PageSourceSearch

https://toolminder.com/pdf.worker.mjs

js toolminder.com collected 2026-10-02 01:47:41 UTC 2,161,149 bytes, 63,133 lines download raw bytes

vendor: 4,284 bytes, lines 1-171
1/**
2 * @licstart The following is the entire license notice for the
3 * JavaScript code in this page
4 *
5 * Copyright 2024 Mozilla Foundation
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 *     http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 *
19 * @licend The above is the entire license notice for the
20 * JavaScript code in this page
21 */
22
23/**
24 * pdfjsVersion = 5.7.284
25 * pdfjsBuild = 7e5b36c2d
26 */
27/******/ // The require scope
28/******/ var __webpack_require__ = {};
29/******/ 
30/************************************************************************/
31/******/ /* webpack/runtime/define property getters */
32/******/ (() => {
33/******/ 	// define getter functions for harmony exports
34/******/ 	__webpack_require__.d = (exports, definition) => {
35/******/ 		for(var key in definition) {
36/******/ 			if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
37/******/ 				Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
38/******/ 			}
39/******/ 		}
40/******/ 	};
41/******/ })();
42/******/ 
43/******/ /* webpack/runtime/hasOwnProperty shorthand */
44/******/ (() => {
45/******/ 	__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
46/******/ })();
47/******/ 
48/************************************************************************/
49
50;// ./src/shared/util.js
51const isNodeJS = typeof process === "object" && process + "" === "[object process]" && !process.versions.nw && !(process.versions.electron && process.type && process.type !== "browser");
52const BBOX_INIT = [Infinity, Infinity, -Infinity, -Infinity];
53const F32_BBOX_INIT = new Float32Array(BBOX_INIT);
54const FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];
55const LINE_FACTOR = 1.35;
56const LINE_DESCENT_FACTOR = 0.35;
57const BASELINE_FACTOR = LINE_DESCENT_FACTOR / LINE_FACTOR;
58const RenderingIntentFlag = {
59  ANY: 0x01,
60  DISPLAY: 0x02,
61  PRINT: 0x04,
62  SAVE: 0x08,
63  ANNOTATIONS_FORMS: 0x10,
64  ANNOTATIONS_STORAGE: 0x20,
65  ANNOTATIONS_DISABLE: 0x40,
66  IS_EDITING: 0x80,
67  OPLIST: 0x100
68};
69const AnnotationMode = {
70  DISABLE: 0,
71  ENABLE: 1,
72  ENABLE_FORMS: 2,
73  ENABLE_STORAGE: 3
74};
75const AnnotationEditorPrefix = "pdfjs_internal_editor_";
76const AnnotationEditorType = {
77  DISABLE: -1,
78  NONE: 0,
79  FREETEXT: 3,
80  HIGHLIGHT: 9,
81  STAMP: 13,
82  INK: 15,
83  POPUP: 16,
84  SIGNATURE: 101,
85  COMMENT: 102
86};
87const AnnotationEditorParamsType = {
88  RESIZE: 1,
89  CREATE: 2,
90  FREETEXT_SIZE: 11,
91  FREETEXT_COLOR: 12,
92  FREETEXT_OPACITY: 13,
93  INK_COLOR: 21,
94  INK_THICKNESS: 22,
95  INK_OPACITY: 23,
96  INK_COLOR_AND_OPACITY: 24,
97  HIGHLIGHT_COLOR: 31,
98  HIGHLIGHT_THICKNESS: 32,
99  HIGHLIGHT_FREE: 33,
100  HIGHLIGHT_SHOW_ALL: 34,
101  DRAW_STEP: 41
102};
103const PermissionFlag = {
104  PRINT: 0x04,
105  MODIFY_CONTENTS: 0x08,
106  COPY: 0x10,
107  MODIFY_ANNOTATIONS: 0x20,
108  FILL_INTERACTIVE_FORMS: 0x100,
109  COPY_FOR_ACCESSIBILITY: 0x200,
110  ASSEMBLE: 0x400,
111  PRINT_HIGH_QUALITY: 0x800
112};
113const MeshFigureType = {
114  TRIANGLES: 1,
115  LATTICE: 2,
116  PATCH: 3
117};
118const TextRenderingMode = {
119  FILL: 0,
120  STROKE: 1,
121  FILL_STROKE: 2,
122  INVISIBLE: 3,
123  FILL_ADD_TO_PATH: 4,
124  STROKE_ADD_TO_PATH: 5,
125  FILL_STROKE_ADD_TO_PATH: 6,
126  ADD_TO_PATH: 7,
127  FILL_STROKE_MASK: 3,
128  ADD_TO_PATH_FLAG: 4
129};
130const ImageKind = {
131  GRAYSCALE_1BPP: 1,
132  RGB_24BPP: 2,
133  RGBA_32BPP: 3
134};
135const AnnotationType = {
136  TEXT: 1,
137  LINK: 2,
138  FREETEXT: 3,
139  LINE: 4,
140  SQUARE: 5,
141  CIRCLE: 6,
142  POLYGON: 7,
143  POLYLINE: 8,
144  HIGHLIGHT: 9,
145  UNDERLINE: 10,
146  SQUIGGLY: 11,
147  STRIKEOUT: 12,
148  STAMP: 13,
149  CARET: 14,
150  INK: 15,
151  POPUP: 16,
152  FILEATTACHMENT: 17,
153  SOUND: 18,
154  MOVIE: 19,
155  WIDGET: 20,
156  SCREEN: 21,
157  PRINTERMARK: 22,
158  TRAPNET: 23,
159  WATERMARK: 24,
160  THREED: 25,
161  REDACT: 26
162};
163const AnnotationReplyType = {
164  GROUP: "Group",
165  REPLY: "R"
166};
167const AnnotationFlag = {
168  INVISIBLE: 0x01,
169  HIDDEN: 0x02,
170  PRINT: 0x04,
171  NOZOOM: 0x08,
172  NOROTATE: 0x10,
173  NOVIEW: 0x20,
174  READONLY: 0x40,
175  LOCKED: 0x80,
176  TOGGLENOVIEW: 0x100,
177  LOCKEDCONTENTS: 0x200
178};
179const AnnotationFieldFlag = {
180  READONLY: 0x0000001,
181  REQUIRED: 0x0000002,
182  NOEXPORT: 0x0000004,
183  MULTILINE: 0x0001000,
184  PASSWORD: 0x0002000,
185  NOTOGGLETOOFF: 0x0004000,
186  RADIO: 0x0008000,
187  PUSHBUTTON: 0x0010000,
188  COMBO: 0x0020000,
189  EDIT: 0x0040000,
190  SORT: 0x0080000,
191  FILESELECT: 0x0100000,
192  MULTISELECT: 0x0200000,
193  DONOTSPELLCHECK: 0x0400000,
194  DONOTSCROLL: 0x0800000,
195  COMB: 0x1000000,
196  RICHTEXT: 0x2000000,
197  RADIOSINUNISON: 0x2000000,
198  COMMITONSELCHANGE: 0x4000000
199};
200const AnnotationBorderStyleType = {
201  SOLID: 1,
202  DASHED: 2,
203  BEVELED: 3,
204  INSET: 4,
205  UNDERLINE: 5
206};
207const AnnotationActionEventType = {
208  E: "Mouse Enter",
209  X: "Mouse Exit",
210  D: "Mouse Down",
211  U: "Mouse Up",
212  Fo: "Focus",
213  Bl: "Blur",
214  PO: "PageOpen",
215  PC: "PageClose",
216  PV: "PageVisible",
217  PI: "PageInvisible",
218  K: "Keystroke",
219  F: "Format",
220  V: "Validate",
221  C: "Calculate"
222};
223const DocumentActionEventType = {
224  WC: "WillClose",
225  WS: "WillSave",
226  DS: "DidSave",
227  WP: "WillPrint",
228  DP: "DidPrint"
229};
230const PageActionEventType = {
231  O: "PageOpen",
232  C: "PageClose"
233}
vendor: 6,037 bytes, lines 233-495
233;
234const VerbosityLevel = {
235  ERRORS: 0,
236  WARNINGS: 1,
237  INFOS: 5
238};
239const OPS = {
240  dependency: 1,
241  setLineWidth: 2,
242  setLineCap: 3,
243  setLineJoin: 4,
244  setMiterLimit: 5,
245  setDash: 6,
246  setRenderingIntent: 7,
247  setFlatness: 8,
248  setGState: 9,
249  save: 10,
250  restore: 11,
251  transform: 12,
252  moveTo: 13,
253  lineTo: 14,
254  curveTo: 15,
255  curveTo2: 16,
256  curveTo3: 17,
257  closePath: 18,
258  rectangle: 19,
259  stroke: 20,
260  closeStroke: 21,
261  fill: 22,
262  eoFill: 23,
263  fillStroke: 24,
264  eoFillStroke: 25,
265  closeFillStroke: 26,
266  closeEOFillStroke: 27,
267  endPath: 28,
268  clip: 29,
269  eoClip: 30,
270  beginText: 31,
271  endText: 32,
272  setCharSpacing: 33,
273  setWordSpacing: 34,
274  setHScale: 35,
275  setLeading: 36,
276  setFont: 37,
277  setTextRenderingMode: 38,
278  setTextRise: 39,
279  moveText: 40,
280  setLeadingMoveText: 41,
281  setTextMatrix: 42,
282  nextLine: 43,
283  showText: 44,
284  showSpacedText: 45,
285  nextLineShowText: 46,
286  nextLineSetSpacingShowText: 47,
287  setCharWidth: 48,
288  setCharWidthAndBounds: 49,
289  setStrokeColorSpace: 50,
290  setFillColorSpace: 51,
291  setStrokeColor: 52,
292  setStrokeColorN: 53,
293  setFillColor: 54,
294  setFillColorN: 55,
295  setStrokeGray: 56,
296  setFillGray: 57,
297  setStrokeRGBColor: 58,
298  setFillRGBColor: 59,
299  setStrokeCMYKColor: 60,
300  setFillCMYKColor: 61,
301  shadingFill: 62,
302  beginInlineImage: 63,
303  beginImageData: 64,
304  endInlineImage: 65,
305  paintXObject: 66,
306  markPoint: 67,
307  markPointProps: 68,
308  beginMarkedContent: 69,
309  beginMarkedContentProps: 70,
310  endMarkedContent: 71,
311  beginCompat: 72,
312  endCompat: 73,
313  paintFormXObjectBegin: 74,
314  paintFormXObjectEnd: 75,
315  beginGroup: 76,
316  endGroup: 77,
317  beginAnnotation: 80,
318  endAnnotation: 81,
319  paintImageMaskXObject: 83,
320  paintImageMaskXObjectGroup: 84,
321  paintImageXObject: 85,
322  paintInlineImageXObject: 86,
323  paintInlineImageXObjectGroup: 87,
324  paintImageXObjectRepeat: 88,
325  paintImageMaskXObjectRepeat: 89,
326  paintSolidColorImageMask: 90,
327  constructPath: 91,
328  setStrokeTransparent: 92,
329  setFillTransparent: 93,
330  rawFillPath: 94
331};
332const DrawOPS = {
333  moveTo: 0,
334  lineTo: 1,
335  curveTo: 2,
336  quadraticCurveTo: 3,
337  closePath: 4
338};
339const PasswordResponses = {
340  NEED_PASSWORD: 1,
341  INCORRECT_PASSWORD: 2
342};
343let verbosity = VerbosityLevel.WARNINGS;
344function setVerbosityLevel(level) {
345  if (Number.isInteger(level)) {
346    verbosity = level;
347  }
348}
349function getVerbosityLevel() {
350  return verbosity;
351}
352function info(msg) {
353  if (verbosity >= VerbosityLevel.INFOS) {
354    console.info(`Info: ${msg}`);
355  }
356}
357function warn(msg) {
358  if (verbosity >= VerbosityLevel.WARNINGS) {
359    console.warn(`Warning: ${msg}`);
360  }
361}
362function unreachable(msg) {
363  throw new Error(msg);
364}
365function assert(cond, msg) {
366  if (!cond) {
367    unreachable(msg);
368  }
369}
370function _isValidProtocol(url) {
371  switch (url?.protocol) {
372    case "http:":
373    case "https:":
374    case "ftp:":
375    case "mailto:":
376    case "tel:":
377      return true;
378    default:
379      return false;
380  }
381}
382function createValidAbsoluteUrl(url, baseUrl = null, options = null) {
383  if (!url) {
384    return null;
385  }
386  if (options && typeof url === "string") {
387    if (options.addDefaultProtocol && url.startsWith("www.")) {
388      const dots = url.match(/\./g);
389      if (dots?.length >= 2) {
390        url = `http://${url}`;
391      }
392    }
393    if (options.tryConvertEncoding) {
394      try {
395        url = stringToUTF8String(url);
396      } catch {}
397    }
398  }
399  const absoluteUrl = baseUrl ? URL.parse(url, baseUrl) : URL.parse(url);
400  return _isValidProtocol(absoluteUrl) ? absoluteUrl : null;
401}
402function updateUrlHash(url, hash, allowRel = false) {
403  const res = URL.parse(url);
404  if (res) {
405    res.hash = hash;
406    return res.href;
407  }
408  if (allowRel && createValidAbsoluteUrl(url, "http://example.com")) {
409    return url.split("#", 1)[0] + `${hash ? `#${hash}` : ""}`;
410  }
411  return "";
412}
413function stripPath(str) {
414  return str.substring(str.lastIndexOf("/") + 1);
415}
416function shadow(obj, prop, value, nonSerializable = false) {
417  Object.defineProperty(obj, prop, {
418    value,
419    enumerable: !nonSerializable,
420    configurable: true,
421    writable: false
422  });
423  return value;
424}
425const BaseException = function BaseExceptionClosure() {
426  function BaseException(message, name) {
427    this.message = message;
428    this.name = name;
429  }
430  BaseException.prototype = new Error();
431  BaseException.constructor = BaseException;
432  return BaseException;
433}();
434class PasswordException extends BaseException {
435  constructor(msg, code) {
436    super(msg, "PasswordException");
437    this.code = code;
438  }
439}
440class UnknownErrorException extends BaseException {
441  constructor(msg, details) {
442    super(msg, "UnknownErrorException");
443    this.details = details;
444  }
445}
446class InvalidPDFException extends BaseException {
447  constructor(msg) {
448    super(msg, "InvalidPDFException");
449  }
450}
451class ResponseException extends BaseException {
452  constructor(msg, status, missing) {
453    super(msg, "ResponseException");
454    this.status = status;
455    this.missing = missing;
456  }
457}
458class FormatError extends BaseException {
459  constructor(msg) {
460    super(msg, "FormatError");
461  }
462}
463class AbortException extends BaseException {
464  constructor(msg) {
465    super(msg, "AbortException");
466  }
467}
468function bytesToString(bytes) {
469  if (typeof bytes !== "object" || bytes?.length === undefined) {
470    unreachable("Invalid argument for bytesToString");
471  }
472  const length = bytes.length;
473  const MAX_ARGUMENT_COUNT = 8192;
474  if (length < MAX_ARGUMENT_COUNT) {
475    return String.fromCharCode.apply(null, bytes);
476  }
477  const strBuf = [];
478  for (let i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
479    const chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
480    const chunk = bytes.subarray(i, chunkEnd);
481    strBuf.push(String.fromCharCode.apply(null, chunk));
482  }
483  return strBuf.join("");
484}
485function stringToBytes(str) {
486  if (typeof str !== "string") {
487    unreachable("Invalid argument for stringToBytes");
488  }
489  const length = str.length;
490  const bytes = new Uint8Array(length);
491  for (let i = 0; i < length; ++i) {
492    bytes[i] = str.charCodeAt(i) & 0xff;
493  }
494  return bytes;
495}
vendor: 14,763 bytes, lines 496-941
496function objectSize(obj) {
497  return Object.keys(obj).length;
498}
499function isLittleEndian() {
500  const buffer8 = new Uint8Array(4);
501  buffer8[0] = 1;
502  const view32 = new Uint32Array(buffer8.buffer, 0, 1);
503  return view32[0] === 1;
504}
505class FeatureTest {
506  static get isLittleEndian() {
507    return shadow(this, "isLittleEndian", isLittleEndian());
508  }
509  static get isOffscreenCanvasSupported() {
510    return shadow(this, "isOffscreenCanvasSupported", typeof OffscreenCanvas !== "undefined");
511  }
512  static get isImageDecoderSupported() {
513    return shadow(this, "isImageDecoderSupported", typeof ImageDecoder !== "undefined");
514  }
515  static get isFloat16ArraySupported() {
516    return shadow(this, "isFloat16ArraySupported", typeof Float16Array !== "undefined");
517  }
518  static get isSanitizerSupported() {
519    return shadow(this, "isSanitizerSupported", typeof Sanitizer !== "undefined");
520  }
521  static get platform() {
522    const {
523      platform,
524      userAgent
525    } = navigator;
526    return shadow(this, "platform", {
527      isAndroid: userAgent.includes("Android"),
528      isLinux: platform.includes("Linux"),
529      isMac: platform.includes("Mac"),
530      isWindows: platform.includes("Win"),
531      isFirefox: userAgent.includes("Firefox")
532    });
533  }
534  static get isCSSRoundSupported() {
535    return shadow(this, "isCSSRoundSupported", globalThis.CSS?.supports?.("width: round(1.5px, 1px)"));
536  }
537  static get isAlphaColorInputSupported() {
538    return shadow(this, "isAlphaColorInputSupported", (() => {
539      if (typeof document === "undefined") {
540        return false;
541      }
542      const input = document.createElement("input");
543      input.type = "color";
544      input.setAttribute("alpha", "");
545      input.value = "#ff000080";
546      return input.value !== "#ff0000";
547    })());
548  }
549}
550class Util {
551  static get hexNums() {
552    return shadow(this, "hexNums", Array.from(Array(256).keys(), n => n.toString(16).padStart(2, "0")));
553  }
554  static makeHexColor(r, g, b) {
555    return `#${this.hexNums[r]}${this.hexNums[g]}${this.hexNums[b]}`;
556  }
557  static domMatrixToTransform(dm) {
558    return [dm.a, dm.b, dm.c, dm.d, dm.e, dm.f];
559  }
560  static scaleMinMax(transform, minMax) {
561    let temp;
562    if (transform[0]) {
563      if (transform[0] < 0) {
564        temp = minMax[0];
565        minMax[0] = minMax[2];
566        minMax[2] = temp;
567      }
568      minMax[0] *= transform[0];
569      minMax[2] *= transform[0];
570      if (transform[3] < 0) {
571        temp = minMax[1];
572        minMax[1] = minMax[3];
573        minMax[3] = temp;
574      }
575      minMax[1] *= transform[3];
576      minMax[3] *= transform[3];
577    } else {
578      temp = minMax[0];
579      minMax[0] = minMax[1];
580      minMax[1] = temp;
581      temp = minMax[2];
582      minMax[2] = minMax[3];
583      minMax[3] = temp;
584      if (transform[1] < 0) {
585        temp = minMax[1];
586        minMax[1] = minMax[3];
587        minMax[3] = temp;
588      }
589      minMax[1] *= transform[1];
590      minMax[3] *= transform[1];
591      if (transform[2] < 0) {
592        temp = minMax[0];
593        minMax[0] = minMax[2];
594        minMax[2] = temp;
595      }
596      minMax[0] *= transform[2];
597      minMax[2] *= transform[2];
598    }
599    minMax[0] += transform[4];
600    minMax[1] += transform[5];
601    minMax[2] += transform[4];
602    minMax[3] += transform[5];
603  }
604  static transform(m1, m2) {
605    return [m1[0] * m2[0] + m1[2] * m2[1], m1[1] * m2[0] + m1[3] * m2[1], m1[0] * m2[2] + m1[2] * m2[3], m1[1] * m2[2] + m1[3] * m2[3], m1[0] * m2[4] + m1[2] * m2[5] + m1[4], m1[1] * m2[4] + m1[3] * m2[5] + m1[5]];
606  }
607  static multiplyByDOMMatrix(m, md) {
608    return [m[0] * md.a + m[2] * md.b, m[1] * md.a + m[3] * md.b, m[0] * md.c + m[2] * md.d, m[1] * md.c + m[3] * md.d, m[0] * md.e + m[2] * md.f + m[4], m[1] * md.e + m[3] * md.f + m[5]];
609  }
610  static applyTransform(p, m, pos = 0) {
611    const p0 = p[pos];
612    const p1 = p[pos + 1];
613    p[pos] = p0 * m[0] + p1 * m[2] + m[4];
614    p[pos + 1] = p0 * m[1] + p1 * m[3] + m[5];
615  }
616  static applyTransformToBezier(p, transform, pos = 0) {
617    const m0 = transform[0];
618    const m1 = transform[1];
619    const m2 = transform[2];
620    const m3 = transform[3];
621    const m4 = transform[4];
622    const m5 = transform[5];
623    for (let i = 0; i < 6; i += 2) {
624      const pI = p[pos + i];
625      const pI1 = p[pos + i + 1];
626      p[pos + i] = pI * m0 + pI1 * m2 + m4;
627      p[pos + i + 1] = pI * m1 + pI1 * m3 + m5;
628    }
629  }
630  static applyInverseTransform(p, m) {
631    const p0 = p[0];
632    const p1 = p[1];
633    const d = m[0] * m[3] - m[1] * m[2];
634    p[0] = (p0 * m[3] - p1 * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
635    p[1] = (-p0 * m[1] + p1 * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
636  }
637  static axialAlignedBoundingBox(rect, transform, output) {
638    const m0 = transform[0];
639    const m1 = transform[1];
640    const m2 = transform[2];
641    const m3 = transform[3];
642    const m4 = transform[4];
643    const m5 = transform[5];
644    const r0 = rect[0];
645    const r1 = rect[1];
646    const r2 = rect[2];
647    const r3 = rect[3];
648    let a0 = m0 * r0 + m4;
649    let a2 = a0;
650    let a1 = m0 * r2 + m4;
651    let a3 = a1;
652    let b0 = m3 * r1 + m5;
653    let b2 = b0;
654    let b1 = m3 * r3 + m5;
655    let b3 = b1;
656    if (m1 !== 0 || m2 !== 0) {
657      const m1r0 = m1 * r0;
658      const m1r2 = m1 * r2;
659      const m2r1 = m2 * r1;
660      const m2r3 = m2 * r3;
661      a0 += m2r1;
662      a3 += m2r1;
663      a1 += m2r3;
664      a2 += m2r3;
665      b0 += m1r0;
666      b3 += m1r0;
667      b1 += m1r2;
668      b2 += m1r2;
669    }
670    output[0] = Math.min(output[0], a0, a1, a2, a3);
671    output[1] = Math.min(output[1], b0, b1, b2, b3);
672    output[2] = Math.max(output[2], a0, a1, a2, a3);
673    output[3] = Math.max(output[3], b0, b1, b2, b3);
674  }
675  static inverseTransform(m) {
676    const d = m[0] * m[3] - m[1] * m[2];
677    return [m[3] / d, -m[1] / d, -m[2] / d, m[0] / d, (m[2] * m[5] - m[4] * m[3]) / d, (m[4] * m[1] - m[5] * m[0]) / d];
678  }
679  static singularValueDecompose2dScale(matrix, output) {
680    const m0 = matrix[0];
681    const m1 = matrix[1];
682    const m2 = matrix[2];
683    const m3 = matrix[3];
684    const a = m0 ** 2 + m1 ** 2;
685    const b = m0 * m2 + m1 * m3;
686    const c = m2 ** 2 + m3 ** 2;
687    const first = (a + c) / 2;
688    const second = Math.sqrt(first ** 2 - (a * c - b ** 2));
689    output[0] = Math.sqrt(first + second || 1);
690    output[1] = Math.sqrt(first - second || 1);
691  }
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  static intersect(rect1, rect2) {
705    const xLow = Math.max(Math.min(rect1[0], rect1[2]), Math.min(rect2[0], rect2[2]));
706    const xHigh = Math.min(Math.max(rect1[0], rect1[2]), Math.max(rect2[0], rect2[2]));
707    if (xLow > xHigh) {
708      return null;
709    }
710    const yLow = Math.max(Math.min(rect1[1], rect1[3]), Math.min(rect2[1], rect2[3]));
711    const yHigh = Math.min(Math.max(rect1[1], rect1[3]), Math.max(rect2[1], rect2[3]));
712    if (yLow > yHigh) {
713      return null;
714    }
715    return [xLow, yLow, xHigh, yHigh];
716  }
717  static pointBoundingBox(x, y, minMax) {
718    minMax[0] = Math.min(minMax[0], x);
719    minMax[1] = Math.min(minMax[1], y);
720    minMax[2] = Math.max(minMax[2], x);
721    minMax[3] = Math.max(minMax[3], y);
722  }
723  static rectBoundingBox(x0, y0, x1, y1, minMax) {
724    minMax[0] = Math.min(minMax[0], x0, x1);
725    minMax[1] = Math.min(minMax[1], y0, y1);
726    minMax[2] = Math.max(minMax[2], x0, x1);
727    minMax[3] = Math.max(minMax[3], y0, y1);
728  }
729  static #getExtremumOnCurve(x0, x1, x2, x3, y0, y1, y2, y3, t, minMax) {
730    if (t <= 0 || t >= 1) {
731      return;
732    }
733    const mt = 1 - t;
734    const tt = t * t;
735    const ttt = tt * t;
736    const x = mt * (mt * (mt * x0 + 3 * t * x1) + 3 * tt * x2) + ttt * x3;
737    const y = mt * (mt * (mt * y0 + 3 * t * y1) + 3 * tt * y2) + ttt * y3;
738    minMax[0] = Math.min(minMax[0], x);
739    minMax[1] = Math.min(minMax[1], y);
740    minMax[2] = Math.max(minMax[2], x);
741    minMax[3] = Math.max(minMax[3], y);
742  }
743  static #getExtremum(x0, x1, x2, x3, y0, y1, y2, y3, a, b, c, minMax) {
744    if (Math.abs(a) < 1e-12) {
745      if (Math.abs(b) >= 1e-12) {
746        this.#getExtremumOnCurve(x0, x1, x2, x3, y0, y1, y2, y3, -c / b, minMax);
747      }
748      return;
749    }
750    const delta = b ** 2 - 4 * c * a;
751    if (delta < 0) {
752      return;
753    }
754    const sqrtDelta = Math.sqrt(delta);
755    const a2 = 2 * a;
756    this.#getExtremumOnCurve(x0, x1, x2, x3, y0, y1, y2, y3, (-b + sqrtDelta) / a2, minMax);
757    this.#getExtremumOnCurve(x0, x1, x2, x3, y0, y1, y2, y3, (-b - sqrtDelta) / a2, minMax);
758  }
759  static bezierBoundingBox(x0, y0, x1, y1, x2, y2, x3, y3, minMax) {
760    minMax[0] = Math.min(minMax[0], x0, x3);
761    minMax[1] = Math.min(minMax[1], y0, y3);
762    minMax[2] = Math.max(minMax[2], x0, x3);
763    minMax[3] = Math.max(minMax[3], y0, y3);
764    this.#getExtremum(x0, x1, x2, x3, y0, y1, y2, y3, 3 * (-x0 + 3 * (x1 - x2) + x3), 6 * (x0 - 2 * x1 + x2), 3 * (x1 - x0), minMax);
765    this.#getExtremum(x0, x1, x2, x3, y0, y1, y2, y3, 3 * (-y0 + 3 * (y1 - y2) + y3), 6 * (y0 - 2 * y1 + y2), 3 * (y1 - y0), minMax);
766  }
767}
768const PDFStringTranslateTable = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2d8, 0x2c7, 0x2c6, 0x2d9, 0x2dd, 0x2db, 0x2da, 0x2dc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2022, 0x2020, 0x2021, 0x2026, 0x2014, 0x2013, 0x192, 0x2044, 0x2039, 0x203a, 0x2212, 0x2030, 0x201e, 0x201c, 0x201d, 0x2018, 0x2019, 0x201a, 0x2122, 0xfb01, 0xfb02, 0x141, 0x152, 0x160, 0x178, 0x17d, 0x131, 0x142, 0x153, 0x161, 0x17e, 0, 0x20ac];
769function stringToPDFString(str, keepEscapeSequence = false) {
770  if (str[0] >= "\xEF") {
771    let encoding;
772    if (str[0] === "\xFE" && str[1] === "\xFF") {
773      encoding = "utf-16be";
774      if (str.length % 2 === 1) {
775        str = str.slice(0, -1);
776      }
777    } else if (str[0] === "\xFF" && str[1] === "\xFE") {
778      encoding = "utf-16le";
779      if (str.length % 2 === 1) {
780        str = str.slice(0, -1);
781      }
782    } else if (str[0] === "\xEF" && str[1] === "\xBB" && str[2] === "\xBF") {
783      encoding = "utf-8";
784    }
785    if (encoding) {
786      try {
787        const decoder = new TextDecoder(encoding, {
788          fatal: true
789        });
790        const buffer = stringToBytes(str);
791        const decoded = decoder.decode(buffer);
792        if (keepEscapeSequence || !decoded.includes("\x1b")) {
793          return decoded;
794        }
795        return decoded.replaceAll(/\x1b[^\x1b]*(?:\x1b|$)/g, "");
796      } catch (ex) {
797        warn(`stringToPDFString: "${ex}".`);
798      }
799    }
800  }
801  const strBuf = [];
802  for (let i = 0, ii = str.length; i < ii; i++) {
803    const charCode = str.charCodeAt(i);
804    if (!keepEscapeSequence && charCode === 0x1b) {
805      while (++i < ii && str.charCodeAt(i) !== 0x1b) {}
806      continue;
807    }
808    const code = PDFStringTranslateTable[charCode];
809    strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));
810  }
811  return strBuf.join("");
812}
813function stringToUTF8String(str) {
814  return decodeURIComponent(escape(str));
815}
816function utf8StringToString(str) {
817  return unescape(encodeURIComponent(str));
818}
819function isArrayEqual(arr1, arr2) {
820  if (arr1.length !== arr2.length) {
821    return false;
822  }
823  for (let i = 0, ii = arr1.length; i < ii; i++) {
824    if (arr1[i] !== arr2[i]) {
825      return false;
826    }
827  }
828  return true;
829}
830function getModificationDate(date = new Date()) {
831  if (!(date instanceof Date)) {
832    date = new Date(date);
833  }
834  const buffer = [date.getUTCFullYear().toString(), (date.getUTCMonth() + 1).toString().padStart(2, "0"), date.getUTCDate().toString().padStart(2, "0"), date.getUTCHours().toString().padStart(2, "0"), date.getUTCMinutes().toString().padStart(2, "0"), date.getUTCSeconds().toString().padStart(2, "0")];
835  return buffer.join("");
836}
837let NormalizeRegex = null;
838let NormalizationMap = null;
839function normalizeUnicode(str) {
840  if (!NormalizeRegex) {
841    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;
842    NormalizationMap = new Map([["ſt", "ſt"]]);
843  }
844  return str.replaceAll(NormalizeRegex, (_, p1, p2) => p1 ? p1.normalize("NFKC") : NormalizationMap.get(p2));
845}
846function getUuid() {
847  if (typeof crypto.randomUUID === "function") {
848    return crypto.randomUUID();
849  }
850  const buf = new Uint8Array(32);
851  crypto.getRandomValues(buf);
852  return bytesToString(buf);
853}
854const AnnotationPrefix = "pdfjs_internal_id_";
855function _isValidExplicitDest(validRef, validName, dest) {
856  if (!Array.isArray(dest) || dest.length < 2) {
857    return false;
858  }
859  const [page, zoom, ...args] = dest;
860  if (!validRef(page) && !Number.isInteger(page)) {
861    return false;
862  }
863  if (!validName(zoom)) {
864    return false;
865  }
866  const argsLen = args.length;
867  let allowNull = true;
868  switch (zoom.name) {
869    case "XYZ":
870      if (argsLen < 2 || argsLen > 3) {
871        return false;
872      }
873      break;
874    case "Fit":
875    case "FitB":
876      return argsLen === 0;
877    case "FitH":
878    case "FitBH":
879    case "FitV":
880    case "FitBV":
881      if (argsLen > 1) {
882        return false;
883      }
884      break;
885    case "FitR":
886      if (argsLen !== 4) {
887        return false;
888      }
889      allowNull = false;
890      break;
891    default:
892      return false;
893  }
894  for (const arg of args) {
895    if (typeof arg === "number" || allowNull && arg === null) {
896      continue;
897    }
898    return false;
899  }
900  return true;
901}
902const makeArr = () => [];
903const makeMap = () => new Map();
904const makeObj = () => Object.create(null);
905
906;// ./src/core/primitives.js
907
908const CIRCULAR_REF = Symbol("CIRCULAR_REF");
909const EOF = Symbol("EOF");
910let CmdCache = Object.create(null);
911let NameCache = Object.create(null);
912let RefCache = Object.create(null);
913function clearPrimitiveCaches() {
914  CmdCache = Object.create(null);
915  NameCache = Object.create(null);
916  RefCache = Object.create(null);
917}
918class Name {
919  constructor(name) {
920    this.name = name;
921  }
922  static get(name) {
923    return NameCache[name] ||= new Name(name);
924  }
925}
926class Cmd {
927  constructor(cmd) {
928    this.cmd = cmd;
929  }
930  static get(cmd) {
931    return CmdCache[cmd] ||= new Cmd(cmd);
932  }
933}
934const nonSerializable = function nonSerializableClosure() {
935  return nonSerializable;
936};
937class Dict {
938  __nonSerializable__ = nonSerializable;
939  #map = new Map();
940  objId = null;
941  suppressEncryption = false;
942  xref;
943  constructor(xref = null) {
944    this.xref = xref;
945  }
946  assignXref(newXref) {
947    this.xref = newXref;
948  }
949  get size() {
950    return this.#map.size;
951  }
952  #getValue(isAsync, key1, key2, key3) {
953    let value = this.#map.get(key1);
954    if (value === undefined && key2 !== undefined) {
955      value = this.#map.get(key2);
956      if (value === undefined && key3 !== undefined) {
957        value = this.#map.get(key3);
958      }
959    }
960    if (value instanceof Ref && this.xref) {
961      return isAsync ? this.xref.fetchAsync(value, this.suppressEncryption) : this.xref.fetch(value, this.suppressEncryption);
962    }
963    return value;
964  }
965  get(key1, key2, key3) {
966    return this.#getValue(false, key1, key2, key3);
967  }
968  async getAsync(key1, key2, key3) {
969    return this.#getValue(true, key1, key2, key3);
970  }
971  getArray(key1, key2, key3) {
972    let value = this.#getValue(false, key1, key2, key3);
973    if (Array.isArray(value)) {
974      value = value.slice();
975      for (let i = 0, ii = value.length; i < ii; i++) {
976        if (value[i] instanceof Ref && this.xref) {
977          value[i] = this.xref.fetch(value[i], this.suppressEncryption);
978        }
979      }
980    }
981    return value;
982  }
983  getRaw(key) {
984    return this.#map.get(key);
985  }
986  getKeys() {
987    return this.#map.keys();
988  }
989  getRawValues() {
990    return this.#map.values();
991  }
992  getRawEntries() {
993    return this.#map.entries();
994  }
995  set(key, value) {
996    this.#map.set(key, value);
997  }
998  setIfNotExists(key, value) {
999    if (!this.has(key)) {
1000      this.set(key, value);
1001    }
1002  }
1003  setIfNumber(key, value) {
1004    if (typeof value === "number") {
1005      this.set(key, value);
1006    }
1007  }
1008  setIfArray(key, value) {
1009    if (Array.isArray(value) || ArrayBuffer.isView(value)) {
1010      this.set(key, value);
1011    }
1012  }
1013  setIfDefined(key, value) {
1014    if (value !== undefined && value !== null) {
1015      this.set(key, value);
1016    }
1017  }
1018  setIfName(key, value) {
1019    if (typeof value === "string") {
1020      this.set(key, Name.get(value));
1021    } else if (value instanceof Name) {
1022      this.set(key, value);
1023    }
1024  }
1025  setIfDict(key, value) {
1026    if (value instanceof Dict) {
1027      this.set(key, value);
1028    }
1029  }
1030  has(key) {
1031    return this.#map.has(key);
1032  }
1033  *[Symbol.iterator]() {
1034    for (const [key, value] of this.#map) {
1035      yield [key, value instanceof Ref && this.xref ? this.xref.fetch(value, this.suppressEncryption) : value];
1036    }
1037  }
1038  static get empty() {
1039    const emptyDict = new Dict(null);
1040    emptyDict.set = (key, value) => {
1041      unreachable("Should not call `set` on the empty dictionary.");
1042    };
1043    return shadow(this, "empty", emptyDict);
1044  }
1045  static merge({
1046    xref,
1047    dictArray,
1048    mergeSubDicts = false
1049  }) {
1050    const mergedDict = new Dict(xref),
1051      properties = new Map();
1052    for (const dict of dictArray) {
1053      if (!(dict instanceof Dict)) {
1054        continue;
1055      }
1056      for (const [key, value] of dict.getRawEntries()) {
1057        let property = properties.get(key);
1058        if (property === undefined) {
1059          property = [];
1060          properties.set(key, property);
1061        } else if (!mergeSubDicts || !(value instanceof Dict)) {
1062          continue;
1063        }
1064        property.push(value);
1065      }
1066    }
1067    for (const [name, values] of properties) {
1068      if (values.length === 1 || !(values[0] instanceof Dict)) {
1069        mergedDict.set(name, values[0]);
1070        continue;
1071      }
1072      const subDict = new Dict(xref);
1073      for (const dict of values) {
1074        for (const [key, value] of dict.getRawEntries()) {
1075          subDict.setIfNotExists(key, value);
1076        }
1077      }
1078      if (subDict.size > 0) {
1079        mergedDict.set(name, subDict);
1080      }
1081    }
1082    properties.clear();
1083    return mergedDict.size > 0 ? mergedDict : Dict.empty;
1084  }
1085  clone() {
1086    const dict = new Dict(this.xref);
1087    for (const [key, value] of this.#map) {
1088      dict.set(key, value);
1089    }
1090    return dict;
1091  }
1092  delete(key) {
1093    this.#map.delete(key);
1094  }
1095}
1096class Ref {
1097  constructor(num, gen) {
1098    this.num = num;
1099    this.gen = gen;
1100  }
1101  toString() {
1102    if (this.gen === 0) {
1103      return `${this.num}R`;
1104    }
1105    return `${this.num}R${this.gen}`;
1106  }
1107  static fromString(str) {
1108    const ref = RefCache[str];
1109    if (ref) {
1110      return ref;
1111    }
1112    const m = /^(\d+)R(\d*)$/.exec(str);
1113    if (!m || m[1] === "0") {
1114      return null;
1115    }
1116    return RefCache[str] = new Ref(parseInt(m[1], 10), !m[2] ? 0 : parseInt(m[2], 10));
1117  }
1118  static get(num, gen) {
vendor: 4,590 bytes, lines 1119-1318
1119    const key = gen === 0 ? `${num}R` : `${num}R${gen}`;
1120    return RefCache[key] ||= new Ref(num, gen);
1121  }
1122}
1123class RefSet {
1124  constructor(parent = null) {
1125    this._set = new Set(parent?._set);
1126  }
1127  has(ref) {
1128    return this._set.has(ref.toString());
1129  }
1130  put(ref) {
1131    this._set.add(ref.toString());
1132  }
1133  remove(ref) {
1134    this._set.delete(ref.toString());
1135  }
1136  [Symbol.iterator]() {
1137    return this._set.values();
1138  }
1139  clear() {
1140    this._set.clear();
1141  }
1142}
1143class RefSetCache {
1144  _map = new Map();
1145  get size() {
1146    return this._map.size;
1147  }
1148  get(ref) {
1149    return this._map.get(ref.toString());
1150  }
1151  has(ref) {
1152    return this._map.has(ref.toString());
1153  }
1154  put(ref, obj) {
1155    this._map.set(ref.toString(), obj);
1156  }
1157  putAlias(ref, aliasRef) {
1158    this._map.set(ref.toString(), this.get(aliasRef));
1159  }
1160  [Symbol.iterator]() {
1161    return this._map.values();
1162  }
1163  clear() {
1164    this._map.clear();
1165  }
1166  *values() {
1167    yield* this._map.values();
1168  }
1169  *items() {
1170    for (const [ref, value] of this._map) {
1171      yield [Ref.fromString(ref), value];
1172    }
1173  }
1174  *keys() {
1175    for (const ref of this._map.keys()) {
1176      yield Ref.fromString(ref);
1177    }
1178  }
1179}
1180function isName(v, name) {
1181  return v instanceof Name && (name === undefined || v.name === name);
1182}
1183function isCmd(v, cmd) {
1184  return v instanceof Cmd && (cmd === undefined || v.cmd === cmd);
1185}
1186function isDict(v, type) {
1187  return v instanceof Dict && (type === undefined || isName(v.get("Type"), type));
1188}
1189function isRefsEqual(v1, v2) {
1190  return v1.num === v2.num && v1.gen === v2.gen;
1191}
1192
1193;// ./src/core/base_stream.js
1194
1195class BaseStream {
1196  get length() {
1197    unreachable("Abstract getter `length` accessed");
1198  }
1199  get isEmpty() {
1200    unreachable("Abstract getter `isEmpty` accessed");
1201  }
1202  get isDataLoaded() {
1203    return shadow(this, "isDataLoaded", true);
1204  }
1205  getByte() {
1206    unreachable("Abstract method `getByte` called");
1207  }
1208  getBytes(length) {
1209    unreachable("Abstract method `getBytes` called");
1210  }
1211  async getImageData(length, decoderOptions) {
1212    return this.getBytes(length, decoderOptions);
1213  }
1214  async asyncGetBytes() {
1215    unreachable("Abstract method `asyncGetBytes` called");
1216  }
1217  get isAsync() {
1218    return false;
1219  }
1220  get isAsyncDecoder() {
1221    return false;
1222  }
1223  get isImageStream() {
1224    return false;
1225  }
1226  get canAsyncDecodeImageFromBuffer() {
1227    return false;
1228  }
1229  async getTransferableImage() {
1230    return null;
1231  }
1232  peekByte() {
1233    const peekedByte = this.getByte();
1234    if (peekedByte !== -1) {
1235      this.pos--;
1236    }
1237    return peekedByte;
1238  }
1239  peekBytes(length) {
1240    const bytes = this.getBytes(length);
1241    this.pos -= bytes.length;
1242    return bytes;
1243  }
1244  getUint16() {
1245    const b0 = this.getByte();
1246    const b1 = this.getByte();
1247    if (b0 === -1 || b1 === -1) {
1248      return -1;
1249    }
1250    return (b0 << 8) + b1;
1251  }
1252  getInt32() {
1253    const b0 = this.getByte();
1254    const b1 = this.getByte();
1255    const b2 = this.getByte();
1256    const b3 = this.getByte();
1257    return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
1258  }
1259  getByteRange(begin, end) {
1260    unreachable("Abstract method `getByteRange` called");
1261  }
1262  getString(length) {
1263    return bytesToString(this.getBytes(length));
1264  }
1265  skip(n) {
1266    this.pos += n || 1;
1267  }
1268  reset() {
1269    unreachable("Abstract method `reset` called");
1270  }
1271  moveStart() {
1272    unreachable("Abstract method `moveStart` called");
1273  }
1274  makeSubStream(start, length, dict = null) {
1275    unreachable("Abstract method `makeSubStream` called");
1276  }
1277  getBaseStreams() {
1278    return null;
1279  }
1280  getOriginalStream() {
1281    return this.stream?.getOriginalStream() || this;
1282  }
1283}
1284
1285;// ./src/core/core_utils.js
1286
1287
1288
1289const PDF_VERSION_REGEXP = /^[1-9]\.\d$/;
1290const MAX_INT_32 = 2 ** 31 - 1;
1291const IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
1292const RESOURCES_KEYS_OPERATOR_LIST = ["ColorSpace", "ExtGState", "Font", "Pattern", "Properties", "Shading", "XObject"];
1293const RESOURCES_KEYS_TEXT_CONTENT = ["ExtGState", "Font", "Properties", "XObject"];
1294function getLookupTableFactory(initializer) {
1295  let lookup;
1296  return function () {
1297    if (initializer) {
1298      lookup = Object.create(null);
1299      initializer(lookup);
1300      initializer = null;
1301    }
1302    return lookup;
1303  };
1304}
1305class MissingDataException extends BaseException {
1306  constructor(begin, end) {
1307    super(`Missing data [${begin}, ${end})`, "MissingDataException");
1308    this.begin = begin;
1309    this.end = end;
1310  }
1311}
1312class ParserEOFException extends BaseException {
1313  constructor(msg) {
1314    super(msg, "ParserEOFException");
1315  }
1316}
1317class XRefEntryException extends BaseException {
1318  constructor(msg) {
vendor: 8,727 bytes, lines 1319-1637
1319    super(msg, "XRefEntryException");
1320  }
1321}
1322class XRefParseException extends BaseException {
1323  constructor(msg) {
1324    super(msg, "XRefParseException");
1325  }
1326}
1327function arrayBuffersToBytes(arr) {
1328  const length = arr.length;
1329  if (length === 0) {
1330    return new Uint8Array(0);
1331  }
1332  if (length === 1) {
1333    return new Uint8Array(arr[0]);
1334  }
1335  let dataLength = 0;
1336  for (let i = 0; i < length; i++) {
1337    dataLength += arr[i].byteLength;
1338  }
1339  const data = new Uint8Array(dataLength);
1340  let pos = 0;
1341  for (let i = 0; i < length; i++) {
1342    const item = new Uint8Array(arr[i]);
1343    data.set(item, pos);
1344    pos += item.byteLength;
1345  }
1346  return data;
1347}
1348async function fetchBinaryData(url) {
1349  const response = await fetch(url);
1350  if (!response.ok) {
1351    throw new Error(`Failed to fetch file "${url}" with "${response.statusText}".`);
1352  }
1353  return response.bytes();
1354}
1355function getInheritableProperty({
1356  dict,
1357  key,
1358  getArray = false,
1359  stopWhenFound = true
1360}) {
1361  let values;
1362  const visited = new RefSet();
1363  while (dict instanceof Dict && !(dict.objId && visited.has(dict.objId))) {
1364    if (dict.objId) {
1365      visited.put(dict.objId);
1366    }
1367    const value = getArray ? dict.getArray(key) : dict.get(key);
1368    if (value !== undefined) {
1369      if (stopWhenFound) {
1370        return value;
1371      }
1372      (values ||= []).push(value);
1373    }
1374    dict = dict.get("Parent");
1375  }
1376  return values;
1377}
1378function getParentToUpdate(dict, ref, xref) {
1379  const visited = new RefSet();
1380  const firstDict = dict;
1381  const result = {
1382    dict: null,
1383    ref: null
1384  };
1385  while (dict instanceof Dict && !visited.has(ref)) {
1386    visited.put(ref);
1387    if (dict.has("T")) {
1388      break;
1389    }
1390    ref = dict.getRaw("Parent");
1391    if (!(ref instanceof Ref)) {
1392      return result;
1393    }
1394    dict = xref.fetch(ref);
1395  }
1396  if (dict instanceof Dict && dict !== firstDict) {
1397    result.dict = dict;
1398    result.ref = ref;
1399  }
1400  return result;
1401}
1402function deepCompare(a, b) {
1403  if (a === b) {
1404    return true;
1405  }
1406  if (a instanceof Dict && b instanceof Dict) {
1407    if (a.size !== b.size) {
1408      return false;
1409    }
1410    for (const [key, value1] of a.getRawEntries()) {
1411      const value2 = b.getRaw(key);
1412      if (value2 === undefined || !deepCompare(value1, value2)) {
1413        return false;
1414      }
1415    }
1416    return true;
1417  }
1418  if (Array.isArray(a) && Array.isArray(b)) {
1419    if (a.length !== b.length) {
1420      return false;
1421    }
1422    for (let i = 0, ii = a.length; i < ii; i++) {
1423      if (!deepCompare(a[i], b[i])) {
1424        return false;
1425      }
1426    }
1427    return true;
1428  }
1429  return false;
1430}
1431const ROMAN_NUMBER_MAP = ["", "C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM", "", "X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC", "", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX"];
1432function toRomanNumerals(number, lowerCase = false) {
1433  assert(Number.isInteger(number) && number > 0, "The number should be a positive integer.");
1434  const roman = "M".repeat(number / 1000 | 0) + ROMAN_NUMBER_MAP[number % 1000 / 100 | 0] + ROMAN_NUMBER_MAP[10 + (number % 100 / 10 | 0)] + ROMAN_NUMBER_MAP[20 + number % 10];
1435  return lowerCase ? roman.toLowerCase() : roman;
1436}
1437function isWhiteSpace(ch) {
1438  return ch === 0x20 || ch === 0x09 || ch === 0x0d || ch === 0x0a;
1439}
1440function isBooleanArray(arr, len) {
1441  return Array.isArray(arr) && (len === null || arr.length === len) && arr.every(x => typeof x === "boolean");
1442}
1443function isNumberArray(arr, len) {
1444  if (Array.isArray(arr)) {
1445    return (len === null || arr.length === len) && arr.every(x => typeof x === "number");
1446  }
1447  return ArrayBuffer.isView(arr) && !(arr instanceof BigInt64Array || arr instanceof BigUint64Array) && (len === null || arr.length === len);
1448}
1449function lookupMatrix(arr, fallback) {
1450  return isNumberArray(arr, 6) ? arr : fallback;
1451}
1452function lookupRect(arr, fallback) {
1453  return isNumberArray(arr, 4) ? arr : fallback;
1454}
1455function lookupNormalRect(arr, fallback) {
1456  return isNumberArray(arr, 4) ? Util.normalizeRect(arr) : fallback;
1457}
1458function parseXFAPath(path) {
1459  const positionPattern = /(.+)\[(\d+)\]$/;
1460  return path.split(".").map(component => {
1461    const m = component.match(positionPattern);
1462    if (m) {
1463      return {
1464        name: m[1],
1465        pos: parseInt(m[2], 10)
1466      };
1467    }
1468    return {
1469      name: component,
1470      pos: 0
1471    };
1472  });
1473}
1474function escapePDFName(str) {
1475  const buffer = [];
1476  let start = 0;
1477  for (let i = 0, ii = str.length; i < ii; i++) {
1478    const char = str.charCodeAt(i);
1479    if (char < 0x21 || char > 0x7e || char === 0x23 || char === 0x28 || char === 0x29 || char === 0x3c || char === 0x3e || char === 0x5b || char === 0x5d || char === 0x7b || char === 0x7d || char === 0x2f || char === 0x25) {
1480      if (start < i) {
1481        buffer.push(str.substring(start, i));
1482      }
1483      buffer.push(`#${char.toString(16)}`);
1484      start = i + 1;
1485    }
1486  }
1487  if (buffer.length === 0) {
1488    return str;
1489  }
1490  if (start < str.length) {
1491    buffer.push(str.substring(start, str.length));
1492  }
1493  return buffer.join("");
1494}
1495function escapeString(str) {
1496  return str.replaceAll(/([()\\\n\r])/g, match => {
1497    if (match === "\n") {
1498      return "\\n";
1499    } else if (match === "\r") {
1500      return "\\r";
1501    }
1502    return `\\${match}`;
1503  });
1504}
1505function _collectJS(entry, xref, list, parents) {
1506  if (!entry) {
1507    return;
1508  }
1509  let parent = null;
1510  if (entry instanceof Ref) {
1511    if (parents.has(entry)) {
1512      return;
1513    }
1514    parent = entry;
1515    parents.put(parent);
1516    entry = xref.fetch(entry);
1517  }
1518  if (Array.isArray(entry)) {
1519    for (const element of entry) {
1520      _collectJS(element, xref, list, parents);
1521    }
1522  } else if (entry instanceof Dict) {
1523    if (isName(entry.get("S"), "JavaScript")) {
1524      const js = entry.get("JS");
1525      let code;
1526      if (js instanceof BaseStream) {
1527        code = js.getString();
1528      } else if (typeof js === "string") {
1529        code = js;
1530      }
1531      code &&= stringToPDFString(code, true).replaceAll("\x00", "");
1532      if (code) {
1533        list.push(code.trim());
1534      }
1535    }
1536    _collectJS(entry.getRaw("Next"), xref, list, parents);
1537  }
1538  if (parent) {
1539    parents.remove(parent);
1540  }
1541}
1542function collectActions(xref, dict, eventType) {
1543  const actions = Object.create(null);
1544  const additionalActionsDicts = getInheritableProperty({
1545    dict,
1546    key: "AA",
1547    stopWhenFound: false
1548  });
1549  if (additionalActionsDicts) {
1550    for (let i = additionalActionsDicts.length - 1; i >= 0; i--) {
1551      const additionalActions = additionalActionsDicts[i];
1552      if (!(additionalActions instanceof Dict)) {
1553        continue;
1554      }
1555      for (const [key, rawActionDict] of additionalActions.getRawEntries()) {
1556        const action = eventType[key];
1557        if (!action) {
1558          continue;
1559        }
1560        const parents = new RefSet();
1561        const list = [];
1562        _collectJS(rawActionDict, xref, list, parents);
1563        if (list.length > 0) {
1564          actions[action] = list;
1565        }
1566      }
1567    }
1568  }
1569  if (dict.has("A")) {
1570    const actionDict = dict.get("A");
1571    const parents = new RefSet();
1572    const list = [];
1573    _collectJS(actionDict, xref, list, parents);
1574    if (list.length > 0) {
1575      actions.Action = list;
1576    }
1577  }
1578  return objectSize(actions) > 0 ? actions : null;
1579}
1580const XMLEntities = {
1581  0x3c: "&lt;",
1582  0x3e: "&gt;",
1583  0x26: "&amp;",
1584  0x22: "&quot;",
1585  0x27: "&apos;"
1586};
1587function* codePointIter(str) {
1588  for (let i = 0, ii = str.length; i < ii; i++) {
1589    const char = str.codePointAt(i);
1590    if (char > 0xd7ff && (char < 0xe000 || char > 0xfffd)) {
1591      i++;
1592    }
1593    yield char;
1594  }
1595}
1596function encodeToXmlString(str) {
1597  const buffer = [];
1598  let start = 0;
1599  for (let i = 0, ii = str.length; i < ii; i++) {
1600    const char = str.codePointAt(i);
1601    if (0x20 <= char && char <= 0x7e) {
1602      const entity = XMLEntities[char];
1603      if (entity) {
1604        if (start < i) {
1605          buffer.push(str.substring(start, i));
1606        }
1607        buffer.push(entity);
1608        start = i + 1;
1609      }
1610    } else {
1611      if (start < i) {
1612        buffer.push(str.substring(start, i));
1613      }
1614      buffer.push(`&#x${char.toString(16).toUpperCase()};`);
1615      if (char > 0xd7ff && (char < 0xe000 || char > 0xfffd)) {
1616        i++;
1617      }
1618      start = i + 1;
1619    }
1620  }
1621  if (buffer.length === 0) {
1622    return str;
1623  }
1624  if (start < str.length) {
1625    buffer.push(str.substring(start, str.length));
1626  }
1627  return buffer.join("");
1628}
1629function validateFontName(fontFamily, mustWarn = false) {
1630  const m = /^("|').*("|')$/.exec(fontFamily);
1631  if (m && m[1] === m[2]) {
1632    const re = new RegExp(`[^\\\\]${m[1]}`);
1633    if (re.test(fontFamily.slice(1, -1))) {
1634      if (mustWarn) {
1635        warn(`FontFamily contains unescaped ${m[1]}: ${fontFamily}.`);
1636      }
1637      return false;
vendor: 4,214 bytes, lines 1638-1781
1638    }
1639  } else {
1640    for (const ident of fontFamily.split(/[ \t]+/)) {
1641      if (/^(\d|(-(\d|-)))/.test(ident) || !/^[\w-\\]+$/.test(ident)) {
1642        if (mustWarn) {
1643          warn(`FontFamily contains invalid <custom-ident>: ${fontFamily}.`);
1644        }
1645        return false;
1646      }
1647    }
1648  }
1649  return true;
1650}
1651function validateCSSFont(cssFontInfo) {
1652  const DEFAULT_CSS_FONT_OBLIQUE = "14";
1653  const DEFAULT_CSS_FONT_WEIGHT = "400";
1654  const CSS_FONT_WEIGHT_VALUES = new Set(["100", "200", "300", "400", "500", "600", "700", "800", "900", "1000", "normal", "bold", "bolder", "lighter"]);
1655  const {
1656    fontFamily,
1657    fontWeight,
1658    italicAngle
1659  } = cssFontInfo;
1660  if (!validateFontName(fontFamily, true)) {
1661    return false;
1662  }
1663  const weight = fontWeight ? fontWeight.toString() : "";
1664  cssFontInfo.fontWeight = CSS_FONT_WEIGHT_VALUES.has(weight) ? weight : DEFAULT_CSS_FONT_WEIGHT;
1665  const angle = parseFloat(italicAngle);
1666  cssFontInfo.italicAngle = isNaN(angle) || angle < -90 || angle > 90 ? DEFAULT_CSS_FONT_OBLIQUE : italicAngle.toString();
1667  return true;
1668}
1669function recoverJsURL(str) {
1670  const URL_OPEN_METHODS = ["app.launchURL", "window.open", "xfa.host.gotoURL"];
1671  const regex = new RegExp("^\\s*(" + URL_OPEN_METHODS.join("|").replaceAll(".", "\\.") + ")\\((?:'|\")([^'\"]*)(?:'|\")(?:,\\s*(\\w+)\\)|\\))", "i");
1672  const jsUrl = regex.exec(str);
1673  if (jsUrl?.[2]) {
1674    return {
1675      url: jsUrl[2],
1676      newWindow: jsUrl[1] === "app.launchURL" && jsUrl[3] === "true"
1677    };
1678  }
1679  return null;
1680}
1681function numberToString(value) {
1682  if (Number.isInteger(value)) {
1683    return value.toString();
1684  }
1685  const roundedValue = Math.round(value * 100);
1686  if (roundedValue % 100 === 0) {
1687    return (roundedValue / 100).toString();
1688  }
1689  if (roundedValue % 10 === 0) {
1690    return value.toFixed(1);
1691  }
1692  return value.toFixed(2);
1693}
1694function getNewAnnotationsMap(annotationStorage) {
1695  if (!annotationStorage) {
1696    return null;
1697  }
1698  const newAnnotationsByPage = new Map();
1699  for (const [key, value] of annotationStorage) {
1700    if (!key.startsWith(AnnotationEditorPrefix)) {
1701      continue;
1702    }
1703    newAnnotationsByPage.getOrInsertComputed(value.pageIndex, makeArr).push(value);
1704  }
1705  return newAnnotationsByPage.size > 0 ? newAnnotationsByPage : null;
1706}
1707function stringToAsciiOrUTF16BE(str) {
1708  if (str === null || str === undefined) {
1709    return str;
1710  }
1711  return isAscii(str) ? str : stringToUTF16String(str, true);
1712}
1713function isAscii(str) {
1714  if (typeof str !== "string") {
1715    return false;
1716  }
1717  return !str || /^[\x00-\x7F]*$/.test(str);
1718}
1719function stringToUTF16HexString(str) {
1720  const buf = [];
1721  for (let i = 0, ii = str.length; i < ii; i++) {
1722    const char = str.charCodeAt(i);
1723    buf.push(Util.hexNums[char >> 8 & 0xff], Util.hexNums[char & 0xff]);
1724  }
1725  return buf.join("");
1726}
1727function stringToUTF16String(str, bigEndian = false) {
1728  const buf = [];
1729  if (bigEndian) {
1730    buf.push("\xFE\xFF");
1731  }
1732  for (let i = 0, ii = str.length; i < ii; i++) {
1733    const char = str.charCodeAt(i);
1734    buf.push(String.fromCharCode(char >> 8 & 0xff), String.fromCharCode(char & 0xff));
1735  }
1736  return buf.join("");
1737}
1738function getRotationMatrix(rotation, width, height) {
1739  switch (rotation) {
1740    case 90:
1741      return [0, 1, -1, 0, width, 0];
1742    case 180:
1743      return [-1, 0, 0, -1, width, height];
1744    case 270:
1745      return [0, -1, 1, 0, 0, height];
1746    default:
1747      throw new Error("Invalid rotation");
1748  }
1749}
1750function getSizeInBytes(x) {
1751  return Math.ceil(Math.ceil(Math.log2(1 + x)) / 8);
1752}
1753
1754;// ./external/qcms/qcms_utils.js
1755class QCMS {
1756  static #memoryArray = null;
1757  static _memory = null;
1758  static _mustAddAlpha = false;
1759  static _destBuffer = null;
1760  static _destOffset = 0;
1761  static _destLength = 0;
1762  static _cssColor = "";
1763  static _makeHexColor = null;
1764  static get _memoryArray() {
1765    const array = this.#memoryArray;
1766    if (array?.byteLength) {
1767      return array;
1768    }
1769    return this.#memoryArray = new Uint8Array(this._memory.buffer);
1770  }
1771}
1772function copy_result(ptr, len) {
1773  const {
1774    _mustAddAlpha,
1775    _destBuffer,
1776    _destOffset,
1777    _destLength,
1778    _memoryArray
1779  } = QCMS;
1780  if (len === _destLength) {
1781    _destBuffer.set(_memoryArray.subarray(ptr, ptr + len), _destOff
1781set);
1782    return;
1783  }
1784  if (_mustAddAlpha) {
1785    for (let i = ptr, ii = ptr + len, j = _destOffset; i < ii; i += 3, j += 4) {
1786      _destBuffer[j] = _memoryArray[i];
1787      _destBuffer[j + 1] = _memoryArray[i + 1];
1788      _destBuffer[j + 2] = _memoryArray[i + 2];
1789      _destBuffer[j + 3] = 255;
1790    }
1791  } else {
1792    for (let i = ptr, ii = ptr + len, j = _destOffset; i < ii; i += 3, j += 4) {
1793      _destBuffer[j] = _memoryArray[i];
1794      _destBuffer[j + 1] = _memoryArray[i + 1];
1795      _destBuffer[j + 2] = _memoryArray[i + 2];
1796    }
1797  }
1798}
1799function copy_rgb(ptr) {
1800  const {
1801    _destBuffer,
1802    _destOffset,
1803    _memoryArray
1804  } = QCMS;
1805  _destBuffer[_destOffset] = _memoryArray[ptr];
1806  _destBuffer[_destOffset + 1] = _memoryArray[ptr + 1];
1807  _destBuffer[_destOffset + 2] = _memoryArray[ptr + 2];
1808}
1809function make_cssRGB(ptr) {
1810  const {
1811    _memoryArray
1812  } = QCMS;
1813  QCMS._cssColor = QCMS._makeHexColor(_memoryArray[ptr], _memoryArray[ptr + 1], _memoryArray[ptr + 2]);
1814}
1815
1816;// ./external/qcms/qcms.js
1817
1818const DataType = Object.freeze({
1819  RGB8: 0,
1820  "0": "RGB8",
1821  RGBA8: 1,
1822  "1": "RGBA8",
1823  BGRA8: 2,
1824  "2": "BGRA8",
1825  Gray8: 3,
1826  "3": "Gray8",
1827  GrayA8: 4,
1828  "4": "GrayA8",
1829  CMYK: 5,
1830  "5": "CMYK"
1831});
1832const Intent = Object.freeze({
1833  Perceptual: 0,
1834  "0": "Perceptual",
1835  RelativeColorimetric: 1,
1836  "1": "RelativeColorimetric",
1837  Saturation: 2,
1838  "2": "Saturation",
1839  AbsoluteColorimetric: 3,
1840  "3": "AbsoluteColorimetric"
1841});
1842function qcms_convert_array(transformer, src) {
1843  const ptr0 = passArray8ToWasm0(src, wasm.__wbindgen_malloc);
1844  const len0 = WASM_VECTOR_LEN;
1845  wasm.qcms_convert_array(transformer, ptr0, len0);
1846}
1847function qcms_convert_four(transformer, src1, src2, src3, src4, css) {
1848  wasm.qcms_convert_four(transformer, src1, src2, src3, src4, css);
1849}
1850function qcms_convert_one(transformer, src, css) {
1851  wasm.qcms_convert_one(transformer, src, css);
1852}
1853function qcms_convert_three(transformer, src1, src2, src3, css) {
1854  wasm.qcms_convert_three(transformer, src1, src2, src3, css);
1855}
1856function qcms_drop_transformer(transformer) {
1857  wasm.qcms_drop_transformer(transformer);
1858}
1859function qcms_transformer_from_memory(mem, in_type, intent) {
1860  const ptr0 = passArray8ToWasm0(mem, wasm.__wbindgen_malloc);
1861  const len0 = WASM_VECTOR_LEN;
1862  const ret = wasm.qcms_transformer_from_memory(ptr0, len0, in_type, intent);
1863  return ret >>> 0;
1864}
1865function __wbg_get_imports() {
1866  const import0 = {
1867    __proto__: null,
1868    __wbg___wbindgen_throw_6b64449b9b9ed33c: function (arg0, arg1) {
1869      throw new Error(getStringFromWasm0(arg0, arg1));
1870    },
1871    __wbg_copy_result_0d15f3bf9d9012ae: function (arg0, arg1) {
1872      copy_result(arg0 >>> 0, arg1 >>> 0);
1873    },
1874    __wbg_copy_rgb_0106d9d9464fce43: function (arg0) {
1875      copy_rgb(arg0 >>> 0);
1876    },
1877    __wbg_make_cssRGB_8e24b34f71f5363e: function (arg0) {
1878      make_cssRGB(arg0 >>> 0);
1879    },
1880    __wbindgen_init_externref_table: function () {
1881      const table = wasm.__wbindgen_externrefs;
1882      const offset = table.grow(4);
1883      table.set(0, undefined);
1884      table.set(offset + 0, undefined);
1885      table.set(offset + 1, null);
1886      table.set(offset + 2, true);
1887      table.set(offset + 3, false);
1888    }
1889  };
1890  return {
1891    __proto__: null,
1892    "./qcms_bg.js": import0
1893  };
1894}
1895function getStringFromWasm0(ptr, len) {
1896  ptr = ptr >>> 0;
1897  return decodeText(ptr, len);
1898}
1899let cachedUint8ArrayMemory0 = null;
1900function getUint8ArrayMemory0() {
1901  if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
1902    cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
1903  }
1904  return cachedUint8ArrayMemory0;
1905}
1906function passArray8ToWasm0(arg, malloc) {
1907  const ptr = malloc(arg.length * 1, 1) >>> 0;
1908  getUint8ArrayMemory0().set(arg, ptr / 1);
1909  WASM_VECTOR_LEN = arg.length;
1910  return ptr;
1911}
1912let cachedTextDecoder = new TextDecoder('utf-8', {
1913  ignoreBOM: true,
1914  fatal: true
1915});
1916cachedTextDecoder.decode();
1917const MAX_SAFARI_DECODE_BYTES = 2146435072;
1918let numBytesDecoded = 0;
1919function decodeText(ptr, len) {
1920  numBytesDecoded += len;
1921  if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
1922    cachedTextDecoder = new TextDecoder('utf-8', {
1923      ignoreBOM: true,
1924      fatal: true
1925    });
1926    cachedTextDecoder.decode();
1927    numBytesDecoded = len;
1928  }
1929  return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
1930}
1931let WASM_VECTOR_LEN = 0;
1932let wasmModule, wasm;
1933function __wbg_finalize_init(instance, module) {
vendor: 6,337 bytes, lines 1933-2136
1933
1934  wasm = instance.exports;
1935  wasmModule = module;
1936  cachedUint8ArrayMemory0 = null;
1937  wasm.__wbindgen_start();
1938  return wasm;
1939}
1940async function __wbg_load(module, imports) {
1941  if (typeof Response === 'function' && module instanceof Response) {
1942    if (typeof WebAssembly.instantiateStreaming === 'function') {
1943      try {
1944        return await WebAssembly.instantiateStreaming(module, imports);
1945      } catch (e) {
1946        const validResponse = module.ok && expectedResponseType(module.type);
1947        if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
1948          console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
1949        } else {
1950          throw e;
1951        }
1952      }
1953    }
1954    const bytes = await module.arrayBuffer();
1955    return await WebAssembly.instantiate(bytes, imports);
1956  } else {
1957    const instance = await WebAssembly.instantiate(module, imports);
1958    if (instance instanceof WebAssembly.Instance) {
1959      return {
1960        instance,
1961        module
1962      };
1963    } else {
1964      return instance;
1965    }
1966  }
1967  function expectedResponseType(type) {
1968    switch (type) {
1969      case 'basic':
1970      case 'cors':
1971      case 'default':
1972        return true;
1973    }
1974    return false;
1975  }
1976}
1977function initSync(module) {
1978  if (wasm !== undefined) return wasm;
1979  if (module !== undefined) {
1980    if (Object.getPrototypeOf(module) === Object.prototype) {
1981      ({
1982        module
1983      } = module);
1984    } else {
1985      console.warn('using deprecated parameters for `initSync()`; pass a single object instead');
1986    }
1987  }
1988  const imports = __wbg_get_imports();
1989  if (!(module instanceof WebAssembly.Module)) {
1990    module = new WebAssembly.Module(module);
1991  }
1992  const instance = new WebAssembly.Instance(module, imports);
1993  return __wbg_finalize_init(instance, module);
1994}
1995async function __wbg_init(module_or_path) {
1996  if (wasm !== undefined) return wasm;
1997  if (module_or_path !== undefined) {
1998    if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
1999      ({
2000        module_or_path
2001      } = module_or_path);
2002    } else {
2003      console.warn('using deprecated parameters for the initialization function; pass a single object instead');
2004    }
2005  }
2006  const imports = __wbg_get_imports();
2007  if (typeof module_or_path === 'string' || typeof Request === 'function' && module_or_path instanceof Request || typeof URL === 'function' && module_or_path instanceof URL) {
2008    module_or_path = fetch(module_or_path);
2009  }
2010  const {
2011    instance,
2012    module
2013  } = await __wbg_load(await module_or_path, imports);
2014  return __wbg_finalize_init(instance, module);
2015}
2016
2017;// ./src/shared/math_clamp.js
2018function MathClamp(v, min, max) {
2019  return Math.min(Math.max(v, min), max);
2020}
2021
2022;// ./src/core/colorspace.js
2023
2024
2025
2026function resizeRgbImage(src, dest, w1, h1, w2, h2, alpha01) {
2027  const COMPONENTS = 3;
2028  alpha01 = alpha01 !== 1 ? 0 : alpha01;
2029  const xRatio = w1 / w2;
2030  const yRatio = h1 / h2;
2031  let newIndex = 0,
2032    oldIndex;
2033  const xScaled = new Uint16Array(w2);
2034  const w1Scanline = w1 * COMPONENTS;
2035  for (let i = 0; i < w2; i++) {
2036    xScaled[i] = Math.floor(i * xRatio) * COMPONENTS;
2037  }
2038  for (let i = 0; i < h2; i++) {
2039    const py = Math.floor(i * yRatio) * w1Scanline;
2040    for (let j = 0; j < w2; j++) {
2041      oldIndex = py + xScaled[j];
2042      dest[newIndex++] = src[oldIndex++];
2043      dest[newIndex++] = src[oldIndex++];
2044      dest[newIndex++] = src[oldIndex++];
2045      newIndex += alpha01;
2046    }
2047  }
2048}
2049function resizeRgbaImage(src, dest, w1, h1, w2, h2, alpha01) {
2050  const xRatio = w1 / w2;
2051  const yRatio = h1 / h2;
2052  let newIndex = 0;
2053  const xScaled = new Uint16Array(w2);
2054  if (alpha01 === 1) {
2055    for (let i = 0; i < w2; i++) {
2056      xScaled[i] = Math.floor(i * xRatio);
2057    }
2058    const src32 = new Uint32Array(src.buffer);
2059    const dest32 = new Uint32Array(dest.buffer);
2060    const rgbMask = FeatureTest.isLittleEndian ? 0x00ffffff : 0xffffff00;
2061    for (let i = 0; i < h2; i++) {
2062      const buf = src32.subarray(Math.floor(i * yRatio) * w1);
2063      for (let j = 0; j < w2; j++) {
2064        dest32[newIndex++] |= buf[xScaled[j]] & rgbMask;
2065      }
2066    }
2067  } else {
2068    const COMPONENTS = 4;
2069    const w1Scanline = w1 * COMPONENTS;
2070    for (let i = 0; i < w2; i++) {
2071      xScaled[i] = Math.floor(i * xRatio) * COMPONENTS;
2072    }
2073    for (let i = 0; i < h2; i++) {
2074      const buf = src.subarray(Math.floor(i * yRatio) * w1Scanline);
2075      for (let j = 0; j < w2; j++) {
2076        const oldIndex = xScaled[j];
2077        dest[newIndex++] = buf[oldIndex];
2078        dest[newIndex++] = buf[oldIndex + 1];
2079        dest[newIndex++] = buf[oldIndex + 2];
2080      }
2081    }
2082  }
2083}
2084function copyRgbaImage(src, dest, alpha01) {
2085  if (alpha01 === 1) {
2086    const src32 = new Uint32Array(src.buffer);
2087    const dest32 = new Uint32Array(dest.buffer);
2088    const rgbMask = FeatureTest.isLittleEndian ? 0x00ffffff : 0xffffff00;
2089    for (let i = 0, ii = src32.length; i < ii; i++) {
2090      dest32[i] |= src32[i] & rgbMask;
2091    }
2092  } else {
2093    let j = 0;
2094    for (let i = 0, ii = src.length; i < ii; i += 4) {
2095      dest[j++] = src[i];
2096      dest[j++] = src[i + 1];
2097      dest[j++] = src[i + 2];
2098    }
2099  }
2100}
2101function isDefaultDecodeHelper(decode, expectedLen) {
2102  if (!Array.isArray(decode)) {
2103    return true;
2104  }
2105  const decodeLen = decode.length;
2106  if (decodeLen < expectedLen) {
2107    warn("Decode map length is too short.");
2108    return true;
2109  }
2110  if (decodeLen > expectedLen) {
2111    info("Truncating too long decode map.");
2112    decode.length = expectedLen;
2113  }
2114  return false;
2115}
2116class ColorSpace {
2117  static #rgbBuf = new Uint8ClampedArray(3);
2118  constructor(name, numComps) {
2119    this.name = name;
2120    this.numComps = numComps;
2121  }
2122  getRgb(src, srcOffset, output = new Uint8ClampedArray(3)) {
2123    this.getRgbItem(src, srcOffset, output, 0);
2124    return output;
2125  }
2126  getRgbHex(src, srcOffset) {
2127    const buffer = this.getRgb(src, srcOffset, ColorSpace.#rgbBuf);
2128    return Util.makeHexColor(buffer[0], buffer[1], buffer[2]);
2129  }
2130  getRgbItem(src, srcOffset, dest, destOffset) {
2131    unreachable("Should not call ColorSpace.getRgbItem");
2132  }
2133  getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
2134    unreachable("Should not call ColorSpace.getRgbBuffer");
2135  }
2136  get
vendor: 3,544 bytes, lines 2136-2232
2136OutputLength(inputLength, alpha01) {
2137    unreachable("Should not call ColorSpace.getOutputLength");
2138  }
2139  isPassthrough(bits) {
2140    return false;
2141  }
2142  isDefaultDecode(decode, bpc) {
2143    return ColorSpace.isDefaultDecode(decode, this.numComps);
2144  }
2145  fillRgb(dest, originalWidth, originalHeight, width, height, actualHeight, bpc, comps, alpha01) {
2146    const count = originalWidth * originalHeight;
2147    let rgbBuf = null;
2148    const numComponentColors = 1 << bpc;
2149    const needsResizing = originalHeight !== height || originalWidth !== width;
2150    if (this.isPassthrough(bpc)) {
2151      rgbBuf = comps;
2152    } else if (this.numComps === 1 && count > numComponentColors && this.name !== "DeviceGray" && this.name !== "DeviceRGB") {
2153      const allColors = bpc <= 8 ? new Uint8Array(numComponentColors) : new Uint16Array(numComponentColors);
2154      for (let i = 0; i < numComponentColors; i++) {
2155        allColors[i] = i;
2156      }
2157      const colorMap = new Uint8ClampedArray(numComponentColors * 3);
2158      this.getRgbBuffer(allColors, 0, numComponentColors, colorMap, 0, bpc, 0);
2159      if (!needsResizing) {
2160        let destPos = 0;
2161        for (let i = 0; i < count; ++i) {
2162          const key = comps[i] * 3;
2163          dest[destPos++] = colorMap[key];
2164          dest[destPos++] = colorMap[key + 1];
2165          dest[destPos++] = colorMap[key + 2];
2166          destPos += alpha01;
2167        }
2168      } else {
2169        rgbBuf = new Uint8Array(count * 3);
2170        let rgbPos = 0;
2171        for (let i = 0; i < count; ++i) {
2172          const key = comps[i] * 3;
2173          rgbBuf[rgbPos++] = colorMap[key];
2174          rgbBuf[rgbPos++] = colorMap[key + 1];
2175          rgbBuf[rgbPos++] = colorMap[key + 2];
2176        }
2177      }
2178    } else if (!needsResizing) {
2179      this.getRgbBuffer(comps, 0, width * actualHeight, dest, 0, bpc, alpha01);
2180    } else {
2181      rgbBuf = new Uint8ClampedArray(count * 3);
2182      this.getRgbBuffer(comps, 0, count, rgbBuf, 0, bpc, 0);
2183    }
2184    if (rgbBuf) {
2185      if (needsResizing) {
2186        resizeRgbImage(rgbBuf, dest, originalWidth, originalHeight, width, height, alpha01);
2187      } else {
2188        let destPos = 0,
2189          rgbPos = 0;
2190        for (let i = 0, ii = width * actualHeight; i < ii; i++) {
2191          dest[destPos++] = rgbBuf[rgbPos++];
2192          dest[destPos++] = rgbBuf[rgbPos++];
2193          dest[destPos++] = rgbBuf[rgbPos++];
2194          destPos += alpha01;
2195        }
2196      }
2197    }
2198  }
2199  get usesZeroToOneRange() {
2200    return shadow(this, "usesZeroToOneRange", true);
2201  }
2202  static isDefaultDecode(decode, numComps) {
2203    if (isDefaultDecodeHelper(decode, numComps * 2)) {
2204      return true;
2205    }
2206    for (let i = 0, ii = decode.length; i < ii; i += 2) {
2207      if (decode[i] !== 0 || decode[i + 1] !== 1) {
2208        return false;
2209      }
2210    }
2211    return true;
2212  }
2213}
2214class AlternateCS extends ColorSpace {
2215  constructor(numComps, base, tintFn) {
2216    super("Alternate", numComps);
2217    this.base = base;
2218    this.tintFn = tintFn;
2219    this.tmpBuf = new Float32Array(base.numComps);
2220  }
2221  getRgbItem(src, srcOffset, dest, destOffset) {
2222    const tmpBuf = this.tmpBuf;
2223    this.tintFn(src, srcOffset, tmpBuf, 0);
2224    this.base.getRgbItem(tmpBuf, 0, dest, destOffset);
2225  }
2226  getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
2227    const tintFn = this.tintFn;
2228    const base = this.base;
2229    const scale = 1 / ((1 << bits) - 1);
2230    const baseNumComps = base.numComps;
2231    const usesZeroToOneRange = base.usesZeroToOneRange;
2232    const isPassthrough = (base.isPassthrough(8) || !usesZeroToOneRange) && alpha01 === 0;
vendor: 28,840 bytes, lines 2233-3085
2233    let pos = isPassthrough ? destOffset : 0;
2234    const baseBuf = isPassthrough ? dest : new Uint8ClampedArray(baseNumComps * count);
2235    const numComps = this.numComps;
2236    const scaled = new Float32Array(numComps);
2237    const tinted = new Float32Array(baseNumComps);
2238    let i, j;
2239    for (i = 0; i < count; i++) {
2240      for (j = 0; j < numComps; j++) {
2241        scaled[j] = src[srcOffset++] * scale;
2242      }
2243      tintFn(scaled, 0, tinted, 0);
2244      if (usesZeroToOneRange) {
2245        for (j = 0; j < baseNumComps; j++) {
2246          baseBuf[pos++] = tinted[j] * 255;
2247        }
2248      } else {
2249        base.getRgbItem(tinted, 0, baseBuf, pos);
2250        pos += baseNumComps;
2251      }
2252    }
2253    if (!isPassthrough) {
2254      base.getRgbBuffer(baseBuf, 0, count, dest, destOffset, 8, alpha01);
2255    }
2256  }
2257  getOutputLength(inputLength, alpha01) {
2258    return this.base.getOutputLength(inputLength * this.base.numComps / this.numComps, alpha01);
2259  }
2260}
2261class PatternCS extends ColorSpace {
2262  constructor(baseCS) {
2263    super("Pattern", null);
2264    this.base = baseCS;
2265  }
2266  isDefaultDecode(decode, bpc) {
2267    unreachable("Should not call PatternCS.isDefaultDecode");
2268  }
2269}
2270class IndexedCS extends ColorSpace {
2271  constructor(base, highVal, lookup) {
2272    super("Indexed", 1);
2273    this.base = base;
2274    this.highVal = highVal;
2275    const length = base.numComps * (highVal + 1);
2276    this.lookup = new Uint8Array(length);
2277    if (lookup instanceof BaseStream) {
2278      const bytes = lookup.getBytes(length);
2279      this.lookup.set(bytes);
2280    } else if (typeof lookup === "string") {
2281      for (let i = 0; i < length; ++i) {
2282        this.lookup[i] = lookup.charCodeAt(i) & 0xff;
2283      }
2284    } else {
2285      throw new FormatError(`IndexedCS - unrecognized lookup table: ${lookup}`);
2286    }
2287  }
2288  getRgbItem(src, srcOffset, dest, destOffset) {
2289    const {
2290      base,
2291      highVal,
2292      lookup
2293    } = this;
2294    const start = MathClamp(Math.round(src[srcOffset]), 0, highVal) * base.numComps;
2295    base.getRgbBuffer(lookup, start, 1, dest, destOffset, 8, 0);
2296  }
2297  getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
2298    const {
2299      base,
2300      highVal,
2301      lookup
2302    } = this;
2303    const {
2304      numComps
2305    } = base;
2306    const outputDelta = base.getOutputLength(numComps, alpha01);
2307    for (let i = 0; i < count; ++i) {
2308      const lookupPos = MathClamp(Math.round(src[srcOffset++]), 0, highVal) * numComps;
2309      base.getRgbBuffer(lookup, lookupPos, 1, dest, destOffset, 8, alpha01);
2310      destOffset += outputDelta;
2311    }
2312  }
2313  getOutputLength(inputLength, alpha01) {
2314    return this.base.getOutputLength(inputLength * this.base.numComps, alpha01);
2315  }
2316  isDefaultDecode(decode, bpc) {
2317    if (isDefaultDecodeHelper(decode, 2)) {
2318      return true;
2319    }
2320    if (!Number.isInteger(bpc) || bpc < 1) {
2321      warn("Bits per component is not correct");
2322      return true;
2323    }
2324    return decode[0] === 0 && decode[1] === (1 << bpc) - 1;
2325  }
2326}
2327class DeviceGrayCS extends ColorSpace {
2328  constructor() {
2329    super("DeviceGray", 1);
2330  }
2331  getRgbItem(src, srcOffset, dest, destOffset) {
2332    const c = src[srcOffset] * 255;
2333    dest[destOffset] = dest[destOffset + 1] = dest[destOffset + 2] = c;
2334  }
2335  getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
2336    const scale = 255 / ((1 << bits) - 1);
2337    let j = srcOffset,
2338      q = destOffset;
2339    for (let i = 0; i < count; ++i) {
2340      const c = scale * src[j++];
2341      dest[q++] = c;
2342      dest[q++] = c;
2343      dest[q++] = c;
2344      q += alpha01;
2345    }
2346  }
2347  getOutputLength(inputLength, alpha01) {
2348    return inputLength * (3 + alpha01);
2349  }
2350}
2351class DeviceRgbCS extends ColorSpace {
2352  constructor() {
2353    super("DeviceRGB", 3);
2354  }
2355  getRgbItem(src, srcOffset, dest, destOffset) {
2356    dest[destOffset] = src[srcOffset] * 255;
2357    dest[destOffset + 1] = src[srcOffset + 1] * 255;
2358    dest[destOffset + 2] = src[srcOffset + 2] * 255;
2359  }
2360  getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
2361    if (bits === 8 && alpha01 === 0) {
2362      dest.set(src.subarray(srcOffset, srcOffset + count * 3), destOffset);
2363      return;
2364    }
2365    const scale = 255 / ((1 << bits) - 1);
2366    let j = srcOffset,
2367      q = destOffset;
2368    for (let i = 0; i < count; ++i) {
2369      dest[q++] = scale * src[j++];
2370      dest[q++] = scale * src[j++];
2371      dest[q++] = scale * src[j++];
2372      q += alpha01;
2373    }
2374  }
2375  getOutputLength(inputLength, alpha01) {
2376    return inputLength * (3 + alpha01) / 3 | 0;
2377  }
2378  isPassthrough(bits) {
2379    return bits === 8;
2380  }
2381}
2382class DeviceRgbaCS extends ColorSpace {
2383  constructor() {
2384    super("DeviceRGBA", 4);
2385  }
2386  getOutputLength(inputLength, _alpha01) {
2387    return inputLength * 4;
2388  }
2389  isPassthrough(bits) {
2390    return bits === 8;
2391  }
2392  fillRgb(dest, originalWidth, originalHeight, width, height, actualHeight, bpc, comps, alpha01) {
2393    if (originalHeight !== height || originalWidth !== width) {
2394      resizeRgbaImage(comps, dest, originalWidth, originalHeight, width, height, alpha01);
2395    } else {
2396      copyRgbaImage(comps, dest, alpha01);
2397    }
2398  }
2399}
2400class DeviceCmykCS extends ColorSpace {
2401  constructor() {
2402    super("DeviceCMYK", 4);
2403  }
2404  #toRgb(src, srcOffset, srcScale, dest, destOffset) {
2405    const c = src[srcOffset] * srcScale;
2406    const m = src[srcOffset + 1] * srcScale;
2407    const y = src[srcOffset + 2] * srcScale;
2408    const k = src[srcOffset + 3] * srcScale;
2409    dest[destOffset] = 255 + c * (-4.387332384609988 * c + 54.48615194189176 * m + 18.82290502165302 * y + 212.25662451639585 * k + -285.2331026137004) + m * (1.7149763477362134 * m - 5.6096736904047315 * y + -17.873870861415444 * k - 5.497006427196366) + y * (-2.5217340131683033 * y - 21.248923337353073 * k + 17.5119270841813) + k * (-21.86122147463605 * k - 189.48180835922747);
2410    dest[destOffset + 1] = 255 + c * (8.841041422036149 * c + 60.118027045597366 * m + 6.871425592049007 * y + 31.159100130055922 * k + -79.2970844816548) + m * (-15.310361306967817 * m + 17.575251261109482 * y + 131.35250912493976 * k - 190.9453302588951) + y * (4.444339102852739 * y + 9.8632861493405 * k - 24.86741582555878) + k * (-20.737325471181034 * k - 187.80453709719578);
2411    dest[destOffset + 2] = 255 + c * (0.8842522430003296 * c + 8.078677503112928 * m + 30.89978309703729 * y - 0.23883238689178934 * k + -14.183576799673286) + m * (10.49593273432072 * m + 63.02378494754052 * y + 50.606957656360734 * k - 112.23884253719248) + y * (0.03296041114873217 * y + 115.60384449646641 * k + -193.58209356861505) + k * (-22.33816807309886 * k - 180.12613974708367);
2412  }
2413  getRgbItem(src, srcOffset, dest, destOffset) {
2414    this.#toRgb(src, srcOffset, 1, dest, destOffset);
2415  }
2416  getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
2417    const scale = 1 / ((1 << bits) - 1);
2418    for (let i = 0; i < count; i++) {
2419      this.#toRgb(src, srcOffset, scale, dest, destOffset);
2420      srcOffset += 4;
2421      destOffset += 3 + alpha01;
2422    }
2423  }
2424  getOutputLength(inputLength, alpha01) {
2425    return inputLength / 4 * (3 + alpha01) | 0;
2426  }
2427}
2428class CalGrayCS extends ColorSpace {
2429  constructor(whitePoint, blackPoint, gamma) {
2430    super("CalGray", 1);
2431    if (!whitePoint) {
2432      throw new FormatError("WhitePoint missing - required for color space CalGray");
2433    }
2434    [this.XW, this.YW, this.ZW] = whitePoint;
2435    [this.XB, this.YB, this.ZB] = blackPoint || [0, 0, 0];
2436    this.G = gamma || 1;
2437    if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
2438      throw new FormatError(`Invalid WhitePoint components for ${this.name}, no fallback available`);
2439    }
2440    if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
2441      info(`Invalid BlackPoint for ${this.name}, falling back to default.`);
2442      this.XB = this.YB = this.ZB = 0;
2443    }
2444    if (this.XB !== 0 || this.YB !== 0 || this.ZB !== 0) {
2445      warn(`${this.name}, BlackPoint: XB: ${this.XB}, YB: ${this.YB}, ` + `ZB: ${this.ZB}, only default values are supported.`);
2446    }
2447    if (this.G < 1) {
2448      info(`Invalid Gamma: ${this.G} for ${this.name}, falling back to default.`);
2449      this.G = 1;
2450    }
2451  }
2452  #toRgb(src, srcOffset, dest, destOffset, scale) {
2453    const A = src[srcOffset] * scale;
2454    const AG = A ** this.G;
2455    const L = this.YW * AG;
2456    const val = Math.max(295.8 * L ** 0.3333333333333333 - 40.8, 0);
2457    dest[destOffset] = val;
2458    dest[destOffset + 1] = val;
2459    dest[destOffset + 2] = val;
2460  }
2461  getRgbItem(src, srcOffset, dest, destOffset) {
2462    this.#toRgb(src, srcOffset, dest, destOffset, 1);
2463  }
2464  getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
2465    const scale = 1 / ((1 << bits) - 1);
2466    for (let i = 0; i < count; ++i) {
2467      this.#toRgb(src, srcOffset, dest, destOffset, scale);
2468      srcOffset += 1;
2469      destOffset += 3 + alpha01;
2470    }
2471  }
2472  getOutputLength(inputLength, alpha01) {
2473    return inputLength * (3 + alpha01);
2474  }
2475}
2476class CalRGBCS extends ColorSpace {
2477  static #BRADFORD_SCALE_MATRIX = new Float32Array([0.8951, 0.2664, -0.1614, -0.7502, 1.7135, 0.0367, 0.0389, -0.0685, 1.0296]);
2478  static #BRADFORD_SCALE_INVERSE_MATRIX = new Float32Array([0.9869929, -0.1470543, 0.1599627, 0.4323053, 0.5183603, 0.0492912, -0.0085287, 0.0400428, 0.9684867]);
2479  static #SRGB_D65_XYZ_TO_RGB_MATRIX = new Float32Array([3.2404542, -1.5371385, -0.4985314, -0.9692660, 1.8760108, 0.0415560, 0.0556434, -0.2040259, 1.0572252]);
2480  static #FLAT_WHITEPOINT_MATRIX = new Float32Array([1, 1, 1]);
2481  static #tempNormalizeMatrix = new Float32Array(3);
2482  static #tempConvertMatrix1 = new Float32Array(3);
2483  static #tempConvertMatrix2 = new Float32Array(3);
2484  static #DECODE_L_CONSTANT = ((8 + 16) / 116) ** 3 / 8.0;
2485  constructor(whitePoint, blackPoint, gamma, matrix) {
2486    super("CalRGB", 3);
2487    if (!whitePoint) {
2488      throw new FormatError("WhitePoint missing - required for color space CalRGB");
2489    }
2490    const [XW, YW, ZW] = this.whitePoint = whitePoint;
2491    const [XB, YB, ZB] = this.blackPoint = blackPoint || new Float32Array(3);
2492    [this.GR, this.GG, this.GB] = gamma || new Float32Array([1, 1, 1]);
2493    [this.MXA, this.MYA, this.MZA, this.MXB, this.MYB, this.MZB, this.MXC, this.MYC, this.MZC] = matrix || new Float32Array([1, 0, 0, 0, 1, 0, 0, 0, 1]);
2494    if (XW < 0 || ZW < 0 || YW !== 1) {
2495      throw new FormatError(`Invalid WhitePoint components for ${this.name}, no fallback available`);
2496    }
2497    if (XB < 0 || YB < 0 || ZB < 0) {
2498      info(`Invalid BlackPoint for ${this.name} [${XB}, ${YB}, ${ZB}], ` + "falling back to default.");
2499      this.blackPoint = new Float32Array(3);
2500    }
2501    if (this.GR < 0 || this.GG < 0 || this.GB < 0) {
2502      info(`Invalid Gamma [${this.GR}, ${this.GG}, ${this.GB}] for ` + `${this.name}, falling back to default.`);
2503      this.GR = this.GG = this.GB = 1;
2504    }
2505  }
2506  #matrixProduct(a, b, result) {
2507    result[0] = a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
2508    result[1] = a[3] * b[0] + a[4] * b[1] + a[5] * b[2];
2509    result[2] = a[6] * b[0] + a[7] * b[1] + a[8] * b[2];
2510  }
2511  #toFlat(sourceWhitePoint, LMS, result) {
2512    result[0] = LMS[0] * 1 / sourceWhitePoint[0];
2513    result[1] = LMS[1] * 1 / sourceWhitePoint[1];
2514    result[2] = LMS[2] * 1 / sourceWhitePoint[2];
2515  }
2516  #toD65(sourceWhitePoint, LMS, result) {
2517    const D65X = 0.95047;
2518    const D65Y = 1;
2519    const D65Z = 1.08883;
2520    result[0] = LMS[0] * D65X / sourceWhitePoint[0];
2521    result[1] = LMS[1] * D65Y / sourceWhitePoint[1];
2522    result[2] = LMS[2] * D65Z / sourceWhitePoint[2];
2523  }
2524  #sRGBTransferFunction(color) {
2525    if (color <= 0.0031308) {
2526      return MathClamp(12.92 * color, 0, 1);
2527    }
2528    if (color >= 0.99554525) {
2529      return 1;
2530    }
2531    return MathClamp((1 + 0.055) * color ** (1 / 2.4) - 0.055, 0, 1);
2532  }
2533  #decodeL(L) {
2534    if (L < 0) {
2535      return -this.#decodeL(-L);
2536    }
2537    if (L > 8.0) {
2538      return ((L + 16) / 116) ** 3;
2539    }
2540    return L * CalRGBCS.#DECODE_L_CONSTANT;
2541  }
2542  #compensateBlackPoint(sourceBlackPoint, XYZ_Flat, result) {
2543    if (sourceBlackPoint[0] === 0 && sourceBlackPoint[1] === 0 && sourceBlackPoint[2] === 0) {
2544      result[0] = XYZ_Flat[0];
2545      result[1] = XYZ_Flat[1];
2546      result[2] = XYZ_Flat[2];
2547      return;
2548    }
2549    const zeroDecodeL = this.#decodeL(0);
2550    const X_DST = zeroDecodeL;
2551    const X_SRC = this.#decodeL(sourceBlackPoint[0]);
2552    const Y_DST = zeroDecodeL;
2553    const Y_SRC = this.#decodeL(sourceBlackPoint[1]);
2554    const Z_DST = zeroDecodeL;
2555    const Z_SRC = this.#decodeL(sourceBlackPoint[2]);
2556    const X_Scale = (1 - X_DST) / (1 - X_SRC);
2557    const X_Offset = 1 - X_Scale;
2558    const Y_Scale = (1 - Y_DST) / (1 - Y_SRC);
2559    const Y_Offset = 1 - Y_Scale;
2560    const Z_Scale = (1 - Z_DST) / (1 - Z_SRC);
2561    const Z_Offset = 1 - Z_Scale;
2562    result[0] = XYZ_Flat[0] * X_Scale + X_Offset;
2563    result[1] = XYZ_Flat[1] * Y_Scale + Y_Offset;
2564    result[2] = XYZ_Flat[2] * Z_Scale + Z_Offset;
2565  }
2566  #normalizeWhitePointToFlat(sourceWhitePoint, XYZ_In, result) {
2567    if (sourceWhitePoint[0] === 1 && sourceWhitePoint[2] === 1) {
2568      result[0] = XYZ_In[0];
2569      result[1] = XYZ_In[1];
2570      result[2] = XYZ_In[2];
2571      return;
2572    }
2573    const LMS = result;
2574    this.#matrixProduct(CalRGBCS.#BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
2575    const LMS_Flat = CalRGBCS.#tempNormalizeMatrix;
2576    this.#toFlat(sourceWhitePoint, LMS, LMS_Flat);
2577    this.#matrixProduct(CalRGBCS.#BRADFORD_SCALE_INVERSE_MATRIX, LMS_Flat, result);
2578  }
2579  #normalizeWhitePointToD65(sourceWhitePoint, XYZ_In, result) {
2580    const LMS = result;
2581    this.#matrixProduct(CalRGBCS.#BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
2582    const LMS_D65 = CalRGBCS.#tempNormalizeMatrix;
2583    this.#toD65(sourceWhitePoint, LMS, LMS_D65);
2584    this.#matrixProduct(CalRGBCS.#BRADFORD_SCALE_INVERSE_MATRIX, LMS_D65, result);
2585  }
2586  #toRgb(src, srcOffset, dest, destOffset, scale) {
2587    const A = MathClamp(src[srcOffset] * scale, 0, 1);
2588    const B = MathClamp(src[srcOffset + 1] * scale, 0, 1);
2589    const C = MathClamp(src[srcOffset + 2] * scale, 0, 1);
2590    const AGR = A === 1 ? 1 : A ** this.GR;
2591    const BGG = B === 1 ? 1 : B ** this.GG;
2592    const CGB = C === 1 ? 1 : C ** this.GB;
2593    const X = this.MXA * AGR + this.MXB * BGG + this.MXC * CGB;
2594    const Y = this.MYA * AGR + this.MYB * BGG + this.MYC * CGB;
2595    const Z = this.MZA * AGR + this.MZB * BGG + this.MZC * CGB;
2596    const XYZ = CalRGBCS.#tempConvertMatrix1;
2597    XYZ[0] = X;
2598    XYZ[1] = Y;
2599    XYZ[2] = Z;
2600    const XYZ_Flat = CalRGBCS.#tempConvertMatrix2;
2601    this.#normalizeWhitePointToFlat(this.whitePoint, XYZ, XYZ_Flat);
2602    const XYZ_Black = CalRGBCS.#tempConvertMatrix1;
2603    this.#compensateBlackPoint(this.blackPoint, XYZ_Flat, XYZ_Black);
2604    const XYZ_D65 = CalRGBCS.#tempConvertMatrix2;
2605    this.#normalizeWhitePointToD65(CalRGBCS.#FLAT_WHITEPOINT_MATRIX, XYZ_Black, XYZ_D65);
2606    const SRGB = CalRGBCS.#tempConvertMatrix1;
2607    this.#matrixProduct(CalRGBCS.#SRGB_D65_XYZ_TO_RGB_MATRIX, XYZ_D65, SRGB);
2608    dest[destOffset] = this.#sRGBTransferFunction(SRGB[0]) * 255;
2609    dest[destOffset + 1] = this.#sRGBTransferFunction(SRGB[1]) * 255;
2610    dest[destOffset + 2] = this.#sRGBTransferFunction(SRGB[2]) * 255;
2611  }
2612  getRgbItem(src, srcOffset, dest, destOffset) {
2613    this.#toRgb(src, srcOffset, dest, destOffset, 1);
2614  }
2615  getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
2616    const scale = 1 / ((1 << bits) - 1);
2617    for (let i = 0; i < count; ++i) {
2618      this.#toRgb(src, srcOffset, dest, destOffset, scale);
2619      srcOffset += 3;
2620      destOffset += 3 + alpha01;
2621    }
2622  }
2623  getOutputLength(inputLength, alpha01) {
2624    return inputLength * (3 + alpha01) / 3 | 0;
2625  }
2626}
2627class LabCS extends ColorSpace {
2628  constructor(whitePoint, blackPoint, range) {
2629    super("Lab", 3);
2630    if (!whitePoint) {
2631      throw new FormatError("WhitePoint missing - required for color space Lab");
2632    }
2633    [this.XW, this.YW, this.ZW] = whitePoint;
2634    [this.amin, this.amax, this.bmin, this.bmax] = range || [-100, 100, -100, 100];
2635    [this.XB, this.YB, this.ZB] = blackPoint || [0, 0, 0];
2636    if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
2637      throw new FormatError("Invalid WhitePoint components, no fallback available");
2638    }
2639    if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
2640      info("Invalid BlackPoint, falling back to default");
2641      this.XB = this.YB = this.ZB = 0;
2642    }
2643    if (this.amin > this.amax || this.bmin > this.bmax) {
2644      info("Invalid Range, falling back to defaults");
2645      this.amin = -100;
2646      this.amax = 100;
2647      this.bmin = -100;
2648      this.bmax = 100;
2649    }
2650  }
2651  #fn_g(x) {
2652    return x >= 6 / 29 ? x ** 3 : 108 / 841 * (x - 4 / 29);
2653  }
2654  #decode(value, high1, low2, high2) {
2655    return low2 + value * (high2 - low2) / high1;
2656  }
2657  #toRgb(src, srcOffset, maxVal, dest, destOffset) {
2658    let Ls = src[srcOffset];
2659    let as = src[srcOffset + 1];
2660    let bs = src[srcOffset + 2];
2661    if (maxVal !== false) {
2662      Ls = this.#decode(Ls, maxVal, 0, 100);
2663      as = this.#decode(as, maxVal, this.amin, this.amax);
2664      bs = this.#decode(bs, maxVal, this.bmin, this.bmax);
2665    }
2666    if (as > this.amax) {
2667      as = this.amax;
2668    } else if (as < this.amin) {
2669      as = this.amin;
2670    }
2671    if (bs > this.bmax) {
2672      bs = this.bmax;
2673    } else if (bs < this.bmin) {
2674      bs = this.bmin;
2675    }
2676    const M = (Ls + 16) / 116;
2677    const L = M + as / 500;
2678    const N = M - bs / 200;
2679    const X = this.XW * this.#fn_g(L);
2680    const Y = this.YW * this.#fn_g(M);
2681    const Z = this.ZW * this.#fn_g(N);
2682    let r, g, b;
2683    if (this.ZW < 1) {
2684      r = X * 3.1339 + Y * -1.617 + Z * -0.4906;
2685      g = X * -0.9785 + Y * 1.916 + Z * 0.0333;
2686      b = X * 0.072 + Y * -0.229 + Z * 1.4057;
2687    } else {
2688      r = X * 3.2406 + Y * -1.5372 + Z * -0.4986;
2689      g = X * -0.9689 + Y * 1.8758 + Z * 0.0415;
2690      b = X * 0.0557 + Y * -0.204 + Z * 1.057;
2691    }
2692    dest[destOffset] = Math.sqrt(r) * 255;
2693    dest[destOffset + 1] = Math.sqrt(g) * 255;
2694    dest[destOffset + 2] = Math.sqrt(b) * 255;
2695  }
2696  getRgbItem(src, srcOffset, dest, destOffset) {
2697    this.#toRgb(src, srcOffset, false, dest, destOffset);
2698  }
2699  getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
2700    const maxVal = (1 << bits) - 1;
2701    for (let i = 0; i < count; i++) {
2702      this.#toRgb(src, srcOffset, maxVal, dest, destOffset);
2703      srcOffset += 3;
2704      destOffset += 3 + alpha01;
2705    }
2706  }
2707  getOutputLength(inputLength, alpha01) {
2708    return inputLength * (3 + alpha01) / 3 | 0;
2709  }
2710  isDefaultDecode(decode, bpc) {
2711    return true;
2712  }
2713  get usesZeroToOneRange() {
2714    return shadow(this, "usesZeroToOneRange", false);
2715  }
2716}
2717
2718;// ./src/core/icc_colorspace.js
2719
2720
2721
2722
2723function fetchSync(url) {
2724  const xhr = new XMLHttpRequest();
2725  xhr.open("GET", url, false);
2726  xhr.responseType = "arraybuffer";
2727  xhr.send(null);
2728  return xhr.response;
2729}
2730class IccColorSpace extends ColorSpace {
2731  #transformer;
2732  #convertPixel;
2733  static #useWasm = true;
2734  static #wasmUrl = null;
2735  static #finalizer = null;
2736  constructor(iccProfile, name, numComps) {
2737    if (!IccColorSpace.isUsable) {
2738      throw new Error("No ICC color space support");
2739    }
2740    super(name, numComps);
2741    let inType;
2742    switch (numComps) {
2743      case 1:
2744        inType = DataType.Gray8;
2745        this.#convertPixel = (src, srcOffset, css) => qcms_convert_one(this.#transformer, src[srcOffset] * 255, css);
2746        break;
2747      case 3:
2748        inType = DataType.RGB8;
2749        this.#convertPixel = (src, srcOffset, css) => qcms_convert_three(this.#transformer, src[srcOffset] * 255, src[srcOffset + 1] * 255, src[srcOffset + 2] * 255, css);
2750        break;
2751      case 4:
2752        inType = DataType.CMYK;
2753        this.#convertPixel = (src, srcOffset, css) => qcms_convert_four(this.#transformer, src[srcOffset] * 255, src[srcOffset + 1] * 255, src[srcOffset + 2] * 255, src[srcOffset + 3] * 255, css);
2754        break;
2755      default:
2756        throw new Error(`Unsupported number of components: ${numComps}`);
2757    }
2758    this.#transformer = qcms_transformer_from_memory(iccProfile, inType, Intent.Perceptual);
2759    if (!this.#transformer) {
2760      throw new Error("Failed to create ICC color space");
2761    }
2762    IccColorSpace.#finalizer ||= new FinalizationRegistry(transformer => {
2763      qcms_drop_transformer(transformer);
2764    });
2765    IccColorSpace.#finalizer.register(this, this.#transformer);
2766  }
2767  getRgbHex(src, srcOffset) {
2768    this.#convertPixel(src, srcOffset, true);
2769    return QCMS._cssColor;
2770  }
2771  getRgbItem(src, srcOffset, dest, destOffset) {
2772    QCMS._destBuffer = dest;
2773    QCMS._destOffset = destOffset;
2774    QCMS._destLength = 3;
2775    this.#convertPixel(src, srcOffset, false);
2776    QCMS._destBuffer = null;
2777  }
2778  getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
2779    src = src.subarray(srcOffset, srcOffset + count * this.numComps);
2780    if (bits !== 8) {
2781      const scale = 255 / ((1 << bits) - 1);
2782      for (let i = 0, ii = src.length; i < ii; i++) {
2783        src[i] *= scale;
2784      }
2785    }
2786    QCMS._mustAddAlpha = alpha01 && dest.buffer === src.buffer;
2787    QCMS._destBuffer = dest;
2788    QCMS._destOffset = destOffset;
2789    QCMS._destLength = count * (3 + alpha01);
2790    qcms_convert_array(this.#transformer, src);
2791    QCMS._mustAddAlpha = false;
2792    QCMS._destBuffer = null;
2793  }
2794  getOutputLength(inputLength, alpha01) {
2795    return inputLength / this.numComps * (3 + alpha01) | 0;
2796  }
2797  static setOptions({
2798    useWasm,
2799    useWorkerFetch,
2800    wasmUrl
2801  }) {
2802    if (!useWorkerFetch) {
2803      this.#useWasm = false;
2804      return;
2805    }
2806    this.#useWasm = useWasm;
2807    this.#wasmUrl = wasmUrl;
2808  }
2809  static get isUsable() {
2810    let isUsable = false;
2811    if (this.#useWasm) {
2812      if (this.#wasmUrl) {
2813        try {
2814          this._module = initSync({
2815            module: fetchSync(`${this.#wasmUrl}qcms_bg.wasm`)
2816          });
2817          isUsable = !!this._module;
2818          QCMS._memory = this._module.memory;
2819          QCMS._makeHexColor = Util.makeHexColor.bind(Util);
2820        } catch (e) {
2821          warn(`ICCBased color space: "${e}".`);
2822        }
2823      } else {
2824        warn("No ICC color space support due to missing `wasmUrl` API option");
2825      }
2826    }
2827    return shadow(this, "isUsable", isUsable);
2828  }
2829}
2830class CmykICCBasedCS extends IccColorSpace {
2831  static #iccUrl;
2832  constructor() {
2833    const iccProfile = new Uint8Array(fetchSync(`${CmykICCBasedCS.#iccUrl}CGATS001Compat-v2-micro.icc`));
2834    super(iccProfile, "DeviceCMYK", 4);
2835  }
2836  static setOptions({
2837    iccUrl
2838  }) {
2839    this.#iccUrl = iccUrl;
2840  }
2841  static get isUsable() {
2842    let isUsable = false;
2843    if (IccColorSpace.isUsable) {
2844      if (this.#iccUrl) {
2845        isUsable = true;
2846      } else {
2847        warn("No CMYK ICC profile support due to missing `iccUrl` API option");
2848      }
2849    }
2850    return shadow(this, "isUsable", isUsable);
2851  }
2852}
2853
2854;// ./src/core/stream.js
2855
2856
2857class Stream extends BaseStream {
2858  constructor(arrayBuffer, start, length, dict) {
2859    super();
2860    this.bytes = arrayBuffer instanceof Uint8Array ? arrayBuffer : new Uint8Array(arrayBuffer);
2861    this.start = start || 0;
2862    this.pos = this.start;
2863    this.end = start + length || this.bytes.length;
2864    this.dict = dict;
2865  }
2866  get length() {
2867    return this.end - this.start;
2868  }
2869  get isEmpty() {
2870    return this.length === 0;
2871  }
2872  getByte() {
2873    if (this.pos >= this.end) {
2874      return -1;
2875    }
2876    return this.bytes[this.pos++];
2877  }
2878  getBytes(length) {
2879    const bytes = this.bytes;
2880    const pos = this.pos;
2881    const strEnd = this.end;
2882    if (!length) {
2883      this.pos = strEnd;
2884      return bytes.subarray(pos, strEnd);
2885    }
2886    let end = pos + length;
2887    if (end > strEnd) {
2888      end = strEnd;
2889    }
2890    this.pos = end;
2891    return bytes.subarray(pos, end);
2892  }
2893  getByteRange(begin, end) {
2894    if (begin < 0) {
2895      begin = 0;
2896    }
2897    if (end > this.end) {
2898      end = this.end;
2899    }
2900    return this.bytes.subarray(begin, end);
2901  }
2902  reset() {
2903    this.pos = this.start;
2904  }
2905  moveStart() {
2906    this.start = this.pos;
2907  }
2908  makeSubStream(start, length, dict = null) {
2909    return new Stream(this.bytes.buffer, start, length, dict);
2910  }
2911  clone() {
2912    return new Stream(this.bytes.buffer, this.start, this.end - this.start, this.dict.clone());
2913  }
2914}
2915class StringStream extends Stream {
2916  constructor(str) {
2917    super(stringToBytes(str));
2918  }
2919}
2920class NullStream extends Stream {
2921  constructor() {
2922    super(new Uint8Array(0));
2923  }
2924}
2925
2926;// ./src/core/chunked_stream.js
2927
2928
2929
2930
2931class ChunkedStream extends Stream {
2932  progressiveDataLength = 0;
2933  _lastSuccessfulEnsureByteChunk = -1;
2934  _loadedChunks = new Set();
2935  constructor(length, chunkSize, manager) {
2936    super(new Uint8Array(length), 0, length, null);
2937    this.chunkSize = chunkSize;
2938    this.numChunks = Math.ceil(length / chunkSize);
2939    this.manager = manager;
2940  }
2941  getMissingChunks() {
2942    const chunks = [];
2943    for (let chunk = 0, n = this.numChunks; chunk < n; ++chunk) {
2944      if (!this._loadedChunks.has(chunk)) {
2945        chunks.push(chunk);
2946      }
2947    }
2948    return chunks;
2949  }
2950  get numChunksLoaded() {
2951    return this._loadedChunks.size;
2952  }
2953  get isDataLoaded() {
2954    return this.numChunksLoaded === this.numChunks;
2955  }
2956  onReceiveData(begin, chunk) {
2957    const chunkSize = this.chunkSize;
2958    if (begin % chunkSize !== 0) {
2959      throw new Error(`Bad begin offset: ${begin}`);
2960    }
2961    const end = begin + chunk.byteLength;
2962    if (end % chunkSize !== 0 && end !== this.bytes.length) {
2963      throw new Error(`Bad end offset: ${end}`);
2964    }
2965    this.bytes.set(new Uint8Array(chunk), begin);
2966    const beginChunk = Math.floor(begin / chunkSize);
2967    const endChunk = Math.floor((end - 1) / chunkSize) + 1;
2968    for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
2969      this._loadedChunks.add(curChunk);
2970    }
2971  }
2972  onReceiveProgressiveData(data) {
2973    let position = this.progressiveDataLength;
2974    const beginChunk = Math.floor(position / this.chunkSize);
2975    this.bytes.set(new Uint8Array(data), position);
2976    position += data.byteLength;
2977    this.progressiveDataLength = position;
2978    const endChunk = position >= this.end ? this.numChunks : Math.floor(position / this.chunkSize);
2979    for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
2980      this._loadedChunks.add(curChunk);
2981    }
2982  }
2983  ensureByte(pos) {
2984    if (pos < this.progressiveDataLength) {
2985      return;
2986    }
2987    const chunk = Math.floor(pos / this.chunkSize);
2988    if (chunk > this.numChunks) {
2989      return;
2990    }
2991    if (chunk === this._lastSuccessfulEnsureByteChunk) {
2992      return;
2993    }
2994    if (!this._loadedChunks.has(chunk)) {
2995      throw new MissingDataException(pos, pos + 1);
2996    }
2997    this._lastSuccessfulEnsureByteChunk = chunk;
2998  }
2999  ensureRange(begin, end) {
3000    if (begin >= end) {
3001      return;
3002    }
3003    if (end <= this.progressiveDataLength) {
3004      return;
3005    }
3006    const beginChunk = Math.floor(begin / this.chunkSize);
3007    if (beginChunk > this.numChunks) {
3008      return;
3009    }
3010    const endChunk = Math.min(Math.floor((end - 1) / this.chunkSize) + 1, this.numChunks);
3011    for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
3012      if (!this._loadedChunks.has(chunk)) {
3013        throw new MissingDataException(begin, end);
3014      }
3015    }
3016  }
3017  nextEmptyChunk(beginChunk) {
3018    const numChunks = this.numChunks;
3019    for (let i = 0; i < numChunks; ++i) {
3020      const chunk = (beginChunk + i) % numChunks;
3021      if (!this._loadedChunks.has(chunk)) {
3022        return chunk;
3023      }
3024    }
3025    return null;
3026  }
3027  hasChunk(chunk) {
3028    return this._loadedChunks.has(chunk);
3029  }
3030  getByte() {
3031    const pos = this.pos;
3032    if (pos >= this.end) {
3033      return -1;
3034    }
3035    if (pos >= this.progressiveDataLength) {
3036      this.ensureByte(pos);
3037    }
3038    return this.bytes[this.pos++];
3039  }
3040  getBytes(length) {
3041    const bytes = this.bytes;
3042    const pos = this.pos;
3043    const strEnd = this.end;
3044    if (!length) {
3045      if (strEnd > this.progressiveDataLength) {
3046        this.ensureRange(pos, strEnd);
3047      }
3048      this.pos = strEnd;
3049      return bytes.subarray(pos, strEnd);
3050    }
3051    let end = pos + length;
3052    if (end > strEnd) {
3053      end = strEnd;
3054    }
3055    if (end > this.progressiveDataLength) {
3056      this.ensureRange(pos, end);
3057    }
3058    this.pos = end;
3059    return bytes.subarray(pos, end);
3060  }
3061  getByteRange(begin, end) {
3062    if (begin < 0) {
3063      begin = 0;
3064    }
3065    if (end > this.end) {
3066      end = this.end;
3067    }
3068    if (end > this.progressiveDataLength) {
3069      this.ensureRange(begin, end);
3070    }
3071    return this.bytes.subarray(begin, end);
3072  }
3073  makeSubStream(start, length, dict = null) {
3074    if (length) {
3075      if (start + length > this.progressiveDataLength) {
3076        this.ensureRange(start, start + length);
3077      }
3078    } else if (start >= this.progressiveDataLength) {
3079      this.ensureByte(start);
3080    }
3081    function ChunkedStreamSubstream() {}
3082    ChunkedStreamSubstream.prototype = Object.create(this);
3083    ChunkedStreamSubstream.prototype.getMissingChunks = function () {
3084      const chunkSize = this.chunkSize;
3085      const beginChunk = Math.floor(this.start / chunkSize);
vendor: 22,376 bytes, lines 3086-3814
3086      const endChunk = Math.floor((this.end - 1) / chunkSize) + 1;
3087      const missingChunks = [];
3088      for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
3089        if (!this._loadedChunks.has(chunk)) {
3090          missingChunks.push(chunk);
3091        }
3092      }
3093      return missingChunks;
3094    };
3095    Object.defineProperty(ChunkedStreamSubstream.prototype, "isDataLoaded", {
3096      get() {
3097        if (this.numChunksLoaded === this.numChunks) {
3098          return true;
3099        }
3100        return this.getMissingChunks().length === 0;
3101      },
3102      configurable: true
3103    });
3104    const subStream = new ChunkedStreamSubstream();
3105    subStream.pos = subStream.start = start;
3106    subStream.end = start + length || this.end;
3107    subStream.dict = dict;
3108    return subStream;
3109  }
3110  getBaseStreams() {
3111    return [this];
3112  }
3113}
3114class ChunkedStreamManager {
3115  aborted = false;
3116  currRequestId = 0;
3117  _chunksNeededByRequest = new Map();
3118  _loadedStreamCapability = Promise.withResolvers();
3119  _promisesByRequest = new Map();
3120  _requestsByChunk = new Map();
3121  constructor(pdfStream, args) {
3122    this.length = args.length;
3123    this.chunkSize = args.rangeChunkSize;
3124    this.stream = new ChunkedStream(this.length, this.chunkSize, this);
3125    this.pdfStream = pdfStream;
3126    this.disableAutoFetch = args.disableAutoFetch;
3127    this.msgHandler = args.msgHandler;
3128  }
3129  async sendRequest(begin, end) {
3130    const rangeReader = this.pdfStream.getRangeReader(begin, end);
3131    let chunks = [];
3132    while (true) {
3133      const {
3134        value,
3135        done
3136      } = await rangeReader.read();
3137      if (this.aborted) {
3138        chunks = null;
3139        return;
3140      }
3141      if (done) {
3142        break;
3143      }
3144      chunks.push(value);
3145    }
3146    if (chunks.length === 0 && this.disableAutoFetch) {
3147      return;
3148    }
3149    const data = arrayBuffersToBytes(chunks);
3150    chunks = null;
3151    this.onReceiveData({
3152      chunk: data.buffer,
3153      begin
3154    });
3155  }
3156  requestAllChunks(noFetch = false) {
3157    if (!noFetch) {
3158      const missingChunks = this.stream.getMissingChunks();
3159      this._requestChunks(missingChunks);
3160    }
3161    return this._loadedStreamCapability.promise;
3162  }
3163  _requestChunks(chunks) {
3164    const requestId = this.currRequestId++;
3165    const chunksNeeded = new Set();
3166    this._chunksNeededByRequest.set(requestId, chunksNeeded);
3167    for (const chunk of chunks) {
3168      if (!this.stream.hasChunk(chunk)) {
3169        chunksNeeded.add(chunk);
3170      }
3171    }
3172    if (chunksNeeded.size === 0) {
3173      return Promise.resolve();
3174    }
3175    const capability = Promise.withResolvers();
3176    this._promisesByRequest.set(requestId, capability);
3177    const chunksToRequest = [];
3178    for (const chunk of chunksNeeded) {
3179      let requestIds = this._requestsByChunk.get(chunk);
3180      if (!requestIds) {
3181        requestIds = [];
3182        this._requestsByChunk.set(chunk, requestIds);
3183        chunksToRequest.push(chunk);
3184      }
3185      requestIds.push(requestId);
3186    }
3187    if (chunksToRequest.length > 0) {
3188      const groupedChunksToRequest = this.groupChunks(chunksToRequest);
3189      for (const groupedChunk of groupedChunksToRequest) {
3190        const begin = groupedChunk.beginChunk * this.chunkSize;
3191        const end = Math.min(groupedChunk.endChunk * this.chunkSize, this.length);
3192        this.sendRequest(begin, end).catch(capability.reject);
3193      }
3194    }
3195    return capability.promise.catch(reason => {
3196      if (this.aborted) {
3197        return;
3198      }
3199      throw reason;
3200    });
3201  }
3202  getStream() {
3203    return this.stream;
3204  }
3205  requestRange(begin, end) {
3206    end = Math.min(end, this.length);
3207    const beginChunk = this.getBeginChunk(begin);
3208    const endChunk = this.getEndChunk(end);
3209    const chunks = [];
3210    for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
3211      chunks.push(chunk);
3212    }
3213    return this._requestChunks(chunks);
3214  }
3215  requestRanges(ranges = []) {
3216    const chunksToRequest = [];
3217    for (const range of ranges) {
3218      const beginChunk = this.getBeginChunk(range.begin);
3219      const endChunk = this.getEndChunk(range.end);
3220      for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
3221        if (!chunksToRequest.includes(chunk)) {
3222          chunksToRequest.push(chunk);
3223        }
3224      }
3225    }
3226    chunksToRequest.sort((a, b) => a - b);
3227    return this._requestChunks(chunksToRequest);
3228  }
3229  groupChunks(chunks) {
3230    const groupedChunks = [];
3231    let beginChunk = -1;
3232    let prevChunk = -1;
3233    for (let i = 0, ii = chunks.length; i < ii; ++i) {
3234      const chunk = chunks[i];
3235      if (beginChunk < 0) {
3236        beginChunk = chunk;
3237      }
3238      if (prevChunk >= 0 && prevChunk + 1 !== chunk) {
3239        groupedChunks.push({
3240          beginChunk,
3241          endChunk: prevChunk + 1
3242        });
3243        beginChunk = chunk;
3244      }
3245      if (i + 1 === chunks.length) {
3246        groupedChunks.push({
3247          beginChunk,
3248          endChunk: chunk + 1
3249        });
3250      }
3251      prevChunk = chunk;
3252    }
3253    return groupedChunks;
3254  }
3255  onReceiveData(args) {
3256    const {
3257      chunkSize,
3258      length,
3259      stream
3260    } = this;
3261    const chunk = args.chunk;
3262    const isProgressive = args.begin === undefined;
3263    const begin = isProgressive ? stream.progressiveDataLength : args.begin;
3264    const end = begin + chunk.byteLength;
3265    const beginChunk = Math.floor(begin / chunkSize);
3266    const endChunk = end < length ? Math.floor(end / chunkSize) : Math.ceil(end / chunkSize);
3267    if (isProgressive) {
3268      stream.onReceiveProgressiveData(chunk);
3269    } else {
3270      stream.onReceiveData(begin, chunk);
3271    }
3272    if (stream.isDataLoaded) {
3273      this._loadedStreamCapability.resolve(stream);
3274    }
3275    const loadedRequests = [];
3276    for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
3277      const requestIds = this._requestsByChunk.get(curChunk);
3278      if (!requestIds) {
3279        continue;
3280      }
3281      this._requestsByChunk.delete(curChunk);
3282      for (const requestId of requestIds) {
3283        const chunksNeeded = this._chunksNeededByRequest.get(requestId);
3284        if (chunksNeeded.has(curChunk)) {
3285          chunksNeeded.delete(curChunk);
3286        }
3287        if (chunksNeeded.size > 0) {
3288          continue;
3289        }
3290        loadedRequests.push(requestId);
3291      }
3292    }
3293    if (!this.disableAutoFetch && this._requestsByChunk.size === 0) {
3294      let nextEmptyChunk;
3295      if (stream.numChunksLoaded === 1) {
3296        const lastChunk = stream.numChunks - 1;
3297        if (!stream.hasChunk(lastChunk)) {
3298          nextEmptyChunk = lastChunk;
3299        }
3300      } else {
3301        nextEmptyChunk = stream.nextEmptyChunk(endChunk);
3302      }
3303      if (Number.isInteger(nextEmptyChunk)) {
3304        this._requestChunks([nextEmptyChunk]);
3305      }
3306    }
3307    for (const requestId of loadedRequests) {
3308      const capability = this._promisesByRequest.get(requestId);
3309      this._promisesByRequest.delete(requestId);
3310      capability.resolve();
3311    }
3312    this.msgHandler.send("DocProgress", {
3313      loaded: MathClamp(stream.numChunksLoaded * chunkSize, stream.progressiveDataLength, length),
3314      total: length
3315    });
3316  }
3317  onError(err) {
3318    this._loadedStreamCapability.reject(err);
3319  }
3320  getBeginChunk(begin) {
3321    return Math.floor(begin / this.chunkSize);
3322  }
3323  getEndChunk(end) {
3324    return Math.floor((end - 1) / this.chunkSize) + 1;
3325  }
3326  abort(reason) {
3327    this.aborted = true;
3328    this.pdfStream?.cancelAllRequests(reason);
3329    for (const capability of this._promisesByRequest.values()) {
3330      capability.reject(reason);
3331    }
3332  }
3333}
3334
3335;// ./src/shared/image_utils.js
3336
3337function convertToRGBA(params) {
3338  switch (params.kind) {
3339    case ImageKind.GRAYSCALE_1BPP:
3340      return convertBlackAndWhiteToRGBA(params);
3341    case ImageKind.RGB_24BPP:
3342      return convertRGBToRGBA(params);
3343  }
3344  return null;
3345}
3346function convertBlackAndWhiteToRGBA({
3347  src,
3348  srcPos = 0,
3349  dest,
3350  width,
3351  height,
3352  nonBlackColor = 0xffffffff,
3353  inverseDecode = false
3354}) {
3355  const black = FeatureTest.isLittleEndian ? 0xff000000 : 0x000000ff;
3356  const [zeroMapping, oneMapping] = inverseDecode ? [nonBlackColor, black] : [black, nonBlackColor];
3357  const widthInSource = width >> 3;
3358  const widthRemainder = width & 7;
3359  const xorMask = zeroMapping ^ oneMapping;
3360  const srcLength = src.length;
3361  dest = new Uint32Array(dest.buffer);
3362  let destPos = 0;
3363  for (let i = 0; i < height; ++i) {
3364    for (const max = srcPos + widthInSource; srcPos < max; ++srcPos, destPos += 8) {
3365      const elem = src[srcPos];
3366      dest[destPos] = zeroMapping ^ -(elem >> 7 & 1) & xorMask;
3367      dest[destPos + 1] = zeroMapping ^ -(elem >> 6 & 1) & xorMask;
3368      dest[destPos + 2] = zeroMapping ^ -(elem >> 5 & 1) & xorMask;
3369      dest[destPos + 3] = zeroMapping ^ -(elem >> 4 & 1) & xorMask;
3370      dest[destPos + 4] = zeroMapping ^ -(elem >> 3 & 1) & xorMask;
3371      dest[destPos + 5] = zeroMapping ^ -(elem >> 2 & 1) & xorMask;
3372      dest[destPos + 6] = zeroMapping ^ -(elem >> 1 & 1) & xorMask;
3373      dest[destPos + 7] = zeroMapping ^ -(elem & 1) & xorMask;
3374    }
3375    if (widthRemainder === 0) {
3376      continue;
3377    }
3378    const elem = srcPos < srcLength ? src[srcPos++] : 255;
3379    for (let j = 0; j < widthRemainder; ++j, ++destPos) {
3380      dest[destPos] = zeroMapping ^ -(elem >> 7 - j & 1) & xorMask;
3381    }
3382  }
3383  return {
3384    srcPos,
3385    destPos
3386  };
3387}
3388function convertRGBToRGBA({
3389  src,
3390  srcPos = 0,
3391  dest,
3392  destPos = 0,
3393  width,
3394  height
3395}) {
3396  let i = 0;
3397  const len = width * height * 3;
3398  const len32 = len >> 2;
3399  const src32 = new Uint32Array(src.buffer, srcPos, len32);
3400  const alphaMask = FeatureTest.isLittleEndian ? 0xff000000 : 0xff;
3401  if (FeatureTest.isLittleEndian) {
3402    for (; i < len32 - 2; i += 3, destPos += 4) {
3403      const s1 = src32[i],
3404        s2 = src32[i + 1],
3405        s3 = src32[i + 2];
3406      dest[destPos] = s1 | alphaMask;
3407      dest[destPos + 1] = s1 >>> 24 | s2 << 8 | alphaMask;
3408      dest[destPos + 2] = s2 >>> 16 | s3 << 16 | alphaMask;
3409      dest[destPos + 3] = s3 >>> 8 | alphaMask;
3410    }
3411    for (let j = i * 4, jj = srcPos + len; j < jj; j += 3) {
3412      dest[destPos++] = src[j] | src[j + 1] << 8 | src[j + 2] << 16 | alphaMask;
3413    }
3414  } else {
3415    for (; i < len32 - 2; i += 3, destPos += 4) {
3416      const s1 = src32[i],
3417        s2 = src32[i + 1],
3418        s3 = src32[i + 2];
3419      dest[destPos] = s1 | alphaMask;
3420      dest[destPos + 1] = s1 << 24 | s2 >>> 8 | alphaMask;
3421      dest[destPos + 2] = s2 << 16 | s3 >>> 16 | alphaMask;
3422      dest[destPos + 3] = s3 << 8 | alphaMask;
3423    }
3424    for (let j = i * 4, jj = srcPos + len; j < jj; j += 3) {
3425      dest[destPos++] = src[j] << 24 | src[j + 1] << 16 | src[j + 2] << 8 | alphaMask;
3426    }
3427  }
3428  return {
3429    srcPos: srcPos + len,
3430    destPos
3431  };
3432}
3433function grayToRGBA(src, dest) {
3434  if (FeatureTest.isLittleEndian) {
3435    for (let i = 0, ii = src.length; i < ii; i++) {
3436      dest[i] = src[i] * 0x10101 | 0xff000000;
3437    }
3438  } else {
3439    for (let i = 0, ii = src.length; i < ii; i++) {
3440      dest[i] = src[i] * 0x1010100 | 0x000000ff;
3441    }
3442  }
3443}
3444
3445;// ./src/core/image_resizer.js
3446
3447
3448
3449const MIN_IMAGE_DIM = 2048;
3450const MAX_IMAGE_DIM = 32768;
3451const MAX_ERROR = 128;
3452class ImageResizer {
3453  static #goodSquareLength = MIN_IMAGE_DIM;
3454  static #isImageDecoderSupported = FeatureTest.isImageDecoderSupported;
3455  constructor(imgData, isMask) {
3456    this._imgData = imgData;
3457    this._isMask = isMask;
3458  }
3459  static get canUseImageDecoder() {
3460    return shadow(this, "canUseImageDecoder", this.#isImageDecoderSupported ? ImageDecoder.isTypeSupported("image/bmp") : Promise.resolve(false));
3461  }
3462  static needsToBeResized(width, height) {
3463    if (width <= this.#goodSquareLength && height <= this.#goodSquareLength) {
3464      return false;
3465    }
3466    const {
3467      MAX_DIM
3468    } = this;
3469    if (width > MAX_DIM || height > MAX_DIM) {
3470      return true;
3471    }
3472    const area = width * height;
3473    if (this._hasMaxArea) {
3474      return area > this.MAX_AREA;
3475    }
3476    if (area < this.#goodSquareLength ** 2) {
3477      return false;
3478    }
3479    if (this._areGoodDims(width, height)) {
3480      this.#goodSquareLength = Math.max(this.#goodSquareLength, Math.floor(Math.sqrt(width * height)));
3481      return false;
3482    }
3483    this.#goodSquareLength = this._guessMax(this.#goodSquareLength, MAX_DIM, MAX_ERROR, 0);
3484    const maxArea = this.MAX_AREA = this.#goodSquareLength ** 2;
3485    return area > maxArea;
3486  }
3487  static getReducePowerForJPX(width, height, componentsCount) {
3488    const area = width * height;
3489    const maxJPXArea = 2 ** 30 / (componentsCount * 4);
3490    if (!this.needsToBeResized(width, height)) {
3491      if (area > maxJPXArea) {
3492        return Math.ceil(Math.log2(area / maxJPXArea));
3493      }
3494      return 0;
3495    }
3496    const {
3497      MAX_DIM,
3498      MAX_AREA
3499    } = this;
3500    const minFactor = Math.max(width / MAX_DIM, height / MAX_DIM, Math.sqrt(area / Math.min(maxJPXArea, MAX_AREA)));
3501    return Math.ceil(Math.log2(minFactor));
3502  }
3503  static get MAX_DIM() {
3504    return shadow(this, "MAX_DIM", this._guessMax(MIN_IMAGE_DIM, MAX_IMAGE_DIM, 0, 1));
3505  }
3506  static get MAX_AREA() {
3507    this._hasMaxArea = true;
3508    return shadow(this, "MAX_AREA", this._guessMax(this.#goodSquareLength, this.MAX_DIM, MAX_ERROR, 0) ** 2);
3509  }
3510  static set MAX_AREA(area) {
3511    if (area >= 0) {
3512      this._hasMaxArea = true;
3513      shadow(this, "MAX_AREA", area);
3514    }
3515  }
3516  static setOptions({
3517    canvasMaxAreaInBytes = -1,
3518    isImageDecoderSupported = false
3519  }) {
3520    if (!this._hasMaxArea) {
3521      this.MAX_AREA = canvasMaxAreaInBytes >> 2;
3522    }
3523    this.#isImageDecoderSupported = isImageDecoderSupported;
3524  }
3525  static _areGoodDims(width, height) {
3526    try {
3527      const canvas = new OffscreenCanvas(width, height);
3528      const ctx = canvas.getContext("2d");
3529      ctx.fillRect(0, 0, 1, 1);
3530      const opacity = ctx.getImageData(0, 0, 1, 1).data[3];
3531      canvas.width = canvas.height = 1;
3532      return opacity !== 0;
3533    } catch {
3534      return false;
3535    }
3536  }
3537  static _guessMax(start, end, tolerance, defaultHeight) {
3538    while (start + tolerance + 1 < end) {
3539      const middle = Math.floor((start + end) / 2);
3540      const height = defaultHeight || middle;
3541      if (this._areGoodDims(middle, height)) {
3542        start = middle;
3543      } else {
3544        end = middle;
3545      }
3546    }
3547    return start;
3548  }
3549  static async createImage(imgData, isMask = false) {
3550    return new ImageResizer(imgData, isMask)._createImage();
3551  }
3552  async _createImage() {
3553    const {
3554      _imgData: imgData
3555    } = this;
3556    const {
3557      width,
3558      height
3559    } = imgData;
3560    if (width * height * 4 > MAX_INT_32) {
3561      const result = this.#rescaleImageData();
3562      if (result) {
3563        return result;
3564      }
3565    }
3566    const data = this._encodeBMP();
3567    let decoder, imagePromise;
3568    if (await ImageResizer.canUseImageDecoder) {
3569      decoder = new ImageDecoder({
3570        data,
3571        type: "image/bmp",
3572        preferAnimation: false,
3573        transfer: [data.buffer]
3574      });
3575      imagePromise = decoder.decode().catch(reason => {
3576        warn(`BMP image decoding failed: ${reason}`);
3577        return createImageBitmap(new Blob([this._encodeBMP().buffer], {
3578          type: "image/bmp"
3579        }));
3580      }).finally(() => {
3581        decoder.close();
3582      });
3583    } else {
3584      imagePromise = createImageBitmap(new Blob([data.buffer], {
3585        type: "image/bmp"
3586      }));
3587    }
3588    const {
3589      MAX_AREA,
3590      MAX_DIM
3591    } = ImageResizer;
3592    const minFactor = Math.max(width / MAX_DIM, height / MAX_DIM, Math.sqrt(width * height / MAX_AREA));
3593    const firstFactor = Math.max(minFactor, 2);
3594    const factor = Math.round(10 * (minFactor + 1.25)) / 10 / firstFactor;
3595    const N = Math.floor(Math.log2(factor));
3596    const steps = new Array(N + 2).fill(2);
3597    steps[0] = firstFactor;
3598    steps.splice(-1, 1, factor / (1 << N));
3599    let newWidth = width;
3600    let newHeight = height;
3601    const result = await imagePromise;
3602    let bitmap = result.image || result;
3603    for (const step of steps) {
3604      const prevWidth = newWidth;
3605      const prevHeight = newHeight;
3606      newWidth = Math.floor(newWidth / step);
3607      newHeight = Math.floor(newHeight / step);
3608      const canvas = new OffscreenCanvas(newWidth, newHeight);
3609      const ctx = canvas.getContext("2d");
3610      ctx.drawImage(bitmap, 0, 0, prevWidth, prevHeight, 0, 0, newWidth, newHeight);
3611      bitmap.close();
3612      bitmap = canvas.transferToImageBitmap();
3613    }
3614    imgData.data = null;
3615    imgData.bitmap = bitmap;
3616    imgData.width = newWidth;
3617    imgData.height = newHeight;
3618    return imgData;
3619  }
3620  #rescaleImageData() {
3621    const {
3622      _imgData: imgData
3623    } = this;
3624    const {
3625      data,
3626      width,
3627      height,
3628      kind
3629    } = imgData;
3630    const rgbaSize = width * height * 4;
3631    const K = Math.ceil(Math.log2(rgbaSize / MAX_INT_32));
3632    const newWidth = width >> K;
3633    const newHeight = height >> K;
3634    let rgbaData;
3635    let maxHeight = height;
3636    try {
3637      rgbaData = new Uint8Array(rgbaSize);
3638    } catch {
3639      let n = Math.floor(Math.log2(rgbaSize + 1));
3640      while (true) {
3641        try {
3642          rgbaData = new Uint8Array(2 ** n - 1);
3643          break;
3644        } catch {
3645          n -= 1;
3646        }
3647      }
3648      maxHeight = Math.floor((2 ** n - 1) / (width * 4));
3649      const newSize = width * maxHeight * 4;
3650      if (newSize < rgbaData.length) {
3651        rgbaData = new Uint8Array(newSize);
3652      }
3653    }
3654    const src32 = new Uint32Array(rgbaData.buffer);
3655    const dest32 = new Uint32Array(newWidth * newHeight);
3656    let srcPos = 0;
3657    let newIndex = 0;
3658    const step = Math.ceil(height / maxHeight);
3659    const remainder = height % maxHeight === 0 ? height : height % maxHeight;
3660    for (let k = 0; k < step; k++) {
3661      const h = k < step - 1 ? maxHeight : remainder;
3662      ({
3663        srcPos
3664      } = convertToRGBA({
3665        kind,
3666        src: data,
3667        dest: src32,
3668        width,
3669        height: h,
3670        inverseDecode: this._isMask,
3671        srcPos
3672      }));
3673      for (let i = 0, ii = h >> K; i < ii; i++) {
3674        const buf = src32.subarray((i << K) * width);
3675        for (let j = 0; j < newWidth; j++) {
3676          dest32[newIndex++] = buf[j << K];
3677        }
3678      }
3679    }
3680    if (ImageResizer.needsToBeResized(newWidth, newHeight)) {
3681      imgData.data = dest32;
3682      imgData.width = newWidth;
3683      imgData.height = newHeight;
3684      imgData.kind = ImageKind.RGBA_32BPP;
3685      return null;
3686    }
3687    const canvas = new OffscreenCanvas(newWidth, newHeight);
3688    const ctx = canvas.getContext("2d", {
3689      willReadFrequently: true
3690    });
3691    ctx.putImageData(new ImageData(new Uint8ClampedArray(dest32.buffer), newWidth, newHeight), 0, 0);
3692    imgData.data = null;
3693    imgData.bitmap = canvas.transferToImageBitmap();
3694    imgData.width = newWidth;
3695    imgData.height = newHeight;
3696    return imgData;
3697  }
3698  _encodeBMP() {
3699    const {
3700      width,
3701      height,
3702      kind
3703    } = this._imgData;
3704    let data = this._imgData.data;
3705    let bitPerPixel;
3706    let colorTable = new Uint8Array(0);
3707    let maskTable = colorTable;
3708    let compression = 0;
3709    switch (kind) {
3710      case ImageKind.GRAYSCALE_1BPP:
3711        {
3712          bitPerPixel = 1;
3713          colorTable = new Uint8Array(this._isMask ? [255, 255, 255, 255, 0, 0, 0, 0] : [0, 0, 0, 0, 255, 255, 255, 255]);
3714          const rowLen = width + 7 >> 3;
3715          const rowSize = rowLen + 3 & -4;
3716          if (rowLen !== rowSize) {
3717            const newData = new Uint8Array(rowSize * height);
3718            let k = 0;
3719            for (let i = 0, ii = height * rowLen; i < ii; i += rowLen, k += rowSize) {
3720              newData.set(data.subarray(i, i + rowLen), k);
3721            }
3722            data = newData;
3723          }
3724          break;
3725        }
3726      case ImageKind.RGB_24BPP:
3727        {
3728          bitPerPixel = 24;
3729          if (width & 3) {
3730            const rowLen = 3 * width;
3731            const rowSize = rowLen + 3 & -4;
3732            const extraLen = rowSize - rowLen;
3733            const newData = new Uint8Array(rowSize * height);
3734            let k = 0;
3735            for (let i = 0, ii = height * rowLen; i < ii; i += rowLen) {
3736              const row = data.subarray(i, i + rowLen);
3737              for (let j = 0; j < rowLen; j += 3) {
3738                newData[k++] = row[j + 2];
3739                newData[k++] = row[j + 1];
3740                newData[k++] = row[j];
3741              }
3742              k += extraLen;
3743            }
3744            data = newData;
3745          } else {
3746            for (let i = 0, ii = data.length; i < ii; i += 3) {
3747              const tmp = data[i];
3748              data[i] = data[i + 2];
3749              data[i + 2] = tmp;
3750            }
3751          }
3752          break;
3753        }
3754      case ImageKind.RGBA_32BPP:
3755        bitPerPixel = 32;
3756        compression = 3;
3757        maskTable = new Uint8Array(4 + 4 + 4 + 4 + 52);
3758        const view = new DataView(maskTable.buffer);
3759        if (FeatureTest.isLittleEndian) {
3760          view.setUint32(0, 0x000000ff, true);
3761          view.setUint32(4, 0x0000ff00, true);
3762          view.setUint32(8, 0x00ff0000, true);
3763          view.setUint32(12, 0xff000000, true);
3764        } else {
3765          view.setUint32(0, 0xff000000, true);
3766          view.setUint32(4, 0x00ff0000, true);
3767          view.setUint32(8, 0x0000ff00, true);
3768          view.setUint32(12, 0x000000ff, true);
3769        }
3770        break;
3771      default:
3772        throw new Error("invalid format");
3773    }
3774    let i = 0;
3775    const headerLength = 40 + maskTable.length;
3776    const fileLength = 14 + headerLength + colorTable.length + data.length;
3777    const bmpData = new Uint8Array(fileLength);
3778    const view = new DataView(bmpData.buffer);
3779    view.setUint16(i, 0x4d42, true);
3780    i += 2;
3781    view.setUint32(i, fileLength, true);
3782    i += 4;
3783    view.setUint32(i, 0, true);
3784    i += 4;
3785    view.setUint32(i, 14 + headerLength + colorTable.length, true);
3786    i += 4;
3787    view.setUint32(i, headerLength, true);
3788    i += 4;
3789    view.setInt32(i, width, true);
3790    i += 4;
3791    view.setInt32(i, -height, true);
3792    i += 4;
3793    view.setUint16(i, 1, true);
3794    i += 2;
3795    view.setUint16(i, bitPerPixel, true);
3796    i += 2;
3797    view.setUint32(i, compression, true);
3798    i += 4;
3799    view.setUint32(i, 0, true);
3800    i += 4;
3801    view.setInt32(i, 0, true);
3802    i += 4;
3803    view.setInt32(i, 0, true);
3804    i += 4;
3805    view.setUint32(i, colorTable.length / 4, true);
3806    i += 4;
3807    view.setUint32(i, 0, true);
3808    i += 4;
3809    bmpData.set(maskTable, i);
3810    i += maskTable.length;
3811    bmpData.set(colorTable, i);
3812    i += colorTable.length;
3813    bmpData.set(data, i);
3814    return bmpData
vendor: 9,072 bytes, lines 3814-4119
3814;
3815  }
3816}
3817
3818;// ./external/jbig2/jbig2.js
3819async function JBig2(moduleArg = {}) {
3820  var moduleRtn;
3821  var Module = moduleArg;
3822  var ENVIRONMENT_IS_WEB = true;
3823  var ENVIRONMENT_IS_WORKER = false;
3824  var arguments_ = [];
3825  var thisProgram = "./this.program";
3826  var quit_ = (status, toThrow) => {
3827    throw toThrow;
3828  };
3829  var _scriptName = import.meta.url;
3830  var scriptDirectory = "";
3831  var readAsync, readBinary;
3832  if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) {
3833    try {
3834      scriptDirectory = new URL(".", _scriptName).href;
3835    } catch {}
3836    readAsync = async url => {
3837      var response = await fetch(url, {
3838        credentials: "same-origin"
3839      });
3840      if (response.ok) {
3841        return response.arrayBuffer();
3842      }
3843      throw new Error(response.status + " : " + response.url);
3844    };
3845  } else {}
3846  var out = console.log.bind(console);
3847  var err = console.error.bind(console);
3848  var wasmBinary;
3849  var ABORT = false;
3850  var EXITSTATUS;
3851  var readyPromiseResolve, readyPromiseReject;
3852  var HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAPF64;
3853  var HEAP64, HEAPU64;
3854  var runtimeInitialized = false;
3855  function updateMemoryViews() {
3856    var b = wasmMemory.buffer;
3857    HEAP8 = new Int8Array(b);
3858    HEAP16 = new Int16Array(b);
3859    HEAPU8 = new Uint8Array(b);
3860    HEAPU16 = new Uint16Array(b);
3861    HEAP32 = new Int32Array(b);
3862    HEAPU32 = new Uint32Array(b);
3863    HEAPF32 = new Float32Array(b);
3864    HEAPF64 = new Float64Array(b);
3865    HEAP64 = new BigInt64Array(b);
3866    HEAPU64 = new BigUint64Array(b);
3867  }
3868  function preRun() {
3869    if (Module["preRun"]) {
3870      if (typeof Module["preRun"] == "function") Module["preRun"] = [Module["preRun"]];
3871      while (Module["preRun"].length) {
3872        addOnPreRun(Module["preRun"].shift());
3873      }
3874    }
3875    callRuntimeCallbacks(onPreRuns);
3876  }
3877  function initRuntime() {
3878    runtimeInitialized = true;
3879    wasmExports["j"]();
3880  }
3881  function postRun() {
3882    if (Module["postRun"]) {
3883      if (typeof Module["postRun"] == "function") Module["postRun"] = [Module["postRun"]];
3884      while (Module["postRun"].length) {
3885        addOnPostRun(Module["postRun"].shift());
3886      }
3887    }
3888    callRuntimeCallbacks(onPostRuns);
3889  }
3890  function abort(what) {
3891    Module["onAbort"]?.(what);
3892    what = "Aborted(" + what + ")";
3893    err(what);
3894    ABORT = true;
3895    what += ". Build with -sASSERTIONS for more info.";
3896    var e = new WebAssembly.RuntimeError(what);
3897    readyPromiseReject?.(e);
3898    throw e;
3899  }
3900  var wasmBinaryFile;
3901  function getWasmImports() {
3902    var imports = {
3903      a: wasmImports
3904    };
3905    return imports;
3906  }
3907  async function createWasm() {
3908    function receiveInstance(instance, module) {
3909      wasmExports = instance.exports;
3910      assignWasmExports(wasmExports);
3911      updateMemoryViews();
3912      return wasmExports;
3913    }
3914    var info = getWasmImports();
3915    return new Promise((resolve, reject) => {
3916      Module["instantiateWasm"](info, (inst, mod) => {
3917        resolve(receiveInstance(inst, mod));
3918      });
3919    });
3920  }
3921  class ExitStatus {
3922    name = "ExitStatus";
3923    constructor(status) {
3924      this.message = `Program terminated with exit(${status})`;
3925      this.status = status;
3926    }
3927  }
3928  var callRuntimeCallbacks = callbacks => {
3929    while (callbacks.length > 0) {
3930      callbacks.shift()(Module);
3931    }
3932  };
3933  var onPostRuns = [];
3934  var addOnPostRun = cb => onPostRuns.push(cb);
3935  var onPreRuns = [];
3936  var addOnPreRun = cb => onPreRuns.push(cb);
3937  var noExitRuntime = true;
3938  var __abort_js = () => abort("");
3939  var runtimeKeepaliveCounter = 0;
3940  var __emscripten_runtime_keepalive_clear = () => {
3941    noExitRuntime = false;
3942    runtimeKeepaliveCounter = 0;
3943  };
3944  var timers = {};
3945  var handleException = e => {
3946    if (e instanceof ExitStatus || e == "unwind") {
3947      return EXITSTATUS;
3948    }
3949    quit_(1, e);
3950  };
3951  var keepRuntimeAlive = () => noExitRuntime || runtimeKeepaliveCounter > 0;
3952  var _proc_exit = code => {
3953    EXITSTATUS = code;
3954    if (!keepRuntimeAlive()) {
3955      Module["onExit"]?.(code);
3956      ABORT = true;
3957    }
3958    quit_(code, new ExitStatus(code));
3959  };
3960  var exitJS = (status, implicit) => {
3961    EXITSTATUS = status;
3962    _proc_exit(status);
3963  };
3964  var _exit = exitJS;
3965  var maybeExit = () => {
3966    if (!keepRuntimeAlive()) {
3967      try {
3968        _exit(EXITSTATUS);
3969      } catch (e) {
3970        handleException(e);
3971      }
3972    }
3973  };
3974  var callUserCallback = func => {
3975    if (ABORT) {
3976      return;
3977    }
3978    try {
3979      return func();
3980    } catch (e) {
3981      handleException(e);
3982    } finally {
3983      maybeExit();
3984    }
3985  };
3986  var _emscripten_get_now = () => performance.now();
3987  var __setitimer_js = (which, timeout_ms) => {
3988    if (timers[which]) {
3989      clearTimeout(timers[which].id);
3990      delete timers[which];
3991    }
3992    if (!timeout_ms) return 0;
3993    var id = setTimeout(() => {
3994      delete timers[which];
3995      callUserCallback(() => __emscripten_timeout(which, _emscripten_get_now()));
3996    }, timeout_ms);
3997    timers[which] = {
3998      id,
3999      timeout_ms
4000    };
4001    return 0;
4002  };
4003  function _createImageData(size) {
4004    Module.imageData = new Uint8Array(size);
4005  }
4006  var getHeapMax = () => 2147483648;
4007  var alignMemory = (size, alignment) => Math.ceil(size / alignment) * alignment;
4008  var growMemory = size => {
4009    var oldHeapSize = wasmMemory.buffer.byteLength;
4010    var pages = (size - oldHeapSize + 65535) / 65536 | 0;
4011    try {
4012      wasmMemory.grow(pages);
4013      updateMemoryViews();
4014      return 1;
4015    } catch (e) {}
4016  };
4017  var _emscripten_resize_heap = requestedSize => {
4018    var oldSize = HEAPU8.length;
4019    requestedSize >>>= 0;
4020    var maxHeapSize = getHeapMax();
4021    if (requestedSize > maxHeapSize) {
4022      return false;
4023    }
4024    for (var cutDown = 1; cutDown <= 4; cutDown *= 2) {
4025      var overGrownHeapSize = oldSize * (1 + .2 / cutDown);
4026      overGrownHeapSize = Math.min(overGrownHeapSize, requestedSize + 100663296);
4027      var newSize = Math.min(maxHeapSize, alignMemory(Math.max(requestedSize, overGrownHeapSize), 65536));
4028      var replacement = growMemory(newSize);
4029      if (replacement) {
4030        return true;
4031      }
4032    }
4033    return false;
4034  };
4035  function _setImageData(array_ptr, pitch8, pitch32, height) {
4036    if (pitch32 === pitch8) {
4037      Module.imageData = new Uint8ClampedArray(HEAPU8.subarray(array_ptr, array_ptr + pitch32 * height));
4038      return;
4039    }
4040    const destSize = pitch8 * height;
4041    const imageData = Module.imageData = new Uint8ClampedArray(destSize);
4042    for (let srcStart = array_ptr, destStart = 0; destStart < destSize; srcStart += pitch32, destStart += pitch8) {
4043      imageData.set(HEAPU8.subarray(srcStart, srcStart + pitch8), destStart);
4044    }
4045  }
4046  function _setLineData(line_ptr, pitch8, offset) {
4047    Module.imageData.set(HEAPU8.subarray(line_ptr, line_ptr + pitch8), offset);
4048  }
4049  var writeArrayToMemory = (array, buffer) => {
4050    HEAP8.set(array, buffer);
4051  };
4052  if (Module["noExitRuntime"]) noExitRuntime = Module["noExitRuntime"];
4053  if (Module["print"]) out = Module["print"];
4054  if (Module["printErr"]) err = Module["printErr"];
4055  if (Module["wasmBinary"]) wasmBinary = Module["wasmBinary"];
4056  if (Module["arguments"]) arguments_ = Module["arguments"];
4057  if (Module["thisProgram"]) thisProgram = Module["thisProgram"];
4058  if (Module["preInit"]) {
4059    if (typeof Module["preInit"] == "function") Module["preInit"] = [Module["preInit"]];
4060    while (Module["preInit"].length > 0) {
4061      Module["preInit"].shift()();
4062    }
4063  }
4064  Module["writeArrayToMemory"] = writeArrayToMemory;
4065  var _malloc, _free, _jbig2_decode, _ccitt_decode, __emscripten_timeout, memory, __indirect_function_table, wasmMemory;
4066  function assignWasmExports(wasmExports) {
4067    _malloc = Module["_malloc"] = wasmExports["k"];
4068    _free = Module["_free"] = wasmExports["l"];
4069    _jbig2_decode = Module["_jbig2_decode"] = wasmExports["m"];
4070    _ccitt_decode = Module["_ccitt_decode"] = wasmExports["n"];
4071    __emscripten_timeout = wasmExports["o"];
4072    memory = wasmMemory = wasmExports["i"];
4073    __indirect_function_table = wasmExports["__indirect_function_table"];
4074  }
4075  var wasmImports = {
4076    e: __abort_js,
4077    b: __emscripten_runtime_keepalive_clear,
4078    c: __setitimer_js,
4079    g: _createImageData,
4080    d: _emscripten_resize_heap,
4081    a: _proc_exit,
4082    h: _setImageData,
4083    f: _setLineData
4084  };
4085  function run() {
4086    preRun();
4087    function doRun() {
4088      Module["calledRun"] = true;
4089      if (ABORT) return;
4090      initRuntime();
4091      readyPromiseResolve?.(Module);
4092      Module["onRuntimeInitialized"]?.();
4093      postRun();
4094    }
4095    if (Module["setStatus"]) {
4096      Module["setStatus"]("Running...");
4097      setTimeout(() => {
4098        setTimeout(() => Module["setStatus"](""), 1);
4099        doRun();
4100      }, 1);
4101    } else {
4102      doRun();
4103    }
4104  }
4105  var wasmExports;
4106  wasmExports = await createWasm();
4107  run();
4108  if (runtimeInitialized) {
4109    moduleRtn = Module;
4110  } else {
4111    moduleRtn = new Promise((resolve, reject) => {
4112      readyPromiseResolve = resolve;
4113      readyPromiseReject = reject;
4114    });
4115  }
4116  return moduleRtn;
4117}
4118/* harmony default export */ const jbig2 = (JBig2);
4119;// ./src/core/
vendor: 6,470 bytes, lines 4119-4354
4119jbig2_ccittFax.js
4120
4121
4122
4123class Jbig2Error extends BaseException {
4124  constructor(msg) {
4125    super(msg, "Jbig2Error");
4126  }
4127}
4128class JBig2CCITTFaxImage {
4129  static #buffer = null;
4130  static #handler = null;
4131  static #modulePromise = null;
4132  static #useWasm = true;
4133  static #useWorkerFetch = true;
4134  static #wasmUrl = null;
4135  static setOptions({
4136    handler,
4137    useWasm,
4138    useWorkerFetch,
4139    wasmUrl
4140  }) {
4141    this.#useWasm = useWasm;
4142    this.#useWorkerFetch = useWorkerFetch;
4143    this.#wasmUrl = wasmUrl;
4144    if (!useWorkerFetch) {
4145      this.#handler = handler;
4146    }
4147  }
4148  static async #getJsModule(fallbackCallback) {
4149    const path = `${this.#wasmUrl}jbig2_nowasm_fallback.js`;
4150    let instance = null;
4151    try {
4152      const mod = await import(
4153      /*webpackIgnore: true*/
4154      /*@vite-ignore*/
4155      path);
4156      instance = mod.default();
4157    } catch (e) {
4158      warn(`JBig2CCITTFaxImage#getJsModule: ${e}`);
4159    }
4160    fallbackCallback(instance);
4161  }
4162  static async #instantiateWasm(fallbackCallback, imports, successCallback) {
4163    const filename = "jbig2.wasm";
4164    try {
4165      if (!this.#buffer) {
4166        if (this.#useWorkerFetch) {
4167          this.#buffer = await fetchBinaryData(`${this.#wasmUrl}${filename}`);
4168        } else {
4169          this.#buffer = await this.#handler.sendWithPromise("FetchBinaryData", {
4170            kind: "wasmUrl",
4171            filename
4172          });
4173        }
4174      }
4175      const results = await WebAssembly.instantiate(this.#buffer, imports);
4176      return successCallback(results.instance);
4177    } catch (reason) {
4178      warn(`JBig2CCITTFaxImage#instantiateWasm: ${reason}`);
4179      this.#getJsModule(fallbackCallback);
4180      return null;
4181    } finally {
4182      this.#handler = null;
4183    }
4184  }
4185  static async decode(bytes, width, height, globals, CCITTOptions) {
4186    if (!this.#modulePromise) {
4187      const {
4188        promise,
4189        resolve
4190      } = Promise.withResolvers();
4191      const promises = [promise];
4192      if (!this.#useWasm) {
4193        this.#getJsModule(resolve);
4194      } else {
4195        promises.push(jbig2({
4196          warn: warn,
4197          instantiateWasm: this.#instantiateWasm.bind(this, resolve)
4198        }));
4199      }
4200      this.#modulePromise = Promise.race(promises);
4201    }
4202    const module = await this.#modulePromise;
4203    if (!module) {
4204      throw new Jbig2Error("JBig2 failed to initialize");
4205    }
4206    let ptr, globalsPtr;
4207    try {
4208      const size = bytes.length;
4209      ptr = module._malloc(size);
4210      module.writeArrayToMemory(bytes, ptr);
4211      if (CCITTOptions) {
4212        module._ccitt_decode(ptr, size, width, height, CCITTOptions.K, CCITTOptions.EndOfLine ? 1 : 0, CCITTOptions.EncodedByteAlign ? 1 : 0, CCITTOptions.BlackIs1 ? 1 : 0, CCITTOptions.Columns, CCITTOptions.Rows);
4213      } else {
4214        const globalsSize = globals ? globals.length : 0;
4215        if (globalsSize > 0) {
4216          globalsPtr = module._malloc(globalsSize);
4217          module.writeArrayToMemory(globals, globalsPtr);
4218        }
4219        module._jbig2_decode(ptr, size, width, height, globalsPtr, globalsSize);
4220      }
4221      if (!module.imageData) {
4222        throw new Jbig2Error("Unknown error");
4223      }
4224      const {
4225        imageData
4226      } = module;
4227      module.imageData = null;
4228      return imageData;
4229    } finally {
4230      if (ptr) {
4231        module._free(ptr);
4232      }
4233      if (globalsPtr) {
4234        module._free(globalsPtr);
4235      }
4236    }
4237  }
4238  static cleanup() {
4239    this.#modulePromise = null;
4240  }
4241}
4242
4243;// ./src/core/decode_stream.js
4244
4245
4246const emptyBuffer = new Uint8Array(0);
4247class DecodeStream extends BaseStream {
4248  constructor(maybeMinBufferLength) {
4249    super();
4250    this._rawMinBufferLength = maybeMinBufferLength || 0;
4251    this.pos = 0;
4252    this.bufferLength = 0;
4253    this.eof = false;
4254    this.buffer = emptyBuffer;
4255    this.minBufferLength = 512;
4256    if (maybeMinBufferLength) {
4257      while (this.minBufferLength < maybeMinBufferLength) {
4258        this.minBufferLength *= 2;
4259      }
4260    }
4261  }
4262  get isEmpty() {
4263    while (!this.eof && this.bufferLength === 0) {
4264      this.readBlock();
4265    }
4266    return this.bufferLength === 0;
4267  }
4268  ensureBuffer(requested) {
4269    const buffer = this.buffer;
4270    if (requested <= buffer.byteLength) {
4271      return buffer;
4272    }
4273    let size = this.minBufferLength;
4274    while (size < requested) {
4275      size *= 2;
4276    }
4277    const buffer2 = new Uint8Array(size);
4278    buffer2.set(buffer);
4279    return this.buffer = buffer2;
4280  }
4281  getByte() {
4282    const pos = this.pos;
4283    while (this.bufferLength <= pos) {
4284      if (this.eof) {
4285        return -1;
4286      }
4287      this.readBlock();
4288    }
4289    return this.buffer[this.pos++];
4290  }
4291  getBytes(length, decoderOptions = null) {
4292    const pos = this.pos;
4293    let end;
4294    if (length) {
4295      this.ensureBuffer(pos + length);
4296      end = pos + length;
4297      while (!this.eof && this.bufferLength < end) {
4298        this.readBlock(decoderOptions);
4299      }
4300      const bufEnd = this.bufferLength;
4301      if (end > bufEnd) {
4302        end = bufEnd;
4303      }
4304    } else {
4305      while (!this.eof) {
4306        this.readBlock(decoderOptions);
4307      }
4308      end = this.bufferLength;
4309    }
4310    this.pos = end;
4311    return this.buffer.subarray(pos, end);
4312  }
4313  async getImageData(length, decoderOptions) {
4314    if (!this.canAsyncDecodeImageFromBuffer) {
4315      if (this.isAsyncDecoder) {
4316        return this.decodeImage(null, length, decoderOptions);
4317      }
4318      return this.getBytes(length, decoderOptions);
4319    }
4320    const data = await this.stream.asyncGetBytes();
4321    return this.decodeImage(data, length, decoderOptions);
4322  }
4323  async asyncGetBytesFromDecompressionStream(name) {
4324    this.stream.reset();
4325    const bytes = this.stream.isAsync ? await this.stream.asyncGetBytes() : this.stream.getBytes();
4326    try {
4327      const {
4328        readable,
4329        writable
4330      } = new DecompressionStream(name);
4331      const writer = writable.getWriter();
4332      await writer.ready;
4333      writer.write(bytes).then(async () => {
4334        await writer.ready;
4335        await writer.close();
4336      }).catch(() => {});
4337      const chunks = [];
4338      let totalLength = 0;
4339      for await (const chunk of readable) {
4340        chunks.push(chunk);
4341        totalLength += chunk.byteLength;
4342      }
4343      const data = new Uint8Array(totalLength);
4344      let offset = 0;
4345      for (const chunk of chunks) {
4346        data.set(chunk, offset);
4347        offset += chunk.byteLength;
4348      }
4349      return {
4350        decompressed: data,
4351        compressed: bytes
4352      };
4353    } catch {
4354      return {
vendor: 7,422 bytes, lines 4355-4618
4355        decompressed: null,
4356        compressed: bytes
4357      };
4358    }
4359  }
4360  reset() {
4361    this.pos = 0;
4362  }
4363  makeSubStream(start, length, dict = null) {
4364    if (length === undefined) {
4365      while (!this.eof) {
4366        this.readBlock();
4367      }
4368    } else {
4369      const end = start + length;
4370      while (this.bufferLength <= end && !this.eof) {
4371        this.readBlock();
4372      }
4373    }
4374    return new Stream(this.buffer, start, length, dict);
4375  }
4376  getBaseStreams() {
4377    return this.stream ? this.stream.getBaseStreams() : null;
4378  }
4379  clone() {
4380    while (!this.eof) {
4381      this.readBlock();
4382    }
4383    return new Stream(this.buffer, this.start, this.end - this.start, this.dict.clone());
4384  }
4385}
4386class StreamsSequenceStream extends DecodeStream {
4387  constructor(streams, onError = null) {
4388    streams = streams.filter(s => s instanceof BaseStream && !s.isImageStream);
4389    let maybeLength = 0;
4390    for (const stream of streams) {
4391      maybeLength += stream instanceof DecodeStream ? stream._rawMinBufferLength : stream.length;
4392    }
4393    super(maybeLength);
4394    this.streams = streams;
4395    this._onError = onError;
4396  }
4397  readBlock() {
4398    const streams = this.streams;
4399    if (streams.length === 0) {
4400      this.eof = true;
4401      return;
4402    }
4403    const stream = streams.shift();
4404    let chunk;
4405    try {
4406      chunk = stream.getBytes();
4407    } catch (reason) {
4408      if (this._onError) {
4409        this._onError(reason, stream.dict?.objId);
4410        return;
4411      }
4412      throw reason;
4413    }
4414    const bufferLength = this.bufferLength;
4415    const newLength = bufferLength + chunk.length;
4416    const buffer = this.ensureBuffer(newLength);
4417    buffer.set(chunk, bufferLength);
4418    this.bufferLength = newLength;
4419  }
4420  getBaseStreams() {
4421    const baseStreamsBuf = [];
4422    for (const stream of this.streams) {
4423      const baseStreams = stream.getBaseStreams();
4424      if (baseStreams) {
4425        baseStreamsBuf.push(...baseStreams);
4426      }
4427    }
4428    return baseStreamsBuf.length > 0 ? baseStreamsBuf : null;
4429  }
4430}
4431
4432;// ./src/core/colorspace_utils.js
4433
4434
4435
4436
4437
4438
4439class ColorSpaceUtils {
4440  static parse({
4441    cs,
4442    xref,
4443    resources = null,
4444    pdfFunctionFactory,
4445    globalColorSpaceCache,
4446    localColorSpaceCache,
4447    asyncIfNotCached = false
4448  }) {
4449    const options = {
4450      xref,
4451      resources,
4452      pdfFunctionFactory,
4453      globalColorSpaceCache,
4454      localColorSpaceCache
4455    };
4456    let csName, csRef, parsedCS;
4457    if (cs instanceof Ref) {
4458      csRef = cs;
4459      const cachedCS = globalColorSpaceCache.getByRef(csRef) || localColorSpaceCache.getByRef(csRef);
4460      if (cachedCS) {
4461        return cachedCS;
4462      }
4463      cs = xref.fetch(cs);
4464    }
4465    if (cs instanceof Name) {
4466      csName = cs.name;
4467      const cachedCS = localColorSpaceCache.getByName(csName);
4468      if (cachedCS) {
4469        return cachedCS;
4470      }
4471    }
4472    try {
4473      parsedCS = this.#parse(cs, options);
4474    } catch (ex) {
4475      if (asyncIfNotCached && !(ex instanceof MissingDataException)) {
4476        return Promise.reject(ex);
4477      }
4478      throw ex;
4479    }
4480    if (csName || csRef) {
4481      localColorSpaceCache.set(csName, csRef, parsedCS);
4482      if (csRef) {
4483        globalColorSpaceCache.set(null, csRef, parsedCS);
4484      }
4485    }
4486    return asyncIfNotCached ? Promise.resolve(parsedCS) : parsedCS;
4487  }
4488  static #subParse(cs, options) {
4489    const {
4490      globalColorSpaceCache
4491    } = options;
4492    let csRef;
4493    if (cs instanceof Ref) {
4494      csRef = cs;
4495      const cachedCS = globalColorSpaceCache.getByRef(csRef);
4496      if (cachedCS) {
4497        return cachedCS;
4498      }
4499    }
4500    const parsedCS = this.#parse(cs, options);
4501    if (csRef) {
4502      globalColorSpaceCache.set(null, csRef, parsedCS);
4503    }
4504    return parsedCS;
4505  }
4506  static #parse(cs, options) {
4507    const {
4508      xref,
4509      resources,
4510      pdfFunctionFactory,
4511      globalColorSpaceCache
4512    } = options;
4513    cs = xref.fetchIfRef(cs);
4514    if (cs instanceof Name) {
4515      switch (cs.name) {
4516        case "G":
4517        case "DeviceGray":
4518          return this.gray;
4519        case "RGB":
4520        case "DeviceRGB":
4521          return this.rgb;
4522        case "DeviceRGBA":
4523          return this.rgba;
4524        case "CMYK":
4525        case "DeviceCMYK":
4526          return this.cmyk;
4527        case "Pattern":
4528          return new PatternCS(null);
4529        default:
4530          if (resources instanceof Dict) {
4531            const colorSpaces = resources.get("ColorSpace");
4532            if (colorSpaces instanceof Dict) {
4533              const resourcesCS = colorSpaces.get(cs.name);
4534              if (resourcesCS) {
4535                if (resourcesCS instanceof Name) {
4536                  return this.#parse(resourcesCS, options);
4537                }
4538                cs = resourcesCS;
4539                break;
4540              }
4541            }
4542          }
4543          warn(`Unrecognized ColorSpace: ${cs.name}`);
4544          return this.gray;
4545      }
4546    }
4547    if (Array.isArray(cs)) {
4548      const mode = xref.fetchIfRef(cs[0]).name;
4549      let params, numComps, baseCS, whitePoint, blackPoint, gamma;
4550      switch (mode) {
4551        case "G":
4552        case "DeviceGray":
4553          return this.gray;
4554        case "RGB":
4555        case "DeviceRGB":
4556          return this.rgb;
4557        case "CMYK":
4558        case "DeviceCMYK":
4559          return this.cmyk;
4560        case "CalGray":
4561          params = xref.fetchIfRef(cs[1]);
4562          whitePoint = params.getArray("WhitePoint");
4563          blackPoint = params.getArray("BlackPoint");
4564          gamma = params.get("Gamma");
4565          return new CalGrayCS(whitePoint, blackPoint, gamma);
4566        case "CalRGB":
4567          params = xref.fetchIfRef(cs[1]);
4568          whitePoint = params.getArray("WhitePoint");
4569          blackPoint = params.getArray("BlackPoint");
4570          gamma = params.getArray("Gamma");
4571          const matrix = params.getArray("Matrix");
4572          return new CalRGBCS(whitePoint, blackPoint, gamma, matrix);
4573        case "ICCBased":
4574          const isRef = cs[1] instanceof Ref;
4575          if (isRef) {
4576            const cachedCS = globalColorSpaceCache.getByRef(cs[1]);
4577            if (cachedCS) {
4578              return cachedCS;
4579            }
4580          }
4581          const stream = xref.fetchIfRef(cs[1]);
4582          const dict = stream.dict;
4583          numComps = dict.get("N");
4584          if (IccColorSpace.isUsable) {
4585            try {
4586              const iccCS = new IccColorSpace(stream.getBytes(), "ICCBased", numComps);
4587              if (isRef) {
4588                globalColorSpaceCache.set(null, cs[1], iccCS);
4589              }
4590              return iccCS;
4591            } catch (ex) {
4592              if (ex instanceof MissingDataException) {
4593                throw ex;
4594              }
4595              warn(`ICCBased color space (${cs[1]}): "${ex}".`);
4596            }
4597          }
4598          const altRaw = dict.getRaw("Alternate");
4599          if (altRaw) {
4600            const altCS = this.#subParse(altRaw, options);
4601            if (altCS.numComps === numComps) {
4602              return altCS;
4603            }
4604            warn("ICCBased color space: Ignoring incorrect /Alternate entry.");
4605          }
4606          if (numComps === 1) {
4607            return this.gray;
4608          } else if (numComps === 3) {
4609            return this.rgb;
4610          } else if (numComps === 4) {
4611            return this.cmyk;
4612          }
4613          break;
4614        case "Pattern":
4615          baseCS = cs[1] || null;
4616          if (baseCS) {
4617            baseCS = this.#subParse(baseCS, options);
4618          }
vendor: 13,407 bytes, lines 4618-5068
4618
4619          return new PatternCS(baseCS);
4620        case "I":
4621        case "Indexed":
4622          baseCS = this.#subParse(cs[1], options);
4623          const hiVal = MathClamp(xref.fetchIfRef(cs[2]), 0, 255);
4624          const lookup = xref.fetchIfRef(cs[3]);
4625          return new IndexedCS(baseCS, hiVal, lookup);
4626        case "Separation":
4627        case "DeviceN":
4628          const name = xref.fetchIfRef(cs[1]);
4629          numComps = Array.isArray(name) ? name.length : 1;
4630          baseCS = this.#subParse(cs[2], options);
4631          const tintFn = pdfFunctionFactory.create(cs[3]);
4632          return new AlternateCS(numComps, baseCS, tintFn);
4633        case "Lab":
4634          params = xref.fetchIfRef(cs[1]);
4635          whitePoint = params.getArray("WhitePoint");
4636          blackPoint = params.getArray("BlackPoint");
4637          const range = params.getArray("Range");
4638          return new LabCS(whitePoint, blackPoint, range);
4639        default:
4640          warn(`Unimplemented ColorSpace object: ${mode}`);
4641          return this.gray;
4642      }
4643    }
4644    warn(`Unrecognized ColorSpace object: ${cs}`);
4645    return this.gray;
4646  }
4647  static get gray() {
4648    return shadow(this, "gray", new DeviceGrayCS());
4649  }
4650  static get rgb() {
4651    return shadow(this, "rgb", new DeviceRgbCS());
4652  }
4653  static get rgba() {
4654    return shadow(this, "rgba", new DeviceRgbaCS());
4655  }
4656  static get cmyk() {
4657    if (CmykICCBasedCS.isUsable) {
4658      try {
4659        return shadow(this, "cmyk", new CmykICCBasedCS());
4660      } catch {
4661        warn("CMYK fallback: DeviceCMYK");
4662      }
4663    }
4664    return shadow(this, "cmyk", new DeviceCmykCS());
4665  }
4666}
4667
4668;// ./src/core/jpg.js
4669
4670
4671
4672
4673class JpegError extends BaseException {
4674  constructor(msg) {
4675    super(msg, "JpegError");
4676  }
4677}
4678class DNLMarkerError extends BaseException {
4679  constructor(message, scanLines) {
4680    super(message, "DNLMarkerError");
4681    this.scanLines = scanLines;
4682  }
4683}
4684class EOIMarkerError extends BaseException {
4685  constructor(msg) {
4686    super(msg, "EOIMarkerError");
4687  }
4688}
4689const dctZigZag = new Uint8Array([0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5, 12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28, 35, 42, 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51, 58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63]);
4690const dctCos1 = 4017;
4691const dctSin1 = 799;
4692const dctCos3 = 3406;
4693const dctSin3 = 2276;
4694const dctCos6 = 1567;
4695const dctSin6 = 3784;
4696const dctSqrt2 = 5793;
4697const dctSqrt1d2 = 2896;
4698function buildHuffmanTable(codeLengths, values) {
4699  let k = 0,
4700    i,
4701    j,
4702    length = 16;
4703  while (length > 0 && !codeLengths[length - 1]) {
4704    length--;
4705  }
4706  const code = [{
4707    children: [],
4708    index: 0
4709  }];
4710  let p = code[0],
4711    q;
4712  for (i = 0; i < length; i++) {
4713    for (j = 0; j < codeLengths[i]; j++) {
4714      p = code.pop();
4715      p.children[p.index] = values[k];
4716      while (p.index > 0) {
4717        p = code.pop();
4718      }
4719      p.index++;
4720      code.push(p);
4721      while (code.length <= i) {
4722        code.push(q = {
4723          children: [],
4724          index: 0
4725        });
4726        p.children[p.index] = q.children;
4727        p = q;
4728      }
4729      k++;
4730    }
4731    if (i + 1 < length) {
4732      code.push(q = {
4733        children: [],
4734        index: 0
4735      });
4736      p.children[p.index] = q.children;
4737      p = q;
4738    }
4739  }
4740  return code[0].children;
4741}
4742function getBlockBufferOffset(component, row, col) {
4743  return 64 * ((component.blocksPerLine + 1) * row + col);
4744}
4745function decodeScan(data, view, offset, frame, components, resetInterval, spectralStart, spectralEnd, successivePrev, successive, parseDNLMarker = false) {
4746  const mcusPerLine = frame.mcusPerLine;
4747  const progressive = frame.progressive;
4748  const startOffset = offset;
4749  let bitsData = 0,
4750    bitsCount = 0;
4751  function readBit() {
4752    if (bitsCount > 0) {
4753      bitsCount--;
4754      return bitsData >> bitsCount & 1;
4755    }
4756    bitsData = data[offset++];
4757    if (bitsData === 0xff) {
4758      const nextByte = data[offset++];
4759      if (nextByte) {
4760        if (nextByte === 0xdc && parseDNLMarker) {
4761          offset += 2;
4762          const scanLines = view.getUint16(offset);
4763          offset += 2;
4764          if (scanLines > 0 && scanLines !== frame.scanLines) {
4765            throw new DNLMarkerError("Found DNL marker (0xFFDC) while parsing scan data", scanLines);
4766          }
4767        } else if (nextByte === 0xd9) {
4768          if (parseDNLMarker) {
4769            const maybeScanLines = blockRow * (frame.precision === 8 ? 8 : 0);
4770            if (maybeScanLines > 0 && Math.round(frame.scanLines / maybeScanLines) >= 5) {
4771              throw new DNLMarkerError("Found EOI marker (0xFFD9) while parsing scan data, " + "possibly caused by incorrect `scanLines` parameter", maybeScanLines);
4772            }
4773          }
4774          throw new EOIMarkerError("Found EOI marker (0xFFD9) while parsing scan data");
4775        }
4776        throw new JpegError(`unexpected marker ${(bitsData << 8 | nextByte).toString(16)}`);
4777      }
4778    }
4779    bitsCount = 7;
4780    return bitsData >>> 7;
4781  }
4782  function decodeHuffman(tree) {
4783    let node = tree;
4784    while (true) {
4785      node = node[readBit()];
4786      switch (typeof node) {
4787        case "number":
4788          return node;
4789        case "object":
4790          continue;
4791      }
4792      throw new JpegError("invalid huffman sequence");
4793    }
4794  }
4795  function receive(length) {
4796    let n = 0;
4797    while (length > 0) {
4798      n = n << 1 | readBit();
4799      length--;
4800    }
4801    return n;
4802  }
4803  function receiveAndExtend(length) {
4804    if (length === 1) {
4805      return readBit() === 1 ? 1 : -1;
4806    }
4807    const n = receive(length);
4808    if (n >= 1 << length - 1) {
4809      return n;
4810    }
4811    return n + (-1 << length) + 1;
4812  }
4813  function decodeBaseline(component, blockOffset) {
4814    const t = decodeHuffman(component.huffmanTableDC);
4815    const diff = t === 0 ? 0 : receiveAndExtend(t);
4816    component.blockData[blockOffset] = component.pred += diff;
4817    let k = 1;
4818    while (k < 64) {
4819      const rs = decodeHuffman(component.huffmanTableAC);
4820      const s = rs & 15,
4821        r = rs >> 4;
4822      if (s === 0) {
4823        if (r < 15) {
4824          break;
4825        }
4826        k += 16;
4827        continue;
4828      }
4829      k += r;
4830      const z = dctZigZag[k];
4831      component.blockData[blockOffset + z] = receiveAndExtend(s);
4832      k++;
4833    }
4834  }
4835  function decodeDCFirst(component, blockOffset) {
4836    const t = decodeHuffman(component.huffmanTableDC);
4837    const diff = t === 0 ? 0 : receiveAndExtend(t) << successive;
4838    component.blockData[blockOffset] = component.pred += diff;
4839  }
4840  function decodeDCSuccessive(component, blockOffset) {
4841    component.blockData[blockOffset] |= readBit() << successive;
4842  }
4843  let eobrun = 0;
4844  function decodeACFirst(component, blockOffset) {
4845    if (eobrun > 0) {
4846      eobrun--;
4847      return;
4848    }
4849    let k = spectralStart;
4850    const e = spectralEnd;
4851    while (k <= e) {
4852      const rs = decodeHuffman(component.huffmanTableAC);
4853      const s = rs & 15,
4854        r = rs >> 4;
4855      if (s === 0) {
4856        if (r < 15) {
4857          eobrun = receive(r) + (1 << r) - 1;
4858          break;
4859        }
4860        k += 16;
4861        continue;
4862      }
4863      k += r;
4864      const z = dctZigZag[k];
4865      component.blockData[blockOffset + z] = receiveAndExtend(s) * (1 << successive);
4866      k++;
4867    }
4868  }
4869  let successiveACState = 0,
4870    successiveACNextValue;
4871  function decodeACSuccessive(component, blockOffset) {
4872    let k = spectralStart;
4873    const e = spectralEnd;
4874    let r = 0;
4875    let s;
4876    let rs;
4877    while (k <= e) {
4878      const offsetZ = blockOffset + dctZigZag[k];
4879      const sign = component.blockData[offsetZ] < 0 ? -1 : 1;
4880      switch (successiveACState) {
4881        case 0:
4882          rs = decodeHuffman(component.huffmanTableAC);
4883          s = rs & 15;
4884          r = rs >> 4;
4885          if (s === 0) {
4886            if (r < 15) {
4887              eobrun = receive(r) + (1 << r);
4888              successiveACState = 4;
4889            } else {
4890              r = 16;
4891              successiveACState = 1;
4892            }
4893          } else {
4894            if (s !== 1) {
4895              throw new JpegError("invalid ACn encoding");
4896            }
4897            successiveACNextValue = receiveAndExtend(s);
4898            successiveACState = r ? 2 : 3;
4899          }
4900          continue;
4901        case 1:
4902        case 2:
4903          if (component.blockData[offsetZ]) {
4904            component.blockData[offsetZ] += sign * (readBit() << successive);
4905          } else {
4906            r--;
4907            if (r === 0) {
4908              successiveACState = successiveACState === 2 ? 3 : 0;
4909            }
4910          }
4911          break;
4912        case 3:
4913          if (component.blockData[offsetZ]) {
4914            component.blockData[offsetZ] += sign * (readBit() << successive);
4915          } else {
4916            component.blockData[offsetZ] = successiveACNextValue << successive;
4917            successiveACState = 0;
4918          }
4919          break;
4920        case 4:
4921          if (component.blockData[offsetZ]) {
4922            component.blockData[offsetZ] += sign * (readBit() << successive);
4923          }
4924          break;
4925      }
4926      k++;
4927    }
4928    if (successiveACState === 4) {
4929      eobrun--;
4930      if (eobrun === 0) {
4931        successiveACState = 0;
4932      }
4933    }
4934  }
4935  let blockRow = 0;
4936  function decodeMcu(component, decode, mcu, row, col) {
4937    const mcuRow = mcu / mcusPerLine | 0;
4938    const mcuCol = mcu % mcusPerLine;
4939    blockRow = mcuRow * component.v + row;
4940    const blockCol = mcuCol * component.h + col;
4941    const blockOffset = getBlockBufferOffset(component, blockRow, blockCol);
4942    decode(component, blockOffset);
4943  }
4944  function decodeBlock(component, decode, mcu) {
4945    blockRow = mcu / component.blocksPerLine | 0;
4946    const blockCol = mcu % component.blocksPerLine;
4947    const blockOffset = getBlockBufferOffset(component, blockRow, blockCol);
4948    decode(component, blockOffset);
4949  }
4950  const componentsLength = components.length;
4951  let component, i, j, k, n;
4952  let decodeFn;
4953  if (progressive) {
4954    if (spectralStart === 0) {
4955      decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive;
4956    } else {
4957      decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive;
4958    }
4959  } else {
4960    decodeFn = decodeBaseline;
4961  }
4962  let mcu = 0,
4963    fileMarker;
4964  const mcuExpected = componentsLength === 1 ? components[0].blocksPerLine * components[0].blocksPerColumn : mcusPerLine * frame.mcusPerColumn;
4965  let h, v;
4966  while (mcu <= mcuExpected) {
4967    const mcuToRead = resetInterval ? Math.min(mcuExpected - mcu, resetInterval) : mcuExpected;
4968    if (mcuToRead > 0) {
4969      for (i = 0; i < componentsLength; i++) {
4970        components[i].pred = 0;
4971      }
4972      eobrun = 0;
4973      if (componentsLength === 1) {
4974        component = components[0];
4975        for (n = 0; n < mcuToRead; n++) {
4976          decodeBlock(component, decodeFn, mcu);
4977          mcu++;
4978        }
4979      } else {
4980        for (n = 0; n < mcuToRead; n++) {
4981          for (i = 0; i < componentsLength; i++) {
4982            component = components[i];
4983            h = component.h;
4984            v = component.v;
4985            for (j = 0; j < v; j++) {
4986              for (k = 0; k < h; k++) {
4987                decodeMcu(component, decodeFn, mcu, j, k);
4988              }
4989            }
4990          }
4991          mcu++;
4992        }
4993      }
4994    }
4995    bitsCount = 0;
4996    fileMarker = findNextFileMarker(data, view, offset);
4997    if (!fileMarker) {
4998      break;
4999    }
5000    if (fileMarker.invalid) {
5001      const partialMsg = mcuToRead > 0 ? "unexpected" : "excessive";
5002      warn(`decodeScan - ${partialMsg} MCU data, current marker is: ${fileMarker.invalid}`);
5003      offset = fileMarker.offset;
5004    }
5005    if (fileMarker.marker >= 0xffd0 && fileMarker.marker <= 0xffd7) {
5006      offset += 2;
5007    } else {
5008      break;
5009    }
5010  }
5011  return offset - startOffset;
5012}
5013function quantizeAndInverse(component, blockBufferOffset, p) {
5014  const qt = component.quantizationTable,
5015    blockData = component.blockData;
5016  let v0, v1, v2, v3, v4, v5, v6, v7;
5017  let p0, p1, p2, p3, p4, p5, p6, p7;
5018  let t;
5019  if (!qt) {
5020    throw new JpegError("missing required Quantization Table.");
5021  }
5022  for (let row = 0; row < 64; row += 8) {
5023    p0 = blockData[blockBufferOffset + row];
5024    p1 = blockData[blockBufferOffset + row + 1];
5025    p2 = blockData[blockBufferOffset + row + 2];
5026    p3 = blockData[blockBufferOffset + row + 3];
5027    p4 = blockData[blockBufferOffset + row + 4];
5028    p5 = blockData[blockBufferOffset + row + 5];
5029    p6 = blockData[blockBufferOffset + row + 6];
5030    p7 = blockData[blockBufferOffset + row + 7];
5031    p0 *= qt[row];
5032    if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
5033      t = dctSqrt2 * p0 + 512 >> 10;
5034      p[row] = t;
5035      p[row + 1] = t;
5036      p[row + 2] = t;
5037      p[row + 3] = t;
5038      p[row + 4] = t;
5039      p[row + 5] = t;
5040      p[row + 6] = t;
5041      p[row + 7] = t;
5042      continue;
5043    }
5044    p1 *= qt[row + 1];
5045    p2 *= qt[row + 2];
5046    p3 *= qt[row + 3];
5047    p4 *= qt[row + 4];
5048    p5 *= qt[row + 5];
5049    p6 *= qt[row + 6];
5050    p7 *= qt[row + 7];
5051    v0 = dctSqrt2 * p0 + 128 >> 8;
5052    v1 = dctSqrt2 * p4 + 128 >> 8;
5053    v2 = p2;
5054    v3 = p6;
5055    v4 = dctSqrt1d2 * (p1 - p7) + 128 >> 8;
5056    v7 = dctSqrt1d2 * (p1 + p7) + 128 >> 8;
5057    v5 = p3 << 4;
5058    v6 = p5 << 4;
5059    v0 = v0 + v1 + 1 >> 1;
5060    v1 = v0 - v1;
5061    t = v2 * dctSin6 + v3 * dctCos6 + 128 >> 8;
5062    v2 = v2 * dctCos6 - v3 * dctSin6 + 128 >> 8;
5063    v3 = t;
5064    v4 = v4 + v6 + 1 >> 1;
5065    v6 = v4 - v6;
5066    v7 = v7 + v5 + 1 >> 1;
5067    v5 = v7 - v5;
5068    v0 = v0 + v3 + 1 >> 1;
vendor: 1,964 bytes, lines 5069-5136
5069    v3 = v0 - v3;
5070    v1 = v1 + v2 + 1 >> 1;
5071    v2 = v1 - v2;
5072    t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
5073    v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
5074    v7 = t;
5075    t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
5076    v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
5077    v6 = t;
5078    p[row] = v0 + v7;
5079    p[row + 7] = v0 - v7;
5080    p[row + 1] = v1 + v6;
5081    p[row + 6] = v1 - v6;
5082    p[row + 2] = v2 + v5;
5083    p[row + 5] = v2 - v5;
5084    p[row + 3] = v3 + v4;
5085    p[row + 4] = v3 - v4;
5086  }
5087  for (let col = 0; col < 8; ++col) {
5088    p0 = p[col];
5089    p1 = p[col + 8];
5090    p2 = p[col + 16];
5091    p3 = p[col + 24];
5092    p4 = p[col + 32];
5093    p5 = p[col + 40];
5094    p6 = p[col + 48];
5095    p7 = p[col + 56];
5096    if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
5097      t = dctSqrt2 * p0 + 8192 >> 14;
5098      if (t < -2040) {
5099        t = 0;
5100      } else if (t >= 2024) {
5101        t = 255;
5102      } else {
5103        t = t + 2056 >> 4;
5104      }
5105      blockData[blockBufferOffset + col] = t;
5106      blockData[blockBufferOffset + col + 8] = t;
5107      blockData[blockBufferOffset + col + 16] = t;
5108      blockData[blockBufferOffset + col + 24] = t;
5109      blockData[blockBufferOffset + col + 32] = t;
5110      blockData[blockBufferOffset + col + 40] = t;
5111      blockData[blockBufferOffset + col + 48] = t;
5112      blockData[blockBufferOffset + col + 56] = t;
5113      continue;
5114    }
5115    v0 = dctSqrt2 * p0 + 2048 >> 12;
5116    v1 = dctSqrt2 * p4 + 2048 >> 12;
5117    v2 = p2;
5118    v3 = p6;
5119    v4 = dctSqrt1d2 * (p1 - p7) + 2048 >> 12;
5120    v7 = dctSqrt1d2 * (p1 + p7) + 2048 >> 12;
5121    v5 = p3;
5122    v6 = p5;
5123    v0 = (v0 + v1 + 1 >> 1) + 4112;
5124    v1 = v0 - v1;
5125    t = v2 * dctSin6 + v3 * dctCos6 + 2048 >> 12;
5126    v2 = v2 * dctCos6 - v3 * dctSin6 + 2048 >> 12;
5127    v3 = t;
5128    v4 = v4 + v6 + 1 >> 1;
5129    v6 = v4 - v6;
5130    v7 = v7 + v5 + 1 >> 1;
5131    v5 = v7 - v5;
5132    v0 = v0 + v3 + 1 >> 1;
5133    v3 = v0 - v3;
5134    v1 = v1 + v2 + 1 >> 1;
5135    v2 = v1 - v2;
5136    t = v4 * dctSin3 + v7 * dctCos3 + 2048 >>
vendor: 4,581 bytes, lines 5136-5298
5136 12;
5137    v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
5138    v7 = t;
5139    t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
5140    v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
5141    v6 = t;
5142    p0 = v0 + v7;
5143    p7 = v0 - v7;
5144    p1 = v1 + v6;
5145    p6 = v1 - v6;
5146    p2 = v2 + v5;
5147    p5 = v2 - v5;
5148    p3 = v3 + v4;
5149    p4 = v3 - v4;
5150    if (p0 < 16) {
5151      p0 = 0;
5152    } else if (p0 >= 4080) {
5153      p0 = 255;
5154    } else {
5155      p0 >>= 4;
5156    }
5157    if (p1 < 16) {
5158      p1 = 0;
5159    } else if (p1 >= 4080) {
5160      p1 = 255;
5161    } else {
5162      p1 >>= 4;
5163    }
5164    if (p2 < 16) {
5165      p2 = 0;
5166    } else if (p2 >= 4080) {
5167      p2 = 255;
5168    } else {
5169      p2 >>= 4;
5170    }
5171    if (p3 < 16) {
5172      p3 = 0;
5173    } else if (p3 >= 4080) {
5174      p3 = 255;
5175    } else {
5176      p3 >>= 4;
5177    }
5178    if (p4 < 16) {
5179      p4 = 0;
5180    } else if (p4 >= 4080) {
5181      p4 = 255;
5182    } else {
5183      p4 >>= 4;
5184    }
5185    if (p5 < 16) {
5186      p5 = 0;
5187    } else if (p5 >= 4080) {
5188      p5 = 255;
5189    } else {
5190      p5 >>= 4;
5191    }
5192    if (p6 < 16) {
5193      p6 = 0;
5194    } else if (p6 >= 4080) {
5195      p6 = 255;
5196    } else {
5197      p6 >>= 4;
5198    }
5199    if (p7 < 16) {
5200      p7 = 0;
5201    } else if (p7 >= 4080) {
5202      p7 = 255;
5203    } else {
5204      p7 >>= 4;
5205    }
5206    blockData[blockBufferOffset + col] = p0;
5207    blockData[blockBufferOffset + col + 8] = p1;
5208    blockData[blockBufferOffset + col + 16] = p2;
5209    blockData[blockBufferOffset + col + 24] = p3;
5210    blockData[blockBufferOffset + col + 32] = p4;
5211    blockData[blockBufferOffset + col + 40] = p5;
5212    blockData[blockBufferOffset + col + 48] = p6;
5213    blockData[blockBufferOffset + col + 56] = p7;
5214  }
5215}
5216function buildComponentData(frame, component) {
5217  const blocksPerLine = component.blocksPerLine;
5218  const blocksPerColumn = component.blocksPerColumn;
5219  const computationBuffer = new Int16Array(64);
5220  for (let blockRow = 0; blockRow < blocksPerColumn; blockRow++) {
5221    for (let blockCol = 0; blockCol < blocksPerLine; blockCol++) {
5222      const offset = getBlockBufferOffset(component, blockRow, blockCol);
5223      quantizeAndInverse(component, offset, computationBuffer);
5224    }
5225  }
5226  return component.blockData;
5227}
5228function findNextFileMarker(data, view, currentPos, startPos = currentPos) {
5229  const maxPos = data.length - 1;
5230  let newPos = startPos < currentPos ? startPos : currentPos;
5231  if (currentPos >= maxPos) {
5232    return null;
5233  }
5234  const currentMarker = view.getUint16(currentPos);
5235  if (currentMarker >= 0xffc0 && currentMarker <= 0xfffe) {
5236    return {
5237      invalid: null,
5238      marker: currentMarker,
5239      offset: currentPos
5240    };
5241  }
5242  let newMarker = view.getUint16(newPos);
5243  while (!(newMarker >= 0xffc0 && newMarker <= 0xfffe)) {
5244    if (++newPos >= maxPos) {
5245      return null;
5246    }
5247    newMarker = view.getUint16(newPos);
5248  }
5249  return {
5250    invalid: currentMarker.toString(16),
5251    marker: newMarker,
5252    offset: newPos
5253  };
5254}
5255function prepareComponents(frame) {
5256  const mcusPerLine = Math.ceil(frame.samplesPerLine / 8 / frame.maxH);
5257  const mcusPerColumn = Math.ceil(frame.scanLines / 8 / frame.maxV);
5258  for (const component of frame.components) {
5259    const blocksPerLine = Math.ceil(Math.ceil(frame.samplesPerLine / 8) * component.h / frame.maxH);
5260    const blocksPerColumn = Math.ceil(Math.ceil(frame.scanLines / 8) * component.v / frame.maxV);
5261    const blocksPerLineForMcu = mcusPerLine * component.h;
5262    const blocksPerColumnForMcu = mcusPerColumn * component.v;
5263    const blocksBufferSize = 64 * blocksPerColumnForMcu * (blocksPerLineForMcu + 1);
5264    component.blockData = new Int16Array(blocksBufferSize);
5265    component.blocksPerLine = blocksPerLine;
5266    component.blocksPerColumn = blocksPerColumn;
5267  }
5268  frame.mcusPerLine = mcusPerLine;
5269  frame.mcusPerColumn = mcusPerColumn;
5270}
5271function readDataBlock(data, view, offset) {
5272  const length = view.getUint16(offset);
5273  offset += 2;
5274  let endOffset = offset + length - 2;
5275  const fileMarker = findNextFileMarker(data, view, endOffset, offset);
5276  if (fileMarker?.invalid) {
5277    warn("readDataBlock - incorrect length, current marker is: " + fileMarker.invalid);
5278    endOffset = fileMarker.offset;
5279  }
5280  const array = data.subarray(offset, endOffset);
5281  return {
5282    appData: array,
5283    oldOffset: offset,
5284    newOffset: offset + array.length
5285  };
5286}
5287function skipData(data, view, offset) {
5288  const length = view.getUint16(offset);
5289  offset += 2;
5290  const endOffset = offset + length - 2;
5291  const fileMarker = findNextFileMarker(data, view, endOffset, offset);
5292  if (fileMarker?.invalid) {
5293    return fileMarker.offset;
5294  }
5295  return endOffset;
5296}
5297class JpegImage {
5298  constructor(
5298{
5299    decodeTransform = null,
5300    colorTransform = -1
5301  } = {}) {
5302    this._decodeTransform = decodeTransform;
5303    this._colorTransform = colorTransform;
5304  }
5305  static canUseImageDecoder(data, colorTransform = -1) {
5306    const view = new DataView(data.buffer, data.byteOffset, data.byteLength);
5307    let exifOffsets = null;
5308    let offset = 0;
5309    let numComponents = null;
5310    let fileMarker = view.getUint16(offset);
5311    offset += 2;
5312    if (fileMarker !== 0xffd8) {
5313      throw new JpegError("SOI not found");
5314    }
5315    fileMarker = view.getUint16(offset);
5316    offset += 2;
5317    markerLoop: while (fileMarker !== 0xffd9) {
5318      switch (fileMarker) {
5319        case 0xffe1:
5320          const {
5321            appData,
5322            oldOffset,
5323            newOffset
5324          } = readDataBlock(data, view, offset);
5325          offset = newOffset;
5326          if (appData[0] === 0x45 && appData[1] === 0x78 && appData[2] === 0x69 && appData[3] === 0x66 && appData[4] === 0 && appData[5] === 0) {
5327            if (exifOffsets) {
vendor: 8,033 bytes, lines 5328-5554
5328              throw new JpegError("Duplicate EXIF-blocks found.");
5329            }
5330            exifOffsets = {
5331              exifStart: oldOffset + 6,
5332              exifEnd: newOffset
5333            };
5334          }
5335          fileMarker = view.getUint16(offset);
5336          offset += 2;
5337          continue;
5338        case 0xffc0:
5339        case 0xffc1:
5340        case 0xffc2:
5341          numComponents = data[offset + (2 + 1 + 2 + 2)];
5342          break markerLoop;
5343        case 0xffff:
5344          if (data[offset] !== 0xff) {
5345            offset--;
5346          }
5347          break;
5348      }
5349      offset = skipData(data, view, offset);
5350      fileMarker = view.getUint16(offset);
5351      offset += 2;
5352    }
5353    if (numComponents === 4) {
5354      return null;
5355    }
5356    if (numComponents === 3 && colorTransform === 0) {
5357      return null;
5358    }
5359    return exifOffsets || {};
5360  }
5361  parse(data, {
5362    dnlScanLines = null
5363  } = {}) {
5364    const view = new DataView(data.buffer, data.byteOffset, data.byteLength);
5365    const maxOffset = data.length - 1;
5366    let offset = 0;
5367    let jfif = null;
5368    let adobe = null;
5369    let frame, resetInterval;
5370    let numSOSMarkers = 0;
5371    const quantizationTables = [];
5372    const huffmanTablesAC = [],
5373      huffmanTablesDC = [];
5374    let fileMarker = view.getUint16(offset);
5375    offset += 2;
5376    if (fileMarker !== 0xffd8) {
5377      throw new JpegError("SOI not found");
5378    }
5379    fileMarker = view.getUint16(offset);
5380    offset += 2;
5381    markerLoop: while (fileMarker !== 0xffd9) {
5382      let i, j, l;
5383      switch (fileMarker) {
5384        case 0xffe0:
5385        case 0xffe1:
5386        case 0xffe2:
5387        case 0xffe3:
5388        case 0xffe4:
5389        case 0xffe5:
5390        case 0xffe6:
5391        case 0xffe7:
5392        case 0xffe8:
5393        case 0xffe9:
5394        case 0xffea:
5395        case 0xffeb:
5396        case 0xffec:
5397        case 0xffed:
5398        case 0xffee:
5399        case 0xffef:
5400        case 0xfffe:
5401          const {
5402            appData,
5403            newOffset
5404          } = readDataBlock(data, view, offset);
5405          offset = newOffset;
5406          if (fileMarker === 0xffe0) {
5407            if (appData[0] === 0x4a && appData[1] === 0x46 && appData[2] === 0x49 && appData[3] === 0x46 && appData[4] === 0) {
5408              jfif = {
5409                version: {
5410                  major: appData[5],
5411                  minor: appData[6]
5412                },
5413                densityUnits: appData[7],
5414                xDensity: appData[8] << 8 | appData[9],
5415                yDensity: appData[10] << 8 | appData[11],
5416                thumbWidth: appData[12],
5417                thumbHeight: appData[13],
5418                thumbData: appData.subarray(14, 14 + 3 * appData[12] * appData[13])
5419              };
5420            }
5421          }
5422          if (fileMarker === 0xffee) {
5423            if (appData[0] === 0x41 && appData[1] === 0x64 && appData[2] === 0x6f && appData[3] === 0x62 && appData[4] === 0x65) {
5424              adobe = {
5425                version: appData[5] << 8 | appData[6],
5426                flags0: appData[7] << 8 | appData[8],
5427                flags1: appData[9] << 8 | appData[10],
5428                transformCode: appData[11]
5429              };
5430            }
5431          }
5432          break;
5433        case 0xffdb:
5434          const quantizationTablesLength = view.getUint16(offset);
5435          offset += 2;
5436          const quantizationTablesEnd = quantizationTablesLength + offset - 2;
5437          let z;
5438          while (offset < quantizationTablesEnd) {
5439            const quantizationTableSpec = data[offset++];
5440            const tableData = new Uint16Array(64);
5441            if (quantizationTableSpec >> 4 === 0) {
5442              for (j = 0; j < 64; j++) {
5443                z = dctZigZag[j];
5444                tableData[z] = data[offset++];
5445              }
5446            } else if (quantizationTableSpec >> 4 === 1) {
5447              for (j = 0; j < 64; j++) {
5448                z = dctZigZag[j];
5449                tableData[z] = view.getUint16(offset);
5450                offset += 2;
5451              }
5452            } else {
5453              throw new JpegError("DQT - invalid table spec");
5454            }
5455            quantizationTables[quantizationTableSpec & 15] = tableData;
5456          }
5457          break;
5458        case 0xffc0:
5459        case 0xffc1:
5460        case 0xffc2:
5461          if (frame) {
5462            throw new JpegError("Only single frame JPEGs supported");
5463          }
5464          offset += 2;
5465          frame = {};
5466          frame.extended = fileMarker === 0xffc1;
5467          frame.progressive = fileMarker === 0xffc2;
5468          frame.precision = data[offset++];
5469          const sofScanLines = view.getUint16(offset);
5470          offset += 2;
5471          frame.scanLines = dnlScanLines || sofScanLines;
5472          frame.samplesPerLine = view.getUint16(offset);
5473          offset += 2;
5474          frame.components = [];
5475          frame.componentIds = {};
5476          const componentsCount = data[offset++];
5477          let maxH = 0,
5478            maxV = 0;
5479          for (i = 0; i < componentsCount; i++) {
5480            const componentId = data[offset];
5481            const h = data[offset + 1] >> 4;
5482            const v = data[offset + 1] & 15;
5483            if (maxH < h) {
5484              maxH = h;
5485            }
5486            if (maxV < v) {
5487              maxV = v;
5488            }
5489            const qId = data[offset + 2];
5490            l = frame.components.push({
5491              h,
5492              v,
5493              quantizationId: qId,
5494              quantizationTable: null
5495            });
5496            frame.componentIds[componentId] = l - 1;
5497            offset += 3;
5498          }
5499          frame.maxH = maxH;
5500          frame.maxV = maxV;
5501          prepareComponents(frame);
5502          break;
5503        case 0xffc4:
5504          const huffmanLength = view.getUint16(offset);
5505          offset += 2;
5506          for (i = 2; i < huffmanLength;) {
5507            const huffmanTableSpec = data[offset++];
5508            const codeLengths = new Uint8Array(16);
5509            let codeLengthSum = 0;
5510            for (j = 0; j < 16; j++, offset++) {
5511              codeLengthSum += codeLengths[j] = data[offset];
5512            }
5513            const huffmanValues = new Uint8Array(codeLengthSum);
5514            for (j = 0; j < codeLengthSum; j++, offset++) {
5515              huffmanValues[j] = data[offset];
5516            }
5517            i += 17 + codeLengthSum;
5518            (huffmanTableSpec >> 4 === 0 ? huffmanTablesDC : huffmanTablesAC)[huffmanTableSpec & 15] = buildHuffmanTable(codeLengths, huffmanValues);
5519          }
5520          break;
5521        case 0xffdd:
5522          offset += 2;
5523          resetInterval = view.getUint16(offset);
5524          offset += 2;
5525          break;
5526        case 0xffda:
5527          const parseDNLMarker = ++numSOSMarkers === 1 && !dnlScanLines;
5528          offset += 2;
5529          const selectorsCount = data[offset++],
5530            components = [];
5531          for (i = 0; i < selectorsCount; i++) {
5532            const index = data[offset++];
5533            const componentIndex = frame.componentIds[index];
5534            const component = frame.components[componentIndex];
5535            component.index = index;
5536            const tableSpec = data[offset++];
5537            component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4];
5538            component.huffmanTableAC = huffmanTablesAC[tableSpec & 15];
5539            components.push(component);
5540          }
5541          const spectralStart = data[offset++],
5542            spectralEnd = data[offset++],
5543            successiveApproximation = data[offset++];
5544          try {
5545            const processed = decodeScan(data, view, offset, frame, components, resetInterval, spectralStart, spectralEnd, successiveApproximation >> 4, successiveApproximation & 15, parseDNLMarker);
5546            offset += processed;
5547          } catch (ex) {
5548            if (ex instanceof DNLMarkerError) {
5549              warn(`${ex.message} -- attempting to re-parse the JPEG image.`);
5550              return this.parse(data, {
5551                dnlScanLines: ex.scanLines
5552              });
5553            } else if (ex instanceof EOIMarkerError) {
5554              warn(`${ex.message} -- ignoring the rest of the image data.`);
vendor: 15,214 bytes, lines 5555-6055
5555              break markerLoop;
5556            }
5557            throw ex;
5558          }
5559          break;
5560        case 0xffdc:
5561          offset += 4;
5562          break;
5563        case 0xffff:
5564          if (data[offset] !== 0xff) {
5565            offset--;
5566          }
5567          break;
5568        default:
5569          const nextFileMarker = findNextFileMarker(data, view, offset - 2, offset - 3);
5570          if (nextFileMarker?.invalid) {
5571            warn("JpegImage.parse - unexpected data, current marker is: " + nextFileMarker.invalid);
5572            offset = nextFileMarker.offset;
5573            break;
5574          }
5575          if (!nextFileMarker || offset >= maxOffset) {
5576            warn("JpegImage.parse - reached the end of the image data " + "without finding an EOI marker (0xFFD9).");
5577            break markerLoop;
5578          }
5579          throw new JpegError("JpegImage.parse - unknown marker: " + fileMarker.toString(16));
5580      }
5581      if (offset < maxOffset) {
5582        fileMarker = view.getUint16(offset);
5583        offset += 2;
5584      } else {
5585        fileMarker = 0;
5586      }
5587    }
5588    if (!frame) {
5589      throw new JpegError("JpegImage.parse - no frame data found.");
5590    }
5591    this.width = frame.samplesPerLine;
5592    this.height = frame.scanLines;
5593    this.jfif = jfif;
5594    this.adobe = adobe;
5595    this.components = [];
5596    for (const component of frame.components) {
5597      const quantizationTable = quantizationTables[component.quantizationId];
5598      if (quantizationTable) {
5599        component.quantizationTable = quantizationTable;
5600      }
5601      this.components.push({
5602        index: component.index,
5603        output: buildComponentData(frame, component),
5604        scaleX: component.h / frame.maxH,
5605        scaleY: component.v / frame.maxV,
5606        blocksPerLine: component.blocksPerLine,
5607        blocksPerColumn: component.blocksPerColumn
5608      });
5609    }
5610    this.numComponents = this.components.length;
5611    return undefined;
5612  }
5613  _getLinearizedBlockData(width, height, isSourcePDF = false) {
5614    const scaleX = this.width / width,
5615      scaleY = this.height / height;
5616    let component, componentScaleX, componentScaleY, blocksPerScanline;
5617    let x, y, i, j, k;
5618    let index;
5619    let offset = 0;
5620    let output;
5621    const numComponents = this.components.length;
5622    const dataLength = width * height * numComponents;
5623    const data = new Uint8ClampedArray(dataLength);
5624    const xScaleBlockOffset = new Uint32Array(width);
5625    const mask3LSB = 0xfffffff8;
5626    let lastComponentScaleX;
5627    for (i = 0; i < numComponents; i++) {
5628      component = this.components[i];
5629      componentScaleX = component.scaleX * scaleX;
5630      componentScaleY = component.scaleY * scaleY;
5631      offset = i;
5632      output = component.output;
5633      blocksPerScanline = component.blocksPerLine + 1 << 3;
5634      if (componentScaleX !== lastComponentScaleX) {
5635        for (x = 0; x < width; x++) {
5636          j = 0 | x * componentScaleX;
5637          xScaleBlockOffset[x] = (j & mask3LSB) << 3 | j & 7;
5638        }
5639        lastComponentScaleX = componentScaleX;
5640      }
5641      for (y = 0; y < height; y++) {
5642        j = 0 | y * componentScaleY;
5643        index = blocksPerScanline * (j & mask3LSB) | (j & 7) << 3;
5644        for (x = 0; x < width; x++) {
5645          data[offset] = output[index + xScaleBlockOffset[x]];
5646          offset += numComponents;
5647        }
5648      }
5649    }
5650    let transform = this._decodeTransform;
5651    if (!isSourcePDF && numComponents === 4 && !transform) {
5652      transform = new Int32Array([-256, 255, -256, 255, -256, 255, -256, 255]);
5653    }
5654    if (transform) {
5655      for (i = 0; i < dataLength;) {
5656        for (j = 0, k = 0; j < numComponents; j++, i++, k += 2) {
5657          data[i] = (data[i] * transform[k] >> 8) + transform[k + 1];
5658        }
5659      }
5660    }
5661    return data;
5662  }
5663  get _isColorConversionNeeded() {
5664    if (this.adobe) {
5665      return !!this.adobe.transformCode;
5666    }
5667    if (this.numComponents === 3) {
5668      if (this._colorTransform === 0) {
5669        return false;
5670      } else if (this.components[0].index === 0x52 && this.components[1].index === 0x47 && this.components[2].index === 0x42) {
5671        return false;
5672      }
5673      return true;
5674    }
5675    if (this._colorTransform === 1) {
5676      return true;
5677    }
5678    return false;
5679  }
5680  _convertYccToRgb(data) {
5681    let Y, Cb, Cr;
5682    for (let i = 0, length = data.length; i < length; i += 3) {
5683      Y = data[i];
5684      Cb = data[i + 1];
5685      Cr = data[i + 2];
5686      data[i] = Y - 179.456 + 1.402 * Cr;
5687      data[i + 1] = Y + 135.459 - 0.344 * Cb - 0.714 * Cr;
5688      data[i + 2] = Y - 226.816 + 1.772 * Cb;
5689    }
5690    return data;
5691  }
5692  _convertYccToRgba(data, out) {
5693    for (let i = 0, j = 0, length = data.length; i < length; i += 3, j += 4) {
5694      const Y = data[i];
5695      const Cb = data[i + 1];
5696      const Cr = data[i + 2];
5697      out[j] = Y - 179.456 + 1.402 * Cr;
5698      out[j + 1] = Y + 135.459 - 0.344 * Cb - 0.714 * Cr;
5699      out[j + 2] = Y - 226.816 + 1.772 * Cb;
5700      out[j + 3] = 255;
5701    }
5702    return out;
5703  }
5704  _convertYcckToRgb(data) {
5705    this._convertYcckToCmyk(data);
5706    return this._convertCmykToRgb(data);
5707  }
5708  _convertYcckToRgba(data) {
5709    this._convertYcckToCmyk(data);
5710    return this._convertCmykToRgba(data);
5711  }
5712  _convertYcckToCmyk(data) {
5713    let Y, Cb, Cr;
5714    for (let i = 0, length = data.length; i < length; i += 4) {
5715      Y = data[i];
5716      Cb = data[i + 1];
5717      Cr = data[i + 2];
5718      data[i] = 434.456 - Y - 1.402 * Cr;
5719      data[i + 1] = 119.541 - Y + 0.344 * Cb + 0.714 * Cr;
5720      data[i + 2] = 481.816 - Y - 1.772 * Cb;
5721    }
5722    return data;
5723  }
5724  _convertCmykToRgb(data) {
5725    const count = data.length / 4;
5726    ColorSpaceUtils.cmyk.getRgbBuffer(data, 0, count, data, 0, 8, 0);
5727    return data.subarray(0, count * 3);
5728  }
5729  _convertCmykToRgba(data) {
5730    ColorSpaceUtils.cmyk.getRgbBuffer(data, 0, data.length / 4, data, 0, 8, 1);
5731    if (ColorSpaceUtils.cmyk instanceof DeviceCmykCS) {
5732      for (let i = 3, ii = data.length; i < ii; i += 4) {
5733        data[i] = 255;
5734      }
5735    }
5736    return data;
5737  }
5738  getData({
5739    width,
5740    height,
5741    forceRGBA = false,
5742    forceRGB = false,
5743    isSourcePDF = false
5744  }) {
5745    if (this.numComponents > 4) {
5746      throw new JpegError("Unsupported color mode");
5747    }
5748    const data = this._getLinearizedBlockData(width, height, isSourcePDF);
5749    if (this.numComponents === 1 && (forceRGBA || forceRGB)) {
5750      const len = data.length * (forceRGBA ? 4 : 3);
5751      const rgbaData = new Uint8ClampedArray(len);
5752      let offset = 0;
5753      if (forceRGBA) {
5754        grayToRGBA(data, new Uint32Array(rgbaData.buffer));
5755      } else {
5756        for (const grayColor of data) {
5757          rgbaData[offset++] = grayColor;
5758          rgbaData[offset++] = grayColor;
5759          rgbaData[offset++] = grayColor;
5760        }
5761      }
5762      return rgbaData;
5763    } else if (this.numComponents === 3 && this._isColorConversionNeeded) {
5764      if (forceRGBA) {
5765        const rgbaData = new Uint8ClampedArray(data.length / 3 * 4);
5766        return this._convertYccToRgba(data, rgbaData);
5767      }
5768      return this._convertYccToRgb(data);
5769    } else if (this.numComponents === 4) {
5770      if (this._isColorConversionNeeded) {
5771        if (forceRGBA) {
5772          return this._convertYcckToRgba(data);
5773        }
5774        if (forceRGB) {
5775          return this._convertYcckToRgb(data);
5776        }
5777        return this._convertYcckToCmyk(data);
5778      } else if (forceRGBA) {
5779        return this._convertCmykToRgba(data);
5780      } else if (forceRGB) {
5781        return this._convertCmykToRgb(data);
5782      }
5783    }
5784    return data;
5785  }
5786}
5787
5788;// ./src/core/jpeg_stream.js
5789
5790
5791
5792
5793class JpegStream extends DecodeStream {
5794  static #isImageDecoderSupported = FeatureTest.isImageDecoderSupported;
5795  constructor(stream, maybeLength, params) {
5796    super(maybeLength);
5797    this.stream = stream;
5798    this.dict = stream.dict;
5799    this.maybeLength = maybeLength;
5800    this.params = params;
5801  }
5802  static get canUseImageDecoder() {
5803    return shadow(this, "canUseImageDecoder", this.#isImageDecoderSupported ? ImageDecoder.isTypeSupported("image/jpeg") : Promise.resolve(false));
5804  }
5805  static setOptions({
5806    isImageDecoderSupported = false
5807  }) {
5808    this.#isImageDecoderSupported = isImageDecoderSupported;
5809  }
5810  get bytes() {
5811    return shadow(this, "bytes", this.stream.getBytes(this.maybeLength));
5812  }
5813  ensureBuffer(requested) {}
5814  readBlock() {
5815    this.decodeImage();
5816  }
5817  get jpegOptions() {
5818    const jpegOptions = {
5819      decodeTransform: undefined,
5820      colorTransform: undefined
5821    };
5822    const decodeArr = this.dict.getArray("D", "Decode");
5823    if ((this.forceRGBA || this.forceRGB) && Array.isArray(decodeArr)) {
5824      const bitsPerComponent = this.dict.get("BPC", "BitsPerComponent") || 8;
5825      const decodeArrLength = decodeArr.length;
5826      const transform = new Int32Array(decodeArrLength);
5827      let transformNeeded = false;
5828      const maxValue = (1 << bitsPerComponent) - 1;
5829      for (let i = 0; i < decodeArrLength; i += 2) {
5830        transform[i] = (decodeArr[i + 1] - decodeArr[i]) * 256 | 0;
5831        transform[i + 1] = decodeArr[i] * maxValue | 0;
5832        if (transform[i] !== 256 || transform[i + 1] !== 0) {
5833          transformNeeded = true;
5834        }
5835      }
5836      if (transformNeeded) {
5837        jpegOptions.decodeTransform = transform;
5838      }
5839    }
5840    if (this.params instanceof Dict) {
5841      const colorTransform = this.params.get("ColorTransform");
5842      if (Number.isInteger(colorTransform)) {
5843        jpegOptions.colorTransform = colorTransform;
5844      }
5845    }
5846    return shadow(this, "jpegOptions", jpegOptions);
5847  }
5848  #skipUselessBytes(data) {
5849    for (let i = 0, ii = data.length - 1; i < ii; i++) {
5850      if (data[i] === 0xff && data[i + 1] === 0xd8) {
5851        if (i > 0) {
5852          data = data.subarray(i);
5853        }
5854        break;
5855      }
5856    }
5857    return data;
5858  }
5859  decodeImage(bytes) {
5860    if (this.eof) {
5861      return this.buffer;
5862    }
5863    bytes = this.#skipUselessBytes(bytes || this.bytes);
5864    const jpegImage = new JpegImage(this.jpegOptions);
5865    jpegImage.parse(bytes);
5866    const data = jpegImage.getData({
5867      width: this.drawWidth,
5868      height: this.drawHeight,
5869      forceRGBA: this.forceRGBA,
5870      forceRGB: this.forceRGB,
5871      isSourcePDF: true
5872    });
5873    this.buffer = data;
5874    this.bufferLength = data.length;
5875    this.eof = true;
5876    return this.buffer;
5877  }
5878  get canAsyncDecodeImageFromBuffer() {
5879    return this.stream.isAsync;
5880  }
5881  async getTransferableImage() {
5882    if (!(await JpegStream.canUseImageDecoder)) {
5883      return null;
5884    }
5885    const jpegOptions = this.jpegOptions;
5886    if (jpegOptions.decodeTransform) {
5887      return null;
5888    }
5889    let decoder;
5890    try {
5891      const bytes = this.canAsyncDecodeImageFromBuffer && (await this.stream.asyncGetBytes()) || this.bytes;
5892      if (!bytes) {
5893        return null;
5894      }
5895      let data = this.#skipUselessBytes(bytes);
5896      const useImageDecoder = JpegImage.canUseImageDecoder(data, jpegOptions.colorTransform);
5897      if (!useImageDecoder) {
5898        return null;
5899      }
5900      if (useImageDecoder.exifStart) {
5901        data = data.slice();
5902        data.fill(0x00, useImageDecoder.exifStart, useImageDecoder.exifEnd);
5903      }
5904      decoder = new ImageDecoder({
5905        data,
5906        type: "image/jpeg",
5907        preferAnimation: false
5908      });
5909      return (await decoder.decode()).image;
5910    } catch (reason) {
5911      warn(`getTransferableImage - failed: "${reason}".`);
5912      return null;
5913    } finally {
5914      decoder?.close();
5915    }
5916  }
5917  get isImageStream() {
5918    return true;
5919  }
5920}
5921
5922;// ./external/openjpeg/openjpeg.js
5923async function OpenJPEG(moduleArg = {}) {
5924  var moduleRtn;
5925  var Module = moduleArg;
5926  var ENVIRONMENT_IS_WEB = true;
5927  var ENVIRONMENT_IS_WORKER = false;
5928  var arguments_ = [];
5929  var thisProgram = "./this.program";
5930  var quit_ = (status, toThrow) => {
5931    throw toThrow;
5932  };
5933  var _scriptName = import.meta.url;
5934  var scriptDirectory = "";
5935  var readAsync, readBinary;
5936  if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) {
5937    try {
5938      scriptDirectory = new URL(".", _scriptName).href;
5939    } catch {}
5940    readAsync = async url => {
5941      var response = await fetch(url, {
5942        credentials: "same-origin"
5943      });
5944      if (response.ok) {
5945        return response.arrayBuffer();
5946      }
5947      throw new Error(response.status + " : " + response.url);
5948    };
5949  } else {}
5950  var out = console.log.bind(console);
5951  var err = console.error.bind(console);
5952  var wasmBinary;
5953  var ABORT = false;
5954  var EXITSTATUS;
5955  class EmscriptenEH {}
5956  class EmscriptenSjLj extends EmscriptenEH {}
5957  var readyPromiseResolve, readyPromiseReject;
5958  var runtimeInitialized = false;
5959  function updateMemoryViews() {
5960    var b = wasmMemory.buffer;
5961    HEAP8 = new Int8Array(b);
5962    HEAP16 = new Int16Array(b);
5963    HEAPU8 = new Uint8Array(b);
5964    HEAPU16 = new Uint16Array(b);
5965    HEAP32 = new Int32Array(b);
5966    HEAPU32 = new Uint32Array(b);
5967    HEAPF32 = new Float32Array(b);
5968    HEAPF64 = new Float64Array(b);
5969    HEAP64 = new BigInt64Array(b);
5970    HEAPU64 = new BigUint64Array(b);
5971  }
5972  function preRun() {
5973    if (Module["preRun"]) {
5974      if (typeof Module["preRun"] == "function") Module["preRun"] = [Module["preRun"]];
5975      while (Module["preRun"].length) {
5976        addOnPreRun(Module["preRun"].shift());
5977      }
5978    }
5979    callRuntimeCallbacks(onPreRuns);
5980  }
5981  function initRuntime() {
5982    runtimeInitialized = true;
5983    wasmExports["s"]();
5984  }
5985  function postRun() {
5986    if (Module["postRun"]) {
5987      if (typeof Module["postRun"] == "function") Module["postRun"] = [Module["postRun"]];
5988      while (Module["postRun"].length) {
5989        addOnPostRun(Module["postRun"].shift());
5990      }
5991    }
5992    callRuntimeCallbacks(onPostRuns);
5993  }
5994  function abort(what) {
5995    Module["onAbort"]?.(what);
5996    what = `Aborted(${what})`;
5997    err(what);
5998    ABORT = true;
5999    what += ". Build with -sASSERTIONS for more info.";
6000    var e = new WebAssembly.RuntimeError(what);
6001    readyPromiseReject?.(e);
6002    throw e;
6003  }
6004  var wasmBinaryFile;
6005  function getWasmImports() {
6006    var imports = {
6007      a: wasmImports
6008    };
6009    return imports;
6010  }
6011  async function createWasm() {
6012    function receiveInstance(instance, module) {
6013      wasmExports = instance.exports;
6014      assignWasmExports(wasmExports);
6015      updateMemoryViews();
6016      return wasmExports;
6017    }
6018    var info = getWasmImports();
6019    return new Promise((resolve, reject) => {
6020      Module["instantiateWasm"](info, (inst, mod) => {
6021        resolve(receiveInstance(inst, mod));
6022      });
6023    });
6024  }
6025  class ExitStatus {
6026    name = "ExitStatus";
6027    constructor(status) {
6028      this.message = `Program terminated with exit(${status})`;
6029      this.status = status;
6030    }
6031  }
6032  var HEAP16;
6033  var HEAP32;
6034  var HEAP64;
6035  var HEAP8;
6036  var HEAPF32;
6037  var HEAPF64;
6038  var HEAPU16;
6039  var HEAPU32;
6040  var HEAPU64;
6041  var HEAPU8;
6042  var callRuntimeCallbacks = callbacks => {
6043    while (callbacks.length > 0) {
6044      callbacks.shift()(Module);
6045    }
6046  };
6047  var onPostRuns = [];
6048  var addOnPostRun = cb => onPostRuns.push(cb);
6049  var onPreRuns = [];
6050  var addOnPreRun = cb => onPreRuns.push(cb);
6051  var noExitRuntime = true;
6052  var __abort_js = () => abort("");
6053  var runtimeKeepaliveCounter = 0;
6054  var __emscripten_runtime_keepalive_clear = () => {
6055    noExitRuntime = false;
vendor: 8,931 bytes, lines 6056-6336
6056    runtimeKeepaliveCounter = 0;
6057  };
6058  var timers = {};
6059  var handleException = e => {
6060    if (e instanceof ExitStatus || e == "unwind") {
6061      return EXITSTATUS;
6062    }
6063    quit_(1, e);
6064  };
6065  var keepRuntimeAlive = () => noExitRuntime || runtimeKeepaliveCounter > 0;
6066  var _proc_exit = code => {
6067    EXITSTATUS = code;
6068    if (!keepRuntimeAlive()) {
6069      Module["onExit"]?.(code);
6070      ABORT = true;
6071    }
6072    quit_(code, new ExitStatus(code));
6073  };
6074  var exitJS = (status, implicit) => {
6075    EXITSTATUS = status;
6076    _proc_exit(status);
6077  };
6078  var _exit = exitJS;
6079  var maybeExit = () => {
6080    if (!keepRuntimeAlive()) {
6081      try {
6082        _exit(EXITSTATUS);
6083      } catch (e) {
6084        handleException(e);
6085      }
6086    }
6087  };
6088  var callUserCallback = func => {
6089    if (ABORT) {
6090      return;
6091    }
6092    try {
6093      return func();
6094    } catch (e) {
6095      handleException(e);
6096    } finally {
6097      maybeExit();
6098    }
6099  };
6100  var _emscripten_get_now = () => performance.now();
6101  var __setitimer_js = (which, timeout_ms) => {
6102    if (timers[which]) {
6103      clearTimeout(timers[which].id);
6104      delete timers[which];
6105    }
6106    if (!timeout_ms) return 0;
6107    var id = setTimeout(() => {
6108      delete timers[which];
6109      callUserCallback(() => __emscripten_timeout(which, _emscripten_get_now()));
6110    }, timeout_ms);
6111    timers[which] = {
6112      id,
6113      timeout_ms
6114    };
6115    return 0;
6116  };
6117  function _copy_pixels_1(compG_ptr, nb_pixels) {
6118    compG_ptr >>= 2;
6119    const imageData = Module.imageData = new Uint8ClampedArray(nb_pixels);
6120    const compG = HEAP32.subarray(compG_ptr, compG_ptr + nb_pixels);
6121    imageData.set(compG);
6122  }
6123  function _copy_pixels_3(compR_ptr, compG_ptr, compB_ptr, nb_pixels) {
6124    compR_ptr >>= 2;
6125    compG_ptr >>= 2;
6126    compB_ptr >>= 2;
6127    const imageData = Module.imageData = new Uint8ClampedArray(nb_pixels * 3);
6128    const compR = HEAP32.subarray(compR_ptr, compR_ptr + nb_pixels);
6129    const compG = HEAP32.subarray(compG_ptr, compG_ptr + nb_pixels);
6130    const compB = HEAP32.subarray(compB_ptr, compB_ptr + nb_pixels);
6131    for (let i = 0; i < nb_pixels; i++) {
6132      imageData[3 * i] = compR[i];
6133      imageData[3 * i + 1] = compG[i];
6134      imageData[3 * i + 2] = compB[i];
6135    }
6136  }
6137  function _copy_pixels_4(compR_ptr, compG_ptr, compB_ptr, compA_ptr, nb_pixels) {
6138    compR_ptr >>= 2;
6139    compG_ptr >>= 2;
6140    compB_ptr >>= 2;
6141    compA_ptr >>= 2;
6142    const imageData = Module.imageData = new Uint8ClampedArray(nb_pixels * 4);
6143    const compR = HEAP32.subarray(compR_ptr, compR_ptr + nb_pixels);
6144    const compG = HEAP32.subarray(compG_ptr, compG_ptr + nb_pixels);
6145    const compB = HEAP32.subarray(compB_ptr, compB_ptr + nb_pixels);
6146    const compA = HEAP32.subarray(compA_ptr, compA_ptr + nb_pixels);
6147    for (let i = 0; i < nb_pixels; i++) {
6148      imageData[4 * i] = compR[i];
6149      imageData[4 * i + 1] = compG[i];
6150      imageData[4 * i + 2] = compB[i];
6151      imageData[4 * i + 3] = compA[i];
6152    }
6153  }
6154  var getHeapMax = () => 2147483648;
6155  var alignMemory = (size, alignment) => Math.ceil(size / alignment) * alignment;
6156  var growMemory = size => {
6157    var oldHeapSize = wasmMemory.buffer.byteLength;
6158    var pages = (size - oldHeapSize + 65535) / 65536 | 0;
6159    try {
6160      wasmMemory.grow(pages);
6161      updateMemoryViews();
6162      return 1;
6163    } catch (e) {}
6164  };
6165  var _emscripten_resize_heap = requestedSize => {
6166    var oldSize = HEAPU8.length;
6167    requestedSize >>>= 0;
6168    var maxHeapSize = getHeapMax();
6169    if (requestedSize > maxHeapSize) {
6170      return false;
6171    }
6172    for (var cutDown = 1; cutDown <= 4; cutDown *= 2) {
6173      var overGrownHeapSize = oldSize * (1 + .2 / cutDown);
6174      overGrownHeapSize = Math.min(overGrownHeapSize, requestedSize + 100663296);
6175      var newSize = Math.min(maxHeapSize, alignMemory(Math.max(requestedSize, overGrownHeapSize), 65536));
6176      var replacement = growMemory(newSize);
6177      if (replacement) {
6178        return true;
6179      }
6180    }
6181    return false;
6182  };
6183  var ENV = {};
6184  var getExecutableName = () => thisProgram || "./this.program";
6185  var getEnvStrings = () => {
6186    if (!getEnvStrings.strings) {
6187      var lang = (globalThis.navigator?.language ?? "C").replace("-", "_") + ".UTF-8";
6188      var env = {
6189        USER: "web_user",
6190        LOGNAME: "web_user",
6191        PATH: "/",
6192        PWD: "/",
6193        HOME: "/home/web_user",
6194        LANG: lang,
6195        _: getExecutableName()
6196      };
6197      for (var x in ENV) {
6198        if (ENV[x] === undefined) delete env[x];else env[x] = ENV[x];
6199      }
6200      var strings = [];
6201      for (var x in env) {
6202        strings.push(`${x}=${env[x]}`);
6203      }
6204      getEnvStrings.strings = strings;
6205    }
6206    return getEnvStrings.strings;
6207  };
6208  var stringToUTF8Array = (str, heap, outIdx, maxBytesToWrite) => {
6209    if (!(maxBytesToWrite > 0)) return 0;
6210    var startIdx = outIdx;
6211    var endIdx = outIdx + maxBytesToWrite - 1;
6212    for (var i = 0; i < str.length; ++i) {
6213      var u = str.codePointAt(i);
6214      if (u <= 127) {
6215        if (outIdx >= endIdx) break;
6216        heap[outIdx++] = u;
6217      } else if (u <= 2047) {
6218        if (outIdx + 1 >= endIdx) break;
6219        heap[outIdx++] = 192 | u >> 6;
6220        heap[outIdx++] = 128 | u & 63;
6221      } else if (u <= 65535) {
6222        if (outIdx + 2 >= endIdx) break;
6223        heap[outIdx++] = 224 | u >> 12;
6224        heap[outIdx++] = 128 | u >> 6 & 63;
6225        heap[outIdx++] = 128 | u & 63;
6226      } else {
6227        if (outIdx + 3 >= endIdx) break;
6228        heap[outIdx++] = 240 | u >> 18;
6229        heap[outIdx++] = 128 | u >> 12 & 63;
6230        heap[outIdx++] = 128 | u >> 6 & 63;
6231        heap[outIdx++] = 128 | u & 63;
6232        i++;
6233      }
6234    }
6235    heap[outIdx] = 0;
6236    return outIdx - startIdx;
6237  };
6238  var stringToUTF8 = (str, outPtr, maxBytesToWrite) => stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite);
6239  var _environ_get = (__environ, environ_buf) => {
6240    var bufSize = 0;
6241    var envp = 0;
6242    for (var string of getEnvStrings()) {
6243      var ptr = environ_buf + bufSize;
6244      HEAPU32[__environ + envp >> 2] = ptr;
6245      bufSize += stringToUTF8(string, ptr, Infinity) + 1;
6246      envp += 4;
6247    }
6248    return 0;
6249  };
6250  var lengthBytesUTF8 = str => {
6251    var len = 0;
6252    for (var i = 0; i < str.length; ++i) {
6253      var c = str.charCodeAt(i);
6254      if (c <= 127) {
6255        len++;
6256      } else if (c <= 2047) {
6257        len += 2;
6258      } else if (c >= 55296 && c <= 57343) {
6259        len += 4;
6260        ++i;
6261      } else {
6262        len += 3;
6263      }
6264    }
6265    return len;
6266  };
6267  var _environ_sizes_get = (penviron_count, penviron_buf_size) => {
6268    var strings = getEnvStrings();
6269    HEAPU32[penviron_count >> 2] = strings.length;
6270    var bufSize = 0;
6271    for (var string of strings) {
6272      bufSize += lengthBytesUTF8(string) + 1;
6273    }
6274    HEAPU32[penviron_buf_size >> 2] = bufSize;
6275    return 0;
6276  };
6277  var INT53_MAX = 9007199254740992;
6278  var INT53_MIN = -9007199254740992;
6279  var bigintToI53Checked = num => num < INT53_MIN || num > INT53_MAX ? NaN : Number(num);
6280  function _fd_seek(fd, offset, whence, newOffset) {
6281    offset = bigintToI53Checked(offset);
6282    return 70;
6283  }
6284  var printCharBuffers = [null, [], []];
6285  var UTF8Decoder = globalThis.TextDecoder && new TextDecoder();
6286  var findStringEnd = (heapOrArray, idx, maxBytesToRead, ignoreNul) => {
6287    var maxIdx = idx + maxBytesToRead;
6288    if (ignoreNul) return maxIdx;
6289    while (heapOrArray[idx] && !(idx >= maxIdx)) ++idx;
6290    return idx;
6291  };
6292  var UTF8ArrayToString = (heapOrArray, idx = 0, maxBytesToRead, ignoreNul) => {
6293    var endPtr = findStringEnd(heapOrArray, idx, maxBytesToRead, ignoreNul);
6294    if (endPtr - idx > 16 && heapOrArray.buffer && UTF8Decoder) {
6295      return UTF8Decoder.decode(heapOrArray.subarray(idx, endPtr));
6296    }
6297    var str = "";
6298    while (idx < endPtr) {
6299      var u0 = heapOrArray[idx++];
6300      if (!(u0 & 128)) {
6301        str += String.fromCharCode(u0);
6302        continue;
6303      }
6304      var u1 = heapOrArray[idx++] & 63;
6305      if ((u0 & 224) == 192) {
6306        str += String.fromCharCode((u0 & 31) << 6 | u1);
6307        continue;
6308      }
6309      var u2 = heapOrArray[idx++] & 63;
6310      if ((u0 & 240) == 224) {
6311        u0 = (u0 & 15) << 12 | u1 << 6 | u2;
6312      } else {
6313        u0 = (u0 & 7) << 18 | u1 << 12 | u2 << 6 | heapOrArray[idx++] & 63;
6314      }
6315      if (u0 < 65536) {
6316        str += String.fromCharCode(u0);
6317      } else {
6318        var ch = u0 - 65536;
6319        str += String.fromCharCode(55296 | ch >> 10, 56320 | ch & 1023);
6320      }
6321    }
6322    return str;
6323  };
6324  var printChar = (stream, curr) => {
6325    var buffer = printCharBuffers[stream];
6326    if (curr === 0 || curr === 10) {
6327      (stream === 1 ? out : err)(UTF8ArrayToString(buffer));
6328      buffer.length = 0;
6329    } else {
6330      buffer.push(curr);
6331    }
6332  };
6333  var UTF8ToString = (ptr, maxBytesToRead, ignoreNul) => ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead, ignoreNul) : "";
6334  var _fd_write = (fd, iov, iovcnt, pnum) => {
6335    var num = 0;
6336    for (var i = 0; i < iovcnt; i++) {
vendor: 8,449 bytes, lines 6337-6618
6337      var ptr = HEAPU32[iov >> 2];
6338      var len = HEAPU32[iov + 4 >> 2];
6339      iov += 8;
6340      for (var j = 0; j < len; j++) {
6341        printChar(fd, HEAPU8[ptr + j]);
6342      }
6343      num += len;
6344    }
6345    HEAPU32[pnum >> 2] = num;
6346    return 0;
6347  };
6348  function _gray_to_rgba(compG_ptr, nb_pixels) {
6349    compG_ptr >>= 2;
6350    const imageData = Module.imageData = new Uint8ClampedArray(nb_pixels * 4);
6351    const compG = HEAP32.subarray(compG_ptr, compG_ptr + nb_pixels);
6352    for (let i = 0; i < nb_pixels; i++) {
6353      imageData[4 * i] = imageData[4 * i + 1] = imageData[4 * i + 2] = compG[i];
6354      imageData[4 * i + 3] = 255;
6355    }
6356  }
6357  function _graya_to_rgba(compG_ptr, compA_ptr, nb_pixels) {
6358    compG_ptr >>= 2;
6359    compA_ptr >>= 2;
6360    const imageData = Module.imageData = new Uint8ClampedArray(nb_pixels * 4);
6361    const compG = HEAP32.subarray(compG_ptr, compG_ptr + nb_pixels);
6362    const compA = HEAP32.subarray(compA_ptr, compA_ptr + nb_pixels);
6363    for (let i = 0; i < nb_pixels; i++) {
6364      imageData[4 * i] = imageData[4 * i + 1] = imageData[4 * i + 2] = compG[i];
6365      imageData[4 * i + 3] = compA[i];
6366    }
6367  }
6368  function _jsPrintWarning(message_ptr) {
6369    const message = UTF8ToString(message_ptr);
6370    (Module.warn || console.warn)(`OpenJPEG: ${message}`);
6371  }
6372  function _rgb_to_rgba(compR_ptr, compG_ptr, compB_ptr, nb_pixels) {
6373    compR_ptr >>= 2;
6374    compG_ptr >>= 2;
6375    compB_ptr >>= 2;
6376    const imageData = Module.imageData = new Uint8ClampedArray(nb_pixels * 4);
6377    const compR = HEAP32.subarray(compR_ptr, compR_ptr + nb_pixels);
6378    const compG = HEAP32.subarray(compG_ptr, compG_ptr + nb_pixels);
6379    const compB = HEAP32.subarray(compB_ptr, compB_ptr + nb_pixels);
6380    for (let i = 0; i < nb_pixels; i++) {
6381      imageData[4 * i] = compR[i];
6382      imageData[4 * i + 1] = compG[i];
6383      imageData[4 * i + 2] = compB[i];
6384      imageData[4 * i + 3] = 255;
6385    }
6386  }
6387  function _storeErrorMessage(message_ptr) {
6388    const message = UTF8ToString(message_ptr);
6389    if (!Module.errorMessages) {
6390      Module.errorMessages = message;
6391    } else {
6392      Module.errorMessages += "\n" + message;
6393    }
6394  }
6395  var writeArrayToMemory = (array, buffer) => {
6396    HEAP8.set(array, buffer);
6397  };
6398  if (Module["noExitRuntime"]) noExitRuntime = Module["noExitRuntime"];
6399  if (Module["print"]) out = Module["print"];
6400  if (Module["printErr"]) err = Module["printErr"];
6401  if (Module["wasmBinary"]) wasmBinary = Module["wasmBinary"];
6402  if (Module["arguments"]) arguments_ = Module["arguments"];
6403  if (Module["thisProgram"]) thisProgram = Module["thisProgram"];
6404  if (Module["preInit"]) {
6405    if (typeof Module["preInit"] == "function") Module["preInit"] = [Module["preInit"]];
6406    while (Module["preInit"].length > 0) {
6407      Module["preInit"].shift()();
6408    }
6409  }
6410  Module["writeArrayToMemory"] = writeArrayToMemory;
6411  var _malloc, _free, _jp2_decode, __emscripten_timeout, memory, __indirect_function_table, wasmMemory;
6412  function assignWasmExports(wasmExports) {
6413    _malloc = Module["_malloc"] = wasmExports["t"];
6414    _free = Module["_free"] = wasmExports["u"];
6415    _jp2_decode = Module["_jp2_decode"] = wasmExports["v"];
6416    __emscripten_timeout = wasmExports["w"];
6417    memory = wasmMemory = wasmExports["r"];
6418    __indirect_function_table = wasmExports["__indirect_function_table"];
6419  }
6420  var wasmImports = {
6421    m: __abort_js,
6422    l: __emscripten_runtime_keepalive_clear,
6423    i: __setitimer_js,
6424    f: _copy_pixels_1,
6425    e: _copy_pixels_3,
6426    d: _copy_pixels_4,
6427    j: _emscripten_resize_heap,
6428    o: _environ_get,
6429    p: _environ_sizes_get,
6430    n: _fd_seek,
6431    b: _fd_write,
6432    q: _gray_to_rgba,
6433    h: _graya_to_rgba,
6434    c: _jsPrintWarning,
6435    k: _proc_exit,
6436    g: _rgb_to_rgba,
6437    a: _storeErrorMessage
6438  };
6439  function run() {
6440    preRun();
6441    function doRun() {
6442      Module["calledRun"] = true;
6443      if (ABORT) return;
6444      initRuntime();
6445      readyPromiseResolve?.(Module);
6446      Module["onRuntimeInitialized"]?.();
6447      postRun();
6448    }
6449    if (Module["setStatus"]) {
6450      Module["setStatus"]("Running...");
6451      setTimeout(() => {
6452        setTimeout(() => Module["setStatus"](""), 1);
6453        doRun();
6454      }, 1);
6455    } else {
6456      doRun();
6457    }
6458  }
6459  var wasmExports;
6460  wasmExports = await createWasm();
6461  run();
6462  if (runtimeInitialized) {
6463    moduleRtn = Module;
6464  } else {
6465    moduleRtn = new Promise((resolve, reject) => {
6466      readyPromiseResolve = resolve;
6467      readyPromiseReject = reject;
6468    });
6469  }
6470  return moduleRtn;
6471}
6472/* harmony default export */ const openjpeg = (OpenJPEG);
6473;// ./src/core/jpx.js
6474
6475
6476
6477
6478class JpxError extends BaseException {
6479  constructor(msg) {
6480    super(msg, "JpxError");
6481  }
6482}
6483class JpxImage {
6484  static #buffer = null;
6485  static #handler = null;
6486  static #modulePromise = null;
6487  static #useWasm = true;
6488  static #useWorkerFetch = true;
6489  static #wasmUrl = null;
6490  static setOptions({
6491    handler,
6492    useWasm,
6493    useWorkerFetch,
6494    wasmUrl
6495  }) {
6496    this.#useWasm = useWasm;
6497    this.#useWorkerFetch = useWorkerFetch;
6498    this.#wasmUrl = wasmUrl;
6499    if (!useWorkerFetch) {
6500      this.#handler = handler;
6501    }
6502  }
6503  static async #getJsModule(fallbackCallback) {
6504    const path = `${this.#wasmUrl}openjpeg_nowasm_fallback.js`;
6505    let instance = null;
6506    try {
6507      const mod = await import(
6508      /*webpackIgnore: true*/
6509      /*@vite-ignore*/
6510      path);
6511      instance = mod.default();
6512    } catch (e) {
6513      warn(`JpxImage#getJsModule: ${e}`);
6514    }
6515    fallbackCallback(instance);
6516  }
6517  static async #instantiateWasm(fallbackCallback, imports, successCallback) {
6518    const filename = "openjpeg.wasm";
6519    try {
6520      if (!this.#buffer) {
6521        if (this.#useWorkerFetch) {
6522          this.#buffer = await fetchBinaryData(`${this.#wasmUrl}${filename}`);
6523        } else {
6524          this.#buffer = await this.#handler.sendWithPromise("FetchBinaryData", {
6525            kind: "wasmUrl",
6526            filename
6527          });
6528        }
6529      }
6530      const results = await WebAssembly.instantiate(this.#buffer, imports);
6531      return successCallback(results.instance);
6532    } catch (reason) {
6533      warn(`JpxImage#instantiateWasm: ${reason}`);
6534      this.#getJsModule(fallbackCallback);
6535      return null;
6536    } finally {
6537      this.#handler = null;
6538    }
6539  }
6540  static async decode(bytes, {
6541    numComponents = 4,
6542    isIndexedColormap = false,
6543    smaskInData = false,
6544    reducePower = 0
6545  } = {}) {
6546    if (!this.#modulePromise) {
6547      const {
6548        promise,
6549        resolve
6550      } = Promise.withResolvers();
6551      const promises = [promise];
6552      if (!this.#useWasm) {
6553        this.#getJsModule(resolve);
6554      } else {
6555        promises.push(openjpeg({
6556          warn: warn,
6557          instantiateWasm: this.#instantiateWasm.bind(this, resolve)
6558        }));
6559      }
6560      this.#modulePromise = Promise.race(promises);
6561    }
6562    const module = await this.#modulePromise;
6563    if (!module) {
6564      throw new JpxError("OpenJPEG failed to initialize");
6565    }
6566    let ptr;
6567    try {
6568      const size = bytes.length;
6569      ptr = module._malloc(size);
6570      module.writeArrayToMemory(bytes, ptr);
6571      const ret = module._jp2_decode(ptr, size, numComponents > 0 ? numComponents : 0, !!isIndexedColormap, !!smaskInData, reducePower);
6572      if (ret) {
6573        const {
6574          errorMessages
6575        } = module;
6576        if (errorMessages) {
6577          delete module.errorMessages;
6578          throw new JpxError(errorMessages);
6579        }
6580        throw new JpxError("Unknown error");
6581      }
6582      const {
6583        imageData
6584      } = module;
6585      module.imageData = null;
6586      return imageData;
6587    } finally {
6588      if (ptr) {
6589        module._free(ptr);
6590      }
6591    }
6592  }
6593  static cleanup() {
6594    this.#modulePromise = null;
6595  }
6596  static parseImageProperties(stream) {
6597    let newByte = stream.getByte();
6598    while (newByte >= 0) {
6599      const oldByte = newByte;
6600      newByte = stream.getByte();
6601      const code = oldByte << 8 | newByte;
6602      if (code === 0xff51) {
6603        stream.skip(4);
6604        const Xsiz = stream.getInt32() >>> 0;
6605        const Ysiz = stream.getInt32() >>> 0;
6606        const XOsiz = stream.getInt32() >>> 0;
6607        const YOsiz = stream.getInt32() >>> 0;
6608        stream.skip(16);
6609        const Csiz = stream.getUint16();
6610        return {
6611          width: Xsiz - XOsiz,
6612          height: Ysiz - YOsiz,
6613          bitsPerComponent: 8,
6614          componentsCount: Csiz
6615        };
6616      }
6617    }
6618    throw new JpxError("No size marker found in JPX stream")
vendor: 19,958 bytes, lines 6618-7223
6618;
6619  }
6620}
6621
6622;// ./src/core/operator_list.js
6623
6624function addState(parentState, pattern, checkFn, iterateFn, processFn) {
6625  let state = parentState;
6626  for (let i = 0, ii = pattern.length - 1; i < ii; i++) {
6627    const item = pattern[i];
6628    state = state[item] ||= [];
6629  }
6630  state[pattern.at(-1)] = {
6631    checkFn,
6632    iterateFn,
6633    processFn
6634  };
6635}
6636const InitialState = [];
6637addState(InitialState, [OPS.save, OPS.transform, OPS.paintInlineImageXObject, OPS.restore], null, function iterateInlineImageGroup(context, i) {
6638  const fnArray = context.fnArray;
6639  const iFirstSave = context.iCurr - 3;
6640  const pos = (i - iFirstSave) % 4;
6641  switch (pos) {
6642    case 0:
6643      return fnArray[i] === OPS.save;
6644    case 1:
6645      return fnArray[i] === OPS.transform;
6646    case 2:
6647      return fnArray[i] === OPS.paintInlineImageXObject;
6648    case 3:
6649      return fnArray[i] === OPS.restore;
6650  }
6651  throw new Error(`iterateInlineImageGroup - invalid pos: ${pos}`);
6652}, function foundInlineImageGroup(context, i) {
6653  const MIN_IMAGES_IN_INLINE_IMAGES_BLOCK = 10;
6654  const MAX_IMAGES_IN_INLINE_IMAGES_BLOCK = 200;
6655  const MAX_WIDTH = 1000;
6656  const IMAGE_PADDING = 1;
6657  const fnArray = context.fnArray,
6658    argsArray = context.argsArray;
6659  const curr = context.iCurr;
6660  const iFirstSave = curr - 3;
6661  const iFirstTransform = curr - 2;
6662  const iFirstPIIXO = curr - 1;
6663  const count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_INLINE_IMAGES_BLOCK);
6664  if (count < MIN_IMAGES_IN_INLINE_IMAGES_BLOCK) {
6665    return i - (i - iFirstSave) % 4;
6666  }
6667  let maxX = 0;
6668  const map = [];
6669  let maxLineHeight = 0;
6670  let currentX = IMAGE_PADDING,
6671    currentY = IMAGE_PADDING;
6672  for (let q = 0; q < count; q++) {
6673    const transform = argsArray[iFirstTransform + (q << 2)];
6674    const img = argsArray[iFirstPIIXO + (q << 2)][0];
6675    if (currentX + img.width > MAX_WIDTH) {
6676      maxX = Math.max(maxX, currentX);
6677      currentY += maxLineHeight + 2 * IMAGE_PADDING;
6678      currentX = 0;
6679      maxLineHeight = 0;
6680    }
6681    map.push({
6682      transform,
6683      x: currentX,
6684      y: currentY,
6685      w: img.width,
6686      h: img.height
6687    });
6688    currentX += img.width + 2 * IMAGE_PADDING;
6689    maxLineHeight = Math.max(maxLineHeight, img.height);
6690  }
6691  const imgWidth = Math.max(maxX, currentX) + IMAGE_PADDING;
6692  const imgHeight = currentY + maxLineHeight + IMAGE_PADDING;
6693  const imgData = new Uint8Array(imgWidth * imgHeight * 4);
6694  const imgRowSize = imgWidth << 2;
6695  for (let q = 0; q < count; q++) {
6696    const data = argsArray[iFirstPIIXO + (q << 2)][0].data;
6697    const rowSize = map[q].w << 2;
6698    let dataOffset = 0;
6699    let offset = map[q].x + map[q].y * imgWidth << 2;
6700    imgData.set(data.subarray(0, rowSize), offset - imgRowSize);
6701    for (let k = 0, kk = map[q].h; k < kk; k++) {
6702      imgData.set(data.subarray(dataOffset, dataOffset + rowSize), offset);
6703      dataOffset += rowSize;
6704      offset += imgRowSize;
6705    }
6706    imgData.set(data.subarray(dataOffset - rowSize, dataOffset), offset);
6707    while (offset >= 0) {
6708      data[offset - 4] = data[offset];
6709      data[offset - 3] = data[offset + 1];
6710      data[offset - 2] = data[offset + 2];
6711      data[offset - 1] = data[offset + 3];
6712      data[offset + rowSize] = data[offset + rowSize - 4];
6713      data[offset + rowSize + 1] = data[offset + rowSize - 3];
6714      data[offset + rowSize + 2] = data[offset + rowSize - 2];
6715      data[offset + rowSize + 3] = data[offset + rowSize - 1];
6716      offset -= imgRowSize;
6717    }
6718  }
6719  const img = {
6720    width: imgWidth,
6721    height: imgHeight
6722  };
6723  if (context.isOffscreenCanvasSupported) {
6724    const canvas = new OffscreenCanvas(imgWidth, imgHeight);
6725    const ctx = canvas.getContext("2d");
6726    ctx.putImageData(new ImageData(new Uint8ClampedArray(imgData.buffer), imgWidth, imgHeight), 0, 0);
6727    img.bitmap = canvas.transferToImageBitmap();
6728    img.data = null;
6729  } else {
6730    img.kind = ImageKind.RGBA_32BPP;
6731    img.data = imgData;
6732  }
6733  fnArray.splice(iFirstSave, count * 4, OPS.paintInlineImageXObjectGroup);
6734  argsArray.splice(iFirstSave, count * 4, [img, map]);
6735  return iFirstSave + 1;
6736});
6737addState(InitialState, [OPS.save, OPS.transform, OPS.paintImageMaskXObject, OPS.restore], null, function iterateImageMaskGroup(context, i) {
6738  const fnArray = context.fnArray;
6739  const iFirstSave = context.iCurr - 3;
6740  const pos = (i - iFirstSave) % 4;
6741  switch (pos) {
6742    case 0:
6743      return fnArray[i] === OPS.save;
6744    case 1:
6745      return fnArray[i] === OPS.transform;
6746    case 2:
6747      return fnArray[i] === OPS.paintImageMaskXObject;
6748    case 3:
6749      return fnArray[i] === OPS.restore;
6750  }
6751  throw new Error(`iterateImageMaskGroup - invalid pos: ${pos}`);
6752}, function foundImageMaskGroup(context, i) {
6753  const MIN_IMAGES_IN_MASKS_BLOCK = 10;
6754  const MAX_IMAGES_IN_MASKS_BLOCK = 100;
6755  const MAX_SAME_IMAGES_IN_MASKS_BLOCK = 1000;
6756  const fnArray = context.fnArray,
6757    argsArray = context.argsArray;
6758  const curr = context.iCurr;
6759  const iFirstSave = curr - 3;
6760  const iFirstTransform = curr - 2;
6761  const iFirstPIMXO = curr - 1;
6762  let count = Math.floor((i - iFirstSave) / 4);
6763  if (count < MIN_IMAGES_IN_MASKS_BLOCK) {
6764    return i - (i - iFirstSave) % 4;
6765  }
6766  let isSameImage = false;
6767  let iTransform, transformArgs;
6768  const firstPIMXOArg0 = argsArray[iFirstPIMXO][0];
6769  const firstTransformArg0 = argsArray[iFirstTransform][0],
6770    firstTransformArg1 = argsArray[iFirstTransform][1],
6771    firstTransformArg2 = argsArray[iFirstTransform][2],
6772    firstTransformArg3 = argsArray[iFirstTransform][3];
6773  if (firstTransformArg1 === firstTransformArg2) {
6774    isSameImage = true;
6775    iTransform = iFirstTransform + 4;
6776    let iPIMXO = iFirstPIMXO + 4;
6777    for (let q = 1; q < count; q++, iTransform += 4, iPIMXO += 4) {
6778      transformArgs = argsArray[iTransform];
6779      if (argsArray[iPIMXO][0] !== firstPIMXOArg0 || transformArgs[0] !== firstTransformArg0 || transformArgs[1] !== firstTransformArg1 || transformArgs[2] !== firstTransformArg2 || transformArgs[3] !== firstTransformArg3) {
6780        if (q < MIN_IMAGES_IN_MASKS_BLOCK) {
6781          isSameImage = false;
6782        } else {
6783          count = q;
6784        }
6785        break;
6786      }
6787    }
6788  }
6789  if (isSameImage) {
6790    count = Math.min(count, MAX_SAME_IMAGES_IN_MASKS_BLOCK);
6791    const positions = new Float32Array(count * 2);
6792    iTransform = iFirstTransform;
6793    for (let q = 0; q < count; q++, iTransform += 4) {
6794      transformArgs = argsArray[iTransform];
6795      positions[q << 1] = transformArgs[4];
6796      positions[(q << 1) + 1] = transformArgs[5];
6797    }
6798    fnArray.splice(iFirstSave, count * 4, OPS.paintImageMaskXObjectRepeat);
6799    argsArray.splice(iFirstSave, count * 4, [firstPIMXOArg0, firstTransformArg0, firstTransformArg1, firstTransformArg2, firstTransformArg3, positions]);
6800  } else {
6801    count = Math.min(count, MAX_IMAGES_IN_MASKS_BLOCK);
6802    const images = [];
6803    for (let q = 0; q < count; q++) {
6804      transformArgs = argsArray[iFirstTransform + (q << 2)];
6805      const maskParams = argsArray[iFirstPIMXO + (q << 2)][0];
6806      images.push({
6807        data: maskParams.data,
6808        width: maskParams.width,
6809        height: maskParams.height,
6810        interpolate: maskParams.interpolate,
6811        count: maskParams.count,
6812        transform: transformArgs
6813      });
6814    }
6815    fnArray.splice(iFirstSave, count * 4, OPS.paintImageMaskXObjectGroup);
6816    argsArray.splice(iFirstSave, count * 4, [images]);
6817  }
6818  return iFirstSave + 1;
6819});
6820addState(InitialState, [OPS.save, OPS.transform, OPS.paintImageXObject, OPS.restore], function (context) {
6821  const argsArray = context.argsArray;
6822  const iFirstTransform = context.iCurr - 2;
6823  return argsArray[iFirstTransform][1] === 0 && argsArray[iFirstTransform][2] === 0;
6824}, function iterateImageGroup(context, i) {
6825  const fnArray = context.fnArray,
6826    argsArray = context.argsArray;
6827  const iFirstSave = context.iCurr - 3;
6828  const pos = (i - iFirstSave) % 4;
6829  switch (pos) {
6830    case 0:
6831      return fnArray[i] === OPS.save;
6832    case 1:
6833      if (fnArray[i] !== OPS.transform) {
6834        return false;
6835      }
6836      const iFirstTransform = context.iCurr - 2;
6837      const firstTransformArg0 = argsArray[iFirstTransform][0];
6838      const firstTransformArg3 = argsArray[iFirstTransform][3];
6839      if (argsArray[i][0] !== firstTransformArg0 || argsArray[i][1] !== 0 || argsArray[i][2] !== 0 || argsArray[i][3] !== firstTransformArg3) {
6840        return false;
6841      }
6842      return true;
6843    case 2:
6844      if (fnArray[i] !== OPS.paintImageXObject) {
6845        return false;
6846      }
6847      const iFirstPIXO = context.iCurr - 1;
6848      const firstPIXOArg0 = argsArray[iFirstPIXO][0];
6849      if (argsArray[i][0] !== firstPIXOArg0) {
6850        return false;
6851      }
6852      return true;
6853    case 3:
6854      return fnArray[i] === OPS.restore;
6855  }
6856  throw new Error(`iterateImageGroup - invalid pos: ${pos}`);
6857}, function (context, i) {
6858  const MIN_IMAGES_IN_BLOCK = 3;
6859  const MAX_IMAGES_IN_BLOCK = 1000;
6860  const fnArray = context.fnArray,
6861    argsArray = context.argsArray;
6862  const curr = context.iCurr;
6863  const iFirstSave = curr - 3;
6864  const iFirstTransform = curr - 2;
6865  const iFirstPIXO = curr - 1;
6866  const firstPIXOArg0 = argsArray[iFirstPIXO][0];
6867  const firstTransformArg0 = argsArray[iFirstTransform][0];
6868  const firstTransformArg3 = argsArray[iFirstTransform][3];
6869  const count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_BLOCK);
6870  if (count < MIN_IMAGES_IN_BLOCK) {
6871    return i - (i - iFirstSave) % 4;
6872  }
6873  const positions = new Float32Array(count * 2);
6874  let iTransform = iFirstTransform;
6875  for (let q = 0; q < count; q++, iTransform += 4) {
6876    const transformArgs = argsArray[iTransform];
6877    positions[q << 1] = transformArgs[4];
6878    positions[(q << 1) + 1] = transformArgs[5];
6879  }
6880  const args = [firstPIXOArg0, firstTransformArg0, firstTransformArg3, positions];
6881  fnArray.splice(iFirstSave, count * 4, OPS.paintImageXObjectRepeat);
6882  argsArray.splice(iFirstSave, count * 4, args);
6883  return iFirstSave + 1;
6884});
6885addState(InitialState, [OPS.beginText, OPS.setFont, OPS.setTextMatrix, OPS.showText, OPS.endText], null, function iterateShowTextGroup(context, i) {
6886  const fnArray = context.fnArray,
6887    argsArray = context.argsArray;
6888  const iFirstSave = context.iCurr - 4;
6889  const pos = (i - iFirstSave) % 5;
6890  switch (pos) {
6891    case 0:
6892      return fnArray[i] === OPS.beginText;
6893    case 1:
6894      return fnArray[i] === OPS.setFont;
6895    case 2:
6896      return fnArray[i] === OPS.setTextMatrix;
6897    case 3:
6898      if (fnArray[i] !== OPS.showText) {
6899        return false;
6900      }
6901      const iFirstSetFont = context.iCurr - 3;
6902      const firstSetFontArg0 = argsArray[iFirstSetFont][0];
6903      const firstSetFontArg1 = argsArray[iFirstSetFont][1];
6904      if (argsArray[i][0] !== firstSetFontArg0 || argsArray[i][1] !== firstSetFontArg1) {
6905        return false;
6906      }
6907      return true;
6908    case 4:
6909      return fnArray[i] === OPS.endText;
6910  }
6911  throw new Error(`iterateShowTextGroup - invalid pos: ${pos}`);
6912}, function (context, i) {
6913  const MIN_CHARS_IN_BLOCK = 3;
6914  const MAX_CHARS_IN_BLOCK = 1000;
6915  const fnArray = context.fnArray,
6916    argsArray = context.argsArray;
6917  const curr = context.iCurr;
6918  const iFirstBeginText = curr - 4;
6919  const iFirstSetFont = curr - 3;
6920  const iFirstSetTextMatrix = curr - 2;
6921  const iFirstShowText = curr - 1;
6922  const iFirstEndText = curr;
6923  const firstSetFontArg0 = argsArray[iFirstSetFont][0];
6924  const firstSetFontArg1 = argsArray[iFirstSetFont][1];
6925  let count = Math.min(Math.floor((i - iFirstBeginText) / 5), MAX_CHARS_IN_BLOCK);
6926  if (count < MIN_CHARS_IN_BLOCK) {
6927    return i - (i - iFirstBeginText) % 5;
6928  }
6929  let iFirst = iFirstBeginText;
6930  if (iFirstBeginText >= 4 && fnArray[iFirstBeginText - 4] === fnArray[iFirstSetFont] && fnArray[iFirstBeginText - 3] === fnArray[iFirstSetTextMatrix] && fnArray[iFirstBeginText - 2] === fnArray[iFirstShowText] && fnArray[iFirstBeginText - 1] === fnArray[iFirstEndText] && argsArray[iFirstBeginText - 4][0] === firstSetFontArg0 && argsArray[iFirstBeginText - 4][1] === firstSetFontArg1) {
6931    count++;
6932    iFirst -= 5;
6933  }
6934  let iEndText = iFirst + 4;
6935  for (let q = 1; q < count; q++) {
6936    fnArray.splice(iEndText, 3);
6937    argsArray.splice(iEndText, 3);
6938    iEndText += 2;
6939  }
6940  return iEndText + 1;
6941});
6942addState(InitialState, [OPS.save, OPS.transform, OPS.constructPath, OPS.restore], context => {
6943  const argsArray = context.argsArray;
6944  const iFirstConstructPath = context.iCurr - 1;
6945  const op = argsArray[iFirstConstructPath][0];
6946  if (op !== OPS.stroke && op !== OPS.closeStroke && op !== OPS.fillStroke && op !== OPS.eoFillStroke && op !== OPS.closeFillStroke && op !== OPS.closeEOFillStroke) {
6947    return true;
6948  }
6949  const iFirstTransform = context.iCurr - 2;
6950  const transform = argsArray[iFirstTransform];
6951  return transform[0] === 1 && transform[1] === 0 && transform[2] === 0 && transform[3] === 1;
6952}, () => false, (context, i) => {
6953  const {
6954    fnArray,
6955    argsArray
6956  } = context;
6957  const curr = context.iCurr;
6958  const iFirstSave = curr - 3;
6959  const iFirstTransform = curr - 2;
6960  const iFirstConstructPath = curr - 1;
6961  const args = argsArray[iFirstConstructPath];
6962  const transform = argsArray[iFirstTransform];
6963  const [, [buffer], minMax] = args;
6964  if (minMax) {
6965    const newBBox = F32_BBOX_INIT.slice();
6966    Util.axialAlignedBoundingBox(minMax, transform, newBBox);
6967    minMax.set(newBBox);
6968    for (let k = 0, kk = buffer.length; k < kk;) {
6969      switch (buffer[k++]) {
6970        case DrawOPS.moveTo:
6971        case DrawOPS.lineTo:
6972          Util.applyTransform(buffer, transform, k);
6973          k += 2;
6974          break;
6975        case DrawOPS.curveTo:
6976          Util.applyTransformToBezier(buffer, transform, k);
6977          k += 6;
6978          break;
6979      }
6980    }
6981  }
6982  fnArray.splice(iFirstSave, 4, OPS.constructPath);
6983  argsArray.splice(iFirstSave, 4, args);
6984  return iFirstSave + 1;
6985});
6986class NullOptimizer {
6987  constructor(queue) {
6988    this.queue = queue;
6989  }
6990  _optimize() {}
6991  push(fn, args) {
6992    this.queue.fnArray.push(fn);
6993    this.queue.argsArray.push(args);
6994    this._optimize();
6995  }
6996  flush() {}
6997  reset() {}
6998}
6999class QueueOptimizer extends NullOptimizer {
7000  constructor(queue) {
7001    super(queue);
7002    this.state = null;
7003    this.context = {
7004      iCurr: 0,
7005      fnArray: queue.fnArray,
7006      argsArray: queue.argsArray,
7007      isOffscreenCanvasSupported: OperatorList.isOffscreenCanvasSupported
7008    };
7009    this.match = null;
7010    this.lastProcessed = 0;
7011  }
7012  _optimize() {
7013    const fnArray = this.queue.fnArray;
7014    let i = this.lastProcessed,
7015      ii = fnArray.length;
7016    let state = this.state;
7017    let match = this.match;
7018    if (!state && !match && i + 1 === ii && !InitialState[fnArray[i]]) {
7019      this.lastProcessed = ii;
7020      return;
7021    }
7022    const context = this.context;
7023    while (i < ii) {
7024      if (match) {
7025        const iterate = (0, match.iterateFn)(context, i);
7026        if (iterate) {
7027          i++;
7028          continue;
7029        }
7030        i = (0, match.processFn)(context, i + 1);
7031        ii = fnArray.length;
7032        match = null;
7033        state = null;
7034        if (i >= ii) {
7035          break;
7036        }
7037      }
7038      state = (state || InitialState)[fnArray[i]];
7039      if (!state || Array.isArray(state)) {
7040        i++;
7041        continue;
7042      }
7043      context.iCurr = i;
7044      i++;
7045      if (state.checkFn && !(0, state.checkFn)(context)) {
7046        state = null;
7047        continue;
7048      }
7049      match = state;
7050      state = null;
7051    }
7052    this.state = state;
7053    this.match = match;
7054    this.lastProcessed = i;
7055  }
7056  flush() {
7057    while (this.match) {
7058      const length = this.queue.fnArray.length;
7059      this.lastProcessed = (0, this.match.processFn)(this.context, length);
7060      this.match = null;
7061      this.state = null;
7062      this._optimize();
7063    }
7064  }
7065  reset() {
7066    this.state = null;
7067    this.match = null;
7068    this.lastProcessed = 0;
7069  }
7070}
7071class OperatorList {
7072  static CHUNK_SIZE = 1000;
7073  static CHUNK_SIZE_ABOUT = this.CHUNK_SIZE - 5;
7074  static isOffscreenCanvasSupported = false;
7075  constructor(intent = 0, streamSink) {
7076    this._streamSink = streamSink;
7077    this.fnArray = [];
7078    this.argsArray = [];
7079    this.optimizer = streamSink && !(intent & RenderingIntentFlag.OPLIST) ? new QueueOptimizer(this) : new NullOptimizer(this);
7080    this.dependencies = new Set();
7081    this._totalLength = 0;
7082    this.weight = 0;
7083    this._resolved = streamSink ? null : Promise.resolve();
7084  }
7085  static setOptions({
7086    isOffscreenCanvasSupported
7087  }) {
7088    this.isOffscreenCanvasSupported = isOffscreenCanvasSupported;
7089  }
7090  get length() {
7091    return this.argsArray.length;
7092  }
7093  get ready() {
7094    return this._resolved || this._streamSink.ready;
7095  }
7096  get totalLength() {
7097    return this._totalLength + this.length;
7098  }
7099  addOp(fn, args) {
7100    this.optimizer.push(fn, args);
7101    this.weight++;
7102    if (this._streamSink) {
7103      if (this.weight >= OperatorList.CHUNK_SIZE) {
7104        this.flush();
7105      } else if (this.weight >= OperatorList.CHUNK_SIZE_ABOUT && (fn === OPS.restore || fn === OPS.endText)) {
7106        this.flush();
7107      }
7108    }
7109  }
7110  addImageOps(fn, args, optionalContent, hasMask = false) {
7111    if (hasMask) {
7112      this.addOp(OPS.save);
7113      this.addOp(OPS.setGState, [[["SMask", false]]]);
7114    }
7115    if (optionalContent !== undefined) {
7116      this.addOp(OPS.beginMarkedContentProps, ["OC", optionalContent]);
7117    }
7118    this.addOp(fn, args);
7119    if (optionalContent !== undefined) {
7120      this.addOp(OPS.endMarkedContent, []);
7121    }
7122    if (hasMask) {
7123      this.addOp(OPS.restore);
7124    }
7125  }
7126  addDependency(dependency) {
7127    if (this.dependencies.has(dependency)) {
7128      return;
7129    }
7130    this.dependencies.add(dependency);
7131    this.addOp(OPS.dependency, [dependency]);
7132  }
7133  addDependencies(dependencies) {
7134    for (const dependency of dependencies) {
7135      this.addDependency(dependency);
7136    }
7137  }
7138  addOpList(opList) {
7139    if (!(opList instanceof OperatorList)) {
7140      warn('addOpList - ignoring invalid "opList" parameter.');
7141      return;
7142    }
7143    for (const dependency of opList.dependencies) {
7144      this.dependencies.add(dependency);
7145    }
7146    for (let i = 0, ii = opList.length; i < ii; i++) {
7147      this.addOp(opList.fnArray[i], opList.argsArray[i]);
7148    }
7149  }
7150  getIR() {
7151    return {
7152      fnArray: this.fnArray,
7153      argsArray: this.argsArray,
7154      length: this.length
7155    };
7156  }
7157  get _transfers() {
7158    const transfers = [];
7159    const {
7160      fnArray,
7161      argsArray,
7162      length
7163    } = this;
7164    for (let i = 0; i < length; i++) {
7165      switch (fnArray[i]) {
7166        case OPS.paintInlineImageXObject:
7167        case OPS.paintInlineImageXObjectGroup:
7168        case OPS.paintImageMaskXObject:
7169          {
7170            const {
7171              bitmap,
7172              data
7173            } = argsArray[i][0];
7174            if (bitmap || data?.buffer) {
7175              transfers.push(bitmap || data.buffer);
7176            }
7177            break;
7178          }
7179        case OPS.constructPath:
7180          {
7181            const [, [data], minMax] = argsArray[i];
7182            if (data) {
7183              transfers.push(data.buffer, minMax.buffer);
7184            }
7185            break;
7186          }
7187        case OPS.paintFormXObjectBegin:
7188          const [matrix, bbox] = argsArray[i];
7189          if (matrix) {
7190            transfers.push(matrix.buffer);
7191          }
7192          if (bbox) {
7193            transfers.push(bbox.buffer);
7194          }
7195          break;
7196        case OPS.setTextMatrix:
7197          transfers.push(argsArray[i][0].buffer);
7198          break;
7199      }
7200    }
7201    return transfers;
7202  }
7203  flush(lastChunk = false, separateAnnots = null) {
7204    this.optimizer.flush();
7205    const length = this.length;
7206    this._totalLength += length;
7207    this._streamSink.enqueue({
7208      fnArray: this.fnArray,
7209      argsArray: this.argsArray,
7210      lastChunk,
7211      separateAnnots,
7212      length
7213    }, 1, this._transfers);
7214    this.dependencies.clear();
7215    this.fnArray.length = 0;
7216    this.argsArray.length = 0;
7217    this.weight = 0;
7218    this.optimizer.reset();
7219  }
7220}
7221class CheckedOperatorList extends OperatorList {
7222  needsIsolation = false;
7223  
vendor: 2,385 bytes, lines 7223-7305
7223addOp(fn, args) {
7224    if (!this.needsIsolation) {
7225      if (fn === OPS.beginGroup) {
7226        this.needsIsolation = args[0].needsIsolation;
7227      } else if (fn === OPS.setGState) {
7228        for (const [key, val] of args[0]) {
7229          if (key === "BM" && val !== "source-over") {
7230            this.needsIsolation = true;
7231            break;
7232          }
7233          if (key === "SMask" && val !== false) {
7234            this.needsIsolation = true;
7235            break;
7236          }
7237        }
7238      }
7239    }
7240    super.addOp(fn, args);
7241  }
7242}
7243
7244;// ./src/core/pattern.js
7245
7246
7247
7248
7249
7250const ShadingType = {
7251  FUNCTION_BASED: 1,
7252  AXIAL: 2,
7253  RADIAL: 3,
7254  FREE_FORM_MESH: 4,
7255  LATTICE_FORM_MESH: 5,
7256  COONS_PATCH_MESH: 6,
7257  TENSOR_PATCH_MESH: 7
7258};
7259class Pattern {
7260  static #hasGPU = false;
7261  constructor() {
7262    unreachable("Cannot initialize Pattern.");
7263  }
7264  static setOptions({
7265    hasGPU
7266  }) {
7267    this.#hasGPU = hasGPU;
7268  }
7269  static parseShading(shading, xref, res, pdfFunctionFactory, globalColorSpaceCache, localColorSpaceCache) {
7270    const dict = shading instanceof BaseStream ? shading.dict : shading;
7271    const type = dict.get("ShadingType");
7272    try {
7273      switch (type) {
7274        case ShadingType.FUNCTION_BASED:
7275          return new FunctionBasedShading(dict, xref, res, pdfFunctionFactory, globalColorSpaceCache, localColorSpaceCache);
7276        case ShadingType.AXIAL:
7277        case ShadingType.RADIAL:
7278          return new RadialAxialShading(dict, xref, res, pdfFunctionFactory, globalColorSpaceCache, localColorSpaceCache);
7279        case ShadingType.FREE_FORM_MESH:
7280        case ShadingType.LATTICE_FORM_MESH:
7281        case ShadingType.COONS_PATCH_MESH:
7282        case ShadingType.TENSOR_PATCH_MESH:
7283          return new MeshShading(shading, xref, res, pdfFunctionFactory, globalColorSpaceCache, localColorSpaceCache);
7284        default:
7285          throw new FormatError("Unsupported ShadingType: " + type);
7286      }
7287    } catch (ex) {
7288      if (ex instanceof MissingDataException) {
7289        throw ex;
7290      }
7291      warn(ex);
7292      return new DummyShading();
7293    }
7294  }
7295}
7296class BaseShading {
7297  static SMALL_NUMBER = 1e-6;
7298  getIR() {
7299    unreachable("Abstract method `getIR` called.");
7300  }
7301}
7302class RadialAxialShading extends BaseShading {
7303  constructor(dict, xref, resources, pdfFunctionFactory, globalColorSpaceCache, localColorSpaceCache) {
7304    super();
7305    this.shadingType = dict.get("ShadingType");
vendor: 3,423 bytes, lines 7306-7401
7306    let coordsLen = 0;
7307    if (this.shadingType === ShadingType.AXIAL) {
7308      coordsLen = 4;
7309    } else if (this.shadingType === ShadingType.RADIAL) {
7310      coordsLen = 6;
7311    }
7312    this.coordsArr = dict.getArray("Coords");
7313    if (!isNumberArray(this.coordsArr, coordsLen)) {
7314      throw new FormatError("RadialAxialShading: Invalid /Coords array.");
7315    }
7316    const cs = ColorSpaceUtils.parse({
7317      cs: dict.getRaw("CS") || dict.getRaw("ColorSpace"),
7318      xref,
7319      resources,
7320      pdfFunctionFactory,
7321      globalColorSpaceCache,
7322      localColorSpaceCache
7323    });
7324    this.bbox = lookupNormalRect(dict.getArray("BBox"), null);
7325    let t0 = 0.0,
7326      t1 = 1.0;
7327    const domainArr = dict.getArray("Domain");
7328    if (isNumberArray(domainArr, 2)) {
7329      [t0, t1] = domainArr;
7330    }
7331    let extendStart = false,
7332      extendEnd = false;
7333    const extendArr = dict.getArray("Extend");
7334    if (isBooleanArray(extendArr, 2)) {
7335      [extendStart, extendEnd] = extendArr;
7336    }
7337    this.extendStart = extendStart;
7338    this.extendEnd = extendEnd;
7339    const fnObj = dict.getRaw("Function");
7340    const fn = pdfFunctionFactory.create(fnObj, true);
7341    const NUMBER_OF_SAMPLES = 840;
7342    const step = (t1 - t0) / NUMBER_OF_SAMPLES;
7343    const colorStops = this.colorStops = [];
7344    if (t0 >= t1 || step <= 0) {
7345      info("Bad shading domain.");
7346      return;
7347    }
7348    const color = new Float32Array(cs.numComps),
7349      ratio = new Float32Array(1);
7350    let iBase = 0;
7351    ratio[0] = t0;
7352    fn(ratio, 0, color, 0);
7353    const rgbBuffer = new Uint8ClampedArray(3);
7354    cs.getRgb(color, 0, rgbBuffer);
7355    let [rBase, gBase, bBase] = rgbBuffer;
7356    colorStops.push([0, Util.makeHexColor(rBase, gBase, bBase)]);
7357    let iPrev = 1;
7358    ratio[0] = t0 + step;
7359    fn(ratio, 0, color, 0);
7360    cs.getRgb(color, 0, rgbBuffer);
7361    let [rPrev, gPrev, bPrev] = rgbBuffer;
7362    let maxSlopeR = rPrev - rBase + 1;
7363    let maxSlopeG = gPrev - gBase + 1;
7364    let maxSlopeB = bPrev - bBase + 1;
7365    let minSlopeR = rPrev - rBase - 1;
7366    let minSlopeG = gPrev - gBase - 1;
7367    let minSlopeB = bPrev - bBase - 1;
7368    for (let i = 2; i < NUMBER_OF_SAMPLES; i++) {
7369      ratio[0] = t0 + i * step;
7370      fn(ratio, 0, color, 0);
7371      cs.getRgb(color, 0, rgbBuffer);
7372      const [r, g, b] = rgbBuffer;
7373      const run = i - iBase;
7374      maxSlopeR = Math.min(maxSlopeR, (r - rBase + 1) / run);
7375      maxSlopeG = Math.min(maxSlopeG, (g - gBase + 1) / run);
7376      maxSlopeB = Math.min(maxSlopeB, (b - bBase + 1) / run);
7377      minSlopeR = Math.max(minSlopeR, (r - rBase - 1) / run);
7378      minSlopeG = Math.max(minSlopeG, (g - gBase - 1) / run);
7379      minSlopeB = Math.max(minSlopeB, (b - bBase - 1) / run);
7380      const slopesExist = minSlopeR <= maxSlopeR && minSlopeG <= maxSlopeG && minSlopeB <= maxSlopeB;
7381      if (!slopesExist) {
7382        const cssColor = Util.makeHexColor(rPrev, gPrev, bPrev);
7383        colorStops.push([iPrev / NUMBER_OF_SAMPLES, cssColor]);
7384        maxSlopeR = r - rPrev + 1;
7385        maxSlopeG = g - gPrev + 1;
7386        maxSlopeB = b - bPrev + 1;
7387        minSlopeR = r - rPrev - 1;
7388        minSlopeG = g - gPrev - 1;
7389        minSlopeB = b - bPrev - 1;
7390        iBase = iPrev;
7391        rBase = rPrev;
7392        gBase = gPrev;
7393        bBase = bPrev;
7394      }
7395      iPrev = i;
7396      rPrev = r;
7397      gPrev = g;
7398      bPrev = b;
7399    }
7400    colorStops.push([1, Util.makeHexColor(rPrev, gPrev, bPrev)]);
7401    let background = "transparent";
vendor: 9,972 bytes, lines 7402-7710
7402    if (dict.has("Background")) {
7403      background = cs.getRgbHex(dict.get("Background"), 0);
7404    }
7405    if (!extendStart) {
7406      colorStops.unshift([0, background]);
7407      colorStops[1][0] += BaseShading.SMALL_NUMBER;
7408    }
7409    if (!extendEnd) {
7410      colorStops.at(-1)[0] -= BaseShading.SMALL_NUMBER;
7411      colorStops.push([1, background]);
7412    }
7413    this.colorStops = colorStops;
7414  }
7415  getIR() {
7416    const {
7417      coordsArr,
7418      shadingType
7419    } = this;
7420    let type, p0, p1, r0, r1;
7421    if (shadingType === ShadingType.AXIAL) {
7422      p0 = [coordsArr[0], coordsArr[1]];
7423      p1 = [coordsArr[2], coordsArr[3]];
7424      r0 = null;
7425      r1 = null;
7426      type = "axial";
7427    } else if (shadingType === ShadingType.RADIAL) {
7428      p0 = [coordsArr[0], coordsArr[1]];
7429      p1 = [coordsArr[3], coordsArr[4]];
7430      r0 = coordsArr[2];
7431      r1 = coordsArr[5];
7432      type = "radial";
7433    } else {
7434      unreachable(`getPattern type unknown: ${shadingType}`);
7435    }
7436    return ["RadialAxial", type, this.bbox, this.colorStops, p0, p1, r0, r1];
7437  }
7438}
7439function meshUpdateBounds(self) {
7440  let minX = self.coords[0][0],
7441    minY = self.coords[0][1],
7442    maxX = minX,
7443    maxY = minY;
7444  for (let i = 1, ii = self.coords.length; i < ii; i++) {
7445    const x = self.coords[i][0],
7446      y = self.coords[i][1];
7447    minX = minX > x ? x : minX;
7448    minY = minY > y ? y : minY;
7449    maxX = maxX < x ? x : maxX;
7450    maxY = maxY < y ? y : maxY;
7451  }
7452  self.bounds = [minX, minY, maxX, maxY];
7453}
7454function meshPackData(self) {
7455  let i, j, ii;
7456  const coords = self.coords;
7457  const coordsPacked = new Float32Array(coords.length * 2);
7458  for (i = 0, j = 0, ii = coords.length; i < ii; i++) {
7459    const xy = coords[i];
7460    coordsPacked[j++] = xy[0];
7461    coordsPacked[j++] = xy[1];
7462  }
7463  self.coords = coordsPacked;
7464  const colors = self.colors;
7465  const colorsPacked = new Uint8Array(colors.length * 4);
7466  for (i = 0, j = 0, ii = colors.length; i < ii; i++) {
7467    const c = colors[i];
7468    colorsPacked[j++] = c[0];
7469    colorsPacked[j++] = c[1];
7470    colorsPacked[j++] = c[2];
7471    j++;
7472  }
7473  self.colors = colorsPacked;
7474  for (const figure of self.figures) {
7475    figure.coords = new Uint32Array(figure.coords);
7476    figure.colors = new Uint32Array(figure.colors);
7477  }
7478}
7479function buildMeshVertexData(coords, colors, figures) {
7480  let vertexCount = 0;
7481  for (const figure of figures) {
7482    if (figure.type === MeshFigureType.TRIANGLES) {
7483      vertexCount += figure.coords.length;
7484    } else if (figure.type === MeshFigureType.LATTICE) {
7485      const vpr = figure.verticesPerRow;
7486      vertexCount += (Math.floor(figure.coords.length / vpr) - 1) * (vpr - 1) * 6;
7487    }
7488  }
7489  const posData = new Float32Array(vertexCount * 2);
7490  const colData = new Uint8Array(vertexCount * 4);
7491  let pOff = 0,
7492    cOff = 0;
7493  const addVertex = (pi, ci) => {
7494    posData[pOff++] = coords[pi * 2];
7495    posData[pOff++] = coords[pi * 2 + 1];
7496    colData[cOff++] = colors[ci * 4];
7497    colData[cOff++] = colors[ci * 4 + 1];
7498    colData[cOff++] = colors[ci * 4 + 2];
7499    cOff++;
7500  };
7501  for (const figure of figures) {
7502    const ps = figure.coords;
7503    const cs = figure.colors;
7504    if (figure.type === MeshFigureType.TRIANGLES) {
7505      for (let i = 0, ii = ps.length; i < ii; i++) {
7506        addVertex(ps[i], cs[i]);
7507      }
7508    } else if (figure.type === MeshFigureType.LATTICE) {
7509      const vpr = figure.verticesPerRow;
7510      const rows = Math.floor(ps.length / vpr) - 1;
7511      const cols = vpr - 1;
7512      for (let i = 0; i < rows; i++) {
7513        let q = i * vpr;
7514        for (let j = 0; j < cols; j++, q++) {
7515          addVertex(ps[q], cs[q]);
7516          addVertex(ps[q + 1], cs[q + 1]);
7517          addVertex(ps[q + vpr], cs[q + vpr]);
7518          addVertex(ps[q + vpr + 1], cs[q + vpr + 1]);
7519          addVertex(ps[q + 1], cs[q + 1]);
7520          addVertex(ps[q + vpr], cs[q + vpr]);
7521        }
7522      }
7523    }
7524  }
7525  return {
7526    posData,
7527    colData,
7528    vertexCount
7529  };
7530}
7531class FunctionBasedShading extends BaseShading {
7532  static MAX_STEP_COUNT = 512;
7533  constructor(dict, xref, resources, pdfFunctionFactory, globalColorSpaceCache, localColorSpaceCache) {
7534    super();
7535    this.bbox = lookupNormalRect(dict.getArray("BBox"), null);
7536    const cs = ColorSpaceUtils.parse({
7537      cs: dict.getRaw("CS") || dict.getRaw("ColorSpace"),
7538      xref,
7539      resources,
7540      pdfFunctionFactory,
7541      globalColorSpaceCache,
7542      localColorSpaceCache
7543    });
7544    this.background = dict.has("Background") ? cs.getRgb(dict.get("Background"), 0) : null;
7545    const fnObj = dict.getRaw("Function");
7546    if (!fnObj) {
7547      throw new FormatError("FunctionBasedShading: missing /Function");
7548    }
7549    const fn = pdfFunctionFactory.create(fnObj, true);
7550    const [x0, x1, y0, y1] = lookupRect(dict.getArray("Domain"), [0, 1, 0, 1]);
7551    const matrix = lookupMatrix(dict.getArray("Matrix"), IDENTITY_MATRIX);
7552    this.bounds = BBOX_INIT.slice();
7553    Util.axialAlignedBoundingBox([x0, y0, x1, y1], matrix, this.bounds);
7554    const bboxW = this.bounds[2] - this.bounds[0];
7555    const bboxH = this.bounds[3] - this.bounds[1];
7556    const stepsX = MathClamp(Math.ceil(bboxW), 1, FunctionBasedShading.MAX_STEP_COUNT);
7557    const stepsY = MathClamp(Math.ceil(bboxH), 1, FunctionBasedShading.MAX_STEP_COUNT);
7558    const verticesPerRow = stepsX + 1;
7559    const totalVertices = (stepsY + 1) * verticesPerRow;
7560    const coords = this.coords = new Float32Array(totalVertices * 2);
7561    const colors = this.colors = new Uint8ClampedArray(totalVertices * 4);
7562    const xyBuf = new Float32Array(2);
7563    const colorBuf = new Float32Array(cs.numComps);
7564    const rangeX = (x1 - x0) / stepsX;
7565    const rangeY = (y1 - y0) / stepsY;
7566    const halfStepX = rangeX / 2;
7567    const halfStepY = rangeY / 2;
7568    let coordOffset = 0;
7569    let colorOffset = 0;
7570    for (let row = 0; row <= stepsY; row++) {
7571      const yDomain = y0 + rangeY * row;
7572      xyBuf[1] = row === stepsY ? yDomain - halfStepY : yDomain;
7573      for (let col = 0; col <= stepsX; col++) {
7574        const xDomain = x0 + rangeX * col;
7575        xyBuf[0] = col === stepsX ? xDomain - halfStepX : xDomain;
7576        fn(xyBuf, 0, colorBuf, 0);
7577        coords[coordOffset] = xDomain;
7578        coords[coordOffset + 1] = yDomain;
7579        Util.applyTransform(coords, matrix, coordOffset);
7580        coordOffset += 2;
7581        cs.getRgbItem(colorBuf, 0, colors, colorOffset);
7582        colorOffset += 4;
7583      }
7584    }
7585    const ps = new Uint32Array(totalVertices);
7586    for (let i = 0; i < totalVertices; i++) {
7587      ps[i] = i;
7588    }
7589    this.figures = [{
7590      type: MeshFigureType.LATTICE,
7591      coords: ps,
7592      colors: new Uint32Array(ps),
7593      verticesPerRow
7594    }];
7595  }
7596  getIR() {
7597    const {
7598      posData,
7599      colData,
7600      vertexCount
7601    } = buildMeshVertexData(this.coords, this.colors, this.figures);
7602    return ["Mesh", ShadingType.FUNCTION_BASED, posData, colData, vertexCount, this.bounds, this.bbox, this.background];
7603  }
7604}
7605class MeshStreamReader {
7606  constructor(stream, context) {
7607    this.stream = stream;
7608    this.context = context;
7609    this.buffer = 0;
7610    this.bufferLength = 0;
7611    const numComps = context.numComps;
7612    this.tmpCompsBuf = new Float32Array(numComps);
7613    const csNumComps = context.colorSpace.numComps;
7614    this.tmpCsCompsBuf = context.colorFn ? new Float32Array(csNumComps) : this.tmpCompsBuf;
7615  }
7616  get hasData() {
7617    if (this.stream.end) {
7618      return this.stream.pos < this.stream.end;
7619    }
7620    if (this.bufferLength > 0) {
7621      return true;
7622    }
7623    const nextByte = this.stream.getByte();
7624    if (nextByte < 0) {
7625      return false;
7626    }
7627    this.buffer = nextByte;
7628    this.bufferLength = 8;
7629    return true;
7630  }
7631  readBits(n) {
7632    const {
7633      stream
7634    } = this;
7635    let {
7636      buffer,
7637      bufferLength
7638    } = this;
7639    if (n === 32) {
7640      if (bufferLength === 0) {
7641        return stream.getInt32() >>> 0;
7642      }
7643      buffer = buffer << 24 | stream.getByte() << 16 | stream.getByte() << 8 | stream.getByte();
7644      const nextByte = stream.getByte();
7645      this.buffer = nextByte & (1 << bufferLength) - 1;
7646      return (buffer << 8 - bufferLength | (nextByte & 0xff) >> bufferLength) >>> 0;
7647    }
7648    if (n === 8 && bufferLength === 0) {
7649      return stream.getByte();
7650    }
7651    while (bufferLength < n) {
7652      buffer = buffer << 8 | stream.getByte();
7653      bufferLength += 8;
7654    }
7655    bufferLength -= n;
7656    this.bufferLength = bufferLength;
7657    this.buffer = buffer & (1 << bufferLength) - 1;
7658    return buffer >> bufferLength;
7659  }
7660  align() {
7661    this.buffer = 0;
7662    this.bufferLength = 0;
7663  }
7664  readFlag() {
7665    return this.readBits(this.context.bitsPerFlag);
7666  }
7667  readCoordinate() {
7668    const {
7669      bitsPerCoordinate,
7670      decode
7671    } = this.context;
7672    const xi = this.readBits(bitsPerCoordinate);
7673    const yi = this.readBits(bitsPerCoordinate);
7674    const scale = bitsPerCoordinate < 32 ? 1 / ((1 << bitsPerCoordinate) - 1) : 2.3283064365386963e-10;
7675    return [xi * scale * (decode[1] - decode[0]) + decode[0], yi * scale * (decode[3] - decode[2]) + decode[2]];
7676  }
7677  readComponents() {
7678    const {
7679      bitsPerComponent,
7680      colorFn,
7681      colorSpace,
7682      decode,
7683      numComps
7684    } = this.context;
7685    const scale = bitsPerComponent < 32 ? 1 / ((1 << bitsPerComponent) - 1) : 2.3283064365386963e-10;
7686    const components = this.tmpCompsBuf;
7687    for (let i = 0, j = 4; i < numComps; i++, j += 2) {
7688      const ci = this.readBits(bitsPerComponent);
7689      components[i] = ci * scale * (decode[j + 1] - decode[j]) + decode[j];
7690    }
7691    const color = this.tmpCsCompsBuf;
7692    colorFn?.(components, 0, color, 0);
7693    return colorSpace.getRgb(color, 0);
7694  }
7695}
7696let bCache = Object.create(null);
7697function buildB(count) {
7698  const lut = [];
7699  for (let i = 0; i <= count; i++) {
7700    const t = i / count,
7701      t_ = 1 - t;
7702    lut.push(new Float32Array([t_ ** 3, 3 * t * t_ ** 2, 3 * t ** 2 * t_, t ** 3]));
7703  }
7704  return lut;
7705}
7706function getB(count) {
7707  return bCache[count] ||= buildB(count);
7708}
7709function clearPatternCaches() {
7710  bCache = Object.create(null
vendor: 178,011 bytes, lines 7710-10405
7710);
7711}
7712class MeshShading extends BaseShading {
7713  static MIN_SPLIT_PATCH_CHUNKS_AMOUNT = 3;
7714  static MAX_SPLIT_PATCH_CHUNKS_AMOUNT = 20;
7715  static TRIANGLE_DENSITY = 20;
7716  constructor(stream, xref, resources, pdfFunctionFactory, globalColorSpaceCache, localColorSpaceCache) {
7717    super();
7718    if (!(stream instanceof BaseStream)) {
7719      throw new FormatError("Mesh data is not a stream");
7720    }
7721    const dict = stream.dict;
7722    this.shadingType = dict.get("ShadingType");
7723    this.bbox = lookupNormalRect(dict.getArray("BBox"), null);
7724    const cs = ColorSpaceUtils.parse({
7725      cs: dict.getRaw("CS") || dict.getRaw("ColorSpace"),
7726      xref,
7727      resources,
7728      pdfFunctionFactory,
7729      globalColorSpaceCache,
7730      localColorSpaceCache
7731    });
7732    this.background = dict.has("Background") ? cs.getRgb(dict.get("Background"), 0) : null;
7733    const fnObj = dict.getRaw("Function");
7734    const fn = fnObj ? pdfFunctionFactory.create(fnObj, true) : null;
7735    this.coords = [];
7736    this.colors = [];
7737    this.figures = [];
7738    const decodeContext = {
7739      bitsPerCoordinate: dict.get("BitsPerCoordinate"),
7740      bitsPerComponent: dict.get("BitsPerComponent"),
7741      bitsPerFlag: dict.get("BitsPerFlag"),
7742      decode: dict.getArray("Decode"),
7743      colorFn: fn,
7744      colorSpace: cs,
7745      numComps: fn ? 1 : cs.numComps
7746    };
7747    const reader = new MeshStreamReader(stream, decodeContext);
7748    let patchMesh = false;
7749    switch (this.shadingType) {
7750      case ShadingType.FREE_FORM_MESH:
7751        this._decodeType4Shading(reader);
7752        break;
7753      case ShadingType.LATTICE_FORM_MESH:
7754        const verticesPerRow = dict.get("VerticesPerRow") | 0;
7755        if (verticesPerRow < 2) {
7756          throw new FormatError("Invalid VerticesPerRow");
7757        }
7758        this._decodeType5Shading(reader, verticesPerRow);
7759        break;
7760      case ShadingType.COONS_PATCH_MESH:
7761        this._decodeType6Shading(reader);
7762        patchMesh = true;
7763        break;
7764      case ShadingType.TENSOR_PATCH_MESH:
7765        this._decodeType7Shading(reader);
7766        patchMesh = true;
7767        break;
7768      default:
7769        unreachable("Unsupported mesh type.");
7770        break;
7771    }
7772    if (patchMesh) {
7773      this._updateBounds();
7774      for (let i = 0, ii = this.figures.length; i < ii; i++) {
7775        this._buildFigureFromPatch(i);
7776      }
7777    }
7778    this._updateBounds();
7779    this._packData();
7780  }
7781  _decodeType4Shading(reader) {
7782    const coords = this.coords;
7783    const colors = this.colors;
7784    const operators = [];
7785    const ps = [];
7786    let verticesLeft = 0;
7787    while (reader.hasData) {
7788      const f = reader.readFlag();
7789      const coord = reader.readCoordinate();
7790      const color = reader.readComponents();
7791      if (verticesLeft === 0) {
7792        if (!(0 <= f && f <= 2)) {
7793          throw new FormatError("Unknown type4 flag");
7794        }
7795        switch (f) {
7796          case 0:
7797            verticesLeft = 3;
7798            break;
7799          case 1:
7800            ps.push(ps.at(-2), ps.at(-1));
7801            verticesLeft = 1;
7802            break;
7803          case 2:
7804            ps.push(ps.at(-3), ps.at(-1));
7805            verticesLeft = 1;
7806            break;
7807        }
7808        operators.push(f);
7809      }
7810      ps.push(coords.length);
7811      coords.push(coord);
7812      colors.push(color);
7813      verticesLeft--;
7814      reader.align();
7815    }
7816    this.figures.push({
7817      type: MeshFigureType.TRIANGLES,
7818      coords: new Int32Array(ps),
7819      colors: new Int32Array(ps)
7820    });
7821  }
7822  _decodeType5Shading(reader, verticesPerRow) {
7823    const coords = this.coords;
7824    const colors = this.colors;
7825    const ps = [];
7826    while (reader.hasData) {
7827      const coord = reader.readCoordinate();
7828      const color = reader.readComponents();
7829      ps.push(coords.length);
7830      coords.push(coord);
7831      colors.push(color);
7832    }
7833    this.figures.push({
7834      type: MeshFigureType.LATTICE,
7835      coords: new Int32Array(ps),
7836      colors: new Int32Array(ps),
7837      verticesPerRow
7838    });
7839  }
7840  _decodeType6Shading(reader) {
7841    const coords = this.coords;
7842    const colors = this.colors;
7843    const ps = new Int32Array(16);
7844    const cs = new Int32Array(4);
7845    while (reader.hasData) {
7846      const f = reader.readFlag();
7847      if (!(0 <= f && f <= 3)) {
7848        throw new FormatError("Unknown type6 flag");
7849      }
7850      const pi = coords.length;
7851      for (let i = 0, ii = f !== 0 ? 8 : 12; i < ii; i++) {
7852        coords.push(reader.readCoordinate());
7853      }
7854      const ci = colors.length;
7855      for (let i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
7856        colors.push(reader.readComponents());
7857      }
7858      let tmp1, tmp2, tmp3, tmp4;
7859      switch (f) {
7860        case 0:
7861          ps[12] = pi + 3;
7862          ps[13] = pi + 4;
7863          ps[14] = pi + 5;
7864          ps[15] = pi + 6;
7865          ps[8] = pi + 2;
7866          ps[11] = pi + 7;
7867          ps[4] = pi + 1;
7868          ps[7] = pi + 8;
7869          ps[0] = pi;
7870          ps[1] = pi + 11;
7871          ps[2] = pi + 10;
7872          ps[3] = pi + 9;
7873          cs[2] = ci + 1;
7874          cs[3] = ci + 2;
7875          cs[0] = ci;
7876          cs[1] = ci + 3;
7877          break;
7878        case 1:
7879          tmp1 = ps[12];
7880          tmp2 = ps[13];
7881          tmp3 = ps[14];
7882          tmp4 = ps[15];
7883          ps[12] = tmp4;
7884          ps[13] = pi + 0;
7885          ps[14] = pi + 1;
7886          ps[15] = pi + 2;
7887          ps[8] = tmp3;
7888          ps[11] = pi + 3;
7889          ps[4] = tmp2;
7890          ps[7] = pi + 4;
7891          ps[0] = tmp1;
7892          ps[1] = pi + 7;
7893          ps[2] = pi + 6;
7894          ps[3] = pi + 5;
7895          tmp1 = cs[2];
7896          tmp2 = cs[3];
7897          cs[2] = tmp2;
7898          cs[3] = ci;
7899          cs[0] = tmp1;
7900          cs[1] = ci + 1;
7901          break;
7902        case 2:
7903          tmp1 = ps[15];
7904          tmp2 = ps[11];
7905          ps[12] = ps[3];
7906          ps[13] = pi + 0;
7907          ps[14] = pi + 1;
7908          ps[15] = pi + 2;
7909          ps[8] = ps[7];
7910          ps[11] = pi + 3;
7911          ps[4] = tmp2;
7912          ps[7] = pi + 4;
7913          ps[0] = tmp1;
7914          ps[1] = pi + 7;
7915          ps[2] = pi + 6;
7916          ps[3] = pi + 5;
7917          tmp1 = cs[3];
7918          cs[2] = cs[1];
7919          cs[3] = ci;
7920          cs[0] = tmp1;
7921          cs[1] = ci + 1;
7922          break;
7923        case 3:
7924          ps[12] = ps[0];
7925          ps[13] = pi + 0;
7926          ps[14] = pi + 1;
7927          ps[15] = pi + 2;
7928          ps[8] = ps[1];
7929          ps[11] = pi + 3;
7930          ps[4] = ps[2];
7931          ps[7] = pi + 4;
7932          ps[0] = ps[3];
7933          ps[1] = pi + 7;
7934          ps[2] = pi + 6;
7935          ps[3] = pi + 5;
7936          cs[2] = cs[0];
7937          cs[3] = ci;
7938          cs[0] = cs[1];
7939          cs[1] = ci + 1;
7940          break;
7941      }
7942      ps[5] = coords.length;
7943      coords.push([(-4 * coords[ps[0]][0] - coords[ps[15]][0] + 6 * (coords[ps[4]][0] + coords[ps[1]][0]) - 2 * (coords[ps[12]][0] + coords[ps[3]][0]) + 3 * (coords[ps[13]][0] + coords[ps[7]][0])) / 9, (-4 * coords[ps[0]][1] - coords[ps[15]][1] + 6 * (coords[ps[4]][1] + coords[ps[1]][1]) - 2 * (coords[ps[12]][1] + coords[ps[3]][1]) + 3 * (coords[ps[13]][1] + coords[ps[7]][1])) / 9]);
7944      ps[6] = coords.length;
7945      coords.push([(-4 * coords[ps[3]][0] - coords[ps[12]][0] + 6 * (coords[ps[2]][0] + coords[ps[7]][0]) - 2 * (coords[ps[0]][0] + coords[ps[15]][0]) + 3 * (coords[ps[4]][0] + coords[ps[14]][0])) / 9, (-4 * coords[ps[3]][1] - coords[ps[12]][1] + 6 * (coords[ps[2]][1] + coords[ps[7]][1]) - 2 * (coords[ps[0]][1] + coords[ps[15]][1]) + 3 * (coords[ps[4]][1] + coords[ps[14]][1])) / 9]);
7946      ps[9] = coords.length;
7947      coords.push([(-4 * coords[ps[12]][0] - coords[ps[3]][0] + 6 * (coords[ps[8]][0] + coords[ps[13]][0]) - 2 * (coords[ps[0]][0] + coords[ps[15]][0]) + 3 * (coords[ps[11]][0] + coords[ps[1]][0])) / 9, (-4 * coords[ps[12]][1] - coords[ps[3]][1] + 6 * (coords[ps[8]][1] + coords[ps[13]][1]) - 2 * (coords[ps[0]][1] + coords[ps[15]][1]) + 3 * (coords[ps[11]][1] + coords[ps[1]][1])) / 9]);
7948      ps[10] = coords.length;
7949      coords.push([(-4 * coords[ps[15]][0] - coords[ps[0]][0] + 6 * (coords[ps[11]][0] + coords[ps[14]][0]) - 2 * (coords[ps[12]][0] + coords[ps[3]][0]) + 3 * (coords[ps[2]][0] + coords[ps[8]][0])) / 9, (-4 * coords[ps[15]][1] - coords[ps[0]][1] + 6 * (coords[ps[11]][1] + coords[ps[14]][1]) - 2 * (coords[ps[12]][1] + coords[ps[3]][1]) + 3 * (coords[ps[2]][1] + coords[ps[8]][1])) / 9]);
7950      this.figures.push({
7951        type: MeshFigureType.PATCH,
7952        coords: new Int32Array(ps),
7953        colors: new Int32Array(cs)
7954      });
7955    }
7956  }
7957  _decodeType7Shading(reader) {
7958    const coords = this.coords;
7959    const colors = this.colors;
7960    const ps = new Int32Array(16);
7961    const cs = new Int32Array(4);
7962    while (reader.hasData) {
7963      const f = reader.readFlag();
7964      if (!(0 <= f && f <= 3)) {
7965        throw new FormatError("Unknown type7 flag");
7966      }
7967      const pi = coords.length;
7968      for (let i = 0, ii = f !== 0 ? 12 : 16; i < ii; i++) {
7969        coords.push(reader.readCoordinate());
7970      }
7971      const ci = colors.length;
7972      for (let i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
7973        colors.push(reader.readComponents());
7974      }
7975      let tmp1, tmp2, tmp3, tmp4;
7976      switch (f) {
7977        case 0:
7978          ps[12] = pi + 3;
7979          ps[13] = pi + 4;
7980          ps[14] = pi + 5;
7981          ps[15] = pi + 6;
7982          ps[8] = pi + 2;
7983          ps[9] = pi + 13;
7984          ps[10] = pi + 14;
7985          ps[11] = pi + 7;
7986          ps[4] = pi + 1;
7987          ps[5] = pi + 12;
7988          ps[6] = pi + 15;
7989          ps[7] = pi + 8;
7990          ps[0] = pi;
7991          ps[1] = pi + 11;
7992          ps[2] = pi + 10;
7993          ps[3] = pi + 9;
7994          cs[2] = ci + 1;
7995          cs[3] = ci + 2;
7996          cs[0] = ci;
7997          cs[1] = ci + 3;
7998          break;
7999        case 1:
8000          tmp1 = ps[12];
8001          tmp2 = ps[13];
8002          tmp3 = ps[14];
8003          tmp4 = ps[15];
8004          ps[12] = tmp4;
8005          ps[13] = pi + 0;
8006          ps[14] = pi + 1;
8007          ps[15] = pi + 2;
8008          ps[8] = tmp3;
8009          ps[9] = pi + 9;
8010          ps[10] = pi + 10;
8011          ps[11] = pi + 3;
8012          ps[4] = tmp2;
8013          ps[5] = pi + 8;
8014          ps[6] = pi + 11;
8015          ps[7] = pi + 4;
8016          ps[0] = tmp1;
8017          ps[1] = pi + 7;
8018          ps[2] = pi + 6;
8019          ps[3] = pi + 5;
8020          tmp1 = cs[2];
8021          tmp2 = cs[3];
8022          cs[2] = tmp2;
8023          cs[3] = ci;
8024          cs[0] = tmp1;
8025          cs[1] = ci + 1;
8026          break;
8027        case 2:
8028          tmp1 = ps[15];
8029          tmp2 = ps[11];
8030          ps[12] = ps[3];
8031          ps[13] = pi + 0;
8032          ps[14] = pi + 1;
8033          ps[15] = pi + 2;
8034          ps[8] = ps[7];
8035          ps[9] = pi + 9;
8036          ps[10] = pi + 10;
8037          ps[11] = pi + 3;
8038          ps[4] = tmp2;
8039          ps[5] = pi + 8;
8040          ps[6] = pi + 11;
8041          ps[7] = pi + 4;
8042          ps[0] = tmp1;
8043          ps[1] = pi + 7;
8044          ps[2] = pi + 6;
8045          ps[3] = pi + 5;
8046          tmp1 = cs[3];
8047          cs[2] = cs[1];
8048          cs[3] = ci;
8049          cs[0] = tmp1;
8050          cs[1] = ci + 1;
8051          break;
8052        case 3:
8053          ps[12] = ps[0];
8054          ps[13] = pi + 0;
8055          ps[14] = pi + 1;
8056          ps[15] = pi + 2;
8057          ps[8] = ps[1];
8058          ps[9] = pi + 9;
8059          ps[10] = pi + 10;
8060          ps[11] = pi + 3;
8061          ps[4] = ps[2];
8062          ps[5] = pi + 8;
8063          ps[6] = pi + 11;
8064          ps[7] = pi + 4;
8065          ps[0] = ps[3];
8066          ps[1] = pi + 7;
8067          ps[2] = pi + 6;
8068          ps[3] = pi + 5;
8069          cs[2] = cs[0];
8070          cs[3] = ci;
8071          cs[0] = cs[1];
8072          cs[1] = ci + 1;
8073          break;
8074      }
8075      this.figures.push({
8076        type: MeshFigureType.PATCH,
8077        coords: new Int32Array(ps),
8078        colors: new Int32Array(cs)
8079      });
8080    }
8081  }
8082  _buildFigureFromPatch(index) {
8083    const figure = this.figures[index];
8084    assert(figure.type === MeshFigureType.PATCH, "Unexpected patch mesh figure");
8085    const coords = this.coords,
8086      colors = this.colors;
8087    const pi = figure.coords;
8088    const ci = figure.colors;
8089    const figureMinX = Math.min(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
8090    const figureMinY = Math.min(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
8091    const figureMaxX = Math.max(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
8092    const figureMaxY = Math.max(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
8093    let splitXBy = Math.ceil((figureMaxX - figureMinX) * MeshShading.TRIANGLE_DENSITY / (this.bounds[2] - this.bounds[0]));
8094    splitXBy = MathClamp(splitXBy, MeshShading.MIN_SPLIT_PATCH_CHUNKS_AMOUNT, MeshShading.MAX_SPLIT_PATCH_CHUNKS_AMOUNT);
8095    let splitYBy = Math.ceil((figureMaxY - figureMinY) * MeshShading.TRIANGLE_DENSITY / (this.bounds[3] - this.bounds[1]));
8096    splitYBy = MathClamp(splitYBy, MeshShading.MIN_SPLIT_PATCH_CHUNKS_AMOUNT, MeshShading.MAX_SPLIT_PATCH_CHUNKS_AMOUNT);
8097    const verticesPerRow = splitXBy + 1;
8098    const figureCoords = new Int32Array((splitYBy + 1) * verticesPerRow);
8099    const figureColors = new Int32Array((splitYBy + 1) * verticesPerRow);
8100    let k = 0;
8101    const cl = new Uint8Array(3),
8102      cr = new Uint8Array(3);
8103    const c0 = colors[ci[0]],
8104      c1 = colors[ci[1]],
8105      c2 = colors[ci[2]],
8106      c3 = colors[ci[3]];
8107    const bRow = getB(splitYBy),
8108      bCol = getB(splitXBy);
8109    for (let row = 0; row <= splitYBy; row++) {
8110      cl[0] = (c0[0] * (splitYBy - row) + c2[0] * row) / splitYBy | 0;
8111      cl[1] = (c0[1] * (splitYBy - row) + c2[1] * row) / splitYBy | 0;
8112      cl[2] = (c0[2] * (splitYBy - row) + c2[2] * row) / splitYBy | 0;
8113      cr[0] = (c1[0] * (splitYBy - row) + c3[0] * row) / splitYBy | 0;
8114      cr[1] = (c1[1] * (splitYBy - row) + c3[1] * row) / splitYBy | 0;
8115      cr[2] = (c1[2] * (splitYBy - row) + c3[2] * row) / splitYBy | 0;
8116      for (let col = 0; col <= splitXBy; col++, k++) {
8117        if ((row === 0 || row === splitYBy) && (col === 0 || col === splitXBy)) {
8118          continue;
8119        }
8120        let x = 0,
8121          y = 0;
8122        let q = 0;
8123        for (let i = 0; i <= 3; i++) {
8124          for (let j = 0; j <= 3; j++, q++) {
8125            const m = bRow[row][i] * bCol[col][j];
8126            x += coords[pi[q]][0] * m;
8127            y += coords[pi[q]][1] * m;
8128          }
8129        }
8130        figureCoords[k] = coords.length;
8131        coords.push([x, y]);
8132        figureColors[k] = colors.length;
8133        const newColor = new Uint8Array(3);
8134        newColor[0] = (cl[0] * (splitXBy - col) + cr[0] * col) / splitXBy | 0;
8135        newColor[1] = (cl[1] * (splitXBy - col) + cr[1] * col) / splitXBy | 0;
8136        newColor[2] = (cl[2] * (splitXBy - col) + cr[2] * col) / splitXBy | 0;
8137        colors.push(newColor);
8138      }
8139    }
8140    figureCoords[0] = pi[0];
8141    figureColors[0] = ci[0];
8142    figureCoords[splitXBy] = pi[3];
8143    figureColors[splitXBy] = ci[1];
8144    figureCoords[verticesPerRow * splitYBy] = pi[12];
8145    figureColors[verticesPerRow * splitYBy] = ci[2];
8146    figureCoords[verticesPerRow * splitYBy + splitXBy] = pi[15];
8147    figureColors[verticesPerRow * splitYBy + splitXBy] = ci[3];
8148    this.figures[index] = {
8149      type: MeshFigureType.LATTICE,
8150      coords: figureCoords,
8151      colors: figureColors,
8152      verticesPerRow
8153    };
8154  }
8155  _updateBounds() {
8156    meshUpdateBounds(this);
8157  }
8158  _packData() {
8159    meshPackData(this);
8160  }
8161  getIR() {
8162    const {
8163      posData,
8164      colData,
8165      vertexCount
8166    } = buildMeshVertexData(this.coords, this.colors, this.figures);
8167    return ["Mesh", this.shadingType, posData, colData, vertexCount, this.bounds, this.bbox, this.background];
8168  }
8169}
8170class DummyShading extends BaseShading {
8171  getIR() {
8172    return ["Dummy"];
8173  }
8174}
8175function getTilingPatternIR(operatorList, dict, color, needsIsolation = true) {
8176  const matrix = lookupMatrix(dict.getArray("Matrix"), IDENTITY_MATRIX);
8177  const bbox = lookupNormalRect(dict.getArray("BBox"), null);
8178  if (!bbox || bbox[2] - bbox[0] === 0 || bbox[3] - bbox[1] === 0) {
8179    throw new FormatError(`Invalid getTilingPatternIR /BBox array.`);
8180  }
8181  const xstep = dict.get("XStep");
8182  if (typeof xstep !== "number") {
8183    throw new FormatError(`Invalid getTilingPatternIR /XStep value.`);
8184  }
8185  const ystep = dict.get("YStep");
8186  if (typeof ystep !== "number") {
8187    throw new FormatError(`Invalid getTilingPatternIR /YStep value.`);
8188  }
8189  const paintType = dict.get("PaintType");
8190  if (!Number.isInteger(paintType)) {
8191    throw new FormatError(`Invalid getTilingPatternIR /PaintType value.`);
8192  }
8193  const tilingType = dict.get("TilingType");
8194  if (!Number.isInteger(tilingType)) {
8195    throw new FormatError(`Invalid getTilingPatternIR /TilingType value.`);
8196  }
8197  return ["TilingPattern", color, operatorList, matrix, bbox, xstep, ystep, paintType, tilingType, needsIsolation];
8198}
8199
8200;// ./src/core/binary_cmap.js
8201
8202
8203function hexToInt(a, size) {
8204  let n = 0;
8205  for (let i = 0; i <= size; i++) {
8206    n = n << 8 | a[i];
8207  }
8208  return n >>> 0;
8209}
8210function hexToStr(a, size) {
8211  if (size === 1) {
8212    return String.fromCharCode(a[0], a[1]);
8213  }
8214  if (size === 3) {
8215    return String.fromCharCode(a[0], a[1], a[2], a[3]);
8216  }
8217  return String.fromCharCode(...a.subarray(0, size + 1));
8218}
8219function addHex(a, b, size) {
8220  let c = 0;
8221  for (let i = size; i >= 0; i--) {
8222    c += a[i] + b[i];
8223    a[i] = c & 255;
8224    c >>= 8;
8225  }
8226}
8227function incHex(a, size) {
8228  let c = 1;
8229  for (let i = size; i >= 0 && c > 0; i--) {
8230    c += a[i];
8231    a[i] = c & 255;
8232    c >>= 8;
8233  }
8234}
8235const MAX_NUM_SIZE = 16;
8236const MAX_ENCODED_NUM_SIZE = 19;
8237class BinaryCMapStream extends Stream {
8238  tmpBuf = new Uint8Array(MAX_ENCODED_NUM_SIZE);
8239  constructor(data) {
8240    super(data, 0, data.length, null);
8241  }
8242  readNumber() {
8243    let n = 0;
8244    let last;
8245    do {
8246      const b = this.getByte();
8247      if (b < 0) {
8248        throw new FormatError("unexpected EOF in bcmap");
8249      }
8250      last = !(b & 0x80);
8251      n = n << 7 | b & 0x7f;
8252    } while (!last);
8253    return n;
8254  }
8255  readSigned() {
8256    const n = this.readNumber();
8257    return n & 1 ? ~(n >>> 1) : n >>> 1;
8258  }
8259  readHex(num, size) {
8260    num.set(this.getBytes(size + 1));
8261  }
8262  readHexNumber(num, size) {
8263    let last;
8264    const stack = this.tmpBuf;
8265    let sp = 0;
8266    do {
8267      const b = this.getByte();
8268      if (b < 0) {
8269        throw new FormatError("unexpected EOF in bcmap");
8270      }
8271      last = !(b & 0x80);
8272      stack[sp++] = b & 0x7f;
8273    } while (!last);
8274    let i = size,
8275      buffer = 0,
8276      bufferSize = 0;
8277    while (i >= 0) {
8278      while (bufferSize < 8 && stack.length > 0) {
8279        buffer |= stack[--sp] << bufferSize;
8280        bufferSize += 7;
8281      }
8282      num[i] = buffer & 255;
8283      i--;
8284      buffer >>= 8;
8285      bufferSize -= 8;
8286    }
8287  }
8288  readHexSigned(num, size) {
8289    this.readHexNumber(num, size);
8290    const sign = num[size] & 1 ? 255 : 0;
8291    let c = 0;
8292    for (let i = 0; i <= size; i++) {
8293      c = (c & 1) << 8 | num[i];
8294      num[i] = c >> 1 ^ sign;
8295    }
8296  }
8297  readString() {
8298    const len = this.readNumber(),
8299      buf = new Array(len);
8300    for (let i = 0; i < len; i++) {
8301      buf[i] = this.readNumber();
8302    }
8303    return String.fromCharCode(...buf);
8304  }
8305}
8306class BinaryCMapReader {
8307  async process(data, cMap, extend) {
8308    const stream = new BinaryCMapStream(data);
8309    const header = stream.getByte();
8310    cMap.vertical = !!(header & 1);
8311    let useCMap = null;
8312    const start = new Uint8Array(MAX_NUM_SIZE);
8313    const end = new Uint8Array(MAX_NUM_SIZE);
8314    const char = new Uint8Array(MAX_NUM_SIZE);
8315    const charCode = new Uint8Array(MAX_NUM_SIZE);
8316    const tmp = new Uint8Array(MAX_NUM_SIZE);
8317    let code;
8318    let b;
8319    while ((b = stream.getByte()) >= 0) {
8320      const type = b >> 5;
8321      if (type === 7) {
8322        switch (b & 0x1f) {
8323          case 0:
8324            stream.readString();
8325            break;
8326          case 1:
8327            useCMap = stream.readString();
8328            break;
8329        }
8330        continue;
8331      }
8332      const sequence = !!(b & 0x10);
8333      const dataSize = b & 15;
8334      if (dataSize + 1 > MAX_NUM_SIZE) {
8335        throw new Error("BinaryCMapReader.process: Invalid dataSize.");
8336      }
8337      const ucs2DataSize = 1;
8338      const subitemsCount = stream.readNumber();
8339      switch (type) {
8340        case 0:
8341          stream.readHex(start, dataSize);
8342          stream.readHexNumber(end, dataSize);
8343          addHex(end, start, dataSize);
8344          cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
8345          for (let i = 1; i < subitemsCount; i++) {
8346            incHex(end, dataSize);
8347            stream.readHexNumber(start, dataSize);
8348            addHex(start, end, dataSize);
8349            stream.readHexNumber(end, dataSize);
8350            addHex(end, start, dataSize);
8351            cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
8352          }
8353          break;
8354        case 1:
8355          stream.readHex(start, dataSize);
8356          stream.readHexNumber(end, dataSize);
8357          addHex(end, start, dataSize);
8358          stream.readNumber();
8359          for (let i = 1; i < subitemsCount; i++) {
8360            incHex(end, dataSize);
8361            stream.readHexNumber(start, dataSize);
8362            addHex(start, end, dataSize);
8363            stream.readHexNumber(end, dataSize);
8364            addHex(end, start, dataSize);
8365            stream.readNumber();
8366          }
8367          break;
8368        case 2:
8369          stream.readHex(char, dataSize);
8370          code = stream.readNumber();
8371          cMap.mapOne(hexToInt(char, dataSize), code);
8372          for (let i = 1; i < subitemsCount; i++) {
8373            incHex(char, dataSize);
8374            if (!sequence) {
8375              stream.readHexNumber(tmp, dataSize);
8376              addHex(char, tmp, dataSize);
8377            }
8378            code = stream.readSigned() + (code + 1);
8379            cMap.mapOne(hexToInt(char, dataSize), code);
8380          }
8381          break;
8382        case 3:
8383          stream.readHex(start, dataSize);
8384          stream.readHexNumber(end, dataSize);
8385          addHex(end, start, dataSize);
8386          code = stream.readNumber();
8387          cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
8388          for (let i = 1; i < subitemsCount; i++) {
8389            incHex(end, dataSize);
8390            if (!sequence) {
8391              stream.readHexNumber(start, dataSize);
8392              addHex(start, end, dataSize);
8393            } else {
8394              start.set(end);
8395            }
8396            stream.readHexNumber(end, dataSize);
8397            addHex(end, start, dataSize);
8398            code = stream.readNumber();
8399            cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
8400          }
8401          break;
8402        case 4:
8403          stream.readHex(char, ucs2DataSize);
8404          stream.readHex(charCode, dataSize);
8405          cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
8406          for (let i = 1; i < subitemsCount; i++) {
8407            incHex(char, ucs2DataSize);
8408            if (!sequence) {
8409              stream.readHexNumber(tmp, ucs2DataSize);
8410              addHex(char, tmp, ucs2DataSize);
8411            }
8412            incHex(charCode, dataSize);
8413            stream.readHexSigned(tmp, dataSize);
8414            addHex(charCode, tmp, dataSize);
8415            cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
8416          }
8417          break;
8418        case 5:
8419          stream.readHex(start, ucs2DataSize);
8420          stream.readHexNumber(end, ucs2DataSize);
8421          addHex(end, start, ucs2DataSize);
8422          stream.readHex(charCode, dataSize);
8423          cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
8424          for (let i = 1; i < subitemsCount; i++) {
8425            incHex(end, ucs2DataSize);
8426            if (!sequence) {
8427              stream.readHexNumber(start, ucs2DataSize);
8428              addHex(start, end, ucs2DataSize);
8429            } else {
8430              start.set(end);
8431            }
8432            stream.readHexNumber(end, ucs2DataSize);
8433            addHex(end, start, ucs2DataSize);
8434            stream.readHex(charCode, dataSize);
8435            cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
8436          }
8437          break;
8438        default:
8439          throw new Error(`BinaryCMapReader.process - unknown type: ${type}`);
8440      }
8441    }
8442    if (useCMap) {
8443      return extend(useCMap);
8444    }
8445    return cMap;
8446  }
8447}
8448
8449;// ./src/core/ascii_85_stream.js
8450
8451
8452class Ascii85Stream extends DecodeStream {
8453  #input = new Uint8Array(5);
8454  constructor(str, maybeLength) {
8455    if (maybeLength) {
8456      maybeLength *= 0.8;
8457    }
8458    super(maybeLength);
8459    this.stream = str;
8460    this.dict = str.dict;
8461  }
8462  readBlock() {
8463    const TILDA_CHAR = 0x7e;
8464    const Z_LOWER_CHAR = 0x7a;
8465    const EOF = -1;
8466    const str = this.stream;
8467    let c = str.getByte();
8468    while (isWhiteSpace(c)) {
8469      c = str.getByte();
8470    }
8471    if (c === EOF || c === TILDA_CHAR) {
8472      this.eof = true;
8473      return;
8474    }
8475    const bufferLength = this.bufferLength;
8476    let buffer, i;
8477    if (c === Z_LOWER_CHAR) {
8478      buffer = this.ensureBuffer(bufferLength + 4);
8479      buffer.fill(0, bufferLength, bufferLength + 4);
8480      this.bufferLength += 4;
8481    } else {
8482      const input = this.#input;
8483      input[0] = c;
8484      for (i = 1; i < 5; ++i) {
8485        c = str.getByte();
8486        while (isWhiteSpace(c)) {
8487          c = str.getByte();
8488        }
8489        input[i] = c;
8490        if (c === EOF || c === TILDA_CHAR) {
8491          break;
8492        }
8493      }
8494      buffer = this.ensureBuffer(bufferLength + i - 1);
8495      this.bufferLength += i - 1;
8496      if (i < 5) {
8497        input.fill(0x21 + 84, i, 5);
8498        this.eof = true;
8499      }
8500      let t = 0;
8501      for (i = 0; i < 5; ++i) {
8502        t = t * 85 + (input[i] - 0x21);
8503      }
8504      for (i = 3; i >= 0; --i) {
8505        buffer[bufferLength + i] = t & 0xff;
8506        t >>= 8;
8507      }
8508    }
8509  }
8510}
8511
8512;// ./src/core/ascii_hex_stream.js
8513
8514class AsciiHexStream extends DecodeStream {
8515  constructor(str, maybeLength) {
8516    if (maybeLength) {
8517      maybeLength *= 0.5;
8518    }
8519    super(maybeLength);
8520    this.stream = str;
8521    this.dict = str.dict;
8522    this.firstDigit = -1;
8523  }
8524  readBlock() {
8525    const UPSTREAM_BLOCK_SIZE = 8000;
8526    const bytes = this.stream.getBytes(UPSTREAM_BLOCK_SIZE);
8527    if (!bytes.length) {
8528      this.eof = true;
8529      return;
8530    }
8531    const maxDecodeLength = bytes.length + 1 >> 1;
8532    const buffer = this.ensureBuffer(this.bufferLength + maxDecodeLength);
8533    let bufferLength = this.bufferLength;
8534    let firstDigit = this.firstDigit;
8535    for (const ch of bytes) {
8536      let digit;
8537      if (ch >= 0x30 && ch <= 0x39) {
8538        digit = ch & 0x0f;
8539      } else if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
8540        digit = (ch & 0x0f) + 9;
8541      } else if (ch === 0x3e) {
8542        this.eof = true;
8543        break;
8544      } else {
8545        continue;
8546      }
8547      if (firstDigit < 0) {
8548        firstDigit = digit;
8549      } else {
8550        buffer[bufferLength++] = firstDigit << 4 | digit;
8551        firstDigit = -1;
8552      }
8553    }
8554    if (firstDigit >= 0 && this.eof) {
8555      buffer[bufferLength++] = firstDigit << 4;
8556      firstDigit = -1;
8557    }
8558    this.firstDigit = firstDigit;
8559    this.bufferLength = bufferLength;
8560  }
8561}
8562
8563;// ./external/brotli/decode.js
8564let Options;
8565let makeBrotliDecode = () => {
8566  const MAX_HUFFMAN_TABLE_SIZE = Int32Array.from([256, 402, 436, 468, 500, 534, 566, 598, 630, 662, 694, 726, 758, 790, 822, 854, 886, 920, 952, 984, 1016, 1048, 1080]);
8567  const CODE_LENGTH_CODE_ORDER = Int32Array.from([1, 2, 3, 4, 0, 5, 17, 6, 16, 7, 8, 9, 10, 11, 12, 13, 14, 15]);
8568  const DISTANCE_SHORT_CODE_INDEX_OFFSET = Int32Array.from([0, 3, 2, 1, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3]);
8569  const DISTANCE_SHORT_CODE_VALUE_OFFSET = Int32Array.from([0, 0, 0, 0, -1, 1, -2, 2, -3, 3, -1, 1, -2, 2, -3, 3]);
8570  const FIXED_TABLE = Int32Array.from([0x020000, 0x020004, 0x020003, 0x030002, 0x020000, 0x020004, 0x020003, 0x040001, 0x020000, 0x020004, 0x020003, 0x030002, 0x020000, 0x020004, 0x020003, 0x040005]);
8571  const BLOCK_LENGTH_OFFSET = Int32Array.from([1, 5, 9, 13, 17, 25, 33, 41, 49, 65, 81, 97, 113, 145, 177, 209, 241, 305, 369, 497, 753, 1265, 2289, 4337, 8433, 16625]);
8572  const BLOCK_LENGTH_N_BITS = Int32Array.from([2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 7, 8, 9, 10, 11, 12, 13, 24]);
8573  const INSERT_LENGTH_N_BITS = Int16Array.from([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x03, 0x03, 0x04, 0x04, 0x05, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0C, 0x0E, 0x18]);
8574  const COPY_LENGTH_N_BITS = Int16Array.from([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x03, 0x03, 0x04, 0x04, 0x05, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x18]);
8575  const CMD_LOOKUP = new Int16Array(2816);
8576  unpackCommandLookupTable(CMD_LOOKUP);
8577  function log2floor(i) {
8578    let result = -1;
8579    let step = 16;
8580    let v = i;
8581    while (step > 0) {
8582      let next = v >> step;
8583      if (next !== 0) {
8584        result += step;
8585        v = next;
8586      }
8587      step = step >> 1;
8588    }
8589    return result + v;
8590  }
8591  function calculateDistanceAlphabetSize(npostfix, ndirect, maxndistbits) {
8592    return 16 + ndirect + 2 * (maxndistbits << npostfix);
8593  }
8594  function calculateDistanceAlphabetLimit(s, maxDistance, npostfix, ndirect) {
8595    if (maxDistance < ndirect + (2 << npostfix)) {
8596      return makeError(s, -23);
8597    }
8598    const offset = (maxDistance - ndirect >> npostfix) + 4;
8599    const ndistbits = log2floor(offset) - 1;
8600    const group = ndistbits - 1 << 1 | offset >> ndistbits & 1;
8601    return (group - 1 << npostfix) + (1 << npostfix) + ndirect + 16;
8602  }
8603  function unpackCommandLookupTable(cmdLookup) {
8604    const insertLengthOffsets = new Int32Array(24);
8605    const copyLengthOffsets = new Int32Array(24);
8606    copyLengthOffsets[0] = 2;
8607    for (let i = 0; i < 23; ++i) {
8608      insertLengthOffsets[i + 1] = insertLengthOffsets[i] + (1 << INSERT_LENGTH_N_BITS[i]);
8609      copyLengthOffsets[i + 1] = copyLengthOffsets[i] + (1 << COPY_LENGTH_N_BITS[i]);
8610    }
8611    for (let cmdCode = 0; cmdCode < 704; ++cmdCode) {
8612      let rangeIdx = cmdCode >> 6;
8613      let distanceContextOffset = -4;
8614      if (rangeIdx >= 2) {
8615        rangeIdx -= 2;
8616        distanceContextOffset = 0;
8617      }
8618      const insertCode = (0x29850 >> rangeIdx * 2 & 0x3) << 3 | cmdCode >> 3 & 7;
8619      const copyCode = (0x26244 >> rangeIdx * 2 & 0x3) << 3 | cmdCode & 7;
8620      const copyLengthOffset = copyLengthOffsets[copyCode];
8621      const distanceContext = distanceContextOffset + Math.min(copyLengthOffset, 5) - 2;
8622      const index = cmdCode * 4;
8623      cmdLookup[index] = INSERT_LENGTH_N_BITS[insertCode] | COPY_LENGTH_N_BITS[copyCode] << 8;
8624      cmdLookup[index + 1] = insertLengthOffsets[insertCode];
8625      cmdLookup[index + 2] = copyLengthOffsets[copyCode];
8626      cmdLookup[index + 3] = distanceContext;
8627    }
8628  }
8629  function decodeWindowBits(s) {
8630    const largeWindowEnabled = s.isLargeWindow;
8631    s.isLargeWindow = 0;
8632    if (s.bitOffset >= 16) {
8633      s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16;
8634      s.bitOffset -= 16;
8635    }
8636    if (readFewBits(s, 1) === 0) {
8637      return 16;
8638    }
8639    let n = readFewBits(s, 3);
8640    if (n !== 0) {
8641      return 17 + n;
8642    }
8643    n = readFewBits(s, 3);
8644    if (n !== 0) {
8645      if (n === 1) {
8646        if (largeWindowEnabled === 0) {
8647          return -1;
8648        }
8649        s.isLargeWindow = 1;
8650        if (readFewBits(s, 1) === 1) {
8651          return -1;
8652        }
8653        n = readFewBits(s, 6);
8654        if (n < 10 || n > 30) {
8655          return -1;
8656        }
8657        return n;
8658      }
8659      return 8 + n;
8660    }
8661    return 17;
8662  }
8663  function attachDictionaryChunk(s, data) {
8664    if (s.runningState !== 1) {
8665      return makeError(s, -24);
8666    }
8667    if (s.cdNumChunks === 0) {
8668      s.cdChunks = new Array(16);
8669      s.cdChunkOffsets = new Int32Array(16);
8670      s.cdBlockBits = -1;
8671    }
8672    if (s.cdNumChunks === 15) {
8673      return makeError(s, -27);
8674    }
8675    s.cdChunks[s.cdNumChunks] = data;
8676    s.cdNumChunks++;
8677    s.cdTotalSize += data.length;
8678    s.cdChunkOffsets[s.cdNumChunks] = s.cdTotalSize;
8679    return 0;
8680  }
8681  function initState(s) {
8682    if (s.runningState !== 0) {
8683      return makeError(s, -26);
8684    }
8685    s.blockTrees = new Int32Array(3091);
8686    s.blockTrees[0] = 7;
8687    s.distRbIdx = 3;
8688    let result = calculateDistanceAlphabetLimit(s, 0x7FFFFFFC, 3, 120);
8689    if (result < 0) {
8690      return result;
8691    }
8692    const maxDistanceAlphabetLimit = result;
8693    s.distExtraBits = new Int8Array(maxDistanceAlphabetLimit);
8694    s.distOffset = new Int32Array(maxDistanceAlphabetLimit);
8695    result = initBitReader(s);
8696    if (result < 0) {
8697      return result;
8698    }
8699    s.runningState = 1;
8700    return 0;
8701  }
8702  function close(s) {
8703    if (s.runningState === 0) {
8704      return makeError(s, -25);
8705    }
8706    if (s.runningState > 0) {
8707      s.runningState = 11;
8708    }
8709    return 0;
8710  }
8711  function decodeVarLenUnsignedByte(s) {
8712    if (s.bitOffset >= 16) {
8713      s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16;
8714      s.bitOffset -= 16;
8715    }
8716    if (readFewBits(s, 1) !== 0) {
8717      const n = readFewBits(s, 3);
8718      if (n === 0) {
8719        return 1;
8720      }
8721      return readFewBits(s, n) + (1 << n);
8722    }
8723    return 0;
8724  }
8725  function decodeMetaBlockLength(s) {
8726    if (s.bitOffset >= 16) {
8727      s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16;
8728      s.bitOffset -= 16;
8729    }
8730    s.inputEnd = readFewBits(s, 1);
8731    s.metaBlockLength = 0;
8732    s.isUncompressed = 0;
8733    s.isMetadata = 0;
8734    if (s.inputEnd !== 0 && readFewBits(s, 1) !== 0) {
8735      return 0;
8736    }
8737    const sizeNibbles = readFewBits(s, 2) + 4;
8738    if (sizeNibbles === 7) {
8739      s.isMetadata = 1;
8740      if (readFewBits(s, 1) !== 0) {
8741        return makeError(s, -6);
8742      }
8743      const sizeBytes = readFewBits(s, 2);
8744      if (sizeBytes === 0) {
8745        return 0;
8746      }
8747      for (let i = 0; i < sizeBytes; ++i) {
8748        if (s.bitOffset >= 16) {
8749          s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16;
8750          s.bitOffset -= 16;
8751        }
8752        const bits = readFewBits(s, 8);
8753        if (bits === 0 && i + 1 === sizeBytes && sizeBytes > 1) {
8754          return makeError(s, -8);
8755        }
8756        s.metaBlockLength += bits << i * 8;
8757      }
8758    } else {
8759      for (let i = 0; i < sizeNibbles; ++i) {
8760        if (s.bitOffset >= 16) {
8761          s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16;
8762          s.bitOffset -= 16;
8763        }
8764        const bits = readFewBits(s, 4);
8765        if (bits === 0 && i + 1 === sizeNibbles && sizeNibbles > 4) {
8766          return makeError(s, -8);
8767        }
8768        s.metaBlockLength += bits << i * 4;
8769      }
8770    }
8771    s.metaBlockLength++;
8772    if (s.inputEnd === 0) {
8773      s.isUncompressed = readFewBits(s, 1);
8774    }
8775    return 0;
8776  }
8777  function readSymbol(tableGroup, tableIdx, s) {
8778    let offset = tableGroup[tableIdx];
8779    const v = s.accumulator32 >>> s.bitOffset;
8780    offset += v & 0xFF;
8781    const bits = tableGroup[offset] >> 16;
8782    const sym = tableGroup[offset] & 0xFFFF;
8783    if (bits <= 8) {
8784      s.bitOffset += bits;
8785      return sym;
8786    }
8787    offset += sym;
8788    const mask = (1 << bits) - 1;
8789    offset += (v & mask) >>> 8;
8790    s.bitOffset += (tableGroup[offset] >> 16) + 8;
8791    return tableGroup[offset] & 0xFFFF;
8792  }
8793  function readBlockLength(tableGroup, tableIdx, s) {
8794    if (s.bitOffset >= 16) {
8795      s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16;
8796      s.bitOffset -= 16;
8797    }
8798    const code = readSymbol(tableGroup, tableIdx, s);
8799    const n = BLOCK_LENGTH_N_BITS[code];
8800    if (s.bitOffset >= 16) {
8801      s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16;
8802      s.bitOffset -= 16;
8803    }
8804    return BLOCK_LENGTH_OFFSET[code] + (n <= 16 ? readFewBits(s, n) : readManyBits(s, n));
8805  }
8806  function moveToFront(v, index) {
8807    let i = index;
8808    const value = v[i];
8809    while (i > 0) {
8810      v[i] = v[i - 1];
8811      i--;
8812    }
8813    v[0] = value;
8814  }
8815  function inverseMoveToFrontTransform(v, vLen) {
8816    const mtf = new Int32Array(256);
8817    for (let i = 0; i < 256; ++i) {
8818      mtf[i] = i;
8819    }
8820    for (let i = 0; i < vLen; ++i) {
8821      const index = v[i] & 0xFF;
8822      v[i] = mtf[index];
8823      if (index !== 0) {
8824        moveToFront(mtf, index);
8825      }
8826    }
8827  }
8828  function readHuffmanCodeLengths(codeLengthCodeLengths, numSymbols, codeLengths, s) {
8829    let symbol = 0;
8830    let prevCodeLen = 8;
8831    let repeat = 0;
8832    let repeatCodeLen = 0;
8833    let space = 32768;
8834    const table = new Int32Array(33);
8835    const tableIdx = table.length - 1;
8836    buildHuffmanTable(table, tableIdx, 5, codeLengthCodeLengths, 18);
8837    while (symbol < numSymbols && space > 0) {
8838      if (s.halfOffset > 2030) {
8839        const result = readMoreInput(s);
8840        if (result < 0) {
8841          return result;
8842        }
8843      }
8844      if (s.bitOffset >= 16) {
8845        s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16;
8846        s.bitOffset -= 16;
8847      }
8848      const p = s.accumulator32 >>> s.bitOffset & 31;
8849      s.bitOffset += table[p] >> 16;
8850      const codeLen = table[p] & 0xFFFF;
8851      if (codeLen < 16) {
8852        repeat = 0;
8853        codeLengths[symbol++] = codeLen;
8854        if (codeLen !== 0) {
8855          prevCodeLen = codeLen;
8856          space -= 32768 >> codeLen;
8857        }
8858      } else {
8859        const extraBits = codeLen - 14;
8860        let newLen = 0;
8861        if (codeLen === 16) {
8862          newLen = prevCodeLen;
8863        }
8864        if (repeatCodeLen !== newLen) {
8865          repeat = 0;
8866          repeatCodeLen = newLen;
8867        }
8868        const oldRepeat = repeat;
8869        if (repeat > 0) {
8870          repeat -= 2;
8871          repeat = repeat << extraBits;
8872        }
8873        if (s.bitOffset >= 16) {
8874          s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16;
8875          s.bitOffset -= 16;
8876        }
8877        repeat += readFewBits(s, extraBits) + 3;
8878        const repeatDelta = repeat - oldRepeat;
8879        if (symbol + repeatDelta > numSymbols) {
8880          return makeError(s, -2);
8881        }
8882        for (let i = 0; i < repeatDelta; ++i) {
8883          codeLengths[symbol++] = repeatCodeLen;
8884        }
8885        if (repeatCodeLen !== 0) {
8886          space -= repeatDelta << 15 - repeatCodeLen;
8887        }
8888      }
8889    }
8890    if (space !== 0) {
8891      return makeError(s, -18);
8892    }
8893    codeLengths.fill(0, symbol, numSymbols);
8894    return 0;
8895  }
8896  function checkDupes(s, symbols, length) {
8897    for (let i = 0; i < length - 1; ++i) {
8898      for (let j = i + 1; j < length; ++j) {
8899        if (symbols[i] === symbols[j]) {
8900          return makeError(s, -7);
8901        }
8902      }
8903    }
8904    return 0;
8905  }
8906  function readSimpleHuffmanCode(alphabetSizeMax, alphabetSizeLimit, tableGroup, tableIdx, s) {
8907    const codeLengths = new Int32Array(alphabetSizeLimit);
8908    const symbols = new Int32Array(4);
8909    const maxBits = 1 + log2floor(alphabetSizeMax - 1);
8910    const numSymbols = readFewBits(s, 2) + 1;
8911    for (let i = 0; i < numSymbols; ++i) {
8912      if (s.bitOffset >= 16) {
8913        s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16;
8914        s.bitOffset -= 16;
8915      }
8916      const symbol = readFewBits(s, maxBits);
8917      if (symbol >= alphabetSizeLimit) {
8918        return makeError(s, -15);
8919      }
8920      symbols[i] = symbol;
8921    }
8922    const result = checkDupes(s, symbols, numSymbols);
8923    if (result < 0) {
8924      return result;
8925    }
8926    let histogramId = numSymbols;
8927    if (numSymbols === 4) {
8928      histogramId += readFewBits(s, 1);
8929    }
8930    switch (histogramId) {
8931      case 1:
8932        codeLengths[symbols[0]] = 1;
8933        break;
8934      case 2:
8935        codeLengths[symbols[0]] = 1;
8936        codeLengths[symbols[1]] = 1;
8937        break;
8938      case 3:
8939        codeLengths[symbols[0]] = 1;
8940        codeLengths[symbols[1]] = 2;
8941        codeLengths[symbols[2]] = 2;
8942        break;
8943      case 4:
8944        codeLengths[symbols[0]] = 2;
8945        codeLengths[symbols[1]] = 2;
8946        codeLengths[symbols[2]] = 2;
8947        codeLengths[symbols[3]] = 2;
8948        break;
8949      case 5:
8950        codeLengths[symbols[0]] = 1;
8951        codeLengths[symbols[1]] = 2;
8952        codeLengths[symbols[2]] = 3;
8953        codeLengths[symbols[3]] = 3;
8954        break;
8955      default:
8956        break;
8957    }
8958    return buildHuffmanTable(tableGroup, tableIdx, 8, codeLengths, alphabetSizeLimit);
8959  }
8960  function readComplexHuffmanCode(alphabetSizeLimit, skip, tableGroup, tableIdx, s) {
8961    const codeLengths = new Int32Array(alphabetSizeLimit);
8962    const codeLengthCodeLengths = new Int32Array(18);
8963    let space = 32;
8964    let numCodes = 0;
8965    for (let i = skip; i < 18; ++i) {
8966      const codeLenIdx = CODE_LENGTH_CODE_ORDER[i];
8967      if (s.bitOffset >= 16) {
8968        s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16;
8969        s.bitOffset -= 16;
8970      }
8971      const p = s.accumulator32 >>> s.bitOffset & 15;
8972      s.bitOffset += FIXED_TABLE[p] >> 16;
8973      const v = FIXED_TABLE[p] & 0xFFFF;
8974      codeLengthCodeLengths[codeLenIdx] = v;
8975      if (v !== 0) {
8976        space -= 32 >> v;
8977        numCodes++;
8978        if (space <= 0) {
8979          break;
8980        }
8981      }
8982    }
8983    if (space !== 0 && numCodes !== 1) {
8984      return makeError(s, -4);
8985    }
8986    const result = readHuffmanCodeLengths(codeLengthCodeLengths, alphabetSizeLimit, codeLengths, s);
8987    if (result < 0) {
8988      return result;
8989    }
8990    return buildHuffmanTable(tableGroup, tableIdx, 8, codeLengths, alphabetSizeLimit);
8991  }
8992  function readHuffmanCode(alphabetSizeMax, alphabetSizeLimit, tableGroup, tableIdx, s) {
8993    if (s.halfOffset > 2030) {
8994      const result = readMoreInput(s);
8995      if (result < 0) {
8996        return result;
8997      }
8998    }
8999    if (s.bitOffset >= 16) {
9000      s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16;
9001      s.bitOffset -= 16;
9002    }
9003    const simpleCodeOrSkip = readFewBits(s, 2);
9004    if (simpleCodeOrSkip === 1) {
9005      return readSimpleHuffmanCode(alphabetSizeMax, alphabetSizeLimit, tableGroup, tableIdx, s);
9006    }
9007    return readComplexHuffmanCode(alphabetSizeLimit, simpleCodeOrSkip, tableGroup, tableIdx, s);
9008  }
9009  function decodeContextMap(contextMapSize, contextMap, s) {
9010    let result;
9011    if (s.halfOffset > 2030) {
9012      result = readMoreInput(s);
9013      if (result < 0) {
9014        return result;
9015      }
9016    }
9017    const numTrees = decodeVarLenUnsignedByte(s) + 1;
9018    if (numTrees === 1) {
9019      contextMap.fill(0, 0, contextMapSize);
9020      return numTrees;
9021    }
9022    if (s.bitOffset >= 16) {
9023      s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16;
9024      s.bitOffset -= 16;
9025    }
9026    const useRleForZeros = readFewBits(s, 1);
9027    let maxRunLengthPrefix = 0;
9028    if (useRleForZeros !== 0) {
9029      maxRunLengthPrefix = readFewBits(s, 4) + 1;
9030    }
9031    const alphabetSize = numTrees + maxRunLengthPrefix;
9032    const tableSize = MAX_HUFFMAN_TABLE_SIZE[alphabetSize + 31 >> 5];
9033    const table = new Int32Array(tableSize + 1);
9034    const tableIdx = table.length - 1;
9035    result = readHuffmanCode(alphabetSize, alphabetSize, table, tableIdx, s);
9036    if (result < 0) {
9037      return result;
9038    }
9039    let i = 0;
9040    while (i < contextMapSize) {
9041      if (s.halfOffset > 2030) {
9042        result = readMoreInput(s);
9043        if (result < 0) {
9044          return result;
9045        }
9046      }
9047      if (s.bitOffset >= 16) {
9048        s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16;
9049        s.bitOffset -= 16;
9050      }
9051      const code = readSymbol(table, tableIdx, s);
9052      if (code === 0) {
9053        contextMap[i] = 0;
9054        i++;
9055      } else if (code <= maxRunLengthPrefix) {
9056        if (s.bitOffset >= 16) {
9057          s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16;
9058          s.bitOffset -= 16;
9059        }
9060        let reps = (1 << code) + readFewBits(s, code);
9061        while (reps !== 0) {
9062          if (i >= contextMapSize) {
9063            return makeError(s, -3);
9064          }
9065          contextMap[i] = 0;
9066          i++;
9067          reps--;
9068        }
9069      } else {
9070        contextMap[i] = code - maxRunLengthPrefix;
9071        i++;
9072      }
9073    }
9074    if (s.bitOffset >= 16) {
9075      s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16;
9076      s.bitOffset -= 16;
9077    }
9078    if (readFewBits(s, 1) === 1) {
9079      inverseMoveToFrontTransform(contextMap, contextMapSize);
9080    }
9081    return numTrees;
9082  }
9083  function decodeBlockTypeAndLength(s, treeType, numBlockTypes) {
9084    const ringBuffers = s.rings;
9085    const offset = 4 + treeType * 2;
9086    if (s.bitOffset >= 16) {
9087      s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16;
9088      s.bitOffset -= 16;
9089    }
9090    let blockType = readSymbol(s.blockTrees, 2 * treeType, s);
9091    const result = readBlockLength(s.blockTrees, 2 * treeType + 1, s);
9092    if (blockType === 1) {
9093      blockType = ringBuffers[offset + 1] + 1;
9094    } else if (blockType === 0) {
9095      blockType = ringBuffers[offset];
9096    } else {
9097      blockType -= 2;
9098    }
9099    if (blockType >= numBlockTypes) {
9100      blockType -= numBlockTypes;
9101    }
9102    ringBuffers[offset] = ringBuffers[offset + 1];
9103    ringBuffers[offset + 1] = blockType;
9104    return result;
9105  }
9106  function decodeLiteralBlockSwitch(s) {
9107    s.literalBlockLength = decodeBlockTypeAndLength(s, 0, s.numLiteralBlockTypes);
9108    const literalBlockType = s.rings[5];
9109    s.contextMapSlice = literalBlockType << 6;
9110    s.literalTreeIdx = s.contextMap[s.contextMapSlice] & 0xFF;
9111    const contextMode = s.contextModes[literalBlockType];
9112    s.contextLookupOffset1 = contextMode << 9;
9113    s.contextLookupOffset2 = s.contextLookupOffset1 + 256;
9114  }
9115  function decodeCommandBlockSwitch(s) {
9116    s.commandBlockLength = decodeBlockTypeAndLength(s, 1, s.numCommandBlockTypes);
9117    s.commandTreeIdx = s.rings[7];
9118  }
9119  function decodeDistanceBlockSwitch(s) {
9120    s.distanceBlockLength = decodeBlockTypeAndLength(s, 2, s.numDistanceBlockTypes);
9121    s.distContextMapSlice = s.rings[9] << 2;
9122  }
9123  function maybeReallocateRingBuffer(s) {
9124    let newSize = s.maxRingBufferSize;
9125    if (newSize > s.expectedTotalSize) {
9126      const minimalNewSize = s.expectedTotalSize;
9127      while (newSize >> 1 > minimalNewSize) {
9128        newSize = newSize >> 1;
9129      }
9130      if (s.inputEnd === 0 && newSize < 16384 && s.maxRingBufferSize >= 16384) {
9131        newSize = 16384;
9132      }
9133    }
9134    if (newSize <= s.ringBufferSize) {
9135      return;
9136    }
9137    const ringBufferSizeWithSlack = newSize + 37;
9138    const newBuffer = new Int8Array(ringBufferSizeWithSlack);
9139    const oldBuffer = s.ringBuffer;
9140    if (oldBuffer.length !== 0) {
9141      newBuffer.set(oldBuffer.subarray(0, s.ringBufferSize), 0);
9142    }
9143    s.ringBuffer = newBuffer;
9144    s.ringBufferSize = newSize;
9145  }
9146  function readNextMetablockHeader(s) {
9147    if (s.inputEnd !== 0) {
9148      s.nextRunningState = 10;
9149      s.runningState = 12;
9150      return 0;
9151    }
9152    s.literalTreeGroup = new Int32Array(0);
9153    s.commandTreeGroup = new Int32Array(0);
9154    s.distanceTreeGroup = new Int32Array(0);
9155    let result;
9156    if (s.halfOffset > 2030) {
9157      result = readMoreInput(s);
9158      if (result < 0) {
9159        return result;
9160      }
9161    }
9162    result = decodeMetaBlockLength(s);
9163    if (result < 0) {
9164      return result;
9165    }
9166    if (s.metaBlockLength === 0 && s.isMetadata === 0) {
9167      return 0;
9168    }
9169    if (s.isUncompressed !== 0 || s.isMetadata !== 0) {
9170      result = jumpToByteBoundary(s);
9171      if (result < 0) {
9172        return result;
9173      }
9174      if (s.isMetadata === 0) {
9175        s.runningState = 6;
9176      } else {
9177        s.runningState = 5;
9178      }
9179    } else {
9180      s.runningState = 3;
9181    }
9182    if (s.isMetadata !== 0) {
9183      return 0;
9184    }
9185    s.expectedTotalSize += s.metaBlockLength;
9186    if (s.expectedTotalSize > 1 << 30) {
9187      s.expectedTotalSize = 1 << 30;
9188    }
9189    if (s.ringBufferSize < s.maxRingBufferSize) {
9190      maybeReallocateRingBuffer(s);
9191    }
9192    return 0;
9193  }
9194  function readMetablockPartition(s, treeType, numBlockTypes) {
9195    let offset = s.blockTrees[2 * treeType];
9196    if (numBlockTypes <= 1) {
9197      s.blockTrees[2 * treeType + 1] = offset;
9198      s.blockTrees[2 * treeType + 2] = offset;
9199      return 1 << 28;
9200    }
9201    const blockTypeAlphabetSize = numBlockTypes + 2;
9202    let result = readHuffmanCode(blockTypeAlphabetSize, blockTypeAlphabetSize, s.blockTrees, 2 * treeType, s);
9203    if (result < 0) {
9204      return result;
9205    }
9206    offset += result;
9207    s.blockTrees[2 * treeType + 1] = offset;
9208    const blockLengthAlphabetSize = 26;
9209    result = readHuffmanCode(blockLengthAlphabetSize, blockLengthAlphabetSize, s.blockTrees, 2 * treeType + 1, s);
9210    if (result < 0) {
9211      return result;
9212    }
9213    offset += result;
9214    s.blockTrees[2 * treeType + 2] = offset;
9215    return readBlockLength(s.blockTrees, 2 * treeType + 1, s);
9216  }
9217  function calculateDistanceLut(s, alphabetSizeLimit) {
9218    const distExtraBits = s.distExtraBits;
9219    const distOffset = s.distOffset;
9220    const npostfix = s.distancePostfixBits;
9221    const ndirect = s.numDirectDistanceCodes;
9222    const postfix = 1 << npostfix;
9223    let bits = 1;
9224    let half = 0;
9225    let i = 16;
9226    for (let j = 0; j < ndirect; ++j) {
9227      distExtraBits[i] = 0;
9228      distOffset[i] = j + 1;
9229      ++i;
9230    }
9231    while (i < alphabetSizeLimit) {
9232      const base = ndirect + ((2 + half << bits) - 4 << npostfix) + 1;
9233      for (let j = 0; j < postfix; ++j) {
9234        distExtraBits[i] = bits;
9235        distOffset[i] = base + j;
9236        ++i;
9237      }
9238      bits = bits + half;
9239      half = half ^ 1;
9240    }
9241  }
9242  function readMetablockHuffmanCodesAndContextMaps(s) {
9243    s.numLiteralBlockTypes = decodeVarLenUnsignedByte(s) + 1;
9244    let result = readMetablockPartition(s, 0, s.numLiteralBlockTypes);
9245    if (result < 0) {
9246      return result;
9247    }
9248    s.literalBlockLength = result;
9249    s.numCommandBlockTypes = decodeVarLenUnsignedByte(s) + 1;
9250    result = readMetablockPartition(s, 1, s.numCommandBlockTypes);
9251    if (result < 0) {
9252      return result;
9253    }
9254    s.commandBlockLength = result;
9255    s.numDistanceBlockTypes = decodeVarLenUnsignedByte(s) + 1;
9256    result = readMetablockPartition(s, 2, s.numDistanceBlockTypes);
9257    if (result < 0) {
9258      return result;
9259    }
9260    s.distanceBlockLength = result;
9261    if (s.halfOffset > 2030) {
9262      result = readMoreInput(s);
9263      if (result < 0) {
9264        return result;
9265      }
9266    }
9267    if (s.bitOffset >= 16) {
9268      s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16;
9269      s.bitOffset -= 16;
9270    }
9271    s.distancePostfixBits = readFewBits(s, 2);
9272    s.numDirectDistanceCodes = readFewBits(s, 4) << s.distancePostfixBits;
9273    s.contextModes = new Int8Array(s.numLiteralBlockTypes);
9274    let i = 0;
9275    while (i < s.numLiteralBlockTypes) {
9276      const limit = Math.min(i + 96, s.numLiteralBlockTypes);
9277      while (i < limit) {
9278        if (s.bitOffset >= 16) {
9279          s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16;
9280          s.bitOffset -= 16;
9281        }
9282        s.contextModes[i] = readFewBits(s, 2);
9283        i++;
9284      }
9285      if (s.halfOffset > 2030) {
9286        result = readMoreInput(s);
9287        if (result < 0) {
9288          return result;
9289        }
9290      }
9291    }
9292    const contextMapLength = s.numLiteralBlockTypes << 6;
9293    s.contextMap = new Int8Array(contextMapLength);
9294    result = decodeContextMap(contextMapLength, s.contextMap, s);
9295    if (result < 0) {
9296      return result;
9297    }
9298    const numLiteralTrees = result;
9299    s.trivialLiteralContext = 1;
9300    for (let j = 0; j < contextMapLength; ++j) {
9301      if (s.contextMap[j] !== j >> 6) {
9302        s.trivialLiteralContext = 0;
9303        break;
9304      }
9305    }
9306    s.distContextMap = new Int8Array(s.numDistanceBlockTypes << 2);
9307    result = decodeContextMap(s.numDistanceBlockTypes << 2, s.distContextMap, s);
9308    if (result < 0) {
9309      return result;
9310    }
9311    const numDistTrees = result;
9312    s.literalTreeGroup = new Int32Array(huffmanTreeGroupAllocSize(256, numLiteralTrees));
9313    result = decodeHuffmanTreeGroup(256, 256, numLiteralTrees, s, s.literalTreeGroup);
9314    if (result < 0) {
9315      return result;
9316    }
9317    s.commandTreeGroup = new Int32Array(huffmanTreeGroupAllocSize(704, s.numCommandBlockTypes));
9318    result = decodeHuffmanTreeGroup(704, 704, s.numCommandBlockTypes, s, s.commandTreeGroup);
9319    if (result < 0) {
9320      return result;
9321    }
9322    let distanceAlphabetSizeMax = calculateDistanceAlphabetSize(s.distancePostfixBits, s.numDirectDistanceCodes, 24);
9323    let distanceAlphabetSizeLimit = distanceAlphabetSizeMax;
9324    if (s.isLargeWindow === 1) {
9325      distanceAlphabetSizeMax = calculateDistanceAlphabetSize(s.distancePostfixBits, s.numDirectDistanceCodes, 62);
9326      result = calculateDistanceAlphabetLimit(s, 0x7FFFFFFC, s.distancePostfixBits, s.numDirectDistanceCodes);
9327      if (result < 0) {
9328        return result;
9329      }
9330      distanceAlphabetSizeLimit = result;
9331    }
9332    s.distanceTreeGroup = new Int32Array(huffmanTreeGroupAllocSize(distanceAlphabetSizeLimit, numDistTrees));
9333    result = decodeHuffmanTreeGroup(distanceAlphabetSizeMax, distanceAlphabetSizeLimit, numDistTrees, s, s.distanceTreeGroup);
9334    if (result < 0) {
9335      return result;
9336    }
9337    calculateDistanceLut(s, distanceAlphabetSizeLimit);
9338    s.contextMapSlice = 0;
9339    s.distContextMapSlice = 0;
9340    s.contextLookupOffset1 = s.contextModes[0] * 512;
9341    s.contextLookupOffset2 = s.contextLookupOffset1 + 256;
9342    s.literalTreeIdx = 0;
9343    s.commandTreeIdx = 0;
9344    s.rings[4] = 1;
9345    s.rings[5] = 0;
9346    s.rings[6] = 1;
9347    s.rings[7] = 0;
9348    s.rings[8] = 1;
9349    s.rings[9] = 0;
9350    return 0;
9351  }
9352  function copyUncompressedData(s) {
9353    const ringBuffer = s.ringBuffer;
9354    let result;
9355    if (s.metaBlockLength <= 0) {
9356      result = reload(s);
9357      if (result < 0) {
9358        return result;
9359      }
9360      s.runningState = 2;
9361      return 0;
9362    }
9363    const chunkLength = Math.min(s.ringBufferSize - s.pos, s.metaBlockLength);
9364    result = copyRawBytes(s, ringBuffer, s.pos, chunkLength);
9365    if (result < 0) {
9366      return result;
9367    }
9368    s.metaBlockLength -= chunkLength;
9369    s.pos += chunkLength;
9370    if (s.pos === s.ringBufferSize) {
9371      s.nextRunningState = 6;
9372      s.runningState = 12;
9373      return 0;
9374    }
9375    result = reload(s);
9376    if (result < 0) {
9377      return result;
9378    }
9379    s.runningState = 2;
9380    return 0;
9381  }
9382  function writeRingBuffer(s) {
9383    const toWrite = Math.min(s.outputLength - s.outputUsed, s.ringBufferBytesReady - s.ringBufferBytesWritten);
9384    if (toWrite !== 0) {
9385      s.output.set(s.ringBuffer.subarray(s.ringBufferBytesWritten, s.ringBufferBytesWritten + toWrite), s.outputOffset + s.outputUsed);
9386      s.outputUsed += toWrite;
9387      s.ringBufferBytesWritten += toWrite;
9388    }
9389    if (s.outputUsed < s.outputLength) {
9390      return 0;
9391    }
9392    return 2;
9393  }
9394  function huffmanTreeGroupAllocSize(alphabetSizeLimit, n) {
9395    const maxTableSize = MAX_HUFFMAN_TABLE_SIZE[alphabetSizeLimit + 31 >> 5];
9396    return n + n * maxTableSize;
9397  }
9398  function decodeHuffmanTreeGroup(alphabetSizeMax, alphabetSizeLimit, n, s, group) {
9399    let next = n;
9400    for (let i = 0; i < n; ++i) {
9401      group[i] = next;
9402      const result = readHuffmanCode(alphabetSizeMax, alphabetSizeLimit, group, i, s);
9403      if (result < 0) {
9404        return result;
9405      }
9406      next += result;
9407    }
9408    return 0;
9409  }
9410  function calculateFence(s) {
9411    let result = s.ringBufferSize;
9412    if (s.isEager !== 0) {
9413      result = Math.min(result, s.ringBufferBytesWritten + s.outputLength - s.outputUsed);
9414    }
9415    return result;
9416  }
9417  function doUseDictionary(s, fence) {
9418    if (s.distance > 0x7FFFFFFC) {
9419      return makeError(s, -9);
9420    }
9421    const address = s.distance - s.maxDistance - 1 - s.cdTotalSize;
9422    if (address < 0) {
9423      const result = initializeCompoundDictionaryCopy(s, -address - 1, s.copyLength);
9424      if (result < 0) {
9425        return result;
9426      }
9427      s.runningState = 14;
9428    } else {
9429      const dictionaryData = data;
9430      const wordLength = s.copyLength;
9431      if (wordLength > 31) {
9432        return makeError(s, -9);
9433      }
9434      const shift = sizeBits[wordLength];
9435      if (shift === 0) {
9436        return makeError(s, -9);
9437      }
9438      let offset = offsets[wordLength];
9439      const mask = (1 << shift) - 1;
9440      const wordIdx = address & mask;
9441      const transformIdx = address >> shift;
9442      offset += wordIdx * wordLength;
9443      const transforms = RFC_TRANSFORMS;
9444      if (transformIdx >= transforms.numTransforms) {
9445        return makeError(s, -9);
9446      }
9447      const len = transformDictionaryWord(s.ringBuffer, s.pos, dictionaryData, offset, wordLength, transforms, transformIdx);
9448      s.pos += len;
9449      s.metaBlockLength -= len;
9450      if (s.pos >= fence) {
9451        s.nextRunningState = 4;
9452        s.runningState = 12;
9453        return 0;
9454      }
9455      s.runningState = 4;
9456    }
9457    return 0;
9458  }
9459  function initializeCompoundDictionary(s) {
9460    s.cdBlockMap = new Int8Array(256);
9461    let blockBits = 8;
9462    while (s.cdTotalSize - 1 >> blockBits !== 0) {
9463      blockBits++;
9464    }
9465    blockBits -= 8;
9466    s.cdBlockBits = blockBits;
9467    let cursor = 0;
9468    let index = 0;
9469    while (cursor < s.cdTotalSize) {
9470      while (s.cdChunkOffsets[index + 1] < cursor) {
9471        index++;
9472      }
9473      s.cdBlockMap[cursor >> blockBits] = index;
9474      cursor += 1 << blockBits;
9475    }
9476  }
9477  function initializeCompoundDictionaryCopy(s, address, length) {
9478    if (s.cdBlockBits === -1) {
9479      initializeCompoundDictionary(s);
9480    }
9481    let index = s.cdBlockMap[address >> s.cdBlockBits];
9482    while (address >= s.cdChunkOffsets[index + 1]) {
9483      index++;
9484    }
9485    if (s.cdTotalSize > address + length) {
9486      return makeError(s, -9);
9487    }
9488    s.distRbIdx = s.distRbIdx + 1 & 0x3;
9489    s.rings[s.distRbIdx] = s.distance;
9490    s.metaBlockLength -= length;
9491    s.cdBrIndex = index;
9492    s.cdBrOffset = address - s.cdChunkOffsets[index];
9493    s.cdBrLength = length;
9494    s.cdBrCopied = 0;
9495    return 0;
9496  }
9497  function copyFromCompoundDictionary(s, fence) {
9498    let pos = s.pos;
9499    const origPos = pos;
9500    while (s.cdBrLength !== s.cdBrCopied) {
9501      const space = fence - pos;
9502      const chunkLength = s.cdChunkOffsets[s.cdBrIndex + 1] - s.cdChunkOffsets[s.cdBrIndex];
9503      const remChunkLength = chunkLength - s.cdBrOffset;
9504      let length = s.cdBrLength - s.cdBrCopied;
9505      if (length > remChunkLength) {
9506        length = remChunkLength;
9507      }
9508      if (length > space) {
9509        length = space;
9510      }
9511      s.ringBuffer.set(s.cdChunks[s.cdBrIndex].subarray(s.cdBrOffset, s.cdBrOffset + length), pos);
9512      pos += length;
9513      s.cdBrOffset += length;
9514      s.cdBrCopied += length;
9515      if (length === remChunkLength) {
9516        s.cdBrIndex++;
9517        s.cdBrOffset = 0;
9518      }
9519      if (pos >= fence) {
9520        break;
9521      }
9522    }
9523    return pos - origPos;
9524  }
9525  function decompress(s) {
9526    let result;
9527    if (s.runningState === 0) {
9528      return makeError(s, -25);
9529    }
9530    if (s.runningState < 0) {
9531      return makeError(s, -28);
9532    }
9533    if (s.runningState === 11) {
9534      return makeError(s, -22);
9535    }
9536    if (s.runningState === 1) {
9537      const windowBits = decodeWindowBits(s);
9538      if (windowBits === -1) {
9539        return makeError(s, -11);
9540      }
9541      s.maxRingBufferSize = 1 << windowBits;
9542      s.maxBackwardDistance = s.maxRingBufferSize - 16;
9543      s.runningState = 2;
9544    }
9545    let fence = calculateFence(s);
9546    let ringBufferMask = s.ringBufferSize - 1;
9547    let ringBuffer = s.ringBuffer;
9548    while (s.runningState !== 10) {
9549      switch (s.runningState) {
9550        case 2:
9551          if (s.metaBlockLength < 0) {
9552            return makeError(s, -10);
9553          }
9554          result = readNextMetablockHeader(s);
9555          if (result < 0) {
9556            return result;
9557          }
9558          fence = calculateFence(s);
9559          ringBufferMask = s.ringBufferSize - 1;
9560          ringBuffer = s.ringBuffer;
9561          continue;
9562        case 3:
9563          result = readMetablockHuffmanCodesAndContextMaps(s);
9564          if (result < 0) {
9565            return result;
9566          }
9567          s.runningState = 4;
9568          continue;
9569        case 4:
9570          if (s.metaBlockLength <= 0) {
9571            s.runningState = 2;
9572            continue;
9573          }
9574          if (s.halfOffset > 2030) {
9575            result = readMoreInput(s);
9576            if (result < 0) {
9577              return result;
9578            }
9579          }
9580          if (s.commandBlockLength === 0) {
9581            decodeCommandBlockSwitch(s);
9582          }
9583          s.commandBlockLength--;
9584          if (s.bitOffset >= 16) {
9585            s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16;
9586            s.bitOffset -= 16;
9587          }
9588          const cmdCode = readSymbol(s.commandTreeGroup, s.commandTreeIdx, s) << 2;
9589          const insertAndCopyExtraBits = CMD_LOOKUP[cmdCode];
9590          const insertLengthOffset = CMD_LOOKUP[cmdCode + 1];
9591          const copyLengthOffset = CMD_LOOKUP[cmdCode + 2];
9592          s.distanceCode = CMD_LOOKUP[cmdCode + 3];
9593          if (s.bitOffset >= 16) {
9594            s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16;
9595            s.bitOffset -= 16;
9596          }
9597          const insertLengthExtraBits = insertAndCopyExtraBits & 0xFF;
9598          s.insertLength = insertLengthOffset + (insertLengthExtraBits <= 16 ? readFewBits(s, insertLengthExtraBits) : readManyBits(s, insertLengthExtraBits));
9599          if (s.bitOffset >= 16) {
9600            s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16;
9601            s.bitOffset -= 16;
9602          }
9603          const copyLengthExtraBits = insertAndCopyExtraBits >> 8;
9604          s.copyLength = copyLengthOffset + (copyLengthExtraBits <= 16 ? readFewBits(s, copyLengthExtraBits) : readManyBits(s, copyLengthExtraBits));
9605          s.j = 0;
9606          s.runningState = 7;
9607          continue;
9608        case 7:
9609          if (s.trivialLiteralContext !== 0) {
9610            while (s.j < s.insertLength) {
9611              if (s.halfOffset > 2030) {
9612                result = readMoreInput(s);
9613                if (result < 0) {
9614                  return result;
9615                }
9616              }
9617              if (s.literalBlockLength === 0) {
9618                decodeLiteralBlockSwitch(s);
9619              }
9620              s.literalBlockLength--;
9621              if (s.bitOffset >= 16) {
9622                s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16;
9623                s.bitOffset -= 16;
9624              }
9625              ringBuffer[s.pos] = readSymbol(s.literalTreeGroup, s.literalTreeIdx, s);
9626              s.pos++;
9627              s.j++;
9628              if (s.pos >= fence) {
9629                s.nextRunningState = 7;
9630                s.runningState = 12;
9631                break;
9632              }
9633            }
9634          } else {
9635            let prevByte1 = ringBuffer[s.pos - 1 & ringBufferMask] & 0xFF;
9636            let prevByte2 = ringBuffer[s.pos - 2 & ringBufferMask] & 0xFF;
9637            while (s.j < s.insertLength) {
9638              if (s.halfOffset > 2030) {
9639                result = readMoreInput(s);
9640                if (result < 0) {
9641                  return result;
9642                }
9643              }
9644              if (s.literalBlockLength === 0) {
9645                decodeLiteralBlockSwitch(s);
9646              }
9647              const literalContext = LOOKUP[s.contextLookupOffset1 + prevByte1] | LOOKUP[s.contextLookupOffset2 + prevByte2];
9648              const literalTreeIdx = s.contextMap[s.contextMapSlice + literalContext] & 0xFF;
9649              s.literalBlockLength--;
9650              prevByte2 = prevByte1;
9651              if (s.bitOffset >= 16) {
9652                s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16;
9653                s.bitOffset -= 16;
9654              }
9655              prevByte1 = readSymbol(s.literalTreeGroup, literalTreeIdx, s);
9656              ringBuffer[s.pos] = prevByte1;
9657              s.pos++;
9658              s.j++;
9659              if (s.pos >= fence) {
9660                s.nextRunningState = 7;
9661                s.runningState = 12;
9662                break;
9663              }
9664            }
9665          }
9666          if (s.runningState !== 7) {
9667            continue;
9668          }
9669          s.metaBlockLength -= s.insertLength;
9670          if (s.metaBlockLength <= 0) {
9671            s.runningState = 4;
9672            continue;
9673          }
9674          let distanceCode = s.distanceCode;
9675          if (distanceCode < 0) {
9676            s.distance = s.rings[s.distRbIdx];
9677          } else {
9678            if (s.halfOffset > 2030) {
9679              result = readMoreInput(s);
9680              if (result < 0) {
9681                return result;
9682              }
9683            }
9684            if (s.distanceBlockLength === 0) {
9685              decodeDistanceBlockSwitch(s);
9686            }
9687            s.distanceBlockLength--;
9688            if (s.bitOffset >= 16) {
9689              s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16;
9690              s.bitOffset -= 16;
9691            }
9692            const distTreeIdx = s.distContextMap[s.distContextMapSlice + distanceCode] & 0xFF;
9693            distanceCode = readSymbol(s.distanceTreeGroup, distTreeIdx, s);
9694            if (distanceCode < 16) {
9695              const index = s.distRbIdx + DISTANCE_SHORT_CODE_INDEX_OFFSET[distanceCode] & 0x3;
9696              s.distance = s.rings[index] + DISTANCE_SHORT_CODE_VALUE_OFFSET[distanceCode];
9697              if (s.distance < 0) {
9698                return makeError(s, -12);
9699              }
9700            } else {
9701              const extraBits = s.distExtraBits[distanceCode];
9702              let bits;
9703              if (s.bitOffset + extraBits <= 32) {
9704                bits = readFewBits(s, extraBits);
9705              } else {
9706                if (s.bitOffset >= 16) {
9707                  s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16;
9708                  s.bitOffset -= 16;
9709                }
9710                bits = extraBits <= 16 ? readFewBits(s, extraBits) : readManyBits(s, extraBits);
9711              }
9712              s.distance = s.distOffset[distanceCode] + (bits << s.distancePostfixBits);
9713            }
9714          }
9715          if (s.maxDistance !== s.maxBackwardDistance && s.pos < s.maxBackwardDistance) {
9716            s.maxDistance = s.pos;
9717          } else {
9718            s.maxDistance = s.maxBackwardDistance;
9719          }
9720          if (s.distance > s.maxDistance) {
9721            s.runningState = 9;
9722            continue;
9723          }
9724          if (distanceCode > 0) {
9725            s.distRbIdx = s.distRbIdx + 1 & 0x3;
9726            s.rings[s.distRbIdx] = s.distance;
9727          }
9728          if (s.copyLength > s.metaBlockLength) {
9729            return makeError(s, -9);
9730          }
9731          s.j = 0;
9732          s.runningState = 8;
9733          continue;
9734        case 8:
9735          let src = s.pos - s.distance & ringBufferMask;
9736          let dst = s.pos;
9737          const copyLength = s.copyLength - s.j;
9738          const srcEnd = src + copyLength;
9739          const dstEnd = dst + copyLength;
9740          if (srcEnd < ringBufferMask && dstEnd < ringBufferMask) {
9741            if (copyLength < 12 || srcEnd > dst && dstEnd > src) {
9742              const numQuads = copyLength + 3 >> 2;
9743              for (let k = 0; k < numQuads; ++k) {
9744                ringBuffer[dst++] = ringBuffer[src++];
9745                ringBuffer[dst++] = ringBuffer[src++];
9746                ringBuffer[dst++] = ringBuffer[src++];
9747                ringBuffer[dst++] = ringBuffer[src++];
9748              }
9749            } else {
9750              ringBuffer.copyWithin(dst, src, srcEnd);
9751            }
9752            s.j += copyLength;
9753            s.metaBlockLength -= copyLength;
9754            s.pos += copyLength;
9755          } else {
9756            while (s.j < s.copyLength) {
9757              ringBuffer[s.pos] = ringBuffer[s.pos - s.distance & ringBufferMask];
9758              s.metaBlockLength--;
9759              s.pos++;
9760              s.j++;
9761              if (s.pos >= fence) {
9762                s.nextRunningState = 8;
9763                s.runningState = 12;
9764                break;
9765              }
9766            }
9767          }
9768          if (s.runningState === 8) {
9769            s.runningState = 4;
9770          }
9771          continue;
9772        case 9:
9773          result = doUseDictionary(s, fence);
9774          if (result < 0) {
9775            return result;
9776          }
9777          continue;
9778        case 14:
9779          s.pos += copyFromCompoundDictionary(s, fence);
9780          if (s.pos >= fence) {
9781            s.nextRunningState = 14;
9782            s.runningState = 12;
9783            return 2;
9784          }
9785          s.runningState = 4;
9786          continue;
9787        case 5:
9788          while (s.metaBlockLength > 0) {
9789            if (s.halfOffset > 2030) {
9790              result = readMoreInput(s);
9791              if (result < 0) {
9792                return result;
9793              }
9794            }
9795            if (s.bitOffset >= 16) {
9796              s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16;
9797              s.bitOffset -= 16;
9798            }
9799            readFewBits(s, 8);
9800            s.metaBlockLength--;
9801          }
9802          s.runningState = 2;
9803          continue;
9804        case 6:
9805          result = copyUncompressedData(s);
9806          if (result < 0) {
9807            return result;
9808          }
9809          continue;
9810        case 12:
9811          s.ringBufferBytesReady = Math.min(s.pos, s.ringBufferSize);
9812          s.runningState = 13;
9813          continue;
9814        case 13:
9815          result = writeRingBuffer(s);
9816          if (result !== 0) {
9817            return result;
9818          }
9819          if (s.pos >= s.maxBackwardDistance) {
9820            s.maxDistance = s.maxBackwardDistance;
9821          }
9822          if (s.pos >= s.ringBufferSize) {
9823            if (s.pos > s.ringBufferSize) {
9824              ringBuffer.copyWithin(0, s.ringBufferSize, s.pos);
9825            }
9826            s.pos = s.pos & ringBufferMask;
9827            s.ringBufferBytesWritten = 0;
9828          }
9829          s.runningState = s.nextRunningState;
9830          continue;
9831        default:
9832          return makeError(s, -28);
9833      }
9834    }
9835    if (s.runningState !== 10) {
9836      return makeError(s, -29);
9837    }
9838    if (s.metaBlockLength < 0) {
9839      return makeError(s, -10);
9840    }
9841    result = jumpToByteBoundary(s);
9842    if (result !== 0) {
9843      return result;
9844    }
9845    result = checkHealth(s, 1);
9846    if (result !== 0) {
9847      return result;
9848    }
9849    return 1;
9850  }
9851  function Transforms(numTransforms, prefixSuffixLen, prefixSuffixCount) {
9852    this.numTransforms = 0;
9853    this.triplets = new Int32Array(0);
9854    this.prefixSuffixStorage = new Int8Array(0);
9855    this.prefixSuffixHeads = new Int32Array(0);
9856    this.params = new Int16Array(0);
9857    this.numTransforms = numTransforms;
9858    this.triplets = new Int32Array(numTransforms * 3);
9859    this.params = new Int16Array(numTransforms);
9860    this.prefixSuffixStorage = new Int8Array(prefixSuffixLen);
9861    this.prefixSuffixHeads = new Int32Array(prefixSuffixCount + 1);
9862  }
9863  const RFC_TRANSFORMS = new Transforms(121, 167, 50);
9864  function unpackTransforms(prefixSuffix, prefixSuffixHeads, transforms, prefixSuffixSrc, transformsSrc) {
9865    const prefixSuffixBytes = toUtf8Runes(prefixSuffixSrc);
9866    const n = prefixSuffixBytes.length;
9867    let index = 1;
9868    let j = 0;
9869    for (let i = 0; i < n; ++i) {
9870      const c = prefixSuffixBytes[i];
9871      if (c === 35) {
9872        prefixSuffixHeads[index++] = j;
9873      } else {
9874        prefixSuffix[j++] = c;
9875      }
9876    }
9877    for (let i = 0; i < 363; ++i) {
9878      transforms[i] = transformsSrc.charCodeAt(i) - 32;
9879    }
9880  }
9881  unpackTransforms(RFC_TRANSFORMS.prefixSuffixStorage, RFC_TRANSFORMS.prefixSuffixHeads, RFC_TRANSFORMS.triplets, "# #s #, #e #.# the #.com/#\xC2\xA0# of # and # in # to #\"#\">#\n#]# for # a # that #. # with #'# from # by #. The # on # as # is #ing #\n\t#:#ed #(# at #ly #=\"# of the #. This #,# not #er #al #='#ful #ive #less #est #ize #ous #", "     !! ! ,  *!  &!  \" !  ) *   * -  ! # !  #!*!  +  ,$ !  -  %  .  / #   0  1 .  \"   2  3!*   4%  ! # /   5  6  7  8 0  1 &   $   9 +   :  ;  < '  !=  >  ?! 4  @ 4  2  &   A *# (   B  C& ) %  ) !*# *-% A +! *.  D! %'  & E *6  F  G% ! *A *%  H! D  I!+!  J!+   K +- *4! A  L!*4  M  N +6  O!*% +.! K *G  P +%(  ! G *D +D  Q +# *K!*G!+D!+# +G +A +4!+% +K!+4!*D!+K!*K");
9882  function transformDictionaryWord(dst, dstOffset, src, srcOffset, wordLen, transforms, transformIndex) {
9883    let offset = dstOffset;
9884    const triplets = transforms.triplets;
9885    const prefixSuffixStorage = transforms.prefixSuffixStorage;
9886    const prefixSuffixHeads = transforms.prefixSuffixHeads;
9887    const transformOffset = 3 * transformIndex;
9888    const prefixIdx = triplets[transformOffset];
9889    const transformType = triplets[transformOffset + 1];
9890    const suffixIdx = triplets[transformOffset + 2];
9891    let prefix = prefixSuffixHeads[prefixIdx];
9892    const prefixEnd = prefixSuffixHeads[prefixIdx + 1];
9893    let suffix = prefixSuffixHeads[suffixIdx];
9894    const suffixEnd = prefixSuffixHeads[suffixIdx + 1];
9895    let omitFirst = transformType - 11;
9896    let omitLast = transformType;
9897    if (omitFirst < 1 || omitFirst > 9) {
9898      omitFirst = 0;
9899    }
9900    if (omitLast < 1 || omitLast > 9) {
9901      omitLast = 0;
9902    }
9903    while (prefix !== prefixEnd) {
9904      dst[offset++] = prefixSuffixStorage[prefix++];
9905    }
9906    let len = wordLen;
9907    if (omitFirst > len) {
9908      omitFirst = len;
9909    }
9910    let dictOffset = srcOffset + omitFirst;
9911    len -= omitFirst;
9912    len -= omitLast;
9913    let i = len;
9914    while (i > 0) {
9915      dst[offset++] = src[dictOffset++];
9916      i--;
9917    }
9918    if (transformType === 10 || transformType === 11) {
9919      let uppercaseOffset = offset - len;
9920      if (transformType === 10) {
9921        len = 1;
9922      }
9923      while (len > 0) {
9924        const c0 = dst[uppercaseOffset] & 0xFF;
9925        if (c0 < 0xC0) {
9926          if (c0 >= 97 && c0 <= 122) {
9927            dst[uppercaseOffset] = dst[uppercaseOffset] ^ 32;
9928          }
9929          uppercaseOffset += 1;
9930          len -= 1;
9931        } else if (c0 < 0xE0) {
9932          dst[uppercaseOffset + 1] = dst[uppercaseOffset + 1] ^ 32;
9933          uppercaseOffset += 2;
9934          len -= 2;
9935        } else {
9936          dst[uppercaseOffset + 2] = dst[uppercaseOffset + 2] ^ 5;
9937          uppercaseOffset += 3;
9938          len -= 3;
9939        }
9940      }
9941    } else if (transformType === 21 || transformType === 22) {
9942      let shiftOffset = offset - len;
9943      const param = transforms.params[transformIndex];
9944      let scalar = (param & 0x7FFF) + (0x1000000 - (param & 0x8000));
9945      while (len > 0) {
9946        let step = 1;
9947        const c0 = dst[shiftOffset] & 0xFF;
9948        if (c0 < 0x80) {
9949          scalar += c0;
9950          dst[shiftOffset] = scalar & 0x7F;
9951        } else if (c0 < 0xC0) {} else if (c0 < 0xE0) {
9952          if (len >= 2) {
9953            const c1 = dst[shiftOffset + 1];
9954            scalar += c1 & 0x3F | (c0 & 0x1F) << 6;
9955            dst[shiftOffset] = 0xC0 | scalar >> 6 & 0x1F;
9956            dst[shiftOffset + 1] = c1 & 0xC0 | scalar & 0x3F;
9957            step = 2;
9958          } else {
9959            step = len;
9960          }
9961        } else if (c0 < 0xF0) {
9962          if (len >= 3) {
9963            const c1 = dst[shiftOffset + 1];
9964            const c2 = dst[shiftOffset + 2];
9965            scalar += c2 & 0x3F | (c1 & 0x3F) << 6 | (c0 & 0x0F) << 12;
9966            dst[shiftOffset] = 0xE0 | scalar >> 12 & 0x0F;
9967            dst[shiftOffset + 1] = c1 & 0xC0 | scalar >> 6 & 0x3F;
9968            dst[shiftOffset + 2] = c2 & 0xC0 | scalar & 0x3F;
9969            step = 3;
9970          } else {
9971            step = len;
9972          }
9973        } else if (c0 < 0xF8) {
9974          if (len >= 4) {
9975            const c1 = dst[shiftOffset + 1];
9976            const c2 = dst[shiftOffset + 2];
9977            const c3 = dst[shiftOffset + 3];
9978            scalar += c3 & 0x3F | (c2 & 0x3F) << 6 | (c1 & 0x3F) << 12 | (c0 & 0x07) << 18;
9979            dst[shiftOffset] = 0xF0 | scalar >> 18 & 0x07;
9980            dst[shiftOffset + 1] = c1 & 0xC0 | scalar >> 12 & 0x3F;
9981            dst[shiftOffset + 2] = c2 & 0xC0 | scalar >> 6 & 0x3F;
9982            dst[shiftOffset + 3] = c3 & 0xC0 | scalar & 0x3F;
9983            step = 4;
9984          } else {
9985            step = len;
9986          }
9987        }
9988        shiftOffset += step;
9989        len -= step;
9990        if (transformType === 21) {
9991          len = 0;
9992        }
9993      }
9994    }
9995    while (suffix !== suffixEnd) {
9996      dst[offset++] = prefixSuffixStorage[suffix++];
9997    }
9998    return offset - dstOffset;
9999  }
10000  function getNextKey(key, len) {
10001    let step = 1 << len - 1;
10002    while ((key & step) !== 0) {
10003      step = step >> 1;
10004    }
10005    return (key & step - 1) + step;
10006  }
10007  function replicateValue(table, offset, step, end, item) {
10008    let pos = end;
10009    while (pos > 0) {
10010      pos -= step;
10011      table[offset + pos] = item;
10012    }
10013  }
10014  function nextTableBitSize(count, len, rootBits) {
10015    let bits = len;
10016    let left = 1 << bits - rootBits;
10017    while (bits < 15) {
10018      left -= count[bits];
10019      if (left <= 0) {
10020        break;
10021      }
10022      bits++;
10023      left = left << 1;
10024    }
10025    return bits - rootBits;
10026  }
10027  function buildHuffmanTable(tableGroup, tableIdx, rootBits, codeLengths, codeLengthsSize) {
10028    const tableOffset = tableGroup[tableIdx];
10029    const sorted = new Int32Array(codeLengthsSize);
10030    const count = new Int32Array(16);
10031    const offset = new Int32Array(16);
10032    for (let sym = 0; sym < codeLengthsSize; ++sym) {
10033      count[codeLengths[sym]]++;
10034    }
10035    offset[1] = 0;
10036    for (let len = 1; len < 15; ++len) {
10037      offset[len + 1] = offset[len] + count[len];
10038    }
10039    for (let sym = 0; sym < codeLengthsSize; ++sym) {
10040      if (codeLengths[sym] !== 0) {
10041        sorted[offset[codeLengths[sym]]++] = sym;
10042      }
10043    }
10044    let tableBits = rootBits;
10045    let tableSize = 1 << tableBits;
10046    let totalSize = tableSize;
10047    if (offset[15] === 1) {
10048      for (let k = 0; k < totalSize; ++k) {
10049        tableGroup[tableOffset + k] = sorted[0];
10050      }
10051      return totalSize;
10052    }
10053    let key = 0;
10054    let symbol = 0;
10055    let step = 1;
10056    for (let len = 1; len <= rootBits; ++len) {
10057      step = step << 1;
10058      while (count[len] > 0) {
10059        replicateValue(tableGroup, tableOffset + key, step, tableSize, len << 16 | sorted[symbol++]);
10060        key = getNextKey(key, len);
10061        count[len]--;
10062      }
10063    }
10064    const mask = totalSize - 1;
10065    let low = -1;
10066    let currentOffset = tableOffset;
10067    step = 1;
10068    for (let len = rootBits + 1; len <= 15; ++len) {
10069      step = step << 1;
10070      while (count[len] > 0) {
10071        if ((key & mask) !== low) {
10072          currentOffset += tableSize;
10073          tableBits = nextTableBitSize(count, len, rootBits);
10074          tableSize = 1 << tableBits;
10075          totalSize += tableSize;
10076          low = key & mask;
10077          tableGroup[tableOffset + low] = tableBits + rootBits << 16 | currentOffset - tableOffset - low;
10078        }
10079        replicateValue(tableGroup, currentOffset + (key >> rootBits), step, tableSize, len - rootBits << 16 | sorted[symbol++]);
10080        key = getNextKey(key, len);
10081        count[len]--;
10082      }
10083    }
10084    return totalSize;
10085  }
10086  function readMoreInput(s) {
10087    if (s.endOfStreamReached !== 0) {
10088      if (halfAvailable(s) >= -2) {
10089        return 0;
10090      }
10091      return makeError(s, -16);
10092    }
10093    const readOffset = s.halfOffset << 1;
10094    let bytesInBuffer = 4096 - readOffset;
10095    s.byteBuffer.copyWithin(0, readOffset, 4096);
10096    s.halfOffset = 0;
10097    while (bytesInBuffer < 4096) {
10098      const spaceLeft = 4096 - bytesInBuffer;
10099      const len = readInput(s, s.byteBuffer, bytesInBuffer, spaceLeft);
10100      if (len < -1) {
10101        return len;
10102      }
10103      if (len <= 0) {
10104        s.endOfStreamReached = 1;
10105        s.tailBytes = bytesInBuffer;
10106        bytesInBuffer += 1;
10107        break;
10108      }
10109      bytesInBuffer += len;
10110    }
10111    bytesToNibbles(s, bytesInBuffer);
10112    return 0;
10113  }
10114  function checkHealth(s, endOfStream) {
10115    if (s.endOfStreamReached === 0) {
10116      return 0;
10117    }
10118    const byteOffset = (s.halfOffset << 1) + (s.bitOffset + 7 >> 3) - 4;
10119    if (byteOffset > s.tailBytes) {
10120      return makeError(s, -13);
10121    }
10122    if (endOfStream !== 0 && byteOffset !== s.tailBytes) {
10123      return makeError(s, -17);
10124    }
10125    return 0;
10126  }
10127  function readFewBits(s, n) {
10128    const v = s.accumulator32 >>> s.bitOffset & (1 << n) - 1;
10129    s.bitOffset += n;
10130    return v;
10131  }
10132  function readManyBits(s, n) {
10133    const low = readFewBits(s, 16);
10134    s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16;
10135    s.bitOffset -= 16;
10136    return low | readFewBits(s, n - 16) << 16;
10137  }
10138  function initBitReader(s) {
10139    s.byteBuffer = new Int8Array(4160);
10140    s.accumulator32 = 0;
10141    s.shortBuffer = new Int16Array(2080);
10142    s.bitOffset = 32;
10143    s.halfOffset = 2048;
10144    s.endOfStreamReached = 0;
10145    return prepare(s);
10146  }
10147  function prepare(s) {
10148    if (s.halfOffset > 2030) {
10149      const result = readMoreInput(s);
10150      if (result !== 0) {
10151        return result;
10152      }
10153    }
10154    let health = checkHealth(s, 0);
10155    if (health !== 0) {
10156      return health;
10157    }
10158    s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16;
10159    s.bitOffset -= 16;
10160    s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16;
10161    s.bitOffset -= 16;
10162    return 0;
10163  }
10164  function reload(s) {
10165    if (s.bitOffset === 32) {
10166      return prepare(s);
10167    }
10168    return 0;
10169  }
10170  function jumpToByteBoundary(s) {
10171    const padding = 32 - s.bitOffset & 7;
10172    if (padding !== 0) {
10173      const paddingBits = readFewBits(s, padding);
10174      if (paddingBits !== 0) {
10175        return makeError(s, -5);
10176      }
10177    }
10178    return 0;
10179  }
10180  function halfAvailable(s) {
10181    let limit = 2048;
10182    if (s.endOfStreamReached !== 0) {
10183      limit = s.tailBytes + 1 >> 1;
10184    }
10185    return limit - s.halfOffset;
10186  }
10187  function copyRawBytes(s, data, offset, length) {
10188    let pos = offset;
10189    let len = length;
10190    if ((s.bitOffset & 7) !== 0) {
10191      return makeError(s, -30);
10192    }
10193    while (s.bitOffset !== 32 && len !== 0) {
10194      data[pos++] = s.accumulator32 >>> s.bitOffset;
10195      s.bitOffset += 8;
10196      len--;
10197    }
10198    if (len === 0) {
10199      return 0;
10200    }
10201    const copyNibbles = Math.min(halfAvailable(s), len >> 1);
10202    if (copyNibbles > 0) {
10203      const readOffset = s.halfOffset << 1;
10204      const delta = copyNibbles << 1;
10205      data.set(s.byteBuffer.subarray(readOffset, readOffset + delta), pos);
10206      pos += delta;
10207      len -= delta;
10208      s.halfOffset += copyNibbles;
10209    }
10210    if (len === 0) {
10211      return 0;
10212    }
10213    if (halfAvailable(s) > 0) {
10214      if (s.bitOffset >= 16) {
10215        s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16;
10216        s.bitOffset -= 16;
10217      }
10218      while (len !== 0) {
10219        data[pos++] = s.accumulator32 >>> s.bitOffset;
10220        s.bitOffset += 8;
10221        len--;
10222      }
10223      return checkHealth(s, 0);
10224    }
10225    while (len > 0) {
10226      const chunkLen = readInput(s, data, pos, len);
10227      if (chunkLen < -1) {
10228        return chunkLen;
10229      }
10230      if (chunkLen <= 0) {
10231        return makeError(s, -16);
10232      }
10233      pos += chunkLen;
10234      len -= chunkLen;
10235    }
10236    return 0;
10237  }
10238  function bytesToNibbles(s, byteLen) {
10239    const byteBuffer = s.byteBuffer;
10240    const halfLen = byteLen >> 1;
10241    const shortBuffer = s.shortBuffer;
10242    for (let i = 0; i < halfLen; ++i) {
10243      shortBuffer[i] = byteBuffer[i * 2] & 0xFF | (byteBuffer[i * 2 + 1] & 0xFF) << 8;
10244    }
10245  }
10246  const LOOKUP = new Int32Array(2048);
10247  function unpackLookupTable(lookup, utfMap, utfRle) {
10248    for (let i = 0; i < 256; ++i) {
10249      lookup[i] = i & 0x3F;
10250      lookup[512 + i] = i >> 2;
10251      lookup[1792 + i] = 2 + (i >> 6);
10252    }
10253    for (let i = 0; i < 128; ++i) {
10254      lookup[1024 + i] = 4 * (utfMap.charCodeAt(i) - 32);
10255    }
10256    for (let i = 0; i < 64; ++i) {
10257      lookup[1152 + i] = i & 1;
10258      lookup[1216 + i] = 2 + (i & 1);
10259    }
10260    let offset = 1280;
10261    for (let k = 0; k < 19; ++k) {
10262      const value = k & 3;
10263      const rep = utfRle.charCodeAt(k) - 32;
10264      for (let i = 0; i < rep; ++i) {
10265        lookup[offset++] = value;
10266      }
10267    }
10268    for (let i = 0; i < 16; ++i) {
10269      lookup[1792 + i] = 1;
10270      lookup[2032 + i] = 6;
10271    }
10272    lookup[1792] = 0;
10273    lookup[2047] = 7;
10274    for (let i = 0; i < 256; ++i) {
10275      lookup[1536 + i] = lookup[1792 + i] << 3;
10276    }
10277  }
10278  unpackLookupTable(LOOKUP, "         !!  !                  \"#$##%#$&'##(#)#++++++++++((&*'##,---,---,-----,-----,-----&#'###.///.///./////./////./////&#'# ", "A/*  ':  & : $  \x81 @");
10279  function State() {
10280    this.ringBuffer = new Int8Array(0);
10281    this.contextModes = new Int8Array(0);
10282    this.contextMap = new Int8Array(0);
10283    this.distContextMap = new Int8Array(0);
10284    this.distExtraBits = new Int8Array(0);
10285    this.output = new Int8Array(0);
10286    this.byteBuffer = new Int8Array(0);
10287    this.shortBuffer = new Int16Array(0);
10288    this.intBuffer = new Int32Array(0);
10289    this.rings = new Int32Array(0);
10290    this.blockTrees = new Int32Array(0);
10291    this.literalTreeGroup = new Int32Array(0);
10292    this.commandTreeGroup = new Int32Array(0);
10293    this.distanceTreeGroup = new Int32Array(0);
10294    this.distOffset = new Int32Array(0);
10295    this.accumulator64 = 0;
10296    this.runningState = 0;
10297    this.nextRunningState = 0;
10298    this.accumulator32 = 0;
10299    this.bitOffset = 0;
10300    this.halfOffset = 0;
10301    this.tailBytes = 0;
10302    this.endOfStreamReached = 0;
10303    this.metaBlockLength = 0;
10304    this.inputEnd = 0;
10305    this.isUncompressed = 0;
10306    this.isMetadata = 0;
10307    this.literalBlockLength = 0;
10308    this.numLiteralBlockTypes = 0;
10309    this.commandBlockLength = 0;
10310    this.numCommandBlockTypes = 0;
10311    this.distanceBlockLength = 0;
10312    this.numDistanceBlockTypes = 0;
10313    this.pos = 0;
10314    this.maxDistance = 0;
10315    this.distRbIdx = 0;
10316    this.trivialLiteralContext = 0;
10317    this.literalTreeIdx = 0;
10318    this.commandTreeIdx = 0;
10319    this.j = 0;
10320    this.insertLength = 0;
10321    this.contextMapSlice = 0;
10322    this.distContextMapSlice = 0;
10323    this.contextLookupOffset1 = 0;
10324    this.contextLookupOffset2 = 0;
10325    this.distanceCode = 0;
10326    this.numDirectDistanceCodes = 0;
10327    this.distancePostfixBits = 0;
10328    this.distance = 0;
10329    this.copyLength = 0;
10330    this.maxBackwardDistance = 0;
10331    this.maxRingBufferSize = 0;
10332    this.ringBufferSize = 0;
10333    this.expectedTotalSize = 0;
10334    this.outputOffset = 0;
10335    this.outputLength = 0;
10336    this.outputUsed = 0;
10337    this.ringBufferBytesWritten = 0;
10338    this.ringBufferBytesReady = 0;
10339    this.isEager = 0;
10340    this.isLargeWindow = 0;
10341    this.cdNumChunks = 0;
10342    this.cdTotalSize = 0;
10343    this.cdBrIndex = 0;
10344    this.cdBrOffset = 0;
10345    this.cdBrLength = 0;
10346    this.cdBrCopied = 0;
10347    this.cdChunks = new Array(0);
10348    this.cdChunkOffsets = new Int32Array(0);
10349    this.cdBlockBits = 0;
10350    this.cdBlockMap = new Int8Array(0);
10351    this.input = new InputStream(new Int8Array(0));
10352    this.ringBuffer = new Int8Array(0);
10353    this.rings = new Int32Array(10);
10354    this.rings[0] = 16;
10355    this.rings[1] = 15;
10356    this.rings[2] = 11;
10357    this.rings[3] = 4;
10358  }
10359  let data = new Int8Array(0);
10360  const offsets = new Int32Array(32);
10361  const sizeBits = new Int32Array(32);
10362  function setData(newData, newSizeBits) {
10363    const dictionaryOffsets = offsets;
10364    const dictionarySizeBits = sizeBits;
10365    for (let i = 0; i < newSizeBits.length; ++i) {
10366      dictionarySizeBits[i] = newSizeBits[i];
10367    }
10368    let pos = 0;
10369    for (let i = 0; i < newSizeBits.length; ++i) {
10370      dictionaryOffsets[i] = pos;
10371      const bits = dictionarySizeBits[i];
10372      if (bits !== 0) {
10373        pos += i << (bits & 31);
10374      }
10375    }
10376    for (let i = newSizeBits.length; i < 32; ++i) {
10377      dictionaryOffsets[i] = pos;
10378    }
10379    data = newData;
10380  }
10381  function unpackDictionaryData(dictionary, data0, data1, skipFlip, sizeBits, sizeBitsData) {
10382    const dict = toUsAsciiBytes(data0 + data1);
10383    const skipFlipRunes = toUtf8Runes(skipFlip);
10384    let offset = 0;
10385    const n = skipFlipRunes.length >> 1;
10386    for (let i = 0; i < n; ++i) {
10387      const skip = skipFlipRunes[2 * i] - 36;
10388      const flip = skipFlipRunes[2 * i + 1] - 36;
10389      for (let j = 0; j < skip; ++j) {
10390        dict[offset] = dict[offset] ^ 3;
10391        offset++;
10392      }
10393      for (let j = 0; j < flip; ++j) {
10394        dict[offset] = dict[offset] ^ 236;
10395        offset++;
10396      }
10397    }
10398    for (let i = 0; i < sizeBitsData.length; ++i) {
10399      sizeBits[i] = sizeBitsData.charCodeAt(i) - 65;
10400    }
10401    dictionary.set(dict);
10402  }
10403  const dictionaryData = new Int8Array(122784);
10404  const dictionarySizeBits = new Int32Array(25);
10405  unpackDictionaryData(dictionaryData, "wjnfgltmojefofewab`h`lgfgbwbpkltlmozpjwf`jwzlsfmivpwojhfeqfftlqhwf{wzfbqlufqalgzolufelqnallhsobzojufojmfkfosklnfpjgfnlqftlqgolmdwkfnujftejmgsbdfgbzpevookfbgwfqnfb`kbqfbeqlnwqvfnbqhbaofvslmkjdkgbwfobmgmftpfufmmf{w`bpfalwkslpwvpfgnbgfkbmgkfqftkbwmbnfOjmhaoldpjyfabpfkfognbhfnbjmvpfq$*#(klogfmgptjwkMftpqfbgtfqfpjdmwbhfkbufdbnfpffm`boosbwktfoosovpnfmvejonsbqwiljmwkjpojpwdllgmffgtbzptfpwilapnjmgboploldlqj`kvpfpobpwwfbnbqnzellghjmdtjoofbpwtbqgafpwejqfSbdfhmltbtbz-smdnlufwkbmolbgdjufpfoemlwfnv`keffgnbmzql`hj`lmlm`follhkjgfgjfgKlnfqvofklpwbib{jmel`ovaobtpofppkboeplnfpv`kylmf233&lmfp`bqfWjnfqb`faovfelvqtffheb`fklsfdbufkbqgolpwtkfmsbqhhfswsbpppkjsqllnKWNOsobmWzsfglmfpbufhffseobdojmhplogejufwllhqbwfwltmivnswkvpgbqh`bqgejofefbqpwbzhjoowkbweboobvwlfufq-`lnwbohpklsulwfgffsnlgfqfpwwvqmalqmabmgefooqlpfvqo+phjmqlof`lnfb`wpbdfpnffwdlog-isdjwfnubqzefowwkfmpfmggqlsUjft`lsz2-3!?,b=pwlsfopfojfpwlvqsb`h-djesbpw`pp<dqbznfbm%dw8qjgfpklwobwfpbjgqlbgubq#effoilkmqj`hslqwebpw$VB.gfbg?,a=sllqajoowzsfV-P-tllgnvpw1s{8JmelqbmhtjgftbmwtbooofbgX3^8sbvotbufpvqf'+$ tbjwnbppbqnpdlfpdbjmobmdsbjg\"..#ol`hvmjwqllwtbohejqntjef{no!plmdwfpw13s{hjmgqltpwlloelmwnbjopbefpwbqnbsp`lqfqbjmeoltabazpsbmpbzp7s{85s{8bqwpellwqfbotjhjkfbwpwfswqjslqd,obhftfbhwlogElqn`bpwebmpabmhufqzqvmpivozwbph2s{8dlbodqftpoltfgdfjg>!pfwp6s{8-ip<73s{je#+pllmpfbwmlmfwvafyfqlpfmwqffgeb`wjmwldjewkbqn2;s{`bnfkjooalogyllnuljgfbpzqjmdejoosfbhjmjw`lpw0s{8ib`hwbdpajwpqloofgjwhmftmfbq?\"..dqltIPLMgvwzMbnfpbofzlv#olwpsbjmibyy`logfzfpejpkttt-qjphwbapsqfu23s{qjpf16s{Aovfgjmd033/abooelqgfbqmtjogal{-ebjqob`hufqpsbjqivmfwf`kje+\"sj`hfujo'+! tbqnolqgglfpsvoo/333jgfbgqbtkvdfpslwevmgavqmkqfe`foohfzpwj`hklvqolppevfo21s{pvjwgfboQPP!bdfgdqfzDFW!fbpfbjnpdjqobjgp;s{8mbuzdqjgwjsp :::tbqpobgz`bqp*8#~sks<kfoowbootklnyk9\t),\x0E\t#233kboo-\t\tB4s{8svpk`kbw3s{8`qft),?,kbpk46s{eobwqbqf#%%#wfoo`bnslmwlobjgnjppphjswfmwejmfnbofdfwpsolw733/\x0E\t\x0E\t`lloeffw-sks?aq=fqj`nlpwdvjgafoogfp`kbjqnbwkbwln,jnd% ;1ov`h`fmw3338wjmzdlmfkwnopfoogqvdEQFFmlgfmj`h<jg>olpfmvooubpwtjmgQPP#tfbqqfozaffmpbnfgvhfmbpb`bsftjpkdvoeW109kjwppolwdbwfhj`haovqwkfz26s{$$*8*8!=npjftjmpajqgplqwafwbpffhW2;9lqgpwqffnboo53s{ebqn\x0ElupalzpX3^-$*8!SLPWafbqhjgp*8~~nbqzwfmg+VH*rvbgyk9\n.pjy....sqls$*8\x0EojewW2:9uj`fbmgzgfaw=QPPsllomf`haoltW259gllqfuboW249ofwpebjolqbosloomlub`lopdfmf#\x0Elxplewqlnfwjooqlpp?k0=slvqebgfsjmh?wq=njmj*\x7F\"+njmfyk9\x04abqpkfbq33*8njoh#..=jqlmeqfggjphtfmwpljosvwp,ip,klozW119JPAMW139bgbnpffp?k1=iplm$/#$`lmwW129#QPPollsbpjbnllm?,s=plvoOJMFelqw`bqwW279?k2=;3s{\"..?:s{8W379njhf975Ymj`fjm`kZlqhqj`fyk9\b$**8svqfnbdfsbqbwlmfalmg904Y\\le\\$^*8333/yk9\x0Bwbmhzbqgaltoavpk965YIbub03s{\t\x7F~\t&@0&907YifeeF[SJ`bpkujpbdloepmltyk9\x05rvfq-`pppj`hnfbwnjm-ajmggfookjqfsj`pqfmw905YKWWS.132elwltloeFMG#{al{967YALGZgj`h8\t~\tf{jw906Yubqpafbw$~*8gjfw:::8bmmf~~?,Xj^-Obmdhn.^tjqfwlzpbggppfbobof{8\t\n~f`klmjmf-lqd336*wlmziftppbmgofdpqlle333*#133tjmfdfbqgldpallwdbqz`vwpwzofwfnswjlm-{no`l`hdbmd'+$-63s{Sk-Gnjp`bobmolbmgfphnjofqzbmvmj{gjp`*8~\tgvpw`ojs*-\t\t43s{.133GUGp4^=?wbsfgfnlj((*tbdffvqlskjolswpklofEBRpbpjm.15WobapsfwpVQO#avoh`llh8~\x0E\tKFBGX3^*baaqivbm+2:;ofpkwtjm?,j=plmzdvzpev`hsjsf\x7F.\t\"331*mgltX2^8X^8\tOld#pbow\x0E\t\n\nabmdwqjnabwk*x\x0E\t33s{\t~*8hl9\0effpbg=\x0Ep9,,#X^8wloosovd+*x\tx\x0E\t#-ip$133sgvboalbw-ISD*8\t~rvlw*8\t\t$*8\t\x0E\t~\x0E1327132613251324132;132:13131312131113101317131613151314131;131:130313021301130013071306130513041320132113221323133:133;133413351336133713301331133213332:::2::;2::42::52::62::72::02::12::22::32:;:2:;;2:;42:;52:;62:;72:;02:;12:;22:;32:4:2:4;2:442:452:462:472:402:412:422:432:5:2:5;2:542:552:562:572:502:512:522:532:6:2:6;2:642:652:662:672:602:612:622:632333231720:73333::::`lnln/Mpfpwffpwbsfqlwlglkb`f`bgbb/]lajfmg/Abbp/Aujgb`bpllwqlelqlplollwqb`vbogjilpjgldqbmwjslwfnbgfafbodlrv/Efpwlmbgbwqfpsl`l`bpbabilwlgbpjmlbdvbsvfpvmlpbmwfgj`fovjpfoobnbzlylmbbnlqsjpllaqb`oj`foolgjlpklqb`bpj<[<\\<Q<\\<R<P=l<\\=l=o=n<\\<Q<Y<S<R<R=n<T<[<Q<R<X<R=n<R<Z<Y<R<Q<T=i<q<\\<Y<Y<]=g<P=g<~=g=m<R<^=g<^<R<q<R<R<]<s<R<W<T<Q<T<L<H<q<Y<p=g=n=g<r<Q<T<P<X<\\<{<\\<x<\\<q=o<r<]=n<Y<t<[<Y<U<Q=o<P<P<N=g=o<Z5m5f4O5j5i4K5i4U5o5h4O5d4]4C5f4K5m5e5k5d5h5i5h5o4K5d5h5k4D4_4K5h4I5j5k5f4O5f5n4C5k5h4G5i4D5k5h5d5h5f4D5h4K5f4D5o4X5f4K5i4O5i5j4F4D5f5h5j4A4D5k5i5i4X5d4Xejqpwujgflojdkwtlqognfgjbtkjwf`olpfaob`hqjdkwpnbooallhpsob`fnvpj`ejfoglqgfqsljmwubovfofufowbaofalbqgklvpfdqlvstlqhpzfbqppwbwfwlgbztbwfqpwbqwpwzofgfbwksltfqsklmfmjdkwfqqlqjmsvwbalvwwfqnpwjwofwllopfufmwol`bowjnfpobqdftlqgpdbnfppklqwpsb`fel`vp`ofbqnlgfoaol`hdvjgfqbgjlpkbqftlnfmbdbjmnlmfzjnbdfmbnfpzlvmdojmfpobwfq`lolqdqffmeqlmw%bns8tbw`kelq`fsqj`fqvofpafdjmbewfqujpjwjppvfbqfbpafoltjmgf{wlwboklvqpobafosqjmwsqfppavjowojmhppsffgpwvgzwqbgfelvmgpfmpfvmgfqpkltmelqnpqbmdfbggfgpwjoonlufgwbhfmbalufeobpkej{fglewfmlwkfqujftp`kf`hofdboqjufqjwfnprvj`hpkbsfkvnbmf{jpwdljmdnlujfwkjqgabpj`sfb`fpwbdftjgwkoldjmjgfbptqlwfsbdfpvpfqpgqjufpwlqfaqfbhplvwkulj`fpjwfpnlmwktkfqfavjogtkj`kfbqwkelqvnwkqffpslqwsbqwz@oj`holtfqojufp`obppobzfqfmwqzpwlqzvpbdfplvmg`lvqwzlvq#ajqwkslsvswzsfpbssozJnbdfafjmdvssfqmlwfpfufqzpkltpnfbmpf{wqbnbw`kwqb`hhmltmfbqozafdbmpvsfqsbsfqmlqwkofbqmdjufmmbnfgfmgfgWfqnpsbqwpDqlvsaqbmgvpjmdtlnbmebopfqfbgzbvgjlwbhfptkjof-`ln,ojufg`bpfpgbjoz`kjogdqfbwivgdfwklpfvmjwpmfufqaqlbg`lbpw`lufqbssofejofp`z`ofp`fmfsobmp`oj`htqjwfrvffmsjf`ffnbjoeqbnflogfqsklwlojnjw`b`kf`jujop`boffmwfqwkfnfwkfqfwlv`kalvmgqlzbobphfgtklofpjm`fpwl`h#mbnfebjwkkfbqwfnswzleefqp`lsfltmfgnjdkwboavnwkjmhaollgbqqbznbilqwqvpw`bmlmvmjlm`lvmwubojgpwlmfPwzofOldjmkbsszl``vqofew9eqfpkrvjwfejonpdqbgfmffgpvqabmejdkwabpjpklufqbvwl8qlvwf-kwnonj{fgejmboZlvq#pojgfwlsj`aqltmbolmfgqbtmpsojwqfb`kQjdkwgbwfpnbq`krvlwfdllgpOjmhpglvawbpzm`wkvnaboolt`kjfezlvwkmlufo23s{8pfqufvmwjokbmgp@kf`hPsb`frvfqzibnfpfrvbowtj`f3/333Pwbqwsbmfoplmdpqlvmgfjdkwpkjewtlqwkslpwpofbgptffhpbuljgwkfpfnjofpsobmfpnbqwboskbsobmwnbqhpqbwfpsobzp`objnpbofpwf{wppwbqptqlmd?,k0=wkjmd-lqd,nvowjkfbqgSltfqpwbmgwlhfmplojg+wkjpaqjmdpkjsppwbeewqjfg`boopevoozeb`wpbdfmwWkjp#,,..=bgnjmfdzswFufmw26s{8Fnbjowqvf!`qlpppsfmwaoldpal{!=mlwfgofbuf`kjmbpjyfpdvfpw?,k7=qlalwkfbuzwqvf/pfufmdqbmg`qjnfpjdmpbtbqfgbm`fskbpf=?\"..fm\\VP% 0:8133s{\\mbnfobwjmfmilzbib{-bwjlmpnjwkV-P-#klogpsfwfqjmgjbmbu!=`kbjmp`lqf`lnfpgljmdsqjlqPkbqf2::3pqlnbmojpwpibsbmeboopwqjboltmfqbdqff?,k1=bavpfbofqwlsfqb!.,,T`bqgpkjoopwfbnpSklwlwqvwk`ofbm-sks<pbjmwnfwboolvjpnfbmwsqlleaqjfeqlt!=dfmqfwqv`hollhpUbovfEqbnf-mfw,..=\t?wqz#x\tubq#nbhfp`lpwpsobjmbgvowrvfpwwqbjmobalqkfosp`bvpfnbdj`nlwlqwkfjq163s{ofbpwpwfsp@lvmw`lvogdobpppjgfpevmgpklwfobtbqgnlvwknlufpsbqjpdjufpgvw`kwf{bpeqvjwmvoo/\x7F\x7FX^8wls!=\t?\"..SLPW!l`fbm?aq,=eollqpsfbhgfswk#pjyfabmhp`bw`k`kbqw13s{8bojdmgfboptlvog63s{8vqo>!sbqhpnlvpfNlpw#---?,bnlmdaqbjmalgz#mlmf8abpfg`bqqzgqbewqfefqsbdf\\klnf-nfwfqgfobzgqfbnsqlufiljmw?,wq=gqvdp?\"..#bsqjojgfboboofmf{b`welqwk`lgfpoldj`Ujft#pffnpaobmhslqwp#+133pbufg\\ojmhdlbopdqbmwdqffhklnfpqjmdpqbwfg03s{8tklpfsbqpf+*8!#Aol`hojmv{ilmfpsj{fo$*8!=*8je+.ofewgbujgklqpfEl`vpqbjpfal{fpWqb`hfnfmw?,fn=abq!=-pq`>wltfqbow>!`baofkfmqz17s{8pfwvsjwbozpkbqsnjmlqwbpwftbmwpwkjp-qfpfwtkffodjqop,`pp,233&8`ovappwveeajaofulwfp#2333hlqfb~*8\x0E\tabmgprvfvf>#x~8;3s{8`hjmdx\x0E\t\n\nbkfbg`ol`hjqjpkojhf#qbwjlpwbwpElqn!zbkll*X3^8Balvwejmgp?,k2=gfavdwbphpVQO#>`foop~*+*821s{8sqjnfwfoopwvqmp3{533-isd!psbjmafb`kwb{fpnj`qlbmdfo..=?,djewppwfuf.ojmhalgz-~*8\t\nnlvmw#+2::EBR?,qldfqeqbmh@obpp1;s{8effgp?k2=?p`lwwwfpwp11s{8gqjmh*#\x7F\x7F#oftjppkboo 30:8#elq#olufgtbpwf33s{8ib9\x0Fnpjnlm?elmwqfsoznffwpvmwfq`kfbswjdkwAqbmg*#\">#gqfpp`ojspqllnplmhfznlajonbjm-Mbnf#sobwfevmmzwqffp`ln,!2-isdtnlgfsbqbnPWBQWofew#jggfm/#132*8\t~\telqn-ujqvp`kbjqwqbmptlqpwSbdfpjwjlmsbw`k?\"..\tl.`b`ejqnpwlvqp/333#bpjbmj((*xbglaf$*X3^jg>23alwk8nfmv#-1-nj-smd!hfujm`lb`k@kjogaqv`f1-isdVQO*(-isd\x7Fpvjwfpoj`fkbqqz213!#ptffwwq=\x0E\tmbnf>gjfdlsbdf#ptjpp..=\t\t eee8!=Old-`ln!wqfbwpkffw*#%%#27s{8poffsmwfmwejofgib9\x0Fojg>!`Mbnf!tlqpfpklwp.al{.gfowb\t%ow8afbqp97;Y?gbwb.qvqbo?,b=#psfmgabhfqpklsp>#!!8sks!=`wjlm20s{8aqjbmkfoolpjyf>l>&1E#iljmnbzaf?jnd#jnd!=/#eipjnd!#!*X3^NWlsAWzsf!mftozGbmph`yf`kwqbjohmltp?,k6=ebr!=yk.`m23*8\t.2!*8wzsf>aovfpwqvozgbujp-ip$8=\x0E\t?\"pwffo#zlv#k1=\x0E\telqn#ifpvp233&#nfmv-\x0E\t\n\x0E\ttbofpqjphpvnfmwggjmda.ojhwfb`kdje!#ufdbpgbmphffpwjpkrjspvlnjplaqfgfpgffmwqfwlglpsvfgfb/]lpfpw/Mwjfmfkbpwblwqlpsbqwfglmgfmvfulkb`fqelqnbnjpnlnfilqnvmglbrv/Ag/Abpp/_olbzvgbef`kbwlgbpwbmwlnfmlpgbwlplwqbppjwjlnv`klbklqbovdbqnbzlqfpwlpklqbpwfmfqbmwfpelwlpfpwbpsb/Apmvfubpbovgelqlpnfgjlrvjfmnfpfpslgfq`kjofpfq/Muf`fpgf`jqilp/Efpwbqufmwbdqvslkf`klfoolpwfmdlbnjdl`lpbpmjufodfmwfnjpnbbjqfpivojlwfnbpkb`jbebulqivmjlojaqfsvmwlavfmlbvwlqbaqjoavfmbwf{wlnbqylpbafqojpwbovfdl`/_nlfmfqlivfdlsfq/Vkbafqfpwlzmvm`bnvifqubolqevfqbojaqldvpwbjdvboulwlp`bplpdv/Absvfglplnlpbujplvpwfggfafmml`kfavp`bebowbfvqlppfqjfgj`kl`vqpl`obuf`bpbpof/_msobylobqdllaqbpujpwbbslzlivmwlwqbwbujpwl`qfbq`bnslkfnlp`jm`l`bqdlsjplplqgfmkb`fm/Mqfbgjp`lsfgql`fq`bsvfgbsbsfonfmlq/Vwjo`obqlilqdf`boofslmfqwbqgfmbgjfnbq`bpjdvffoobppjdol`l`kfnlwlpnbgqf`obpfqfpwlmj/]lrvfgbsbpbqabm`lkjilpujbifsbaol/Epwfujfmfqfjmlgfibqelmgl`bmbomlqwfofwqb`bvpbwlnbqnbmlpovmfpbvwlpujoobufmglsfpbqwjslpwfmdbnbq`loofubsbgqfvmjglubnlpylmbpbnalpabmgbnbqjbbavplnv`kbpvajqqjlibujujqdqbgl`kj`bboo/Ailufmgj`kbfpwbmwbofppbojqpvfolsfplpejmfpoobnbavp`l/Epwboofdbmfdqlsobybkvnlqsbdbqivmwbglaofjpobpalopbab/]lkbaobov`kb/mqfbgj`fmivdbqmlwbpuboofboo/M`bqdbglolqbabilfpw/Edvpwlnfmwfnbqjlejqnb`lpwlej`kbsobwbkldbqbqwfpofzfpbrvfonvpflabpfpsl`lpnjwbg`jfol`kj`lnjfgldbmbqpbmwlfwbsbgfafpsobzbqfgfppjfwf`lqwf`lqfbgvgbpgfpflujfilgfpfbbdvbp%rvlw8glnbjm`lnnlmpwbwvpfufmwpnbpwfqpzpwfnb`wjlmabmmfqqfnlufp`qloovsgbwfdolabonfgjvnejowfqmvnafq`kbmdfqfpvowsvaoj`p`qffm`kllpfmlqnbowqbufojppvfpplvq`fwbqdfwpsqjmdnlgvofnlajofptjw`ksklwlpalqgfqqfdjlmjwpfoepl`jbob`wjuf`lovnmqf`lqgelooltwjwof=fjwkfqofmdwkebnjozeqjfmgobzlvwbvwklq`qfbwfqfujftpvnnfqpfqufqsobzfgsobzfqf{sbmgsloj`zelqnbwglvaofsljmwppfqjfpsfqplmojujmdgfpjdmnlmwkpelq`fpvmjrvftfjdkwsflsoffmfqdzmbwvqfpfbq`kejdvqfkbujmd`vpwlnleepfwofwwfqtjmgltpvanjwqfmgfqdqlvspvsolbgkfbowknfwklgujgflpp`klloevwvqfpkbgltgfabwfubovfpLaif`wlwkfqpqjdkwpofbdvf`kqlnfpjnsofmlwj`fpkbqfgfmgjmdpfbplmqfslqwlmojmfprvbqfavwwlmjnbdfpfmbaofnlujmdobwfpwtjmwfqEqbm`fsfqjlgpwqlmdqfsfbwOlmglmgfwbjoelqnfggfnbmgpf`vqfsbppfgwlddofsob`fpgfuj`fpwbwj``jwjfppwqfbnzfooltbwwb`hpwqffweojdkwkjggfmjmel!=lsfmfgvpfevouboofz`bvpfpofbgfqpf`qfwpf`lmggbnbdfpslqwpf{`fswqbwjmdpjdmfgwkjmdpfeef`wejfogppwbwfpleej`fujpvbofgjwlqulovnfQfslqwnvpfvnnlujfpsbqfmwb``fppnlpwoznlwkfq!#jg>!nbqhfwdqlvmg`kbm`fpvqufzafelqfpznalonlnfmwpsff`knlwjlmjmpjgfnbwwfq@fmwfqlaif`wf{jpwpnjggofFvqlsfdqltwkofdb`znbmmfqfmlvdk`bqffqbmptfqlqjdjmslqwbo`ojfmwpfof`wqbmgln`olpfgwlsj`p`lnjmdebwkfqlswjlmpjnsozqbjpfgfp`bsf`klpfm`kvq`kgfejmfqfbplm`lqmfqlvwsvwnfnlqzjeqbnfsloj`fnlgfopMvnafqgvqjmdleefqppwzofphjoofgojpwfg`boofgpjoufqnbqdjmgfofwfafwwfqaqltpfojnjwpDolabopjmdoftjgdfw`fmwfqavgdfwmltqbs`qfgjw`objnpfmdjmfpbefwz`klj`fpsjqjw.pwzofpsqfbgnbhjmdmffgfgqvppjbsofbpff{wfmwP`qjswaqlhfmbooltp`kbqdfgjujgfeb`wlqnfnafq.abpfgwkflqz`lmejdbqlvmgtlqhfgkfosfg@kvq`kjnsb`wpklvogbotbzpoldl!#alwwlnojpw!=*xubq#sqfej{lqbmdfKfbgfq-svpk+`lvsofdbqgfmaqjgdfobvm`kQfujftwbhjmdujpjlmojwwofgbwjmdAvwwlmafbvwzwkfnfpelqdlwPfbq`kbm`klqbonlpwolbgfg@kbmdfqfwvqmpwqjmdqfolbgNlajofjm`lnfpvssozPlvq`flqgfqpujftfg%maps8`lvqpfBalvw#jpobmg?kwno#`llhjfmbnf>!bnbylmnlgfqmbguj`fjm?,b=9#Wkf#gjboldklvpfpAFDJM#Nf{j`lpwbqwp`fmwqfkfjdkwbggjmdJpobmgbppfwpFnsjqfP`kllofeelqwgjqf`wmfbqoznbmvboPfof`w-\t\tLmfiljmfgnfmv!=SkjojsbtbqgpkbmgofjnslqwLeej`fqfdbqgphjoopmbwjlmPslqwpgfdqfftffhoz#+f-d-afkjmggl`wlqolddfgvmjwfg?,a=?,afdjmpsobmwpbppjpwbqwjpwjppvfg033s{\x7F`bmbgbbdfm`zp`kfnfqfnbjmAqbyjopbnsofoldl!=afzlmg.p`bofb``fswpfqufgnbqjmfEllwfq`bnfqb?,k2=\t\\elqn!ofbufppwqfpp!#,=\x0E\t-dje!#lmolbgolbgfqL{elqgpjpwfqpvqujuojpwfmefnbofGfpjdmpjyf>!bssfbowf{w!=ofufopwkbmhpkjdkfqelq`fgbmjnbobmzlmfBeqj`bbdqffgqf`fmwSflsof?aq#,=tlmgfqsqj`fpwvqmfg\x7F\x7F#x~8nbjm!=jmojmfpvmgbztqbs!=ebjofg`fmpvpnjmvwfafb`lmrvlwfp263s{\x7Ffpwbwfqfnlwffnbjo!ojmhfgqjdkw8pjdmboelqnbo2-kwnopjdmvssqjm`feolbw9-smd!#elqvn-B``fppsbsfqpplvmgpf{wfmgKfjdkwpojgfqVWE.;!%bns8#Afelqf-#TjwkpwvgjlltmfqpnbmbdfsqlejwiRvfqzbmmvbosbqbnpalvdkwebnlvpdlldofolmdfqj((*#xjpqbfopbzjmdgf`jgfklnf!=kfbgfqfmpvqfaqbm`ksjf`fpaol`h8pwbwfgwls!=?qb`jmdqfpjyf..%dw8sb`jwzpf{vboavqfbv-isd!#23/333lawbjmwjwofpbnlvmw/#Jm`-`lnfgznfmv!#ozqj`pwlgbz-jmgffg`lvmwz\\oldl-EbnjozollhfgNbqhfwopf#jeSobzfqwvqhfz*8ubq#elqfpwdjujmdfqqlqpGlnbjm~fopfxjmpfqwAold?,ellwfqoldjm-ebpwfqbdfmwp?algz#23s{#3sqbdnbeqjgbzivmjlqgloobqsob`fg`lufqpsovdjm6/333#sbdf!=alpwlm-wfpw+bubwbqwfpwfg\\`lvmwelqvnpp`kfnbjmgf{/ejoofgpkbqfpqfbgfqbofqw+bssfbqPvanjwojmf!=algz!=\t)#WkfWklvdkpffjmdifqpfzMftp?,ufqjezf{sfqwjmivqztjgwk>@llhjfPWBQW#b`qlpp\\jnbdfwkqfbgmbwjufsl`hfwal{!=\tPzpwfn#Gbujg`bm`fqwbaofpsqlufgBsqjo#qfboozgqjufqjwfn!=nlqf!=albqgp`lolqp`bnsvpejqpw#\x7F\x7F#X^8nfgjb-dvjwbqejmjpktjgwk9pkltfgLwkfq#-sks!#bppvnfobzfqptjoplmpwlqfpqfojfeptfgfm@vpwlnfbpjoz#zlvq#Pwqjmd\t\tTkjowbzolq`ofbq9qfplqweqfm`kwklvdk!*#(#!?algz=avzjmdaqbmgpNfnafqmbnf!=lssjmdpf`wlq6s{8!=upsb`fslpwfqnbilq#`leeffnbqwjmnbwvqfkbssfm?,mbu=hbmpbpojmh!=Jnbdfp>ebopftkjof#kpsb`f3%bns8#\t\tJm##sltfqSlophj.`lolqilqgbmAlwwlnPwbqw#.`lvmw1-kwnomftp!=32-isdLmojmf.qjdkwnjoofqpfmjlqJPAM#33/333#dvjgfpubovf*f`wjlmqfsbjq-{no!##qjdkwp-kwno.aol`hqfdF{s9klufqtjwkjmujqdjmsklmfp?,wq=\x0Evpjmd#\t\nubq#=$*8\t\n?,wg=\t?,wq=\tabkbpbaqbpjodbofdlnbdzbqslophjpqsphj4]4C5d\bTA\nzk\x0BBl\bQ\x7F\x0BUm\x05Gx\bSM\nmC\bTA\twQ\nd}\bW@\bTl\bTF\ti@\tcT\x0BBM\x0B|j\x04BV\tqw\tcC\bWI\npa\tfM\n{Z\x05{X\bTF\bVV\bVK\t\x7Fm\x04kF\t[]\bPm\bTv\nsI\x0Bpg\t[I\bQp\x04mx\x0B_W\n^M\npe\x0BQ}\x0BGu\nel\npe\x04Ch\x04BV\bTA\tSo\nzk\x0BGL\x0BxD\nd[\x05Jz\x05MY\bQp\x04li\nfl\npC\x05{B\x05Nt\x0BwT\ti_\bTg\x04QQ\n|p\x0BXN\bQS\x0BxD\x04QC\bWZ\tpD\x0BVS\bTW\x05Nt\x04Yh\nzu\x04Kj\x05N}\twr\tHa\n_D\tj`\x0BQ}\x0BWp\nxZ\x04{c\tji\tBU\nbD\x04a|\tTn\tpV\nZd\nmC\x0BEV\x05{X\tc}\tTo\bWl\bUd\tIQ\tcg\x0Bxs\nXW\twR\x0Bek\tc}\t]y\tJn\nrp\neg\npV\nz\\\x05{W\npl\nz\\\nzU\tPc\t`{\bV@\nc|\bRw\ti_\bVb\nwX\tHv\x04Su\bTF\x0B_W\x0BWs\x0BsI\x05m\x7F\nTT\ndc\tUS\t}f\tiZ\bWz\tc}\x04MD\tBe\tiD\x0B@@\bTl\bPv\t}t\x04Sw\x04M`\x0BnU\tkW\x0Bed\nqo\x0BxY\tA|\bTz\x0By`\x04BR\x04BM\tia\x04XU\nyu\x04n^\tfL\tiI\nXW\tfD\bWz\bW@\tyj\t\x7Fm\tav\tBN\x0Bb\\\tpD\bTf\nY[\tJn\bQy\t[^\x0BWc\x0Byu\x04Dl\x04CJ\x0BWj\x0BHR\t`V\x0BuW\tQy\np@\x0BGu\x05pl\x04Jm\bW[\nLP\nxC\n`m\twQ\x05ui\x05\x7FR\nbI\twQ\tBZ\tWV\x04BR\npg\tcg\x05ti\x04CW\n_y\tRg\bQa\x0BQB\x0BWc\nYb\x05le\ngE\x04Su\nL[\tQ\x7F\tea\tdj\x0B]W\nb~\x04M`\twL\bTV\bVH\nt\x7F\npl\t|b\x05s_\bU|\bTa\x04oQ\x05lv\x04Sk\x04M`\bTv\x0BK}\nfl\tcC\x04oQ\x04BR\tHk\t|d\bQp\tHK\tBZ\x0BHR\bPv\x0BLx\x0BEZ\bT\x7F\bTv\tiD\x05oD\x05MU\x0BwB\x04Su\x05k`\x04St\ntC\tPl\tKg\noi\tjY\x0BxY\x04h}\nzk\bWZ\t\x7Fm\x0Be`\tTB\tfE\nzk\t`z\x04Yh\nV|\tHK\tAJ\tAJ\bUL\tp\\\tql\nYc\x04Kd\nfy\x04Yh\t[I\x0BDg\x04Jm\n]n\nlb\bUd\n{Z\tlu\tfs\x04oQ\bTW\x04Jm\x0BwB\tea\x04Yh\x04BC\tsb\tTn\nzU\n_y\x0BxY\tQ]\ngw\x04mt\tO\\\ntb\bWW\bQy\tmI\tV[\ny\\\naB\x0BRb\twQ\n]Q\x04QJ\bWg\x0BWa\bQj\ntC\bVH\nYm\x0Bxs\bVK\nel\bWI\x0BxY\x04Cq\ntR\x0BHV\bTl\bVw\tay\bQa\bVV\t}t\tdj\nr|\tp\\\twR\n{i\nTT\t[I\ti[\tAJ\x0Bxs\x0B_W\td{\x0BQ}\tcg\tTz\tA|\tCj\x0BLm\x05N}\x05m\x7F\nbK\tdZ\tp\\\t`V\tsV\np@\tiD\twQ\x0BQ}\bTf\x05ka\x04Jm\x0B@@\bV`\tzp\n@N\x04Sw\tiI\tcg\noi\x04Su\bVw\x04lo\x04Cy\tc}\x0Bb\\\tsU\x04BA\bWI\bTf\nxS\tVp\nd|\bTV\x0BbC\tNo\x05Ju\nTC\t|`\n{Z\tD]\bU|\tc}\x05lm\bTl\tBv\tPl\tc}\bQp\t\x7Fm\nLk\tkj\n@N\x04Sb\x04KO\tj_\tp\\\nzU\bTl\bTg\bWI\tcf\x04XO\bWW\ndz\x04li\tBN\nd[\bWO\x04MD\x0BKC\tdj\tI_\bVV\ny\\\x0BLm\x05xl\txB\tkV\x0Bb\\\x0BJW\x0BVS\tVx\x0BxD\td{\x04MD\bTa\t|`\x0BPz\x04R}\x0BWs\x04BM\nsI\x04CN\bTa\x04Jm\npe\ti_\npV\nrh\tRd\tHv\n~A\nxR\x0BWh\x0BWk\nxS\x0BAz\x0BwX\nbI\x04oQ\tfw\nqI\nV|\nun\x05z\x7F\x0Bpg\td\\\x0BoA\x05{D\ti_\x05xB\bT\x7F\t`V\x05qr\tTT\x04g]\x04CA\x0BuR\tVJ\tT`\npw\x0BRb\tI_\nCx\x04Ro\x0BsI\x04Cj\x04Kh\tBv\tWV\x04BB\x05oD\x05{D\nhc\x04Km\x0B^R\tQE\n{I\np@\nc|\x05Gt\tc}\x04Dl\nzU\x05qN\tsV\x05k}\tHh\x0B|j\nqo\x05u|\tQ]\x0Bek\x05\x7FZ\x04M`\x04St\npe\tdj\bVG\x0BeE\t\x7Fm\x0BWc\x04|I\n[W\tfL\bT\x7F\tBZ\x04Su\x0BKa\x04Cq\x05Nt\x04Y[\nqI\bTv\tfM\ti@\t}f\x04B\\\tQy\x0BBl\bWg\x04XD\x05kc\x0Bx[\bVV\tQ]\t\x7Fa\tPy\x0BxD\nfI\t}f\x05oD\tdj\tSG\x05ls\t~D\x04CN\n{Z\t\\v\n_D\nhc\x0Bx_\x04C[\tAJ\nLM\tVx\x04CI\tbj\tc^\tcF\ntC\x04Sx\twr\x04XA\bU\\\t|a\x0BK\\\bTV\bVj\nd|\tfs\x04CX\ntb\bRw\tVx\tAE\tA|\bT\x7F\x05Nt\x0BDg\tVc\bTl\x04d@\npo\t\x7FM\tcF\npe\tiZ\tBo\bSq\nfH\x04l`\bTx\bWf\tHE\x0BF{\tcO\tfD\nlm\x0BfZ\nlm\x0BeU\tdG\x04BH\bTV\tSi\x05MW\nwX\nz\\\t\\c\x04CX\nd}\tl}\bQp\bTV\tF~\bQ\x7F\t`i\ng@\x05nO\bUd\bTl\nL[\twQ\tji\ntC\t|J\nLU\naB\x0BxY\x04Kj\tAJ\x05uN\ti[\npe\x04Sk\x0BDg\x0Bx]\bVb\bVV\nea\tkV\nqI\bTa\x04Sk\nAO\tpD\ntb\nts\nyi\bVg\ti_\x0B_W\nLk\x05Nt\tyj\tfM\x04R\x7F\tiI\bTl\x0BwX\tsV\x0BMl\nyu\tAJ\bVj\x04KO\tWV\x0BA}\x0BW\x7F\nrp\tiD\x0B|o\x05lv\x0BsI\x04BM\td~\tCU\bVb\x04eV\npC\x0BwT\tj`\tc}\x0Bxs\x0Bps\x0Bvh\tWV\x0BGg\x0BAe\x0BVK\x0B]W\trg\x0BWc\x05F`\tBr\x0Bb\\\tdZ\bQp\nqI\x04kF\nLk\x0BAR\bWI\bTg\tbs\tdw\n{L\n_y\tiZ\bTA\tlg\bVV\bTl\tdk\n`k\ta{\ti_\x05{A\x05wj\twN\x0B@@\bTe\ti_\n_D\twL\nAH\x0BiK\x0Bek\n[]\tp_\tyj\bTv\tUS\t[r\n{I\nps\x05Gt\x0BVK\npl\x04S}\x0BWP\t|d\x04MD\x0BHV\bT\x7F\x04R}\x04M`\bTV\bVH\x05lv\x04Ch\bW[\x04Ke\tR{\x0B^R\tab\tBZ\tVA\tB`\nd|\nhs\x04Ke\tBe\x04Oi\tR{\td\\\x05nB\bWZ\tdZ\tVJ\x05Os\t\x7Fm\x04uQ\x0BhZ\x04Q@\x04QQ\nfI\bW[\x04B\\\x04li\nzU\nMd\x04M`\nxS\bVV\n\\}\x0BxD\t\x7Fm\bTp\x04IS\nc|\tkV\x05i~\tV{\x0BhZ\t|b\bWt\n@R\x0BoA\x0BnU\bWI\tea\tB`\tiD\tc}\tTz\x04BR\x0BQB\x05Nj\tCP\t[I\bTv\t`W\x05uN\x0Bpg\x0Bpg\x0BWc\tiT\tbs\twL\tU_\tc\\\t|h\x0BKa\tNr\tfL\nq|\nzu\nz\\\tNr\bUg\t|b\x04m`\bTv\nyd\nrp\bWf\tUX\x04BV\nzk\nd}\twQ\t}f\x04Ce\x0Bed\bTW\bSB\nxU\tcn\bTb\ne\x7F\ta\\\tSG\bU|\npV\nN\\\x04Kn\x0BnU\tAt\tpD\x0B^R\x0BIr\x04b[\tR{\tdE\x0BxD\x0BWK\x0BWA\bQL\bW@\x04Su\bUd\nDM\tPc\x04CA\x04Dl\x04oQ\tHs\x05wi\x04ub\n\x7Fa\bQp\x05Ob\nLP\bTl\x04Y[\x0BK}\tAJ\bQ\x7F\x04n^\x0BsA\bSM\nqM\bWZ\n^W\x0Bz{\x04S|\tfD\bVK\bTv\bPv\x04BB\tCP\x04dF\tid\x0Bxs\x04mx\x0Bws\tcC\ntC\tyc\x05M`\x0BW\x7F\nrh\bQp\x0BxD\x04\\o\nsI\x04_k\nzu\x04kF\tfD\x04Xs\x04XO\tjp\bTv\x04BS\x05{B\tBr\nzQ\nbI\tc{\x04BD\x04BV\x05nO\bTF\tca\x05Jd\tfL\tPV\tI_\nlK\x04`o\twX\npa\tgu\bP}\x05{^\bWf\n{I\tBN\npa\x04Kl\x0Bpg\tcn\tfL\x0Bvh\x04Cq\bTl\x0BnU\bSq\x04Cm\twR\bUJ\npe\nyd\nYg\x04Cy\x0BKW\tfD\nea\x04oQ\tj_\tBv\x04nM\x0BID\bTa\nzA\x05pl\n]n\bTa\tR{\tfr\n_y\bUg\x05{X\x05kk\x0BxD\x04|I\x05xl\nfy\x04Ce\x0BwB\nLk\x0Bd]\noi\n}h\tQ]\npe\bVw\x04Hk\x04OQ\nzk\tAJ\npV\bPv\ny\\\tA{\x04Oi\bSB\x04XA\x0BeE\tjp\nq}\tiD\x05qN\x0B^R\t\x7Fm\tiZ\tBr\bVg\noi\n\\X\tU_\nc|\x0BHV\bTf\tTn\x04\\N\x04\\N\nuB\x05lv\nyu\tTd\bTf\bPL\x0B]W\tdG\nA`\nw^\ngI\npe\tdw\nz\\\x05ia\bWZ\tcF\x04Jm\n{Z\bWO\x04_k\x04Df\x04RR\td\\\bVV\x0Bxs\x04BN\x05ti\x04lm\tTd\t]y\x0BHV\tSo\x0B|j\x04XX\tA|\x0BZ^\x0BGu\bTW\x05M`\x04kF\x0BhZ\x0BVK\tdG\x0BBl\tay\nxU\x05qE\x05nO\bVw\nqI\x04CX\ne\x7F\tPl\bWO\x0BLm\tdL\x05uH\x04Cm\tdT\x04fn\x0BwB\x05ka\x0BnU\n@M\nyT\tHv\t\\}\x04Kh\td~\x04Yh\x05k}\neR\td\\\bWI\t|b\tHK\tiD\bTW\x05MY\npl\bQ_\twr\x0BAx\tHE\bTg\bSq\x05vp\x0Bb\\\bWO\nOl\nsI\nfy\x0BID\t\\c\n{Z\n^~\npe\nAO\tTT\x0Bxv\x04k_\bWO\x0B|j\x0BwB\tQy\ti@\tPl\tHa\tdZ\x05k}\x04ra\tUT\x0BJc\x0Bed\np@\tQN\nd|\tkj\tHk\x04M`\noi\twr\td\\\nlq\no_\nlb\nL[\tac\x04BB\x04BH\x04Cm\npl\tIQ\bVK\x0Bxs\n`e\x0BiK\npa\x04Oi\tUS\bTp\tfD\nPG\x05kk\x04XA\nz\\\neg\x0BWh\twR\x05qN\nqS\tcn\x04lo\nxS\n^W\tBU\nt\x7F\tHE\tp\\\tfF\tfw\bVV\bW@\tak\x0BVK\x05ls\tVJ\bVV\x0BeE\x04\\o\nyX\nYm\x04M`\x05lL\nd|\nzk\tA{\x05sE\twQ\x04XT\nt\x7F\tPl\t]y\x0BwT\x05{p\x04MD\x0Bb\\\tQ]\x04Kj\tJn\nAH\x0BRb\tBU\tHK\t\\c\nfI\x05m\x7F\nqM\n@R\tSo\noi\x04BT\tHv\n_y\x04Kh\tBZ\t]i\bUJ\tV{\x04Sr\nbI\x0BGg\ta_\bTR\nfI\nfl\t[K\tII\x04S|\x0BuW\tiI\bWI\nqI\x0B|j\x04BV\bVg\bWZ\x04kF\x0Bx]\bTA\tab\tfr\ti@\tJd\tJd\x0Bps\nAO\bTa\x05xu\tiD\nzk\t|d\t|`\bW[\tlP\tdG\bVV\x0Bw}\x0BqO\ti[\bQ\x7F\bTz\x0BVF\twN\x05ts\tdw\bTv\neS\ngi\tNr\x05yS\npe\bVV\bSq\n`m\tyj\tBZ\x0BWX\bSB\tc\\\nUR\t[J\tc_\x04nM\bWQ\x0BAx\nMd\tBr\x05ui\x0BxY\bSM\x0BWc\x0B|j\x0Bxs\t}Q\tBO\bPL\bWW\tfM\nAO\tPc\x0BeU\x04e^\bTg\nqI\tac\bPv\tcF\x04oQ\tQ\x7F\x0BhZ\x05ka\nz\\\tiK\tBU\n`k\tCP\x04S|\x04M`\n{I\tS{\x04_O\tBZ\x04Zi\x04Sk\tps\tp\\\nYu\n]s\nxC\bWt\nbD\tkV\x0BGu\x05yS\nqA\t[r\neK\x04M`\tdZ\x05lL\bUg\bTl\nbD\tUS\x0Bb\\\tpV\ncc\x04S\\\tct\t`z\bPL\x0BWs\nA`\neg\bSq\x05uE\x04CR\x0BDg\t`W\x0Bz{\x0BWc\x04Sk\x04Sk\tbW\bUg\tea\nxZ\tiI\tUX\tVJ\nqn\tS{\x0BRb\bTQ\npl\x05Gt\x0BuW\x05uj\npF\nqI\tfL\t[I\tia\x04XO\nyu\x0BDg\x0Bed\tq{\x04VG\bQ\x7F\x05ka\tVj\tkV\txB\nd|\np@\tQN\tPc\tps\x04]j\tkV\toU\bTp\nzU\x05nB\x0BB]\ta{\bV@\n]n\x04m`\tcz\tR{\x04m`\bQa\x0BwT\bSM\x05MY\x05qN\tdj\x05~s\x0BQ}\x05MY\x0BMB\tBv\twR\bRg\x0BQ}\tql\x0BKC\nrm\x05xu\x04CC\x0BwB\x0Bvh\tBq\x04Xq\npV\ti_\x05Ob\x05uE\nbd\nqo\x0B{i\nC~\tBL\x0BeE\x05uH\bVj\x04Ey\x04Gz\x0BzR\x0B{i\tcf\n{Z\n]n\x04XA\x0BGu\x0BnU\thS\x0BGI\nCc\tHE\bTA\tHB\x04BH\x04Cj\nCc\bTF\tHE\nXI\tA{\bQ\x7F\tc\\\x0BmO\x0BWX\nfH\np@\x05MY\bTF\nlK\tBt\nzU\tTT\x04Km\x0BwT\npV\ndt\x0ByI\tVx\tQ\x7F\tRg\tTd\nzU\bRS\nLM\twA\x04nM\tTn\ndS\t]g\nLc\x0BwB\t}t\t[I\tCP\x04kX\x0BFm\x0BhZ\x05m\x7F\ti[\np@\x0BQ}\x0BW\x7F\t|d\nMO\nMd\tf_\tfD\tcJ\tHz\x0BRb\tio\tPy\x04Y[\nxU\tct\x0B@@\tww\bPv\x04BM\x04FF\ntb\x05v|\x0BKm\tBq\tBq\x04Kh\x04`o\nZd\x04XU\ti]\t|`\tSt\x04B\\\bQ\x7F\x0B_W\tTJ\nqI\t|a\tA{\x0BuP\x04MD\tPl\nxR\tfL\x0Bws\tc{\td\\\bV`\neg\tHK\x05kc\nd|\bVV\ny\\\x05kc\ti]\bVG\t`V\tss\tI_\tAE\tbs\tdu\nel\tpD\x0BW\x7F\nqs\x05lv\bSM\x04Zi\x0BVK\x05ia\x0BQB\tQ\x7F\n{Z\bPt\x0BKl\nlK\nhs\ndS\bVK\x05mf\nd^\tkV\tcO\nc|\bVH\t\\]\bTv\bSq\tmI\x0BDg\tVJ\tcn\ny\\\bVg\bTv\nyX\bTF\t]]\bTp\noi\nhs\x0BeU\nBf\tdj\x05Mr\n|p\t\\g\t]r\bVb\x05{D\nd[\x04XN\tfM\tO\\\x05s_\tcf\tiZ\x04XN\x0BWc\tqv\n`m\tU^\x05oD\nd|\x0BGg\tdE\x0Bwf\x04lo\x04u}\nd|\x05oQ\t`i\x04Oi\x0BxD\ndZ\nCx\x04Yw\nzk\ntb\ngw\tyj\tB`\nyX\x0Bps\ntC\x0BpP\x0Bqw\bPu\bPX\tDm\npw\x05Nj\tss\taG\x0Bxs\bPt\noL\x04Gz\tOk\ti@\ti]\x04eC\tIQ\tii\tdj\x0B@J\t|d\x05uh\bWZ\x0BeU\x0BnU\bTa\tcC\x04g]\nzk\x04Yh\bVK\nLU\np@\ntb\ntR\tCj\x0BNP\ti@\bP{\n\\}\n{c\nwX\tfL\bVG\tc{\t|`\tAJ\t|C\tfD\x05ln\t|d\tbs\nqI\x05{B\x0BAx\np@\nzk\x0BRb\x05Os\x0BWS\x04e^\x0BD_\tBv\x0BWd\bVb\x0Bxs\x0BeE\bRw\n]n\n|p\x0Bg|\tfw\x05kc\bTI\x05ka\n\\T\x04Sp\tju\x0Bps\npe\x05u|\x0BGr\bVe\tCU\x04]M\x04XU\x0BxD\bTa\tIQ\x0BWq\tCU\tam\tdj\bSo\x04Sw\x0BnU\x04Ch\tQ]\x05s_\bPt\tfS\bTa\t\\}\n@O\x04Yc\tUZ\bTx\npe\x0BnU\nzU\t|}\tiD\nz\\\bSM\x0BxD\x04BR\nzQ\tQN\x04]M\x04Yh\nLP\x0BFm\x0BLX\x05vc\x0Bql\x05ka\tHK\bVb\ntC\nCy\bTv\nuV\x04oQ\t`z\t[I\tB`\x0BRb\tyj\tsb\x0BWs\bTl\tkV\x0Bed\ne\x7F\x05lL\x0BxN\t\x7Fm\nJn\tjY\x0BxD\bVb\bSq\x0Byu\twL\x0BXL\bTA\tpg\tAt\tnD\x04XX\twR\npl\nhw\x05yS\nps\tcO\bW[\x0B|j\x04XN\tsV\tp\\\tBe\nb~\nAJ\n]e\x05k`\x05qN\tdw\tWV\tHE\x0BEV\x05Jz\tid\tB`\tzh\x05E]\tfD\bTg\x05qN\bTa\tja\x04Cv\bSM\nhc\bUe\x05t_\tie\x04g]\twQ\nPn\bVB\tjw\bVg\x0BbE\tBZ\x0BRH\bP{\tjp\n\\}\ta_\tcC\t|a\x0BD]\tBZ\ti[\tfD\x0BxW\no_\td\\\n_D\ntb\t\\c\tAJ\nlK\x04oQ\x04lo\x0BLx\x0BM@\bWZ\x04Kn\x0Bpg\nTi\nIv\n|r\x0B@}\x05Jz\x05Lm\x05Wh\x05k}\x05ln\x0BxD\n]s\x04gc\x0Bps\tBr\bTW\x0BBM\x05tZ\nBY\x04DW\tjf\x0BSW\x04C}\nqo\tdE\tmv\tIQ\bPP\bUb\x05lv\x04BC\nzQ\t[I\x0Bgl\nig\bUs\x04BT\x0BbC\bSq\tsU\tiW\nJn\tSY\tHK\trg\npV\x0BID\x0B|j\x04KO\t`S\t|a`vbmglfmujbqnbgqjgavp`bqjmj`jlwjfnslslqrvf`vfmwbfpwbglsvfgfmivfdlp`lmwqbfpw/Mmmlnaqfwjfmfmsfqejonbmfqbbnjdlp`jvgbg`fmwqlbvmrvfsvfgfpgfmwqlsqjnfqsqf`jlpfd/Vmavfmlpuloufqsvmwlppfnbmbkba/Abbdlpwlmvfulpvmjglp`bqolpfrvjslmj/]lpnv`klpbodvmb`lqqfljnbdfmsbqwjqbqqjabnbq/Abklnaqffnsoflufqgbg`bnajlnv`kbpevfqlmsbpbglo/Amfbsbqf`fmvfubp`vqplpfpwbabrvjfqlojaqlp`vbmwlb``fplnjdvfoubqjlp`vbwqlwjfmfpdqvslppfq/Mmfvqlsbnfgjlpeqfmwfb`fq`bgfn/Mplefqwb`l`kfpnlgfoljwbojbofwqbpbod/Vm`lnsqb`vbofpf{jpwf`vfqslpjfmglsqfmpboofdbqujbifpgjmfqlnvq`jbslgq/Msvfpwlgjbqjlsvfaolrvjfqfnbmvfosqlsjl`qjpjp`jfqwlpfdvqlnvfqwfevfmwf`fqqbqdqbmgffef`wlsbqwfpnfgjgbsqlsjbleqf`fwjfqqbf.nbjoubqjbpelqnbpevwvqllaifwlpfdvjqqjfpdlmlqnbpnjpnlp/Vmj`l`bnjmlpjwjlpqby/_mgfajglsqvfabwlofglwfm/Abifp/Vpfpsfql`l`jmblqjdfmwjfmgb`jfmwl`/Mgjykbaobqpfq/Abobwjmbevfqybfpwjoldvfqqbfmwqbq/E{jwlo/_sfybdfmgbu/Agflfujwbqsbdjmbnfwqlpibujfqsbgqfpe/M`jo`bafyb/Mqfbppbojgbfmu/Alibs/_mbavplpajfmfpwf{wlpoofubqsvfgbmevfqwf`ln/Vm`obpfpkvnbmlwfmjglajoablvmjgbgfpw/Mpfgjwbq`qfbgl<X<W=c=k=n<R<V<\\<V<T<W<T=a=n<R<^=m<Y<Y<_<R<S=l<T=n<\\<V<Y=e<Y=o<Z<Y<v<\\<V<]<Y<[<]=g<W<R<Q<T<~=m<Y<S<R<X<A=n<R=n<R<P=k<Y<P<Q<Y=n<W<Y=n=l<\\<[<R<Q<\\<_<X<Y<P<Q<Y<x<W=c<s=l<T<Q<\\=m<Q<T=i=n<Y<P<V=n<R<_<R<X<^<R=n=n<\\<P<M<D<|<P<\\=c<K=n<R<^<\\=m<^<\\<P<Y<P=o<N<\\<V<X<^<\\<Q<\\<P=a=n<T=a=n=o<~<\\<P=n<Y=i<S=l<R=n=o=n<Q<\\<X<X<Q=c<~<R=n=n=l<T<Q<Y<U<~<\\=m<Q<T<P=m<\\<P=n<R=n=l=o<]<r<Q<T<P<T=l<Q<Y<Y<r<r<r<W<T=j=a=n<\\<r<Q<\\<Q<Y<P<X<R<P<P<R<U<X<^<Y<R<Q<R=m=o<X\fHy\fIk\fHU\fId\fHy\fIl\fHT\fIk\fHy\fHR\fHy\fIg\fHx\fH\\\fHF\fH\\\fHD\fIk\fHc\fHy\fHy\fHS\fHA\fIl\fHk\fHT\fHy\fH\\\fHH\fIg\fHU\fIg\fHj\fHF\fHU\fIl\fHC\fHU\fHC\fHR\fHH\fHy\fHI\fHRibdqbm\fHj\fHp\fHp\fIg\fHi\fH@\fHJ\fIg\fH{\fHd\fHp\fHR\fH{\fHc\fHU\fHB\fHk\fHD\fHY\fHU\fHC\fIk\fHI\fIk\fHI\fIl\fHt\fH\\\fHp\fH@\fHJ\fIl\fHy\fHd\fHp\fIl\fHY\fIk\fHD\fHd\fHD\fHc\fHU\fH\\\fHe\fHT\fHB\fIk\fHy\fHB\fHY\fIg\fH^\fIk\fHT\fH@\fHB\fHd\fHJ\fIk\fH\x7F\fH\\\fHj\fHB\fH@\fHT\fHA\fH\\\fH@\fHD\fHv\fH^\fHB\fHD\fHj\fH{\fHT\fIl\fH^\fIl4U5h5e4I5h5e5k4\\4K4N4B4]4U4C4C4K5h5e5k4\\5k4Y5d4]4V5f4]5o4K5j5d5h4K4D5f5j4U4]4Z4\\5h5o5k5j4K5f5d5i5n4K5h4U5h5f4K5j4K5h5o5j4A4F5e5n4D5h5d4A4E4K4B4]5m5n4[4U4D4C4]5o5j4I4\\4K5o5i4K4K4A4C4I5h4K5m5f5k4D4U4Z5o5f5m4D4A4G5d5i5j5d5k5d4O5j4K4@4C4K5h5k4K4_5h5i4U5j4C5h5f4_4U4D4]4Y5h5e5i5j4\\4D5k4K4O5j5k5i4G5h5o5j4F4K5h4K4A5f4G5i4Y4]4X4]4A4A5d5h5d5m5f4K4\\4K5h5o5h5i4]4E4K5j4F4K5h5m4O4D5d4B4K4Y4O5j4F4K5j5k4K5h5f4U4Z5d5d5n4C4K4D5j4B5f4]4D5j4F5h5o5i4X4K4M5d5k5f4K4D5d5n4Y4Y5d5i4K4]5n5i4O4A4C5j4A5j4U4C5i4]4O5f4K4A4E5o4F4D4C5d5j5f4@4D5i5j5k4F4A4F4@5k4E4_5j4E5f4F5i5o4]4E4V4^4E5j5m4_4D5f4F5h5h5k5h5j4K4F5h5o5n5h4D5h5i4K4U5j5k4O5d5h4X5f4M5j5d4]4O5i4K5m5f5o4D5o5h4\\4K4F4]4F4D4D4O5j5k5i4_4K5j5o4D5f4U5m5n4C4A4_5j5h5k5i4X4U4]4O5k5h4X5k4]5n4[4]4[5h4Dsqlejofpfquj`fgfebvowkjnpfoegfwbjop`lmwfmwpvsslqwpwbqwfgnfppbdfpv``fppebpkjlm?wjwof=`lvmwqzb``lvmw`qfbwfgpwlqjfpqfpvowpqvmmjmdsql`fpptqjwjmdlaif`wpujpjaoftfo`lnfbqwj`ofvmhmltmmfwtlqh`lnsbmzgzmbnj`aqltpfqsqjub`zsqlaofnPfquj`fqfpsf`wgjpsobzqfrvfpwqfpfquftfapjwfkjpwlqzeqjfmgplswjlmptlqhjmdufqpjlmnjoojlm`kbmmfotjmglt-bggqfppujpjwfgtfbwkfq`lqqf`wsqlgv`wfgjqf`welqtbqgzlv#`bmqfnlufgpvaif`w`lmwqlobq`kjuf`vqqfmwqfbgjmdojaqbqzojnjwfgnbmbdfqevqwkfqpvnnbqznb`kjmfnjmvwfpsqjubwf`lmwf{wsqldqbnpl`jfwzmvnafqptqjwwfmfmbaofgwqjddfqplvq`fpolbgjmdfofnfmwsbqwmfqejmboozsfqef`wnfbmjmdpzpwfnphffsjmd`vowvqf%rvlw8/ilvqmbosqlif`wpvqeb`fp%rvlw8f{sjqfpqfujftpabobm`fFmdojpk@lmwfmwwkqlvdkSofbpf#lsjmjlm`lmwb`wbufqbdfsqjnbqzujoobdfPsbmjpkdboofqzgf`ojmfnffwjmdnjppjlmslsvobqrvbojwznfbpvqfdfmfqbopsf`jfppfppjlmpf`wjlmtqjwfqp`lvmwfqjmjwjboqfslqwpejdvqfpnfnafqpklogjmdgjpsvwffbqojfqf{sqfppgjdjwbosj`wvqfBmlwkfqnbqqjfgwqbeej`ofbgjmd`kbmdfg`fmwqbouj`wlqzjnbdfp,qfbplmppwvgjfpefbwvqfojpwjmdnvpw#afp`kllopUfqpjlmvpvboozfsjplgfsobzjmddqltjmdlaujlvplufqobzsqfpfmwb`wjlmp?,vo=\x0E\ttqbssfqboqfbgz`fqwbjmqfbojwzpwlqbdfbmlwkfqgfphwlsleefqfgsbwwfqmvmvpvboGjdjwbo`bsjwboTfapjwfebjovqf`lmmf`wqfgv`fgBmgqljggf`bgfpqfdvobq#%bns8#bmjnbopqfofbpfBvwlnbwdfwwjmdnfwklgpmlwkjmdSlsvobq`bswjlmofwwfqp`bswvqfp`jfm`foj`fmpf`kbmdfpFmdobmg>2%bns8Kjpwlqz#>#mft#@fmwqbovsgbwfgPsf`jboMfwtlqhqfrvjqf`lnnfmwtbqmjmd@loofdfwlloabqqfnbjmpaf`bvpffof`wfgGfvwp`kejmbm`ftlqhfqprvj`hozafwtffmf{b`wozpfwwjmdgjpfbpfPl`jfwztfbslmpf{kjajw%ow8\"..@lmwqlo`obppfp`lufqfglvwojmfbwwb`hpgfuj`fp+tjmgltsvqslpfwjwof>!Nlajof#hjoojmdpkltjmdJwbojbmgqlssfgkfbujozfeef`wp.2$^*8\t`lmejqn@vqqfmwbgubm`fpkbqjmdlsfmjmdgqbtjmdajoojlmlqgfqfgDfqnbmzqfobwfg?,elqn=jm`ovgftkfwkfqgfejmfgP`jfm`f`bwboldBqwj`ofavwwlmpobqdfpwvmjelqnilvqmfzpjgfabq@kj`bdlklojgbzDfmfqbosbppbdf/%rvlw8bmjnbwfeffojmdbqqjufgsbppjmdmbwvqboqlvdkoz-\t\tWkf#avw#mlwgfmpjwzAqjwbjm@kjmfpfob`h#lewqjavwfJqfobmg!#gbwb.eb`wlqpqf`fjufwkbw#jpOjaqbqzkvpabmgjm#eb`wbeebjqp@kbqofpqbgj`boaqlvdkwejmgjmdobmgjmd9obmd>!qfwvqm#ofbgfqpsobmmfgsqfnjvnsb`hbdfBnfqj`bFgjwjlm^%rvlw8Nfppbdfmffg#wlubovf>!`lnsof{ollhjmdpwbwjlmafojfufpnboofq.nlajofqf`lqgptbmw#wlhjmg#leEjqfel{zlv#bqfpjnjobqpwvgjfgnb{jnvnkfbgjmdqbsjgoz`ojnbwfhjmdglnfnfqdfgbnlvmwpelvmgfgsjlmffqelqnvobgzmbpwzklt#wl#Pvsslqwqfufmvff`lmlnzQfpvowpaqlwkfqplogjfqobqdfoz`boojmd-%rvlw8B``lvmwFgtbqg#pfdnfmwQlafqw#feelqwpSb`jej`ofbqmfgvs#tjwkkfjdkw9tf#kbufBmdfofpmbwjlmp\\pfbq`kbssojfgb`rvjqfnbppjufdqbmwfg9#ebopfwqfbwfgajddfpwafmfejwgqjujmdPwvgjfpnjmjnvnsfqkbspnlqmjmdpfoojmdjp#vpfgqfufqpfubqjbmw#qlof>!njppjmdb`kjfufsqlnlwfpwvgfmwplnflmff{wqfnfqfpwlqfalwwln9fuloufgboo#wkfpjwfnbsfmdojpktbz#wl##Bvdvpwpznalop@lnsbmznbwwfqpnvpj`bobdbjmpwpfqujmd~*+*8\x0E\tsbznfmwwqlvaof`lm`fsw`lnsbqfsbqfmwpsobzfqpqfdjlmpnlmjwlq#$$Wkf#tjmmjmdf{solqfbgbswfgDboofqzsqlgv`fbajojwzfmkbm`f`bqffqp*-#Wkf#`loof`wPfbq`k#bm`jfmwf{jpwfgellwfq#kbmgofqsqjmwfg`lmplofFbpwfqmf{slqwptjmgltp@kbmmfojoofdbomfvwqbopvddfpw\\kfbgfqpjdmjmd-kwno!=pfwwofgtfpwfqm`bvpjmd.tfahjw`objnfgIvpwj`f`kbswfquj`wjnpWklnbp#nlyjoobsqlnjpfsbqwjfpfgjwjlmlvwpjgf9ebopf/kvmgqfgLoznsj`\\avwwlmbvwklqpqfb`kfg`kqlmj`gfnbmgppf`lmgpsqlwf`wbglswfgsqfsbqfmfjwkfqdqfbwozdqfbwfqlufqboojnsqluf`lnnbmgpsf`jbopfbq`k-tlqpkjsevmgjmdwklvdkwkjdkfpwjmpwfbgvwjojwzrvbqwfq@vowvqfwfpwjmd`ofbqozf{slpfgAqltpfqojafqbo~#`bw`kSqlif`wf{bnsofkjgf+*8EolqjgbbmptfqpbooltfgFnsfqlqgfefmpfpfqjlvpeqffglnPfufqbo.avwwlmEvqwkfqlvw#le#\">#mvoowqbjmfgGfmnbqhuljg+3*,boo-ipsqfufmwQfrvfpwPwfskfm\t\tTkfm#lapfquf?,k1=\x0E\tNlgfqm#sqlujgf!#bow>!alqgfqp-\t\tElq#\t\tNbmz#bqwjpwpsltfqfgsfqelqnej`wjlmwzsf#lenfgj`bowj`hfwplsslpfg@lvm`jotjwmfppivpwj`fDflqdf#Afodjvn---?,b=wtjwwfqmlwbaoztbjwjmdtbqebqf#Lwkfq#qbmhjmdskqbpfpnfmwjlmpvqujufp`klobq?,s=\x0E\t#@lvmwqzjdmlqfgolpp#leivpw#bpDflqdjbpwqbmdf?kfbg=?pwlssfg2$^*8\x0E\tjpobmgpmlwbaofalqgfq9ojpw#le`bqqjfg233/333?,k0=\t#pfufqboaf`lnfppfof`w#tfggjmd33-kwnonlmbq`klee#wkfwfb`kfqkjdkoz#ajloldzojef#lelq#fufmqjpf#le%qbrvl8sovplmfkvmwjmd+wklvdkGlvdobpiljmjmd`jq`ofpElq#wkfBm`jfmwUjfwmbnufkj`ofpv`k#bp`qzpwboubovf#>Tjmgltpfmilzfgb#pnboobppvnfg?b#jg>!elqfjdm#Boo#qjklt#wkfGjpsobzqfwjqfgkltfufqkjggfm8abwwofppffhjmd`bajmfwtbp#mlwollh#bw`lmgv`wdfw#wkfIbmvbqzkbssfmpwvqmjmdb9klufqLmojmf#Eqfm`k#ob`hjmdwzsj`bof{wqb`wfmfnjfpfufm#jedfmfqbwgf`jgfgbqf#mlw,pfbq`kafojfep.jnbdf9ol`bwfgpwbwj`-oldjm!=`lmufqwujlofmwfmwfqfgejqpw!=`jq`vjwEjmobmg`kfnjpwpkf#tbp23s{8!=bp#pv`kgjujgfg?,psbm=tjoo#afojmf#leb#dqfbwnzpwfqz,jmgf{-eboojmdgvf#wl#qbjotbz`loofdfnlmpwfqgfp`fmwjw#tjwkmv`ofbqIftjpk#sqlwfpwAqjwjpkeoltfqpsqfgj`wqfelqnpavwwlm#tkl#tbpof`wvqfjmpwbmwpvj`jgfdfmfqj`sfqjlgpnbqhfwpPl`jbo#ejpkjmd`lnajmfdqbskj`tjmmfqp?aq#,=?az#wkf#MbwvqboSqjub`z`llhjfplvw`lnfqfploufPtfgjpkaqjfeozSfqpjbmpl#nv`k@fmwvqzgfsj`wp`lovnmpklvpjmdp`qjswpmf{w#wlafbqjmdnbssjmdqfujpfgiRvfqz+.tjgwk9wjwof!=wllowjsPf`wjlmgfpjdmpWvqhjpkzlvmdfq-nbw`k+~*+*8\t\tavqmjmdlsfqbwfgfdqffpplvq`f>Qj`kbqg`olpfozsobpwj`fmwqjfp?,wq=\x0E\t`lolq9 vo#jg>!slppfppqloojmdskzpj`pebjojmdf{f`vwf`lmwfpwojmh#wlGfebvow?aq#,=\t9#wqvf/`kbqwfqwlvqjpn`obppj`sql`ffgf{sobjm?,k2=\x0E\tlmojmf-<{no#ufkfosjmdgjbnlmgvpf#wkfbjqojmffmg#..=*-bwwq+qfbgfqpklpwjmd eeeeeeqfbojyfUjm`fmwpjdmbop#pq`>!,Sqlgv`wgfpsjwfgjufqpfwfoojmdSvaoj`#kfog#jmIlpfsk#wkfbwqfbeef`wp?pwzof=b#obqdfglfpm$wobwfq/#Fofnfmwebuj`lm`qfbwlqKvmdbqzBjqslqwpff#wkfpl#wkbwNj`kbfoPzpwfnpSqldqbnp/#bmg##tjgwk>f%rvlw8wqbgjmdofew!=\tsfqplmpDlogfm#Beebjqpdqbnnbqelqnjmdgfpwqlzjgfb#le`bpf#lelogfpw#wkjp#jp-pq`#>#`bqwllmqfdjpwq@lnnlmpNvpojnpTkbw#jpjm#nbmznbqhjmdqfufbopJmgffg/frvbooz,pklt\\blvwgllqfp`bsf+Bvpwqjbdfmfwj`pzpwfn/Jm#wkf#pjwwjmdKf#boplJpobmgpB`bgfnz\t\n\n?\"..Gbmjfo#ajmgjmdaol`h!=jnslpfgvwjojyfBaqbkbn+f{`fswxtjgwk9svwwjmd*-kwno+\x7F\x7F#X^8\tGBWBX#)hjw`kfmnlvmwfgb`wvbo#gjbof`wnbjmoz#\\aobmh$jmpwboof{sfqwpje+wzsfJw#bopl%`lsz8#!=Wfqnpalqm#jmLswjlmpfbpwfqmwbohjmd`lm`fqmdbjmfg#lmdljmdivpwjez`qjwj`peb`wlqzjwp#ltmbppbvowjmujwfgobpwjmdkjp#ltmkqfe>!,!#qfo>!gfufols`lm`fqwgjbdqbngloobqp`ovpwfqsks<jg>bo`lklo*8~*+*8vpjmd#b=?psbm=ufppfopqfujuboBggqfppbnbwfvqbmgqljgboofdfgjoomfpptbohjmd`fmwfqprvbojeznbw`kfpvmjejfgf{wjm`wGfefmpfgjfg#jm\t\n?\"..#`vpwlnpojmhjmdOjwwof#Allh#lefufmjmdnjm-ip<bqf#wkfhlmwbhwwlgbz$p-kwno!#wbqdfw>tfbqjmdBoo#Qjd8\t~*+*8qbjpjmd#Bopl/#`qv`jbobalvw!=gf`obqf..=\t?p`ejqfel{bp#nv`kbssojfpjmgf{/#p/#avw#wzsf#>#\t\x0E\t?\"..wltbqgpQf`lqgpSqjubwfElqfjdmSqfnjfq`klj`fpUjqwvboqfwvqmp@lnnfmwSltfqfgjmojmf8slufqwz`kbnafqOjujmd#ulovnfpBmwklmzoldjm!#QfobwfgF`lmlnzqfb`kfp`vwwjmddqbujwzojef#[email protected]?,wg=\x0E\t#qfwvqmpwbgjvntjgdfwpubqzjmdwqbufopkfog#aztkl#bqftlqh#jmeb`vowzbmdvobqtkl#kbgbjqslqwwltm#le\t\tPlnf#$`oj`h$`kbqdfphfztlqgjw#tjoo`jwz#le+wkjp*8Bmgqft#vmjrvf#`kf`hfglq#nlqf033s{8#qfwvqm8qpjlm>!sovdjmptjwkjm#kfqpfoePwbwjlmEfgfqboufmwvqfsvaojpkpfmw#wlwfmpjlmb`wqfpp`lnf#wlejmdfqpGvhf#lesflsof/f{soljwtkbw#jpkbqnlmzb#nbilq!9!kwwsjm#kjp#nfmv!=\tnlmwkozleej`fq`lvm`jodbjmjmdfufm#jmPvnnbqzgbwf#leolzbowzejwmfppbmg#tbpfnsfqlqpvsqfnfPf`lmg#kfbqjmdQvppjbmolmdfpwBoafqwbobwfqbopfw#le#pnboo!=-bssfmggl#tjwkefgfqboabmh#leafmfbwkGfpsjwf@bsjwbodqlvmgp*/#bmg#sfq`fmwjw#eqln`olpjmd`lmwbjmJmpwfbgejewffmbp#tfoo-zbkll-qfpslmgejdkwfqlap`vqfqfeof`wlqdbmj`>#Nbwk-fgjwjmdlmojmf#sbggjmdb#tkloflmfqqlqzfbq#lefmg#le#abqqjfqtkfm#jwkfbgfq#klnf#leqfpvnfgqfmbnfgpwqlmd=kfbwjmdqfwbjmp`olvgeqtbz#le#Nbq`k#2hmltjmdjm#sbqwAfwtffmofpplmp`olpfpwujqwvboojmhp!=`qlppfgFMG#..=ebnlvp#btbqgfgOj`fmpfKfbowk#ebjqoz#tfbowkznjmjnboBeqj`bm`lnsfwfobafo!=pjmdjmdebqnfqpAqbpjo*gjp`vppqfsob`fDqfdlqzelmw#`lsvqpvfgbssfbqpnbhf#vsqlvmgfgalwk#leaol`hfgpbt#wkfleej`fp`lolvqpje+gl`vtkfm#kffmelq`fsvpk+evBvdvpw#VWE.;!=Ebmwbpzjm#nlpwjmivqfgVpvboozebqnjmd`olpvqflaif`w#gfefm`fvpf#le#Nfgj`bo?algz=\tfujgfmwaf#vpfghfz@lgfpj{wffmJpobnj` 333333fmwjqf#tjgfoz#b`wjuf#+wzsflelmf#`bm`lolq#>psfbhfqf{wfmgpSkzpj`pwfqqbjm?walgz=evmfqboujftjmdnjggof#`qj`hfwsqlskfwpkjewfggl`wlqpQvppfoo#wbqdfw`lnsb`wbodfaqbpl`jbo.avoh#lenbm#bmg?,wg=\t#kf#ofew*-ubo+*ebopf*8oldj`boabmhjmdklnf#wlmbnjmd#Bqjylmb`qfgjwp*8\t~*8\telvmgfqjm#wvqm@loojmpafelqf#Avw#wkf`kbqdfgWjwof!=@bswbjmpsfoofgdlggfppWbd#..=Bggjmd9avw#tbpQf`fmw#sbwjfmwab`h#jm>ebopf%Ojm`lomtf#hmlt@lvmwfqIvgbjpnp`qjsw#bowfqfg$^*8\t##kbp#wkfvm`ofbqFufmw$/alwk#jmmlw#boo\t\t?\"..#sob`jmdkbqg#wl#`fmwfqplqw#le`ojfmwppwqffwpAfqmbqgbppfqwpwfmg#wlebmwbpzgltm#jmkbqalvqEqffglniftfoqz,balvw--pfbq`kofdfmgpjp#nbgfnlgfqm#lmoz#lmlmoz#wljnbdf!#ojmfbq#sbjmwfqbmg#mlwqbqfoz#b`qlmzngfojufqpklqwfq33%bns8bp#nbmztjgwk>!,)#?\"X@wjwof#>le#wkf#oltfpw#sj`hfg#fp`bsfgvpfp#lesflsofp#Svaoj`Nbwwkftwb`wj`pgbnbdfgtbz#elqobtp#lefbpz#wl#tjmgltpwqlmd##pjnsof~`bw`k+pfufmwkjmelal{tfmw#wlsbjmwfg`jwjyfmJ#glm$wqfwqfbw-#Plnf#tt-!*8\talnajmdnbjowl9nbgf#jm-#Nbmz#`bqqjfp\x7F\x7Fx~8tjtlqh#lepzmlmzngfefbwpebulqfglswj`bosbdfWqbvmofpp#pfmgjmdofew!=?`lnP`lqBoo#wkfiRvfqz-wlvqjpw@obppj`ebopf!#Tjokfonpvavqapdfmvjmfajpklsp-psojw+dolabo#elooltpalgz#lemlnjmbo@lmwb`wpf`vobqofew#wl`kjfeoz.kjggfm.abmmfq?,oj=\t\t-#Tkfm#jm#alwkgjpnjppF{solqfbotbzp#ujb#wkfpsb/]lotfoebqfqvojmd#bqqbmdf`bswbjmkjp#plmqvof#lekf#wllhjwpfoe/>3%bns8+`boofgpbnsofpwl#nbhf`ln,sbdNbqwjm#Hfmmfgzb``fswpevoo#lekbmgofgAfpjgfp,,..=?,baof#wlwbqdfwpfppfm`fkjn#wl#jwp#az#`lnnlm-njmfqbowl#wbhftbzp#wlp-lqd,obgujpfgsfmbowzpjnsof9je#wkfzOfwwfqpb#pklqwKfqafqwpwqjhfp#dqlvsp-ofmdwkeojdkwplufqobspoltoz#ofppfq#pl`jbo#?,s=\t\n\njw#jmwlqbmhfg#qbwf#levo=\x0E\t##bwwfnswsbjq#lenbhf#jwHlmwbhwBmwlmjlkbujmd#qbwjmdp#b`wjufpwqfbnpwqbssfg!*-`pp+klpwjofofbg#wlojwwof#dqlvsp/Sj`wvqf..=\x0E\t\x0E\t#qltp>!#laif`wjmufqpf?ellwfq@vpwlnU=?_,p`qploujmd@kbnafqpobufqztlvmgfgtkfqfbp\">#$vmgelq#boosbqwoz#.qjdkw9Bqbajbmab`hfg#`fmwvqzvmjw#lenlajof.Fvqlsf/jp#klnfqjph#legfpjqfg@ojmwlm`lpw#lebdf#le#af`lnf#mlmf#les%rvlw8Njggof#fbg$*X3@qjwj`ppwvgjlp=%`lsz8dqlvs!=bppfnaonbhjmd#sqfppfgtjgdfw-sp9!#<#qfavjowaz#plnfElqnfq#fgjwlqpgfobzfg@bmlmj`kbg#wkfsvpkjmd`obpp>!avw#bqfsbqwjboAbazolmalwwln#`bqqjfq@lnnbmgjwp#vpfBp#tjwk`lvqpfpb#wkjqggfmlwfpbopl#jmKlvpwlm13s{8!=b``vpfgglvaof#dlbo#leEbnlvp#*-ajmg+sqjfpwp#Lmojmfjm#Ivozpw#(#!d`lmpvowgf`jnbokfosevoqfujufgjp#ufqzq$($jswolpjmd#efnbofpjp#boplpwqjmdpgbzp#lebqqjuboevwvqf#?laif`welq`jmdPwqjmd+!#,=\t\n\nkfqf#jpfm`lgfg-##Wkf#aboollmglmf#az,`lnnlmad`lolqobt#le#Jmgjbmbbuljgfgavw#wkf1s{#0s{irvfqz-bewfq#bsloj`z-nfm#bmgellwfq.>#wqvf8elq#vpfp`qffm-Jmgjbm#jnbdf#>ebnjoz/kwws9,,#%maps8gqjufqpfwfqmbopbnf#bpmlwj`fgujftfqp~*+*8\t#jp#nlqfpfbplmpelqnfq#wkf#mftjp#ivpw`lmpfmw#Pfbq`ktbp#wkftkz#wkfpkjssfgaq=?aq=tjgwk9#kfjdkw>nbgf#le`vjpjmfjp#wkbwb#ufqz#Bgnjqbo#ej{fg8mlqnbo#NjppjlmSqfpp/#lmwbqjl`kbqpfwwqz#wl#jmubgfg>!wqvf!psb`jmdjp#nlpwb#nlqf#wlwboozeboo#le~*8\x0E\t##jnnfmpfwjnf#jmpfw#lvwpbwjpezwl#ejmggltm#wlolw#le#Sobzfqpjm#Ivmfrvbmwvnmlw#wkfwjnf#wlgjpwbmwEjmmjpkpq`#>#+pjmdof#kfos#leDfqnbm#obt#bmgobafofgelqfpwp`llhjmdpsb`f!=kfbgfq.tfoo#bpPwbmofzaqjgdfp,dolabo@qlbwjb#Balvw#X3^8\t##jw/#bmgdqlvsfgafjmd#b*xwkqltkf#nbgfojdkwfqfwkj`boEEEEEE!alwwln!ojhf#b#fnsolzpojuf#jmbp#pffmsqjmwfqnlpw#leva.ojmhqfif`wpbmg#vpfjnbdf!=pv``ffgeffgjmdMv`ofbqjmelqnbwl#kfosTlnfm$pMfjwkfqNf{j`bmsqlwfjm?wbaof#az#nbmzkfbowkzobtpvjwgfujpfg-svpk+xpfoofqppjnsoz#Wkqlvdk-`llhjf#Jnbdf+logfq!=vp-ip!=#Pjm`f#vmjufqpobqdfq#lsfm#wl\"..#fmgojfp#jm$^*8\x0E\t##nbqhfwtkl#jp#+!GLN@lnbmbdfglmf#elqwzsfle#Hjmdglnsqlejwpsqlslpfwl#pklt`fmwfq8nbgf#jwgqfppfgtfqf#jmnj{wvqfsqf`jpfbqjpjmdpq`#>#$nbhf#b#pf`vqfgAbswjpwulwjmd#\t\n\nubq#Nbq`k#1dqft#vs@ojnbwf-qfnlufphjoofgtbz#wkf?,kfbg=eb`f#leb`wjmd#qjdkw!=wl#tlqhqfgv`fpkbp#kbgfqf`wfgpklt+*8b`wjlm>allh#lebm#bqfb>>#!kww?kfbgfq\t?kwno=`lmelqneb`jmd#`llhjf-qfoz#lmklpwfg#-`vpwlnkf#tfmwavw#elqpsqfbg#Ebnjoz#b#nfbmplvw#wkfelqvnp-ellwbdf!=Nlajo@ofnfmwp!#jg>!bp#kjdkjmwfmpf..=?\"..efnbof#jp#pffmjnsojfgpfw#wkfb#pwbwfbmg#kjpebpwfpwafpjgfpavwwlm\\alvmgfg!=?jnd#Jmelal{fufmwp/b#zlvmdbmg#bqfMbwjuf#`kfbsfqWjnflvwbmg#kbpfmdjmfptlm#wkf+nlpwozqjdkw9#ejmg#b#.alwwlnSqjm`f#bqfb#lenlqf#lepfbq`k\\mbwvqf/ofdboozsfqjlg/obmg#lelq#tjwkjmgv`fgsqlujmdnjppjofol`boozBdbjmpwwkf#tbzh%rvlw8s{8!=\x0E\tsvpkfg#babmglmmvnfqbo@fqwbjmJm#wkjpnlqf#jmlq#plnfmbnf#jpbmg/#jm`qltmfgJPAM#3.`qfbwfpL`wlafqnbz#mlw`fmwfq#obwf#jmGfefm`ffmb`wfgtjpk#wlaqlbgoz`llojmdlmolbg>jw-#Wkfqf`lufqNfnafqpkfjdkw#bppvnfp?kwno=\tsflsof-jm#lmf#>tjmgltellwfq\\b#dllg#qfhobnblwkfqp/wl#wkjp\\`llhjfsbmfo!=Olmglm/gfejmfp`qvpkfgabswjpn`lbpwbopwbwvp#wjwof!#nluf#wlolpw#jmafwwfq#jnsojfpqjuboqzpfqufqp#PzpwfnSfqkbspfp#bmg#`lmwfmgeoltjmdobpwfg#qjpf#jmDfmfpjpujft#leqjpjmd#pffn#wlavw#jm#ab`hjmdkf#tjoodjufm#bdjujmd#`jwjfp-eolt#le#Obwfq#boo#avwKjdktbzlmoz#azpjdm#lekf#glfpgjeefqpabwwfqz%bns8obpjmdofpwkqfbwpjmwfdfqwbhf#lmqfevpfg`boofg#>VP%bnsPff#wkfmbwjufpaz#wkjppzpwfn-kfbg#le9klufq/ofpajbmpvqmbnfbmg#boo`lnnlm,kfbgfq\\\\sbqbnpKbqubqg,sj{fo-qfnlubopl#olmdqlof#leiljmwozphzp`qbVmj`lgfaq#,=\x0E\tBwobmwbmv`ofvp@lvmwz/svqfoz#`lvmw!=fbpjoz#avjog#blm`oj`hb#djufmsljmwfqk%rvlw8fufmwp#fopf#x\tgjwjlmpmlt#wkf/#tjwk#nbm#tkllqd,Tfalmf#bmg`buboqzKf#gjfgpfbwwof33/333#xtjmgltkbuf#wlje+tjmgbmg#jwpplofoz#n%rvlw8qfmftfgGfwqljwbnlmdpwfjwkfq#wkfn#jmPfmbwlqVp?,b=?Hjmd#leEqbm`jp.sqlgv`kf#vpfgbqw#bmgkjn#bmgvpfg#azp`lqjmdbw#klnfwl#kbufqfobwfpjajojwzeb`wjlmAveebolojmh!=?tkbw#kfeqff#wl@jwz#le`lnf#jmpf`wlqp`lvmwfglmf#gbzmfqulvpprvbqf#~8je+dljm#tkbwjnd!#bojp#lmozpfbq`k,wvfpgbzollpfozPlolnlmpf{vbo#.#?b#kqnfgjvn!GL#MLW#Eqbm`f/tjwk#b#tbq#bmgpf`lmg#wbhf#b#=\x0E\t\x0E\t\x0E\tnbqhfw-kjdktbzglmf#jm`wjujwz!obpw!=laojdfgqjpf#wl!vmgfejnbgf#wl#Fbqoz#sqbjpfgjm#jwp#elq#kjpbwkofwfIvsjwfqZbkll\"#wfqnfg#pl#nbmzqfbooz#p-#Wkf#b#tlnbm<ubovf>gjqf`w#qjdkw!#aj`z`ofb`jmd>!gbz#bmgpwbwjmdQbwkfq/kjdkfq#Leej`f#bqf#mltwjnfp/#tkfm#b#sbz#elqlm#wkjp.ojmh!=8alqgfqbqlvmg#bmmvbo#wkf#Mftsvw#wkf-`ln!#wbhjm#wlb#aqjfe+jm#wkfdqlvsp-8#tjgwkfmyznfppjnsof#jm#obwfxqfwvqmwkfqbszb#sljmwabmmjmdjmhp!=\t+*8!#qfb#sob`f_v330@bbalvw#bwq=\x0E\t\n\n``lvmw#djufp#b?P@QJSWQbjotbzwkfnfp,wlloal{AzJg+!{kvnbmp/tbw`kfpjm#plnf#je#+tj`lnjmd#elqnbwp#Vmgfq#avw#kbpkbmgfg#nbgf#azwkbm#jmefbq#legfmlwfg,jeqbnfofew#jmulowbdfjm#fb`kb%rvlw8abpf#leJm#nbmzvmgfqdlqfdjnfpb`wjlm#?,s=\x0E\t?vpwlnUb8%dw8?,jnslqwplq#wkbwnlpwoz#%bns8qf#pjyf>!?,b=?,kb#`obppsbppjufKlpw#>#TkfwkfqefqwjofUbqjlvp>X^8+ev`bnfqbp,=?,wg=b`wp#bpJm#plnf=\x0E\t\x0E\t?\"lqdbmjp#?aq#,=Afjijmd`bwbo/Lgfvwp`kfvqlsfvfvphbqbdbfjodfpufmphbfpsb/]bnfmpbifvpvbqjlwqbabiln/E{j`ls/Mdjmbpjfnsqfpjpwfnbl`wvaqfgvqbmwfb/]bgjqfnsqfpbnlnfmwlmvfpwqlsqjnfqbwqbu/Epdqb`jbpmvfpwqbsql`fplfpwbglp`bojgbgsfqplmbm/Vnfqlb`vfqgln/Vpj`bnjfnaqllefqwbpbodvmlpsb/Apfpfifnsolgfqf`klbgfn/Mpsqjubglbdqfdbqfmob`fpslpjaofklwfofppfujoobsqjnfql/Vowjnlfufmwlpbq`kjul`vowvqbnvifqfpfmwqbgbbmvm`jlfnabqdlnfq`bgldqbmgfpfpwvgjlnfilqfpefaqfqlgjpf/]lwvqjpnl`/_gjdlslqwbgbfpsb`jlebnjojbbmwlmjlsfqnjwfdvbqgbqbodvmbpsqf`jlpbodvjfmpfmwjglujpjwbpw/Awvol`lml`fqpfdvmgl`lmpfileqbm`jbnjmvwlppfdvmgbwfmfnlpfef`wlpn/Mobdbpfpj/_mqfujpwbdqbmbgb`lnsqbqjmdqfpldbq`/Abb``j/_mf`vbglqrvjfmfpjm`ovplgfafq/Mnbwfqjbklnaqfpnvfpwqbslgq/Abnb/]bmb/Vowjnbfpwbnlplej`jbowbnajfmmjmd/Vmpbovglpslgfnlpnfilqbqslpjwjlmavpjmfppklnfsbdfpf`vqjwzobmdvbdfpwbmgbqg`bnsbjdmefbwvqfp`bwfdlqzf{wfqmbo`kjogqfmqfpfqufgqfpfbq`kf{`kbmdfebulqjwfwfnsobwfnjojwbqzjmgvpwqzpfquj`fpnbwfqjbosqlgv`wpy.jmgf{9`lnnfmwpplewtbqf`lnsofwf`bofmgbqsobwelqnbqwj`ofpqfrvjqfgnlufnfmwrvfpwjlmavjogjmdslojwj`pslppjaofqfojdjlmskzpj`boeffgab`hqfdjpwfqsj`wvqfpgjpbaofgsqlwl`lobvgjfm`fpfwwjmdpb`wjujwzfofnfmwpofbqmjmdbmzwkjmdbapwqb`wsqldqfpplufqujftnbdbyjmff`lmlnj`wqbjmjmdsqfppvqfubqjlvp#?pwqlmd=sqlsfqwzpklssjmdwldfwkfqbgubm`fgafkbujlqgltmolbgefbwvqfgellwaboopfof`wfgObmdvbdfgjpwbm`fqfnfnafqwqb`hjmdsbpptlqgnlgjejfgpwvgfmwpgjqf`wozejdkwjmdmlqwkfqmgbwbabpfefpwjuboaqfbhjmdol`bwjlmjmwfqmfwgqlsgltmsqb`wj`ffujgfm`fevm`wjlmnbqqjbdfqfpslmpfsqlaofnpmfdbwjufsqldqbnpbmbozpjpqfofbpfgabmmfq!=svq`kbpfsloj`jfpqfdjlmbo`qfbwjufbqdvnfmwallhnbqhqfefqqfq`kfnj`bogjujpjlm`booab`hpfsbqbwfsqlif`wp`lmeoj`wkbqgtbqfjmwfqfpwgfojufqznlvmwbjmlawbjmfg>#ebopf8elq+ubq#b``fswfg`bsb`jwz`lnsvwfqjgfmwjwzbjq`qbewfnsolzfgsqlslpfgglnfpwj`jm`ovgfpsqlujgfgklpsjwboufqwj`bo`loobspfbssqlb`ksbqwmfqpoldl!=?bgbvdkwfqbvwklq!#`vowvqboebnjojfp,jnbdfp,bppfnaozsltfqevowfb`kjmdejmjpkfggjpwqj`w`qjwj`bo`dj.ajm,svqslpfpqfrvjqfpfof`wjlmaf`lnjmdsqlujgfpb`bgfnj`f{fq`jpfb`wvbooznfgj`jmf`lmpwbmwb``jgfmwNbdbyjmfgl`vnfmwpwbqwjmdalwwln!=lapfqufg9#%rvlw8f{wfmgfgsqfujlvpPlewtbqf`vpwlnfqgf`jpjlmpwqfmdwkgfwbjofgpojdkwozsobmmjmdwf{wbqfb`vqqfm`zfufqzlmfpwqbjdkwwqbmpefqslpjwjufsqlgv`fgkfqjwbdfpkjssjmdbaplovwfqf`fjufgqfofubmwavwwlm!#ujlofm`fbmztkfqfafmfejwpobvm`kfgqf`fmwozboojbm`felooltfgnvowjsofavoofwjmjm`ovgfgl``vqqfgjmwfqmbo'+wkjp*-qfsvaoj`=?wq=?wg`lmdqfppqf`lqgfgvowjnbwfplovwjlm?vo#jg>!gjp`lufqKlnf?,b=tfapjwfpmfwtlqhpbowklvdkfmwjqfoznfnlqjbonfppbdfp`lmwjmvfb`wjuf!=plnftkbwuj`wlqjbTfpwfqm##wjwof>!Ol`bwjlm`lmwqb`wujpjwlqpGltmolbgtjwklvw#qjdkw!=\tnfbpvqfptjgwk#>#ubqjbaofjmuloufgujqdjmjbmlqnboozkbssfmfgb``lvmwppwbmgjmdmbwjlmboQfdjpwfqsqfsbqfg`lmwqlopb``vqbwfajqwkgbzpwqbwfdzleej`jbodqbskj`p`qjnjmboslppjaoz`lmpvnfqSfqplmbopsfbhjmdubojgbwfb`kjfufg-isd!#,=nb`kjmfp?,k1=\t##hfztlqgpeqjfmgozaqlwkfqp`lnajmfglqjdjmbo`lnslpfgf{sf`wfgbgfrvbwfsbhjpwbmeloolt!#ubovbaof?,obafo=qfobwjufaqjmdjmdjm`qfbpfdlufqmlqsovdjmp,Ojpw#le#Kfbgfq!=!#mbnf>!#+%rvlw8dqbgvbwf?,kfbg=\t`lnnfq`fnbobzpjbgjqf`wlqnbjmwbjm8kfjdkw9p`kfgvof`kbmdjmdab`h#wl#`bwkloj`sbwwfqmp`lolq9# dqfbwfpwpvssojfpqfojbaof?,vo=\t\n\n?pfof`w#`jwjyfmp`olwkjmdtbw`kjmd?oj#jg>!psf`jej``bqqzjmdpfmwfm`f?`fmwfq=`lmwqbpwwkjmhjmd`bw`k+f*plvwkfqmNj`kbfo#nfq`kbmw`bqlvpfosbggjmd9jmwfqjlq-psojw+!ojybwjlmL`wlafq#*xqfwvqmjnsqlufg..%dw8\t\t`lufqbdf`kbjqnbm-smd!#,=pvaif`wpQj`kbqg#tkbwfufqsqlabaozqf`lufqzabpfabooivgdnfmw`lmmf`w--`pp!#,=#tfapjwfqfslqwfggfebvow!,=?,b=\x0E\tfof`wqj`p`lwobmg`qfbwjlmrvbmwjwz-#JPAM#3gjg#mlw#jmpwbm`f.pfbq`k.!#obmd>!psfbhfqp@lnsvwfq`lmwbjmpbq`kjufpnjmjpwfqqfb`wjlmgjp`lvmwJwbojbml`qjwfqjbpwqlmdoz9#$kwws9$p`qjsw$`lufqjmdleefqjmdbssfbqfgAqjwjpk#jgfmwjezEb`fallhmvnfqlvpufkj`ofp`lm`fqmpBnfqj`bmkbmgojmdgju#jg>!Tjoojbn#sqlujgfq\\`lmwfmwb``vqb`zpf`wjlm#bmgfqplmeof{jaof@bwfdlqzobtqfm`f?p`qjsw=obzlvw>!bssqlufg#nb{jnvnkfbgfq!=?,wbaof=Pfquj`fpkbnjowlm`vqqfmw#`bmbgjbm`kbmmfop,wkfnfp,,bqwj`oflswjlmboslqwvdboubovf>!!jmwfqubotjqfofppfmwjwofgbdfm`jfpPfbq`k!#nfbpvqfgwklvpbmgpsfmgjmd%kfoojs8mft#Gbwf!#pjyf>!sbdfMbnfnjggof!#!#,=?,b=kjggfm!=pfrvfm`fsfqplmbolufqeoltlsjmjlmpjoojmljpojmhp!=\t\n?wjwof=ufqpjlmppbwvqgbzwfqnjmbojwfnsqlsfmdjmffqpf`wjlmpgfpjdmfqsqlslpbo>!ebopf!Fpsb/]loqfofbpfppvanjw!#fq%rvlw8bggjwjlmpznswlnplqjfmwfgqfplvq`fqjdkw!=?sofbpvqfpwbwjlmpkjpwlqz-ofbujmd##alqgfq>`lmwfmwp`fmwfq!=-\t\tPlnf#gjqf`wfgpvjwbaofavodbqjb-pklt+*8gfpjdmfgDfmfqbo#`lm`fswpF{bnsofptjoojbnpLqjdjmbo!=?psbm=pfbq`k!=lsfqbwlqqfrvfpwpb#%rvlw8booltjmdGl`vnfmwqfujpjlm-#\t\tWkf#zlvqpfoe@lmwb`w#nj`kjdbmFmdojpk#`lovnajbsqjlqjwzsqjmwjmdgqjmhjmdeb`jojwzqfwvqmfg@lmwfmw#leej`fqpQvppjbm#dfmfqbwf.;;6:.2!jmgj`bwfebnjojbq#rvbojwznbqdjm93#`lmwfmwujftslqw`lmwb`wp.wjwof!=slqwbaof-ofmdwk#fojdjaofjmuloufpbwobmwj`lmolbg>!gfebvow-pvssojfgsbznfmwpdolppbqz\t\tBewfq#dvjgbm`f?,wg=?wgfm`lgjmdnjggof!=`bnf#wl#gjpsobzpp`lwwjpkilmbwkbmnbilqjwztjgdfwp-`ojmj`bowkbjobmgwfb`kfqp?kfbg=\t\nbeef`wfgpvsslqwpsljmwfq8wlPwqjmd?,pnboo=lhobklnbtjoo#af#jmufpwlq3!#bow>!klojgbzpQfplvq`foj`fmpfg#+tkj`k#-#Bewfq#`lmpjgfqujpjwjmdf{solqfqsqjnbqz#pfbq`k!#bmgqljg!rvj`hoz#nffwjmdpfpwjnbwf8qfwvqm#8`lolq9 #kfjdkw>bssqlubo/#%rvlw8#`kf`hfg-njm-ip!nbdmfwj`=?,b=?,kelqf`bpw-#Tkjof#wkvqpgbzgufqwjpf%fb`vwf8kbp@obppfubovbwflqgfqjmdf{jpwjmdsbwjfmwp#Lmojmf#`lolqbglLswjlmp!`bnsafoo?\"..#fmg?,psbm=??aq#,=\x0E\t\\slsvsp\x7Fp`jfm`fp/%rvlw8#rvbojwz#Tjmgltp#bppjdmfgkfjdkw9#?a#`obppof%rvlw8#ubovf>!#@lnsbmzf{bnsofp?jeqbnf#afojfufpsqfpfmwpnbqpkboosbqw#le#sqlsfqoz*-\t\tWkf#wb{lmlnznv`k#le#?,psbm=\t!#gbwb.pqwvdv/Fpp`qlooWl#sqlif`w?kfbg=\x0E\tbwwlqmfzfnskbpjppslmplqpebm`zal{tlqog$p#tjogojef`kf`hfg>pfppjlmpsqldqbnns{8elmw.#Sqlif`wilvqmbopafojfufgub`bwjlmwklnsplmojdkwjmdbmg#wkf#psf`jbo#alqgfq>3`kf`hjmd?,walgz=?avwwlm#@lnsofwf`ofbqej{\t?kfbg=\tbqwj`of#?pf`wjlmejmgjmdpqlof#jm#slsvobq##L`wlafqtfapjwf#f{slpvqfvpfg#wl##`kbmdfplsfqbwfg`oj`hjmdfmwfqjmd`lnnbmgpjmelqnfg#mvnafqp##?,gju=`qfbwjmdlmPvanjwnbqzobmg`loofdfpbmbozwj`ojpwjmdp`lmwb`w-olddfgJmbgujplqzpjaojmdp`lmwfmw!p%rvlw8*p-#Wkjp#sb`hbdfp`kf`hal{pvddfpwpsqfdmbmwwlnlqqltpsb`jmd>j`lm-smdibsbmfpf`lgfabpfavwwlm!=dbnaojmdpv`k#bp#/#tkjof#?,psbm=#njpplvqjpslqwjmdwls92s{#-?,psbm=wfmpjlmptjgwk>!1obyzolbgmlufnafqvpfg#jm#kfjdkw>!`qjsw!=\t%maps8?,?wq=?wg#kfjdkw91,sqlgv`w`lvmwqz#jm`ovgf#ellwfq!#%ow8\"..#wjwof!=?,irvfqz-?,elqn=\t+\x0BBl\bQ\x7F*+\x0BUm\x05Gx*kqubwphjjwbojbmlqln/Nm(ow/Pqh/Kf4K4]4C5dwbnaj/Emmlwj`jbpnfmpbifpsfqplmbpgfqf`klpmb`jlmbopfquj`jl`lmwb`wlvpvbqjlpsqldqbnbdlajfqmlfnsqfpbpbmvm`jlpubofm`jb`lolnajbgfpsv/Epgfslqwfpsqlzf`wlsqlgv`wls/Vaoj`lmlplwqlpkjpwlqjbsqfpfmwfnjoolmfpnfgjbmwfsqfdvmwbbmwfqjlqqf`vqplpsqlaofnbpbmwjbdlmvfpwqlplsjmj/_mjnsqjnjqnjfmwqbpbn/Eqj`bufmgfglqpl`jfgbgqfpsf`wlqfbojybqqfdjpwqlsbobaqbpjmwfq/Epfmwlm`fpfpsf`jbonjfnaqlpqfbojgbg`/_qglabybqbdlybs/Mdjmbppl`jbofpaolrvfbqdfpwj/_mborvjofqpjpwfnbp`jfm`jbp`lnsofwlufqpj/_m`lnsofwbfpwvgjlps/Vaoj`blaifwjulboj`bmwfavp`bglq`bmwjgbgfmwqbgbpb``jlmfpbq`kjulppvsfqjlqnbzlq/Abbofnbmjbevm`j/_m/Vowjnlpkb`jfmglbrvfoolpfgj`j/_mefqmbmglbnajfmwfeb`fallhmvfpwqbp`ojfmwfpsql`fplpabpwbmwfsqfpfmwbqfslqwbq`lmdqfplsvaoj`bq`lnfq`jl`lmwqbwli/_ufmfpgjpwqjwlw/E`mj`b`lmivmwlfmfqd/Abwqbabibqbpwvqjbpqf`jfmwfvwjojybqalofw/Ampboubglq`lqqf`wbwqbabilpsqjnfqlpmfdl`jlpojafqwbggfwboofpsbmwboobsq/_{jnlbonfq/Abbmjnbofprvj/Emfp`lqby/_mpf``j/_mavp`bmglls`jlmfpf{wfqjlq`lm`fswlwlgbu/Abdbofq/Abfp`qjajqnfgj`jmboj`fm`jb`lmpvowbbpsf`wlp`q/Awj`bg/_obqfpivpwj`jbgfafq/Mmsfq/Alglmf`fpjwbnbmwfmfqsfrvf/]lqf`jajgbwqjavmbowfmfqjef`bm`j/_m`bmbqjbpgfp`bqdbgjufqplpnboolq`bqfrvjfqfw/E`mj`lgfafq/Abujujfmgbejmbmybpbgfobmwfevm`jlmb`lmpfilpgje/A`jo`jvgbgfpbmwjdvbpbubmybgbw/Eqnjmlvmjgbgfpp/Mm`kfy`bnsb/]bplewlmj`qfujpwbp`lmwjfmfpf`wlqfpnlnfmwlpeb`vowbg`q/Egjwlgjufqpbppvsvfpwleb`wlqfppfdvmglpsfrvf/]b<_<R<X<\\<Y=m<W<T<Y=m=n=`<]=g<W<R<]=g=n=`=a=n<R<P<y=m<W<T=n<R<_<R<P<Y<Q=c<^=m<Y=i=a=n<R<U<X<\\<Z<Y<]=g<W<T<_<R<X=o<X<Y<Q=`=a=n<R=n<]=g<W<\\=m<Y<]=c<R<X<T<Q=m<Y<]<Y<Q<\\<X<R=m<\\<U=n=h<R=n<R<Q<Y<_<R=m<^<R<T=m<^<R<U<T<_=l=g=n<R<Z<Y<^=m<Y<P=m<^<R=b<W<T=d=`=a=n<T=i<S<R<V<\\<X<Q<Y<U<X<R<P<\\<P<T=l<\\<W<T<]<R=n<Y<P=o=i<R=n=c<X<^=o=i=m<Y=n<T<W=b<X<T<X<Y<W<R<P<T=l<Y=n<Y<]=c=m<^<R<Y<^<T<X<Y=k<Y<_<R=a=n<T<P=m=k<Y=n=n<Y<P=g=j<Y<Q=g=m=n<\\<W<^<Y<X=`=n<Y<P<Y<^<R<X=g=n<Y<]<Y<^=g=d<Y<Q<\\<P<T=n<T<S<\\=n<R<P=o<S=l<\\<^<W<T=j<\\<R<X<Q<\\<_<R<X=g<[<Q<\\=b<P<R<_=o<X=l=o<_<^=m<Y<U<T<X<Y=n<V<T<Q<R<R<X<Q<R<X<Y<W<\\<X<Y<W<Y=m=l<R<V<T=b<Q=c<^<Y=m=`<y=m=n=`=l<\\<[<\\<Q<\\=d<T4K5h5h5k4K5h4F5f4@5i5f4U4B4K4Y4E4K5h4\\5f4U5h5f5k4@4C5f4C4K5h4N5j4K5h4]4C4F4A5o5i4Y5m4A4E5o4K5j4F4K5h5h5f5f5o5d5j4X4D5o4E5m5f5k4K4D5j4K4F4A5d4K4M4O5o4G4]4B5h4K5h4K5h4A4D4C5h5f5h4C4]5d4_4K4Z4V4[4F5o5d5j5k5j4K5o4_4K4A4E5j4K4C5f4K5h4[4D4U5h5f5o4X5o4]4K5f5i5o5j5i5j5k4K4X4]5o4E4]4J5f4_5j4X5f4[5i4K4\\4K4K5h5m5j4X4D4K4D4F4U4D4]4]4A5i4E5o4K5m4E5f5n5d5h5i4]5o4^5o5h5i4E4O4A5i4C5n5h4D5f5f4U5j5f4Y5d4]4E4[4]5f5n4X4K4]5o4@5d4K5h4O4B4]5e5i4U5j4K4K4D4A4G4U4]5d4Z4D4X5o5h5i4_4@5h4D5j4K5j4B4K5h4C5o4F4K4D5o5h5f4E4D4C5d5j4O5f4Z4K5f5d4@4C5m4]5f5n5o4F4D4F4O5m4Z5h5i4[4D4B4K5o4G4]4D4K4]5o4K5m4Z5h4K4A5h5e5j5m4_5k4O5f4K5i4]4C5d4C4O5j5k4K4C5f5j4K4K5h4K5j5i4U4]4Z4F4U5h5i4C4K4B5h5i5i5o5j\x03\x03\x03\x03\x03\x03\x03\x03\x02\x03\x02\x03\x02\x03\x02\x03\x01\x03\x01\x03\x01\x03\x01\x03\x07\x03\x07\x03\x07\x03\x07\x03\x03\x02\x01\0\x07\x06\x05\x04\x04\x05\x06\x07\0\x01\x02\x03\x0B\n\t\b\x0F\x0E\r\f\f\r\x0E\x0F\b\t\n\x0B\x13\x12\x11\x10\x17\x16\x15\x14\x14\x15\x16\x17\x10\x11\x12\x13\x1B\x1A\x19\x18\x1F\x1E\x1D\x1C\x1C\x1D\x1E\x1F\x18\x19\x1A\x1B\x13\x13\x13\x13\x03\x03\x03\x03\x03\x03\x03\x03\x13\x13\x13\x13\x02\x03\x03\x03\x01\x03\x03\x03\x01\x03\x03\x03\x02\x03\x03\x03\x02\x03\x03\x03\0\x03\x03\x03\x13\x13\x03\x02\x03\x03\x03\x02\x03\x03\x13\x13\x03\x02\x03\x03\x03\x0B\x03\x0B\x03\x0B\x03\x0B\x03\x03\x03\x02\x03\x01\x03\0\x03\x07\x03\x06\x03\x05\x03\x04qfplvq`fp`lvmwqjfprvfpwjlmpfrvjsnfmw`lnnvmjwzbubjobaofkjdkojdkwGWG,{kwnonbqhfwjmdhmltofgdfplnfwkjmd`lmwbjmfqgjqf`wjlmpvap`qjafbgufqwjpf`kbqb`wfq!#ubovf>!?,pfof`w=Bvpwqbojb!#`obpp>!pjwvbwjlmbvwklqjwzelooltjmdsqjnbqjozlsfqbwjlm`kboofmdfgfufolsfgbmlmznlvpevm`wjlm#evm`wjlmp`lnsbmjfppwqv`wvqfbdqffnfmw!#wjwof>!slwfmwjbofgv`bwjlmbqdvnfmwppf`lmgbqz`lszqjdkwobmdvbdfpf{`ovpjuf`lmgjwjlm?,elqn=\x0E\tpwbwfnfmwbwwfmwjlmAjldqbskz~#fopf#x\tplovwjlmptkfm#wkf#Bmbozwj`pwfnsobwfpgbmdfqlvppbwfoojwfgl`vnfmwpsvaojpkfqjnslqwbmwsqlwlwzsfjmeovfm`f%qbrvl8?,feef`wjufdfmfqboozwqbmpelqnafbvwjevowqbmpslqwlqdbmjyfgsvaojpkfgsqlnjmfmwvmwjo#wkfwkvnambjoMbwjlmbo#-el`vp+*8lufq#wkf#njdqbwjlmbmmlvm`fgellwfq!=\tf{`fswjlmofpp#wkbmf{sfmpjufelqnbwjlmeqbnftlqhwfqqjwlqzmgj`bwjlm`vqqfmwoz`obppMbnf`qjwj`jpnwqbgjwjlmfopftkfqfBof{bmgfqbssljmwfgnbwfqjbopaqlbg`bpwnfmwjlmfgbeejojbwf?,lswjlm=wqfbwnfmwgjeefqfmw,gfebvow-Sqfpjgfmwlm`oj`h>!ajldqbskzlwkfqtjpfsfqnbmfmwEqbm/KbjpKlooztllgf{sbmpjlmpwbmgbqgp?,pwzof=\tqfgv`wjlmGf`fnafq#sqfefqqfg@bnaqjgdflsslmfmwpAvpjmfpp#`lmevpjlm=\t?wjwof=sqfpfmwfgf{sobjmfgglfp#mlw#tlqogtjgfjmwfqeb`fslpjwjlmpmftpsbsfq?,wbaof=\tnlvmwbjmpojhf#wkf#fppfmwjboejmbm`jbopfof`wjlmb`wjlm>!,babmglmfgFgv`bwjlmsbqpfJmw+pwbajojwzvmbaof#wl?,wjwof=\tqfobwjlmpMlwf#wkbwfeej`jfmwsfqelqnfgwtl#zfbqpPjm`f#wkfwkfqfelqftqbssfq!=bowfqmbwfjm`qfbpfgAbwwof#lesfq`fjufgwqzjmd#wlmf`fppbqzslqwqbzfgfof`wjlmpFojybafwk?,jeqbnf=gjp`lufqzjmpvqbm`fp-ofmdwk8ofdfmgbqzDfldqbskz`bmgjgbwf`lqslqbwfplnfwjnfppfquj`fp-jmkfqjwfg?,pwqlmd=@lnnvmjwzqfojdjlvpol`bwjlmp@lnnjwwffavjogjmdpwkf#tlqogml#olmdfqafdjmmjmdqfefqfm`f`bmmlw#afeqfrvfm`zwzsj`boozjmwl#wkf#qfobwjuf8qf`lqgjmdsqfpjgfmwjmjwjboozwf`kmjrvfwkf#lwkfqjw#`bm#aff{jpwfm`fvmgfqojmfwkjp#wjnfwfofsklmfjwfnp`lsfsqb`wj`fpbgubmwbdf*8qfwvqm#Elq#lwkfqsqlujgjmdgfnl`qb`zalwk#wkf#f{wfmpjufpveefqjmdpvsslqwfg`lnsvwfqp#evm`wjlmsqb`wj`bopbjg#wkbwjw#nbz#afFmdojpk?,eqln#wkf#p`kfgvofggltmolbgp?,obafo=\tpvpsf`wfgnbqdjm9#3psjqjwvbo?,kfbg=\t\tnj`qlplewdqbgvboozgjp`vppfgkf#af`bnff{f`vwjufirvfqz-ipklvpfklog`lmejqnfgsvq`kbpfgojwfqboozgfpwqlzfgvs#wl#wkfubqjbwjlmqfnbjmjmdjw#jp#mlw`fmwvqjfpIbsbmfpf#bnlmd#wkf`lnsofwfgbodlqjwknjmwfqfpwpqfafoojlmvmgfejmfgfm`lvqbdfqfpjybaofjmuloujmdpfmpjwjufvmjufqpbosqlujpjlm+bowklvdkefbwvqjmd`lmgv`wfg*/#tkj`k#`lmwjmvfg.kfbgfq!=Efaqvbqz#mvnfqlvp#lufqeolt9`lnslmfmweqbdnfmwpf{`foofmw`lopsbm>!wf`kmj`bomfbq#wkf#Bgubm`fg#plvq`f#lef{sqfppfgKlmd#Hlmd#Eb`fallhnvowjsof#nf`kbmjpnfofubwjlmleefmpjuf?,elqn=\t\npslmplqfggl`vnfmw-lq#%rvlw8wkfqf#bqfwklpf#tklnlufnfmwpsql`fppfpgjeej`vowpvanjwwfgqf`lnnfmg`lmujm`fgsqlnlwjmd!#tjgwk>!-qfsob`f+`obppj`bo`lbojwjlmkjp#ejqpwgf`jpjlmpbppjpwbmwjmgj`bwfgfulovwjlm.tqbssfq!fmlvdk#wlbolmd#wkfgfojufqfg..=\x0E\t?\"..Bnfqj`bm#sqlwf`wfgMlufnafq#?,pwzof=?evqmjwvqfJmwfqmfw##lmaovq>!pvpsfmgfgqf`jsjfmwabpfg#lm#Nlqflufq/balojpkfg`loof`wfgtfqf#nbgffnlwjlmbofnfqdfm`zmbqqbwjufbgul`bwfps{8alqgfq`lnnjwwfggjq>!owq!fnsolzffpqfpfbq`k-#pfof`wfgpv``fpplq`vpwlnfqpgjpsobzfgPfswfnafqbgg@obpp+Eb`fallh#pvddfpwfgbmg#obwfqlsfqbwjmdfobalqbwfPlnfwjnfpJmpwjwvwf`fqwbjmozjmpwboofgelooltfqpIfqvpbofnwkfz#kbuf`lnsvwjmddfmfqbwfgsqlujm`fpdvbqbmwffbqajwqbqzqf`ldmjyftbmwfg#wls{8tjgwk9wkflqz#leafkbujlvqTkjof#wkffpwjnbwfgafdbm#wl#jw#af`bnfnbdmjwvgfnvpw#kbufnlqf#wkbmGjqf`wlqzf{wfmpjlmpf`qfwbqzmbwvqboozl``vqqjmdubqjbaofpdjufm#wkfsobwelqn-?,obafo=?ebjofg#wl`lnslvmgphjmgp#le#pl`jfwjfpbolmdpjgf#..%dw8\t\tplvwktfpwwkf#qjdkwqbgjbwjlmnbz#kbuf#vmfp`bsf+pslhfm#jm!#kqfe>!,sqldqbnnflmoz#wkf#`lnf#eqlngjqf`wlqzavqjfg#jmb#pjnjobqwkfz#tfqf?,elmw=?,Mlqtfdjbmpsf`jejfgsqlgv`jmdsbppfmdfq+mft#Gbwfwfnslqbqzej`wjlmboBewfq#wkffrvbwjlmpgltmolbg-qfdvobqozgfufolsfqbaluf#wkfojmhfg#wlskfmlnfmbsfqjlg#lewllowjs!=pvapwbm`fbvwlnbwj`bpsf`w#leBnlmd#wkf`lmmf`wfgfpwjnbwfpBjq#Elq`fpzpwfn#lelaif`wjufjnnfgjbwfnbhjmd#jwsbjmwjmdp`lmrvfqfgbqf#pwjoosql`fgvqfdqltwk#lekfbgfg#azFvqlsfbm#gjujpjlmpnlof`vofpeqbm`kjpfjmwfmwjlmbwwqb`wfg`kjogkllgbopl#vpfggfgj`bwfgpjmdbslqfgfdqff#leebwkfq#le`lmeoj`wp?,b=?,s=\t`bnf#eqlntfqf#vpfgmlwf#wkbwqf`fjujmdF{f`vwjuffufm#nlqfb``fpp#wl`lnnbmgfqSlojwj`bonvpj`jbmpgfoj`jlvpsqjplmfqpbgufmw#leVWE.;!#,=?\"X@GBWBX!=@lmwb`wPlvwkfqm#ad`lolq>!pfqjfp#le-#Jw#tbp#jm#Fvqlsfsfqnjwwfgubojgbwf-bssfbqjmdleej`jboppfqjlvpoz.obmdvbdfjmjwjbwfgf{wfmgjmdolmd.wfqnjmeobwjlmpv`k#wkbwdfw@llhjfnbqhfg#az?,avwwlm=jnsofnfmwavw#jw#jpjm`qfbpfpgltm#wkf#qfrvjqjmdgfsfmgfmw..=\t?\"..#jmwfqujftTjwk#wkf#`lsjfp#le`lmpfmpvptbp#avjowUfmfyvfob+elqnfqozwkf#pwbwfsfqplmmfopwqbwfdj`ebulvq#lejmufmwjlmTjhjsfgjb`lmwjmfmwujqwvbooztkj`k#tbpsqjm`jsof@lnsofwf#jgfmwj`bopklt#wkbwsqjnjwjufbtbz#eqlnnlof`vobqsqf`jpfozgjpploufgVmgfq#wkfufqpjlm>!=%maps8?,Jw#jp#wkf#Wkjp#jp#tjoo#kbuflqdbmjpnpplnf#wjnfEqjfgqj`ktbp#ejqpwwkf#lmoz#eb`w#wkbwelqn#jg>!sqf`fgjmdWf`kmj`boskzpj`jpwl``vqp#jmmbujdbwlqpf`wjlm!=psbm#jg>!plvdkw#wlafolt#wkfpvqujujmd~?,pwzof=kjp#gfbwkbp#jm#wkf`bvpfg#azsbqwjboozf{jpwjmd#vpjmd#wkftbp#djufmb#ojpw#leofufop#lemlwjlm#leLeej`jbo#gjpnjppfgp`jfmwjpwqfpfnaofpgvsoj`bwff{solpjufqf`lufqfgboo#lwkfqdboofqjfpxsbggjmd9sflsof#leqfdjlm#lebggqfppfpbppl`jbwfjnd#bow>!jm#nlgfqmpklvog#afnfwklg#leqfslqwjmdwjnfpwbnsmffgfg#wlwkf#Dqfbwqfdbqgjmdpffnfg#wlujftfg#bpjnsb`w#lmjgfb#wkbwwkf#Tlqogkfjdkw#lef{sbmgjmdWkfpf#bqf`vqqfmw!=`bqfevooznbjmwbjmp`kbqdf#le@obppj`bobggqfppfgsqfgj`wfgltmfqpkjs?gju#jg>!qjdkw!=\x0E\tqfpjgfm`fofbuf#wkf`lmwfmw!=bqf#lewfm##~*+*8\x0E\tsqlabaoz#Sqlefpplq.avwwlm!#qfpslmgfgpbzp#wkbwkbg#wl#afsob`fg#jmKvmdbqjbmpwbwvp#lepfqufp#bpVmjufqpbof{f`vwjlmbddqfdbwfelq#tkj`kjmef`wjlmbdqffg#wlkltfufq/#slsvobq!=sob`fg#lm`lmpwqv`wfof`wlqbopznalo#lejm`ovgjmdqfwvqm#wlbq`kjwf`w@kqjpwjbmsqfujlvp#ojujmd#jmfbpjfq#wlsqlefpplq\t%ow8\"..#feef`w#lebmbozwj`ptbp#wbhfmtkfqf#wkfwllh#lufqafojfe#jmBeqjhbbmpbp#ebq#bpsqfufmwfgtlqh#tjwkb#psf`jbo?ejfogpfw@kqjpwnbpQfwqjfufg\t\tJm#wkf#ab`h#jmwlmlqwkfbpwnbdbyjmfp=?pwqlmd=`lnnjwwffdlufqmjmddqlvsp#lepwlqfg#jmfpwbaojpkb#dfmfqbojwp#ejqpwwkfjq#ltmslsvobwfgbm#laif`w@bqjaafbmboolt#wkfgjpwqj`wptjp`lmpjmol`bwjlm-8#tjgwk9#jmkbajwfgPl`jbojpwIbmvbqz#2?,ellwfq=pjnjobqoz`klj`f#lewkf#pbnf#psf`jej`#avpjmfpp#Wkf#ejqpw-ofmdwk8#gfpjqf#wlgfbo#tjwkpjm`f#wkfvpfqBdfmw`lm`fjufgjmgf{-sksbp#%rvlw8fmdbdf#jmqf`fmwoz/eft#zfbqptfqf#bopl\t?kfbg=\t?fgjwfg#azbqf#hmltm`jwjfp#jmb``fpphfz`lmgfnmfgbopl#kbufpfquj`fp/ebnjoz#leP`kllo#le`lmufqwfgmbwvqf#le#obmdvbdfnjmjpwfqp?,laif`w=wkfqf#jp#b#slsvobqpfrvfm`fpbgul`bwfgWkfz#tfqfbmz#lwkfqol`bwjlm>fmwfq#wkfnv`k#nlqfqfeof`wfgtbp#mbnfglqjdjmbo#b#wzsj`botkfm#wkfzfmdjmffqp`lvog#mlwqfpjgfmwptfgmfpgbzwkf#wkjqg#sqlgv`wpIbmvbqz#1tkbw#wkfzb#`fqwbjmqfb`wjlmpsql`fpplqbewfq#kjpwkf#obpw#`lmwbjmfg!=?,gju=\t?,b=?,wg=gfsfmg#lmpfbq`k!=\tsjf`fp#le`lnsfwjmdQfefqfm`fwfmmfppfftkj`k#kbp#ufqpjlm>?,psbm=#??,kfbgfq=djufp#wkfkjpwlqjbmubovf>!!=sbggjmd93ujft#wkbwwldfwkfq/wkf#nlpw#tbp#elvmgpvapfw#lebwwb`h#lm`kjogqfm/sljmwp#lesfqplmbo#slpjwjlm9boofdfgoz@ofufobmgtbp#obwfqbmg#bewfqbqf#djufmtbp#pwjoop`qloojmdgfpjdm#lenbhfp#wkfnv`k#ofppBnfqj`bmp-\t\tBewfq#/#avw#wkfNvpfvn#leolvjpjbmb+eqln#wkfnjmmfplwbsbqwj`ofpb#sql`fppGlnjmj`bmulovnf#leqfwvqmjmdgfefmpjuf33s{\x7Fqjdknbgf#eqlnnlvpflufq!#pwzof>!pwbwfp#le+tkj`k#jp`lmwjmvfpEqbm`jp`lavjogjmd#tjwklvw#btjwk#plnftkl#tlvogb#elqn#leb#sbqw#leafelqf#jwhmltm#bp##Pfquj`fpol`bwjlm#bmg#lewfmnfbpvqjmdbmg#jw#jpsbsfqab`hubovfp#le\x0E\t?wjwof=>#tjmglt-gfwfqnjmffq%rvlw8#sobzfg#azbmg#fbqoz?,`fmwfq=eqln#wkjpwkf#wkqffsltfq#bmgle#%rvlw8jmmfqKWNO?b#kqfe>!z9jmojmf8@kvq`k#lewkf#fufmwufqz#kjdkleej`jbo#.kfjdkw9#`lmwfmw>!,`dj.ajm,wl#`qfbwfbeqjhbbmpfpsfqbmwleqbm/Kbjpobwujf)Mvojfwvuj)_(`f)Mwjmb(af)Mwjmb\fUh\fT{\fTN\n{I\np@\x04Fr\x0BBl\bQ\x7F\tA{\x0BUm\x05Gx\tA{\x01yp\x06YA\0zX\bTV\bWl\bUd\x04BM\x0BB{\npV\x0B@x\x04B\\\np@\x04Db\x04Gz\tal\npa\tfM\tuD\bV~\x04mx\x0BQ}\ndS\tp\\\bVK\bS]\bU|\x05oD\tkV\x0Bed\x0BHR\nb~\x04M`\nJp\x05oD\x04|Q\nLP\x04Sw\bTl\nAI\nxC\bWt\tBq\x05F`\x04Cm\x0BLm\tKx\t}t\bPv\ny\\\naB\tV\x7F\nZd\x04XU\x04li\tfr\ti@\tBH\x04BD\x04BV\t`V\n[]\tp_\tTn\n~A\nxR\tuD\t`{\bV@\tTn\tHK\tAJ\x0Bxs\x04Zf\nqI\x04Zf\x0BBM\x0B|j\t}t\bSM\nmC\x0BQ}pfquj`jlpbqw/A`volbqdfmwjmbabq`folmb`vborvjfqsvaoj`bglsqlgv`wlpslo/Awj`bqfpsvfpwbtjhjsfgjbpjdvjfmwfa/Vprvfgb`lnvmjgbgpfdvqjgbgsqjm`jsbosqfdvmwbp`lmwfmjglqfpslmgfqufmfyvfobsqlaofnbpgj`jfnaqfqfob`j/_mmlujfnaqfpjnjobqfpsqlzf`wlpsqldqbnbpjmpwjwvwlb`wjujgbgfm`vfmwqbf`lmln/Abjn/Mdfmfp`lmwb`wbqgfp`bqdbqmf`fpbqjlbwfm`j/_mwfo/Eelml`lnjpj/_m`bm`jlmfp`bsb`jgbgfm`lmwqbqbm/Mojpjpebulqjwlpw/Eqnjmlpsqlujm`jbfwjrvfwbpfofnfmwlpevm`jlmfpqfpvowbgl`bq/M`wfqsqlsjfgbgsqjm`jsjlmf`fpjgbgnvmj`jsbo`qfb`j/_mgfp`bqdbpsqfpfm`jb`lnfq`jbolsjmjlmfpfifq`j`jlfgjwlqjbopbobnbm`bdlmy/Mofygl`vnfmwlsfo/A`vobqf`jfmwfpdfmfqbofpwbqqbdlmbsq/M`wj`bmlufgbgfpsqlsvfpwbsb`jfmwfpw/E`mj`bplaifwjulp`lmwb`wlp\fHB\fIk\fHn\fH^\fHS\fHc\fHU\fId\fHn\fH{\fHC\fHR\fHT\fHR\fHI\fHc\fHY\fHn\fH\\\fHU\fIk\fHy\fIg\fHd\fHy\fIm\fHw\fH\\\fHU\fHR\fH@\fHR\fHJ\fHy\fHU\fHR\fHT\fHA\fIl\fHU\fIm\fHc\fH\\\fHU\fIl\fHB\fId\fHn\fHJ\fHS\fHD\fH@\fHR\fHHgjsolgl`p\fHT\fHB\fHC\fH\\\fIn\fHF\fHD\fHR\fHB\fHF\fHH\fHR\fHG\fHS\fH\\\fHx\fHT\fHH\fHH\fH\\\fHU\fH^\fIg\fH{\fHU\fIm\fHj\fH@\fHR\fH\\\fHJ\fIk\fHZ\fHU\fIm\fHd\fHz\fIk\fH^\fHC\fHJ\fHS\fHy\fHR\fHB\fHY\fIk\fH@\fHH\fIl\fHD\fH@\fIl\fHv\fHB\fI`\fHH\fHT\fHR\fH^\fH^\fIk\fHz\fHp\fIe\fH@\fHB\fHJ\fHJ\fHH\fHI\fHR\fHD\fHU\fIl\fHZ\fHU\fH\\\fHi\fH^\fH{\fHy\fHA\fIl\fHD\fH{\fH\\\fHF\fHR\fHT\fH\\\fHR\fHH\fHy\fHS\fHc\fHe\fHT\fIk\fH{\fHC\fIl\fHU\fIn\fHm\fHj\fH{\fIk\fHs\fIl\fHB\fHz\fIg\fHp\fHy\fHR\fH\\\fHi\fHA\fIl\fH{\fHC\fIk\fHH\fIm\fHB\fHY\fIg\fHs\fHJ\fIk\fHn\fHi\fH{\fH\\\fH|\fHT\fIk\fHB\fIk\fH^\fH^\fH{\fHR\fHU\fHR\fH^\fHf\fHF\fH\\\fHv\fHR\fH\\\fH|\fHT\fHR\fHJ\fIk\fH\\\fHp\fHS\fHT\fHJ\fHS\fH^\fH@\fHn\fHJ\fH@\fHD\fHR\fHU\fIn\fHn\fH^\fHR\fHz\fHp\fIl\fHH\fH@\fHs\fHD\fHB\fHS\fH^\fHk\fHT\fIk\fHj\fHD\fIk\fHD\fHC\fHR\fHy\fIm\fH^\fH^\fIe\fH{\fHA\fHR\fH{\fH\\\fIk\fH^\fHp\fH{\fHU\fH\\\fHR\fHB\fH^\fH{\fIk\fHF\fIk\fHp\fHU\fHR\fHI\fHk\fHT\fIl\fHT\fHU\fIl\fHy\fH^\fHR\fHL\fIl\fHy\fHU\fHR\fHm\fHJ\fIn\fH\\\fHH\fHU\fHH\fHT\fHR\fHH\fHC\fHR\fHJ\fHj\fHC\fHR\fHF\fHR\fHy\fHy\fI`\fHD\fHZ\fHR\fHB\fHJ\fIk\fHz\fHC\fHU\fIl\fH\\\fHR\fHC\fHz\fIm\fHJ\fH^\fH{\fIl`bwfdlqjfpf{sfqjfm`f?,wjwof=\x0E\t@lszqjdkw#ibubp`qjsw`lmgjwjlmpfufqzwkjmd?s#`obpp>!wf`kmloldzab`hdqlvmg?b#`obpp>!nbmbdfnfmw%`lsz8#132ibubP`qjsw`kbqb`wfqpaqfbg`qvnawkfnpfoufpklqjylmwbodlufqmnfmw@bojelqmjbb`wjujwjfpgjp`lufqfgMbujdbwjlmwqbmpjwjlm`lmmf`wjlmmbujdbwjlmbssfbqbm`f?,wjwof=?n`kf`hal{!#wf`kmjrvfpsqlwf`wjlmbssbqfmwozbp#tfoo#bpvmw$/#$VB.qfplovwjlmlsfqbwjlmpwfofujpjlmwqbmpobwfgTbpkjmdwlmmbujdbwlq-#>#tjmglt-jnsqfppjlm%ow8aq%dw8ojwfqbwvqfslsvobwjlmad`lolq>! fpsf`jbooz#`lmwfmw>!sqlgv`wjlmmftpofwwfqsqlsfqwjfpgfejmjwjlmofbgfqpkjsWf`kmloldzSbqojbnfmw`lnsbqjplmvo#`obpp>!-jmgf{Le+!`lm`ovpjlmgjp`vppjlm`lnslmfmwpajloldj`boQfulovwjlm\\`lmwbjmfqvmgfqpwllgmlp`qjsw=?sfqnjppjlmfb`k#lwkfqbwnlpskfqf#lmel`vp>!?elqn#jg>!sql`fppjmdwkjp-ubovfdfmfqbwjlm@lmefqfm`fpvapfrvfmwtfoo.hmltmubqjbwjlmpqfsvwbwjlmskfmlnfmlmgjp`jsojmfoldl-smd!#+gl`vnfmw/alvmgbqjfpf{sqfppjlmpfwwofnfmwAb`hdqlvmglvw#le#wkffmwfqsqjpf+!kwwsp9!#vmfp`bsf+!sbpptlqg!#gfnl`qbwj`?b#kqfe>!,tqbssfq!=\tnfnafqpkjsojmdvjpwj`s{8sbggjmdskjolplskzbppjpwbm`fvmjufqpjwzeb`jojwjfpqf`ldmjyfgsqfefqfm`fje#+wzsflenbjmwbjmfgul`bavobqzkzslwkfpjp-pvanjw+*8%bns8maps8bmmlwbwjlmafkjmg#wkfElvmgbwjlmsvaojpkfq!bppvnswjlmjmwqlgv`fg`lqqvswjlmp`jfmwjpwpf{soj`jwozjmpwfbg#legjnfmpjlmp#lm@oj`h>!`lmpjgfqfggfsbqwnfmwl``vsbwjlmpllm#bewfqjmufpwnfmwsqlmlvm`fgjgfmwjejfgf{sfqjnfmwNbmbdfnfmwdfldqbskj`!#kfjdkw>!ojmh#qfo>!-qfsob`f+,gfsqfppjlm`lmefqfm`fsvmjpknfmwfojnjmbwfgqfpjpwbm`fbgbswbwjlmlsslpjwjlmtfoo#hmltmpvssofnfmwgfwfqnjmfgk2#`obpp>!3s{8nbqdjmnf`kbmj`bopwbwjpwj`p`fofaqbwfgDlufqmnfmw\t\tGvqjmd#wgfufolsfqpbqwjej`jbofrvjubofmwlqjdjmbwfg@lnnjppjlmbwwb`knfmw?psbm#jg>!wkfqf#tfqfMfgfqobmgpafzlmg#wkfqfdjpwfqfgilvqmbojpweqfrvfmwozboo#le#wkfobmd>!fm!#?,pwzof=\x0E\tbaplovwf8#pvsslqwjmdf{wqfnfoz#nbjmpwqfbn?,pwqlmd=#slsvobqjwzfnsolznfmw?,wbaof=\x0E\t#`lopsbm>!?,elqn=\t##`lmufqpjlmbalvw#wkf#?,s=?,gju=jmwfdqbwfg!#obmd>!fmSlqwvdvfpfpvapwjwvwfjmgjujgvbojnslppjaofnvowjnfgjbbonlpw#boos{#plojg# bsbqw#eqlnpvaif`w#wljm#Fmdojpk`qjwj`jyfgf{`fsw#elqdvjgfojmfplqjdjmboozqfnbqhbaofwkf#pf`lmgk1#`obpp>!?b#wjwof>!+jm`ovgjmdsbqbnfwfqpsqlkjajwfg>#!kwws9,,gj`wjlmbqzsfq`fswjlmqfulovwjlmelvmgbwjlms{8kfjdkw9pv``fppevopvsslqwfqpnjoofmmjvnkjp#ebwkfqwkf#%rvlw8ml.qfsfbw8`lnnfq`jbojmgvpwqjbofm`lvqbdfgbnlvmw#le#vmleej`jbofeej`jfm`zQfefqfm`fp`llqgjmbwfgjp`objnfqf{sfgjwjlmgfufolsjmd`bo`vobwfgpjnsojejfgofdjwjnbwfpvapwqjmd+3!#`obpp>!`lnsofwfozjoovpwqbwfejuf#zfbqpjmpwqvnfmwSvaojpkjmd2!#`obpp>!spz`kloldz`lmejgfm`fmvnafq#le#bapfm`f#leel`vpfg#lmiljmfg#wkfpwqv`wvqfpsqfujlvpoz=?,jeqbnf=lm`f#bdbjmavw#qbwkfqjnnjdqbmwple#`lvqpf/b#dqlvs#leOjwfqbwvqfVmojhf#wkf?,b=%maps8\tevm`wjlm#jw#tbp#wkf@lmufmwjlmbvwlnlajofSqlwfpwbmwbddqfppjufbewfq#wkf#Pjnjobqoz/!#,=?,gju=`loof`wjlm\x0E\tevm`wjlmujpjajojwzwkf#vpf#leulovmwffqpbwwqb`wjlmvmgfq#wkf#wkqfbwfmfg)?\"X@GBWBXjnslqwbm`fjm#dfmfqbowkf#obwwfq?,elqn=\t?,-jmgf{Le+$j#>#38#j#?gjeefqfm`fgfulwfg#wlwqbgjwjlmppfbq`k#elqvowjnbwfozwlvqmbnfmwbwwqjavwfppl.`boofg#~\t?,pwzof=fubovbwjlmfnskbpjyfgb``fppjaof?,pf`wjlm=pv``fppjlmbolmd#tjwkNfbmtkjof/jmgvpwqjfp?,b=?aq#,=kbp#af`lnfbpsf`wp#leWfofujpjlmpveej`jfmwabphfwabooalwk#pjgfp`lmwjmvjmdbm#bqwj`of?jnd#bow>!bgufmwvqfpkjp#nlwkfqnbm`kfpwfqsqjm`jsofpsbqwj`vobq`lnnfmwbqzfeef`wp#legf`jgfg#wl!=?pwqlmd=svaojpkfqpIlvqmbo#legjeej`vowzeb`jojwbwfb``fswbaofpwzof-`pp!\nevm`wjlm#jmmlubwjlm=@lszqjdkwpjwvbwjlmptlvog#kbufavpjmfppfpGj`wjlmbqzpwbwfnfmwplewfm#vpfgsfqpjpwfmwjm#Ibmvbqz`lnsqjpjmd?,wjwof=\t\ngjsolnbwj``lmwbjmjmdsfqelqnjmdf{wfmpjlmpnbz#mlw#af`lm`fsw#le#lm`oj`h>!Jw#jp#boplejmbm`jbo#nbhjmd#wkfOv{fnalvqdbggjwjlmbobqf#`boofgfmdbdfg#jm!p`qjsw!*8avw#jw#tbpfof`wqlmj`lmpvanjw>!\t?\"..#Fmg#fof`wqj`boleej`jboozpvddfpwjlmwls#le#wkfvmojhf#wkfBvpwqbojbmLqjdjmboozqfefqfm`fp\t?,kfbg=\x0E\tqf`ldmjpfgjmjwjbojyfojnjwfg#wlBof{bmgqjbqfwjqfnfmwBgufmwvqfpelvq#zfbqp\t\t%ow8\"..#jm`qfbpjmdgf`lqbwjlmk0#`obpp>!lqjdjmp#lelaojdbwjlmqfdvobwjlm`obppjejfg+evm`wjlm+bgubmwbdfpafjmd#wkf#kjpwlqjbmp?abpf#kqfeqfsfbwfgoztjoojmd#wl`lnsbqbaofgfpjdmbwfgmlnjmbwjlmevm`wjlmbojmpjgf#wkfqfufobwjlmfmg#le#wkfp#elq#wkf#bvwklqjyfgqfevpfg#wlwbhf#sob`fbvwlmlnlvp`lnsqlnjpfslojwj`bo#qfpwbvqbmwwtl#le#wkfEfaqvbqz#1rvbojwz#leptelaif`w-vmgfqpwbmgmfbqoz#bootqjwwfm#azjmwfqujftp!#tjgwk>!2tjwkgqbtboeolbw9ofewjp#vpvbooz`bmgjgbwfpmftpsbsfqpnzpwfqjlvpGfsbqwnfmwafpw#hmltmsbqojbnfmwpvssqfppfg`lmufmjfmwqfnfnafqfggjeefqfmw#pzpwfnbwj`kbp#ofg#wlsqlsbdbmgb`lmwqloofgjmeovfm`fp`fqfnlmjbosql`objnfgSqlwf`wjlmoj#`obpp>!P`jfmwjej``obpp>!ml.wqbgfnbqhpnlqf#wkbm#tjgfpsqfbgOjafqbwjlmwllh#sob`fgbz#le#wkfbp#olmd#bpjnsqjplmfgBggjwjlmbo\t?kfbg=\t?nObalqbwlqzMlufnafq#1f{`fswjlmpJmgvpwqjboubqjfwz#leeolbw9#ofeGvqjmd#wkfbppfppnfmwkbuf#affm#gfbop#tjwkPwbwjpwj`pl``vqqfm`f,vo=?,gju=`ofbqej{!=wkf#svaoj`nbmz#zfbqptkj`k#tfqflufq#wjnf/pzmlmznlvp`lmwfmw!=\tsqfpvnbaozkjp#ebnjozvpfqBdfmw-vmf{sf`wfgjm`ovgjmd#`kboofmdfgb#njmlqjwzvmgfejmfg!afolmdp#wlwbhfm#eqlnjm#L`wlafqslpjwjlm9#pbjg#wl#afqfojdjlvp#Efgfqbwjlm#qltpsbm>!lmoz#b#eftnfbmw#wkbwofg#wl#wkf..=\x0E\t?gju#?ejfogpfw=Bq`kajpkls#`obpp>!mlafjmd#vpfgbssqlb`kfpsqjujofdfpmlp`qjsw=\tqfpvowp#jmnbz#af#wkfFbpwfq#fddnf`kbmjpnpqfbplmbaofSlsvobwjlm@loof`wjlmpfof`wfg!=mlp`qjsw=\x0E,jmgf{-sksbqqjubo#le.ippgh$**8nbmbdfg#wljm`lnsofwf`bpvbowjfp`lnsofwjlm@kqjpwjbmpPfswfnafq#bqjwknfwj`sql`fgvqfpnjdkw#kbufSqlgv`wjlmjw#bssfbqpSkjolplskzeqjfmgpkjsofbgjmd#wldjujmd#wkfwltbqg#wkfdvbqbmwffggl`vnfmwfg`lolq9 333ujgfl#dbnf`lnnjppjlmqfeof`wjmd`kbmdf#wkfbppl`jbwfgpbmp.pfqjelmhfzsqfpp8#sbggjmd9Kf#tbp#wkfvmgfqozjmdwzsj`booz#/#bmg#wkf#pq`Fofnfmwpv``fppjufpjm`f#wkf#pklvog#af#mfwtlqhjmdb``lvmwjmdvpf#le#wkfoltfq#wkbmpkltp#wkbw?,psbm=\t\n\n`lnsobjmwp`lmwjmvlvprvbmwjwjfpbpwqlmlnfqkf#gjg#mlwgvf#wl#jwpbssojfg#wlbm#bufqbdffeelqwp#wlwkf#evwvqfbwwfnsw#wlWkfqfelqf/`bsbajojwzQfsvaoj`bmtbp#elqnfgFof`wqlmj`hjolnfwfqp`kboofmdfpsvaojpkjmdwkf#elqnfqjmgjdfmlvpgjqf`wjlmppvapjgjbqz`lmpsjqb`zgfwbjop#lebmg#jm#wkfbeelqgbaofpvapwbm`fpqfbplm#elq`lmufmwjlmjwfnwzsf>!baplovwfozpvsslpfgozqfnbjmfg#bbwwqb`wjufwqbufoojmdpfsbqbwfozel`vpfp#lmfofnfmwbqzbssoj`baofelvmg#wkbwpwzofpkffwnbmvp`qjswpwbmgp#elq#ml.qfsfbw+plnfwjnfp@lnnfq`jbojm#Bnfqj`bvmgfqwbhfmrvbqwfq#lebm#f{bnsofsfqplmboozjmgf{-sks<?,avwwlm=\tsfq`fmwbdfafpw.hmltm`qfbwjmd#b!#gjq>!owqOjfvwfmbmw\t?gju#jg>!wkfz#tlvogbajojwz#lenbgf#vs#lemlwfg#wkbw`ofbq#wkbwbqdvf#wkbwwl#bmlwkfq`kjogqfm$psvqslpf#leelqnvobwfgabpfg#vslmwkf#qfdjlmpvaif`w#lesbppfmdfqpslppfppjlm-\t\tJm#wkf#Afelqf#wkfbewfqtbqgp`vqqfmwoz#b`qlpp#wkfp`jfmwjej``lnnvmjwz-`bsjwbojpnjm#Dfqnbmzqjdkw.tjmdwkf#pzpwfnPl`jfwz#leslojwj`jbmgjqf`wjlm9tfmw#lm#wlqfnlubo#le#Mft#Zlqh#bsbqwnfmwpjmgj`bwjlmgvqjmd#wkfvmofpp#wkfkjpwlqj`bokbg#affm#bgfejmjwjufjmdqfgjfmwbwwfmgbm`f@fmwfq#elqsqlnjmfm`fqfbgzPwbwfpwqbwfdjfpavw#jm#wkfbp#sbqw#le`lmpwjwvwf`objn#wkbwobalqbwlqz`lnsbwjaofebjovqf#le/#pv`k#bp#afdbm#tjwkvpjmd#wkf#wl#sqlujgfefbwvqf#leeqln#tkj`k,!#`obpp>!dfloldj`bopfufqbo#legfojafqbwfjnslqwbmw#klogp#wkbwjmd%rvlw8#ubojdm>wlswkf#Dfqnbmlvwpjgf#lemfdlwjbwfgkjp#`bqffqpfsbqbwjlmjg>!pfbq`ktbp#`boofgwkf#elvqwkqf`qfbwjlmlwkfq#wkbmsqfufmwjlmtkjof#wkf#fgv`bwjlm/`lmmf`wjmdb``vqbwfoztfqf#avjowtbp#hjoofgbdqffnfmwpnv`k#nlqf#Gvf#wl#wkftjgwk9#233plnf#lwkfqHjmdgln#lewkf#fmwjqfebnlvp#elqwl#`lmmf`wlaif`wjufpwkf#Eqfm`ksflsof#bmgefbwvqfg!=jp#pbjg#wlpwqv`wvqboqfefqfmgvnnlpw#lewfmb#pfsbqbwf.=\t?gju#jg#Leej`jbo#tlqogtjgf-bqjb.obafowkf#sobmfwbmg#jw#tbpg!#ubovf>!ollhjmd#bwafmfej`jbobqf#jm#wkfnlmjwlqjmdqfslqwfgozwkf#nlgfqmtlqhjmd#lmbooltfg#wltkfqf#wkf#jmmlubwjuf?,b=?,gju=plvmgwqb`hpfbq`kElqnwfmg#wl#afjmsvw#jg>!lsfmjmd#leqfpwqj`wfgbglswfg#azbggqfppjmdwkfloldjbmnfwklgp#leubqjbmw#le@kqjpwjbm#ufqz#obqdfbvwlnlwjufaz#ebq#wkfqbmdf#eqlnsvqpvjw#leeloolt#wkfaqlvdkw#wljm#Fmdobmgbdqff#wkbwb``vpfg#le`lnfp#eqlnsqfufmwjmdgju#pwzof>kjp#lq#kfqwqfnfmglvpeqffgln#le`lm`fqmjmd3#2fn#2fn8Abphfwaboo,pwzof-`ppbm#fbqojfqfufm#bewfq,!#wjwof>!-`ln,jmgf{wbhjmd#wkfsjwwpavqdk`lmwfmw!=\x0E?p`qjsw=+ewvqmfg#lvwkbujmd#wkf?,psbm=\x0E\t#l``bpjlmboaf`bvpf#jwpwbqwfg#wlskzpj`booz=?,gju=\t##`qfbwfg#az@vqqfmwoz/#ad`lolq>!wbajmgf{>!gjpbpwqlvpBmbozwj`p#bopl#kbp#b=?gju#jg>!?,pwzof=\t?`boofg#elqpjmdfq#bmg-pq`#>#!,,ujlobwjlmpwkjp#sljmw`lmpwbmwozjp#ol`bwfgqf`lqgjmdpg#eqln#wkfmfgfqobmgpslqwvdv/Fp;N;};D;u;F5m4K4]4_7`gfpbqqlool`lnfmwbqjlfgv`b`j/_mpfswjfnaqfqfdjpwqbglgjqf``j/_mvaj`b`j/_msvaoj`jgbgqfpsvfpwbpqfpvowbglpjnslqwbmwfqfpfqubglpbqw/A`volpgjefqfmwfppjdvjfmwfpqfs/Vaoj`bpjwvb`j/_mnjmjpwfqjlsqjub`jgbggjqf`wlqjlelqnb`j/_mslaob`j/_msqfpjgfmwf`lmw", "fmjglpb``fplqjlpwf`kmlqbwjsfqplmbofp`bwfdlq/Abfpsf`jbofpgjpslmjaofb`wvbojgbgqfefqfm`jbuboobglojgajaojlwf`bqfob`jlmfp`bofmgbqjlslo/Awj`bpbmwfqjlqfpgl`vnfmwlpmbwvqbofybnbwfqjbofpgjefqfm`jbf`lm/_nj`bwqbmpslqwfqlgq/Advfysbqwj`jsbqfm`vfmwqbmgjp`vpj/_mfpwqv`wvqbevmgb`j/_meqf`vfmwfpsfqnbmfmwfwlwbonfmwf<P<R<Z<Q<R<]=o<X<Y=n<P<R<Z<Y=n<^=l<Y<P=c=n<\\<V<Z<Y=k=n<R<]=g<]<R<W<Y<Y<R=k<Y<Q=`=a=n<R<_<R<V<R<_<X<\\<S<R=m<W<Y<^=m<Y<_<R=m<\\<U=n<Y=k<Y=l<Y<[<P<R<_=o=n=m<\\<U=n<\\<Z<T<[<Q<T<P<Y<Z<X=o<]=o<X=o=n<s<R<T=m<V<[<X<Y=m=`<^<T<X<Y<R=m<^=c<[<T<Q=o<Z<Q<R=m<^<R<Y<U<W=b<X<Y<U<S<R=l<Q<R<P<Q<R<_<R<X<Y=n<Y<U=m<^<R<T=i<S=l<\\<^<\\=n<\\<V<R<U<P<Y=m=n<R<T<P<Y<Y=n<Z<T<[<Q=`<R<X<Q<R<U<W=o=k=d<Y<S<Y=l<Y<X=k<\\=m=n<T=k<\\=m=n=`=l<\\<]<R=n<Q<R<^=g=i<S=l<\\<^<R=m<R<]<R<U<S<R=n<R<P<P<Y<Q<Y<Y=k<T=m<W<Y<Q<R<^=g<Y=o=m<W=o<_<R<V<R<W<R<Q<\\<[<\\<X=n<\\<V<R<Y=n<R<_<X<\\<S<R=k=n<T<s<R=m<W<Y=n<\\<V<T<Y<Q<R<^=g<U=m=n<R<T=n=n<\\<V<T=i=m=l<\\<[=o<M<\\<Q<V=n=h<R=l=o<P<v<R<_<X<\\<V<Q<T<_<T=m<W<R<^<\\<Q<\\=d<Y<U<Q<\\<U=n<T=m<^<R<T<P=m<^=c<[=`<W=b<]<R<U=k<\\=m=n<R=m=l<Y<X<T<v=l<R<P<Y<H<R=l=o<P=l=g<Q<V<Y=m=n<\\<W<T<S<R<T=m<V=n=g=m=c=k<P<Y=m=c=j=j<Y<Q=n=l=n=l=o<X<\\=m<\\<P=g=i=l=g<Q<V<\\<q<R<^=g<U=k<\\=m<R<^<P<Y=m=n<\\=h<T<W=`<P<P<\\=l=n<\\=m=n=l<\\<Q<P<Y=m=n<Y=n<Y<V=m=n<Q<\\=d<T=i<P<T<Q=o=n<T<P<Y<Q<T<T<P<Y=b=n<Q<R<P<Y=l<_<R=l<R<X=m<\\<P<R<P=a=n<R<P=o<V<R<Q=j<Y=m<^<R<Y<P<V<\\<V<R<U<|=l=i<T<^5i5j4F4C5e4I4]4_4K5h4]4_4K5h4E4K5h4U4K5i5o4F4D5k4K4D4]4K5i4@4K5h5f5d5i4K5h4Y5d4]4@4C5f4C4E4K5h4U4Z5d4I4Z4K5m4E4K5h5n4_5i4K5h4U4K4D4F4A5i5f5h5i5h5m4K4F5i5h4F5n5e4F4U4C5f5h4K5h4X4U4]4O4B4D4K4]4F4[5d5f4]4U5h5f5o5i4I4]5m4K5n4[5h4D4K4F4K5h5h4V4E4F4]4F5f4D4K5h5j4K4_4K5h4X5f4B5i5j4F4C5f4K5h4U4]4D4K5h5n4Y4Y4K5m5h4K5i4U5h5f5k4K4F4A4C5f4G4K5h5h5k5i4K5h4U5i5h5i5o4F4D4E5f5i5o5j5o4K5h4[5m5h5m5f4C5f5d4I4C4K4]4E4F4K4]5f4B4K5h4Y4A4E4F4_4@5f5h4K5h5d5n4F4U5j4C5i4K5i4C5f5j4E4F4Y5i5f5i4O4]4X5f5m4K5h4\\5f5j4U4]4D5f4E4D5d4K4D4E4O5h4U4K4D4K5h4_5m4]5i4X4K5o5h4F4U4K5h5e4K5h4O5d5h4K5h4_5j4E4@4K5i4U4E4K5h4Y4A5m4K5h4C5f5j5o5h5i4K4F4K5h4B4K4Y4K5h5i5h5m4O4U4Z4K4M5o4F4K4D4E4K5h4B5f4]4]4_4K4J5h4K5h5n5h4D4K5h4O4C4D5i5n4K4[4U5i4]4K4_5h5i5j4[5n4E4K5h5o4F4D4K5h4]4@5h4K4X4F4]5o4K5h5n4C5i5f4U4[5f5opAzWbdMbnf+-isd!#bow>!2s{#plojg# -dje!#bow>!wqbmpsbqfmwjmelqnbwjlmbssoj`bwjlm!#lm`oj`h>!fpwbaojpkfgbgufqwjpjmd-smd!#bow>!fmujqlmnfmwsfqelqnbm`fbssqlsqjbwf%bns8ngbpk8jnnfgjbwfoz?,pwqlmd=?,qbwkfq#wkbmwfnsfqbwvqfgfufolsnfmw`lnsfwjwjlmsob`fklogfqujpjajojwz9`lszqjdkw!=3!#kfjdkw>!fufm#wklvdkqfsob`fnfmwgfpwjmbwjlm@lqslqbwjlm?vo#`obpp>!Bppl`jbwjlmjmgjujgvbopsfqpsf`wjufpfwWjnflvw+vqo+kwws9,,nbwkfnbwj`pnbqdjm.wls9fufmwvbooz#gfp`qjswjlm*#ml.qfsfbw`loof`wjlmp-ISD\x7Fwkvna\x7Fsbqwj`jsbwf,kfbg=?algzeolbw9ofew8?oj#`obpp>!kvmgqfgp#le\t\tKltfufq/#`lnslpjwjlm`ofbq9alwk8`llsfqbwjlmtjwkjm#wkf#obafo#elq>!alqgfq.wls9Mft#Yfbobmgqf`lnnfmgfgsklwldqbskzjmwfqfpwjmd%ow8pvs%dw8`lmwqlufqpzMfwkfqobmgpbowfqmbwjufnb{ofmdwk>!ptjwyfqobmgGfufolsnfmwfppfmwjbooz\t\tBowklvdk#?,wf{wbqfb=wkvmgfqajqgqfsqfpfmwfg%bns8mgbpk8psf`vobwjlm`lnnvmjwjfpofdjpobwjlmfof`wqlmj`p\t\n?gju#jg>!joovpwqbwfgfmdjmffqjmdwfqqjwlqjfpbvwklqjwjfpgjpwqjavwfg5!#kfjdkw>!pbmp.pfqje8`bsbaof#le#gjpbssfbqfgjmwfqb`wjufollhjmd#elqjw#tlvog#afBedkbmjpwbmtbp#`qfbwfgNbwk-eollq+pvqqlvmgjmd`bm#bopl#aflapfqubwjlmnbjmwfmbm`ffm`lvmwfqfg?k1#`obpp>!nlqf#qf`fmwjw#kbp#affmjmubpjlm#le*-dfwWjnf+*evmgbnfmwboGfpsjwf#wkf!=?gju#jg>!jmpsjqbwjlmf{bnjmbwjlmsqfsbqbwjlmf{sobmbwjlm?jmsvw#jg>!?,b=?,psbm=ufqpjlmp#lejmpwqvnfmwpafelqf#wkf##>#$kwws9,,Gfp`qjswjlmqfobwjufoz#-pvapwqjmd+fb`k#le#wkff{sfqjnfmwpjmeovfmwjbojmwfdqbwjlmnbmz#sflsofgvf#wl#wkf#`lnajmbwjlmgl#mlw#kbufNjggof#Fbpw?mlp`qjsw=?`lszqjdkw!#sfqkbsp#wkfjmpwjwvwjlmjm#Gf`fnafqbqqbmdfnfmwnlpw#ebnlvpsfqplmbojwz`qfbwjlm#leojnjwbwjlmpf{`ovpjufozplufqfjdmwz.`lmwfmw!=\t?wg#`obpp>!vmgfqdqlvmgsbqboofo#wlgl`wqjmf#lel``vsjfg#azwfqnjmloldzQfmbjppbm`fb#mvnafq#lepvsslqw#elqf{solqbwjlmqf`ldmjwjlmsqfgf`fpplq?jnd#pq`>!,?k2#`obpp>!svaoj`bwjlmnbz#bopl#afpsf`jbojyfg?,ejfogpfw=sqldqfppjufnjoojlmp#lepwbwfp#wkbwfmelq`fnfmwbqlvmg#wkf#lmf#bmlwkfq-sbqfmwMlgfbdqj`vowvqfBowfqmbwjufqfpfbq`kfqpwltbqgp#wkfNlpw#le#wkfnbmz#lwkfq#+fpsf`jbooz?wg#tjgwk>!8tjgwk9233&jmgfsfmgfmw?k0#`obpp>!#lm`kbmdf>!*-bgg@obpp+jmwfqb`wjlmLmf#le#wkf#gbvdkwfq#leb``fpplqjfpaqbm`kfp#le\x0E\t?gju#jg>!wkf#obqdfpwgf`obqbwjlmqfdvobwjlmpJmelqnbwjlmwqbmpobwjlmgl`vnfmwbqzjm#lqgfq#wl!=\t?kfbg=\t?!#kfjdkw>!2b`qlpp#wkf#lqjfmwbwjlm*8?,p`qjsw=jnsofnfmwfg`bm#af#pffmwkfqf#tbp#bgfnlmpwqbwf`lmwbjmfq!=`lmmf`wjlmpwkf#Aqjwjpktbp#tqjwwfm\"jnslqwbmw8s{8#nbqdjm.elooltfg#azbajojwz#wl#`lnsoj`bwfggvqjmd#wkf#jnnjdqbwjlmbopl#`boofg?k7#`obpp>!gjpwjm`wjlmqfsob`fg#azdlufqmnfmwpol`bwjlm#lejm#Mlufnafqtkfwkfq#wkf?,s=\t?,gju=b`rvjpjwjlm`boofg#wkf#sfqpf`vwjlmgfpjdmbwjlmxelmw.pjyf9bssfbqfg#jmjmufpwjdbwff{sfqjfm`fgnlpw#ojhfoztjgfoz#vpfggjp`vppjlmpsqfpfm`f#le#+gl`vnfmw-f{wfmpjufozJw#kbp#affmjw#glfp#mlw`lmwqbqz#wljmkbajwbmwpjnsqlufnfmwp`klobqpkjs`lmpvnswjlmjmpwqv`wjlmelq#f{bnsoflmf#lq#nlqfs{8#sbggjmdwkf#`vqqfmwb#pfqjfp#lebqf#vpvboozqlof#jm#wkfsqfujlvpoz#gfqjubwjufpfujgfm`f#lef{sfqjfm`fp`lolqp`kfnfpwbwfg#wkbw`fqwjej`bwf?,b=?,gju=\t#pfof`wfg>!kjdk#p`klloqfpslmpf#wl`lnelqwbaofbglswjlm#lewkqff#zfbqpwkf#`lvmwqzjm#Efaqvbqzpl#wkbw#wkfsflsof#tkl#sqlujgfg#az?sbqbn#mbnfbeef`wfg#azjm#wfqnp#lebssljmwnfmwJPL.;;6:.2!tbp#alqm#jmkjpwlqj`bo#qfdbqgfg#bpnfbpvqfnfmwjp#abpfg#lm#bmg#lwkfq#9#evm`wjlm+pjdmjej`bmw`fofaqbwjlmwqbmpnjwwfg,ip,irvfqz-jp#hmltm#bpwkflqfwj`bo#wbajmgf{>!jw#`lvog#af?mlp`qjsw=\tkbujmd#affm\x0E\t?kfbg=\x0E\t?#%rvlw8Wkf#`lnsjobwjlmkf#kbg#affmsqlgv`fg#azskjolplskfq`lmpwqv`wfgjmwfmgfg#wlbnlmd#lwkfq`lnsbqfg#wlwl#pbz#wkbwFmdjmffqjmdb#gjeefqfmwqfefqqfg#wlgjeefqfm`fpafojfe#wkbwsklwldqbskpjgfmwjezjmdKjpwlqz#le#Qfsvaoj`#lemf`fppbqjozsqlabajojwzwf`kmj`boozofbujmd#wkfpsf`wb`vobqeqb`wjlm#lefof`wqj`jwzkfbg#le#wkfqfpwbvqbmwpsbqwmfqpkjsfnskbpjp#lmnlpw#qf`fmwpkbqf#tjwk#pbzjmd#wkbwejoofg#tjwkgfpjdmfg#wljw#jp#lewfm!=?,jeqbnf=bp#elooltp9nfqdfg#tjwkwkqlvdk#wkf`lnnfq`jbo#sljmwfg#lvwlsslqwvmjwzujft#le#wkfqfrvjqfnfmwgjujpjlm#lesqldqbnnjmdkf#qf`fjufgpfwJmwfqubo!=?,psbm=?,jm#Mft#Zlqhbggjwjlmbo#`lnsqfppjlm\t\t?gju#jg>!jm`lqslqbwf8?,p`qjsw=?bwwb`kFufmwaf`bnf#wkf#!#wbqdfw>!\\`bqqjfg#lvwPlnf#le#wkfp`jfm`f#bmgwkf#wjnf#le@lmwbjmfq!=nbjmwbjmjmd@kqjpwlskfqNv`k#le#wkftqjwjmdp#le!#kfjdkw>!1pjyf#le#wkfufqpjlm#le#nj{wvqf#le#afwtffm#wkfF{bnsofp#lefgv`bwjlmbo`lnsfwjwjuf#lmpvanjw>!gjqf`wlq#legjpwjm`wjuf,GWG#[KWNO#qfobwjmd#wlwfmgfm`z#wlsqlujm`f#letkj`k#tlvoggfpsjwf#wkfp`jfmwjej`#ofdjpobwvqf-jmmfqKWNO#boofdbwjlmpBdqj`vowvqftbp#vpfg#jmbssqlb`k#wljmwfoojdfmwzfbqp#obwfq/pbmp.pfqjegfwfqnjmjmdSfqelqnbm`fbssfbqbm`fp/#tkj`k#jp#elvmgbwjlmpbaaqfujbwfgkjdkfq#wkbmp#eqln#wkf#jmgjujgvbo#`lnslpfg#lepvsslpfg#wl`objnp#wkbwbwwqjavwjlmelmw.pjyf92fofnfmwp#leKjpwlqj`bo#kjp#aqlwkfqbw#wkf#wjnfbmmjufqpbqzdlufqmfg#azqfobwfg#wl#vowjnbwfoz#jmmlubwjlmpjw#jp#pwjoo`bm#lmoz#afgfejmjwjlmpwlDNWPwqjmdB#mvnafq#lejnd#`obpp>!Fufmwvbooz/tbp#`kbmdfgl``vqqfg#jmmfjdkalqjmdgjpwjmdvjpktkfm#kf#tbpjmwqlgv`jmdwfqqfpwqjboNbmz#le#wkfbqdvfp#wkbwbm#Bnfqj`bm`lmrvfpw#letjgfpsqfbg#tfqf#hjoofgp`qffm#bmg#Jm#lqgfq#wlf{sf`wfg#wlgfp`fmgbmwpbqf#ol`bwfgofdjpobwjufdfmfqbwjlmp#ab`hdqlvmgnlpw#sflsofzfbqp#bewfqwkfqf#jp#mlwkf#kjdkfpweqfrvfmwoz#wkfz#gl#mlwbqdvfg#wkbwpkltfg#wkbwsqfglnjmbmwwkfloldj`boaz#wkf#wjnf`lmpjgfqjmdpklqw.ojufg?,psbm=?,b=`bm#af#vpfgufqz#ojwwoflmf#le#wkf#kbg#boqfbgzjmwfqsqfwfg`lnnvmj`bwfefbwvqfp#ledlufqmnfmw/?,mlp`qjsw=fmwfqfg#wkf!#kfjdkw>!0Jmgfsfmgfmwslsvobwjlmpobqdf.p`bof-#Bowklvdk#vpfg#jm#wkfgfpwqv`wjlmslppjajojwzpwbqwjmd#jmwtl#lq#nlqff{sqfppjlmppvalqgjmbwfobqdfq#wkbmkjpwlqz#bmg?,lswjlm=\x0E\t@lmwjmfmwbofojnjmbwjmdtjoo#mlw#afsqb`wj`f#lejm#eqlmw#lepjwf#le#wkffmpvqf#wkbwwl#`qfbwf#bnjppjppjssjslwfmwjboozlvwpwbmgjmdafwwfq#wkbmtkbw#jp#mltpjwvbwfg#jmnfwb#mbnf>!WqbgjwjlmbopvddfpwjlmpWqbmpobwjlmwkf#elqn#lebwnlpskfqj`jgfloldj`bofmwfqsqjpfp`bo`vobwjmdfbpw#le#wkfqfnmbmwp#lesovdjmpsbdf,jmgf{-sks<qfnbjmfg#jmwqbmpelqnfgKf#tbp#bopltbp#boqfbgzpwbwjpwj`bojm#ebulq#leNjmjpwqz#lenlufnfmw#leelqnvobwjlmjp#qfrvjqfg?ojmh#qfo>!Wkjp#jp#wkf#?b#kqfe>!,slsvobqjyfgjmuloufg#jmbqf#vpfg#wlbmg#pfufqbonbgf#az#wkfpffnp#wl#afojhfoz#wkbwSbofpwjmjbmmbnfg#bewfqjw#kbg#affmnlpw#`lnnlmwl#qfefq#wlavw#wkjp#jp`lmpf`vwjufwfnslqbqjozJm#dfmfqbo/`lmufmwjlmpwbhfp#sob`fpvagjujpjlmwfqqjwlqjbolsfqbwjlmbosfqnbmfmwoztbp#obqdfozlvwaqfbh#lejm#wkf#sbpwelooltjmd#b#{nomp9ld>!=?b#`obpp>!`obpp>!wf{w@lmufqpjlm#nbz#af#vpfgnbmveb`wvqfbewfq#afjmd`ofbqej{!=\trvfpwjlm#letbp#fof`wfgwl#af`lnf#baf`bvpf#le#plnf#sflsofjmpsjqfg#azpv``fppevo#b#wjnf#tkfmnlqf#`lnnlmbnlmdpw#wkfbm#leej`jbotjgwk9233&8wf`kmloldz/tbp#bglswfgwl#hffs#wkfpfwwofnfmwpojuf#ajqwkpjmgf{-kwno!@lmmf`wj`vwbppjdmfg#wl%bns8wjnfp8b``lvmw#elqbojdm>qjdkwwkf#`lnsbmzbotbzp#affmqfwvqmfg#wljmuloufnfmwAf`bvpf#wkfwkjp#sfqjlg!#mbnf>!r!#`lmejmfg#wlb#qfpvow#leubovf>!!#,=jp#b`wvboozFmujqlmnfmw\x0E\t?,kfbg=\x0E\t@lmufqpfoz/=\t?gju#jg>!3!#tjgwk>!2jp#sqlabaozkbuf#af`lnf`lmwqloojmdwkf#sqlaofn`jwjyfmp#leslojwj`jbmpqfb`kfg#wkfbp#fbqoz#bp9mlmf8#lufq?wbaof#`fooubojgjwz#legjqf`woz#wllmnlvpfgltmtkfqf#jw#jptkfm#jw#tbpnfnafqp#le#qfobwjlm#wlb``lnnlgbwfbolmd#tjwk#Jm#wkf#obwfwkf#Fmdojpkgfoj`jlvp!=wkjp#jp#mlwwkf#sqfpfmwje#wkfz#bqfbmg#ejmboozb#nbwwfq#le\x0E\t\n?,gju=\x0E\t\x0E\t?,p`qjsw=ebpwfq#wkbmnbilqjwz#lebewfq#tkj`k`lnsbqbwjufwl#nbjmwbjmjnsqluf#wkfbtbqgfg#wkffq!#`obpp>!eqbnfalqgfqqfpwlqbwjlmjm#wkf#pbnfbmbozpjp#lewkfjq#ejqpwGvqjmd#wkf#`lmwjmfmwbopfrvfm`f#leevm`wjlm+*xelmw.pjyf9#tlqh#lm#wkf?,p`qjsw=\t?afdjmp#tjwkibubp`qjsw9`lmpwjwvfmwtbp#elvmgfgfrvjojaqjvnbppvnf#wkbwjp#djufm#azmffgp#wl#af`llqgjmbwfpwkf#ubqjlvpbqf#sbqw#lelmoz#jm#wkfpf`wjlmp#lejp#b#`lnnlmwkflqjfp#legjp`lufqjfpbppl`jbwjlmfgdf#le#wkfpwqfmdwk#leslpjwjlm#jmsqfpfmw.gbzvmjufqpboozwl#elqn#wkfavw#jmpwfbg`lqslqbwjlmbwwb`kfg#wljp#`lnnlmozqfbplmp#elq#%rvlw8wkf#`bm#af#nbgftbp#baof#wltkj`k#nfbmpavw#gjg#mlwlmNlvpfLufqbp#slppjaoflsfqbwfg#az`lnjmd#eqlnwkf#sqjnbqzbggjwjlm#leelq#pfufqbowqbmpefqqfgb#sfqjlg#lebqf#baof#wlkltfufq/#jwpklvog#kbufnv`k#obqdfq\t\n?,p`qjsw=bglswfg#wkfsqlsfqwz#legjqf`wfg#azfeef`wjufoztbp#aqlvdkw`kjogqfm#leSqldqbnnjmdolmdfq#wkbmnbmvp`qjswptbq#bdbjmpwaz#nfbmp#lebmg#nlpw#lepjnjobq#wl#sqlsqjfwbqzlqjdjmbwjmdsqfpwjdjlvpdqbnnbwj`bof{sfqjfm`f-wl#nbhf#wkfJw#tbp#bopljp#elvmg#jm`lnsfwjwlqpjm#wkf#V-P-qfsob`f#wkfaqlvdkw#wkf`bo`vobwjlmeboo#le#wkfwkf#dfmfqbosqb`wj`boozjm#klmlq#leqfofbpfg#jmqfpjgfmwjbobmg#plnf#lehjmd#le#wkfqfb`wjlm#wl2pw#Fbqo#le`vowvqf#bmgsqjm`jsbooz?,wjwof=\t##wkfz#`bm#afab`h#wl#wkfplnf#le#kjpf{slpvqf#wlbqf#pjnjobqelqn#le#wkfbggEbulqjwf`jwjyfmpkjssbqw#jm#wkfsflsof#tjwkjm#sqb`wj`fwl#`lmwjmvf%bns8njmvp8bssqlufg#az#wkf#ejqpw#booltfg#wkfbmg#elq#wkfevm`wjlmjmdsobzjmd#wkfplovwjlm#wlkfjdkw>!3!#jm#kjp#allhnlqf#wkbm#belooltp#wkf`qfbwfg#wkfsqfpfm`f#jm%maps8?,wg=mbwjlmbojpwwkf#jgfb#leb#`kbqb`wfqtfqf#elq`fg#`obpp>!awmgbzp#le#wkfefbwvqfg#jmpkltjmd#wkfjmwfqfpw#jmjm#sob`f#lewvqm#le#wkfwkf#kfbg#leOlqg#le#wkfslojwj`boozkbp#jwp#ltmFgv`bwjlmbobssqlubo#leplnf#le#wkffb`k#lwkfq/afkbujlq#lebmg#af`bvpfbmg#bmlwkfqbssfbqfg#lmqf`lqgfg#jmaob`h%rvlw8nbz#jm`ovgfwkf#tlqog$p`bm#ofbg#wlqfefqp#wl#balqgfq>!3!#dlufqmnfmw#tjmmjmd#wkfqfpvowfg#jm#tkjof#wkf#Tbpkjmdwlm/wkf#pvaif`w`jwz#jm#wkf=?,gju=\x0E\t\n\nqfeof`w#wkfwl#`lnsofwfaf`bnf#nlqfqbgjlb`wjufqfif`wfg#aztjwklvw#bmzkjp#ebwkfq/tkj`k#`lvog`lsz#le#wkfwl#jmgj`bwfb#slojwj`bob``lvmwp#le`lmpwjwvwfptlqhfg#tjwkfq?,b=?,oj=le#kjp#ojefb``lnsbmjfg`ojfmwTjgwksqfufmw#wkfOfdjpobwjufgjeefqfmwozwldfwkfq#jmkbp#pfufqboelq#bmlwkfqwf{w#le#wkfelvmgfg#wkff#tjwk#wkf#jp#vpfg#elq`kbmdfg#wkfvpvbooz#wkfsob`f#tkfqftkfqfbp#wkf=#?b#kqfe>!!=?b#kqfe>!wkfnpfoufp/bowklvdk#kfwkbw#`bm#afwqbgjwjlmboqlof#le#wkfbp#b#qfpvowqfnluf@kjoggfpjdmfg#aztfpw#le#wkfPlnf#sflsofsqlgv`wjlm/pjgf#le#wkfmftpofwwfqpvpfg#az#wkfgltm#wl#wkfb``fswfg#azojuf#jm#wkfbwwfnswp#wllvwpjgf#wkfeqfrvfm`jfpKltfufq/#jmsqldqbnnfqpbw#ofbpw#jmbssql{jnbwfbowklvdk#jwtbp#sbqw#lebmg#ubqjlvpDlufqmlq#lewkf#bqwj`ofwvqmfg#jmwl=?b#kqfe>!,wkf#f`lmlnzjp#wkf#nlpwnlpw#tjgfoztlvog#obwfqbmg#sfqkbspqjpf#wl#wkfl``vqp#tkfmvmgfq#tkj`k`lmgjwjlmp-wkf#tfpwfqmwkflqz#wkbwjp#sqlgv`fgwkf#`jwz#lejm#tkj`k#kfpffm#jm#wkfwkf#`fmwqboavjogjmd#lenbmz#le#kjpbqfb#le#wkfjp#wkf#lmoznlpw#le#wkfnbmz#le#wkfwkf#TfpwfqmWkfqf#jp#mlf{wfmgfg#wlPwbwjpwj`bo`lopsbm>1#\x7Fpklqw#pwlqzslppjaof#wlwlsloldj`bo`qjwj`bo#leqfslqwfg#wlb#@kqjpwjbmgf`jpjlm#wljp#frvbo#wlsqlaofnp#leWkjp#`bm#afnfq`kbmgjpfelq#nlpw#leml#fujgfm`ffgjwjlmp#lefofnfmwp#jm%rvlw8-#Wkf`ln,jnbdfp,tkj`k#nbhfpwkf#sql`fppqfnbjmp#wkfojwfqbwvqf/jp#b#nfnafqwkf#slsvobqwkf#bm`jfmwsqlaofnp#jmwjnf#le#wkfgfefbwfg#azalgz#le#wkfb#eft#zfbqpnv`k#le#wkfwkf#tlqh#le@bojelqmjb/pfqufg#bp#bdlufqmnfmw-`lm`fswp#lenlufnfmw#jm\n\n?gju#jg>!jw!#ubovf>!obmdvbdf#lebp#wkfz#bqfsqlgv`fg#jmjp#wkbw#wkff{sobjm#wkfgju=?,gju=\tKltfufq#wkfofbg#wl#wkf\n?b#kqfe>!,tbp#dqbmwfgsflsof#kbuf`lmwjmvbooztbp#pffm#bpbmg#qfobwfgwkf#qlof#lesqlslpfg#azle#wkf#afpwfb`k#lwkfq-@lmpwbmwjmfsflsof#eqlngjbof`wp#lewl#qfujpjlmtbp#qfmbnfgb#plvq`f#lewkf#jmjwjboobvm`kfg#jmsqlujgf#wkfwl#wkf#tfpwtkfqf#wkfqfbmg#pjnjobqafwtffm#wtljp#bopl#wkfFmdojpk#bmg`lmgjwjlmp/wkbw#jw#tbpfmwjwofg#wlwkfnpfoufp-rvbmwjwz#leqbmpsbqfm`zwkf#pbnf#bpwl#iljm#wkf`lvmwqz#bmgwkjp#jp#wkfWkjp#ofg#wlb#pwbwfnfmw`lmwqbpw#wlobpwJmgf{Lewkqlvdk#kjpjp#gfpjdmfgwkf#wfqn#jpjp#sqlujgfgsqlwf`w#wkfmd?,b=?,oj=Wkf#`vqqfmwwkf#pjwf#lepvapwbmwjbof{sfqjfm`f/jm#wkf#Tfpwwkfz#pklvogpolufm(ajmb`lnfmwbqjlpvmjufqpjgbg`lmgj`jlmfpb`wjujgbgfpf{sfqjfm`jbwf`mlold/Absqlgv``j/_msvmwvb`j/_mbsoj`b`j/_m`lmwqbpf/]b`bwfdlq/Abpqfdjpwqbqpfsqlefpjlmbowqbwbnjfmwlqfd/Apwqbwfpf`qfwbq/Absqjm`jsbofpsqlwf``j/_mjnslqwbmwfpjnslqwbm`jbslpjajojgbgjmwfqfpbmwf`qf`jnjfmwlmf`fpjgbgfppvp`qjajqpfbpl`jb`j/_mgjpslmjaofpfubovb`j/_mfpwvgjbmwfpqfpslmpbaofqfplov`j/_mdvbgbobibqbqfdjpwqbglplslqwvmjgbg`lnfq`jbofpelwldqbe/Abbvwlqjgbgfpjmdfmjfq/Abwfofujpj/_m`lnsfwfm`jblsfqb`jlmfpfpwbaof`jglpjnsofnfmwfb`wvbonfmwfmbufdb`j/_m`lmelqnjgbgojmf.kfjdkw9elmw.ebnjoz9!#9#!kwws9,,bssoj`bwjlmpojmh!#kqfe>!psf`jej`booz,,?\"X@GBWBX\tLqdbmjybwjlmgjpwqjavwjlm3s{8#kfjdkw9qfobwjlmpkjsgfuj`f.tjgwk?gju#`obpp>!?obafo#elq>!qfdjpwqbwjlm?,mlp`qjsw=\t,jmgf{-kwno!tjmglt-lsfm+#\"jnslqwbmw8bssoj`bwjlm,jmgfsfmgfm`f,,ttt-dlldoflqdbmjybwjlmbvwl`lnsofwfqfrvjqfnfmwp`lmpfqubwjuf?elqn#mbnf>!jmwfoof`wvbonbqdjm.ofew92;wk#`fmwvqzbm#jnslqwbmwjmpwjwvwjlmpbaaqfujbwjlm?jnd#`obpp>!lqdbmjpbwjlm`jujojybwjlm2:wk#`fmwvqzbq`kjwf`wvqfjm`lqslqbwfg13wk#`fmwvqz.`lmwbjmfq!=nlpw#mlwbaoz,=?,b=?,gju=mlwjej`bwjlm$vmgfejmfg$*Evqwkfqnlqf/afojfuf#wkbwjmmfqKWNO#>#sqjlq#wl#wkfgqbnbwj`boozqfefqqjmd#wlmfdlwjbwjlmpkfbgrvbqwfqpPlvwk#Beqj`bvmpv``fppevoSfmmpzoubmjbBp#b#qfpvow/?kwno#obmd>!%ow8,pvs%dw8gfbojmd#tjwkskjobgfoskjbkjpwlqj`booz*8?,p`qjsw=\tsbggjmd.wls9f{sfqjnfmwbodfwBwwqjavwfjmpwqv`wjlmpwf`kmloldjfpsbqw#le#wkf#>evm`wjlm+*xpvap`qjswjlmo-gwg!=\x0E\t?kwdfldqbskj`bo@lmpwjwvwjlm$/#evm`wjlm+pvsslqwfg#azbdqj`vowvqbo`lmpwqv`wjlmsvaoj`bwjlmpelmw.pjyf9#2b#ubqjfwz#le?gju#pwzof>!Fm`z`olsfgjbjeqbnf#pq`>!gfnlmpwqbwfgb``lnsojpkfgvmjufqpjwjfpGfnldqbskj`p*8?,p`qjsw=?gfgj`bwfg#wlhmltofgdf#lepbwjpeb`wjlmsbqwj`vobqoz?,gju=?,gju=Fmdojpk#+VP*bssfmg@kjog+wqbmpnjppjlmp-#Kltfufq/#jmwfoojdfm`f!#wbajmgf{>!eolbw9qjdkw8@lnnlmtfbowkqbmdjmd#eqlnjm#tkj`k#wkfbw#ofbpw#lmfqfsqlgv`wjlmfm`z`olsfgjb8elmw.pjyf92ivqjpgj`wjlmbw#wkbw#wjnf!=?b#`obpp>!Jm#bggjwjlm/gfp`qjswjlm(`lmufqpbwjlm`lmwb`w#tjwkjp#dfmfqboozq!#`lmwfmw>!qfsqfpfmwjmd%ow8nbwk%dw8sqfpfmwbwjlml``bpjlmbooz?jnd#tjgwk>!mbujdbwjlm!=`lnsfmpbwjlm`kbnsjlmpkjsnfgjb>!boo!#ujlobwjlm#leqfefqfm`f#wlqfwvqm#wqvf8Pwqj`w,,FM!#wqbmpb`wjlmpjmwfqufmwjlmufqjej`bwjlmJmelqnbwjlm#gjeej`vowjfp@kbnsjlmpkjs`bsbajojwjfp?\"Xfmgje^..=~\t?,p`qjsw=\t@kqjpwjbmjwzelq#f{bnsof/Sqlefppjlmboqfpwqj`wjlmppvddfpw#wkbwtbp#qfofbpfg+pv`k#bp#wkfqfnluf@obpp+vmfnsolznfmwwkf#Bnfqj`bmpwqv`wvqf#le,jmgf{-kwno#svaojpkfg#jmpsbm#`obpp>!!=?b#kqfe>!,jmwqlgv`wjlmafolmdjmd#wl`objnfg#wkbw`lmpfrvfm`fp?nfwb#mbnf>!Dvjgf#wl#wkflufqtkfonjmdbdbjmpw#wkf#`lm`fmwqbwfg/\t-mlmwlv`k#lapfqubwjlmp?,b=\t?,gju=\te#+gl`vnfmw-alqgfq9#2s{#xelmw.pjyf92wqfbwnfmw#le3!#kfjdkw>!2nlgjej`bwjlmJmgfsfmgfm`fgjujgfg#jmwldqfbwfq#wkbmb`kjfufnfmwpfpwbaojpkjmdIbubP`qjsw!#mfufqwkfofpppjdmjej`bm`fAqlbg`bpwjmd=%maps8?,wg=`lmwbjmfq!=\tpv`k#bp#wkf#jmeovfm`f#leb#sbqwj`vobqpq`>$kwws9,,mbujdbwjlm!#kboe#le#wkf#pvapwbmwjbo#%maps8?,gju=bgubmwbdf#legjp`lufqz#leevmgbnfmwbo#nfwqlslojwbmwkf#lsslpjwf!#{no9obmd>!gfojafqbwfozbojdm>`fmwfqfulovwjlm#lesqfpfqubwjlmjnsqlufnfmwpafdjmmjmd#jmIfpvp#@kqjpwSvaoj`bwjlmpgjpbdqffnfmwwf{w.bojdm9q/#evm`wjlm+*pjnjobqjwjfpalgz=?,kwno=jp#`vqqfmwozboskbafwj`bojp#plnfwjnfpwzsf>!jnbdf,nbmz#le#wkf#eolt9kjggfm8bubjobaof#jmgfp`qjaf#wkff{jpwfm`f#leboo#lufq#wkfwkf#Jmwfqmfw\n?vo#`obpp>!jmpwboobwjlmmfjdkalqkllgbqnfg#elq`fpqfgv`jmd#wkf`lmwjmvfp#wlMlmfwkfofpp/wfnsfqbwvqfp\t\n\n?b#kqfe>!`olpf#wl#wkff{bnsofp#le#jp#balvw#wkf+pff#afolt*-!#jg>!pfbq`ksqlefppjlmbojp#bubjobaofwkf#leej`jbo\n\n?,p`qjsw=\t\t\n\n?gju#jg>!b``fofqbwjlmwkqlvdk#wkf#Kboo#le#Ebnfgfp`qjswjlmpwqbmpobwjlmpjmwfqefqfm`f#wzsf>$wf{w,qf`fmw#zfbqpjm#wkf#tlqogufqz#slsvobqxab`hdqlvmg9wqbgjwjlmbo#plnf#le#wkf#`lmmf`wfg#wlf{soljwbwjlmfnfqdfm`f#le`lmpwjwvwjlmB#Kjpwlqz#lepjdmjej`bmw#nbmveb`wvqfgf{sf`wbwjlmp=?mlp`qjsw=?`bm#af#elvmgaf`bvpf#wkf#kbp#mlw#affmmfjdkalvqjmdtjwklvw#wkf#bggfg#wl#wkf\n?oj#`obpp>!jmpwqvnfmwboPlujfw#Vmjlmb`hmltofgdfgtkj`k#`bm#afmbnf#elq#wkfbwwfmwjlm#wlbwwfnswp#wl#gfufolsnfmwpJm#eb`w/#wkf?oj#`obpp>!bjnsoj`bwjlmppvjwbaof#elqnv`k#le#wkf#`lolmjybwjlmsqfpjgfmwjbo`bm`foAvaaof#Jmelqnbwjlmnlpw#le#wkf#jp#gfp`qjafgqfpw#le#wkf#nlqf#lq#ofppjm#PfswfnafqJmwfoojdfm`fpq`>!kwws9,,s{8#kfjdkw9#bubjobaof#wlnbmveb`wvqfqkvnbm#qjdkwpojmh#kqfe>!,bubjobajojwzsqlslqwjlmbolvwpjgf#wkf#bpwqlmlnj`bokvnbm#afjmdpmbnf#le#wkf#bqf#elvmg#jmbqf#abpfg#lmpnboofq#wkbmb#sfqplm#tklf{sbmpjlm#lebqdvjmd#wkbwmlt#hmltm#bpJm#wkf#fbqozjmwfqnfgjbwfgfqjufg#eqlnP`bmgjmbujbm?,b=?,gju=\x0E\t`lmpjgfq#wkfbm#fpwjnbwfgwkf#Mbwjlmbo?gju#jg>!sbdqfpvowjmd#jm`lnnjppjlmfgbmboldlvp#wlbqf#qfrvjqfg,vo=\t?,gju=\ttbp#abpfg#lmbmg#af`bnf#b%maps8%maps8w!#ubovf>!!#tbp#`bswvqfgml#nlqf#wkbmqfpsf`wjufoz`lmwjmvf#wl#=\x0E\t?kfbg=\x0E\t?tfqf#`qfbwfgnlqf#dfmfqbojmelqnbwjlm#vpfg#elq#wkfjmgfsfmgfmw#wkf#Jnsfqjbo`lnslmfmw#lewl#wkf#mlqwkjm`ovgf#wkf#@lmpwqv`wjlmpjgf#le#wkf#tlvog#mlw#afelq#jmpwbm`fjmufmwjlm#lenlqf#`lnsof{`loof`wjufozab`hdqlvmg9#wf{w.bojdm9#jwp#lqjdjmbojmwl#b``lvmwwkjp#sql`fppbm#f{wfmpjufkltfufq/#wkfwkfz#bqf#mlwqfif`wfg#wkf`qjwj`jpn#legvqjmd#tkj`ksqlabaoz#wkfwkjp#bqwj`of+evm`wjlm+*xJw#pklvog#afbm#bdqffnfmwb``jgfmwboozgjeefqp#eqlnBq`kjwf`wvqfafwwfq#hmltmbqqbmdfnfmwpjmeovfm`f#lmbwwfmgfg#wkfjgfmwj`bo#wlplvwk#le#wkfsbpp#wkqlvdk{no!#wjwof>!tfjdkw9alog8`qfbwjmd#wkfgjpsobz9mlmfqfsob`fg#wkf?jnd#pq`>!,jkwwsp9,,ttt-Tlqog#Tbq#JJwfpwjnlmjbopelvmg#jm#wkfqfrvjqfg#wl#bmg#wkbw#wkfafwtffm#wkf#tbp#gfpjdmfg`lmpjpwp#le#`lmpjgfqbaozsvaojpkfg#azwkf#obmdvbdf@lmpfqubwjlm`lmpjpwfg#leqfefq#wl#wkfab`h#wl#wkf#`pp!#nfgjb>!Sflsof#eqln#bubjobaof#lmsqlufg#wl#afpvddfpwjlmp!tbp#hmltm#bpubqjfwjfp#leojhfoz#wl#af`lnsqjpfg#lepvsslqw#wkf#kbmgp#le#wkf`lvsofg#tjwk`lmmf`w#bmg#alqgfq9mlmf8sfqelqnbm`fpafelqf#afjmdobwfq#af`bnf`bo`vobwjlmplewfm#`boofgqfpjgfmwp#lenfbmjmd#wkbw=?oj#`obpp>!fujgfm`f#elqf{sobmbwjlmpfmujqlmnfmwp!=?,b=?,gju=tkj`k#booltpJmwqlgv`wjlmgfufolsfg#azb#tjgf#qbmdflm#afkboe#leubojdm>!wls!sqjm`jsof#lebw#wkf#wjnf/?,mlp`qjsw=\x0Epbjg#wl#kbufjm#wkf#ejqpwtkjof#lwkfqpkzslwkfwj`boskjolplskfqpsltfq#le#wkf`lmwbjmfg#jmsfqelqnfg#azjmbajojwz#wltfqf#tqjwwfmpsbm#pwzof>!jmsvw#mbnf>!wkf#rvfpwjlmjmwfmgfg#elqqfif`wjlm#lejnsojfp#wkbwjmufmwfg#wkfwkf#pwbmgbqgtbp#sqlabaozojmh#afwtffmsqlefpplq#lejmwfqb`wjlmp`kbmdjmd#wkfJmgjbm#L`fbm#`obpp>!obpwtlqhjmd#tjwk$kwws9,,ttt-zfbqp#afelqfWkjp#tbp#wkfqf`qfbwjlmbofmwfqjmd#wkfnfbpvqfnfmwpbm#f{wqfnfozubovf#le#wkfpwbqw#le#wkf\t?,p`qjsw=\t\tbm#feelqw#wljm`qfbpf#wkfwl#wkf#plvwkpsb`jmd>!3!=pveej`jfmwozwkf#Fvqlsfbm`lmufqwfg#wl`ofbqWjnflvwgjg#mlw#kbuf`lmpfrvfmwozelq#wkf#mf{wf{wfmpjlm#lef`lmlnj`#bmgbowklvdk#wkfbqf#sqlgv`fgbmg#tjwk#wkfjmpveej`jfmwdjufm#az#wkfpwbwjmd#wkbwf{sfmgjwvqfp?,psbm=?,b=\twklvdkw#wkbwlm#wkf#abpjp`foosbggjmd>jnbdf#le#wkfqfwvqmjmd#wljmelqnbwjlm/pfsbqbwfg#azbppbppjmbwfgp!#`lmwfmw>!bvwklqjwz#lemlqwktfpwfqm?,gju=\t?gju#!=?,gju=\x0E\t##`lmpvowbwjlm`lnnvmjwz#lewkf#mbwjlmbojw#pklvog#afsbqwj`jsbmwp#bojdm>!ofewwkf#dqfbwfpwpfof`wjlm#lepvsfqmbwvqbogfsfmgfmw#lmjp#nfmwjlmfgbooltjmd#wkftbp#jmufmwfgb``lnsbmzjmdkjp#sfqplmbobubjobaof#bwpwvgz#le#wkflm#wkf#lwkfqf{f`vwjlm#leKvnbm#Qjdkwpwfqnp#le#wkfbppl`jbwjlmpqfpfbq`k#bmgpv``ffgfg#azgfefbwfg#wkfbmg#eqln#wkfavw#wkfz#bqf`lnnbmgfq#lepwbwf#le#wkfzfbqp#le#bdfwkf#pwvgz#le?vo#`obpp>!psob`f#jm#wkftkfqf#kf#tbp?oj#`obpp>!ewkfqf#bqf#mltkj`k#af`bnfkf#svaojpkfgf{sqfppfg#jmwl#tkj`k#wkf`lnnjppjlmfqelmw.tfjdkw9wfqqjwlqz#lef{wfmpjlmp!=Qlnbm#Fnsjqffrvbo#wl#wkfJm#`lmwqbpw/kltfufq/#bmgjp#wzsj`boozbmg#kjp#tjef+bopl#`boofg=?vo#`obpp>!feef`wjufoz#fuloufg#jmwlpffn#wl#kbuftkj`k#jp#wkfwkfqf#tbp#mlbm#f{`foofmwboo#le#wkfpfgfp`qjafg#azJm#sqb`wj`f/aqlbg`bpwjmd`kbqdfg#tjwkqfeof`wfg#jmpvaif`wfg#wlnjojwbqz#bmgwl#wkf#sljmwf`lmlnj`boozpfwWbqdfwjmdbqf#b`wvboozuj`wlqz#lufq+*8?,p`qjsw=`lmwjmvlvpozqfrvjqfg#elqfulovwjlmbqzbm#feef`wjufmlqwk#le#wkf/#tkj`k#tbp#eqlmw#le#wkflq#lwkfqtjpfplnf#elqn#lekbg#mlw#affmdfmfqbwfg#azjmelqnbwjlm-sfqnjwwfg#wljm`ovgfp#wkfgfufolsnfmw/fmwfqfg#jmwlwkf#sqfujlvp`lmpjpwfmwozbqf#hmltm#bpwkf#ejfog#lewkjp#wzsf#ledjufm#wl#wkfwkf#wjwof#le`lmwbjmp#wkfjmpwbm`fp#lejm#wkf#mlqwkgvf#wl#wkfjqbqf#gfpjdmfg`lqslqbwjlmptbp#wkbw#wkflmf#le#wkfpfnlqf#slsvobqpv``ffgfg#jmpvsslqw#eqlnjm#gjeefqfmwglnjmbwfg#azgfpjdmfg#elqltmfqpkjs#lebmg#slppjaozpwbmgbqgjyfgqfpslmpfWf{wtbp#jmwfmgfgqf`fjufg#wkfbppvnfg#wkbwbqfbp#le#wkfsqjnbqjoz#jmwkf#abpjp#lejm#wkf#pfmpfb``lvmwp#elqgfpwqlzfg#azbw#ofbpw#wtltbp#gf`obqfg`lvog#mlw#afPf`qfwbqz#lebssfbq#wl#afnbqdjm.wls92,]_p(\x7F_p(',df*xwkqlt#f~8wkf#pwbqw#lewtl#pfsbqbwfobmdvbdf#bmgtkl#kbg#affmlsfqbwjlm#legfbwk#le#wkfqfbo#mvnafqp\n?ojmh#qfo>!sqlujgfg#wkfwkf#pwlqz#le`lnsfwjwjlmpfmdojpk#+VH*fmdojpk#+VP*<p<R<Q<_<R<W<M=l<S=m<V<T=m=l<S=m<V<T=m=l<S=m<V<R5h4U4]4D5f4E\nAO\x05Gx\bTA\nzk\x0BBl\bQ\x7F\bTA\nzk\x0BUm\bQ\x7F\bTA\nzk\npe\x05u|\ti@\tcT\bVV\n\\}\nxS\tVp\x05tS\x05k`\t[X\t[X\x0BHR\bPv\bTW\bUe\n\x7Fa\bQp\x0B_W\x0BWs\nxS\x0BAz\n_y\x04Khjmelqnb`j/_mkfqqbnjfmwbpfof`wq/_mj`lgfp`qjs`j/_m`obpjej`bglp`lml`jnjfmwlsvaoj`b`j/_mqfob`jlmbgbpjmelqn/Mwj`bqfob`jlmbglpgfsbqwbnfmwlwqbabibglqfpgjqf`wbnfmwfbzvmwbnjfmwlnfq`bglOjaqf`lmw/M`wfmlpkbajwb`jlmfp`vnsojnjfmwlqfpwbvqbmwfpgjpslpj`j/_m`lmpf`vfm`jbfof`wq/_mj`bbsoj`b`jlmfpgfp`lmf`wbgljmpwbob`j/_mqfbojyb`j/_mvwjojyb`j/_mfm`j`olsfgjbfmefqnfgbgfpjmpwqvnfmwlpf{sfqjfm`jbpjmpwjwv`j/_msbqwj`vobqfppva`bwfdlqjb=n<R<W=`<V<R<L<R=m=m<T<T=l<\\<]<R=n=g<]<R<W=`=d<Y<S=l<R=m=n<R<P<R<Z<Y=n<Y<X=l=o<_<T=i=m<W=o=k<\\<Y=m<Y<U=k<\\=m<^=m<Y<_<X<\\<L<R=m=m<T=c<p<R=m<V<^<Y<X=l=o<_<T<Y<_<R=l<R<X<\\<^<R<S=l<R=m<X<\\<Q<Q=g=i<X<R<W<Z<Q=g<T<P<Y<Q<Q<R<p<R=m<V<^=g=l=o<]<W<Y<U<p<R=m<V<^<\\=m=n=l<\\<Q=g<Q<T=k<Y<_<R=l<\\<]<R=n<Y<X<R<W<Z<Y<Q=o=m<W=o<_<T=n<Y<S<Y=l=`<r<X<Q<\\<V<R<S<R=n<R<P=o=l<\\<]<R=n=o<\\<S=l<Y<W=c<^<R<R<]=e<Y<R<X<Q<R<_<R=m<^<R<Y<_<R=m=n<\\=n=`<T<X=l=o<_<R<U=h<R=l=o<P<Y=i<R=l<R=d<R<S=l<R=n<T<^=m=m=g<W<V<\\<V<\\<Z<X=g<U<^<W<\\=m=n<T<_=l=o<S<S=g<^<P<Y=m=n<Y=l<\\<]<R=n<\\=m<V<\\<[<\\<W<S<Y=l<^=g<U<X<Y<W<\\=n=`<X<Y<Q=`<_<T<S<Y=l<T<R<X<]<T<[<Q<Y=m<R=m<Q<R<^<Y<P<R<P<Y<Q=n<V=o<S<T=n=`<X<R<W<Z<Q<\\=l<\\<P<V<\\=i<Q<\\=k<\\<W<R<L<\\<]<R=n<\\<N<R<W=`<V<R=m<R<^=m<Y<P<^
vendor: 4,592 bytes, line 10405
10405=n<R=l<R<U<Q<\\=k<\\<W<\\=m<S<T=m<R<V=m<W=o<Z<]=g=m<T=m=n<Y<P<S<Y=k<\\=n<T<Q<R<^<R<_<R<S<R<P<R=e<T=m<\\<U=n<R<^<S<R=k<Y<P=o<S<R<P<R=e=`<X<R<W<Z<Q<R=m=m=g<W<V<T<]=g=m=n=l<R<X<\\<Q<Q=g<Y<P<Q<R<_<T<Y<S=l<R<Y<V=n<M<Y<U=k<\\=m<P<R<X<Y<W<T=n<\\<V<R<_<R<R<Q<W<\\<U<Q<_<R=l<R<X<Y<^<Y=l=m<T=c=m=n=l<\\<Q<Y=h<T<W=`<P=g=o=l<R<^<Q=c=l<\\<[<Q=g=i<T=m<V<\\=n=`<Q<Y<X<Y<W=b=c<Q<^<\\=l=c<P<Y<Q=`=d<Y<P<Q<R<_<T=i<X<\\<Q<Q<R<U<[<Q<\\=k<T=n<Q<Y<W=`<[=c=h<R=l=o<P<\\<N<Y<S<Y=l=`<P<Y=m=c=j<\\<[<\\=e<T=n=g<w=o=k=d<T<Y\fHD\fHU\fIl\fHn\fHy\fH\\\fHD\fIk\fHi\fHF\fHD\fIk\fHy\fHS\fHC\fHR\fHy\fH\\\fIk\fHn\fHi\fHD\fIa\fHC\fHy\fIa\fHC\fHR\fH{\fHR\fHk\fHM\fH@\fHR\fH\\\fIk\fHy\fHS\fHT\fIl\fHJ\fHS\fHC\fHR\fHF\fHU\fH^\fIk\fHT\fHS\fHn\fHU\fHA\fHR\fH\\\fHH\fHi\fHF\fHD\fIl\fHY\fHR\fH^\fIk\fHT\fIk\fHY\fHR\fHy\fH\\\fHH\fIk\fHB\fIk\fH\\\fIk\fHU\fIg\fHD\fIk\fHT\fHy\fHH\fIk\fH@\fHU\fIm\fHH\fHT\fHR\fHk\fHs\fHU\fIg\fH{\fHR\fHp\fHR\fHD\fIk\fHB\fHS\fHD\fHs\fHy\fH\\\fHH\fHR\fHy\fH\\\fHD\fHR\fHe\fHD\fHy\fIk\fHC\fHU\fHR\fHm\fHT\fH@\fHT\fIk\fHA\fHR\fH[\fHR\fHj\fHF\fHy\fIk\fH^\fHS\fHC\fIk\fHZ\fIm\fH\\\fIn\fHk\fHT\fHy\fIk\fHt\fHn\fHs\fIk\fHB\fIk\fH\\\fIl\fHT\fHy\fHH\fHR\fHB\fIk\fH\\\fHR\fH^\fIk\fHy\fH\\\fHi\fHK\fHS\fHy\fHi\fHF\fHD\fHR\fHT\fHB\fHR\fHp\fHB\fIm\fHq\fIk\fHy\fHR\fH\\\fHO\fHU\fIg\fHH\fHR\fHy\fHM\fHP\fIl\fHC\fHU\fHR\fHn\fHU\fIg\fHs\fH^\fHZ\fH@\fIa\fHJ\fH^\fHS\fHC\fHR\fHp\fIl\fHY\fHD\fHp\fHR\fHH\fHR\fHy\fId\fHT\fIk\fHj\fHF\fHy\fHR\fHY\fHR\fH^\fIl\fHJ\fIk\fHD\fIk\fHF\fIn\fH\\\fIl\fHF\fHR\fHD\fIl\fHe\fHT\fHy\fIk\fHU\fIg\fH{\fIl\fH@\fId\fHL\fHy\fHj\fHF\fHy\fIl\fHY\fH\\\fIa\fH[\fH{\fHR\fHn\fHY\fHj\fHF\fHy\fIg\fHp\fHS\fH^\fHR\fHp\fHR\fHD\fHR\fHT\fHU\fHB\fHH\fHU\fHB\fIk\fHn\fHe\fHD\fHy\fIl\fHC\fHR\fHU\fIn\fHJ\fH\\\fIa\fHp\fHT\fIn\fHv\fIl\fHF\fHT\fHn\fHJ\fHT\fHY\fHR\fH^\fHU\fIg\fHD\fHR\fHU\fIg\fHH\fIl\fHp\fId\fHT\fIk\fHY\fHR\fHF\fHT\fHp\fHD\fHH\fHR\fHD\fIk\fHH\fHR\fHp\fHR\fH\\\fIl\fHt\fHR\fHC\fH^\fHp\fHS\fH^\fIk\fHD\fIl\fHv\fIk\fHp\fHR\fHn\fHv\fHF\fHH\fIa\fH\\\fH{\fIn\fH{\fH^\fHp\fHR\fHH\fIk\fH@\fHR\fHU\fH\\\fHj\fHF\fHD\fIk\fHY\fHR\fHU\fHD\fHk\fHT\fHy\fHR\fHT\fIm\fH@\fHU\fH\\\fHU\fHD\fIk\fHk\fHT\fHT\fIk\fHT\fHU\fHS\fHH\fH@\fHM\fHP\fIk\fHt\fHs\fHD\fHR\fHH\fH^\fHR\fHZ\fHF\fHR\fHn\fHv\fHZ\fIa\fH\\\fIl\fH@\fHM\fHP\fIl\fHU\fIg\fHH\fIk\fHT\fHR\fHd\fHs\fHZ\fHR\fHC\fHJ\fHT\fHy\fHH\fIl\fHp\fHR\fHH\fIl\fHY\fHR\fH^\fHR\fHU\fHp\fHR\fH\\\fHF\fHs\fHD\fHR\fH\\\fHz\fHD\fIk\fHT\fHM\fHP\fHy\fHB\fHS\fH^\fHR\fHe\fHT\fHy\fIl\fHy\fIk\fHY\fH^\fH^\fH{\fHH\fHR\fHz\fHR\fHD\fHR\fHi\fH\\\fIa\fHI\fHp\fHU\fHR\fHn\fHJ\fIk\fHz\fHR\fHF\fHU\fH^\fIl\fHD\fHS\fHC\fHB\fH@\fHS\fHD\fHR\fH@\fId\fHn\fHy\fHy\fHU\fIl\fHn\fHy\fHU\fHD\fHR\fHJ\fIk\fHH\fHR\fHU\fHB\fH^\fIk\fHy\fHR\fHG\fIl\fHp\fH@\fHy\fHS\fHH\fIm\fH\\\fHH\fHB\fHR\fHn\fH{\fHY\fHU\fIl\fHn\fH\\\fIg\fHp\fHP\fHB\fHS\fH^\fIl\fHj\fH\\\fIg\fHF\fHT\fIk\fHD\fHR\fHC\fHR\fHJ\fHY\fH^\fIk\fHD\fIk\fHz\fHR\fHH\fHR\fHy\fH\\\fIl\fH@\fHe\fHD\fHy\fHR\fHp\fHY\fHR\fH@\fHF\fIn\fH\\\fHR\fH@\fHM\fHP\fHR\fHT\fI`\fHJ\fHR\fHZ\fIk\fHC\fH\\\fHy\fHS\fHC\fIk\fHy\fHU\fHR\fHn\fHi\fHy\fHT\fH\\\fH@\fHD\fHR\fHc\fHY\fHU\fHR\fHn\fHT\fIa\fHI\fH^\fHB\fHS\fH^\fIk\fH^\fIk\fHz\fHy\fHY\fHS\fH[\fHC\fHy\fIa\fH\\\fHn\fHT\fHB\fIn\fHU\fHI\fHR\fHD\fHR4F4_4F4[5f4U5i4X4K4]5o4E4D5d4K4_4[4E4K5h4Y5m4A4E5i5d4K4Z5f4U4K5h4B4K4Y4E4K5h5i4^5f4C4K5h4U4K5i4E4K5h5o4K4F4D4K5h4]4C5d4C4D4]5j4K5i4@4K5h4C5d5h4E4K5h4U4K5h5i4K5h5i5d5n4U4K5h4U4]4D5f4K5h4_4]5f4U4K5h4@5d4K5h4K5h4\\5k4K4D4K5h4A5f4K4E4K5h4A5n5d5n4K5h5o4]5f5i4K5h4U4]4K5n5i4A5m5d4T4E4K5h4G4K5j5f5i4X4K5k4C4E4K5h5i4]4O4E4K5h5n4]4N5j4K5h4X4D4K4D4K5h4A5d4K4]4K5h4@4C5f4C4K5h4O4_4]4E4K5h4U5h5d5i5i4@5i5d4U4E4K5h4]4A5i5j4K5h5j5n4K4[5m5h4_4[5f5j4K5h5o5d5f4F4K5h4C5j5f4K4D4]5o4K4F5k4K5h4]5f4K4Z4F4A5f4K4F5f4D4F5d5n5f4F4K5h4O5d5h5e4K5h4D4]5f4C4K5h5o5h4K5i4K5h4]4K4D4[4K5h4X4B4Y5f4_5f4K4]4K4F4K5h4G4K5h4G4K5h4Y5h4K4E4K5h4A4C5f4G4K5h4^5d4K4]4K5h4B5h5f4@4K5h4@5i5f4U4K5h4U4K5i5k4K5h4@5i4K5h4K5h4_4K4U4E5i4X4K5k4C5k4K5h4]4J5f4_4K5h4C4B5d5h4K5h5m5j5f4E4K5h5o4F4K4D4K5h4C5d4]5f4K5h4C4]5d4_4K4_4F4V4]5n4F4Y4K5i5f5i4K5h4D5j4K4F4K5h4U4T5f5ifmwfqwbjmnfmwvmgfqpwbmgjmd#>#evm`wjlm+*-isd!#tjgwk>!`lmejdvqbwjlm-smd!#tjgwk>!?algz#`obpp>!Nbwk-qbmgln+*`lmwfnslqbqz#Vmjwfg#Pwbwfp`jq`vnpwbm`fp-bssfmg@kjog+lqdbmjybwjlmp?psbm#`obpp>!!=?jnd#pq`>!,gjpwjmdvjpkfgwklvpbmgp#le#`lnnvmj`bwjlm`ofbq!=?,gju=jmufpwjdbwjlmebuj`lm-j`l!#nbqdjm.qjdkw9abpfg#lm#wkf#Nbppb`kvpfwwpwbaof#alqgfq>jmwfqmbwjlmbobopl#hmltm#bpsqlmvm`jbwjlmab`hdqlvmg9 esbggjmd.ofew9Elq#f{bnsof/#njp`foobmflvp%ow8,nbwk%dw8spz`kloldj`bojm#sbqwj`vobqfbq`k!#wzsf>!elqn#nfwklg>!bp#lsslpfg#wlPvsqfnf#@lvqwl``bpjlmbooz#Bggjwjlmbooz/Mlqwk#Bnfqj`bs{8ab`hdqlvmglsslqwvmjwjfpFmwfqwbjmnfmw-wlOltfq@bpf+nbmveb`wvqjmdsqlefppjlmbo#`lnajmfg#tjwkElq#jmpwbm`f/`lmpj
vendor: 41,091 bytes, lines 10405-10539
10405pwjmd#le!#nb{ofmdwk>!qfwvqm#ebopf8`lmp`jlvpmfppNfgjwfqqbmfbmf{wqblqgjmbqzbppbppjmbwjlmpvapfrvfmwoz#avwwlm#wzsf>!wkf#mvnafq#lewkf#lqjdjmbo#`lnsqfkfmpjufqfefqp#wl#wkf?,vo=\t?,gju=\tskjolplskj`bool`bwjlm-kqfetbp#svaojpkfgPbm#Eqbm`jp`l+evm`wjlm+*x\t?gju#jg>!nbjmplskjpwj`bwfgnbwkfnbwj`bo#,kfbg=\x0E\t?algzpvddfpwp#wkbwgl`vnfmwbwjlm`lm`fmwqbwjlmqfobwjlmpkjspnbz#kbuf#affm+elq#f{bnsof/Wkjp#bqwj`of#jm#plnf#`bpfpsbqwp#le#wkf#gfejmjwjlm#leDqfbw#Aqjwbjm#`foosbggjmd>frvjubofmw#wlsob`fklogfq>!8#elmw.pjyf9#ivpwjej`bwjlmafojfufg#wkbwpveefqfg#eqlnbwwfnswfg#wl#ofbgfq#le#wkf`qjsw!#pq`>!,+evm`wjlm+*#xbqf#bubjobaof\t\n?ojmh#qfo>!#pq`>$kwws9,,jmwfqfpwfg#jm`lmufmwjlmbo#!#bow>!!#,=?,bqf#dfmfqboozkbp#bopl#affmnlpw#slsvobq#`lqqfpslmgjmd`qfgjwfg#tjwkwzof>!alqgfq9?,b=?,psbm=?,-dje!#tjgwk>!?jeqbnf#pq`>!wbaof#`obpp>!jmojmf.aol`h8b``lqgjmd#wl#wldfwkfq#tjwkbssql{jnbwfozsbqojbnfmwbqznlqf#bmg#nlqfgjpsobz9mlmf8wqbgjwjlmboozsqfglnjmbmwoz%maps8\x7F%maps8%maps8?,psbm=#`foopsb`jmd>?jmsvw#mbnf>!lq!#`lmwfmw>!`lmwqlufqpjbosqlsfqwz>!ld9,{.pkl`htbuf.gfnlmpwqbwjlmpvqqlvmgfg#azMfufqwkfofpp/tbp#wkf#ejqpw`lmpjgfqbaof#Bowklvdk#wkf#`loobalqbwjlmpklvog#mlw#afsqlslqwjlm#le?psbm#pwzof>!hmltm#bp#wkf#pklqwoz#bewfqelq#jmpwbm`f/gfp`qjafg#bp#,kfbg=\t?algz#pwbqwjmd#tjwkjm`qfbpjmdoz#wkf#eb`w#wkbwgjp`vppjlm#lenjggof#le#wkfbm#jmgjujgvbogjeej`vow#wl#sljmw#le#ujftklnlpf{vbojwzb``fswbm`f#le?,psbm=?,gju=nbmveb`wvqfqplqjdjm#le#wkf`lnnlmoz#vpfgjnslqwbm`f#legfmlnjmbwjlmpab`hdqlvmg9# ofmdwk#le#wkfgfwfqnjmbwjlmb#pjdmjej`bmw!#alqgfq>!3!=qfulovwjlmbqzsqjm`jsofp#lejp#`lmpjgfqfgtbp#gfufolsfgJmgl.Fvqlsfbmuvomfqbaof#wlsqlslmfmwp#lebqf#plnfwjnfp`olpfq#wl#wkfMft#Zlqh#@jwz#mbnf>!pfbq`kbwwqjavwfg#wl`lvqpf#le#wkfnbwkfnbwj`jbmaz#wkf#fmg#lebw#wkf#fmg#le!#alqgfq>!3!#wf`kmloldj`bo-qfnluf@obpp+aqbm`k#le#wkffujgfm`f#wkbw\"Xfmgje^..=\x0E\tJmpwjwvwf#le#jmwl#b#pjmdofqfpsf`wjufoz-bmg#wkfqfelqfsqlsfqwjfp#lejp#ol`bwfg#jmplnf#le#tkj`kWkfqf#jp#bopl`lmwjmvfg#wl#bssfbqbm`f#le#%bns8mgbpk8#gfp`qjafp#wkf`lmpjgfqbwjlmbvwklq#le#wkfjmgfsfmgfmwozfrvjssfg#tjwkglfp#mlw#kbuf?,b=?b#kqfe>!`lmevpfg#tjwk?ojmh#kqfe>!,bw#wkf#bdf#lebssfbq#jm#wkfWkfpf#jm`ovgfqfdbqgofpp#le`lvog#af#vpfg#pwzof>%rvlw8pfufqbo#wjnfpqfsqfpfmw#wkfalgz=\t?,kwno=wklvdkw#wl#afslsvobwjlm#leslppjajojwjfpsfq`fmwbdf#leb``fpp#wl#wkfbm#bwwfnsw#wlsqlgv`wjlm#leirvfqz,irvfqzwtl#gjeefqfmwafolmd#wl#wkffpwbaojpknfmwqfsob`jmd#wkfgfp`qjswjlm!#gfwfqnjmf#wkfbubjobaof#elqB``lqgjmd#wl#tjgf#qbmdf#le\n?gju#`obpp>!nlqf#`lnnlmozlqdbmjpbwjlmpevm`wjlmbojwztbp#`lnsofwfg#%bns8ngbpk8#sbqwj`jsbwjlmwkf#`kbqb`wfqbm#bggjwjlmbobssfbqp#wl#afeb`w#wkbw#wkfbm#f{bnsof#lepjdmjej`bmwozlmnlvpflufq>!af`bvpf#wkfz#bpzm`#>#wqvf8sqlaofnp#tjwkpffnp#wl#kbufwkf#qfpvow#le#pq`>!kwws9,,ebnjojbq#tjwkslppfppjlm#leevm`wjlm#+*#xwllh#sob`f#jmbmg#plnfwjnfppvapwbmwjbooz?psbm=?,psbm=jp#lewfm#vpfgjm#bm#bwwfnswdqfbw#gfbo#leFmujqlmnfmwbopv``fppevooz#ujqwvbooz#boo13wk#`fmwvqz/sqlefppjlmbopmf`fppbqz#wl#gfwfqnjmfg#az`lnsbwjajojwzaf`bvpf#jw#jpGj`wjlmbqz#lenlgjej`bwjlmpWkf#elooltjmdnbz#qfefq#wl9@lmpfrvfmwoz/Jmwfqmbwjlmbobowklvdk#plnfwkbw#tlvog#aftlqog$p#ejqpw`obppjejfg#bpalwwln#le#wkf+sbqwj`vobqozbojdm>!ofew!#nlpw#`lnnlmozabpjp#elq#wkfelvmgbwjlm#le`lmwqjavwjlmpslsvobqjwz#le`fmwfq#le#wkfwl#qfgv`f#wkfivqjpgj`wjlmpbssql{jnbwjlm#lmnlvpflvw>!Mft#Wfpwbnfmw`loof`wjlm#le?,psbm=?,b=?,jm#wkf#Vmjwfgejon#gjqf`wlq.pwqj`w-gwg!=kbp#affm#vpfgqfwvqm#wl#wkfbowklvdk#wkjp`kbmdf#jm#wkfpfufqbo#lwkfqavw#wkfqf#bqfvmsqf`fgfmwfgjp#pjnjobq#wlfpsf`jbooz#jmtfjdkw9#alog8jp#`boofg#wkf`lnsvwbwjlmbojmgj`bwf#wkbwqfpwqj`wfg#wl\n?nfwb#mbnf>!bqf#wzsj`booz`lmeoj`w#tjwkKltfufq/#wkf#Bm#f{bnsof#le`lnsbqfg#tjwkrvbmwjwjfp#leqbwkfq#wkbm#b`lmpwfoobwjlmmf`fppbqz#elqqfslqwfg#wkbwpsf`jej`bwjlmslojwj`bo#bmg%maps8%maps8?qfefqfm`fp#wlwkf#pbnf#zfbqDlufqmnfmw#ledfmfqbwjlm#lekbuf#mlw#affmpfufqbo#zfbqp`lnnjwnfmw#wl\n\n?vo#`obpp>!ujpvbojybwjlm2:wk#`fmwvqz/sqb`wjwjlmfqpwkbw#kf#tlvogbmg#`lmwjmvfgl``vsbwjlm#lejp#gfejmfg#bp`fmwqf#le#wkfwkf#bnlvmw#le=?gju#pwzof>!frvjubofmw#legjeefqfmwjbwfaqlvdkw#balvwnbqdjm.ofew9#bvwlnbwj`boozwklvdkw#le#bpPlnf#le#wkfpf\t?gju#`obpp>!jmsvw#`obpp>!qfsob`fg#tjwkjp#lmf#le#wkffgv`bwjlm#bmgjmeovfm`fg#azqfsvwbwjlm#bp\t?nfwb#mbnf>!b``lnnlgbwjlm?,gju=\t?,gju=obqdf#sbqw#leJmpwjwvwf#elqwkf#pl.`boofg#bdbjmpw#wkf#Jm#wkjp#`bpf/tbp#bssljmwfg`objnfg#wl#afKltfufq/#wkjpGfsbqwnfmw#lewkf#qfnbjmjmdfeef`w#lm#wkfsbqwj`vobqoz#gfbo#tjwk#wkf\t?gju#pwzof>!bonlpw#botbzpbqf#`vqqfmwozf{sqfppjlm#leskjolplskz#leelq#nlqf#wkbm`jujojybwjlmplm#wkf#jpobmgpfof`wfgJmgf{`bm#qfpvow#jm!#ubovf>!!#,=wkf#pwqv`wvqf#,=?,b=?,gju=Nbmz#le#wkfpf`bvpfg#az#wkfle#wkf#Vmjwfgpsbm#`obpp>!n`bm#af#wqb`fgjp#qfobwfg#wlaf`bnf#lmf#lejp#eqfrvfmwozojujmd#jm#wkfwkflqfwj`boozElooltjmd#wkfQfulovwjlmbqzdlufqmnfmw#jmjp#gfwfqnjmfgwkf#slojwj`bojmwqlgv`fg#jmpveej`jfmw#wlgfp`qjswjlm!=pklqw#pwlqjfppfsbqbwjlm#lebp#wl#tkfwkfqhmltm#elq#jwptbp#jmjwjboozgjpsobz9aol`hjp#bm#f{bnsofwkf#sqjm`jsbo`lmpjpwp#le#bqf`ldmjyfg#bp,algz=?,kwno=b#pvapwbmwjboqf`lmpwqv`wfgkfbg#le#pwbwfqfpjpwbm`f#wlvmgfqdqbgvbwfWkfqf#bqf#wtldqbujwbwjlmbobqf#gfp`qjafgjmwfmwjlmboozpfqufg#bp#wkf`obpp>!kfbgfqlsslpjwjlm#wlevmgbnfmwboozglnjmbwfg#wkfbmg#wkf#lwkfqboojbm`f#tjwktbp#elq`fg#wlqfpsf`wjufoz/bmg#slojwj`bojm#pvsslqw#lesflsof#jm#wkf13wk#`fmwvqz-bmg#svaojpkfgolbg@kbqwafbwwl#vmgfqpwbmgnfnafq#pwbwfpfmujqlmnfmwboejqpw#kboe#le`lvmwqjfp#bmgbq`kjwf`wvqboaf#`lmpjgfqfg`kbqb`wfqjyfg`ofbqJmwfqubobvwklqjwbwjufEfgfqbwjlm#letbp#pv``ffgfgbmg#wkfqf#bqfb#`lmpfrvfm`fwkf#Sqfpjgfmwbopl#jm`ovgfgeqff#plewtbqfpv``fppjlm#legfufolsfg#wkftbp#gfpwqlzfgbtbz#eqln#wkf8\t?,p`qjsw=\t?bowklvdk#wkfzelooltfg#az#bnlqf#sltfqevoqfpvowfg#jm#bVmjufqpjwz#leKltfufq/#nbmzwkf#sqfpjgfmwKltfufq/#plnfjp#wklvdkw#wlvmwjo#wkf#fmgtbp#bmmlvm`fgbqf#jnslqwbmwbopl#jm`ovgfp=?jmsvw#wzsf>wkf#`fmwfq#le#GL#MLW#BOWFQvpfg#wl#qfefqwkfnfp,<plqw>wkbw#kbg#affmwkf#abpjp#elqkbp#gfufolsfgjm#wkf#pvnnfq`lnsbqbwjufozgfp`qjafg#wkfpv`k#bp#wklpfwkf#qfpvowjmdjp#jnslppjaofubqjlvp#lwkfqPlvwk#Beqj`bmkbuf#wkf#pbnffeef`wjufmfppjm#tkj`k#`bpf8#wf{w.bojdm9pwqv`wvqf#bmg8#ab`hdqlvmg9qfdbqgjmd#wkfpvsslqwfg#wkfjp#bopl#hmltmpwzof>!nbqdjmjm`ovgjmd#wkfabkbpb#Nfobzvmlqph#alhn/Iomlqph#mzmlqphpolufm)M(ajmbjmwfqmb`jlmbo`bojej`b`j/_m`lnvmj`b`j/_m`lmpwqv``j/_m!=?gju#`obpp>!gjpbnajdvbwjlmGlnbjmMbnf$/#$bgnjmjpwqbwjlmpjnvowbmflvpozwqbmpslqwbwjlmJmwfqmbwjlmbo#nbqdjm.alwwln9qfpslmpjajojwz?\"Xfmgje^..=\t?,=?nfwb#mbnf>!jnsofnfmwbwjlmjmeqbpwqv`wvqfqfsqfpfmwbwjlmalqgfq.alwwln9?,kfbg=\t?algz=>kwws&0B&1E&1E?elqn#nfwklg>!nfwklg>!slpw!#,ebuj`lm-j`l!#~*8\t?,p`qjsw=\t-pfwBwwqjavwf+Bgnjmjpwqbwjlm>#mft#Bqqbz+*8?\"Xfmgje^..=\x0E\tgjpsobz9aol`h8Vmelqwvmbwfoz/!=%maps8?,gju=,ebuj`lm-j`l!=>$pwzofpkffw$#jgfmwjej`bwjlm/#elq#f{bnsof/?oj=?b#kqfe>!,bm#bowfqmbwjufbp#b#qfpvow#lesw!=?,p`qjsw=\twzsf>!pvanjw!#\t+evm`wjlm+*#xqf`lnnfmgbwjlmelqn#b`wjlm>!,wqbmpelqnbwjlmqf`lmpwqv`wjlm-pwzof-gjpsobz#B``lqgjmd#wl#kjggfm!#mbnf>!bolmd#tjwk#wkfgl`vnfmw-algz-bssql{jnbwfoz#@lnnvmj`bwjlmpslpw!#b`wjlm>!nfbmjmd#%rvlw8..?\"Xfmgje^..=Sqjnf#Njmjpwfq`kbqb`wfqjpwj`?,b=#?b#`obpp>wkf#kjpwlqz#le#lmnlvpflufq>!wkf#dlufqmnfmwkqfe>!kwwsp9,,tbp#lqjdjmbooztbp#jmwqlgv`fg`obppjej`bwjlmqfsqfpfmwbwjufbqf#`lmpjgfqfg?\"Xfmgje^..=\t\tgfsfmgp#lm#wkfVmjufqpjwz#le#jm#`lmwqbpw#wl#sob`fklogfq>!jm#wkf#`bpf#lejmwfqmbwjlmbo#`lmpwjwvwjlmbopwzof>!alqgfq.9#evm`wjlm+*#xAf`bvpf#le#wkf.pwqj`w-gwg!=\t?wbaof#`obpp>!b``lnsbmjfg#azb``lvmw#le#wkf?p`qjsw#pq`>!,mbwvqf#le#wkf#wkf#sflsof#jm#jm#bggjwjlm#wlp*8#ip-jg#>#jg!#tjgwk>!233&!qfdbqgjmd#wkf#Qlnbm#@bwkloj`bm#jmgfsfmgfmwelooltjmd#wkf#-dje!#tjgwk>!2wkf#elooltjmd#gjp`qjnjmbwjlmbq`kbfloldj`bosqjnf#njmjpwfq-ip!=?,p`qjsw=`lnajmbwjlm#le#nbqdjmtjgwk>!`qfbwfFofnfmw+t-bwwb`kFufmw+?,b=?,wg=?,wq=pq`>!kwwsp9,,bJm#sbqwj`vobq/#bojdm>!ofew!#@yf`k#Qfsvaoj`Vmjwfg#Hjmdgln`lqqfpslmgfm`f`lm`ovgfg#wkbw-kwno!#wjwof>!+evm`wjlm#+*#x`lnfp#eqln#wkfbssoj`bwjlm#le?psbm#`obpp>!pafojfufg#wl#affnfmw+$p`qjsw$?,b=\t?,oj=\t?ojufqz#gjeefqfmw=?psbm#`obpp>!lswjlm#ubovf>!+bopl#hmltm#bp\n?oj=?b#kqfe>!=?jmsvw#mbnf>!pfsbqbwfg#eqlnqfefqqfg#wl#bp#ubojdm>!wls!=elvmgfq#le#wkfbwwfnswjmd#wl#`bqalm#gjl{jgf\t\t?gju#`obpp>!`obpp>!pfbq`k.,algz=\t?,kwno=lsslqwvmjwz#wl`lnnvmj`bwjlmp?,kfbg=\x0E\t?algz#pwzof>!tjgwk9Wj\rVSmd#Uj\rWkw`kbmdfp#jm#wkfalqgfq.`lolq9 3!#alqgfq>!3!#?,psbm=?,gju=?tbp#gjp`lufqfg!#wzsf>!wf{w!#*8\t?,p`qjsw=\t\tGfsbqwnfmw#le#f``ofpjbpwj`bowkfqf#kbp#affmqfpvowjmd#eqln?,algz=?,kwno=kbp#mfufq#affmwkf#ejqpw#wjnfjm#qfpslmpf#wlbvwlnbwj`booz#?,gju=\t\t?gju#jtbp#`lmpjgfqfgsfq`fmw#le#wkf!#,=?,b=?,gju=`loof`wjlm#le#gfp`fmgfg#eqlnpf`wjlm#le#wkfb``fsw.`kbqpfwwl#af#`lmevpfgnfnafq#le#wkf#sbggjmd.qjdkw9wqbmpobwjlm#lejmwfqsqfwbwjlm#kqfe>$kwws9,,tkfwkfq#lq#mlwWkfqf#bqf#boplwkfqf#bqf#nbmzb#pnboo#mvnafqlwkfq#sbqwp#lejnslppjaof#wl##`obpp>!avwwlmol`bwfg#jm#wkf-#Kltfufq/#wkfbmg#fufmwvboozBw#wkf#fmg#le#af`bvpf#le#jwpqfsqfpfmwp#wkf?elqn#b`wjlm>!#nfwklg>!slpw!jw#jp#slppjaofnlqf#ojhfoz#wlbm#jm`qfbpf#jmkbuf#bopl#affm`lqqfpslmgp#wlbmmlvm`fg#wkbwbojdm>!qjdkw!=nbmz#`lvmwqjfpelq#nbmz#zfbqpfbqojfpw#hmltmaf`bvpf#jw#tbpsw!=?,p`qjsw=\x0E#ubojdm>!wls!#jmkbajwbmwp#leelooltjmd#zfbq\x0E\t?gju#`obpp>!njoojlm#sflsof`lmwqlufqpjbo#`lm`fqmjmd#wkfbqdvf#wkbw#wkfdlufqmnfmw#bmgb#qfefqfm`f#wlwqbmpefqqfg#wlgfp`qjajmd#wkf#pwzof>!`lolq9bowklvdk#wkfqfafpw#hmltm#elqpvanjw!#mbnf>!nvowjsoj`bwjlmnlqf#wkbm#lmf#qf`ldmjwjlm#le@lvm`jo#le#wkffgjwjlm#le#wkf##?nfwb#mbnf>!Fmwfqwbjmnfmw#btbz#eqln#wkf#8nbqdjm.qjdkw9bw#wkf#wjnf#lejmufpwjdbwjlmp`lmmf`wfg#tjwkbmg#nbmz#lwkfqbowklvdk#jw#jpafdjmmjmd#tjwk#?psbm#`obpp>!gfp`fmgbmwp#le?psbm#`obpp>!j#bojdm>!qjdkw!?,kfbg=\t?algz#bpsf`wp#le#wkfkbp#pjm`f#affmFvqlsfbm#Vmjlmqfnjmjp`fmw#lenlqf#gjeej`vowUj`f#Sqfpjgfmw`lnslpjwjlm#lesbppfg#wkqlvdknlqf#jnslqwbmwelmw.pjyf922s{f{sobmbwjlm#lewkf#`lm`fsw#letqjwwfm#jm#wkf\n?psbm#`obpp>!jp#lmf#le#wkf#qfpfnaobm`f#wllm#wkf#dqlvmgptkj`k#`lmwbjmpjm`ovgjmd#wkf#gfejmfg#az#wkfsvaoj`bwjlm#lenfbmp#wkbw#wkflvwpjgf#le#wkfpvsslqw#le#wkf?jmsvw#`obpp>!?psbm#`obpp>!w+Nbwk-qbmgln+*nlpw#sqlnjmfmwgfp`qjswjlm#le@lmpwbmwjmlsoftfqf#svaojpkfg?gju#`obpp>!pfbssfbqp#jm#wkf2!#kfjdkw>!2!#nlpw#jnslqwbmwtkj`k#jm`ovgfptkj`k#kbg#affmgfpwqv`wjlm#lewkf#slsvobwjlm\t\n?gju#`obpp>!slppjajojwz#leplnfwjnfp#vpfgbssfbq#wl#kbufpv``fpp#le#wkfjmwfmgfg#wl#afsqfpfmw#jm#wkfpwzof>!`ofbq9a\x0E\t?,p`qjsw=\x0E\t?tbp#elvmgfg#jmjmwfqujft#tjwk\\jg!#`lmwfmw>!`bsjwbo#le#wkf\x0E\t?ojmh#qfo>!pqfofbpf#le#wkfsljmw#lvw#wkbw{NOKwwsQfrvfpwbmg#pvapfrvfmwpf`lmg#obqdfpwufqz#jnslqwbmwpsf`jej`bwjlmppvqeb`f#le#wkfbssojfg#wl#wkfelqfjdm#sloj`z\\pfwGlnbjmMbnffpwbaojpkfg#jmjp#afojfufg#wlJm#bggjwjlm#wlnfbmjmd#le#wkfjp#mbnfg#bewfqwl#sqlwf`w#wkfjp#qfsqfpfmwfgGf`obqbwjlm#lenlqf#feej`jfmw@obppjej`bwjlmlwkfq#elqnp#lekf#qfwvqmfg#wl?psbm#`obpp>!`sfqelqnbm`f#le+evm`wjlm+*#x\x0Eje#bmg#lmoz#jeqfdjlmp#le#wkfofbgjmd#wl#wkfqfobwjlmp#tjwkVmjwfg#Mbwjlmppwzof>!kfjdkw9lwkfq#wkbm#wkfzsf!#`lmwfmw>!Bppl`jbwjlm#le\t?,kfbg=\t?algzol`bwfg#lm#wkfjp#qfefqqfg#wl+jm`ovgjmd#wkf`lm`fmwqbwjlmpwkf#jmgjujgvbobnlmd#wkf#nlpwwkbm#bmz#lwkfq,=\t?ojmh#qfo>!#qfwvqm#ebopf8wkf#svqslpf#lewkf#bajojwz#wl8`lolq9 eee~\t-\t?psbm#`obpp>!wkf#pvaif`w#legfejmjwjlmp#le=\x0E\t?ojmh#qfo>!`objn#wkbw#wkfkbuf#gfufolsfg?wbaof#tjgwk>!`fofaqbwjlm#leElooltjmd#wkf#wl#gjpwjmdvjpk?psbm#`obpp>!awbhfp#sob`f#jmvmgfq#wkf#mbnfmlwfg#wkbw#wkf=?\"Xfmgje^..=\tpwzof>!nbqdjm.jmpwfbg#le#wkfjmwqlgv`fg#wkfwkf#sql`fpp#lejm`qfbpjmd#wkfgjeefqfm`fp#jmfpwjnbwfg#wkbwfpsf`jbooz#wkf,gju=?gju#jg>!tbp#fufmwvboozwkqlvdklvw#kjpwkf#gjeefqfm`fplnfwkjmd#wkbwpsbm=?,psbm=?,pjdmjej`bmwoz#=?,p`qjsw=\x0E\t\x0E\tfmujqlmnfmwbo#wl#sqfufmw#wkfkbuf#affm#vpfgfpsf`jbooz#elqvmgfqpwbmg#wkfjp#fppfmwjbooztfqf#wkf#ejqpwjp#wkf#obqdfpwkbuf#affm#nbgf!#pq`>!kwws9,,jmwfqsqfwfg#bppf`lmg#kboe#le`qloojmd>!ml!#jp#`lnslpfg#leJJ/#Kloz#Qlnbmjp#f{sf`wfg#wlkbuf#wkfjq#ltmgfejmfg#bp#wkfwqbgjwjlmbooz#kbuf#gjeefqfmwbqf#lewfm#vpfgwl#fmpvqf#wkbwbdqffnfmw#tjwk`lmwbjmjmd#wkfbqf#eqfrvfmwozjmelqnbwjlm#lmf{bnsof#jp#wkfqfpvowjmd#jm#b?,b=?,oj=?,vo=#`obpp>!ellwfqbmg#fpsf`jboozwzsf>!avwwlm!#?,psbm=?,psbm=tkj`k#jm`ovgfg=\t?nfwb#mbnf>!`lmpjgfqfg#wkf`bqqjfg#lvw#azKltfufq/#jw#jpaf`bnf#sbqw#lejm#qfobwjlm#wlslsvobq#jm#wkfwkf#`bsjwbo#letbp#leej`jbooztkj`k#kbp#affmwkf#Kjpwlqz#lebowfqmbwjuf#wlgjeefqfmw#eqlnwl#pvsslqw#wkfpvddfpwfg#wkbwjm#wkf#sql`fpp##?gju#`obpp>!wkf#elvmgbwjlmaf`bvpf#le#kjp`lm`fqmfg#tjwkwkf#vmjufqpjwzlsslpfg#wl#wkfwkf#`lmwf{w#le?psbm#`obpp>!swf{w!#mbnf>!r!\n\n?gju#`obpp>!wkf#p`jfmwjej`qfsqfpfmwfg#aznbwkfnbwj`jbmpfof`wfg#az#wkfwkbw#kbuf#affm=?gju#`obpp>!`gju#jg>!kfbgfqjm#sbqwj`vobq/`lmufqwfg#jmwl*8\t?,p`qjsw=\t?skjolplskj`bo#pqsphlkqubwphjwj\rVSmd#Uj\rWkw<L=o=m=m<V<T<U=l=o=m=m<V<T<Ujmufpwjdb`j/_msbqwj`jsb`j/_m<V<R=n<R=l=g<Y<R<]<W<\\=m=n<T<V<R=n<R=l=g<U=k<Y<W<R<^<Y<V=m<T=m=n<Y<P=g<q<R<^<R=m=n<T<V<R=n<R=l=g=i<R<]<W<\\=m=n=`<^=l<Y<P<Y<Q<T<V<R=n<R=l<\\=c=m<Y<_<R<X<Q=c=m<V<\\=k<\\=n=`<Q<R<^<R=m=n<T<O<V=l<\\<T<Q=g<^<R<S=l<R=m=g<V<R=n<R=l<R<U=m<X<Y<W<\\=n=`<S<R<P<R=e=`=b=m=l<Y<X=m=n<^<R<]=l<\\<[<R<P=m=n<R=l<R<Q=g=o=k<\\=m=n<T<Y=n<Y=k<Y<Q<T<Y<\x7F<W<\\<^<Q<\\=c<T=m=n<R=l<T<T=m<T=m=n<Y<P<\\=l<Y=d<Y<Q<T=c<M<V<\\=k<\\=n=`<S<R=a=n<R<P=o=m<W<Y<X=o<Y=n=m<V<\\<[<\\=n=`=n<R<^<\\=l<R<^<V<R<Q<Y=k<Q<R=l<Y=d<Y<Q<T<Y<V<R=n<R=l<R<Y<R=l<_<\\<Q<R<^<V<R=n<R=l<R<P<L<Y<V<W<\\<P<\\4K5h5i5j4F4C5e5i5j4F4C5f4K4F4K5h5i5d4Z5d4U4K5h4D4]4K5i4@4K5h5i5d4K5n4U4K5h4]4_4K4J5h5i4X4K4]5o4K4F4K5h4O4U4Z4K4M4K5h4]5f4K4Z4E4K5h4F4Y5i5f5i4K5h4K4U4Z4K4M4K5h5j4F4K4J4@4K5h4O5h4U4K4D4K5h4F4_4@5f5h4K5h4O5n4_4K5i4K5h4Z4V4[4K4F4K5h5m5f4C5f5d4K5h4F4]4A5f4D4K5h4@4C5f4C4E4K5h4F4U5h5f5i4K5h4O4B4D4K4]4K5h4K5m5h4K5i4K5h4O5m5h4K5i4K5h4F4K4]5f4B4K5h4F5n5j5f4E4K5h4K5h4U4K4D4K5h4B5d4K4[4]4K5h5i4@4F5i4U4K5h4C5f5o5d4]4K5h4_5f4K4A4E4U4D4C4K5h5h5k4K5h4F4]4D5f4E4K5h4]5d4K4D4[4K5h4O4C4D5f4E4K5h4K4B4D4K4]4K5h5i4F4A4C4E4K5h4K4V4K5j5f`vqplq9sljmwfq8?,wjwof=\t?nfwb#!#kqfe>!kwws9,,!=?psbm#`obpp>!nfnafqp#le#wkf#tjmglt-ol`bwjlmufqwj`bo.bojdm9,b=#\x7F#?b#kqfe>!?\"gl`wzsf#kwno=nfgjb>!p`qffm!#?lswjlm#ubovf>!ebuj`lm-j`l!#,=\t\n\n?gju#`obpp>!`kbqb`wfqjpwj`p!#nfwklg>!dfw!#,algz=\t?,kwno=\tpklqw`vw#j`lm!#gl`vnfmw-tqjwf+sbggjmd.alwwln9qfsqfpfmwbwjufppvanjw!#ubovf>!bojdm>!`fmwfq!#wkqlvdklvw#wkf#p`jfm`f#ej`wjlm\t##?gju#`obpp>!pvanjw!#`obpp>!lmf#le#wkf#nlpw#ubojdm>!wls!=?tbp#fpwbaojpkfg*8\x0E\t?,p`qjsw=\x0E\tqfwvqm#ebopf8!=*-pwzof-gjpsobzaf`bvpf#le#wkf#gl`vnfmw-`llhjf?elqn#b`wjlm>!,~algzxnbqdjm938Fm`z`olsfgjb#leufqpjlm#le#wkf#-`qfbwfFofnfmw+mbnf!#`lmwfmw>!?,gju=\t?,gju=\t\tbgnjmjpwqbwjuf#?,algz=\t?,kwno=kjpwlqz#le#wkf#!=?jmsvw#wzsf>!slqwjlm#le#wkf#bp#sbqw#le#wkf#%maps8?b#kqfe>!lwkfq#`lvmwqjfp!=\t?gju#`obpp>!?,psbm=?,psbm=?Jm#lwkfq#tlqgp/gjpsobz9#aol`h8`lmwqlo#le#wkf#jmwqlgv`wjlm#le,=\t?nfwb#mbnf>!bp#tfoo#bp#wkf#jm#qf`fmw#zfbqp\x0E\t\n?gju#`obpp>!?,gju=\t\n?,gju=\tjmpsjqfg#az#wkfwkf#fmg#le#wkf#`lnsbwjaof#tjwkaf`bnf#hmltm#bp#pwzof>!nbqdjm9-ip!=?,p`qjsw=?#Jmwfqmbwjlmbo#wkfqf#kbuf#affmDfqnbm#obmdvbdf#pwzof>!`lolq9 @lnnvmjpw#Sbqwz`lmpjpwfmw#tjwkalqgfq>!3!#`foo#nbqdjmkfjdkw>!wkf#nbilqjwz#le!#bojdm>!`fmwfqqfobwfg#wl#wkf#nbmz#gjeefqfmw#Lqwklgl{#@kvq`kpjnjobq#wl#wkf#,=\t?ojmh#qfo>!ptbp#lmf#le#wkf#vmwjo#kjp#gfbwk~*+*8\t?,p`qjsw=lwkfq#obmdvbdfp`lnsbqfg#wl#wkfslqwjlmp#le#wkfwkf#Mfwkfqobmgpwkf#nlpw#`lnnlmab`hdqlvmg9vqo+bqdvfg#wkbw#wkfp`qloojmd>!ml!#jm`ovgfg#jm#wkfMlqwk#Bnfqj`bm#wkf#mbnf#le#wkfjmwfqsqfwbwjlmpwkf#wqbgjwjlmbogfufolsnfmw#le#eqfrvfmwoz#vpfgb#`loof`wjlm#leufqz#pjnjobq#wlpvqqlvmgjmd#wkff{bnsof#le#wkjpbojdm>!`fmwfq!=tlvog#kbuf#affmjnbdf\\`bswjlm#>bwwb`kfg#wl#wkfpvddfpwjmd#wkbwjm#wkf#elqn#le#jmuloufg#jm#wkfjp#gfqjufg#eqlnmbnfg#bewfq#wkfJmwqlgv`wjlm#wlqfpwqj`wjlmp#lm#pwzof>!tjgwk9#`bm#af#vpfg#wl#wkf#`qfbwjlm#lenlpw#jnslqwbmw#jmelqnbwjlm#bmgqfpvowfg#jm#wkf`loobspf#le#wkfWkjp#nfbmp#wkbwfofnfmwp#le#wkftbp#qfsob`fg#azbmbozpjp#le#wkfjmpsjqbwjlm#elqqfdbqgfg#bp#wkfnlpw#pv``fppevohmltm#bp#%rvlw8b#`lnsqfkfmpjufKjpwlqz#le#wkf#tfqf#`lmpjgfqfgqfwvqmfg#wl#wkfbqf#qfefqqfg#wlVmplvq`fg#jnbdf=\t\n?gju#`obpp>!`lmpjpwp#le#wkfpwlsSqlsbdbwjlmjmwfqfpw#jm#wkfbubjobajojwz#lebssfbqp#wl#kbuffof`wqlnbdmfwj`fmbaofPfquj`fp+evm`wjlm#le#wkfJw#jp#jnslqwbmw?,p`qjsw=?,gju=evm`wjlm+*xubq#qfobwjuf#wl#wkfbp#b#qfpvow#le#wkf#slpjwjlm#leElq#f{bnsof/#jm#nfwklg>!slpw!#tbp#elooltfg#az%bns8ngbpk8#wkfwkf#bssoj`bwjlmip!=?,p`qjsw=\x0E\tvo=?,gju=?,gju=bewfq#wkf#gfbwktjwk#qfpsf`w#wlpwzof>!sbggjmd9jp#sbqwj`vobqozgjpsobz9jmojmf8#wzsf>!pvanjw!#jp#gjujgfg#jmwl\bTA\nzk#+\x0BBl\bQ\x7F*qfpslmpbajojgbgbgnjmjpwqb`j/_mjmwfqmb`jlmbofp`lqqfpslmgjfmwf\fHe\fHF\fHC\fIg\fH{\fHF\fIn\fH\\\fIa\fHY\fHU\fHB\fHR\fH\\\fIk\fH^\fIg\fH{\fIg\fHn\fHv\fIm\fHD\fHR\fHY\fH^\fIk\fHy\fHS\fHD\fHT\fH\\\fHy\fHR\fH\\\fHF\fIm\fH^\fHS\fHT\fHz\fIg\fHp\fIk\fHn\fHv\fHR\fHU\fHS\fHc\fHA\fIk\fHp\fIk\fHn\fHZ\fHR\fHB\fHS\fH^\fHU\fHB\fHR\fH\\\fIl\fHp\fHR\fH{\fH\\\fHO\fH@\fHD\fHR\fHD\fIk\fHy\fIm\fHB\fHR\fH\\\fH@\fIa\fH^\fIe\fH{\fHB\fHR\fH^\fHS\fHy\fHB\fHU\fHS\fH^\fHR\fHF\fIo\fH[\fIa\fHL\fH@\fHN\fHP\fHH\fIk\fHA\fHR\fHp\fHF\fHR\fHy\fIa\fH^\fHS\fHy\fHs\fIa\fH\\\fIk\fHD\fHz\fHS\fH^\fHR\fHG\fHJ\fI`\fH\\\fHR\fHD\fHB\fHR\fHB\fH^\fIk\fHB\fHH\fHJ\fHR\fHD\fH@\fHR\fHp\fHR\fH\\\fHY\fHS\fHy\fHR\fHT\fHy\fIa\fHC\fIg\fHn\fHv\fHR\fHU\fHH\fIk\fHF\fHU\fIm\fHm\fHv\fH@\fHH\fHR\fHC\fHR\fHT\fHn\fHY\fHR\fHJ\fHJ\fIk\fHz\fHD\fIk\fHF\fHS\fHw\fH^\fIk\fHY\fHS\fHZ\fIk\fH[\fH\\\fHR\fHp\fIa\fHC\fHe\fHH\fIa\fHH\fH\\\fHB\fIm\fHn\fH@\fHd\fHJ\fIg\fHD\fIg\fHn\fHe\fHF\fHy\fH\\\fHO\fHF\fHN\fHP\fIk\fHn\fHT\fIa\fHI\fHS\fHH\fHG\fHS\fH^\fIa\fHB\fHB\fIm\fHz\fIa\fHC\fHi\fHv\fIa\fHw\fHR\fHw\fIn\fHs\fHH\fIl\fHT\fHn\fH{\fIl\fHH\fHp\fHR\fHc\fH{\fHR\fHY\fHS\fHA\fHR\fH{\fHt\fHO\fIa\fHs\fIk\fHJ\fIn\fHT\fH\\\fIk\fHJ\fHS\fHD\fIg\fHn\fHU\fHH\fIa\fHC\fHR\fHT\fIk\fHy\fIa\fHT\fH{\fHR\fHn\fHK\fIl\fHY\fHS\fHZ\fIa\fHY\fH\\\fHR\fHH\fIk\fHn\fHJ\fId\fHs\fIa\fHT\fHD\fHy\fIa\fHZ\fHR\fHT\fHR\fHB\fHD\fIk\fHi\fHJ\fHR\fH^\fHH\fH@\fHS\fHp\fH^\fIl\fHF\fIm\fH\\\fIn\fH[\fHU\fHS\fHn\fHJ\fIl\fHB\fHS\fHH\fIa\fH\\\fHy\fHY\fHS\fHH\fHR\fH\\\fIm\fHF\fHC\fIk\fHT\fIa\fHI\fHR\fHD\fHy\fH\\\fIg\fHM\fHP\fHB\fIm\fHy\fIa\fHH\fHC\fIg\fHp\fHD\fHR\fHy\fIo\fHF\fHC\fHR\fHF\fIg\fHT\fIa\fHs\fHt\fH\\\fIk\fH^\fIn\fHy\fHR\fH\\\fIa\fHC\fHY\fHS\fHv\fHR\fH\\\fHT\fIn\fHv\fHD\fHR\fHB\fIn\fH^\fIa\fHC\fHJ\fIk\fHz\fIk\fHn\fHU\fHB\fIk\fHZ\fHR\fHT\fIa\fHy\fIn\fH^\fHB\fId\fHn\fHD\fIk\fHH\fId\fHC\fHR\fH\\\fHp\fHS\fHT\fHy\fIkqpp({no!#wjwof>!.wzsf!#`lmwfmw>!wjwof!#`lmwfmw>!bw#wkf#pbnf#wjnf-ip!=?,p`qjsw=\t?!#nfwklg>!slpw!#?,psbm=?,b=?,oj=ufqwj`bo.bojdm9w,irvfqz-njm-ip!=-`oj`h+evm`wjlm+#pwzof>!sbggjmd.~*+*8\t?,p`qjsw=\t?,psbm=?b#kqfe>!?b#kqfe>!kwws9,,*8#qfwvqm#ebopf8wf{w.gf`lqbwjlm9#p`qloojmd>!ml!#alqgfq.`loobspf9bppl`jbwfg#tjwk#Abkbpb#JmglmfpjbFmdojpk#obmdvbdf?wf{w#{no9psb`f>-dje!#alqgfq>!3!?,algz=\t?,kwno=\tlufqeolt9kjggfm8jnd#pq`>!kwws9,,bggFufmwOjpwfmfqqfpslmpjaof#elq#p-ip!=?,p`qjsw=\t,ebuj`lm-j`l!#,=lsfqbwjmd#pzpwfn!#pwzof>!tjgwk92wbqdfw>!\\aobmh!=Pwbwf#Vmjufqpjwzwf{w.bojdm9ofew8\tgl`vnfmw-tqjwf+/#jm`ovgjmd#wkf#bqlvmg#wkf#tlqog*8\x0E\t?,p`qjsw=\x0E\t?!#pwzof>!kfjdkw98lufqeolt9kjggfmnlqf#jmelqnbwjlmbm#jmwfqmbwjlmbob#nfnafq#le#wkf#lmf#le#wkf#ejqpw`bm#af#elvmg#jm#?,gju=\t\n\n?,gju=\tgjpsobz9#mlmf8!=!#,=\t?ojmh#qfo>!\t##+evm`wjlm+*#xwkf#26wk#`fmwvqz-sqfufmwGfebvow+obqdf#mvnafq#le#Azybmwjmf#Fnsjqf-isd\x7Fwkvna\x7Fofew\x7Fubpw#nbilqjwz#lenbilqjwz#le#wkf##bojdm>!`fmwfq!=Vmjufqpjwz#Sqfppglnjmbwfg#az#wkfPf`lmg#Tlqog#Tbqgjpwqjavwjlm#le#pwzof>!slpjwjlm9wkf#qfpw#le#wkf#`kbqb`wfqjyfg#az#qfo>!mleloolt!=gfqjufp#eqln#wkfqbwkfq#wkbm#wkf#b#`lnajmbwjlm#lepwzof>!tjgwk9233Fmdojpk.psfbhjmd`lnsvwfq#p`jfm`falqgfq>!3!#bow>!wkf#f{jpwfm`f#leGfnl`qbwj`#Sbqwz!#pwzof>!nbqdjm.Elq#wkjp#qfbplm/-ip!=?,p`qjsw=\t\npAzWbdMbnf+p*X3^ip!=?,p`qjsw=\x0E\t?-ip!=?,p`qjsw=\x0E\tojmh#qfo>!j`lm!#$#bow>$$#`obpp>$elqnbwjlm#le#wkfufqpjlmp#le#wkf#?,b=?,gju=?,gju=,sbdf=\t##?sbdf=\t?gju#`obpp>!`lmwaf`bnf#wkf#ejqpwabkbpb#Jmglmfpjbfmdojpk#+pjnsof*\"y\"W\"W\"[\"Q\"U\"V\"@=i=l<^<\\=n=m<V<T<V<R<P<S<\\<Q<T<T=c<^<W=c<Y=n=m=c<x<R<]<\\<^<T=n=`=k<Y<W<R<^<Y<V<\\=l<\\<[<^<T=n<T=c<t<Q=n<Y=l<Q<Y=n<r=n<^<Y=n<T=n=`<Q<\\<S=l<T<P<Y=l<T<Q=n<Y=l<Q<Y=n<V<R=n<R=l<R<_<R=m=n=l<\\<Q<T=j=g<V<\\=k<Y=m=n<^<Y=o=m<W<R<^<T=c=i<S=l<R<]<W<Y<P=g<S<R<W=o=k<T=n=`=c<^<W=c=b=n=m=c<Q<\\<T<]<R<W<Y<Y<V<R<P<S<\\<Q<T=c<^<Q<T<P<\\<Q<T<Y=m=l<Y<X=m=n<^<\\4K5h5i5d4K4Z5f4U4K5h4]4J5f4_5f4E4K5h4K5j4F5n4K5h5i4X4K4]5o4K4F5o4K5h4_5f4K4]4K4F4K5h5i5o4F5d4D4E4K5h4_4U5d4C5f4E4K4A4Y4K4J5f4K4F4K5h4U4K5h5i5f4E4K5h4Y5d4F5f4K4F4K5h4K5j4F4]5j4F4K5h4F4Y4K5i5f5i4K5h4I4_5h4K5i5f4K5h5i4X4K4]5o4E4K5h5i4]4J5f4K4Fqlalwp!#`lmwfmw>!?gju#jg>!ellwfq!=wkf#Vmjwfg#Pwbwfp?jnd#pq`>!kwws9,,-isd\x7Fqjdkw\x7Fwkvna\x7F-ip!=?,p`qjsw=\x0E\t?ol`bwjlm-sqlwl`loeqbnfalqgfq>!3!#p!#,=\t?nfwb#mbnf>!?,b=?,gju=?,gju=?elmw.tfjdkw9alog8%rvlw8#bmg#%rvlw8gfsfmgjmd#lm#wkf#nbqdjm938sbggjmd9!#qfo>!mleloolt!#Sqfpjgfmw#le#wkf#wtfmwjfwk#`fmwvqzfujpjlm=\t##?,sbdfJmwfqmfw#F{solqfqb-bpzm`#>#wqvf8\x0E\tjmelqnbwjlm#balvw?gju#jg>!kfbgfq!=!#b`wjlm>!kwws9,,?b#kqfe>!kwwsp9,,?gju#jg>!`lmwfmw!?,gju=\x0E\t?,gju=\x0E\t?gfqjufg#eqln#wkf#?jnd#pq`>$kwws9,,b``lqgjmd#wl#wkf#\t?,algz=\t?,kwno=\tpwzof>!elmw.pjyf9p`qjsw#obmdvbdf>!Bqjbo/#Kfoufwj`b/?,b=?psbm#`obpp>!?,p`qjsw=?p`qjsw#slojwj`bo#sbqwjfpwg=?,wq=?,wbaof=?kqfe>!kwws9,,ttt-jmwfqsqfwbwjlm#leqfo>!pwzofpkffw!#gl`vnfmw-tqjwf+$?`kbqpfw>!vwe.;!=\tafdjmmjmd#le#wkf#qfufbofg#wkbw#wkfwfofujpjlm#pfqjfp!#qfo>!mleloolt!=#wbqdfw>!\\aobmh!=`objnjmd#wkbw#wkfkwws&0B&1E&1Ettt-nbmjefpwbwjlmp#leSqjnf#Njmjpwfq#lejmeovfm`fg#az#wkf`obpp>!`ofbqej{!=,gju=\x0E\t?,gju=\x0E\t\x0E\twkqff.gjnfmpjlmbo@kvq`k#le#Fmdobmgle#Mlqwk#@bqlojmbprvbqf#hjolnfwqfp-bggFufmwOjpwfmfqgjpwjm`w#eqln#wkf`lnnlmoz#hmltm#bpSklmfwj`#Boskbafwgf`obqfg#wkbw#wkf`lmwqloofg#az#wkfAfmibnjm#Eqbmhojmqlof.sobzjmd#dbnfwkf#Vmjufqpjwz#lejm#Tfpwfqm#Fvqlsfsfqplmbo#`lnsvwfqSqlif`w#Dvwfmafqdqfdbqgofpp#le#wkfkbp#affm#sqlslpfgwldfwkfq#tjwk#wkf=?,oj=?oj#`obpp>!jm#plnf#`lvmwqjfpnjm-ip!=?,p`qjsw=le#wkf#slsvobwjlmleej`jbo#obmdvbdf?jnd#pq`>!jnbdfp,jgfmwjejfg#az#wkfmbwvqbo#qfplvq`fp`obppjej`bwjlm#le`bm#af#`lmpjgfqfgrvbmwvn#nf`kbmj`pMfufqwkfofpp/#wkfnjoojlm#zfbqp#bdl?,algz=\x0E\t?,kwno=\x0E\"y\"W\"W\"[\"Q\"U\"V\"@\twbhf#bgubmwbdf#lebmg/#b``lqgjmd#wlbwwqjavwfg#wl#wkfNj`qlplew#Tjmgltpwkf#ejqpw#`fmwvqzvmgfq#wkf#`lmwqlogju#`obpp>!kfbgfqpklqwoz#bewfq#wkfmlwbaof#f{`fswjlmwfmp#le#wklvpbmgppfufqbo#gjeefqfmwbqlvmg#wkf#tlqog-qfb`kjmd#njojwbqzjplobwfg#eqln#wkflsslpjwjlm#wl#wkfwkf#Log#WfpwbnfmwBeqj`bm#Bnfqj`bmpjmpfqwfg#jmwl#wkfpfsbqbwf#eqln#wkfnfwqlslojwbm#bqfbnbhfp#jw#slppjaofb`hmltofgdfg#wkbwbqdvbaoz#wkf#nlpwwzsf>!wf{w,`pp!=\twkf#JmwfqmbwjlmboB``lqgjmd#wl#wkf#sf>!wf{w,`pp!#,=\t`ljm`jgf#tjwk#wkfwtl.wkjqgp#le#wkfGvqjmd#wkjp#wjnf/gvqjmd#wkf#sfqjlgbmmlvm`fg#wkbw#kfwkf#jmwfqmbwjlmbobmg#nlqf#qf`fmwozafojfufg#wkbw#wkf`lmp`jlvpmfpp#bmgelqnfqoz#hmltm#bppvqqlvmgfg#az#wkfejqpw#bssfbqfg#jml``bpjlmbooz#vpfgslpjwjlm9baplovwf8!#wbqdfw>!\\aobmh!#slpjwjlm9qfobwjuf8wf{w.bojdm9`fmwfq8ib{,ojap,irvfqz,2-ab`hdqlvmg.`lolq9 wzsf>!bssoj`bwjlm,bmdvbdf!#`lmwfmw>!?nfwb#kwws.frvju>!Sqjub`z#Sloj`z?,b=f+!&0@p`qjsw#pq`>$!#wbqdfw>!\\aobmh!=Lm#wkf#lwkfq#kbmg/-isd\x7Fwkvna\x7Fqjdkw\x7F1?,gju=?gju#`obpp>!?gju#pwzof>!eolbw9mjmfwffmwk#`fmwvqz?,algz=\x0E\t?,kwno=\x0E\t?jnd#pq`>!kwws9,,p8wf{w.bojdm9`fmwfqelmw.tfjdkw9#alog8#B``lqgjmd#wl#wkf#gjeefqfm`f#afwtffm!#eqbnfalqgfq>!3!#!#pwzof>!slpjwjlm9ojmh#kqfe>!kwws9,,kwno7,ollpf-gwg!=\tgvqjmd#wkjp#sfqjlg?,wg=?,wq=?,wbaof=`olpfoz#qfobwfg#wlelq#wkf#ejqpw#wjnf8elmw.tfjdkw9alog8jmsvw#wzsf>!wf{w!#?psbm#pwzof>!elmw.lmqfbgzpwbwf`kbmdf\n?gju#`obpp>!`ofbqgl`vnfmw-ol`bwjlm-#Elq#f{bnsof/#wkf#b#tjgf#ubqjfwz#le#?\"GL@WZSF#kwno=\x0E\t?%maps8%maps8%maps8!=?b#kqfe>!kwws9,,pwzof>!eolbw9ofew8`lm`fqmfg#tjwk#wkf>kwws&0B&1E&1Ettt-jm#slsvobq#`vowvqfwzsf>!wf{w,`pp!#,=jw#jp#slppjaof#wl#Kbqubqg#Vmjufqpjwzwzofpkffw!#kqfe>!,wkf#nbjm#`kbqb`wfqL{elqg#Vmjufqpjwz##mbnf>!hfztlqgp!#`pwzof>!wf{w.bojdm9wkf#Vmjwfg#Hjmdglnefgfqbo#dlufqmnfmw?gju#pwzof>!nbqdjm#gfsfmgjmd#lm#wkf#gfp`qjswjlm#le#wkf?gju#`obpp>!kfbgfq-njm-ip!=?,p`qjsw=gfpwqv`wjlm#le#wkfpojdkwoz#gjeefqfmwjm#b``lqgbm`f#tjwkwfof`lnnvmj`bwjlmpjmgj`bwfp#wkbw#wkfpklqwoz#wkfqfbewfqfpsf`jbooz#jm#wkf#Fvqlsfbm#`lvmwqjfpKltfufq/#wkfqf#bqfpq`>!kwws9,,pwbwj`pvddfpwfg#wkbw#wkf!#pq`>!kwws9,,ttt-b#obqdf#mvnafq#le#Wfof`lnnvmj`bwjlmp!#qfo>!mleloolt!#wKloz#Qlnbm#Fnsfqlqbonlpw#f{`ovpjufoz!#alqgfq>!3!#bow>!Pf`qfwbqz#le#Pwbwf`vonjmbwjmd#jm#wkf@JB#Tlqog#Eb`wallhwkf#nlpw#jnslqwbmwbmmjufqpbqz#le#wkfpwzof>!ab`hdqlvmg.?oj=?fn=?b#kqfe>!,wkf#Bwobmwj`#L`fbmpwqj`woz#psfbhjmd/pklqwoz#afelqf#wkfgjeefqfmw#wzsfp#lewkf#Lwwlnbm#Fnsjqf=?jnd#pq`>!kwws9,,Bm#Jmwqlgv`wjlm#wl`lmpfrvfm`f#le#wkfgfsbqwvqf#eqln#wkf@lmefgfqbwf#Pwbwfpjmgjdfmlvp#sflsofpSql`ffgjmdp#le#wkfjmelqnbwjlm#lm#wkfwkflqjfp#kbuf#affmjmuloufnfmw#jm#wkfgjujgfg#jmwl#wkqffbgib`fmw#`lvmwqjfpjp#qfpslmpjaof#elqgjpplovwjlm#le#wkf`loobalqbwjlm#tjwktjgfoz#qfdbqgfg#bpkjp#`lmwfnslqbqjfpelvmgjmd#nfnafq#leGlnjmj`bm#Qfsvaoj`dfmfqbooz#b``fswfgwkf#slppjajojwz#lebqf#bopl#bubjobaofvmgfq#`lmpwqv`wjlmqfpwlqbwjlm#le#wkfwkf#dfmfqbo#svaoj`jp#bonlpw#fmwjqfozsbppfp#wkqlvdk#wkfkbp#affm#pvddfpwfg`lnsvwfq#bmg#ujgflDfqnbmj`#obmdvbdfp#b``lqgjmd#wl#wkf#gjeefqfmw#eqln#wkfpklqwoz#bewfqtbqgpkqfe>!kwwsp9,,ttt-qf`fmw#gfufolsnfmwAlbqg#le#Gjqf`wlqp?gju#`obpp>!pfbq`k\x7F#?b#kqfe>!kwws9,,Jm#sbqwj`vobq/#wkfNvowjsof#ellwmlwfplq#lwkfq#pvapwbm`fwklvpbmgp#le#zfbqpwqbmpobwjlm#le#wkf?,gju=\x0E\t?,gju=\x0E\t\x0E\t?b#kqfe>!jmgf{-skstbp#fpwbaojpkfg#jmnjm-ip!=?,p`qjsw=\tsbqwj`jsbwf#jm#wkfb#pwqlmd#jmeovfm`fpwzof>!nbqdjm.wls9qfsqfpfmwfg#az#wkfdqbgvbwfg#eqln#wkfWqbgjwjlmbooz/#wkfFofnfmw+!p`qjsw!*8Kltfufq/#pjm`f#wkf,gju=\t?,gju=\t?gju#ofew8#nbqdjm.ofew9sqlwf`wjlm#bdbjmpw38#ufqwj`bo.bojdm9Vmelqwvmbwfoz/#wkfwzsf>!jnbdf,{.j`lm,gju=\t?gju#`obpp>!#`obpp>!`ofbqej{!=?gju#`obpp>!ellwfq\n\n?,gju=\t\n\n?,gju=\twkf#nlwjlm#sj`wvqf<}=f<W<_<\\=l=m<V<T<]=f<W<_<\\=l=m<V<T<H<Y<X<Y=l<\\=j<T<T<Q<Y=m<V<R<W=`<V<R=m<R<R<]=e<Y<Q<T<Y=m<R<R<]=e<Y<Q<T=c<S=l<R<_=l<\\<P<P=g<r=n<S=l<\\<^<T=n=`<]<Y=m<S<W<\\=n<Q<R<P<\\=n<Y=l<T<\\<W=g<S<R<[<^<R<W=c<Y=n<S<R=m<W<Y<X<Q<T<Y=l<\\<[<W<T=k<Q=g=i<S=l<R<X=o<V=j<T<T<S=l<R<_=l<\\<P<P<\\<S<R<W<Q<R=m=n=`=b<Q<\\=i<R<X<T=n=m=c<T<[<]=l<\\<Q<Q<R<Y<Q<\\=m<Y<W<Y<Q<T=c<T<[<P<Y<Q<Y<Q<T=c<V<\\=n<Y<_<R=l<T<T<|<W<Y<V=m<\\<Q<X=l\fHJ\fIa\fHY\fHR\fH\\\fHR\fHB\fId\fHD\fIm\fHi\fH^\fHF\fIa\fH\\\fHJ\fHR\fHD\fHA\fHR\fH\\\fHH\fIl\fHC\fHi\fHD\fIm\fHJ\fIk\fHZ\fHU\fHS\fHD\fIa\fHJ\fIl\fHk\fHn\fHM\fHS\fHC\fHR\fHJ\fHS\fH^\fIa\fH^\fIl\fHi\fHK\fHS\fHy\fHR\fH\\\fHY\fIl\fHM\fHS\fHC\fIg\fHv\fHS\fHs\fIa\fHL\fIk\fHT\fHB\fHR\fHv\fHR\fH\\\fHp\fHn\fHy\fIa\fHZ\fHD\fHJ\fIm\fHD\fHS\fHC\fHR\fHF\fIa\fH\\\fHC\fIg\fH{\fHi\fHD\fIm\fHT\fHR\fH\\\fH}\fHD\fH^\fHR\fHk\fHD\fHF\fHR\fH\\\fIa\fHs\fIl\fHZ\fH\\\fIa\fHH\fIg\fHn\fH^\fIg\fHy\fHT\fHA\fHR\fHG\fHP\fIa\fH^\fId\fHZ\fHZ\fH\\\fIa\fHH\fIk\fHn\fHF\fIa\fH\\\fHJ\fIk\fHZ\fHF\fIa\fH^\fIk\fHC\fH\\\fHy\fIk\fHn\fHJ\fIa\fH\\\fHT\fIa\fHI\fHS\fHH\fHS\fHe\fHH\fIa\fHF\fHR\fHJ\fHe\fHD\fIa\fHU\fIk\fHn\fHv\fHS\fHs\fIa\fHL\fHR\fHC\fHR\fHH\fIa\fH\\\fHR\fHp\fIa\fHC\fHR\fHJ\fHR\fHF\fIm\fH\\\fHR\fHD\fIk\fHp\fIg\fHM\fHP\fIk\fHn\fHi\fHD\fIm\fHY\fHR\fHJ\fHZ\fIa\fH\\\fIk\fHO\fIl\fHZ\fHS\fHy\fIa\fH[\fHR\fHT\fH\\\fHy\fHR\fH\\\fIl\fHT\fHn\fH{\fIa\fH\\\fHU\fHF\fH\\\fHS\fHO\fHR\fHB\fH@\fIa\fH\\\fHR\fHn\fHM\fH@\fHv\fIa\fHv\fIg\fHn\fHe\fHF\fH^\fH@\fIa\fHK\fHB\fHn\fHH\fIa\fH\\\fIl\fHT\fHn\fHF\fH\\\fIa\fHy\fHe\fHB\fIa\fHB\fIl\fHJ\fHB\fHR\fHK\fIa\fHC\fHB\fHT\fHU\fHR\fHC\fHH\fHR\fHZ\fH@\fIa\fHJ\fIg\fHn\fHB\fIl\fHM\fHS\fHC\fHR\fHj\fHd\fHF\fIl\fHc\fH^\fHB\fIg\fH@\fHR\fHk\fH^\fHT\fHn\fHz\fIa\fHC\fHR\fHj\fHF\fH\\\fIk\fHZ\fHD\fHi\fHD\fIm\fH@\fHn\fHK\fH@\fHR\fHp\fHP\fHR\fH\\\fHD\fHY\fIl\fHD\fHH\fHB\fHF\fIa\fH\\\fHB\fIm\fHz\fHF\fIa\fH\\\fHZ\fIa\fHD\fHF\fH\\\fHS\fHY\fHR\fH\\\fHD\fIm\fHy\fHT\fHR\fHD\fHT\fHB\fH\\\fIa\fHI\fHD\fHj\fHC\fIg\fHp\fHS\fHH\fHT\fIg\fHB\fHY\fHR\fH\\4K5h5i4X4K4]5o4K4F4K5h5i5j4F4C5f4K4F4K5h5o5i4D5f5d4F4]4K5h5i4X4K5k4C4K4F4U4C4C4K5h4^5d4K4]4U4C4C4K5h4]4C5d4C4K5h4I4_5h4K5i5f4E4K5h5m5d4F5d4X5d4D4K5h5i4_4K4D5n4K4F4K5h5i4U5h5d5i4K4F4K5h5i4_5h4_5h4K4F4K5h4@4]4K5m5f5o4_4K5h4K4_5h4K5i5f4E4K5h4K4F4Y4K5h4K4Fhfztlqgp!#`lmwfmw>!t0-lqd,2:::,{kwno!=?b#wbqdfw>!\\aobmh!#wf{w,kwno8#`kbqpfw>!#wbqdfw>!\\aobmh!=?wbaof#`foosbggjmd>!bvwl`lnsofwf>!lee!#wf{w.bojdm9#`fmwfq8wl#obpw#ufqpjlm#az#ab`hdqlvmg.`lolq9# !#kqfe>!kwws9,,ttt-,gju=?,gju=?gju#jg>?b#kqfe>! !#`obpp>!!=?jnd#pq`>!kwws9,,`qjsw!#pq`>!kwws9,,\t?p`qjsw#obmdvbdf>!,,FM!#!kwws9,,ttt-tfm`lgfVQJ@lnslmfmw+!#kqfe>!ibubp`qjsw9?gju#`obpp>!`lmwfmwgl`vnfmw-tqjwf+$?p`slpjwjlm9#baplovwf8p`qjsw#pq`>!kwws9,,#pwzof>!nbqdjm.wls9-njm-ip!=?,p`qjsw=\t?,gju=\t?gju#`obpp>!t0-lqd,2:::,{kwno!#\t\x0E\t?,algz=\x0E\t?,kwno=gjpwjm`wjlm#afwtffm,!#wbqdfw>!\\aobmh!=?ojmh#kqfe>!kwws9,,fm`lgjmd>!vwe.;!<=\tt-bggFufmwOjpwfmfq<b`wjlm>!kwws9,,ttt-j`lm!#kqfe>!kwws9,,#pwzof>!ab`hdqlvmg9wzsf>!wf{w,`pp!#,=\tnfwb#sqlsfqwz>!ld9w?jmsvw#wzsf>!wf{w!##pwzof>!wf{w.bojdm9wkf#gfufolsnfmw#le#wzofpkffw!#wzsf>!wfkwno8#`kbqpfw>vwe.;jp#`lmpjgfqfg#wl#afwbaof#tjgwk>!233&!#Jm#bggjwjlm#wl#wkf#`lmwqjavwfg#wl#wkf#gjeefqfm`fp#afwtffmgfufolsnfmw#le#wkf#Jw#jp#jnslqwbmw#wl#?,p`qjsw=\t\t?p`qjsw##pwzof>!elmw.pjyf92=?,psbm=?psbm#jg>daOjaqbqz#le#@lmdqfpp?jnd#pq`>!kwws9,,jnFmdojpk#wqbmpobwjlmB`bgfnz#le#P`jfm`fpgju#pwzof>!gjpsobz9`lmpwqv`wjlm#le#wkf-dfwFofnfmwAzJg+jg*jm#`lmivm`wjlm#tjwkFofnfmw+$p`qjsw$*8#?nfwb#sqlsfqwz>!ld9<}=f<W<_<\\=l=m<V<T\t#wzsf>!wf{w!#mbnf>!=Sqjub`z#Sloj`z?,b=bgnjmjpwfqfg#az#wkffmbaofPjmdofQfrvfpwpwzof>%rvlw8nbqdjm9?,gju=?,gju=?,gju=?=?jnd#pq`>!kwws9,,j#pwzof>%rvlw8eolbw9qfefqqfg#wl#bp#wkf#wlwbo#slsvobwjlm#lejm#Tbpkjmdwlm/#G-@-#pwzof>!ab`hdqlvmg.bnlmd#lwkfq#wkjmdp/lqdbmjybwjlm#le#wkfsbqwj`jsbwfg#jm#wkfwkf#jmwqlgv`wjlm#lejgfmwjejfg#tjwk#wkfej`wjlmbo#`kbqb`wfq#L{elqg#Vmjufqpjwz#njpvmgfqpwbmgjmd#leWkfqf#bqf/#kltfufq/pwzofpkffw!#kqfe>!,@lovnajb#Vmjufqpjwzf{sbmgfg#wl#jm`ovgfvpvbooz#qfefqqfg#wljmgj`bwjmd#wkbw#wkfkbuf#pvddfpwfg#wkbwbeejojbwfg#tjwk#wkf`lqqfobwjlm#afwtffmmvnafq#le#gjeefqfmw=?,wg=?,wq=?,wbaof=Qfsvaoj`#le#Jqfobmg\t?,p`qjsw=\t?p`qjsw#vmgfq#wkf#jmeovfm`f`lmwqjavwjlm#wl#wkfLeej`jbo#tfapjwf#lekfbgrvbqwfqp#le#wkf`fmwfqfg#bqlvmg#wkfjnsoj`bwjlmp#le#wkfkbuf#affm#gfufolsfgEfgfqbo#Qfsvaoj`#leaf`bnf#jm`qfbpjmdoz`lmwjmvbwjlm#le#wkfMlwf/#kltfufq/#wkbwpjnjobq#wl#wkbw#le#`bsbajojwjfp#le#wkfb``lqgbm`f#tjwk#wkfsbqwj`jsbmwp#jm#wkfevqwkfq#gfufolsnfmwvmgfq#wkf#gjqf`wjlmjp#lewfm#`lmpjgfqfgkjp#zlvmdfq#aqlwkfq?,wg=?,wq=?,wbaof=?b#kwws.frvju>![.VB.skzpj`bo#sqlsfqwjfple#Aqjwjpk#@lovnajbkbp#affm#`qjwj`jyfg+tjwk#wkf#f{`fswjlmrvfpwjlmp#balvw#wkfsbppjmd#wkqlvdk#wkf3!#`foosbggjmd>!3!#wklvpbmgp#le#sflsofqfgjqf`wp#kfqf-#Elqkbuf#`kjogqfm#vmgfq&0F&0@,p`qjsw&0F!**8?b#kqfe>!kwws9,,ttt-?oj=?b#kqfe>!kwws9,,pjwf\\mbnf!#`lmwfmw>!wf{w.gf`lqbwjlm9mlmfpwzof>!gjpsobz9#mlmf?nfwb#kwws.frvju>![.mft#Gbwf+*-dfwWjnf+*#wzsf>!jnbdf,{.j`lm!?,psbm=?psbm#`obpp>!obmdvbdf>!ibubp`qjswtjmglt-ol`bwjlm-kqfe?b#kqfe>!ibubp`qjsw9..=\x0E\t?p`qjsw#wzsf>!w?b#kqfe>$kwws9,,ttt-klqw`vw#j`lm!#kqfe>!?,gju=\x0E\t?gju#`obpp>!?p`qjsw#pq`>!kwws9,,!#qfo>!pwzofpkffw!#w?,gju=\t?p`qjsw#wzsf>,b=#?b#kqfe>!kwws9,,#booltWqbmpsbqfm`z>![.VB.@lnsbwjaof!#`lmqfobwjlmpkjs#afwtffm\t?,p`qjsw=\x0E\t?p`qjsw#?,b=?,oj=?,vo=?,gju=bppl`jbwfg#tjwk#wkf#sqldqbnnjmd#obmdvbdf?,b=?b#kqfe>!kwws9,,?,b=?,oj=?oj#`obpp>!elqn#b`wjlm>!kwws9,,?gju#pwzof>!gjpsobz9wzsf>!wf{w!#mbnf>!r!?wbaof#tjgwk>!233&!#ab`hdqlvmg.slpjwjlm9!#alqgfq>!3!#tjgwk>!qfo>!pklqw`vw#j`lm!#k5=?vo=?oj=?b#kqfe>!##?nfwb#kwws.frvju>!`pp!#nfgjb>!p`qffm!#qfpslmpjaof#elq#wkf#!#wzsf>!bssoj`bwjlm,!#pwzof>!ab`hdqlvmg.kwno8#`kbqpfw>vwe.;!#booltwqbmpsbqfm`z>!pwzofpkffw!#wzsf>!wf\x0E\t?nfwb#kwws.frvju>!=?,psbm=?psbm#`obpp>!3!#`foopsb`jmd>!3!=8\t?,p`qjsw=\t?p`qjsw#plnfwjnfp#`boofg#wkfglfp#mlw#mf`fppbqjozElq#nlqf#jmelqnbwjlmbw#wkf#afdjmmjmd#le#?\"GL@WZSF#kwno=?kwnosbqwj`vobqoz#jm#wkf#wzsf>!kjggfm!#mbnf>!ibubp`qjsw9uljg+3*8!feef`wjufmfpp#le#wkf#bvwl`lnsofwf>!lee!#dfmfqbooz#`lmpjgfqfg=?jmsvw#wzsf>!wf{w!#!=?,p`qjsw=\x0E\t?p`qjswwkqlvdklvw#wkf#tlqog`lnnlm#njp`lm`fswjlmbppl`jbwjlm#tjwk#wkf?,gju=\t?,gju=\t?gju#`gvqjmd#kjp#ojefwjnf/`lqqfpslmgjmd#wl#wkfwzsf>!jnbdf,{.j`lm!#bm#jm`qfbpjmd#mvnafqgjsolnbwj`#qfobwjlmpbqf#lewfm#`lmpjgfqfgnfwb#`kbqpfw>!vwe.;!#?jmsvw#wzsf>!wf{w!#f{bnsofp#jm`ovgf#wkf!=?jnd#pq`>!kwws9,,jsbqwj`jsbwjlm#jm#wkfwkf#fpwbaojpknfmw#le\t?,gju=\t?gju#`obpp>!%bns8maps8%bns8maps8wl#gfwfqnjmf#tkfwkfqrvjwf#gjeefqfmw#eqlnnbqhfg#wkf#afdjmmjmdgjpwbm`f#afwtffm#wkf`lmwqjavwjlmp#wl#wkf`lmeoj`w#afwtffm#wkftjgfoz#`lmpjgfqfg#wltbp#lmf#le#wkf#ejqpwtjwk#ubqzjmd#gfdqffpkbuf#psf`vobwfg#wkbw+gl`vnfmw-dfwFofnfmwsbqwj`jsbwjmd#jm#wkflqjdjmbooz#gfufolsfgfwb#`kbqpfw>!vwe.;!=#wzsf>!wf{w,`pp!#,=\tjmwfq`kbmdfbaoz#tjwknlqf#`olpfoz#qfobwfgpl`jbo#bmg#slojwj`bowkbw#tlvog#lwkfqtjpfsfqsfmgj`vobq#wl#wkfpwzof#wzsf>!wf{w,`ppwzsf>!pvanjw!#mbnf>!ebnjojfp#qfpjgjmd#jmgfufolsjmd#`lvmwqjfp`lnsvwfq#sqldqbnnjmdf`lmlnj`#gfufolsnfmwgfwfqnjmbwjlm#le#wkfelq#nlqf#jmelqnbwjlmlm#pfufqbo#l``bpjlmpslqwvdv/Fp#+Fvqlsfv*<O<V=l<\\={<Q=m=`<V<\\=o<V=l<\\={<Q=m=`<V<\\<L<R=m=m<T<U=m<V<R<U<P<\\=n<Y=l<T<\\<W<R<^<T<Q=h<R=l<P<\\=j<T<T=o<S=l<\\<^<W<Y<Q<T=c<Q<Y<R<]=i<R<X<T<P<R<T<Q=h<R=l<P<\\=j<T=c<t<Q=h<R=l<P<\\=j<T=c<L<Y=m<S=o<]<W<T<V<T<V<R<W<T=k<Y=m=n<^<R<T<Q=h<R=l<P<\\=j<T=b=n<Y=l=l<T=n<R=l<T<T<X<R=m=n<\\=n<R=k<Q<R4K5h5i4F5d4K4@4C5d5j4K5h4K4X4F4]4K5o4K4F4K5h4K5n4F4]4K4A4K4Fkwno8#`kbqpfw>VWE.;!#pfwWjnflvw+evm`wjlm+*gjpsobz9jmojmf.aol`h8?jmsvw#wzsf>!pvanjw!#wzsf#>#$wf{w,ibubp`qj?jnd#pq`>!kwws9,,ttt-!#!kwws9,,ttt-t0-lqd,pklqw`vw#j`lm!#kqfe>!!#bvwl`lnsofwf>!lee!#?,b=?,gju=?gju#`obpp>?,b=?,oj=\t?oj#`obpp>!`pp!#wzsf>!wf{w,`pp!#?elqn#b`wjlm>!kwws9,,{w,`pp!#kqfe>!kwws9,,ojmh#qfo>!bowfqmbwf!#\x0E\t?p`qjsw#wzsf>!wf{w,#lm`oj`h>!ibubp`qjsw9+mft#Gbwf*-dfwWjnf+*~kfjdkw>!2!#tjgwk>!2!#Sflsof$p#Qfsvaoj`#le##?b#kqfe>!kwws9,,ttt-wf{w.gf`lqbwjlm9vmgfqwkf#afdjmmjmd#le#wkf#?,gju=\t?,gju=\t?,gju=\tfpwbaojpknfmw#le#wkf#?,gju=?,gju=?,gju=?,g ujftslqwxnjm.kfjdkw9\t?p`qjsw#pq`>!kwws9,,lswjlm=?lswjlm#ubovf>lewfm#qfefqqfg#wl#bp#,lswjlm=\t?lswjlm#ubov?\"GL@WZSF#kwno=\t?\"..XJmwfqmbwjlmbo#Bjqslqw=\t?b#kqfe>!kwws9,,ttt?,b=?b#kqfe>!kwws9,,t\fTL\fT^\fTE\fT^\fUh\fT{\fTN\roI\ro|\roL\ro{\roO\rov\rot\nAO\x05Gx\bTA\nzk#+\x0BUm\x05Gx*\fHD\fHS\fH\\\fIa\fHJ\fIk\fHZ\fHM\fHR\fHe\fHD\fH^\fIg\fHM\fHy\fIa\fH[\fIk\fHH\fIa\fH\\\fHp\fHR\fHD\fHy\fHR\fH\\\fIl\fHT\fHn\fH@\fHn\fHK\fHS\fHH\fHT\fIa\fHI\fHR\fHF\fHD\fHR\fHT\fIa\fHY\fIl\fHy\fHR\fH\\\fHT\fHn\fHT\fIa\fHy\fH\\\fHO\fHT\fHR\fHB\fH{\fIa\fH\\\fIl\fHv\fHS\fHs\fIa\fHL\fIg\fHn\fHY\fHS\fHp\fIa\fHr\fHR\fHD\fHi\fHB\fIk\fH\\\fHS\fHy\fHR\fHY\fHS\fHA\fHS\fHD\fIa\fHD\fH{\fHR\fHM\fHS\fHC\fHR\fHm\fHy\fIa\fHC\fIg\fHn\fHy\fHS\fHT\fIm\fH\\\fHy\fIa\fH[\fHR\fHF\fHU\fIm\fHm\fHv\fHH\fIl\fHF\fIa\fH\\\fH@\fHn\fHK\fHD\fHs\fHS\fHF\fIa\fHF\fHO\fIl\fHy\fIa\fH\\\fHS\fHy\fIk\fHs\fHF\fIa\fH\\\fHR\fH\\\fHn\fHA\fHF\fIa\fH\\\fHR\fHF\fIa\fHH\fHB\fHR\fH^\fHS\fHy\fIg\fHn\fH\\\fHG\fHP\fIa\fHH\fHR\fH\\\fHD\fHS\fH\\\fIa\fHB\fHR\fHO\fH^\fHS\fHB\fHS\fHs\fIk\fHMgfp`qjswjlm!#`lmwfmw>!gl`vnfmw-ol`bwjlm-sqlw-dfwFofnfmwpAzWbdMbnf+?\"GL@WZSF#kwno=\t?kwno#?nfwb#`kbqpfw>!vwe.;!=9vqo!#`lmwfmw>!kwws9,,-`pp!#qfo>!pwzofpkffw!pwzof#wzsf>!wf{w,`pp!=wzsf>!wf{w,`pp!#kqfe>!t0-lqd,2:::,{kwno!#{nowzsf>!wf{w,ibubp`qjsw!#nfwklg>!dfw!#b`wjlm>!ojmh#qfo>!pwzofpkffw!##>#gl`vnfmw-dfwFofnfmwwzsf>!jnbdf,{.j`lm!#,=`foosbggjmd>!3!#`foops-`pp!#wzsf>!wf{w,`pp!#?,b=?,oj=?oj=?b#kqfe>!!#tjgwk>!2!#kfjdkw>!2!!=?b#kqfe>!kwws9,,ttt-pwzof>!gjpsobz9mlmf8!=bowfqmbwf!#wzsf>!bssoj.,,T0@,,GWG#[KWNO#2-3#foopsb`jmd>!3!#`foosbg#wzsf>!kjggfm!#ubovf>!,b=%maps8?psbm#qlof>!p\t?jmsvw#wzsf>!kjggfm!#obmdvbdf>!IbubP`qjsw!##gl`vnfmw-dfwFofnfmwpAd>!3!#`foopsb`jmd>!3!#zsf>!wf{w,`pp!#nfgjb>!wzsf>$wf{w,ibubp`qjsw$tjwk#wkf#f{`fswjlm#le#zsf>!wf{w,`pp!#qfo>!pw#kfjdkw>!2!#tjgwk>!2!#>$(fm`lgfVQJ@lnslmfmw+?ojmh#qfo>!bowfqmbwf!#\talgz/#wq/#jmsvw/#wf{wnfwb#mbnf>!qlalwp!#`lmnfwklg>!slpw!#b`wjlm>!=\t?b#kqfe>!kwws9,,ttt-`pp!#qfo>!pwzofpkffw!#?,gju=?,gju=?gju#`obppobmdvbdf>!ibubp`qjsw!=bqjb.kjggfm>!wqvf!=.[?qjsw!#wzsf>!wf{w,ibubpo>38~*+*8\t+evm`wjlm+*xab`hdqlvmg.jnbdf9#vqo+,b=?,oj=?oj=?b#kqfe>!k\n\n?oj=?b#kqfe>!kwws9,,bwlq!#bqjb.kjggfm>!wqv=#?b#kqfe>!kwws9,,ttt-obmdvbdf>!ibubp`qjsw!#,lswjlm=\t?lswjlm#ubovf,gju=?,gju=?gju#`obpp>qbwlq!#bqjb.kjggfm>!wqf>+mft#Gbwf*-dfwWjnf+*slqwvdv/Fp#+gl#Aqbpjo*<R=l<_<\\<Q<T<[<\\=j<T<T<^<R<[<P<R<Z<Q<R=m=n=`<R<]=l<\\<[<R<^<\\<Q<T=c=l<Y<_<T=m=n=l<\\=j<T<T<^<R<[<P<R<Z<Q<R=m=n<T<R<]=c<[<\\=n<Y<W=`<Q<\\?\"GL@WZSF#kwno#SVAOJ@#!mw.Wzsf!#`lmwfmw>!wf{w,?nfwb#kwws.frvju>!@lmwfqbmpjwjlmbo,,FM!#!kwws9?kwno#{nomp>!kwws9,,ttt.,,T0@,,GWG#[KWNO#2-3#WGWG,{kwno2.wqbmpjwjlmbo,,ttt-t0-lqd,WQ,{kwno2,sf#>#$wf{w,ibubp`qjsw$8?nfwb#mbnf>!gfp`qjswjlmsbqfmwMlgf-jmpfqwAfelqf?jmsvw#wzsf>!kjggfm!#mbip!#wzsf>!wf{w,ibubp`qj+gl`vnfmw*-qfbgz+evm`wjp`qjsw#wzsf>!wf{w,ibubpjnbdf!#`lmwfmw>!kwws9,,VB.@lnsbwjaof!#`lmwfmw>wno8#`kbqpfw>vwe.;!#,=\tojmh#qfo>!pklqw`vw#j`lm?ojmh#qfo>!pwzofpkffw!#?,p`qjsw=\t?p`qjsw#wzsf>>#gl`vnfmw-`qfbwfFofnfm?b#wbqdfw>!\\aobmh!#kqfe>#gl`vnfmw-dfwFofnfmwpAjmsvw#wzsf>!wf{w!#mbnf>b-wzsf#>#$wf{w,ibubp`qjmsvw#wzsf>!kjggfm!#mbnfkwno8#`kbqpfw>vwe.;!#,=gwg!=\t?kwno#{nomp>!kwws.,,T0@,,GWG#KWNO#7-32#WfmwpAzWbdMbnf+$p`qjsw$*jmsvw#wzsf>!kjggfm!#mbn?p`qjsw#wzsf>!wf{w,ibubp!#pwzof>!gjpsobz9mlmf8!=gl`vnfmw-dfwFofnfmwAzJg+>gl`vnfmw-`qfbwfFofnfmw+$#wzsf>$wf{w,ibubp`qjsw$jmsvw#wzsf>!wf{w!#mbnf>!g-dfwFofnfmwpAzWbdMbnf+pmj`bo!#kqfe>!kwws9,,ttt-@,,GWG#KWNO#7-32#Wqbmpjw?pwzof#wzsf>!wf{w,`pp!=\t\t?pwzof#wzsf>!wf{w,`pp!=jlmbo-gwg!=\t?kwno#{nomp>kwws.frvju>[email protected]>!3!#`foopsb`jmd>!3!kwno8#`kbqpfw>vwe.;!#,=\t#pwzof>!gjpsobz9mlmf8!=??oj=?b#kqfe>!kwws9,,ttt-#wzsf>$wf{w,ibubp`qjsw$=<X<Y=c=n<Y<W=`<Q<R=m=n<T=m<R<R=n<^<Y=n=m=n<^<T<T<S=l<R<T<[<^<R<X=m=n<^<\\<]<Y<[<R<S<\\=m<Q<R=m=n<T\fHF\fIm\fHT\fIa\fHH\fHS\fHy\fHR\fHy\fHR\fHn\fH{\fIa\fH\\\fIk\fHT\fHe\fHD\fIa\fHU\fIg\fHn\fHD\fIk\fHY\fHS\fHK\fHR\fHD\fHT\fHA\fHR\fHG\fHS\fHy\fIa\fHT\fHS\fHn\fH{\fHT\fIm\fH\\\fHy\fIa\fH[\fHS\fHH\fHy\fIe\fHF\fIl\fH\\\fHR\fHk\fHs\fHY\fHS\fHp\fIa\fHr\fHR\fHF\fHD\fHy\fHR\fH\\\fIa\fH\\\fHY\fHR\fHd\fHT\fHy\fIa\fH\\\fHS\fHC\fHH\fHR", "\u06F7%\u018C'T%\x85'W%\xD7%O%g%\xA6&\u0193%\u01E5&>&*&'&^&\x88\u0178\u0C3E&\u01AD&\u0192&)&^&%&'&\x82&P&1&\xB1&3&]&m&u&E&t&C&\xCF&V&V&/&>&6&\u0F76\u177Co&p&@&E&M&P&x&@&F&e&\xCC&7&:&(&D&0&C&)&.&F&-&1&(&L&F&1\u025E*\u03EA\u21F3&\u1372&K&;&)&E&H&P&0&?&9&V&\x81&-&v&a&,&E&)&?&=&'&'&B&\u0D2E&\u0503&\u0316*&*8&%&%&&&%,)&\x9A&>&\x86&7&]&F&2&>&J&6&n&2&%&?&\x8E&2&6&J&g&-&0&,&*&J&*&O&)&6&(&<&B&N&.&P&@&2&.&W&M&%\u053C\x84(,(<&,&\u03DA&\u18C7&-&,(%&(&%&(\u013B0&X&D&\x81&j&'&J&(&.&B&3&Z&R&h&3&E&E&<\xC6-\u0360\u1EF3&%8?&@&,&Z&@&0&J&,&^&x&_&6&C&6&C\u072C\u2A25&f&-&-&-&-&,&J&2&8&z&8&C&Y&8&-&d&\u1E78\xCC-&7&1&F&7&t&W&7&I&.&.&^&=\u0F9C\u19D3&8(>&/&/&\u077B')'\u1065')'%@/&0&%\u043E\u09C0*&*@&C\u053D\u05D4\u0274\u05EB4\u0DD7\u071A\u04D16\u0D84&/\u0178\u0303Z&*%\u0246\u03FF&\u0134&1\xA8\u04B4\u0174", dictionarySizeBits, "AAAAKKLLKKKKKJJIHHIHHGGFF");
10406  setData(dictionaryData, dictionarySizeBits);
10407  function InputStream(data) {
10408    this.data = new Int8Array(0);
10409    this.offset = 0;
10410    this.data = data;
10411  }
10412  function readInput(s, dst, offset, length) {
10413    if (s.input === null) {
10414      return -1;
10415    }
10416    const src = s.input;
10417    const end = Math.min(src.offset + length, src.data.length);
10418    const bytesRead = end - src.offset;
10419    dst.set(src.data.subarray(src.offset, end), offset);
10420    src.offset += bytesRead;
10421    return bytesRead;
10422  }
10423  function closeInput(s) {
10424    s.input = new InputStream(new Int8Array(0));
10425  }
10426  function toUsAsciiBytes(src) {
10427    const n = src.length;
10428    const result = new Int8Array(n);
10429    for (let i = 0; i < n; ++i) {
10430      result[i] = src.charCodeAt(i);
10431    }
10432    return result;
10433  }
10434  function toUtf8Runes(src) {
10435    const n = src.length;
10436    const result = new Int32Array(n);
10437    for (let i = 0; i < n; ++i) {
10438      result[i] = src.charCodeAt(i);
10439    }
10440    return result;
10441  }
10442  function makeError(s, code) {
10443    if (code >= 0) {
10444      return code;
10445    }
10446    if (s.runningState >= 0) {
10447      s.runningState = code;
10448    }
10449    throw new Error("Brotli error code: " + code);
10450  }
10451  let ByteBuffer;
10452  function decode(bytes, options) {
10453    let s = new State();
10454    s.input = new InputStream(bytes);
10455    initState(s);
10456    if (options) {
10457      let customDictionary = options["customDictionary"];
10458      if (customDictionary) attachDictionaryChunk(s, customDictionary);
10459    }
10460    let totalOutput = 0;
10461    let chunks = [];
10462    while (true) {
10463      let chunk = new Int8Array(16384);
10464      chunks.push(chunk);
10465      s.output = chunk;
10466      s.outputOffset = 0;
10467      s.outputLength = 16384;
10468      s.outputUsed = 0;
10469      decompress(s);
10470      totalOutput += s.outputUsed;
10471      if (s.outputUsed < 16384) break;
10472    }
10473    close(s);
10474    closeInput(s);
10475    let result = new Int8Array(totalOutput);
10476    let offset = 0;
10477    for (let i = 0; i < chunks.length; ++i) {
10478      let chunk = chunks[i];
10479      let end = Math.min(totalOutput, offset + 16384);
10480      let len = end - offset;
10481      if (len < 16384) {
10482        result.set(chunk.subarray(0, len), offset);
10483      } else {
10484        result.set(chunk, offset);
10485      }
10486      offset += len;
10487    }
10488    return result;
10489  }
10490  return decode;
10491};
10492let BrotliDecode = makeBrotliDecode();
10493;// ./src/core/brotli_stream.js
10494
10495
10496
10497class BrotliStream extends DecodeStream {
10498  #isAsync = true;
10499  constructor(stream, maybeLength) {
10500    super(maybeLength);
10501    this.stream = stream;
10502    this.dict = stream.dict;
10503  }
10504  readBlock() {
10505    const bytes = this.stream.getBytes();
10506    const decodedData = BrotliDecode(new Int8Array(bytes.buffer, bytes.byteOffset, bytes.length));
10507    this.buffer = new Uint8Array(decodedData.buffer, decodedData.byteOffset, decodedData.length);
10508    this.bufferLength = this.buffer.length;
10509    this.eof = true;
10510  }
10511  async getImageData(length, _decoderOptions) {
10512    const data = await this.asyncGetBytes();
10513    if (!data) {
10514      return this.getBytes(length);
10515    }
10516    if (data.length <= length) {
10517      return data;
10518    }
10519    return data.subarray(0, length);
10520  }
10521  async asyncGetBytes() {
10522    const {
10523      decompressed,
10524      compressed
10525    } = await this.asyncGetBytesFromDecompressionStream("brotli");
10526    if (decompressed) {
10527      return decompressed;
10528    }
10529    this.#isAsync = false;
10530    this.stream = new Stream(compressed, 0, compressed.length, this.stream.dict);
10531    this.reset();
10532    return null;
10533  }
10534  get isAsync() {
10535    return this.#isAsync;
10536  }
10537}
10538
10539;// ./
vendor: 1,159 bytes, lines 10539-10582
10539src/core/ccitt_stream.js
10540
10541
10542
10543
10544class CCITTFaxStream extends DecodeStream {
10545  constructor(str, maybeLength, params) {
10546    super(maybeLength);
10547    this.stream = str;
10548    this.maybeLength = maybeLength;
10549    this.dict = str.dict;
10550    if (!(params instanceof Dict)) {
10551      params = Dict.empty;
10552    }
10553    this.params = {
10554      K: params.get("K") || 0,
10555      EndOfLine: !!params.get("EndOfLine"),
10556      EncodedByteAlign: !!params.get("EncodedByteAlign"),
10557      Columns: params.get("Columns") || 1728,
10558      Rows: params.get("Rows") || 0,
10559      EndOfBlock: !!(params.get("EndOfBlock") ?? true),
10560      BlackIs1: !!params.get("BlackIs1")
10561    };
10562  }
10563  get bytes() {
10564    return shadow(this, "bytes", this.stream.getBytes(this.maybeLength));
10565  }
10566  readBlock() {
10567    unreachable("CCITTFaxStream.readBlock");
10568  }
10569  get isImageStream() {
10570    return true;
10571  }
10572  get isAsyncDecoder() {
10573    return true;
10574  }
10575  async decodeImage(bytes, length, _decoderOptions) {
10576    if (this.eof) {
10577      return this.buffer;
10578    }
10579    if (!bytes) {
10580      bytes = this.stream.isAsync ? (await this.stream.asyncGetBytes()) || this.bytes : this.bytes;
10581    }
10582    this.buffer = await JBig2CCITTFaxImag
vendor: 14,067 bytes, lines 10582-10886
10582e.decode(bytes, this.dict.get("W", "Width"), this.dict.get("H", "Height"), null, this.params);
10583    this.bufferLength = this.buffer.length;
10584    this.eof = true;
10585    return this.buffer;
10586  }
10587}
10588
10589;// ./src/core/flate_stream.js
10590
10591
10592
10593const codeLenCodeMap = new Int32Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
10594const lengthDecode = new Int32Array([0x00003, 0x00004, 0x00005, 0x00006, 0x00007, 0x00008, 0x00009, 0x0000a, 0x1000b, 0x1000d, 0x1000f, 0x10011, 0x20013, 0x20017, 0x2001b, 0x2001f, 0x30023, 0x3002b, 0x30033, 0x3003b, 0x40043, 0x40053, 0x40063, 0x40073, 0x50083, 0x500a3, 0x500c3, 0x500e3, 0x00102, 0x00102, 0x00102]);
10595const distDecode = new Int32Array([0x00001, 0x00002, 0x00003, 0x00004, 0x10005, 0x10007, 0x20009, 0x2000d, 0x30011, 0x30019, 0x40021, 0x40031, 0x50041, 0x50061, 0x60081, 0x600c1, 0x70101, 0x70181, 0x80201, 0x80301, 0x90401, 0x90601, 0xa0801, 0xa0c01, 0xb1001, 0xb1801, 0xc2001, 0xc3001, 0xd4001, 0xd6001]);
10596const fixedLitCodeTab = [new Int32Array([0x70100, 0x80050, 0x80010, 0x80118, 0x70110, 0x80070, 0x80030, 0x900c0, 0x70108, 0x80060, 0x80020, 0x900a0, 0x80000, 0x80080, 0x80040, 0x900e0, 0x70104, 0x80058, 0x80018, 0x90090, 0x70114, 0x80078, 0x80038, 0x900d0, 0x7010c, 0x80068, 0x80028, 0x900b0, 0x80008, 0x80088, 0x80048, 0x900f0, 0x70102, 0x80054, 0x80014, 0x8011c, 0x70112, 0x80074, 0x80034, 0x900c8, 0x7010a, 0x80064, 0x80024, 0x900a8, 0x80004, 0x80084, 0x80044, 0x900e8, 0x70106, 0x8005c, 0x8001c, 0x90098, 0x70116, 0x8007c, 0x8003c, 0x900d8, 0x7010e, 0x8006c, 0x8002c, 0x900b8, 0x8000c, 0x8008c, 0x8004c, 0x900f8, 0x70101, 0x80052, 0x80012, 0x8011a, 0x70111, 0x80072, 0x80032, 0x900c4, 0x70109, 0x80062, 0x80022, 0x900a4, 0x80002, 0x80082, 0x80042, 0x900e4, 0x70105, 0x8005a, 0x8001a, 0x90094, 0x70115, 0x8007a, 0x8003a, 0x900d4, 0x7010d, 0x8006a, 0x8002a, 0x900b4, 0x8000a, 0x8008a, 0x8004a, 0x900f4, 0x70103, 0x80056, 0x80016, 0x8011e, 0x70113, 0x80076, 0x80036, 0x900cc, 0x7010b, 0x80066, 0x80026, 0x900ac, 0x80006, 0x80086, 0x80046, 0x900ec, 0x70107, 0x8005e, 0x8001e, 0x9009c, 0x70117, 0x8007e, 0x8003e, 0x900dc, 0x7010f, 0x8006e, 0x8002e, 0x900bc, 0x8000e, 0x8008e, 0x8004e, 0x900fc, 0x70100, 0x80051, 0x80011, 0x80119, 0x70110, 0x80071, 0x80031, 0x900c2, 0x70108, 0x80061, 0x80021, 0x900a2, 0x80001, 0x80081, 0x80041, 0x900e2, 0x70104, 0x80059, 0x80019, 0x90092, 0x70114, 0x80079, 0x80039, 0x900d2, 0x7010c, 0x80069, 0x80029, 0x900b2, 0x80009, 0x80089, 0x80049, 0x900f2, 0x70102, 0x80055, 0x80015, 0x8011d, 0x70112, 0x80075, 0x80035, 0x900ca, 0x7010a, 0x80065, 0x80025, 0x900aa, 0x80005, 0x80085, 0x80045, 0x900ea, 0x70106, 0x8005d, 0x8001d, 0x9009a, 0x70116, 0x8007d, 0x8003d, 0x900da, 0x7010e, 0x8006d, 0x8002d, 0x900ba, 0x8000d, 0x8008d, 0x8004d, 0x900fa, 0x70101, 0x80053, 0x80013, 0x8011b, 0x70111, 0x80073, 0x80033, 0x900c6, 0x70109, 0x80063, 0x80023, 0x900a6, 0x80003, 0x80083, 0x80043, 0x900e6, 0x70105, 0x8005b, 0x8001b, 0x90096, 0x70115, 0x8007b, 0x8003b, 0x900d6, 0x7010d, 0x8006b, 0x8002b, 0x900b6, 0x8000b, 0x8008b, 0x8004b, 0x900f6, 0x70103, 0x80057, 0x80017, 0x8011f, 0x70113, 0x80077, 0x80037, 0x900ce, 0x7010b, 0x80067, 0x80027, 0x900ae, 0x80007, 0x80087, 0x80047, 0x900ee, 0x70107, 0x8005f, 0x8001f, 0x9009e, 0x70117, 0x8007f, 0x8003f, 0x900de, 0x7010f, 0x8006f, 0x8002f, 0x900be, 0x8000f, 0x8008f, 0x8004f, 0x900fe, 0x70100, 0x80050, 0x80010, 0x80118, 0x70110, 0x80070, 0x80030, 0x900c1, 0x70108, 0x80060, 0x80020, 0x900a1, 0x80000, 0x80080, 0x80040, 0x900e1, 0x70104, 0x80058, 0x80018, 0x90091, 0x70114, 0x80078, 0x80038, 0x900d1, 0x7010c, 0x80068, 0x80028, 0x900b1, 0x80008, 0x80088, 0x80048, 0x900f1, 0x70102, 0x80054, 0x80014, 0x8011c, 0x70112, 0x80074, 0x80034, 0x900c9, 0x7010a, 0x80064, 0x80024, 0x900a9, 0x80004, 0x80084, 0x80044, 0x900e9, 0x70106, 0x8005c, 0x8001c, 0x90099, 0x70116, 0x8007c, 0x8003c, 0x900d9, 0x7010e, 0x8006c, 0x8002c, 0x900b9, 0x8000c, 0x8008c, 0x8004c, 0x900f9, 0x70101, 0x80052, 0x80012, 0x8011a, 0x70111, 0x80072, 0x80032, 0x900c5, 0x70109, 0x80062, 0x80022, 0x900a5, 0x80002, 0x80082, 0x80042, 0x900e5, 0x70105, 0x8005a, 0x8001a, 0x90095, 0x70115, 0x8007a, 0x8003a, 0x900d5, 0x7010d, 0x8006a, 0x8002a, 0x900b5, 0x8000a, 0x8008a, 0x8004a, 0x900f5, 0x70103, 0x80056, 0x80016, 0x8011e, 0x70113, 0x80076, 0x80036, 0x900cd, 0x7010b, 0x80066, 0x80026, 0x900ad, 0x80006, 0x80086, 0x80046, 0x900ed, 0x70107, 0x8005e, 0x8001e, 0x9009d, 0x70117, 0x8007e, 0x8003e, 0x900dd, 0x7010f, 0x8006e, 0x8002e, 0x900bd, 0x8000e, 0x8008e, 0x8004e, 0x900fd, 0x70100, 0x80051, 0x80011, 0x80119, 0x70110, 0x80071, 0x80031, 0x900c3, 0x70108, 0x80061, 0x80021, 0x900a3, 0x80001, 0x80081, 0x80041, 0x900e3, 0x70104, 0x80059, 0x80019, 0x90093, 0x70114, 0x80079, 0x80039, 0x900d3, 0x7010c, 0x80069, 0x80029, 0x900b3, 0x80009, 0x80089, 0x80049, 0x900f3, 0x70102, 0x80055, 0x80015, 0x8011d, 0x70112, 0x80075, 0x80035, 0x900cb, 0x7010a, 0x80065, 0x80025, 0x900ab, 0x80005, 0x80085, 0x80045, 0x900eb, 0x70106, 0x8005d, 0x8001d, 0x9009b, 0x70116, 0x8007d, 0x8003d, 0x900db, 0x7010e, 0x8006d, 0x8002d, 0x900bb, 0x8000d, 0x8008d, 0x8004d, 0x900fb, 0x70101, 0x80053, 0x80013, 0x8011b, 0x70111, 0x80073, 0x80033, 0x900c7, 0x70109, 0x80063, 0x80023, 0x900a7, 0x80003, 0x80083, 0x80043, 0x900e7, 0x70105, 0x8005b, 0x8001b, 0x90097, 0x70115, 0x8007b, 0x8003b, 0x900d7, 0x7010d, 0x8006b, 0x8002b, 0x900b7, 0x8000b, 0x8008b, 0x8004b, 0x900f7, 0x70103, 0x80057, 0x80017, 0x8011f, 0x70113, 0x80077, 0x80037, 0x900cf, 0x7010b, 0x80067, 0x80027, 0x900af, 0x80007, 0x80087, 0x80047, 0x900ef, 0x70107, 0x8005f, 0x8001f, 0x9009f, 0x70117, 0x8007f, 0x8003f, 0x900df, 0x7010f, 0x8006f, 0x8002f, 0x900bf, 0x8000f, 0x8008f, 0x8004f, 0x900ff]), 9];
10597const fixedDistCodeTab = [new Int32Array([0x50000, 0x50010, 0x50008, 0x50018, 0x50004, 0x50014, 0x5000c, 0x5001c, 0x50002, 0x50012, 0x5000a, 0x5001a, 0x50006, 0x50016, 0x5000e, 0x00000, 0x50001, 0x50011, 0x50009, 0x50019, 0x50005, 0x50015, 0x5000d, 0x5001d, 0x50003, 0x50013, 0x5000b, 0x5001b, 0x50007, 0x50017, 0x5000f, 0x00000]), 5];
10598class FlateStream extends DecodeStream {
10599  #isAsync = true;
10600  constructor(str, maybeLength) {
10601    super(maybeLength);
10602    this.stream = str;
10603    this.dict = str.dict;
10604    const cmf = str.getByte();
10605    const flg = str.getByte();
10606    if (cmf === -1 || flg === -1) {
10607      throw new FormatError(`Invalid header in flate stream: ${cmf}, ${flg}`);
10608    }
10609    if ((cmf & 0x0f) !== 0x08) {
10610      throw new FormatError(`Unknown compression method in flate stream: ${cmf}, ${flg}`);
10611    }
10612    if (((cmf << 8) + flg) % 31 !== 0) {
10613      throw new FormatError(`Bad FCHECK in flate stream: ${cmf}, ${flg}`);
10614    }
10615    if (flg & 0x20) {
10616      throw new FormatError(`FDICT bit set in flate stream: ${cmf}, ${flg}`);
10617    }
10618    this.codeSize = 0;
10619    this.codeBuf = 0;
10620  }
10621  async getImageData(length, _decoderOptions) {
10622    const data = await this.asyncGetBytes();
10623    if (!data) {
10624      return this.getBytes(length);
10625    }
10626    if (data.length <= length) {
10627      return data;
10628    }
10629    return data.subarray(0, length);
10630  }
10631  async asyncGetBytes() {
10632    const {
10633      decompressed,
10634      compressed
10635    } = await this.asyncGetBytesFromDecompressionStream("deflate");
10636    if (decompressed) {
10637      return decompressed;
10638    }
10639    this.#isAsync = false;
10640    this.stream = new Stream(compressed, 2, compressed.length, this.stream.dict);
10641    this.reset();
10642    return null;
10643  }
10644  get isAsync() {
10645    return this.#isAsync;
10646  }
10647  getBits(bits) {
10648    const str = this.stream;
10649    let codeSize = this.codeSize;
10650    let codeBuf = this.codeBuf;
10651    let b;
10652    while (codeSize < bits) {
10653      if ((b = str.getByte()) === -1) {
10654        throw new FormatError("Bad encoding in flate stream");
10655      }
10656      codeBuf |= b << codeSize;
10657      codeSize += 8;
10658    }
10659    b = codeBuf & (1 << bits) - 1;
10660    this.codeBuf = codeBuf >> bits;
10661    this.codeSize = codeSize -= bits;
10662    return b;
10663  }
10664  getCode(table) {
10665    const str = this.stream;
10666    const codes = table[0];
10667    const maxLen = table[1];
10668    let codeSize = this.codeSize;
10669    let codeBuf = this.codeBuf;
10670    let b;
10671    while (codeSize < maxLen) {
10672      if ((b = str.getByte()) === -1) {
10673        break;
10674      }
10675      codeBuf |= b << codeSize;
10676      codeSize += 8;
10677    }
10678    const code = codes[codeBuf & (1 << maxLen) - 1];
10679    const codeLen = code >> 16;
10680    const codeVal = code & 0xffff;
10681    if (codeLen < 1 || codeSize < codeLen) {
10682      throw new FormatError("Bad encoding in flate stream");
10683    }
10684    this.codeBuf = codeBuf >> codeLen;
10685    this.codeSize = codeSize - codeLen;
10686    return codeVal;
10687  }
10688  generateHuffmanTable(lengths) {
10689    const n = lengths.length;
10690    let maxLen = 0;
10691    let i;
10692    for (i = 0; i < n; ++i) {
10693      if (lengths[i] > maxLen) {
10694        maxLen = lengths[i];
10695      }
10696    }
10697    const size = 1 << maxLen;
10698    const codes = new Int32Array(size);
10699    for (let len = 1, code = 0, skip = 2; len <= maxLen; ++len, code <<= 1, skip <<= 1) {
10700      for (let val = 0; val < n; ++val) {
10701        if (lengths[val] === len) {
10702          let code2 = 0;
10703          let t = code;
10704          for (i = 0; i < len; ++i) {
10705            code2 = code2 << 1 | t & 1;
10706            t >>= 1;
10707          }
10708          for (i = code2; i < size; i += skip) {
10709            codes[i] = len << 16 | val;
10710          }
10711          ++code;
10712        }
10713      }
10714    }
10715    return [codes, maxLen];
10716  }
10717  #endsStreamOnError(err) {
10718    info(err);
10719    this.eof = true;
10720  }
10721  readBlock() {
10722    let buffer, hdr, len;
10723    const str = this.stream;
10724    try {
10725      hdr = this.getBits(3);
10726    } catch (ex) {
10727      this.#endsStreamOnError(ex.message);
10728      return;
10729    }
10730    if (hdr & 1) {
10731      this.eof = true;
10732    }
10733    hdr >>= 1;
10734    if (hdr === 0) {
10735      let b;
10736      if ((b = str.getByte()) === -1) {
10737        this.#endsStreamOnError("Bad block header in flate stream");
10738        return;
10739      }
10740      let blockLen = b;
10741      if ((b = str.getByte()) === -1) {
10742        this.#endsStreamOnError("Bad block header in flate stream");
10743        return;
10744      }
10745      blockLen |= b << 8;
10746      if ((b = str.getByte()) === -1) {
10747        this.#endsStreamOnError("Bad block header in flate stream");
10748        return;
10749      }
10750      let check = b;
10751      if ((b = str.getByte()) === -1) {
10752        this.#endsStreamOnError("Bad block header in flate stream");
10753        return;
10754      }
10755      check |= b << 8;
10756      if (check !== (~blockLen & 0xffff) && (blockLen !== 0 || check !== 0)) {
10757        throw new FormatError("Bad uncompressed block length in flate stream");
10758      }
10759      this.codeBuf = 0;
10760      this.codeSize = 0;
10761      const bufferLength = this.bufferLength,
10762        end = bufferLength + blockLen;
10763      buffer = this.ensureBuffer(end);
10764      this.bufferLength = end;
10765      if (blockLen === 0) {
10766        if (str.peekByte() === -1) {
10767          this.eof = true;
10768        }
10769      } else {
10770        const block = str.getBytes(blockLen);
10771        buffer.set(block, bufferLength);
10772        if (block.length < blockLen) {
10773          this.eof = true;
10774        }
10775      }
10776      return;
10777    }
10778    let litCodeTable;
10779    let distCodeTable;
10780    if (hdr === 1) {
10781      litCodeTable = fixedLitCodeTab;
10782      distCodeTable = fixedDistCodeTab;
10783    } else if (hdr === 2) {
10784      const numLitCodes = this.getBits(5) + 257;
10785      const numDistCodes = this.getBits(5) + 1;
10786      const numCodeLenCodes = this.getBits(4) + 4;
10787      const codeLenCodeLengths = new Uint8Array(codeLenCodeMap.length);
10788      let i;
10789      for (i = 0; i < numCodeLenCodes; ++i) {
10790        codeLenCodeLengths[codeLenCodeMap[i]] = this.getBits(3);
10791      }
10792      const codeLenCodeTab = this.generateHuffmanTable(codeLenCodeLengths);
10793      len = 0;
10794      i = 0;
10795      const codes = numLitCodes + numDistCodes;
10796      const codeLengths = new Uint8Array(codes);
10797      let bitsLength, bitsOffset, what;
10798      while (i < codes) {
10799        const code = this.getCode(codeLenCodeTab);
10800        if (code === 16) {
10801          bitsLength = 2;
10802          bitsOffset = 3;
10803          what = len;
10804        } else if (code === 17) {
10805          bitsLength = 3;
10806          bitsOffset = 3;
10807          what = len = 0;
10808        } else if (code === 18) {
10809          bitsLength = 7;
10810          bitsOffset = 11;
10811          what = len = 0;
10812        } else {
10813          codeLengths[i++] = len = code;
10814          continue;
10815        }
10816        let repeatLength = this.getBits(bitsLength) + bitsOffset;
10817        while (repeatLength-- > 0) {
10818          codeLengths[i++] = what;
10819        }
10820      }
10821      litCodeTable = this.generateHuffmanTable(codeLengths.subarray(0, numLitCodes));
10822      distCodeTable = this.generateHuffmanTable(codeLengths.subarray(numLitCodes, codes));
10823    } else {
10824      throw new FormatError("Unknown block type in flate stream");
10825    }
10826    buffer = this.buffer;
10827    let limit = buffer ? buffer.length : 0;
10828    let pos = this.bufferLength;
10829    while (true) {
10830      let code1 = this.getCode(litCodeTable);
10831      if (code1 < 256) {
10832        if (pos + 1 >= limit) {
10833          buffer = this.ensureBuffer(pos + 1);
10834          limit = buffer.length;
10835        }
10836        buffer[pos++] = code1;
10837        continue;
10838      }
10839      if (code1 === 256) {
10840        this.bufferLength = pos;
10841        return;
10842      }
10843      code1 -= 257;
10844      code1 = lengthDecode[code1];
10845      let code2 = code1 >> 16;
10846      if (code2 > 0) {
10847        code2 = this.getBits(code2);
10848      }
10849      len = (code1 & 0xffff) + code2;
10850      code1 = this.getCode(distCodeTable);
10851      code1 = distDecode[code1];
10852      code2 = code1 >> 16;
10853      if (code2 > 0) {
10854        code2 = this.getBits(code2);
10855      }
10856      const dist = (code1 & 0xffff) + code2;
10857      if (pos + len >= limit) {
10858        buffer = this.ensureBuffer(pos + len);
10859        limit = buffer.length;
10860      }
10861      for (let k = 0; k < len; ++k, ++pos) {
10862        buffer[pos] = buffer[pos - dist];
10863      }
10864    }
10865  }
10866}
10867
10868;// ./src/core/jbig2_stream.js
10869
10870
10871
10872
10873
10874class Jbig2Stream extends DecodeStream {
10875  constructor(stream, maybeLength, params) {
10876    super(maybeLength);
10877    this.stream = stream;
10878    this.dict = stream.dict;
10879    this.maybeLength = maybeLength;
10880    this.params = params;
10881  }
10882  get bytes() {
10883    return shadow(this, "bytes", this.stream.getBytes(this.maybeLength));
10884  }
10885  ensureBuffer(requested) {}
10886  
vendor: 3,182 bytes, lines 10886-11007
10886readBlock() {
10887    unreachable("Jbig2Stream.readBlock");
10888  }
10889  get isAsyncDecoder() {
10890    return true;
10891  }
10892  get isImageStream() {
10893    return true;
10894  }
10895  async decodeImage(bytes, length, _decoderOptions) {
10896    if (this.eof) {
10897      return this.buffer;
10898    }
10899    bytes ||= this.bytes;
10900    let globals = null;
10901    if (this.params instanceof Dict) {
10902      const globalsStream = this.params.get("JBIG2Globals");
10903      if (globalsStream instanceof BaseStream) {
10904        globals = globalsStream.getBytes();
10905      }
10906    }
10907    this.buffer = await JBig2CCITTFaxImage.decode(bytes, this.dict.get("Width"), this.dict.get("Height"), globals);
10908    this.bufferLength = this.buffer.length;
10909    this.eof = true;
10910    return this.buffer;
10911  }
10912  get canAsyncDecodeImageFromBuffer() {
10913    return this.stream.isAsync;
10914  }
10915}
10916
10917;// ./src/core/jpx_stream.js
10918
10919
10920
10921class JpxStream extends DecodeStream {
10922  constructor(stream, maybeLength, params) {
10923    super(maybeLength);
10924    this.stream = stream;
10925    this.dict = stream.dict;
10926    this.maybeLength = maybeLength;
10927    this.params = params;
10928  }
10929  get bytes() {
10930    return shadow(this, "bytes", this.stream.getBytes(this.maybeLength));
10931  }
10932  ensureBuffer(requested) {}
10933  readBlock(decoderOptions) {
10934    unreachable("JpxStream.readBlock");
10935  }
10936  get isAsyncDecoder() {
10937    return true;
10938  }
10939  async decodeImage(bytes, _length, decoderOptions) {
10940    if (this.eof) {
10941      return this.buffer;
10942    }
10943    bytes ||= this.bytes;
10944    this.buffer = await JpxImage.decode(bytes, decoderOptions);
10945    this.bufferLength = this.buffer.length;
10946    this.eof = true;
10947    return this.buffer;
10948  }
10949  get canAsyncDecodeImageFromBuffer() {
10950    return this.stream.isAsync;
10951  }
10952  get isImageStream() {
10953    return true;
10954  }
10955}
10956
10957;// ./src/core/lzw_stream.js
10958
10959class LZWStream extends DecodeStream {
10960  constructor(str, maybeLength, earlyChange) {
10961    super(maybeLength);
10962    this.stream = str;
10963    this.dict = str.dict;
10964    this.cachedData = 0;
10965    this.bitsCached = 0;
10966    const maxLzwDictionarySize = 4096;
10967    const lzwState = {
10968      earlyChange,
10969      codeLength: 9,
10970      nextCode: 258,
10971      dictionaryValues: new Uint8Array(maxLzwDictionarySize),
10972      dictionaryLengths: new Uint16Array(maxLzwDictionarySize),
10973      dictionaryPrevCodes: new Uint16Array(maxLzwDictionarySize),
10974      currentSequence: new Uint8Array(maxLzwDictionarySize),
10975      currentSequenceLength: 0
10976    };
10977    for (let i = 0; i < 256; ++i) {
10978      lzwState.dictionaryValues[i] = i;
10979      lzwState.dictionaryLengths[i] = 1;
10980    }
10981    this.lzwState = lzwState;
10982  }
10983  readBits(n) {
10984    let bitsCached = this.bitsCached;
10985    let cachedData = this.cachedData;
10986    while (bitsCached < n) {
10987      const c = this.stream.getByte();
10988      if (c === -1) {
10989        this.eof = true;
10990        return null;
10991      }
10992      cachedData = cachedData << 8 | c;
10993      bitsCached += 8;
10994    }
10995    this.bitsCached = bitsCached -= n;
10996    this.cachedData = cachedData;
10997    return cachedData >>> bitsCached & (1 << n) - 1;
10998  }
10999  readBlock() {
11000    const blockSize = 512,
11001      decodedSizeDelta = blockSize;
11002    let estimatedDecodedSize = blockSize * 2;
11003    let i, j, q;
11004    const lzwState = this.lzwState;
11005    if (!lzwState) {
11006      return;
11007    }
vendor: 8,343 bytes, lines 11007-11270
11007
11008    const earlyChange = lzwState.earlyChange;
11009    let nextCode = lzwState.nextCode;
11010    const dictionaryValues = lzwState.dictionaryValues;
11011    const dictionaryLengths = lzwState.dictionaryLengths;
11012    const dictionaryPrevCodes = lzwState.dictionaryPrevCodes;
11013    let codeLength = lzwState.codeLength;
11014    let prevCode = lzwState.prevCode;
11015    const currentSequence = lzwState.currentSequence;
11016    let currentSequenceLength = lzwState.currentSequenceLength;
11017    let decodedLength = 0;
11018    let currentBufferLength = this.bufferLength;
11019    let buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
11020    for (i = 0; i < blockSize; i++) {
11021      const code = this.readBits(codeLength);
11022      const hasPrev = currentSequenceLength > 0;
11023      if (code < 256) {
11024        currentSequence[0] = code;
11025        currentSequenceLength = 1;
11026      } else if (code >= 258) {
11027        if (code < nextCode) {
11028          currentSequenceLength = dictionaryLengths[code];
11029          for (j = currentSequenceLength - 1, q = code; j >= 0; j--) {
11030            currentSequence[j] = dictionaryValues[q];
11031            q = dictionaryPrevCodes[q];
11032          }
11033        } else {
11034          currentSequence[currentSequenceLength++] = currentSequence[0];
11035        }
11036      } else if (code === 256) {
11037        codeLength = 9;
11038        nextCode = 258;
11039        currentSequenceLength = 0;
11040        continue;
11041      } else {
11042        this.eof = true;
11043        delete this.lzwState;
11044        break;
11045      }
11046      if (hasPrev) {
11047        dictionaryPrevCodes[nextCode] = prevCode;
11048        dictionaryLengths[nextCode] = dictionaryLengths[prevCode] + 1;
11049        dictionaryValues[nextCode] = currentSequence[0];
11050        nextCode++;
11051        codeLength = nextCode + earlyChange & nextCode + earlyChange - 1 ? codeLength : Math.min(Math.log(nextCode + earlyChange) / 0.6931471805599453 + 1, 12) | 0;
11052      }
11053      prevCode = code;
11054      decodedLength += currentSequenceLength;
11055      if (estimatedDecodedSize < decodedLength) {
11056        do {
11057          estimatedDecodedSize += decodedSizeDelta;
11058        } while (estimatedDecodedSize < decodedLength);
11059        buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
11060      }
11061      for (j = 0; j < currentSequenceLength; j++) {
11062        buffer[currentBufferLength++] = currentSequence[j];
11063      }
11064    }
11065    lzwState.nextCode = nextCode;
11066    lzwState.codeLength = codeLength;
11067    lzwState.prevCode = prevCode;
11068    lzwState.currentSequenceLength = currentSequenceLength;
11069    this.bufferLength = currentBufferLength;
11070  }
11071}
11072
11073;// ./src/core/predictor_stream.js
11074
11075
11076
11077class PredictorStream extends DecodeStream {
11078  constructor(str, maybeLength, params) {
11079    super(maybeLength);
11080    if (!(params instanceof Dict)) {
11081      return str;
11082    }
11083    const predictor = this.predictor = params.get("Predictor") || 1;
11084    if (predictor <= 1) {
11085      return str;
11086    }
11087    if (predictor !== 2 && (predictor < 10 || predictor > 15)) {
11088      throw new FormatError(`Unsupported predictor: ${predictor}`);
11089    }
11090    this.readBlock = predictor === 2 ? this.readBlockTiff : this.readBlockPng;
11091    this.stream = str;
11092    this.dict = str.dict;
11093    const colors = this.colors = params.get("Colors") || 1;
11094    const bits = this.bits = params.get("BPC", "BitsPerComponent") || 8;
11095    const columns = this.columns = params.get("Columns") || 1;
11096    this.pixBytes = colors * bits + 7 >> 3;
11097    this.rowBytes = columns * colors * bits + 7 >> 3;
11098    return this;
11099  }
11100  readBlockTiff() {
11101    const rowBytes = this.rowBytes;
11102    const bufferLength = this.bufferLength;
11103    const buffer = this.ensureBuffer(bufferLength + rowBytes);
11104    const bits = this.bits;
11105    const colors = this.colors;
11106    const rawBytes = this.stream.getBytes(rowBytes);
11107    this.eof = !rawBytes.length;
11108    if (this.eof) {
11109      return;
11110    }
11111    let inbuf = 0,
11112      outbuf = 0;
11113    let inbits = 0,
11114      outbits = 0;
11115    let pos = bufferLength;
11116    let i;
11117    if (bits === 1 && colors === 1) {
11118      for (i = 0; i < rowBytes; ++i) {
11119        let c = rawBytes[i] ^ inbuf;
11120        c ^= c >> 1;
11121        c ^= c >> 2;
11122        c ^= c >> 4;
11123        inbuf = (c & 1) << 7;
11124        buffer[pos++] = c;
11125      }
11126    } else if (bits === 8) {
11127      for (i = 0; i < colors; ++i) {
11128        buffer[pos++] = rawBytes[i];
11129      }
11130      for (; i < rowBytes; ++i) {
11131        buffer[pos] = buffer[pos - colors] + rawBytes[i];
11132        pos++;
11133      }
11134    } else if (bits === 16) {
11135      const bytesPerPixel = colors * 2;
11136      for (i = 0; i < bytesPerPixel; ++i) {
11137        buffer[pos++] = rawBytes[i];
11138      }
11139      for (; i < rowBytes; i += 2) {
11140        const sum = ((rawBytes[i] & 0xff) << 8) + (rawBytes[i + 1] & 0xff) + ((buffer[pos - bytesPerPixel] & 0xff) << 8) + (buffer[pos - bytesPerPixel + 1] & 0xff);
11141        buffer[pos++] = sum >> 8 & 0xff;
11142        buffer[pos++] = sum & 0xff;
11143      }
11144    } else {
11145      const compArray = new Uint8Array(colors + 1);
11146      const bitMask = (1 << bits) - 1;
11147      let j = 0,
11148        k = bufferLength;
11149      const columns = this.columns;
11150      for (i = 0; i < columns; ++i) {
11151        for (let kk = 0; kk < colors; ++kk) {
11152          if (inbits < bits) {
11153            inbuf = inbuf << 8 | rawBytes[j++] & 0xff;
11154            inbits += 8;
11155          }
11156          compArray[kk] = compArray[kk] + (inbuf >> inbits - bits) & bitMask;
11157          inbits -= bits;
11158          outbuf = outbuf << bits | compArray[kk];
11159          outbits += bits;
11160          if (outbits >= 8) {
11161            buffer[k++] = outbuf >> outbits - 8 & 0xff;
11162            outbits -= 8;
11163          }
11164        }
11165      }
11166      if (outbits > 0) {
11167        buffer[k++] = (outbuf << 8 - outbits) + (inbuf & (1 << 8 - outbits) - 1);
11168      }
11169    }
11170    this.bufferLength += rowBytes;
11171  }
11172  readBlockPng() {
11173    const rowBytes = this.rowBytes;
11174    const pixBytes = this.pixBytes;
11175    const predictor = this.stream.getByte();
11176    const rawBytes = this.stream.getBytes(rowBytes);
11177    this.eof = !rawBytes.length;
11178    if (this.eof) {
11179      return;
11180    }
11181    const bufferLength = this.bufferLength;
11182    const buffer = this.ensureBuffer(bufferLength + rowBytes);
11183    let prevRow = buffer.subarray(bufferLength - rowBytes, bufferLength);
11184    if (prevRow.length === 0) {
11185      prevRow = new Uint8Array(rowBytes);
11186    }
11187    let i,
11188      j = bufferLength,
11189      up,
11190      c;
11191    switch (predictor) {
11192      case 0:
11193        for (i = 0; i < rowBytes; ++i) {
11194          buffer[j++] = rawBytes[i];
11195        }
11196        break;
11197      case 1:
11198        for (i = 0; i < pixBytes; ++i) {
11199          buffer[j++] = rawBytes[i];
11200        }
11201        for (; i < rowBytes; ++i) {
11202          buffer[j] = buffer[j - pixBytes] + rawBytes[i] & 0xff;
11203          j++;
11204        }
11205        break;
11206      case 2:
11207        for (i = 0; i < rowBytes; ++i) {
11208          buffer[j++] = prevRow[i] + rawBytes[i] & 0xff;
11209        }
11210        break;
11211      case 3:
11212        for (i = 0; i < pixBytes; ++i) {
11213          buffer[j++] = (prevRow[i] >> 1) + rawBytes[i];
11214        }
11215        for (; i < rowBytes; ++i) {
11216          buffer[j] = (prevRow[i] + buffer[j - pixBytes] >> 1) + rawBytes[i] & 0xff;
11217          j++;
11218        }
11219        break;
11220      case 4:
11221        for (i = 0; i < pixBytes; ++i) {
11222          up = prevRow[i];
11223          c = rawBytes[i];
11224          buffer[j++] = up + c;
11225        }
11226        for (; i < rowBytes; ++i) {
11227          up = prevRow[i];
11228          const upLeft = prevRow[i - pixBytes];
11229          const left = buffer[j - pixBytes];
11230          const p = left + up - upLeft;
11231          let pa = p - left;
11232          if (pa < 0) {
11233            pa = -pa;
11234          }
11235          let pb = p - up;
11236          if (pb < 0) {
11237            pb = -pb;
11238          }
11239          let pc = p - upLeft;
11240          if (pc < 0) {
11241            pc = -pc;
11242          }
11243          c = rawBytes[i];
11244          if (pa <= pb && pa <= pc) {
11245            buffer[j++] = left + c;
11246          } else if (pb <= pc) {
11247            buffer[j++] = up + c;
11248          } else {
11249            buffer[j++] = upLeft + c;
11250          }
11251        }
11252        break;
11253      default:
11254        throw new FormatError(`Unsupported predictor: ${predictor}`);
11255    }
11256    this.bufferLength += rowBytes;
11257  }
11258}
11259
11260;// ./src/core/run_length_stream.js
11261
11262class RunLengthStream extends DecodeStream {
11263  constructor(str, maybeLength) {
11264    super(maybeLength);
11265    this.stream = str;
11266    this.dict = str.dict;
11267  }
11268  readBlock() {
11269    const repeatHeader = this.stream.getBytes(2);
11270    if (
vendor: 724 bytes, lines 11270-11295
11270!repeatHeader || repeatHeader.length < 2 || repeatHeader[0] === 128) {
11271      this.eof = true;
11272      return;
11273    }
11274    let buffer;
11275    let bufferLength = this.bufferLength;
11276    let n = repeatHeader[0];
11277    if (n < 128) {
11278      buffer = this.ensureBuffer(bufferLength + n + 1);
11279      buffer[bufferLength++] = repeatHeader[1];
11280      if (n > 0) {
11281        const source = this.stream.getBytes(n);
11282        buffer.set(source, bufferLength);
11283        bufferLength += n;
11284      }
11285    } else {
11286      n = 257 - n;
11287      buffer = this.ensureBuffer(bufferLength + n + 1);
11288      buffer.fill(repeatHeader[1], bufferLength, bufferLength + n);
11289      bufferLength += n;
11290    }
11291    this.bufferLength = bufferLength;
11292  }
11293}
11294
11295;// ./src/core/parser.js
vendor: 17,320 bytes, lines 11295-11902
11295
11296
11297
11298
11299
11300
11301
11302
11303
11304
11305
11306
11307
11308
11309
11310
11311const MAX_LENGTH_TO_CACHE = 1000;
11312function getInlineImageCacheKey(bytes) {
11313  const strBuf = [],
11314    ii = bytes.length;
11315  let i = 0;
11316  while (i < ii - 1) {
11317    strBuf.push(bytes[i++] << 8 | bytes[i++]);
11318  }
11319  if (i < ii) {
11320    strBuf.push(bytes[i]);
11321  }
11322  return ii + "_" + String.fromCharCode.apply(null, strBuf);
11323}
11324class Parser {
11325  constructor({
11326    lexer,
11327    xref,
11328    allowStreams = false,
11329    recoveryMode = false
11330  }) {
11331    this.lexer = lexer;
11332    this.xref = xref;
11333    this.allowStreams = allowStreams;
11334    this.recoveryMode = recoveryMode;
11335    this.imageCache = Object.create(null);
11336    this._imageId = 0;
11337    this.refill();
11338  }
11339  refill() {
11340    this.buf1 = this.lexer.getObj();
11341    this.buf2 = this.lexer.getObj();
11342  }
11343  shift() {
11344    if (this.buf2 instanceof Cmd && this.buf2.cmd === "ID") {
11345      this.buf1 = this.buf2;
11346      this.buf2 = null;
11347    } else {
11348      this.buf1 = this.buf2;
11349      this.buf2 = this.lexer.getObj();
11350    }
11351  }
11352  tryShift() {
11353    try {
11354      this.shift();
11355      return true;
11356    } catch (e) {
11357      if (e instanceof MissingDataException) {
11358        throw e;
11359      }
11360      return false;
11361    }
11362  }
11363  getObj(cipherTransform = null) {
11364    const buf1 = this.buf1;
11365    this.shift();
11366    if (buf1 instanceof Cmd) {
11367      switch (buf1.cmd) {
11368        case "BI":
11369          return this.makeInlineImage(cipherTransform);
11370        case "[":
11371          const array = [];
11372          while (!isCmd(this.buf1, "]") && this.buf1 !== EOF) {
11373            array.push(this.getObj(cipherTransform));
11374          }
11375          if (this.buf1 === EOF) {
11376            if (this.recoveryMode) {
11377              return array;
11378            }
11379            throw new ParserEOFException("End of file inside array.");
11380          }
11381          this.shift();
11382          return array;
11383        case "<<":
11384          const dict = new Dict(this.xref);
11385          while (!isCmd(this.buf1, ">>") && this.buf1 !== EOF) {
11386            if (!(this.buf1 instanceof Name)) {
11387              info("Malformed dictionary: key must be a name object");
11388              this.shift();
11389              continue;
11390            }
11391            const key = this.buf1.name;
11392            this.shift();
11393            if (this.buf1 === EOF) {
11394              break;
11395            }
11396            dict.set(key, this.getObj(cipherTransform));
11397          }
11398          if (this.buf1 === EOF) {
11399            if (this.recoveryMode) {
11400              return dict;
11401            }
11402            throw new ParserEOFException("End of file inside dictionary.");
11403          }
11404          if (isCmd(this.buf2, "stream")) {
11405            return this.allowStreams ? this.makeStream(dict, cipherTransform) : dict;
11406          }
11407          this.shift();
11408          return dict;
11409        default:
11410          return buf1;
11411      }
11412    }
11413    if (Number.isInteger(buf1)) {
11414      if (Number.isInteger(this.buf1) && isCmd(this.buf2, "R")) {
11415        const ref = Ref.get(buf1, this.buf1);
11416        this.shift();
11417        this.shift();
11418        return ref;
11419      }
11420      return buf1;
11421    }
11422    if (typeof buf1 === "string") {
11423      if (cipherTransform) {
11424        return cipherTransform.decryptString(buf1);
11425      }
11426      return buf1;
11427    }
11428    return buf1;
11429  }
11430  findDefaultInlineStreamEnd(stream) {
11431    const E = 0x45,
11432      I = 0x49,
11433      SPACE = 0x20,
11434      LF = 0xa,
11435      CR = 0xd,
11436      NUL = 0x0;
11437    const {
11438        knownCommands
11439      } = this.lexer,
11440      startPos = stream.pos,
11441      n = 15;
11442    let state = 0,
11443      ch,
11444      maybeEIPos;
11445    while ((ch = stream.getByte()) !== -1) {
11446      if (state === 0) {
11447        state = ch === E ? 1 : 0;
11448      } else if (state === 1) {
11449        state = ch === I ? 2 : 0;
11450      } else {
11451        if (ch === SPACE || ch === LF || ch === CR) {
11452          maybeEIPos = stream.pos;
11453          const followingBytes = stream.peekBytes(n);
11454          const ii = followingBytes.length;
11455          if (ii === 0) {
11456            break;
11457          }
11458          for (let i = 0; i < ii; i++) {
11459            ch = followingBytes[i];
11460            if (ch === NUL && followingBytes[i + 1] !== NUL) {
11461              continue;
11462            }
11463            if (ch !== LF && ch !== CR && (ch < SPACE || ch > 0x7f)) {
11464              state = 0;
11465              break;
11466            }
11467          }
11468          if (state !== 2) {
11469            continue;
11470          }
11471          if (!knownCommands) {
11472            warn("findDefaultInlineStreamEnd - `lexer.knownCommands` is undefined.");
11473            continue;
11474          }
11475          const tmpLexer = new Lexer(new Stream(stream.peekBytes(5 * n)), knownCommands);
11476          tmpLexer._hexStringWarn = () => {};
11477          let numArgs = 0;
11478          while (true) {
11479            const nextObj = tmpLexer.getObj();
11480            if (nextObj === EOF) {
11481              state = 0;
11482              break;
11483            }
11484            if (nextObj instanceof Cmd) {
11485              const knownCommand = knownCommands[nextObj.cmd];
11486              if (!knownCommand) {
11487                state = 0;
11488                break;
11489              } else if (knownCommand.variableArgs ? numArgs <= knownCommand.numArgs : numArgs === knownCommand.numArgs) {
11490                break;
11491              }
11492              numArgs = 0;
11493              continue;
11494            }
11495            numArgs++;
11496          }
11497          if (state === 2) {
11498            break;
11499          }
11500        } else {
11501          state = 0;
11502        }
11503      }
11504    }
11505    if (ch === -1) {
11506      warn("findDefaultInlineStreamEnd: " + "Reached the end of the stream without finding a valid EI marker");
11507      if (maybeEIPos) {
11508        warn('... trying to recover by using the last "EI" occurrence.');
11509        stream.skip(-(stream.pos - maybeEIPos));
11510      }
11511    }
11512    let endOffset = 4;
11513    stream.skip(-endOffset);
11514    ch = stream.peekByte();
11515    stream.skip(endOffset);
11516    if (!isWhiteSpace(ch)) {
11517      endOffset--;
11518    }
11519    return stream.pos - endOffset - startPos;
11520  }
11521  findDCTDecodeInlineStreamEnd(stream) {
11522    const startPos = stream.pos;
11523    let foundEOI = false,
11524      b,
11525      markerLength;
11526    while ((b = stream.getByte()) !== -1) {
11527      if (b !== 0xff) {
11528        continue;
11529      }
11530      switch (stream.getByte()) {
11531        case 0x00:
11532          break;
11533        case 0xff:
11534          stream.skip(-1);
11535          break;
11536        case 0xd9:
11537          foundEOI = true;
11538          break;
11539        case 0xc0:
11540        case 0xc1:
11541        case 0xc2:
11542        case 0xc3:
11543        case 0xc5:
11544        case 0xc6:
11545        case 0xc7:
11546        case 0xc9:
11547        case 0xca:
11548        case 0xcb:
11549        case 0xcd:
11550        case 0xce:
11551        case 0xcf:
11552        case 0xc4:
11553        case 0xcc:
11554        case 0xda:
11555        case 0xdb:
11556        case 0xdc:
11557        case 0xdd:
11558        case 0xde:
11559        case 0xdf:
11560        case 0xe0:
11561        case 0xe1:
11562        case 0xe2:
11563        case 0xe3:
11564        case 0xe4:
11565        case 0xe5:
11566        case 0xe6:
11567        case 0xe7:
11568        case 0xe8:
11569        case 0xe9:
11570        case 0xea:
11571        case 0xeb:
11572        case 0xec:
11573        case 0xed:
11574        case 0xee:
11575        case 0xef:
11576        case 0xfe:
11577          markerLength = stream.getUint16();
11578          if (markerLength > 2) {
11579            stream.skip(markerLength - 2);
11580          } else {
11581            stream.skip(-2);
11582          }
11583          break;
11584      }
11585      if (foundEOI) {
11586        break;
11587      }
11588    }
11589    const length = stream.pos - startPos;
11590    if (b === -1) {
11591      warn("Inline DCTDecode image stream: " + "EOI marker not found, searching for /EI/ instead.");
11592      stream.skip(-length);
11593      return this.findDefaultInlineStreamEnd(stream);
11594    }
11595    this.inlineStreamSkipEI(stream);
11596    return length;
11597  }
11598  findASCII85DecodeInlineStreamEnd(stream) {
11599    const TILDE = 0x7e,
11600      GT = 0x3e;
11601    const startPos = stream.pos;
11602    let ch;
11603    while ((ch = stream.getByte()) !== -1) {
11604      if (ch === TILDE) {
11605        const tildePos = stream.pos;
11606        ch = stream.peekByte();
11607        while (isWhiteSpace(ch)) {
11608          stream.skip();
11609          ch = stream.peekByte();
11610        }
11611        if (ch === GT) {
11612          stream.skip();
11613          break;
11614        }
11615        if (stream.pos > tildePos) {
11616          const maybeEI = stream.peekBytes(2);
11617          if (maybeEI[0] === 0x45 && maybeEI[1] === 0x49) {
11618            break;
11619          }
11620        }
11621      }
11622    }
11623    const length = stream.pos - startPos;
11624    if (ch === -1) {
11625      warn("Inline ASCII85Decode image stream: " + "EOD marker not found, searching for /EI/ instead.");
11626      stream.skip(-length);
11627      return this.findDefaultInlineStreamEnd(stream);
11628    }
11629    this.inlineStreamSkipEI(stream);
11630    return length;
11631  }
11632  findASCIIHexDecodeInlineStreamEnd(stream) {
11633    const GT = 0x3e;
11634    const startPos = stream.pos;
11635    let ch;
11636    while ((ch = stream.getByte()) !== -1) {
11637      if (ch === GT) {
11638        break;
11639      }
11640    }
11641    const length = stream.pos - startPos;
11642    if (ch === -1) {
11643      warn("Inline ASCIIHexDecode image stream: " + "EOD marker not found, searching for /EI/ instead.");
11644      stream.skip(-length);
11645      return this.findDefaultInlineStreamEnd(stream);
11646    }
11647    this.inlineStreamSkipEI(stream);
11648    return length;
11649  }
11650  inlineStreamSkipEI(stream) {
11651    const E = 0x45,
11652      I = 0x49;
11653    let state = 0,
11654      ch;
11655    while ((ch = stream.getByte()) !== -1) {
11656      if (state === 0) {
11657        state = ch === E ? 1 : 0;
11658      } else if (state === 1) {
11659        state = ch === I ? 2 : 0;
11660      } else if (state === 2) {
11661        break;
11662      }
11663    }
11664  }
11665  makeInlineImage(cipherTransform) {
11666    const lexer = this.lexer;
11667    const stream = lexer.stream;
11668    const dictMap = Object.create(null);
11669    let dictLength;
11670    while (!isCmd(this.buf1, "ID") && this.buf1 !== EOF) {
11671      if (!(this.buf1 instanceof Name)) {
11672        throw new FormatError("Dictionary key must be a name object");
11673      }
11674      const key = this.buf1.name;
11675      this.shift();
11676      if (this.buf1 === EOF) {
11677        break;
11678      }
11679      dictMap[key] = this.getObj(cipherTransform);
11680    }
11681    if (lexer.beginInlineImagePos !== -1) {
11682      dictLength = stream.pos - lexer.beginInlineImagePos;
11683    }
11684    const filter = this.xref.fetchIfRef(dictMap.F || dictMap.Filter);
11685    let filterName;
11686    if (filter instanceof Name) {
11687      filterName = filter.name;
11688    } else if (Array.isArray(filter)) {
11689      const filterZero = this.xref.fetchIfRef(filter[0]);
11690      if (filterZero instanceof Name) {
11691        filterName = filterZero.name;
11692      }
11693    }
11694    const startPos = stream.pos;
11695    let length;
11696    switch (filterName) {
11697      case "DCT":
11698      case "DCTDecode":
11699        length = this.findDCTDecodeInlineStreamEnd(stream);
11700        break;
11701      case "A85":
11702      case "ASCII85Decode":
11703        length = this.findASCII85DecodeInlineStreamEnd(stream);
11704        break;
11705      case "AHx":
11706      case "ASCIIHexDecode":
11707        length = this.findASCIIHexDecodeInlineStreamEnd(stream);
11708        break;
11709      default:
11710        length = this.findDefaultInlineStreamEnd(stream);
11711    }
11712    let cacheKey;
11713    if (length < MAX_LENGTH_TO_CACHE && dictLength > 0) {
11714      const initialStreamPos = stream.pos;
11715      stream.pos = lexer.beginInlineImagePos;
11716      cacheKey = getInlineImageCacheKey(stream.getBytes(dictLength + length));
11717      stream.pos = initialStreamPos;
11718      const cacheEntry = this.imageCache[cacheKey];
11719      if (cacheEntry !== undefined) {
11720        this.buf2 = Cmd.get("EI");
11721        this.shift();
11722        cacheEntry.reset();
11723        return cacheEntry;
11724      }
11725    }
11726    const dict = new Dict(this.xref);
11727    for (const key in dictMap) {
11728      dict.set(key, dictMap[key]);
11729    }
11730    let imageStream = stream.makeSubStream(startPos, length, dict);
11731    if (cipherTransform) {
11732      imageStream = cipherTransform.createStream(imageStream, length);
11733    }
11734    imageStream = this.filter(imageStream, dict, length);
11735    imageStream.dict = dict;
11736    if (cacheKey !== undefined) {
11737      imageStream.cacheKey = `inline_img_${++this._imageId}`;
11738      this.imageCache[cacheKey] = imageStream;
11739    }
11740    this.buf2 = Cmd.get("EI");
11741    this.shift();
11742    return imageStream;
11743  }
11744  #findStreamLength(startPos) {
11745    const {
11746      stream
11747    } = this.lexer;
11748    stream.pos = startPos;
11749    const SCAN_BLOCK_LENGTH = 2048;
11750    const signatureLength = "endstream".length;
11751    const END_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64]);
11752    const endLength = END_SIGNATURE.length;
11753    const PARTIAL_SIGNATURE = [new Uint8Array([0x73, 0x74, 0x72, 0x65, 0x61, 0x6d]), new Uint8Array([0x73, 0x74, 0x65, 0x61, 0x6d]), new Uint8Array([0x73, 0x74, 0x72, 0x65, 0x61])];
11754    const normalLength = signatureLength - endLength;
11755    while (stream.pos < stream.end) {
11756      const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
11757      const scanLength = scanBytes.length - signatureLength;
11758      if (scanLength <= 0) {
11759        break;
11760      }
11761      let pos = 0;
11762      while (pos < scanLength) {
11763        let j = 0;
11764        while (j < endLength && scanBytes[pos + j] === END_SIGNATURE[j]) {
11765          j++;
11766        }
11767        if (j >= endLength) {
11768          let found = false;
11769          for (const part of PARTIAL_SIGNATURE) {
11770            const partLen = part.length;
11771            let k = 0;
11772            while (k < partLen && scanBytes[pos + j + k] === part[k]) {
11773              k++;
11774            }
11775            if (k >= normalLength) {
11776              found = true;
11777              break;
11778            }
11779            if (k >= partLen) {
11780              const lastByte = scanBytes[pos + j + k];
11781              if (isWhiteSpace(lastByte)) {
11782                info(`Found "${bytesToString([...END_SIGNATURE, ...part])}" when ` + "searching for endstream command.");
11783                found = true;
11784              }
11785              break;
11786            }
11787          }
11788          if (found) {
11789            stream.pos += pos;
11790            return stream.pos - startPos;
11791          }
11792        }
11793        pos++;
11794      }
11795      stream.pos += scanLength;
11796    }
11797    return -1;
11798  }
11799  makeStream(dict, cipherTransform) {
11800    const lexer = this.lexer;
11801    let stream = lexer.stream;
11802    lexer.skipToNextLine();
11803    const startPos = stream.pos - 1;
11804    let length = dict.get("Length");
11805    if (!Number.isInteger(length)) {
11806      info(`Bad length "${length && length.toString()}" in stream.`);
11807      length = 0;
11808    }
11809    stream.pos = startPos + length;
11810    lexer.nextChar();
11811    if (this.tryShift() && isCmd(this.buf2, "endstream")) {
11812      this.shift();
11813    } else {
11814      length = this.#findStreamLength(startPos);
11815      if (length < 0) {
11816        throw new FormatError("Missing endstream command.");
11817      }
11818      lexer.nextChar();
11819      this.shift();
11820      this.shift();
11821    }
11822    this.shift();
11823    stream = stream.makeSubStream(startPos, length, dict);
11824    if (cipherTransform) {
11825      stream = cipherTransform.createStream(stream, length);
11826    }
11827    stream = this.filter(stream, dict, length);
11828    stream.dict = dict;
11829    return stream;
11830  }
11831  filter(stream, dict, length) {
11832    let filter = dict.get("F", "Filter");
11833    let params = dict.get("DP", "DecodeParms");
11834    if (filter instanceof Name) {
11835      if (Array.isArray(params)) {
11836        warn("/DecodeParms should not be an Array, when /Filter is a Name.");
11837      }
11838      return this.makeFilter(stream, filter.name, length, params);
11839    }
11840    let maybeLength = length;
11841    if (Array.isArray(filter)) {
11842      const filterArray = filter;
11843      const paramsArray = params;
11844      for (let i = 0, ii = filterArray.length; i < ii; ++i) {
11845        filter = this.xref.fetchIfRef(filterArray[i]);
11846        if (!(filter instanceof Name)) {
11847          throw new FormatError(`Bad filter name "${filter}"`);
11848        }
11849        params = null;
11850        if (Array.isArray(paramsArray) && i in paramsArray) {
11851          params = this.xref.fetchIfRef(paramsArray[i]);
11852        }
11853        stream = this.makeFilter(stream, filter.name, maybeLength, params);
11854        maybeLength = null;
11855      }
11856    }
11857    return stream;
11858  }
11859  makeFilter(stream, name, maybeLength, params) {
11860    if (maybeLength === 0) {
11861      warn(`Empty "${name}" stream.`);
11862      return new NullStream();
11863    }
11864    try {
11865      switch (name) {
11866        case "Fl":
11867        case "FlateDecode":
11868          if (params) {
11869            return new PredictorStream(new FlateStream(stream, maybeLength), maybeLength, params);
11870          }
11871          return new FlateStream(stream, maybeLength);
11872        case "LZW":
11873        case "LZWDecode":
11874          let earlyChange = 1;
11875          if (params) {
11876            if (params.has("EarlyChange")) {
11877              earlyChange = params.get("EarlyChange");
11878            }
11879            return new PredictorStream(new LZWStream(stream, maybeLength, earlyChange), maybeLength, params);
11880          }
11881          return new LZWStream(stream, maybeLength, earlyChange);
11882        case "DCT":
11883        case "DCTDecode":
11884          return new JpegStream(stream, maybeLength, params);
11885        case "JPX":
11886        case "JPXDecode":
11887          return new JpxStream(stream, maybeLength, params);
11888        case "A85":
11889        case "ASCII85Decode":
11890          return new Ascii85Stream(stream, maybeLength);
11891        case "AHx":
11892        case "ASCIIHexDecode":
11893          return new AsciiHexStream(stream, maybeLength);
11894        case "CCF":
11895        case "CCITTFaxDecode":
11896          return new CCITTFaxStream(stream, maybeLength, params);
11897        case "RL":
11898        case "RunLengthDecode":
11899          return new RunLengthStream(stream, maybeLength);
11900        case "JBIG2Decode":
11901          return new Jbig2Stream(stream, maybeLength, params);
11902      
11902  case "BrotliDecode":
11903          return new BrotliStream(stream, maybeLength);
vendor: 15,605 bytes, lines 11903-12363
11903
11904      }
11905      warn(`Filter "${name}" is not supported.`);
11906      return stream;
11907    } catch (ex) {
11908      if (ex instanceof MissingDataException) {
11909        throw ex;
11910      }
11911      warn(`Invalid stream: "${ex}"`);
11912      return new NullStream();
11913    }
11914  }
11915}
11916const specialChars = [1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 2, 0, 0, 2, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
11917function toHexDigit(ch) {
11918  if (ch >= 0x30 && ch <= 0x39) {
11919    return ch & 0x0f;
11920  }
11921  if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
11922    return (ch & 0x0f) + 9;
11923  }
11924  return -1;
11925}
11926class Lexer {
11927  constructor(stream, knownCommands = null) {
11928    this.stream = stream;
11929    this.nextChar();
11930    this.strBuf = [];
11931    this.knownCommands = knownCommands;
11932    this._hexStringNumWarn = 0;
11933    this.beginInlineImagePos = -1;
11934  }
11935  nextChar() {
11936    return this.currentChar = this.stream.getByte();
11937  }
11938  peekChar() {
11939    return this.stream.peekByte();
11940  }
11941  getNumber() {
11942    let ch = this.currentChar;
11943    let divideBy = 0;
11944    let sign = 1;
11945    if (ch === 0x2d) {
11946      sign = -1;
11947      ch = this.nextChar();
11948      if (ch === 0x2d) {
11949        ch = this.nextChar();
11950      }
11951    } else if (ch === 0x2b) {
11952      ch = this.nextChar();
11953    }
11954    if (ch === 0x0a || ch === 0x0d) {
11955      do {
11956        ch = this.nextChar();
11957      } while (ch === 0x0a || ch === 0x0d);
11958    }
11959    if (ch === 0x2e) {
11960      divideBy = 10;
11961      ch = this.nextChar();
11962    }
11963    if (ch < 0x30 || ch > 0x39) {
11964      const msg = `Invalid number: ${String.fromCharCode(ch)} (charCode ${ch})`;
11965      if (isWhiteSpace(ch) || ch === 0x28 || ch === 0x3c || ch === -1) {
11966        info(`Lexer.getNumber - "${msg}".`);
11967        return 0;
11968      }
11969      throw new FormatError(msg);
11970    }
11971    let baseValue = ch - 0x30;
11972    while ((ch = this.nextChar()) >= 0) {
11973      if (ch >= 0x30 && ch <= 0x39) {
11974        const currentDigit = ch - 0x30;
11975        if (divideBy !== 0) {
11976          divideBy *= 10;
11977        }
11978        baseValue = baseValue * 10 + currentDigit;
11979      } else if (ch === 0x2e) {
11980        if (divideBy === 0) {
11981          divideBy = 1;
11982        } else {
11983          break;
11984        }
11985      } else if (ch === 0x2d) {
11986        warn("Badly formatted number: minus sign in the middle");
11987      } else {
11988        break;
11989      }
11990    }
11991    if (divideBy !== 0) {
11992      baseValue /= divideBy;
11993    }
11994    return sign * baseValue;
11995  }
11996  getString() {
11997    let numParen = 1;
11998    let done = false;
11999    const strBuf = this.strBuf;
12000    strBuf.length = 0;
12001    let ch = this.nextChar();
12002    while (true) {
12003      let charBuffered = false;
12004      switch (ch | 0) {
12005        case -1:
12006          warn("Unterminated string");
12007          done = true;
12008          break;
12009        case 0x28:
12010          ++numParen;
12011          strBuf.push("(");
12012          break;
12013        case 0x29:
12014          if (--numParen === 0) {
12015            this.nextChar();
12016            done = true;
12017          } else {
12018            strBuf.push(")");
12019          }
12020          break;
12021        case 0x5c:
12022          ch = this.nextChar();
12023          switch (ch) {
12024            case -1:
12025              warn("Unterminated string");
12026              done = true;
12027              break;
12028            case 0x6e:
12029              strBuf.push("\n");
12030              break;
12031            case 0x72:
12032              strBuf.push("\r");
12033              break;
12034            case 0x74:
12035              strBuf.push("\t");
12036              break;
12037            case 0x62:
12038              strBuf.push("\b");
12039              break;
12040            case 0x66:
12041              strBuf.push("\f");
12042              break;
12043            case 0x5c:
12044            case 0x28:
12045            case 0x29:
12046              strBuf.push(String.fromCharCode(ch));
12047              break;
12048            case 0x30:
12049            case 0x31:
12050            case 0x32:
12051            case 0x33:
12052            case 0x34:
12053            case 0x35:
12054            case 0x36:
12055            case 0x37:
12056              let x = ch & 0x0f;
12057              ch = this.nextChar();
12058              charBuffered = true;
12059              if (ch >= 0x30 && ch <= 0x37) {
12060                x = (x << 3) + (ch & 0x0f);
12061                ch = this.nextChar();
12062                if (ch >= 0x30 && ch <= 0x37) {
12063                  charBuffered = false;
12064                  x = (x << 3) + (ch & 0x0f);
12065                }
12066              }
12067              strBuf.push(String.fromCharCode(x));
12068              break;
12069            case 0x0d:
12070              if (this.peekChar() === 0x0a) {
12071                this.nextChar();
12072              }
12073              break;
12074            case 0x0a:
12075              break;
12076            default:
12077              strBuf.push(String.fromCharCode(ch));
12078              break;
12079          }
12080          break;
12081        default:
12082          strBuf.push(String.fromCharCode(ch));
12083          break;
12084      }
12085      if (done) {
12086        break;
12087      }
12088      if (!charBuffered) {
12089        ch = this.nextChar();
12090      }
12091    }
12092    return strBuf.join("");
12093  }
12094  getName() {
12095    let ch, previousCh;
12096    const strBuf = this.strBuf;
12097    strBuf.length = 0;
12098    while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
12099      if (ch === 0x23) {
12100        ch = this.nextChar();
12101        if (specialChars[ch]) {
12102          warn("Lexer_getName: " + "NUMBER SIGN (#) should be followed by a hexadecimal number.");
12103          strBuf.push("#");
12104          break;
12105        }
12106        const x = toHexDigit(ch);
12107        if (x !== -1) {
12108          previousCh = ch;
12109          ch = this.nextChar();
12110          const x2 = toHexDigit(ch);
12111          if (x2 === -1) {
12112            warn(`Lexer_getName: Illegal digit (${String.fromCharCode(ch)}) ` + "in hexadecimal number.");
12113            strBuf.push("#", String.fromCharCode(previousCh));
12114            if (specialChars[ch]) {
12115              break;
12116            }
12117            strBuf.push(String.fromCharCode(ch));
12118            continue;
12119          }
12120          strBuf.push(String.fromCharCode(x << 4 | x2));
12121        } else {
12122          strBuf.push("#", String.fromCharCode(ch));
12123        }
12124      } else {
12125        strBuf.push(String.fromCharCode(ch));
12126      }
12127    }
12128    if (strBuf.length > 127) {
12129      warn(`Name token is longer than allowed by the spec: ${strBuf.length}`);
12130    }
12131    return Name.get(strBuf.join(""));
12132  }
12133  _hexStringWarn(ch) {
12134    const MAX_HEX_STRING_NUM_WARN = 5;
12135    if (this._hexStringNumWarn++ === MAX_HEX_STRING_NUM_WARN) {
12136      warn("getHexString - ignoring additional invalid characters.");
12137      return;
12138    }
12139    if (this._hexStringNumWarn > MAX_HEX_STRING_NUM_WARN) {
12140      return;
12141    }
12142    warn(`getHexString - ignoring invalid character: ${ch}`);
12143  }
12144  getHexString() {
12145    const strBuf = this.strBuf;
12146    strBuf.length = 0;
12147    let ch = this.currentChar;
12148    let firstDigit = -1,
12149      digit = -1;
12150    this._hexStringNumWarn = 0;
12151    while (true) {
12152      if (ch < 0) {
12153        warn("Unterminated hex string");
12154        break;
12155      } else if (ch === 0x3e) {
12156        this.nextChar();
12157        break;
12158      } else if (specialChars[ch] === 1) {
12159        ch = this.nextChar();
12160        continue;
12161      } else {
12162        digit = toHexDigit(ch);
12163        if (digit === -1) {
12164          this._hexStringWarn(ch);
12165        } else if (firstDigit === -1) {
12166          firstDigit = digit;
12167        } else {
12168          strBuf.push(String.fromCharCode(firstDigit << 4 | digit));
12169          firstDigit = -1;
12170        }
12171        ch = this.nextChar();
12172      }
12173    }
12174    if (firstDigit !== -1) {
12175      strBuf.push(String.fromCharCode(firstDigit << 4));
12176    }
12177    return strBuf.join("");
12178  }
12179  getObj() {
12180    let comment = false;
12181    let ch = this.currentChar;
12182    while (true) {
12183      if (ch < 0) {
12184        return EOF;
12185      }
12186      if (comment) {
12187        if (ch === 0x0a || ch === 0x0d) {
12188          comment = false;
12189        }
12190      } else if (ch === 0x25) {
12191        comment = true;
12192      } else if (specialChars[ch] !== 1) {
12193        break;
12194      }
12195      ch = this.nextChar();
12196    }
12197    switch (ch | 0) {
12198      case 0x30:
12199      case 0x31:
12200      case 0x32:
12201      case 0x33:
12202      case 0x34:
12203      case 0x35:
12204      case 0x36:
12205      case 0x37:
12206      case 0x38:
12207      case 0x39:
12208      case 0x2b:
12209      case 0x2d:
12210      case 0x2e:
12211        return this.getNumber();
12212      case 0x28:
12213        return this.getString();
12214      case 0x2f:
12215        return this.getName();
12216      case 0x5b:
12217        this.nextChar();
12218        return Cmd.get("[");
12219      case 0x5d:
12220        this.nextChar();
12221        return Cmd.get("]");
12222      case 0x3c:
12223        ch = this.nextChar();
12224        if (ch === 0x3c) {
12225          this.nextChar();
12226          return Cmd.get("<<");
12227        }
12228        return this.getHexString();
12229      case 0x3e:
12230        ch = this.nextChar();
12231        if (ch === 0x3e) {
12232          this.nextChar();
12233          return Cmd.get(">>");
12234        }
12235        return Cmd.get(">");
12236      case 0x7b:
12237        this.nextChar();
12238        return Cmd.get("{");
12239      case 0x7d:
12240        this.nextChar();
12241        return Cmd.get("}");
12242      case 0x29:
12243        this.nextChar();
12244        throw new FormatError(`Illegal character: ${ch}`);
12245    }
12246    let str = String.fromCharCode(ch);
12247    if (ch < 0x20 || ch > 0x7f) {
12248      const nextCh = this.peekChar();
12249      if (nextCh >= 0x20 && nextCh <= 0x7f) {
12250        this.nextChar();
12251        return Cmd.get(str);
12252      }
12253    }
12254    const knownCommands = this.knownCommands;
12255    let knownCommandFound = knownCommands?.[str] !== undefined;
12256    while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
12257      const possibleCommand = str + String.fromCharCode(ch);
12258      if (knownCommandFound && knownCommands[possibleCommand] === undefined) {
12259        break;
12260      }
12261      if (str.length === 128) {
12262        throw new FormatError(`Command token too long: ${str.length}`);
12263      }
12264      str = possibleCommand;
12265      knownCommandFound = knownCommands?.[str] !== undefined;
12266    }
12267    if (str === "true") {
12268      return true;
12269    }
12270    if (str === "false") {
12271      return false;
12272    }
12273    if (str === "null") {
12274      return null;
12275    }
12276    if (str === "BI") {
12277      this.beginInlineImagePos = this.stream.pos;
12278    }
12279    return Cmd.get(str);
12280  }
12281  skipToNextLine() {
12282    let ch = this.currentChar;
12283    while (ch >= 0) {
12284      if (ch === 0x0d) {
12285        ch = this.nextChar();
12286        if (ch === 0x0a) {
12287          this.nextChar();
12288        }
12289        break;
12290      } else if (ch === 0x0a) {
12291        this.nextChar();
12292        break;
12293      }
12294      ch = this.nextChar();
12295    }
12296  }
12297}
12298class Linearization {
12299  static create(stream) {
12300    function getInt(linDict, name, allowZeroValue = false) {
12301      const obj = linDict.get(name);
12302      if (Number.isInteger(obj) && (allowZeroValue ? obj >= 0 : obj > 0)) {
12303        return obj;
12304      }
12305      throw new Error(`The "${name}" parameter in the linearization ` + "dictionary is invalid.");
12306    }
12307    function getHints(linDict) {
12308      const hints = linDict.get("H");
12309      let hintsLength;
12310      if (Array.isArray(hints) && ((hintsLength = hints.length) === 2 || hintsLength === 4)) {
12311        for (let index = 0; index < hintsLength; index++) {
12312          const hint = hints[index];
12313          if (!(Number.isInteger(hint) && hint > 0)) {
12314            throw new Error(`Hint (${index}) in the linearization dictionary is invalid.`);
12315          }
12316        }
12317        return hints;
12318      }
12319      throw new Error("Hint array in the linearization dictionary is invalid.");
12320    }
12321    const parser = new Parser({
12322      lexer: new Lexer(stream),
12323      xref: null
12324    });
12325    const obj1 = parser.getObj();
12326    const obj2 = parser.getObj();
12327    const obj3 = parser.getObj();
12328    const linDict = parser.getObj();
12329    let obj, length;
12330    if (!(Number.isInteger(obj1) && Number.isInteger(obj2) && isCmd(obj3, "obj") && linDict instanceof Dict && typeof (obj = linDict.get("Linearized")) === "number" && obj > 0)) {
12331      return null;
12332    } else if ((length = getInt(linDict, "L")) !== stream.length) {
12333      throw new Error('The "L" parameter in the linearization dictionary ' + "does not equal the stream length.");
12334    }
12335    return {
12336      length,
12337      hints: getHints(linDict),
12338      objectNumberFirst: getInt(linDict, "O"),
12339      endFirst: getInt(linDict, "E"),
12340      numPages: getInt(linDict, "N"),
12341      mainXRefEntriesOffset: getInt(linDict, "T"),
12342      pageFirst: linDict.has("P") ? getInt(linDict, "P", true) : 0
12343    };
12344  }
12345}
12346
12347;// ./src/core/cmap.js
12348
12349
12350
12351
12352
12353
12354
12355const BUILT_IN_CMAPS = ["Adobe-GB1-UCS2", "Adobe-CNS1-UCS2", "Adobe-Japan1-UCS2", "Adobe-Korea1-UCS2", "78-EUC-H", "78-EUC-V", "78-H", "78-RKSJ-H", "78-RKSJ-V", "78-V", "78ms-RKSJ-H", "78ms-RKSJ-V", "83pv-RKSJ-H", "90ms-RKSJ-H", "90ms-RKSJ-V", "90msp-RKSJ-H", "90msp-RKSJ-V", "90pv-RKSJ-H", "90pv-RKSJ-V", "Add-H", "Add-RKSJ-H", "Add-RKSJ-V", "Add-V", "Adobe-CNS1-0", "Adobe-CNS1-1", "Adobe-CNS1-2", "Adobe-CNS1-3", "Adobe-CNS1-4", "Adobe-CNS1-5", "Adobe-CNS1-6", "Adobe-GB1-0", "Adobe-GB1-1", "Adobe-GB1-2", "Adobe-GB1-3", "Adobe-GB1-4", "Adobe-GB1-5", "Adobe-Japan1-0", "Adobe-Japan1-1", "Adobe-Japan1-2", "Adobe-Japan1-3", "Adobe-Japan1-4", "Adobe-Japan1-5", "Adobe-Japan1-6", "Adobe-Korea1-0", "Adobe-Korea1-1", "Adobe-Korea1-2", "B5-H", "B5-V", "B5pc-H", "B5pc-V", "CNS-EUC-H", "CNS-EUC-V", "CNS1-H", "CNS1-V", "CNS2-H", "CNS2-V", "ETHK-B5-H", "ETHK-B5-V", "ETen-B5-H", "ETen-B5-V", "ETenms-B5-H", "ETenms-B5-V", "EUC-H", "EUC-V", "Ext-H", "Ext-RKSJ-H", "Ext-RKSJ-V", "Ext-V", "GB-EUC-H", "GB-EUC-V", "GB-H", "GB-V", "GBK-EUC-H", "GBK-EUC-V", "GBK2K-H", "GBK2K-V", "GBKp-EUC-H", "GBKp-EUC-V", "GBT-EUC-H", "GBT-EUC-V", "GBT-H", "GBT-V", "GBTpc-EUC-H", "GBTpc-EUC-V", "GBpc-EUC-H", "GBpc-EUC-V", "H", "HKdla-B5-H", "HKdla-B5-V", "HKdlb-B5-H", "HKdlb-B5-V", "HKgccs-B5-H", "HKgccs-B5-V", "HKm314-B5-H", "HKm314-B5-V", "HKm471-B5-H", "HKm471-B5-V", "HKscs-B5-H", "HKscs-B5-V", "Hankaku", "Hiragana", "KSC-EUC-H", "KSC-EUC-V", "KSC-H", "KSC-Johab-H", "KSC-Johab-V", "KSC-V", "KSCms-UHC-H", "KSCms-UHC-HW-H", "KSCms-UHC-HW-V", "KSCms-UHC-V", "KSCpc-EUC-H", "KSCpc-EUC-V", "Katakana", "NWP-H", "NWP-V", "RKSJ-H", "RKSJ-V", "Roman", "UniCNS-UCS2-H", "UniCNS-UCS2-V", "UniCNS-UTF16-H", "UniCNS-UTF16-V", "UniCNS-UTF32-H", "UniCNS-UTF32-V", "UniCNS-UTF8-H", "UniCNS-UTF8-V", "UniGB-UCS2-H", "UniGB-UCS2-V", "UniGB-UTF16-H", "UniGB-UTF16-V", "UniGB-UTF32-H", "UniGB-UTF32-V", "UniGB-UTF8-H", "UniGB-UTF8-V", "UniJIS-UCS2-H", "UniJIS-UCS2-HW-H", "UniJIS-UCS2-HW-V", "UniJIS-UCS2-V", "UniJIS-UTF16-H", "UniJIS-UTF16-V", "UniJIS-UTF32-H", "UniJIS-UTF32-V", "UniJIS-UTF8-H", "UniJIS-UTF8-V", "UniJIS2004-UTF16-H", "UniJIS2004-UTF16-V", "UniJIS2004-UTF32-H", "UniJIS2004-UTF32-V", "UniJIS2004-UTF8-H", "UniJIS2004-UTF8-V", "UniJISPro-UCS2-HW-V", "UniJISPro-UCS2-V", "UniJISPro-UTF8-V", "UniJISX0213-UTF32-H", "UniJISX0213-UTF32-V", "UniJISX02132004-UTF32-H", "UniJISX02132004-UTF32-V", "UniKS-UCS2-H", "UniKS-UCS2-V", "UniKS-UTF16-H", "UniKS-UTF16-V", "UniKS-UTF32-H", "UniKS-UTF32-V", "UniKS-UTF8-H", "UniKS-UTF8-V", "V", "WP-Symbol"];
12356const MAX_MAP_RANGE = 2 ** 24 - 1;
12357class CMap {
12358  constructor(builtInCMap = false) {
12359    this.codespaceRanges = [[], [], [], []];
12360    this.numCodespaceRanges = 0;
12361    this._map = [];
12362    this.name = "";
12363    this.vertical = false;
vendor: 2,526 bytes, lines 12364-12453
12364    this.useCMap = null;
12365    this.builtInCMap = builtInCMap;
12366  }
12367  addCodespaceRange(n, low, high) {
12368    this.codespaceRanges[n - 1].push(low, high);
12369    this.numCodespaceRanges++;
12370  }
12371  mapCidRange(low, high, dstLow) {
12372    if (high - low > MAX_MAP_RANGE) {
12373      throw new Error("mapCidRange - ignoring data above MAX_MAP_RANGE.");
12374    }
12375    while (low <= high) {
12376      this._map[low++] = dstLow++;
12377    }
12378  }
12379  mapBfRange(low, high, dstLow) {
12380    if (high - low > MAX_MAP_RANGE) {
12381      throw new Error("mapBfRange - ignoring data above MAX_MAP_RANGE.");
12382    }
12383    const lastByte = dstLow.length - 1;
12384    while (low <= high) {
12385      this._map[low++] = dstLow;
12386      const nextCharCode = dstLow.charCodeAt(lastByte) + 1;
12387      if (nextCharCode > 0xff) {
12388        dstLow = dstLow.substring(0, lastByte - 1) + String.fromCharCode(dstLow.charCodeAt(lastByte - 1) + 1) + "\x00";
12389        continue;
12390      }
12391      dstLow = dstLow.substring(0, lastByte) + String.fromCharCode(nextCharCode);
12392    }
12393  }
12394  mapBfRangeToArray(low, high, array) {
12395    if (high - low > MAX_MAP_RANGE) {
12396      throw new Error("mapBfRangeToArray - ignoring data above MAX_MAP_RANGE.");
12397    }
12398    const ii = array.length;
12399    let i = 0;
12400    while (low <= high && i < ii) {
12401      this._map[low] = array[i++];
12402      ++low;
12403    }
12404  }
12405  mapOne(src, dst) {
12406    this._map[src] = dst;
12407  }
12408  lookup(code) {
12409    return this._map[code];
12410  }
12411  contains(code) {
12412    return this._map[code] !== undefined;
12413  }
12414  forEach(callback) {
12415    const map = this._map;
12416    const length = map.length;
12417    if (length <= 0x10000) {
12418      for (let i = 0; i < length; i++) {
12419        if (map[i] !== undefined) {
12420          callback(i, map[i]);
12421        }
12422      }
12423    } else {
12424      for (const i in map) {
12425        callback(i, map[i]);
12426      }
12427    }
12428  }
12429  charCodeOf(value) {
12430    const map = this._map;
12431    if (map.length <= 0x10000) {
12432      return map.indexOf(value);
12433    }
12434    for (const charCode in map) {
12435      if (map[charCode] === value) {
12436        return charCode | 0;
12437      }
12438    }
12439    return -1;
12440  }
12441  getMap() {
12442    return this._map;
12443  }
12444  readCharCode(str, offset, out) {
12445    let c = 0;
12446    const codespaceRanges = this.codespaceRanges;
12447    for (let n = 0, nn = codespaceRanges.length; n < nn; n++) {
12448      c = (c << 8 | str.charCodeAt(offset + n)) >>> 0;
12449      const codespaceRange = codespaceRanges[n];
12450      for (let k = 0, kk = codespaceRange.length; k < kk;) {
12451        const low = codespaceRange[k++];
12452        const high = codespaceRange[k++];
12453        if (c >= low && c <= high) {
vendor: 8,779 bytes, lines 12454-12798
12454          out.charcode = c;
12455          out.length = n + 1;
12456          return;
12457        }
12458      }
12459    }
12460    out.charcode = 0;
12461    out.length = 1;
12462  }
12463  getCharCodeLength(charCode) {
12464    const codespaceRanges = this.codespaceRanges;
12465    for (let n = 0, nn = codespaceRanges.length; n < nn; n++) {
12466      const codespaceRange = codespaceRanges[n];
12467      for (let k = 0, kk = codespaceRange.length; k < kk;) {
12468        const low = codespaceRange[k++];
12469        const high = codespaceRange[k++];
12470        if (charCode >= low && charCode <= high) {
12471          return n + 1;
12472        }
12473      }
12474    }
12475    return 1;
12476  }
12477  get length() {
12478    return this._map.length;
12479  }
12480  get isIdentityCMap() {
12481    if (!(this.name === "Identity-H" || this.name === "Identity-V")) {
12482      return false;
12483    }
12484    if (this._map.length !== 0x10000) {
12485      return false;
12486    }
12487    for (let i = 0; i < 0x10000; i++) {
12488      if (this._map[i] !== i) {
12489        return false;
12490      }
12491    }
12492    return true;
12493  }
12494}
12495class IdentityCMap extends CMap {
12496  constructor(vertical, n) {
12497    super();
12498    this.vertical = vertical;
12499    this.addCodespaceRange(n, 0, 0xffff);
12500  }
12501  mapCidRange(low, high, dstLow) {
12502    unreachable("should not call mapCidRange");
12503  }
12504  mapBfRange(low, high, dstLow) {
12505    unreachable("should not call mapBfRange");
12506  }
12507  mapBfRangeToArray(low, high, array) {
12508    unreachable("should not call mapBfRangeToArray");
12509  }
12510  mapOne(src, dst) {
12511    unreachable("should not call mapCidOne");
12512  }
12513  lookup(code) {
12514    return Number.isInteger(code) && code <= 0xffff ? code : undefined;
12515  }
12516  contains(code) {
12517    return Number.isInteger(code) && code <= 0xffff;
12518  }
12519  forEach(callback) {
12520    for (let i = 0; i <= 0xffff; i++) {
12521      callback(i, i);
12522    }
12523  }
12524  charCodeOf(value) {
12525    return Number.isInteger(value) && value <= 0xffff ? value : -1;
12526  }
12527  getMap() {
12528    const map = new Array(0x10000);
12529    for (let i = 0; i <= 0xffff; i++) {
12530      map[i] = i;
12531    }
12532    return map;
12533  }
12534  get length() {
12535    return 0x10000;
12536  }
12537  get isIdentityCMap() {
12538    unreachable("should not access .isIdentityCMap");
12539  }
12540}
12541function strToInt(str) {
12542  let a = 0;
12543  for (let i = 0; i < str.length; i++) {
12544    a = a << 8 | str.charCodeAt(i);
12545  }
12546  return a >>> 0;
12547}
12548function expectString(obj) {
12549  if (typeof obj !== "string") {
12550    throw new FormatError("Malformed CMap: expected string.");
12551  }
12552}
12553function expectInt(obj) {
12554  if (!Number.isInteger(obj)) {
12555    throw new FormatError("Malformed CMap: expected int.");
12556  }
12557}
12558function parseBfChar(cMap, lexer) {
12559  while (true) {
12560    let obj = lexer.getObj();
12561    if (obj === EOF) {
12562      break;
12563    }
12564    if (isCmd(obj, "endbfchar")) {
12565      return;
12566    }
12567    expectString(obj);
12568    const src = strToInt(obj);
12569    obj = lexer.getObj();
12570    expectString(obj);
12571    const dst = obj;
12572    cMap.mapOne(src, dst);
12573  }
12574}
12575function parseBfRange(cMap, lexer) {
12576  while (true) {
12577    let obj = lexer.getObj();
12578    if (obj === EOF) {
12579      break;
12580    }
12581    if (isCmd(obj, "endbfrange")) {
12582      return;
12583    }
12584    expectString(obj);
12585    const low = strToInt(obj);
12586    obj = lexer.getObj();
12587    expectString(obj);
12588    const high = strToInt(obj);
12589    obj = lexer.getObj();
12590    if (Number.isInteger(obj) || typeof obj === "string") {
12591      const dstLow = Number.isInteger(obj) ? String.fromCharCode(obj) : obj;
12592      cMap.mapBfRange(low, high, dstLow);
12593    } else if (isCmd(obj, "[")) {
12594      obj = lexer.getObj();
12595      const array = [];
12596      while (!isCmd(obj, "]") && obj !== EOF) {
12597        array.push(obj);
12598        obj = lexer.getObj();
12599      }
12600      cMap.mapBfRangeToArray(low, high, array);
12601    } else {
12602      break;
12603    }
12604  }
12605  throw new FormatError("Invalid bf range.");
12606}
12607function parseCidChar(cMap, lexer) {
12608  while (true) {
12609    let obj = lexer.getObj();
12610    if (obj === EOF) {
12611      break;
12612    }
12613    if (isCmd(obj, "endcidchar")) {
12614      return;
12615    }
12616    expectString(obj);
12617    const src = strToInt(obj);
12618    obj = lexer.getObj();
12619    expectInt(obj);
12620    const dst = obj;
12621    cMap.mapOne(src, dst);
12622  }
12623}
12624function parseCidRange(cMap, lexer) {
12625  while (true) {
12626    let obj = lexer.getObj();
12627    if (obj === EOF) {
12628      break;
12629    }
12630    if (isCmd(obj, "endcidrange")) {
12631      return;
12632    }
12633    expectString(obj);
12634    const low = strToInt(obj);
12635    obj = lexer.getObj();
12636    expectString(obj);
12637    const high = strToInt(obj);
12638    obj = lexer.getObj();
12639    expectInt(obj);
12640    const dstLow = obj;
12641    cMap.mapCidRange(low, high, dstLow);
12642  }
12643}
12644function parseCodespaceRange(cMap, lexer) {
12645  while (true) {
12646    let obj = lexer.getObj();
12647    if (obj === EOF) {
12648      break;
12649    }
12650    if (isCmd(obj, "endcodespacerange")) {
12651      return;
12652    }
12653    if (typeof obj !== "string") {
12654      break;
12655    }
12656    const low = strToInt(obj);
12657    obj = lexer.getObj();
12658    if (typeof obj !== "string") {
12659      break;
12660    }
12661    const high = strToInt(obj);
12662    cMap.addCodespaceRange(obj.length, low, high);
12663  }
12664  throw new FormatError("Invalid codespace range.");
12665}
12666function parseWMode(cMap, lexer) {
12667  const obj = lexer.getObj();
12668  if (Number.isInteger(obj)) {
12669    cMap.vertical = !!obj;
12670  }
12671}
12672function parseCMapName(cMap, lexer) {
12673  const obj = lexer.getObj();
12674  if (obj instanceof Name) {
12675    cMap.name = obj.name;
12676  }
12677}
12678async function parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap) {
12679  let previous, embeddedUseCMap;
12680  objLoop: while (true) {
12681    try {
12682      const obj = lexer.getObj();
12683      if (obj === EOF) {
12684        break;
12685      } else if (obj instanceof Name) {
12686        if (obj.name === "WMode") {
12687          parseWMode(cMap, lexer);
12688        } else if (obj.name === "CMapName") {
12689          parseCMapName(cMap, lexer);
12690        }
12691        previous = obj;
12692      } else if (obj instanceof Cmd) {
12693        switch (obj.cmd) {
12694          case "endcmap":
12695            break objLoop;
12696          case "usecmap":
12697            if (previous instanceof Name) {
12698              embeddedUseCMap = previous.name;
12699            }
12700            break;
12701          case "begincodespacerange":
12702            parseCodespaceRange(cMap, lexer);
12703            break;
12704          case "beginbfchar":
12705            parseBfChar(cMap, lexer);
12706            break;
12707          case "begincidchar":
12708            parseCidChar(cMap, lexer);
12709            break;
12710          case "beginbfrange":
12711            parseBfRange(cMap, lexer);
12712            break;
12713          case "begincidrange":
12714            parseCidRange(cMap, lexer);
12715            break;
12716        }
12717      }
12718    } catch (ex) {
12719      if (ex instanceof MissingDataException) {
12720        throw ex;
12721      }
12722      warn("Invalid cMap data: " + ex);
12723      continue;
12724    }
12725  }
12726  if (!useCMap && embeddedUseCMap) {
12727    useCMap = embeddedUseCMap;
12728  }
12729  if (useCMap) {
12730    return extendCMap(cMap, fetchBuiltInCMap, useCMap);
12731  }
12732  return cMap;
12733}
12734async function extendCMap(cMap, fetchBuiltInCMap, useCMap) {
12735  cMap.useCMap = await createBuiltInCMap(useCMap, fetchBuiltInCMap);
12736  if (cMap.numCodespaceRanges === 0) {
12737    const useCodespaceRanges = cMap.useCMap.codespaceRanges;
12738    for (let i = 0; i < useCodespaceRanges.length; i++) {
12739      cMap.codespaceRanges[i] = useCodespaceRanges[i].slice();
12740    }
12741    cMap.numCodespaceRanges = cMap.useCMap.numCodespaceRanges;
12742  }
12743  cMap.useCMap.forEach(function (key, value) {
12744    if (!cMap.contains(key)) {
12745      cMap.mapOne(key, value);
12746    }
12747  });
12748  return cMap;
12749}
12750async function createBuiltInCMap(name, fetchBuiltInCMap) {
12751  if (name === "Identity-H") {
12752    return new IdentityCMap(false, 2);
12753  } else if (name === "Identity-V") {
12754    return new IdentityCMap(true, 2);
12755  }
12756  if (!BUILT_IN_CMAPS.includes(name)) {
12757    throw new Error("Unknown CMap name: " + name);
12758  }
12759  if (!fetchBuiltInCMap) {
12760    throw new Error("Built-in CMap parameters are not provided.");
12761  }
12762  const {
12763    cMapData,
12764    isCompressed
12765  } = await fetchBuiltInCMap(name);
12766  const cMap = new CMap(true);
12767  if (isCompressed) {
12768    return new BinaryCMapReader().process(cMapData, cMap, useCMap => extendCMap(cMap, fetchBuiltInCMap, useCMap));
12769  }
12770  const lexer = new Lexer(new Stream(cMapData));
12771  return parseCMap(cMap, lexer, fetchBuiltInCMap, null);
12772}
12773class CMapFactory {
12774  static async create({
12775    encoding,
12776    fetchBuiltInCMap,
12777    useCMap
12778  }) {
12779    if (encoding instanceof Name) {
12780      return createBuiltInCMap(encoding.name, fetchBuiltInCMap);
12781    } else if (encoding instanceof BaseStream) {
12782      if (encoding.isAsync) {
12783        const bytes = await encoding.asyncGetBytes();
12784        if (bytes) {
12785          encoding = new Stream(bytes, 0, bytes.length, encoding.dict);
12786        }
12787      }
12788      const parsedCMap = await parseCMap(new CMap(), new Lexer(encoding), fetchBuiltInCMap, useCMap);
12789      if (parsedCMap.isIdentityCMap) {
12790        return createBuiltInCMap(parsedCMap.name, fetchBuiltInCMap);
12791      }
12792      return parsedCMap;
12793    }
12794    throw new Error("Encoding required.");
12795  }
12796}
12797
12798;// ./src/
vendor: 9,745 bytes, lines 12798-13076
12798shared/obj_bin_transform_utils.js
12799class CSS_FONT_INFO {
12800  static strings = ["fontFamily", "fontWeight", "italicAngle"];
12801}
12802class SYSTEM_FONT_INFO {
12803  static strings = ["css", "loadedName", "baseFontName", "src"];
12804}
12805class FONT_INFO {
12806  static bools = ["black", "bold", "disableFontFace", "fontExtraProperties", "isInvalidPDFjsFont", "isType3Font", "italic", "missingFile", "remeasure", "vertical"];
12807  static numbers = ["ascent", "defaultWidth", "descent"];
12808  static strings = ["fallbackName", "loadedName", "mimetype", "name"];
12809  static OFFSET_NUMBERS = Math.ceil(this.bools.length * 2 / 8);
12810  static OFFSET_BBOX = this.OFFSET_NUMBERS + this.numbers.length * 8;
12811  static OFFSET_FONT_MATRIX = this.OFFSET_BBOX + 1 + 2 * 4;
12812  static OFFSET_DEFAULT_VMETRICS = this.OFFSET_FONT_MATRIX + 1 + 8 * 6;
12813  static OFFSET_STRINGS = this.OFFSET_DEFAULT_VMETRICS + 1 + 2 * 3;
12814}
12815class PATTERN_INFO {
12816  static KIND = 0;
12817  static HAS_BBOX = 1;
12818  static HAS_BACKGROUND = 2;
12819  static SHADING_TYPE = 3;
12820  static N_COORD = 4;
12821  static N_COLOR = 8;
12822  static N_STOP = 12;
12823  static N_FIGURES = 16;
12824}
12825
12826;// ./src/core/obj_bin_transform_core.js
12827
12828
12829function compileCssFontInfo(info) {
12830  const encoder = new TextEncoder();
12831  const encodedStrings = {};
12832  let stringsLength = 0;
12833  for (const prop of CSS_FONT_INFO.strings) {
12834    const encoded = encoder.encode(info[prop]);
12835    encodedStrings[prop] = encoded;
12836    stringsLength += 4 + encoded.length;
12837  }
12838  const buffer = new ArrayBuffer(stringsLength);
12839  const data = new Uint8Array(buffer);
12840  const view = new DataView(buffer);
12841  let offset = 0;
12842  for (const prop of CSS_FONT_INFO.strings) {
12843    const encoded = encodedStrings[prop];
12844    const length = encoded.length;
12845    view.setUint32(offset, length);
12846    data.set(encoded, offset + 4);
12847    offset += 4 + length;
12848  }
12849  assert(offset === buffer.byteLength, "compileCssFontInfo: Buffer overflow");
12850  return buffer;
12851}
12852function compileSystemFontInfo(info) {
12853  const encoder = new TextEncoder();
12854  const encodedStrings = {};
12855  let stringsLength = 0;
12856  for (const prop of SYSTEM_FONT_INFO.strings) {
12857    const encoded = encoder.encode(info[prop]);
12858    encodedStrings[prop] = encoded;
12859    stringsLength += 4 + encoded.length;
12860  }
12861  stringsLength += 4;
12862  let encodedStyleStyle,
12863    encodedStyleWeight,
12864    lengthEstimate = 1 + stringsLength;
12865  if (info.style) {
12866    encodedStyleStyle = encoder.encode(info.style.style);
12867    encodedStyleWeight = encoder.encode(info.style.weight);
12868    lengthEstimate += 4 + encodedStyleStyle.length + 4 + encodedStyleWeight.length;
12869  }
12870  const buffer = new ArrayBuffer(lengthEstimate);
12871  const data = new Uint8Array(buffer);
12872  const view = new DataView(buffer);
12873  let offset = 0;
12874  view.setUint8(offset++, info.guessFallback ? 1 : 0);
12875  view.setUint32(offset, 0);
12876  offset += 4;
12877  stringsLength = 0;
12878  for (const prop of SYSTEM_FONT_INFO.strings) {
12879    const encoded = encodedStrings[prop];
12880    const length = encoded.length;
12881    stringsLength += 4 + length;
12882    view.setUint32(offset, length);
12883    data.set(encoded, offset + 4);
12884    offset += 4 + length;
12885  }
12886  view.setUint32(offset - stringsLength - 4, stringsLength);
12887  if (info.style) {
12888    view.setUint32(offset, encodedStyleStyle.length);
12889    data.set(encodedStyleStyle, offset + 4);
12890    offset += 4 + encodedStyleStyle.length;
12891    view.setUint32(offset, encodedStyleWeight.length);
12892    data.set(encodedStyleWeight, offset + 4);
12893    offset += 4 + encodedStyleWeight.length;
12894  }
12895  assert(offset <= buffer.byteLength, "compileSystemFontInfo: Buffer overflow");
12896  return buffer.transferToFixedLength(offset);
12897}
12898function compileFontInfo(font) {
12899  const systemFontInfoBuffer = font.systemFontInfo ? compileSystemFontInfo(font.systemFontInfo) : null;
12900  const cssFontInfoBuffer = font.cssFontInfo ? compileCssFontInfo(font.cssFontInfo) : null;
12901  const encoder = new TextEncoder();
12902  const encodedStrings = {};
12903  let stringsLength = 0;
12904  for (const prop of FONT_INFO.strings) {
12905    encodedStrings[prop] = encoder.encode(font[prop]);
12906    stringsLength += 4 + encodedStrings[prop].length;
12907  }
12908  const lengthEstimate = FONT_INFO.OFFSET_STRINGS + 4 + stringsLength + 4 + (systemFontInfoBuffer?.byteLength ?? 0) + 4 + (cssFontInfoBuffer?.byteLength ?? 0) + 4 + (font.data?.length ?? 0);
12909  const buffer = new ArrayBuffer(lengthEstimate);
12910  const data = new Uint8Array(buffer);
12911  const view = new DataView(buffer);
12912  let offset = 0;
12913  const numBools = FONT_INFO.bools.length;
12914  let boolByte = 0,
12915    boolBit = 0;
12916  for (let i = 0; i < numBools; i++) {
12917    const value = font[FONT_INFO.bools[i]];
12918    const bits = value === undefined ? 0x00 : value ? 0x02 : 0x01;
12919    boolByte |= bits << boolBit;
12920    boolBit += 2;
12921    if (boolBit === 8 || i === numBools - 1) {
12922      view.setUint8(offset++, boolByte);
12923      boolByte = 0;
12924      boolBit = 0;
12925    }
12926  }
12927  assert(offset === FONT_INFO.OFFSET_NUMBERS, "compileFontInfo: Boolean properties offset mismatch");
12928  for (const prop of FONT_INFO.numbers) {
12929    view.setFloat64(offset, font[prop]);
12930    offset += 8;
12931  }
12932  assert(offset === FONT_INFO.OFFSET_BBOX, "compileFontInfo: Number properties offset mismatch");
12933  if (font.bbox) {
12934    view.setUint8(offset++, 4);
12935    for (const coord of font.bbox) {
12936      view.setInt16(offset, coord, true);
12937      offset += 2;
12938    }
12939  } else {
12940    view.setUint8(offset++, 0);
12941    offset += 2 * 4;
12942  }
12943  assert(offset === FONT_INFO.OFFSET_FONT_MATRIX, "compileFontInfo: BBox properties offset mismatch");
12944  if (font.fontMatrix) {
12945    view.setUint8(offset++, 6);
12946    for (const point of font.fontMatrix) {
12947      view.setFloat64(offset, point, true);
12948      offset += 8;
12949    }
12950  } else {
12951    view.setUint8(offset++, 0);
12952    offset += 8 * 6;
12953  }
12954  assert(offset === FONT_INFO.OFFSET_DEFAULT_VMETRICS, "compileFontInfo: FontMatrix properties offset mismatch");
12955  if (font.defaultVMetrics) {
12956    view.setUint8(offset++, 3);
12957    for (const metric of font.defaultVMetrics) {
12958      view.setInt16(offset, metric, true);
12959      offset += 2;
12960    }
12961  } else {
12962    view.setUint8(offset++, 0);
12963    offset += 3 * 2;
12964  }
12965  assert(offset === FONT_INFO.OFFSET_STRINGS, "compileFontInfo: DefaultVMetrics properties offset mismatch");
12966  view.setUint32(FONT_INFO.OFFSET_STRINGS, 0);
12967  offset += 4;
12968  for (const prop of FONT_INFO.strings) {
12969    const encoded = encodedStrings[prop];
12970    const length = encoded.length;
12971    view.setUint32(offset, length);
12972    data.set(encoded, offset + 4);
12973    offset += 4 + length;
12974  }
12975  view.setUint32(FONT_INFO.OFFSET_STRINGS, offset - FONT_INFO.OFFSET_STRINGS - 4);
12976  if (!systemFontInfoBuffer) {
12977    view.setUint32(offset, 0);
12978    offset += 4;
12979  } else {
12980    const length = systemFontInfoBuffer.byteLength;
12981    view.setUint32(offset, length);
12982    assert(offset + 4 + length <= buffer.byteLength, "compileFontInfo: Buffer overflow at systemFontInfo");
12983    data.set(new Uint8Array(systemFontInfoBuffer), offset + 4);
12984    offset += 4 + length;
12985  }
12986  if (!cssFontInfoBuffer) {
12987    view.setUint32(offset, 0);
12988    offset += 4;
12989  } else {
12990    const length = cssFontInfoBuffer.byteLength;
12991    view.setUint32(offset, length);
12992    assert(offset + 4 + length <= buffer.byteLength, "compileFontInfo: Buffer overflow at cssFontInfo");
12993    data.set(new Uint8Array(cssFontInfoBuffer), offset + 4);
12994    offset += 4 + length;
12995  }
12996  if (font.data === undefined) {
12997    view.setUint32(offset, 0);
12998    offset += 4;
12999  } else {
13000    view.setUint32(offset, font.data.length);
13001    data.set(font.data, offset + 4);
13002    offset += 4 + font.data.length;
13003  }
13004  assert(offset <= buffer.byteLength, "compileFontInfo: Buffer overflow");
13005  return buffer.transferToFixedLength(offset);
13006}
13007function compilePatternInfo(ir) {
13008  let kind,
13009    bbox = null,
13010    coords = [],
13011    colors = [],
13012    colorStops = [],
13013    shadingType = null,
13014    background = null;
13015  switch (ir[0]) {
13016    case "RadialAxial":
13017      kind = ir[1] === "axial" ? 1 : 2;
13018      bbox = ir[2];
13019      colorStops = ir[3];
13020      if (kind === 1) {
13021        coords.push(...ir[4], ...ir[5]);
13022      } else {
13023        coords.push(ir[4][0], ir[4][1], ir[6], ir[5][0], ir[5][1], ir[7]);
13024      }
13025      break;
13026    case "Mesh":
13027      kind = 3;
13028      shadingType = ir[1];
13029      coords = ir[2];
13030      colors = ir[3];
13031      bbox = ir[6];
13032      background = ir[7];
13033      break;
13034    default:
13035      throw new Error(`Unsupported pattern type: ${ir[0]}`);
13036  }
13037  const nCoord = Math.floor(coords.length / 2);
13038  const nColor = Math.floor(colors.length / 4);
13039  const nStop = colorStops.length;
13040  const byteLen = 20 + nCoord * 8 + nColor * 4 + nStop * 8 + (bbox ? 16 : 0) + (background ? 3 : 0);
13041  const buffer = new ArrayBuffer(byteLen);
13042  const dataView = new DataView(buffer);
13043  const u8data = new Uint8Array(buffer);
13044  dataView.setUint8(PATTERN_INFO.KIND, kind);
13045  dataView.setUint8(PATTERN_INFO.HAS_BBOX, bbox ? 1 : 0);
13046  dataView.setUint8(PATTERN_INFO.HAS_BACKGROUND, background ? 1 : 0);
13047  dataView.setUint8(PATTERN_INFO.SHADING_TYPE, shadingType);
13048  dataView.setUint32(PATTERN_INFO.N_COORD, nCoord, true);
13049  dataView.setUint32(PATTERN_INFO.N_COLOR, nColor, true);
13050  dataView.setUint32(PATTERN_INFO.N_STOP, nStop, true);
13051  dataView.setUint32(PATTERN_INFO.N_FIGURES, 0, true);
13052  let offset = 20;
13053  const coordsView = new Float32Array(buffer, offset, nCoord * 2);
13054  coordsView.set(coords);
13055  offset += nCoord * 8;
13056  u8data.set(colors, offset);
13057  offset += nColor * 4;
13058  for (const [pos, hex] of colorStops) {
13059    dataView.setFloat32(offset, pos, true);
13060    offset += 4;
13061    dataView.setUint32(offset, parseInt(hex.slice(1), 16), true);
13062    offset += 4;
13063  }
13064  if (bbox) {
13065    for (const v of bbox) {
13066      dataView.setFloat32(offset, v, true);
13067      offset += 4;
13068    }
13069  }
13070  if (background) {
13071    u8data.set(background, offset);
13072  }
13073  return buffer;
13074}
13075function compileFontPathInfo(path) {
13076  return path.slice().buffer;
vendor: 136,506 bytes, lines 13076-17655
13076
13077}
13078
13079;// ./src/core/encodings.js
13080const ExpertEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclamsmall", "Hungarumlautsmall", "", "dollaroldstyle", "dollarsuperior", "ampersandsmall", "Acutesmall", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "comma", "hyphen", "period", "fraction", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "colon", "semicolon", "commasuperior", "threequartersemdash", "periodsuperior", "questionsmall", "", "asuperior", "bsuperior", "centsuperior", "dsuperior", "esuperior", "", "", "", "isuperior", "", "", "lsuperior", "msuperior", "nsuperior", "osuperior", "", "", "rsuperior", "ssuperior", "tsuperior", "", "ff", "fi", "fl", "ffi", "ffl", "parenleftinferior", "", "parenrightinferior", "Circumflexsmall", "hyphensuperior", "Gravesmall", "Asmall", "Bsmall", "Csmall", "Dsmall", "Esmall", "Fsmall", "Gsmall", "Hsmall", "Ismall", "Jsmall", "Ksmall", "Lsmall", "Msmall", "Nsmall", "Osmall", "Psmall", "Qsmall", "Rsmall", "Ssmall", "Tsmall", "Usmall", "Vsmall", "Wsmall", "Xsmall", "Ysmall", "Zsmall", "colonmonetary", "onefitted", "rupiah", "Tildesmall", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "exclamdownsmall", "centoldstyle", "Lslashsmall", "", "", "Scaronsmall", "Zcaronsmall", "Dieresissmall", "Brevesmall", "Caronsmall", "", "Dotaccentsmall", "", "", "Macronsmall", "", "", "figuredash", "hypheninferior", "", "", "Ogoneksmall", "Ringsmall", "Cedillasmall", "", "", "", "onequarter", "onehalf", "threequarters", "questiondownsmall", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "", "", "zerosuperior", "onesuperior", "twosuperior", "threesuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "eightsuperior", "ninesuperior", "zeroinferior", "oneinferior", "twoinferior", "threeinferior", "fourinferior", "fiveinferior", "sixinferior", "seveninferior", "eightinferior", "nineinferior", "centinferior", "dollarinferior", "periodinferior", "commainferior", "Agravesmall", "Aacutesmall", "Acircumflexsmall", "Atildesmall", "Adieresissmall", "Aringsmall", "AEsmall", "Ccedillasmall", "Egravesmall", "Eacutesmall", "Ecircumflexsmall", "Edieresissmall", "Igravesmall", "Iacutesmall", "Icircumflexsmall", "Idieresissmall", "Ethsmall", "Ntildesmall", "Ogravesmall", "Oacutesmall", "Ocircumflexsmall", "Otildesmall", "Odieresissmall", "OEsmall", "Oslashsmall", "Ugravesmall", "Uacutesmall", "Ucircumflexsmall", "Udieresissmall", "Yacutesmall", "Thornsmall", "Ydieresissmall"];
13081const MacExpertEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclamsmall", "Hungarumlautsmall", "centoldstyle", "dollaroldstyle", "dollarsuperior", "ampersandsmall", "Acutesmall", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "comma", "hyphen", "period", "fraction", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "colon", "semicolon", "", "threequartersemdash", "", "questionsmall", "", "", "", "", "Ethsmall", "", "", "onequarter", "onehalf", "threequarters", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "", "", "", "", "", "", "ff", "fi", "fl", "ffi", "ffl", "parenleftinferior", "", "parenrightinferior", "Circumflexsmall", "hypheninferior", "Gravesmall", "Asmall", "Bsmall", "Csmall", "Dsmall", "Esmall", "Fsmall", "Gsmall", "Hsmall", "Ismall", "Jsmall", "Ksmall", "Lsmall", "Msmall", "Nsmall", "Osmall", "Psmall", "Qsmall", "Rsmall", "Ssmall", "Tsmall", "Usmall", "Vsmall", "Wsmall", "Xsmall", "Ysmall", "Zsmall", "colonmonetary", "onefitted", "rupiah", "Tildesmall", "", "", "asuperior", "centsuperior", "", "", "", "", "Aacutesmall", "Agravesmall", "Acircumflexsmall", "Adieresissmall", "Atildesmall", "Aringsmall", "Ccedillasmall", "Eacutesmall", "Egravesmall", "Ecircumflexsmall", "Edieresissmall", "Iacutesmall", "Igravesmall", "Icircumflexsmall", "Idieresissmall", "Ntildesmall", "Oacutesmall", "Ogravesmall", "Ocircumflexsmall", "Odieresissmall", "Otildesmall", "Uacutesmall", "Ugravesmall", "Ucircumflexsmall", "Udieresissmall", "", "eightsuperior", "fourinferior", "threeinferior", "sixinferior", "eightinferior", "seveninferior", "Scaronsmall", "", "centinferior", "twoinferior", "", "Dieresissmall", "", "Caronsmall", "osuperior", "fiveinferior", "", "commainferior", "periodinferior", "Yacutesmall", "", "dollarinferior", "", "", "Thornsmall", "", "nineinferior", "zeroinferior", "Zcaronsmall", "AEsmall", "Oslashsmall", "questiondownsmall", "oneinferior", "Lslashsmall", "", "", "", "", "", "", "Cedillasmall", "", "", "", "", "", "OEsmall", "figuredash", "hyphensuperior", "", "", "", "", "exclamdownsmall", "", "Ydieresissmall", "", "onesuperior", "twosuperior", "threesuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "ninesuperior", "zerosuperior", "", "esuperior", "rsuperior", "tsuperior", "", "", "isuperior", "ssuperior", "dsuperior", "", "", "", "", "", "lsuperior", "Ogoneksmall", "Brevesmall", "Macronsmall", "bsuperior", "nsuperior", "msuperior", "commasuperior", "periodsuperior", "Dotaccentsmall", "Ringsmall", "", "", "", ""];
13082const MacRomanEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quotesingle", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "grave", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "", "Adieresis", "Aring", "Ccedilla", "Eacute", "Ntilde", "Odieresis", "Udieresis", "aacute", "agrave", "acircumflex", "adieresis", "atilde", "aring", "ccedilla", "eacute", "egrave", "ecircumflex", "edieresis", "iacute", "igrave", "icircumflex", "idieresis", "ntilde", "oacute", "ograve", "ocircumflex", "odieresis", "otilde", "uacute", "ugrave", "ucircumflex", "udieresis", "dagger", "degree", "cent", "sterling", "section", "bullet", "paragraph", "germandbls", "registered", "copyright", "trademark", "acute", "dieresis", "notequal", "AE", "Oslash", "infinity", "plusminus", "lessequal", "greaterequal", "yen", "mu", "partialdiff", "summation", "product", "pi", "integral", "ordfeminine", "ordmasculine", "Omega", "ae", "oslash", "questiondown", "exclamdown", "logicalnot", "radical", "florin", "approxequal", "Delta", "guillemotleft", "guillemotright", "ellipsis", "space", "Agrave", "Atilde", "Otilde", "OE", "oe", "endash", "emdash", "quotedblleft", "quotedblright", "quoteleft", "quoteright", "divide", "lozenge", "ydieresis", "Ydieresis", "fraction", "currency", "guilsinglleft", "guilsinglright", "fi", "fl", "daggerdbl", "periodcentered", "quotesinglbase", "quotedblbase", "perthousand", "Acircumflex", "Ecircumflex", "Aacute", "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis", "Igrave", "Oacute", "Ocircumflex", "apple", "Ograve", "Uacute", "Ucircumflex", "Ugrave", "dotlessi", "circumflex", "tilde", "macron", "breve", "dotaccent", "ring", "cedilla", "hungarumlaut", "ogonek", "caron"];
13083const StandardEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quoteright", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "quoteleft", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "exclamdown", "cent", "sterling", "fraction", "yen", "florin", "section", "currency", "quotesingle", "quotedblleft", "guillemotleft", "guilsinglleft", "guilsinglright", "fi", "fl", "", "endash", "dagger", "daggerdbl", "periodcentered", "", "paragraph", "bullet", "quotesinglbase", "quotedblbase", "quotedblright", "guillemotright", "ellipsis", "perthousand", "", "questiondown", "", "grave", "acute", "circumflex", "tilde", "macron", "breve", "dotaccent", "dieresis", "", "ring", "cedilla", "", "hungarumlaut", "ogonek", "caron", "emdash", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "AE", "", "ordfeminine", "", "", "", "", "Lslash", "Oslash", "OE", "ordmasculine", "", "", "", "", "", "ae", "", "", "", "dotlessi", "", "", "lslash", "oslash", "oe", "germandbls", "", "", "", ""];
13084const WinAnsiEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quotesingle", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "grave", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "bullet", "Euro", "bullet", "quotesinglbase", "florin", "quotedblbase", "ellipsis", "dagger", "daggerdbl", "circumflex", "perthousand", "Scaron", "guilsinglleft", "OE", "bullet", "Zcaron", "bullet", "bullet", "quoteleft", "quoteright", "quotedblleft", "quotedblright", "bullet", "endash", "emdash", "tilde", "trademark", "scaron", "guilsinglright", "oe", "bullet", "zcaron", "Ydieresis", "space", "exclamdown", "cent", "sterling", "currency", "yen", "brokenbar", "section", "dieresis", "copyright", "ordfeminine", "guillemotleft", "logicalnot", "hyphen", "registered", "macron", "degree", "plusminus", "twosuperior", "threesuperior", "acute", "mu", "paragraph", "periodcentered", "cedilla", "onesuperior", "ordmasculine", "guillemotright", "onequarter", "onehalf", "threequarters", "questiondown", "Agrave", "Aacute", "Acircumflex", "Atilde", "Adieresis", "Aring", "AE", "Ccedilla", "Egrave", "Eacute", "Ecircumflex", "Edieresis", "Igrave", "Iacute", "Icircumflex", "Idieresis", "Eth", "Ntilde", "Ograve", "Oacute", "Ocircumflex", "Otilde", "Odieresis", "multiply", "Oslash", "Ugrave", "Uacute", "Ucircumflex", "Udieresis", "Yacute", "Thorn", "germandbls", "agrave", "aacute", "acircumflex", "atilde", "adieresis", "aring", "ae", "ccedilla", "egrave", "eacute", "ecircumflex", "edieresis", "igrave", "iacute", "icircumflex", "idieresis", "eth", "ntilde", "ograve", "oacute", "ocircumflex", "otilde", "odieresis", "divide", "oslash", "ugrave", "uacute", "ucircumflex", "udieresis", "yacute", "thorn", "ydieresis"];
13085const SymbolSetEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclam", "universal", "numbersign", "existential", "percent", "ampersand", "suchthat", "parenleft", "parenright", "asteriskmath", "plus", "comma", "minus", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "congruent", "Alpha", "Beta", "Chi", "Delta", "Epsilon", "Phi", "Gamma", "Eta", "Iota", "theta1", "Kappa", "Lambda", "Mu", "Nu", "Omicron", "Pi", "Theta", "Rho", "Sigma", "Tau", "Upsilon", "sigma1", "Omega", "Xi", "Psi", "Zeta", "bracketleft", "therefore", "bracketright", "perpendicular", "underscore", "radicalex", "alpha", "beta", "chi", "delta", "epsilon", "phi", "gamma", "eta", "iota", "phi1", "kappa", "lambda", "mu", "nu", "omicron", "pi", "theta", "rho", "sigma", "tau", "upsilon", "omega1", "omega", "xi", "psi", "zeta", "braceleft", "bar", "braceright", "similar", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "Euro", "Upsilon1", "minute", "lessequal", "fraction", "infinity", "florin", "club", "diamond", "heart", "spade", "arrowboth", "arrowleft", "arrowup", "arrowright", "arrowdown", "degree", "plusminus", "second", "greaterequal", "multiply", "proportional", "partialdiff", "bullet", "divide", "notequal", "equivalence", "approxequal", "ellipsis", "arrowvertex", "arrowhorizex", "carriagereturn", "aleph", "Ifraktur", "Rfraktur", "weierstrass", "circlemultiply", "circleplus", "emptyset", "intersection", "union", "propersuperset", "reflexsuperset", "notsubset", "propersubset", "reflexsubset", "element", "notelement", "angle", "gradient", "registerserif", "copyrightserif", "trademarkserif", "product", "radical", "dotmath", "logicalnot", "logicaland", "logicalor", "arrowdblboth", "arrowdblleft", "arrowdblup", "arrowdblright", "arrowdbldown", "lozenge", "angleleft", "registersans", "copyrightsans", "trademarksans", "summation", "parenlefttp", "parenleftex", "parenleftbt", "bracketlefttp", "bracketleftex", "bracketleftbt", "bracelefttp", "braceleftmid", "braceleftbt", "braceex", "", "angleright", "integral", "integraltp", "integralex", "integralbt", "parenrighttp", "parenrightex", "parenrightbt", "bracketrighttp", "bracketrightex", "bracketrightbt", "bracerighttp", "bracerightmid", "bracerightbt", ""];
13086const ZapfDingbatsEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "a1", "a2", "a202", "a3", "a4", "a5", "a119", "a118", "a117", "a11", "a12", "a13", "a14", "a15", "a16", "a105", "a17", "a18", "a19", "a20", "a21", "a22", "a23", "a24", "a25", "a26", "a27", "a28", "a6", "a7", "a8", "a9", "a10", "a29", "a30", "a31", "a32", "a33", "a34", "a35", "a36", "a37", "a38", "a39", "a40", "a41", "a42", "a43", "a44", "a45", "a46", "a47", "a48", "a49", "a50", "a51", "a52", "a53", "a54", "a55", "a56", "a57", "a58", "a59", "a60", "a61", "a62", "a63", "a64", "a65", "a66", "a67", "a68", "a69", "a70", "a71", "a72", "a73", "a74", "a203", "a75", "a204", "a76", "a77", "a78", "a79", "a81", "a82", "a83", "a84", "a97", "a98", "a99", "a100", "", "a89", "a90", "a93", "a94", "a91", "a92", "a205", "a85", "a206", "a86", "a87", "a88", "a95", "a96", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "a101", "a102", "a103", "a104", "a106", "a107", "a108", "a112", "a111", "a110", "a109", "a120", "a121", "a122", "a123", "a124", "a125", "a126", "a127", "a128", "a129", "a130", "a131", "a132", "a133", "a134", "a135", "a136", "a137", "a138", "a139", "a140", "a141", "a142", "a143", "a144", "a145", "a146", "a147", "a148", "a149", "a150", "a151", "a152", "a153", "a154", "a155", "a156", "a157", "a158", "a159", "a160", "a161", "a163", "a164", "a196", "a165", "a192", "a166", "a167", "a168", "a169", "a170", "a171", "a172", "a173", "a162", "a174", "a175", "a176", "a177", "a178", "a179", "a193", "a180", "a199", "a181", "a200", "a182", "", "a201", "a183", "a184", "a197", "a185", "a194", "a198", "a186", "a195", "a187", "a188", "a189", "a190", "a191", ""];
13087function getEncoding(encodingName) {
13088  switch (encodingName) {
13089    case "WinAnsiEncoding":
13090      return WinAnsiEncoding;
13091    case "StandardEncoding":
13092      return StandardEncoding;
13093    case "MacRomanEncoding":
13094      return MacRomanEncoding;
13095    case "SymbolSetEncoding":
13096      return SymbolSetEncoding;
13097    case "ZapfDingbatsEncoding":
13098      return ZapfDingbatsEncoding;
13099    case "ExpertEncoding":
13100      return ExpertEncoding;
13101    case "MacExpertEncoding":
13102      return MacExpertEncoding;
13103    default:
13104      return null;
13105  }
13106}
13107
13108;// ./src/core/glyphlist.js
13109
13110const getGlyphsUnicode = getLookupTableFactory(function (t) {
13111  t.A = 0x0041;
13112  t.AE = 0x00c6;
13113  t.AEacute = 0x01fc;
13114  t.AEmacron = 0x01e2;
13115  t.AEsmall = 0xf7e6;
13116  t.Aacute = 0x00c1;
13117  t.Aacutesmall = 0xf7e1;
13118  t.Abreve = 0x0102;
13119  t.Abreveacute = 0x1eae;
13120  t.Abrevecyrillic = 0x04d0;
13121  t.Abrevedotbelow = 0x1eb6;
13122  t.Abrevegrave = 0x1eb0;
13123  t.Abrevehookabove = 0x1eb2;
13124  t.Abrevetilde = 0x1eb4;
13125  t.Acaron = 0x01cd;
13126  t.Acircle = 0x24b6;
13127  t.Acircumflex = 0x00c2;
13128  t.Acircumflexacute = 0x1ea4;
13129  t.Acircumflexdotbelow = 0x1eac;
13130  t.Acircumflexgrave = 0x1ea6;
13131  t.Acircumflexhookabove = 0x1ea8;
13132  t.Acircumflexsmall = 0xf7e2;
13133  t.Acircumflextilde = 0x1eaa;
13134  t.Acute = 0xf6c9;
13135  t.Acutesmall = 0xf7b4;
13136  t.Acyrillic = 0x0410;
13137  t.Adblgrave = 0x0200;
13138  t.Adieresis = 0x00c4;
13139  t.Adieresiscyrillic = 0x04d2;
13140  t.Adieresismacron = 0x01de;
13141  t.Adieresissmall = 0xf7e4;
13142  t.Adotbelow = 0x1ea0;
13143  t.Adotmacron = 0x01e0;
13144  t.Agrave = 0x00c0;
13145  t.Agravesmall = 0xf7e0;
13146  t.Ahookabove = 0x1ea2;
13147  t.Aiecyrillic = 0x04d4;
13148  t.Ainvertedbreve = 0x0202;
13149  t.Alpha = 0x0391;
13150  t.Alphatonos = 0x0386;
13151  t.Amacron = 0x0100;
13152  t.Amonospace = 0xff21;
13153  t.Aogonek = 0x0104;
13154  t.Aring = 0x00c5;
13155  t.Aringacute = 0x01fa;
13156  t.Aringbelow = 0x1e00;
13157  t.Aringsmall = 0xf7e5;
13158  t.Asmall = 0xf761;
13159  t.Atilde = 0x00c3;
13160  t.Atildesmall = 0xf7e3;
13161  t.Aybarmenian = 0x0531;
13162  t.B = 0x0042;
13163  t.Bcircle = 0x24b7;
13164  t.Bdotaccent = 0x1e02;
13165  t.Bdotbelow = 0x1e04;
13166  t.Becyrillic = 0x0411;
13167  t.Benarmenian = 0x0532;
13168  t.Beta = 0x0392;
13169  t.Bhook = 0x0181;
13170  t.Blinebelow = 0x1e06;
13171  t.Bmonospace = 0xff22;
13172  t.Brevesmall = 0xf6f4;
13173  t.Bsmall = 0xf762;
13174  t.Btopbar = 0x0182;
13175  t.C = 0x0043;
13176  t.Caarmenian = 0x053e;
13177  t.Cacute = 0x0106;
13178  t.Caron = 0xf6ca;
13179  t.Caronsmall = 0xf6f5;
13180  t.Ccaron = 0x010c;
13181  t.Ccedilla = 0x00c7;
13182  t.Ccedillaacute = 0x1e08;
13183  t.Ccedillasmall = 0xf7e7;
13184  t.Ccircle = 0x24b8;
13185  t.Ccircumflex = 0x0108;
13186  t.Cdot = 0x010a;
13187  t.Cdotaccent = 0x010a;
13188  t.Cedillasmall = 0xf7b8;
13189  t.Chaarmenian = 0x0549;
13190  t.Cheabkhasiancyrillic = 0x04bc;
13191  t.Checyrillic = 0x0427;
13192  t.Chedescenderabkhasiancyrillic = 0x04be;
13193  t.Chedescendercyrillic = 0x04b6;
13194  t.Chedieresiscyrillic = 0x04f4;
13195  t.Cheharmenian = 0x0543;
13196  t.Chekhakassiancyrillic = 0x04cb;
13197  t.Cheverticalstrokecyrillic = 0x04b8;
13198  t.Chi = 0x03a7;
13199  t.Chook = 0x0187;
13200  t.Circumflexsmall = 0xf6f6;
13201  t.Cmonospace = 0xff23;
13202  t.Coarmenian = 0x0551;
13203  t.Csmall = 0xf763;
13204  t.D = 0x0044;
13205  t.DZ = 0x01f1;
13206  t.DZcaron = 0x01c4;
13207  t.Daarmenian = 0x0534;
13208  t.Dafrican = 0x0189;
13209  t.Dcaron = 0x010e;
13210  t.Dcedilla = 0x1e10;
13211  t.Dcircle = 0x24b9;
13212  t.Dcircumflexbelow = 0x1e12;
13213  t.Dcroat = 0x0110;
13214  t.Ddotaccent = 0x1e0a;
13215  t.Ddotbelow = 0x1e0c;
13216  t.Decyrillic = 0x0414;
13217  t.Deicoptic = 0x03ee;
13218  t.Delta = 0x2206;
13219  t.Deltagreek = 0x0394;
13220  t.Dhook = 0x018a;
13221  t.Dieresis = 0xf6cb;
13222  t.DieresisAcute = 0xf6cc;
13223  t.DieresisGrave = 0xf6cd;
13224  t.Dieresissmall = 0xf7a8;
13225  t.Digammagreek = 0x03dc;
13226  t.Djecyrillic = 0x0402;
13227  t.Dlinebelow = 0x1e0e;
13228  t.Dmonospace = 0xff24;
13229  t.Dotaccentsmall = 0xf6f7;
13230  t.Dslash = 0x0110;
13231  t.Dsmall = 0xf764;
13232  t.Dtopbar = 0x018b;
13233  t.Dz = 0x01f2;
13234  t.Dzcaron = 0x01c5;
13235  t.Dzeabkhasiancyrillic = 0x04e0;
13236  t.Dzecyrillic = 0x0405;
13237  t.Dzhecyrillic = 0x040f;
13238  t.E = 0x0045;
13239  t.Eacute = 0x00c9;
13240  t.Eacutesmall = 0xf7e9;
13241  t.Ebreve = 0x0114;
13242  t.Ecaron = 0x011a;
13243  t.Ecedillabreve = 0x1e1c;
13244  t.Echarmenian = 0x0535;
13245  t.Ecircle = 0x24ba;
13246  t.Ecircumflex = 0x00ca;
13247  t.Ecircumflexacute = 0x1ebe;
13248  t.Ecircumflexbelow = 0x1e18;
13249  t.Ecircumflexdotbelow = 0x1ec6;
13250  t.Ecircumflexgrave = 0x1ec0;
13251  t.Ecircumflexhookabove = 0x1ec2;
13252  t.Ecircumflexsmall = 0xf7ea;
13253  t.Ecircumflextilde = 0x1ec4;
13254  t.Ecyrillic = 0x0404;
13255  t.Edblgrave = 0x0204;
13256  t.Edieresis = 0x00cb;
13257  t.Edieresissmall = 0xf7eb;
13258  t.Edot = 0x0116;
13259  t.Edotaccent = 0x0116;
13260  t.Edotbelow = 0x1eb8;
13261  t.Efcyrillic = 0x0424;
13262  t.Egrave = 0x00c8;
13263  t.Egravesmall = 0xf7e8;
13264  t.Eharmenian = 0x0537;
13265  t.Ehookabove = 0x1eba;
13266  t.Eightroman = 0x2167;
13267  t.Einvertedbreve = 0x0206;
13268  t.Eiotifiedcyrillic = 0x0464;
13269  t.Elcyrillic = 0x041b;
13270  t.Elevenroman = 0x216a;
13271  t.Emacron = 0x0112;
13272  t.Emacronacute = 0x1e16;
13273  t.Emacrongrave = 0x1e14;
13274  t.Emcyrillic = 0x041c;
13275  t.Emonospace = 0xff25;
13276  t.Encyrillic = 0x041d;
13277  t.Endescendercyrillic = 0x04a2;
13278  t.Eng = 0x014a;
13279  t.Enghecyrillic = 0x04a4;
13280  t.Enhookcyrillic = 0x04c7;
13281  t.Eogonek = 0x0118;
13282  t.Eopen = 0x0190;
13283  t.Epsilon = 0x0395;
13284  t.Epsilontonos = 0x0388;
13285  t.Ercyrillic = 0x0420;
13286  t.Ereversed = 0x018e;
13287  t.Ereversedcyrillic = 0x042d;
13288  t.Escyrillic = 0x0421;
13289  t.Esdescendercyrillic = 0x04aa;
13290  t.Esh = 0x01a9;
13291  t.Esmall = 0xf765;
13292  t.Eta = 0x0397;
13293  t.Etarmenian = 0x0538;
13294  t.Etatonos = 0x0389;
13295  t.Eth = 0x00d0;
13296  t.Ethsmall = 0xf7f0;
13297  t.Etilde = 0x1ebc;
13298  t.Etildebelow = 0x1e1a;
13299  t.Euro = 0x20ac;
13300  t.Ezh = 0x01b7;
13301  t.Ezhcaron = 0x01ee;
13302  t.Ezhreversed = 0x01b8;
13303  t.F = 0x0046;
13304  t.Fcircle = 0x24bb;
13305  t.Fdotaccent = 0x1e1e;
13306  t.Feharmenian = 0x0556;
13307  t.Feicoptic = 0x03e4;
13308  t.Fhook = 0x0191;
13309  t.Fitacyrillic = 0x0472;
13310  t.Fiveroman = 0x2164;
13311  t.Fmonospace = 0xff26;
13312  t.Fourroman = 0x2163;
13313  t.Fsmall = 0xf766;
13314  t.G = 0x0047;
13315  t.GBsquare = 0x3387;
13316  t.Gacute = 0x01f4;
13317  t.Gamma = 0x0393;
13318  t.Gammaafrican = 0x0194;
13319  t.Gangiacoptic = 0x03ea;
13320  t.Gbreve = 0x011e;
13321  t.Gcaron = 0x01e6;
13322  t.Gcedilla = 0x0122;
13323  t.Gcircle = 0x24bc;
13324  t.Gcircumflex = 0x011c;
13325  t.Gcommaaccent = 0x0122;
13326  t.Gdot = 0x0120;
13327  t.Gdotaccent = 0x0120;
13328  t.Gecyrillic = 0x0413;
13329  t.Ghadarmenian = 0x0542;
13330  t.Ghemiddlehookcyrillic = 0x0494;
13331  t.Ghestrokecyrillic = 0x0492;
13332  t.Gheupturncyrillic = 0x0490;
13333  t.Ghook = 0x0193;
13334  t.Gimarmenian = 0x0533;
13335  t.Gjecyrillic = 0x0403;
13336  t.Gmacron = 0x1e20;
13337  t.Gmonospace = 0xff27;
13338  t.Grave = 0xf6ce;
13339  t.Gravesmall = 0xf760;
13340  t.Gsmall = 0xf767;
13341  t.Gsmallhook = 0x029b;
13342  t.Gstroke = 0x01e4;
13343  t.H = 0x0048;
13344  t.H18533 = 0x25cf;
13345  t.H18543 = 0x25aa;
13346  t.H18551 = 0x25ab;
13347  t.H22073 = 0x25a1;
13348  t.HPsquare = 0x33cb;
13349  t.Haabkhasiancyrillic = 0x04a8;
13350  t.Hadescendercyrillic = 0x04b2;
13351  t.Hardsigncyrillic = 0x042a;
13352  t.Hbar = 0x0126;
13353  t.Hbrevebelow = 0x1e2a;
13354  t.Hcedilla = 0x1e28;
13355  t.Hcircle = 0x24bd;
13356  t.Hcircumflex = 0x0124;
13357  t.Hdieresis = 0x1e26;
13358  t.Hdotaccent = 0x1e22;
13359  t.Hdotbelow = 0x1e24;
13360  t.Hmonospace = 0xff28;
13361  t.Hoarmenian = 0x0540;
13362  t.Horicoptic = 0x03e8;
13363  t.Hsmall = 0xf768;
13364  t.Hungarumlaut = 0xf6cf;
13365  t.Hungarumlautsmall = 0xf6f8;
13366  t.Hzsquare = 0x3390;
13367  t.I = 0x0049;
13368  t.IAcyrillic = 0x042f;
13369  t.IJ = 0x0132;
13370  t.IUcyrillic = 0x042e;
13371  t.Iacute = 0x00cd;
13372  t.Iacutesmall = 0xf7ed;
13373  t.Ibreve = 0x012c;
13374  t.Icaron = 0x01cf;
13375  t.Icircle = 0x24be;
13376  t.Icircumflex = 0x00ce;
13377  t.Icircumflexsmall = 0xf7ee;
13378  t.Icyrillic = 0x0406;
13379  t.Idblgrave = 0x0208;
13380  t.Idieresis = 0x00cf;
13381  t.Idieresisacute = 0x1e2e;
13382  t.Idieresiscyrillic = 0x04e4;
13383  t.Idieresissmall = 0xf7ef;
13384  t.Idot = 0x0130;
13385  t.Idotaccent = 0x0130;
13386  t.Idotbelow = 0x1eca;
13387  t.Iebrevecyrillic = 0x04d6;
13388  t.Iecyrillic = 0x0415;
13389  t.Ifraktur = 0x2111;
13390  t.Igrave = 0x00cc;
13391  t.Igravesmall = 0xf7ec;
13392  t.Ihookabove = 0x1ec8;
13393  t.Iicyrillic = 0x0418;
13394  t.Iinvertedbreve = 0x020a;
13395  t.Iishortcyrillic = 0x0419;
13396  t.Imacron = 0x012a;
13397  t.Imacroncyrillic = 0x04e2;
13398  t.Imonospace = 0xff29;
13399  t.Iniarmenian = 0x053b;
13400  t.Iocyrillic = 0x0401;
13401  t.Iogonek = 0x012e;
13402  t.Iota = 0x0399;
13403  t.Iotaafrican = 0x0196;
13404  t.Iotadieresis = 0x03aa;
13405  t.Iotatonos = 0x038a;
13406  t.Ismall = 0xf769;
13407  t.Istroke = 0x0197;
13408  t.Itilde = 0x0128;
13409  t.Itildebelow = 0x1e2c;
13410  t.Izhitsacyrillic = 0x0474;
13411  t.Izhitsadblgravecyrillic = 0x0476;
13412  t.J = 0x004a;
13413  t.Jaarmenian = 0x0541;
13414  t.Jcircle = 0x24bf;
13415  t.Jcircumflex = 0x0134;
13416  t.Jecyrillic = 0x0408;
13417  t.Jheharmenian = 0x054b;
13418  t.Jmonospace = 0xff2a;
13419  t.Jsmall = 0xf76a;
13420  t.K = 0x004b;
13421  t.KBsquare = 0x3385;
13422  t.KKsquare = 0x33cd;
13423  t.Kabashkircyrillic = 0x04a0;
13424  t.Kacute = 0x1e30;
13425  t.Kacyrillic = 0x041a;
13426  t.Kadescendercyrillic = 0x049a;
13427  t.Kahookcyrillic = 0x04c3;
13428  t.Kappa = 0x039a;
13429  t.Kastrokecyrillic = 0x049e;
13430  t.Kaverticalstrokecyrillic = 0x049c;
13431  t.Kcaron = 0x01e8;
13432  t.Kcedilla = 0x0136;
13433  t.Kcircle = 0x24c0;
13434  t.Kcommaaccent = 0x0136;
13435  t.Kdotbelow = 0x1e32;
13436  t.Keharmenian = 0x0554;
13437  t.Kenarmenian = 0x053f;
13438  t.Khacyrillic = 0x0425;
13439  t.Kheicoptic = 0x03e6;
13440  t.Khook = 0x0198;
13441  t.Kjecyrillic = 0x040c;
13442  t.Klinebelow = 0x1e34;
13443  t.Kmonospace = 0xff2b;
13444  t.Koppacyrillic = 0x0480;
13445  t.Koppagreek = 0x03de;
13446  t.Ksicyrillic = 0x046e;
13447  t.Ksmall = 0xf76b;
13448  t.L = 0x004c;
13449  t.LJ = 0x01c7;
13450  t.LL = 0xf6bf;
13451  t.Lacute = 0x0139;
13452  t.Lambda = 0x039b;
13453  t.Lcaron = 0x013d;
13454  t.Lcedilla = 0x013b;
13455  t.Lcircle = 0x24c1;
13456  t.Lcircumflexbelow = 0x1e3c;
13457  t.Lcommaaccent = 0x013b;
13458  t.Ldot = 0x013f;
13459  t.Ldotaccent = 0x013f;
13460  t.Ldotbelow = 0x1e36;
13461  t.Ldotbelowmacron = 0x1e38;
13462  t.Liwnarmenian = 0x053c;
13463  t.Lj = 0x01c8;
13464  t.Ljecyrillic = 0x0409;
13465  t.Llinebelow = 0x1e3a;
13466  t.Lmonospace = 0xff2c;
13467  t.Lslash = 0x0141;
13468  t.Lslashsmall = 0xf6f9;
13469  t.Lsmall = 0xf76c;
13470  t.M = 0x004d;
13471  t.MBsquare = 0x3386;
13472  t.Macron = 0xf6d0;
13473  t.Macronsmall = 0xf7af;
13474  t.Macute = 0x1e3e;
13475  t.Mcircle = 0x24c2;
13476  t.Mdotaccent = 0x1e40;
13477  t.Mdotbelow = 0x1e42;
13478  t.Menarmenian = 0x0544;
13479  t.Mmonospace = 0xff2d;
13480  t.Msmall = 0xf76d;
13481  t.Mturned = 0x019c;
13482  t.Mu = 0x039c;
13483  t.N = 0x004e;
13484  t.NJ = 0x01ca;
13485  t.Nacute = 0x0143;
13486  t.Ncaron = 0x0147;
13487  t.Ncedilla = 0x0145;
13488  t.Ncircle = 0x24c3;
13489  t.Ncircumflexbelow = 0x1e4a;
13490  t.Ncommaaccent = 0x0145;
13491  t.Ndotaccent = 0x1e44;
13492  t.Ndotbelow = 0x1e46;
13493  t.Nhookleft = 0x019d;
13494  t.Nineroman = 0x2168;
13495  t.Nj = 0x01cb;
13496  t.Njecyrillic = 0x040a;
13497  t.Nlinebelow = 0x1e48;
13498  t.Nmonospace = 0xff2e;
13499  t.Nowarmenian = 0x0546;
13500  t.Nsmall = 0xf76e;
13501  t.Ntilde = 0x00d1;
13502  t.Ntildesmall = 0xf7f1;
13503  t.Nu = 0x039d;
13504  t.O = 0x004f;
13505  t.OE = 0x0152;
13506  t.OEsmall = 0xf6fa;
13507  t.Oacute = 0x00d3;
13508  t.Oacutesmall = 0xf7f3;
13509  t.Obarredcyrillic = 0x04e8;
13510  t.Obarreddieresiscyrillic = 0x04ea;
13511  t.Obreve = 0x014e;
13512  t.Ocaron = 0x01d1;
13513  t.Ocenteredtilde = 0x019f;
13514  t.Ocircle = 0x24c4;
13515  t.Ocircumflex = 0x00d4;
13516  t.Ocircumflexacute = 0x1ed0;
13517  t.Ocircumflexdotbelow = 0x1ed8;
13518  t.Ocircumflexgrave = 0x1ed2;
13519  t.Ocircumflexhookabove = 0x1ed4;
13520  t.Ocircumflexsmall = 0xf7f4;
13521  t.Ocircumflextilde = 0x1ed6;
13522  t.Ocyrillic = 0x041e;
13523  t.Odblacute = 0x0150;
13524  t.Odblgrave = 0x020c;
13525  t.Odieresis = 0x00d6;
13526  t.Odieresiscyrillic = 0x04e6;
13527  t.Odieresissmall = 0xf7f6;
13528  t.Odotbelow = 0x1ecc;
13529  t.Ogoneksmall = 0xf6fb;
13530  t.Ograve = 0x00d2;
13531  t.Ogravesmall = 0xf7f2;
13532  t.Oharmenian = 0x0555;
13533  t.Ohm = 0x2126;
13534  t.Ohookabove = 0x1ece;
13535  t.Ohorn = 0x01a0;
13536  t.Ohornacute = 0x1eda;
13537  t.Ohorndotbelow = 0x1ee2;
13538  t.Ohorngrave = 0x1edc;
13539  t.Ohornhookabove = 0x1ede;
13540  t.Ohorntilde = 0x1ee0;
13541  t.Ohungarumlaut = 0x0150;
13542  t.Oi = 0x01a2;
13543  t.Oinvertedbreve = 0x020e;
13544  t.Omacron = 0x014c;
13545  t.Omacronacute = 0x1e52;
13546  t.Omacrongrave = 0x1e50;
13547  t.Omega = 0x2126;
13548  t.Omegacyrillic = 0x0460;
13549  t.Omegagreek = 0x03a9;
13550  t.Omegaroundcyrillic = 0x047a;
13551  t.Omegatitlocyrillic = 0x047c;
13552  t.Omegatonos = 0x038f;
13553  t.Omicron = 0x039f;
13554  t.Omicrontonos = 0x038c;
13555  t.Omonospace = 0xff2f;
13556  t.Oneroman = 0x2160;
13557  t.Oogonek = 0x01ea;
13558  t.Oogonekmacron = 0x01ec;
13559  t.Oopen = 0x0186;
13560  t.Oslash = 0x00d8;
13561  t.Oslashacute = 0x01fe;
13562  t.Oslashsmall = 0xf7f8;
13563  t.Osmall = 0xf76f;
13564  t.Ostrokeacute = 0x01fe;
13565  t.Otcyrillic = 0x047e;
13566  t.Otilde = 0x00d5;
13567  t.Otildeacute = 0x1e4c;
13568  t.Otildedieresis = 0x1e4e;
13569  t.Otildesmall = 0xf7f5;
13570  t.P = 0x0050;
13571  t.Pacute = 0x1e54;
13572  t.Pcircle = 0x24c5;
13573  t.Pdotaccent = 0x1e56;
13574  t.Pecyrillic = 0x041f;
13575  t.Peharmenian = 0x054a;
13576  t.Pemiddlehookcyrillic = 0x04a6;
13577  t.Phi = 0x03a6;
13578  t.Phook = 0x01a4;
13579  t.Pi = 0x03a0;
13580  t.Piwrarmenian = 0x0553;
13581  t.Pmonospace = 0xff30;
13582  t.Psi = 0x03a8;
13583  t.Psicyrillic = 0x0470;
13584  t.Psmall = 0xf770;
13585  t.Q = 0x0051;
13586  t.Qcircle = 0x24c6;
13587  t.Qmonospace = 0xff31;
13588  t.Qsmall = 0xf771;
13589  t.R = 0x0052;
13590  t.Raarmenian = 0x054c;
13591  t.Racute = 0x0154;
13592  t.Rcaron = 0x0158;
13593  t.Rcedilla = 0x0156;
13594  t.Rcircle = 0x24c7;
13595  t.Rcommaaccent = 0x0156;
13596  t.Rdblgrave = 0x0210;
13597  t.Rdotaccent = 0x1e58;
13598  t.Rdotbelow = 0x1e5a;
13599  t.Rdotbelowmacron = 0x1e5c;
13600  t.Reharmenian = 0x0550;
13601  t.Rfraktur = 0x211c;
13602  t.Rho = 0x03a1;
13603  t.Ringsmall = 0xf6fc;
13604  t.Rinvertedbreve = 0x0212;
13605  t.Rlinebelow = 0x1e5e;
13606  t.Rmonospace = 0xff32;
13607  t.Rsmall = 0xf772;
13608  t.Rsmallinverted = 0x0281;
13609  t.Rsmallinvertedsuperior = 0x02b6;
13610  t.S = 0x0053;
13611  t.SF010000 = 0x250c;
13612  t.SF020000 = 0x2514;
13613  t.SF030000 = 0x2510;
13614  t.SF040000 = 0x2518;
13615  t.SF050000 = 0x253c;
13616  t.SF060000 = 0x252c;
13617  t.SF070000 = 0x2534;
13618  t.SF080000 = 0x251c;
13619  t.SF090000 = 0x2524;
13620  t.SF100000 = 0x2500;
13621  t.SF110000 = 0x2502;
13622  t.SF190000 = 0x2561;
13623  t.SF200000 = 0x2562;
13624  t.SF210000 = 0x2556;
13625  t.SF220000 = 0x2555;
13626  t.SF230000 = 0x2563;
13627  t.SF240000 = 0x2551;
13628  t.SF250000 = 0x2557;
13629  t.SF260000 = 0x255d;
13630  t.SF270000 = 0x255c;
13631  t.SF280000 = 0x255b;
13632  t.SF360000 = 0x255e;
13633  t.SF370000 = 0x255f;
13634  t.SF380000 = 0x255a;
13635  t.SF390000 = 0x2554;
13636  t.SF400000 = 0x2569;
13637  t.SF410000 = 0x2566;
13638  t.SF420000 = 0x2560;
13639  t.SF430000 = 0x2550;
13640  t.SF440000 = 0x256c;
13641  t.SF450000 = 0x2567;
13642  t.SF460000 = 0x2568;
13643  t.SF470000 = 0x2564;
13644  t.SF480000 = 0x2565;
13645  t.SF490000 = 0x2559;
13646  t.SF500000 = 0x2558;
13647  t.SF510000 = 0x2552;
13648  t.SF520000 = 0x2553;
13649  t.SF530000 = 0x256b;
13650  t.SF540000 = 0x256a;
13651  t.Sacute = 0x015a;
13652  t.Sacutedotaccent = 0x1e64;
13653  t.Sampigreek = 0x03e0;
13654  t.Scaron = 0x0160;
13655  t.Scarondotaccent = 0x1e66;
13656  t.Scaronsmall = 0xf6fd;
13657  t.Scedilla = 0x015e;
13658  t.Schwa = 0x018f;
13659  t.Schwacyrillic = 0x04d8;
13660  t.Schwadieresiscyrillic = 0x04da;
13661  t.Scircle = 0x24c8;
13662  t.Scircumflex = 0x015c;
13663  t.Scommaaccent = 0x0218;
13664  t.Sdotaccent = 0x1e60;
13665  t.Sdotbelow = 0x1e62;
13666  t.Sdotbelowdotaccent = 0x1e68;
13667  t.Seharmenian = 0x054d;
13668  t.Sevenroman = 0x2166;
13669  t.Shaarmenian = 0x0547;
13670  t.Shacyrillic = 0x0428;
13671  t.Shchacyrillic = 0x0429;
13672  t.Sheicoptic = 0x03e2;
13673  t.Shhacyrillic = 0x04ba;
13674  t.Shimacoptic = 0x03ec;
13675  t.Sigma = 0x03a3;
13676  t.Sixroman = 0x2165;
13677  t.Smonospace = 0xff33;
13678  t.Softsigncyrillic = 0x042c;
13679  t.Ssmall = 0xf773;
13680  t.Stigmagreek = 0x03da;
13681  t.T = 0x0054;
13682  t.Tau = 0x03a4;
13683  t.Tbar = 0x0166;
13684  t.Tcaron = 0x0164;
13685  t.Tcedilla = 0x0162;
13686  t.Tcircle = 0x24c9;
13687  t.Tcircumflexbelow = 0x1e70;
13688  t.Tcommaaccent = 0x0162;
13689  t.Tdotaccent = 0x1e6a;
13690  t.Tdotbelow = 0x1e6c;
13691  t.Tecyrillic = 0x0422;
13692  t.Tedescendercyrillic = 0x04ac;
13693  t.Tenroman = 0x2169;
13694  t.Tetsecyrillic = 0x04b4;
13695  t.Theta = 0x0398;
13696  t.Thook = 0x01ac;
13697  t.Thorn = 0x00de;
13698  t.Thornsmall = 0xf7fe;
13699  t.Threeroman = 0x2162;
13700  t.Tildesmall = 0xf6fe;
13701  t.Tiwnarmenian = 0x054f;
13702  t.Tlinebelow = 0x1e6e;
13703  t.Tmonospace = 0xff34;
13704  t.Toarmenian = 0x0539;
13705  t.Tonefive = 0x01bc;
13706  t.Tonesix = 0x0184;
13707  t.Tonetwo = 0x01a7;
13708  t.Tretroflexhook = 0x01ae;
13709  t.Tsecyrillic = 0x0426;
13710  t.Tshecyrillic = 0x040b;
13711  t.Tsmall = 0xf774;
13712  t.Twelveroman = 0x216b;
13713  t.Tworoman = 0x2161;
13714  t.U = 0x0055;
13715  t.Uacute = 0x00da;
13716  t.Uacutesmall = 0xf7fa;
13717  t.Ubreve = 0x016c;
13718  t.Ucaron = 0x01d3;
13719  t.Ucircle = 0x24ca;
13720  t.Ucircumflex = 0x00db;
13721  t.Ucircumflexbelow = 0x1e76;
13722  t.Ucircumflexsmall = 0xf7fb;
13723  t.Ucyrillic = 0x0423;
13724  t.Udblacute = 0x0170;
13725  t.Udblgrave = 0x0214;
13726  t.Udieresis = 0x00dc;
13727  t.Udieresisacute = 0x01d7;
13728  t.Udieresisbelow = 0x1e72;
13729  t.Udieresiscaron = 0x01d9;
13730  t.Udieresiscyrillic = 0x04f0;
13731  t.Udieresisgrave = 0x01db;
13732  t.Udieresismacron = 0x01d5;
13733  t.Udieresissmall = 0xf7fc;
13734  t.Udotbelow = 0x1ee4;
13735  t.Ugrave = 0x00d9;
13736  t.Ugravesmall = 0xf7f9;
13737  t.Uhookabove = 0x1ee6;
13738  t.Uhorn = 0x01af;
13739  t.Uhornacute = 0x1ee8;
13740  t.Uhorndotbelow = 0x1ef0;
13741  t.Uhorngrave = 0x1eea;
13742  t.Uhornhookabove = 0x1eec;
13743  t.Uhorntilde = 0x1eee;
13744  t.Uhungarumlaut = 0x0170;
13745  t.Uhungarumlautcyrillic = 0x04f2;
13746  t.Uinvertedbreve = 0x0216;
13747  t.Ukcyrillic = 0x0478;
13748  t.Umacron = 0x016a;
13749  t.Umacroncyrillic = 0x04ee;
13750  t.Umacrondieresis = 0x1e7a;
13751  t.Umonospace = 0xff35;
13752  t.Uogonek = 0x0172;
13753  t.Upsilon = 0x03a5;
13754  t.Upsilon1 = 0x03d2;
13755  t.Upsilonacutehooksymbolgreek = 0x03d3;
13756  t.Upsilonafrican = 0x01b1;
13757  t.Upsilondieresis = 0x03ab;
13758  t.Upsilondieresishooksymbolgreek = 0x03d4;
13759  t.Upsilonhooksymbol = 0x03d2;
13760  t.Upsilontonos = 0x038e;
13761  t.Uring = 0x016e;
13762  t.Ushortcyrillic = 0x040e;
13763  t.Usmall = 0xf775;
13764  t.Ustraightcyrillic = 0x04ae;
13765  t.Ustraightstrokecyrillic = 0x04b0;
13766  t.Utilde = 0x0168;
13767  t.Utildeacute = 0x1e78;
13768  t.Utildebelow = 0x1e74;
13769  t.V = 0x0056;
13770  t.Vcircle = 0x24cb;
13771  t.Vdotbelow = 0x1e7e;
13772  t.Vecyrillic = 0x0412;
13773  t.Vewarmenian = 0x054e;
13774  t.Vhook = 0x01b2;
13775  t.Vmonospace = 0xff36;
13776  t.Voarmenian = 0x0548;
13777  t.Vsmall = 0xf776;
13778  t.Vtilde = 0x1e7c;
13779  t.W = 0x0057;
13780  t.Wacute = 0x1e82;
13781  t.Wcircle = 0x24cc;
13782  t.Wcircumflex = 0x0174;
13783  t.Wdieresis = 0x1e84;
13784  t.Wdotaccent = 0x1e86;
13785  t.Wdotbelow = 0x1e88;
13786  t.Wgrave = 0x1e80;
13787  t.Wmonospace = 0xff37;
13788  t.Wsmall = 0xf777;
13789  t.X = 0x0058;
13790  t.Xcircle = 0x24cd;
13791  t.Xdieresis = 0x1e8c;
13792  t.Xdotaccent = 0x1e8a;
13793  t.Xeharmenian = 0x053d;
13794  t.Xi = 0x039e;
13795  t.Xmonospace = 0xff38;
13796  t.Xsmall = 0xf778;
13797  t.Y = 0x0059;
13798  t.Yacute = 0x00dd;
13799  t.Yacutesmall = 0xf7fd;
13800  t.Yatcyrillic = 0x0462;
13801  t.Ycircle = 0x24ce;
13802  t.Ycircumflex = 0x0176;
13803  t.Ydieresis = 0x0178;
13804  t.Ydieresissmall = 0xf7ff;
13805  t.Ydotaccent = 0x1e8e;
13806  t.Ydotbelow = 0x1ef4;
13807  t.Yericyrillic = 0x042b;
13808  t.Yerudieresiscyrillic = 0x04f8;
13809  t.Ygrave = 0x1ef2;
13810  t.Yhook = 0x01b3;
13811  t.Yhookabove = 0x1ef6;
13812  t.Yiarmenian = 0x0545;
13813  t.Yicyrillic = 0x0407;
13814  t.Yiwnarmenian = 0x0552;
13815  t.Ymonospace = 0xff39;
13816  t.Ysmall = 0xf779;
13817  t.Ytilde = 0x1ef8;
13818  t.Yusbigcyrillic = 0x046a;
13819  t.Yusbigiotifiedcyrillic = 0x046c;
13820  t.Yuslittlecyrillic = 0x0466;
13821  t.Yuslittleiotifiedcyrillic = 0x0468;
13822  t.Z = 0x005a;
13823  t.Zaarmenian = 0x0536;
13824  t.Zacute = 0x0179;
13825  t.Zcaron = 0x017d;
13826  t.Zcaronsmall = 0xf6ff;
13827  t.Zcircle = 0x24cf;
13828  t.Zcircumflex = 0x1e90;
13829  t.Zdot = 0x017b;
13830  t.Zdotaccent = 0x017b;
13831  t.Zdotbelow = 0x1e92;
13832  t.Zecyrillic = 0x0417;
13833  t.Zedescendercyrillic = 0x0498;
13834  t.Zedieresiscyrillic = 0x04de;
13835  t.Zeta = 0x0396;
13836  t.Zhearmenian = 0x053a;
13837  t.Zhebrevecyrillic = 0x04c1;
13838  t.Zhecyrillic = 0x0416;
13839  t.Zhedescendercyrillic = 0x0496;
13840  t.Zhedieresiscyrillic = 0x04dc;
13841  t.Zlinebelow = 0x1e94;
13842  t.Zmonospace = 0xff3a;
13843  t.Zsmall = 0xf77a;
13844  t.Zstroke = 0x01b5;
13845  t.a = 0x0061;
13846  t.aabengali = 0x0986;
13847  t.aacute = 0x00e1;
13848  t.aadeva = 0x0906;
13849  t.aagujarati = 0x0a86;
13850  t.aagurmukhi = 0x0a06;
13851  t.aamatragurmukhi = 0x0a3e;
13852  t.aarusquare = 0x3303;
13853  t.aavowelsignbengali = 0x09be;
13854  t.aavowelsigndeva = 0x093e;
13855  t.aavowelsigngujarati = 0x0abe;
13856  t.abbreviationmarkarmenian = 0x055f;
13857  t.abbreviationsigndeva = 0x0970;
13858  t.abengali = 0x0985;
13859  t.abopomofo = 0x311a;
13860  t.abreve = 0x0103;
13861  t.abreveacute = 0x1eaf;
13862  t.abrevecyrillic = 0x04d1;
13863  t.abrevedotbelow = 0x1eb7;
13864  t.abrevegrave = 0x1eb1;
13865  t.abrevehookabove = 0x1eb3;
13866  t.abrevetilde = 0x1eb5;
13867  t.acaron = 0x01ce;
13868  t.acircle = 0x24d0;
13869  t.acircumflex = 0x00e2;
13870  t.acircumflexacute = 0x1ea5;
13871  t.acircumflexdotbelow = 0x1ead;
13872  t.acircumflexgrave = 0x1ea7;
13873  t.acircumflexhookabove = 0x1ea9;
13874  t.acircumflextilde = 0x1eab;
13875  t.acute = 0x00b4;
13876  t.acutebelowcmb = 0x0317;
13877  t.acutecmb = 0x0301;
13878  t.acutecomb = 0x0301;
13879  t.acutedeva = 0x0954;
13880  t.acutelowmod = 0x02cf;
13881  t.acutetonecmb = 0x0341;
13882  t.acyrillic = 0x0430;
13883  t.adblgrave = 0x0201;
13884  t.addakgurmukhi = 0x0a71;
13885  t.adeva = 0x0905;
13886  t.adieresis = 0x00e4;
13887  t.adieresiscyrillic = 0x04d3;
13888  t.adieresismacron = 0x01df;
13889  t.adotbelow = 0x1ea1;
13890  t.adotmacron = 0x01e1;
13891  t.ae = 0x00e6;
13892  t.aeacute = 0x01fd;
13893  t.aekorean = 0x3150;
13894  t.aemacron = 0x01e3;
13895  t.afii00208 = 0x2015;
13896  t.afii08941 = 0x20a4;
13897  t.afii10017 = 0x0410;
13898  t.afii10018 = 0x0411;
13899  t.afii10019 = 0x0412;
13900  t.afii10020 = 0x0413;
13901  t.afii10021 = 0x0414;
13902  t.afii10022 = 0x0415;
13903  t.afii10023 = 0x0401;
13904  t.afii10024 = 0x0416;
13905  t.afii10025 = 0x0417;
13906  t.afii10026 = 0x0418;
13907  t.afii10027 = 0x0419;
13908  t.afii10028 = 0x041a;
13909  t.afii10029 = 0x041b;
13910  t.afii10030 = 0x041c;
13911  t.afii10031 = 0x041d;
13912  t.afii10032 = 0x041e;
13913  t.afii10033 = 0x041f;
13914  t.afii10034 = 0x0420;
13915  t.afii10035 = 0x0421;
13916  t.afii10036 = 0x0422;
13917  t.afii10037 = 0x0423;
13918  t.afii10038 = 0x0424;
13919  t.afii10039 = 0x0425;
13920  t.afii10040 = 0x0426;
13921  t.afii10041 = 0x0427;
13922  t.afii10042 = 0x0428;
13923  t.afii10043 = 0x0429;
13924  t.afii10044 = 0x042a;
13925  t.afii10045 = 0x042b;
13926  t.afii10046 = 0x042c;
13927  t.afii10047 = 0x042d;
13928  t.afii10048 = 0x042e;
13929  t.afii10049 = 0x042f;
13930  t.afii10050 = 0x0490;
13931  t.afii10051 = 0x0402;
13932  t.afii10052 = 0x0403;
13933  t.afii10053 = 0x0404;
13934  t.afii10054 = 0x0405;
13935  t.afii10055 = 0x0406;
13936  t.afii10056 = 0x0407;
13937  t.afii10057 = 0x0408;
13938  t.afii10058 = 0x0409;
13939  t.afii10059 = 0x040a;
13940  t.afii10060 = 0x040b;
13941  t.afii10061 = 0x040c;
13942  t.afii10062 = 0x040e;
13943  t.afii10063 = 0xf6c4;
13944  t.afii10064 = 0xf6c5;
13945  t.afii10065 = 0x0430;
13946  t.afii10066 = 0x0431;
13947  t.afii10067 = 0x0432;
13948  t.afii10068 = 0x0433;
13949  t.afii10069 = 0x0434;
13950  t.afii10070 = 0x0435;
13951  t.afii10071 = 0x0451;
13952  t.afii10072 = 0x0436;
13953  t.afii10073 = 0x0437;
13954  t.afii10074 = 0x0438;
13955  t.afii10075 = 0x0439;
13956  t.afii10076 = 0x043a;
13957  t.afii10077 = 0x043b;
13958  t.afii10078 = 0x043c;
13959  t.afii10079 = 0x043d;
13960  t.afii10080 = 0x043e;
13961  t.afii10081 = 0x043f;
13962  t.afii10082 = 0x0440;
13963  t.afii10083 = 0x0441;
13964  t.afii10084 = 0x0442;
13965  t.afii10085 = 0x0443;
13966  t.afii10086 = 0x0444;
13967  t.afii10087 = 0x0445;
13968  t.afii10088 = 0x0446;
13969  t.afii10089 = 0x0447;
13970  t.afii10090 = 0x0448;
13971  t.afii10091 = 0x0449;
13972  t.afii10092 = 0x044a;
13973  t.afii10093 = 0x044b;
13974  t.afii10094 = 0x044c;
13975  t.afii10095 = 0x044d;
13976  t.afii10096 = 0x044e;
13977  t.afii10097 = 0x044f;
13978  t.afii10098 = 0x0491;
13979  t.afii10099 = 0x0452;
13980  t.afii10100 = 0x0453;
13981  t.afii10101 = 0x0454;
13982  t.afii10102 = 0x0455;
13983  t.afii10103 = 0x0456;
13984  t.afii10104 = 0x0457;
13985  t.afii10105 = 0x0458;
13986  t.afii10106 = 0x0459;
13987  t.afii10107 = 0x045a;
13988  t.afii10108 = 0x045b;
13989  t.afii10109 = 0x045c;
13990  t.afii10110 = 0x045e;
13991  t.afii10145 = 0x040f;
13992  t.afii10146 = 0x0462;
13993  t.afii10147 = 0x0472;
13994  t.afii10148 = 0x0474;
13995  t.afii10192 = 0xf6c6;
13996  t.afii10193 = 0x045f;
13997  t.afii10194 = 0x0463;
13998  t.afii10195 = 0x0473;
13999  t.afii10196 = 0x0475;
14000  t.afii10831 = 0xf6c7;
14001  t.afii10832 = 0xf6c8;
14002  t.afii10846 = 0x04d9;
14003  t.afii299 = 0x200e;
14004  t.afii300 = 0x200f;
14005  t.afii301 = 0x200d;
14006  t.afii57381 = 0x066a;
14007  t.afii57388 = 0x060c;
14008  t.afii57392 = 0x0660;
14009  t.afii57393 = 0x0661;
14010  t.afii57394 = 0x0662;
14011  t.afii57395 = 0x0663;
14012  t.afii57396 = 0x0664;
14013  t.afii57397 = 0x0665;
14014  t.afii57398 = 0x0666;
14015  t.afii57399 = 0x0667;
14016  t.afii57400 = 0x0668;
14017  t.afii57401 = 0x0669;
14018  t.afii57403 = 0x061b;
14019  t.afii57407 = 0x061f;
14020  t.afii57409 = 0x0621;
14021  t.afii57410 = 0x0622;
14022  t.afii57411 = 0x0623;
14023  t.afii57412 = 0x0624;
14024  t.afii57413 = 0x0625;
14025  t.afii57414 = 0x0626;
14026  t.afii57415 = 0x0627;
14027  t.afii57416 = 0x0628;
14028  t.afii57417 = 0x0629;
14029  t.afii57418 = 0x062a;
14030  t.afii57419 = 0x062b;
14031  t.afii57420 = 0x062c;
14032  t.afii57421 = 0x062d;
14033  t.afii57422 = 0x062e;
14034  t.afii57423 = 0x062f;
14035  t.afii57424 = 0x0630;
14036  t.afii57425 = 0x0631;
14037  t.afii57426 = 0x0632;
14038  t.afii57427 = 0x0633;
14039  t.afii57428 = 0x0634;
14040  t.afii57429 = 0x0635;
14041  t.afii57430 = 0x0636;
14042  t.afii57431 = 0x0637;
14043  t.afii57432 = 0x0638;
14044  t.afii57433 = 0x0639;
14045  t.afii57434 = 0x063a;
14046  t.afii57440 = 0x0640;
14047  t.afii57441 = 0x0641;
14048  t.afii57442 = 0x0642;
14049  t.afii57443 = 0x0643;
14050  t.afii57444 = 0x0644;
14051  t.afii57445 = 0x0645;
14052  t.afii57446 = 0x0646;
14053  t.afii57448 = 0x0648;
14054  t.afii57449 = 0x0649;
14055  t.afii57450 = 0x064a;
14056  t.afii57451 = 0x064b;
14057  t.afii57452 = 0x064c;
14058  t.afii57453 = 0x064d;
14059  t.afii57454 = 0x064e;
14060  t.afii57455 = 0x064f;
14061  t.afii57456 = 0x0650;
14062  t.afii57457 = 0x0651;
14063  t.afii57458 = 0x0652;
14064  t.afii57470 = 0x0647;
14065  t.afii57505 = 0x06a4;
14066  t.afii57506 = 0x067e;
14067  t.afii57507 = 0x0686;
14068  t.afii57508 = 0x0698;
14069  t.afii57509 = 0x06af;
14070  t.afii57511 = 0x0679;
14071  t.afii57512 = 0x0688;
14072  t.afii57513 = 0x0691;
14073  t.afii57514 = 0x06ba;
14074  t.afii57519 = 0x06d2;
14075  t.afii57534 = 0x06d5;
14076  t.afii57636 = 0x20aa;
14077  t.afii57645 = 0x05be;
14078  t.afii57658 = 0x05c3;
14079  t.afii57664 = 0x05d0;
14080  t.afii57665 = 0x05d1;
14081  t.afii57666 = 0x05d2;
14082  t.afii57667 = 0x05d3;
14083  t.afii57668 = 0x05d4;
14084  t.afii57669 = 0x05d5;
14085  t.afii57670 = 0x05d6;
14086  t.afii57671 = 0x05d7;
14087  t.afii57672 = 0x05d8;
14088  t.afii57673 = 0x05d9;
14089  t.afii57674 = 0x05da;
14090  t.afii57675 = 0x05db;
14091  t.afii57676 = 0x05dc;
14092  t.afii57677 = 0x05dd;
14093  t.afii57678 = 0x05de;
14094  t.afii57679 = 0x05df;
14095  t.afii57680 = 0x05e0;
14096  t.afii57681 = 0x05e1;
14097  t.afii57682 = 0x05e2;
14098  t.afii57683 = 0x05e3;
14099  t.afii57684 = 0x05e4;
14100  t.afii57685 = 0x05e5;
14101  t.afii57686 = 0x05e6;
14102  t.afii57687 = 0x05e7;
14103  t.afii57688 = 0x05e8;
14104  t.afii57689 = 0x05e9;
14105  t.afii57690 = 0x05ea;
14106  t.afii57694 = 0xfb2a;
14107  t.afii57695 = 0xfb2b;
14108  t.afii57700 = 0xfb4b;
14109  t.afii57705 = 0xfb1f;
14110  t.afii57716 = 0x05f0;
14111  t.afii57717 = 0x05f1;
14112  t.afii57718 = 0x05f2;
14113  t.afii57723 = 0xfb35;
14114  t.afii57793 = 0x05b4;
14115  t.afii57794 = 0x05b5;
14116  t.afii57795 = 0x05b6;
14117  t.afii57796 = 0x05bb;
14118  t.afii57797 = 0x05b8;
14119  t.afii57798 = 0x05b7;
14120  t.afii57799 = 0x05b0;
14121  t.afii57800 = 0x05b2;
14122  t.afii57801 = 0x05b1;
14123  t.afii57802 = 0x05b3;
14124  t.afii57803 = 0x05c2;
14125  t.afii57804 = 0x05c1;
14126  t.afii57806 = 0x05b9;
14127  t.afii57807 = 0x05bc;
14128  t.afii57839 = 0x05bd;
14129  t.afii57841 = 0x05bf;
14130  t.afii57842 = 0x05c0;
14131  t.afii57929 = 0x02bc;
14132  t.afii61248 = 0x2105;
14133  t.afii61289 = 0x2113;
14134  t.afii61352 = 0x2116;
14135  t.afii61573 = 0x202c;
14136  t.afii61574 = 0x202d;
14137  t.afii61575 = 0x202e;
14138  t.afii61664 = 0x200c;
14139  t.afii63167 = 0x066d;
14140  t.afii64937 = 0x02bd;
14141  t.agrave = 0x00e0;
14142  t.agujarati = 0x0a85;
14143  t.agurmukhi = 0x0a05;
14144  t.ahiragana = 0x3042;
14145  t.ahookabove = 0x1ea3;
14146  t.aibengali = 0x0990;
14147  t.aibopomofo = 0x311e;
14148  t.aideva = 0x0910;
14149  t.aiecyrillic = 0x04d5;
14150  t.aigujarati = 0x0a90;
14151  t.aigurmukhi = 0x0a10;
14152  t.aimatragurmukhi = 0x0a48;
14153  t.ainarabic = 0x0639;
14154  t.ainfinalarabic = 0xfeca;
14155  t.aininitialarabic = 0xfecb;
14156  t.ainmedialarabic = 0xfecc;
14157  t.ainvertedbreve = 0x0203;
14158  t.aivowelsignbengali = 0x09c8;
14159  t.aivowelsigndeva = 0x0948;
14160  t.aivowelsigngujarati = 0x0ac8;
14161  t.akatakana = 0x30a2;
14162  t.akatakanahalfwidth = 0xff71;
14163  t.akorean = 0x314f;
14164  t.alef = 0x05d0;
14165  t.alefarabic = 0x0627;
14166  t.alefdageshhebrew = 0xfb30;
14167  t.aleffinalarabic = 0xfe8e;
14168  t.alefhamzaabovearabic = 0x0623;
14169  t.alefhamzaabovefinalarabic = 0xfe84;
14170  t.alefhamzabelowarabic = 0x0625;
14171  t.alefhamzabelowfinalarabic = 0xfe88;
14172  t.alefhebrew = 0x05d0;
14173  t.aleflamedhebrew = 0xfb4f;
14174  t.alefmaddaabovearabic = 0x0622;
14175  t.alefmaddaabovefinalarabic = 0xfe82;
14176  t.alefmaksuraarabic = 0x0649;
14177  t.alefmaksurafinalarabic = 0xfef0;
14178  t.alefmaksurainitialarabic = 0xfef3;
14179  t.alefmaksuramedialarabic = 0xfef4;
14180  t.alefpatahhebrew = 0xfb2e;
14181  t.alefqamatshebrew = 0xfb2f;
14182  t.aleph = 0x2135;
14183  t.allequal = 0x224c;
14184  t.alpha = 0x03b1;
14185  t.alphatonos = 0x03ac;
14186  t.amacron = 0x0101;
14187  t.amonospace = 0xff41;
14188  t.ampersand = 0x0026;
14189  t.ampersandmonospace = 0xff06;
14190  t.ampersandsmall = 0xf726;
14191  t.amsquare = 0x33c2;
14192  t.anbopomofo = 0x3122;
14193  t.angbopomofo = 0x3124;
14194  t.angbracketleft = 0x3008;
14195  t.angbracketright = 0x3009;
14196  t.angkhankhuthai = 0x0e5a;
14197  t.angle = 0x2220;
14198  t.anglebracketleft = 0x3008;
14199  t.anglebracketleftvertical = 0xfe3f;
14200  t.anglebracketright = 0x3009;
14201  t.anglebracketrightvertical = 0xfe40;
14202  t.angleleft = 0x2329;
14203  t.angleright = 0x232a;
14204  t.angstrom = 0x212b;
14205  t.anoteleia = 0x0387;
14206  t.anudattadeva = 0x0952;
14207  t.anusvarabengali = 0x0982;
14208  t.anusvaradeva = 0x0902;
14209  t.anusvaragujarati = 0x0a82;
14210  t.aogonek = 0x0105;
14211  t.apaatosquare = 0x3300;
14212  t.aparen = 0x249c;
14213  t.apostrophearmenian = 0x055a;
14214  t.apostrophemod = 0x02bc;
14215  t.apple = 0xf8ff;
14216  t.approaches = 0x2250;
14217  t.approxequal = 0x2248;
14218  t.approxequalorimage = 0x2252;
14219  t.approximatelyequal = 0x2245;
14220  t.araeaekorean = 0x318e;
14221  t.araeakorean = 0x318d;
14222  t.arc = 0x2312;
14223  t.arighthalfring = 0x1e9a;
14224  t.aring = 0x00e5;
14225  t.aringacute = 0x01fb;
14226  t.aringbelow = 0x1e01;
14227  t.arrowboth = 0x2194;
14228  t.arrowdashdown = 0x21e3;
14229  t.arrowdashleft = 0x21e0;
14230  t.arrowdashright = 0x21e2;
14231  t.arrowdashup = 0x21e1;
14232  t.arrowdblboth = 0x21d4;
14233  t.arrowdbldown = 0x21d3;
14234  t.arrowdblleft = 0x21d0;
14235  t.arrowdblright = 0x21d2;
14236  t.arrowdblup = 0x21d1;
14237  t.arrowdown = 0x2193;
14238  t.arrowdownleft = 0x2199;
14239  t.arrowdownright = 0x2198;
14240  t.arrowdownwhite = 0x21e9;
14241  t.arrowheaddownmod = 0x02c5;
14242  t.arrowheadleftmod = 0x02c2;
14243  t.arrowheadrightmod = 0x02c3;
14244  t.arrowheadupmod = 0x02c4;
14245  t.arrowhorizex = 0xf8e7;
14246  t.arrowleft = 0x2190;
14247  t.arrowleftdbl = 0x21d0;
14248  t.arrowleftdblstroke = 0x21cd;
14249  t.arrowleftoverright = 0x21c6;
14250  t.arrowleftwhite = 0x21e6;
14251  t.arrowright = 0x2192;
14252  t.arrowrightdblstroke = 0x21cf;
14253  t.arrowrightheavy = 0x279e;
14254  t.arrowrightoverleft = 0x21c4;
14255  t.arrowrightwhite = 0x21e8;
14256  t.arrowtableft = 0x21e4;
14257  t.arrowtabright = 0x21e5;
14258  t.arrowup = 0x2191;
14259  t.arrowupdn = 0x2195;
14260  t.arrowupdnbse = 0x21a8;
14261  t.arrowupdownbase = 0x21a8;
14262  t.arrowupleft = 0x2196;
14263  t.arrowupleftofdown = 0x21c5;
14264  t.arrowupright = 0x2197;
14265  t.arrowupwhite = 0x21e7;
14266  t.arrowvertex = 0xf8e6;
14267  t.asciicircum = 0x005e;
14268  t.asciicircummonospace = 0xff3e;
14269  t.asciitilde = 0x007e;
14270  t.asciitildemonospace = 0xff5e;
14271  t.ascript = 0x0251;
14272  t.ascriptturned = 0x0252;
14273  t.asmallhiragana = 0x3041;
14274  t.asmallkatakana = 0x30a1;
14275  t.asmallkatakanahalfwidth = 0xff67;
14276  t.asterisk = 0x002a;
14277  t.asteriskaltonearabic = 0x066d;
14278  t.asteriskarabic = 0x066d;
14279  t.asteriskmath = 0x2217;
14280  t.asteriskmonospace = 0xff0a;
14281  t.asterisksmall = 0xfe61;
14282  t.asterism = 0x2042;
14283  t.asuperior = 0xf6e9;
14284  t.asymptoticallyequal = 0x2243;
14285  t.at = 0x0040;
14286  t.atilde = 0x00e3;
14287  t.atmonospace = 0xff20;
14288  t.atsmall = 0xfe6b;
14289  t.aturned = 0x0250;
14290  t.aubengali = 0x0994;
14291  t.aubopomofo = 0x3120;
14292  t.audeva = 0x0914;
14293  t.augujarati = 0x0a94;
14294  t.augurmukhi = 0x0a14;
14295  t.aulengthmarkbengali = 0x09d7;
14296  t.aumatragurmukhi = 0x0a4c;
14297  t.auvowelsignbengali = 0x09cc;
14298  t.auvowelsigndeva = 0x094c;
14299  t.auvowelsigngujarati = 0x0acc;
14300  t.avagrahadeva = 0x093d;
14301  t.aybarmenian = 0x0561;
14302  t.ayin = 0x05e2;
14303  t.ayinaltonehebrew = 0xfb20;
14304  t.ayinhebrew = 0x05e2;
14305  t.b = 0x0062;
14306  t.babengali = 0x09ac;
14307  t.backslash = 0x005c;
14308  t.backslashmonospace = 0xff3c;
14309  t.badeva = 0x092c;
14310  t.bagujarati = 0x0aac;
14311  t.bagurmukhi = 0x0a2c;
14312  t.bahiragana = 0x3070;
14313  t.bahtthai = 0x0e3f;
14314  t.bakatakana = 0x30d0;
14315  t.bar = 0x007c;
14316  t.barmonospace = 0xff5c;
14317  t.bbopomofo = 0x3105;
14318  t.bcircle = 0x24d1;
14319  t.bdotaccent = 0x1e03;
14320  t.bdotbelow = 0x1e05;
14321  t.beamedsixteenthnotes = 0x266c;
14322  t.because = 0x2235;
14323  t.becyrillic = 0x0431;
14324  t.beharabic = 0x0628;
14325  t.behfinalarabic = 0xfe90;
14326  t.behinitialarabic = 0xfe91;
14327  t.behiragana = 0x3079;
14328  t.behmedialarabic = 0xfe92;
14329  t.behmeeminitialarabic = 0xfc9f;
14330  t.behmeemisolatedarabic = 0xfc08;
14331  t.behnoonfinalarabic = 0xfc6d;
14332  t.bekatakana = 0x30d9;
14333  t.benarmenian = 0x0562;
14334  t.bet = 0x05d1;
14335  t.beta = 0x03b2;
14336  t.betasymbolgreek = 0x03d0;
14337  t.betdagesh = 0xfb31;
14338  t.betdageshhebrew = 0xfb31;
14339  t.bethebrew = 0x05d1;
14340  t.betrafehebrew = 0xfb4c;
14341  t.bhabengali = 0x09ad;
14342  t.bhadeva = 0x092d;
14343  t.bhagujarati = 0x0aad;
14344  t.bhagurmukhi = 0x0a2d;
14345  t.bhook = 0x0253;
14346  t.bihiragana = 0x3073;
14347  t.bikatakana = 0x30d3;
14348  t.bilabialclick = 0x0298;
14349  t.bindigurmukhi = 0x0a02;
14350  t.birusquare = 0x3331;
14351  t.blackcircle = 0x25cf;
14352  t.blackdiamond = 0x25c6;
14353  t.blackdownpointingtriangle = 0x25bc;
14354  t.blackleftpointingpointer = 0x25c4;
14355  t.blackleftpointingtriangle = 0x25c0;
14356  t.blacklenticularbracketleft = 0x3010;
14357  t.blacklenticularbracketleftvertical = 0xfe3b;
14358  t.blacklenticularbracketright = 0x3011;
14359  t.blacklenticularbracketrightvertical = 0xfe3c;
14360  t.blacklowerlefttriangle = 0x25e3;
14361  t.blacklowerrighttriangle = 0x25e2;
14362  t.blackrectangle = 0x25ac;
14363  t.blackrightpointingpointer = 0x25ba;
14364  t.blackrightpointingtriangle = 0x25b6;
14365  t.blacksmallsquare = 0x25aa;
14366  t.blacksmilingface = 0x263b;
14367  t.blacksquare = 0x25a0;
14368  t.blackstar = 0x2605;
14369  t.blackupperlefttriangle = 0x25e4;
14370  t.blackupperrighttriangle = 0x25e5;
14371  t.blackuppointingsmalltriangle = 0x25b4;
14372  t.blackuppointingtriangle = 0x25b2;
14373  t.blank = 0x2423;
14374  t.blinebelow = 0x1e07;
14375  t.block = 0x2588;
14376  t.bmonospace = 0xff42;
14377  t.bobaimaithai = 0x0e1a;
14378  t.bohiragana = 0x307c;
14379  t.bokatakana = 0x30dc;
14380  t.bparen = 0x249d;
14381  t.bqsquare = 0x33c3;
14382  t.braceex = 0xf8f4;
14383  t.braceleft = 0x007b;
14384  t.braceleftbt = 0xf8f3;
14385  t.braceleftmid = 0xf8f2;
14386  t.braceleftmonospace = 0xff5b;
14387  t.braceleftsmall = 0xfe5b;
14388  t.bracelefttp = 0xf8f1;
14389  t.braceleftvertical = 0xfe37;
14390  t.braceright = 0x007d;
14391  t.bracerightbt = 0xf8fe;
14392  t.bracerightmid = 0xf8fd;
14393  t.bracerightmonospace = 0xff5d;
14394  t.bracerightsmall = 0xfe5c;
14395  t.bracerighttp = 0xf8fc;
14396  t.bracerightvertical = 0xfe38;
14397  t.bracketleft = 0x005b;
14398  t.bracketleftbt = 0xf8f0;
14399  t.bracketleftex = 0xf8ef;
14400  t.bracketleftmonospace = 0xff3b;
14401  t.bracketlefttp = 0xf8ee;
14402  t.bracketright = 0x005d;
14403  t.bracketrightbt = 0xf8fb;
14404  t.bracketrightex = 0xf8fa;
14405  t.bracketrightmonospace = 0xff3d;
14406  t.bracketrighttp = 0xf8f9;
14407  t.breve = 0x02d8;
14408  t.brevebelowcmb = 0x032e;
14409  t.brevecmb = 0x0306;
14410  t.breveinvertedbelowcmb = 0x032f;
14411  t.breveinvertedcmb = 0x0311;
14412  t.breveinverteddoublecmb = 0x0361;
14413  t.bridgebelowcmb = 0x032a;
14414  t.bridgeinvertedbelowcmb = 0x033a;
14415  t.brokenbar = 0x00a6;
14416  t.bstroke = 0x0180;
14417  t.bsuperior = 0xf6ea;
14418  t.btopbar = 0x0183;
14419  t.buhiragana = 0x3076;
14420  t.bukatakana = 0x30d6;
14421  t.bullet = 0x2022;
14422  t.bulletinverse = 0x25d8;
14423  t.bulletoperator = 0x2219;
14424  t.bullseye = 0x25ce;
14425  t.c = 0x0063;
14426  t.caarmenian = 0x056e;
14427  t.cabengali = 0x099a;
14428  t.cacute = 0x0107;
14429  t.cadeva = 0x091a;
14430  t.cagujarati = 0x0a9a;
14431  t.cagurmukhi = 0x0a1a;
14432  t.calsquare = 0x3388;
14433  t.candrabindubengali = 0x0981;
14434  t.candrabinducmb = 0x0310;
14435  t.candrabindudeva = 0x0901;
14436  t.candrabindugujarati = 0x0a81;
14437  t.capslock = 0x21ea;
14438  t.careof = 0x2105;
14439  t.caron = 0x02c7;
14440  t.caronbelowcmb = 0x032c;
14441  t.caroncmb = 0x030c;
14442  t.carriagereturn = 0x21b5;
14443  t.cbopomofo = 0x3118;
14444  t.ccaron = 0x010d;
14445  t.ccedilla = 0x00e7;
14446  t.ccedillaacute = 0x1e09;
14447  t.ccircle = 0x24d2;
14448  t.ccircumflex = 0x0109;
14449  t.ccurl = 0x0255;
14450  t.cdot = 0x010b;
14451  t.cdotaccent = 0x010b;
14452  t.cdsquare = 0x33c5;
14453  t.cedilla = 0x00b8;
14454  t.cedillacmb = 0x0327;
14455  t.cent = 0x00a2;
14456  t.centigrade = 0x2103;
14457  t.centinferior = 0xf6df;
14458  t.centmonospace = 0xffe0;
14459  t.centoldstyle = 0xf7a2;
14460  t.centsuperior = 0xf6e0;
14461  t.chaarmenian = 0x0579;
14462  t.chabengali = 0x099b;
14463  t.chadeva = 0x091b;
14464  t.chagujarati = 0x0a9b;
14465  t.chagurmukhi = 0x0a1b;
14466  t.chbopomofo = 0x3114;
14467  t.cheabkhasiancyrillic = 0x04bd;
14468  t.checkmark = 0x2713;
14469  t.checyrillic = 0x0447;
14470  t.chedescenderabkhasiancyrillic = 0x04bf;
14471  t.chedescendercyrillic = 0x04b7;
14472  t.chedieresiscyrillic = 0x04f5;
14473  t.cheharmenian = 0x0573;
14474  t.chekhakassiancyrillic = 0x04cc;
14475  t.cheverticalstrokecyrillic = 0x04b9;
14476  t.chi = 0x03c7;
14477  t.chieuchacirclekorean = 0x3277;
14478  t.chieuchaparenkorean = 0x3217;
14479  t.chieuchcirclekorean = 0x3269;
14480  t.chieuchkorean = 0x314a;
14481  t.chieuchparenkorean = 0x3209;
14482  t.chochangthai = 0x0e0a;
14483  t.chochanthai = 0x0e08;
14484  t.chochingthai = 0x0e09;
14485  t.chochoethai = 0x0e0c;
14486  t.chook = 0x0188;
14487  t.cieucacirclekorean = 0x3276;
14488  t.cieucaparenkorean = 0x3216;
14489  t.cieuccirclekorean = 0x3268;
14490  t.cieuckorean = 0x3148;
14491  t.cieucparenkorean = 0x3208;
14492  t.cieucuparenkorean = 0x321c;
14493  t.circle = 0x25cb;
14494  t.circlecopyrt = 0x00a9;
14495  t.circlemultiply = 0x2297;
14496  t.circleot = 0x2299;
14497  t.circleplus = 0x2295;
14498  t.circlepostalmark = 0x3036;
14499  t.circlewithlefthalfblack = 0x25d0;
14500  t.circlewithrighthalfblack = 0x25d1;
14501  t.circumflex = 0x02c6;
14502  t.circumflexbelowcmb = 0x032d;
14503  t.circumflexcmb = 0x0302;
14504  t.clear = 0x2327;
14505  t.clickalveolar = 0x01c2;
14506  t.clickdental = 0x01c0;
14507  t.clicklateral = 0x01c1;
14508  t.clickretroflex = 0x01c3;
14509  t.club = 0x2663;
14510  t.clubsuitblack = 0x2663;
14511  t.clubsuitwhite = 0x2667;
14512  t.cmcubedsquare = 0x33a4;
14513  t.cmonospace = 0xff43;
14514  t.cmsquaredsquare = 0x33a0;
14515  t.coarmenian = 0x0581;
14516  t.colon = 0x003a;
14517  t.colonmonetary = 0x20a1;
14518  t.colonmonospace = 0xff1a;
14519  t.colonsign = 0x20a1;
14520  t.colonsmall = 0xfe55;
14521  t.colontriangularhalfmod = 0x02d1;
14522  t.colontriangularmod = 0x02d0;
14523  t.comma = 0x002c;
14524  t.commaabovecmb = 0x0313;
14525  t.commaaboverightcmb = 0x0315;
14526  t.commaaccent = 0xf6c3;
14527  t.commaarabic = 0x060c;
14528  t.commaarmenian = 0x055d;
14529  t.commainferior = 0xf6e1;
14530  t.commamonospace = 0xff0c;
14531  t.commareversedabovecmb = 0x0314;
14532  t.commareversedmod = 0x02bd;
14533  t.commasmall = 0xfe50;
14534  t.commasuperior = 0xf6e2;
14535  t.commaturnedabovecmb = 0x0312;
14536  t.commaturnedmod = 0x02bb;
14537  t.compass = 0x263c;
14538  t.congruent = 0x2245;
14539  t.contourintegral = 0x222e;
14540  t.control = 0x2303;
14541  t.controlACK = 0x0006;
14542  t.controlBEL = 0x0007;
14543  t.controlBS = 0x0008;
14544  t.controlCAN = 0x0018;
14545  t.controlCR = 0x000d;
14546  t.controlDC1 = 0x0011;
14547  t.controlDC2 = 0x0012;
14548  t.controlDC3 = 0x0013;
14549  t.controlDC4 = 0x0014;
14550  t.controlDEL = 0x007f;
14551  t.controlDLE = 0x0010;
14552  t.controlEM = 0x0019;
14553  t.controlENQ = 0x0005;
14554  t.controlEOT = 0x0004;
14555  t.controlESC = 0x001b;
14556  t.controlETB = 0x0017;
14557  t.controlETX = 0x0003;
14558  t.controlFF = 0x000c;
14559  t.controlFS = 0x001c;
14560  t.controlGS = 0x001d;
14561  t.controlHT = 0x0009;
14562  t.controlLF = 0x000a;
14563  t.controlNAK = 0x0015;
14564  t.controlNULL = 0x0000;
14565  t.controlRS = 0x001e;
14566  t.controlSI = 0x000f;
14567  t.controlSO = 0x000e;
14568  t.controlSOT = 0x0002;
14569  t.controlSTX = 0x0001;
14570  t.controlSUB = 0x001a;
14571  t.controlSYN = 0x0016;
14572  t.controlUS = 0x001f;
14573  t.controlVT = 0x000b;
14574  t.copyright = 0x00a9;
14575  t.copyrightsans = 0xf8e9;
14576  t.copyrightserif = 0xf6d9;
14577  t.cornerbracketleft = 0x300c;
14578  t.cornerbracketlefthalfwidth = 0xff62;
14579  t.cornerbracketleftvertical = 0xfe41;
14580  t.cornerbracketright = 0x300d;
14581  t.cornerbracketrighthalfwidth = 0xff63;
14582  t.cornerbracketrightvertical = 0xfe42;
14583  t.corporationsquare = 0x337f;
14584  t.cosquare = 0x33c7;
14585  t.coverkgsquare = 0x33c6;
14586  t.cparen = 0x249e;
14587  t.cruzeiro = 0x20a2;
14588  t.cstretched = 0x0297;
14589  t.curlyand = 0x22cf;
14590  t.curlyor = 0x22ce;
14591  t.currency = 0x00a4;
14592  t.cyrBreve = 0xf6d1;
14593  t.cyrFlex = 0xf6d2;
14594  t.cyrbreve = 0xf6d4;
14595  t.cyrflex = 0xf6d5;
14596  t.d = 0x0064;
14597  t.daarmenian = 0x0564;
14598  t.dabengali = 0x09a6;
14599  t.dadarabic = 0x0636;
14600  t.dadeva = 0x0926;
14601  t.dadfinalarabic = 0xfebe;
14602  t.dadinitialarabic = 0xfebf;
14603  t.dadmedialarabic = 0xfec0;
14604  t.dagesh = 0x05bc;
14605  t.dageshhebrew = 0x05bc;
14606  t.dagger = 0x2020;
14607  t.daggerdbl = 0x2021;
14608  t.dagujarati = 0x0aa6;
14609  t.dagurmukhi = 0x0a26;
14610  t.dahiragana = 0x3060;
14611  t.dakatakana = 0x30c0;
14612  t.dalarabic = 0x062f;
14613  t.dalet = 0x05d3;
14614  t.daletdagesh = 0xfb33;
14615  t.daletdageshhebrew = 0xfb33;
14616  t.dalethebrew = 0x05d3;
14617  t.dalfinalarabic = 0xfeaa;
14618  t.dammaarabic = 0x064f;
14619  t.dammalowarabic = 0x064f;
14620  t.dammatanaltonearabic = 0x064c;
14621  t.dammatanarabic = 0x064c;
14622  t.danda = 0x0964;
14623  t.dargahebrew = 0x05a7;
14624  t.dargalefthebrew = 0x05a7;
14625  t.dasiapneumatacyrilliccmb = 0x0485;
14626  t.dblGrave = 0xf6d3;
14627  t.dblanglebracketleft = 0x300a;
14628  t.dblanglebracketleftvertical = 0xfe3d;
14629  t.dblanglebracketright = 0x300b;
14630  t.dblanglebracketrightvertical = 0xfe3e;
14631  t.dblarchinvertedbelowcmb = 0x032b;
14632  t.dblarrowleft = 0x21d4;
14633  t.dblarrowright = 0x21d2;
14634  t.dbldanda = 0x0965;
14635  t.dblgrave = 0xf6d6;
14636  t.dblgravecmb = 0x030f;
14637  t.dblintegral = 0x222c;
14638  t.dbllowline = 0x2017;
14639  t.dbllowlinecmb = 0x0333;
14640  t.dbloverlinecmb = 0x033f;
14641  t.dblprimemod = 0x02ba;
14642  t.dblverticalbar = 0x2016;
14643  t.dblverticallineabovecmb = 0x030e;
14644  t.dbopomofo = 0x3109;
14645  t.dbsquare = 0x33c8;
14646  t.dcaron = 0x010f;
14647  t.dcedilla = 0x1e11;
14648  t.dcircle = 0x24d3;
14649  t.dcircumflexbelow = 0x1e13;
14650  t.dcroat = 0x0111;
14651  t.ddabengali = 0x09a1;
14652  t.ddadeva = 0x0921;
14653  t.ddagujarati = 0x0aa1;
14654  t.ddagurmukhi = 0x0a21;
14655  t.ddalarabic = 0x0688;
14656  t.ddalfinalarabic = 0xfb89;
14657  t.dddhadeva = 0x095c;
14658  t.ddhabengali = 0x09a2;
14659  t.ddhadeva = 0x0922;
14660  t.ddhagujarati = 0x0aa2;
14661  t.ddhagurmukhi = 0x0a22;
14662  t.ddotaccent = 0x1e0b;
14663  t.ddotbelow = 0x1e0d;
14664  t.decimalseparatorarabic = 0x066b;
14665  t.decimalseparatorpersian = 0x066b;
14666  t.decyrillic = 0x0434;
14667  t.degree = 0x00b0;
14668  t.dehihebrew = 0x05ad;
14669  t.dehiragana = 0x3067;
14670  t.deicoptic = 0x03ef;
14671  t.dekatakana = 0x30c7;
14672  t.deleteleft = 0x232b;
14673  t.deleteright = 0x2326;
14674  t.delta = 0x03b4;
14675  t.deltaturned = 0x018d;
14676  t.denominatorminusonenumeratorbengali = 0x09f8;
14677  t.dezh = 0x02a4;
14678  t.dhabengali = 0x09a7;
14679  t.dhadeva = 0x0927;
14680  t.dhagujarati = 0x0aa7;
14681  t.dhagurmukhi = 0x0a27;
14682  t.dhook = 0x0257;
14683  t.dialytikatonos = 0x0385;
14684  t.dialytikatonoscmb = 0x0344;
14685  t.diamond = 0x2666;
14686  t.diamondsuitwhite = 0x2662;
14687  t.dieresis = 0x00a8;
14688  t.dieresisacute = 0xf6d7;
14689  t.dieresisbelowcmb = 0x0324;
14690  t.dieresiscmb = 0x0308;
14691  t.dieresisgrave = 0xf6d8;
14692  t.dieresistonos = 0x0385;
14693  t.dihiragana = 0x3062;
14694  t.dikatakana = 0x30c2;
14695  t.dittomark = 0x3003;
14696  t.divide = 0x00f7;
14697  t.divides = 0x2223;
14698  t.divisionslash = 0x2215;
14699  t.djecyrillic = 0x0452;
14700  t.dkshade = 0x2593;
14701  t.dlinebelow = 0x1e0f;
14702  t.dlsquare = 0x3397;
14703  t.dmacron = 0x0111;
14704  t.dmonospace = 0xff44;
14705  t.dnblock = 0x2584;
14706  t.dochadathai = 0x0e0e;
14707  t.dodekthai = 0x0e14;
14708  t.dohiragana = 0x3069;
14709  t.dokatakana = 0x30c9;
14710  t.dollar = 0x0024;
14711  t.dollarinferior = 0xf6e3;
14712  t.dollarmonospace = 0xff04;
14713  t.dollaroldstyle = 0xf724;
14714  t.dollarsmall = 0xfe69;
14715  t.dollarsuperior = 0xf6e4;
14716  t.dong = 0x20ab;
14717  t.dorusquare = 0x3326;
14718  t.dotaccent = 0x02d9;
14719  t.dotaccentcmb = 0x0307;
14720  t.dotbelowcmb = 0x0323;
14721  t.dotbelowcomb = 0x0323;
14722  t.dotkatakana = 0x30fb;
14723  t.dotlessi = 0x0131;
14724  t.dotlessj = 0xf6be;
14725  t.dotlessjstrokehook = 0x0284;
14726  t.dotmath = 0x22c5;
14727  t.dottedcircle = 0x25cc;
14728  t.doubleyodpatah = 0xfb1f;
14729  t.doubleyodpatahhebrew = 0xfb1f;
14730  t.downtackbelowcmb = 0x031e;
14731  t.downtackmod = 0x02d5;
14732  t.dparen = 0x249f;
14733  t.dsuperior = 0xf6eb;
14734  t.dtail = 0x0256;
14735  t.dtopbar = 0x018c;
14736  t.duhiragana = 0x3065;
14737  t.dukatakana = 0x30c5;
14738  t.dz = 0x01f3;
14739  t.dzaltone = 0x02a3;
14740  t.dzcaron = 0x01c6;
14741  t.dzcurl = 0x02a5;
14742  t.dzeabkhasiancyrillic = 0x04e1;
14743  t.dzecyrillic = 0x0455;
14744  t.dzhecyrillic = 0x045f;
14745  t.e = 0x0065;
14746  t.eacute = 0x00e9;
14747  t.earth = 0x2641;
14748  t.ebengali = 0x098f;
14749  t.ebopomofo = 0x311c;
14750  t.ebreve = 0x0115;
14751  t.ecandradeva = 0x090d;
14752  t.ecandragujarati = 0x0a8d;
14753  t.ecandravowelsigndeva = 0x0945;
14754  t.ecandravowelsigngujarati = 0x0ac5;
14755  t.ecaron = 0x011b;
14756  t.ecedillabreve = 0x1e1d;
14757  t.echarmenian = 0x0565;
14758  t.echyiwnarmenian = 0x0587;
14759  t.ecircle = 0x24d4;
14760  t.ecircumflex = 0x00ea;
14761  t.ecircumflexacute = 0x1ebf;
14762  t.ecircumflexbelow = 0x1e19;
14763  t.ecircumflexdotbelow = 0x1ec7;
14764  t.ecircumflexgrave = 0x1ec1;
14765  t.ecircumflexhookabove = 0x1ec3;
14766  t.ecircumflextilde = 0x1ec5;
14767  t.ecyrillic = 0x0454;
14768  t.edblgrave = 0x0205;
14769  t.edeva = 0x090f;
14770  t.edieresis = 0x00eb;
14771  t.edot = 0x0117;
14772  t.edotaccent = 0x0117;
14773  t.edotbelow = 0x1eb9;
14774  t.eegurmukhi = 0x0a0f;
14775  t.eematragurmukhi = 0x0a47;
14776  t.efcyrillic = 0x0444;
14777  t.egrave = 0x00e8;
14778  t.egujarati = 0x0a8f;
14779  t.eharmenian = 0x0567;
14780  t.ehbopomofo = 0x311d;
14781  t.ehiragana = 0x3048;
14782  t.ehookabove = 0x1ebb;
14783  t.eibopomofo = 0x311f;
14784  t.eight = 0x0038;
14785  t.eightarabic = 0x0668;
14786  t.eightbengali = 0x09ee;
14787  t.eightcircle = 0x2467;
14788  t.eightcircleinversesansserif = 0x2791;
14789  t.eightdeva = 0x096e;
14790  t.eighteencircle = 0x2471;
14791  t.eighteenparen = 0x2485;
14792  t.eighteenperiod = 0x2499;
14793  t.eightgujarati = 0x0aee;
14794  t.eightgurmukhi = 0x0a6e;
14795  t.eighthackarabic = 0x0668;
14796  t.eighthangzhou = 0x3028;
14797  t.eighthnotebeamed = 0x266b;
14798  t.eightideographicparen = 0x3227;
14799  t.eightinferior = 0x2088;
14800  t.eightmonospace = 0xff18;
14801  t.eightoldstyle = 0xf738;
14802  t.eightparen = 0x247b;
14803  t.eightperiod = 0x248f;
14804  t.eightpersian = 0x06f8;
14805  t.eightroman = 0x2177;
14806  t.eightsuperior = 0x2078;
14807  t.eightthai = 0x0e58;
14808  t.einvertedbreve = 0x0207;
14809  t.eiotifiedcyrillic = 0x0465;
14810  t.ekatakana = 0x30a8;
14811  t.ekatakanahalfwidth = 0xff74;
14812  t.ekonkargurmukhi = 0x0a74;
14813  t.ekorean = 0x3154;
14814  t.elcyrillic = 0x043b;
14815  t.element = 0x2208;
14816  t.elevencircle = 0x246a;
14817  t.elevenparen = 0x247e;
14818  t.elevenperiod = 0x2492;
14819  t.elevenroman = 0x217a;
14820  t.ellipsis = 0x2026;
14821  t.ellipsisvertical = 0x22ee;
14822  t.emacron = 0x0113;
14823  t.emacronacute = 0x1e17;
14824  t.emacrongrave = 0x1e15;
14825  t.emcyrillic = 0x043c;
14826  t.emdash = 0x2014;
14827  t.emdashvertical = 0xfe31;
14828  t.emonospace = 0xff45;
14829  t.emphasismarkarmenian = 0x055b;
14830  t.emptyset = 0x2205;
14831  t.enbopomofo = 0x3123;
14832  t.encyrillic = 0x043d;
14833  t.endash = 0x2013;
14834  t.endashvertical = 0xfe32;
14835  t.endescendercyrillic = 0x04a3;
14836  t.eng = 0x014b;
14837  t.engbopomofo = 0x3125;
14838  t.enghecyrillic = 0x04a5;
14839  t.enhookcyrillic = 0x04c8;
14840  t.enspace = 0x2002;
14841  t.eogonek = 0x0119;
14842  t.eokorean = 0x3153;
14843  t.eopen = 0x025b;
14844  t.eopenclosed = 0x029a;
14845  t.eopenreversed = 0x025c;
14846  t.eopenreversedclosed = 0x025e;
14847  t.eopenreversedhook = 0x025d;
14848  t.eparen = 0x24a0;
14849  t.epsilon = 0x03b5;
14850  t.epsilontonos = 0x03ad;
14851  t.equal = 0x003d;
14852  t.equalmonospace = 0xff1d;
14853  t.equalsmall = 0xfe66;
14854  t.equalsuperior = 0x207c;
14855  t.equivalence = 0x2261;
14856  t.erbopomofo = 0x3126;
14857  t.ercyrillic = 0x0440;
14858  t.ereversed = 0x0258;
14859  t.ereversedcyrillic = 0x044d;
14860  t.escyrillic = 0x0441;
14861  t.esdescendercyrillic = 0x04ab;
14862  t.esh = 0x0283;
14863  t.eshcurl = 0x0286;
14864  t.eshortdeva = 0x090e;
14865  t.eshortvowelsigndeva = 0x0946;
14866  t.eshreversedloop = 0x01aa;
14867  t.eshsquatreversed = 0x0285;
14868  t.esmallhiragana = 0x3047;
14869  t.esmallkatakana = 0x30a7;
14870  t.esmallkatakanahalfwidth = 0xff6a;
14871  t.estimated = 0x212e;
14872  t.esuperior = 0xf6ec;
14873  t.eta = 0x03b7;
14874  t.etarmenian = 0x0568;
14875  t.etatonos = 0x03ae;
14876  t.eth = 0x00f0;
14877  t.etilde = 0x1ebd;
14878  t.etildebelow = 0x1e1b;
14879  t.etnahtafoukhhebrew = 0x0591;
14880  t.etnahtafoukhlefthebrew = 0x0591;
14881  t.etnahtahebrew = 0x0591;
14882  t.etnahtalefthebrew = 0x0591;
14883  t.eturned = 0x01dd;
14884  t.eukorean = 0x3161;
14885  t.euro = 0x20ac;
14886  t.evowelsignbengali = 0x09c7;
14887  t.evowelsigndeva = 0x0947;
14888  t.evowelsigngujarati = 0x0ac7;
14889  t.exclam = 0x0021;
14890  t.exclamarmenian = 0x055c;
14891  t.exclamdbl = 0x203c;
14892  t.exclamdown = 0x00a1;
14893  t.exclamdownsmall = 0xf7a1;
14894  t.exclammonospace = 0xff01;
14895  t.exclamsmall = 0xf721;
14896  t.existential = 0x2203;
14897  t.ezh = 0x0292;
14898  t.ezhcaron = 0x01ef;
14899  t.ezhcurl = 0x0293;
14900  t.ezhreversed = 0x01b9;
14901  t.ezhtail = 0x01ba;
14902  t.f = 0x0066;
14903  t.fadeva = 0x095e;
14904  t.fagurmukhi = 0x0a5e;
14905  t.fahrenheit = 0x2109;
14906  t.fathaarabic = 0x064e;
14907  t.fathalowarabic = 0x064e;
14908  t.fathatanarabic = 0x064b;
14909  t.fbopomofo = 0x3108;
14910  t.fcircle = 0x24d5;
14911  t.fdotaccent = 0x1e1f;
14912  t.feharabic = 0x0641;
14913  t.feharmenian = 0x0586;
14914  t.fehfinalarabic = 0xfed2;
14915  t.fehinitialarabic = 0xfed3;
14916  t.fehmedialarabic = 0xfed4;
14917  t.feicoptic = 0x03e5;
14918  t.female = 0x2640;
14919  t.ff = 0xfb00;
14920  t.f_f = 0xfb00;
14921  t.ffi = 0xfb03;
14922  t.f_f_i = 0xfb03;
14923  t.ffl = 0xfb04;
14924  t.f_f_l = 0xfb04;
14925  t.fi = 0xfb01;
14926  t.f_i = 0xfb01;
14927  t.fifteencircle = 0x246e;
14928  t.fifteenparen = 0x2482;
14929  t.fifteenperiod = 0x2496;
14930  t.figuredash = 0x2012;
14931  t.filledbox = 0x25a0;
14932  t.filledrect = 0x25ac;
14933  t.finalkaf = 0x05da;
14934  t.finalkafdagesh = 0xfb3a;
14935  t.finalkafdageshhebrew = 0xfb3a;
14936  t.finalkafhebrew = 0x05da;
14937  t.finalmem = 0x05dd;
14938  t.finalmemhebrew = 0x05dd;
14939  t.finalnun = 0x05df;
14940  t.finalnunhebrew = 0x05df;
14941  t.finalpe = 0x05e3;
14942  t.finalpehebrew = 0x05e3;
14943  t.finaltsadi = 0x05e5;
14944  t.finaltsadihebrew = 0x05e5;
14945  t.firsttonechinese = 0x02c9;
14946  t.fisheye = 0x25c9;
14947  t.fitacyrillic = 0x0473;
14948  t.five = 0x0035;
14949  t.fivearabic = 0x0665;
14950  t.fivebengali = 0x09eb;
14951  t.fivecircle = 0x2464;
14952  t.fivecircleinversesansserif = 0x278e;
14953  t.fivedeva = 0x096b;
14954  t.fiveeighths = 0x215d;
14955  t.fivegujarati = 0x0aeb;
14956  t.fivegurmukhi = 0x0a6b;
14957  t.fivehackarabic = 0x0665;
14958  t.fivehangzhou = 0x3025;
14959  t.fiveideographicparen = 0x3224;
14960  t.fiveinferior = 0x2085;
14961  t.fivemonospace = 0xff15;
14962  t.fiveoldstyle = 0xf735;
14963  t.fiveparen = 0x2478;
14964  t.fiveperiod = 0x248c;
14965  t.fivepersian = 0x06f5;
14966  t.fiveroman = 0x2174;
14967  t.fivesuperior = 0x2075;
14968  t.fivethai = 0x0e55;
14969  t.fl = 0xfb02;
14970  t.f_l = 0xfb02;
14971  t.florin = 0x0192;
14972  t.fmonospace = 0xff46;
14973  t.fmsquare = 0x3399;
14974  t.fofanthai = 0x0e1f;
14975  t.fofathai = 0x0e1d;
14976  t.fongmanthai = 0x0e4f;
14977  t.forall = 0x2200;
14978  t.four = 0x0034;
14979  t.fourarabic = 0x0664;
14980  t.fourbengali = 0x09ea;
14981  t.fourcircle = 0x2463;
14982  t.fourcircleinversesansserif = 0x278d;
14983  t.fourdeva = 0x096a;
14984  t.fourgujarati = 0x0aea;
14985  t.fourgurmukhi = 0x0a6a;
14986  t.fourhackarabic = 0x0664;
14987  t.fourhangzhou = 0x3024;
14988  t.fourideographicparen = 0x3223;
14989  t.fourinferior = 0x2084;
14990  t.fourmonospace = 0xff14;
14991  t.fournumeratorbengali = 0x09f7;
14992  t.fouroldstyle = 0xf734;
14993  t.fourparen = 0x2477;
14994  t.fourperiod = 0x248b;
14995  t.fourpersian = 0x06f4;
14996  t.fourroman = 0x2173;
14997  t.foursuperior = 0x2074;
14998  t.fourteencircle = 0x246d;
14999  t.fourteenparen = 0x2481;
15000  t.fourteenperiod = 0x2495;
15001  t.fourthai = 0x0e54;
15002  t.fourthtonechinese = 0x02cb;
15003  t.fparen = 0x24a1;
15004  t.fraction = 0x2044;
15005  t.franc = 0x20a3;
15006  t.g = 0x0067;
15007  t.gabengali = 0x0997;
15008  t.gacute = 0x01f5;
15009  t.gadeva = 0x0917;
15010  t.gafarabic = 0x06af;
15011  t.gaffinalarabic = 0xfb93;
15012  t.gafinitialarabic = 0xfb94;
15013  t.gafmedialarabic = 0xfb95;
15014  t.gagujarati = 0x0a97;
15015  t.gagurmukhi = 0x0a17;
15016  t.gahiragana = 0x304c;
15017  t.gakatakana = 0x30ac;
15018  t.gamma = 0x03b3;
15019  t.gammalatinsmall = 0x0263;
15020  t.gammasuperior = 0x02e0;
15021  t.gangiacoptic = 0x03eb;
15022  t.gbopomofo = 0x310d;
15023  t.gbreve = 0x011f;
15024  t.gcaron = 0x01e7;
15025  t.gcedilla = 0x0123;
15026  t.gcircle = 0x24d6;
15027  t.gcircumflex = 0x011d;
15028  t.gcommaaccent = 0x0123;
15029  t.gdot = 0x0121;
15030  t.gdotaccent = 0x0121;
15031  t.gecyrillic = 0x0433;
15032  t.gehiragana = 0x3052;
15033  t.gekatakana = 0x30b2;
15034  t.geometricallyequal = 0x2251;
15035  t.gereshaccenthebrew = 0x059c;
15036  t.gereshhebrew = 0x05f3;
15037  t.gereshmuqdamhebrew = 0x059d;
15038  t.germandbls = 0x00df;
15039  t.gershayimaccenthebrew = 0x059e;
15040  t.gershayimhebrew = 0x05f4;
15041  t.getamark = 0x3013;
15042  t.ghabengali = 0x0998;
15043  t.ghadarmenian = 0x0572;
15044  t.ghadeva = 0x0918;
15045  t.ghagujarati = 0x0a98;
15046  t.ghagurmukhi = 0x0a18;
15047  t.ghainarabic = 0x063a;
15048  t.ghainfinalarabic = 0xfece;
15049  t.ghaininitialarabic = 0xfecf;
15050  t.ghainmedialarabic = 0xfed0;
15051  t.ghemiddlehookcyrillic = 0x0495;
15052  t.ghestrokecyrillic = 0x0493;
15053  t.gheupturncyrillic = 0x0491;
15054  t.ghhadeva = 0x095a;
15055  t.ghhagurmukhi = 0x0a5a;
15056  t.ghook = 0x0260;
15057  t.ghzsquare = 0x3393;
15058  t.gihiragana = 0x304e;
15059  t.gikatakana = 0x30ae;
15060  t.gimarmenian = 0x0563;
15061  t.gimel = 0x05d2;
15062  t.gimeldagesh = 0xfb32;
15063  t.gimeldageshhebrew = 0xfb32;
15064  t.gimelhebrew = 0x05d2;
15065  t.gjecyrillic = 0x0453;
15066  t.glottalinvertedstroke = 0x01be;
15067  t.glottalstop = 0x0294;
15068  t.glottalstopinverted = 0x0296;
15069  t.glottalstopmod = 0x02c0;
15070  t.glottalstopreversed = 0x0295;
15071  t.glottalstopreversedmod = 0x02c1;
15072  t.glottalstopreversedsuperior = 0x02e4;
15073  t.glottalstopstroke = 0x02a1;
15074  t.glottalstopstrokereversed = 0x02a2;
15075  t.gmacron = 0x1e21;
15076  t.gmonospace = 0xff47;
15077  t.gohiragana = 0x3054;
15078  t.gokatakana = 0x30b4;
15079  t.gparen = 0x24a2;
15080  t.gpasquare = 0x33ac;
15081  t.gradient = 0x2207;
15082  t.grave = 0x0060;
15083  t.gravebelowcmb = 0x0316;
15084  t.gravecmb = 0x0300;
15085  t.gravecomb = 0x0300;
15086  t.gravedeva = 0x0953;
15087  t.gravelowmod = 0x02ce;
15088  t.gravemonospace = 0xff40;
15089  t.gravetonecmb = 0x0340;
15090  t.greater = 0x003e;
15091  t.greaterequal = 0x2265;
15092  t.greaterequalorless = 0x22db;
15093  t.greatermonospace = 0xff1e;
15094  t.greaterorequivalent = 0x2273;
15095  t.greaterorless = 0x2277;
15096  t.greateroverequal = 0x2267;
15097  t.greatersmall = 0xfe65;
15098  t.gscript = 0x0261;
15099  t.gstroke = 0x01e5;
15100  t.guhiragana = 0x3050;
15101  t.guillemotleft = 0x00ab;
15102  t.guillemotright = 0x00bb;
15103  t.guilsinglleft = 0x2039;
15104  t.guilsinglright = 0x203a;
15105  t.gukatakana = 0x30b0;
15106  t.guramusquare = 0x3318;
15107  t.gysquare = 0x33c9;
15108  t.h = 0x0068;
15109  t.haabkhasiancyrillic = 0x04a9;
15110  t.haaltonearabic = 0x06c1;
15111  t.habengali = 0x09b9;
15112  t.hadescendercyrillic = 0x04b3;
15113  t.hadeva = 0x0939;
15114  t.hagujarati = 0x0ab9;
15115  t.hagurmukhi = 0x0a39;
15116  t.haharabic = 0x062d;
15117  t.hahfinalarabic = 0xfea2;
15118  t.hahinitialarabic = 0xfea3;
15119  t.hahiragana = 0x306f;
15120  t.hahmedialarabic = 0xfea4;
15121  t.haitusquare = 0x332a;
15122  t.hakatakana = 0x30cf;
15123  t.hakatakanahalfwidth = 0xff8a;
15124  t.halantgurmukhi = 0x0a4d;
15125  t.hamzaarabic = 0x0621;
15126  t.hamzalowarabic = 0x0621;
15127  t.hangulfiller = 0x3164;
15128  t.hardsigncyrillic = 0x044a;
15129  t.harpoonleftbarbup = 0x21bc;
15130  t.harpoonrightbarbup = 0x21c0;
15131  t.hasquare = 0x33ca;
15132  t.hatafpatah = 0x05b2;
15133  t.hatafpatah16 = 0x05b2;
15134  t.hatafpatah23 = 0x05b2;
15135  t.hatafpatah2f = 0x05b2;
15136  t.hatafpatahhebrew = 0x05b2;
15137  t.hatafpatahnarrowhebrew = 0x05b2;
15138  t.hatafpatahquarterhebrew = 0x05b2;
15139  t.hatafpatahwidehebrew = 0x05b2;
15140  t.hatafqamats = 0x05b3;
15141  t.hatafqamats1b = 0x05b3;
15142  t.hatafqamats28 = 0x05b3;
15143  t.hatafqamats34 = 0x05b3;
15144  t.hatafqamatshebrew = 0x05b3;
15145  t.hatafqamatsnarrowhebrew = 0x05b3;
15146  t.hatafqamatsquarterhebrew = 0x05b3;
15147  t.hatafqamatswidehebrew = 0x05b3;
15148  t.hatafsegol = 0x05b1;
15149  t.hatafsegol17 = 0x05b1;
15150  t.hatafsegol24 = 0x05b1;
15151  t.hatafsegol30 = 0x05b1;
15152  t.hatafsegolhebrew = 0x05b1;
15153  t.hatafsegolnarrowhebrew = 0x05b1;
15154  t.hatafsegolquarterhebrew = 0x05b1;
15155  t.hatafsegolwidehebrew = 0x05b1;
15156  t.hbar = 0x0127;
15157  t.hbopomofo = 0x310f;
15158  t.hbrevebelow = 0x1e2b;
15159  t.hcedilla = 0x1e29;
15160  t.hcircle = 0x24d7;
15161  t.hcircumflex = 0x0125;
15162  t.hdieresis = 0x1e27;
15163  t.hdotaccent = 0x1e23;
15164  t.hdotbelow = 0x1e25;
15165  t.he = 0x05d4;
15166  t.heart = 0x2665;
15167  t.heartsuitblack = 0x2665;
15168  t.heartsuitwhite = 0x2661;
15169  t.hedagesh = 0xfb34;
15170  t.hedageshhebrew = 0xfb34;
15171  t.hehaltonearabic = 0x06c1;
15172  t.heharabic = 0x0647;
15173  t.hehebrew = 0x05d4;
15174  t.hehfinalaltonearabic = 0xfba7;
15175  t.hehfinalalttwoarabic = 0xfeea;
15176  t.hehfinalarabic = 0xfeea;
15177  t.hehhamzaabovefinalarabic = 0xfba5;
15178  t.hehhamzaaboveisolatedarabic = 0xfba4;
15179  t.hehinitialaltonearabic = 0xfba8;
15180  t.hehinitialarabic = 0xfeeb;
15181  t.hehiragana = 0x3078;
15182  t.hehmedialaltonearabic = 0xfba9;
15183  t.hehmedialarabic = 0xfeec;
15184  t.heiseierasquare = 0x337b;
15185  t.hekatakana = 0x30d8;
15186  t.hekatakanahalfwidth = 0xff8d;
15187  t.hekutaarusquare = 0x3336;
15188  t.henghook = 0x0267;
15189  t.herutusquare = 0x3339;
15190  t.het = 0x05d7;
15191  t.hethebrew = 0x05d7;
15192  t.hhook = 0x0266;
15193  t.hhooksuperior = 0x02b1;
15194  t.hieuhacirclekorean = 0x327b;
15195  t.hieuhaparenkorean = 0x321b;
15196  t.hieuhcirclekorean = 0x326d;
15197  t.hieuhkorean = 0x314e;
15198  t.hieuhparenkorean = 0x320d;
15199  t.hihiragana = 0x3072;
15200  t.hikatakana = 0x30d2;
15201  t.hikatakanahalfwidth = 0xff8b;
15202  t.hiriq = 0x05b4;
15203  t.hiriq14 = 0x05b4;
15204  t.hiriq21 = 0x05b4;
15205  t.hiriq2d = 0x05b4;
15206  t.hiriqhebrew = 0x05b4;
15207  t.hiriqnarrowhebrew = 0x05b4;
15208  t.hiriqquarterhebrew = 0x05b4;
15209  t.hiriqwidehebrew = 0x05b4;
15210  t.hlinebelow = 0x1e96;
15211  t.hmonospace = 0xff48;
15212  t.hoarmenian = 0x0570;
15213  t.hohipthai = 0x0e2b;
15214  t.hohiragana = 0x307b;
15215  t.hokatakana = 0x30db;
15216  t.hokatakanahalfwidth = 0xff8e;
15217  t.holam = 0x05b9;
15218  t.holam19 = 0x05b9;
15219  t.holam26 = 0x05b9;
15220  t.holam32 = 0x05b9;
15221  t.holamhebrew = 0x05b9;
15222  t.holamnarrowhebrew = 0x05b9;
15223  t.holamquarterhebrew = 0x05b9;
15224  t.holamwidehebrew = 0x05b9;
15225  t.honokhukthai = 0x0e2e;
15226  t.hookabovecomb = 0x0309;
15227  t.hookcmb = 0x0309;
15228  t.hookpalatalizedbelowcmb = 0x0321;
15229  t.hookretroflexbelowcmb = 0x0322;
15230  t.hoonsquare = 0x3342;
15231  t.horicoptic = 0x03e9;
15232  t.horizontalbar = 0x2015;
15233  t.horncmb = 0x031b;
15234  t.hotsprings = 0x2668;
15235  t.house = 0x2302;
15236  t.hparen = 0x24a3;
15237  t.hsuperior = 0x02b0;
15238  t.hturned = 0x0265;
15239  t.huhiragana = 0x3075;
15240  t.huiitosquare = 0x3333;
15241  t.hukatakana = 0x30d5;
15242  t.hukatakanahalfwidth = 0xff8c;
15243  t.hungarumlaut = 0x02dd;
15244  t.hungarumlautcmb = 0x030b;
15245  t.hv = 0x0195;
15246  t.hyphen = 0x002d;
15247  t.hypheninferior = 0xf6e5;
15248  t.hyphenmonospace = 0xff0d;
15249  t.hyphensmall = 0xfe63;
15250  t.hyphensuperior = 0xf6e6;
15251  t.hyphentwo = 0x2010;
15252  t.i = 0x0069;
15253  t.iacute = 0x00ed;
15254  t.iacyrillic = 0x044f;
15255  t.ibengali = 0x0987;
15256  t.ibopomofo = 0x3127;
15257  t.ibreve = 0x012d;
15258  t.icaron = 0x01d0;
15259  t.icircle = 0x24d8;
15260  t.icircumflex = 0x00ee;
15261  t.icyrillic = 0x0456;
15262  t.idblgrave = 0x0209;
15263  t.ideographearthcircle = 0x328f;
15264  t.ideographfirecircle = 0x328b;
15265  t.ideographicallianceparen = 0x323f;
15266  t.ideographiccallparen = 0x323a;
15267  t.ideographiccentrecircle = 0x32a5;
15268  t.ideographicclose = 0x3006;
15269  t.ideographiccomma = 0x3001;
15270  t.ideographiccommaleft = 0xff64;
15271  t.ideographiccongratulationparen = 0x3237;
15272  t.ideographiccorrectcircle = 0x32a3;
15273  t.ideographicearthparen = 0x322f;
15274  t.ideographicenterpriseparen = 0x323d;
15275  t.ideographicexcellentcircle = 0x329d;
15276  t.ideographicfestivalparen = 0x3240;
15277  t.ideographicfinancialcircle = 0x3296;
15278  t.ideographicfinancialparen = 0x3236;
15279  t.ideographicfireparen = 0x322b;
15280  t.ideographichaveparen = 0x3232;
15281  t.ideographichighcircle = 0x32a4;
15282  t.ideographiciterationmark = 0x3005;
15283  t.ideographiclaborcircle = 0x3298;
15284  t.ideographiclaborparen = 0x3238;
15285  t.ideographicleftcircle = 0x32a7;
15286  t.ideographiclowcircle = 0x32a6;
15287  t.ideographicmedicinecircle = 0x32a9;
15288  t.ideographicmetalparen = 0x322e;
15289  t.ideographicmoonparen = 0x322a;
15290  t.ideographicnameparen = 0x3234;
15291  t.ideographicperiod = 0x3002;
15292  t.ideographicprintcircle = 0x329e;
15293  t.ideographicreachparen = 0x3243;
15294  t.ideographicrepresentparen = 0x3239;
15295  t.ideographicresourceparen = 0x323e;
15296  t.ideographicrightcircle = 0x32a8;
15297  t.ideographicsecretcircle = 0x3299;
15298  t.ideographicselfparen = 0x3242;
15299  t.ideographicsocietyparen = 0x3233;
15300  t.ideographicspace = 0x3000;
15301  t.ideographicspecialparen = 0x3235;
15302  t.ideographicstockparen = 0x3231;
15303  t.ideographicstudyparen = 0x323b;
15304  t.ideographicsunparen = 0x3230;
15305  t.ideographicsuperviseparen = 0x323c;
15306  t.ideographicwaterparen = 0x322c;
15307  t.ideographicwoodparen = 0x322d;
15308  t.ideographiczero = 0x3007;
15309  t.ideographmetalcircle = 0x328e;
15310  t.ideographmooncircle = 0x328a;
15311  t.ideographnamecircle = 0x3294;
15312  t.ideographsuncircle = 0x3290;
15313  t.ideographwatercircle = 0x328c;
15314  t.ideographwoodcircle = 0x328d;
15315  t.ideva = 0x0907;
15316  t.idieresis = 0x00ef;
15317  t.idieresisacute = 0x1e2f;
15318  t.idieresiscyrillic = 0x04e5;
15319  t.idotbelow = 0x1ecb;
15320  t.iebrevecyrillic = 0x04d7;
15321  t.iecyrillic = 0x0435;
15322  t.ieungacirclekorean = 0x3275;
15323  t.ieungaparenkorean = 0x3215;
15324  t.ieungcirclekorean = 0x3267;
15325  t.ieungkorean = 0x3147;
15326  t.ieungparenkorean = 0x3207;
15327  t.igrave = 0x00ec;
15328  t.igujarati = 0x0a87;
15329  t.igurmukhi = 0x0a07;
15330  t.ihiragana = 0x3044;
15331  t.ihookabove = 0x1ec9;
15332  t.iibengali = 0x0988;
15333  t.iicyrillic = 0x0438;
15334  t.iideva = 0x0908;
15335  t.iigujarati = 0x0a88;
15336  t.iigurmukhi = 0x0a08;
15337  t.iimatragurmukhi = 0x0a40;
15338  t.iinvertedbreve = 0x020b;
15339  t.iishortcyrillic = 0x0439;
15340  t.iivowelsignbengali = 0x09c0;
15341  t.iivowelsigndeva = 0x0940;
15342  t.iivowelsigngujarati = 0x0ac0;
15343  t.ij = 0x0133;
15344  t.ikatakana = 0x30a4;
15345  t.ikatakanahalfwidth = 0xff72;
15346  t.ikorean = 0x3163;
15347  t.ilde = 0x02dc;
15348  t.iluyhebrew = 0x05ac;
15349  t.imacron = 0x012b;
15350  t.imacroncyrillic = 0x04e3;
15351  t.imageorapproximatelyequal = 0x2253;
15352  t.imatragurmukhi = 0x0a3f;
15353  t.imonospace = 0xff49;
15354  t.increment = 0x2206;
15355  t.infinity = 0x221e;
15356  t.iniarmenian = 0x056b;
15357  t.integral = 0x222b;
15358  t.integralbottom = 0x2321;
15359  t.integralbt = 0x2321;
15360  t.integralex = 0xf8f5;
15361  t.integraltop = 0x2320;
15362  t.integraltp = 0x2320;
15363  t.intersection = 0x2229;
15364  t.intisquare = 0x3305;
15365  t.invbullet = 0x25d8;
15366  t.invcircle = 0x25d9;
15367  t.invsmileface = 0x263b;
15368  t.iocyrillic = 0x0451;
15369  t.iogonek = 0x012f;
15370  t.iota = 0x03b9;
15371  t.iotadieresis = 0x03ca;
15372  t.iotadieresistonos = 0x0390;
15373  t.iotalatin = 0x0269;
15374  t.iotatonos = 0x03af;
15375  t.iparen = 0x24a4;
15376  t.irigurmukhi = 0x0a72;
15377  t.ismallhiragana = 0x3043;
15378  t.ismallkatakana = 0x30a3;
15379  t.ismallkatakanahalfwidth = 0xff68;
15380  t.issharbengali = 0x09fa;
15381  t.istroke = 0x0268;
15382  t.isuperior = 0xf6ed;
15383  t.iterationhiragana = 0x309d;
15384  t.iterationkatakana = 0x30fd;
15385  t.itilde = 0x0129;
15386  t.itildebelow = 0x1e2d;
15387  t.iubopomofo = 0x3129;
15388  t.iucyrillic = 0x044e;
15389  t.ivowelsignbengali = 0x09bf;
15390  t.ivowelsigndeva = 0x093f;
15391  t.ivowelsigngujarati = 0x0abf;
15392  t.izhitsacyrillic = 0x0475;
15393  t.izhitsadblgravecyrillic = 0x0477;
15394  t.j = 0x006a;
15395  t.jaarmenian = 0x0571;
15396  t.jabengali = 0x099c;
15397  t.jadeva = 0x091c;
15398  t.jagujarati = 0x0a9c;
15399  t.jagurmukhi = 0x0a1c;
15400  t.jbopomofo = 0x3110;
15401  t.jcaron = 0x01f0;
15402  t.jcircle = 0x24d9;
15403  t.jcircumflex = 0x0135;
15404  t.jcrossedtail = 0x029d;
15405  t.jdotlessstroke = 0x025f;
15406  t.jecyrillic = 0x0458;
15407  t.jeemarabic = 0x062c;
15408  t.jeemfinalarabic = 0xfe9e;
15409  t.jeeminitialarabic = 0xfe9f;
15410  t.jeemmedialarabic = 0xfea0;
15411  t.jeharabic = 0x0698;
15412  t.jehfinalarabic = 0xfb8b;
15413  t.jhabengali = 0x099d;
15414  t.jhadeva = 0x091d;
15415  t.jhagujarati = 0x0a9d;
15416  t.jhagurmukhi = 0x0a1d;
15417  t.jheharmenian = 0x057b;
15418  t.jis = 0x3004;
15419  t.jmonospace = 0xff4a;
15420  t.jparen = 0x24a5;
15421  t.jsuperior = 0x02b2;
15422  t.k = 0x006b;
15423  t.kabashkircyrillic = 0x04a1;
15424  t.kabengali = 0x0995;
15425  t.kacute = 0x1e31;
15426  t.kacyrillic = 0x043a;
15427  t.kadescendercyrillic = 0x049b;
15428  t.kadeva = 0x0915;
15429  t.kaf = 0x05db;
15430  t.kafarabic = 0x0643;
15431  t.kafdagesh = 0xfb3b;
15432  t.kafdageshhebrew = 0xfb3b;
15433  t.kaffinalarabic = 0xfeda;
15434  t.kafhebrew = 0x05db;
15435  t.kafinitialarabic = 0xfedb;
15436  t.kafmedialarabic = 0xfedc;
15437  t.kafrafehebrew = 0xfb4d;
15438  t.kagujarati = 0x0a95;
15439  t.kagurmukhi = 0x0a15;
15440  t.kahiragana = 0x304b;
15441  t.kahookcyrillic = 0x04c4;
15442  t.kakatakana = 0x30ab;
15443  t.kakatakanahalfwidth = 0xff76;
15444  t.kappa = 0x03ba;
15445  t.kappasymbolgreek = 0x03f0;
15446  t.kapyeounmieumkorean = 0x3171;
15447  t.kapyeounphieuphkorean = 0x3184;
15448  t.kapyeounpieupkorean = 0x3178;
15449  t.kapyeounssangpieupkorean = 0x3179;
15450  t.karoriisquare = 0x330d;
15451  t.kashidaautoarabic = 0x0640;
15452  t.kashidaautonosidebearingarabic = 0x0640;
15453  t.kasmallkatakana = 0x30f5;
15454  t.kasquare = 0x3384;
15455  t.kasraarabic = 0x0650;
15456  t.kasratanarabic = 0x064d;
15457  t.kastrokecyrillic = 0x049f;
15458  t.katahiraprolongmarkhalfwidth = 0xff70;
15459  t.kaverticalstrokecyrillic = 0x049d;
15460  t.kbopomofo = 0x310e;
15461  t.kcalsquare = 0x3389;
15462  t.kcaron = 0x01e9;
15463  t.kcedilla = 0x0137;
15464  t.kcircle = 0x24da;
15465  t.kcommaaccent = 0x0137;
15466  t.kdotbelow = 0x1e33;
15467  t.keharmenian = 0x0584;
15468  t.kehiragana = 0x3051;
15469  t.kekatakana = 0x30b1;
15470  t.kekatakanahalfwidth = 0xff79;
15471  t.kenarmenian = 0x056f;
15472  t.kesmallkatakana = 0x30f6;
15473  t.kgreenlandic = 0x0138;
15474  t.khabengali = 0x0996;
15475  t.khacyrillic = 0x0445;
15476  t.khadeva = 0x0916;
15477  t.khagujarati = 0x0a96;
15478  t.khagurmukhi = 0x0a16;
15479  t.khaharabic = 0x062e;
15480  t.khahfinalarabic = 0xfea6;
15481  t.khahinitialarabic = 0xfea7;
15482  t.khahmedialarabic = 0xfea8;
15483  t.kheicoptic = 0x03e7;
15484  t.khhadeva = 0x0959;
15485  t.khhagurmukhi = 0x0a59;
15486  t.khieukhacirclekorean = 0x3278;
15487  t.khieukhaparenkorean = 0x3218;
15488  t.khieukhcirclekorean = 0x326a;
15489  t.khieukhkorean = 0x314b;
15490  t.khieukhparenkorean = 0x320a;
15491  t.khokhaithai = 0x0e02;
15492  t.khokhonthai = 0x0e05;
15493  t.khokhuatthai = 0x0e03;
15494  t.khokhwaithai = 0x0e04;
15495  t.khomutthai = 0x0e5b;
15496  t.khook = 0x0199;
15497  t.khorakhangthai = 0x0e06;
15498  t.khzsquare = 0x3391;
15499  t.kihiragana = 0x304d;
15500  t.kikatakana = 0x30ad;
15501  t.kikatakanahalfwidth = 0xff77;
15502  t.kiroguramusquare = 0x3315;
15503  t.kiromeetorusquare = 0x3316;
15504  t.kirosquare = 0x3314;
15505  t.kiyeokacirclekorean = 0x326e;
15506  t.kiyeokaparenkorean = 0x320e;
15507  t.kiyeokcirclekorean = 0x3260;
15508  t.kiyeokkorean = 0x3131;
15509  t.kiyeokparenkorean = 0x3200;
15510  t.kiyeoksioskorean = 0x3133;
15511  t.kjecyrillic = 0x045c;
15512  t.klinebelow = 0x1e35;
15513  t.klsquare = 0x3398;
15514  t.kmcubedsquare = 0x33a6;
15515  t.kmonospace = 0xff4b;
15516  t.kmsquaredsquare = 0x33a2;
15517  t.kohiragana = 0x3053;
15518  t.kohmsquare = 0x33c0;
15519  t.kokaithai = 0x0e01;
15520  t.kokatakana = 0x30b3;
15521  t.kokatakanahalfwidth = 0xff7a;
15522  t.kooposquare = 0x331e;
15523  t.koppacyrillic = 0x0481;
15524  t.koreanstandardsymbol = 0x327f;
15525  t.koroniscmb = 0x0343;
15526  t.kparen = 0x24a6;
15527  t.kpasquare = 0x33aa;
15528  t.ksicyrillic = 0x046f;
15529  t.ktsquare = 0x33cf;
15530  t.kturned = 0x029e;
15531  t.kuhiragana = 0x304f;
15532  t.kukatakana = 0x30af;
15533  t.kukatakanahalfwidth = 0xff78;
15534  t.kvsquare = 0x33b8;
15535  t.kwsquare = 0x33be;
15536  t.l = 0x006c;
15537  t.labengali = 0x09b2;
15538  t.lacute = 0x013a;
15539  t.ladeva = 0x0932;
15540  t.lagujarati = 0x0ab2;
15541  t.lagurmukhi = 0x0a32;
15542  t.lakkhangyaothai = 0x0e45;
15543  t.lamaleffinalarabic = 0xfefc;
15544  t.lamalefhamzaabovefinalarabic = 0xfef8;
15545  t.lamalefhamzaaboveisolatedarabic = 0xfef7;
15546  t.lamalefhamzabelowfinalarabic = 0xfefa;
15547  t.lamalefhamzabelowisolatedarabic = 0xfef9;
15548  t.lamalefisolatedarabic = 0xfefb;
15549  t.lamalefmaddaabovefinalarabic = 0xfef6;
15550  t.lamalefmaddaaboveisolatedarabic = 0xfef5;
15551  t.lamarabic = 0x0644;
15552  t.lambda = 0x03bb;
15553  t.lambdastroke = 0x019b;
15554  t.lamed = 0x05dc;
15555  t.lameddagesh = 0xfb3c;
15556  t.lameddageshhebrew = 0xfb3c;
15557  t.lamedhebrew = 0x05dc;
15558  t.lamfinalarabic = 0xfede;
15559  t.lamhahinitialarabic = 0xfcca;
15560  t.laminitialarabic = 0xfedf;
15561  t.lamjeeminitialarabic = 0xfcc9;
15562  t.lamkhahinitialarabic = 0xfccb;
15563  t.lamlamhehisolatedarabic = 0xfdf2;
15564  t.lammedialarabic = 0xfee0;
15565  t.lammeemhahinitialarabic = 0xfd88;
15566  t.lammeeminitialarabic = 0xfccc;
15567  t.largecircle = 0x25ef;
15568  t.lbar = 0x019a;
15569  t.lbelt = 0x026c;
15570  t.lbopomofo = 0x310c;
15571  t.lcaron = 0x013e;
15572  t.lcedilla = 0x013c;
15573  t.lcircle = 0x24db;
15574  t.lcircumflexbelow = 0x1e3d;
15575  t.lcommaaccent = 0x013c;
15576  t.ldot = 0x0140;
15577  t.ldotaccent = 0x0140;
15578  t.ldotbelow = 0x1e37;
15579  t.ldotbelowmacron = 0x1e39;
15580  t.leftangleabovecmb = 0x031a;
15581  t.lefttackbelowcmb = 0x0318;
15582  t.less = 0x003c;
15583  t.lessequal = 0x2264;
15584  t.lessequalorgreater = 0x22da;
15585  t.lessmonospace = 0xff1c;
15586  t.lessorequivalent = 0x2272;
15587  t.lessorgreater = 0x2276;
15588  t.lessoverequal = 0x2266;
15589  t.lesssmall = 0xfe64;
15590  t.lezh = 0x026e;
15591  t.lfblock = 0x258c;
15592  t.lhookretroflex = 0x026d;
15593  t.lira = 0x20a4;
15594  t.liwnarmenian = 0x056c;
15595  t.lj = 0x01c9;
15596  t.ljecyrillic = 0x0459;
15597  t.ll = 0xf6c0;
15598  t.lladeva = 0x0933;
15599  t.llagujarati = 0x0ab3;
15600  t.llinebelow = 0x1e3b;
15601  t.llladeva = 0x0934;
15602  t.llvocalicbengali = 0x09e1;
15603  t.llvocalicdeva = 0x0961;
15604  t.llvocalicvowelsignbengali = 0x09e3;
15605  t.llvocalicvowelsigndeva = 0x0963;
15606  t.lmiddletilde = 0x026b;
15607  t.lmonospace = 0xff4c;
15608  t.lmsquare = 0x33d0;
15609  t.lochulathai = 0x0e2c;
15610  t.logicaland = 0x2227;
15611  t.logicalnot = 0x00ac;
15612  t.logicalnotreversed = 0x2310;
15613  t.logicalor = 0x2228;
15614  t.lolingthai = 0x0e25;
15615  t.longs = 0x017f;
15616  t.lowlinecenterline = 0xfe4e;
15617  t.lowlinecmb = 0x0332;
15618  t.lowlinedashed = 0xfe4d;
15619  t.lozenge = 0x25ca;
15620  t.lparen = 0x24a7;
15621  t.lslash = 0x0142;
15622  t.lsquare = 0x2113;
15623  t.lsuperior = 0xf6ee;
15624  t.ltshade = 0x2591;
15625  t.luthai = 0x0e26;
15626  t.lvocalicbengali = 0x098c;
15627  t.lvocalicdeva = 0x090c;
15628  t.lvocalicvowelsignbengali = 0x09e2;
15629  t.lvocalicvowelsigndeva = 0x0962;
15630  t.lxsquare = 0x33d3;
15631  t.m = 0x006d;
15632  t.mabengali = 0x09ae;
15633  t.macron = 0x00af;
15634  t.macronbelowcmb = 0x0331;
15635  t.macroncmb = 0x0304;
15636  t.macronlowmod = 0x02cd;
15637  t.macronmonospace = 0xffe3;
15638  t.macute = 0x1e3f;
15639  t.madeva = 0x092e;
15640  t.magujarati = 0x0aae;
15641  t.magurmukhi = 0x0a2e;
15642  t.mahapakhhebrew = 0x05a4;
15643  t.mahapakhlefthebrew = 0x05a4;
15644  t.mahiragana = 0x307e;
15645  t.maichattawalowleftthai = 0xf895;
15646  t.maichattawalowrightthai = 0xf894;
15647  t.maichattawathai = 0x0e4b;
15648  t.maichattawaupperleftthai = 0xf893;
15649  t.maieklowleftthai = 0xf88c;
15650  t.maieklowrightthai = 0xf88b;
15651  t.maiekthai = 0x0e48;
15652  t.maiekupperleftthai = 0xf88a;
15653  t.maihanakatleftthai = 0xf884;
15654  t.maihanakatthai = 0x0e31;
15655  t.maitaikhuleftthai = 0xf889;
15656  t.maitaikhuthai = 0x0e47;
15657  t.maitholowleftthai = 0xf88f;
15658  t.maitholowrightthai = 0xf88e;
15659  t.maithothai = 0x0e49;
15660  t.maithoupperleftthai = 0xf88d;
15661  t.maitrilowleftthai = 0xf892;
15662  t.maitrilowrightthai = 0xf891;
15663  t.maitrithai = 0x0e4a;
15664  t.maitriupperleftthai = 0xf890;
15665  t.maiyamokthai = 0x0e46;
15666  t.makatakana = 0x30de;
15667  t.makatakanahalfwidth = 0xff8f;
15668  t.male = 0x2642;
15669  t.mansyonsquare = 0x3347;
15670  t.maqafhebrew = 0x05be;
15671  t.mars = 0x2642;
15672  t.masoracirclehebrew = 0x05af;
15673  t.masquare = 0x3383;
15674  t.mbopomofo = 0x3107;
15675  t.mbsquare = 0x33d4;
15676  t.mcircle = 0x24dc;
15677  t.mcubedsquare = 0x33a5;
15678  t.mdotaccent = 0x1e41;
15679  t.mdotbelow = 0x1e43;
15680  t.meemarabic = 0x0645;
15681  t.meemfinalarabic = 0xfee2;
15682  t.meeminitialarabic = 0xfee3;
15683  t.meemmedialarabic = 0xfee4;
15684  t.meemmeeminitialarabic = 0xfcd1;
15685  t.meemmeemisolatedarabic = 0xfc48;
15686  t.meetorusquare = 0x334d;
15687  t.mehiragana = 0x3081;
15688  t.meizierasquare = 0x337e;
15689  t.mekatakana = 0x30e1;
15690  t.mekatakanahalfwidth = 0xff92;
15691  t.mem = 0x05de;
15692  t.memdagesh = 0xfb3e;
15693  t.memdageshhebrew = 0xfb3e;
15694  t.memhebrew = 0x05de;
15695  t.menarmenian = 0x0574;
15696  t.merkhahebrew = 0x05a5;
15697  t.merkhakefulahebrew = 0x05a6;
15698  t.merkhakefulalefthebrew = 0x05a6;
15699  t.merkhalefthebrew = 0x05a5;
15700  t.mhook = 0x0271;
15701  t.mhzsquare = 0x3392;
15702  t.middledotkatakanahalfwidth = 0xff65;
15703  t.middot = 0x00b7;
15704  t.mieumacirclekorean = 0x3272;
15705  t.mieumaparenkorean = 0x3212;
15706  t.mieumcirclekorean = 0x3264;
15707  t.mieumkorean = 0x3141;
15708  t.mieumpansioskorean = 0x3170;
15709  t.mieumparenkorean = 0x3204;
15710  t.mieumpieupkorean = 0x316e;
15711  t.mieumsioskorean = 0x316f;
15712  t.mihiragana = 0x307f;
15713  t.mikatakana = 0x30df;
15714  t.mikatakanahalfwidth = 0xff90;
15715  t.minus = 0x2212;
15716  t.minusbelowcmb = 0x0320;
15717  t.minuscircle = 0x2296;
15718  t.minusmod = 0x02d7;
15719  t.minusplus = 0x2213;
15720  t.minute = 0x2032;
15721  t.miribaarusquare = 0x334a;
15722  t.mirisquare = 0x3349;
15723  t.mlonglegturned = 0x0270;
15724  t.mlsquare = 0x3396;
15725  t.mmcubedsquare = 0x33a3;
15726  t.mmonospace = 0xff4d;
15727  t.mmsquaredsquare = 0x339f;
15728  t.mohiragana = 0x3082;
15729  t.mohmsquare = 0x33c1;
15730  t.mokatakana = 0x30e2;
15731  t.mokatakanahalfwidth = 0xff93;
15732  t.molsquare = 0x33d6;
15733  t.momathai = 0x0e21;
15734  t.moverssquare = 0x33a7;
15735  t.moverssquaredsquare = 0x33a8;
15736  t.mparen = 0x24a8;
15737  t.mpasquare = 0x33ab;
15738  t.mssquare = 0x33b3;
15739  t.msuperior = 0xf6ef;
15740  t.mturned = 0x026f;
15741  t.mu = 0x00b5;
15742  t.mu1 = 0x00b5;
15743  t.muasquare = 0x3382;
15744  t.muchgreater = 0x226b;
15745  t.muchless = 0x226a;
15746  t.mufsquare = 0x338c;
15747  t.mugreek = 0x03bc;
15748  t.mugsquare = 0x338d;
15749  t.muhiragana = 0x3080;
15750  t.mukatakana = 0x30e0;
15751  t.mukatakanahalfwidth = 0xff91;
15752  t.mulsquare = 0x3395;
15753  t.multiply = 0x00d7;
15754  t.mumsquare = 0x339b;
15755  t.munahhebrew = 0x05a3;
15756  t.munahlefthebrew = 0x05a3;
15757  t.musicalnote = 0x266a;
15758  t.musicalnotedbl = 0x266b;
15759  t.musicflatsign = 0x266d;
15760  t.musicsharpsign = 0x266f;
15761  t.mussquare = 0x33b2;
15762  t.muvsquare = 0x33b6;
15763  t.muwsquare = 0x33bc;
15764  t.mvmegasquare = 0x33b9;
15765  t.mvsquare = 0x33b7;
15766  t.mwmegasquare = 0x33bf;
15767  t.mwsquare = 0x33bd;
15768  t.n = 0x006e;
15769  t.nabengali = 0x09a8;
15770  t.nabla = 0x2207;
15771  t.nacute = 0x0144;
15772  t.nadeva = 0x0928;
15773  t.nagujarati = 0x0aa8;
15774  t.nagurmukhi = 0x0a28;
15775  t.nahiragana = 0x306a;
15776  t.nakatakana = 0x30ca;
15777  t.nakatakanahalfwidth = 0xff85;
15778  t.napostrophe = 0x0149;
15779  t.nasquare = 0x3381;
15780  t.nbopomofo = 0x310b;
15781  t.nbspace = 0x00a0;
15782  t.ncaron = 0x0148;
15783  t.ncedilla = 0x0146;
15784  t.ncircle = 0x24dd;
15785  t.ncircumflexbelow = 0x1e4b;
15786  t.ncommaaccent = 0x0146;
15787  t.ndotaccent = 0x1e45;
15788  t.ndotbelow = 0x1e47;
15789  t.nehiragana = 0x306d;
15790  t.nekatakana = 0x30cd;
15791  t.nekatakanahalfwidth = 0xff88;
15792  t.newsheqelsign = 0x20aa;
15793  t.nfsquare = 0x338b;
15794  t.ngabengali = 0x0999;
15795  t.ngadeva = 0x0919;
15796  t.ngagujarati = 0x0a99;
15797  t.ngagurmukhi = 0x0a19;
15798  t.ngonguthai = 0x0e07;
15799  t.nhiragana = 0x3093;
15800  t.nhookleft = 0x0272;
15801  t.nhookretroflex = 0x0273;
15802  t.nieunacirclekorean = 0x326f;
15803  t.nieunaparenkorean = 0x320f;
15804  t.nieuncieuckorean = 0x3135;
15805  t.nieuncirclekorean = 0x3261;
15806  t.nieunhieuhkorean = 0x3136;
15807  t.nieunkorean = 0x3134;
15808  t.nieunpansioskorean = 0x3168;
15809  t.nieunparenkorean = 0x3201;
15810  t.nieunsioskorean = 0x3167;
15811  t.nieuntikeutkorean = 0x3166;
15812  t.nihiragana = 0x306b;
15813  t.nikatakana = 0x30cb;
15814  t.nikatakanahalfwidth = 0xff86;
15815  t.nikhahitleftthai = 0xf899;
15816  t.nikhahitthai = 0x0e4d;
15817  t.nine = 0x0039;
15818  t.ninearabic = 0x0669;
15819  t.ninebengali = 0x09ef;
15820  t.ninecircle = 0x2468;
15821  t.ninecircleinversesansserif = 0x2792;
15822  t.ninedeva = 0x096f;
15823  t.ninegujarati = 0x0aef;
15824  t.ninegurmukhi = 0x0a6f;
15825  t.ninehackarabic = 0x0669;
15826  t.ninehangzhou = 0x3029;
15827  t.nineideographicparen = 0x3228;
15828  t.nineinferior = 0x2089;
15829  t.ninemonospace = 0xff19;
15830  t.nineoldstyle = 0xf739;
15831  t.nineparen = 0x247c;
15832  t.nineperiod = 0x2490;
15833  t.ninepersian = 0x06f9;
15834  t.nineroman = 0x2178;
15835  t.ninesuperior = 0x2079;
15836  t.nineteencircle = 0x2472;
15837  t.nineteenparen = 0x2486;
15838  t.nineteenperiod = 0x249a;
15839  t.ninethai = 0x0e59;
15840  t.nj = 0x01cc;
15841  t.njecyrillic = 0x045a;
15842  t.nkatakana = 0x30f3;
15843  t.nkatakanahalfwidth = 0xff9d;
15844  t.nlegrightlong = 0x019e;
15845  t.nlinebelow = 0x1e49;
15846  t.nmonospace = 0xff4e;
15847  t.nmsquare = 0x339a;
15848  t.nnabengali = 0x09a3;
15849  t.nnadeva = 0x0923;
15850  t.nnagujarati = 0x0aa3;
15851  t.nnagurmukhi = 0x0a23;
15852  t.nnnadeva = 0x0929;
15853  t.nohiragana = 0x306e;
15854  t.nokatakana = 0x30ce;
15855  t.nokatakanahalfwidth = 0xff89;
15856  t.nonbreakingspace = 0x00a0;
15857  t.nonenthai = 0x0e13;
15858  t.nonuthai = 0x0e19;
15859  t.noonarabic = 0x0646;
15860  t.noonfinalarabic = 0xfee6;
15861  t.noonghunnaarabic = 0x06ba;
15862  t.noonghunnafinalarabic = 0xfb9f;
15863  t.nooninitialarabic = 0xfee7;
15864  t.noonjeeminitialarabic = 0xfcd2;
15865  t.noonjeemisolatedarabic = 0xfc4b;
15866  t.noonmedialarabic = 0xfee8;
15867  t.noonmeeminitialarabic = 0xfcd5;
15868  t.noonmeemisolatedarabic = 0xfc4e;
15869  t.noonnoonfinalarabic = 0xfc8d;
15870  t.notcontains = 0x220c;
15871  t.notelement = 0x2209;
15872  t.notelementof = 0x2209;
15873  t.notequal = 0x2260;
15874  t.notgreater = 0x226f;
15875  t.notgreaternorequal = 0x2271;
15876  t.notgreaternorless = 0x2279;
15877  t.notidentical = 0x2262;
15878  t.notless = 0x226e;
15879  t.notlessnorequal = 0x2270;
15880  t.notparallel = 0x2226;
15881  t.notprecedes = 0x2280;
15882  t.notsubset = 0x2284;
15883  t.notsucceeds = 0x2281;
15884  t.notsuperset = 0x2285;
15885  t.nowarmenian = 0x0576;
15886  t.nparen = 0x24a9;
15887  t.nssquare = 0x33b1;
15888  t.nsuperior = 0x207f;
15889  t.ntilde = 0x00f1;
15890  t.nu = 0x03bd;
15891  t.nuhiragana = 0x306c;
15892  t.nukatakana = 0x30cc;
15893  t.nukatakanahalfwidth = 0xff87;
15894  t.nuktabengali = 0x09bc;
15895  t.nuktadeva = 0x093c;
15896  t.nuktagujarati = 0x0abc;
15897  t.nuktagurmukhi = 0x0a3c;
15898  t.numbersign = 0x0023;
15899  t.numbersignmonospace = 0xff03;
15900  t.numbersignsmall = 0xfe5f;
15901  t.numeralsigngreek = 0x0374;
15902  t.numeralsignlowergreek = 0x0375;
15903  t.numero = 0x2116;
15904  t.nun = 0x05e0;
15905  t.nundagesh = 0xfb40;
15906  t.nundageshhebrew = 0xfb40;
15907  t.nunhebrew = 0x05e0;
15908  t.nvsquare = 0x33b5;
15909  t.nwsquare = 0x33bb;
15910  t.nyabengali = 0x099e;
15911  t.nyadeva = 0x091e;
15912  t.nyagujarati = 0x0a9e;
15913  t.nyagurmukhi = 0x0a1e;
15914  t.o = 0x006f;
15915  t.oacute = 0x00f3;
15916  t.oangthai = 0x0e2d;
15917  t.obarred = 0x0275;
15918  t.obarredcyrillic = 0x04e9;
15919  t.obarreddieresiscyrillic = 0x04eb;
15920  t.obengali = 0x0993;
15921  t.obopomofo = 0x311b;
15922  t.obreve = 0x014f;
15923  t.ocandradeva = 0x0911;
15924  t.ocandragujarati = 0x0a91;
15925  t.ocandravowelsigndeva = 0x0949;
15926  t.ocandravowelsigngujarati = 0x0ac9;
15927  t.ocaron = 0x01d2;
15928  t.ocircle = 0x24de;
15929  t.ocircumflex = 0x00f4;
15930  t.ocircumflexacute = 0x1ed1;
15931  t.ocircumflexdotbelow = 0x1ed9;
15932  t.ocircumflexgrave = 0x1ed3;
15933  t.ocircumflexhookabove = 0x1ed5;
15934  t.ocircumflextilde = 0x1ed7;
15935  t.ocyrillic = 0x043e;
15936  t.odblacute = 0x0151;
15937  t.odblgrave = 0x020d;
15938  t.odeva = 0x0913;
15939  t.odieresis = 0x00f6;
15940  t.odieresiscyrillic = 0x04e7;
15941  t.odotbelow = 0x1ecd;
15942  t.oe = 0x0153;
15943  t.oekorean = 0x315a;
15944  t.ogonek = 0x02db;
15945  t.ogonekcmb = 0x0328;
15946  t.ograve = 0x00f2;
15947  t.ogujarati = 0x0a93;
15948  t.oharmenian = 0x0585;
15949  t.ohiragana = 0x304a;
15950  t.ohookabove = 0x1ecf;
15951  t.ohorn = 0x01a1;
15952  t.ohornacute = 0x1edb;
15953  t.ohorndotbelow = 0x1ee3;
15954  t.ohorngrave = 0x1edd;
15955  t.ohornhookabove = 0x1edf;
15956  t.ohorntilde = 0x1ee1;
15957  t.ohungarumlaut = 0x0151;
15958  t.oi = 0x01a3;
15959  t.oinvertedbreve = 0x020f;
15960  t.okatakana = 0x30aa;
15961  t.okatakanahalfwidth = 0xff75;
15962  t.okorean = 0x3157;
15963  t.olehebrew = 0x05ab;
15964  t.omacron = 0x014d;
15965  t.omacronacute = 0x1e53;
15966  t.omacrongrave = 0x1e51;
15967  t.omdeva = 0x0950;
15968  t.omega = 0x03c9;
15969  t.omega1 = 0x03d6;
15970  t.omegacyrillic = 0x0461;
15971  t.omegalatinclosed = 0x0277;
15972  t.omegaroundcyrillic = 0x047b;
15973  t.omegatitlocyrillic = 0x047d;
15974  t.omegatonos = 0x03ce;
15975  t.omgujarati = 0x0ad0;
15976  t.omicron = 0x03bf;
15977  t.omicrontonos = 0x03cc;
15978  t.omonospace = 0xff4f;
15979  t.one = 0x0031;
15980  t.onearabic = 0x0661;
15981  t.onebengali = 0x09e7;
15982  t.onecircle = 0x2460;
15983  t.onecircleinversesansserif = 0x278a;
15984  t.onedeva = 0x0967;
15985  t.onedotenleader = 0x2024;
15986  t.oneeighth = 0x215b;
15987  t.onefitted = 0xf6dc;
15988  t.onegujarati = 0x0ae7;
15989  t.onegurmukhi = 0x0a67;
15990  t.onehackarabic = 0x0661;
15991  t.onehalf = 0x00bd;
15992  t.onehangzhou = 0x3021;
15993  t.oneideographicparen = 0x3220;
15994  t.oneinferior = 0x2081;
15995  t.onemonospace = 0xff11;
15996  t.onenumeratorbengali = 0x09f4;
15997  t.oneoldstyle = 0xf731;
15998  t.oneparen = 0x2474;
15999  t.oneperiod = 0x2488;
16000  t.onepersian = 0x06f1;
16001  t.onequarter = 0x00bc;
16002  t.oneroman = 0x2170;
16003  t.onesuperior = 0x00b9;
16004  t.onethai = 0x0e51;
16005  t.onethird = 0x2153;
16006  t.oogonek = 0x01eb;
16007  t.oogonekmacron = 0x01ed;
16008  t.oogurmukhi = 0x0a13;
16009  t.oomatragurmukhi = 0x0a4b;
16010  t.oopen = 0x0254;
16011  t.oparen = 0x24aa;
16012  t.openbullet = 0x25e6;
16013  t.option = 0x2325;
16014  t.ordfeminine = 0x00aa;
16015  t.ordmasculine = 0x00ba;
16016  t.orthogonal = 0x221f;
16017  t.oshortdeva = 0x0912;
16018  t.oshortvowelsigndeva = 0x094a;
16019  t.oslash = 0x00f8;
16020  t.oslashacute = 0x01ff;
16021  t.osmallhiragana = 0x3049;
16022  t.osmallkatakana = 0x30a9;
16023  t.osmallkatakanahalfwidth = 0xff6b;
16024  t.ostrokeacute = 0x01ff;
16025  t.osuperior = 0xf6f0;
16026  t.otcyrillic = 0x047f;
16027  t.otilde = 0x00f5;
16028  t.otildeacute = 0x1e4d;
16029  t.otildedieresis = 0x1e4f;
16030  t.oubopomofo = 0x3121;
16031  t.overline = 0x203e;
16032  t.overlinecenterline = 0xfe4a;
16033  t.overlinecmb = 0x0305;
16034  t.overlinedashed = 0xfe49;
16035  t.overlinedblwavy = 0xfe4c;
16036  t.overlinewavy = 0xfe4b;
16037  t.overscore = 0x00af;
16038  t.ovowelsignbengali = 0x09cb;
16039  t.ovowelsigndeva = 0x094b;
16040  t.ovowelsigngujarati = 0x0acb;
16041  t.p = 0x0070;
16042  t.paampssquare = 0x3380;
16043  t.paasentosquare = 0x332b;
16044  t.pabengali = 0x09aa;
16045  t.pacute = 0x1e55;
16046  t.padeva = 0x092a;
16047  t.pagedown = 0x21df;
16048  t.pageup = 0x21de;
16049  t.pagujarati = 0x0aaa;
16050  t.pagurmukhi = 0x0a2a;
16051  t.pahiragana = 0x3071;
16052  t.paiyannoithai = 0x0e2f;
16053  t.pakatakana = 0x30d1;
16054  t.palatalizationcyrilliccmb = 0x0484;
16055  t.palochkacyrillic = 0x04c0;
16056  t.pansioskorean = 0x317f;
16057  t.paragraph = 0x00b6;
16058  t.parallel = 0x2225;
16059  t.parenleft = 0x0028;
16060  t.parenleftaltonearabic = 0xfd3e;
16061  t.parenleftbt = 0xf8ed;
16062  t.parenleftex = 0xf8ec;
16063  t.parenleftinferior = 0x208d;
16064  t.parenleftmonospace = 0xff08;
16065  t.parenleftsmall = 0xfe59;
16066  t.parenleftsuperior = 0x207d;
16067  t.parenlefttp = 0xf8eb;
16068  t.parenleftvertical = 0xfe35;
16069  t.parenright = 0x0029;
16070  t.parenrightaltonearabic = 0xfd3f;
16071  t.parenrightbt = 0xf8f8;
16072  t.parenrightex = 0xf8f7;
16073  t.parenrightinferior = 0x208e;
16074  t.parenrightmonospace = 0xff09;
16075  t.parenrightsmall = 0xfe5a;
16076  t.parenrightsuperior = 0x207e;
16077  t.parenrighttp = 0xf8f6;
16078  t.parenrightvertical = 0xfe36;
16079  t.partialdiff = 0x2202;
16080  t.paseqhebrew = 0x05c0;
16081  t.pashtahebrew = 0x0599;
16082  t.pasquare = 0x33a9;
16083  t.patah = 0x05b7;
16084  t.patah11 = 0x05b7;
16085  t.patah1d = 0x05b7;
16086  t.patah2a = 0x05b7;
16087  t.patahhebrew = 0x05b7;
16088  t.patahnarrowhebrew = 0x05b7;
16089  t.patahquarterhebrew = 0x05b7;
16090  t.patahwidehebrew = 0x05b7;
16091  t.pazerhebrew = 0x05a1;
16092  t.pbopomofo = 0x3106;
16093  t.pcircle = 0x24df;
16094  t.pdotaccent = 0x1e57;
16095  t.pe = 0x05e4;
16096  t.pecyrillic = 0x043f;
16097  t.pedagesh = 0xfb44;
16098  t.pedageshhebrew = 0xfb44;
16099  t.peezisquare = 0x333b;
16100  t.pefinaldageshhebrew = 0xfb43;
16101  t.peharabic = 0x067e;
16102  t.peharmenian = 0x057a;
16103  t.pehebrew = 0x05e4;
16104  t.pehfinalarabic = 0xfb57;
16105  t.pehinitialarabic = 0xfb58;
16106  t.pehiragana = 0x307a;
16107  t.pehmedialarabic = 0xfb59;
16108  t.pekatakana = 0x30da;
16109  t.pemiddlehookcyrillic = 0x04a7;
16110  t.perafehebrew = 0xfb4e;
16111  t.percent = 0x0025;
16112  t.percentarabic = 0x066a;
16113  t.percentmonospace = 0xff05;
16114  t.percentsmall = 0xfe6a;
16115  t.period = 0x002e;
16116  t.periodarmenian = 0x0589;
16117  t.periodcentered = 0x00b7;
16118  t.periodhalfwidth = 0xff61;
16119  t.periodinferior = 0xf6e7;
16120  t.periodmonospace = 0xff0e;
16121  t.periodsmall = 0xfe52;
16122  t.periodsuperior = 0xf6e8;
16123  t.perispomenigreekcmb = 0x0342;
16124  t.perpendicular = 0x22a5;
16125  t.perthousand = 0x2030;
16126  t.peseta = 0x20a7;
16127  t.pfsquare = 0x338a;
16128  t.phabengali = 0x09ab;
16129  t.phadeva = 0x092b;
16130  t.phagujarati = 0x0aab;
16131  t.phagurmukhi = 0x0a2b;
16132  t.phi = 0x03c6;
16133  t.phi1 = 0x03d5;
16134  t.phieuphacirclekorean = 0x327a;
16135  t.phieuphaparenkorean = 0x321a;
16136  t.phieuphcirclekorean = 0x326c;
16137  t.phieuphkorean = 0x314d;
16138  t.phieuphparenkorean = 0x320c;
16139  t.philatin = 0x0278;
16140  t.phinthuthai = 0x0e3a;
16141  t.phisymbolgreek = 0x03d5;
16142  t.phook = 0x01a5;
16143  t.phophanthai = 0x0e1e;
16144  t.phophungthai = 0x0e1c;
16145  t.phosamphaothai = 0x0e20;
16146  t.pi = 0x03c0;
16147  t.pieupacirclekorean = 0x3273;
16148  t.pieupaparenkorean = 0x3213;
16149  t.pieupcieuckorean = 0x3176;
16150  t.pieupcirclekorean = 0x3265;
16151  t.pieupkiyeokkorean = 0x3172;
16152  t.pieupkorean = 0x3142;
16153  t.pieupparenkorean = 0x3205;
16154  t.pieupsioskiyeokkorean = 0x3174;
16155  t.pieupsioskorean = 0x3144;
16156  t.pieupsiostikeutkorean = 0x3175;
16157  t.pieupthieuthkorean = 0x3177;
16158  t.pieuptikeutkorean = 0x3173;
16159  t.pihiragana = 0x3074;
16160  t.pikatakana = 0x30d4;
16161  t.pisymbolgreek = 0x03d6;
16162  t.piwrarmenian = 0x0583;
16163  t.planckover2pi = 0x210f;
16164  t.planckover2pi1 = 0x210f;
16165  t.plus = 0x002b;
16166  t.plusbelowcmb = 0x031f;
16167  t.pluscircle = 0x2295;
16168  t.plusminus = 0x00b1;
16169  t.plusmod = 0x02d6;
16170  t.plusmonospace = 0xff0b;
16171  t.plussmall = 0xfe62;
16172  t.plussuperior = 0x207a;
16173  t.pmonospace = 0xff50;
16174  t.pmsquare = 0x33d8;
16175  t.pohiragana = 0x307d;
16176  t.pointingindexdownwhite = 0x261f;
16177  t.pointingindexleftwhite = 0x261c;
16178  t.pointingindexrightwhite = 0x261e;
16179  t.pointingindexupwhite = 0x261d;
16180  t.pokatakana = 0x30dd;
16181  t.poplathai = 0x0e1b;
16182  t.postalmark = 0x3012;
16183  t.postalmarkface = 0x3020;
16184  t.pparen = 0x24ab;
16185  t.precedes = 0x227a;
16186  t.prescription = 0x211e;
16187  t.primemod = 0x02b9;
16188  t.primereversed = 0x2035;
16189  t.product = 0x220f;
16190  t.projective = 0x2305;
16191  t.prolongedkana = 0x30fc;
16192  t.propellor = 0x2318;
16193  t.propersubset = 0x2282;
16194  t.propersuperset = 0x2283;
16195  t.proportion = 0x2237;
16196  t.proportional = 0x221d;
16197  t.psi = 0x03c8;
16198  t.psicyrillic = 0x0471;
16199  t.psilipneumatacyrilliccmb = 0x0486;
16200  t.pssquare = 0x33b0;
16201  t.puhiragana = 0x3077;
16202  t.pukatakana = 0x30d7;
16203  t.pvsquare = 0x33b4;
16204  t.pwsquare = 0x33ba;
16205  t.q = 0x0071;
16206  t.qadeva = 0x0958;
16207  t.qadmahebrew = 0x05a8;
16208  t.qafarabic = 0x0642;
16209  t.qaffinalarabic = 0xfed6;
16210  t.qafinitialarabic = 0xfed7;
16211  t.qafmedialarabic = 0xfed8;
16212  t.qamats = 0x05b8;
16213  t.qamats10 = 0x05b8;
16214  t.qamats1a = 0x05b8;
16215  t.qamats1c = 0x05b8;
16216  t.qamats27 = 0x05b8;
16217  t.qamats29 = 0x05b8;
16218  t.qamats33 = 0x05b8;
16219  t.qamatsde = 0x05b8;
16220  t.qamatshebrew = 0x05b8;
16221  t.qamatsnarrowhebrew = 0x05b8;
16222  t.qamatsqatanhebrew = 0x05b8;
16223  t.qamatsqatannarrowhebrew = 0x05b8;
16224  t.qamatsqatanquarterhebrew = 0x05b8;
16225  t.qamatsqatanwidehebrew = 0x05b8;
16226  t.qamatsquarterhebrew = 0x05b8;
16227  t.qamatswidehebrew = 0x05b8;
16228  t.qarneyparahebrew = 0x059f;
16229  t.qbopomofo = 0x3111;
16230  t.qcircle = 0x24e0;
16231  t.qhook = 0x02a0;
16232  t.qmonospace = 0xff51;
16233  t.qof = 0x05e7;
16234  t.qofdagesh = 0xfb47;
16235  t.qofdageshhebrew = 0xfb47;
16236  t.qofhebrew = 0x05e7;
16237  t.qparen = 0x24ac;
16238  t.quarternote = 0x2669;
16239  t.qubuts = 0x05bb;
16240  t.qubuts18 = 0x05bb;
16241  t.qubuts25 = 0x05bb;
16242  t.qubuts31 = 0x05bb;
16243  t.qubutshebrew = 0x05bb;
16244  t.qubutsnarrowhebrew = 0x05bb;
16245  t.qubutsquarterhebrew = 0x05bb;
16246  t.qubutswidehebrew = 0x05bb;
16247  t.question = 0x003f;
16248  t.questionarabic = 0x061f;
16249  t.questionarmenian = 0x055e;
16250  t.questiondown = 0x00bf;
16251  t.questiondownsmall = 0xf7bf;
16252  t.questiongreek = 0x037e;
16253  t.questionmonospace = 0xff1f;
16254  t.questionsmall = 0xf73f;
16255  t.quotedbl = 0x0022;
16256  t.quotedblbase = 0x201e;
16257  t.quotedblleft = 0x201c;
16258  t.quotedblmonospace = 0xff02;
16259  t.quotedblprime = 0x301e;
16260  t.quotedblprimereversed = 0x301d;
16261  t.quotedblright = 0x201d;
16262  t.quoteleft = 0x2018;
16263  t.quoteleftreversed = 0x201b;
16264  t.quotereversed = 0x201b;
16265  t.quoteright = 0x2019;
16266  t.quoterightn = 0x0149;
16267  t.quotesinglbase = 0x201a;
16268  t.quotesingle = 0x0027;
16269  t.quotesinglemonospace = 0xff07;
16270  t.r = 0x0072;
16271  t.raarmenian = 0x057c;
16272  t.rabengali = 0x09b0;
16273  t.racute = 0x0155;
16274  t.radeva = 0x0930;
16275  t.radical = 0x221a;
16276  t.radicalex = 0xf8e5;
16277  t.radoverssquare = 0x33ae;
16278  t.radoverssquaredsquare = 0x33af;
16279  t.radsquare = 0x33ad;
16280  t.rafe = 0x05bf;
16281  t.rafehebrew = 0x05bf;
16282  t.ragujarati = 0x0ab0;
16283  t.ragurmukhi = 0x0a30;
16284  t.rahiragana = 0x3089;
16285  t.rakatakana = 0x30e9;
16286  t.rakatakanahalfwidth = 0xff97;
16287  t.ralowerdiagonalbengali = 0x09f1;
16288  t.ramiddlediagonalbengali = 0x09f0;
16289  t.ramshorn = 0x0264;
16290  t.ratio = 0x2236;
16291  t.rbopomofo = 0x3116;
16292  t.rcaron = 0x0159;
16293  t.rcedilla = 0x0157;
16294  t.rcircle = 0x24e1;
16295  t.rcommaaccent = 0x0157;
16296  t.rdblgrave = 0x0211;
16297  t.rdotaccent = 0x1e59;
16298  t.rdotbelow = 0x1e5b;
16299  t.rdotbelowmacron = 0x1e5d;
16300  t.referencemark = 0x203b;
16301  t.reflexsubset = 0x2286;
16302  t.reflexsuperset = 0x2287;
16303  t.registered = 0x00ae;
16304  t.registersans = 0xf8e8;
16305  t.registerserif = 0xf6da;
16306  t.reharabic = 0x0631;
16307  t.reharmenian = 0x0580;
16308  t.rehfinalarabic = 0xfeae;
16309  t.rehiragana = 0x308c;
16310  t.rekatakana = 0x30ec;
16311  t.rekatakanahalfwidth = 0xff9a;
16312  t.resh = 0x05e8;
16313  t.reshdageshhebrew = 0xfb48;
16314  t.reshhebrew = 0x05e8;
16315  t.reversedtilde = 0x223d;
16316  t.reviahebrew = 0x0597;
16317  t.reviamugrashhebrew = 0x0597;
16318  t.revlogicalnot = 0x2310;
16319  t.rfishhook = 0x027e;
16320  t.rfishhookreversed = 0x027f;
16321  t.rhabengali = 0x09dd;
16322  t.rhadeva = 0x095d;
16323  t.rho = 0x03c1;
16324  t.rhook = 0x027d;
16325  t.rhookturned = 0x027b;
16326  t.rhookturnedsuperior = 0x02b5;
16327  t.rhosymbolgreek = 0x03f1;
16328  t.rhotichookmod = 0x02de;
16329  t.rieulacirclekorean = 0x3271;
16330  t.rieulaparenkorean = 0x3211;
16331  t.rieulcirclekorean = 0x3263;
16332  t.rieulhieuhkorean = 0x3140;
16333  t.rieulkiyeokkorean = 0x313a;
16334  t.rieulkiyeoksioskorean = 0x3169;
16335  t.rieulkorean = 0x3139;
16336  t.rieulmieumkorean = 0x313b;
16337  t.rieulpansioskorean = 0x316c;
16338  t.rieulparenkorean = 0x3203;
16339  t.rieulphieuphkorean = 0x313f;
16340  t.rieulpieupkorean = 0x313c;
16341  t.rieulpieupsioskorean = 0x316b;
16342  t.rieulsioskorean = 0x313d;
16343  t.rieulthieuthkorean = 0x313e;
16344  t.rieultikeutkorean = 0x316a;
16345  t.rieulyeorinhieuhkorean = 0x316d;
16346  t.rightangle = 0x221f;
16347  t.righttackbelowcmb = 0x0319;
16348  t.righttriangle = 0x22bf;
16349  t.rihiragana = 0x308a;
16350  t.rikatakana = 0x30ea;
16351  t.rikatakanahalfwidth = 0xff98;
16352  t.ring = 0x02da;
16353  t.ringbelowcmb = 0x0325;
16354  t.ringcmb = 0x030a;
16355  t.ringhalfleft = 0x02bf;
16356  t.ringhalfleftarmenian = 0x0559;
16357  t.ringhalfleftbelowcmb = 0x031c;
16358  t.ringhalfleftcentered = 0x02d3;
16359  t.ringhalfright = 0x02be;
16360  t.ringhalfrightbelowcmb = 0x0339;
16361  t.ringhalfrightcentered = 0x02d2;
16362  t.rinvertedbreve = 0x0213;
16363  t.rittorusquare = 0x3351;
16364  t.rlinebelow = 0x1e5f;
16365  t.rlongleg = 0x027c;
16366  t.rlonglegturned = 0x027a;
16367  t.rmonospace = 0xff52;
16368  t.rohiragana = 0x308d;
16369  t.rokatakana = 0x30ed;
16370  t.rokatakanahalfwidth = 0xff9b;
16371  t.roruathai = 0x0e23;
16372  t.rparen = 0x24ad;
16373  t.rrabengali = 0x09dc;
16374  t.rradeva = 0x0931;
16375  t.rragurmukhi = 0x0a5c;
16376  t.rreharabic = 0x0691;
16377  t.rrehfinalarabic = 0xfb8d;
16378  t.rrvocalicbengali = 0x09e0;
16379  t.rrvocalicdeva = 0x0960;
16380  t.rrvocalicgujarati = 0x0ae0;
16381  t.rrvocalicvowelsignbengali = 0x09c4;
16382  t.rrvocalicvowelsigndeva = 0x0944;
16383  t.rrvocalicvowelsigngujarati = 0x0ac4;
16384  t.rsuperior = 0xf6f1;
16385  t.rtblock = 0x2590;
16386  t.rturned = 0x0279;
16387  t.rturnedsuperior = 0x02b4;
16388  t.ruhiragana = 0x308b;
16389  t.rukatakana = 0x30eb;
16390  t.rukatakanahalfwidth = 0xff99;
16391  t.rupeemarkbengali = 0x09f2;
16392  t.rupeesignbengali = 0x09f3;
16393  t.rupiah = 0xf6dd;
16394  t.ruthai = 0x0e24;
16395  t.rvocalicbengali = 0x098b;
16396  t.rvocalicdeva = 0x090b;
16397  t.rvocalicgujarati = 0x0a8b;
16398  t.rvocalicvowelsignbengali = 0x09c3;
16399  t.rvocalicvowelsigndeva = 0x0943;
16400  t.rvocalicvowelsigngujarati = 0x0ac3;
16401  t.s = 0x0073;
16402  t.sabengali = 0x09b8;
16403  t.sacute = 0x015b;
16404  t.sacutedotaccent = 0x1e65;
16405  t.sadarabic = 0x0635;
16406  t.sadeva = 0x0938;
16407  t.sadfinalarabic = 0xfeba;
16408  t.sadinitialarabic = 0xfebb;
16409  t.sadmedialarabic = 0xfebc;
16410  t.sagujarati = 0x0ab8;
16411  t.sagurmukhi = 0x0a38;
16412  t.sahiragana = 0x3055;
16413  t.sakatakana = 0x30b5;
16414  t.sakatakanahalfwidth = 0xff7b;
16415  t.sallallahoualayhewasallamarabic = 0xfdfa;
16416  t.samekh = 0x05e1;
16417  t.samekhdagesh = 0xfb41;
16418  t.samekhdageshhebrew = 0xfb41;
16419  t.samekhhebrew = 0x05e1;
16420  t.saraaathai = 0x0e32;
16421  t.saraaethai = 0x0e41;
16422  t.saraaimaimalaithai = 0x0e44;
16423  t.saraaimaimuanthai = 0x0e43;
16424  t.saraamthai = 0x0e33;
16425  t.saraathai = 0x0e30;
16426  t.saraethai = 0x0e40;
16427  t.saraiileftthai = 0xf886;
16428  t.saraiithai = 0x0e35;
16429  t.saraileftthai = 0xf885;
16430  t.saraithai = 0x0e34;
16431  t.saraothai = 0x0e42;
16432  t.saraueeleftthai = 0xf888;
16433  t.saraueethai = 0x0e37;
16434  t.saraueleftthai = 0xf887;
16435  t.sarauethai = 0x0e36;
16436  t.sarauthai = 0x0e38;
16437  t.sarauuthai = 0x0e39;
16438  t.sbopomofo = 0x3119;
16439  t.scaron = 0x0161;
16440  t.scarondotaccent = 0x1e67;
16441  t.scedilla = 0x015f;
16442  t.schwa = 0x0259;
16443  t.schwacyrillic = 0x04d9;
16444  t.schwadieresiscyrillic = 0x04db;
16445  t.schwahook = 0x025a;
16446  t.scircle = 0x24e2;
16447  t.scircumflex = 0x015d;
16448  t.scommaaccent = 0x0219;
16449  t.sdotaccent = 0x1e61;
16450  t.sdotbelow = 0x1e63;
16451  t.sdotbelowdotaccent = 0x1e69;
16452  t.seagullbelowcmb = 0x033c;
16453  t.second = 0x2033;
16454  t.secondtonechinese = 0x02ca;
16455  t.section = 0x00a7;
16456  t.seenarabic = 0x0633;
16457  t.seenfinalarabic = 0xfeb2;
16458  t.seeninitialarabic = 0xfeb3;
16459  t.seenmedialarabic = 0xfeb4;
16460  t.segol = 0x05b6;
16461  t.segol13 = 0x05b6;
16462  t.segol1f = 0x05b6;
16463  t.segol2c = 0x05b6;
16464  t.segolhebrew = 0x05b6;
16465  t.segolnarrowhebrew = 0x05b6;
16466  t.segolquarterhebrew = 0x05b6;
16467  t.segoltahebrew = 0x0592;
16468  t.segolwidehebrew = 0x05b6;
16469  t.seharmenian = 0x057d;
16470  t.sehiragana = 0x305b;
16471  t.sekatakana = 0x30bb;
16472  t.sekatakanahalfwidth = 0xff7e;
16473  t.semicolon = 0x003b;
16474  t.semicolonarabic = 0x061b;
16475  t.semicolonmonospace = 0xff1b;
16476  t.semicolonsmall = 0xfe54;
16477  t.semivoicedmarkkana = 0x309c;
16478  t.semivoicedmarkkanahalfwidth = 0xff9f;
16479  t.sentisquare = 0x3322;
16480  t.sentosquare = 0x3323;
16481  t.seven = 0x0037;
16482  t.sevenarabic = 0x0667;
16483  t.sevenbengali = 0x09ed;
16484  t.sevencircle = 0x2466;
16485  t.sevencircleinversesansserif = 0x2790;
16486  t.sevendeva = 0x096d;
16487  t.seveneighths = 0x215e;
16488  t.sevengujarati = 0x0aed;
16489  t.sevengurmukhi = 0x0a6d;
16490  t.sevenhackarabic = 0x0667;
16491  t.sevenhangzhou = 0x3027;
16492  t.sevenideographicparen = 0x3226;
16493  t.seveninferior = 0x2087;
16494  t.sevenmonospace = 0xff17;
16495  t.sevenoldstyle = 0xf737;
16496  t.sevenparen = 0x247a;
16497  t.sevenperiod = 0x248e;
16498  t.sevenpersian = 0x06f7;
16499  t.sevenroman = 0x2176;
16500  t.sevensuperior = 0x2077;
16501  t.seventeencircle = 0x2470;
16502  t.seventeenparen = 0x2484;
16503  t.seventeenperiod = 0x2498;
16504  t.seventhai = 0x0e57;
16505  t.sfthyphen = 0x00ad;
16506  t.shaarmenian = 0x0577;
16507  t.shabengali = 0x09b6;
16508  t.shacyrillic = 0x0448;
16509  t.shaddaarabic = 0x0651;
16510  t.shaddadammaarabic = 0xfc61;
16511  t.shaddadammatanarabic = 0xfc5e;
16512  t.shaddafathaarabic = 0xfc60;
16513  t.shaddakasraarabic = 0xfc62;
16514  t.shaddakasratanarabic = 0xfc5f;
16515  t.shade = 0x2592;
16516  t.shadedark = 0x2593;
16517  t.shadelight = 0x2591;
16518  t.shademedium = 0x2592;
16519  t.shadeva = 0x0936;
16520  t.shagujarati = 0x0ab6;
16521  t.shagurmukhi = 0x0a36;
16522  t.shalshelethebrew = 0x0593;
16523  t.shbopomofo = 0x3115;
16524  t.shchacyrillic = 0x0449;
16525  t.sheenarabic = 0x0634;
16526  t.sheenfinalarabic = 0xfeb6;
16527  t.sheeninitialarabic = 0xfeb7;
16528  t.sheenmedialarabic = 0xfeb8;
16529  t.sheicoptic = 0x03e3;
16530  t.sheqel = 0x20aa;
16531  t.sheqelhebrew = 0x20aa;
16532  t.sheva = 0x05b0;
16533  t.sheva115 = 0x05b0;
16534  t.sheva15 = 0x05b0;
16535  t.sheva22 = 0x05b0;
16536  t.sheva2e = 0x05b0;
16537  t.shevahebrew = 0x05b0;
16538  t.shevanarrowhebrew = 0x05b0;
16539  t.shevaquarterhebrew = 0x05b0;
16540  t.shevawidehebrew = 0x05b0;
16541  t.shhacyrillic = 0x04bb;
16542  t.shimacoptic = 0x03ed;
16543  t.shin = 0x05e9;
16544  t.shindagesh = 0xfb49;
16545  t.shindageshhebrew = 0xfb49;
16546  t.shindageshshindot = 0xfb2c;
16547  t.shindageshshindothebrew = 0xfb2c;
16548  t.shindageshsindot = 0xfb2d;
16549  t.shindageshsindothebrew = 0xfb2d;
16550  t.shindothebrew = 0x05c1;
16551  t.shinhebrew = 0x05e9;
16552  t.shinshindot = 0xfb2a;
16553  t.shinshindothebrew = 0xfb2a;
16554  t.shinsindot = 0xfb2b;
16555  t.shinsindothebrew = 0xfb2b;
16556  t.shook = 0x0282;
16557  t.sigma = 0x03c3;
16558  t.sigma1 = 0x03c2;
16559  t.sigmafinal = 0x03c2;
16560  t.sigmalunatesymbolgreek = 0x03f2;
16561  t.sihiragana = 0x3057;
16562  t.sikatakana = 0x30b7;
16563  t.sikatakanahalfwidth = 0xff7c;
16564  t.siluqhebrew = 0x05bd;
16565  t.siluqlefthebrew = 0x05bd;
16566  t.similar = 0x223c;
16567  t.sindothebrew = 0x05c2;
16568  t.siosacirclekorean = 0x3274;
16569  t.siosaparenkorean = 0x3214;
16570  t.sioscieuckorean = 0x317e;
16571  t.sioscirclekorean = 0x3266;
16572  t.sioskiyeokkorean = 0x317a;
16573  t.sioskorean = 0x3145;
16574  t.siosnieunkorean = 0x317b;
16575  t.siosparenkorean = 0x3206;
16576  t.siospieupkorean = 0x317d;
16577  t.siostikeutkorean = 0x317c;
16578  t.six = 0x0036;
16579  t.sixarabic = 0x0666;
16580  t.sixbengali = 0x09ec;
16581  t.sixcircle = 0x2465;
16582  t.sixcircleinversesansserif = 0x278f;
16583  t.sixdeva = 0x096c;
16584  t.sixgujarati = 0x0aec;
16585  t.sixgurmukhi = 0x0a6c;
16586  t.sixhackarabic = 0x0666;
16587  t.sixhangzhou = 0x3026;
16588  t.sixideographicparen = 0x3225;
16589  t.sixinferior = 0x2086;
16590  t.sixmonospace = 0xff16;
16591  t.sixoldstyle = 0xf736;
16592  t.sixparen = 0x2479;
16593  t.sixperiod = 0x248d;
16594  t.sixpersian = 0x06f6;
16595  t.sixroman = 0x2175;
16596  t.sixsuperior = 0x2076;
16597  t.sixteencircle = 0x246f;
16598  t.sixteencurrencydenominatorbengali = 0x09f9;
16599  t.sixteenparen = 0x2483;
16600  t.sixteenperiod = 0x2497;
16601  t.sixthai = 0x0e56;
16602  t.slash = 0x002f;
16603  t.slashmonospace = 0xff0f;
16604  t.slong = 0x017f;
16605  t.slongdotaccent = 0x1e9b;
16606  t.smileface = 0x263a;
16607  t.smonospace = 0xff53;
16608  t.sofpasuqhebrew = 0x05c3;
16609  t.softhyphen = 0x00ad;
16610  t.softsigncyrillic = 0x044c;
16611  t.sohiragana = 0x305d;
16612  t.sokatakana = 0x30bd;
16613  t.sokatakanahalfwidth = 0xff7f;
16614  t.soliduslongoverlaycmb = 0x0338;
16615  t.solidusshortoverlaycmb = 0x0337;
16616  t.sorusithai = 0x0e29;
16617  t.sosalathai = 0x0e28;
16618  t.sosothai = 0x0e0b;
16619  t.sosuathai = 0x0e2a;
16620  t.space = 0x0020;
16621  t.spacehackarabic = 0x0020;
16622  t.spade = 0x2660;
16623  t.spadesuitblack = 0x2660;
16624  t.spadesuitwhite = 0x2664;
16625  t.sparen = 0x24ae;
16626  t.squarebelowcmb = 0x033b;
16627  t.squarecc = 0x33c4;
16628  t.squarecm = 0x339d;
16629  t.squarediagonalcrosshatchfill = 0x25a9;
16630  t.squarehorizontalfill = 0x25a4;
16631  t.squarekg = 0x338f;
16632  t.squarekm = 0x339e;
16633  t.squarekmcapital = 0x33ce;
16634  t.squareln = 0x33d1;
16635  t.squarelog = 0x33d2;
16636  t.squaremg = 0x338e;
16637  t.squaremil = 0x33d5;
16638  t.squaremm = 0x339c;
16639  t.squaremsquared = 0x33a1;
16640  t.squareorthogonalcrosshatchfill = 0x25a6;
16641  t.squareupperlefttolowerrightfill = 0x25a7;
16642  t.squareupperrighttolowerleftfill = 0x25a8;
16643  t.squareverticalfill = 0x25a5;
16644  t.squarewhitewithsmallblack = 0x25a3;
16645  t.srsquare = 0x33db;
16646  t.ssabengali = 0x09b7;
16647  t.ssadeva = 0x0937;
16648  t.ssagujarati = 0x0ab7;
16649  t.ssangcieuckorean = 0x3149;
16650  t.ssanghieuhkorean = 0x3185;
16651  t.ssangieungkorean = 0x3180;
16652  t.ssangkiyeokkorean = 0x3132;
16653  t.ssangnieunkorean = 0x3165;
16654  t.ssangpieupkorean = 0x3143;
16655  t.ssangsioskorean = 0x3146;
16656  t.ssangtikeutkorean = 0x3138;
16657  t.ssuperior = 0xf6f2;
16658  t.sterling = 0x00a3;
16659  t.sterlingmonospace = 0xffe1;
16660  t.strokelongoverlaycmb = 0x0336;
16661  t.strokeshortoverlaycmb = 0x0335;
16662  t.subset = 0x2282;
16663  t.subsetnotequal = 0x228a;
16664  t.subsetorequal = 0x2286;
16665  t.succeeds = 0x227b;
16666  t.suchthat = 0x220b;
16667  t.suhiragana = 0x3059;
16668  t.sukatakana = 0x30b9;
16669  t.sukatakanahalfwidth = 0xff7d;
16670  t.sukunarabic = 0x0652;
16671  t.summation = 0x2211;
16672  t.sun = 0x263c;
16673  t.superset = 0x2283;
16674  t.supersetnotequal = 0x228b;
16675  t.supersetorequal = 0x2287;
16676  t.svsquare = 0x33dc;
16677  t.syouwaerasquare = 0x337c;
16678  t.t = 0x0074;
16679  t.tabengali = 0x09a4;
16680  t.tackdown = 0x22a4;
16681  t.tackleft = 0x22a3;
16682  t.tadeva = 0x0924;
16683  t.tagujarati = 0x0aa4;
16684  t.tagurmukhi = 0x0a24;
16685  t.taharabic = 0x0637;
16686  t.tahfinalarabic = 0xfec2;
16687  t.tahinitialarabic = 0xfec3;
16688  t.tahiragana = 0x305f;
16689  t.tahmedialarabic = 0xfec4;
16690  t.taisyouerasquare = 0x337d;
16691  t.takatakana = 0x30bf;
16692  t.takatakanahalfwidth = 0xff80;
16693  t.tatweelarabic = 0x0640;
16694  t.tau = 0x03c4;
16695  t.tav = 0x05ea;
16696  t.tavdages = 0xfb4a;
16697  t.tavdagesh = 0xfb4a;
16698  t.tavdageshhebrew = 0xfb4a;
16699  t.tavhebrew = 0x05ea;
16700  t.tbar = 0x0167;
16701  t.tbopomofo = 0x310a;
16702  t.tcaron = 0x0165;
16703  t.tccurl = 0x02a8;
16704  t.tcedilla = 0x0163;
16705  t.tcheharabic = 0x0686;
16706  t.tchehfinalarabic = 0xfb7b;
16707  t.tchehinitialarabic = 0xfb7c;
16708  t.tchehmedialarabic = 0xfb7d;
16709  t.tcircle = 0x24e3;
16710  t.tcircumflexbelow = 0x1e71;
16711  t.tcommaaccent = 0x0163;
16712  t.tdieresis = 0x1e97;
16713  t.tdotaccent = 0x1e6b;
16714  t.tdotbelow = 0x1e6d;
16715  t.tecyrillic = 0x0442;
16716  t.tedescendercyrillic = 0x04ad;
16717  t.teharabic = 0x062a;
16718  t.tehfinalarabic = 0xfe96;
16719  t.tehhahinitialarabic = 0xfca2;
16720  t.tehhahisolatedarabic = 0xfc0c;
16721  t.tehinitialarabic = 0xfe97;
16722  t.tehiragana = 0x3066;
16723  t.tehjeeminitialarabic = 0xfca1;
16724  t.tehjeemisolatedarabic = 0xfc0b;
16725  t.tehmarbutaarabic = 0x0629;
16726  t.tehmarbutafinalarabic = 0xfe94;
16727  t.tehmedialarabic = 0xfe98;
16728  t.tehmeeminitialarabic = 0xfca4;
16729  t.tehmeemisolatedarabic = 0xfc0e;
16730  t.tehnoonfinalarabic = 0xfc73;
16731  t.tekatakana = 0x30c6;
16732  t.tekatakanahalfwidth = 0xff83;
16733  t.telephone = 0x2121;
16734  t.telephoneblack = 0x260e;
16735  t.telishagedolahebrew = 0x05a0;
16736  t.telishaqetanahebrew = 0x05a9;
16737  t.tencircle = 0x2469;
16738  t.tenideographicparen = 0x3229;
16739  t.tenparen = 0x247d;
16740  t.tenperiod = 0x2491;
16741  t.tenroman = 0x2179;
16742  t.tesh = 0x02a7;
16743  t.tet = 0x05d8;
16744  t.tetdagesh = 0xfb38;
16745  t.tetdageshhebrew = 0xfb38;
16746  t.tethebrew = 0x05d8;
16747  t.tetsecyrillic = 0x04b5;
16748  t.tevirhebrew = 0x059b;
16749  t.tevirlefthebrew = 0x059b;
16750  t.thabengali = 0x09a5;
16751  t.thadeva = 0x0925;
16752  t.thagujarati = 0x0aa5;
16753  t.thagurmukhi = 0x0a25;
16754  t.thalarabic = 0x0630;
16755  t.thalfinalarabic = 0xfeac;
16756  t.thanthakhatlowleftthai = 0xf898;
16757  t.thanthakhatlowrightthai = 0xf897;
16758  t.thanthakhatthai = 0x0e4c;
16759  t.thanthakhatupperleftthai = 0xf896;
16760  t.theharabic = 0x062b;
16761  t.thehfinalarabic = 0xfe9a;
16762  t.thehinitialarabic = 0xfe9b;
16763  t.thehmedialarabic = 0xfe9c;
16764  t.thereexists = 0x2203;
16765  t.therefore = 0x2234;
16766  t.theta = 0x03b8;
16767  t.theta1 = 0x03d1;
16768  t.thetasymbolgreek = 0x03d1;
16769  t.thieuthacirclekorean = 0x3279;
16770  t.thieuthaparenkorean = 0x3219;
16771  t.thieuthcirclekorean = 0x326b;
16772  t.thieuthkorean = 0x314c;
16773  t.thieuthparenkorean = 0x320b;
16774  t.thirteencircle = 0x246c;
16775  t.thirteenparen = 0x2480;
16776  t.thirteenperiod = 0x2494;
16777  t.thonangmonthothai = 0x0e11;
16778  t.thook = 0x01ad;
16779  t.thophuthaothai = 0x0e12;
16780  t.thorn = 0x00fe;
16781  t.thothahanthai = 0x0e17;
16782  t.thothanthai = 0x0e10;
16783  t.thothongthai = 0x0e18;
16784  t.thothungthai = 0x0e16;
16785  t.thousandcyrillic = 0x0482;
16786  t.thousandsseparatorarabic = 0x066c;
16787  t.thousandsseparatorpersian = 0x066c;
16788  t.three = 0x0033;
16789  t.threearabic = 0x0663;
16790  t.threebengali = 0x09e9;
16791  t.threecircle = 0x2462;
16792  t.threecircleinversesansserif = 0x278c;
16793  t.threedeva = 0x0969;
16794  t.threeeighths = 0x215c;
16795  t.threegujarati = 0x0ae9;
16796  t.threegurmukhi = 0x0a69;
16797  t.threehackarabic = 0x0663;
16798  t.threehangzhou = 0x3023;
16799  t.threeideographicparen = 0x3222;
16800  t.threeinferior = 0x2083;
16801  t.threemonospace = 0xff13;
16802  t.threenumeratorbengali = 0x09f6;
16803  t.threeoldstyle = 0xf733;
16804  t.threeparen = 0x2476;
16805  t.threeperiod = 0x248a;
16806  t.threepersian = 0x06f3;
16807  t.threequarters = 0x00be;
16808  t.threequartersemdash = 0xf6de;
16809  t.threeroman = 0x2172;
16810  t.threesuperior = 0x00b3;
16811  t.threethai = 0x0e53;
16812  t.thzsquare = 0x3394;
16813  t.tihiragana = 0x3061;
16814  t.tikatakana = 0x30c1;
16815  t.tikatakanahalfwidth = 0xff81;
16816  t.tikeutacirclekorean = 0x3270;
16817  t.tikeutaparenkorean = 0x3210;
16818  t.tikeutcirclekorean = 0x3262;
16819  t.tikeutkorean = 0x3137;
16820  t.tikeutparenkorean = 0x3202;
16821  t.tilde = 0x02dc;
16822  t.tildebelowcmb = 0x0330;
16823  t.tildecmb = 0x0303;
16824  t.tildecomb = 0x0303;
16825  t.tildedoublecmb = 0x0360;
16826  t.tildeoperator = 0x223c;
16827  t.tildeoverlaycmb = 0x0334;
16828  t.tildeverticalcmb = 0x033e;
16829  t.timescircle = 0x2297;
16830  t.tipehahebrew = 0x0596;
16831  t.tipehalefthebrew = 0x0596;
16832  t.tippigurmukhi = 0x0a70;
16833  t.titlocyrilliccmb = 0x0483;
16834  t.tiwnarmenian = 0x057f;
16835  t.tlinebelow = 0x1e6f;
16836  t.tmonospace = 0xff54;
16837  t.toarmenian = 0x0569;
16838  t.tohiragana = 0x3068;
16839  t.tokatakana = 0x30c8;
16840  t.tokatakanahalfwidth = 0xff84;
16841  t.tonebarextrahighmod = 0x02e5;
16842  t.tonebarextralowmod = 0x02e9;
16843  t.tonebarhighmod = 0x02e6;
16844  t.tonebarlowmod = 0x02e8;
16845  t.tonebarmidmod = 0x02e7;
16846  t.tonefive = 0x01bd;
16847  t.tonesix = 0x0185;
16848  t.tonetwo = 0x01a8;
16849  t.tonos = 0x0384;
16850  t.tonsquare = 0x3327;
16851  t.topatakthai = 0x0e0f;
16852  t.tortoiseshellbracketleft = 0x3014;
16853  t.tortoiseshellbracketleftsmall = 0xfe5d;
16854  t.tortoiseshellbracketleftvertical = 0xfe39;
16855  t.tortoiseshellbracketright = 0x3015;
16856  t.tortoiseshellbracketrightsmall = 0xfe5e;
16857  t.tortoiseshellbracketrightvertical = 0xfe3a;
16858  t.totaothai = 0x0e15;
16859  t.tpalatalhook = 0x01ab;
16860  t.tparen = 0x24af;
16861  t.trademark = 0x2122;
16862  t.trademarksans = 0xf8ea;
16863  t.trademarkserif = 0xf6db;
16864  t.tretroflexhook = 0x0288;
16865  t.triagdn = 0x25bc;
16866  t.triaglf = 0x25c4;
16867  t.triagrt = 0x25ba;
16868  t.triagup = 0x25b2;
16869  t.ts = 0x02a6;
16870  t.tsadi = 0x05e6;
16871  t.tsadidagesh = 0xfb46;
16872  t.tsadidageshhebrew = 0xfb46;
16873  t.tsadihebrew = 0x05e6;
16874  t.tsecyrillic = 0x0446;
16875  t.tsere = 0x05b5;
16876  t.tsere12 = 0x05b5;
16877  t.tsere1e = 0x05b5;
16878  t.tsere2b = 0x05b5;
16879  t.tserehebrew = 0x05b5;
16880  t.tserenarrowhebrew = 0x05b5;
16881  t.tserequarterhebrew = 0x05b5;
16882  t.tserewidehebrew = 0x05b5;
16883  t.tshecyrillic = 0x045b;
16884  t.tsuperior = 0xf6f3;
16885  t.ttabengali = 0x099f;
16886  t.ttadeva = 0x091f;
16887  t.ttagujarati = 0x0a9f;
16888  t.ttagurmukhi = 0x0a1f;
16889  t.tteharabic = 0x0679;
16890  t.ttehfinalarabic = 0xfb67;
16891  t.ttehinitialarabic = 0xfb68;
16892  t.ttehmedialarabic = 0xfb69;
16893  t.tthabengali = 0x09a0;
16894  t.tthadeva = 0x0920;
16895  t.tthagujarati = 0x0aa0;
16896  t.tthagurmukhi = 0x0a20;
16897  t.tturned = 0x0287;
16898  t.tuhiragana = 0x3064;
16899  t.tukatakana = 0x30c4;
16900  t.tukatakanahalfwidth = 0xff82;
16901  t.tusmallhiragana = 0x3063;
16902  t.tusmallkatakana = 0x30c3;
16903  t.tusmallkatakanahalfwidth = 0xff6f;
16904  t.twelvecircle = 0x246b;
16905  t.twelveparen = 0x247f;
16906  t.twelveperiod = 0x2493;
16907  t.twelveroman = 0x217b;
16908  t.twentycircle = 0x2473;
16909  t.twentyhangzhou = 0x5344;
16910  t.twentyparen = 0x2487;
16911  t.twentyperiod = 0x249b;
16912  t.two = 0x0032;
16913  t.twoarabic = 0x0662;
16914  t.twobengali = 0x09e8;
16915  t.twocircle = 0x2461;
16916  t.twocircleinversesansserif = 0x278b;
16917  t.twodeva = 0x0968;
16918  t.twodotenleader = 0x2025;
16919  t.twodotleader = 0x2025;
16920  t.twodotleadervertical = 0xfe30;
16921  t.twogujarati = 0x0ae8;
16922  t.twogurmukhi = 0x0a68;
16923  t.twohackarabic = 0x0662;
16924  t.twohangzhou = 0x3022;
16925  t.twoideographicparen = 0x3221;
16926  t.twoinferior = 0x2082;
16927  t.twomonospace = 0xff12;
16928  t.twonumeratorbengali = 0x09f5;
16929  t.twooldstyle = 0xf732;
16930  t.twoparen = 0x2475;
16931  t.twoperiod = 0x2489;
16932  t.twopersian = 0x06f2;
16933  t.tworoman = 0x2171;
16934  t.twostroke = 0x01bb;
16935  t.twosuperior = 0x00b2;
16936  t.twothai = 0x0e52;
16937  t.twothirds = 0x2154;
16938  t.u = 0x0075;
16939  t.uacute = 0x00fa;
16940  t.ubar = 0x0289;
16941  t.ubengali = 0x0989;
16942  t.ubopomofo = 0x3128;
16943  t.ubreve = 0x016d;
16944  t.ucaron = 0x01d4;
16945  t.ucircle = 0x24e4;
16946  t.ucircumflex = 0x00fb;
16947  t.ucircumflexbelow = 0x1e77;
16948  t.ucyrillic = 0x0443;
16949  t.udattadeva = 0x0951;
16950  t.udblacute = 0x0171;
16951  t.udblgrave = 0x0215;
16952  t.udeva = 0x0909;
16953  t.udieresis = 0x00fc;
16954  t.udieresisacute = 0x01d8;
16955  t.udieresisbelow = 0x1e73;
16956  t.udieresiscaron = 0x01da;
16957  t.udieresiscyrillic = 0x04f1;
16958  t.udieresisgrave = 0x01dc;
16959  t.udieresismacron = 0x01d6;
16960  t.udotbelow = 0x1ee5;
16961  t.ugrave = 0x00f9;
16962  t.ugujarati = 0x0a89;
16963  t.ugurmukhi = 0x0a09;
16964  t.uhiragana = 0x3046;
16965  t.uhookabove = 0x1ee7;
16966  t.uhorn = 0x01b0;
16967  t.uhornacute = 0x1ee9;
16968  t.uhorndotbelow = 0x1ef1;
16969  t.uhorngrave = 0x1eeb;
16970  t.uhornhookabove = 0x1eed;
16971  t.uhorntilde = 0x1eef;
16972  t.uhungarumlaut = 0x0171;
16973  t.uhungarumlautcyrillic = 0x04f3;
16974  t.uinvertedbreve = 0x0217;
16975  t.ukatakana = 0x30a6;
16976  t.ukatakanahalfwidth = 0xff73;
16977  t.ukcyrillic = 0x0479;
16978  t.ukorean = 0x315c;
16979  t.umacron = 0x016b;
16980  t.umacroncyrillic = 0x04ef;
16981  t.umacrondieresis = 0x1e7b;
16982  t.umatragurmukhi = 0x0a41;
16983  t.umonospace = 0xff55;
16984  t.underscore = 0x005f;
16985  t.underscoredbl = 0x2017;
16986  t.underscoremonospace = 0xff3f;
16987  t.underscorevertical = 0xfe33;
16988  t.underscorewavy = 0xfe4f;
16989  t.union = 0x222a;
16990  t.universal = 0x2200;
16991  t.uogonek = 0x0173;
16992  t.uparen = 0x24b0;
16993  t.upblock = 0x2580;
16994  t.upperdothebrew = 0x05c4;
16995  t.upsilon = 0x03c5;
16996  t.upsilondieresis = 0x03cb;
16997  t.upsilondieresistonos = 0x03b0;
16998  t.upsilonlatin = 0x028a;
16999  t.upsilontonos = 0x03cd;
17000  t.uptackbelowcmb = 0x031d;
17001  t.uptackmod = 0x02d4;
17002  t.uragurmukhi = 0x0a73;
17003  t.uring = 0x016f;
17004  t.ushortcyrillic = 0x045e;
17005  t.usmallhiragana = 0x3045;
17006  t.usmallkatakana = 0x30a5;
17007  t.usmallkatakanahalfwidth = 0xff69;
17008  t.ustraightcyrillic = 0x04af;
17009  t.ustraightstrokecyrillic = 0x04b1;
17010  t.utilde = 0x0169;
17011  t.utildeacute = 0x1e79;
17012  t.utildebelow = 0x1e75;
17013  t.uubengali = 0x098a;
17014  t.uudeva = 0x090a;
17015  t.uugujarati = 0x0a8a;
17016  t.uugurmukhi = 0x0a0a;
17017  t.uumatragurmukhi = 0x0a42;
17018  t.uuvowelsignbengali = 0x09c2;
17019  t.uuvowelsigndeva = 0x0942;
17020  t.uuvowelsigngujarati = 0x0ac2;
17021  t.uvowelsignbengali = 0x09c1;
17022  t.uvowelsigndeva = 0x0941;
17023  t.uvowelsigngujarati = 0x0ac1;
17024  t.v = 0x0076;
17025  t.vadeva = 0x0935;
17026  t.vagujarati = 0x0ab5;
17027  t.vagurmukhi = 0x0a35;
17028  t.vakatakana = 0x30f7;
17029  t.vav = 0x05d5;
17030  t.vavdagesh = 0xfb35;
17031  t.vavdagesh65 = 0xfb35;
17032  t.vavdageshhebrew = 0xfb35;
17033  t.vavhebrew = 0x05d5;
17034  t.vavholam = 0xfb4b;
17035  t.vavholamhebrew = 0xfb4b;
17036  t.vavvavhebrew = 0x05f0;
17037  t.vavyodhebrew = 0x05f1;
17038  t.vcircle = 0x24e5;
17039  t.vdotbelow = 0x1e7f;
17040  t.vecyrillic = 0x0432;
17041  t.veharabic = 0x06a4;
17042  t.vehfinalarabic = 0xfb6b;
17043  t.vehinitialarabic = 0xfb6c;
17044  t.vehmedialarabic = 0xfb6d;
17045  t.vekatakana = 0x30f9;
17046  t.venus = 0x2640;
17047  t.verticalbar = 0x007c;
17048  t.verticallineabovecmb = 0x030d;
17049  t.verticallinebelowcmb = 0x0329;
17050  t.verticallinelowmod = 0x02cc;
17051  t.verticallinemod = 0x02c8;
17052  t.vewarmenian = 0x057e;
17053  t.vhook = 0x028b;
17054  t.vikatakana = 0x30f8;
17055  t.viramabengali = 0x09cd;
17056  t.viramadeva = 0x094d;
17057  t.viramagujarati = 0x0acd;
17058  t.visargabengali = 0x0983;
17059  t.visargadeva = 0x0903;
17060  t.visargagujarati = 0x0a83;
17061  t.vmonospace = 0xff56;
17062  t.voarmenian = 0x0578;
17063  t.voicediterationhiragana = 0x309e;
17064  t.voicediterationkatakana = 0x30fe;
17065  t.voicedmarkkana = 0x309b;
17066  t.voicedmarkkanahalfwidth = 0xff9e;
17067  t.vokatakana = 0x30fa;
17068  t.vparen = 0x24b1;
17069  t.vtilde = 0x1e7d;
17070  t.vturned = 0x028c;
17071  t.vuhiragana = 0x3094;
17072  t.vukatakana = 0x30f4;
17073  t.w = 0x0077;
17074  t.wacute = 0x1e83;
17075  t.waekorean = 0x3159;
17076  t.wahiragana = 0x308f;
17077  t.wakatakana = 0x30ef;
17078  t.wakatakanahalfwidth = 0xff9c;
17079  t.wakorean = 0x3158;
17080  t.wasmallhiragana = 0x308e;
17081  t.wasmallkatakana = 0x30ee;
17082  t.wattosquare = 0x3357;
17083  t.wavedash = 0x301c;
17084  t.wavyunderscorevertical = 0xfe34;
17085  t.wawarabic = 0x0648;
17086  t.wawfinalarabic = 0xfeee;
17087  t.wawhamzaabovearabic = 0x0624;
17088  t.wawhamzaabovefinalarabic = 0xfe86;
17089  t.wbsquare = 0x33dd;
17090  t.wcircle = 0x24e6;
17091  t.wcircumflex = 0x0175;
17092  t.wdieresis = 0x1e85;
17093  t.wdotaccent = 0x1e87;
17094  t.wdotbelow = 0x1e89;
17095  t.wehiragana = 0x3091;
17096  t.weierstrass = 0x2118;
17097  t.wekatakana = 0x30f1;
17098  t.wekorean = 0x315e;
17099  t.weokorean = 0x315d;
17100  t.wgrave = 0x1e81;
17101  t.whitebullet = 0x25e6;
17102  t.whitecircle = 0x25cb;
17103  t.whitecircleinverse = 0x25d9;
17104  t.whitecornerbracketleft = 0x300e;
17105  t.whitecornerbracketleftvertical = 0xfe43;
17106  t.whitecornerbracketright = 0x300f;
17107  t.whitecornerbracketrightvertical = 0xfe44;
17108  t.whitediamond = 0x25c7;
17109  t.whitediamondcontainingblacksmalldiamond = 0x25c8;
17110  t.whitedownpointingsmalltriangle = 0x25bf;
17111  t.whitedownpointingtriangle = 0x25bd;
17112  t.whiteleftpointingsmalltriangle = 0x25c3;
17113  t.whiteleftpointingtriangle = 0x25c1;
17114  t.whitelenticularbracketleft = 0x3016;
17115  t.whitelenticularbracketright = 0x3017;
17116  t.whiterightpointingsmalltriangle = 0x25b9;
17117  t.whiterightpointingtriangle = 0x25b7;
17118  t.whitesmallsquare = 0x25ab;
17119  t.whitesmilingface = 0x263a;
17120  t.whitesquare = 0x25a1;
17121  t.whitestar = 0x2606;
17122  t.whitetelephone = 0x260f;
17123  t.whitetortoiseshellbracketleft = 0x3018;
17124  t.whitetortoiseshellbracketright = 0x3019;
17125  t.whiteuppointingsmalltriangle = 0x25b5;
17126  t.whiteuppointingtriangle = 0x25b3;
17127  t.wihiragana = 0x3090;
17128  t.wikatakana = 0x30f0;
17129  t.wikorean = 0x315f;
17130  t.wmonospace = 0xff57;
17131  t.wohiragana = 0x3092;
17132  t.wokatakana = 0x30f2;
17133  t.wokatakanahalfwidth = 0xff66;
17134  t.won = 0x20a9;
17135  t.wonmonospace = 0xffe6;
17136  t.wowaenthai = 0x0e27;
17137  t.wparen = 0x24b2;
17138  t.wring = 0x1e98;
17139  t.wsuperior = 0x02b7;
17140  t.wturned = 0x028d;
17141  t.wynn = 0x01bf;
17142  t.x = 0x0078;
17143  t.xabovecmb = 0x033d;
17144  t.xbopomofo = 0x3112;
17145  t.xcircle = 0x24e7;
17146  t.xdieresis = 0x1e8d;
17147  t.xdotaccent = 0x1e8b;
17148  t.xeharmenian = 0x056d;
17149  t.xi = 0x03be;
17150  t.xmonospace = 0xff58;
17151  t.xparen = 0x24b3;
17152  t.xsuperior = 0x02e3;
17153  t.y = 0x0079;
17154  t.yaadosquare = 0x334e;
17155  t.yabengali = 0x09af;
17156  t.yacute = 0x00fd;
17157  t.yadeva = 0x092f;
17158  t.yaekorean = 0x3152;
17159  t.yagujarati = 0x0aaf;
17160  t.yagurmukhi = 0x0a2f;
17161  t.yahiragana = 0x3084;
17162  t.yakatakana = 0x30e4;
17163  t.yakatakanahalfwidth = 0xff94;
17164  t.yakorean = 0x3151;
17165  t.yamakkanthai = 0x0e4e;
17166  t.yasmallhiragana = 0x3083;
17167  t.yasmallkatakana = 0x30e3;
17168  t.yasmallkatakanahalfwidth = 0xff6c;
17169  t.yatcyrillic = 0x0463;
17170  t.ycircle = 0x24e8;
17171  t.ycircumflex = 0x0177;
17172  t.ydieresis = 0x00ff;
17173  t.ydotaccent = 0x1e8f;
17174  t.ydotbelow = 0x1ef5;
17175  t.yeharabic = 0x064a;
17176  t.yehbarreearabic = 0x06d2;
17177  t.yehbarreefinalarabic = 0xfbaf;
17178  t.yehfinalarabic = 0xfef2;
17179  t.yehhamzaabovearabic = 0x0626;
17180  t.yehhamzaabovefinalarabic = 0xfe8a;
17181  t.yehhamzaaboveinitialarabic = 0xfe8b;
17182  t.yehhamzaabovemedialarabic = 0xfe8c;
17183  t.yehinitialarabic = 0xfef3;
17184  t.yehmedialarabic = 0xfef4;
17185  t.yehmeeminitialarabic = 0xfcdd;
17186  t.yehmeemisolatedarabic = 0xfc58;
17187  t.yehnoonfinalarabic = 0xfc94;
17188  t.yehthreedotsbelowarabic = 0x06d1;
17189  t.yekorean = 0x3156;
17190  t.yen = 0x00a5;
17191  t.yenmonospace = 0xffe5;
17192  t.yeokorean = 0x3155;
17193  t.yeorinhieuhkorean = 0x3186;
17194  t.yerahbenyomohebrew = 0x05aa;
17195  t.yerahbenyomolefthebrew = 0x05aa;
17196  t.yericyrillic = 0x044b;
17197  t.yerudieresiscyrillic = 0x04f9;
17198  t.yesieungkorean = 0x3181;
17199  t.yesieungpansioskorean = 0x3183;
17200  t.yesieungsioskorean = 0x3182;
17201  t.yetivhebrew = 0x059a;
17202  t.ygrave = 0x1ef3;
17203  t.yhook = 0x01b4;
17204  t.yhookabove = 0x1ef7;
17205  t.yiarmenian = 0x0575;
17206  t.yicyrillic = 0x0457;
17207  t.yikorean = 0x3162;
17208  t.yinyang = 0x262f;
17209  t.yiwnarmenian = 0x0582;
17210  t.ymonospace = 0xff59;
17211  t.yod = 0x05d9;
17212  t.yoddagesh = 0xfb39;
17213  t.yoddageshhebrew = 0xfb39;
17214  t.yodhebrew = 0x05d9;
17215  t.yodyodhebrew = 0x05f2;
17216  t.yodyodpatahhebrew = 0xfb1f;
17217  t.yohiragana = 0x3088;
17218  t.yoikorean = 0x3189;
17219  t.yokatakana = 0x30e8;
17220  t.yokatakanahalfwidth = 0xff96;
17221  t.yokorean = 0x315b;
17222  t.yosmallhiragana = 0x3087;
17223  t.yosmallkatakana = 0x30e7;
17224  t.yosmallkatakanahalfwidth = 0xff6e;
17225  t.yotgreek = 0x03f3;
17226  t.yoyaekorean = 0x3188;
17227  t.yoyakorean = 0x3187;
17228  t.yoyakthai = 0x0e22;
17229  t.yoyingthai = 0x0e0d;
17230  t.yparen = 0x24b4;
17231  t.ypogegrammeni = 0x037a;
17232  t.ypogegrammenigreekcmb = 0x0345;
17233  t.yr = 0x01a6;
17234  t.yring = 0x1e99;
17235  t.ysuperior = 0x02b8;
17236  t.ytilde = 0x1ef9;
17237  t.yturned = 0x028e;
17238  t.yuhiragana = 0x3086;
17239  t.yuikorean = 0x318c;
17240  t.yukatakana = 0x30e6;
17241  t.yukatakanahalfwidth = 0xff95;
17242  t.yukorean = 0x3160;
17243  t.yusbigcyrillic = 0x046b;
17244  t.yusbigiotifiedcyrillic = 0x046d;
17245  t.yuslittlecyrillic = 0x0467;
17246  t.yuslittleiotifiedcyrillic = 0x0469;
17247  t.yusmallhiragana = 0x3085;
17248  t.yusmallkatakana = 0x30e5;
17249  t.yusmallkatakanahalfwidth = 0xff6d;
17250  t.yuyekorean = 0x318b;
17251  t.yuyeokorean = 0x318a;
17252  t.yyabengali = 0x09df;
17253  t.yyadeva = 0x095f;
17254  t.z = 0x007a;
17255  t.zaarmenian = 0x0566;
17256  t.zacute = 0x017a;
17257  t.zadeva = 0x095b;
17258  t.zagurmukhi = 0x0a5b;
17259  t.zaharabic = 0x0638;
17260  t.zahfinalarabic = 0xfec6;
17261  t.zahinitialarabic = 0xfec7;
17262  t.zahiragana = 0x3056;
17263  t.zahmedialarabic = 0xfec8;
17264  t.zainarabic = 0x0632;
17265  t.zainfinalarabic = 0xfeb0;
17266  t.zakatakana = 0x30b6;
17267  t.zaqefgadolhebrew = 0x0595;
17268  t.zaqefqatanhebrew = 0x0594;
17269  t.zarqahebrew = 0x0598;
17270  t.zayin = 0x05d6;
17271  t.zayindagesh = 0xfb36;
17272  t.zayindageshhebrew = 0xfb36;
17273  t.zayinhebrew = 0x05d6;
17274  t.zbopomofo = 0x3117;
17275  t.zcaron = 0x017e;
17276  t.zcircle = 0x24e9;
17277  t.zcircumflex = 0x1e91;
17278  t.zcurl = 0x0291;
17279  t.zdot = 0x017c;
17280  t.zdotaccent = 0x017c;
17281  t.zdotbelow = 0x1e93;
17282  t.zecyrillic = 0x0437;
17283  t.zedescendercyrillic = 0x0499;
17284  t.zedieresiscyrillic = 0x04df;
17285  t.zehiragana = 0x305c;
17286  t.zekatakana = 0x30bc;
17287  t.zero = 0x0030;
17288  t.zeroarabic = 0x0660;
17289  t.zerobengali = 0x09e6;
17290  t.zerodeva = 0x0966;
17291  t.zerogujarati = 0x0ae6;
17292  t.zerogurmukhi = 0x0a66;
17293  t.zerohackarabic = 0x0660;
17294  t.zeroinferior = 0x2080;
17295  t.zeromonospace = 0xff10;
17296  t.zerooldstyle = 0xf730;
17297  t.zeropersian = 0x06f0;
17298  t.zerosuperior = 0x2070;
17299  t.zerothai = 0x0e50;
17300  t.zerowidthjoiner = 0xfeff;
17301  t.zerowidthnonjoiner = 0x200c;
17302  t.zerowidthspace = 0x200b;
17303  t.zeta = 0x03b6;
17304  t.zhbopomofo = 0x3113;
17305  t.zhearmenian = 0x056a;
17306  t.zhebrevecyrillic = 0x04c2;
17307  t.zhecyrillic = 0x0436;
17308  t.zhedescendercyrillic = 0x0497;
17309  t.zhedieresiscyrillic = 0x04dd;
17310  t.zihiragana = 0x3058;
17311  t.zikatakana = 0x30b8;
17312  t.zinorhebrew = 0x05ae;
17313  t.zlinebelow = 0x1e95;
17314  t.zmonospace = 0xff5a;
17315  t.zohiragana = 0x305e;
17316  t.zokatakana = 0x30be;
17317  t.zparen = 0x24b5;
17318  t.zretroflexhook = 0x0290;
17319  t.zstroke = 0x01b6;
17320  t.zuhiragana = 0x305a;
17321  t.zukatakana = 0x30ba;
17322  t[".notdef"] = 0x0000;
17323  t.angbracketleftbig = 0x2329;
17324  t.angbracketleftBig = 0x2329;
17325  t.angbracketleftbigg = 0x2329;
17326  t.angbracketleftBigg = 0x2329;
17327  t.angbracketrightBig = 0x232a;
17328  t.angbracketrightbig = 0x232a;
17329  t.angbracketrightBigg = 0x232a;
17330  t.angbracketrightbigg = 0x232a;
17331  t.arrowhookleft = 0x21aa;
17332  t.arrowhookright = 0x21a9;
17333  t.arrowlefttophalf = 0x21bc;
17334  t.arrowleftbothalf = 0x21bd;
17335  t.arrownortheast = 0x2197;
17336  t.arrownorthwest = 0x2196;
17337  t.arrowrighttophalf = 0x21c0;
17338  t.arrowrightbothalf = 0x21c1;
17339  t.arrowsoutheast = 0x2198;
17340  t.arrowsouthwest = 0x2199;
17341  t.backslashbig = 0x2216;
17342  t.backslashBig = 0x2216;
17343  t.backslashBigg = 0x2216;
17344  t.backslashbigg = 0x2216;
17345  t.bardbl = 0x2016;
17346  t.bracehtipdownleft = 0xfe37;
17347  t.bracehtipdownright = 0xfe37;
17348  t.bracehtipupleft = 0xfe38;
17349  t.bracehtipupright = 0xfe38;
17350  t.braceleftBig = 0x007b;
17351  t.braceleftbig = 0x007b;
17352  t.braceleftbigg = 0x007b;
17353  t.braceleftBigg = 0x007b;
17354  t.bracerightBig = 0x007d;
17355  t.bracerightbig = 0x007d;
17356  t.bracerightbigg = 0x007d;
17357  t.bracerightBigg = 0x007d;
17358  t.bracketleftbig = 0x005b;
17359  t.bracketleftBig = 0x005b;
17360  t.bracketleftbigg = 0x005b;
17361  t.bracketleftBigg = 0x005b;
17362  t.bracketrightBig = 0x005d;
17363  t.bracketrightbig = 0x005d;
17364  t.bracketrightbigg = 0x005d;
17365  t.bracketrightBigg = 0x005d;
17366  t.ceilingleftbig = 0x2308;
17367  t.ceilingleftBig = 0x2308;
17368  t.ceilingleftBigg = 0x2308;
17369  t.ceilingleftbigg = 0x2308;
17370  t.ceilingrightbig = 0x2309;
17371  t.ceilingrightBig = 0x2309;
17372  t.ceilingrightbigg = 0x2309;
17373  t.ceilingrightBigg = 0x2309;
17374  t.circledotdisplay = 0x2299;
17375  t.circledottext = 0x2299;
17376  t.circlemultiplydisplay = 0x2297;
17377  t.circlemultiplytext = 0x2297;
17378  t.circleplusdisplay = 0x2295;
17379  t.circleplustext = 0x2295;
17380  t.contintegraldisplay = 0x222e;
17381  t.contintegraltext = 0x222e;
17382  t.coproductdisplay = 0x2210;
17383  t.coproducttext = 0x2210;
17384  t.floorleftBig = 0x230a;
17385  t.floorleftbig = 0x230a;
17386  t.floorleftbigg = 0x230a;
17387  t.floorleftBigg = 0x230a;
17388  t.floorrightbig = 0x230b;
17389  t.floorrightBig = 0x230b;
17390  t.floorrightBigg = 0x230b;
17391  t.floorrightbigg = 0x230b;
17392  t.hatwide = 0x0302;
17393  t.hatwider = 0x0302;
17394  t.hatwidest = 0x0302;
17395  t.intercal = 0x1d40;
17396  t.integraldisplay = 0x222b;
17397  t.integraltext = 0x222b;
17398  t.intersectiondisplay = 0x22c2;
17399  t.intersectiontext = 0x22c2;
17400  t.logicalanddisplay = 0x2227;
17401  t.logicalandtext = 0x2227;
17402  t.logicalordisplay = 0x2228;
17403  t.logicalortext = 0x2228;
17404  t.parenleftBig = 0x0028;
17405  t.parenleftbig = 0x0028;
17406  t.parenleftBigg = 0x0028;
17407  t.parenleftbigg = 0x0028;
17408  t.parenrightBig = 0x0029;
17409  t.parenrightbig = 0x0029;
17410  t.parenrightBigg = 0x0029;
17411  t.parenrightbigg = 0x0029;
17412  t.prime = 0x2032;
17413  t.productdisplay = 0x220f;
17414  t.producttext = 0x220f;
17415  t.radicalbig = 0x221a;
17416  t.radicalBig = 0x221a;
17417  t.radicalBigg = 0x221a;
17418  t.radicalbigg = 0x221a;
17419  t.radicalbt = 0x221a;
17420  t.radicaltp = 0x221a;
17421  t.radicalvertex = 0x221a;
17422  t.slashbig = 0x002f;
17423  t.slashBig = 0x002f;
17424  t.slashBigg = 0x002f;
17425  t.slashbigg = 0x002f;
17426  t.summationdisplay = 0x2211;
17427  t.summationtext = 0x2211;
17428  t.tildewide = 0x02dc;
17429  t.tildewider = 0x02dc;
17430  t.tildewidest = 0x02dc;
17431  t.uniondisplay = 0x22c3;
17432  t.unionmultidisplay = 0x228e;
17433  t.unionmultitext = 0x228e;
17434  t.unionsqdisplay = 0x2294;
17435  t.unionsqtext = 0x2294;
17436  t.uniontext = 0x22c3;
17437  t.vextenddouble = 0x2225;
17438  t.vextendsingle = 0x2223;
17439});
17440const getDingbatsGlyphsUnicode = getLookupTableFactory(function (t) {
17441  t.space = 0x0020;
17442  t.a1 = 0x2701;
17443  t.a2 = 0x2702;
17444  t.a202 = 0x2703;
17445  t.a3 = 0x2704;
17446  t.a4 = 0x260e;
17447  t.a5 = 0x2706;
17448  t.a119 = 0x2707;
17449  t.a118 = 0x2708;
17450  t.a117 = 0x2709;
17451  t.a11 = 0x261b;
17452  t.a12 = 0x261e;
17453  t.a13 = 0x270c;
17454  t.a14 = 0x270d;
17455  t.a15 = 0x270e;
17456  t.a16 = 0x270f;
17457  t.a105 = 0x2710;
17458  t.a17 = 0x2711;
17459  t.a18 = 0x2712;
17460  t.a19 = 0x2713;
17461  t.a20 = 0x2714;
17462  t.a21 = 0x2715;
17463  t.a22 = 0x2716;
17464  t.a23 = 0x2717;
17465  t.a24 = 0x2718;
17466  t.a25 = 0x2719;
17467  t.a26 = 0x271a;
17468  t.a27 = 0x271b;
17469  t.a28 = 0x271c;
17470  t.a6 = 0x271d;
17471  t.a7 = 0x271e;
17472  t.a8 = 0x271f;
17473  t.a9 = 0x2720;
17474  t.a10 = 0x2721;
17475  t.a29 = 0x2722;
17476  t.a30 = 0x2723;
17477  t.a31 = 0x2724;
17478  t.a32 = 0x2725;
17479  t.a33 = 0x2726;
17480  t.a34 = 0x2727;
17481  t.a35 = 0x2605;
17482  t.a36 = 0x2729;
17483  t.a37 = 0x272a;
17484  t.a38 = 0x272b;
17485  t.a39 = 0x272c;
17486  t.a40 = 0x272d;
17487  t.a41 = 0x272e;
17488  t.a42 = 0x272f;
17489  t.a43 = 0x2730;
17490  t.a44 = 0x2731;
17491  t.a45 = 0x2732;
17492  t.a46 = 0x2733;
17493  t.a47 = 0x2734;
17494  t.a48 = 0x2735;
17495  t.a49 = 0x2736;
17496  t.a50 = 0x2737;
17497  t.a51 = 0x2738;
17498  t.a52 = 0x2739;
17499  t.a53 = 0x273a;
17500  t.a54 = 0x273b;
17501  t.a55 = 0x273c;
17502  t.a56 = 0x273d;
17503  t.a57 = 0x273e;
17504  t.a58 = 0x273f;
17505  t.a59 = 0x2740;
17506  t.a60 = 0x2741;
17507  t.a61 = 0x2742;
17508  t.a62 = 0x2743;
17509  t.a63 = 0x2744;
17510  t.a64 = 0x2745;
17511  t.a65 = 0x2746;
17512  t.a66 = 0x2747;
17513  t.a67 = 0x2748;
17514  t.a68 = 0x2749;
17515  t.a69 = 0x274a;
17516  t.a70 = 0x274b;
17517  t.a71 = 0x25cf;
17518  t.a72 = 0x274d;
17519  t.a73 = 0x25a0;
17520  t.a74 = 0x274f;
17521  t.a203 = 0x2750;
17522  t.a75 = 0x2751;
17523  t.a204 = 0x2752;
17524  t.a76 = 0x25b2;
17525  t.a77 = 0x25bc;
17526  t.a78 = 0x25c6;
17527  t.a79 = 0x2756;
17528  t.a81 = 0x25d7;
17529  t.a82 = 0x2758;
17530  t.a83 = 0x2759;
17531  t.a84 = 0x275a;
17532  t.a97 = 0x275b;
17533  t.a98 = 0x275c;
17534  t.a99 = 0x275d;
17535  t.a100 = 0x275e;
17536  t.a101 = 0x2761;
17537  t.a102 = 0x2762;
17538  t.a103 = 0x2763;
17539  t.a104 = 0x2764;
17540  t.a106 = 0x2765;
17541  t.a107 = 0x2766;
17542  t.a108 = 0x2767;
17543  t.a112 = 0x2663;
17544  t.a111 = 0x2666;
17545  t.a110 = 0x2665;
17546  t.a109 = 0x2660;
17547  t.a120 = 0x2460;
17548  t.a121 = 0x2461;
17549  t.a122 = 0x2462;
17550  t.a123 = 0x2463;
17551  t.a124 = 0x2464;
17552  t.a125 = 0x2465;
17553  t.a126 = 0x2466;
17554  t.a127 = 0x2467;
17555  t.a128 = 0x2468;
17556  t.a129 = 0x2469;
17557  t.a130 = 0x2776;
17558  t.a131 = 0x2777;
17559  t.a132 = 0x2778;
17560  t.a133 = 0x2779;
17561  t.a134 = 0x277a;
17562  t.a135 = 0x277b;
17563  t.a136 = 0x277c;
17564  t.a137 = 0x277d;
17565  t.a138 = 0x277e;
17566  t.a139 = 0x277f;
17567  t.a140 = 0x2780;
17568  t.a141 = 0x2781;
17569  t.a142 = 0x2782;
17570  t.a143 = 0x2783;
17571  t.a144 = 0x2784;
17572  t.a145 = 0x2785;
17573  t.a146 = 0x2786;
17574  t.a147 = 0x2787;
17575  t.a148 = 0x2788;
17576  t.a149 = 0x2789;
17577  t.a150 = 0x278a;
17578  t.a151 = 0x278b;
17579  t.a152 = 0x278c;
17580  t.a153 = 0x278d;
17581  t.a154 = 0x278e;
17582  t.a155 = 0x278f;
17583  t.a156 = 0x2790;
17584  t.a157 = 0x2791;
17585  t.a158 = 0x2792;
17586  t.a159 = 0x2793;
17587  t.a160 = 0x2794;
17588  t.a161 = 0x2192;
17589  t.a163 = 0x2194;
17590  t.a164 = 0x2195;
17591  t.a196 = 0x2798;
17592  t.a165 = 0x2799;
17593  t.a192 = 0x279a;
17594  t.a166 = 0x279b;
17595  t.a167 = 0x279c;
17596  t.a168 = 0x279d;
17597  t.a169 = 0x279e;
17598  t.a170 = 0x279f;
17599  t.a171 = 0x27a0;
17600  t.a172 = 0x27a1;
17601  t.a173 = 0x27a2;
17602  t.a162 = 0x27a3;
17603  t.a174 = 0x27a4;
17604  t.a175 = 0x27a5;
17605  t.a176 = 0x27a6;
17606  t.a177 = 0x27a7;
17607  t.a178 = 0x27a8;
17608  t.a179 = 0x27a9;
17609  t.a193 = 0x27aa;
17610  t.a180 = 0x27ab;
17611  t.a199 = 0x27ac;
17612  t.a181 = 0x27ad;
17613  t.a200 = 0x27ae;
17614  t.a182 = 0x27af;
17615  t.a201 = 0x27b1;
17616  t.a183 = 0x27b2;
17617  t.a184 = 0x27b3;
17618  t.a197 = 0x27b4;
17619  t.a185 = 0x27b5;
17620  t.a194 = 0x27b6;
17621  t.a198 = 0x27b7;
17622  t.a186 = 0x27b8;
17623  t.a195 = 0x27b9;
17624  t.a187 = 0x27ba;
17625  t.a188 = 0x27bb;
17626  t.a189 = 0x27bc;
17627  t.a190 = 0x27bd;
17628  t.a191 = 0x27be;
17629  t.a89 = 0x2768;
17630  t.a90 = 0x2769;
17631  t.a93 = 0x276a;
17632  t.a94 = 0x276b;
17633  t.a91 = 0x276c;
17634  t.a92 = 0x276d;
17635  t.a205 = 0x276e;
17636  t.a85 = 0x276f;
17637  t.a206 = 0x2770;
17638  t.a86 = 0x2771;
17639  t.a87 = 0x2772;
17640  t.a88 = 0x2773;
17641  t.a95 = 0x2774;
17642  t.a96 = 0x2775;
17643  t[".notdef"] = 0x0000;
17644});
17645
17646;// ./src/core/unicode.js
17647
17648const getSpecialPUASymbols = getLookupTableFactory(function (t) {
17649  t[63721] = 0x00a9;
17650  t[63193] = 0x00a9;
17651  t[63720] = 0x00ae;
17652  t[63194] = 0x00ae;
17653  t[63722] = 0x2122;
17654  t[63195] = 0x2122;
17655  t[637
vendor: 15,628 bytes, lines 17655-18005
1765529] = 0x23a7;
17656  t[63730] = 0x23a8;
17657  t[63731] = 0x23a9;
17658  t[63740] = 0x23ab;
17659  t[63741] = 0x23ac;
17660  t[63742] = 0x23ad;
17661  t[63726] = 0x23a1;
17662  t[63727] = 0x23a2;
17663  t[63728] = 0x23a3;
17664  t[63737] = 0x23a4;
17665  t[63738] = 0x23a5;
17666  t[63739] = 0x23a6;
17667  t[63723] = 0x239b;
17668  t[63724] = 0x239c;
17669  t[63725] = 0x239d;
17670  t[63734] = 0x239e;
17671  t[63735] = 0x239f;
17672  t[63736] = 0x23a0;
17673});
17674function mapSpecialUnicodeValues(code) {
17675  if (code >= 0xfff0 && code <= 0xffff) {
17676    return 0;
17677  } else if (code >= 0xf600 && code <= 0xf8ff) {
17678    return getSpecialPUASymbols()[code] || code;
17679  } else if (code === 0x00ad) {
17680    return 0x002d;
17681  }
17682  return code;
17683}
17684function getUnicodeForGlyph(name, glyphsUnicodeMap) {
17685  let unicode = glyphsUnicodeMap[name];
17686  if (unicode !== undefined) {
17687    return unicode;
17688  }
17689  if (!name) {
17690    return -1;
17691  }
17692  if (name[0] === "u") {
17693    const nameLen = name.length;
17694    let hexStr;
17695    if (nameLen === 7 && name[1] === "n" && name[2] === "i") {
17696      hexStr = name.substring(3);
17697    } else if (nameLen >= 5 && nameLen <= 7) {
17698      hexStr = name.substring(1);
17699    } else {
17700      return -1;
17701    }
17702    if (hexStr === hexStr.toUpperCase()) {
17703      unicode = parseInt(hexStr, 16);
17704      if (unicode >= 0) {
17705        return unicode;
17706      }
17707    }
17708  }
17709  return -1;
17710}
17711const UnicodeRanges = [[0x0000, 0x007f], [0x0080, 0x00ff], [0x0100, 0x017f], [0x0180, 0x024f], [0x0250, 0x02af, 0x1d00, 0x1d7f, 0x1d80, 0x1dbf], [0x02b0, 0x02ff, 0xa700, 0xa71f], [0x0300, 0x036f, 0x1dc0, 0x1dff], [0x0370, 0x03ff], [0x2c80, 0x2cff], [0x0400, 0x04ff, 0x0500, 0x052f, 0x2de0, 0x2dff, 0xa640, 0xa69f], [0x0530, 0x058f], [0x0590, 0x05ff], [0xa500, 0xa63f], [0x0600, 0x06ff, 0x0750, 0x077f], [0x07c0, 0x07ff], [0x0900, 0x097f], [0x0980, 0x09ff], [0x0a00, 0x0a7f], [0x0a80, 0x0aff], [0x0b00, 0x0b7f], [0x0b80, 0x0bff], [0x0c00, 0x0c7f], [0x0c80, 0x0cff], [0x0d00, 0x0d7f], [0x0e00, 0x0e7f], [0x0e80, 0x0eff], [0x10a0, 0x10ff, 0x2d00, 0x2d2f], [0x1b00, 0x1b7f], [0x1100, 0x11ff], [0x1e00, 0x1eff, 0x2c60, 0x2c7f, 0xa720, 0xa7ff], [0x1f00, 0x1fff], [0x2000, 0x206f, 0x2e00, 0x2e7f], [0x2070, 0x209f], [0x20a0, 0x20cf], [0x20d0, 0x20ff], [0x2100, 0x214f], [0x2150, 0x218f], [0x2190, 0x21ff, 0x27f0, 0x27ff, 0x2900, 0x297f, 0x2b00, 0x2bff], [0x2200, 0x22ff, 0x2a00, 0x2aff, 0x27c0, 0x27ef, 0x2980, 0x29ff], [0x2300, 0x23ff], [0x2400, 0x243f], [0x2440, 0x245f], [0x2460, 0x24ff], [0x2500, 0x257f], [0x2580, 0x259f], [0x25a0, 0x25ff], [0x2600, 0x26ff], [0x2700, 0x27bf], [0x3000, 0x303f], [0x3040, 0x309f], [0x30a0, 0x30ff, 0x31f0, 0x31ff], [0x3100, 0x312f, 0x31a0, 0x31bf], [0x3130, 0x318f], [0xa840, 0xa87f], [0x3200, 0x32ff], [0x3300, 0x33ff], [0xac00, 0xd7af], [0xd800, 0xdfff], [0x10900, 0x1091f], [0x4e00, 0x9fff, 0x2e80, 0x2eff, 0x2f00, 0x2fdf, 0x2ff0, 0x2fff, 0x3400, 0x4dbf, 0x20000, 0x2a6df, 0x3190, 0x319f], [0xe000, 0xf8ff], [0x31c0, 0x31ef, 0xf900, 0xfaff, 0x2f800, 0x2fa1f], [0xfb00, 0xfb4f], [0xfb50, 0xfdff], [0xfe20, 0xfe2f], [0xfe10, 0xfe1f], [0xfe50, 0xfe6f], [0xfe70, 0xfeff], [0xff00, 0xffef], [0xfff0, 0xffff], [0x0f00, 0x0fff], [0x0700, 0x074f], [0x0780, 0x07bf], [0x0d80, 0x0dff], [0x1000, 0x109f], [0x1200, 0x137f, 0x1380, 0x139f, 0x2d80, 0x2ddf], [0x13a0, 0x13ff], [0x1400, 0x167f], [0x1680, 0x169f], [0x16a0, 0x16ff], [0x1780, 0x17ff], [0x1800, 0x18af], [0x2800, 0x28ff], [0xa000, 0xa48f], [0x1700, 0x171f, 0x1720, 0x173f, 0x1740, 0x175f, 0x1760, 0x177f], [0x10300, 0x1032f], [0x10330, 0x1034f], [0x10400, 0x1044f], [0x1d000, 0x1d0ff, 0x1d100, 0x1d1ff, 0x1d200, 0x1d24f], [0x1d400, 0x1d7ff], [0xff000, 0xffffd], [0xfe00, 0xfe0f, 0xe0100, 0xe01ef], [0xe0000, 0xe007f], [0x1900, 0x194f], [0x1950, 0x197f], [0x1980, 0x19df], [0x1a00, 0x1a1f], [0x2c00, 0x2c5f], [0x2d30, 0x2d7f], [0x4dc0, 0x4dff], [0xa800, 0xa82f], [0x10000, 0x1007f, 0x10080, 0x100ff, 0x10100, 0x1013f], [0x10140, 0x1018f], [0x10380, 0x1039f], [0x103a0, 0x103df], [0x10450, 0x1047f], [0x10480, 0x104af], [0x10800, 0x1083f], [0x10a00, 0x10a5f], [0x1d300, 0x1d35f], [0x12000, 0x123ff, 0x12400, 0x1247f], [0x1d360, 0x1d37f], [0x1b80, 0x1bbf], [0x1c00, 0x1c4f], [0x1c50, 0x1c7f], [0xa880, 0xa8df], [0xa900, 0xa92f], [0xa930, 0xa95f], [0xaa00, 0xaa5f], [0x10190, 0x101cf], [0x101d0, 0x101ff], [0x102a0, 0x102df, 0x10280, 0x1029f, 0x10920, 0x1093f], [0x1f030, 0x1f09f, 0x1f000, 0x1f02f]];
17712function getUnicodeRangeFor(value, lastPosition = -1) {
17713  if (lastPosition !== -1) {
17714    const range = UnicodeRanges[lastPosition];
17715    for (let i = 0, ii = range.length; i < ii; i += 2) {
17716      if (value >= range[i] && value <= range[i + 1]) {
17717        return lastPosition;
17718      }
17719    }
17720  }
17721  for (let i = 0, ii = UnicodeRanges.length; i < ii; i++) {
17722    const range = UnicodeRanges[i];
17723    for (let j = 0, jj = range.length; j < jj; j += 2) {
17724      if (value >= range[j] && value <= range[j + 1]) {
17725        return i;
17726      }
17727    }
17728  }
17729  return -1;
17730}
17731const SpecialCharRegExp = new RegExp("^(\\s)|(\\p{Mn})|(\\p{Cf})$", "u");
17732const CategoryCache = new Map();
17733function getCharUnicodeCategory(char) {
17734  const cachedCategory = CategoryCache.get(char);
17735  if (cachedCategory) {
17736    return cachedCategory;
17737  }
17738  const groups = char.match(SpecialCharRegExp);
17739  const category = {
17740    isWhitespace: !!groups?.[1],
17741    isZeroWidthDiacritic: !!groups?.[2],
17742    isInvisibleFormatMark: !!groups?.[3]
17743  };
17744  CategoryCache.set(char, category);
17745  return category;
17746}
17747function clearUnicodeCaches() {
17748  CategoryCache.clear();
17749}
17750
17751;// ./src/core/fonts_utils.js
17752
17753
17754
17755
17756
17757const SEAC_ANALYSIS_ENABLED = true;
17758const FontFlags = {
17759  FixedPitch: 1,
17760  Serif: 2,
17761  Symbolic: 4,
17762  Script: 8,
17763  Nonsymbolic: 32,
17764  Italic: 64,
17765  AllCap: 65536,
17766  SmallCap: 131072,
17767  ForceBold: 262144
17768};
17769const MacStandardGlyphOrdering = [".notdef", ".null", "nonmarkingreturn", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quotesingle", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "grave", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "Adieresis", "Aring", "Ccedilla", "Eacute", "Ntilde", "Odieresis", "Udieresis", "aacute", "agrave", "acircumflex", "adieresis", "atilde", "aring", "ccedilla", "eacute", "egrave", "ecircumflex", "edieresis", "iacute", "igrave", "icircumflex", "idieresis", "ntilde", "oacute", "ograve", "ocircumflex", "odieresis", "otilde", "uacute", "ugrave", "ucircumflex", "udieresis", "dagger", "degree", "cent", "sterling", "section", "bullet", "paragraph", "germandbls", "registered", "copyright", "trademark", "acute", "dieresis", "notequal", "AE", "Oslash", "infinity", "plusminus", "lessequal", "greaterequal", "yen", "mu", "partialdiff", "summation", "product", "pi", "integral", "ordfeminine", "ordmasculine", "Omega", "ae", "oslash", "questiondown", "exclamdown", "logicalnot", "radical", "florin", "approxequal", "Delta", "guillemotleft", "guillemotright", "ellipsis", "nonbreakingspace", "Agrave", "Atilde", "Otilde", "OE", "oe", "endash", "emdash", "quotedblleft", "quotedblright", "quoteleft", "quoteright", "divide", "lozenge", "ydieresis", "Ydieresis", "fraction", "currency", "guilsinglleft", "guilsinglright", "fi", "fl", "daggerdbl", "periodcentered", "quotesinglbase", "quotedblbase", "perthousand", "Acircumflex", "Ecircumflex", "Aacute", "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis", "Igrave", "Oacute", "Ocircumflex", "apple", "Ograve", "Uacute", "Ucircumflex", "Ugrave", "dotlessi", "circumflex", "tilde", "macron", "breve", "dotaccent", "ring", "cedilla", "hungarumlaut", "ogonek", "caron", "Lslash", "lslash", "Scaron", "scaron", "Zcaron", "zcaron", "brokenbar", "Eth", "eth", "Yacute", "yacute", "Thorn", "thorn", "minus", "multiply", "onesuperior", "twosuperior", "threesuperior", "onehalf", "onequarter", "threequarters", "franc", "Gbreve", "gbreve", "Idotaccent", "Scedilla", "scedilla", "Cacute", "cacute", "Ccaron", "ccaron", "dcroat"];
17770function recoverGlyphName(name, glyphsUnicodeMap) {
17771  if (glyphsUnicodeMap[name] !== undefined) {
17772    return name;
17773  }
17774  const unicode = getUnicodeForGlyph(name, glyphsUnicodeMap);
17775  if (unicode !== -1) {
17776    for (const key in glyphsUnicodeMap) {
17777      if (glyphsUnicodeMap[key] === unicode) {
17778        return key;
17779      }
17780    }
17781  }
17782  info("Unable to recover a standard glyph name for: " + name);
17783  return name;
17784}
17785function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) {
17786  const charCodeToGlyphId = Object.create(null);
17787  let glyphId, charCode, baseEncoding;
17788  const isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
17789  if (properties.isInternalFont) {
17790    baseEncoding = builtInEncoding;
17791    for (charCode = 0; charCode < baseEncoding.length; charCode++) {
17792      glyphId = glyphNames.indexOf(baseEncoding[charCode]);
17793      charCodeToGlyphId[charCode] = glyphId >= 0 ? glyphId : 0;
17794    }
17795  } else if (properties.baseEncodingName) {
17796    baseEncoding = getEncoding(properties.baseEncodingName);
17797    for (charCode = 0; charCode < baseEncoding.length; charCode++) {
17798      glyphId = glyphNames.indexOf(baseEncoding[charCode]);
17799      charCodeToGlyphId[charCode] = glyphId >= 0 ? glyphId : 0;
17800    }
17801  } else if (isSymbolicFont) {
17802    for (charCode in builtInEncoding) {
17803      charCodeToGlyphId[charCode] = builtInEncoding[charCode];
17804    }
17805  } else {
17806    baseEncoding = StandardEncoding;
17807    for (charCode = 0; charCode < baseEncoding.length; charCode++) {
17808      glyphId = glyphNames.indexOf(baseEncoding[charCode]);
17809      charCodeToGlyphId[charCode] = glyphId >= 0 ? glyphId : 0;
17810    }
17811  }
17812  const differences = properties.differences;
17813  let glyphsUnicodeMap;
17814  if (differences) {
17815    for (charCode in differences) {
17816      const glyphName = differences[charCode];
17817      glyphId = glyphNames.indexOf(glyphName);
17818      if (glyphId === -1) {
17819        if (!glyphsUnicodeMap) {
17820          glyphsUnicodeMap = getGlyphsUnicode();
17821        }
17822        const standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
17823        if (standardGlyphName !== glyphName) {
17824          glyphId = glyphNames.indexOf(standardGlyphName);
17825        }
17826      }
17827      charCodeToGlyphId[charCode] = glyphId >= 0 ? glyphId : 0;
17828    }
17829  }
17830  return charCodeToGlyphId;
17831}
17832function normalizeFontName(name) {
17833  return name.replaceAll(/[,_]/g, "-").replaceAll(/\s/g, "");
17834}
17835const getVerticalPresentationForm = getLookupTableFactory(t => {
17836  t[0x2013] = 0xfe32;
17837  t[0x2014] = 0xfe31;
17838  t[0x2025] = 0xfe30;
17839  t[0x2026] = 0xfe19;
17840  t[0x3001] = 0xfe11;
17841  t[0x3002] = 0xfe12;
17842  t[0x3008] = 0xfe3f;
17843  t[0x3009] = 0xfe40;
17844  t[0x300a] = 0xfe3d;
17845  t[0x300b] = 0xfe3e;
17846  t[0x300c] = 0xfe41;
17847  t[0x300d] = 0xfe42;
17848  t[0x300e] = 0xfe43;
17849  t[0x300f] = 0xfe44;
17850  t[0x3010] = 0xfe3b;
17851  t[0x3011] = 0xfe3c;
17852  t[0x3014] = 0xfe39;
17853  t[0x3015] = 0xfe3a;
17854  t[0x3016] = 0xfe17;
17855  t[0x3017] = 0xfe18;
17856  t[0xfe4f] = 0xfe34;
17857  t[0xff01] = 0xfe15;
17858  t[0xff08] = 0xfe35;
17859  t[0xff09] = 0xfe36;
17860  t[0xff0c] = 0xfe10;
17861  t[0xff1a] = 0xfe13;
17862  t[0xff1b] = 0xfe14;
17863  t[0xff1f] = 0xfe16;
17864  t[0xff3b] = 0xfe47;
17865  t[0xff3d] = 0xfe48;
17866  t[0xff3f] = 0xfe33;
17867  t[0xff5b] = 0xfe37;
17868  t[0xff5d] = 0xfe38;
17869});
17870const MAX_SIZE_TO_COMPILE = 1000;
17871function compileType3Glyph({
17872  data: img,
17873  width,
17874  height
17875}) {
17876  if (width > MAX_SIZE_TO_COMPILE || height > MAX_SIZE_TO_COMPILE) {
17877    return null;
17878  }
17879  const POINT_TO_PROCESS_LIMIT = 1000;
17880  const POINT_TYPES = new Uint8Array([0, 2, 4, 0, 1, 0, 5, 4, 8, 10, 0, 8, 0, 2, 1, 0]);
17881  const width1 = width + 1;
17882  const points = new Uint8Array(width1 * (height + 1));
17883  let i, j, j0;
17884  const lineSize = width + 7 & ~7;
17885  const data = new Uint8Array(lineSize * height);
17886  let pos = 0;
17887  for (const elem of img) {
17888    let mask = 128;
17889    while (mask > 0) {
17890      data[pos++] = elem & mask ? 0 : 255;
17891      mask >>= 1;
17892    }
17893  }
17894  let count = 0;
17895  pos = 0;
17896  if (data[pos] !== 0) {
17897    points[0] = 1;
17898    ++count;
17899  }
17900  for (j = 1; j < width; j++) {
17901    if (data[pos] !== data[pos + 1]) {
17902      points[j] = data[pos] ? 2 : 1;
17903      ++count;
17904    }
17905    pos++;
17906  }
17907  if (data[pos] !== 0) {
17908    points[j] = 2;
17909    ++count;
17910  }
17911  for (i = 1; i < height; i++) {
17912    pos = i * lineSize;
17913    j0 = i * width1;
17914    if (data[pos - lineSize] !== data[pos]) {
17915      points[j0] = data[pos] ? 1 : 8;
17916      ++count;
17917    }
17918    let sum = (data[pos] ? 4 : 0) + (data[pos - lineSize] ? 8 : 0);
17919    for (j = 1; j < width; j++) {
17920      sum = (sum >> 2) + (data[pos + 1] ? 4 : 0) + (data[pos - lineSize + 1] ? 8 : 0);
17921      if (POINT_TYPES[sum]) {
17922        points[j0 + j] = POINT_TYPES[sum];
17923        ++count;
17924      }
17925      pos++;
17926    }
17927    if (data[pos - lineSize] !== data[pos]) {
17928      points[j0 + j] = data[pos] ? 2 : 4;
17929      ++count;
17930    }
17931    if (count > POINT_TO_PROCESS_LIMIT) {
17932      return null;
17933    }
17934  }
17935  pos = lineSize * (height - 1);
17936  j0 = i * width1;
17937  if (data[pos] !== 0) {
17938    points[j0] = 8;
17939    ++count;
17940  }
17941  for (j = 1; j < width; j++) {
17942    if (data[pos] !== data[pos + 1]) {
17943      points[j0 + j] = data[pos] ? 4 : 8;
17944      ++count;
17945    }
17946    pos++;
17947  }
17948  if (data[pos] !== 0) {
17949    points[j0 + j] = 4;
17950    ++count;
17951  }
17952  if (count > POINT_TO_PROCESS_LIMIT) {
17953    return null;
17954  }
17955  const steps = new Int32Array([0, width1, -1, 0, -width1, 0, 0, 0, 1]);
17956  const pathBuf = [];
17957  const {
17958    a,
17959    b,
17960    c,
17961    d,
17962    e,
17963    f
17964  } = new DOMMatrix().scaleSelf(1 / width, -1 / height).translateSelf(0, -height);
17965  for (i = 0; count && i <= height; i++) {
17966    let p = i * width1;
17967    const end = p + width;
17968    while (p < end && !points[p]) {
17969      p++;
17970    }
17971    if (p === end) {
17972      continue;
17973    }
17974    let x = p % width1;
17975    let y = i;
17976    pathBuf.push(DrawOPS.moveTo, a * x + c * y + e, b * x + d * y + f);
17977    const p0 = p;
17978    let type = points[p];
17979    do {
17980      const step = steps[type];
17981      do {
17982        p += step;
17983      } while (!points[p]);
17984      const pp = points[p];
17985      if (pp !== 5 && pp !== 10) {
17986        type = pp;
17987        points[p] = 0;
17988      } else {
17989        type = pp & 0x33 * type >> 4;
17990        points[p] &= type >> 2 | type << 2;
17991      }
17992      x = p % width1;
17993      y = p / width1 | 0;
17994      pathBuf.push(DrawOPS.lineTo, a * x + c * y + e, b * x + d * y + f);
17995      if (!points[p]) {
17996        --count;
17997      }
17998    } while (p0 !== p);
17999    --i;
18000  }
18001  return [OPS.rawFillPath, [new Float32Array(pathBuf)], new Float32Array([0, 0, width, height])];
18002}
18003
18004;// ./src/core/charsets.js
18005const ISOAdobeCharset = [".notdef", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quoteright", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "quoteleft", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "exclamdown", "cent", "sterling", "fraction", "yen", "florin", "section", "currency", "quotesingle", "quotedblleft", "guillemotleft", "guilsinglleft", "guilsinglright", "fi", "fl", "endash", "dagger", "daggerdbl", "periodce
18005ntered", "paragraph", "bullet", "quotesinglbase", "quotedblbase", "quotedblright", "guillemotright", "ellipsis", "perthousand", "questiondown", "grave", "acute", "circumflex", "tilde", "macron", "breve", "dotaccent", "dieresis", "ring", "cedilla", "hungarumlaut", "ogonek", "caron", "emdash", "AE", "ordfeminine", "Lslash", "Oslash", "OE", "ordmasculine", "ae", "dotlessi", "lslash", "oslash", "oe", "germandbls", "onesuperior", "logicalnot", "mu", "trademark", "Eth", "onehalf", "plusminus", "Thorn", "onequarter", "divide", "brokenbar", "degree", "thorn", "threequarters", "twosuperior", "registered", "minus", "eth", "multiply", "threesuperior", "copyright", "Aacute", "Acircumflex", "Adieresis", "Agrave", "Aring", "Atilde", "Ccedilla", "Eacute", "Ecircumflex", "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis", "Igrave", "Ntilde", "Oacute", "Ocircumflex", "Odieresis", "Ograve", "Otilde", "Scaron", "Uacute", "Ucircumflex", "Udieresis", "Ugrave", "Yacute", "Ydieresis", "Zcaron", "aacute", "acircumflex", "adieresis", "agrave", "aring", "atilde", "ccedilla", "eacute", "ecircumflex", "edieresis", "egrave", "iacute", "icircumflex", "idieresis", "igrave", "ntilde", "oacute", "ocircumflex", "odieresis", "ograve", "otilde", "scaron", "uacute", "ucircumflex", "udieresis", "ugrave", "yacute", "ydieresis", "zcaron"];
18006const ExpertCharset = [".notdef", "space", "exclamsmall", "Hungarumlautsmall", "dollaroldstyle", "dollarsuperior", "ampersandsmall", "Acutesmall", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "comma", "hyphen", "period", "fraction", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "colon", "semicolon", "commasuperior", "threequartersemdash", "periodsuperior", "questionsmall", "asuperior", "bsuperior", "centsuperior", "dsuperior", "esuperior", "isuperior", "lsuperior", "msuperior", "nsuperior", "osuperior", "rsuperior", "ssuperior", "tsuperior", "ff", "fi", "fl", "ffi", "ffl", "parenleftinferior", "parenrightinferior", "Circumflexsmall", "hyphensuperior", "Gravesmall", "Asmall", "Bsmall", "Csmall", "Dsmall", "Esmall", "Fsmall", "Gsmall", "Hsmall", "Ismall", "Jsmall", "Ksmall", "Lsmall", "Msmall", "Nsmall", "Osmall", "Psmall", "Qsmall", "Rsmall", "Ssmall", "Tsmall", "Usmall", "Vsmall", "Wsmall", "Xsmall", "Ysmall", "Zsmall", "colonmonetary", "onefitted", "rupiah", "Tildesmall", "exclamdownsmall", "centoldstyle", "Lslashsmall", "Scaronsmall", "Zcaronsmall", "Dieresissmall", "Brevesmall", "Caronsmall", "Dotaccentsmall", "Macronsmall", "figuredash", "hypheninferior", "Ogoneksmall", "Ringsmall", "Cedillasmall", "onequarter", "onehalf", "threequarters", "questiondownsmall", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "zerosuperior", "onesuperior", "twosuperior", "threesuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "eightsuperior", "ninesuperior", "zeroinferior", "oneinferior", "twoinferior", "threeinferior", "fourinferior", "fiveinferior", "sixinferior", "seveninferior", "eightinferior", "nineinferior", "centinferior", "dollarinferior", "periodinferior", "commainferior", "Agravesmall", "Aacutesmall", "Acircumflexsmall", "Atildesmall", "Adieresissmall", "Aringsmall", "AEsmall", "Ccedillasmall", "Egravesmall", "Eacutesmall", "Ecircumflexsmall", "Edieresissmall", "Igravesmall", "Iacutesmall", "Icircumflexsmall", "Idieresissmall", "Ethsmall", "Ntildesmall", "Ogravesmall", "Oacutesmall", "Ocircumflexsmall", "Otildesmall", "Odieresissmall", "OEsmall", "Oslashsmall", "Ugravesmall", "Uacutesmall", "Ucircumflexsmall", "Udieresissmall", "Yacutesmall", "Thornsmall", "Ydieresissmall"];
18007const ExpertSubsetCharset = [".notdef", "space", "dollaroldstyle", "dollarsuperior", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "comma", "hyphen", "period", "fraction", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "colon", "semicolon", "commasuperior", "threequartersemdash", "periodsuperior", "asuperior", "bsuperior", "centsuperior", "dsuperior", "esuperior", "isuperior", "lsuperior", "msuperior", "nsuperior", "osuperior", "rsuperior", "ssuperior", "tsuperior", "ff", "fi", "fl", "ffi", "ffl", "parenleftinferior", "parenrightinferior", "hyphensuperior", "colonmonetary", "onefitted", "rupiah", "centoldstyle", "figuredash", "hypheninferior", "onequarter", "onehalf", "threequarters", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "zerosuperior", "onesuperior", "twosuperior", "threesuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "eightsuperior", "ninesuperior", "zeroinferior", "oneinferior", "twoinferior", "threeinferior", "fourinferior", "fiveinferior", "sixinferior", "seveninferior", "eightinferior", "nineinferior", "centinferior", "dollarinferior", "periodinferior", "commainferior"];
18008
18009;// ./src/core/cff_parser.js
18010
18011
18012
18013const MAX_SUBR_NESTING = 10;
18014const CFFStandardStrings = [".notdef", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quoteright", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "quoteleft", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "exclamdown", "cent", "sterling", "fraction", "yen", "florin", "section", "currency", "quotesingle", "quotedblleft", "guillemotleft", "guilsinglleft", "guilsinglright", "fi", "fl", "endash", "dagger", "daggerdbl", "periodce
vendor: 8,071 bytes, lines 18014-18254
18014ntered", "paragraph", "bullet", "quotesinglbase", "quotedblbase", "quotedblright", "guillemotright", "ellipsis", "perthousand", "questiondown", "grave", "acute", "circumflex", "tilde", "macron", "breve", "dotaccent", "dieresis", "ring", "cedilla", "hungarumlaut", "ogonek", "caron", "emdash", "AE", "ordfeminine", "Lslash", "Oslash", "OE", "ordmasculine", "ae", "dotlessi", "lslash", "oslash", "oe", "germandbls", "onesuperior", "logicalnot", "mu", "trademark", "Eth", "onehalf", "plusminus", "Thorn", "onequarter", "divide", "brokenbar", "degree", "thorn", "threequarters", "twosuperior", "registered", "minus", "eth", "multiply", "threesuperior", "copyright", "Aacute", "Acircumflex", "Adieresis", "Agrave", "Aring", "Atilde", "Ccedilla", "Eacute", "Ecircumflex", "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis", "Igrave", "Ntilde", "Oacute", "Ocircumflex", "Odieresis", "Ograve", "Otilde", "Scaron", "Uacute", "Ucircumflex", "Udieresis", "Ugrave", "Yacute", "Ydieresis", "Zcaron", "aacute", "acircumflex", "adieresis", "agrave", "aring", "atilde", "ccedilla", "eacute", "ecircumflex", "edieresis", "egrave", "iacute", "icircumflex", "idieresis", "igrave", "ntilde", "oacute", "ocircumflex", "odieresis", "ograve", "otilde", "scaron", "uacute", "ucircumflex", "udieresis", "ugrave", "yacute", "ydieresis", "zcaron", "exclamsmall", "Hungarumlautsmall", "dollaroldstyle", "dollarsuperior", "ampersandsmall", "Acutesmall", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "commasuperior", "threequartersemdash", "periodsuperior", "questionsmall", "asuperior", "bsuperior", "centsuperior", "dsuperior", "esuperior", "isuperior", "lsuperior", "msuperior", "nsuperior", "osuperior", "rsuperior", "ssuperior", "tsuperior", "ff", "ffi", "ffl", "parenleftinferior", "parenrightinferior", "Circumflexsmall", "hyphensuperior", "Gravesmall", "Asmall", "Bsmall", "Csmall", "Dsmall", "Esmall", "Fsmall", "Gsmall", "Hsmall", "Ismall", "Jsmall", "Ksmall", "Lsmall", "Msmall", "Nsmall", "Osmall", "Psmall", "Qsmall", "Rsmall", "Ssmall", "Tsmall", "Usmall", "Vsmall", "Wsmall", "Xsmall", "Ysmall", "Zsmall", "colonmonetary", "onefitted", "rupiah", "Tildesmall", "exclamdownsmall", "centoldstyle", "Lslashsmall", "Scaronsmall", "Zcaronsmall", "Dieresissmall", "Brevesmall", "Caronsmall", "Dotaccentsmall", "Macronsmall", "figuredash", "hypheninferior", "Ogoneksmall", "Ringsmall", "Cedillasmall", "questiondownsmall", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "zerosuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "eightsuperior", "ninesuperior", "zeroinferior", "oneinferior", "twoinferior", "threeinferior", "fourinferior", "fiveinferior", "sixinferior", "seveninferior", "eightinferior", "nineinferior", "centinferior", "dollarinferior", "periodinferior", "commainferior", "Agravesmall", "Aacutesmall", "Acircumflexsmall", "Atildesmall", "Adieresissmall", "Aringsmall", "AEsmall", "Ccedillasmall", "Egravesmall", "Eacutesmall", "Ecircumflexsmall", "Edieresissmall", "Igravesmall", "Iacutesmall", "Icircumflexsmall", "Idieresissmall", "Ethsmall", "Ntildesmall", "Ogravesmall", "Oacutesmall", "Ocircumflexsmall", "Otildesmall", "Odieresissmall", "OEsmall", "Oslashsmall", "Ugravesmall", "Uacutesmall", "Ucircumflexsmall", "Udieresissmall", "Yacutesmall", "Thornsmall", "Ydieresissmall", "001.000", "001.001", "001.002", "001.003", "Black", "Bold", "Book", "Light", "Medium", "Regular", "Roman", "Semibold"];
18015const NUM_STANDARD_CFF_STRINGS = 391;
18016const CharstringValidationData = [null, {
18017  id: "hstem",
18018  min: 2,
18019  stackClearing: true,
18020  stem: true
18021}, null, {
18022  id: "vstem",
18023  min: 2,
18024  stackClearing: true,
18025  stem: true
18026}, {
18027  id: "vmoveto",
18028  min: 1,
18029  stackClearing: true
18030}, {
18031  id: "rlineto",
18032  min: 2,
18033  resetStack: true
18034}, {
18035  id: "hlineto",
18036  min: 1,
18037  resetStack: true
18038}, {
18039  id: "vlineto",
18040  min: 1,
18041  resetStack: true
18042}, {
18043  id: "rrcurveto",
18044  min: 6,
18045  resetStack: true
18046}, null, {
18047  id: "callsubr",
18048  min: 1
18049}, {
18050  id: "return",
18051  min: 0
18052}, null, null, {
18053  id: "endchar",
18054  min: 0,
18055  stackClearing: true
18056}, null, null, null, {
18057  id: "hstemhm",
18058  min: 2,
18059  stackClearing: true,
18060  stem: true
18061}, {
18062  id: "hintmask",
18063  min: 0,
18064  stackClearing: true
18065}, {
18066  id: "cntrmask",
18067  min: 0,
18068  stackClearing: true
18069}, {
18070  id: "rmoveto",
18071  min: 2,
18072  stackClearing: true
18073}, {
18074  id: "hmoveto",
18075  min: 1,
18076  stackClearing: true
18077}, {
18078  id: "vstemhm",
18079  min: 2,
18080  stackClearing: true,
18081  stem: true
18082}, {
18083  id: "rcurveline",
18084  min: 8,
18085  resetStack: true
18086}, {
18087  id: "rlinecurve",
18088  min: 8,
18089  resetStack: true
18090}, {
18091  id: "vvcurveto",
18092  min: 4,
18093  resetStack: true
18094}, {
18095  id: "hhcurveto",
18096  min: 4,
18097  resetStack: true
18098}, null, {
18099  id: "callgsubr",
18100  min: 1
18101}, {
18102  id: "vhcurveto",
18103  min: 4,
18104  resetStack: true
18105}, {
18106  id: "hvcurveto",
18107  min: 4,
18108  resetStack: true
18109}];
18110const CharstringValidationData12 = [null, null, null, {
18111  id: "and",
18112  min: 2,
18113  stackDelta: -1
18114}, {
18115  id: "or",
18116  min: 2,
18117  stackDelta: -1
18118}, {
18119  id: "not",
18120  min: 1,
18121  stackDelta: 0
18122}, null, null, null, {
18123  id: "abs",
18124  min: 1,
18125  stackDelta: 0
18126}, {
18127  id: "add",
18128  min: 2,
18129  stackDelta: -1,
18130  stackFn(stack, index) {
18131    stack[index - 2] = stack[index - 2] + stack[index - 1];
18132  }
18133}, {
18134  id: "sub",
18135  min: 2,
18136  stackDelta: -1,
18137  stackFn(stack, index) {
18138    stack[index - 2] = stack[index - 2] - stack[index - 1];
18139  }
18140}, {
18141  id: "div",
18142  min: 2,
18143  stackDelta: -1,
18144  stackFn(stack, index) {
18145    stack[index - 2] = stack[index - 2] / stack[index - 1];
18146  }
18147}, null, {
18148  id: "neg",
18149  min: 1,
18150  stackDelta: 0,
18151  stackFn(stack, index) {
18152    stack[index - 1] = -stack[index - 1];
18153  }
18154}, {
18155  id: "eq",
18156  min: 2,
18157  stackDelta: -1
18158}, null, null, {
18159  id: "drop",
18160  min: 1,
18161  stackDelta: -1
18162}, null, {
18163  id: "put",
18164  min: 2,
18165  stackDelta: -2
18166}, {
18167  id: "get",
18168  min: 1,
18169  stackDelta: 0
18170}, {
18171  id: "ifelse",
18172  min: 4,
18173  stackDelta: -3
18174}, {
18175  id: "random",
18176  min: 0,
18177  stackDelta: 1
18178}, {
18179  id: "mul",
18180  min: 2,
18181  stackDelta: -1,
18182  stackFn(stack, index) {
18183    stack[index - 2] = stack[index - 2] * stack[index - 1];
18184  }
18185}, null, {
18186  id: "sqrt",
18187  min: 1,
18188  stackDelta: 0
18189}, {
18190  id: "dup",
18191  min: 1,
18192  stackDelta: 1
18193}, {
18194  id: "exch",
18195  min: 2,
18196  stackDelta: 0
18197}, {
18198  id: "index",
18199  min: 2,
18200  stackDelta: 0
18201}, {
18202  id: "roll",
18203  min: 3,
18204  stackDelta: -2
18205}, null, null, null, {
18206  id: "hflex",
18207  min: 7,
18208  resetStack: true
18209}, {
18210  id: "flex",
18211  min: 13,
18212  resetStack: true
18213}, {
18214  id: "hflex1",
18215  min: 9,
18216  resetStack: true
18217}, {
18218  id: "flex1",
18219  min: 11,
18220  resetStack: true
18221}];
18222class CFFParser {
18223  constructor(file, properties, seacAnalysisEnabled) {
18224    this.bytes = file.getBytes();
18225    this.properties = properties;
18226    this.seacAnalysisEnabled = !!seacAnalysisEnabled;
18227  }
18228  parse() {
18229    const properties = this.properties;
18230    const cff = new CFF(this.bytes.length);
18231    this.cff = cff;
18232    const header = this.parseHeader();
18233    const nameIndex = this.parseIndex(header.endPos);
18234    const topDictIndex = this.parseIndex(nameIndex.endPos);
18235    const stringIndex = this.parseIndex(topDictIndex.endPos);
18236    const globalSubrIndex = this.parseIndex(stringIndex.endPos);
18237    const topDictParsed = this.parseDict(topDictIndex.obj.get(0));
18238    const topDict = this.createDict(CFFTopDict, topDictParsed, cff.strings);
18239    cff.header = header.obj;
18240    cff.names = this.parseNameIndex(nameIndex.obj);
18241    cff.strings = this.parseStringIndex(stringIndex.obj);
18242    cff.topDict = topDict;
18243    cff.globalSubrIndex = globalSubrIndex.obj;
18244    this.parsePrivateDict(cff.topDict);
18245    cff.isCIDFont = topDict.hasName("ROS");
18246    const charStringOffset = topDict.getByName("CharStrings");
18247    const charStringIndex = this.parseIndex(charStringOffset).obj;
18248    cff.charStringCount = charStringIndex.count;
18249    const fontMatrix = topDict.getByName("FontMatrix");
18250    if (fontMatrix) {
18251      properties.fontMatrix = fontMatrix;
18252    }
18253    const fontBBox = topDict.getByName("FontBBox");
18254    if (fontBBox
vendor: 11,696 bytes, lines 18254-18618
18254) {
18255      properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
18256      properties.descent = Math.min(fontBBox[1], fontBBox[3]);
18257      properties.ascentScaled = true;
18258    }
18259    let charset, encoding;
18260    if (cff.isCIDFont) {
18261      const fdArrayIndex = this.parseIndex(topDict.getByName("FDArray")).obj;
18262      for (let i = 0, ii = fdArrayIndex.count; i < ii; ++i) {
18263        const dictRaw = fdArrayIndex.get(i);
18264        const fontDict = this.createDict(CFFTopDict, this.parseDict(dictRaw), cff.strings);
18265        this.parsePrivateDict(fontDict);
18266        cff.fdArray.push(fontDict);
18267      }
18268      encoding = null;
18269      charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, true);
18270      cff.fdSelect = this.parseFDSelect(topDict.getByName("FDSelect"), charStringIndex.count);
18271    } else {
18272      charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, false);
18273      encoding = this.parseEncoding(topDict.getByName("Encoding"), properties, cff.strings, charset.charset);
18274    }
18275    cff.charset = charset;
18276    cff.encoding = encoding;
18277    const charStringsAndSeacs = this.parseCharStrings({
18278      charStrings: charStringIndex,
18279      localSubrIndex: topDict.privateDict.subrsIndex,
18280      globalSubrIndex: globalSubrIndex.obj,
18281      fdSelect: cff.fdSelect,
18282      fdArray: cff.fdArray,
18283      privateDict: topDict.privateDict
18284    });
18285    cff.charStrings = charStringsAndSeacs.charStrings;
18286    cff.seacs = charStringsAndSeacs.seacs;
18287    cff.widths = charStringsAndSeacs.widths;
18288    return cff;
18289  }
18290  parseHeader() {
18291    let bytes = this.bytes;
18292    const bytesLength = bytes.length;
18293    let offset = 0;
18294    while (offset < bytesLength && bytes[offset] !== 1) {
18295      ++offset;
18296    }
18297    if (offset >= bytesLength) {
18298      throw new FormatError("Invalid CFF header");
18299    }
18300    if (offset !== 0) {
18301      info("cff data is shifted");
18302      bytes = bytes.subarray(offset);
18303      this.bytes = bytes;
18304    }
18305    const major = bytes[0];
18306    const minor = bytes[1];
18307    const hdrSize = bytes[2];
18308    const offSize = bytes[3];
18309    const header = new CFFHeader(major, minor, hdrSize, offSize);
18310    return {
18311      obj: header,
18312      endPos: hdrSize
18313    };
18314  }
18315  parseDict(dict) {
18316    const view = new DataView(dict.buffer, dict.byteOffset, dict.bytesLength);
18317    let pos = 0;
18318    function parseOperand() {
18319      let value = dict[pos++];
18320      if (value === 30) {
18321        return parseFloatOperand();
18322      } else if (value === 28) {
18323        value = view.getInt16(pos);
18324        pos += 2;
18325        return value;
18326      } else if (value === 29) {
18327        value = view.getInt32(pos);
18328        pos += 4;
18329        return value;
18330      } else if (value >= 32 && value <= 246) {
18331        return value - 139;
18332      } else if (value >= 247 && value <= 250) {
18333        return (value - 247) * 256 + dict[pos++] + 108;
18334      } else if (value >= 251 && value <= 254) {
18335        return -((value - 251) * 256) - dict[pos++] - 108;
18336      }
18337      warn(`CFFParser.parseDict: "${value}" is a reserved command.`);
18338      return NaN;
18339    }
18340    function parseFloatOperand() {
18341      let str = "";
18342      const eof = 15;
18343      const lookup = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ".", "E", "E-", null, "-"];
18344      const length = dict.length;
18345      while (pos < length) {
18346        const b = dict[pos++];
18347        const b1 = b >> 4;
18348        const b2 = b & 15;
18349        if (b1 === eof) {
18350          break;
18351        }
18352        str += lookup[b1];
18353        if (b2 === eof) {
18354          break;
18355        }
18356        str += lookup[b2];
18357      }
18358      return parseFloat(str);
18359    }
18360    let operands = [];
18361    const entries = [];
18362    pos = 0;
18363    const end = dict.length;
18364    while (pos < end) {
18365      let b = dict[pos];
18366      if (b <= 21) {
18367        if (b === 12) {
18368          b = b << 8 | dict[++pos];
18369        }
18370        entries.push([b, operands]);
18371        operands = [];
18372        ++pos;
18373      } else {
18374        operands.push(parseOperand());
18375      }
18376    }
18377    return entries;
18378  }
18379  parseIndex(pos) {
18380    const cffIndex = new CFFIndex();
18381    const bytes = this.bytes;
18382    const count = bytes[pos++] << 8 | bytes[pos++];
18383    const offsets = [];
18384    let end = pos;
18385    let i, ii;
18386    if (count !== 0) {
18387      const offsetSize = bytes[pos++];
18388      const startPos = pos + (count + 1) * offsetSize - 1;
18389      for (i = 0, ii = count + 1; i < ii; ++i) {
18390        let offset = 0;
18391        for (let j = 0; j < offsetSize; ++j) {
18392          offset <<= 8;
18393          offset += bytes[pos++];
18394        }
18395        offsets.push(startPos + offset);
18396      }
18397      end = offsets[count];
18398    }
18399    for (i = 0, ii = offsets.length - 1; i < ii; ++i) {
18400      const offsetStart = offsets[i];
18401      const offsetEnd = offsets[i + 1];
18402      cffIndex.add(bytes.subarray(offsetStart, offsetEnd));
18403    }
18404    return {
18405      obj: cffIndex,
18406      endPos: end
18407    };
18408  }
18409  parseNameIndex(index) {
18410    const names = [];
18411    for (let i = 0, ii = index.count; i < ii; ++i) {
18412      const name = index.get(i);
18413      names.push(bytesToString(name));
18414    }
18415    return names;
18416  }
18417  parseStringIndex(index) {
18418    const strings = new CFFStrings();
18419    for (let i = 0, ii = index.count; i < ii; ++i) {
18420      const data = index.get(i);
18421      strings.add(bytesToString(data));
18422    }
18423    return strings;
18424  }
18425  createDict(Type, dict, strings) {
18426    const cffDict = new Type(strings);
18427    for (const [key, value] of dict) {
18428      cffDict.setByKey(key, value);
18429    }
18430    return cffDict;
18431  }
18432  parseCharString(state, data, localSubrIndex, globalSubrIndex) {
18433    if (!data || state.callDepth > MAX_SUBR_NESTING) {
18434      return false;
18435    }
18436    const view = new DataView(data.buffer, data.byteOffset, data.bytesLength);
18437    let stackSize = state.stackSize;
18438    const stack = state.stack;
18439    let length = data.length;
18440    for (let j = 0; j < length;) {
18441      const value = data[j++];
18442      let validationCommand = null;
18443      if (value === 12) {
18444        const q = data[j++];
18445        if (q === 0) {
18446          data[j - 2] = 139;
18447          data[j - 1] = 22;
18448          stackSize = 0;
18449        } else {
18450          validationCommand = CharstringValidationData12[q];
18451        }
18452      } else if (value === 28) {
18453        stack[stackSize] = view.getInt16(j);
18454        j += 2;
18455        stackSize++;
18456      } else if (value === 14) {
18457        if (stackSize >= 4) {
18458          stackSize -= 4;
18459          if (this.seacAnalysisEnabled) {
18460            state.seac = stack.slice(stackSize, stackSize + 4);
18461            return false;
18462          }
18463        }
18464        validationCommand = CharstringValidationData[value];
18465      } else if (value >= 32 && value <= 246) {
18466        stack[stackSize] = value - 139;
18467        stackSize++;
18468      } else if (value >= 247 && value <= 254) {
18469        stack[stackSize] = value < 251 ? (value - 247 << 8) + data[j] + 108 : -(value - 251 << 8) - data[j] - 108;
18470        j++;
18471        stackSize++;
18472      } else if (value === 255) {
18473        stack[stackSize] = view.getInt32(j) / 65536;
18474        j += 4;
18475        stackSize++;
18476      } else if (value === 19 || value === 20) {
18477        state.hints += stackSize >> 1;
18478        if (state.hints === 0) {
18479          data.copyWithin(j - 1, j, -1);
18480          j -= 1;
18481          length -= 1;
18482          continue;
18483        }
18484        j += state.hints + 7 >> 3;
18485        stackSize %= 2;
18486        validationCommand = CharstringValidationData[value];
18487      } else if (value === 10 || value === 29) {
18488        const subrsIndex = value === 10 ? localSubrIndex : globalSubrIndex;
18489        if (!subrsIndex) {
18490          validationCommand = CharstringValidationData[value];
18491          warn("Missing subrsIndex for " + validationCommand.id);
18492          return false;
18493        }
18494        let bias = 32768;
18495        if (subrsIndex.count < 1240) {
18496          bias = 107;
18497        } else if (subrsIndex.count < 33900) {
18498          bias = 1131;
18499        }
18500        const subrNumber = stack[--stackSize] + bias;
18501        if (subrNumber < 0 || subrNumber >= subrsIndex.count || isNaN(subrNumber)) {
18502          validationCommand = CharstringValidationData[value];
18503          warn("Out of bounds subrIndex for " + validationCommand.id);
18504          return false;
18505        }
18506        state.stackSize = stackSize;
18507        state.callDepth++;
18508        const valid = this.parseCharString(state, subrsIndex.get(subrNumber), localSubrIndex, globalSubrIndex);
18509        if (!valid) {
18510          return false;
18511        }
18512        state.callDepth--;
18513        stackSize = state.stackSize;
18514        continue;
18515      } else if (value === 11) {
18516        state.stackSize = stackSize;
18517        return true;
18518      } else if (value === 0 && j === data.length) {
18519        data[j - 1] = 14;
18520        validationCommand = CharstringValidationData[14];
18521      } else if (value === 9) {
18522        data.copyWithin(j - 1, j, -1);
18523        j -= 1;
18524        length -= 1;
18525        continue;
18526      } else {
18527        validationCommand = CharstringValidationData[value];
18528      }
18529      if (validationCommand) {
18530        if (validationCommand.stem) {
18531          state.hints += stackSize >> 1;
18532          if (value === 3 || value === 23) {
18533            state.hasVStems = true;
18534          } else if (state.hasVStems && (value === 1 || value === 18)) {
18535            warn("CFF stem hints are in wrong order");
18536            data[j - 1] = value === 1 ? 3 : 23;
18537          }
18538        }
18539        if (stackSize < validationCommand.min) {
18540          warn("Not enough parameters for " + validationCommand.id + "; actual: " + stackSize + ", expected: " + validationCommand.min);
18541          if (stackSize === 0) {
18542            data[j - 1] = 14;
18543            return true;
18544          }
18545          return false;
18546        }
18547        if (state.firstStackClearing && validationCommand.stackClearing) {
18548          state.firstStackClearing = false;
18549          stackSize -= validationCommand.min;
18550          if (stackSize >= 2 && validationCommand.stem) {
18551            stackSize %= 2;
18552          } else if (stackSize > 1) {
18553            warn("Found too many parameters for stack-clearing command");
18554          }
18555          if (stackSize > 0) {
18556            state.width = stack[stackSize - 1];
18557          }
18558        }
18559        if ("stackDelta" in validationCommand) {
18560          if ("stackFn" in validationCommand) {
18561            validationCommand.stackFn(stack, stackSize);
18562          }
18563          stackSize += validationCommand.stackDelta;
18564        } else if (validationCommand.stackClearing || validationCommand.resetStack) {
18565          stackSize = 0;
18566        }
18567      }
18568    }
18569    if (length < data.length) {
18570      data.fill(14, length);
18571    }
18572    state.stackSize = stackSize;
18573    return true;
18574  }
18575  parseCharStrings({
18576    charStrings,
18577    localSubrIndex,
18578    globalSubrIndex,
18579    fdSelect,
18580    fdArray,
18581    privateDict
18582  }) {
18583    const seacs = [];
18584    const widths = [];
18585    const count = charStrings.count;
18586    for (let i = 0; i < count; i++) {
18587      const charstring = charStrings.get(i);
18588      const state = {
18589        callDepth: 0,
18590        stackSize: 0,
18591        stack: [],
18592        hints: 0,
18593        firstStackClearing: true,
18594        seac: null,
18595        width: null,
18596        hasVStems: false
18597      };
18598      let valid = true;
18599      let localSubrToUse = null;
18600      let privateDictToUse = privateDict;
18601      if (fdSelect && fdArray.length) {
18602        const fdIndex = fdSelect.getFDIndex(i);
18603        if (fdIndex === -1) {
18604          warn("Glyph index is not in fd select.");
18605          valid = false;
18606        }
18607        if (fdIndex >= fdArray.length) {
18608          warn("Invalid fd index for glyph index.");
18609          valid = false;
18610        }
18611        if (valid) {
18612          privateDictToUse = fdArray[fdIndex].privateDict;
18613          localSubrToUse = privateDictToUse.subrsIndex;
18614        }
18615      } else if (localSubrIndex) {
18616        localSubrToUse = localSubrIndex;
18617      }
18618      
vendor: 2,795 bytes, lines 18618-18698
18618if (valid) {
18619        valid = this.parseCharString(state, charstring, localSubrToUse, globalSubrIndex);
18620      }
18621      if (state.width !== null) {
18622        const nominalWidth = privateDictToUse.getByName("nominalWidthX");
18623        widths[i] = nominalWidth + state.width;
18624      } else {
18625        const defaultWidth = privateDictToUse.getByName("defaultWidthX");
18626        widths[i] = defaultWidth;
18627      }
18628      if (state.seac !== null) {
18629        seacs[i] = state.seac;
18630      }
18631      if (!valid) {
18632        charStrings.set(i, new Uint8Array([14]));
18633      }
18634    }
18635    return {
18636      charStrings,
18637      seacs,
18638      widths
18639    };
18640  }
18641  emptyPrivateDictionary(parentDict) {
18642    const privateDict = this.createDict(CFFPrivateDict, [], parentDict.strings);
18643    parentDict.setByKey(18, [0, 0]);
18644    parentDict.privateDict = privateDict;
18645  }
18646  parsePrivateDict(parentDict) {
18647    if (!parentDict.hasName("Private")) {
18648      this.emptyPrivateDictionary(parentDict);
18649      return;
18650    }
18651    const privateOffset = parentDict.getByName("Private");
18652    if (!Array.isArray(privateOffset) || privateOffset.length !== 2) {
18653      parentDict.removeByName("Private");
18654      return;
18655    }
18656    const size = privateOffset[0];
18657    const offset = privateOffset[1];
18658    if (size === 0 || offset >= this.bytes.length) {
18659      this.emptyPrivateDictionary(parentDict);
18660      return;
18661    }
18662    const privateDictEnd = offset + size;
18663    const dictData = this.bytes.subarray(offset, privateDictEnd);
18664    const dict = this.parseDict(dictData);
18665    const privateDict = this.createDict(CFFPrivateDict, dict, parentDict.strings);
18666    parentDict.privateDict = privateDict;
18667    if (privateDict.getByName("ExpansionFactor") === 0) {
18668      privateDict.setByName("ExpansionFactor", 0.06);
18669    }
18670    if (!privateDict.getByName("Subrs")) {
18671      return;
18672    }
18673    const subrsOffset = privateDict.getByName("Subrs");
18674    const relativeOffset = offset + subrsOffset;
18675    if (subrsOffset === 0 || relativeOffset >= this.bytes.length) {
18676      this.emptyPrivateDictionary(parentDict);
18677      return;
18678    }
18679    const subrsIndex = this.parseIndex(relativeOffset);
18680    privateDict.subrsIndex = subrsIndex.obj;
18681  }
18682  parseCharsets(pos, length, strings, cid) {
18683    if (pos === 0) {
18684      return new CFFCharset(true, CFFCharsetPredefinedTypes.ISO_ADOBE, ISOAdobeCharset);
18685    } else if (pos === 1) {
18686      return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT, ExpertCharset);
18687    } else if (pos === 2) {
18688      return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT_SUBSET, ExpertSubsetCharset);
18689    }
18690    const bytes = this.bytes;
18691    const start = pos;
18692    const format = bytes[pos++];
18693    const charset = [cid ? 0 : ".notdef"];
18694    let id, count, i;
18695    length -= 1;
18696    switch (format) {
18697      case 0:
18698        for (i = 0; i < length; i++) {
vendor: 26,032 bytes, lines 18699-19493
18699          id = bytes[pos++] << 8 | bytes[pos++];
18700          charset.push(cid ? id : strings.get(id));
18701        }
18702        break;
18703      case 1:
18704        while (charset.length <= length) {
18705          id = bytes[pos++] << 8 | bytes[pos++];
18706          count = bytes[pos++];
18707          for (i = 0; i <= count; i++) {
18708            charset.push(cid ? id++ : strings.get(id++));
18709          }
18710        }
18711        break;
18712      case 2:
18713        while (charset.length <= length) {
18714          id = bytes[pos++] << 8 | bytes[pos++];
18715          count = bytes[pos++] << 8 | bytes[pos++];
18716          for (i = 0; i <= count; i++) {
18717            charset.push(cid ? id++ : strings.get(id++));
18718          }
18719        }
18720        break;
18721      default:
18722        throw new FormatError("Unknown charset format");
18723    }
18724    const end = pos;
18725    const raw = bytes.subarray(start, end);
18726    return new CFFCharset(false, format, charset, raw);
18727  }
18728  parseEncoding(pos, properties, strings, charset) {
18729    const encoding = Object.create(null);
18730    const bytes = this.bytes;
18731    let predefined = false;
18732    let format, i, ii;
18733    let raw = null;
18734    function readSupplement() {
18735      const supplementsCount = bytes[pos++];
18736      for (i = 0; i < supplementsCount; i++) {
18737        const code = bytes[pos++];
18738        const sid = (bytes[pos++] << 8) + (bytes[pos++] & 0xff);
18739        encoding[code] = charset.indexOf(strings.get(sid));
18740      }
18741    }
18742    if (pos === 0 || pos === 1) {
18743      predefined = true;
18744      format = pos;
18745      const baseEncoding = pos ? ExpertEncoding : StandardEncoding;
18746      for (i = 0, ii = charset.length; i < ii; i++) {
18747        const index = baseEncoding.indexOf(charset[i]);
18748        if (index !== -1) {
18749          encoding[index] = i;
18750        }
18751      }
18752    } else {
18753      const dataStart = pos;
18754      format = bytes[pos++];
18755      switch (format & 0x7f) {
18756        case 0:
18757          const glyphsCount = bytes[pos++];
18758          for (i = 1; i <= glyphsCount; i++) {
18759            encoding[bytes[pos++]] = i;
18760          }
18761          break;
18762        case 1:
18763          const rangesCount = bytes[pos++];
18764          let gid = 1;
18765          for (i = 0; i < rangesCount; i++) {
18766            const start = bytes[pos++];
18767            const left = bytes[pos++];
18768            for (let j = start; j <= start + left; j++) {
18769              encoding[j] = gid++;
18770            }
18771          }
18772          break;
18773        default:
18774          throw new FormatError(`Unknown encoding format: ${format} in CFF`);
18775      }
18776      const dataEnd = pos;
18777      if (format & 0x80) {
18778        bytes[dataStart] &= 0x7f;
18779        readSupplement();
18780      }
18781      raw = bytes.subarray(dataStart, dataEnd);
18782    }
18783    format &= 0x7f;
18784    return new CFFEncoding(predefined, format, encoding, raw);
18785  }
18786  parseFDSelect(pos, length) {
18787    const bytes = this.bytes;
18788    const format = bytes[pos++];
18789    const fdSelect = [];
18790    let i;
18791    switch (format) {
18792      case 0:
18793        for (i = 0; i < length; ++i) {
18794          const id = bytes[pos++];
18795          fdSelect.push(id);
18796        }
18797        break;
18798      case 3:
18799        const rangesCount = bytes[pos++] << 8 | bytes[pos++];
18800        for (i = 0; i < rangesCount; ++i) {
18801          let first = bytes[pos++] << 8 | bytes[pos++];
18802          if (i === 0 && first !== 0) {
18803            warn("parseFDSelect: The first range must have a first GID of 0" + " -- trying to recover.");
18804            first = 0;
18805          }
18806          const fdIndex = bytes[pos++];
18807          const next = bytes[pos] << 8 | bytes[pos + 1];
18808          for (let j = first; j < next; ++j) {
18809            fdSelect.push(fdIndex);
18810          }
18811        }
18812        pos += 2;
18813        break;
18814      default:
18815        throw new FormatError(`parseFDSelect: Unknown format "${format}".`);
18816    }
18817    if (fdSelect.length !== length) {
18818      throw new FormatError("parseFDSelect: Invalid font data.");
18819    }
18820    return new CFFFDSelect(format, fdSelect);
18821  }
18822}
18823class CFF {
18824  header = null;
18825  names = [];
18826  topDict = null;
18827  strings = new CFFStrings();
18828  globalSubrIndex = null;
18829  encoding = null;
18830  charset = null;
18831  charStrings = null;
18832  fdArray = [];
18833  fdSelect = null;
18834  isCIDFont = false;
18835  charStringCount = 0;
18836  constructor(rawFileLength = 0) {
18837    this.rawFileLength = rawFileLength;
18838  }
18839  duplicateFirstGlyph() {
18840    if (this.charStrings.count >= 65535) {
18841      warn("Not enough space in charstrings to duplicate first glyph.");
18842      return;
18843    }
18844    const glyphZero = this.charStrings.get(0);
18845    this.charStrings.add(glyphZero);
18846    if (this.isCIDFont) {
18847      this.fdSelect.fdSelect.push(this.fdSelect.fdSelect[0]);
18848    }
18849  }
18850  hasGlyphId(id) {
18851    if (id < 0 || id >= this.charStrings.count) {
18852      return false;
18853    }
18854    const glyph = this.charStrings.get(id);
18855    return glyph.length > 0;
18856  }
18857}
18858class CFFHeader {
18859  constructor(major, minor, hdrSize, offSize) {
18860    this.major = major;
18861    this.minor = minor;
18862    this.hdrSize = hdrSize;
18863    this.offSize = offSize;
18864  }
18865}
18866class CFFStrings {
18867  strings = [];
18868  get(index) {
18869    if (index >= 0 && index <= NUM_STANDARD_CFF_STRINGS - 1) {
18870      return CFFStandardStrings[index];
18871    }
18872    if (index - NUM_STANDARD_CFF_STRINGS <= this.strings.length) {
18873      return this.strings[index - NUM_STANDARD_CFF_STRINGS];
18874    }
18875    return CFFStandardStrings[0];
18876  }
18877  getSID(str) {
18878    let index = CFFStandardStrings.indexOf(str);
18879    if (index !== -1) {
18880      return index;
18881    }
18882    index = this.strings.indexOf(str);
18883    if (index !== -1) {
18884      return index + NUM_STANDARD_CFF_STRINGS;
18885    }
18886    return -1;
18887  }
18888  add(value) {
18889    this.strings.push(value);
18890  }
18891  get count() {
18892    return this.strings.length;
18893  }
18894}
18895class CFFIndex {
18896  objects = [];
18897  length = 0;
18898  add(data) {
18899    this.length += data.length;
18900    this.objects.push(data);
18901  }
18902  set(index, data) {
18903    this.length += data.length - this.objects[index].length;
18904    this.objects[index] = data;
18905  }
18906  get(index) {
18907    return this.objects[index];
18908  }
18909  get count() {
18910    return this.objects.length;
18911  }
18912}
18913class CFFDict {
18914  constructor(tables, strings) {
18915    this.keyToNameMap = tables.keyToNameMap;
18916    this.nameToKeyMap = tables.nameToKeyMap;
18917    this.defaults = tables.defaults;
18918    this.types = tables.types;
18919    this.opcodes = tables.opcodes;
18920    this.order = tables.order;
18921    this.strings = strings;
18922    this.values = Object.create(null);
18923  }
18924  setByKey(key, value) {
18925    if (!(key in this.keyToNameMap)) {
18926      return false;
18927    }
18928    if (value.length === 0) {
18929      return true;
18930    }
18931    for (const val of value) {
18932      if (isNaN(val)) {
18933        warn(`Invalid CFFDict value: "${value}" for key "${key}".`);
18934        return true;
18935      }
18936    }
18937    const type = this.types[key];
18938    if (type === "num" || type === "sid" || type === "offset") {
18939      value = value[0];
18940    }
18941    this.values[key] = value;
18942    return true;
18943  }
18944  setByName(name, value) {
18945    if (!(name in this.nameToKeyMap)) {
18946      throw new FormatError(`Invalid dictionary name "${name}"`);
18947    }
18948    this.values[this.nameToKeyMap[name]] = value;
18949  }
18950  hasName(name) {
18951    return this.nameToKeyMap[name] in this.values;
18952  }
18953  getByName(name) {
18954    if (!(name in this.nameToKeyMap)) {
18955      throw new FormatError(`Invalid dictionary name ${name}"`);
18956    }
18957    const key = this.nameToKeyMap[name];
18958    if (!(key in this.values)) {
18959      return this.defaults[key];
18960    }
18961    return this.values[key];
18962  }
18963  removeByName(name) {
18964    delete this.values[this.nameToKeyMap[name]];
18965  }
18966  static createTables(layout) {
18967    const tables = {
18968      keyToNameMap: {},
18969      nameToKeyMap: {},
18970      defaults: {},
18971      types: {},
18972      opcodes: {},
18973      order: []
18974    };
18975    for (const entry of layout) {
18976      const key = Array.isArray(entry[0]) ? (entry[0][0] << 8) + entry[0][1] : entry[0];
18977      tables.keyToNameMap[key] = entry[1];
18978      tables.nameToKeyMap[entry[1]] = key;
18979      tables.types[key] = entry[2];
18980      tables.defaults[key] = entry[3];
18981      tables.opcodes[key] = Array.isArray(entry[0]) ? entry[0] : [entry[0]];
18982      tables.order.push(key);
18983    }
18984    return tables;
18985  }
18986}
18987const CFFTopDictLayout = [[[12, 30], "ROS", ["sid", "sid", "num"], null], [[12, 20], "SyntheticBase", "num", null], [0, "version", "sid", null], [1, "Notice", "sid", null], [[12, 0], "Copyright", "sid", null], [2, "FullName", "sid", null], [3, "FamilyName", "sid", null], [4, "Weight", "sid", null], [[12, 1], "isFixedPitch", "num", 0], [[12, 2], "ItalicAngle", "num", 0], [[12, 3], "UnderlinePosition", "num", -100], [[12, 4], "UnderlineThickness", "num", 50], [[12, 5], "PaintType", "num", 0], [[12, 6], "CharstringType", "num", 2], [[12, 7], "FontMatrix", ["num", "num", "num", "num", "num", "num"], [0.001, 0, 0, 0.001, 0, 0]], [13, "UniqueID", "num", null], [5, "FontBBox", ["num", "num", "num", "num"], [0, 0, 0, 0]], [[12, 8], "StrokeWidth", "num", 0], [14, "XUID", "array", null], [15, "charset", "offset", 0], [16, "Encoding", "offset", 0], [17, "CharStrings", "offset", 0], [18, "Private", ["offset", "offset"], null], [[12, 21], "PostScript", "sid", null], [[12, 22], "BaseFontName", "sid", null], [[12, 23], "BaseFontBlend", "delta", null], [[12, 31], "CIDFontVersion", "num", 0], [[12, 32], "CIDFontRevision", "num", 0], [[12, 33], "CIDFontType", "num", 0], [[12, 34], "CIDCount", "num", 8720], [[12, 35], "UIDBase", "num", null], [[12, 37], "FDSelect", "offset", null], [[12, 36], "FDArray", "offset", null], [[12, 38], "FontName", "sid", null]];
18988class CFFTopDict extends CFFDict {
18989  static get tables() {
18990    return shadow(this, "tables", this.createTables(CFFTopDictLayout));
18991  }
18992  constructor(strings) {
18993    super(CFFTopDict.tables, strings);
18994    this.privateDict = null;
18995  }
18996}
18997const CFFPrivateDictLayout = [[6, "BlueValues", "delta", null], [7, "OtherBlues", "delta", null], [8, "FamilyBlues", "delta", null], [9, "FamilyOtherBlues", "delta", null], [[12, 9], "BlueScale", "num", 0.039625], [[12, 10], "BlueShift", "num", 7], [[12, 11], "BlueFuzz", "num", 1], [10, "StdHW", "num", null], [11, "StdVW", "num", null], [[12, 12], "StemSnapH", "delta", null], [[12, 13], "StemSnapV", "delta", null], [[12, 14], "ForceBold", "num", 0], [[12, 17], "LanguageGroup", "num", 0], [[12, 18], "ExpansionFactor", "num", 0.06], [[12, 19], "initialRandomSeed", "num", 0], [20, "defaultWidthX", "num", 0], [21, "nominalWidthX", "num", 0], [19, "Subrs", "offset", null]];
18998class CFFPrivateDict extends CFFDict {
18999  static get tables() {
19000    return shadow(this, "tables", this.createTables(CFFPrivateDictLayout));
19001  }
19002  constructor(strings) {
19003    super(CFFPrivateDict.tables, strings);
19004    this.subrsIndex = null;
19005  }
19006}
19007const CFFCharsetPredefinedTypes = {
19008  ISO_ADOBE: 0,
19009  EXPERT: 1,
19010  EXPERT_SUBSET: 2
19011};
19012class CFFCharset {
19013  constructor(predefined, format, charset, raw) {
19014    this.predefined = predefined;
19015    this.format = format;
19016    this.charset = charset;
19017    this.raw = raw;
19018  }
19019}
19020class CFFEncoding {
19021  constructor(predefined, format, encoding, raw) {
19022    this.predefined = predefined;
19023    this.format = format;
19024    this.encoding = encoding;
19025    this.raw = raw;
19026  }
19027}
19028class CFFFDSelect {
19029  constructor(format, fdSelect) {
19030    this.format = format;
19031    this.fdSelect = fdSelect;
19032  }
19033  getFDIndex(glyphIndex) {
19034    if (glyphIndex < 0 || glyphIndex >= this.fdSelect.length) {
19035      return -1;
19036    }
19037    return this.fdSelect[glyphIndex];
19038  }
19039}
19040class CFFOffsetTracker {
19041  offsets = Object.create(null);
19042  isTracking(key) {
19043    return key in this.offsets;
19044  }
19045  track(key, location) {
19046    if (key in this.offsets) {
19047      throw new FormatError(`Already tracking location of ${key}`);
19048    }
19049    this.offsets[key] = location;
19050  }
19051  offset(value) {
19052    for (const key in this.offsets) {
19053      this.offsets[key] += value;
19054    }
19055  }
19056  setEntryLocation(key, values, output) {
19057    if (!(key in this.offsets)) {
19058      throw new FormatError(`Not tracking location of ${key}`);
19059    }
19060    const data = output.data;
19061    const dataOffset = this.offsets[key];
19062    const size = 5;
19063    for (let i = 0, ii = values.length; i < ii; ++i) {
19064      const offset0 = i * size + dataOffset;
19065      const offset1 = offset0 + 1;
19066      const offset2 = offset0 + 2;
19067      const offset3 = offset0 + 3;
19068      const offset4 = offset0 + 4;
19069      if (data[offset0] !== 0x1d || data[offset1] !== 0 || data[offset2] !== 0 || data[offset3] !== 0 || data[offset4] !== 0) {
19070        throw new FormatError("writing to an offset that is not empty");
19071      }
19072      const value = values[i];
19073      data[offset0] = 0x1d;
19074      data[offset1] = value >> 24 & 0xff;
19075      data[offset2] = value >> 16 & 0xff;
19076      data[offset3] = value >> 8 & 0xff;
19077      data[offset4] = value & 0xff;
19078    }
19079  }
19080}
19081class CompilerOutput {
19082  #buf;
19083  #bufLength = 1024;
19084  #pos = 0;
19085  constructor(minLength) {
19086    this.#initBuf(minLength);
19087  }
19088  #initBuf(minLength) {
19089    while (this.#bufLength < minLength) {
19090      this.#bufLength *= 2;
19091    }
19092    const newBuf = new Uint8Array(this.#bufLength);
19093    if (this.#buf) {
19094      newBuf.set(this.#buf, 0);
19095    }
19096    this.#buf = newBuf;
19097  }
19098  get data() {
19099    return this.#buf.subarray(0, this.#pos);
19100  }
19101  get finalData() {
19102    const data = this.#buf.slice(0, this.#pos);
19103    this.#buf = null;
19104    return data;
19105  }
19106  get length() {
19107    return this.#pos;
19108  }
19109  add(data) {
19110    const newPos = this.#pos + data.length;
19111    if (newPos > this.#bufLength) {
19112      this.#initBuf(newPos);
19113    }
19114    this.#buf.set(data, this.#pos);
19115    this.#pos = newPos;
19116  }
19117}
19118class CFFCompiler {
19119  constructor(cff) {
19120    this.cff = cff;
19121  }
19122  compile() {
19123    const cff = this.cff;
19124    const output = new CompilerOutput(cff.rawFileLength);
19125    const header = this.compileHeader(cff.header);
19126    output.add(header);
19127    const nameIndex = this.compileNameIndex(cff.names);
19128    output.add(nameIndex);
19129    if (cff.isCIDFont) {
19130      if (cff.topDict.hasName("FontMatrix")) {
19131        const base = cff.topDict.getByName("FontMatrix");
19132        cff.topDict.removeByName("FontMatrix");
19133        for (const subDict of cff.fdArray) {
19134          let matrix = base.slice(0);
19135          if (subDict.hasName("FontMatrix")) {
19136            matrix = Util.transform(matrix, subDict.getByName("FontMatrix"));
19137          }
19138          subDict.setByName("FontMatrix", matrix);
19139        }
19140      }
19141    }
19142    const xuid = cff.topDict.getByName("XUID");
19143    if (xuid?.length > 16) {
19144      cff.topDict.removeByName("XUID");
19145    }
19146    cff.topDict.setByName("charset", 0);
19147    let compiled = this.compileTopDicts([cff.topDict], output.length, cff.isCIDFont);
19148    output.add(compiled.output);
19149    const topDictTracker = compiled.trackers[0];
19150    const stringIndex = this.compileStringIndex(cff.strings.strings);
19151    output.add(stringIndex);
19152    const globalSubrIndex = this.compileIndex(cff.globalSubrIndex);
19153    output.add(globalSubrIndex);
19154    if (cff.encoding && cff.topDict.hasName("Encoding")) {
19155      if (cff.encoding.predefined) {
19156        topDictTracker.setEntryLocation("Encoding", [cff.encoding.format], output);
19157      } else {
19158        const encoding = this.compileEncoding(cff.encoding);
19159        topDictTracker.setEntryLocation("Encoding", [output.length], output);
19160        output.add(encoding);
19161      }
19162    }
19163    const charset = this.compileCharset(cff.charset, cff.charStrings.count, cff.strings, cff.isCIDFont);
19164    topDictTracker.setEntryLocation("charset", [output.length], output);
19165    output.add(charset);
19166    const charStrings = this.compileCharStrings(cff.charStrings);
19167    topDictTracker.setEntryLocation("CharStrings", [output.length], output);
19168    output.add(charStrings);
19169    if (cff.isCIDFont) {
19170      topDictTracker.setEntryLocation("FDSelect", [output.length], output);
19171      const fdSelect = this.compileFDSelect(cff.fdSelect);
19172      output.add(fdSelect);
19173      compiled = this.compileTopDicts(cff.fdArray, output.length, true);
19174      topDictTracker.setEntryLocation("FDArray", [output.length], output);
19175      output.add(compiled.output);
19176      const fontDictTrackers = compiled.trackers;
19177      this.compilePrivateDicts(cff.fdArray, fontDictTrackers, output);
19178    }
19179    this.compilePrivateDicts([cff.topDict], [topDictTracker], output);
19180    output.add([0]);
19181    return output.finalData;
19182  }
19183  encodeNumber(value) {
19184    if (Number.isInteger(value)) {
19185      return this.encodeInteger(value);
19186    }
19187    return this.encodeFloat(value);
19188  }
19189  static get EncodeFloatRegExp() {
19190    return shadow(this, "EncodeFloatRegExp", /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/);
19191  }
19192  encodeFloat(num) {
19193    let value = num.toString();
19194    const m = CFFCompiler.EncodeFloatRegExp.exec(value);
19195    if (m) {
19196      const epsilon = parseFloat("1e" + ((m[2] ? +m[2] : 0) + m[1].length));
19197      value = (Math.round(num * epsilon) / epsilon).toString();
19198    }
19199    let nibbles = "";
19200    let i, ii;
19201    for (i = 0, ii = value.length; i < ii; ++i) {
19202      const a = value[i];
19203      if (a === "e") {
19204        nibbles += value[++i] === "-" ? "c" : "b";
19205      } else if (a === ".") {
19206        nibbles += "a";
19207      } else if (a === "-") {
19208        nibbles += "e";
19209      } else {
19210        nibbles += a;
19211      }
19212    }
19213    nibbles += nibbles.length & 1 ? "f" : "ff";
19214    const out = [30];
19215    for (i = 0, ii = nibbles.length; i < ii; i += 2) {
19216      out.push(parseInt(nibbles.substring(i, i + 2), 16));
19217    }
19218    return out;
19219  }
19220  encodeInteger(value) {
19221    let code;
19222    if (value >= -107 && value <= 107) {
19223      code = [value + 139];
19224    } else if (value >= 108 && value <= 1131) {
19225      value -= 108;
19226      code = [(value >> 8) + 247, value & 0xff];
19227    } else if (value >= -1131 && value <= -108) {
19228      value = -value - 108;
19229      code = [(value >> 8) + 251, value & 0xff];
19230    } else if (value >= -32768 && value <= 32767) {
19231      code = [0x1c, value >> 8 & 0xff, value & 0xff];
19232    } else {
19233      code = [0x1d, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff];
19234    }
19235    return code;
19236  }
19237  compileHeader(header) {
19238    return [header.major, header.minor, 4, header.offSize];
19239  }
19240  compileNameIndex(names) {
19241    const nameIndex = new CFFIndex();
19242    for (const name of names) {
19243      const length = Math.min(name.length, 127);
19244      let sanitizedName = new Array(length);
19245      for (let j = 0; j < length; j++) {
19246        let char = name[j];
19247        if (char < "!" || char > "~" || char === "[" || char === "]" || char === "(" || char === ")" || char === "{" || char === "}" || char === "<" || char === ">" || char === "/" || char === "%") {
19248          char = "_";
19249        }
19250        sanitizedName[j] = char;
19251      }
19252      sanitizedName = sanitizedName.join("");
19253      if (sanitizedName === "") {
19254        sanitizedName = "Bad_Font_Name";
19255      }
19256      nameIndex.add(stringToBytes(sanitizedName));
19257    }
19258    return this.compileIndex(nameIndex);
19259  }
19260  compileTopDicts(dicts, length, removeCidKeys) {
19261    const fontDictTrackers = [];
19262    let fdArrayIndex = new CFFIndex();
19263    for (const fontDict of dicts) {
19264      if (removeCidKeys) {
19265        fontDict.removeByName("CIDFontVersion");
19266        fontDict.removeByName("CIDFontRevision");
19267        fontDict.removeByName("CIDFontType");
19268        fontDict.removeByName("CIDCount");
19269        fontDict.removeByName("UIDBase");
19270      }
19271      const fontDictTracker = new CFFOffsetTracker();
19272      const fontDictData = this.compileDict(fontDict, fontDictTracker);
19273      fontDictTrackers.push(fontDictTracker);
19274      fdArrayIndex.add(fontDictData);
19275      fontDictTracker.offset(length);
19276    }
19277    fdArrayIndex = this.compileIndex(fdArrayIndex, fontDictTrackers);
19278    return {
19279      trackers: fontDictTrackers,
19280      output: fdArrayIndex
19281    };
19282  }
19283  compilePrivateDicts(dicts, trackers, output) {
19284    for (let i = 0, ii = dicts.length; i < ii; ++i) {
19285      const fontDict = dicts[i];
19286      const privateDict = fontDict.privateDict;
19287      if (!privateDict || !fontDict.hasName("Private")) {
19288        throw new FormatError("There must be a private dictionary.");
19289      }
19290      const privateDictTracker = new CFFOffsetTracker();
19291      const privateDictData = this.compileDict(privateDict, privateDictTracker);
19292      let outputLength = output.length;
19293      privateDictTracker.offset(outputLength);
19294      if (!privateDictData.length) {
19295        outputLength = 0;
19296      }
19297      trackers[i].setEntryLocation("Private", [privateDictData.length, outputLength], output);
19298      output.add(privateDictData);
19299      if (privateDict.subrsIndex && privateDict.hasName("Subrs")) {
19300        const subrs = this.compileIndex(privateDict.subrsIndex);
19301        privateDictTracker.setEntryLocation("Subrs", [privateDictData.length], output);
19302        output.add(subrs);
19303      }
19304    }
19305  }
19306  compileDict(dict, offsetTracker) {
19307    const out = [];
19308    for (const key of dict.order) {
19309      if (!(key in dict.values)) {
19310        continue;
19311      }
19312      let values = dict.values[key];
19313      let types = dict.types[key];
19314      if (!Array.isArray(types)) {
19315        types = [types];
19316      }
19317      if (!Array.isArray(values)) {
19318        values = [values];
19319      }
19320      if (values.length === 0) {
19321        continue;
19322      }
19323      for (let j = 0, jj = types.length; j < jj; ++j) {
19324        const type = types[j];
19325        const value = values[j];
19326        switch (type) {
19327          case "num":
19328          case "sid":
19329            out.push(...this.encodeNumber(value));
19330            break;
19331          case "offset":
19332            const name = dict.keyToNameMap[key];
19333            if (!offsetTracker.isTracking(name)) {
19334              offsetTracker.track(name, out.length);
19335            }
19336            out.push(0x1d, 0, 0, 0, 0);
19337            break;
19338          case "array":
19339          case "delta":
19340            out.push(...this.encodeNumber(value));
19341            for (let k = 1, kk = values.length; k < kk; ++k) {
19342              out.push(...this.encodeNumber(values[k]));
19343            }
19344            break;
19345          default:
19346            throw new FormatError(`Unknown data type of ${type}`);
19347        }
19348      }
19349      out.push(...dict.opcodes[key]);
19350    }
19351    return out;
19352  }
19353  compileStringIndex(strings) {
19354    const stringIndex = new CFFIndex();
19355    for (const string of strings) {
19356      stringIndex.add(stringToBytes(string));
19357    }
19358    return this.compileIndex(stringIndex);
19359  }
19360  compileCharStrings(charStrings) {
19361    const charStringsIndex = new CFFIndex();
19362    for (let i = 0; i < charStrings.count; i++) {
19363      const glyph = charStrings.get(i);
19364      if (glyph.length === 0) {
19365        charStringsIndex.add(new Uint8Array([0x8b, 0x0e]));
19366        continue;
19367      }
19368      charStringsIndex.add(glyph);
19369    }
19370    return this.compileIndex(charStringsIndex);
19371  }
19372  compileCharset(charset, numGlyphs, strings, isCIDFont) {
19373    let out;
19374    const numGlyphsLessNotDef = numGlyphs - 1;
19375    if (isCIDFont) {
19376      const nLeft = numGlyphsLessNotDef - 1;
19377      out = new Uint8Array([2, 0, 1, nLeft >> 8 & 0xff, nLeft & 0xff]);
19378    } else {
19379      const length = 1 + numGlyphsLessNotDef * 2;
19380      out = new Uint8Array(length);
19381      let charsetIndex = 0;
19382      const numCharsets = charset.charset.length;
19383      let warned = false;
19384      for (let i = 1; i < out.length; i += 2) {
19385        let sid = 0;
19386        if (charsetIndex < numCharsets) {
19387          const name = charset.charset[charsetIndex++];
19388          sid = strings.getSID(name);
19389          if (sid === -1) {
19390            sid = 0;
19391            if (!warned) {
19392              warned = true;
19393              warn(`Couldn't find ${name} in CFF strings`);
19394            }
19395          }
19396        }
19397        out[i] = sid >> 8 & 0xff;
19398        out[i + 1] = sid & 0xff;
19399      }
19400    }
19401    return out;
19402  }
19403  compileEncoding(encoding) {
19404    return encoding.raw;
19405  }
19406  compileFDSelect(fdSelect) {
19407    const format = fdSelect.format;
19408    let out, i;
19409    switch (format) {
19410      case 0:
19411        out = new Uint8Array(1 + fdSelect.fdSelect.length);
19412        out[0] = format;
19413        for (i = 0; i < fdSelect.fdSelect.length; i++) {
19414          out[i + 1] = fdSelect.fdSelect[i];
19415        }
19416        break;
19417      case 3:
19418        const start = 0;
19419        let lastFD = fdSelect.fdSelect[0];
19420        const ranges = [format, 0, 0, start >> 8 & 0xff, start & 0xff, lastFD];
19421        for (i = 1; i < fdSelect.fdSelect.length; i++) {
19422          const currentFD = fdSelect.fdSelect[i];
19423          if (currentFD !== lastFD) {
19424            ranges.push(i >> 8 & 0xff, i & 0xff, currentFD);
19425            lastFD = currentFD;
19426          }
19427        }
19428        const numRanges = (ranges.length - 3) / 3;
19429        ranges[1] = numRanges >> 8 & 0xff;
19430        ranges[2] = numRanges & 0xff;
19431        ranges.push(i >> 8 & 0xff, i & 0xff);
19432        out = new Uint8Array(ranges);
19433        break;
19434    }
19435    return out;
19436  }
19437  compileIndex(index, trackers = []) {
19438    const objects = index.objects;
19439    const count = objects.length;
19440    if (count === 0) {
19441      return new Uint8Array(2);
19442    }
19443    let lastOffset = 1,
19444      i;
19445    for (i = 0; i < count; ++i) {
19446      lastOffset += objects[i].length;
19447    }
19448    let offsetSize;
19449    if (lastOffset < 0x100) {
19450      offsetSize = 1;
19451    } else if (lastOffset < 0x10000) {
19452      offsetSize = 2;
19453    } else if (lastOffset < 0x1000000) {
19454      offsetSize = 3;
19455    } else {
19456      offsetSize = 4;
19457    }
19458    const data = new Uint8Array(2 + offsetSize * (count + 1) + lastOffset);
19459    let pos = 0;
19460    data[pos++] = count >> 8 & 0xff;
19461    data[pos++] = count & 0xff;
19462    data[pos++] = offsetSize;
19463    let relativeOffset = 1;
19464    for (i = 0; i < count + 1; i++) {
19465      if (offsetSize === 1) {
19466        data[pos++] = relativeOffset & 0xff;
19467      } else if (offsetSize === 2) {
19468        data[pos++] = relativeOffset >> 8 & 0xff;
19469        data[pos++] = relativeOffset & 0xff;
19470      } else if (offsetSize === 3) {
19471        data[pos++] = relativeOffset >> 16 & 0xff;
19472        data[pos++] = relativeOffset >> 8 & 0xff;
19473        data[pos++] = relativeOffset & 0xff;
19474      } else {
19475        data[pos++] = relativeOffset >>> 24 & 0xff;
19476        data[pos++] = relativeOffset >> 16 & 0xff;
19477        data[pos++] = relativeOffset >> 8 & 0xff;
19478        data[pos++] = relativeOffset & 0xff;
19479      }
19480      if (objects[i]) {
19481        relativeOffset += objects[i].length;
19482      }
19483    }
19484    for (i = 0; i < count; i++) {
19485      trackers[i]?.offset(pos);
19486      data.set(objects[i], pos);
19487      pos += objects[i].length;
19488    }
19489    return data;
19490  }
19491}
19492
19493;// ./src/core/standard_fonts.js
vendor: 4,846 bytes, lines 19493-19603
19493
19494
19495
19496const getStdFontMap = getLookupTableFactory(function (t) {
19497  t["Times-Roman"] = "Times-Roman";
19498  t.Helvetica = "Helvetica";
19499  t.Courier = "Courier";
19500  t.Symbol = "Symbol";
19501  t["Times-Bold"] = "Times-Bold";
19502  t["Helvetica-Bold"] = "Helvetica-Bold";
19503  t["Courier-Bold"] = "Courier-Bold";
19504  t.ZapfDingbats = "ZapfDingbats";
19505  t["Times-Italic"] = "Times-Italic";
19506  t["Helvetica-Oblique"] = "Helvetica-Oblique";
19507  t["Courier-Oblique"] = "Courier-Oblique";
19508  t["Times-BoldItalic"] = "Times-BoldItalic";
19509  t["Helvetica-BoldOblique"] = "Helvetica-BoldOblique";
19510  t["Courier-BoldOblique"] = "Courier-BoldOblique";
19511  t.ArialNarrow = "Helvetica";
19512  t["ArialNarrow-Bold"] = "Helvetica-Bold";
19513  t["ArialNarrow-BoldItalic"] = "Helvetica-BoldOblique";
19514  t["ArialNarrow-Italic"] = "Helvetica-Oblique";
19515  t.ArialBlack = "Helvetica";
19516  t["ArialBlack-Bold"] = "Helvetica-Bold";
19517  t["ArialBlack-BoldItalic"] = "Helvetica-BoldOblique";
19518  t["ArialBlack-Italic"] = "Helvetica-Oblique";
19519  t["Arial-Black"] = "Helvetica";
19520  t["Arial-Black-Bold"] = "Helvetica-Bold";
19521  t["Arial-Black-BoldItalic"] = "Helvetica-BoldOblique";
19522  t["Arial-Black-Italic"] = "Helvetica-Oblique";
19523  t.Arial = "Helvetica";
19524  t["Arial-Bold"] = "Helvetica-Bold";
19525  t["Arial-BoldItalic"] = "Helvetica-BoldOblique";
19526  t["Arial-Italic"] = "Helvetica-Oblique";
19527  t.ArialMT = "Helvetica";
19528  t["Arial-BoldItalicMT"] = "Helvetica-BoldOblique";
19529  t["Arial-BoldMT"] = "Helvetica-Bold";
19530  t["Arial-ItalicMT"] = "Helvetica-Oblique";
19531  t["Arial-BoldItalicMT-BoldItalic"] = "Helvetica-BoldOblique";
19532  t["Arial-BoldMT-Bold"] = "Helvetica-Bold";
19533  t["Arial-ItalicMT-Italic"] = "Helvetica-Oblique";
19534  t.ArialUnicodeMS = "Helvetica";
19535  t["ArialUnicodeMS-Bold"] = "Helvetica-Bold";
19536  t["ArialUnicodeMS-BoldItalic"] = "Helvetica-BoldOblique";
19537  t["ArialUnicodeMS-Italic"] = "Helvetica-Oblique";
19538  t["Courier-BoldItalic"] = "Courier-BoldOblique";
19539  t["Courier-Italic"] = "Courier-Oblique";
19540  t.CourierNew = "Courier";
19541  t["CourierNew-Bold"] = "Courier-Bold";
19542  t["CourierNew-BoldItalic"] = "Courier-BoldOblique";
19543  t["CourierNew-Italic"] = "Courier-Oblique";
19544  t["CourierNewPS-BoldItalicMT"] = "Courier-BoldOblique";
19545  t["CourierNewPS-BoldMT"] = "Courier-Bold";
19546  t["CourierNewPS-ItalicMT"] = "Courier-Oblique";
19547  t.CourierNewPSMT = "Courier";
19548  t["Helvetica-BoldItalic"] = "Helvetica-BoldOblique";
19549  t["Helvetica-Italic"] = "Helvetica-Oblique";
19550  t["HelveticaLTStd-Bold"] = "Helvetica-Bold";
19551  t["Symbol-Bold"] = "Symbol";
19552  t["Symbol-BoldItalic"] = "Symbol";
19553  t["Symbol-Italic"] = "Symbol";
19554  t.TimesNewRoman = "Times-Roman";
19555  t["TimesNewRoman-Bold"] = "Times-Bold";
19556  t["TimesNewRoman-BoldItalic"] = "Times-BoldItalic";
19557  t["TimesNewRoman-Italic"] = "Times-Italic";
19558  t.TimesNewRomanPS = "Times-Roman";
19559  t["TimesNewRomanPS-Bold"] = "Times-Bold";
19560  t["TimesNewRomanPS-BoldItalic"] = "Times-BoldItalic";
19561  t["TimesNewRomanPS-BoldItalicMT"] = "Times-BoldItalic";
19562  t["TimesNewRomanPS-BoldMT"] = "Times-Bold";
19563  t["TimesNewRomanPS-Italic"] = "Times-Italic";
19564  t["TimesNewRomanPS-ItalicMT"] = "Times-Italic";
19565  t.TimesNewRomanPSMT = "Times-Roman";
19566  t["TimesNewRomanPSMT-Bold"] = "Times-Bold";
19567  t["TimesNewRomanPSMT-BoldItalic"] = "Times-BoldItalic";
19568  t["TimesNewRomanPSMT-Italic"] = "Times-Italic";
19569});
19570const getFontNameToFileMap = getLookupTableFactory(function (t) {
19571  t.Courier = "FoxitFixed.pfb";
19572  t["Courier-Bold"] = "FoxitFixedBold.pfb";
19573  t["Courier-BoldOblique"] = "FoxitFixedBoldItalic.pfb";
19574  t["Courier-Oblique"] = "FoxitFixedItalic.pfb";
19575  t.Helvetica = "LiberationSans-Regular.ttf";
19576  t["Helvetica-Bold"] = "LiberationSans-Bold.ttf";
19577  t["Helvetica-BoldOblique"] = "LiberationSans-BoldItalic.ttf";
19578  t["Helvetica-Oblique"] = "LiberationSans-Italic.ttf";
19579  t["Times-Roman"] = "FoxitSerif.pfb";
19580  t["Times-Bold"] = "FoxitSerifBold.pfb";
19581  t["Times-BoldItalic"] = "FoxitSerifBoldItalic.pfb";
19582  t["Times-Italic"] = "FoxitSerifItalic.pfb";
19583  t.Symbol = "FoxitSymbol.pfb";
19584  t.ZapfDingbats = "FoxitDingbats.pfb";
19585  t["LiberationSans-Regular"] = "LiberationSans-Regular.ttf";
19586  t["LiberationSans-Bold"] = "LiberationSans-Bold.ttf";
19587  t["LiberationSans-Italic"] = "LiberationSans-Italic.ttf";
19588  t["LiberationSans-BoldItalic"] = "LiberationSans-BoldItalic.ttf";
19589});
19590const getNonStdFontMap = getLookupTableFactory(function (t) {
19591  t.Calibri = "Helvetica";
19592  t["Calibri-Bold"] = "Helvetica-Bold";
19593  t["Calibri-BoldItalic"] = "Helvetica-BoldOblique";
19594  t["Calibri-Italic"] = "Helvetica-Oblique";
19595  t.CenturyGothic = "Helvetica";
19596  t["CenturyGothic-Bold"] = "Helvetica-Bold";
19597  t["CenturyGothic-BoldItalic"] = "Helvetica-BoldOblique";
19598  t["CenturyGothic-Italic"] = "Helvetica-Oblique";
19599  t.ComicSansMS = "Comic Sans MS";
19600  t["ComicSansMS-Bold"] = "Comic Sans MS-Bold";
19601  t["ComicSansMS-BoldItalic"] = "Comic Sans MS-BoldItalic";
19602  t["ComicSansMS-Italic"] = "Comic Sans MS-Italic";
19603  t.GillSansMT = "Helvetica";
vendor: 8,875 bytes, lines 19604-20034
19604  t["GillSansMT-Bold"] = "Helvetica-Bold";
19605  t["GillSansMT-BoldItalic"] = "Helvetica-BoldOblique";
19606  t["GillSansMT-Italic"] = "Helvetica-Oblique";
19607  t.Impact = "Helvetica";
19608  t["ItcSymbol-Bold"] = "Helvetica-Bold";
19609  t["ItcSymbol-BoldItalic"] = "Helvetica-BoldOblique";
19610  t["ItcSymbol-Book"] = "Helvetica";
19611  t["ItcSymbol-BookItalic"] = "Helvetica-Oblique";
19612  t["ItcSymbol-Medium"] = "Helvetica";
19613  t["ItcSymbol-MediumItalic"] = "Helvetica-Oblique";
19614  t.LucidaConsole = "Courier";
19615  t["LucidaConsole-Bold"] = "Courier-Bold";
19616  t["LucidaConsole-BoldItalic"] = "Courier-BoldOblique";
19617  t["LucidaConsole-Italic"] = "Courier-Oblique";
19618  t["LucidaSans-Demi"] = "Helvetica-Bold";
19619  t["MS-Gothic"] = "MS Gothic";
19620  t["MS-Gothic-Bold"] = "MS Gothic-Bold";
19621  t["MS-Gothic-BoldItalic"] = "MS Gothic-BoldItalic";
19622  t["MS-Gothic-Italic"] = "MS Gothic-Italic";
19623  t["MS-Mincho"] = "MS Mincho";
19624  t["MS-Mincho-Bold"] = "MS Mincho-Bold";
19625  t["MS-Mincho-BoldItalic"] = "MS Mincho-BoldItalic";
19626  t["MS-Mincho-Italic"] = "MS Mincho-Italic";
19627  t["MS-PGothic"] = "MS PGothic";
19628  t["MS-PGothic-Bold"] = "MS PGothic-Bold";
19629  t["MS-PGothic-BoldItalic"] = "MS PGothic-BoldItalic";
19630  t["MS-PGothic-Italic"] = "MS PGothic-Italic";
19631  t["MS-PMincho"] = "MS PMincho";
19632  t["MS-PMincho-Bold"] = "MS PMincho-Bold";
19633  t["MS-PMincho-BoldItalic"] = "MS PMincho-BoldItalic";
19634  t["MS-PMincho-Italic"] = "MS PMincho-Italic";
19635  t.NuptialScript = "Times-Italic";
19636  t.SegoeUISymbol = "Helvetica";
19637});
19638const getSerifFonts = getLookupTableFactory(function (t) {
19639  t["Adobe Jenson"] = true;
19640  t["Adobe Text"] = true;
19641  t.Albertus = true;
19642  t.Aldus = true;
19643  t.Alexandria = true;
19644  t.Algerian = true;
19645  t["American Typewriter"] = true;
19646  t.Antiqua = true;
19647  t.Apex = true;
19648  t.Arno = true;
19649  t.Aster = true;
19650  t.Aurora = true;
19651  t.Baskerville = true;
19652  t.Bell = true;
19653  t.Bembo = true;
19654  t["Bembo Schoolbook"] = true;
19655  t.Benguiat = true;
19656  t["Berkeley Old Style"] = true;
19657  t["Bernhard Modern"] = true;
19658  t["Berthold City"] = true;
19659  t.Bodoni = true;
19660  t["Bauer Bodoni"] = true;
19661  t["Book Antiqua"] = true;
19662  t.Bookman = true;
19663  t["Bordeaux Roman"] = true;
19664  t["Californian FB"] = true;
19665  t.Calisto = true;
19666  t.Calvert = true;
19667  t.Capitals = true;
19668  t.Cambria = true;
19669  t.Cartier = true;
19670  t.Caslon = true;
19671  t.Catull = true;
19672  t.Centaur = true;
19673  t["Century Old Style"] = true;
19674  t["Century Schoolbook"] = true;
19675  t.Chaparral = true;
19676  t["Charis SIL"] = true;
19677  t.Cheltenham = true;
19678  t["Cholla Slab"] = true;
19679  t.Clarendon = true;
19680  t.Clearface = true;
19681  t.Cochin = true;
19682  t.Colonna = true;
19683  t["Computer Modern"] = true;
19684  t["Concrete Roman"] = true;
19685  t.Constantia = true;
19686  t["Cooper Black"] = true;
19687  t.Corona = true;
19688  t.Ecotype = true;
19689  t.Egyptienne = true;
19690  t.Elephant = true;
19691  t.Excelsior = true;
19692  t.Fairfield = true;
19693  t["FF Scala"] = true;
19694  t.Folkard = true;
19695  t.Footlight = true;
19696  t.FreeSerif = true;
19697  t["Friz Quadrata"] = true;
19698  t.Garamond = true;
19699  t.Gentium = true;
19700  t.Georgia = true;
19701  t.Gloucester = true;
19702  t["Goudy Old Style"] = true;
19703  t["Goudy Schoolbook"] = true;
19704  t["Goudy Pro Font"] = true;
19705  t.Granjon = true;
19706  t["Guardian Egyptian"] = true;
19707  t.Heather = true;
19708  t.Hercules = true;
19709  t["High Tower Text"] = true;
19710  t.Hiroshige = true;
19711  t["Hoefler Text"] = true;
19712  t["Humana Serif"] = true;
19713  t.Imprint = true;
19714  t["Ionic No. 5"] = true;
19715  t.Janson = true;
19716  t.Joanna = true;
19717  t.Korinna = true;
19718  t.Lexicon = true;
19719  t.LiberationSerif = true;
19720  t["Liberation Serif"] = true;
19721  t["Linux Libertine"] = true;
19722  t.Literaturnaya = true;
19723  t.Lucida = true;
19724  t["Lucida Bright"] = true;
19725  t.Melior = true;
19726  t.Memphis = true;
19727  t.Miller = true;
19728  t.Minion = true;
19729  t.Modern = true;
19730  t["Mona Lisa"] = true;
19731  t["Mrs Eaves"] = true;
19732  t["MS Serif"] = true;
19733  t["Museo Slab"] = true;
19734  t["New York"] = true;
19735  t["Nimbus Roman"] = true;
19736  t["NPS Rawlinson Roadway"] = true;
19737  t.NuptialScript = true;
19738  t.Palatino = true;
19739  t.Perpetua = true;
19740  t.Plantin = true;
19741  t["Plantin Schoolbook"] = true;
19742  t.Playbill = true;
19743  t["Poor Richard"] = true;
19744  t["Rawlinson Roadway"] = true;
19745  t.Renault = true;
19746  t.Requiem = true;
19747  t.Rockwell = true;
19748  t.Roman = true;
19749  t["Rotis Serif"] = true;
19750  t.Sabon = true;
19751  t.Scala = true;
19752  t.Seagull = true;
19753  t.Sistina = true;
19754  t.Souvenir = true;
19755  t.STIX = true;
19756  t["Stone Informal"] = true;
19757  t["Stone Serif"] = true;
19758  t.Sylfaen = true;
19759  t.Times = true;
19760  t.Trajan = true;
19761  t["Trinité"] = true;
19762  t["Trump Mediaeval"] = true;
19763  t.Utopia = true;
19764  t["Vale Type"] = true;
19765  t["Bitstream Vera"] = true;
19766  t["Vera Serif"] = true;
19767  t.Versailles = true;
19768  t.Wanted = true;
19769  t.Weiss = true;
19770  t["Wide Latin"] = true;
19771  t.Windsor = true;
19772  t.XITS = true;
19773});
19774const getSymbolsFonts = getLookupTableFactory(function (t) {
19775  t.Dingbats = true;
19776  t.Symbol = true;
19777  t.ZapfDingbats = true;
19778  t.Wingdings = true;
19779  t["Wingdings-Bold"] = true;
19780  t["Wingdings-Regular"] = true;
19781});
19782const getGlyphMapForStandardFonts = getLookupTableFactory(function (t) {
19783  t[2] = 10;
19784  t[3] = 32;
19785  t[4] = 33;
19786  t[5] = 34;
19787  t[6] = 35;
19788  t[7] = 36;
19789  t[8] = 37;
19790  t[9] = 38;
19791  t[10] = 39;
19792  t[11] = 40;
19793  t[12] = 41;
19794  t[13] = 42;
19795  t[14] = 43;
19796  t[15] = 44;
19797  t[16] = 45;
19798  t[17] = 46;
19799  t[18] = 47;
19800  t[19] = 48;
19801  t[20] = 49;
19802  t[21] = 50;
19803  t[22] = 51;
19804  t[23] = 52;
19805  t[24] = 53;
19806  t[25] = 54;
19807  t[26] = 55;
19808  t[27] = 56;
19809  t[28] = 57;
19810  t[29] = 58;
19811  t[30] = 894;
19812  t[31] = 60;
19813  t[32] = 61;
19814  t[33] = 62;
19815  t[34] = 63;
19816  t[35] = 64;
19817  t[36] = 65;
19818  t[37] = 66;
19819  t[38] = 67;
19820  t[39] = 68;
19821  t[40] = 69;
19822  t[41] = 70;
19823  t[42] = 71;
19824  t[43] = 72;
19825  t[44] = 73;
19826  t[45] = 74;
19827  t[46] = 75;
19828  t[47] = 76;
19829  t[48] = 77;
19830  t[49] = 78;
19831  t[50] = 79;
19832  t[51] = 80;
19833  t[52] = 81;
19834  t[53] = 82;
19835  t[54] = 83;
19836  t[55] = 84;
19837  t[56] = 85;
19838  t[57] = 86;
19839  t[58] = 87;
19840  t[59] = 88;
19841  t[60] = 89;
19842  t[61] = 90;
19843  t[62] = 91;
19844  t[63] = 92;
19845  t[64] = 93;
19846  t[65] = 94;
19847  t[66] = 95;
19848  t[67] = 96;
19849  t[68] = 97;
19850  t[69] = 98;
19851  t[70] = 99;
19852  t[71] = 100;
19853  t[72] = 101;
19854  t[73] = 102;
19855  t[74] = 103;
19856  t[75] = 104;
19857  t[76] = 105;
19858  t[77] = 106;
19859  t[78] = 107;
19860  t[79] = 108;
19861  t[80] = 109;
19862  t[81] = 110;
19863  t[82] = 111;
19864  t[83] = 112;
19865  t[84] = 113;
19866  t[85] = 114;
19867  t[86] = 115;
19868  t[87] = 116;
19869  t[88] = 117;
19870  t[89] = 118;
19871  t[90] = 119;
19872  t[91] = 120;
19873  t[92] = 121;
19874  t[93] = 122;
19875  t[94] = 123;
19876  t[95] = 124;
19877  t[96] = 125;
19878  t[97] = 126;
19879  t[98] = 196;
19880  t[99] = 197;
19881  t[100] = 199;
19882  t[101] = 201;
19883  t[102] = 209;
19884  t[103] = 214;
19885  t[104] = 220;
19886  t[105] = 225;
19887  t[106] = 224;
19888  t[107] = 226;
19889  t[108] = 228;
19890  t[109] = 227;
19891  t[110] = 229;
19892  t[111] = 231;
19893  t[112] = 233;
19894  t[113] = 232;
19895  t[114] = 234;
19896  t[115] = 235;
19897  t[116] = 237;
19898  t[117] = 236;
19899  t[118] = 238;
19900  t[119] = 239;
19901  t[120] = 241;
19902  t[121] = 243;
19903  t[122] = 242;
19904  t[123] = 244;
19905  t[124] = 246;
19906  t[125] = 245;
19907  t[126] = 250;
19908  t[127] = 249;
19909  t[128] = 251;
19910  t[129] = 252;
19911  t[130] = 8224;
19912  t[131] = 176;
19913  t[132] = 162;
19914  t[133] = 163;
19915  t[134] = 167;
19916  t[135] = 8226;
19917  t[136] = 182;
19918  t[137] = 223;
19919  t[138] = 174;
19920  t[139] = 169;
19921  t[140] = 8482;
19922  t[141] = 180;
19923  t[142] = 168;
19924  t[143] = 8800;
19925  t[144] = 198;
19926  t[145] = 216;
19927  t[146] = 8734;
19928  t[147] = 177;
19929  t[148] = 8804;
19930  t[149] = 8805;
19931  t[150] = 165;
19932  t[151] = 181;
19933  t[152] = 8706;
19934  t[153] = 8721;
19935  t[154] = 8719;
19936  t[156] = 8747;
19937  t[157] = 170;
19938  t[158] = 186;
19939  t[159] = 8486;
19940  t[160] = 230;
19941  t[161] = 248;
19942  t[162] = 191;
19943  t[163] = 161;
19944  t[164] = 172;
19945  t[165] = 8730;
19946  t[166] = 402;
19947  t[167] = 8776;
19948  t[168] = 8710;
19949  t[169] = 171;
19950  t[170] = 187;
19951  t[171] = 8230;
19952  t[179] = 8220;
19953  t[180] = 8221;
19954  t[181] = 8216;
19955  t[182] = 8217;
19956  t[200] = 193;
19957  t[203] = 205;
19958  t[207] = 211;
19959  t[210] = 218;
19960  t[223] = 711;
19961  t[224] = 321;
19962  t[225] = 322;
19963  t[226] = 352;
19964  t[227] = 353;
19965  t[228] = 381;
19966  t[229] = 382;
19967  t[233] = 221;
19968  t[234] = 253;
19969  t[252] = 263;
19970  t[253] = 268;
19971  t[254] = 269;
19972  t[258] = 258;
19973  t[260] = 260;
19974  t[261] = 261;
19975  t[265] = 280;
19976  t[266] = 281;
19977  t[267] = 282;
19978  t[268] = 283;
19979  t[269] = 313;
19980  t[275] = 323;
19981  t[276] = 324;
19982  t[278] = 328;
19983  t[283] = 344;
19984  t[284] = 345;
19985  t[285] = 346;
19986  t[286] = 347;
19987  t[292] = 367;
19988  t[295] = 377;
19989  t[296] = 378;
19990  t[298] = 380;
19991  t[305] = 963;
19992  t[306] = 964;
19993  t[307] = 966;
19994  t[308] = 8215;
19995  t[309] = 8252;
19996  t[310] = 8319;
19997  t[311] = 8359;
19998  t[312] = 8592;
19999  t[313] = 8593;
20000  t[337] = 9552;
20001  t[493] = 1039;
20002  t[494] = 1040;
20003  t[570] = 1040;
20004  t[571] = 1041;
20005  t[572] = 1042;
20006  t[573] = 1043;
20007  t[574] = 1044;
20008  t[575] = 1045;
20009  t[576] = 1046;
20010  t[577] = 1047;
20011  t[578] = 1048;
20012  t[579] = 1049;
20013  t[580] = 1050;
20014  t[581] = 1051;
20015  t[582] = 1052;
20016  t[583] = 1053;
20017  t[584] = 1054;
20018  t[585] = 1055;
20019  t[586] = 1056;
20020  t[587] = 1057;
20021  t[588] = 1058;
20022  t[589] = 1059;
20023  t[590] = 1060;
20024  t[591] = 1061;
20025  t[592] = 1062;
20026  t[593] = 1063;
20027  t[594] = 1064;
20028  t[595] = 1065;
20029  t[596] = 1066;
20030  t[597] = 1067;
20031  t[598] = 1068;
20032  t[599] = 1069;
20033  t[600] = 1070;
20034  t[6
2003401] = 1071;
20035  t[602] = 1072;
20036  t[603] = 1073;
20037  t[604] = 1074;
20038  t[605] = 1075;
20039  t[606] = 1076;
20040  t[607] = 1077;
20041  t[608] = 1078;
20042  t[609] = 1079;
20043  t[610] = 1080;
20044  t[611] = 1081;
20045  t[612] = 1082;
20046  t[613] = 1083;
20047  t[614] = 1084;
20048  t[615] = 1085;
20049  t[616] = 1086;
20050  t[617] = 1087;
20051  t[618] = 1088;
20052  t[619] = 1089;
20053  t[620] = 1090;
20054  t[621] = 1091;
20055  t[622] = 1092;
20056  t[623] = 1093;
20057  t[624] = 1094;
20058  t[625] = 1095;
20059  t[626] = 1096;
20060  t[627] = 1097;
20061  t[628] = 1098;
20062  t[629] = 1099;
20063  t[630] = 1100;
20064  t[631] = 1101;
20065  t[632] = 1102;
20066  t[633] = 1103
vendor: 10,392 bytes, lines 20066-20590
20066;
20067  t[672] = 1488;
20068  t[673] = 1489;
20069  t[674] = 1490;
20070  t[675] = 1491;
20071  t[676] = 1492;
20072  t[677] = 1493;
20073  t[678] = 1494;
20074  t[679] = 1495;
20075  t[680] = 1496;
20076  t[681] = 1497;
20077  t[682] = 1498;
20078  t[683] = 1499;
20079  t[684] = 1500;
20080  t[685] = 1501;
20081  t[686] = 1502;
20082  t[687] = 1503;
20083  t[688] = 1504;
20084  t[689] = 1505;
20085  t[690] = 1506;
20086  t[691] = 1507;
20087  t[692] = 1508;
20088  t[693] = 1509;
20089  t[694] = 1510;
20090  t[695] = 1511;
20091  t[696] = 1512;
20092  t[697] = 1513;
20093  t[698] = 1514;
20094  t[705] = 1524;
20095  t[706] = 8362;
20096  t[710] = 64288;
20097  t[711] = 64298;
20098  t[759] = 1617;
20099  t[761] = 1776;
20100  t[763] = 1778;
20101  t[775] = 1652;
20102  t[777] = 1764;
20103  t[778] = 1780;
20104  t[779] = 1781;
20105  t[780] = 1782;
20106  t[782] = 771;
20107  t[783] = 64726;
20108  t[786] = 8363;
20109  t[788] = 8532;
20110  t[790] = 768;
20111  t[791] = 769;
20112  t[792] = 768;
20113  t[795] = 803;
20114  t[797] = 64336;
20115  t[798] = 64337;
20116  t[799] = 64342;
20117  t[800] = 64343;
20118  t[801] = 64344;
20119  t[802] = 64345;
20120  t[803] = 64362;
20121  t[804] = 64363;
20122  t[805] = 64364;
20123  t[2424] = 7821;
20124  t[2425] = 7822;
20125  t[2426] = 7823;
20126  t[2427] = 7824;
20127  t[2428] = 7825;
20128  t[2429] = 7826;
20129  t[2430] = 7827;
20130  t[2433] = 7682;
20131  t[2678] = 8045;
20132  t[2679] = 8046;
20133  t[2830] = 1552;
20134  t[2838] = 686;
20135  t[2840] = 751;
20136  t[2842] = 753;
20137  t[2843] = 754;
20138  t[2844] = 755;
20139  t[2846] = 757;
20140  t[2856] = 767;
20141  t[2857] = 848;
20142  t[2858] = 849;
20143  t[2862] = 853;
20144  t[2863] = 854;
20145  t[2864] = 855;
20146  t[2865] = 861;
20147  t[2866] = 862;
20148  t[2906] = 7460;
20149  t[2908] = 7462;
20150  t[2909] = 7463;
20151  t[2910] = 7464;
20152  t[2912] = 7466;
20153  t[2913] = 7467;
20154  t[2914] = 7468;
20155  t[2916] = 7470;
20156  t[2917] = 7471;
20157  t[2918] = 7472;
20158  t[2920] = 7474;
20159  t[2921] = 7475;
20160  t[2922] = 7476;
20161  t[2924] = 7478;
20162  t[2925] = 7479;
20163  t[2926] = 7480;
20164  t[2928] = 7482;
20165  t[2929] = 7483;
20166  t[2930] = 7484;
20167  t[2932] = 7486;
20168  t[2933] = 7487;
20169  t[2934] = 7488;
20170  t[2936] = 7490;
20171  t[2937] = 7491;
20172  t[2938] = 7492;
20173  t[2940] = 7494;
20174  t[2941] = 7495;
20175  t[2942] = 7496;
20176  t[2944] = 7498;
20177  t[2946] = 7500;
20178  t[2948] = 7502;
20179  t[2950] = 7504;
20180  t[2951] = 7505;
20181  t[2952] = 7506;
20182  t[2954] = 7508;
20183  t[2955] = 7509;
20184  t[2956] = 7510;
20185  t[2958] = 7512;
20186  t[2959] = 7513;
20187  t[2960] = 7514;
20188  t[2962] = 7516;
20189  t[2963] = 7517;
20190  t[2964] = 7518;
20191  t[2966] = 7520;
20192  t[2967] = 7521;
20193  t[2968] = 7522;
20194  t[2970] = 7524;
20195  t[2971] = 7525;
20196  t[2972] = 7526;
20197  t[2974] = 7528;
20198  t[2975] = 7529;
20199  t[2976] = 7530;
20200  t[2978] = 1537;
20201  t[2979] = 1538;
20202  t[2980] = 1539;
20203  t[2982] = 1549;
20204  t[2983] = 1551;
20205  t[2984] = 1552;
20206  t[2986] = 1554;
20207  t[2987] = 1555;
20208  t[2988] = 1556;
20209  t[2990] = 1623;
20210  t[2991] = 1624;
20211  t[2995] = 1775;
20212  t[2999] = 1791;
20213  t[3002] = 64290;
20214  t[3003] = 64291;
20215  t[3004] = 64292;
20216  t[3006] = 64294;
20217  t[3007] = 64295;
20218  t[3008] = 64296;
20219  t[3011] = 1900;
20220  t[3014] = 8223;
20221  t[3015] = 8244;
20222  t[3017] = 7532;
20223  t[3018] = 7533;
20224  t[3019] = 7534;
20225  t[3075] = 7590;
20226  t[3076] = 7591;
20227  t[3079] = 7594;
20228  t[3080] = 7595;
20229  t[3083] = 7598;
20230  t[3084] = 7599;
20231  t[3087] = 7602;
20232  t[3088] = 7603;
20233  t[3091] = 7606;
20234  t[3092] = 7607;
20235  t[3095] = 7610;
20236  t[3096] = 7611;
20237  t[3099] = 7614;
20238  t[3100] = 7615;
20239  t[3103] = 7618;
20240  t[3104] = 7619;
20241  t[3107] = 8337;
20242  t[3108] = 8338;
20243  t[3116] = 1884;
20244  t[3119] = 1885;
20245  t[3120] = 1885;
20246  t[3123] = 1886;
20247  t[3124] = 1886;
20248  t[3127] = 1887;
20249  t[3128] = 1887;
20250  t[3131] = 1888;
20251  t[3132] = 1888;
20252  t[3135] = 1889;
20253  t[3136] = 1889;
20254  t[3139] = 1890;
20255  t[3140] = 1890;
20256  t[3143] = 1891;
20257  t[3144] = 1891;
20258  t[3147] = 1892;
20259  t[3148] = 1892;
20260  t[3153] = 580;
20261  t[3154] = 581;
20262  t[3157] = 584;
20263  t[3158] = 585;
20264  t[3161] = 588;
20265  t[3162] = 589;
20266  t[3165] = 891;
20267  t[3166] = 892;
20268  t[3169] = 1274;
20269  t[3170] = 1275;
20270  t[3173] = 1278;
20271  t[3174] = 1279;
20272  t[3181] = 7622;
20273  t[3182] = 7623;
20274  t[3282] = 11799;
20275  t[3316] = 578;
20276  t[3379] = 42785;
20277  t[3393] = 1159;
20278  t[3416] = 8377;
20279});
20280const getSupplementalGlyphMapForArialBlack = getLookupTableFactory(function (t) {
20281  t[227] = 322;
20282  t[264] = 261;
20283  t[291] = 346;
20284});
20285const getSupplementalGlyphMapForCalibri = getLookupTableFactory(function (t) {
20286  t[1] = 32;
20287  t[4] = 65;
20288  t[5] = 192;
20289  t[6] = 193;
20290  t[9] = 196;
20291  t[17] = 66;
20292  t[18] = 67;
20293  t[21] = 268;
20294  t[24] = 68;
20295  t[28] = 69;
20296  t[29] = 200;
20297  t[30] = 201;
20298  t[32] = 282;
20299  t[38] = 70;
20300  t[39] = 71;
20301  t[44] = 72;
20302  t[47] = 73;
20303  t[48] = 204;
20304  t[49] = 205;
20305  t[58] = 74;
20306  t[60] = 75;
20307  t[62] = 76;
20308  t[68] = 77;
20309  t[69] = 78;
20310  t[75] = 79;
20311  t[76] = 210;
20312  t[80] = 214;
20313  t[87] = 80;
20314  t[89] = 81;
20315  t[90] = 82;
20316  t[92] = 344;
20317  t[94] = 83;
20318  t[97] = 352;
20319  t[100] = 84;
20320  t[104] = 85;
20321  t[109] = 220;
20322  t[115] = 86;
20323  t[116] = 87;
20324  t[121] = 88;
20325  t[122] = 89;
20326  t[124] = 221;
20327  t[127] = 90;
20328  t[129] = 381;
20329  t[258] = 97;
20330  t[259] = 224;
20331  t[260] = 225;
20332  t[263] = 228;
20333  t[268] = 261;
20334  t[271] = 98;
20335  t[272] = 99;
20336  t[273] = 263;
20337  t[275] = 269;
20338  t[282] = 100;
20339  t[286] = 101;
20340  t[287] = 232;
20341  t[288] = 233;
20342  t[290] = 283;
20343  t[295] = 281;
20344  t[296] = 102;
20345  t[336] = 103;
20346  t[346] = 104;
20347  t[349] = 105;
20348  t[350] = 236;
20349  t[351] = 237;
20350  t[361] = 106;
20351  t[364] = 107;
20352  t[367] = 108;
20353  t[371] = 322;
20354  t[373] = 109;
20355  t[374] = 110;
20356  t[381] = 111;
20357  t[382] = 242;
20358  t[383] = 243;
20359  t[386] = 246;
20360  t[393] = 112;
20361  t[395] = 113;
20362  t[396] = 114;
20363  t[398] = 345;
20364  t[400] = 115;
20365  t[401] = 347;
20366  t[403] = 353;
20367  t[410] = 116;
20368  t[437] = 117;
20369  t[442] = 252;
20370  t[448] = 118;
20371  t[449] = 119;
20372  t[454] = 120;
20373  t[455] = 121;
20374  t[457] = 253;
20375  t[460] = 122;
20376  t[462] = 382;
20377  t[463] = 380;
20378  t[853] = 44;
20379  t[855] = 58;
20380  t[856] = 46;
20381  t[876] = 47;
20382  t[878] = 45;
20383  t[882] = 45;
20384  t[894] = 40;
20385  t[895] = 41;
20386  t[896] = 91;
20387  t[897] = 93;
20388  t[923] = 64;
20389  t[940] = 163;
20390  t[1004] = 48;
20391  t[1005] = 49;
20392  t[1006] = 50;
20393  t[1007] = 51;
20394  t[1008] = 52;
20395  t[1009] = 53;
20396  t[1010] = 54;
20397  t[1011] = 55;
20398  t[1012] = 56;
20399  t[1013] = 57;
20400  t[1081] = 37;
20401  t[1085] = 43;
20402  t[1086] = 45;
20403});
20404function getStandardFontName(name) {
20405  const fontName = normalizeFontName(name);
20406  const stdFontMap = getStdFontMap();
20407  return stdFontMap[fontName];
20408}
20409function isKnownFontName(name) {
20410  const fontName = normalizeFontName(name);
20411  return !!(getStdFontMap()[fontName] || getNonStdFontMap()[fontName] || getSerifFonts()[fontName] || getSymbolsFonts()[fontName]);
20412}
20413
20414;// ./src/core/to_unicode_map.js
20415
20416class ToUnicodeMap {
20417  constructor(cmap = []) {
20418    this._map = cmap;
20419  }
20420  get length() {
20421    return this._map.length;
20422  }
20423  forEach(callback) {
20424    for (const charCode in this._map) {
20425      callback(charCode, this._map[charCode].codePointAt(0));
20426    }
20427  }
20428  has(i) {
20429    return this._map[i] !== undefined;
20430  }
20431  get(i) {
20432    return this._map[i];
20433  }
20434  charCodeOf(value) {
20435    const map = this._map;
20436    if (map.length <= 0x10000) {
20437      return map.indexOf(value);
20438    }
20439    for (const charCode in map) {
20440      if (map[charCode] === value) {
20441        return charCode | 0;
20442      }
20443    }
20444    return -1;
20445  }
20446  amend(map) {
20447    for (const charCode in map) {
20448      this._map[charCode] = map[charCode];
20449    }
20450  }
20451}
20452class IdentityToUnicodeMap {
20453  constructor(firstChar, lastChar) {
20454    this.firstChar = firstChar;
20455    this.lastChar = lastChar;
20456  }
20457  get length() {
20458    return this.lastChar + 1 - this.firstChar;
20459  }
20460  forEach(callback) {
20461    for (let i = this.firstChar, ii = this.lastChar; i <= ii; i++) {
20462      callback(i, i);
20463    }
20464  }
20465  has(i) {
20466    return this.firstChar <= i && i <= this.lastChar;
20467  }
20468  get(i) {
20469    if (this.firstChar <= i && i <= this.lastChar) {
20470      return String.fromCharCode(i);
20471    }
20472    return undefined;
20473  }
20474  charCodeOf(v) {
20475    return Number.isInteger(v) && v >= this.firstChar && v <= this.lastChar ? v : -1;
20476  }
20477  amend(map) {
20478    unreachable("Should not call amend()");
20479  }
20480}
20481
20482;// ./src/core/cff_font.js
20483
20484
20485
20486class CFFFont {
20487  constructor(file, properties) {
20488    this.properties = properties;
20489    const parser = new CFFParser(file, properties, SEAC_ANALYSIS_ENABLED);
20490    this.cff = parser.parse();
20491    this.cff.duplicateFirstGlyph();
20492    const compiler = new CFFCompiler(this.cff);
20493    this.seacs = this.cff.seacs;
20494    try {
20495      this.data = compiler.compile();
20496    } catch {
20497      warn("Failed to compile font " + properties.loadedName);
20498      this.data = file;
20499    }
20500    this._createBuiltInEncoding();
20501  }
20502  get numGlyphs() {
20503    return this.cff.charStrings.count;
20504  }
20505  getCharset() {
20506    return this.cff.charset.charset;
20507  }
20508  getGlyphMapping() {
20509    const cff = this.cff;
20510    const properties = this.properties;
20511    const {
20512      cidToGidMap,
20513      cMap
20514    } = properties;
20515    const charsets = cff.charset.charset;
20516    let charCodeToGlyphId;
20517    let glyphId;
20518    if (properties.composite) {
20519      let invCidToGidMap;
20520      if (cidToGidMap?.length > 0) {
20521        invCidToGidMap = Object.create(null);
20522        for (let i = 0, ii = cidToGidMap.length; i < ii; i++) {
20523          const gid = cidToGidMap[i];
20524          if (gid !== undefined) {
20525            invCidToGidMap[gid] = i;
20526          }
20527        }
20528      }
20529      charCodeToGlyphId = Object.create(null);
20530      let charCode;
20531      if (cff.isCIDFont) {
20532        for (glyphId = 0; glyphId < charsets.length; glyphId++) {
20533          const cid = charsets[glyphId];
20534          charCode = cMap.charCodeOf(cid);
20535          if (invCidToGidMap?.[charCode] !== undefined) {
20536            charCode = invCidToGidMap[charCode];
20537          }
20538          charCodeToGlyphId[charCode] = glyphId;
20539        }
20540      } else {
20541        for (glyphId = 0; glyphId < cff.charStrings.count; glyphId++) {
20542          charCode = cMap.charCodeOf(glyphId);
20543          charCodeToGlyphId[charCode] = glyphId;
20544        }
20545      }
20546      return charCodeToGlyphId;
20547    }
20548    let encoding = cff.encoding ? cff.encoding.encoding : null;
20549    if (properties.isInternalFont) {
20550      encoding = properties.defaultEncoding;
20551    }
20552    charCodeToGlyphId = type1FontGlyphMapping(properties, encoding, charsets);
20553    return charCodeToGlyphId;
20554  }
20555  hasGlyphId(id) {
20556    return this.cff.hasGlyphId(id);
20557  }
20558  _createBuiltInEncoding() {
20559    const {
20560      charset,
20561      encoding
20562    } = this.cff;
20563    if (!charset || !encoding) {
20564      return;
20565    }
20566    const charsets = charset.charset,
20567      encodings = encoding.encoding;
20568    const map = [];
20569    for (const charCode in encodings) {
20570      const glyphId = encodings[charCode];
20571      if (glyphId >= 0) {
20572        const glyphName = charsets[glyphId];
20573        if (glyphName) {
20574          map[charCode] = glyphName;
20575        }
20576      }
20577    }
20578    if (map.length > 0) {
20579      this.properties.builtInEncoding = map;
20580    }
20581  }
20582}
20583
20584;// ./src/core/font_renderer.js
20585
20586
20587
20588
20589
20590
vendor: 8,640 bytes, lines 20591-20896
20591function getFloat214(view, offset) {
20592  return view.getInt16(offset) / 16384;
20593}
20594function getSubroutineBias(subrs) {
20595  const numSubrs = subrs.length;
20596  let bias = 32768;
20597  if (numSubrs < 1240) {
20598    bias = 107;
20599  } else if (numSubrs < 33900) {
20600    bias = 1131;
20601  }
20602  return bias;
20603}
20604function parseCmap(data, start, end) {
20605  const view = new DataView(data.buffer, data.byteOffset, data.byteLength);
20606  const offset = view.getUint16(start + 2) === 1 ? view.getUint32(start + 8) : view.getUint32(start + 16);
20607  const format = view.getUint16(start + offset);
20608  let ranges, p, i;
20609  if (format === 4) {
20610    const segCount = view.getUint16(start + offset + 6) >> 1;
20611    p = start + offset + 14;
20612    ranges = [];
20613    for (i = 0; i < segCount; i++, p += 2) {
20614      ranges[i] = {
20615        end: view.getUint16(p)
20616      };
20617    }
20618    p += 2;
20619    for (i = 0; i < segCount; i++, p += 2) {
20620      ranges[i].start = view.getUint16(p);
20621    }
20622    for (i = 0; i < segCount; i++, p += 2) {
20623      ranges[i].idDelta = view.getUint16(p);
20624    }
20625    for (i = 0; i < segCount; i++, p += 2) {
20626      let idOffset = view.getUint16(p);
20627      if (idOffset === 0) {
20628        continue;
20629      }
20630      ranges[i].ids = [];
20631      for (let j = 0, jj = ranges[i].end - ranges[i].start + 1; j < jj; j++) {
20632        ranges[i].ids[j] = view.getUint16(p + idOffset);
20633        idOffset += 2;
20634      }
20635    }
20636    return ranges;
20637  } else if (format === 12) {
20638    const groups = view.getUint32(start + offset + 12);
20639    p = start + offset + 16;
20640    ranges = [];
20641    for (i = 0; i < groups; i++) {
20642      start = view.getUint32(p);
20643      ranges.push({
20644        start,
20645        end: view.getUint32(p + 4),
20646        idDelta: view.getUint32(p + 8) - start
20647      });
20648      p += 12;
20649    }
20650    return ranges;
20651  }
20652  throw new FormatError(`unsupported cmap: ${format}`);
20653}
20654function parseCff(data, start, end, seacAnalysisEnabled) {
20655  const properties = {};
20656  const parser = new CFFParser(new Stream(data, start, end - start), properties, seacAnalysisEnabled);
20657  const cff = parser.parse();
20658  return {
20659    glyphs: cff.charStrings.objects,
20660    subrs: cff.topDict.privateDict?.subrsIndex?.objects,
20661    gsubrs: cff.globalSubrIndex?.objects,
20662    isCFFCIDFont: cff.isCIDFont,
20663    fdSelect: cff.fdSelect,
20664    fdArray: cff.fdArray
20665  };
20666}
20667function parseGlyfTable(glyf, loca, isGlyphLocationsLong) {
20668  const view = new DataView(loca.buffer, loca.byteOffset, loca.byteLength);
20669  let itemSize, itemDecode;
20670  if (isGlyphLocationsLong) {
20671    itemSize = 4;
20672    itemDecode = (dv, offset) => dv.getUint32(offset);
20673  } else {
20674    itemSize = 2;
20675    itemDecode = (dv, offset) => 2 * dv.getUint16(offset);
20676  }
20677  const glyphs = [];
20678  let startOffset = itemDecode(view, 0);
20679  for (let j = itemSize; j < loca.length; j += itemSize) {
20680    const endOffset = itemDecode(view, j);
20681    glyphs.push(glyf.subarray(startOffset, endOffset));
20682    startOffset = endOffset;
20683  }
20684  return glyphs;
20685}
20686function lookupCmap(ranges, unicode) {
20687  const code = unicode.codePointAt(0);
20688  let gid = 0,
20689    l = 0,
20690    r = ranges.length - 1;
20691  while (l < r) {
20692    const c = l + r + 1 >> 1;
20693    if (code < ranges[c].start) {
20694      r = c - 1;
20695    } else {
20696      l = c;
20697    }
20698  }
20699  if (ranges[l].start <= code && code <= ranges[l].end) {
20700    gid = ranges[l].idDelta + (ranges[l].ids ? ranges[l].ids[code - ranges[l].start] : code) & 0xffff;
20701  }
20702  return {
20703    charCode: code,
20704    glyphId: gid
20705  };
20706}
20707function compileGlyf(code, cmds, font, visitedGlyphs = new Set()) {
20708  if (visitedGlyphs.has(code)) {
20709    warn("compileGlyf: skipping recursive composite glyph reference.");
20710    return;
20711  }
20712  visitedGlyphs.add(code);
20713  function moveTo(x, y) {
20714    if (firstPoint) {
20715      cmds.add(DrawOPS.lineTo, firstPoint);
20716    }
20717    firstPoint = [x, y];
20718    cmds.add(DrawOPS.moveTo, [x, y]);
20719  }
20720  function lineTo(x, y) {
20721    cmds.add(DrawOPS.lineTo, [x, y]);
20722  }
20723  function quadraticCurveTo(xa, ya, x, y) {
20724    cmds.add(DrawOPS.quadraticCurveTo, [xa, ya, x, y]);
20725  }
20726  const view = new DataView(code.buffer, code.byteOffset, code.byteLength);
20727  let i = 0;
20728  const numberOfContours = view.getInt16(i);
20729  let flags;
20730  let firstPoint = null;
20731  let x = 0,
20732    y = 0;
20733  i += 10;
20734  if (numberOfContours < 0) {
20735    do {
20736      flags = view.getUint16(i);
20737      const glyphIndex = view.getUint16(i + 2);
20738      i += 4;
20739      let arg1, arg2;
20740      if (flags & 0x01) {
20741        if (flags & 0x02) {
20742          arg1 = view.getInt16(i);
20743          arg2 = view.getInt16(i + 2);
20744        } else {
20745          arg1 = view.getUint16(i);
20746          arg2 = view.getUint16(i + 2);
20747        }
20748        i += 4;
20749      } else if (flags & 0x02) {
20750        arg1 = view.getInt8(i++);
20751        arg2 = view.getInt8(i++);
20752      } else {
20753        arg1 = code[i++];
20754        arg2 = code[i++];
20755      }
20756      if (flags & 0x02) {
20757        x = arg1;
20758        y = arg2;
20759      } else {
20760        x = 0;
20761        y = 0;
20762      }
20763      let scaleX = 1,
20764        scaleY = 1,
20765        scale01 = 0,
20766        scale10 = 0;
20767      if (flags & 0x08) {
20768        scaleX = scaleY = getFloat214(view, i);
20769        i += 2;
20770      } else if (flags & 0x40) {
20771        scaleX = getFloat214(view, i);
20772        scaleY = getFloat214(view, i + 2);
20773        i += 4;
20774      } else if (flags & 0x80) {
20775        scaleX = getFloat214(view, i);
20776        scale01 = getFloat214(view, i + 2);
20777        scale10 = getFloat214(view, i + 4);
20778        scaleY = getFloat214(view, i + 6);
20779        i += 8;
20780      }
20781      const subglyph = font.glyphs[glyphIndex];
20782      if (subglyph) {
20783        cmds.save();
20784        cmds.transform([scaleX, scale01, scale10, scaleY, x, y]);
20785        if (!(flags & 0x02)) {}
20786        compileGlyf(subglyph, cmds, font, visitedGlyphs);
20787        cmds.restore();
20788      }
20789    } while (flags & 0x20);
20790  } else {
20791    const endPtsOfContours = [];
20792    let j, jj;
20793    for (j = 0; j < numberOfContours; j++) {
20794      endPtsOfContours.push(view.getUint16(i));
20795      i += 2;
20796    }
20797    const instructionLength = view.getUint16(i);
20798    i += 2 + instructionLength;
20799    const numberOfPoints = endPtsOfContours.at(-1) + 1;
20800    const points = [];
20801    while (points.length < numberOfPoints) {
20802      flags = code[i++];
20803      let repeat = 1;
20804      if (flags & 0x08) {
20805        repeat += code[i++];
20806      }
20807      while (repeat-- > 0) {
20808        points.push({
20809          flags
20810        });
20811      }
20812    }
20813    for (j = 0; j < numberOfPoints; j++) {
20814      switch (points[j].flags & 0x12) {
20815        case 0x00:
20816          x += view.getInt16(i);
20817          i += 2;
20818          break;
20819        case 0x02:
20820          x -= code[i++];
20821          break;
20822        case 0x12:
20823          x += code[i++];
20824          break;
20825      }
20826      points[j].x = x;
20827    }
20828    for (j = 0; j < numberOfPoints; j++) {
20829      switch (points[j].flags & 0x24) {
20830        case 0x00:
20831          y += view.getInt16(i);
20832          i += 2;
20833          break;
20834        case 0x04:
20835          y -= code[i++];
20836          break;
20837        case 0x24:
20838          y += code[i++];
20839          break;
20840      }
20841      points[j].y = y;
20842    }
20843    let startPoint = 0;
20844    for (i = 0; i < numberOfContours; i++) {
20845      const endPoint = endPtsOfContours[i];
20846      const contour = points.slice(startPoint, endPoint + 1);
20847      if (contour[0].flags & 1) {
20848        contour.push(contour[0]);
20849      } else if (contour.at(-1).flags & 1) {
20850        contour.unshift(contour.at(-1));
20851      } else {
20852        const p = {
20853          flags: 1,
20854          x: (contour[0].x + contour.at(-1).x) / 2,
20855          y: (contour[0].y + contour.at(-1).y) / 2
20856        };
20857        contour.unshift(p);
20858        contour.push(p);
20859      }
20860      moveTo(contour[0].x, contour[0].y);
20861      for (j = 1, jj = contour.length; j < jj; j++) {
20862        if (contour[j].flags & 1) {
20863          lineTo(contour[j].x, contour[j].y);
20864        } else if (contour[j + 1].flags & 1) {
20865          quadraticCurveTo(contour[j].x, contour[j].y, contour[j + 1].x, contour[j + 1].y);
20866          j++;
20867        } else {
20868          quadraticCurveTo(contour[j].x, contour[j].y, (contour[j].x + contour[j + 1].x) / 2, (contour[j].y + contour[j + 1].y) / 2);
20869        }
20870      }
20871      startPoint = endPoint + 1;
20872    }
20873  }
20874  visitedGlyphs.delete(code);
20875}
20876function compileCharString(charStringCode, cmds, font, glyphId) {
20877  function moveTo(x, y) {
20878    if (firstPoint) {
20879      cmds.add(DrawOPS.lineTo, firstPoint);
20880    }
20881    firstPoint = [x, y];
20882    cmds.add(DrawOPS.moveTo, [x, y]);
20883  }
20884  function lineTo(x, y) {
20885    cmds.add(DrawOPS.lineTo, [x, y]);
20886  }
20887  function bezierCurveTo(x1, y1, x2, y2, x, y) {
20888    cmds.add(DrawOPS.curveTo, [x1, y1, x2, y2, x, y]);
20889  }
20890  const stack = [];
20891  let x = 0,
20892    y = 0;
20893  let stems = 0;
20894  let firstPoint = null;
20895  function parse(code) {
20896    const view = new DataView(code.buffer, code.byteOffset, code.byteLength);
vendor: 8,031 bytes, lines 20896-21155
20896
20897    let i = 0;
20898    while (i < code.length) {
20899      let stackClean = false;
20900      let v = code[i++];
20901      let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
20902      switch (v) {
20903        case 1:
20904          stems += stack.length >> 1;
20905          stackClean = true;
20906          break;
20907        case 3:
20908          stems += stack.length >> 1;
20909          stackClean = true;
20910          break;
20911        case 4:
20912          y += stack.pop();
20913          moveTo(x, y);
20914          stackClean = true;
20915          break;
20916        case 5:
20917          while (stack.length > 0) {
20918            x += stack.shift();
20919            y += stack.shift();
20920            lineTo(x, y);
20921          }
20922          break;
20923        case 6:
20924          while (stack.length > 0) {
20925            x += stack.shift();
20926            lineTo(x, y);
20927            if (stack.length === 0) {
20928              break;
20929            }
20930            y += stack.shift();
20931            lineTo(x, y);
20932          }
20933          break;
20934        case 7:
20935          while (stack.length > 0) {
20936            y += stack.shift();
20937            lineTo(x, y);
20938            if (stack.length === 0) {
20939              break;
20940            }
20941            x += stack.shift();
20942            lineTo(x, y);
20943          }
20944          break;
20945        case 8:
20946          while (stack.length > 0) {
20947            xa = x + stack.shift();
20948            ya = y + stack.shift();
20949            xb = xa + stack.shift();
20950            yb = ya + stack.shift();
20951            x = xb + stack.shift();
20952            y = yb + stack.shift();
20953            bezierCurveTo(xa, ya, xb, yb, x, y);
20954          }
20955          break;
20956        case 10:
20957          n = stack.pop();
20958          subrCode = null;
20959          if (font.isCFFCIDFont) {
20960            const fdIndex = font.fdSelect.getFDIndex(glyphId);
20961            if (fdIndex >= 0 && fdIndex < font.fdArray.length) {
20962              const fontDict = font.fdArray[fdIndex];
20963              let subrs;
20964              if (fontDict.privateDict?.subrsIndex) {
20965                subrs = fontDict.privateDict.subrsIndex.objects;
20966              }
20967              if (subrs) {
20968                n += getSubroutineBias(subrs);
20969                subrCode = subrs[n];
20970              }
20971            } else {
20972              warn("Invalid fd index for glyph index.");
20973            }
20974          } else {
20975            subrCode = font.subrs[n + font.subrsBias];
20976          }
20977          if (subrCode) {
20978            parse(subrCode);
20979          }
20980          break;
20981        case 11:
20982          return;
20983        case 12:
20984          v = code[i++];
20985          switch (v) {
20986            case 34:
20987              xa = x + stack.shift();
20988              xb = xa + stack.shift();
20989              y1 = y + stack.shift();
20990              x = xb + stack.shift();
20991              bezierCurveTo(xa, y, xb, y1, x, y1);
20992              xa = x + stack.shift();
20993              xb = xa + stack.shift();
20994              x = xb + stack.shift();
20995              bezierCurveTo(xa, y1, xb, y, x, y);
20996              break;
20997            case 35:
20998              xa = x + stack.shift();
20999              ya = y + stack.shift();
21000              xb = xa + stack.shift();
21001              yb = ya + stack.shift();
21002              x = xb + stack.shift();
21003              y = yb + stack.shift();
21004              bezierCurveTo(xa, ya, xb, yb, x, y);
21005              xa = x + stack.shift();
21006              ya = y + stack.shift();
21007              xb = xa + stack.shift();
21008              yb = ya + stack.shift();
21009              x = xb + stack.shift();
21010              y = yb + stack.shift();
21011              bezierCurveTo(xa, ya, xb, yb, x, y);
21012              stack.pop();
21013              break;
21014            case 36:
21015              xa = x + stack.shift();
21016              y1 = y + stack.shift();
21017              xb = xa + stack.shift();
21018              y2 = y1 + stack.shift();
21019              x = xb + stack.shift();
21020              bezierCurveTo(xa, y1, xb, y2, x, y2);
21021              xa = x + stack.shift();
21022              xb = xa + stack.shift();
21023              y3 = y2 + stack.shift();
21024              x = xb + stack.shift();
21025              bezierCurveTo(xa, y2, xb, y3, x, y);
21026              break;
21027            case 37:
21028              const x0 = x,
21029                y0 = y;
21030              xa = x + stack.shift();
21031              ya = y + stack.shift();
21032              xb = xa + stack.shift();
21033              yb = ya + stack.shift();
21034              x = xb + stack.shift();
21035              y = yb + stack.shift();
21036              bezierCurveTo(xa, ya, xb, yb, x, y);
21037              xa = x + stack.shift();
21038              ya = y + stack.shift();
21039              xb = xa + stack.shift();
21040              yb = ya + stack.shift();
21041              x = xb;
21042              y = yb;
21043              if (Math.abs(x - x0) > Math.abs(y - y0)) {
21044                x += stack.shift();
21045              } else {
21046                y += stack.shift();
21047              }
21048              bezierCurveTo(xa, ya, xb, yb, x, y);
21049              break;
21050            default:
21051              throw new FormatError(`unknown operator: 12 ${v}`);
21052          }
21053          break;
21054        case 14:
21055          if (stack.length >= 4) {
21056            const achar = stack.pop();
21057            const bchar = stack.pop();
21058            y = stack.pop();
21059            x = stack.pop();
21060            cmds.save();
21061            cmds.translate(x, y);
21062            let cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[StandardEncoding[achar]]));
21063            compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
21064            cmds.restore();
21065            cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[StandardEncoding[bchar]]));
21066            compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
21067          }
21068          return;
21069        case 18:
21070          stems += stack.length >> 1;
21071          stackClean = true;
21072          break;
21073        case 19:
21074          stems += stack.length >> 1;
21075          i += stems + 7 >> 3;
21076          stackClean = true;
21077          break;
21078        case 20:
21079          stems += stack.length >> 1;
21080          i += stems + 7 >> 3;
21081          stackClean = true;
21082          break;
21083        case 21:
21084          y += stack.pop();
21085          x += stack.pop();
21086          moveTo(x, y);
21087          stackClean = true;
21088          break;
21089        case 22:
21090          x += stack.pop();
21091          moveTo(x, y);
21092          stackClean = true;
21093          break;
21094        case 23:
21095          stems += stack.length >> 1;
21096          stackClean = true;
21097          break;
21098        case 24:
21099          while (stack.length > 2) {
21100            xa = x + stack.shift();
21101            ya = y + stack.shift();
21102            xb = xa + stack.shift();
21103            yb = ya + stack.shift();
21104            x = xb + stack.shift();
21105            y = yb + stack.shift();
21106            bezierCurveTo(xa, ya, xb, yb, x, y);
21107          }
21108          x += stack.shift();
21109          y += stack.shift();
21110          lineTo(x, y);
21111          break;
21112        case 25:
21113          while (stack.length > 6) {
21114            x += stack.shift();
21115            y += stack.shift();
21116            lineTo(x, y);
21117          }
21118          xa = x + stack.shift();
21119          ya = y + stack.shift();
21120          xb = xa + stack.shift();
21121          yb = ya + stack.shift();
21122          x = xb + stack.shift();
21123          y = yb + stack.shift();
21124          bezierCurveTo(xa, ya, xb, yb, x, y);
21125          break;
21126        case 26:
21127          if (stack.length % 2) {
21128            x += stack.shift();
21129          }
21130          while (stack.length > 0) {
21131            xa = x;
21132            ya = y + stack.shift();
21133            xb = xa + stack.shift();
21134            yb = ya + stack.shift();
21135            x = xb;
21136            y = yb + stack.shift();
21137            bezierCurveTo(xa, ya, xb, yb, x, y);
21138          }
21139          break;
21140        case 27:
21141          if (stack.length % 2) {
21142            y += stack.shift();
21143          }
21144          while (stack.length > 0) {
21145            xa = x + stack.shift();
21146            ya = y;
21147            xb = xa + stack.shift();
21148            yb = ya + stack.shift();
21149            x = xb + stack.shift();
21150            y = yb;
21151            bezierCurveTo(xa, ya, xb, yb, x, y);
21152          }
21153          break;
21154        case 28:
21155          stack.push(
vendor: 1,956 bytes, lines 21155-21215
21155view.getInt16(i));
21156          i += 2;
21157          break;
21158        case 29:
21159          n = stack.pop() + font.gsubrsBias;
21160          subrCode = font.gsubrs[n];
21161          if (subrCode) {
21162            parse(subrCode);
21163          }
21164          break;
21165        case 30:
21166          while (stack.length > 0) {
21167            xa = x;
21168            ya = y + stack.shift();
21169            xb = xa + stack.shift();
21170            yb = ya + stack.shift();
21171            x = xb + stack.shift();
21172            y = yb + (stack.length === 1 ? stack.shift() : 0);
21173            bezierCurveTo(xa, ya, xb, yb, x, y);
21174            if (stack.length === 0) {
21175              break;
21176            }
21177            xa = x + stack.shift();
21178            ya = y;
21179            xb = xa + stack.shift();
21180            yb = ya + stack.shift();
21181            y = yb + stack.shift();
21182            x = xb + (stack.length === 1 ? stack.shift() : 0);
21183            bezierCurveTo(xa, ya, xb, yb, x, y);
21184          }
21185          break;
21186        case 31:
21187          while (stack.length > 0) {
21188            xa = x + stack.shift();
21189            ya = y;
21190            xb = xa + stack.shift();
21191            yb = ya + stack.shift();
21192            y = yb + stack.shift();
21193            x = xb + (stack.length === 1 ? stack.shift() : 0);
21194            bezierCurveTo(xa, ya, xb, yb, x, y);
21195            if (stack.length === 0) {
21196              break;
21197            }
21198            xa = x;
21199            ya = y + stack.shift();
21200            xb = xa + stack.shift();
21201            yb = ya + stack.shift();
21202            x = xb + stack.shift();
21203            y = yb + (stack.length === 1 ? stack.shift() : 0);
21204            bezierCurveTo(xa, ya, xb, yb, x, y);
21205          }
21206          break;
21207        default:
21208          if (v < 32) {
21209            throw new FormatError(`unknown operator: ${v}`);
21210          }
21211          if (v < 247) {
21212            stack.push(v - 139);
21213          } else if (v < 251) {
21214            stack.push((v - 247) * 256 + code[i++] + 108);
21215          } else if (v < 255) {
21216            stack.push(-(v - 251) * 256 - code[i++] - 108);
21217          } else {
21218            stack.push(view.getInt32(i) / 65536);
21219            i += 4;
21220          }
21221          break;
21222      }
21223      if (stackClean) {
21224        stack.length = 0;
21225      }
21226    }
21227  }
21228  parse(charStringCode);
21229}
21230class Commands {
21231  cmds = [];
21232  transformStack = [];
21233  currentTransform = [1, 0, 0, 1, 0, 0];
21234  add(cmd, args) {
21235    if (args) {
21236      const {
21237        currentTransform
21238      } = this;
21239      for (let i = 0, ii = args.length; i < ii; i += 2) {
21240        Util.applyTransform(args, currentTransform, i);
21241      }
21242      this.cmds.push(cmd, ...args);
21243    } else {
21244      this.cmds.push(cmd);
21245    }
21246  }
21247  transform(transf) {
21248    this.currentTransform = Util.transform(this.currentTransform, transf);
21249  }
21250  translate(x, y) {
21251    this.transform([1, 0, 0, 1, x, y]);
21252  }
21253  save() {
21254    this.transformStack.push(this.currentTransform.slice());
21255  }
21256  restore() {
21257    this.currentTransform = this.transformStack.pop() || [1, 0, 0, 1, 0, 0];
21258  }
21259  getPath() {
21260    if (FeatureTest.isFloat16ArraySupported) {
21261      return new Float16Array(this.cmds);
21262    }
21263    return new Float32Array(this.cmds);
21264  }
21265}
21266class CompiledFont {
21267  constructor(fontMatrix) {
21268    this.fontMatrix = fontMatrix;
21269    this.compiledGlyphs = Object.create(null);
21270    this.compiledCharCodeToGlyphId = Object.create(null);
21271  }
21272  static get NOOP() {
21273    return shadow(this, "NOOP", FeatureTest.isFloat16ArraySupported ? new Float16Array(0) : new Float32Array(0));
21274  }
21275  getPathJs(unicode) {
21276    const {
21277      charCode,
21278      glyphId
21279    } = lookupCmap(this.cmap, unicode);
21280    let fn = this.compiledGlyphs[glyphId],
21281      compileEx;
21282    if (fn === undefined) {
21283      try {
21284        fn = this.compileGlyph(this.glyphs[glyphId], glyphId);
21285      } catch (ex) {
21286        fn = CompiledFont.NOOP;
21287        compileEx = ex;
21288      }
21289      this.compiledGlyphs[glyphId] = fn;
21290    }
21291    this.compiledCharCodeToGlyphId[charCode] ??= glyphId;
21292    if (compileEx) {
21293      throw compileEx;
21294    }
21295    return fn;
21296  }
21297  compileGlyph(code, glyphId) {
21298    if (!code?.length || code[0] === 14) {
21299      return CompiledFont.NOOP;
21300    }
21301    let fontMatrix = this.fontMatrix;
21302    if (this.isCFFCIDFont) {
21303      const fdIndex = this.fdSelect.getFDIndex(glyphId);
21304      if (fdIndex >= 0 && fdIndex < this.fdArray.length) {
21305        const fontDict = this.fdArray[fdIndex];
21306        fontMatrix = fontDict.getByName("FontMatrix") || FONT_IDENTITY_MATRIX;
21307      } else {
21308        warn("Invalid fd index for glyph index.");
21309      }
21310    }
21311    assert(isNumberArray(fontMatrix, 6), "Expected a valid fontMatrix.");
21312    const cmds = new Commands();
21313    cmds.transform(fontMatrix.slice());
21314    this.compileGlyphImpl(code, cmds, glyphId);
21315    cmds.add(DrawOPS.closePath);
21316    return cmds.getPath();
21317  }
21318  compileGlyphImpl() {
21319    unreachable("Children classes should implement this.");
21320  }
21321  hasBuiltPath(unicode) {
21322    const {
21323      charCode,
21324      glyphId
21325    } = lookupCmap(this.cmap, unicode);
21326    return this.compiledGlyphs[glyphId] !== undefined && this.compiledCharCodeToGlyphId[charCode] !== undefined;
21327  }
21328}
21329class TrueTypeCompiled extends CompiledFont {
21330  constructor(glyphs, cmap, fontMatrix) {
21331    super(fontMatrix || [0.000488, 0, 0, 0.000488, 0, 0]);
21332    this.glyphs = glyphs;
21333    this.cmap = cmap;
21334  }
21335  compileGlyphImpl(code, cmds) {
21336    compileGlyf(code, cmds, this);
21337  }
21338}
21339class Type2Compiled extends CompiledFont {
21340  constructor(cffInfo, cmap, fontMatrix) {
21341    super(fontMatrix || [0.001, 0, 0, 0.001, 0, 0]);
21342    this.glyphs = cffInfo.glyphs;
21343    this.gsubrs = cffInfo.gsubrs || [];
21344    this.subrs = cffInfo.subrs || [];
21345    this.cmap = cmap;
21346    this.glyphNameMap = getGlyphsUnicode();
21347    this.gsubrsBias = getSubroutineBias(this.gsubrs);
21348    this.subrsBias = getSubroutineBias(this.subrs);
21349    this.isCFFCIDFont = cffInfo.isCFFCIDFont;
21350    this.fdSelect = cffInfo.fdSelect;
21351    this.fdArray = cffInfo.fdArray;
21352  }
21353  compileGlyphImpl(code, cmds, glyphId) {
21354    compileCharString(code, cmds, this, glyphId);
21355  }
21356}
21357class FontRendererFactory {
21358  static create(font, seacAnalysisEnabled) {
21359    const data = new Uint8Array(font.data),
21360      view = new DataView(data.buffer);
vendor: 1,413 bytes, lines 21361-21401
21361    let cmap, glyf, loca, cff, indexToLocFormat, unitsPerEm;
21362    const numTables = view.getUint16(4);
21363    for (let i = 0, p = 12; i < numTables; i++, p += 16) {
21364      const tag = bytesToString(data.subarray(p, p + 4));
21365      const offset = view.getUint32(p + 8);
21366      const length = view.getUint32(p + 12);
21367      switch (tag) {
21368        case "cmap":
21369          cmap = parseCmap(data, offset, offset + length);
21370          break;
21371        case "glyf":
21372          glyf = data.subarray(offset, offset + length);
21373          break;
21374        case "loca":
21375          loca = data.subarray(offset, offset + length);
21376          break;
21377        case "head":
21378          unitsPerEm = view.getUint16(offset + 18);
21379          indexToLocFormat = view.getUint16(offset + 50);
21380          break;
21381        case "CFF ":
21382          cff = parseCff(data, offset, offset + length, seacAnalysisEnabled);
21383          break;
21384      }
21385    }
21386    if (glyf) {
21387      const fontMatrix = !unitsPerEm ? font.fontMatrix : [1 / unitsPerEm, 0, 0, 1 / unitsPerEm, 0, 0];
21388      return new TrueTypeCompiled(parseGlyfTable(glyf, loca, indexToLocFormat), cmap, fontMatrix);
21389    }
21390    return new Type2Compiled(cff, cmap, font.fontMatrix);
21391  }
21392}
21393
21394;// ./src/core/metrics.js
21395
21396const getMetrics = getLookupTableFactory(function (t) {
21397  t.Courier = 600;
21398  t["Courier-Bold"] = 600;
21399  t["Courier-BoldOblique"] = 600;
21400  t["Courier-Oblique"] = 600;
21401  t.Helvetica = getLookupTableFactory
vendor: 5,719 bytes, lines 21401-21681
21401(function (t) {
21402    t.space = 278;
21403    t.exclam = 278;
21404    t.quotedbl = 355;
21405    t.numbersign = 556;
21406    t.dollar = 556;
21407    t.percent = 889;
21408    t.ampersand = 667;
21409    t.quoteright = 222;
21410    t.parenleft = 333;
21411    t.parenright = 333;
21412    t.asterisk = 389;
21413    t.plus = 584;
21414    t.comma = 278;
21415    t.hyphen = 333;
21416    t.period = 278;
21417    t.slash = 278;
21418    t.zero = 556;
21419    t.one = 556;
21420    t.two = 556;
21421    t.three = 556;
21422    t.four = 556;
21423    t.five = 556;
21424    t.six = 556;
21425    t.seven = 556;
21426    t.eight = 556;
21427    t.nine = 556;
21428    t.colon = 278;
21429    t.semicolon = 278;
21430    t.less = 584;
21431    t.equal = 584;
21432    t.greater = 584;
21433    t.question = 556;
21434    t.at = 1015;
21435    t.A = 667;
21436    t.B = 667;
21437    t.C = 722;
21438    t.D = 722;
21439    t.E = 667;
21440    t.F = 611;
21441    t.G = 778;
21442    t.H = 722;
21443    t.I = 278;
21444    t.J = 500;
21445    t.K = 667;
21446    t.L = 556;
21447    t.M = 833;
21448    t.N = 722;
21449    t.O = 778;
21450    t.P = 667;
21451    t.Q = 778;
21452    t.R = 722;
21453    t.S = 667;
21454    t.T = 611;
21455    t.U = 722;
21456    t.V = 667;
21457    t.W = 944;
21458    t.X = 667;
21459    t.Y = 667;
21460    t.Z = 611;
21461    t.bracketleft = 278;
21462    t.backslash = 278;
21463    t.bracketright = 278;
21464    t.asciicircum = 469;
21465    t.underscore = 556;
21466    t.quoteleft = 222;
21467    t.a = 556;
21468    t.b = 556;
21469    t.c = 500;
21470    t.d = 556;
21471    t.e = 556;
21472    t.f = 278;
21473    t.g = 556;
21474    t.h = 556;
21475    t.i = 222;
21476    t.j = 222;
21477    t.k = 500;
21478    t.l = 222;
21479    t.m = 833;
21480    t.n = 556;
21481    t.o = 556;
21482    t.p = 556;
21483    t.q = 556;
21484    t.r = 333;
21485    t.s = 500;
21486    t.t = 278;
21487    t.u = 556;
21488    t.v = 500;
21489    t.w = 722;
21490    t.x = 500;
21491    t.y = 500;
21492    t.z = 500;
21493    t.braceleft = 334;
21494    t.bar = 260;
21495    t.braceright = 334;
21496    t.asciitilde = 584;
21497    t.exclamdown = 333;
21498    t.cent = 556;
21499    t.sterling = 556;
21500    t.fraction = 167;
21501    t.yen = 556;
21502    t.florin = 556;
21503    t.section = 556;
21504    t.currency = 556;
21505    t.quotesingle = 191;
21506    t.quotedblleft = 333;
21507    t.guillemotleft = 556;
21508    t.guilsinglleft = 333;
21509    t.guilsinglright = 333;
21510    t.fi = 500;
21511    t.fl = 500;
21512    t.endash = 556;
21513    t.dagger = 556;
21514    t.daggerdbl = 556;
21515    t.periodcentered = 278;
21516    t.paragraph = 537;
21517    t.bullet = 350;
21518    t.quotesinglbase = 222;
21519    t.quotedblbase = 333;
21520    t.quotedblright = 333;
21521    t.guillemotright = 556;
21522    t.ellipsis = 1000;
21523    t.perthousand = 1000;
21524    t.questiondown = 611;
21525    t.grave = 333;
21526    t.acute = 333;
21527    t.circumflex = 333;
21528    t.tilde = 333;
21529    t.macron = 333;
21530    t.breve = 333;
21531    t.dotaccent = 333;
21532    t.dieresis = 333;
21533    t.ring = 333;
21534    t.cedilla = 333;
21535    t.hungarumlaut = 333;
21536    t.ogonek = 333;
21537    t.caron = 333;
21538    t.emdash = 1000;
21539    t.AE = 1000;
21540    t.ordfeminine = 370;
21541    t.Lslash = 556;
21542    t.Oslash = 778;
21543    t.OE = 1000;
21544    t.ordmasculine = 365;
21545    t.ae = 889;
21546    t.dotlessi = 278;
21547    t.lslash = 222;
21548    t.oslash = 611;
21549    t.oe = 944;
21550    t.germandbls = 611;
21551    t.Idieresis = 278;
21552    t.eacute = 556;
21553    t.abreve = 556;
21554    t.uhungarumlaut = 556;
21555    t.ecaron = 556;
21556    t.Ydieresis = 667;
21557    t.divide = 584;
21558    t.Yacute = 667;
21559    t.Acircumflex = 667;
21560    t.aacute = 556;
21561    t.Ucircumflex = 722;
21562    t.yacute = 500;
21563    t.scommaaccent = 500;
21564    t.ecircumflex = 556;
21565    t.Uring = 722;
21566    t.Udieresis = 722;
21567    t.aogonek = 556;
21568    t.Uacute = 722;
21569    t.uogonek = 556;
21570    t.Edieresis = 667;
21571    t.Dcroat = 722;
21572    t.commaaccent = 250;
21573    t.copyright = 737;
21574    t.Emacron = 667;
21575    t.ccaron = 500;
21576    t.aring = 556;
21577    t.Ncommaaccent = 722;
21578    t.lacute = 222;
21579    t.agrave = 556;
21580    t.Tcommaaccent = 611;
21581    t.Cacute = 722;
21582    t.atilde = 556;
21583    t.Edotaccent = 667;
21584    t.scaron = 500;
21585    t.scedilla = 500;
21586    t.iacute = 278;
21587    t.lozenge = 471;
21588    t.Rcaron = 722;
21589    t.Gcommaaccent = 778;
21590    t.ucircumflex = 556;
21591    t.acircumflex = 556;
21592    t.Amacron = 667;
21593    t.rcaron = 333;
21594    t.ccedilla = 500;
21595    t.Zdotaccent = 611;
21596    t.Thorn = 667;
21597    t.Omacron = 778;
21598    t.Racute = 722;
21599    t.Sacute = 667;
21600    t.dcaron = 643;
21601    t.Umacron = 722;
21602    t.uring = 556;
21603    t.threesuperior = 333;
21604    t.Ograve = 778;
21605    t.Agrave = 667;
21606    t.Abreve = 667;
21607    t.multiply = 584;
21608    t.uacute = 556;
21609    t.Tcaron = 611;
21610    t.partialdiff = 476;
21611    t.ydieresis = 500;
21612    t.Nacute = 722;
21613    t.icircumflex = 278;
21614    t.Ecircumflex = 667;
21615    t.adieresis = 556;
21616    t.edieresis = 556;
21617    t.cacute = 500;
21618    t.nacute = 556;
21619    t.umacron = 556;
21620    t.Ncaron = 722;
21621    t.Iacute = 278;
21622    t.plusminus = 584;
21623    t.brokenbar = 260;
21624    t.registered = 737;
21625    t.Gbreve = 778;
21626    t.Idotaccent = 278;
21627    t.summation = 600;
21628    t.Egrave = 667;
21629    t.racute = 333;
21630    t.omacron = 556;
21631    t.Zacute = 611;
21632    t.Zcaron = 611;
21633    t.greaterequal = 549;
21634    t.Eth = 722;
21635    t.Ccedilla = 722;
21636    t.lcommaaccent = 222;
21637    t.tcaron = 317;
21638    t.eogonek = 556;
21639    t.Uogonek = 722;
21640    t.Aacute = 667;
21641    t.Adieresis = 667;
21642    t.egrave = 556;
21643    t.zacute = 500;
21644    t.iogonek = 222;
21645    t.Oacute = 778;
21646    t.oacute = 556;
21647    t.amacron = 556;
21648    t.sacute = 500;
21649    t.idieresis = 278;
21650    t.Ocircumflex = 778;
21651    t.Ugrave = 722;
21652    t.Delta = 612;
21653    t.thorn = 556;
21654    t.twosuperior = 333;
21655    t.Odieresis = 778;
21656    t.mu = 556;
21657    t.igrave = 278;
21658    t.ohungarumlaut = 556;
21659    t.Eogonek = 667;
21660    t.dcroat = 556;
21661    t.threequarters = 834;
21662    t.Scedilla = 667;
21663    t.lcaron = 299;
21664    t.Kcommaaccent = 667;
21665    t.Lacute = 556;
21666    t.trademark = 1000;
21667    t.edotaccent = 556;
21668    t.Igrave = 278;
21669    t.Imacron = 278;
21670    t.Lcaron = 556;
21671    t.onehalf = 834;
21672    t.lessequal = 549;
21673    t.ocircumflex = 556;
21674    t.ntilde = 556;
21675    t.Uhungarumlaut = 722;
21676    t.Eacute = 667;
21677    t.emacron = 556;
21678    t.gbreve = 556;
21679    t.onequarter = 834;
21680    t.Scaron = 667;
21681    t.Scommaaccent = 667;
vendor: 14,768 bytes, lines 21682-22397
21682    t.Ohungarumlaut = 778;
21683    t.degree = 400;
21684    t.ograve = 556;
21685    t.Ccaron = 722;
21686    t.ugrave = 556;
21687    t.radical = 453;
21688    t.Dcaron = 722;
21689    t.rcommaaccent = 333;
21690    t.Ntilde = 722;
21691    t.otilde = 556;
21692    t.Rcommaaccent = 722;
21693    t.Lcommaaccent = 556;
21694    t.Atilde = 667;
21695    t.Aogonek = 667;
21696    t.Aring = 667;
21697    t.Otilde = 778;
21698    t.zdotaccent = 500;
21699    t.Ecaron = 667;
21700    t.Iogonek = 278;
21701    t.kcommaaccent = 500;
21702    t.minus = 584;
21703    t.Icircumflex = 278;
21704    t.ncaron = 556;
21705    t.tcommaaccent = 278;
21706    t.logicalnot = 584;
21707    t.odieresis = 556;
21708    t.udieresis = 556;
21709    t.notequal = 549;
21710    t.gcommaaccent = 556;
21711    t.eth = 556;
21712    t.zcaron = 500;
21713    t.ncommaaccent = 556;
21714    t.onesuperior = 333;
21715    t.imacron = 278;
21716    t.Euro = 556;
21717  });
21718  t["Helvetica-Bold"] = getLookupTableFactory(function (t) {
21719    t.space = 278;
21720    t.exclam = 333;
21721    t.quotedbl = 474;
21722    t.numbersign = 556;
21723    t.dollar = 556;
21724    t.percent = 889;
21725    t.ampersand = 722;
21726    t.quoteright = 278;
21727    t.parenleft = 333;
21728    t.parenright = 333;
21729    t.asterisk = 389;
21730    t.plus = 584;
21731    t.comma = 278;
21732    t.hyphen = 333;
21733    t.period = 278;
21734    t.slash = 278;
21735    t.zero = 556;
21736    t.one = 556;
21737    t.two = 556;
21738    t.three = 556;
21739    t.four = 556;
21740    t.five = 556;
21741    t.six = 556;
21742    t.seven = 556;
21743    t.eight = 556;
21744    t.nine = 556;
21745    t.colon = 333;
21746    t.semicolon = 333;
21747    t.less = 584;
21748    t.equal = 584;
21749    t.greater = 584;
21750    t.question = 611;
21751    t.at = 975;
21752    t.A = 722;
21753    t.B = 722;
21754    t.C = 722;
21755    t.D = 722;
21756    t.E = 667;
21757    t.F = 611;
21758    t.G = 778;
21759    t.H = 722;
21760    t.I = 278;
21761    t.J = 556;
21762    t.K = 722;
21763    t.L = 611;
21764    t.M = 833;
21765    t.N = 722;
21766    t.O = 778;
21767    t.P = 667;
21768    t.Q = 778;
21769    t.R = 722;
21770    t.S = 667;
21771    t.T = 611;
21772    t.U = 722;
21773    t.V = 667;
21774    t.W = 944;
21775    t.X = 667;
21776    t.Y = 667;
21777    t.Z = 611;
21778    t.bracketleft = 333;
21779    t.backslash = 278;
21780    t.bracketright = 333;
21781    t.asciicircum = 584;
21782    t.underscore = 556;
21783    t.quoteleft = 278;
21784    t.a = 556;
21785    t.b = 611;
21786    t.c = 556;
21787    t.d = 611;
21788    t.e = 556;
21789    t.f = 333;
21790    t.g = 611;
21791    t.h = 611;
21792    t.i = 278;
21793    t.j = 278;
21794    t.k = 556;
21795    t.l = 278;
21796    t.m = 889;
21797    t.n = 611;
21798    t.o = 611;
21799    t.p = 611;
21800    t.q = 611;
21801    t.r = 389;
21802    t.s = 556;
21803    t.t = 333;
21804    t.u = 611;
21805    t.v = 556;
21806    t.w = 778;
21807    t.x = 556;
21808    t.y = 556;
21809    t.z = 500;
21810    t.braceleft = 389;
21811    t.bar = 280;
21812    t.braceright = 389;
21813    t.asciitilde = 584;
21814    t.exclamdown = 333;
21815    t.cent = 556;
21816    t.sterling = 556;
21817    t.fraction = 167;
21818    t.yen = 556;
21819    t.florin = 556;
21820    t.section = 556;
21821    t.currency = 556;
21822    t.quotesingle = 238;
21823    t.quotedblleft = 500;
21824    t.guillemotleft = 556;
21825    t.guilsinglleft = 333;
21826    t.guilsinglright = 333;
21827    t.fi = 611;
21828    t.fl = 611;
21829    t.endash = 556;
21830    t.dagger = 556;
21831    t.daggerdbl = 556;
21832    t.periodcentered = 278;
21833    t.paragraph = 556;
21834    t.bullet = 350;
21835    t.quotesinglbase = 278;
21836    t.quotedblbase = 500;
21837    t.quotedblright = 500;
21838    t.guillemotright = 556;
21839    t.ellipsis = 1000;
21840    t.perthousand = 1000;
21841    t.questiondown = 611;
21842    t.grave = 333;
21843    t.acute = 333;
21844    t.circumflex = 333;
21845    t.tilde = 333;
21846    t.macron = 333;
21847    t.breve = 333;
21848    t.dotaccent = 333;
21849    t.dieresis = 333;
21850    t.ring = 333;
21851    t.cedilla = 333;
21852    t.hungarumlaut = 333;
21853    t.ogonek = 333;
21854    t.caron = 333;
21855    t.emdash = 1000;
21856    t.AE = 1000;
21857    t.ordfeminine = 370;
21858    t.Lslash = 611;
21859    t.Oslash = 778;
21860    t.OE = 1000;
21861    t.ordmasculine = 365;
21862    t.ae = 889;
21863    t.dotlessi = 278;
21864    t.lslash = 278;
21865    t.oslash = 611;
21866    t.oe = 944;
21867    t.germandbls = 611;
21868    t.Idieresis = 278;
21869    t.eacute = 556;
21870    t.abreve = 556;
21871    t.uhungarumlaut = 611;
21872    t.ecaron = 556;
21873    t.Ydieresis = 667;
21874    t.divide = 584;
21875    t.Yacute = 667;
21876    t.Acircumflex = 722;
21877    t.aacute = 556;
21878    t.Ucircumflex = 722;
21879    t.yacute = 556;
21880    t.scommaaccent = 556;
21881    t.ecircumflex = 556;
21882    t.Uring = 722;
21883    t.Udieresis = 722;
21884    t.aogonek = 556;
21885    t.Uacute = 722;
21886    t.uogonek = 611;
21887    t.Edieresis = 667;
21888    t.Dcroat = 722;
21889    t.commaaccent = 250;
21890    t.copyright = 737;
21891    t.Emacron = 667;
21892    t.ccaron = 556;
21893    t.aring = 556;
21894    t.Ncommaaccent = 722;
21895    t.lacute = 278;
21896    t.agrave = 556;
21897    t.Tcommaaccent = 611;
21898    t.Cacute = 722;
21899    t.atilde = 556;
21900    t.Edotaccent = 667;
21901    t.scaron = 556;
21902    t.scedilla = 556;
21903    t.iacute = 278;
21904    t.lozenge = 494;
21905    t.Rcaron = 722;
21906    t.Gcommaaccent = 778;
21907    t.ucircumflex = 611;
21908    t.acircumflex = 556;
21909    t.Amacron = 722;
21910    t.rcaron = 389;
21911    t.ccedilla = 556;
21912    t.Zdotaccent = 611;
21913    t.Thorn = 667;
21914    t.Omacron = 778;
21915    t.Racute = 722;
21916    t.Sacute = 667;
21917    t.dcaron = 743;
21918    t.Umacron = 722;
21919    t.uring = 611;
21920    t.threesuperior = 333;
21921    t.Ograve = 778;
21922    t.Agrave = 722;
21923    t.Abreve = 722;
21924    t.multiply = 584;
21925    t.uacute = 611;
21926    t.Tcaron = 611;
21927    t.partialdiff = 494;
21928    t.ydieresis = 556;
21929    t.Nacute = 722;
21930    t.icircumflex = 278;
21931    t.Ecircumflex = 667;
21932    t.adieresis = 556;
21933    t.edieresis = 556;
21934    t.cacute = 556;
21935    t.nacute = 611;
21936    t.umacron = 611;
21937    t.Ncaron = 722;
21938    t.Iacute = 278;
21939    t.plusminus = 584;
21940    t.brokenbar = 280;
21941    t.registered = 737;
21942    t.Gbreve = 778;
21943    t.Idotaccent = 278;
21944    t.summation = 600;
21945    t.Egrave = 667;
21946    t.racute = 389;
21947    t.omacron = 611;
21948    t.Zacute = 611;
21949    t.Zcaron = 611;
21950    t.greaterequal = 549;
21951    t.Eth = 722;
21952    t.Ccedilla = 722;
21953    t.lcommaaccent = 278;
21954    t.tcaron = 389;
21955    t.eogonek = 556;
21956    t.Uogonek = 722;
21957    t.Aacute = 722;
21958    t.Adieresis = 722;
21959    t.egrave = 556;
21960    t.zacute = 500;
21961    t.iogonek = 278;
21962    t.Oacute = 778;
21963    t.oacute = 611;
21964    t.amacron = 556;
21965    t.sacute = 556;
21966    t.idieresis = 278;
21967    t.Ocircumflex = 778;
21968    t.Ugrave = 722;
21969    t.Delta = 612;
21970    t.thorn = 611;
21971    t.twosuperior = 333;
21972    t.Odieresis = 778;
21973    t.mu = 611;
21974    t.igrave = 278;
21975    t.ohungarumlaut = 611;
21976    t.Eogonek = 667;
21977    t.dcroat = 611;
21978    t.threequarters = 834;
21979    t.Scedilla = 667;
21980    t.lcaron = 400;
21981    t.Kcommaaccent = 722;
21982    t.Lacute = 611;
21983    t.trademark = 1000;
21984    t.edotaccent = 556;
21985    t.Igrave = 278;
21986    t.Imacron = 278;
21987    t.Lcaron = 611;
21988    t.onehalf = 834;
21989    t.lessequal = 549;
21990    t.ocircumflex = 611;
21991    t.ntilde = 611;
21992    t.Uhungarumlaut = 722;
21993    t.Eacute = 667;
21994    t.emacron = 556;
21995    t.gbreve = 611;
21996    t.onequarter = 834;
21997    t.Scaron = 667;
21998    t.Scommaaccent = 667;
21999    t.Ohungarumlaut = 778;
22000    t.degree = 400;
22001    t.ograve = 611;
22002    t.Ccaron = 722;
22003    t.ugrave = 611;
22004    t.radical = 549;
22005    t.Dcaron = 722;
22006    t.rcommaaccent = 389;
22007    t.Ntilde = 722;
22008    t.otilde = 611;
22009    t.Rcommaaccent = 722;
22010    t.Lcommaaccent = 611;
22011    t.Atilde = 722;
22012    t.Aogonek = 722;
22013    t.Aring = 722;
22014    t.Otilde = 778;
22015    t.zdotaccent = 500;
22016    t.Ecaron = 667;
22017    t.Iogonek = 278;
22018    t.kcommaaccent = 556;
22019    t.minus = 584;
22020    t.Icircumflex = 278;
22021    t.ncaron = 611;
22022    t.tcommaaccent = 333;
22023    t.logicalnot = 584;
22024    t.odieresis = 611;
22025    t.udieresis = 611;
22026    t.notequal = 549;
22027    t.gcommaaccent = 611;
22028    t.eth = 611;
22029    t.zcaron = 500;
22030    t.ncommaaccent = 611;
22031    t.onesuperior = 333;
22032    t.imacron = 278;
22033    t.Euro = 556;
22034  });
22035  t["Helvetica-BoldOblique"] = getLookupTableFactory(function (t) {
22036    t.space = 278;
22037    t.exclam = 333;
22038    t.quotedbl = 474;
22039    t.numbersign = 556;
22040    t.dollar = 556;
22041    t.percent = 889;
22042    t.ampersand = 722;
22043    t.quoteright = 278;
22044    t.parenleft = 333;
22045    t.parenright = 333;
22046    t.asterisk = 389;
22047    t.plus = 584;
22048    t.comma = 278;
22049    t.hyphen = 333;
22050    t.period = 278;
22051    t.slash = 278;
22052    t.zero = 556;
22053    t.one = 556;
22054    t.two = 556;
22055    t.three = 556;
22056    t.four = 556;
22057    t.five = 556;
22058    t.six = 556;
22059    t.seven = 556;
22060    t.eight = 556;
22061    t.nine = 556;
22062    t.colon = 333;
22063    t.semicolon = 333;
22064    t.less = 584;
22065    t.equal = 584;
22066    t.greater = 584;
22067    t.question = 611;
22068    t.at = 975;
22069    t.A = 722;
22070    t.B = 722;
22071    t.C = 722;
22072    t.D = 722;
22073    t.E = 667;
22074    t.F = 611;
22075    t.G = 778;
22076    t.H = 722;
22077    t.I = 278;
22078    t.J = 556;
22079    t.K = 722;
22080    t.L = 611;
22081    t.M = 833;
22082    t.N = 722;
22083    t.O = 778;
22084    t.P = 667;
22085    t.Q = 778;
22086    t.R = 722;
22087    t.S = 667;
22088    t.T = 611;
22089    t.U = 722;
22090    t.V = 667;
22091    t.W = 944;
22092    t.X = 667;
22093    t.Y = 667;
22094    t.Z = 611;
22095    t.bracketleft = 333;
22096    t.backslash = 278;
22097    t.bracketright = 333;
22098    t.asciicircum = 584;
22099    t.underscore = 556;
22100    t.quoteleft = 278;
22101    t.a = 556;
22102    t.b = 611;
22103    t.c = 556;
22104    t.d = 611;
22105    t.e = 556;
22106    t.f = 333;
22107    t.g = 611;
22108    t.h = 611;
22109    t.i = 278;
22110    t.j = 278;
22111    t.k = 556;
22112    t.l = 278;
22113    t.m = 889;
22114    t.n = 611;
22115    t.o = 611;
22116    t.p = 611;
22117    t.q = 611;
22118    t.r = 389;
22119    t.s = 556;
22120    t.t = 333;
22121    t.u = 611;
22122    t.v = 556;
22123    t.w = 778;
22124    t.x = 556;
22125    t.y = 556;
22126    t.z = 500;
22127    t.braceleft = 389;
22128    t.bar = 280;
22129    t.braceright = 389;
22130    t.asciitilde = 584;
22131    t.exclamdown = 333;
22132    t.cent = 556;
22133    t.sterling = 556;
22134    t.fraction = 167;
22135    t.yen = 556;
22136    t.florin = 556;
22137    t.section = 556;
22138    t.currency = 556;
22139    t.quotesingle = 238;
22140    t.quotedblleft = 500;
22141    t.guillemotleft = 556;
22142    t.guilsinglleft = 333;
22143    t.guilsinglright = 333;
22144    t.fi = 611;
22145    t.fl = 611;
22146    t.endash = 556;
22147    t.dagger = 556;
22148    t.daggerdbl = 556;
22149    t.periodcentered = 278;
22150    t.paragraph = 556;
22151    t.bullet = 350;
22152    t.quotesinglbase = 278;
22153    t.quotedblbase = 500;
22154    t.quotedblright = 500;
22155    t.guillemotright = 556;
22156    t.ellipsis = 1000;
22157    t.perthousand = 1000;
22158    t.questiondown = 611;
22159    t.grave = 333;
22160    t.acute = 333;
22161    t.circumflex = 333;
22162    t.tilde = 333;
22163    t.macron = 333;
22164    t.breve = 333;
22165    t.dotaccent = 333;
22166    t.dieresis = 333;
22167    t.ring = 333;
22168    t.cedilla = 333;
22169    t.hungarumlaut = 333;
22170    t.ogonek = 333;
22171    t.caron = 333;
22172    t.emdash = 1000;
22173    t.AE = 1000;
22174    t.ordfeminine = 370;
22175    t.Lslash = 611;
22176    t.Oslash = 778;
22177    t.OE = 1000;
22178    t.ordmasculine = 365;
22179    t.ae = 889;
22180    t.dotlessi = 278;
22181    t.lslash = 278;
22182    t.oslash = 611;
22183    t.oe = 944;
22184    t.germandbls = 611;
22185    t.Idieresis = 278;
22186    t.eacute = 556;
22187    t.abreve = 556;
22188    t.uhungarumlaut = 611;
22189    t.ecaron = 556;
22190    t.Ydieresis = 667;
22191    t.divide = 584;
22192    t.Yacute = 667;
22193    t.Acircumflex = 722;
22194    t.aacute = 556;
22195    t.Ucircumflex = 722;
22196    t.yacute = 556;
22197    t.scommaaccent = 556;
22198    t.ecircumflex = 556;
22199    t.Uring = 722;
22200    t.Udieresis = 722;
22201    t.aogonek = 556;
22202    t.Uacute = 722;
22203    t.uogonek = 611;
22204    t.Edieresis = 667;
22205    t.Dcroat = 722;
22206    t.commaaccent = 250;
22207    t.copyright = 737;
22208    t.Emacron = 667;
22209    t.ccaron = 556;
22210    t.aring = 556;
22211    t.Ncommaaccent = 722;
22212    t.lacute = 278;
22213    t.agrave = 556;
22214    t.Tcommaaccent = 611;
22215    t.Cacute = 722;
22216    t.atilde = 556;
22217    t.Edotaccent = 667;
22218    t.scaron = 556;
22219    t.scedilla = 556;
22220    t.iacute = 278;
22221    t.lozenge = 494;
22222    t.Rcaron = 722;
22223    t.Gcommaaccent = 778;
22224    t.ucircumflex = 611;
22225    t.acircumflex = 556;
22226    t.Amacron = 722;
22227    t.rcaron = 389;
22228    t.ccedilla = 556;
22229    t.Zdotaccent = 611;
22230    t.Thorn = 667;
22231    t.Omacron = 778;
22232    t.Racute = 722;
22233    t.Sacute = 667;
22234    t.dcaron = 743;
22235    t.Umacron = 722;
22236    t.uring = 611;
22237    t.threesuperior = 333;
22238    t.Ograve = 778;
22239    t.Agrave = 722;
22240    t.Abreve = 722;
22241    t.multiply = 584;
22242    t.uacute = 611;
22243    t.Tcaron = 611;
22244    t.partialdiff = 494;
22245    t.ydieresis = 556;
22246    t.Nacute = 722;
22247    t.icircumflex = 278;
22248    t.Ecircumflex = 667;
22249    t.adieresis = 556;
22250    t.edieresis = 556;
22251    t.cacute = 556;
22252    t.nacute = 611;
22253    t.umacron = 611;
22254    t.Ncaron = 722;
22255    t.Iacute = 278;
22256    t.plusminus = 584;
22257    t.brokenbar = 280;
22258    t.registered = 737;
22259    t.Gbreve = 778;
22260    t.Idotaccent = 278;
22261    t.summation = 600;
22262    t.Egrave = 667;
22263    t.racute = 389;
22264    t.omacron = 611;
22265    t.Zacute = 611;
22266    t.Zcaron = 611;
22267    t.greaterequal = 549;
22268    t.Eth = 722;
22269    t.Ccedilla = 722;
22270    t.lcommaaccent = 278;
22271    t.tcaron = 389;
22272    t.eogonek = 556;
22273    t.Uogonek = 722;
22274    t.Aacute = 722;
22275    t.Adieresis = 722;
22276    t.egrave = 556;
22277    t.zacute = 500;
22278    t.iogonek = 278;
22279    t.Oacute = 778;
22280    t.oacute = 611;
22281    t.amacron = 556;
22282    t.sacute = 556;
22283    t.idieresis = 278;
22284    t.Ocircumflex = 778;
22285    t.Ugrave = 722;
22286    t.Delta = 612;
22287    t.thorn = 611;
22288    t.twosuperior = 333;
22289    t.Odieresis = 778;
22290    t.mu = 611;
22291    t.igrave = 278;
22292    t.ohungarumlaut = 611;
22293    t.Eogonek = 667;
22294    t.dcroat = 611;
22295    t.threequarters = 834;
22296    t.Scedilla = 667;
22297    t.lcaron = 400;
22298    t.Kcommaaccent = 722;
22299    t.Lacute = 611;
22300    t.trademark = 1000;
22301    t.edotaccent = 556;
22302    t.Igrave = 278;
22303    t.Imacron = 278;
22304    t.Lcaron = 611;
22305    t.onehalf = 834;
22306    t.lessequal = 549;
22307    t.ocircumflex = 611;
22308    t.ntilde = 611;
22309    t.Uhungarumlaut = 722;
22310    t.Eacute = 667;
22311    t.emacron = 556;
22312    t.gbreve = 611;
22313    t.onequarter = 834;
22314    t.Scaron = 667;
22315    t.Scommaaccent = 667;
22316    t.Ohungarumlaut = 778;
22317    t.degree = 400;
22318    t.ograve = 611;
22319    t.Ccaron = 722;
22320    t.ugrave = 611;
22321    t.radical = 549;
22322    t.Dcaron = 722;
22323    t.rcommaaccent = 389;
22324    t.Ntilde = 722;
22325    t.otilde = 611;
22326    t.Rcommaaccent = 722;
22327    t.Lcommaaccent = 611;
22328    t.Atilde = 722;
22329    t.Aogonek = 722;
22330    t.Aring = 722;
22331    t.Otilde = 778;
22332    t.zdotaccent = 500;
22333    t.Ecaron = 667;
22334    t.Iogonek = 278;
22335    t.kcommaaccent = 556;
22336    t.minus = 584;
22337    t.Icircumflex = 278;
22338    t.ncaron = 611;
22339    t.tcommaaccent = 333;
22340    t.logicalnot = 584;
22341    t.odieresis = 611;
22342    t.udieresis = 611;
22343    t.notequal = 549;
22344    t.gcommaaccent = 611;
22345    t.eth = 611;
22346    t.zcaron = 500;
22347    t.ncommaaccent = 611;
22348    t.onesuperior = 333;
22349    t.imacron = 278;
22350    t.Euro = 556;
22351  });
22352  t["Helvetica-Oblique"] = getLookupTableFactory(function (t) {
22353    t.space = 278;
22354    t.exclam = 278;
22355    t.quotedbl = 355;
22356    t.numbersign = 556;
22357    t.dollar = 556;
22358    t.percent = 889;
22359    t.ampersand = 667;
22360    t.quoteright = 222;
22361    t.parenleft = 333;
22362    t.parenright = 333;
22363    t.asterisk = 389;
22364    t.plus = 584;
22365    t.comma = 278;
22366    t.hyphen = 333;
22367    t.period = 278;
22368    t.slash = 278;
22369    t.zero = 556;
22370    t.one = 556;
22371    t.two = 556;
22372    t.three = 556;
22373    t.four = 556;
22374    t.five = 556;
22375    t.six = 556;
22376    t.seven = 556;
22377    t.eight = 556;
22378    t.nine = 556;
22379    t.colon = 278;
22380    t.semicolon = 278;
22381    t.less = 584;
22382    t.equal = 584;
22383    t.greater = 584;
22384    t.question = 556;
22385    t.at = 1015;
22386    t.A = 667;
22387    t.B = 667;
22388    t.C = 722;
22389    t.D = 722;
22390    t.E = 667;
22391    t.F = 611;
22392    t.G = 778;
22393    t.H = 722;
22394    t.I = 278;
22395    t.J = 500;
22396    t.K = 667;
22397    t.L = 556;
vendor: 4,866 bytes, lines 22398-22632
22398    t.M = 833;
22399    t.N = 722;
22400    t.O = 778;
22401    t.P = 667;
22402    t.Q = 778;
22403    t.R = 722;
22404    t.S = 667;
22405    t.T = 611;
22406    t.U = 722;
22407    t.V = 667;
22408    t.W = 944;
22409    t.X = 667;
22410    t.Y = 667;
22411    t.Z = 611;
22412    t.bracketleft = 278;
22413    t.backslash = 278;
22414    t.bracketright = 278;
22415    t.asciicircum = 469;
22416    t.underscore = 556;
22417    t.quoteleft = 222;
22418    t.a = 556;
22419    t.b = 556;
22420    t.c = 500;
22421    t.d = 556;
22422    t.e = 556;
22423    t.f = 278;
22424    t.g = 556;
22425    t.h = 556;
22426    t.i = 222;
22427    t.j = 222;
22428    t.k = 500;
22429    t.l = 222;
22430    t.m = 833;
22431    t.n = 556;
22432    t.o = 556;
22433    t.p = 556;
22434    t.q = 556;
22435    t.r = 333;
22436    t.s = 500;
22437    t.t = 278;
22438    t.u = 556;
22439    t.v = 500;
22440    t.w = 722;
22441    t.x = 500;
22442    t.y = 500;
22443    t.z = 500;
22444    t.braceleft = 334;
22445    t.bar = 260;
22446    t.braceright = 334;
22447    t.asciitilde = 584;
22448    t.exclamdown = 333;
22449    t.cent = 556;
22450    t.sterling = 556;
22451    t.fraction = 167;
22452    t.yen = 556;
22453    t.florin = 556;
22454    t.section = 556;
22455    t.currency = 556;
22456    t.quotesingle = 191;
22457    t.quotedblleft = 333;
22458    t.guillemotleft = 556;
22459    t.guilsinglleft = 333;
22460    t.guilsinglright = 333;
22461    t.fi = 500;
22462    t.fl = 500;
22463    t.endash = 556;
22464    t.dagger = 556;
22465    t.daggerdbl = 556;
22466    t.periodcentered = 278;
22467    t.paragraph = 537;
22468    t.bullet = 350;
22469    t.quotesinglbase = 222;
22470    t.quotedblbase = 333;
22471    t.quotedblright = 333;
22472    t.guillemotright = 556;
22473    t.ellipsis = 1000;
22474    t.perthousand = 1000;
22475    t.questiondown = 611;
22476    t.grave = 333;
22477    t.acute = 333;
22478    t.circumflex = 333;
22479    t.tilde = 333;
22480    t.macron = 333;
22481    t.breve = 333;
22482    t.dotaccent = 333;
22483    t.dieresis = 333;
22484    t.ring = 333;
22485    t.cedilla = 333;
22486    t.hungarumlaut = 333;
22487    t.ogonek = 333;
22488    t.caron = 333;
22489    t.emdash = 1000;
22490    t.AE = 1000;
22491    t.ordfeminine = 370;
22492    t.Lslash = 556;
22493    t.Oslash = 778;
22494    t.OE = 1000;
22495    t.ordmasculine = 365;
22496    t.ae = 889;
22497    t.dotlessi = 278;
22498    t.lslash = 222;
22499    t.oslash = 611;
22500    t.oe = 944;
22501    t.germandbls = 611;
22502    t.Idieresis = 278;
22503    t.eacute = 556;
22504    t.abreve = 556;
22505    t.uhungarumlaut = 556;
22506    t.ecaron = 556;
22507    t.Ydieresis = 667;
22508    t.divide = 584;
22509    t.Yacute = 667;
22510    t.Acircumflex = 667;
22511    t.aacute = 556;
22512    t.Ucircumflex = 722;
22513    t.yacute = 500;
22514    t.scommaaccent = 500;
22515    t.ecircumflex = 556;
22516    t.Uring = 722;
22517    t.Udieresis = 722;
22518    t.aogonek = 556;
22519    t.Uacute = 722;
22520    t.uogonek = 556;
22521    t.Edieresis = 667;
22522    t.Dcroat = 722;
22523    t.commaaccent = 250;
22524    t.copyright = 737;
22525    t.Emacron = 667;
22526    t.ccaron = 500;
22527    t.aring = 556;
22528    t.Ncommaaccent = 722;
22529    t.lacute = 222;
22530    t.agrave = 556;
22531    t.Tcommaaccent = 611;
22532    t.Cacute = 722;
22533    t.atilde = 556;
22534    t.Edotaccent = 667;
22535    t.scaron = 500;
22536    t.scedilla = 500;
22537    t.iacute = 278;
22538    t.lozenge = 471;
22539    t.Rcaron = 722;
22540    t.Gcommaaccent = 778;
22541    t.ucircumflex = 556;
22542    t.acircumflex = 556;
22543    t.Amacron = 667;
22544    t.rcaron = 333;
22545    t.ccedilla = 500;
22546    t.Zdotaccent = 611;
22547    t.Thorn = 667;
22548    t.Omacron = 778;
22549    t.Racute = 722;
22550    t.Sacute = 667;
22551    t.dcaron = 643;
22552    t.Umacron = 722;
22553    t.uring = 556;
22554    t.threesuperior = 333;
22555    t.Ograve = 778;
22556    t.Agrave = 667;
22557    t.Abreve = 667;
22558    t.multiply = 584;
22559    t.uacute = 556;
22560    t.Tcaron = 611;
22561    t.partialdiff = 476;
22562    t.ydieresis = 500;
22563    t.Nacute = 722;
22564    t.icircumflex = 278;
22565    t.Ecircumflex = 667;
22566    t.adieresis = 556;
22567    t.edieresis = 556;
22568    t.cacute = 500;
22569    t.nacute = 556;
22570    t.umacron = 556;
22571    t.Ncaron = 722;
22572    t.Iacute = 278;
22573    t.plusminus = 584;
22574    t.brokenbar = 260;
22575    t.registered = 737;
22576    t.Gbreve = 778;
22577    t.Idotaccent = 278;
22578    t.summation = 600;
22579    t.Egrave = 667;
22580    t.racute = 333;
22581    t.omacron = 556;
22582    t.Zacute = 611;
22583    t.Zcaron = 611;
22584    t.greaterequal = 549;
22585    t.Eth = 722;
22586    t.Ccedilla = 722;
22587    t.lcommaaccent = 222;
22588    t.tcaron = 317;
22589    t.eogonek = 556;
22590    t.Uogonek = 722;
22591    t.Aacute = 667;
22592    t.Adieresis = 667;
22593    t.egrave = 556;
22594    t.zacute = 500;
22595    t.iogonek = 222;
22596    t.Oacute = 778;
22597    t.oacute = 556;
22598    t.amacron = 556;
22599    t.sacute = 500;
22600    t.idieresis = 278;
22601    t.Ocircumflex = 778;
22602    t.Ugrave = 722;
22603    t.Delta = 612;
22604    t.thorn = 556;
22605    t.twosuperior = 333;
22606    t.Odieresis = 778;
22607    t.mu = 556;
22608    t.igrave = 278;
22609    t.ohungarumlaut = 556;
22610    t.Eogonek = 667;
22611    t.dcroat = 556;
22612    t.threequarters = 834;
22613    t.Scedilla = 667;
22614    t.lcaron = 299;
22615    t.Kcommaaccent = 667;
22616    t.Lacute = 556;
22617    t.trademark = 1000;
22618    t.edotaccent = 556;
22619    t.Igrave = 278;
22620    t.Imacron = 278;
22621    t.Lcaron = 556;
22622    t.onehalf = 834;
22623    t.lessequal = 549;
22624    t.ocircumflex = 556;
22625    t.ntilde = 556;
22626    t.Uhungarumlaut = 722;
22627    t.Eacute = 667;
22628    t.emacron = 556;
22629    t.gbreve = 556;
22630    t.onequarter = 834;
22631    t.Scaron = 667;
22632    t.Scommaaccent = 667;
vendor: 25,462 bytes, lines 22633-23857
22633    t.Ohungarumlaut = 778;
22634    t.degree = 400;
22635    t.ograve = 556;
22636    t.Ccaron = 722;
22637    t.ugrave = 556;
22638    t.radical = 453;
22639    t.Dcaron = 722;
22640    t.rcommaaccent = 333;
22641    t.Ntilde = 722;
22642    t.otilde = 556;
22643    t.Rcommaaccent = 722;
22644    t.Lcommaaccent = 556;
22645    t.Atilde = 667;
22646    t.Aogonek = 667;
22647    t.Aring = 667;
22648    t.Otilde = 778;
22649    t.zdotaccent = 500;
22650    t.Ecaron = 667;
22651    t.Iogonek = 278;
22652    t.kcommaaccent = 500;
22653    t.minus = 584;
22654    t.Icircumflex = 278;
22655    t.ncaron = 556;
22656    t.tcommaaccent = 278;
22657    t.logicalnot = 584;
22658    t.odieresis = 556;
22659    t.udieresis = 556;
22660    t.notequal = 549;
22661    t.gcommaaccent = 556;
22662    t.eth = 556;
22663    t.zcaron = 500;
22664    t.ncommaaccent = 556;
22665    t.onesuperior = 333;
22666    t.imacron = 278;
22667    t.Euro = 556;
22668  });
22669  t.Symbol = getLookupTableFactory(function (t) {
22670    t.space = 250;
22671    t.exclam = 333;
22672    t.universal = 713;
22673    t.numbersign = 500;
22674    t.existential = 549;
22675    t.percent = 833;
22676    t.ampersand = 778;
22677    t.suchthat = 439;
22678    t.parenleft = 333;
22679    t.parenright = 333;
22680    t.asteriskmath = 500;
22681    t.plus = 549;
22682    t.comma = 250;
22683    t.minus = 549;
22684    t.period = 250;
22685    t.slash = 278;
22686    t.zero = 500;
22687    t.one = 500;
22688    t.two = 500;
22689    t.three = 500;
22690    t.four = 500;
22691    t.five = 500;
22692    t.six = 500;
22693    t.seven = 500;
22694    t.eight = 500;
22695    t.nine = 500;
22696    t.colon = 278;
22697    t.semicolon = 278;
22698    t.less = 549;
22699    t.equal = 549;
22700    t.greater = 549;
22701    t.question = 444;
22702    t.congruent = 549;
22703    t.Alpha = 722;
22704    t.Beta = 667;
22705    t.Chi = 722;
22706    t.Delta = 612;
22707    t.Epsilon = 611;
22708    t.Phi = 763;
22709    t.Gamma = 603;
22710    t.Eta = 722;
22711    t.Iota = 333;
22712    t.theta1 = 631;
22713    t.Kappa = 722;
22714    t.Lambda = 686;
22715    t.Mu = 889;
22716    t.Nu = 722;
22717    t.Omicron = 722;
22718    t.Pi = 768;
22719    t.Theta = 741;
22720    t.Rho = 556;
22721    t.Sigma = 592;
22722    t.Tau = 611;
22723    t.Upsilon = 690;
22724    t.sigma1 = 439;
22725    t.Omega = 768;
22726    t.Xi = 645;
22727    t.Psi = 795;
22728    t.Zeta = 611;
22729    t.bracketleft = 333;
22730    t.therefore = 863;
22731    t.bracketright = 333;
22732    t.perpendicular = 658;
22733    t.underscore = 500;
22734    t.radicalex = 500;
22735    t.alpha = 631;
22736    t.beta = 549;
22737    t.chi = 549;
22738    t.delta = 494;
22739    t.epsilon = 439;
22740    t.phi = 521;
22741    t.gamma = 411;
22742    t.eta = 603;
22743    t.iota = 329;
22744    t.phi1 = 603;
22745    t.kappa = 549;
22746    t.lambda = 549;
22747    t.mu = 576;
22748    t.nu = 521;
22749    t.omicron = 549;
22750    t.pi = 549;
22751    t.theta = 521;
22752    t.rho = 549;
22753    t.sigma = 603;
22754    t.tau = 439;
22755    t.upsilon = 576;
22756    t.omega1 = 713;
22757    t.omega = 686;
22758    t.xi = 493;
22759    t.psi = 686;
22760    t.zeta = 494;
22761    t.braceleft = 480;
22762    t.bar = 200;
22763    t.braceright = 480;
22764    t.similar = 549;
22765    t.Euro = 750;
22766    t.Upsilon1 = 620;
22767    t.minute = 247;
22768    t.lessequal = 549;
22769    t.fraction = 167;
22770    t.infinity = 713;
22771    t.florin = 500;
22772    t.club = 753;
22773    t.diamond = 753;
22774    t.heart = 753;
22775    t.spade = 753;
22776    t.arrowboth = 1042;
22777    t.arrowleft = 987;
22778    t.arrowup = 603;
22779    t.arrowright = 987;
22780    t.arrowdown = 603;
22781    t.degree = 400;
22782    t.plusminus = 549;
22783    t.second = 411;
22784    t.greaterequal = 549;
22785    t.multiply = 549;
22786    t.proportional = 713;
22787    t.partialdiff = 494;
22788    t.bullet = 460;
22789    t.divide = 549;
22790    t.notequal = 549;
22791    t.equivalence = 549;
22792    t.approxequal = 549;
22793    t.ellipsis = 1000;
22794    t.arrowvertex = 603;
22795    t.arrowhorizex = 1000;
22796    t.carriagereturn = 658;
22797    t.aleph = 823;
22798    t.Ifraktur = 686;
22799    t.Rfraktur = 795;
22800    t.weierstrass = 987;
22801    t.circlemultiply = 768;
22802    t.circleplus = 768;
22803    t.emptyset = 823;
22804    t.intersection = 768;
22805    t.union = 768;
22806    t.propersuperset = 713;
22807    t.reflexsuperset = 713;
22808    t.notsubset = 713;
22809    t.propersubset = 713;
22810    t.reflexsubset = 713;
22811    t.element = 713;
22812    t.notelement = 713;
22813    t.angle = 768;
22814    t.gradient = 713;
22815    t.registerserif = 790;
22816    t.copyrightserif = 790;
22817    t.trademarkserif = 890;
22818    t.product = 823;
22819    t.radical = 549;
22820    t.dotmath = 250;
22821    t.logicalnot = 713;
22822    t.logicaland = 603;
22823    t.logicalor = 603;
22824    t.arrowdblboth = 1042;
22825    t.arrowdblleft = 987;
22826    t.arrowdblup = 603;
22827    t.arrowdblright = 987;
22828    t.arrowdbldown = 603;
22829    t.lozenge = 494;
22830    t.angleleft = 329;
22831    t.registersans = 790;
22832    t.copyrightsans = 790;
22833    t.trademarksans = 786;
22834    t.summation = 713;
22835    t.parenlefttp = 384;
22836    t.parenleftex = 384;
22837    t.parenleftbt = 384;
22838    t.bracketlefttp = 384;
22839    t.bracketleftex = 384;
22840    t.bracketleftbt = 384;
22841    t.bracelefttp = 494;
22842    t.braceleftmid = 494;
22843    t.braceleftbt = 494;
22844    t.braceex = 494;
22845    t.angleright = 329;
22846    t.integral = 274;
22847    t.integraltp = 686;
22848    t.integralex = 686;
22849    t.integralbt = 686;
22850    t.parenrighttp = 384;
22851    t.parenrightex = 384;
22852    t.parenrightbt = 384;
22853    t.bracketrighttp = 384;
22854    t.bracketrightex = 384;
22855    t.bracketrightbt = 384;
22856    t.bracerighttp = 494;
22857    t.bracerightmid = 494;
22858    t.bracerightbt = 494;
22859    t.apple = 790;
22860  });
22861  t["Times-Roman"] = getLookupTableFactory(function (t) {
22862    t.space = 250;
22863    t.exclam = 333;
22864    t.quotedbl = 408;
22865    t.numbersign = 500;
22866    t.dollar = 500;
22867    t.percent = 833;
22868    t.ampersand = 778;
22869    t.quoteright = 333;
22870    t.parenleft = 333;
22871    t.parenright = 333;
22872    t.asterisk = 500;
22873    t.plus = 564;
22874    t.comma = 250;
22875    t.hyphen = 333;
22876    t.period = 250;
22877    t.slash = 278;
22878    t.zero = 500;
22879    t.one = 500;
22880    t.two = 500;
22881    t.three = 500;
22882    t.four = 500;
22883    t.five = 500;
22884    t.six = 500;
22885    t.seven = 500;
22886    t.eight = 500;
22887    t.nine = 500;
22888    t.colon = 278;
22889    t.semicolon = 278;
22890    t.less = 564;
22891    t.equal = 564;
22892    t.greater = 564;
22893    t.question = 444;
22894    t.at = 921;
22895    t.A = 722;
22896    t.B = 667;
22897    t.C = 667;
22898    t.D = 722;
22899    t.E = 611;
22900    t.F = 556;
22901    t.G = 722;
22902    t.H = 722;
22903    t.I = 333;
22904    t.J = 389;
22905    t.K = 722;
22906    t.L = 611;
22907    t.M = 889;
22908    t.N = 722;
22909    t.O = 722;
22910    t.P = 556;
22911    t.Q = 722;
22912    t.R = 667;
22913    t.S = 556;
22914    t.T = 611;
22915    t.U = 722;
22916    t.V = 722;
22917    t.W = 944;
22918    t.X = 722;
22919    t.Y = 722;
22920    t.Z = 611;
22921    t.bracketleft = 333;
22922    t.backslash = 278;
22923    t.bracketright = 333;
22924    t.asciicircum = 469;
22925    t.underscore = 500;
22926    t.quoteleft = 333;
22927    t.a = 444;
22928    t.b = 500;
22929    t.c = 444;
22930    t.d = 500;
22931    t.e = 444;
22932    t.f = 333;
22933    t.g = 500;
22934    t.h = 500;
22935    t.i = 278;
22936    t.j = 278;
22937    t.k = 500;
22938    t.l = 278;
22939    t.m = 778;
22940    t.n = 500;
22941    t.o = 500;
22942    t.p = 500;
22943    t.q = 500;
22944    t.r = 333;
22945    t.s = 389;
22946    t.t = 278;
22947    t.u = 500;
22948    t.v = 500;
22949    t.w = 722;
22950    t.x = 500;
22951    t.y = 500;
22952    t.z = 444;
22953    t.braceleft = 480;
22954    t.bar = 200;
22955    t.braceright = 480;
22956    t.asciitilde = 541;
22957    t.exclamdown = 333;
22958    t.cent = 500;
22959    t.sterling = 500;
22960    t.fraction = 167;
22961    t.yen = 500;
22962    t.florin = 500;
22963    t.section = 500;
22964    t.currency = 500;
22965    t.quotesingle = 180;
22966    t.quotedblleft = 444;
22967    t.guillemotleft = 500;
22968    t.guilsinglleft = 333;
22969    t.guilsinglright = 333;
22970    t.fi = 556;
22971    t.fl = 556;
22972    t.endash = 500;
22973    t.dagger = 500;
22974    t.daggerdbl = 500;
22975    t.periodcentered = 250;
22976    t.paragraph = 453;
22977    t.bullet = 350;
22978    t.quotesinglbase = 333;
22979    t.quotedblbase = 444;
22980    t.quotedblright = 444;
22981    t.guillemotright = 500;
22982    t.ellipsis = 1000;
22983    t.perthousand = 1000;
22984    t.questiondown = 444;
22985    t.grave = 333;
22986    t.acute = 333;
22987    t.circumflex = 333;
22988    t.tilde = 333;
22989    t.macron = 333;
22990    t.breve = 333;
22991    t.dotaccent = 333;
22992    t.dieresis = 333;
22993    t.ring = 333;
22994    t.cedilla = 333;
22995    t.hungarumlaut = 333;
22996    t.ogonek = 333;
22997    t.caron = 333;
22998    t.emdash = 1000;
22999    t.AE = 889;
23000    t.ordfeminine = 276;
23001    t.Lslash = 611;
23002    t.Oslash = 722;
23003    t.OE = 889;
23004    t.ordmasculine = 310;
23005    t.ae = 667;
23006    t.dotlessi = 278;
23007    t.lslash = 278;
23008    t.oslash = 500;
23009    t.oe = 722;
23010    t.germandbls = 500;
23011    t.Idieresis = 333;
23012    t.eacute = 444;
23013    t.abreve = 444;
23014    t.uhungarumlaut = 500;
23015    t.ecaron = 444;
23016    t.Ydieresis = 722;
23017    t.divide = 564;
23018    t.Yacute = 722;
23019    t.Acircumflex = 722;
23020    t.aacute = 444;
23021    t.Ucircumflex = 722;
23022    t.yacute = 500;
23023    t.scommaaccent = 389;
23024    t.ecircumflex = 444;
23025    t.Uring = 722;
23026    t.Udieresis = 722;
23027    t.aogonek = 444;
23028    t.Uacute = 722;
23029    t.uogonek = 500;
23030    t.Edieresis = 611;
23031    t.Dcroat = 722;
23032    t.commaaccent = 250;
23033    t.copyright = 760;
23034    t.Emacron = 611;
23035    t.ccaron = 444;
23036    t.aring = 444;
23037    t.Ncommaaccent = 722;
23038    t.lacute = 278;
23039    t.agrave = 444;
23040    t.Tcommaaccent = 611;
23041    t.Cacute = 667;
23042    t.atilde = 444;
23043    t.Edotaccent = 611;
23044    t.scaron = 389;
23045    t.scedilla = 389;
23046    t.iacute = 278;
23047    t.lozenge = 471;
23048    t.Rcaron = 667;
23049    t.Gcommaaccent = 722;
23050    t.ucircumflex = 500;
23051    t.acircumflex = 444;
23052    t.Amacron = 722;
23053    t.rcaron = 333;
23054    t.ccedilla = 444;
23055    t.Zdotaccent = 611;
23056    t.Thorn = 556;
23057    t.Omacron = 722;
23058    t.Racute = 667;
23059    t.Sacute = 556;
23060    t.dcaron = 588;
23061    t.Umacron = 722;
23062    t.uring = 500;
23063    t.threesuperior = 300;
23064    t.Ograve = 722;
23065    t.Agrave = 722;
23066    t.Abreve = 722;
23067    t.multiply = 564;
23068    t.uacute = 500;
23069    t.Tcaron = 611;
23070    t.partialdiff = 476;
23071    t.ydieresis = 500;
23072    t.Nacute = 722;
23073    t.icircumflex = 278;
23074    t.Ecircumflex = 611;
23075    t.adieresis = 444;
23076    t.edieresis = 444;
23077    t.cacute = 444;
23078    t.nacute = 500;
23079    t.umacron = 500;
23080    t.Ncaron = 722;
23081    t.Iacute = 333;
23082    t.plusminus = 564;
23083    t.brokenbar = 200;
23084    t.registered = 760;
23085    t.Gbreve = 722;
23086    t.Idotaccent = 333;
23087    t.summation = 600;
23088    t.Egrave = 611;
23089    t.racute = 333;
23090    t.omacron = 500;
23091    t.Zacute = 611;
23092    t.Zcaron = 611;
23093    t.greaterequal = 549;
23094    t.Eth = 722;
23095    t.Ccedilla = 667;
23096    t.lcommaaccent = 278;
23097    t.tcaron = 326;
23098    t.eogonek = 444;
23099    t.Uogonek = 722;
23100    t.Aacute = 722;
23101    t.Adieresis = 722;
23102    t.egrave = 444;
23103    t.zacute = 444;
23104    t.iogonek = 278;
23105    t.Oacute = 722;
23106    t.oacute = 500;
23107    t.amacron = 444;
23108    t.sacute = 389;
23109    t.idieresis = 278;
23110    t.Ocircumflex = 722;
23111    t.Ugrave = 722;
23112    t.Delta = 612;
23113    t.thorn = 500;
23114    t.twosuperior = 300;
23115    t.Odieresis = 722;
23116    t.mu = 500;
23117    t.igrave = 278;
23118    t.ohungarumlaut = 500;
23119    t.Eogonek = 611;
23120    t.dcroat = 500;
23121    t.threequarters = 750;
23122    t.Scedilla = 556;
23123    t.lcaron = 344;
23124    t.Kcommaaccent = 722;
23125    t.Lacute = 611;
23126    t.trademark = 980;
23127    t.edotaccent = 444;
23128    t.Igrave = 333;
23129    t.Imacron = 333;
23130    t.Lcaron = 611;
23131    t.onehalf = 750;
23132    t.lessequal = 549;
23133    t.ocircumflex = 500;
23134    t.ntilde = 500;
23135    t.Uhungarumlaut = 722;
23136    t.Eacute = 611;
23137    t.emacron = 444;
23138    t.gbreve = 500;
23139    t.onequarter = 750;
23140    t.Scaron = 556;
23141    t.Scommaaccent = 556;
23142    t.Ohungarumlaut = 722;
23143    t.degree = 400;
23144    t.ograve = 500;
23145    t.Ccaron = 667;
23146    t.ugrave = 500;
23147    t.radical = 453;
23148    t.Dcaron = 722;
23149    t.rcommaaccent = 333;
23150    t.Ntilde = 722;
23151    t.otilde = 500;
23152    t.Rcommaaccent = 667;
23153    t.Lcommaaccent = 611;
23154    t.Atilde = 722;
23155    t.Aogonek = 722;
23156    t.Aring = 722;
23157    t.Otilde = 722;
23158    t.zdotaccent = 444;
23159    t.Ecaron = 611;
23160    t.Iogonek = 333;
23161    t.kcommaaccent = 500;
23162    t.minus = 564;
23163    t.Icircumflex = 333;
23164    t.ncaron = 500;
23165    t.tcommaaccent = 278;
23166    t.logicalnot = 564;
23167    t.odieresis = 500;
23168    t.udieresis = 500;
23169    t.notequal = 549;
23170    t.gcommaaccent = 500;
23171    t.eth = 500;
23172    t.zcaron = 444;
23173    t.ncommaaccent = 500;
23174    t.onesuperior = 300;
23175    t.imacron = 278;
23176    t.Euro = 500;
23177  });
23178  t["Times-Bold"] = getLookupTableFactory(function (t) {
23179    t.space = 250;
23180    t.exclam = 333;
23181    t.quotedbl = 555;
23182    t.numbersign = 500;
23183    t.dollar = 500;
23184    t.percent = 1000;
23185    t.ampersand = 833;
23186    t.quoteright = 333;
23187    t.parenleft = 333;
23188    t.parenright = 333;
23189    t.asterisk = 500;
23190    t.plus = 570;
23191    t.comma = 250;
23192    t.hyphen = 333;
23193    t.period = 250;
23194    t.slash = 278;
23195    t.zero = 500;
23196    t.one = 500;
23197    t.two = 500;
23198    t.three = 500;
23199    t.four = 500;
23200    t.five = 500;
23201    t.six = 500;
23202    t.seven = 500;
23203    t.eight = 500;
23204    t.nine = 500;
23205    t.colon = 333;
23206    t.semicolon = 333;
23207    t.less = 570;
23208    t.equal = 570;
23209    t.greater = 570;
23210    t.question = 500;
23211    t.at = 930;
23212    t.A = 722;
23213    t.B = 667;
23214    t.C = 722;
23215    t.D = 722;
23216    t.E = 667;
23217    t.F = 611;
23218    t.G = 778;
23219    t.H = 778;
23220    t.I = 389;
23221    t.J = 500;
23222    t.K = 778;
23223    t.L = 667;
23224    t.M = 944;
23225    t.N = 722;
23226    t.O = 778;
23227    t.P = 611;
23228    t.Q = 778;
23229    t.R = 722;
23230    t.S = 556;
23231    t.T = 667;
23232    t.U = 722;
23233    t.V = 722;
23234    t.W = 1000;
23235    t.X = 722;
23236    t.Y = 722;
23237    t.Z = 667;
23238    t.bracketleft = 333;
23239    t.backslash = 278;
23240    t.bracketright = 333;
23241    t.asciicircum = 581;
23242    t.underscore = 500;
23243    t.quoteleft = 333;
23244    t.a = 500;
23245    t.b = 556;
23246    t.c = 444;
23247    t.d = 556;
23248    t.e = 444;
23249    t.f = 333;
23250    t.g = 500;
23251    t.h = 556;
23252    t.i = 278;
23253    t.j = 333;
23254    t.k = 556;
23255    t.l = 278;
23256    t.m = 833;
23257    t.n = 556;
23258    t.o = 500;
23259    t.p = 556;
23260    t.q = 556;
23261    t.r = 444;
23262    t.s = 389;
23263    t.t = 333;
23264    t.u = 556;
23265    t.v = 500;
23266    t.w = 722;
23267    t.x = 500;
23268    t.y = 500;
23269    t.z = 444;
23270    t.braceleft = 394;
23271    t.bar = 220;
23272    t.braceright = 394;
23273    t.asciitilde = 520;
23274    t.exclamdown = 333;
23275    t.cent = 500;
23276    t.sterling = 500;
23277    t.fraction = 167;
23278    t.yen = 500;
23279    t.florin = 500;
23280    t.section = 500;
23281    t.currency = 500;
23282    t.quotesingle = 278;
23283    t.quotedblleft = 500;
23284    t.guillemotleft = 500;
23285    t.guilsinglleft = 333;
23286    t.guilsinglright = 333;
23287    t.fi = 556;
23288    t.fl = 556;
23289    t.endash = 500;
23290    t.dagger = 500;
23291    t.daggerdbl = 500;
23292    t.periodcentered = 250;
23293    t.paragraph = 540;
23294    t.bullet = 350;
23295    t.quotesinglbase = 333;
23296    t.quotedblbase = 500;
23297    t.quotedblright = 500;
23298    t.guillemotright = 500;
23299    t.ellipsis = 1000;
23300    t.perthousand = 1000;
23301    t.questiondown = 500;
23302    t.grave = 333;
23303    t.acute = 333;
23304    t.circumflex = 333;
23305    t.tilde = 333;
23306    t.macron = 333;
23307    t.breve = 333;
23308    t.dotaccent = 333;
23309    t.dieresis = 333;
23310    t.ring = 333;
23311    t.cedilla = 333;
23312    t.hungarumlaut = 333;
23313    t.ogonek = 333;
23314    t.caron = 333;
23315    t.emdash = 1000;
23316    t.AE = 1000;
23317    t.ordfeminine = 300;
23318    t.Lslash = 667;
23319    t.Oslash = 778;
23320    t.OE = 1000;
23321    t.ordmasculine = 330;
23322    t.ae = 722;
23323    t.dotlessi = 278;
23324    t.lslash = 278;
23325    t.oslash = 500;
23326    t.oe = 722;
23327    t.germandbls = 556;
23328    t.Idieresis = 389;
23329    t.eacute = 444;
23330    t.abreve = 500;
23331    t.uhungarumlaut = 556;
23332    t.ecaron = 444;
23333    t.Ydieresis = 722;
23334    t.divide = 570;
23335    t.Yacute = 722;
23336    t.Acircumflex = 722;
23337    t.aacute = 500;
23338    t.Ucircumflex = 722;
23339    t.yacute = 500;
23340    t.scommaaccent = 389;
23341    t.ecircumflex = 444;
23342    t.Uring = 722;
23343    t.Udieresis = 722;
23344    t.aogonek = 500;
23345    t.Uacute = 722;
23346    t.uogonek = 556;
23347    t.Edieresis = 667;
23348    t.Dcroat = 722;
23349    t.commaaccent = 250;
23350    t.copyright = 747;
23351    t.Emacron = 667;
23352    t.ccaron = 444;
23353    t.aring = 500;
23354    t.Ncommaaccent = 722;
23355    t.lacute = 278;
23356    t.agrave = 500;
23357    t.Tcommaaccent = 667;
23358    t.Cacute = 722;
23359    t.atilde = 500;
23360    t.Edotaccent = 667;
23361    t.scaron = 389;
23362    t.scedilla = 389;
23363    t.iacute = 278;
23364    t.lozenge = 494;
23365    t.Rcaron = 722;
23366    t.Gcommaaccent = 778;
23367    t.ucircumflex = 556;
23368    t.acircumflex = 500;
23369    t.Amacron = 722;
23370    t.rcaron = 444;
23371    t.ccedilla = 444;
23372    t.Zdotaccent = 667;
23373    t.Thorn = 611;
23374    t.Omacron = 778;
23375    t.Racute = 722;
23376    t.Sacute = 556;
23377    t.dcaron = 672;
23378    t.Umacron = 722;
23379    t.uring = 556;
23380    t.threesuperior = 300;
23381    t.Ograve = 778;
23382    t.Agrave = 722;
23383    t.Abreve = 722;
23384    t.multiply = 570;
23385    t.uacute = 556;
23386    t.Tcaron = 667;
23387    t.partialdiff = 494;
23388    t.ydieresis = 500;
23389    t.Nacute = 722;
23390    t.icircumflex = 278;
23391    t.Ecircumflex = 667;
23392    t.adieresis = 500;
23393    t.edieresis = 444;
23394    t.cacute = 444;
23395    t.nacute = 556;
23396    t.umacron = 556;
23397    t.Ncaron = 722;
23398    t.Iacute = 389;
23399    t.plusminus = 570;
23400    t.brokenbar = 220;
23401    t.registered = 747;
23402    t.Gbreve = 778;
23403    t.Idotaccent = 389;
23404    t.summation = 600;
23405    t.Egrave = 667;
23406    t.racute = 444;
23407    t.omacron = 500;
23408    t.Zacute = 667;
23409    t.Zcaron = 667;
23410    t.greaterequal = 549;
23411    t.Eth = 722;
23412    t.Ccedilla = 722;
23413    t.lcommaaccent = 278;
23414    t.tcaron = 416;
23415    t.eogonek = 444;
23416    t.Uogonek = 722;
23417    t.Aacute = 722;
23418    t.Adieresis = 722;
23419    t.egrave = 444;
23420    t.zacute = 444;
23421    t.iogonek = 278;
23422    t.Oacute = 778;
23423    t.oacute = 500;
23424    t.amacron = 500;
23425    t.sacute = 389;
23426    t.idieresis = 278;
23427    t.Ocircumflex = 778;
23428    t.Ugrave = 722;
23429    t.Delta = 612;
23430    t.thorn = 556;
23431    t.twosuperior = 300;
23432    t.Odieresis = 778;
23433    t.mu = 556;
23434    t.igrave = 278;
23435    t.ohungarumlaut = 500;
23436    t.Eogonek = 667;
23437    t.dcroat = 556;
23438    t.threequarters = 750;
23439    t.Scedilla = 556;
23440    t.lcaron = 394;
23441    t.Kcommaaccent = 778;
23442    t.Lacute = 667;
23443    t.trademark = 1000;
23444    t.edotaccent = 444;
23445    t.Igrave = 389;
23446    t.Imacron = 389;
23447    t.Lcaron = 667;
23448    t.onehalf = 750;
23449    t.lessequal = 549;
23450    t.ocircumflex = 500;
23451    t.ntilde = 556;
23452    t.Uhungarumlaut = 722;
23453    t.Eacute = 667;
23454    t.emacron = 444;
23455    t.gbreve = 500;
23456    t.onequarter = 750;
23457    t.Scaron = 556;
23458    t.Scommaaccent = 556;
23459    t.Ohungarumlaut = 778;
23460    t.degree = 400;
23461    t.ograve = 500;
23462    t.Ccaron = 722;
23463    t.ugrave = 556;
23464    t.radical = 549;
23465    t.Dcaron = 722;
23466    t.rcommaaccent = 444;
23467    t.Ntilde = 722;
23468    t.otilde = 500;
23469    t.Rcommaaccent = 722;
23470    t.Lcommaaccent = 667;
23471    t.Atilde = 722;
23472    t.Aogonek = 722;
23473    t.Aring = 722;
23474    t.Otilde = 778;
23475    t.zdotaccent = 444;
23476    t.Ecaron = 667;
23477    t.Iogonek = 389;
23478    t.kcommaaccent = 556;
23479    t.minus = 570;
23480    t.Icircumflex = 389;
23481    t.ncaron = 556;
23482    t.tcommaaccent = 333;
23483    t.logicalnot = 570;
23484    t.odieresis = 500;
23485    t.udieresis = 556;
23486    t.notequal = 549;
23487    t.gcommaaccent = 500;
23488    t.eth = 500;
23489    t.zcaron = 444;
23490    t.ncommaaccent = 556;
23491    t.onesuperior = 300;
23492    t.imacron = 278;
23493    t.Euro = 500;
23494  });
23495  t["Times-BoldItalic"] = getLookupTableFactory(function (t) {
23496    t.space = 250;
23497    t.exclam = 389;
23498    t.quotedbl = 555;
23499    t.numbersign = 500;
23500    t.dollar = 500;
23501    t.percent = 833;
23502    t.ampersand = 778;
23503    t.quoteright = 333;
23504    t.parenleft = 333;
23505    t.parenright = 333;
23506    t.asterisk = 500;
23507    t.plus = 570;
23508    t.comma = 250;
23509    t.hyphen = 333;
23510    t.period = 250;
23511    t.slash = 278;
23512    t.zero = 500;
23513    t.one = 500;
23514    t.two = 500;
23515    t.three = 500;
23516    t.four = 500;
23517    t.five = 500;
23518    t.six = 500;
23519    t.seven = 500;
23520    t.eight = 500;
23521    t.nine = 500;
23522    t.colon = 333;
23523    t.semicolon = 333;
23524    t.less = 570;
23525    t.equal = 570;
23526    t.greater = 570;
23527    t.question = 500;
23528    t.at = 832;
23529    t.A = 667;
23530    t.B = 667;
23531    t.C = 667;
23532    t.D = 722;
23533    t.E = 667;
23534    t.F = 667;
23535    t.G = 722;
23536    t.H = 778;
23537    t.I = 389;
23538    t.J = 500;
23539    t.K = 667;
23540    t.L = 611;
23541    t.M = 889;
23542    t.N = 722;
23543    t.O = 722;
23544    t.P = 611;
23545    t.Q = 722;
23546    t.R = 667;
23547    t.S = 556;
23548    t.T = 611;
23549    t.U = 722;
23550    t.V = 667;
23551    t.W = 889;
23552    t.X = 667;
23553    t.Y = 611;
23554    t.Z = 611;
23555    t.bracketleft = 333;
23556    t.backslash = 278;
23557    t.bracketright = 333;
23558    t.asciicircum = 570;
23559    t.underscore = 500;
23560    t.quoteleft = 333;
23561    t.a = 500;
23562    t.b = 500;
23563    t.c = 444;
23564    t.d = 500;
23565    t.e = 444;
23566    t.f = 333;
23567    t.g = 500;
23568    t.h = 556;
23569    t.i = 278;
23570    t.j = 278;
23571    t.k = 500;
23572    t.l = 278;
23573    t.m = 778;
23574    t.n = 556;
23575    t.o = 500;
23576    t.p = 500;
23577    t.q = 500;
23578    t.r = 389;
23579    t.s = 389;
23580    t.t = 278;
23581    t.u = 556;
23582    t.v = 444;
23583    t.w = 667;
23584    t.x = 500;
23585    t.y = 444;
23586    t.z = 389;
23587    t.braceleft = 348;
23588    t.bar = 220;
23589    t.braceright = 348;
23590    t.asciitilde = 570;
23591    t.exclamdown = 389;
23592    t.cent = 500;
23593    t.sterling = 500;
23594    t.fraction = 167;
23595    t.yen = 500;
23596    t.florin = 500;
23597    t.section = 500;
23598    t.currency = 500;
23599    t.quotesingle = 278;
23600    t.quotedblleft = 500;
23601    t.guillemotleft = 500;
23602    t.guilsinglleft = 333;
23603    t.guilsinglright = 333;
23604    t.fi = 556;
23605    t.fl = 556;
23606    t.endash = 500;
23607    t.dagger = 500;
23608    t.daggerdbl = 500;
23609    t.periodcentered = 250;
23610    t.paragraph = 500;
23611    t.bullet = 350;
23612    t.quotesinglbase = 333;
23613    t.quotedblbase = 500;
23614    t.quotedblright = 500;
23615    t.guillemotright = 500;
23616    t.ellipsis = 1000;
23617    t.perthousand = 1000;
23618    t.questiondown = 500;
23619    t.grave = 333;
23620    t.acute = 333;
23621    t.circumflex = 333;
23622    t.tilde = 333;
23623    t.macron = 333;
23624    t.breve = 333;
23625    t.dotaccent = 333;
23626    t.dieresis = 333;
23627    t.ring = 333;
23628    t.cedilla = 333;
23629    t.hungarumlaut = 333;
23630    t.ogonek = 333;
23631    t.caron = 333;
23632    t.emdash = 1000;
23633    t.AE = 944;
23634    t.ordfeminine = 266;
23635    t.Lslash = 611;
23636    t.Oslash = 722;
23637    t.OE = 944;
23638    t.ordmasculine = 300;
23639    t.ae = 722;
23640    t.dotlessi = 278;
23641    t.lslash = 278;
23642    t.oslash = 500;
23643    t.oe = 722;
23644    t.germandbls = 500;
23645    t.Idieresis = 389;
23646    t.eacute = 444;
23647    t.abreve = 500;
23648    t.uhungarumlaut = 556;
23649    t.ecaron = 444;
23650    t.Ydieresis = 611;
23651    t.divide = 570;
23652    t.Yacute = 611;
23653    t.Acircumflex = 667;
23654    t.aacute = 500;
23655    t.Ucircumflex = 722;
23656    t.yacute = 444;
23657    t.scommaaccent = 389;
23658    t.ecircumflex = 444;
23659    t.Uring = 722;
23660    t.Udieresis = 722;
23661    t.aogonek = 500;
23662    t.Uacute = 722;
23663    t.uogonek = 556;
23664    t.Edieresis = 667;
23665    t.Dcroat = 722;
23666    t.commaaccent = 250;
23667    t.copyright = 747;
23668    t.Emacron = 667;
23669    t.ccaron = 444;
23670    t.aring = 500;
23671    t.Ncommaaccent = 722;
23672    t.lacute = 278;
23673    t.agrave = 500;
23674    t.Tcommaaccent = 611;
23675    t.Cacute = 667;
23676    t.atilde = 500;
23677    t.Edotaccent = 667;
23678    t.scaron = 389;
23679    t.scedilla = 389;
23680    t.iacute = 278;
23681    t.lozenge = 494;
23682    t.Rcaron = 667;
23683    t.Gcommaaccent = 722;
23684    t.ucircumflex = 556;
23685    t.acircumflex = 500;
23686    t.Amacron = 667;
23687    t.rcaron = 389;
23688    t.ccedilla = 444;
23689    t.Zdotaccent = 611;
23690    t.Thorn = 611;
23691    t.Omacron = 722;
23692    t.Racute = 667;
23693    t.Sacute = 556;
23694    t.dcaron = 608;
23695    t.Umacron = 722;
23696    t.uring = 556;
23697    t.threesuperior = 300;
23698    t.Ograve = 722;
23699    t.Agrave = 667;
23700    t.Abreve = 667;
23701    t.multiply = 570;
23702    t.uacute = 556;
23703    t.Tcaron = 611;
23704    t.partialdiff = 494;
23705    t.ydieresis = 444;
23706    t.Nacute = 722;
23707    t.icircumflex = 278;
23708    t.Ecircumflex = 667;
23709    t.adieresis = 500;
23710    t.edieresis = 444;
23711    t.cacute = 444;
23712    t.nacute = 556;
23713    t.umacron = 556;
23714    t.Ncaron = 722;
23715    t.Iacute = 389;
23716    t.plusminus = 570;
23717    t.brokenbar = 220;
23718    t.registered = 747;
23719    t.Gbreve = 722;
23720    t.Idotaccent = 389;
23721    t.summation = 600;
23722    t.Egrave = 667;
23723    t.racute = 389;
23724    t.omacron = 500;
23725    t.Zacute = 611;
23726    t.Zcaron = 611;
23727    t.greaterequal = 549;
23728    t.Eth = 722;
23729    t.Ccedilla = 667;
23730    t.lcommaaccent = 278;
23731    t.tcaron = 366;
23732    t.eogonek = 444;
23733    t.Uogonek = 722;
23734    t.Aacute = 667;
23735    t.Adieresis = 667;
23736    t.egrave = 444;
23737    t.zacute = 389;
23738    t.iogonek = 278;
23739    t.Oacute = 722;
23740    t.oacute = 500;
23741    t.amacron = 500;
23742    t.sacute = 389;
23743    t.idieresis = 278;
23744    t.Ocircumflex = 722;
23745    t.Ugrave = 722;
23746    t.Delta = 612;
23747    t.thorn = 500;
23748    t.twosuperior = 300;
23749    t.Odieresis = 722;
23750    t.mu = 576;
23751    t.igrave = 278;
23752    t.ohungarumlaut = 500;
23753    t.Eogonek = 667;
23754    t.dcroat = 500;
23755    t.threequarters = 750;
23756    t.Scedilla = 556;
23757    t.lcaron = 382;
23758    t.Kcommaaccent = 667;
23759    t.Lacute = 611;
23760    t.trademark = 1000;
23761    t.edotaccent = 444;
23762    t.Igrave = 389;
23763    t.Imacron = 389;
23764    t.Lcaron = 611;
23765    t.onehalf = 750;
23766    t.lessequal = 549;
23767    t.ocircumflex = 500;
23768    t.ntilde = 556;
23769    t.Uhungarumlaut = 722;
23770    t.Eacute = 667;
23771    t.emacron = 444;
23772    t.gbreve = 500;
23773    t.onequarter = 750;
23774    t.Scaron = 556;
23775    t.Scommaaccent = 556;
23776    t.Ohungarumlaut = 722;
23777    t.degree = 400;
23778    t.ograve = 500;
23779    t.Ccaron = 667;
23780    t.ugrave = 556;
23781    t.radical = 549;
23782    t.Dcaron = 722;
23783    t.rcommaaccent = 389;
23784    t.Ntilde = 722;
23785    t.otilde = 500;
23786    t.Rcommaaccent = 667;
23787    t.Lcommaaccent = 611;
23788    t.Atilde = 667;
23789    t.Aogonek = 667;
23790    t.Aring = 667;
23791    t.Otilde = 722;
23792    t.zdotaccent = 389;
23793    t.Ecaron = 667;
23794    t.Iogonek = 389;
23795    t.kcommaaccent = 500;
23796    t.minus = 606;
23797    t.Icircumflex = 389;
23798    t.ncaron = 556;
23799    t.tcommaaccent = 278;
23800    t.logicalnot = 606;
23801    t.odieresis = 500;
23802    t.udieresis = 556;
23803    t.notequal = 549;
23804    t.gcommaaccent = 500;
23805    t.eth = 500;
23806    t.zcaron = 389;
23807    t.ncommaaccent = 556;
23808    t.onesuperior = 300;
23809    t.imacron = 278;
23810    t.Euro = 500;
23811  });
23812  t["Times-Italic"] = getLookupTableFactory(function (t) {
23813    t.space = 250;
23814    t.exclam = 333;
23815    t.quotedbl = 420;
23816    t.numbersign = 500;
23817    t.dollar = 500;
23818    t.percent = 833;
23819    t.ampersand = 778;
23820    t.quoteright = 333;
23821    t.parenleft = 333;
23822    t.parenright = 333;
23823    t.asterisk = 500;
23824    t.plus = 675;
23825    t.comma = 250;
23826    t.hyphen = 333;
23827    t.period = 250;
23828    t.slash = 278;
23829    t.zero = 500;
23830    t.one = 500;
23831    t.two = 500;
23832    t.three = 500;
23833    t.four = 500;
23834    t.five = 500;
23835    t.six = 500;
23836    t.seven = 500;
23837    t.eight = 500;
23838    t.nine = 500;
23839    t.colon = 333;
23840    t.semicolon = 333;
23841    t.less = 675;
23842    t.equal = 675;
23843    t.greater = 675;
23844    t.question = 500;
23845    t.at = 920;
23846    t.A = 611;
23847    t.B = 611;
23848    t.C = 667;
23849    t.D = 722;
23850    t.E = 611;
23851    t.F = 611;
23852    t.G = 722;
23853    t.H = 722;
23854    t.I = 333;
23855    t.J = 444;
23856    t.K = 667;
23857    t.L = 556;
vendor: 4,861 bytes, lines 23858-24092
23858    t.M = 833;
23859    t.N = 667;
23860    t.O = 722;
23861    t.P = 611;
23862    t.Q = 722;
23863    t.R = 611;
23864    t.S = 500;
23865    t.T = 556;
23866    t.U = 722;
23867    t.V = 611;
23868    t.W = 833;
23869    t.X = 611;
23870    t.Y = 556;
23871    t.Z = 556;
23872    t.bracketleft = 389;
23873    t.backslash = 278;
23874    t.bracketright = 389;
23875    t.asciicircum = 422;
23876    t.underscore = 500;
23877    t.quoteleft = 333;
23878    t.a = 500;
23879    t.b = 500;
23880    t.c = 444;
23881    t.d = 500;
23882    t.e = 444;
23883    t.f = 278;
23884    t.g = 500;
23885    t.h = 500;
23886    t.i = 278;
23887    t.j = 278;
23888    t.k = 444;
23889    t.l = 278;
23890    t.m = 722;
23891    t.n = 500;
23892    t.o = 500;
23893    t.p = 500;
23894    t.q = 500;
23895    t.r = 389;
23896    t.s = 389;
23897    t.t = 278;
23898    t.u = 500;
23899    t.v = 444;
23900    t.w = 667;
23901    t.x = 444;
23902    t.y = 444;
23903    t.z = 389;
23904    t.braceleft = 400;
23905    t.bar = 275;
23906    t.braceright = 400;
23907    t.asciitilde = 541;
23908    t.exclamdown = 389;
23909    t.cent = 500;
23910    t.sterling = 500;
23911    t.fraction = 167;
23912    t.yen = 500;
23913    t.florin = 500;
23914    t.section = 500;
23915    t.currency = 500;
23916    t.quotesingle = 214;
23917    t.quotedblleft = 556;
23918    t.guillemotleft = 500;
23919    t.guilsinglleft = 333;
23920    t.guilsinglright = 333;
23921    t.fi = 500;
23922    t.fl = 500;
23923    t.endash = 500;
23924    t.dagger = 500;
23925    t.daggerdbl = 500;
23926    t.periodcentered = 250;
23927    t.paragraph = 523;
23928    t.bullet = 350;
23929    t.quotesinglbase = 333;
23930    t.quotedblbase = 556;
23931    t.quotedblright = 556;
23932    t.guillemotright = 500;
23933    t.ellipsis = 889;
23934    t.perthousand = 1000;
23935    t.questiondown = 500;
23936    t.grave = 333;
23937    t.acute = 333;
23938    t.circumflex = 333;
23939    t.tilde = 333;
23940    t.macron = 333;
23941    t.breve = 333;
23942    t.dotaccent = 333;
23943    t.dieresis = 333;
23944    t.ring = 333;
23945    t.cedilla = 333;
23946    t.hungarumlaut = 333;
23947    t.ogonek = 333;
23948    t.caron = 333;
23949    t.emdash = 889;
23950    t.AE = 889;
23951    t.ordfeminine = 276;
23952    t.Lslash = 556;
23953    t.Oslash = 722;
23954    t.OE = 944;
23955    t.ordmasculine = 310;
23956    t.ae = 667;
23957    t.dotlessi = 278;
23958    t.lslash = 278;
23959    t.oslash = 500;
23960    t.oe = 667;
23961    t.germandbls = 500;
23962    t.Idieresis = 333;
23963    t.eacute = 444;
23964    t.abreve = 500;
23965    t.uhungarumlaut = 500;
23966    t.ecaron = 444;
23967    t.Ydieresis = 556;
23968    t.divide = 675;
23969    t.Yacute = 556;
23970    t.Acircumflex = 611;
23971    t.aacute = 500;
23972    t.Ucircumflex = 722;
23973    t.yacute = 444;
23974    t.scommaaccent = 389;
23975    t.ecircumflex = 444;
23976    t.Uring = 722;
23977    t.Udieresis = 722;
23978    t.aogonek = 500;
23979    t.Uacute = 722;
23980    t.uogonek = 500;
23981    t.Edieresis = 611;
23982    t.Dcroat = 722;
23983    t.commaaccent = 250;
23984    t.copyright = 760;
23985    t.Emacron = 611;
23986    t.ccaron = 444;
23987    t.aring = 500;
23988    t.Ncommaaccent = 667;
23989    t.lacute = 278;
23990    t.agrave = 500;
23991    t.Tcommaaccent = 556;
23992    t.Cacute = 667;
23993    t.atilde = 500;
23994    t.Edotaccent = 611;
23995    t.scaron = 389;
23996    t.scedilla = 389;
23997    t.iacute = 278;
23998    t.lozenge = 471;
23999    t.Rcaron = 611;
24000    t.Gcommaaccent = 722;
24001    t.ucircumflex = 500;
24002    t.acircumflex = 500;
24003    t.Amacron = 611;
24004    t.rcaron = 389;
24005    t.ccedilla = 444;
24006    t.Zdotaccent = 556;
24007    t.Thorn = 611;
24008    t.Omacron = 722;
24009    t.Racute = 611;
24010    t.Sacute = 500;
24011    t.dcaron = 544;
24012    t.Umacron = 722;
24013    t.uring = 500;
24014    t.threesuperior = 300;
24015    t.Ograve = 722;
24016    t.Agrave = 611;
24017    t.Abreve = 611;
24018    t.multiply = 675;
24019    t.uacute = 500;
24020    t.Tcaron = 556;
24021    t.partialdiff = 476;
24022    t.ydieresis = 444;
24023    t.Nacute = 667;
24024    t.icircumflex = 278;
24025    t.Ecircumflex = 611;
24026    t.adieresis = 500;
24027    t.edieresis = 444;
24028    t.cacute = 444;
24029    t.nacute = 500;
24030    t.umacron = 500;
24031    t.Ncaron = 667;
24032    t.Iacute = 333;
24033    t.plusminus = 675;
24034    t.brokenbar = 275;
24035    t.registered = 760;
24036    t.Gbreve = 722;
24037    t.Idotaccent = 333;
24038    t.summation = 600;
24039    t.Egrave = 611;
24040    t.racute = 389;
24041    t.omacron = 500;
24042    t.Zacute = 556;
24043    t.Zcaron = 556;
24044    t.greaterequal = 549;
24045    t.Eth = 722;
24046    t.Ccedilla = 667;
24047    t.lcommaaccent = 278;
24048    t.tcaron = 300;
24049    t.eogonek = 444;
24050    t.Uogonek = 722;
24051    t.Aacute = 611;
24052    t.Adieresis = 611;
24053    t.egrave = 444;
24054    t.zacute = 389;
24055    t.iogonek = 278;
24056    t.Oacute = 722;
24057    t.oacute = 500;
24058    t.amacron = 500;
24059    t.sacute = 389;
24060    t.idieresis = 278;
24061    t.Ocircumflex = 722;
24062    t.Ugrave = 722;
24063    t.Delta = 612;
24064    t.thorn = 500;
24065    t.twosuperior = 300;
24066    t.Odieresis = 722;
24067    t.mu = 500;
24068    t.igrave = 278;
24069    t.ohungarumlaut = 500;
24070    t.Eogonek = 611;
24071    t.dcroat = 500;
24072    t.threequarters = 750;
24073    t.Scedilla = 500;
24074    t.lcaron = 300;
24075    t.Kcommaaccent = 667;
24076    t.Lacute = 556;
24077    t.trademark = 980;
24078    t.edotaccent = 444;
24079    t.Igrave = 333;
24080    t.Imacron = 333;
24081    t.Lcaron = 611;
24082    t.onehalf = 750;
24083    t.lessequal = 549;
24084    t.ocircumflex = 500;
24085    t.ntilde = 500;
24086    t.Uhungarumlaut = 722;
24087    t.Eacute = 611;
24088    t.emacron = 444;
24089    t.gbreve = 500;
24090    t.onequarter = 750;
24091    t.Scaron = 500;
24092    t.Scommaaccent = 500;
vendor: 5,928 bytes, lines 24093-24421
24093    t.Ohungarumlaut = 722;
24094    t.degree = 400;
24095    t.ograve = 500;
24096    t.Ccaron = 667;
24097    t.ugrave = 500;
24098    t.radical = 453;
24099    t.Dcaron = 722;
24100    t.rcommaaccent = 389;
24101    t.Ntilde = 667;
24102    t.otilde = 500;
24103    t.Rcommaaccent = 611;
24104    t.Lcommaaccent = 556;
24105    t.Atilde = 611;
24106    t.Aogonek = 611;
24107    t.Aring = 611;
24108    t.Otilde = 722;
24109    t.zdotaccent = 389;
24110    t.Ecaron = 611;
24111    t.Iogonek = 333;
24112    t.kcommaaccent = 444;
24113    t.minus = 675;
24114    t.Icircumflex = 333;
24115    t.ncaron = 500;
24116    t.tcommaaccent = 278;
24117    t.logicalnot = 675;
24118    t.odieresis = 500;
24119    t.udieresis = 500;
24120    t.notequal = 549;
24121    t.gcommaaccent = 500;
24122    t.eth = 500;
24123    t.zcaron = 389;
24124    t.ncommaaccent = 500;
24125    t.onesuperior = 300;
24126    t.imacron = 278;
24127    t.Euro = 500;
24128  });
24129  t.ZapfDingbats = getLookupTableFactory(function (t) {
24130    t.space = 278;
24131    t.a1 = 974;
24132    t.a2 = 961;
24133    t.a202 = 974;
24134    t.a3 = 980;
24135    t.a4 = 719;
24136    t.a5 = 789;
24137    t.a119 = 790;
24138    t.a118 = 791;
24139    t.a117 = 690;
24140    t.a11 = 960;
24141    t.a12 = 939;
24142    t.a13 = 549;
24143    t.a14 = 855;
24144    t.a15 = 911;
24145    t.a16 = 933;
24146    t.a105 = 911;
24147    t.a17 = 945;
24148    t.a18 = 974;
24149    t.a19 = 755;
24150    t.a20 = 846;
24151    t.a21 = 762;
24152    t.a22 = 761;
24153    t.a23 = 571;
24154    t.a24 = 677;
24155    t.a25 = 763;
24156    t.a26 = 760;
24157    t.a27 = 759;
24158    t.a28 = 754;
24159    t.a6 = 494;
24160    t.a7 = 552;
24161    t.a8 = 537;
24162    t.a9 = 577;
24163    t.a10 = 692;
24164    t.a29 = 786;
24165    t.a30 = 788;
24166    t.a31 = 788;
24167    t.a32 = 790;
24168    t.a33 = 793;
24169    t.a34 = 794;
24170    t.a35 = 816;
24171    t.a36 = 823;
24172    t.a37 = 789;
24173    t.a38 = 841;
24174    t.a39 = 823;
24175    t.a40 = 833;
24176    t.a41 = 816;
24177    t.a42 = 831;
24178    t.a43 = 923;
24179    t.a44 = 744;
24180    t.a45 = 723;
24181    t.a46 = 749;
24182    t.a47 = 790;
24183    t.a48 = 792;
24184    t.a49 = 695;
24185    t.a50 = 776;
24186    t.a51 = 768;
24187    t.a52 = 792;
24188    t.a53 = 759;
24189    t.a54 = 707;
24190    t.a55 = 708;
24191    t.a56 = 682;
24192    t.a57 = 701;
24193    t.a58 = 826;
24194    t.a59 = 815;
24195    t.a60 = 789;
24196    t.a61 = 789;
24197    t.a62 = 707;
24198    t.a63 = 687;
24199    t.a64 = 696;
24200    t.a65 = 689;
24201    t.a66 = 786;
24202    t.a67 = 787;
24203    t.a68 = 713;
24204    t.a69 = 791;
24205    t.a70 = 785;
24206    t.a71 = 791;
24207    t.a72 = 873;
24208    t.a73 = 761;
24209    t.a74 = 762;
24210    t.a203 = 762;
24211    t.a75 = 759;
24212    t.a204 = 759;
24213    t.a76 = 892;
24214    t.a77 = 892;
24215    t.a78 = 788;
24216    t.a79 = 784;
24217    t.a81 = 438;
24218    t.a82 = 138;
24219    t.a83 = 277;
24220    t.a84 = 415;
24221    t.a97 = 392;
24222    t.a98 = 392;
24223    t.a99 = 668;
24224    t.a100 = 668;
24225    t.a89 = 390;
24226    t.a90 = 390;
24227    t.a93 = 317;
24228    t.a94 = 317;
24229    t.a91 = 276;
24230    t.a92 = 276;
24231    t.a205 = 509;
24232    t.a85 = 509;
24233    t.a206 = 410;
24234    t.a86 = 410;
24235    t.a87 = 234;
24236    t.a88 = 234;
24237    t.a95 = 334;
24238    t.a96 = 334;
24239    t.a101 = 732;
24240    t.a102 = 544;
24241    t.a103 = 544;
24242    t.a104 = 910;
24243    t.a106 = 667;
24244    t.a107 = 760;
24245    t.a108 = 760;
24246    t.a112 = 776;
24247    t.a111 = 595;
24248    t.a110 = 694;
24249    t.a109 = 626;
24250    t.a120 = 788;
24251    t.a121 = 788;
24252    t.a122 = 788;
24253    t.a123 = 788;
24254    t.a124 = 788;
24255    t.a125 = 788;
24256    t.a126 = 788;
24257    t.a127 = 788;
24258    t.a128 = 788;
24259    t.a129 = 788;
24260    t.a130 = 788;
24261    t.a131 = 788;
24262    t.a132 = 788;
24263    t.a133 = 788;
24264    t.a134 = 788;
24265    t.a135 = 788;
24266    t.a136 = 788;
24267    t.a137 = 788;
24268    t.a138 = 788;
24269    t.a139 = 788;
24270    t.a140 = 788;
24271    t.a141 = 788;
24272    t.a142 = 788;
24273    t.a143 = 788;
24274    t.a144 = 788;
24275    t.a145 = 788;
24276    t.a146 = 788;
24277    t.a147 = 788;
24278    t.a148 = 788;
24279    t.a149 = 788;
24280    t.a150 = 788;
24281    t.a151 = 788;
24282    t.a152 = 788;
24283    t.a153 = 788;
24284    t.a154 = 788;
24285    t.a155 = 788;
24286    t.a156 = 788;
24287    t.a157 = 788;
24288    t.a158 = 788;
24289    t.a159 = 788;
24290    t.a160 = 894;
24291    t.a161 = 838;
24292    t.a163 = 1016;
24293    t.a164 = 458;
24294    t.a196 = 748;
24295    t.a165 = 924;
24296    t.a192 = 748;
24297    t.a166 = 918;
24298    t.a167 = 927;
24299    t.a168 = 928;
24300    t.a169 = 928;
24301    t.a170 = 834;
24302    t.a171 = 873;
24303    t.a172 = 828;
24304    t.a173 = 924;
24305    t.a162 = 924;
24306    t.a174 = 917;
24307    t.a175 = 930;
24308    t.a176 = 931;
24309    t.a177 = 463;
24310    t.a178 = 883;
24311    t.a179 = 836;
24312    t.a193 = 836;
24313    t.a180 = 867;
24314    t.a199 = 867;
24315    t.a181 = 696;
24316    t.a200 = 696;
24317    t.a182 = 874;
24318    t.a201 = 874;
24319    t.a183 = 760;
24320    t.a184 = 946;
24321    t.a197 = 771;
24322    t.a185 = 865;
24323    t.a194 = 771;
24324    t.a198 = 888;
24325    t.a186 = 967;
24326    t.a195 = 888;
24327    t.a187 = 831;
24328    t.a188 = 873;
24329    t.a189 = 927;
24330    t.a190 = 970;
24331    t.a191 = 918;
24332  });
24333});
24334const getFontBasicMetrics = getLookupTableFactory(function (t) {
24335  t.Courier = {
24336    ascent: 629,
24337    descent: -157,
24338    capHeight: 562,
24339    xHeight: -426
24340  };
24341  t["Courier-Bold"] = {
24342    ascent: 629,
24343    descent: -157,
24344    capHeight: 562,
24345    xHeight: 439
24346  };
24347  t["Courier-Oblique"] = {
24348    ascent: 629,
24349    descent: -157,
24350    capHeight: 562,
24351    xHeight: 426
24352  };
24353  t["Courier-BoldOblique"] = {
24354    ascent: 629,
24355    descent: -157,
24356    capHeight: 562,
24357    xHeight: 426
24358  };
24359  t.Helvetica = {
24360    ascent: 718,
24361    descent: -207,
24362    capHeight: 718,
24363    xHeight: 523
24364  };
24365  t["Helvetica-Bold"] = {
24366    ascent: 718,
24367    descent: -207,
24368    capHeight: 718,
24369    xHeight: 532
24370  };
24371  t["Helvetica-Oblique"] = {
24372    ascent: 718,
24373    descent: -207,
24374    capHeight: 718,
24375    xHeight: 523
24376  };
24377  t["Helvetica-BoldOblique"] = {
24378    ascent: 718,
24379    descent: -207,
24380    capHeight: 718,
24381    xHeight: 532
24382  };
24383  t["Times-Roman"] = {
24384    ascent: 683,
24385    descent: -217,
24386    capHeight: 662,
24387    xHeight: 450
24388  };
24389  t["Times-Bold"] = {
24390    ascent: 683,
24391    descent: -217,
24392    capHeight: 676,
24393    xHeight: 461
24394  };
24395  t["Times-Italic"] = {
24396    ascent: 683,
24397    descent: -217,
24398    capHeight: 653,
24399    xHeight: 441
24400  };
24401  t["Times-BoldItalic"] = {
24402    ascent: 683,
24403    descent: -217,
24404    capHeight: 669,
24405    xHeight: 462
24406  };
24407  t.Symbol = {
24408    ascent: Math.NaN,
24409    descent: Math.NaN,
24410    capHeight: Math.NaN,
24411    xHeight: Math.NaN
24412  };
24413  t.ZapfDingbats = {
24414    ascent: Math.NaN,
24415    descent: Math.NaN,
24416    capHeight: Math.NaN,
24417    xHeight: Math.NaN
24418  };
24419});
24420
24421;// ./src/core/
vendor: 4,863 bytes, lines 24421-24600
24421glyf.js
24422const ON_CURVE_POINT = 1 << 0;
24423const X_SHORT_VECTOR = 1 << 1;
24424const Y_SHORT_VECTOR = 1 << 2;
24425const REPEAT_FLAG = 1 << 3;
24426const X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR = 1 << 4;
24427const Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR = 1 << 5;
24428const OVERLAP_SIMPLE = 1 << 6;
24429const ARG_1_AND_2_ARE_WORDS = 1 << 0;
24430const ARGS_ARE_XY_VALUES = 1 << 1;
24431const WE_HAVE_A_SCALE = 1 << 3;
24432const MORE_COMPONENTS = 1 << 5;
24433const WE_HAVE_AN_X_AND_Y_SCALE = 1 << 6;
24434const WE_HAVE_A_TWO_BY_TWO = 1 << 7;
24435const WE_HAVE_INSTRUCTIONS = 1 << 8;
24436class GlyfTable {
24437  constructor({
24438    glyfTable,
24439    isGlyphLocationsLong,
24440    locaTable,
24441    numGlyphs
24442  }) {
24443    this.glyphs = [];
24444    const loca = new DataView(locaTable.buffer, locaTable.byteOffset, locaTable.byteLength);
24445    const glyf = new DataView(glyfTable.buffer, glyfTable.byteOffset, glyfTable.byteLength);
24446    const offsetSize = isGlyphLocationsLong ? 4 : 2;
24447    let prev = isGlyphLocationsLong ? loca.getUint32(0) : 2 * loca.getUint16(0);
24448    let pos = 0;
24449    for (let i = 0; i < numGlyphs; i++) {
24450      pos += offsetSize;
24451      const next = isGlyphLocationsLong ? loca.getUint32(pos) : 2 * loca.getUint16(pos);
24452      if (next === prev) {
24453        this.glyphs.push(new Glyph({}));
24454        continue;
24455      }
24456      const glyph = Glyph.parse(prev, glyf);
24457      this.glyphs.push(glyph);
24458      prev = next;
24459    }
24460  }
24461  getSize() {
24462    return Math.sumPrecise(this.glyphs.map(g => g.getSize() + 3 & ~3));
24463  }
24464  write() {
24465    const totalSize = this.getSize();
24466    const glyfTable = new DataView(new ArrayBuffer(totalSize));
24467    const isLocationLong = totalSize > 0x1fffe;
24468    const offsetSize = isLocationLong ? 4 : 2;
24469    const locaTable = new DataView(new ArrayBuffer((this.glyphs.length + 1) * offsetSize));
24470    if (isLocationLong) {
24471      locaTable.setUint32(0, 0);
24472    } else {
24473      locaTable.setUint16(0, 0);
24474    }
24475    let pos = 0;
24476    let locaIndex = 0;
24477    for (const glyph of this.glyphs) {
24478      pos += glyph.write(pos, glyfTable);
24479      pos = pos + 3 & ~3;
24480      locaIndex += offsetSize;
24481      if (isLocationLong) {
24482        locaTable.setUint32(locaIndex, pos);
24483      } else {
24484        locaTable.setUint16(locaIndex, pos >> 1);
24485      }
24486    }
24487    return {
24488      isLocationLong,
24489      loca: new Uint8Array(locaTable.buffer),
24490      glyf: new Uint8Array(glyfTable.buffer)
24491    };
24492  }
24493  scale(factors) {
24494    for (let i = 0, ii = this.glyphs.length; i < ii; i++) {
24495      this.glyphs[i].scale(factors[i]);
24496    }
24497  }
24498}
24499class Glyph {
24500  constructor({
24501    header = null,
24502    simple = null,
24503    composites = null
24504  }) {
24505    this.header = header;
24506    this.simple = simple;
24507    this.composites = composites;
24508  }
24509  static parse(pos, glyf) {
24510    const [read, header] = GlyphHeader.parse(pos, glyf);
24511    pos += read;
24512    if (header.numberOfContours < 0) {
24513      const composites = [];
24514      while (true) {
24515        const [n, composite] = CompositeGlyph.parse(pos, glyf);
24516        pos += n;
24517        composites.push(composite);
24518        if (!(composite.flags & MORE_COMPONENTS)) {
24519          break;
24520        }
24521      }
24522      return new Glyph({
24523        header,
24524        composites
24525      });
24526    }
24527    const simple = SimpleGlyph.parse(pos, glyf, header.numberOfContours);
24528    return new Glyph({
24529      header,
24530      simple
24531    });
24532  }
24533  getSize() {
24534    if (!this.header) {
24535      return 0;
24536    }
24537    const size = this.simple ? this.simple.getSize() : Math.sumPrecise(this.composites.map(c => c.getSize()));
24538    return this.header.getSize() + size;
24539  }
24540  write(pos, buf) {
24541    if (!this.header) {
24542      return 0;
24543    }
24544    const spos = pos;
24545    pos += this.header.write(pos, buf);
24546    if (this.simple) {
24547      pos += this.simple.write(pos, buf);
24548    } else {
24549      for (const composite of this.composites) {
24550        pos += composite.write(pos, buf);
24551      }
24552    }
24553    return pos - spos;
24554  }
24555  scale(factor) {
24556    if (!this.header) {
24557      return;
24558    }
24559    const xMiddle = (this.header.xMin + this.header.xMax) / 2;
24560    this.header.scale(xMiddle, factor);
24561    if (this.simple) {
24562      this.simple.scale(xMiddle, factor);
24563    } else {
24564      for (const composite of this.composites) {
24565        composite.scale(xMiddle, factor);
24566      }
24567    }
24568  }
24569}
24570class GlyphHeader {
24571  constructor({
24572    numberOfContours,
24573    xMin,
24574    yMin,
24575    xMax,
24576    yMax
24577  }) {
24578    this.numberOfContours = numberOfContours;
24579    this.xMin = xMin;
24580    this.yMin = yMin;
24581    this.xMax = xMax;
24582    this.yMax = yMax;
24583  }
24584  static parse(pos, glyf) {
24585    return [10, new GlyphHeader({
24586      numberOfContours: glyf.getInt16(pos),
24587      xMin: glyf.getInt16(pos + 2),
24588      yMin: glyf.getInt16(pos + 4),
24589      xMax: glyf.getInt16(pos + 6),
24590      yMax: glyf.getInt16(pos + 8)
24591    })];
24592  }
24593  getSize() {
24594    return 10;
24595  }
24596  write(pos, buf) {
24597    buf.setInt16(pos, this.numberOfContours);
24598    buf.setInt16(pos + 2, this.xMin);
24599    buf.setInt16(pos + 4, this.yMin);
24600    buf.setInt16(pos + 6, this.xMax);
vendor: 16,672 bytes, lines 24601-25165
24601    buf.setInt16(pos + 8, this.yMax);
24602    return 10;
24603  }
24604  scale(x, factor) {
24605    this.xMin = Math.round(x + (this.xMin - x) * factor);
24606    this.xMax = Math.round(x + (this.xMax - x) * factor);
24607  }
24608}
24609class Contour {
24610  constructor({
24611    flags,
24612    xCoordinates,
24613    yCoordinates
24614  }) {
24615    this.xCoordinates = xCoordinates;
24616    this.yCoordinates = yCoordinates;
24617    this.flags = flags;
24618  }
24619}
24620class SimpleGlyph {
24621  constructor({
24622    contours,
24623    instructions
24624  }) {
24625    this.contours = contours;
24626    this.instructions = instructions;
24627  }
24628  static parse(pos, glyf, numberOfContours) {
24629    const endPtsOfContours = [];
24630    for (let i = 0; i < numberOfContours; i++) {
24631      const endPt = glyf.getUint16(pos);
24632      pos += 2;
24633      endPtsOfContours.push(endPt);
24634    }
24635    const numberOfPt = endPtsOfContours[numberOfContours - 1] + 1;
24636    const instructionLength = glyf.getUint16(pos);
24637    pos += 2;
24638    const instructions = new Uint8Array(glyf).slice(pos, pos + instructionLength);
24639    pos += instructionLength;
24640    const flags = [];
24641    for (let i = 0; i < numberOfPt; pos++, i++) {
24642      let flag = glyf.getUint8(pos);
24643      flags.push(flag);
24644      if (flag & REPEAT_FLAG) {
24645        const count = glyf.getUint8(++pos);
24646        flag ^= REPEAT_FLAG;
24647        for (let m = 0; m < count; m++) {
24648          flags.push(flag);
24649        }
24650        i += count;
24651      }
24652    }
24653    const allXCoordinates = [];
24654    let xCoordinates = [];
24655    let yCoordinates = [];
24656    let pointFlags = [];
24657    const contours = [];
24658    let endPtsOfContoursIndex = 0;
24659    let lastCoordinate = 0;
24660    for (let i = 0; i < numberOfPt; i++) {
24661      const flag = flags[i];
24662      if (flag & X_SHORT_VECTOR) {
24663        const x = glyf.getUint8(pos++);
24664        lastCoordinate += flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR ? x : -x;
24665        xCoordinates.push(lastCoordinate);
24666      } else if (flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR) {
24667        xCoordinates.push(lastCoordinate);
24668      } else {
24669        lastCoordinate += glyf.getInt16(pos);
24670        pos += 2;
24671        xCoordinates.push(lastCoordinate);
24672      }
24673      if (endPtsOfContours[endPtsOfContoursIndex] === i) {
24674        endPtsOfContoursIndex++;
24675        allXCoordinates.push(xCoordinates);
24676        xCoordinates = [];
24677      }
24678    }
24679    lastCoordinate = 0;
24680    endPtsOfContoursIndex = 0;
24681    for (let i = 0; i < numberOfPt; i++) {
24682      const flag = flags[i];
24683      if (flag & Y_SHORT_VECTOR) {
24684        const y = glyf.getUint8(pos++);
24685        lastCoordinate += flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR ? y : -y;
24686        yCoordinates.push(lastCoordinate);
24687      } else if (flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR) {
24688        yCoordinates.push(lastCoordinate);
24689      } else {
24690        lastCoordinate += glyf.getInt16(pos);
24691        pos += 2;
24692        yCoordinates.push(lastCoordinate);
24693      }
24694      pointFlags.push(flag & ON_CURVE_POINT | flag & OVERLAP_SIMPLE);
24695      if (endPtsOfContours[endPtsOfContoursIndex] === i) {
24696        xCoordinates = allXCoordinates[endPtsOfContoursIndex];
24697        endPtsOfContoursIndex++;
24698        contours.push(new Contour({
24699          flags: pointFlags,
24700          xCoordinates,
24701          yCoordinates
24702        }));
24703        yCoordinates = [];
24704        pointFlags = [];
24705      }
24706    }
24707    return new SimpleGlyph({
24708      contours,
24709      instructions
24710    });
24711  }
24712  getSize() {
24713    let size = this.contours.length * 2 + 2 + this.instructions.length;
24714    let lastX = 0;
24715    let lastY = 0;
24716    for (const contour of this.contours) {
24717      size += contour.flags.length;
24718      for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
24719        const x = contour.xCoordinates[i];
24720        const y = contour.yCoordinates[i];
24721        let abs = Math.abs(x - lastX);
24722        if (abs > 255) {
24723          size += 2;
24724        } else if (abs > 0) {
24725          size += 1;
24726        }
24727        lastX = x;
24728        abs = Math.abs(y - lastY);
24729        if (abs > 255) {
24730          size += 2;
24731        } else if (abs > 0) {
24732          size += 1;
24733        }
24734        lastY = y;
24735      }
24736    }
24737    return size;
24738  }
24739  write(pos, buf) {
24740    const spos = pos;
24741    const xCoordinates = [];
24742    const yCoordinates = [];
24743    const flags = [];
24744    let lastX = 0;
24745    let lastY = 0;
24746    for (const contour of this.contours) {
24747      for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
24748        let flag = contour.flags[i];
24749        const x = contour.xCoordinates[i];
24750        let delta = x - lastX;
24751        if (delta === 0) {
24752          flag |= X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR;
24753          xCoordinates.push(0);
24754        } else {
24755          const abs = Math.abs(delta);
24756          if (abs <= 255) {
24757            flag |= delta >= 0 ? X_SHORT_VECTOR | X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR : X_SHORT_VECTOR;
24758            xCoordinates.push(abs);
24759          } else {
24760            xCoordinates.push(delta);
24761          }
24762        }
24763        lastX = x;
24764        const y = contour.yCoordinates[i];
24765        delta = y - lastY;
24766        if (delta === 0) {
24767          flag |= Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR;
24768          yCoordinates.push(0);
24769        } else {
24770          const abs = Math.abs(delta);
24771          if (abs <= 255) {
24772            flag |= delta >= 0 ? Y_SHORT_VECTOR | Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR : Y_SHORT_VECTOR;
24773            yCoordinates.push(abs);
24774          } else {
24775            yCoordinates.push(delta);
24776          }
24777        }
24778        lastY = y;
24779        flags.push(flag);
24780      }
24781      buf.setUint16(pos, xCoordinates.length - 1);
24782      pos += 2;
24783    }
24784    buf.setUint16(pos, this.instructions.length);
24785    pos += 2;
24786    if (this.instructions.length) {
24787      new Uint8Array(buf.buffer, 0, buf.buffer.byteLength).set(this.instructions, pos);
24788      pos += this.instructions.length;
24789    }
24790    for (const flag of flags) {
24791      buf.setUint8(pos++, flag);
24792    }
24793    for (let i = 0, ii = xCoordinates.length; i < ii; i++) {
24794      const x = xCoordinates[i];
24795      const flag = flags[i];
24796      if (flag & X_SHORT_VECTOR) {
24797        buf.setUint8(pos++, x);
24798      } else if (!(flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR)) {
24799        buf.setInt16(pos, x);
24800        pos += 2;
24801      }
24802    }
24803    for (let i = 0, ii = yCoordinates.length; i < ii; i++) {
24804      const y = yCoordinates[i];
24805      const flag = flags[i];
24806      if (flag & Y_SHORT_VECTOR) {
24807        buf.setUint8(pos++, y);
24808      } else if (!(flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR)) {
24809        buf.setInt16(pos, y);
24810        pos += 2;
24811      }
24812    }
24813    return pos - spos;
24814  }
24815  scale(x, factor) {
24816    for (const contour of this.contours) {
24817      if (contour.xCoordinates.length === 0) {
24818        continue;
24819      }
24820      for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
24821        contour.xCoordinates[i] = Math.round(x + (contour.xCoordinates[i] - x) * factor);
24822      }
24823    }
24824  }
24825}
24826class CompositeGlyph {
24827  constructor({
24828    flags,
24829    glyphIndex,
24830    argument1,
24831    argument2,
24832    transf,
24833    instructions
24834  }) {
24835    this.flags = flags;
24836    this.glyphIndex = glyphIndex;
24837    this.argument1 = argument1;
24838    this.argument2 = argument2;
24839    this.transf = transf;
24840    this.instructions = instructions;
24841  }
24842  static parse(pos, glyf) {
24843    const spos = pos;
24844    const transf = [];
24845    let flags = glyf.getUint16(pos);
24846    const glyphIndex = glyf.getUint16(pos + 2);
24847    pos += 4;
24848    let argument1, argument2;
24849    if (flags & ARG_1_AND_2_ARE_WORDS) {
24850      if (flags & ARGS_ARE_XY_VALUES) {
24851        argument1 = glyf.getInt16(pos);
24852        argument2 = glyf.getInt16(pos + 2);
24853      } else {
24854        argument1 = glyf.getUint16(pos);
24855        argument2 = glyf.getUint16(pos + 2);
24856      }
24857      pos += 4;
24858      flags ^= ARG_1_AND_2_ARE_WORDS;
24859    } else {
24860      if (flags & ARGS_ARE_XY_VALUES) {
24861        argument1 = glyf.getInt8(pos);
24862        argument2 = glyf.getInt8(pos + 1);
24863      } else {
24864        argument1 = glyf.getUint8(pos);
24865        argument2 = glyf.getUint8(pos + 1);
24866      }
24867      pos += 2;
24868    }
24869    if (flags & WE_HAVE_A_SCALE) {
24870      transf.push(glyf.getUint16(pos));
24871      pos += 2;
24872    } else if (flags & WE_HAVE_AN_X_AND_Y_SCALE) {
24873      transf.push(glyf.getUint16(pos), glyf.getUint16(pos + 2));
24874      pos += 4;
24875    } else if (flags & WE_HAVE_A_TWO_BY_TWO) {
24876      transf.push(glyf.getUint16(pos), glyf.getUint16(pos + 2), glyf.getUint16(pos + 4), glyf.getUint16(pos + 6));
24877      pos += 8;
24878    }
24879    let instructions = null;
24880    if (flags & WE_HAVE_INSTRUCTIONS) {
24881      const instructionLength = glyf.getUint16(pos);
24882      pos += 2;
24883      instructions = new Uint8Array(glyf).slice(pos, pos + instructionLength);
24884      pos += instructionLength;
24885    }
24886    return [pos - spos, new CompositeGlyph({
24887      flags,
24888      glyphIndex,
24889      argument1,
24890      argument2,
24891      transf,
24892      instructions
24893    })];
24894  }
24895  getSize() {
24896    let size = 2 + 2 + this.transf.length * 2;
24897    if (this.flags & WE_HAVE_INSTRUCTIONS) {
24898      size += 2 + this.instructions.length;
24899    }
24900    size += 2;
24901    if (this.flags & 2) {
24902      if (!(this.argument1 >= -128 && this.argument1 <= 127 && this.argument2 >= -128 && this.argument2 <= 127)) {
24903        size += 2;
24904      }
24905    } else if (!(this.argument1 >= 0 && this.argument1 <= 255 && this.argument2 >= 0 && this.argument2 <= 255)) {
24906      size += 2;
24907    }
24908    return size;
24909  }
24910  write(pos, buf) {
24911    const spos = pos;
24912    if (this.flags & ARGS_ARE_XY_VALUES) {
24913      if (!(this.argument1 >= -128 && this.argument1 <= 127 && this.argument2 >= -128 && this.argument2 <= 127)) {
24914        this.flags |= ARG_1_AND_2_ARE_WORDS;
24915      }
24916    } else if (!(this.argument1 >= 0 && this.argument1 <= 255 && this.argument2 >= 0 && this.argument2 <= 255)) {
24917      this.flags |= ARG_1_AND_2_ARE_WORDS;
24918    }
24919    buf.setUint16(pos, this.flags);
24920    buf.setUint16(pos + 2, this.glyphIndex);
24921    pos += 4;
24922    if (this.flags & ARG_1_AND_2_ARE_WORDS) {
24923      if (this.flags & ARGS_ARE_XY_VALUES) {
24924        buf.setInt16(pos, this.argument1);
24925        buf.setInt16(pos + 2, this.argument2);
24926      } else {
24927        buf.setUint16(pos, this.argument1);
24928        buf.setUint16(pos + 2, this.argument2);
24929      }
24930      pos += 4;
24931    } else {
24932      buf.setUint8(pos, this.argument1);
24933      buf.setUint8(pos + 1, this.argument2);
24934      pos += 2;
24935    }
24936    if (this.flags & WE_HAVE_INSTRUCTIONS) {
24937      buf.setUint16(pos, this.instructions.length);
24938      pos += 2;
24939      if (this.instructions.length) {
24940        new Uint8Array(buf.buffer, 0, buf.buffer.byteLength).set(this.instructions, pos);
24941        pos += this.instructions.length;
24942      }
24943    }
24944    return pos - spos;
24945  }
24946  scale(x, factor) {}
24947}
24948
24949;// ./src/core/opentype_file_builder.js
24950
24951const OTF_HEADER_SIZE = 12;
24952const OTF_TABLE_ENTRY_SIZE = 16;
24953class OpenTypeFileBuilder {
24954  #tables = new Map();
24955  constructor(sfnt) {
24956    this.sfnt = sfnt;
24957  }
24958  static getSearchParams(entriesCount, entrySize) {
24959    let maxPower2 = 1,
24960      log2 = 0;
24961    while ((maxPower2 ^ entriesCount) > maxPower2) {
24962      maxPower2 <<= 1;
24963      log2++;
24964    }
24965    const searchRange = maxPower2 * entrySize;
24966    return {
24967      range: searchRange,
24968      entry: log2,
24969      rangeShift: entrySize * entriesCount - searchRange
24970    };
24971  }
24972  toArray() {
24973    let sfnt = this.sfnt;
24974    const tables = this.#tables;
24975    const tablesNames = [...tables.keys()].sort();
24976    const numTables = tablesNames.length;
24977    let offset = OTF_HEADER_SIZE + numTables * OTF_TABLE_ENTRY_SIZE;
24978    const tableOffsets = [offset];
24979    for (let i = 0; i < numTables; i++) {
24980      const table = tables.get(tablesNames[i]);
24981      const paddedLength = (table.length + 3 & ~3) >>> 0;
24982      offset += paddedLength;
24983      tableOffsets.push(offset);
24984    }
24985    const file = new Uint8Array(offset),
24986      view = new DataView(file.buffer);
24987    for (let i = 0; i < numTables; i++) {
24988      const table = tables.get(tablesNames[i]);
24989      file.set(table, tableOffsets[i]);
24990    }
24991    if (sfnt === "true") {
24992      sfnt = "\x00\x01\x00\x00";
24993    }
24994    file.set(stringToBytes(sfnt), 0);
24995    view.setInt16(4, numTables);
24996    const searchParams = OpenTypeFileBuilder.getSearchParams(numTables, 16);
24997    view.setInt16(6, searchParams.range);
24998    view.setInt16(8, searchParams.entry);
24999    view.setInt16(10, searchParams.rangeShift);
25000    offset = OTF_HEADER_SIZE;
25001    for (let i = 0; i < numTables; i++) {
25002      const tableName = tablesNames[i];
25003      file.set(stringToBytes(tableName), offset);
25004      let checksum = 0;
25005      for (let j = tableOffsets[i], jj = tableOffsets[i + 1]; j < jj; j += 4) {
25006        const quad = view.getUint32(j);
25007        checksum = checksum + quad >>> 0;
25008      }
25009      view.setInt32(offset + 4, checksum);
25010      view.setInt32(offset + 8, tableOffsets[i]);
25011      view.setInt32(offset + 12, tables.get(tableName).length);
25012      offset += OTF_TABLE_ENTRY_SIZE;
25013    }
25014    this.#tables.clear();
25015    return file;
25016  }
25017  addTable(tag, data) {
25018    if (this.#tables.has(tag)) {
25019      throw new Error(`Table ${tag} already exists`);
25020    }
25021    this.#tables.set(tag, data);
25022  }
25023}
25024
25025;// ./src/core/type1_parser.js
25026
25027
25028
25029
25030const HINTING_ENABLED = false;
25031const COMMAND_MAP = {
25032  hstem: [1],
25033  vstem: [3],
25034  vmoveto: [4],
25035  rlineto: [5],
25036  hlineto: [6],
25037  vlineto: [7],
25038  rrcurveto: [8],
25039  callsubr: [10],
25040  flex: [12, 35],
25041  drop: [12, 18],
25042  endchar: [14],
25043  rmoveto: [21],
25044  hmoveto: [22],
25045  vhcurveto: [30],
25046  hvcurveto: [31]
25047};
25048class Type1CharString {
25049  width = 0;
25050  lsb = 0;
25051  flexing = false;
25052  output = [];
25053  stack = [];
25054  convert(encoded, subrs, seacAnalysisEnabled) {
25055    const count = encoded.length;
25056    let error = false;
25057    let wx, sbx, subrNumber;
25058    for (let i = 0; i < count; i++) {
25059      let value = encoded[i];
25060      if (value < 32) {
25061        if (value === 12) {
25062          value = (value << 8) + encoded[++i];
25063        }
25064        switch (value) {
25065          case 1:
25066            if (!HINTING_ENABLED) {
25067              this.stack = [];
25068              break;
25069            }
25070            error = this.executeCommand(2, COMMAND_MAP.hstem);
25071            break;
25072          case 3:
25073            if (!HINTING_ENABLED) {
25074              this.stack = [];
25075              break;
25076            }
25077            error = this.executeCommand(2, COMMAND_MAP.vstem);
25078            break;
25079          case 4:
25080            if (this.flexing) {
25081              if (this.stack.length < 1) {
25082                error = true;
25083                break;
25084              }
25085              const dy = this.stack.pop();
25086              this.stack.push(0, dy);
25087              break;
25088            }
25089            error = this.executeCommand(1, COMMAND_MAP.vmoveto);
25090            break;
25091          case 5:
25092            error = this.executeCommand(2, COMMAND_MAP.rlineto);
25093            break;
25094          case 6:
25095            error = this.executeCommand(1, COMMAND_MAP.hlineto);
25096            break;
25097          case 7:
25098            error = this.executeCommand(1, COMMAND_MAP.vlineto);
25099            break;
25100          case 8:
25101            error = this.executeCommand(6, COMMAND_MAP.rrcurveto);
25102            break;
25103          case 9:
25104            this.stack = [];
25105            break;
25106          case 10:
25107            if (this.stack.length < 1) {
25108              error = true;
25109              break;
25110            }
25111            subrNumber = this.stack.pop();
25112            if (!subrs[subrNumber]) {
25113              error = true;
25114              break;
25115            }
25116            error = this.convert(subrs[subrNumber], subrs, seacAnalysisEnabled);
25117            break;
25118          case 11:
25119            return error;
25120          case 13:
25121            if (this.stack.length < 2) {
25122              error = true;
25123              break;
25124            }
25125            wx = this.stack.pop();
25126            sbx = this.stack.pop();
25127            this.lsb = sbx;
25128            this.width = wx;
25129            this.stack.push(wx, sbx);
25130            error = this.executeCommand(2, COMMAND_MAP.hmoveto);
25131            break;
25132          case 14:
25133            this.output.push(COMMAND_MAP.endchar[0]);
25134            break;
25135          case 21:
25136            if (this.flexing) {
25137              break;
25138            }
25139            error = this.executeCommand(2, COMMAND_MAP.rmoveto);
25140            break;
25141          case 22:
25142            if (this.flexing) {
25143              this.stack.push(0);
25144              break;
25145            }
25146            error = this.executeCommand(1, COMMAND_MAP.hmoveto);
25147            break;
25148          case 30:
25149            error = this.executeCommand(4, COMMAND_MAP.vhcurveto);
25150            break;
25151          case 31:
25152            error = this.executeCommand(4, COMMAND_MAP.hvcurveto);
25153            break;
25154          case (12 << 8) + 0:
25155            this.stack = [];
25156            break;
25157          case (12 << 8) + 1:
25158            if (!HINTING_ENABLED) {
25159              this.stack = [];
25160              break;
25161            }
25162            error = this.executeCommand(2, COMMAND_MAP.vstem);
25163            break;
25164          case (12 << 8) + 2:
25165            if (!HINTING_ENABLED
vendor: 7,654 bytes, lines 25165-25415
25165) {
25166              this.stack = [];
25167              break;
25168            }
25169            error = this.executeCommand(2, COMMAND_MAP.hstem);
25170            break;
25171          case (12 << 8) + 6:
25172            if (seacAnalysisEnabled) {
25173              const asb = this.stack.at(-5);
25174              this.seac = this.stack.splice(-4, 4);
25175              this.seac[0] += this.lsb - asb;
25176              error = this.executeCommand(0, COMMAND_MAP.endchar);
25177            } else {
25178              error = this.executeCommand(4, COMMAND_MAP.endchar);
25179            }
25180            break;
25181          case (12 << 8) + 7:
25182            if (this.stack.length < 4) {
25183              error = true;
25184              break;
25185            }
25186            this.stack.pop();
25187            wx = this.stack.pop();
25188            const sby = this.stack.pop();
25189            sbx = this.stack.pop();
25190            this.lsb = sbx;
25191            this.width = wx;
25192            this.stack.push(wx, sbx, sby);
25193            error = this.executeCommand(3, COMMAND_MAP.rmoveto);
25194            break;
25195          case (12 << 8) + 12:
25196            if (this.stack.length < 2) {
25197              error = true;
25198              break;
25199            }
25200            const num2 = this.stack.pop();
25201            const num1 = this.stack.pop();
25202            this.stack.push(num1 / num2);
25203            break;
25204          case (12 << 8) + 16:
25205            if (this.stack.length < 2) {
25206              error = true;
25207              break;
25208            }
25209            subrNumber = this.stack.pop();
25210            const numArgs = this.stack.pop();
25211            if (subrNumber === 0 && numArgs === 3) {
25212              const flexArgs = this.stack.splice(-17, 17);
25213              this.stack.push(flexArgs[2] + flexArgs[0], flexArgs[3] + flexArgs[1], flexArgs[4], flexArgs[5], flexArgs[6], flexArgs[7], flexArgs[8], flexArgs[9], flexArgs[10], flexArgs[11], flexArgs[12], flexArgs[13], flexArgs[14]);
25214              error = this.executeCommand(13, COMMAND_MAP.flex, true);
25215              this.flexing = false;
25216              this.stack.push(flexArgs[15], flexArgs[16]);
25217            } else if (subrNumber === 1 && numArgs === 0) {
25218              this.flexing = true;
25219            }
25220            break;
25221          case (12 << 8) + 17:
25222            break;
25223          case (12 << 8) + 33:
25224            this.stack = [];
25225            break;
25226          default:
25227            warn('Unknown type 1 charstring command of "' + value + '"');
25228            break;
25229        }
25230        if (error) {
25231          break;
25232        }
25233        continue;
25234      } else if (value <= 246) {
25235        value -= 139;
25236      } else if (value <= 250) {
25237        value = (value - 247) * 256 + encoded[++i] + 108;
25238      } else if (value <= 254) {
25239        value = -((value - 251) * 256) - encoded[++i] - 108;
25240      } else {
25241        value = (encoded[++i] & 0xff) << 24 | (encoded[++i] & 0xff) << 16 | (encoded[++i] & 0xff) << 8 | (encoded[++i] & 0xff) << 0;
25242      }
25243      this.stack.push(value);
25244    }
25245    return error;
25246  }
25247  executeCommand(howManyArgs, command, keepStack) {
25248    const stackLength = this.stack.length;
25249    if (howManyArgs > stackLength) {
25250      return true;
25251    }
25252    const start = stackLength - howManyArgs;
25253    for (let i = start; i < stackLength; i++) {
25254      let value = this.stack[i];
25255      if (Number.isInteger(value)) {
25256        this.output.push(28, value >> 8 & 0xff, value & 0xff);
25257      } else {
25258        value = 65536 * value | 0;
25259        this.output.push(255, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
25260      }
25261    }
25262    this.output.push(...command);
25263    if (keepStack) {
25264      this.stack.splice(start, howManyArgs);
25265    } else {
25266      this.stack.length = 0;
25267    }
25268    return false;
25269  }
25270}
25271const EEXEC_ENCRYPT_KEY = 55665;
25272const CHAR_STRS_ENCRYPT_KEY = 4330;
25273function isHexDigit(code) {
25274  return code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102;
25275}
25276function decrypt(data, key, discardNumber) {
25277  if (discardNumber >= data.length) {
25278    return new Uint8Array(0);
25279  }
25280  const c1 = 52845,
25281    c2 = 22719;
25282  let r = key | 0,
25283    i,
25284    j;
25285  for (i = 0; i < discardNumber; i++) {
25286    r = (data[i] + r) * c1 + c2 & (1 << 16) - 1;
25287  }
25288  const count = data.length - discardNumber;
25289  const decrypted = new Uint8Array(count);
25290  for (i = discardNumber, j = 0; j < count; i++, j++) {
25291    const value = data[i];
25292    decrypted[j] = value ^ r >> 8;
25293    r = (value + r) * c1 + c2 & (1 << 16) - 1;
25294  }
25295  return decrypted;
25296}
25297function decryptAscii(data, key, discardNumber) {
25298  const c1 = 52845,
25299    c2 = 22719;
25300  let r = key | 0;
25301  const count = data.length,
25302    maybeLength = count >>> 1;
25303  const decrypted = new Uint8Array(maybeLength);
25304  let i, j;
25305  for (i = 0, j = 0; i < count; i++) {
25306    const digit1 = data[i];
25307    if (!isHexDigit(digit1)) {
25308      continue;
25309    }
25310    i++;
25311    let digit2;
25312    while (i < count && !isHexDigit(digit2 = data[i])) {
25313      i++;
25314    }
25315    if (i < count) {
25316      const value = parseInt(String.fromCharCode(digit1, digit2), 16);
25317      decrypted[j++] = value ^ r >> 8;
25318      r = (value + r) * c1 + c2 & (1 << 16) - 1;
25319    }
25320  }
25321  return decrypted.slice(discardNumber, j);
25322}
25323function isSpecial(c) {
25324  return c === 0x2f || c === 0x5b || c === 0x5d || c === 0x7b || c === 0x7d || c === 0x28 || c === 0x29;
25325}
25326class Type1Parser {
25327  constructor(stream, encrypted, seacAnalysisEnabled) {
25328    if (encrypted) {
25329      const data = stream.getBytes();
25330      const isBinary = !((isHexDigit(data[0]) || isWhiteSpace(data[0])) && isHexDigit(data[1]) && isHexDigit(data[2]) && isHexDigit(data[3]) && isHexDigit(data[4]) && isHexDigit(data[5]) && isHexDigit(data[6]) && isHexDigit(data[7]));
25331      stream = new Stream(isBinary ? decrypt(data, EEXEC_ENCRYPT_KEY, 4) : decryptAscii(data, EEXEC_ENCRYPT_KEY, 4));
25332    }
25333    this.seacAnalysisEnabled = !!seacAnalysisEnabled;
25334    this.stream = stream;
25335    this.nextChar();
25336  }
25337  readNumberArray() {
25338    this.getToken();
25339    const array = [];
25340    while (true) {
25341      const token = this.getToken();
25342      if (token === null || token === "]" || token === "}") {
25343        break;
25344      }
25345      array.push(parseFloat(token || 0));
25346    }
25347    return array;
25348  }
25349  readNumber() {
25350    const token = this.getToken();
25351    return parseFloat(token || 0);
25352  }
25353  readInt() {
25354    const token = this.getToken();
25355    return parseInt(token || 0, 10) | 0;
25356  }
25357  readBoolean() {
25358    const token = this.getToken();
25359    return token === "true" ? 1 : 0;
25360  }
25361  nextChar() {
25362    return this.currentChar = this.stream.getByte();
25363  }
25364  prevChar() {
25365    this.stream.skip(-2);
25366    return this.currentChar = this.stream.getByte();
25367  }
25368  getToken() {
25369    let comment = false;
25370    let ch = this.currentChar;
25371    while (true) {
25372      if (ch === -1) {
25373        return null;
25374      }
25375      if (comment) {
25376        if (ch === 0x0a || ch === 0x0d) {
25377          comment = false;
25378        }
25379      } else if (ch === 0x25) {
25380        comment = true;
25381      } else if (!isWhiteSpace(ch)) {
25382        break;
25383      }
25384      ch = this.nextChar();
25385    }
25386    if (isSpecial(ch)) {
25387      this.nextChar();
25388      return String.fromCharCode(ch);
25389    }
25390    let token = "";
25391    do {
25392      token += String.fromCharCode(ch);
25393      ch = this.nextChar();
25394    } while (ch >= 0 && !isWhiteSpace(ch) && !isSpecial(ch));
25395    return token;
25396  }
25397  readCharStrings(bytes, lenIV) {
25398    if (lenIV === -1) {
25399      return bytes;
25400    }
25401    return decrypt(bytes, CHAR_STRS_ENCRYPT_KEY, lenIV);
25402  }
25403  extractFontProgram(properties) {
25404    const stream = this.stream;
25405    const subrs = [],
25406      charstrings = [];
25407    const privateData = new Map([["lenIV", 4]]);
25408    const program = {
25409      subrs: [],
25410      charstrings: [],
25411      properties: {
25412        privateData
25413      }
25414    };
25415    let token, length, data
vendor: 9,832 bytes, lines 25415-25725
25415, lenIV;
25416    while ((token = this.getToken()) !== null) {
25417      if (token !== "/") {
25418        continue;
25419      }
25420      token = this.getToken();
25421      switch (token) {
25422        case "CharStrings":
25423          this.getToken();
25424          this.getToken();
25425          this.getToken();
25426          this.getToken();
25427          while (true) {
25428            token = this.getToken();
25429            if (token === null || token === "end") {
25430              break;
25431            }
25432            if (token !== "/") {
25433              continue;
25434            }
25435            const glyph = this.getToken();
25436            length = this.readInt();
25437            this.getToken();
25438            data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
25439            lenIV = privateData.get("lenIV");
25440            const encoded = this.readCharStrings(data, lenIV);
25441            this.nextChar();
25442            token = this.getToken();
25443            if (token === "noaccess") {
25444              this.getToken();
25445            } else if (token === "/") {
25446              this.prevChar();
25447            }
25448            charstrings.push({
25449              glyph,
25450              encoded
25451            });
25452          }
25453          break;
25454        case "Subrs":
25455          this.readInt();
25456          this.getToken();
25457          while (this.getToken() === "dup") {
25458            const index = this.readInt();
25459            length = this.readInt();
25460            this.getToken();
25461            data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
25462            lenIV = privateData.get("lenIV");
25463            const encoded = this.readCharStrings(data, lenIV);
25464            this.nextChar();
25465            token = this.getToken();
25466            if (token === "noaccess") {
25467              this.getToken();
25468            }
25469            subrs[index] = encoded;
25470          }
25471          break;
25472        case "BlueValues":
25473        case "OtherBlues":
25474        case "FamilyBlues":
25475        case "FamilyOtherBlues":
25476          const blueArray = this.readNumberArray();
25477          if (blueArray.length > 0 && blueArray.length % 2 === 0 && HINTING_ENABLED) {
25478            privateData.set(token, blueArray);
25479          }
25480          break;
25481        case "StemSnapH":
25482        case "StemSnapV":
25483          privateData.set(token, this.readNumberArray());
25484          break;
25485        case "StdHW":
25486        case "StdVW":
25487          privateData.set(token, this.readNumberArray()[0]);
25488          break;
25489        case "BlueShift":
25490        case "lenIV":
25491        case "BlueFuzz":
25492        case "BlueScale":
25493        case "LanguageGroup":
25494          privateData.set(token, this.readNumber());
25495          break;
25496        case "ExpansionFactor":
25497          privateData.set(token, this.readNumber() || 0.06);
25498          break;
25499        case "ForceBold":
25500          privateData.set(token, this.readBoolean());
25501          break;
25502      }
25503    }
25504    for (const {
25505      encoded,
25506      glyph
25507    } of charstrings) {
25508      const charString = new Type1CharString();
25509      const error = charString.convert(encoded, subrs, this.seacAnalysisEnabled);
25510      let output = charString.output;
25511      if (error) {
25512        output = [14];
25513      }
25514      const charStringObject = {
25515        glyphName: glyph,
25516        charstring: output,
25517        width: charString.width,
25518        lsb: charString.lsb,
25519        seac: charString.seac
25520      };
25521      if (glyph === ".notdef") {
25522        program.charstrings.unshift(charStringObject);
25523      } else {
25524        program.charstrings.push(charStringObject);
25525      }
25526      if (properties.builtInEncoding) {
25527        const index = properties.builtInEncoding.indexOf(glyph);
25528        if (index > -1 && properties.widths[index] === undefined && index >= properties.firstChar && index <= properties.lastChar) {
25529          properties.widths[index] = charString.width;
25530        }
25531      }
25532    }
25533    return program;
25534  }
25535  extractFontHeader(properties) {
25536    let token;
25537    while ((token = this.getToken()) !== null) {
25538      if (token !== "/") {
25539        continue;
25540      }
25541      token = this.getToken();
25542      switch (token) {
25543        case "FontMatrix":
25544          const matrix = this.readNumberArray();
25545          properties.fontMatrix = matrix;
25546          break;
25547        case "Encoding":
25548          const encodingArg = this.getToken();
25549          let encoding;
25550          if (!/^\d+$/.test(encodingArg)) {
25551            encoding = getEncoding(encodingArg);
25552          } else {
25553            encoding = [];
25554            const size = parseInt(encodingArg, 10) | 0;
25555            this.getToken();
25556            for (let j = 0; j < size; j++) {
25557              token = this.getToken();
25558              while (token !== "dup" && token !== "def") {
25559                token = this.getToken();
25560                if (token === null) {
25561                  return;
25562                }
25563              }
25564              if (token === "def") {
25565                break;
25566              }
25567              const index = this.readInt();
25568              this.getToken();
25569              const glyph = this.getToken();
25570              encoding[index] = glyph;
25571              this.getToken();
25572            }
25573          }
25574          properties.builtInEncoding = encoding;
25575          break;
25576        case "FontBBox":
25577          const fontBBox = this.readNumberArray();
25578          properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
25579          properties.descent = Math.min(fontBBox[1], fontBBox[3]);
25580          properties.ascentScaled = true;
25581          break;
25582      }
25583    }
25584  }
25585}
25586
25587;// ./src/core/type1_font.js
25588
25589
25590
25591
25592
25593
25594function findBlock(streamBytes, signature, startIndex) {
25595  const streamBytesLength = streamBytes.length;
25596  const signatureLength = signature.length;
25597  const scanLength = streamBytesLength - signatureLength;
25598  let i = startIndex,
25599    found = false;
25600  while (i < scanLength) {
25601    let j = 0;
25602    while (j < signatureLength && streamBytes[i + j] === signature[j]) {
25603      j++;
25604    }
25605    if (j >= signatureLength) {
25606      i += j;
25607      while (i < streamBytesLength && isWhiteSpace(streamBytes[i])) {
25608        i++;
25609      }
25610      found = true;
25611      break;
25612    }
25613    i++;
25614  }
25615  return {
25616    found,
25617    length: i
25618  };
25619}
25620function getHeaderBlock(stream, suggestedLength) {
25621  const EEXEC_SIGNATURE = [0x65, 0x65, 0x78, 0x65, 0x63];
25622  const streamStartPos = stream.pos;
25623  let headerBytes, headerBytesLength, block;
25624  try {
25625    headerBytes = stream.getBytes(suggestedLength);
25626    headerBytesLength = headerBytes.length;
25627  } catch {}
25628  if (headerBytesLength === suggestedLength) {
25629    block = findBlock(headerBytes, EEXEC_SIGNATURE, suggestedLength - 2 * EEXEC_SIGNATURE.length);
25630    if (block.found && block.length === suggestedLength) {
25631      return {
25632        stream: new Stream(headerBytes),
25633        length: suggestedLength
25634      };
25635    }
25636  }
25637  warn('Invalid "Length1" property in Type1 font -- trying to recover.');
25638  stream.pos = streamStartPos;
25639  const SCAN_BLOCK_LENGTH = 2048;
25640  let actualLength;
25641  while (true) {
25642    const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
25643    block = findBlock(scanBytes, EEXEC_SIGNATURE, 0);
25644    if (block.length === 0) {
25645      break;
25646    }
25647    stream.pos += block.length;
25648    if (block.found) {
25649      actualLength = stream.pos - streamStartPos;
25650      break;
25651    }
25652  }
25653  stream.pos = streamStartPos;
25654  if (actualLength) {
25655    return {
25656      stream: new Stream(stream.getBytes(actualLength)),
25657      length: actualLength
25658    };
25659  }
25660  warn('Unable to recover "Length1" property in Type1 font -- using as is.');
25661  return {
25662    stream: new Stream(stream.getBytes(suggestedLength)),
25663    length: suggestedLength
25664  };
25665}
25666function getEexecBlock(stream, suggestedLength) {
25667  const eexecBytes = stream.getBytes();
25668  if (eexecBytes.length === 0) {
25669    throw new FormatError("getEexecBlock - no font program found.");
25670  }
25671  return {
25672    stream: new Stream(eexecBytes),
25673    length: eexecBytes.length
25674  };
25675}
25676class Type1Font {
25677  #rawFileLength;
25678  constructor(name, file, properties) {
25679    const PFB_HEADER_SIZE = 6;
25680    let headerBlockLength = properties.length1;
25681    let eexecBlockLength = properties.length2;
25682    let pfbHeader = file.peekBytes(PFB_HEADER_SIZE);
25683    const pfbHeaderPresent = pfbHeader[0] === 0x80 && pfbHeader[1] === 0x01;
25684    if (pfbHeaderPresent) {
25685      file.skip(PFB_HEADER_SIZE);
25686      headerBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
25687    }
25688    const headerBlock = getHeaderBlock(file, headerBlockLength);
25689    const headerBlockParser = new Type1Parser(headerBlock.stream, false, SEAC_ANALYSIS_ENABLED);
25690    headerBlockParser.extractFontHeader(properties);
25691    if (pfbHeaderPresent) {
25692      pfbHeader = file.getBytes(PFB_HEADER_SIZE);
25693      eexecBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
25694    }
25695    const eexecBlock = getEexecBlock(file, eexecBlockLength);
25696    const eexecBlockParser = new Type1Parser(eexecBlock.stream, true, SEAC_ANALYSIS_ENABLED);
25697    const data = eexecBlockParser.extractFontProgram(properties);
25698    for (const key in data.properties) {
25699      properties[key] = data.properties[key];
25700    }
25701    this.#rawFileLength = headerBlock.length + eexecBlock.length;
25702    const charstrings = data.charstrings;
25703    const type2Charstrings = this.getType2Charstrings(charstrings);
25704    const subrs = this.getType2Subrs(data.subrs);
25705    this.charstrings = charstrings;
25706    this.data = this.wrap(name, type2Charstrings, this.charstrings, subrs, properties);
25707    this.seacs = this.getSeacs(data.charstrings);
25708  }
25709  get numGlyphs() {
25710    return this.charstrings.length + 1;
25711  }
25712  getCharset() {
25713    const charset = [".notdef"];
25714    for (const {
25715      glyphName
25716    } of this.charstrings) {
25717      charset.push(glyphName);
25718    }
25719    return charset;
25720  }
25721  getGlyphMapping(properties) {
25722    const charstrings = this.charstrings;
25723    if (properties.composite) {
25724      const charCodeToGlyphId = Object.create(null);
25725      for (let glyphId = 0, charstringsLen = charstrings.length; glyphId < charstringsLen; glyphId++) {
vendor: 34,302 bytes, lines 25726-26809
25726        const charCode = properties.cMap.charCodeOf(glyphId);
25727        charCodeToGlyphId[charCode] = glyphId + 1;
25728      }
25729      return charCodeToGlyphId;
25730    }
25731    const glyphNames = [".notdef"];
25732    let builtInEncoding, glyphId;
25733    for (glyphId = 0; glyphId < charstrings.length; glyphId++) {
25734      glyphNames.push(charstrings[glyphId].glyphName);
25735    }
25736    const encoding = properties.builtInEncoding;
25737    if (encoding) {
25738      builtInEncoding = Object.create(null);
25739      for (const charCode in encoding) {
25740        glyphId = glyphNames.indexOf(encoding[charCode]);
25741        if (glyphId >= 0) {
25742          builtInEncoding[charCode] = glyphId;
25743        }
25744      }
25745    }
25746    return type1FontGlyphMapping(properties, builtInEncoding, glyphNames);
25747  }
25748  hasGlyphId(id) {
25749    if (id < 0 || id >= this.numGlyphs) {
25750      return false;
25751    }
25752    if (id === 0) {
25753      return true;
25754    }
25755    const glyph = this.charstrings[id - 1];
25756    return glyph.charstring.length > 0;
25757  }
25758  getSeacs(charstrings) {
25759    const seacMap = [];
25760    for (let i = 0, ii = charstrings.length; i < ii; i++) {
25761      const charstring = charstrings[i];
25762      if (charstring.seac) {
25763        seacMap[i + 1] = charstring.seac;
25764      }
25765    }
25766    return seacMap;
25767  }
25768  getType2Charstrings(type1Charstrings) {
25769    const type2Charstrings = [];
25770    for (const type1Charstring of type1Charstrings) {
25771      type2Charstrings.push(type1Charstring.charstring);
25772    }
25773    return type2Charstrings;
25774  }
25775  getType2Subrs(type1Subrs) {
25776    let bias = 0;
25777    const count = type1Subrs.length;
25778    if (count < 1133) {
25779      bias = 107;
25780    } else if (count < 33769) {
25781      bias = 1131;
25782    } else {
25783      bias = 32768;
25784    }
25785    const type2Subrs = [];
25786    let i;
25787    for (i = 0; i < bias; i++) {
25788      type2Subrs.push([0x0b]);
25789    }
25790    for (i = 0; i < count; i++) {
25791      type2Subrs.push(type1Subrs[i]);
25792    }
25793    return type2Subrs;
25794  }
25795  wrap(name, glyphs, charstrings, subrs, properties) {
25796    const cff = new CFF(this.#rawFileLength);
25797    cff.header = new CFFHeader(1, 0, 4, 4);
25798    cff.names = [name];
25799    const topDict = new CFFTopDict();
25800    topDict.setByName("version", 391);
25801    topDict.setByName("Notice", 392);
25802    topDict.setByName("FullName", 393);
25803    topDict.setByName("FamilyName", 394);
25804    topDict.setByName("Weight", 395);
25805    topDict.setByName("Encoding", null);
25806    topDict.setByName("FontMatrix", properties.fontMatrix);
25807    topDict.setByName("FontBBox", properties.bbox);
25808    topDict.setByName("charset", null);
25809    topDict.setByName("CharStrings", null);
25810    topDict.setByName("Private", null);
25811    cff.topDict = topDict;
25812    const strings = new CFFStrings();
25813    strings.add("Version 0.11");
25814    strings.add("See original notice");
25815    strings.add(name);
25816    strings.add(name);
25817    strings.add("Medium");
25818    cff.strings = strings;
25819    cff.globalSubrIndex = new CFFIndex();
25820    const count = glyphs.length;
25821    const charsetArray = [".notdef"];
25822    for (let i = 0; i < count; i++) {
25823      const {
25824        glyphName
25825      } = charstrings[i];
25826      const index = CFFStandardStrings.indexOf(glyphName);
25827      if (index === -1) {
25828        strings.add(glyphName);
25829      }
25830      charsetArray.push(glyphName);
25831    }
25832    cff.charset = new CFFCharset(false, 0, charsetArray);
25833    const charStringsIndex = new CFFIndex();
25834    charStringsIndex.add([0x8b, 0x0e]);
25835    for (let i = 0; i < count; i++) {
25836      charStringsIndex.add(glyphs[i]);
25837    }
25838    cff.charStrings = charStringsIndex;
25839    const privateDict = new CFFPrivateDict();
25840    privateDict.setByName("Subrs", null);
25841    const fields = ["BlueValues", "OtherBlues", "FamilyBlues", "FamilyOtherBlues", "StemSnapH", "StemSnapV", "BlueShift", "BlueFuzz", "BlueScale", "LanguageGroup", "ExpansionFactor", "ForceBold", "StdHW", "StdVW"];
25842    for (const field of fields) {
25843      if (!properties.privateData.has(field)) {
25844        continue;
25845      }
25846      const value = properties.privateData.get(field);
25847      if (Array.isArray(value)) {
25848        for (let j = value.length - 1; j > 0; j--) {
25849          value[j] -= value[j - 1];
25850        }
25851      }
25852      privateDict.setByName(field, value);
25853    }
25854    cff.topDict.privateDict = privateDict;
25855    const subrIndex = new CFFIndex();
25856    for (const subr of subrs) {
25857      subrIndex.add(subr);
25858    }
25859    privateDict.subrsIndex = subrIndex;
25860    const compiler = new CFFCompiler(cff);
25861    return compiler.compile();
25862  }
25863}
25864
25865;// ./src/core/fonts.js
25866
25867
25868
25869
25870
25871
25872
25873
25874
25875
25876
25877
25878
25879
25880
25881
25882
25883const PRIVATE_USE_AREAS = [[0xe000, 0xf8ff], [0x100000, 0x10fffd]];
25884const PDF_GLYPH_SPACE_UNITS = 1000;
25885const EXPORT_DATA_PROPERTIES = ["ascent", "bbox", "black", "bold", "cssFontInfo", "data", "defaultVMetrics", "defaultWidth", "descent", "disableFontFace", "fallbackName", "fontExtraProperties", "fontMatrix", "isInvalidPDFjsFont", "isType3Font", "italic", "loadedName", "mimetype", "missingFile", "name", "remeasure", "systemFontInfo", "vertical"];
25886const EXPORT_DATA_EXTRA_PROPERTIES = ["cMap", "composite", "defaultEncoding", "differences", "isMonospace", "isSerifFont", "isSymbolicFont", "seacMap", "subtype", "toFontChar", "toUnicode", "type", "vmetrics", "widths"];
25887function adjustWidths(properties) {
25888  if (!properties.fontMatrix) {
25889    return;
25890  }
25891  if (properties.fontMatrix[0] === FONT_IDENTITY_MATRIX[0]) {
25892    return;
25893  }
25894  const scale = 0.001 / properties.fontMatrix[0];
25895  const glyphsWidths = properties.widths;
25896  for (const glyph in glyphsWidths) {
25897    glyphsWidths[glyph] *= scale;
25898  }
25899  properties.defaultWidth *= scale;
25900}
25901function adjustTrueTypeToUnicode(properties, isSymbolicFont, nameRecords) {
25902  if (properties.isInternalFont) {
25903    return;
25904  }
25905  if (properties.hasIncludedToUnicodeMap) {
25906    return;
25907  }
25908  if (properties.hasEncoding) {
25909    return;
25910  }
25911  if (properties.toUnicode instanceof IdentityToUnicodeMap) {
25912    return;
25913  }
25914  if (!isSymbolicFont) {
25915    return;
25916  }
25917  if (nameRecords.length === 0) {
25918    return;
25919  }
25920  if (properties.defaultEncoding === WinAnsiEncoding) {
25921    return;
25922  }
25923  for (const r of nameRecords) {
25924    if (!isWinNameRecord(r)) {
25925      return;
25926    }
25927  }
25928  const encoding = WinAnsiEncoding;
25929  const toUnicode = [],
25930    glyphsUnicodeMap = getGlyphsUnicode();
25931  for (const charCode in encoding) {
25932    const glyphName = encoding[charCode];
25933    if (glyphName === "") {
25934      continue;
25935    }
25936    const unicode = glyphsUnicodeMap[glyphName];
25937    if (unicode === undefined) {
25938      continue;
25939    }
25940    toUnicode[charCode] = String.fromCharCode(unicode);
25941  }
25942  if (toUnicode.length > 0) {
25943    properties.toUnicode.amend(toUnicode);
25944  }
25945}
25946function adjustType1ToUnicode(properties, builtInEncoding) {
25947  if (properties.isInternalFont) {
25948    return;
25949  }
25950  if (properties.hasIncludedToUnicodeMap) {
25951    return;
25952  }
25953  if (builtInEncoding === properties.defaultEncoding) {
25954    return;
25955  }
25956  if (properties.toUnicode instanceof IdentityToUnicodeMap) {
25957    return;
25958  }
25959  const toUnicode = [],
25960    glyphsUnicodeMap = getGlyphsUnicode();
25961  for (const charCode in builtInEncoding) {
25962    if (properties.hasEncoding) {
25963      if (properties.baseEncodingName || properties.differences[charCode] !== undefined) {
25964        continue;
25965      }
25966    }
25967    const glyphName = builtInEncoding[charCode];
25968    const unicode = getUnicodeForGlyph(glyphName, glyphsUnicodeMap);
25969    if (unicode !== -1) {
25970      toUnicode[charCode] = String.fromCharCode(unicode);
25971    }
25972  }
25973  if (toUnicode.length > 0) {
25974    properties.toUnicode.amend(toUnicode);
25975  }
25976}
25977function amendFallbackToUnicode(properties) {
25978  if (!properties.fallbackToUnicode) {
25979    return;
25980  }
25981  if (properties.toUnicode instanceof IdentityToUnicodeMap) {
25982    return;
25983  }
25984  const toUnicode = [];
25985  for (const charCode in properties.fallbackToUnicode) {
25986    if (properties.toUnicode.has(charCode)) {
25987      continue;
25988    }
25989    toUnicode[charCode] = properties.fallbackToUnicode[charCode];
25990  }
25991  if (toUnicode.length > 0) {
25992    properties.toUnicode.amend(toUnicode);
25993  }
25994}
25995class fonts_Glyph {
25996  constructor(originalCharCode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
25997    this.originalCharCode = originalCharCode;
25998    this.fontChar = fontChar;
25999    this.unicode = unicode;
26000    this.accent = accent;
26001    this.width = width;
26002    this.vmetric = vmetric;
26003    this.operatorListId = operatorListId;
26004    this.isSpace = isSpace;
26005    this.isInFont = isInFont;
26006  }
26007  get category() {
26008    return shadow(this, "category", getCharUnicodeCategory(this.unicode), true);
26009  }
26010}
26011function int16(b0, b1) {
26012  return (b0 << 8) + b1;
26013}
26014function writeSignedInt16(bytes, index, value) {
26015  bytes[index + 1] = value;
26016  bytes[index] = value >>> 8;
26017}
26018function signedInt16(b0, b1) {
26019  const value = (b0 << 8) + b1;
26020  return value & 1 << 15 ? value - 0x10000 : value;
26021}
26022function writeUint32(bytes, index, value) {
26023  bytes[index + 3] = value & 0xff;
26024  bytes[index + 2] = value >>> 8;
26025  bytes[index + 1] = value >>> 16;
26026  bytes[index] = value >>> 24;
26027}
26028class TrueTypeTableBuilder {
26029  #buf;
26030  #bufLength = 1024;
26031  #hasExactLength = false;
26032  #pos = 0;
26033  #view;
26034  constructor({
26035    exactLength,
26036    minLength
26037  }) {
26038    this.#hasExactLength = !!exactLength;
26039    this.#initBuf(exactLength || minLength);
26040  }
26041  #initBuf(minLength) {
26042    if (this.#hasExactLength) {
26043      this.#bufLength = minLength;
26044    } else {
26045      while (this.#bufLength < minLength) {
26046        this.#bufLength *= 2;
26047      }
26048    }
26049    const newBuf = new Uint8Array(this.#bufLength);
26050    if (this.#buf) {
26051      newBuf.set(this.#buf, 0);
26052    }
26053    this.#buf = newBuf;
26054    this.#view = new DataView(newBuf.buffer);
26055  }
26056  get data() {
26057    return this.#buf.subarray(0, this.#pos);
26058  }
26059  get length() {
26060    return this.#pos;
26061  }
26062  skip(n) {
26063    this.#pos += n;
26064  }
26065  setArray(arr) {
26066    const newPos = this.#pos + arr.length;
26067    if (!this.#hasExactLength && newPos > this.#bufLength) {
26068      this.#initBuf(newPos);
26069    }
26070    this.#buf.set(arr, this.#pos);
26071    this.#pos = newPos;
26072  }
26073  setInt16(val) {
26074    const newPos = this.#pos + 2;
26075    if (!this.#hasExactLength && newPos > this.#bufLength) {
26076      this.#initBuf(newPos);
26077    }
26078    this.#view.setInt16(this.#pos, val);
26079    this.#pos = newPos;
26080  }
26081  setSafeInt16(val) {
26082    const newPos = this.#pos + 2;
26083    if (!this.#hasExactLength && newPos > this.#bufLength) {
26084      this.#initBuf(newPos);
26085    }
26086    this.#view.setInt16(this.#pos, MathClamp(val, -0x8000, 0x7fff));
26087    this.#pos = newPos;
26088  }
26089  setInt32(val) {
26090    const newPos = this.#pos + 4;
26091    if (!this.#hasExactLength && newPos > this.#bufLength) {
26092      this.#initBuf(newPos);
26093    }
26094    this.#view.setInt32(this.#pos, val);
26095    this.#pos = newPos;
26096  }
26097}
26098function isTrueTypeFile(file) {
26099  const header = file.peekBytes(4),
26100    str = bytesToString(header);
26101  return str === "\x00\x01\x00\x00" || str === "true";
26102}
26103function isTrueTypeCollectionFile(file) {
26104  const header = file.peekBytes(4);
26105  return bytesToString(header) === "ttcf";
26106}
26107function isOpenTypeFile(file) {
26108  const header = file.peekBytes(4);
26109  return bytesToString(header) === "OTTO";
26110}
26111function isType1File(file) {
26112  const header = file.peekBytes(2);
26113  if (header[0] === 0x25 && header[1] === 0x21) {
26114    return true;
26115  }
26116  if (header[0] === 0x80 && header[1] === 0x01) {
26117    return true;
26118  }
26119  return false;
26120}
26121function isCFFFile(file) {
26122  const header = file.peekBytes(4);
26123  if (header[0] >= 1 && header[3] >= 1 && header[3] <= 4) {
26124    return true;
26125  }
26126  return false;
26127}
26128function getFontFileType(file, {
26129  type,
26130  subtype,
26131  composite
26132}) {
26133  let fileType, fileSubtype;
26134  if (isTrueTypeFile(file) || isTrueTypeCollectionFile(file)) {
26135    fileType = composite ? "CIDFontType2" : "TrueType";
26136  } else if (isOpenTypeFile(file)) {
26137    fileType = composite ? "CIDFontType2" : "OpenType";
26138  } else if (isType1File(file)) {
26139    if (composite) {
26140      fileType = "CIDFontType0";
26141    } else {
26142      fileType = type === "MMType1" ? "MMType1" : "Type1";
26143    }
26144  } else if (isCFFFile(file)) {
26145    if (composite) {
26146      fileType = "CIDFontType0";
26147      fileSubtype = "CIDFontType0C";
26148    } else {
26149      fileType = type === "MMType1" ? "MMType1" : "Type1";
26150      fileSubtype = "Type1C";
26151    }
26152  } else {
26153    warn("getFontFileType: Unable to detect correct font file Type/Subtype.");
26154    fileType = type;
26155    fileSubtype = subtype;
26156  }
26157  return [fileType, fileSubtype];
26158}
26159function applyStandardFontGlyphMap(map, glyphMap) {
26160  for (const charCode in glyphMap) {
26161    map[+charCode] = glyphMap[charCode];
26162  }
26163}
26164function buildToFontChar(encoding, glyphsUnicodeMap, differences) {
26165  const toFontChar = [];
26166  let unicode;
26167  for (let i = 0, ii = encoding.length; i < ii; i++) {
26168    unicode = getUnicodeForGlyph(encoding[i], glyphsUnicodeMap);
26169    if (unicode !== -1) {
26170      toFontChar[i] = unicode;
26171    }
26172  }
26173  for (const charCode in differences) {
26174    unicode = getUnicodeForGlyph(differences[charCode], glyphsUnicodeMap);
26175    if (unicode !== -1) {
26176      toFontChar[+charCode] = unicode;
26177    }
26178  }
26179  return toFontChar;
26180}
26181function isMacNameRecord(r) {
26182  return r.platform === 1 && r.encoding === 0 && r.language === 0;
26183}
26184function isWinNameRecord(r) {
26185  return r.platform === 3 && r.encoding === 1 && r.language === 0x409;
26186}
26187function convertCidString(charCode, cid, shouldThrow = false) {
26188  switch (cid.length) {
26189    case 1:
26190      return cid.charCodeAt(0);
26191    case 2:
26192      return cid.charCodeAt(0) << 8 | cid.charCodeAt(1);
26193  }
26194  const msg = `Unsupported CID string (charCode ${charCode}): "${cid}".`;
26195  if (shouldThrow) {
26196    throw new FormatError(msg);
26197  }
26198  warn(msg);
26199  return cid;
26200}
26201function adjustMapping(charCodeToGlyphId, hasGlyph, newGlyphZeroId, toUnicode) {
26202  const newMap = Object.create(null);
26203  const toUnicodeExtraMap = new Map();
26204  const toFontChar = [];
26205  const usedGlyphIds = new Set();
26206  let privateUseAreaIndex = 0;
26207  const privateUseOffetStart = PRIVATE_USE_AREAS[privateUseAreaIndex][0];
26208  let nextAvailableFontCharCode = privateUseOffetStart;
26209  let privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
26210  const isInPrivateArea = code => PRIVATE_USE_AREAS[0][0] <= code && code <= PRIVATE_USE_AREAS[0][1] || PRIVATE_USE_AREAS[1][0] <= code && code <= PRIVATE_USE_AREAS[1][1];
26211  let LIGATURE_TO_UNICODE = null;
26212  for (const originalCharCode in charCodeToGlyphId) {
26213    let glyphId = charCodeToGlyphId[originalCharCode];
26214    if (!hasGlyph(glyphId)) {
26215      continue;
26216    }
26217    if (nextAvailableFontCharCode > privateUseOffetEnd) {
26218      privateUseAreaIndex++;
26219      if (privateUseAreaIndex >= PRIVATE_USE_AREAS.length) {
26220        warn("Ran out of space in font private use area.");
26221        break;
26222      }
26223      nextAvailableFontCharCode = PRIVATE_USE_AREAS[privateUseAreaIndex][0];
26224      privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
26225    }
26226    const fontCharCode = nextAvailableFontCharCode++;
26227    if (glyphId === 0) {
26228      glyphId = newGlyphZeroId;
26229    }
26230    let unicode = toUnicode.get(originalCharCode);
26231    if (typeof unicode === "string") {
26232      if (unicode.length === 1) {
26233        unicode = unicode.codePointAt(0);
26234      } else {
26235        if (!LIGATURE_TO_UNICODE) {
26236          LIGATURE_TO_UNICODE = new Map();
26237          for (let i = 0xfb00; i <= 0xfb4f; i++) {
26238            const normalized = String.fromCharCode(i).normalize("NFKD");
26239            if (normalized.length > 1) {
26240              LIGATURE_TO_UNICODE.set(normalized, i);
26241            }
26242          }
26243        }
26244        unicode = LIGATURE_TO_UNICODE.get(unicode) || unicode.codePointAt(0);
26245      }
26246    }
26247    if (unicode && !isInPrivateArea(unicode) && !usedGlyphIds.has(glyphId)) {
26248      toUnicodeExtraMap.set(unicode, glyphId);
26249      usedGlyphIds.add(glyphId);
26250    }
26251    newMap[fontCharCode] = glyphId;
26252    toFontChar[originalCharCode] = fontCharCode;
26253  }
26254  return {
26255    toFontChar,
26256    charCodeToGlyphId: newMap,
26257    toUnicodeExtraMap,
26258    nextAvailableFontCharCode
26259  };
26260}
26261function getRanges(glyphs, toUnicodeExtraMap, numGlyphs) {
26262  const codes = [];
26263  for (const charCode in glyphs) {
26264    if (glyphs[charCode] >= numGlyphs) {
26265      continue;
26266    }
26267    codes.push({
26268      fontCharCode: charCode | 0,
26269      glyphId: glyphs[charCode]
26270    });
26271  }
26272  if (toUnicodeExtraMap) {
26273    for (const [unicode, glyphId] of toUnicodeExtraMap) {
26274      if (glyphId >= numGlyphs) {
26275        continue;
26276      }
26277      codes.push({
26278        fontCharCode: unicode,
26279        glyphId
26280      });
26281    }
26282  }
26283  if (codes.length === 0) {
26284    codes.push({
26285      fontCharCode: 0,
26286      glyphId: 0
26287    });
26288  }
26289  codes.sort((a, b) => a.fontCharCode - b.fontCharCode);
26290  const ranges = [];
26291  const length = codes.length;
26292  for (let n = 0; n < length;) {
26293    const start = codes[n].fontCharCode;
26294    const codeIndices = [codes[n].glyphId];
26295    ++n;
26296    let end = start;
26297    while (n < length && end + 1 === codes[n].fontCharCode) {
26298      codeIndices.push(codes[n].glyphId);
26299      ++end;
26300      ++n;
26301      if (end === 0xffff) {
26302        break;
26303      }
26304    }
26305    ranges.push([start, end, codeIndices]);
26306  }
26307  return ranges;
26308}
26309function createCmapTable(glyphs, toUnicodeExtraMap, numGlyphs) {
26310  const ranges = getRanges(glyphs, toUnicodeExtraMap, numGlyphs);
26311  const numTables = ranges.at(-1)[1] > 0xffff ? 2 : 1;
26312  const cmap = new TrueTypeTableBuilder({
26313    exactLength: 12
26314  });
26315  cmap.skip(2);
26316  cmap.setInt16(numTables);
26317  cmap.setArray([0x00, 0x03]);
26318  cmap.setArray([0x00, 0x01]);
26319  cmap.setInt32(4 + numTables * 8);
26320  let i, ii, j, jj;
26321  for (i = ranges.length - 1; i >= 0; --i) {
26322    if (ranges[i][0] <= 0xffff) {
26323      break;
26324    }
26325  }
26326  const bmpLength = i + 1;
26327  if (ranges[i][0] < 0xffff && ranges[i][1] === 0xffff) {
26328    ranges[i][1] = 0xfffe;
26329  }
26330  const trailingRangesCount = ranges[i][1] < 0xffff ? 1 : 0;
26331  const segCount = bmpLength + trailingRangesCount;
26332  const searchParams = OpenTypeFileBuilder.getSearchParams(segCount, 2);
26333  const segmentsLength = bmpLength * 2 + trailingRangesCount * 2;
26334  const startCount = new TrueTypeTableBuilder({
26335      exactLength: segmentsLength
26336    }),
26337    endCount = new TrueTypeTableBuilder({
26338      exactLength: segmentsLength
26339    }),
26340    idDeltas = new TrueTypeTableBuilder({
26341      exactLength: segmentsLength
26342    }),
26343    idRangeOffsets = new TrueTypeTableBuilder({
26344      exactLength: segmentsLength
26345    }),
26346    glyphsIds = new TrueTypeTableBuilder({});
26347  let bias = 0;
26348  for (i = 0, ii = bmpLength; i < ii; i++) {
26349    const [start, end, codes] = ranges[i];
26350    startCount.setInt16(start);
26351    endCount.setInt16(end);
26352    let contiguous = true;
26353    for (j = 1, jj = codes.length; j < jj; ++j) {
26354      if (codes[j] !== codes[j - 1] + 1) {
26355        contiguous = false;
26356        break;
26357      }
26358    }
26359    if (!contiguous) {
26360      const offset = (segCount - i) * 2 + bias * 2;
26361      bias += end - start + 1;
26362      idDeltas.skip(2);
26363      idRangeOffsets.setInt16(offset);
26364      for (j = 0, jj = codes.length; j < jj; ++j) {
26365        glyphsIds.setInt16(codes[j]);
26366      }
26367    } else {
26368      const startCode = codes[0];
26369      idDeltas.setInt16(startCode - start & 0xffff);
26370      idRangeOffsets.skip(2);
26371    }
26372  }
26373  if (trailingRangesCount > 0) {
26374    endCount.setArray([0xff, 0xff]);
26375    startCount.setArray([0xff, 0xff]);
26376    idDeltas.setArray([0x00, 0x01]);
26377    idRangeOffsets.skip(2);
26378  }
26379  const format314 = new TrueTypeTableBuilder({
26380    exactLength: 12 + startCount.length + endCount.length + idDeltas.length + idRangeOffsets.length + glyphsIds.length
26381  });
26382  format314.skip(2);
26383  format314.setInt16(2 * segCount);
26384  format314.setInt16(searchParams.range);
26385  format314.setInt16(searchParams.entry);
26386  format314.setInt16(searchParams.rangeShift);
26387  format314.setArray(endCount.data);
26388  format314.skip(2);
26389  format314.setArray(startCount.data);
26390  format314.setArray(idDeltas.data);
26391  format314.setArray(idRangeOffsets.data);
26392  format314.setArray(glyphsIds.data);
26393  let cmap31012 = null,
26394    format31012 = null,
26395    header31012 = null;
26396  if (numTables > 1) {
26397    cmap31012 = new TrueTypeTableBuilder({
26398      exactLength: 8
26399    });
26400    cmap31012.setArray([0x00, 0x03]);
26401    cmap31012.setArray([0x00, 0x0a]);
26402    cmap31012.setInt32(4 + numTables * 8 + 4 + format314.length);
26403    format31012 = new TrueTypeTableBuilder({});
26404    for (const range of ranges) {
26405      let start = range[0];
26406      const codes = range[2];
26407      let code = codes[0];
26408      for (j = 1, jj = codes.length; j < jj; ++j) {
26409        if (codes[j] !== codes[j - 1] + 1) {
26410          const end = range[0] + j - 1;
26411          format31012.setInt32(start);
26412          format31012.setInt32(end);
26413          format31012.setInt32(code);
26414          start = end + 1;
26415          code = codes[j];
26416        }
26417      }
26418      format31012.setInt32(start);
26419      format31012.setInt32(range[1]);
26420      format31012.setInt32(code);
26421    }
26422    header31012 = new TrueTypeTableBuilder({
26423      exactLength: 16
26424    });
26425    header31012.setArray([0x00, 0x0c]);
26426    header31012.skip(2);
26427    header31012.setInt32(format31012.length + 16);
26428    header31012.skip(4);
26429    header31012.setInt32(format31012.length / 12);
26430  }
26431  const table = new TrueTypeTableBuilder({
26432    exactLength: 4 + cmap.length + (cmap31012?.length ?? 0) + format314.length + (header31012?.length ?? 0) + (format31012?.length ?? 0)
26433  });
26434  table.setArray(cmap.data);
26435  table.setArray(cmap31012?.data ?? []);
26436  table.setArray([0x00, 0x04]);
26437  table.setInt16(format314.length + 4);
26438  table.setArray(format314.data);
26439  table.setArray(header31012?.data ?? []);
26440  table.setArray(format31012?.data ?? []);
26441  return table.data;
26442}
26443function validateOS2Table(os2, file) {
26444  file.pos = (file.start || 0) + os2.offset;
26445  const version = file.getUint16();
26446  file.skip(60);
26447  const selection = file.getUint16();
26448  if (version < 4 && selection & 0x0300) {
26449    return false;
26450  }
26451  const firstChar = file.getUint16();
26452  const lastChar = file.getUint16();
26453  if (firstChar > lastChar) {
26454    return false;
26455  }
26456  file.skip(6);
26457  const usWinAscent = file.getUint16();
26458  if (usWinAscent === 0) {
26459    return false;
26460  }
26461  os2.data[8] = os2.data[9] = 0;
26462  return true;
26463}
26464function createOS2Table(properties, charstrings, override) {
26465  override ||= {
26466    unitsPerEm: 0,
26467    yMax: 0,
26468    yMin: 0,
26469    ascent: 0,
26470    descent: 0
26471  };
26472  let ulUnicodeRange1 = 0;
26473  let ulUnicodeRange2 = 0;
26474  let ulUnicodeRange3 = 0;
26475  let ulUnicodeRange4 = 0;
26476  let firstCharIndex = null;
26477  let lastCharIndex = 0;
26478  let position = -1;
26479  if (charstrings) {
26480    for (let code in charstrings) {
26481      code |= 0;
26482      if (firstCharIndex > code || !firstCharIndex) {
26483        firstCharIndex = code;
26484      }
26485      if (lastCharIndex < code) {
26486        lastCharIndex = code;
26487      }
26488      position = getUnicodeRangeFor(code, position);
26489      if (position < 32) {
26490        ulUnicodeRange1 |= 1 << position;
26491      } else if (position < 64) {
26492        ulUnicodeRange2 |= 1 << position - 32;
26493      } else if (position < 96) {
26494        ulUnicodeRange3 |= 1 << position - 64;
26495      } else if (position < 123) {
26496        ulUnicodeRange4 |= 1 << position - 96;
26497      } else {
26498        throw new FormatError("Unicode ranges Bits > 123 are reserved for internal usage");
26499      }
26500    }
26501    if (lastCharIndex > 0xffff) {
26502      lastCharIndex = 0xffff;
26503    }
26504  } else {
26505    firstCharIndex = 0;
26506    lastCharIndex = 255;
26507  }
26508  const bbox = properties.bbox || [0, 0, 0, 0];
26509  const unitsPerEm = override.unitsPerEm || (properties.fontMatrix ? 1 / Math.max(...properties.fontMatrix.slice(0, 4).map(Math.abs)) : 1000);
26510  const scale = properties.ascentScaled ? 1.0 : unitsPerEm / PDF_GLYPH_SPACE_UNITS;
26511  const typoAscent = override.ascent || Math.round(scale * (properties.ascent || bbox[3]));
26512  let typoDescent = override.descent || Math.round(scale * (properties.descent || bbox[1]));
26513  if (typoDescent > 0 && properties.descent > 0 && bbox[1] < 0) {
26514    typoDescent = -typoDescent;
26515  }
26516  const winAscent = override.yMax || typoAscent;
26517  const winDescent = -override.yMin || -typoDescent;
26518  const os2 = new TrueTypeTableBuilder({
26519    exactLength: 96
26520  });
26521  os2.setArray([0x00, 0x03]);
26522  os2.setArray([0x02, 0x24]);
26523  os2.setArray([0x01, 0xf4]);
26524  os2.setArray([0x00, 0x05]);
26525  os2.skip(2);
26526  os2.setArray([0x02, 0x8a]);
26527  os2.setArray([0x02, 0xbb]);
26528  os2.skip(2);
26529  os2.setArray([0x00, 0x8c]);
26530  os2.setArray([0x02, 0x8a]);
26531  os2.setArray([0x02, 0xbb]);
26532  os2.skip(2);
26533  os2.setArray([0x01, 0xdf]);
26534  os2.setArray([0x00, 0x31]);
26535  os2.setArray([0x01, 0x02]);
26536  os2.skip(2);
26537  os2.setArray([0x00, 0x00, 0x06, properties.fixedPitch ? 0x09 : 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]);
26538  os2.setInt32(ulUnicodeRange1);
26539  os2.setInt32(ulUnicodeRange2);
26540  os2.setInt32(ulUnicodeRange3);
26541  os2.setInt32(ulUnicodeRange4);
26542  os2.setArray([0x2a, 0x32, 0x31, 0x2a]);
26543  os2.setInt16(properties.italicAngle ? 1 : 0);
26544  os2.setInt16(firstCharIndex || properties.firstChar);
26545  os2.setInt16(lastCharIndex || properties.lastChar);
26546  os2.setInt16(typoAscent);
26547  os2.setInt16(typoDescent);
26548  os2.setArray([0x00, 0x64]);
26549  os2.setInt16(winAscent);
26550  os2.setInt16(winDescent);
26551  os2.skip(4 + 4);
26552  os2.setInt16(properties.xHeight);
26553  os2.setInt16(properties.capHeight);
26554  os2.skip(2);
26555  os2.setInt16(firstCharIndex || properties.firstChar);
26556  os2.setArray([0x00, 0x03]);
26557  return os2.data;
26558}
26559function createPostTable(properties) {
26560  const post = new TrueTypeTableBuilder({
26561    exactLength: 32
26562  });
26563  post.setArray([0x00, 0x03, 0x00, 0x00]);
26564  post.setInt32(Math.floor(properties.italicAngle * 2 ** 16));
26565  post.skip(2 + 2);
26566  post.setInt32(properties.fixedPitch ? 1 : 0);
26567  post.skip(4 + 4 + 4 + 4);
26568  return post.data;
26569}
26570function createPostscriptName(name) {
26571  return name.replaceAll(/[^\x21-\x7E]|[[\](){}<>/%]/g, "").slice(0, 63);
26572}
26573function createNameTable(name, proto) {
26574  proto ||= [[], []];
26575  const strings = [proto[0][0] || "Original licence", proto[0][1] || name, proto[0][2] || "Unknown", proto[0][3] || "uniqueID", proto[0][4] || name, proto[0][5] || "Version 0.11", proto[0][6] || createPostscriptName(name), proto[0][7] || "Unknown", proto[0][8] || "Unknown", proto[0][9] || "Unknown"];
26576  const stringsBytes = strings.map(s => stringToBytes(s));
26577  const stringsUnicodeBytes = new Array(strings.length);
26578  let i, ii, j, jj, str;
26579  for (i = 0, ii = strings.length; i < ii; i++) {
26580    str = proto[1][i] || strings[i];
26581    const strUnicode = new TrueTypeTableBuilder({
26582      exactLength: str.length * 2
26583    });
26584    for (j = 0, jj = str.length; j < jj; j++) {
26585      strUnicode.setInt16(str.charCodeAt(j));
26586    }
26587    stringsUnicodeBytes[i] = strUnicode.data;
26588  }
26589  const namesBytes = [stringsBytes, stringsUnicodeBytes];
26590  const platformsBytes = [[0x00, 0x01], [0x00, 0x03]];
26591  const encodingsBytes = [[0x00, 0x00], [0x00, 0x01]];
26592  const languagesBytes = [[0x00, 0x00], [0x04, 0x09]];
26593  const nameRecords = [];
26594  let strOffset = 0;
26595  for (i = 0, ii = platformsBytes.length; i < ii; i++) {
26596    const strs = namesBytes[i];
26597    for (j = 0, jj = strs.length; j < jj; j++) {
26598      str = strs[j];
26599      const nameRecord = new TrueTypeTableBuilder({
26600        exactLength: 6 + platformsBytes[i].length + encodingsBytes[i].length + languagesBytes[i].length
26601      });
26602      nameRecord.setArray(platformsBytes[i]);
26603      nameRecord.setArray(encodingsBytes[i]);
26604      nameRecord.setArray(languagesBytes[i]);
26605      nameRecord.setInt16(j);
26606      nameRecord.setInt16(str.length);
26607      nameRecord.setInt16(strOffset);
26608      nameRecords.push(nameRecord.data);
26609      strOffset += str.length;
26610    }
26611  }
26612  const namesRecordCount = stringsBytes.length * platformsBytes.length;
26613  const nameTable = new TrueTypeTableBuilder({
26614    exactLength: 6 + Math.sumPrecise(nameRecords.map(arr => arr.length)) + Math.sumPrecise(stringsBytes.map(arr => arr.length)) + Math.sumPrecise(stringsUnicodeBytes.map(arr => arr.length))
26615  });
26616  nameTable.skip(2);
26617  nameTable.setInt16(namesRecordCount);
26618  nameTable.setInt16(namesRecordCount * 12 + 6);
26619  for (const arr of nameRecords) {
26620    nameTable.setArray(arr);
26621  }
26622  for (const arr of stringsBytes) {
26623    nameTable.setArray(arr);
26624  }
26625  for (const arr of stringsUnicodeBytes) {
26626    nameTable.setArray(arr);
26627  }
26628  return nameTable.data;
26629}
26630class Font {
26631  #charsCache = new Map();
26632  #glyphCache = new Map();
26633  charProcOperatorList;
26634  constructor(name, file, properties, evaluatorOptions) {
26635    this.name = name;
26636    this.psName = null;
26637    this.mimetype = null;
26638    this.disableFontFace = evaluatorOptions.disableFontFace;
26639    this.fontExtraProperties = evaluatorOptions.fontExtraProperties;
26640    this.loadedName = properties.loadedName;
26641    this.isType3Font = properties.isType3Font;
26642    this.missingFile = false;
26643    this.cssFontInfo = properties.cssFontInfo;
26644    let isSerifFont = !!(properties.flags & FontFlags.Serif);
26645    if (!isSerifFont && !properties.isSimulatedFlags) {
26646      const stdFontMap = getStdFontMap(),
26647        nonStdFontMap = getNonStdFontMap(),
26648        serifFonts = getSerifFonts();
26649      for (const namePart of name.split("+")) {
26650        let fontName = normalizeFontName(namePart);
26651        fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName;
26652        fontName = fontName.split("-", 1)[0];
26653        if (serifFonts[fontName]) {
26654          isSerifFont = true;
26655          break;
26656        }
26657      }
26658    }
26659    this.isSerifFont = isSerifFont;
26660    this.isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
26661    this.isMonospace = !!(properties.flags & FontFlags.FixedPitch);
26662    let {
26663      type,
26664      subtype
26665    } = properties;
26666    this.type = type;
26667    this.subtype = subtype;
26668    this.systemFontInfo = properties.systemFontInfo;
26669    const matches = name.match(/^InvalidPDFjsFont_(.*)_\d+$/);
26670    this.isInvalidPDFjsFont = !!matches;
26671    if (this.isInvalidPDFjsFont) {
26672      this.fallbackName = matches[1];
26673    } else if (this.isMonospace) {
26674      this.fallbackName = "monospace";
26675    } else if (this.isSerifFont) {
26676      this.fallbackName = "serif";
26677    } else {
26678      this.fallbackName = "sans-serif";
26679    }
26680    if (this.systemFontInfo?.guessFallback) {
26681      this.systemFontInfo.guessFallback = false;
26682      this.systemFontInfo.css += `,${this.fallbackName}`;
26683    }
26684    this.differences = properties.differences;
26685    this.widths = properties.widths;
26686    this.defaultWidth = properties.defaultWidth;
26687    this.composite = properties.composite;
26688    this.cMap = properties.cMap;
26689    this.capHeight = properties.capHeight / PDF_GLYPH_SPACE_UNITS;
26690    this.ascent = properties.ascent / PDF_GLYPH_SPACE_UNITS;
26691    this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS;
26692    this.lineHeight = this.ascent - this.descent;
26693    this.fontMatrix = properties.fontMatrix;
26694    this.bbox = properties.bbox;
26695    this.defaultEncoding = properties.defaultEncoding;
26696    this.toUnicode = properties.toUnicode;
26697    this.toFontChar = [];
26698    if (properties.type === "Type3") {
26699      for (let charCode = 0; charCode < 256; charCode++) {
26700        this.toFontChar[charCode] = this.differences[charCode] || properties.defaultEncoding[charCode];
26701      }
26702      return;
26703    }
26704    this.cidEncoding = properties.cidEncoding || "";
26705    this.vertical = !!properties.vertical;
26706    if (this.vertical) {
26707      this.vmetrics = properties.vmetrics;
26708      this.defaultVMetrics = properties.defaultVMetrics;
26709    }
26710    if (!file || file.isEmpty) {
26711      if (file) {
26712        warn('Font file is empty in "' + name + '" (' + this.loadedName + ")");
26713      }
26714      this.fallbackToSystemFont(properties);
26715      return;
26716    }
26717    [type, subtype] = getFontFileType(file, properties);
26718    if (type !== this.type || subtype !== this.subtype) {
26719      info("Inconsistent font file Type/SubType, expected: " + `${this.type}/${this.subtype} but found: ${type}/${subtype}.`);
26720    }
26721    let data;
26722    try {
26723      switch (type) {
26724        case "MMType1":
26725          info("MMType1 font (" + name + "), falling back to Type1.");
26726        case "Type1":
26727        case "CIDFontType0":
26728          this.mimetype = "font/opentype";
26729          const cff = subtype === "Type1C" || subtype === "CIDFontType0C" ? new CFFFont(file, properties) : new Type1Font(name, file, properties);
26730          adjustWidths(properties);
26731          data = this.convert(name, cff, properties);
26732          break;
26733        case "OpenType":
26734        case "TrueType":
26735        case "CIDFontType2":
26736          this.mimetype = "font/opentype";
26737          data = this.checkAndRepair(name, file, properties);
26738          adjustWidths(properties);
26739          if (this.isOpenType) {
26740            type = "OpenType";
26741          }
26742          break;
26743        default:
26744          throw new FormatError(`Font ${type} is not supported`);
26745      }
26746    } catch (e) {
26747      warn(e);
26748      this.fallbackToSystemFont(properties);
26749      return;
26750    }
26751    amendFallbackToUnicode(properties);
26752    this.data = data;
26753    this.type = type;
26754    this.subtype = subtype;
26755    this.fontMatrix = properties.fontMatrix;
26756    this.widths = properties.widths;
26757    this.defaultWidth = properties.defaultWidth;
26758    this.toUnicode = properties.toUnicode;
26759    this.seacMap = properties.seacMap;
26760  }
26761  get renderer() {
26762    const renderer = FontRendererFactory.create(this, SEAC_ANALYSIS_ENABLED);
26763    return shadow(this, "renderer", renderer);
26764  }
26765  #getExportData(props) {
26766    const data = Object.create(null);
26767    for (const prop of props) {
26768      const value = this[prop];
26769      if (value !== undefined) {
26770        data[prop] = value;
26771      }
26772    }
26773    return data;
26774  }
26775  exportData() {
26776    return {
26777      buffer: compileFontInfo(this.#getExportData(EXPORT_DATA_PROPERTIES)),
26778      charProcOperatorList: this.charProcOperatorList,
26779      extra: this.fontExtraProperties ? this.#getExportData(EXPORT_DATA_EXTRA_PROPERTIES) : undefined
26780    };
26781  }
26782  fallbackToSystemFont(properties) {
26783    this.missingFile = true;
26784    const {
26785      name,
26786      type
26787    } = this;
26788    let fontName = normalizeFontName(name);
26789    const stdFontMap = getStdFontMap(),
26790      nonStdFontMap = getNonStdFontMap();
26791    const isStandardFont = !!stdFontMap[fontName];
26792    const isMappedToStandardFont = !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]);
26793    fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName;
26794    const fontBasicMetricsMap = getFontBasicMetrics();
26795    const metrics = fontBasicMetricsMap[fontName];
26796    if (metrics) {
26797      if (isNaN(this.ascent)) {
26798        this.ascent = metrics.ascent / PDF_GLYPH_SPACE_UNITS;
26799      }
26800      if (isNaN(this.descent)) {
26801        this.descent = metrics.descent / PDF_GLYPH_SPACE_UNITS;
26802      }
26803      if (isNaN(this.capHeight)) {
26804        this.capHeight = metrics.capHeight / PDF_GLYPH_SPACE_UNITS;
26805      }
26806    }
26807    this.bold = /bold/gi.test(fontName);
26808    this.italic = /oblique|italic/gi.test(fontName);
26809    this.black = /Black/g.test(name);
vendor: 6,583 bytes, lines 26810-26980
26810    const isNarrow = /Narrow/g.test(name);
26811    this.remeasure = (!isStandardFont || isNarrow) && Object.keys(this.widths).length > 0;
26812    if ((isStandardFont || isMappedToStandardFont) && type === "CIDFontType2" && this.cidEncoding.startsWith("Identity-")) {
26813      const cidToGidMap = properties.cidToGidMap;
26814      const map = [];
26815      applyStandardFontGlyphMap(map, getGlyphMapForStandardFonts());
26816      if (/Arial-?Black/i.test(name)) {
26817        applyStandardFontGlyphMap(map, getSupplementalGlyphMapForArialBlack());
26818      } else if (/Calibri/i.test(name)) {
26819        applyStandardFontGlyphMap(map, getSupplementalGlyphMapForCalibri());
26820      }
26821      if (cidToGidMap) {
26822        for (const charCode in map) {
26823          const cid = map[charCode];
26824          if (cidToGidMap[cid] !== undefined) {
26825            map[+charCode] = cidToGidMap[cid];
26826          }
26827        }
26828        if (cidToGidMap.length !== this.toUnicode.length && properties.hasIncludedToUnicodeMap && this.toUnicode instanceof IdentityToUnicodeMap) {
26829          this.toUnicode.forEach(function (charCode, unicodeCharCode) {
26830            const cid = map[charCode];
26831            if (cidToGidMap[cid] === undefined) {
26832              map[+charCode] = unicodeCharCode;
26833            }
26834          });
26835        }
26836      }
26837      if (!(this.toUnicode instanceof IdentityToUnicodeMap)) {
26838        this.toUnicode.forEach(function (charCode, unicodeCharCode) {
26839          map[+charCode] = unicodeCharCode;
26840        });
26841      }
26842      this.toFontChar = map;
26843      this.toUnicode = new ToUnicodeMap(map);
26844    } else if (/Symbol/i.test(fontName)) {
26845      this.toFontChar = buildToFontChar(SymbolSetEncoding, getGlyphsUnicode(), this.differences);
26846    } else if (/Dingbats/i.test(fontName)) {
26847      this.toFontChar = buildToFontChar(ZapfDingbatsEncoding, getDingbatsGlyphsUnicode(), this.differences);
26848    } else if (isStandardFont || isMappedToStandardFont) {
26849      const map = buildToFontChar(this.defaultEncoding, getGlyphsUnicode(), this.differences);
26850      if (type === "CIDFontType2" && !this.cidEncoding.startsWith("Identity-") && !(this.toUnicode instanceof IdentityToUnicodeMap)) {
26851        this.toUnicode.forEach(function (charCode, unicodeCharCode) {
26852          map[+charCode] = unicodeCharCode;
26853        });
26854      }
26855      this.toFontChar = map;
26856    } else {
26857      const glyphsUnicodeMap = getGlyphsUnicode();
26858      const map = [];
26859      this.toUnicode.forEach((charCode, unicodeCharCode) => {
26860        if (!this.composite) {
26861          const glyphName = this.differences[charCode] || this.defaultEncoding[charCode];
26862          const unicode = getUnicodeForGlyph(glyphName, glyphsUnicodeMap);
26863          if (unicode !== -1) {
26864            unicodeCharCode = unicode;
26865          }
26866        }
26867        map[+charCode] = unicodeCharCode;
26868      });
26869      if (this.composite && this.toUnicode instanceof IdentityToUnicodeMap) {
26870        if (/Tahoma|Verdana/i.test(name)) {
26871          applyStandardFontGlyphMap(map, getGlyphMapForStandardFonts());
26872        }
26873      }
26874      this.toFontChar = map;
26875    }
26876    amendFallbackToUnicode(properties);
26877    this.loadedName = fontName.split("-", 1)[0];
26878  }
26879  checkAndRepair(name, font, properties) {
26880    const VALID_TABLES = ["OS/2", "cmap", "head", "hhea", "hmtx", "maxp", "name", "post", "loca", "glyf", "fpgm", "prep", "cvt ", "CFF "];
26881    function readTables(file, numTables) {
26882      const tables = Object.create(null);
26883      tables["OS/2"] = null;
26884      tables.cmap = null;
26885      tables.head = null;
26886      tables.hhea = null;
26887      tables.hmtx = null;
26888      tables.maxp = null;
26889      tables.name = null;
26890      tables.post = null;
26891      for (let i = 0; i < numTables; i++) {
26892        const table = readTableEntry(file);
26893        if (!VALID_TABLES.includes(table.tag)) {
26894          continue;
26895        }
26896        if (table.length === 0) {
26897          continue;
26898        }
26899        tables[table.tag] = table;
26900      }
26901      return tables;
26902    }
26903    function readTableEntry(file) {
26904      const tag = file.getString(4);
26905      const checksum = file.getInt32() >>> 0;
26906      const offset = file.getInt32() >>> 0;
26907      const length = file.getInt32() >>> 0;
26908      const previousPosition = file.pos;
26909      file.pos = file.start || 0;
26910      file.skip(offset);
26911      const data = file.getBytes(length);
26912      file.pos = previousPosition;
26913      if (tag === "head") {
26914        data[8] = data[9] = data[10] = data[11] = 0;
26915        data[17] |= 0x20;
26916      }
26917      return {
26918        tag,
26919        checksum,
26920        length,
26921        offset,
26922        data,
26923        view: new DataView(data.buffer, data.byteOffset, data.byteLength)
26924      };
26925    }
26926    function readOpenTypeHeader(ttf) {
26927      return {
26928        version: ttf.getString(4),
26929        numTables: ttf.getUint16(),
26930        searchRange: ttf.getUint16(),
26931        entrySelector: ttf.getUint16(),
26932        rangeShift: ttf.getUint16()
26933      };
26934    }
26935    function readTrueTypeCollectionHeader(ttc) {
26936      const ttcTag = ttc.getString(4);
26937      assert(ttcTag === "ttcf", "Must be a TrueType Collection font.");
26938      const majorVersion = ttc.getUint16();
26939      const minorVersion = ttc.getUint16();
26940      const numFonts = ttc.getInt32() >>> 0;
26941      const offsetTable = [];
26942      for (let i = 0; i < numFonts; i++) {
26943        offsetTable.push(ttc.getInt32() >>> 0);
26944      }
26945      const header = {
26946        ttcTag,
26947        majorVersion,
26948        minorVersion,
26949        numFonts,
26950        offsetTable
26951      };
26952      switch (majorVersion) {
26953        case 1:
26954          return header;
26955        case 2:
26956          header.dsigTag = ttc.getInt32() >>> 0;
26957          header.dsigLength = ttc.getInt32() >>> 0;
26958          header.dsigOffset = ttc.getInt32() >>> 0;
26959          return header;
26960      }
26961      throw new FormatError(`Invalid TrueType Collection majorVersion: ${majorVersion}.`);
26962    }
26963    function readTrueTypeCollectionData(ttc, fontName) {
26964      const {
26965        numFonts,
26966        offsetTable
26967      } = readTrueTypeCollectionHeader(ttc);
26968      const fontNameParts = fontName.split("+");
26969      let fallbackData;
26970      for (let i = 0; i < numFonts; i++) {
26971        ttc.pos = (ttc.start || 0) + offsetTable[i];
26972        const potentialHeader = readOpenTypeHeader(ttc);
26973        const potentialTables = readTables(ttc, potentialHeader.numTables);
26974        if (!potentialTables.name) {
26975          throw new FormatError('TrueType Collection font must contain a "name" table.');
26976        }
26977        const [nameTable] = readNameTable(potentialTables.name);
26978        for (let j = 0, jj = nameTable.length; j < jj; j++) {
26979          for (let k = 0, kk = nameTable[j].length; k < kk; k++) {
26980            const nameEntry = nameTable[j][k]
vendor: 6,959 bytes, lines 26980-27191
26980?.replaceAll(/\s/g, "");
26981            if (!nameEntry) {
26982              continue;
26983            }
26984            if (nameEntry === fontName) {
26985              return {
26986                header: potentialHeader,
26987                tables: potentialTables
26988              };
26989            }
26990            if (fontNameParts.length < 2) {
26991              continue;
26992            }
26993            for (const part of fontNameParts) {
26994              if (nameEntry === part) {
26995                fallbackData = {
26996                  name: part,
26997                  header: potentialHeader,
26998                  tables: potentialTables
26999                };
27000              }
27001            }
27002          }
27003        }
27004      }
27005      if (fallbackData) {
27006        warn(`TrueType Collection does not contain "${fontName}" font, ` + `falling back to "${fallbackData.name}" font instead.`);
27007        return {
27008          header: fallbackData.header,
27009          tables: fallbackData.tables
27010        };
27011      }
27012      throw new FormatError(`TrueType Collection does not contain "${fontName}" font.`);
27013    }
27014    function readCmapTable(cmap, file, isSymbolicFont, hasEncoding) {
27015      if (!cmap) {
27016        warn("No cmap table available.");
27017        return {
27018          platformId: -1,
27019          encodingId: -1,
27020          mappings: [],
27021          hasShortCmap: false
27022        };
27023      }
27024      let segment;
27025      let start = (file.start || 0) + cmap.offset;
27026      file.pos = start;
27027      file.skip(2);
27028      const numTables = file.getUint16();
27029      let potentialTable;
27030      let canBreak = false;
27031      for (let i = 0; i < numTables; i++) {
27032        const platformId = file.getUint16();
27033        const encodingId = file.getUint16();
27034        const offset = file.getInt32() >>> 0;
27035        let useTable = false;
27036        if (potentialTable?.platformId === platformId && potentialTable?.encodingId === encodingId) {
27037          continue;
27038        }
27039        if (platformId === 0 && (encodingId === 0 || encodingId === 1 || encodingId === 3)) {
27040          useTable = true;
27041        } else if (platformId === 1 && encodingId === 0) {
27042          useTable = true;
27043        } else if (platformId === 3 && encodingId === 1 && (hasEncoding || !potentialTable)) {
27044          useTable = true;
27045          if (!isSymbolicFont) {
27046            canBreak = true;
27047          }
27048        } else if (isSymbolicFont && platformId === 3 && encodingId === 0) {
27049          useTable = true;
27050          let correctlySorted = true;
27051          if (i < numTables - 1) {
27052            const nextBytes = file.peekBytes(2),
27053              nextPlatformId = int16(nextBytes[0], nextBytes[1]);
27054            if (nextPlatformId < platformId) {
27055              correctlySorted = false;
27056            }
27057          }
27058          if (correctlySorted) {
27059            canBreak = true;
27060          }
27061        }
27062        if (useTable) {
27063          potentialTable = {
27064            platformId,
27065            encodingId,
27066            offset
27067          };
27068        }
27069        if (canBreak) {
27070          break;
27071        }
27072      }
27073      if (potentialTable) {
27074        file.pos = start + potentialTable.offset;
27075      }
27076      if (!potentialTable || file.peekByte() === -1) {
27077        warn("Could not find a preferred cmap table.");
27078        return {
27079          platformId: -1,
27080          encodingId: -1,
27081          mappings: [],
27082          hasShortCmap: false
27083        };
27084      }
27085      const format = file.getUint16();
27086      let hasShortCmap = false;
27087      const mappings = [];
27088      let j, glyphId;
27089      if (format === 0) {
27090        file.skip(2 + 2);
27091        for (j = 0; j < 256; j++) {
27092          const index = file.getByte();
27093          if (!index) {
27094            continue;
27095          }
27096          mappings.push({
27097            charCode: j,
27098            glyphId: index
27099          });
27100        }
27101        hasShortCmap = true;
27102      } else if (format === 2) {
27103        file.skip(2 + 2);
27104        const subHeaderKeys = [];
27105        let maxSubHeaderKey = 0;
27106        for (let i = 0; i < 256; i++) {
27107          const subHeaderKey = file.getUint16() >> 3;
27108          subHeaderKeys.push(subHeaderKey);
27109          maxSubHeaderKey = Math.max(subHeaderKey, maxSubHeaderKey);
27110        }
27111        const subHeaders = [];
27112        for (let i = 0; i <= maxSubHeaderKey; i++) {
27113          subHeaders.push({
27114            firstCode: file.getUint16(),
27115            entryCount: file.getUint16(),
27116            idDelta: signedInt16(file.getByte(), file.getByte()),
27117            idRangePos: file.pos + file.getUint16()
27118          });
27119        }
27120        for (let i = 0; i < 256; i++) {
27121          if (subHeaderKeys[i] === 0) {
27122            file.pos = subHeaders[0].idRangePos + 2 * i;
27123            glyphId = file.getUint16();
27124            mappings.push({
27125              charCode: i,
27126              glyphId
27127            });
27128          } else {
27129            const s = subHeaders[subHeaderKeys[i]];
27130            for (j = 0; j < s.entryCount; j++) {
27131              const charCode = (i << 8) + j + s.firstCode;
27132              file.pos = s.idRangePos + 2 * j;
27133              glyphId = file.getUint16();
27134              if (glyphId !== 0) {
27135                glyphId = (glyphId + s.idDelta) % 65536;
27136              }
27137              mappings.push({
27138                charCode,
27139                glyphId
27140              });
27141            }
27142          }
27143        }
27144      } else if (format === 4) {
27145        file.skip(2 + 2);
27146        const segCount = file.getUint16() >> 1;
27147        file.skip(6);
27148        const segments = [];
27149        let segIndex;
27150        for (segIndex = 0; segIndex < segCount; segIndex++) {
27151          segments.push({
27152            end: file.getUint16()
27153          });
27154        }
27155        file.skip(2);
27156        for (segIndex = 0; segIndex < segCount; segIndex++) {
27157          segments[segIndex].start = file.getUint16();
27158        }
27159        for (segIndex = 0; segIndex < segCount; segIndex++) {
27160          segments[segIndex].delta = file.getUint16();
27161        }
27162        let offsetsCount = 0,
27163          offsetIndex;
27164        for (segIndex = 0; segIndex < segCount; segIndex++) {
27165          segment = segments[segIndex];
27166          const rangeOffset = file.getUint16();
27167          if (!rangeOffset) {
27168            segment.offsetIndex = -1;
27169            continue;
27170          }
27171          offsetIndex = (rangeOffset >> 1) - (segCount - segIndex);
27172          segment.offsetIndex = offsetIndex;
27173          offsetsCount = Math.max(offsetsCount, offsetIndex + segment.end - segment.start + 1);
27174        }
27175        const offsets = [];
27176        for (j = 0; j < offsetsCount; j++) {
27177          offsets.push(file.getUint16());
27178        }
27179        for (segIndex = 0; segIndex < segCount; segIndex++) {
27180          segment = segments[segIndex];
27181          start = segment.start;
27182          const end = segment.end;
27183          const delta = segment.delta;
27184          offsetIndex = segment.offsetIndex;
27185          for (j = start; j <= end; j++) {
27186            if (j === 0xffff) {
27187              continue;
27188            }
27189            glyphId = offsetIndex < 0 ? j : offsets[offsetIndex + j - start];
27190            glyphId = glyphId + delta & 0xffff;
27191            mappings.push({
vendor: 6,754 bytes, lines 27192-27400
27192              charCode: j,
27193              glyphId
27194            });
27195          }
27196        }
27197      } else if (format === 6) {
27198        file.skip(2 + 2);
27199        const firstCode = file.getUint16();
27200        const entryCount = file.getUint16();
27201        for (j = 0; j < entryCount; j++) {
27202          glyphId = file.getUint16();
27203          const charCode = firstCode + j;
27204          mappings.push({
27205            charCode,
27206            glyphId
27207          });
27208        }
27209      } else if (format === 12) {
27210        file.skip(2 + 4 + 4);
27211        const nGroups = file.getInt32() >>> 0;
27212        for (j = 0; j < nGroups; j++) {
27213          const startCharCode = file.getInt32() >>> 0;
27214          const endCharCode = file.getInt32() >>> 0;
27215          let glyphCode = file.getInt32() >>> 0;
27216          for (let charCode = startCharCode; charCode <= endCharCode; charCode++) {
27217            mappings.push({
27218              charCode,
27219              glyphId: glyphCode++
27220            });
27221          }
27222        }
27223      } else {
27224        warn("cmap table has unsupported format: " + format);
27225        return {
27226          platformId: -1,
27227          encodingId: -1,
27228          mappings: [],
27229          hasShortCmap: false
27230        };
27231      }
27232      mappings.sort((a, b) => a.charCode - b.charCode);
27233      const finalMappings = [],
27234        seenCharCodes = new Set();
27235      for (const map of mappings) {
27236        const {
27237          charCode
27238        } = map;
27239        if (seenCharCodes.has(charCode)) {
27240          continue;
27241        }
27242        seenCharCodes.add(charCode);
27243        finalMappings.push(map);
27244      }
27245      return {
27246        platformId: potentialTable.platformId,
27247        encodingId: potentialTable.encodingId,
27248        mappings: finalMappings,
27249        hasShortCmap
27250      };
27251    }
27252    function sanitizeMetrics(file, header, metrics, headTable, numGlyphs, dupFirstEntry) {
27253      if (!header) {
27254        if (metrics) {
27255          metrics.data = null;
27256        }
27257        return;
27258      }
27259      file.pos = (file.start || 0) + header.offset;
27260      file.pos += 4;
27261      file.pos += 2;
27262      file.pos += 2;
27263      file.pos += 2;
27264      file.pos += 2;
27265      file.pos += 2;
27266      file.pos += 2;
27267      file.pos += 2;
27268      file.pos += 2;
27269      file.pos += 2;
27270      const caretOffset = file.getUint16();
27271      file.pos += 8;
27272      file.pos += 2;
27273      let numOfMetrics = file.getUint16();
27274      if (caretOffset !== 0) {
27275        const macStyle = int16(headTable.data[44], headTable.data[45]);
27276        if (!(macStyle & 2)) {
27277          header.data[22] = 0;
27278          header.data[23] = 0;
27279        }
27280      }
27281      if (numOfMetrics > numGlyphs) {
27282        info(`The numOfMetrics (${numOfMetrics}) should not be ` + `greater than the numGlyphs (${numGlyphs}).`);
27283        numOfMetrics = numGlyphs;
27284        header.data[34] = (numOfMetrics & 0xff00) >> 8;
27285        header.data[35] = numOfMetrics & 0x00ff;
27286      }
27287      const numOfSidebearings = numGlyphs - numOfMetrics;
27288      const numMissing = numOfSidebearings - (metrics.length - numOfMetrics * 4 >> 1);
27289      if (numMissing > 0) {
27290        const entries = new Uint8Array(metrics.length + numMissing * 2);
27291        entries.set(metrics.data);
27292        if (dupFirstEntry) {
27293          entries[metrics.length] = metrics.data[2];
27294          entries[metrics.length + 1] = metrics.data[3];
27295        }
27296        metrics.data = entries;
27297      }
27298    }
27299    function sanitizeGlyph(source, sourceStart, sourceEnd, dest, destStart, hintsValid) {
27300      const glyphProfile = {
27301        length: 0,
27302        sizeOfInstructions: 0
27303      };
27304      if (sourceStart < 0 || sourceStart >= source.length || sourceEnd > source.length || sourceEnd - sourceStart <= 12) {
27305        return glyphProfile;
27306      }
27307      const glyf = source.subarray(sourceStart, sourceEnd);
27308      const xMin = signedInt16(glyf[2], glyf[3]);
27309      const yMin = signedInt16(glyf[4], glyf[5]);
27310      const xMax = signedInt16(glyf[6], glyf[7]);
27311      const yMax = signedInt16(glyf[8], glyf[9]);
27312      if (xMin > xMax) {
27313        writeSignedInt16(glyf, 2, xMax);
27314        writeSignedInt16(glyf, 6, xMin);
27315      }
27316      if (yMin > yMax) {
27317        writeSignedInt16(glyf, 4, yMax);
27318        writeSignedInt16(glyf, 8, yMin);
27319      }
27320      const contoursCount = signedInt16(glyf[0], glyf[1]);
27321      if (contoursCount < 0) {
27322        if (contoursCount < -1) {
27323          return glyphProfile;
27324        }
27325        dest.set(glyf, destStart);
27326        glyphProfile.length = glyf.length;
27327        return glyphProfile;
27328      }
27329      let i,
27330        j = 10,
27331        flagsCount = 0;
27332      for (i = 0; i < contoursCount; i++) {
27333        const endPoint = glyf[j] << 8 | glyf[j + 1];
27334        flagsCount = endPoint + 1;
27335        j += 2;
27336      }
27337      const instructionsStart = j;
27338      const instructionsLength = glyf[j] << 8 | glyf[j + 1];
27339      glyphProfile.sizeOfInstructions = instructionsLength;
27340      j += 2 + instructionsLength;
27341      const instructionsEnd = j;
27342      let coordinatesLength = 0;
27343      for (i = 0; i < flagsCount; i++) {
27344        const flag = glyf[j++];
27345        if (flag & 0xc0) {
27346          glyf[j - 1] = flag & 0x3f;
27347        }
27348        let xLength = 2;
27349        if (flag & 2) {
27350          xLength = 1;
27351        } else if (flag & 16) {
27352          xLength = 0;
27353        }
27354        let yLength = 2;
27355        if (flag & 4) {
27356          yLength = 1;
27357        } else if (flag & 32) {
27358          yLength = 0;
27359        }
27360        const xyLength = xLength + yLength;
27361        coordinatesLength += xyLength;
27362        if (flag & 8) {
27363          const repeat = glyf[j++];
27364          if (repeat === 0) {
27365            glyf[j - 1] ^= 8;
27366          }
27367          i += repeat;
27368          coordinatesLength += repeat * xyLength;
27369        }
27370      }
27371      if (coordinatesLength === 0) {
27372        return glyphProfile;
27373      }
27374      let glyphDataLength = j + coordinatesLength;
27375      if (glyphDataLength > glyf.length) {
27376        return glyphProfile;
27377      }
27378      if (!hintsValid && instructionsLength > 0) {
27379        dest.set(glyf.subarray(0, instructionsStart), destStart);
27380        dest.set([0, 0], destStart + instructionsStart);
27381        dest.set(glyf.subarray(instructionsEnd, glyphDataLength), destStart + instructionsStart + 2);
27382        glyphDataLength -= instructionsLength;
27383        if (glyf.length - glyphDataLength > 3) {
27384          glyphDataLength = glyphDataLength + 3 & ~3;
27385        }
27386        glyphProfile.length = glyphDataLength;
27387        return glyphProfile;
27388      }
27389      if (glyf.length - glyphDataLength > 3) {
27390        glyphDataLength = glyphDataLength + 3 & ~3;
27391        dest.set(glyf.subarray(0, glyphDataLength), destStart);
27392        glyphProfile.length = glyphDataLength;
27393        return glyphProfile;
27394      }
27395      dest.set(glyf, destStart);
27396      glyphProfile.length = glyf.length;
27397      return glyphProfile;
27398    }
27399    function sanitizeHead(head, numGlyphs, locaLength) {
27400      const 
vendor: 3,608 bytes, lines 27400-27496
27400{
27401        data,
27402        view
27403      } = head;
27404      const version = view.getInt32(0);
27405      if (version >> 16 !== 1) {
27406        info("Attempting to fix invalid version in head table: " + version);
27407        view.setInt32(0, 0x00010000);
27408      }
27409      const indexToLocFormat = signedInt16(data[50], data[51]);
27410      if (indexToLocFormat < 0 || indexToLocFormat > 1) {
27411        info("Attempting to fix invalid indexToLocFormat in head table: " + indexToLocFormat);
27412        const numGlyphsPlusOne = numGlyphs + 1;
27413        if (locaLength === numGlyphsPlusOne << 1) {
27414          data[50] = 0;
27415          data[51] = 0;
27416        } else if (locaLength === numGlyphsPlusOne << 2) {
27417          data[50] = 0;
27418          data[51] = 1;
27419        } else {
27420          throw new FormatError("Could not fix indexToLocFormat: " + indexToLocFormat);
27421        }
27422      }
27423    }
27424    function sanitizeGlyphLocations(loca, glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions) {
27425      let itemSize, itemDecode, itemEncode;
27426      if (isGlyphLocationsLong) {
27427        itemSize = 4;
27428        itemDecode = function fontItemDecodeLong(data, offset) {
27429          return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
27430        };
27431        itemEncode = function fontItemEncodeLong(data, offset, value) {
27432          data[offset] = value >>> 24 & 0xff;
27433          data[offset + 1] = value >> 16 & 0xff;
27434          data[offset + 2] = value >> 8 & 0xff;
27435          data[offset + 3] = value & 0xff;
27436        };
27437      } else {
27438        itemSize = 2;
27439        itemDecode = function fontItemDecode(data, offset) {
27440          return data[offset] << 9 | data[offset + 1] << 1;
27441        };
27442        itemEncode = function fontItemEncode(data, offset, value) {
27443          data[offset] = value >> 9 & 0xff;
27444          data[offset + 1] = value >> 1 & 0xff;
27445        };
27446      }
27447      const numGlyphsOut = dupFirstEntry ? numGlyphs + 1 : numGlyphs;
27448      const locaDataSize = itemSize * (1 + numGlyphsOut);
27449      const locaData = new Uint8Array(locaDataSize);
27450      locaData.set(loca.data.subarray(0, locaDataSize));
27451      loca.data = locaData;
27452      const oldGlyfData = glyf.data;
27453      const oldGlyfDataLength = oldGlyfData.length;
27454      const newGlyfData = new Uint8Array(oldGlyfDataLength);
27455      let i, j;
27456      const locaEntries = [];
27457      for (i = 0, j = 0; i < numGlyphs + 1; i++, j += itemSize) {
27458        let offset = itemDecode(locaData, j);
27459        if (offset > oldGlyfDataLength) {
27460          offset = oldGlyfDataLength;
27461        }
27462        locaEntries.push({
27463          index: i,
27464          offset,
27465          endOffset: 0
27466        });
27467      }
27468      locaEntries.sort((a, b) => a.offset - b.offset);
27469      for (i = 0; i < numGlyphs; i++) {
27470        locaEntries[i].endOffset = locaEntries[i + 1].offset;
27471      }
27472      locaEntries.sort((a, b) => a.index - b.index);
27473      for (i = 0; i < numGlyphs; i++) {
27474        const {
27475          offset,
27476          endOffset
27477        } = locaEntries[i];
27478        if (offset !== 0 || endOffset !== 0) {
27479          break;
27480        }
27481        const nextOffset = locaEntries[i + 1].offset;
27482        if (nextOffset === 0) {
27483          continue;
27484        }
27485        locaEntries[i].endOffset = nextOffset;
27486        break;
27487      }
27488      const last = locaEntries.at(-2);
27489      if (last.offset !== 0 && last.endOffset === 0) {
27490        last.endOffset = oldGlyfDataLength;
27491      }
27492      const missingGlyphs = Object.create(null);
27493      let writeOffset = 0;
27494      itemEncode(locaData, 0, writeOffset);
27495      for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) {
27496        const glyphProfile =
vendor: 13,573 bytes, lines 27496-27898
27496 sanitizeGlyph(oldGlyfData, locaEntries[i].offset, locaEntries[i].endOffset, newGlyfData, writeOffset, hintsValid);
27497        const newLength = glyphProfile.length;
27498        if (newLength === 0) {
27499          missingGlyphs[i] = true;
27500        }
27501        if (glyphProfile.sizeOfInstructions > maxSizeOfInstructions) {
27502          maxSizeOfInstructions = glyphProfile.sizeOfInstructions;
27503        }
27504        writeOffset += newLength;
27505        itemEncode(locaData, j, writeOffset);
27506      }
27507      if (writeOffset === 0) {
27508        const simpleGlyph = new Uint8Array([0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 0]);
27509        for (i = 0, j = itemSize; i < numGlyphsOut; i++, j += itemSize) {
27510          itemEncode(locaData, j, simpleGlyph.length);
27511        }
27512        glyf.data = simpleGlyph;
27513      } else if (dupFirstEntry) {
27514        const firstEntryLength = itemDecode(locaData, itemSize);
27515        if (newGlyfData.length > firstEntryLength + writeOffset) {
27516          glyf.data = newGlyfData.subarray(0, firstEntryLength + writeOffset);
27517        } else {
27518          glyf.data = new Uint8Array(firstEntryLength + writeOffset);
27519          glyf.data.set(newGlyfData.subarray(0, writeOffset));
27520        }
27521        glyf.data.set(newGlyfData.subarray(0, firstEntryLength), writeOffset);
27522        itemEncode(loca.data, locaData.length - itemSize, writeOffset + firstEntryLength);
27523      } else {
27524        glyf.data = newGlyfData.subarray(0, writeOffset);
27525      }
27526      return {
27527        missingGlyphs,
27528        maxSizeOfInstructions
27529      };
27530    }
27531    function readPostScriptTable(post, propertiesObj, maxpNumGlyphs) {
27532      const start = (font.start || 0) + post.offset;
27533      font.pos = start;
27534      const length = post.length,
27535        end = start + length;
27536      const version = font.getInt32();
27537      font.skip(28);
27538      let glyphNames;
27539      let valid = true;
27540      let i;
27541      switch (version) {
27542        case 0x00010000:
27543          glyphNames = MacStandardGlyphOrdering;
27544          break;
27545        case 0x00020000:
27546          const numGlyphs = font.getUint16();
27547          if (numGlyphs !== maxpNumGlyphs) {
27548            valid = false;
27549            break;
27550          }
27551          const glyphNameIndexes = [];
27552          for (i = 0; i < numGlyphs; ++i) {
27553            const index = font.getUint16();
27554            if (index >= 32768) {
27555              valid = false;
27556              break;
27557            }
27558            glyphNameIndexes.push(index);
27559          }
27560          if (!valid) {
27561            break;
27562          }
27563          const customNames = [];
27564          while (font.pos < end) {
27565            const strLen = font.getByte(),
27566              str = font.getString(strLen);
27567            customNames.push(str);
27568          }
27569          glyphNames = [];
27570          for (i = 0; i < numGlyphs; ++i) {
27571            const j = glyphNameIndexes[i];
27572            if (j < 258) {
27573              glyphNames.push(MacStandardGlyphOrdering[j]);
27574              continue;
27575            }
27576            glyphNames.push(customNames[j - 258]);
27577          }
27578          break;
27579        case 0x00030000:
27580          break;
27581        default:
27582          warn("Unknown/unsupported post table version " + version);
27583          valid = false;
27584          if (propertiesObj.defaultEncoding) {
27585            glyphNames = propertiesObj.defaultEncoding;
27586          }
27587          break;
27588      }
27589      propertiesObj.glyphNames = glyphNames;
27590      return valid;
27591    }
27592    function readNameTable(nameTable) {
27593      const start = (font.start || 0) + nameTable.offset;
27594      font.pos = start;
27595      const names = [[], []],
27596        records = [];
27597      const length = nameTable.length,
27598        end = start + length;
27599      const format = font.getUint16();
27600      const FORMAT_0_HEADER_LENGTH = 6;
27601      if (format !== 0 || length < FORMAT_0_HEADER_LENGTH) {
27602        return [names, records];
27603      }
27604      const numRecords = font.getUint16();
27605      const stringsStart = font.getUint16();
27606      const NAME_RECORD_LENGTH = 12;
27607      let i, ii;
27608      for (i = 0; i < numRecords && font.pos + NAME_RECORD_LENGTH <= end; i++) {
27609        const r = {
27610          platform: font.getUint16(),
27611          encoding: font.getUint16(),
27612          language: font.getUint16(),
27613          name: font.getUint16(),
27614          length: font.getUint16(),
27615          offset: font.getUint16()
27616        };
27617        if (isMacNameRecord(r) || isWinNameRecord(r)) {
27618          records.push(r);
27619        }
27620      }
27621      for (i = 0, ii = records.length; i < ii; i++) {
27622        const record = records[i];
27623        if (record.length <= 0) {
27624          continue;
27625        }
27626        const pos = start + stringsStart + record.offset;
27627        if (pos + record.length > end) {
27628          continue;
27629        }
27630        font.pos = pos;
27631        const nameIndex = record.name;
27632        if (record.encoding) {
27633          let str = "";
27634          for (let j = 0, jj = record.length; j < jj; j += 2) {
27635            str += String.fromCharCode(font.getUint16());
27636          }
27637          names[1][nameIndex] = str;
27638        } else {
27639          names[0][nameIndex] = font.getString(record.length);
27640        }
27641      }
27642      return [names, records];
27643    }
27644    const TTOpsStackDeltas = [0, 0, 0, 0, 0, 0, 0, 0, -2, -2, -2, -2, 0, 0, -2, -5, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, -1, 0, -1, -1, -1, -1, 1, -1, -999, 0, 1, 0, -1, -2, 0, -1, -2, -1, -1, 0, -1, -1, 0, 0, -999, -999, -1, -1, -1, -1, -2, -999, -2, -2, -999, 0, -2, -2, 0, 0, -2, 0, -2, 0, 0, 0, -2, -1, -1, 1, 1, 0, 0, -1, -1, -1, -1, -1, -1, -1, 0, 0, -1, 0, -1, -1, 0, -999, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, -999, -999, -999, -999, -999, -1, -1, -2, -2, 0, 0, 0, 0, -1, -1, -999, -2, -2, 0, 0, -1, -2, -2, 0, 0, 0, -1, -1, -1, -2];
27645    function sanitizeTTProgram(table, ttContext) {
27646      let data = table.data;
27647      let i = 0,
27648        j,
27649        n,
27650        b,
27651        funcId,
27652        pc,
27653        lastEndf = 0,
27654        lastDeff = 0;
27655      const stack = [];
27656      const callstack = [];
27657      const functionsCalled = [];
27658      let tooComplexToFollowFunctions = ttContext.tooComplexToFollowFunctions;
27659      let inFDEF = false,
27660        ifLevel = 0,
27661        inELSE = 0;
27662      for (let ii = data.length; i < ii;) {
27663        const op = data[i++];
27664        if (op === 0x40) {
27665          n = data[i++];
27666          if (inFDEF || inELSE) {
27667            i += n;
27668          } else {
27669            for (j = 0; j < n; j++) {
27670              stack.push(data[i++]);
27671            }
27672          }
27673        } else if (op === 0x41) {
27674          n = data[i++];
27675          if (inFDEF || inELSE) {
27676            i += n * 2;
27677          } else {
27678            for (j = 0; j < n; j++) {
27679              b = data[i++];
27680              stack.push(signedInt16(b, data[i++]));
27681            }
27682          }
27683        } else if ((op & 0xf8) === 0xb0) {
27684          n = op - 0xb0 + 1;
27685          if (inFDEF || inELSE) {
27686            i += n;
27687          } else {
27688            for (j = 0; j < n; j++) {
27689              stack.push(data[i++]);
27690            }
27691          }
27692        } else if ((op & 0xf8) === 0xb8) {
27693          n = op - 0xb8 + 1;
27694          if (inFDEF || inELSE) {
27695            i += n * 2;
27696          } else {
27697            for (j = 0; j < n; j++) {
27698              b = data[i++];
27699              stack.push(signedInt16(b, data[i++]));
27700            }
27701          }
27702        } else if (op === 0x2b && !tooComplexToFollowFunctions) {
27703          if (!inFDEF && !inELSE) {
27704            funcId = stack.at(-1);
27705            if (isNaN(funcId)) {
27706              info("TT: CALL empty stack (or invalid entry).");
27707            } else {
27708              ttContext.functionsUsed[funcId] = true;
27709              if (funcId in ttContext.functionsStackDeltas) {
27710                const newStackLength = stack.length + ttContext.functionsStackDeltas[funcId];
27711                if (newStackLength < 0) {
27712                  warn("TT: CALL invalid functions stack delta.");
27713                  ttContext.hintsValid = false;
27714                  return;
27715                }
27716                stack.length = newStackLength;
27717              } else if (funcId in ttContext.functionsDefined && !functionsCalled.includes(funcId)) {
27718                callstack.push({
27719                  data,
27720                  i,
27721                  stackTop: stack.length - 1
27722                });
27723                functionsCalled.push(funcId);
27724                pc = ttContext.functionsDefined[funcId];
27725                if (!pc) {
27726                  warn("TT: CALL non-existent function");
27727                  ttContext.hintsValid = false;
27728                  return;
27729                }
27730                data = pc.data;
27731                i = pc.i;
27732              }
27733            }
27734          }
27735        } else if (op === 0x2c && !tooComplexToFollowFunctions) {
27736          if (inFDEF || inELSE) {
27737            warn("TT: nested FDEFs not allowed");
27738            tooComplexToFollowFunctions = true;
27739          }
27740          inFDEF = true;
27741          lastDeff = i;
27742          funcId = stack.pop();
27743          ttContext.functionsDefined[funcId] = {
27744            data,
27745            i
27746          };
27747        } else if (op === 0x2d) {
27748          if (inFDEF) {
27749            inFDEF = false;
27750            lastEndf = i;
27751          } else {
27752            pc = callstack.pop();
27753            if (!pc) {
27754              warn("TT: ENDF bad stack");
27755              ttContext.hintsValid = false;
27756              return;
27757            }
27758            funcId = functionsCalled.pop();
27759            data = pc.data;
27760            i = pc.i;
27761            ttContext.functionsStackDeltas[funcId] = stack.length - pc.stackTop;
27762          }
27763        } else if (op === 0x89) {
27764          if (inFDEF || inELSE) {
27765            warn("TT: nested IDEFs not allowed");
27766            tooComplexToFollowFunctions = true;
27767          }
27768          inFDEF = true;
27769          lastDeff = i;
27770        } else if (op === 0x58) {
27771          ++ifLevel;
27772        } else if (op === 0x1b) {
27773          inELSE = ifLevel;
27774        } else if (op === 0x59) {
27775          if (inELSE === ifLevel) {
27776            inELSE = 0;
27777          }
27778          --ifLevel;
27779        } else if (op === 0x1c) {
27780          if (!inFDEF && !inELSE) {
27781            const offset = stack.at(-1);
27782            if (offset > 0) {
27783              i += offset - 1;
27784            }
27785          }
27786        }
27787        if (!inFDEF && !inELSE) {
27788          let stackDelta = 0;
27789          if (op <= 0x8e) {
27790            stackDelta = TTOpsStackDeltas[op];
27791          } else if (op >= 0xc0 && op <= 0xdf) {
27792            stackDelta = -1;
27793          } else if (op >= 0xe0) {
27794            stackDelta = -2;
27795          }
27796          if (op >= 0x71 && op <= 0x75) {
27797            n = stack.pop();
27798            if (!isNaN(n)) {
27799              stackDelta = -n * 2;
27800            }
27801          }
27802          while (stackDelta < 0 && stack.length > 0) {
27803            stack.pop();
27804            stackDelta++;
27805          }
27806          while (stackDelta > 0) {
27807            stack.push(NaN);
27808            stackDelta--;
27809          }
27810        }
27811      }
27812      ttContext.tooComplexToFollowFunctions = tooComplexToFollowFunctions;
27813      const content = [data];
27814      if (i > data.length) {
27815        content.push(new Uint8Array(i - data.length));
27816      }
27817      if (lastDeff > lastEndf) {
27818        warn("TT: complementing a missing function tail");
27819        content.push(new Uint8Array([0x22, 0x2d]));
27820      }
27821      foldTTTable(table, content);
27822    }
27823    function checkInvalidFunctions(ttContext, maxFunctionDefs) {
27824      if (ttContext.tooComplexToFollowFunctions) {
27825        return;
27826      }
27827      if (ttContext.functionsDefined.length > maxFunctionDefs) {
27828        warn("TT: more functions defined than expected");
27829        ttContext.hintsValid = false;
27830        return;
27831      }
27832      for (let j = 0, jj = ttContext.functionsUsed.length; j < jj; j++) {
27833        if (j > maxFunctionDefs) {
27834          warn("TT: invalid function id: " + j);
27835          ttContext.hintsValid = false;
27836          return;
27837        }
27838        if (ttContext.functionsUsed[j] && !ttContext.functionsDefined[j]) {
27839          warn("TT: undefined function: " + j);
27840          ttContext.hintsValid = false;
27841          return;
27842        }
27843      }
27844    }
27845    function foldTTTable(table, content) {
27846      if (content.length > 1) {
27847        let newLength = 0;
27848        let j, jj;
27849        for (j = 0, jj = content.length; j < jj; j++) {
27850          newLength += content[j].length;
27851        }
27852        newLength = newLength + 3 & ~3;
27853        const result = new Uint8Array(newLength);
27854        let pos = 0;
27855        for (j = 0, jj = content.length; j < jj; j++) {
27856          result.set(content[j], pos);
27857          pos += content[j].length;
27858        }
27859        table.data = result;
27860        table.length = newLength;
27861      }
27862    }
27863    function sanitizeTTPrograms(fpgm, prep, cvt, maxFunctionDefs) {
27864      const ttContext = {
27865        functionsDefined: [],
27866        functionsUsed: [],
27867        functionsStackDeltas: [],
27868        tooComplexToFollowFunctions: false,
27869        hintsValid: true
27870      };
27871      if (fpgm) {
27872        sanitizeTTProgram(fpgm, ttContext);
27873      }
27874      if (prep) {
27875        sanitizeTTProgram(prep, ttContext);
27876      }
27877      if (fpgm) {
27878        checkInvalidFunctions(ttContext, maxFunctionDefs);
27879      }
27880      if (cvt && cvt.length & 1) {
27881        const cvtData = new Uint8Array(cvt.length + 1);
27882        cvtData.set(cvt.data);
27883        cvt.data = cvtData;
27884      }
27885      return ttContext.hintsValid;
27886    }
27887    font = new Stream(new Uint8Array(font.getBytes()));
27888    let header, tables;
27889    if (isTrueTypeCollectionFile(font)) {
27890      const ttcData = readTrueTypeCollectionData(font, this.name);
27891      header = ttcData.header;
27892      tables = ttcData.tables;
27893    } else {
27894      header = readOpenTypeHeader(font);
27895      tables = readTables(font, header.numTables);
27896    }
27897    const isTrueType = !tables["CFF "];
27898    
vendor: 4,674 bytes, lines 27898-28023
27898if (!isTrueType) {
27899      if (header.version === "OTTO" && !properties.composite || !tables.head || !tables.hhea || !tables.maxp || !tables.post) {
27900        return this.convert(name, new CFFFont(new Stream(tables["CFF "].data), properties), properties);
27901      }
27902      delete tables.glyf;
27903      delete tables.loca;
27904      delete tables.fpgm;
27905      delete tables.prep;
27906      delete tables["cvt "];
27907      this.isOpenType = true;
27908    } else {
27909      if (!tables.loca) {
27910        throw new FormatError('Required "loca" table is not found');
27911      }
27912      if (!tables.glyf) {
27913        warn('Required "glyf" table is not found -- trying to recover.');
27914        tables.glyf = {
27915          tag: "glyf",
27916          data: new Uint8Array(0)
27917        };
27918      }
27919      this.isOpenType = false;
27920    }
27921    if (!tables.maxp) {
27922      throw new FormatError('Required "maxp" table is not found');
27923    }
27924    let numGlyphsFromCFF;
27925    if (!isTrueType) {
27926      try {
27927        const parser = new CFFParser(new Stream(tables["CFF "].data), properties, SEAC_ANALYSIS_ENABLED);
27928        const cff = parser.parse();
27929        cff.duplicateFirstGlyph();
27930        const compiler = new CFFCompiler(cff);
27931        tables["CFF "].data = compiler.compile();
27932        numGlyphsFromCFF = cff.charStringCount;
27933      } catch {
27934        warn("Failed to compile font " + properties.loadedName);
27935      }
27936    }
27937    font.pos = (font.start || 0) + tables.maxp.offset;
27938    let version = font.getInt32();
27939    const numGlyphs = numGlyphsFromCFF ?? font.getUint16();
27940    if (version === 0x00005000 && tables.maxp.length !== 6) {
27941      tables.maxp.data = tables.maxp.data.subarray(0, 6);
27942      tables.maxp.length = 6;
27943    }
27944    if (version !== 0x00010000 && version !== 0x00005000) {
27945      if (tables.maxp.length === 6) {
27946        version = 0x0005000;
27947      } else if (tables.maxp.length >= 32) {
27948        version = 0x00010000;
27949      } else {
27950        throw new FormatError(`"maxp" table has a wrong version number`);
27951      }
27952      writeUint32(tables.maxp.data, 0, version);
27953    }
27954    let isGlyphLocationsLong = int16(tables.head.data[50], tables.head.data[51]);
27955    if (tables.loca) {
27956      const locaLength = isGlyphLocationsLong ? (numGlyphs + 1) * 4 : (numGlyphs + 1) * 2;
27957      if (tables.loca.length !== locaLength) {
27958        warn("Incorrect 'loca' table length -- attempting to fix it.");
27959        const sortedTables = Object.values(tables).filter(Boolean).sort((a, b) => a.offset - b.offset);
27960        const locaIndex = sortedTables.indexOf(tables.loca);
27961        const nextTable = sortedTables[locaIndex + 1] || null;
27962        if (nextTable && tables.loca.offset + locaLength < nextTable.offset) {
27963          const previousPos = font.pos;
27964          font.pos = font.start || 0;
27965          font.skip(tables.loca.offset);
27966          tables.loca.data = font.getBytes(locaLength);
27967          tables.loca.length = locaLength;
27968          font.pos = previousPos;
27969        }
27970      }
27971    }
27972    if (properties.scaleFactors?.length === numGlyphs && isTrueType) {
27973      const {
27974        scaleFactors
27975      } = properties;
27976      const glyphs = new GlyfTable({
27977        glyfTable: tables.glyf.data,
27978        isGlyphLocationsLong,
27979        locaTable: tables.loca.data,
27980        numGlyphs
27981      });
27982      glyphs.scale(scaleFactors);
27983      const {
27984        glyf,
27985        loca,
27986        isLocationLong
27987      } = glyphs.write();
27988      tables.glyf.data = glyf;
27989      tables.loca.data = loca;
27990      if (isLocationLong !== !!isGlyphLocationsLong) {
27991        tables.head.data[50] = 0;
27992        isGlyphLocationsLong = tables.head.data[51] = isLocationLong ? 1 : 0;
27993      }
27994      const metrics = tables.hmtx.data;
27995      for (let i = 0; i < numGlyphs; i++) {
27996        const j = 4 * i;
27997        const advanceWidth = Math.round(scaleFactors[i] * int16(metrics[j], metrics[j + 1]));
27998        metrics[j] = advanceWidth >> 8 & 0xff;
27999        metrics[j + 1] = advanceWidth & 0xff;
28000        const lsb = Math.round(scaleFactors[i] * signedInt16(metrics[j + 2], metrics[j + 3]));
28001        writeSignedInt16(metrics, j + 2, lsb);
28002      }
28003    }
28004    let numGlyphsOut = numGlyphs + 1;
28005    let dupFirstEntry = true;
28006    if (numGlyphsOut > 0xffff) {
28007      dupFirstEntry = false;
28008      numGlyphsOut = numGlyphs;
28009      warn("Not enough space in glyfs to duplicate first glyph.");
28010    }
28011    let maxFunctionDefs = 0;
28012    let maxSizeOfInstructions = 0;
28013    if (version >= 0x00010000 && tables.maxp.length >= 32) {
28014      font.pos += 8;
28015      const maxZones = font.getUint16();
28016      if (maxZones > 2) {
28017        tables.maxp.data[14] = 0;
28018        tables.maxp.data[15] = 2;
28019      }
28020      font.pos += 4;
28021      maxFunctionDefs = font.getUint16();
28022      font.pos += 4;
28023      maxSizeOfInstructions = font.getUint16()
vendor: 6,814 bytes, lines 28023-28185
28023;
28024    }
28025    tables.maxp.data[4] = numGlyphsOut >> 8;
28026    tables.maxp.data[5] = numGlyphsOut & 255;
28027    const hintsValid = sanitizeTTPrograms(tables.fpgm, tables.prep, tables["cvt "], maxFunctionDefs);
28028    if (!hintsValid) {
28029      delete tables.fpgm;
28030      delete tables.prep;
28031      delete tables["cvt "];
28032    }
28033    sanitizeMetrics(font, tables.hhea, tables.hmtx, tables.head, numGlyphsOut, dupFirstEntry);
28034    if (!tables.head) {
28035      throw new FormatError('Required "head" table is not found');
28036    }
28037    sanitizeHead(tables.head, numGlyphs, isTrueType ? tables.loca.length : 0);
28038    let missingGlyphs = Object.create(null);
28039    if (isTrueType) {
28040      const glyphsInfo = sanitizeGlyphLocations(tables.loca, tables.glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions);
28041      missingGlyphs = glyphsInfo.missingGlyphs;
28042      if (version >= 0x00010000 && tables.maxp.length >= 32) {
28043        tables.maxp.data[26] = glyphsInfo.maxSizeOfInstructions >> 8;
28044        tables.maxp.data[27] = glyphsInfo.maxSizeOfInstructions & 255;
28045      }
28046    }
28047    if (!tables.hhea) {
28048      throw new FormatError('Required "hhea" table is not found');
28049    }
28050    if (tables.hhea.data[10] === 0 && tables.hhea.data[11] === 0) {
28051      tables.hhea.data[10] = 0xff;
28052      tables.hhea.data[11] = 0xff;
28053    }
28054    const metricsOverride = {
28055      unitsPerEm: int16(tables.head.data[18], tables.head.data[19]),
28056      yMax: signedInt16(tables.head.data[42], tables.head.data[43]),
28057      yMin: signedInt16(tables.head.data[38], tables.head.data[39]),
28058      ascent: signedInt16(tables.hhea.data[4], tables.hhea.data[5]),
28059      descent: signedInt16(tables.hhea.data[6], tables.hhea.data[7]),
28060      lineGap: signedInt16(tables.hhea.data[8], tables.hhea.data[9])
28061    };
28062    this.ascent = metricsOverride.ascent / metricsOverride.unitsPerEm;
28063    this.descent = metricsOverride.descent / metricsOverride.unitsPerEm;
28064    this.lineGap = metricsOverride.lineGap / metricsOverride.unitsPerEm;
28065    if (this.cssFontInfo?.lineHeight) {
28066      this.lineHeight = this.cssFontInfo.metrics.lineHeight;
28067      this.lineGap = this.cssFontInfo.metrics.lineGap;
28068    } else {
28069      this.lineHeight = this.ascent - this.descent + this.lineGap;
28070    }
28071    if (tables.post) {
28072      readPostScriptTable(tables.post, properties, numGlyphs);
28073    }
28074    tables.post = {
28075      tag: "post",
28076      data: createPostTable(properties)
28077    };
28078    const charCodeToGlyphId = Object.create(null);
28079    function hasGlyph(glyphId) {
28080      return !missingGlyphs[glyphId];
28081    }
28082    if (properties.composite) {
28083      const cidToGidMap = properties.cidToGidMap || [];
28084      const isCidToGidMapEmpty = cidToGidMap.length === 0;
28085      properties.cMap.forEach(function (charCode, cid) {
28086        if (typeof cid === "string") {
28087          cid = convertCidString(charCode, cid, true);
28088        }
28089        if (cid > 0xffff) {
28090          throw new FormatError("Max size of CID is 65,535");
28091        }
28092        let glyphId = -1;
28093        if (isCidToGidMapEmpty) {
28094          glyphId = cid;
28095        } else if (cidToGidMap[cid] !== undefined) {
28096          glyphId = cidToGidMap[cid];
28097        }
28098        if (glyphId >= 0 && glyphId < numGlyphs && hasGlyph(glyphId)) {
28099          charCodeToGlyphId[charCode] = glyphId;
28100        }
28101      });
28102    } else {
28103      const cmapTable = readCmapTable(tables.cmap, font, this.isSymbolicFont, properties.hasEncoding);
28104      const cmapPlatformId = cmapTable.platformId;
28105      const cmapEncodingId = cmapTable.encodingId;
28106      const cmapMappings = cmapTable.mappings;
28107      let baseEncoding = [],
28108        forcePostTable = false;
28109      if (properties.hasEncoding && (properties.baseEncodingName === "MacRomanEncoding" || properties.baseEncodingName === "WinAnsiEncoding")) {
28110        baseEncoding = getEncoding(properties.baseEncodingName);
28111      }
28112      if (properties.hasEncoding && !this.isSymbolicFont && (cmapPlatformId === 3 && cmapEncodingId === 1 || cmapPlatformId === 1 && cmapEncodingId === 0)) {
28113        const glyphsUnicodeMap = getGlyphsUnicode();
28114        for (let charCode = 0; charCode < 256; charCode++) {
28115          let glyphName;
28116          if (this.differences[charCode] !== undefined) {
28117            glyphName = this.differences[charCode];
28118          } else if (baseEncoding.length && baseEncoding[charCode] !== "") {
28119            glyphName = baseEncoding[charCode];
28120          } else {
28121            glyphName = StandardEncoding[charCode];
28122          }
28123          if (!glyphName) {
28124            continue;
28125          }
28126          const standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
28127          let unicodeOrCharCode;
28128          if (cmapPlatformId === 3 && cmapEncodingId === 1) {
28129            unicodeOrCharCode = glyphsUnicodeMap[standardGlyphName];
28130          } else if (cmapPlatformId === 1 && cmapEncodingId === 0) {
28131            unicodeOrCharCode = MacRomanEncoding.indexOf(standardGlyphName);
28132          }
28133          if (unicodeOrCharCode === undefined) {
28134            if (!properties.glyphNames && properties.hasIncludedToUnicodeMap && !(this.toUnicode instanceof IdentityToUnicodeMap)) {
28135              const unicode = this.toUnicode.get(charCode);
28136              if (unicode) {
28137                unicodeOrCharCode = unicode.codePointAt(0);
28138              }
28139            }
28140            if (unicodeOrCharCode === undefined) {
28141              continue;
28142            }
28143          }
28144          for (const mapping of cmapMappings) {
28145            if (mapping.charCode !== unicodeOrCharCode) {
28146              continue;
28147            }
28148            charCodeToGlyphId[charCode] = mapping.glyphId;
28149            break;
28150          }
28151        }
28152      } else if (cmapPlatformId === 0) {
28153        for (const mapping of cmapMappings) {
28154          charCodeToGlyphId[mapping.charCode] = mapping.glyphId;
28155        }
28156        forcePostTable = true;
28157      } else if (cmapPlatformId === 3 && cmapEncodingId === 0) {
28158        for (const mapping of cmapMappings) {
28159          let charCode = mapping.charCode;
28160          if (charCode >= 0xf000 && charCode <= 0xf0ff) {
28161            charCode &= 0xff;
28162          }
28163          charCodeToGlyphId[charCode] = mapping.glyphId;
28164        }
28165      } else {
28166        for (const mapping of cmapMappings) {
28167          charCodeToGlyphId[mapping.charCode] = mapping.glyphId;
28168        }
28169      }
28170      if (properties.glyphNames && (baseEncoding.length || this.differences.length)) {
28171        for (let i = 0; i < 256; ++i) {
28172          if (!forcePostTable && charCodeToGlyphId[i] !== undefined) {
28173            continue;
28174          }
28175          const glyphName = this.differences[i] || baseEncoding[i];
28176          if (!glyphName) {
28177            continue;
28178          }
28179          const glyphId = properties.glyphNames.indexOf(glyphName);
28180          if (glyphId > 0 && hasGlyph(glyphId)) {
28181            charCodeToGlyphId[i] = glyphId;
28182          }
28183        }
28184      }
28185    
vendor: 3,478 bytes, lines 28185-28278
28185}
28186    if (charCodeToGlyphId.length === 0) {
28187      charCodeToGlyphId[0] = 0;
28188    }
28189    let glyphZeroId = numGlyphsOut - 1;
28190    if (!dupFirstEntry) {
28191      glyphZeroId = 0;
28192    }
28193    if (!properties.cssFontInfo) {
28194      const newMapping = adjustMapping(charCodeToGlyphId, hasGlyph, glyphZeroId, this.toUnicode);
28195      this.toFontChar = newMapping.toFontChar;
28196      tables.cmap = {
28197        tag: "cmap",
28198        data: createCmapTable(newMapping.charCodeToGlyphId, newMapping.toUnicodeExtraMap, numGlyphsOut)
28199      };
28200      if (!tables["OS/2"] || !validateOS2Table(tables["OS/2"], font)) {
28201        tables["OS/2"] = {
28202          tag: "OS/2",
28203          data: createOS2Table(properties, newMapping.charCodeToGlyphId, metricsOverride)
28204        };
28205      }
28206    }
28207    if (!tables.name) {
28208      tables.name = {
28209        tag: "name",
28210        data: createNameTable(this.name)
28211      };
28212    } else {
28213      const [namePrototype, nameRecords] = readNameTable(tables.name);
28214      tables.name.data = createNameTable(name, namePrototype);
28215      this.psName = namePrototype[0][6] || null;
28216      if (!properties.composite) {
28217        adjustTrueTypeToUnicode(properties, this.isSymbolicFont, nameRecords);
28218      }
28219    }
28220    const builder = new OpenTypeFileBuilder(header.version);
28221    for (const tableTag in tables) {
28222      builder.addTable(tableTag, tables[tableTag].data);
28223    }
28224    return builder.toArray();
28225  }
28226  convert(fontName, font, properties) {
28227    properties.fixedPitch = false;
28228    if (properties.builtInEncoding) {
28229      adjustType1ToUnicode(properties, properties.builtInEncoding);
28230    }
28231    let glyphZeroId = 1;
28232    if (font instanceof CFFFont) {
28233      glyphZeroId = font.numGlyphs - 1;
28234    }
28235    const mapping = font.getGlyphMapping(properties);
28236    let newMapping = null;
28237    let newCharCodeToGlyphId = mapping;
28238    let toUnicodeExtraMap = null;
28239    if (!properties.cssFontInfo) {
28240      newMapping = adjustMapping(mapping, font.hasGlyphId.bind(font), glyphZeroId, this.toUnicode);
28241      this.toFontChar = newMapping.toFontChar;
28242      newCharCodeToGlyphId = newMapping.charCodeToGlyphId;
28243      toUnicodeExtraMap = newMapping.toUnicodeExtraMap;
28244    }
28245    const numGlyphs = font.numGlyphs;
28246    function getCharCodes(charCodeToGlyphId, glyphId) {
28247      let charCodes = null;
28248      for (const charCode in charCodeToGlyphId) {
28249        if (glyphId === charCodeToGlyphId[charCode]) {
28250          (charCodes ||= []).push(charCode | 0);
28251        }
28252      }
28253      return charCodes;
28254    }
28255    function createCharCode(charCodeToGlyphId, glyphId) {
28256      for (const charCode in charCodeToGlyphId) {
28257        if (glyphId === charCodeToGlyphId[charCode]) {
28258          return charCode | 0;
28259        }
28260      }
28261      newMapping.charCodeToGlyphId[newMapping.nextAvailableFontCharCode] = glyphId;
28262      return newMapping.nextAvailableFontCharCode++;
28263    }
28264    const seacs = font.seacs;
28265    if (newMapping && SEAC_ANALYSIS_ENABLED && seacs?.length) {
28266      const matrix = properties.fontMatrix || FONT_IDENTITY_MATRIX;
28267      const charset = font.getCharset();
28268      const seacMap = Object.create(null);
28269      for (let glyphId in seacs) {
28270        glyphId |= 0;
28271        const seac = seacs[glyphId];
28272        const baseGlyphName = StandardEncoding[seac[2]];
28273        const accentGlyphName = StandardEncoding[seac[3]];
28274        const baseGlyphId = charset.indexOf(baseGlyphName);
28275        const accentGlyphId = charset.indexOf(accentGlyphName);
28276        if (baseGlyphId < 0 || accentGlyphId < 0) {
28277          continue;
28278        }
vendor: 8,717 bytes, lines 28279-28528
28279        const accentOffset = {
28280          x: seac[0] * matrix[0] + seac[1] * matrix[2] + matrix[4],
28281          y: seac[0] * matrix[1] + seac[1] * matrix[3] + matrix[5]
28282        };
28283        const charCodes = getCharCodes(mapping, glyphId);
28284        if (!charCodes) {
28285          continue;
28286        }
28287        for (const charCode of charCodes) {
28288          const charCodeToGlyphId = newMapping.charCodeToGlyphId;
28289          const baseFontCharCode = createCharCode(charCodeToGlyphId, baseGlyphId);
28290          const accentFontCharCode = createCharCode(charCodeToGlyphId, accentGlyphId);
28291          seacMap[charCode] = {
28292            baseFontCharCode,
28293            accentFontCharCode,
28294            accentOffset
28295          };
28296        }
28297      }
28298      properties.seacMap = seacMap;
28299    }
28300    const unitsPerEm = properties.fontMatrix ? 1 / Math.max(...properties.fontMatrix.slice(0, 4).map(Math.abs)) : 1000;
28301    const builder = new OpenTypeFileBuilder("\x4F\x54\x54\x4F");
28302    builder.addTable("CFF ", font.data);
28303    builder.addTable("OS/2", createOS2Table(properties, newCharCodeToGlyphId));
28304    builder.addTable("cmap", createCmapTable(newCharCodeToGlyphId, toUnicodeExtraMap, numGlyphs));
28305    builder.addTable("head", function fontTableHead() {
28306      const dateArr = [0x00, 0x00, 0x00, 0x00, 0x9e, 0x0b, 0x7e, 0x27];
28307      const head = new TrueTypeTableBuilder({
28308        exactLength: 54
28309      });
28310      head.setArray([0x00, 0x01, 0x00, 0x00]);
28311      head.setArray([0x00, 0x00, 0x10, 0x00]);
28312      head.skip(4);
28313      head.setArray([0x5f, 0x0f, 0x3c, 0xf5]);
28314      head.skip(2);
28315      head.setSafeInt16(unitsPerEm);
28316      head.setArray(dateArr);
28317      head.setArray(dateArr);
28318      head.skip(2);
28319      head.setSafeInt16(properties.descent);
28320      head.setArray([0x0f, 0xff]);
28321      head.setSafeInt16(properties.ascent);
28322      head.setInt16(properties.italicAngle ? 2 : 0);
28323      head.setArray([0x00, 0x11]);
28324      head.skip(2 + 2 + 2);
28325      return head.data;
28326    }());
28327    builder.addTable("hhea", function fontTableHhea() {
28328      const hhea = new TrueTypeTableBuilder({
28329        exactLength: 36
28330      });
28331      hhea.setArray([0x00, 0x01, 0x00, 0x00]);
28332      hhea.setSafeInt16(properties.ascent);
28333      hhea.setSafeInt16(properties.descent);
28334      hhea.skip(2);
28335      hhea.setArray([0xff, 0xff]);
28336      hhea.skip(2 + 2 + 2);
28337      hhea.setSafeInt16(properties.capHeight);
28338      hhea.setSafeInt16(Math.tan(properties.italicAngle) * properties.xHeight);
28339      hhea.skip(2 + 2 + 2 + 2 + 2 + 2);
28340      hhea.setInt16(numGlyphs);
28341      return hhea.data;
28342    }());
28343    builder.addTable("hmtx", function fontTableHmtx() {
28344      const charstrings = font.charstrings;
28345      const cffWidths = font.cff?.widths ?? null;
28346      const hmtx = new TrueTypeTableBuilder({
28347        exactLength: numGlyphs * 4
28348      });
28349      hmtx.skip(4);
28350      for (let i = 1, ii = numGlyphs; i < ii; i++) {
28351        let width = 0;
28352        if (charstrings) {
28353          width = charstrings[i - 1].width || 0;
28354        } else if (cffWidths) {
28355          width = Math.ceil(cffWidths[i] || 0);
28356        }
28357        hmtx.setInt16(width);
28358        hmtx.skip(2);
28359      }
28360      return hmtx.data;
28361    }());
28362    builder.addTable("maxp", function fontTableMaxp() {
28363      const maxp = new TrueTypeTableBuilder({
28364        exactLength: 6
28365      });
28366      maxp.setArray([0x00, 0x00, 0x50, 0x00]);
28367      maxp.setInt16(numGlyphs);
28368      return maxp.data;
28369    }());
28370    builder.addTable("name", createNameTable(fontName));
28371    builder.addTable("post", createPostTable(properties));
28372    return builder.toArray();
28373  }
28374  get _spaceWidth() {
28375    const possibleSpaceReplacements = ["space", "minus", "one", "i", "I"];
28376    let width;
28377    for (const glyphName of possibleSpaceReplacements) {
28378      if (glyphName in this.widths) {
28379        width = this.widths[glyphName];
28380        break;
28381      }
28382      const glyphsUnicodeMap = getGlyphsUnicode();
28383      const glyphUnicode = glyphsUnicodeMap[glyphName];
28384      let charcode = 0;
28385      if (this.composite && this.cMap.contains(glyphUnicode)) {
28386        charcode = this.cMap.lookup(glyphUnicode);
28387        if (typeof charcode === "string") {
28388          charcode = convertCidString(glyphUnicode, charcode);
28389        }
28390      }
28391      if (!charcode && this.toUnicode) {
28392        charcode = this.toUnicode.charCodeOf(glyphUnicode);
28393      }
28394      if (charcode <= 0) {
28395        charcode = glyphUnicode;
28396      }
28397      width = this.widths[charcode];
28398      if (width) {
28399        break;
28400      }
28401    }
28402    return shadow(this, "_spaceWidth", width || this.defaultWidth);
28403  }
28404  _charToGlyph(charcode, isSpace = false) {
28405    let glyph = this.#glyphCache.get(charcode);
28406    if (glyph?.isSpace === isSpace) {
28407      return glyph;
28408    }
28409    let fontCharCode, width, operatorListId;
28410    let widthCode = charcode;
28411    if (this.cMap?.contains(charcode)) {
28412      widthCode = this.cMap.lookup(charcode);
28413      if (typeof widthCode === "string") {
28414        widthCode = convertCidString(charcode, widthCode);
28415      }
28416    }
28417    width = this.widths[widthCode];
28418    if (typeof width !== "number") {
28419      width = this.defaultWidth;
28420    }
28421    const vmetric = this.vmetrics?.[widthCode] || this.defaultVMetrics;
28422    let unicode = this.toUnicode.get(charcode) || charcode;
28423    if (typeof unicode === "number") {
28424      unicode = String.fromCharCode(unicode);
28425    }
28426    let isInFont = this.toFontChar[charcode] !== undefined;
28427    fontCharCode = this.toFontChar[charcode] || charcode;
28428    if (this.missingFile) {
28429      const glyphName = this.differences[charcode] || this.defaultEncoding[charcode];
28430      if ((glyphName === ".notdef" || glyphName === "") && this.type === "Type1") {
28431        fontCharCode = 0x20;
28432        if (glyphName === "") {
28433          width ||= this._spaceWidth;
28434          unicode = String.fromCharCode(fontCharCode);
28435        }
28436      }
28437      fontCharCode = mapSpecialUnicodeValues(fontCharCode);
28438    }
28439    if (this.isType3Font) {
28440      operatorListId = fontCharCode;
28441    }
28442    let accent = null;
28443    if (this.seacMap?.[charcode]) {
28444      isInFont = true;
28445      const seac = this.seacMap[charcode];
28446      fontCharCode = seac.baseFontCharCode;
28447      accent = {
28448        fontChar: String.fromCodePoint(seac.accentFontCharCode),
28449        offset: seac.accentOffset
28450      };
28451    }
28452    let fontChar = "";
28453    if (typeof fontCharCode === "number") {
28454      if (fontCharCode <= 0x10ffff) {
28455        fontChar = String.fromCodePoint(fontCharCode);
28456      } else {
28457        warn(`charToGlyph - invalid fontCharCode: ${fontCharCode}`);
28458      }
28459    }
28460    if (this.missingFile && this.vertical && fontChar.length === 1) {
28461      const vertical = getVerticalPresentationForm()[fontChar.charCodeAt(0)];
28462      if (vertical) {
28463        fontChar = unicode = String.fromCharCode(vertical);
28464      }
28465    }
28466    glyph = new fonts_Glyph(charcode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont);
28467    this.#glyphCache.set(charcode, glyph);
28468    return glyph;
28469  }
28470  charsToGlyphs(chars) {
28471    let glyphs = this.#charsCache.get(chars);
28472    if (glyphs) {
28473      return glyphs;
28474    }
28475    glyphs = [];
28476    if (this.cMap) {
28477      const c = Object.create(null),
28478        ii = chars.length;
28479      let i = 0;
28480      while (i < ii) {
28481        this.cMap.readCharCode(chars, i, c);
28482        const {
28483          charcode,
28484          length
28485        } = c;
28486        i += length;
28487        const glyph = this._charToGlyph(charcode, length === 1 && chars.charCodeAt(i - 1) === 0x20);
28488        glyphs.push(glyph);
28489      }
28490    } else {
28491      for (let i = 0, ii = chars.length; i < ii; ++i) {
28492        const charcode = chars.charCodeAt(i);
28493        const glyph = this._charToGlyph(charcode, charcode === 0x20);
28494        glyphs.push(glyph);
28495      }
28496    }
28497    this.#charsCache.set(chars, glyphs);
28498    return glyphs;
28499  }
28500  getCharPositions(chars) {
28501    const positions = [];
28502    if (this.cMap) {
28503      const c = Object.create(null);
28504      let i = 0;
28505      while (i < chars.length) {
28506        this.cMap.readCharCode(chars, i, c);
28507        const length = c.length;
28508        positions.push([i, i + length]);
28509        i += length;
28510      }
28511    } else {
28512      for (let i = 0, ii = chars.length; i < ii; ++i) {
28513        positions.push([i, i + 1]);
28514      }
28515    }
28516    return positions;
28517  }
28518  get glyphCacheValues() {
28519    return this.#glyphCache.values();
28520  }
28521  encodeString(str) {
28522    const buffers = [];
28523    const currentBuf = [];
28524    const hasCurrentBufErrors = () => buffers.length % 2 === 1;
28525    const getCharCode = this.toUnicode instanceof IdentityToUnicodeMap ? unicode => this.toUnicode.charCodeOf(unicode) : unicode => this.toUnicode.charCodeOf(String.fromCodePoint(unicode));
28526    for (let i = 0, ii = str.length; i < ii; i++) {
28527      const unicode = str.codePointAt(i);
28528      if (unicode > 0xd7ff && (unicode < 0xe000 || unicode > 0xfffd)
vendor: 1,652 bytes, lines 28528-28575
28528) {
28529        i++;
28530      }
28531      if (this.toUnicode) {
28532        const charCode = getCharCode(unicode);
28533        if (charCode !== -1) {
28534          if (hasCurrentBufErrors()) {
28535            buffers.push(currentBuf.join(""));
28536            currentBuf.length = 0;
28537          }
28538          const charCodeLength = this.cMap ? this.cMap.getCharCodeLength(charCode) : 1;
28539          for (let j = charCodeLength - 1; j >= 0; j--) {
28540            currentBuf.push(String.fromCharCode(charCode >> 8 * j & 0xff));
28541          }
28542          continue;
28543        }
28544      }
28545      if (!hasCurrentBufErrors()) {
28546        buffers.push(currentBuf.join(""));
28547        currentBuf.length = 0;
28548      }
28549      currentBuf.push(String.fromCodePoint(unicode));
28550    }
28551    buffers.push(currentBuf.join(""));
28552    return buffers;
28553  }
28554}
28555class ErrorFont {
28556  constructor(error) {
28557    this.error = error;
28558    this.loadedName = "g_font_error";
28559    this.missingFile = true;
28560  }
28561  charsToGlyphs() {
28562    return [];
28563  }
28564  encodeString(chars) {
28565    return [chars];
28566  }
28567  exportData() {
28568    return {
28569      error: this.error
28570    };
28571  }
28572}
28573
28574;// ./src/core/calibri_factors.js
28575const CalibriBoldFactors = [1.3877, 1, 1, 1, 0.97801, 0.92482, 0.89552, 0.91133, 0.81988, 0.97566, 0.98152, 0.93548, 0.93548, 1.2798, 0.85284, 0.92794, 1, 0.96134, 1.54657, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.82845, 0.82845, 0.85284, 0.85284, 0.85284, 0.75859, 0.92138, 0.83908, 0.7762, 0.73293, 0.87289, 0.73133, 0.7514, 0.81921, 0.87356, 0.95958, 0.59526, 0.75727, 0.69225, 1.04924, 0.9121, 0.86943, 0.79795, 0.88198, 0.77958, 0.70864, 0.81055, 0.90399, 0.88653, 0.96017, 0.82577, 0.77892, 
vendor: 2,638 bytes, line 28575
285750.78257, 0.97507, 1.54657, 0.97507, 0.85284, 0.89552, 0.90176, 0.88762, 0.8785, 0.75241, 0.8785, 0.90518, 0.95015, 0.77618, 0.8785, 0.88401, 0.91916, 0.86304, 0.88401, 0.91488, 0.8785, 0.8801, 0.8785, 0.8785, 0.91343, 0.7173, 1.04106, 0.8785, 0.85075, 0.95794, 0.82616, 0.85162, 0.79492, 0.88331, 1.69808, 0.88331, 0.85284, 0.97801, 0.89552, 0.91133, 0.89552, 0.91133, 1.7801, 0.89552, 1.24487, 1.13254, 1.12401, 0.96839, 0.85284, 0.68787, 0.70645, 0.85592, 0.90747, 1.01466, 1.0088, 0.90323, 1, 1.07463, 1, 0.91056, 0.75806, 1.19118, 0.96839, 0.78864, 0.82845, 0.84133, 0.75859, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.77539, 0.73293, 0.73133, 0.73133, 0.73133, 0.73133, 0.95958, 0.95958, 0.95958, 0.95958, 0.88506, 0.9121, 0.86943, 0.86943, 0.86943, 0.86943, 0.86943, 0.85284, 0.87508, 0.90399, 0.90399, 0.90399, 0.90399, 0.77892, 0.79795, 0.90807, 0.88762, 0.88762, 0.88762, 0.88762, 0.88762, 0.88762, 0.8715, 0.75241, 0.90518, 0.90518, 0.90518, 0.90518, 0.88401, 0.88401, 0.88401, 0.88401, 0.8785, 0.8785, 0.8801, 0.8801, 0.8801, 0.8801, 0.8801, 0.90747, 0.89049, 0.8785, 0.8785, 0.8785, 0.8785, 0.85162, 0.8785, 0.85162, 0.83908, 0.88762, 0.83908, 0.88762, 0.83908, 0.88762, 0.73293, 0.75241, 0.73293, 0.75241, 0.73293, 0.75241, 0.73293, 0.75241, 0.87289, 0.83016, 0.88506, 0.93125, 0.73133, 0.90518, 0.73133, 0.90518, 0.73133, 0.90518, 0.73133, 0.90518, 0.73133, 0.90518, 0.81921, 0.77618, 0.81921, 0.77618, 0.81921, 0.77618, 1, 1, 0.87356, 0.8785, 0.91075, 0.89608, 0.95958, 0.88401, 0.95958, 0.88401, 0.95958, 0.88401, 0.95958, 0.88401, 0.95958, 0.88401, 0.76229, 0.90167, 0.59526, 0.91916, 1, 1, 0.86304, 0.69225, 0.88401, 1, 1, 0.70424, 0.79468, 0.91926, 0.88175, 0.70823, 0.94903, 0.9121, 0.8785, 1, 1, 0.9121, 0.8785, 0.87802, 0.88656, 0.8785, 0.86943, 0.8801, 0.86943, 0.8801, 0.86943, 0.8801, 0.87402, 0.89291, 0.77958, 0.91343, 1, 1, 0.77958, 0.91343, 0.70864, 0.7173, 0.70864, 0.7173, 0.70864, 0.7173, 0.70864, 0.7173, 1, 1, 0.81055, 0.75841, 0.81055, 1.06452, 0.90399, 0.8785, 0.90399, 0.8785, 0.90399, 0.8785, 0.90399, 0.8785, 0.90399, 0.8785, 0.90399, 0.8785, 0.96017, 0.95794, 0.77892, 0.85162, 0.77892, 0.78257, 0.79492, 0.78257, 0.79492, 0.78257, 0.79492, 0.9297, 0.56892, 0.83908, 0.88762, 0.77539, 0.8715, 0.87508, 0.89049, 1, 1, 0.81055, 1.04106, 1.20528, 1.20528, 1, 1.15543, 0.70674, 0.98387, 0.94721, 1.33431, 1.45894, 0.95161, 1.06303, 0.83908, 0.80352, 0.57184, 0.6965, 0.56289, 0.82001, 0.56029, 0.81235, 1.02988, 0.83908, 0.7762, 0.68156, 0.80367, 0.73133, 0.78257, 0.87356, 0.86943, 0.95958, 0.75727, 0.89019, 1.04924, 0.9121, 0.7648, 0.86943, 0.87356, 0.79795, 0.78275, 0.81055, 0.77892, 
vendor: 2,277 bytes, lines 28575-28580
285750.9762, 0.82577, 0.99819, 0.84896, 0.95958, 0.77892, 0.96108, 1.01407, 0.89049, 1.02988, 0.94211, 0.96108, 0.8936, 0.84021, 0.87842, 0.96399, 0.79109, 0.89049, 1.00813, 1.02988, 0.86077, 0.87445, 0.92099, 0.84723, 0.86513, 0.8801, 0.75638, 0.85714, 0.78216, 0.79586, 0.87965, 0.94211, 0.97747, 0.78287, 0.97926, 0.84971, 1.02988, 0.94211, 0.8801, 0.94211, 0.84971, 0.73133, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.90264, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.90518, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.90548, 1, 1, 1, 1, 1, 1, 0.96017, 0.95794, 0.96017, 0.95794, 0.96017, 0.95794, 0.77892, 0.85162, 1, 1, 0.89552, 0.90527, 1, 0.90363, 0.92794, 0.92794, 0.92794, 0.92794, 0.87012, 0.87012, 0.87012, 0.89552, 0.89552, 1.42259, 0.71143, 1.06152, 1, 1, 1.03372, 1.03372, 0.97171, 1.4956, 2.2807, 0.93835, 0.83406, 0.91133, 0.84107, 0.91133, 1, 1, 1, 0.72021, 1, 1.23108, 0.83489, 0.88525, 0.88525, 0.81499, 0.90527, 1.81055, 0.90527, 1.81055, 1.31006, 1.53711, 0.94434, 1.08696, 1, 0.95018, 0.77192, 0.85284, 0.90747, 1.17534, 0.69825, 0.9716, 1.37077, 0.90747, 0.90747, 0.85356, 0.90747, 0.90747, 1.44947, 0.85284, 0.8941, 0.8941, 0.70572, 0.8, 0.70572, 0.70572, 0.70572, 0.70572, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.99862, 0.99862, 1, 1, 1, 1, 1, 1.08004, 0.91027, 1, 1, 1, 0.99862, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.90727, 0.90727, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
28576const CalibriBoldMetrics = {
28577  lineHeight: 1.2207,
28578  lineGap: 0.2207
28579};
28580const CalibriBoldItalicFactors = [1.3877, 1, 1, 1, 0.97801, 0.92482, 0.89552, 0.91133, 0.81988, 0.97566, 0.98152, 0.93548, 0.93548, 1.2798, 0.85284, 0.92794, 1, 0.96134, 1.56239, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.82845, 0.82845, 0.85284, 0.85284, 0.85284, 0.75859, 0.92138, 0.83908, 0.7762, 0.71805, 0.87289, 0.73133, 0.7514, 0.81921, 0.87356, 0.95958, 0.59526, 0.75727, 0.69225, 1.04924, 0.90872, 0.85938, 0.79795, 0.87068, 0.77958, 0.69766, 0.81055, 0.90399, 0.88653, 0.96068, 0.82577, 0.77892, 
vendor: 1,685 bytes, line 28580
285800.78257, 0.97507, 1.529, 0.97507, 0.85284, 0.89552, 0.90176, 0.94908, 0.86411, 0.74012, 0.86411, 0.88323, 0.95015, 0.86411, 0.86331, 0.88401, 0.91916, 0.86304, 0.88401, 0.9039, 0.86331, 0.86331, 0.86411, 0.86411, 0.90464, 0.70852, 1.04106, 0.86331, 0.84372, 0.95794, 0.82616, 0.84548, 0.79492, 0.88331, 1.69808, 0.88331, 0.85284, 0.97801, 0.89552, 0.91133, 0.89552, 0.91133, 1.7801, 0.89552, 1.24487, 1.13254, 1.19129, 0.96839, 0.85284, 0.68787, 0.70645, 0.85592, 0.90747, 1.01466, 1.0088, 0.90323, 1, 1.07463, 1, 0.91056, 0.75806, 1.19118, 0.96839, 0.78864, 0.82845, 0.84133, 0.75859, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.77539, 0.71805, 0.73133, 0.73133, 0.73133, 0.73133, 0.95958, 0.95958, 0.95958, 0.95958, 0.88506, 0.90872, 0.85938, 0.85938, 0.85938, 0.85938, 0.85938, 0.85284, 0.87068, 0.90399, 0.90399, 0.90399, 0.90399, 0.77892, 0.79795, 0.90807, 0.94908, 0.94908, 0.94908, 0.94908, 0.94908, 0.94908, 0.85887, 0.74012, 0.88323, 0.88323, 0.88323, 0.88323, 0.88401, 0.88401, 0.88401, 0.88401, 0.8785, 0.86331, 0.86331, 0.86331, 0.86331, 0.86331, 0.86331, 0.90747, 0.89049, 0.86331, 0.86331, 0.86331, 0.86331, 0.84548, 0.86411, 0.84548, 0.83908, 0.94908, 0.83908, 0.94908, 0.83908, 0.94908, 0.71805, 0.74012, 0.71805, 0.74012, 0.71805, 0.74012, 0.71805, 0.74012, 0.87289, 0.79538, 0.88506, 0.92726, 0.73133, 0.88323, 0.73133, 0.88323, 0.73133, 0.88323, 0.73133, 0.88323, 0.73133, 0.88323, 0.81921, 0.86411, 0.81921, 0.86411, 0.81921, 0.86411, 1, 1, 0.87356, 0.86331, 0.91075, 0.8777, 0.95958, 0.88401, 0.95958, 0.88401, 0.95958, 0.88401, 0.95958, 0.88401, 0.95958, 0.88401, 0.76467, 0.90167, 0.59526, 0.91916, 1, 1, 0.86304, 0.69225, 0.88401, 1, 1, 0.70424, 0.7
vendor: 3,143 bytes, lines 28580-28585
285807312, 0.91926, 0.88175, 0.70823, 0.94903, 0.90872, 0.86331, 1, 1, 0.90872, 0.86331, 0.86906, 0.88116, 0.86331, 0.85938, 0.86331, 0.85938, 0.86331, 0.85938, 0.86331, 0.87402, 0.86549, 0.77958, 0.90464, 1, 1, 0.77958, 0.90464, 0.69766, 0.70852, 0.69766, 0.70852, 0.69766, 0.70852, 0.69766, 0.70852, 1, 1, 0.81055, 0.75841, 0.81055, 1.06452, 0.90399, 0.86331, 0.90399, 0.86331, 0.90399, 0.86331, 0.90399, 0.86331, 0.90399, 0.86331, 0.90399, 0.86331, 0.96068, 0.95794, 0.77892, 0.84548, 0.77892, 0.78257, 0.79492, 0.78257, 0.79492, 0.78257, 0.79492, 0.9297, 0.56892, 0.83908, 0.94908, 0.77539, 0.85887, 0.87068, 0.89049, 1, 1, 0.81055, 1.04106, 1.20528, 1.20528, 1, 1.15543, 0.70088, 0.98387, 0.94721, 1.33431, 1.45894, 0.95161, 1.48387, 0.83908, 0.80352, 0.57118, 0.6965, 0.56347, 0.79179, 0.55853, 0.80346, 1.02988, 0.83908, 0.7762, 0.67174, 0.86036, 0.73133, 0.78257, 0.87356, 0.86441, 0.95958, 0.75727, 0.89019, 1.04924, 0.90872, 0.74889, 0.85938, 0.87891, 0.79795, 0.7957, 0.81055, 0.77892, 0.97447, 0.82577, 0.97466, 0.87179, 0.95958, 0.77892, 0.94252, 0.95612, 0.8753, 1.02988, 0.92733, 0.94252, 0.87411, 0.84021, 0.8728, 0.95612, 0.74081, 0.8753, 1.02189, 1.02988, 0.84814, 0.87445, 0.91822, 0.84723, 0.85668, 0.86331, 0.81344, 0.87581, 0.76422, 0.82046, 0.96057, 0.92733, 0.99375, 0.78022, 0.95452, 0.86015, 1.02988, 0.92733, 0.86331, 0.92733, 0.86015, 0.73133, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.90631, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.88323, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.85174, 1, 1, 1, 1, 1, 1, 0.96068, 0.95794, 0.96068, 0.95794, 0.96068, 0.95794, 0.77892, 0.84548, 1, 1, 0.89552, 0.90527, 1, 0.90363, 0.92794, 0.92794, 0.92794, 0.89807, 0.87012, 0.87012, 0.87012, 0.89552, 0.89552, 1.42259, 0.71094, 1.06152, 1, 1, 1.03372, 1.03372, 0.97171, 1.4956, 2.2807, 0.92972, 0.83406, 0.91133, 0.83326, 0.91133, 1, 1, 1, 0.72021, 1, 1.23108, 0.83489, 0.88525, 0.88525, 0.81499, 0.90616, 1.81055, 0.90527, 1.81055, 1.3107, 1.53711, 0.94434, 1.08696, 1, 0.95018, 0.77192, 0.85284, 0.90747, 1.17534, 0.69825, 0.9716, 1.37077, 0.90747, 0.90747, 0.85356, 0.90747, 0.90747, 1.44947, 0.85284, 0.8941, 0.8941, 0.70572, 0.8, 0.70572, 0.70572, 0.70572, 0.70572, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.99862, 0.99862, 1, 1, 1, 1, 1, 1.08004, 0.91027, 1, 1, 1, 0.99862, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.90727, 0.90727, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
28581const CalibriBoldItalicMetrics = {
28582  lineHeight: 1.2207,
28583  lineGap: 0.2207
28584};
28585const CalibriItalicFactors = [1.3877, 1, 1, 1, 1.17223, 1.1293, 0.89552, 0.91133, 0.80395, 1.02269, 1.15601, 0.91056, 0.91056, 1.2798, 0.85284, 0.89807, 1, 0.90861, 1.39543, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.96309, 0.96309, 0.85284, 0.85284, 0.85284, 0.83319, 0.88071, 0.8675, 0.81552, 0.72346, 0.85193, 0.73206, 0.7522, 0.81105, 0.86275, 0.90685, 0.6377, 0.77892, 
vendor: 3,657 bytes, line 28585
285850.75593, 1.02638, 0.89249, 0.84118, 0.77452, 0.85374, 0.75186, 0.67789, 0.79776, 0.88844, 0.85066, 0.94309, 0.77818, 0.7306, 0.76659, 1.10369, 1.38313, 1.10369, 1.06139, 0.89552, 0.8739, 0.9245, 0.9245, 0.83203, 0.9245, 0.85865, 1.09842, 0.9245, 0.9245, 1.03297, 1.07692, 0.90918, 1.03297, 0.94959, 0.9245, 0.92274, 0.9245, 0.9245, 1.02933, 0.77832, 1.20562, 0.9245, 0.8916, 0.98986, 0.86621, 0.89453, 0.79004, 0.94152, 1.77256, 0.94152, 0.85284, 0.97801, 0.89552, 0.91133, 0.89552, 0.91133, 1.91729, 0.89552, 1.17889, 1.13254, 1.16359, 0.92098, 0.85284, 0.68787, 0.71353, 0.84737, 0.90747, 1.0088, 1.0044, 0.87683, 1, 1.09091, 1, 0.92229, 0.739, 1.15642, 0.92098, 0.76288, 0.80504, 0.80972, 0.75859, 0.8675, 0.8675, 0.8675, 0.8675, 0.8675, 0.8675, 0.76318, 0.72346, 0.73206, 0.73206, 0.73206, 0.73206, 0.90685, 0.90685, 0.90685, 0.90685, 0.86477, 0.89249, 0.84118, 0.84118, 0.84118, 0.84118, 0.84118, 0.85284, 0.84557, 0.88844, 0.88844, 0.88844, 0.88844, 0.7306, 0.77452, 0.86331, 0.9245, 0.9245, 0.9245, 0.9245, 0.9245, 0.9245, 0.84843, 0.83203, 0.85865, 0.85865, 0.85865, 0.85865, 0.82601, 0.82601, 0.82601, 0.82601, 0.94469, 0.9245, 0.92274, 0.92274, 0.92274, 0.92274, 0.92274, 0.90747, 0.86651, 0.9245, 0.9245, 0.9245, 0.9245, 0.89453, 0.9245, 0.89453, 0.8675, 0.9245, 0.8675, 0.9245, 0.8675, 0.9245, 0.72346, 0.83203, 0.72346, 0.83203, 0.72346, 0.83203, 0.72346, 0.83203, 0.85193, 0.8875, 0.86477, 0.99034, 0.73206, 0.85865, 0.73206, 0.85865, 0.73206, 0.85865, 0.73206, 0.85865, 0.73206, 0.85865, 0.81105, 0.9245, 0.81105, 0.9245, 0.81105, 0.9245, 1, 1, 0.86275, 0.9245, 0.90872, 0.93591, 0.90685, 0.82601, 0.90685, 0.82601, 0.90685, 0.82601, 0.90685, 1.03297, 0.90685, 0.82601, 0.77896, 1.05611, 0.6377, 1.07692, 1, 1, 0.90918, 0.75593, 1.03297, 1, 1, 0.76032, 0.9375, 0.98156, 0.93407, 0.77261, 1.11429, 0.89249, 0.9245, 1, 1, 0.89249, 0.9245, 0.92534, 0.86698, 0.9245, 0.84118, 0.92274, 0.84118, 0.92274, 0.84118, 0.92274, 0.8667, 0.86291, 0.75186, 1.02933, 1, 1, 0.75186, 1.02933, 0.67789, 0.77832, 0.67789, 0.77832, 0.67789, 0.77832, 0.67789, 0.77832, 1, 1, 0.79776, 0.97655, 0.79776, 1.23023, 0.88844, 0.9245, 0.88844, 0.9245, 0.88844, 0.9245, 0.88844, 0.9245, 0.88844, 0.9245, 0.88844, 0.9245, 0.94309, 0.98986, 0.7306, 0.89453, 0.7306, 0.76659, 0.79004, 0.76659, 0.79004, 0.76659, 0.79004, 1.09231, 0.54873, 0.8675, 0.9245, 0.76318, 0.84843, 0.84557, 0.86651, 1, 1, 0.79776, 1.20562, 1.18622, 1.18622, 1, 1.1437, 0.67009, 0.96334, 0.93695, 1.35191, 1.40909, 0.95161, 1.48387, 0.8675, 0.90861, 0.6192, 0.7363, 0.64824, 0.82411, 0.56321, 0.85696, 1.23516, 0.8675, 0.81552, 0.7286, 0.84134, 0.73206, 0.76659, 0.86275, 0.84369, 0.90685, 0.77892, 0.85871, 1.02638, 0.89249, 0.75828, 0.84118, 0.85984, 0.77452, 0.76466, 0.79776, 0.7306, 0.90782, 0.77818, 0.903, 0.87291, 0.90685, 0.7306, 0.99058, 1.03667, 0.94635, 1.23516, 0.9849, 0.99058, 0.92393, 0.8916, 0.942, 1.03667, 0.75026, 0.94635, 1.0297, 1.23516, 0.90918, 0.94048, 0.98217, 0.89746, 0.84153, 0.92274, 0.82507, 0.88832, 0.84438, 0.88178, 1.03525, 0.9849, 1.00225, 0.78086, 0.97248, 0.89404, 1.23516, 0.9849, 0.92274, 0.9849, 0.89404, 0.73206, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.89693, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.85865, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.90933, 1, 1, 1, 1, 1, 1, 0.94309, 0.98986, 0.94309, 0.98986, 0.94309, 0.98986, 0.7306, 0.89453, 1, 1, 0.89552, 0.90527, 1, 0.90186, 1.12308, 1.12308, 1.12308, 1.12308, 1.2566, 1.2566, 1.2566, 0.89552, 0.89552, 1.42259, 0.68994, 1.03809, 1, 1, 1.0176, 1.01
vendor: 1,221 bytes, lines 28585-28590
2858576, 1.11523, 1.4956, 2.01462, 0.97858, 0.82616, 0.91133, 0.83437, 0.91133, 1, 1, 1, 0.70508, 1, 1.23108, 0.79801, 0.84426, 0.84426, 0.774, 0.90572, 1.81055, 0.90749, 1.81055, 1.28809, 1.55469, 0.94434, 1.07806, 1, 0.97094, 0.7589, 0.85284, 0.90747, 1.19658, 0.69825, 0.97622, 1.33512, 0.90747, 0.90747, 0.85284, 0.90747, 0.90747, 1.44947, 0.85284, 0.8941, 0.8941, 0.70572, 0.8, 0.70572, 0.70572, 0.70572, 0.70572, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.99862, 0.99862, 1, 1, 1, 1, 1, 1.0336, 0.91027, 1, 1, 1, 0.99862, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.05859, 1.05859, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
28586const CalibriItalicMetrics = {
28587  lineHeight: 1.2207,
28588  lineGap: 0.2207
28589};
28590const CalibriRegularFactors = [1.3877, 1, 1, 1, 1.17223, 1.1293, 0.89552, 0.91133, 0.80395, 1.02269, 1.15601, 0.91056, 0.91056, 1.2798, 0.85284, 0.89807, 1, 0.90861, 1.39016, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.96309, 0.96309, 0.85284, 0.85284, 0.85284, 0.83319, 0.88071, 0.8675, 0.81552, 0.73834, 0.85193, 0.73206, 0.7522, 0.81105, 0.86275, 0.90685, 0.6377, 0.77892, 
vendor: 3,690 bytes, line 28590
285900.75593, 1.02638, 0.89385, 0.85122, 0.77452, 0.86503, 0.75186, 0.68887, 0.79776, 0.88844, 0.85066, 0.94258, 0.77818, 0.7306, 0.76659, 1.10369, 1.39016, 1.10369, 1.06139, 0.89552, 0.8739, 0.86128, 0.94469, 0.8457, 0.94469, 0.89464, 1.09842, 0.84636, 0.94469, 1.03297, 1.07692, 0.90918, 1.03297, 0.95897, 0.94469, 0.9482, 0.94469, 0.94469, 1.04692, 0.78223, 1.20562, 0.94469, 0.90332, 0.98986, 0.86621, 0.90527, 0.79004, 0.94152, 1.77256, 0.94152, 0.85284, 0.97801, 0.89552, 0.91133, 0.89552, 0.91133, 1.91729, 0.89552, 1.17889, 1.13254, 1.08707, 0.92098, 0.85284, 0.68787, 0.71353, 0.84737, 0.90747, 1.0088, 1.0044, 0.87683, 1, 1.09091, 1, 0.92229, 0.739, 1.15642, 0.92098, 0.76288, 0.80504, 0.80972, 0.75859, 0.8675, 0.8675, 0.8675, 0.8675, 0.8675, 0.8675, 0.76318, 0.73834, 0.73206, 0.73206, 0.73206, 0.73206, 0.90685, 0.90685, 0.90685, 0.90685, 0.86477, 0.89385, 0.85122, 0.85122, 0.85122, 0.85122, 0.85122, 0.85284, 0.85311, 0.88844, 0.88844, 0.88844, 0.88844, 0.7306, 0.77452, 0.86331, 0.86128, 0.86128, 0.86128, 0.86128, 0.86128, 0.86128, 0.8693, 0.8457, 0.89464, 0.89464, 0.89464, 0.89464, 0.82601, 0.82601, 0.82601, 0.82601, 0.94469, 0.94469, 0.9482, 0.9482, 0.9482, 0.9482, 0.9482, 0.90747, 0.86651, 0.94469, 0.94469, 0.94469, 0.94469, 0.90527, 0.94469, 0.90527, 0.8675, 0.86128, 0.8675, 0.86128, 0.8675, 0.86128, 0.73834, 0.8457, 0.73834, 0.8457, 0.73834, 0.8457, 0.73834, 0.8457, 0.85193, 0.92454, 0.86477, 0.9921, 0.73206, 0.89464, 0.73206, 0.89464, 0.73206, 0.89464, 0.73206, 0.89464, 0.73206, 0.89464, 0.81105, 0.84636, 0.81105, 0.84636, 0.81105, 0.84636, 1, 1, 0.86275, 0.94469, 0.90872, 0.95786, 0.90685, 0.82601, 0.90685, 0.82601, 0.90685, 0.82601, 0.90685, 1.03297, 0.90685, 0.82601, 0.77741, 1.05611, 0.6377, 1.07692, 1, 1, 0.90918, 0.75593, 1.03297, 1, 1, 0.76032, 0.90452, 0.98156, 1.11842, 0.77261, 1.11429, 0.89385, 0.94469, 1, 1, 0.89385, 0.94469, 0.95877, 0.86901, 0.94469, 0.85122, 0.9482, 0.85122, 0.9482, 0.85122, 0.9482, 0.8667, 0.90016, 0.75186, 1.04692, 1, 1, 0.75186, 1.04692, 0.68887, 0.78223, 0.68887, 0.78223, 0.68887, 0.78223, 0.68887, 0.78223, 1, 1, 0.79776, 0.92188, 0.79776, 1.23023, 0.88844, 0.94469, 0.88844, 0.94469, 0.88844, 0.94469, 0.88844, 0.94469, 0.88844, 0.94469, 0.88844, 0.94469, 0.94258, 0.98986, 0.7306, 0.90527, 0.7306, 0.76659, 0.79004, 0.76659, 0.79004, 0.76659, 0.79004, 1.09231, 0.54873, 0.8675, 0.86128, 0.76318, 0.8693, 0.85311, 0.86651, 1, 1, 0.79776, 1.20562, 1.18622, 1.18622, 1, 1.1437, 0.67742, 0.96334, 0.93695, 1.35191, 1.40909, 0.95161, 1.48387, 0.86686, 0.90861, 0.62267, 0.74359, 0.65649, 0.85498, 0.56963, 0.88254, 1.23516, 0.8675, 0.81552, 0.75443, 0.84503, 0.73206, 0.76659, 0.86275, 0.85122, 0.90685, 0.77892, 0.85746, 1.02638, 0.89385, 0.75657, 0.85122, 0.86275, 0.77452, 0.74171, 0.79776, 0.7306, 0.95165, 0.77818, 0.89772, 0.88831, 0.90685, 0.7306, 0.98142, 1.02191, 0.96576, 1.23516, 0.99018, 0.98142, 0.9236, 0.89258, 0.94035, 1.02191, 0.78848, 0.96576, 0.9561, 1.23516, 0.90918, 0.92578, 0.95424, 0.89746, 0.83969, 0.9482, 0.80113, 0.89442, 0.85208, 0.86155, 0.98022, 0.99018, 1.00452, 0.81209, 0.99247, 0.89181, 1.23516, 0.99018, 0.9482, 0.99018, 0.89181, 0.73206, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.88844, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.89464, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.96766, 1, 1, 1, 1, 1, 1, 0.94258, 0.98986, 0.94258, 0.98986, 0.94258, 0.98986, 0.7306, 0.90527, 1, 1, 0.89552, 0.90527, 1, 0.90186, 1.12308, 1.12308, 1.12308, 1.12308, 1.2566, 1.2566, 1.2566, 0.89552, 0.89552, 1.42259, 0.69043, 1.03809, 1, 1, 1.0176, 1.01
vendor: 56,964 bytes, lines 28590-28634
2859076, 1.11523, 1.4956, 2.01462, 0.99331, 0.82616, 0.91133, 0.84286, 0.91133, 1, 1, 1, 0.70508, 1, 1.23108, 0.79801, 0.84426, 0.84426, 0.774, 0.90527, 1.81055, 0.90527, 1.81055, 1.28809, 1.55469, 0.94434, 1.07806, 1, 0.97094, 0.7589, 0.85284, 0.90747, 1.19658, 0.69825, 0.97622, 1.33512, 0.90747, 0.90747, 0.85356, 0.90747, 0.90747, 1.44947, 0.85284, 0.8941, 0.8941, 0.70572, 0.8, 0.70572, 0.70572, 0.70572, 0.70572, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.99862, 0.99862, 1, 1, 1, 1, 1, 1.0336, 0.91027, 1, 1, 1, 0.99862, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.05859, 1.05859, 1, 1, 1, 1.07185, 0.99413, 0.96334, 1.08065, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
28591const CalibriRegularMetrics = {
28592  lineHeight: 1.2207,
28593  lineGap: 0.2207
28594};
28595
28596;// ./src/core/helvetica_factors.js
28597const HelveticaBoldFactors = [0.76116, 1, 1, 1.0006, 0.99998, 0.99974, 0.99973, 0.99973, 0.99982, 0.99977, 1.00087, 0.99998, 0.99998, 0.99959, 1.00003, 1.0006, 0.99998, 1.0006, 1.0006, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99998, 1, 1.00003, 1.00003, 1.00003, 1.00026, 0.9999, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00026, 1.00022, 0.99977, 1.0006, 0.99973, 0.99977, 1.00026, 0.99999, 0.99977, 1.00022, 1.00001, 1.00022, 0.99977, 1.00001, 1.00026, 0.99977, 1.00001, 1.00016, 1.00001, 1.00001, 1.00026, 0.99998, 1.0006, 0.99998, 1.00003, 0.99973, 0.99998, 0.99973, 1.00026, 0.99973, 1.00026, 0.99973, 0.99998, 1.00026, 1.00026, 1.0006, 1.0006, 0.99973, 1.0006, 0.99982, 1.00026, 1.00026, 1.00026, 1.00026, 0.99959, 0.99973, 0.99998, 1.00026, 0.99973, 1.00022, 0.99973, 0.99973, 1, 0.99959, 1.00077, 0.99959, 1.00003, 0.99998, 0.99973, 0.99973, 0.99973, 0.99973, 1.00077, 0.99973, 0.99998, 1.00025, 0.99968, 0.99973, 1.00003, 1.00025, 0.60299, 1.00024, 1.06409, 1, 1, 0.99998, 1, 0.99973, 1.0006, 0.99998, 1, 0.99936, 0.99973, 1.00002, 1.00002, 1.00002, 1.00026, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 1, 0.99977, 1.00001, 1.00001, 1.00001, 1.00001, 1.0006, 1.0006, 1.0006, 1.0006, 0.99977, 0.99977, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 1.00003, 1.00022, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00001, 1.00026, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99982, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 1.0006, 1.0006, 1.0006, 1.0006, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.06409, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 0.99973, 1.00026, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 1.03374, 0.99977, 1.00026, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00022, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.00042, 0.99973, 0.99973, 1.0006, 0.99977, 0.99973, 0.99973, 1.00026, 1.0006, 1.00026, 1.0006, 1.00026, 1.03828, 1.00026, 0.99999, 1.00026, 1.0006, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.9993, 0.9998, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 1, 1.00016, 0.99977, 0.99959, 0.99977, 0.99959, 0.99977, 0.99959, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00026, 0.99998, 1.00026, 0.8121, 1.00026, 0.99998, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 1.00016, 1.00022, 1.00001, 0.99973, 1.00001, 1.00026, 1, 1.00026, 1, 1.00026, 1, 1.0006, 0.99973, 0.99977, 0.99973, 1, 0.99982, 1.00022, 1.00026, 1.00001, 0.99973, 1.00026, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 1.00034, 0.99977, 1, 0.99997, 1.00026, 1.00078, 1.00036, 0.99973, 1.00013, 1.0006, 0.99977, 0.99977, 0.99988, 0.85148, 1.00001, 1.00026, 0.99977, 1.00022, 1.0006, 0.99977, 1.00001, 0.99999, 0.99977, 1.00069, 1.00022, 0.99977, 1.00001, 0.99984, 1.00026, 1.00001, 1.00024, 1.00001, 0.9999, 1, 1.0006, 1.00001, 1.00041, 0.99962, 1.00026, 1.0006, 0.99995, 1.00041, 0.99942, 0.99973, 0.99927, 1.00082, 0.99902, 1.00026, 1.00087, 1.0006, 1.00069, 0.99973, 0.99867, 0.99973, 0.9993, 1.00026, 1.00049, 1.00056, 1, 0.99988, 0.99935, 0.99995, 0.99954, 1.00055, 0.99945, 1.00032, 1.0006, 0.99995, 1.00026, 0.99995, 1.00032, 1.00001, 1.00008, 0.99971, 1.00019, 0.9994, 1.00001, 1.0006, 1.00044, 0.99973, 1.00023, 1.00047, 1, 0.99942, 0.99561, 0.99989, 1.00035, 0.99977, 1.00035, 0.99977, 1.00019, 0.99944, 1.00001, 1.00021, 0.99926, 1.00035, 1.00035, 0.99942, 1.00048, 0.99999, 0.99977, 1.00022, 1.00035, 1.00001, 0.99977, 1.00026, 0.99989, 1.00057, 1.00001, 0.99936, 1.00052, 1.00012, 0.99996, 1.00043, 1, 1.00035, 0.9994, 0.99976, 1.00035, 0.99973, 1.00052, 1.00041, 1.00119, 1.00037, 0.99973, 1.00002, 0.99986, 1.00041, 1.00041, 0.99902, 0.9996, 1.00034, 0.99999, 1.00026, 0.99999, 1.00026, 0.99973, 1.00052, 0.99973, 1, 0.99973, 1.00041, 1.00075, 0.9994, 1.0003, 0.99999, 1, 1.00041, 0.99955, 1, 0.99915, 0.99973, 0.99973, 1.00026, 1.00119, 0.99955, 0.99973, 1.0006, 0.99911, 1.0006, 1.00026, 0.99972, 1.00026, 0.99902, 1.00041, 0.99973, 0.99999, 1, 1, 1.00038, 1.0005, 1.00016, 1.00022, 1.00016, 1.00022, 1.00016, 1.00022, 1.00001, 0.99973, 1, 1, 0.99973, 1, 1, 0.99955, 1.0006, 1.0006, 1.0006, 1.0006, 1, 1, 1, 0.99973, 0.99973, 0.99972, 1, 1, 1.00106, 0.99999, 0.99998, 0.99998, 0.99999, 0.99998, 1.66475, 1, 0.99973, 0.99973, 1.00023, 0.99973, 0.99971, 1.00047, 1.00023, 1, 0.99991, 0.99984, 1.00002, 1.00002, 1.00002, 1.00002, 1, 1, 1, 1, 1, 1, 1, 0.99972, 1, 1.20985, 1.39713, 1.00003, 1.00031, 1.00015, 1, 0.99561, 1.00027, 1.00031, 1.00031, 0.99915, 1.00031, 1.00031, 0.99999, 1.00003, 0.99999, 0.99999, 1.41144, 1.6, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.40579, 1.40579, 1.36625, 0.99999, 1, 0.99861, 0.99861, 1, 1.00026, 1.00026, 1.00026, 1.00026, 0.99972, 0.99999, 0.99999, 0.99999, 0.99999, 1.40483, 1, 0.99977, 1.00054, 1, 1, 0.99953, 0.99962, 1.00042, 0.9995, 1, 1, 1, 1, 1, 1, 1, 1, 0.99998, 0.99998, 0.99998, 0.99998, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
28598const HelveticaBoldMetrics = {
28599  lineHeight: 1.2,
28600  lineGap: 0.2
28601};
28602const HelveticaBoldItalicFactors = [0.76116, 1, 1, 1.0006, 0.99998, 0.99974, 0.99973, 0.99973, 0.99982, 0.99977, 1.00087, 0.99998, 0.99998, 0.99959, 1.00003, 1.0006, 0.99998, 1.0006, 1.0006, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99998, 1, 1.00003, 1.00003, 1.00003, 1.00026, 0.9999, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00026, 1.00022, 0.99977, 1.0006, 0.99973, 0.99977, 1.00026, 0.99999, 0.99977, 1.00022, 1.00001, 1.00022, 0.99977, 1.00001, 1.00026, 0.99977, 1.00001, 1.00016, 1.00001, 1.00001, 1.00026, 0.99998, 1.0006, 0.99998, 1.00003, 0.99973, 0.99998, 0.99973, 1.00026, 0.99973, 1.00026, 0.99973, 0.99998, 1.00026, 1.00026, 1.0006, 1.0006, 0.99973, 1.0006, 0.99982, 1.00026, 1.00026, 1.00026, 1.00026, 0.99959, 0.99973, 0.99998, 1.00026, 0.99973, 1.00022, 0.99973, 0.99973, 1, 0.99959, 1.00077, 0.99959, 1.00003, 0.99998, 0.99973, 0.99973, 0.99973, 0.99973, 1.00077, 0.99973, 0.99998, 1.00025, 0.99968, 0.99973, 1.00003, 1.00025, 0.60299, 1.00024, 1.06409, 1, 1, 0.99998, 1, 0.99973, 1.0006, 0.99998, 1, 0.99936, 0.99973, 1.00002, 1.00002, 1.00002, 1.00026, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 1, 0.99977, 1.00001, 1.00001, 1.00001, 1.00001, 1.0006, 1.0006, 1.0006, 1.0006, 0.99977, 0.99977, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 1.00003, 1.00022, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00001, 1.00026, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99982, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 1.0006, 1.0006, 1.0006, 1.0006, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.06409, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 0.99973, 1.00026, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 1.0044, 0.99977, 1.00026, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00022, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 0.99971, 0.99973, 0.99973, 1.0006, 0.99977, 0.99973, 0.99973, 1.00026, 1.0006, 1.00026, 1.0006, 1.00026, 1.01011, 1.00026, 0.99999, 1.00026, 1.0006, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.9993, 0.9998, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 1, 1.00016, 0.99977, 0.99959, 0.99977, 0.99959, 0.99977, 0.99959, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00026, 0.99998, 1.00026, 0.8121, 1.00026, 0.99998, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 1.00016, 1.00022, 1.00001, 0.99973, 1.00001, 1.00026, 1, 1.00026, 1, 1.00026, 1, 1.0006, 0.99973, 0.99977, 0.99973, 1, 0.99982, 1.00022, 1.00026, 1.00001, 0.99973, 1.00026, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99977, 1, 1, 1.00026, 0.99969, 0.99972, 0.99981, 0.9998, 1.0006, 0.99977, 0.99977, 1.00022, 0.91155, 1.00001, 1.00026, 0.99977, 1.00022, 1.0006, 0.99977, 1.00001, 0.99999, 0.99977, 0.99966, 1.00022, 1.00032, 1.00001, 0.99944, 1.00026, 1.00001, 0.99968, 1.00001, 1.00047, 1, 1.0006, 1.00001, 0.99981, 1.00101, 1.00026, 1.0006, 0.99948, 0.99981, 1.00064, 0.99973, 0.99942, 1.00101, 1.00061, 1.00026, 1.00069, 1.0006, 1.00014, 0.99973, 1.01322, 0.99973, 1.00065, 1.00026, 1.00012, 0.99923, 1, 1.00064, 1.00076, 0.99948, 1.00055, 1.00063, 1.00007, 0.99943, 1.0006, 0.99948, 1.00026, 0.99948, 0.99943, 1.00001, 1.00001, 1.00029, 1.00038, 1.00035, 1.00001, 1.0006, 1.0006, 0.99973, 0.99978, 1.00001, 1.00057, 0.99989, 0.99967, 0.99964, 0.99967, 0.99977, 0.99999, 0.99977, 1.00038, 0.99977, 1.00001, 0.99973, 1.00066, 0.99967, 0.99967, 1.00041, 0.99998, 0.99999, 0.99977, 1.00022, 0.99967, 1.00001, 0.99977, 1.00026, 0.99964, 1.00031, 1.00001, 0.99999, 0.99999, 1, 1.00023, 1, 1, 0.99999, 1.00035, 1.00001, 0.99999, 0.99973, 0.99977, 0.99999, 1.00058, 0.99973, 0.99973, 0.99955, 0.9995, 1.00026, 1.00026, 1.00032, 0.99989, 1.00034, 0.99999, 1.00026, 1.00026, 1.00026, 0.99973, 0.45998, 0.99973, 1.00026, 0.99973, 1.00001, 0.99999, 0.99982, 0.99994, 0.99996, 1, 1.00042, 1.00044, 1.00029, 1.00023, 0.99973, 0.99973, 1.00026, 0.99949, 1.00002, 0.99973, 1.0006, 1.0006, 1.0006, 0.99975, 1.00026, 1.00026, 1.00032, 0.98685, 0.99973, 1.00026, 1, 1, 0.99966, 1.00044, 1.00016, 1.00022, 1.00016, 1.00022, 1.00016, 1.00022, 1.00001, 0.99973, 1, 1, 0.99973, 1, 1, 0.99955, 1.0006, 1.0006, 1.0006, 1.0006, 1, 1, 1, 0.99973, 0.99973, 0.99972, 1, 1, 1.00106, 0.99999, 0.99998, 0.99998, 0.99999, 0.99998, 1.66475, 1, 0.99973, 0.99973, 1, 0.99973, 0.99971, 0.99978, 1, 1, 0.99991, 0.99984, 1.00002, 1.00002, 1.00002, 1.00002, 1.00098, 1, 1, 1, 1.00049, 1, 1, 0.99972, 1, 1.20985, 1.39713, 1.00003, 1.00031, 1.00015, 1, 0.99561, 1.00027, 1.00031, 1.00031, 0.99915, 1.00031, 1.00031, 0.99999, 1.00003, 0.99999, 0.99999, 1.41144, 1.6, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.40579, 1.40579, 1.36625, 0.99999, 1, 0.99861, 0.99861, 1, 1.00026, 1.00026, 1.00026, 1.00026, 0.99972, 0.99999, 0.99999, 0.99999, 0.99999, 1.40483, 1, 0.99977, 1.00054, 1, 1, 0.99953, 0.99962, 1.00042, 0.9995, 1, 1, 1, 1, 1, 1, 1, 1, 0.99998, 0.99998, 0.99998, 0.99998, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
28603const HelveticaBoldItalicMetrics = {
28604  lineHeight: 1.35,
28605  lineGap: 0.2
28606};
28607const HelveticaItalicFactors = [0.76116, 1, 1, 1.0006, 1.0006, 1.00006, 0.99973, 0.99973, 0.99982, 1.00001, 1.00043, 0.99998, 0.99998, 0.99959, 1.00003, 1.0006, 0.99998, 1.0006, 1.0006, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 1.0006, 1, 1.00003, 1.00003, 1.00003, 0.99973, 0.99987, 1.00001, 1.00001, 0.99977, 0.99977, 1.00001, 1.00026, 1.00022, 0.99977, 1.0006, 1, 1.00001, 0.99973, 0.99999, 0.99977, 1.00022, 1.00001, 1.00022, 0.99977, 1.00001, 1.00026, 0.99977, 1.00001, 1.00016, 1.00001, 1.00001, 1.00026, 1.0006, 1.0006, 1.0006, 0.99949, 0.99973, 0.99998, 0.99973, 0.99973, 1, 0.99973, 0.99973, 1.0006, 0.99973, 0.99973, 0.99924, 0.99924, 1, 0.99924, 0.99999, 0.99973, 0.99973, 0.99973, 0.99973, 0.99998, 1, 1.0006, 0.99973, 1, 0.99977, 1, 1, 1, 1.00005, 1.0009, 1.00005, 1.00003, 0.99998, 0.99973, 0.99973, 0.99973, 0.99973, 1.0009, 0.99973, 0.99998, 1.00025, 0.99968, 0.99973, 1.00003, 1.00025, 0.60299, 1.00024, 1.06409, 1, 1, 0.99998, 1, 0.9998, 1.0006, 0.99998, 1, 0.99936, 0.99973, 1.00002, 1.00002, 1.00002, 1.00026, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1, 0.99977, 1.00001, 1.00001, 1.00001, 1.00001, 1.0006, 1.0006, 1.0006, 1.0006, 0.99977, 0.99977, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 1.00003, 1.00022, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00001, 1.00026, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99982, 1, 0.99973, 0.99973, 0.99973, 0.99973, 1.0006, 1.0006, 1.0006, 1.0006, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 1.06409, 1.00026, 0.99973, 0.99973, 0.99973, 0.99973, 1, 0.99973, 1, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 0.99977, 1, 0.99977, 1, 0.99977, 1, 0.99977, 1, 0.99977, 1.0288, 0.99977, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 0.99924, 1.0006, 1.0006, 0.99946, 1.00034, 1, 0.99924, 1.00001, 1, 1, 0.99973, 0.99924, 0.99973, 0.99924, 0.99973, 1.06311, 0.99973, 1.00024, 0.99973, 0.99924, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 1.00041, 0.9998, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 1, 1.00016, 0.99977, 0.99998, 0.99977, 0.99998, 0.99977, 0.99998, 1.00001, 1, 1.00001, 1, 1.00001, 1, 1.00001, 1, 1.00026, 1.0006, 1.00026, 0.89547, 1.00026, 1.0006, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 1.00016, 0.99977, 1.00001, 1, 1.00001, 1.00026, 1, 1.00026, 1, 1.00026, 1, 0.99924, 0.99973, 1.00001, 0.99973, 1, 0.99982, 1.00022, 1.00026, 1.00001, 1, 1.00026, 1.0006, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 1.00001, 1, 1.00054, 0.99977, 1.00084, 1.00007, 0.99973, 1.00013, 0.99924, 1.00001, 1.00001, 0.99945, 0.91221, 1.00001, 1.00026, 0.99977, 1.00022, 1.0006, 1.00001, 1.00001, 0.99999, 0.99977, 0.99933, 1.00022, 1.00054, 1.00001, 1.00065, 1.00026, 1.00001, 1.0001, 1.00001, 1.00052, 1, 1.0006, 1.00001, 0.99945, 0.99897, 0.99968, 0.99924, 1.00036, 0.99945, 0.99949, 1, 1.0006, 0.99897, 0.99918, 0.99968, 0.99911, 0.99924, 1, 0.99962, 1.01487, 1, 1.0005, 0.99973, 1.00012, 1.00043, 1, 0.99995, 0.99994, 1.00036, 0.99947, 1.00019, 1.00063, 1.00025, 0.99924, 1.00036, 0.99973, 1.00036, 1.00025, 1.00001, 1.00001, 1.00027, 1.0001, 1.00068, 1.00001, 1.0006, 1.0006, 1, 1.00008, 0.99957, 0.99972, 0.9994, 0.99954, 0.99975, 1.00051, 1.00001, 1.00019, 1.00001, 1.0001, 0.99986, 1.00001, 1.00001, 1.00038, 0.99954, 0.99954, 0.9994, 1.00066, 0.99999, 0.99977, 1.00022, 1.00054, 1.00001, 0.99977, 1.00026, 0.99975, 1.0001, 1.00001, 0.99993, 0.9995, 0.99955, 1.00016, 0.99978, 0.99974, 1.00019, 1.00022, 0.99955, 1.00053, 0.99973, 1.00089, 1.00005, 0.99967, 1.00048, 0.99973, 1.00002, 1.00034, 0.99973, 0.99973, 0.99964, 1.00006, 1.00066, 0.99947, 0.99973, 0.98894, 0.99973, 1, 0.44898, 1, 0.99946, 1, 1.00039, 1.00082, 0.99991, 0.99991, 0.99985, 1.00022, 1.00023, 1.00061, 1.00006, 0.99966, 0.99973, 0.99973, 0.99973, 1.00019, 1.0008, 1, 0.99924, 0.99924, 0.99924, 0.99983, 1.00044, 0.99973, 0.99964, 0.98332, 1, 0.99973, 1, 1, 0.99962, 0.99895, 1.00016, 0.99977, 1.00016, 0.99977, 1.00016, 0.99977, 1.00001, 1, 1, 1, 0.99973, 1, 1, 0.99955, 0.99924, 0.99924, 0.99924, 0.99924, 0.99998, 0.99998, 0.99998, 0.99973, 0.99973, 0.99972, 1, 1, 1.00267, 0.99999, 0.99998, 0.99998, 1, 0.99998, 1.66475, 1, 0.99973, 0.99973, 1.00023, 0.99973, 1.00423, 0.99925, 0.99999, 1, 0.99991, 0.99984, 1.00002, 1.00002, 1.00002, 1.00002, 1.00049, 1, 1.00245, 1, 1, 1, 1, 0.96329, 1, 1.20985, 1.39713, 1.00003, 0.8254, 1.00015, 1, 1.00035, 1.00027, 1.00031, 1.00031, 1.00003, 1.00031, 1.00031, 0.99999, 1.00003, 0.99999, 0.99999, 1.41144, 1.6, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.40579, 1.40579, 1.36625, 0.99999, 1, 0.99861, 0.99861, 1, 1.00026, 1.00026, 1.00026, 1.00026, 0.95317, 0.99999, 0.99999, 0.99999, 0.99999, 1.40483, 1, 0.99977, 1.00054, 1, 1, 0.99953, 0.99962, 1.00042, 0.9995, 1, 1, 1, 1, 1, 1, 1, 1, 0.99998, 0.99998, 0.99998, 0.99998, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
28608const HelveticaItalicMetrics = {
28609  lineHeight: 1.35,
28610  lineGap: 0.2
28611};
28612const HelveticaRegularFactors = [0.76116, 1, 1, 1.0006, 1.0006, 1.00006, 0.99973, 0.99973, 0.99982, 1.00001, 1.00043, 0.99998, 0.99998, 0.99959, 1.00003, 1.0006, 0.99998, 1.0006, 1.0006, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 1.0006, 1, 1.00003, 1.00003, 1.00003, 0.99973, 0.99987, 1.00001, 1.00001, 0.99977, 0.99977, 1.00001, 1.00026, 1.00022, 0.99977, 1.0006, 1, 1.00001, 0.99973, 0.99999, 0.99977, 1.00022, 1.00001, 1.00022, 0.99977, 1.00001, 1.00026, 0.99977, 1.00001, 1.00016, 1.00001, 1.00001, 1.00026, 1.0006, 1.0006, 1.0006, 0.99949, 0.99973, 0.99998, 0.99973, 0.99973, 1, 0.99973, 0.99973, 1.0006, 0.99973, 0.99973, 0.99924, 0.99924, 1, 0.99924, 0.99999, 0.99973, 0.99973, 0.99973, 0.99973, 0.99998, 1, 1.0006, 0.99973, 1, 0.99977, 1, 1, 1, 1.00005, 1.0009, 1.00005, 1.00003, 0.99998, 0.99973, 0.99973, 0.99973, 0.99973, 1.0009, 0.99973, 0.99998, 1.00025, 0.99968, 0.99973, 1.00003, 1.00025, 0.60299, 1.00024, 1.06409, 1, 1, 0.99998, 1, 0.9998, 1.0006, 0.99998, 1, 0.99936, 0.99973, 1.00002, 1.00002, 1.00002, 1.00026, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1, 0.99977, 1.00001, 1.00001, 1.00001, 1.00001, 1.0006, 1.0006, 1.0006, 1.0006, 0.99977, 0.99977, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 1.00003, 1.00022, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00001, 1.00026, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99982, 1, 0.99973, 0.99973, 0.99973, 0.99973, 1.0006, 1.0006, 1.0006, 1.0006, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 1.06409, 1.00026, 0.99973, 0.99973, 0.99973, 0.99973, 1, 0.99973, 1, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 0.99977, 1, 0.99977, 1, 0.99977, 1, 0.99977, 1, 0.99977, 1.04596, 0.99977, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 0.99924, 1.0006, 1.0006, 1.00019, 1.00034, 1, 0.99924, 1.00001, 1, 1, 0.99973, 0.99924, 0.99973, 0.99924, 0.99973, 1.02572, 0.99973, 1.00005, 0.99973, 0.99924, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99999, 0.9998, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 1, 1.00016, 0.99977, 0.99998, 0.99977, 0.99998, 0.99977, 0.99998, 1.00001, 1, 1.00001, 1, 1.00001, 1, 1.00001, 1, 1.00026, 1.0006, 1.00026, 0.84533, 1.00026, 1.0006, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 1.00016, 0.99977, 1.00001, 1, 1.00001, 1.00026, 1, 1.00026, 1, 1.00026, 1, 0.99924, 0.99973, 1.00001, 0.99973, 1, 0.99982, 1.00022, 1.00026, 1.00001, 1, 1.00026, 1.0006, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99928, 1, 0.99977, 1.00013, 1.00055, 0.99947, 0.99945, 0.99941, 0.99924, 1.00001, 1.00001, 1.0004, 0.91621, 1.00001, 1.00026, 0.99977, 1.00022, 1.0006, 1.00001, 1.00005, 0.99999, 0.99977, 1.00015, 1.00022, 0.99977, 1.00001, 0.99973, 1.00026, 1.00001, 1.00019, 1.00001, 0.99946, 1, 1.0006, 1.00001, 0.99978, 1.00045, 0.99973, 0.99924, 1.00023, 0.99978, 0.99966, 1, 1.00065, 1.00045, 1.00019, 0.99973, 0.99973, 0.99924, 1, 1, 0.96499, 1, 1.00055, 0.99973, 1.00008, 1.00027, 1, 0.9997, 0.99995, 1.00023, 0.99933, 1.00019, 1.00015, 1.00031, 0.99924, 1.00023, 0.99973, 1.00023, 1.00031, 1.00001, 0.99928, 1.00029, 1.00092, 1.00035, 1.00001, 1.0006, 1.0006, 1, 0.99988, 0.99975, 1, 1.00082, 0.99561, 0.9996, 1.00035, 1.00001, 0.99962, 1.00001, 1.00092, 0.99964, 1.00001, 0.99963, 0.99999, 1.00035, 1.00035, 1.00082, 0.99962, 0.99999, 0.99977, 1.00022, 1.00035, 1.00001, 0.99977, 1.00026, 0.9996, 0.99967, 1.00001, 1.00034, 1.00074, 1.00054, 1.00053, 1.00063, 0.99971, 0.99962, 1.00035, 0.99975, 0.99977, 0.99973, 1.00043, 0.99953, 1.0007, 0.99915, 0.99973, 1.00008, 0.99892, 1.00073, 1.00073, 1.00114, 0.99915, 1.00073, 0.99955, 0.99973, 1.00092, 0.99973, 1, 0.99998, 1, 1.0003, 1, 1.00043, 1.00001, 0.99969, 1.0003, 1, 1.00035, 1.00001, 0.9995, 1, 1.00092, 0.99973, 0.99973, 0.99973, 1.0007, 0.9995, 1, 0.99924, 1.0006, 0.99924, 0.99972, 1.00062, 0.99973, 1.00114, 1.00073, 1, 0.99955, 1, 1, 1.00047, 0.99968, 1.00016, 0.99977, 1.00016, 0.99977, 1.00016, 0.99977, 1.00001, 1, 1, 1, 0.99973, 1, 1, 0.99955, 0.99924, 0.99924, 0.99924, 0.99924, 0.99998, 0.99998, 0.99998, 0.99973, 0.99973, 0.99972, 1, 1, 1.00267, 0.99999, 0.99998, 0.99998, 1, 0.99998, 1.66475, 1, 0.99973, 0.99973, 1.00023, 0.99973, 0.99971, 0.99925, 1.00023, 1, 0.99991, 0.99984, 1.00002, 1.00002, 1.00002, 1.00002, 1, 1, 1, 1, 1, 1, 1, 0.96329, 1, 1.20985, 1.39713, 1.00003, 0.8254, 1.00015, 1, 1.00035, 1.00027, 1.00031, 1.00031, 0.99915, 1.00031, 1.00031, 0.99999, 1.00003, 0.99999, 0.99999, 1.41144, 1.6, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.40579, 1.40579, 1.36625, 0.99999, 1, 0.99861, 0.99861, 1, 1.00026, 1.00026, 1.00026, 1.00026, 0.95317, 0.99999, 0.99999, 0.99999, 0.99999, 1.40483, 1, 0.99977, 1.00054, 1, 1, 0.99953, 0.99962, 1.00042, 0.9995, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
28613const HelveticaRegularMetrics = {
28614  lineHeight: 1.2,
28615  lineGap: 0.2
28616};
28617
28618;// ./src/core/liberationsans_widths.js
28619const LiberationSansBoldWidths = [365, 0, 333, 278, 333, 474, 556, 556, 889, 722, 238, 333, 333, 389, 584, 278, 333, 278, 278, 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 333, 333, 584, 584, 584, 611, 975, 722, 722, 722, 722, 667, 611, 778, 722, 278, 556, 722, 611, 833, 722, 778, 667, 778, 722, 667, 611, 722, 667, 944, 667, 667, 611, 333, 278, 333, 584, 556, 333, 556, 611, 556, 611, 556, 333, 611, 611, 278, 278, 556, 278, 889, 611, 611, 611, 611, 389, 556, 333, 611, 556, 778, 556, 556, 500, 389, 280, 389, 584, 333, 556, 556, 556, 556, 280, 556, 333, 737, 370, 556, 584, 737, 552, 400, 549, 333, 333, 333, 576, 556, 278, 333, 333, 365, 556, 834, 834, 834, 611, 722, 722, 722, 722, 722, 722, 1000, 722, 667, 667, 667, 667, 278, 278, 278, 278, 722, 722, 778, 778, 778, 778, 778, 584, 778, 722, 722, 722, 722, 667, 667, 611, 556, 556, 556, 556, 556, 556, 889, 556, 556, 556, 556, 556, 278, 278, 278, 278, 611, 611, 611, 611, 611, 611, 611, 549, 611, 611, 611, 611, 611, 556, 611, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 719, 722, 611, 667, 556, 667, 556, 667, 556, 667, 556, 667, 556, 778, 611, 778, 611, 778, 611, 778, 611, 722, 611, 722, 611, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 785, 556, 556, 278, 722, 556, 556, 611, 278, 611, 278, 611, 385, 611, 479, 611, 278, 722, 611, 722, 611, 722, 611, 708, 723, 611, 778, 611, 778, 611, 778, 611, 1000, 944, 722, 389, 722, 389, 722, 389, 667, 556, 667, 556, 667, 556, 667, 556, 611, 333, 611, 479, 611, 333, 722, 611, 722, 611, 722, 611, 722, 611, 722, 611, 722, 611, 944, 778, 667, 556, 667, 611, 500, 611, 500, 611, 500, 278, 556, 722, 556, 1000, 889, 778, 611, 667, 556, 611, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 465, 722, 333, 853, 906, 474, 825, 927, 838, 278, 722, 722, 601, 719, 667, 611, 722, 778, 278, 722, 667, 833, 722, 644, 778, 722, 667, 600, 611, 667, 821, 667, 809, 802, 278, 667, 615, 451, 611, 278, 582, 615, 610, 556, 606, 475, 460, 611, 541, 278, 558, 556, 612, 556, 445, 611, 766, 619, 520, 684, 446, 582, 715, 576, 753, 845, 278, 582, 611, 582, 845, 667, 669, 885, 567, 711, 667, 278, 276, 556, 1094, 1062, 875, 610, 722, 622, 719, 722, 719, 722, 567, 712, 667, 904, 626, 719, 719, 610, 702, 833, 722, 778, 719, 667, 722, 611, 622, 854, 667, 730, 703, 1005, 1019, 870, 979, 719, 711, 1031, 719, 556, 618, 615, 417, 635, 556, 709, 497, 615, 615, 500, 635, 740, 604, 611, 604, 611, 556, 490, 556, 875, 556, 615, 581, 833, 844, 729, 854, 615, 552, 854, 583, 556, 556, 611, 417, 552, 556, 278, 281, 278, 969, 906, 611, 500, 615, 556, 604, 778, 611, 487, 447, 944, 778, 944, 778, 944, 778, 667, 556, 333, 333, 556, 1000, 1000, 552, 278, 278, 278, 278, 500, 500, 500, 556, 556, 350, 1000, 1000, 240, 479, 333, 333, 604, 333, 167, 396, 556, 556, 1094, 556, 885, 489, 1115, 1000, 768, 600, 834, 834, 834, 834, 1000, 500, 1000, 500, 1000, 500, 500, 494, 612, 823, 713, 584, 549, 713, 979, 722, 274, 549, 549, 583, 549, 549, 604, 584, 604, 604, 708, 625, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 729, 604, 604, 354, 354, 1000, 990, 990, 990, 990, 494, 604, 604, 604, 604, 354, 1021, 1052, 917, 750, 750, 531, 656, 594, 510, 500, 750, 750, 611, 611, 333, 333, 333, 333, 333, 333, 333, 333, 222, 222, 333, 333, 333, 333, 333, 333, 333, 333];
28620const LiberationSansBoldMapping = [-1, -1, -1, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 402, 506, 507, 508, 509, 510, 511, 536, 537, 538, 539, 710, 711, 713, 728, 729, 730, 731, 732, 733, 900, 901, 902, 903, 904, 905, 906, 908, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 1024, 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1138, 1139, 1168, 1169, 7808, 7809, 7810, 7811, 7812, 7813, 7922, 7923, 8208, 8209, 8211, 8212, 8213, 8215, 8216, 8217, 8218, 8219, 8220, 8221, 8222, 8224, 8225, 8226, 8230, 8240, 8242, 8243, 8249, 8250, 8252, 8254, 8260, 8319, 8355, 8356, 8359, 8364, 8453, 8467, 8470, 8482, 8486, 8494, 8539, 8540, 8541, 8542, 8592, 8593, 8594, 8595, 8596, 8597, 8616, 8706, 8710, 8719, 8721, 8722, 8730, 8734, 8735, 8745, 8747, 8776, 8800, 8801, 8804, 8805, 8962, 8976, 8992, 8993, 9472, 9474, 9484, 9488, 9492, 9496, 9500, 9508, 9516, 9524, 9532, 9552, 9553, 9554, 9555, 9556, 9557, 9558, 9559, 9560, 9561, 9562, 9563, 9564, 9565, 9566, 9567, 9568, 9569, 9570, 9571, 9572, 9573, 9574, 9575, 9576, 9577, 9578, 9579, 9580, 9600, 9604, 9608, 9612, 9616, 9617, 9618, 9619, 9632, 9633, 9642, 9643, 9644, 9650, 9658, 9660, 9668, 9674, 9675, 9679, 9688, 9689, 9702, 9786, 9787, 9788, 9792, 9794, 9824, 9827, 9829, 9830, 9834, 9835, 9836, 61441, 61442, 61445, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1];
28621const LiberationSansBoldItalicWidths = [365, 0, 333, 278, 333, 474, 556, 556, 889, 722, 238, 333, 333, 389, 584, 278, 333, 278, 278, 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 333, 333, 584, 584, 584, 611, 975, 722, 722, 722, 722, 667, 611, 778, 722, 278, 556, 722, 611, 833, 722, 778, 667, 778, 722, 667, 611, 722, 667, 944, 667, 667, 611, 333, 278, 333, 584, 556, 333, 556, 611, 556, 611, 556, 333, 611, 611, 278, 278, 556, 278, 889, 611, 611, 611, 611, 389, 556, 333, 611, 556, 778, 556, 556, 500, 389, 280, 389, 584, 333, 556, 556, 556, 556, 280, 556, 333, 737, 370, 556, 584, 737, 552, 400, 549, 333, 333, 333, 576, 556, 278, 333, 333, 365, 556, 834, 834, 834, 611, 722, 722, 722, 722, 722, 722, 1000, 722, 667, 667, 667, 667, 278, 278, 278, 278, 722, 722, 778, 778, 778, 778, 778, 584, 778, 722, 722, 722, 722, 667, 667, 611, 556, 556, 556, 556, 556, 556, 889, 556, 556, 556, 556, 556, 278, 278, 278, 278, 611, 611, 611, 611, 611, 611, 611, 549, 611, 611, 611, 611, 611, 556, 611, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 740, 722, 611, 667, 556, 667, 556, 667, 556, 667, 556, 667, 556, 778, 611, 778, 611, 778, 611, 778, 611, 722, 611, 722, 611, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 782, 556, 556, 278, 722, 556, 556, 611, 278, 611, 278, 611, 396, 611, 479, 611, 278, 722, 611, 722, 611, 722, 611, 708, 723, 611, 778, 611, 778, 611, 778, 611, 1000, 944, 722, 389, 722, 389, 722, 389, 667, 556, 667, 556, 667, 556, 667, 556, 611, 333, 611, 479, 611, 333, 722, 611, 722, 611, 722, 611, 722, 611, 722, 611, 722, 611, 944, 778, 667, 556, 667, 611, 500, 611, 500, 611, 500, 278, 556, 722, 556, 1000, 889, 778, 611, 667, 556, 611, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 722, 333, 854, 906, 473, 844, 930, 847, 278, 722, 722, 610, 671, 667, 611, 722, 778, 278, 722, 667, 833, 722, 657, 778, 718, 667, 590, 611, 667, 822, 667, 829, 781, 278, 667, 620, 479, 611, 278, 591, 620, 621, 556, 610, 479, 492, 611, 558, 278, 566, 556, 603, 556, 450, 611, 712, 605, 532, 664, 409, 591, 704, 578, 773, 834, 278, 591, 611, 591, 834, 667, 667, 886, 614, 719, 667, 278, 278, 556, 1094, 1042, 854, 622, 719, 677, 719, 722, 708, 722, 614, 722, 667, 927, 643, 719, 719, 615, 687, 833, 722, 778, 719, 667, 722, 611, 677, 781, 667, 729, 708, 979, 989, 854, 1000, 708, 719, 1042, 729, 556, 619, 604, 534, 618, 556, 736, 510, 611, 611, 507, 622, 740, 604, 611, 611, 611, 556, 889, 556, 885, 556, 646, 583, 889, 935, 707, 854, 594, 552, 865, 589, 556, 556, 611, 469, 563, 556, 278, 278, 278, 969, 906, 611, 507, 619, 556, 611, 778, 611, 575, 467, 944, 778, 944, 778, 944, 778, 667, 556, 333, 333, 556, 1000, 1000, 552, 278, 278, 278, 278, 500, 500, 500, 556, 556, 350, 1000, 1000, 240, 479, 333, 333, 604, 333, 167, 396, 556, 556, 1104, 556, 885, 516, 1146, 1000, 768, 600, 834, 834, 834, 834, 999, 500, 1000, 500, 1000, 500, 500, 494, 612, 823, 713, 584, 549, 713, 979, 722, 274, 549, 549, 583, 549, 549, 604, 584, 604, 604, 708, 625, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 729, 604, 604, 354, 354, 1000, 990, 990, 990, 990, 494, 604, 604, 604, 604, 354, 1021, 1052, 917, 750, 750, 531, 656, 594, 510, 500, 750, 750, 611, 611, 333, 333, 333, 333, 333, 333, 333, 333, 222, 222, 333, 333, 333, 333, 333, 333, 333, 333];
28622const LiberationSansBoldItalicMapping = [-1, -1, -1, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 402, 506, 507, 508, 509, 510, 511, 536, 537, 538, 539, 710, 711, 713, 728, 729, 730, 731, 732, 733, 900, 901, 902, 903, 904, 905, 906, 908, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 1024, 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1138, 1139, 1168, 1169, 7808, 7809, 7810, 7811, 7812, 7813, 7922, 7923, 8208, 8209, 8211, 8212, 8213, 8215, 8216, 8217, 8218, 8219, 8220, 8221, 8222, 8224, 8225, 8226, 8230, 8240, 8242, 8243, 8249, 8250, 8252, 8254, 8260, 8319, 8355, 8356, 8359, 8364, 8453, 8467, 8470, 8482, 8486, 8494, 8539, 8540, 8541, 8542, 8592, 8593, 8594, 8595, 8596, 8597, 8616, 8706, 8710, 8719, 8721, 8722, 8730, 8734, 8735, 8745, 8747, 8776, 8800, 8801, 8804, 8805, 8962, 8976, 8992, 8993, 9472, 9474, 9484, 9488, 9492, 9496, 9500, 9508, 9516, 9524, 9532, 9552, 9553, 9554, 9555, 9556, 9557, 9558, 9559, 9560, 9561, 9562, 9563, 9564, 9565, 9566, 9567, 9568, 9569, 9570, 9571, 9572, 9573, 9574, 9575, 9576, 9577, 9578, 9579, 9580, 9600, 9604, 9608, 9612, 9616, 9617, 9618, 9619, 9632, 9633, 9642, 9643, 9644, 9650, 9658, 9660, 9668, 9674, 9675, 9679, 9688, 9689, 9702, 9786, 9787, 9788, 9792, 9794, 9824, 9827, 9829, 9830, 9834, 9835, 9836, 61441, 61442, 61445, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1];
28623const LiberationSansItalicWidths = [365, 0, 333, 278, 278, 355, 556, 556, 889, 667, 191, 333, 333, 389, 584, 278, 333, 278, 278, 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 278, 278, 584, 584, 584, 556, 1015, 667, 667, 722, 722, 667, 611, 778, 722, 278, 500, 667, 556, 833, 722, 778, 667, 778, 722, 667, 611, 722, 667, 944, 667, 667, 611, 278, 278, 278, 469, 556, 333, 556, 556, 500, 556, 556, 278, 556, 556, 222, 222, 500, 222, 833, 556, 556, 556, 556, 333, 500, 278, 556, 500, 722, 500, 500, 500, 334, 260, 334, 584, 333, 556, 556, 556, 556, 260, 556, 333, 737, 370, 556, 584, 737, 552, 400, 549, 333, 333, 333, 576, 537, 278, 333, 333, 365, 556, 834, 834, 834, 611, 667, 667, 667, 667, 667, 667, 1000, 722, 667, 667, 667, 667, 278, 278, 278, 278, 722, 722, 778, 778, 778, 778, 778, 584, 778, 722, 722, 722, 722, 667, 667, 611, 556, 556, 556, 556, 556, 556, 889, 500, 556, 556, 556, 556, 278, 278, 278, 278, 556, 556, 556, 556, 556, 556, 556, 549, 611, 556, 556, 556, 556, 500, 556, 500, 667, 556, 667, 556, 667, 556, 722, 500, 722, 500, 722, 500, 722, 500, 722, 625, 722, 556, 667, 556, 667, 556, 667, 556, 667, 556, 667, 556, 778, 556, 778, 556, 778, 556, 778, 556, 722, 556, 722, 556, 278, 278, 278, 278, 278, 278, 278, 222, 278, 278, 733, 444, 500, 222, 667, 500, 500, 556, 222, 556, 222, 556, 281, 556, 400, 556, 222, 722, 556, 722, 556, 722, 556, 615, 723, 556, 778, 556, 778, 556, 778, 556, 1000, 944, 722, 333, 722, 333, 722, 333, 667, 500, 667, 500, 667, 500, 667, 500, 611, 278, 611, 354, 611, 278, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 944, 722, 667, 500, 667, 611, 500, 611, 500, 611, 500, 222, 556, 667, 556, 1000, 889, 778, 611, 667, 500, 611, 278, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 667, 278, 789, 846, 389, 794, 865, 775, 222, 667, 667, 570, 671, 667, 611, 722, 778, 278, 667, 667, 833, 722, 648, 778, 725, 667, 600, 611, 667, 837, 667, 831, 761, 278, 667, 570, 439, 555, 222, 550, 570, 571, 500, 556, 439, 463, 555, 542, 222, 500, 492, 548, 500, 447, 556, 670, 573, 486, 603, 374, 550, 652, 546, 728, 779, 222, 550, 556, 550, 779, 667, 667, 843, 544, 708, 667, 278, 278, 500, 1066, 982, 844, 589, 715, 639, 724, 667, 651, 667, 544, 704, 667, 917, 614, 715, 715, 589, 686, 833, 722, 778, 725, 667, 722, 611, 639, 795, 667, 727, 673, 920, 923, 805, 886, 651, 694, 1022, 682, 556, 562, 522, 493, 553, 556, 688, 465, 556, 556, 472, 564, 686, 550, 556, 556, 556, 500, 833, 500, 835, 500, 572, 518, 830, 851, 621, 736, 526, 492, 752, 534, 556, 556, 556, 378, 496, 500, 222, 222, 222, 910, 828, 556, 472, 565, 500, 556, 778, 556, 492, 339, 944, 722, 944, 722, 944, 722, 667, 500, 333, 333, 556, 1000, 1000, 552, 222, 222, 222, 222, 333, 333, 333, 556, 556, 350, 1000, 1000, 188, 354, 333, 333, 500, 333, 167, 365, 556, 556, 1094, 556, 885, 323, 1083, 1000, 768, 600, 834, 834, 834, 834, 1000, 500, 998, 500, 1000, 500, 500, 494, 612, 823, 713, 584, 549, 713, 979, 719, 274, 549, 549, 584, 549, 549, 604, 584, 604, 604, 708, 625, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 729, 604, 604, 354, 354, 1000, 990, 990, 990, 990, 494, 604, 604, 604, 604, 354, 1021, 1052, 917, 750, 750, 531, 656, 594, 510, 500, 750, 750, 500, 500, 333, 333, 333, 333, 333, 333, 333, 333, 222, 222, 294, 294, 324, 324, 316, 328, 398, 285];
28624const LiberationSansItalicMapping = [-1, -1, -1, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 402, 506, 507, 508, 509, 510, 511, 536, 537, 538, 539, 710, 711, 713, 728, 729, 730, 731, 732, 733, 900, 901, 902, 903, 904, 905, 906, 908, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 1024, 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1138, 1139, 1168, 1169, 7808, 7809, 7810, 7811, 7812, 7813, 7922, 7923, 8208, 8209, 8211, 8212, 8213, 8215, 8216, 8217, 8218, 8219, 8220, 8221, 8222, 8224, 8225, 8226, 8230, 8240, 8242, 8243, 8249, 8250, 8252, 8254, 8260, 8319, 8355, 8356, 8359, 8364, 8453, 8467, 8470, 8482, 8486, 8494, 8539, 8540, 8541, 8542, 8592, 8593, 8594, 8595, 8596, 8597, 8616, 8706, 8710, 8719, 8721, 8722, 8730, 8734, 8735, 8745, 8747, 8776, 8800, 8801, 8804, 8805, 8962, 8976, 8992, 8993, 9472, 9474, 9484, 9488, 9492, 9496, 9500, 9508, 9516, 9524, 9532, 9552, 9553, 9554, 9555, 9556, 9557, 9558, 9559, 9560, 9561, 9562, 9563, 9564, 9565, 9566, 9567, 9568, 9569, 9570, 9571, 9572, 9573, 9574, 9575, 9576, 9577, 9578, 9579, 9580, 9600, 9604, 9608, 9612, 9616, 9617, 9618, 9619, 9632, 9633, 9642, 9643, 9644, 9650, 9658, 9660, 9668, 9674, 9675, 9679, 9688, 9689, 9702, 9786, 9787, 9788, 9792, 9794, 9824, 9827, 9829, 9830, 9834, 9835, 9836, 61441, 61442, 61445, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1];
28625const LiberationSansRegularWidths = [365, 0, 333, 278, 278, 355, 556, 556, 889, 667, 191, 333, 333, 389, 584, 278, 333, 278, 278, 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 278, 278, 584, 584, 584, 556, 1015, 667, 667, 722, 722, 667, 611, 778, 722, 278, 500, 667, 556, 833, 722, 778, 667, 778, 722, 667, 611, 722, 667, 944, 667, 667, 611, 278, 278, 278, 469, 556, 333, 556, 556, 500, 556, 556, 278, 556, 556, 222, 222, 500, 222, 833, 556, 556, 556, 556, 333, 500, 278, 556, 500, 722, 500, 500, 500, 334, 260, 334, 584, 333, 556, 556, 556, 556, 260, 556, 333, 737, 370, 556, 584, 737, 552, 400, 549, 333, 333, 333, 576, 537, 278, 333, 333, 365, 556, 834, 834, 834, 611, 667, 667, 667, 667, 667, 667, 1000, 722, 667, 667, 667, 667, 278, 278, 278, 278, 722, 722, 778, 778, 778, 778, 778, 584, 778, 722, 722, 722, 722, 667, 667, 611, 556, 556, 556, 556, 556, 556, 889, 500, 556, 556, 556, 556, 278, 278, 278, 278, 556, 556, 556, 556, 556, 556, 556, 549, 611, 556, 556, 556, 556, 500, 556, 500, 667, 556, 667, 556, 667, 556, 722, 500, 722, 500, 722, 500, 722, 500, 722, 615, 722, 556, 667, 556, 667, 556, 667, 556, 667, 556, 667, 556, 778, 556, 778, 556, 778, 556, 778, 556, 722, 556, 722, 556, 278, 278, 278, 278, 278, 278, 278, 222, 278, 278, 735, 444, 500, 222, 667, 500, 500, 556, 222, 556, 222, 556, 292, 556, 334, 556, 222, 722, 556, 722, 556, 722, 556, 604, 723, 556, 778, 556, 778, 556, 778, 556, 1000, 944, 722, 333, 722, 333, 722, 333, 667, 500, 667, 500, 667, 500, 667, 500, 611, 278, 611, 375, 611, 278, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 944, 722, 667, 500, 667, 611, 500, 611, 500, 611, 500, 222, 556, 667, 556, 1000, 889, 778, 611, 667, 500, 611, 278, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 667, 278, 784, 838, 384, 774, 855, 752, 222, 667, 667, 551, 668, 667, 611, 722, 778, 278, 667, 668, 833, 722, 650, 778, 722, 667, 618, 611, 667, 798, 667, 835, 748, 278, 667, 578, 446, 556, 222, 547, 578, 575, 500, 557, 446, 441, 556, 556, 222, 500, 500, 576, 500, 448, 556, 690, 569, 482, 617, 395, 547, 648, 525, 713, 781, 222, 547, 556, 547, 781, 667, 667, 865, 542, 719, 667, 278, 278, 500, 1057, 1010, 854, 583, 722, 635, 719, 667, 656, 667, 542, 677, 667, 923, 604, 719, 719, 583, 656, 833, 722, 778, 719, 667, 722, 611, 635, 760, 667, 740, 667, 917, 938, 792, 885, 656, 719, 1010, 722, 556, 573, 531, 365, 583, 556, 669, 458, 559, 559, 438, 583, 688, 552, 556, 542, 556, 500, 458, 500, 823, 500, 573, 521, 802, 823, 625, 719, 521, 510, 750, 542, 556, 556, 556, 365, 510, 500, 222, 278, 222, 906, 812, 556, 438, 559, 500, 552, 778, 556, 489, 411, 944, 722, 944, 722, 944, 722, 667, 500, 333, 333, 556, 1000, 1000, 552, 222, 222, 222, 222, 333, 333, 333, 556, 556, 350, 1000, 1000, 188, 354, 333, 333, 500, 333, 167, 365, 556, 556, 1094, 556, 885, 323, 1073, 1000, 768, 600, 834, 834, 834, 834, 1000, 500, 1000, 500, 1000, 500, 500, 494, 612, 823, 713, 584, 549, 713, 979, 719, 274, 549, 549, 583, 549, 549, 604, 584, 604, 604, 708, 625, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 729, 604, 604, 354, 354, 1000, 990, 990, 990, 990, 494, 604, 604, 604, 604, 354, 1021, 1052, 917, 750, 750, 531, 656, 594, 510, 500, 750, 750, 500, 500, 333, 333, 333, 333, 333, 333, 333, 333, 222, 222, 294, 294, 324, 324, 316, 328, 398, 285];
28626const LiberationSansRegularMapping = [-1, -1, -1, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 402, 506, 507, 508, 509, 510, 511, 536, 537, 538, 539, 710, 711, 713, 728, 729, 730, 731, 732, 733, 900, 901, 902, 903, 904, 905, 906, 908, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 1024, 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1138, 1139, 1168, 1169, 7808, 7809, 7810, 7811, 7812, 7813, 7922, 7923, 8208, 8209, 8211, 8212, 8213, 8215, 8216, 8217, 8218, 8219, 8220, 8221, 8222, 8224, 8225, 8226, 8230, 8240, 8242, 8243, 8249, 8250, 8252, 8254, 8260, 8319, 8355, 8356, 8359, 8364, 8453, 8467, 8470, 8482, 8486, 8494, 8539, 8540, 8541, 8542, 8592, 8593, 8594, 8595, 8596, 8597, 8616, 8706, 8710, 8719, 8721, 8722, 8730, 8734, 8735, 8745, 8747, 8776, 8800, 8801, 8804, 8805, 8962, 8976, 8992, 8993, 9472, 9474, 9484, 9488, 9492, 9496, 9500, 9508, 9516, 9524, 9532, 9552, 9553, 9554, 9555, 9556, 9557, 9558, 9559, 9560, 9561, 9562, 9563, 9564, 9565, 9566, 9567, 9568, 9569, 9570, 9571, 9572, 9573, 9574, 9575, 9576, 9577, 9578, 9579, 9580, 9600, 9604, 9608, 9612, 9616, 9617, 9618, 9619, 9632, 9633, 9642, 9643, 9644, 9650, 9658, 9660, 9668, 9674, 9675, 9679, 9688, 9689, 9702, 9786, 9787, 9788, 9792, 9794, 9824, 9827, 9829, 9830, 9834, 9835, 9836, 61441, 61442, 61445, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1];
28627
28628;// ./src/core/myriadpro_factors.js
28629const MyriadProBoldFactors = [1.36898, 1, 1, 0.72706, 0.80479, 0.83734, 0.98894, 0.99793, 0.9897, 0.93884, 0.86209, 0.94292, 0.94292, 1.16661, 1.02058, 0.93582, 0.96694, 0.93582, 1.19137, 0.99793, 0.99793, 0.99793, 0.99793, 0.99793, 0.99793, 0.99793, 0.99793, 0.99793, 0.99793, 0.78076, 0.78076, 1.02058, 1.02058, 1.02058, 0.72851, 0.78966, 0.90838, 0.83637, 0.82391, 0.96376, 0.80061, 0.86275, 0.8768, 0.95407, 1.0258, 0.73901, 0.85022, 0.83655, 1.0156, 0.95546, 0.92179, 0.87107, 0.92179, 0.82114, 0.8096, 0.89713, 0.94438, 0.95353, 0.94083, 0.91905, 0.90406, 0.9446, 0.94292, 1.18777, 0.94292, 1.02058, 0.89903, 0.90088, 0.94938, 0.97898, 0.81093, 0.97571, 0.94938, 1.024, 0.9577, 0.95933, 0.98621, 1.0474, 0.97455, 0.98981, 0.9672, 0.95933, 0.9446, 0.97898, 0.97407, 0.97646, 0.78036, 1.10208, 0.95442, 0.95298, 0.97579, 0.9332, 0.94039, 0.938, 0.80687, 1.01149, 0.80687, 1.02058, 0.80479, 0.99793, 0.99793, 0.99793, 0.99793, 1.01149, 1.00872, 0.90088, 0.91882, 1.0213, 0.8361, 1.02058, 0.62295, 0.54324, 0.89022, 1.08595, 1, 1, 0.90088, 1, 0.97455, 0.93582, 0.90088, 1, 1.05686, 0.8361, 0.99642, 0.99642, 0.99642, 0.72851, 0.90838, 0.90838, 0.90838, 0.90838, 0.90838, 0.90838, 0.868, 0.82391, 0.80061, 0.80061, 0.80061, 0.80061, 1.0258, 1.0258, 1.0258, 1.0258, 0.97484, 0.95546, 0.92179, 0.92179, 0.92179, 0.92179, 0.92179, 1.02058, 0.92179, 0.94438, 0.94438, 0.94438, 0.94438, 0.90406, 0.86958, 0.98225, 0.94938, 0.94938, 0.94938, 0.94938, 0.94938, 0.94938, 0.9031, 0.81093, 0.94938, 0.94938, 0.94938, 0.94938, 0.98621, 0.98621, 0.98621, 0.98621, 0.93969, 0.95933, 0.9446, 0.9446, 0.9446, 0.9446, 0.9446, 1.08595, 0.9446, 0.95442, 0.95442, 0.95442, 0.95442, 0.94039, 0.97898, 0.94039, 0.90838, 0.94938, 0.90838, 0.94938, 0.90838, 0.94938, 0.82391, 0.81093, 0.82391, 0.81093, 0.82391, 0.81093, 0.82391, 0.81093, 0.96376, 0.84313, 0.97484, 0.97571, 0.80061, 0.94938, 0.80061, 0.94938, 0.80061, 0.94938, 0.80061, 0.94938, 0.80061, 0.94938, 0.8768, 0.9577, 0.8768, 0.9577, 0.8768, 0.9577, 1, 1, 0.95407, 0.95933, 0.97069, 0.95933, 1.0258, 0.98621, 1.0258, 0.98621, 1.0258, 0.98621, 1.0258, 0.98621, 1.0258, 0.98621, 0.887, 1.01591, 0.73901, 1.0474, 1, 1, 0.97455, 0.83655, 0.98981, 1, 1, 0.83655, 0.73977, 0.83655, 0.73903, 0.84638, 1.033, 0.95546, 0.95933, 1, 1, 0.95546, 0.95933, 0.8271, 0.95417, 0.95933, 0.92179, 0.9446, 0.92179, 0.9446, 0.92179, 0.9446, 0.936, 0.91964, 0.82114, 0.97646, 1, 1, 0.82114, 0.97646, 0.8096, 0.78036, 0.8096, 0.78036, 1, 1, 0.8096, 0.78036, 1, 1, 0.89713, 0.77452, 0.89713, 1.10208, 0.94438, 0.95442, 0.94438, 0.95442, 0.94438, 0.95442, 0.94438, 0.95442, 0.94438, 0.95442, 0.94438, 0.95442, 0.94083, 0.97579, 0.90406, 0.94039, 0.90406, 0.9446, 0.938, 0.9446, 0.938, 0.9446, 0.938, 1, 0.99793, 0.90838, 0.94938, 0.868, 0.9031, 0.92179, 0.9446, 1, 1, 0.89713, 1.10208, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90989, 0.9358, 0.91945, 0.83181, 0.75261, 0.87992, 0.82976, 0.96034, 0.83689, 0.97268, 1.0078, 0.90838, 0.83637, 0.8019, 0.90157, 0.80061, 0.9446, 0.95407, 0.92436, 1.0258, 0.85022, 0.97153, 1.0156, 0.95546, 0.89192, 0.92179, 0.92361, 0.87107, 0.96318, 0.89713, 0.93704, 0.95638, 0.91905, 0.91709, 0.92796, 1.0258, 0.93704, 0.94836, 1.0373, 0.95933, 1.0078, 0.95871, 0.94836, 0.96174, 0.92601, 0.9498, 0.98607, 0.95776, 0.95933, 1.05453, 1.0078, 0.98275, 0.9314, 0.95617, 0.91701, 1.05993, 0.9446, 0.78367, 0.9553, 1, 0.86832, 1.0128, 0.95871, 0.99394, 0.87548, 0.96361, 0.86774, 1.0078, 0.95871, 0.9446, 0.95871, 0.86774, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.94083, 0.97579, 0.94083, 0.97579, 0.94083, 0.97579, 0.90406, 0.94039, 0.96694, 1, 0.89903, 1, 1, 1, 0.93582, 0.93582, 0.93582, 1, 0.908, 0.908, 0.918, 0.94219, 0.94219, 0.96544, 1, 1.285, 1, 1, 0.81079, 0.81079, 1, 1, 0.74854, 1, 1, 1, 1, 0.99793, 1, 1, 1, 0.65, 1, 1.36145, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.17173, 1, 0.80535, 0.76169, 1.02058, 1.0732, 1.05486, 1, 1, 1.30692, 1.08595, 1.08595, 1, 1.08595, 1.08595, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.16161, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
28630const MyriadProBoldMetrics = {
28631  lineHeight: 1.2,
28632  lineGap: 0.2
28633};
28634const MyriadProBoldItalicFactors = [1.36898, 1, 1, 0.66227, 0.80779, 0.81625, 0.97276, 0.97276, 0.97733, 0.92222, 0.83266, 0.94292, 0.94292, 1.16148, 1.02058, 0.93582, 0.96694, 0.93582, 1.17337, 0.97276, 0.97276, 0.97276, 0.97276, 0.97276, 0.97276, 0.97276, 0.97276, 0.97276, 0.97276, 0.78076, 0.78076, 1.02058, 1.02058, 1.02058, 0.71541, 0.76813, 0.85576, 0.80591, 0.80729, 0.94299, 0.77512, 0.83655, 0.86523, 0.92222, 0.9862
vendor: 1,447 bytes, line 28634
286341, 0.71743, 0.81698, 0.79726, 0.98558, 0.92222, 0.90637, 0.83809, 0.90637, 0.80729, 0.76463, 0.86275, 0.90699, 0.91605, 0.9154, 0.85308, 0.85458, 0.90531, 0.94292, 1.21296, 0.94292, 1.02058, 0.89903, 1.18616, 0.99613, 0.91677, 0.78216, 0.91677, 0.90083, 0.98796, 0.9135, 0.92168, 0.95381, 0.98981, 0.95298, 0.95381, 0.93459, 0.92168, 0.91513, 0.92004, 0.91677, 0.95077, 0.748, 1.04502, 0.91677, 0.92061, 0.94236, 0.89544, 0.89364, 0.9, 0.80687, 0.8578, 0.80687, 1.02058, 0.80779, 0.97276, 0.97276, 0.97276, 0.97276, 0.8578, 0.99973, 1.18616, 0.91339, 1.08074, 0.82891, 1.02058, 0.55509, 0.71526, 0.89022, 1.08595, 1, 1, 1.18616, 1, 0.96736, 0.93582, 1.18616, 1, 1.04864, 0.82711, 0.99043, 0.99043, 0.99043, 0.71541, 0.85576, 0.85576, 0.85576, 0.85576, 0.85576, 0.85576, 0.845, 0.80729, 0.77512, 0.77512, 0.77512, 0.77512, 0.98621, 0.98621, 0.98621, 0.98621, 0.95961, 0.92222, 0.90637, 0.90637, 0.90637, 0.90637, 0.90637, 1.02058, 0.90251, 0.90699, 0.90699, 0.90699, 0.90699, 0.85458, 0.83659, 0.94951, 0.99613, 0.99613, 0.99613, 0.99613, 0.99613, 0.99613, 0.85811, 0.78216, 0.90083, 0.90083, 0.90083, 0.90083, 0.95381, 0.95381, 0.95381, 0.95381, 0.9135, 0.92168, 0.91513, 0.91513, 0.91513, 0.91513, 0.91513, 1.08595, 0.91677, 0.91677, 0.91677, 0.91677, 0.91677, 0.89364, 0.92332, 0.89364, 0.85576, 0.99613, 0.85576, 0.99613, 0.85576, 0.99613, 0.80729, 0.78216, 0.80729, 0.78216, 0.80729, 0.78216, 0.80729, 0.78216, 0.94299, 0.76783, 0.95961, 0.916
vendor: 39,631 bytes, lines 28634-28954
2863477, 0.77512, 0.90083, 0.77512, 0.90083, 0.77512, 0.90083, 0.77512, 0.90083, 0.77512, 0.90083, 0.86523, 0.9135, 0.86523, 0.9135, 0.86523, 0.9135, 1, 1, 0.92222, 0.92168, 0.92222, 0.92168, 0.98621, 0.95381, 0.98621, 0.95381, 0.98621, 0.95381, 0.98621, 0.95381, 0.98621, 0.95381, 0.86036, 0.97096, 0.71743, 0.98981, 1, 1, 0.95298, 0.79726, 0.95381, 1, 1, 0.79726, 0.6894, 0.79726, 0.74321, 0.81691, 1.0006, 0.92222, 0.92168, 1, 1, 0.92222, 0.92168, 0.79464, 0.92098, 0.92168, 0.90637, 0.91513, 0.90637, 0.91513, 0.90637, 0.91513, 0.909, 0.87514, 0.80729, 0.95077, 1, 1, 0.80729, 0.95077, 0.76463, 0.748, 0.76463, 0.748, 1, 1, 0.76463, 0.748, 1, 1, 0.86275, 0.72651, 0.86275, 1.04502, 0.90699, 0.91677, 0.90699, 0.91677, 0.90699, 0.91677, 0.90699, 0.91677, 0.90699, 0.91677, 0.90699, 0.91677, 0.9154, 0.94236, 0.85458, 0.89364, 0.85458, 0.90531, 0.9, 0.90531, 0.9, 0.90531, 0.9, 1, 0.97276, 0.85576, 0.99613, 0.845, 0.85811, 0.90251, 0.91677, 1, 1, 0.86275, 1.04502, 1.18616, 1.18616, 1.18616, 1.18616, 1.18616, 1.18616, 1.18616, 1.18616, 1.18616, 1.00899, 1.30628, 0.85576, 0.80178, 0.66862, 0.7927, 0.69323, 0.88127, 0.72459, 0.89711, 0.95381, 0.85576, 0.80591, 0.7805, 0.94729, 0.77512, 0.90531, 0.92222, 0.90637, 0.98621, 0.81698, 0.92655, 0.98558, 0.92222, 0.85359, 0.90637, 0.90976, 0.83809, 0.94523, 0.86275, 0.83509, 0.93157, 0.85308, 0.83392, 0.92346, 0.98621, 0.83509, 0.92886, 0.91324, 0.92168, 0.95381, 0.90646, 0.92886, 0.90557, 0.86847, 0.90276, 0.91324, 0.86842, 0.92168, 0.99531, 0.95381, 0.9224, 0.85408, 0.92699, 0.86847, 1.0051, 0.91513, 0.80487, 0.93481, 1, 0.88159, 1.05214, 0.90646, 0.97355, 0.81539, 0.89398, 0.85923, 0.95381, 0.90646, 0.91513, 0.90646, 0.85923, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.9154, 0.94236, 0.9154, 0.94236, 0.9154, 0.94236, 0.85458, 0.89364, 0.96694, 1, 0.89903, 1, 1, 1, 0.91782, 0.91782, 0.91782, 1, 0.896, 0.896, 0.896, 0.9332, 0.9332, 0.95973, 1, 1.26, 1, 1, 0.80479, 0.80178, 1, 1, 0.85633, 1, 1, 1, 1, 0.97276, 1, 1, 1, 0.698, 1, 1.36145, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.14542, 1, 0.79199, 0.78694, 1.02058, 1.03493, 1.05486, 1, 1, 1.23026, 1.08595, 1.08595, 1, 1.08595, 1.08595, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.20006, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
28635const MyriadProBoldItalicMetrics = {
28636  lineHeight: 1.2,
28637  lineGap: 0.2
28638};
28639const MyriadProItalicFactors = [1.36898, 1, 1, 0.65507, 0.84943, 0.85639, 0.88465, 0.88465, 0.86936, 0.88307, 0.86948, 0.85283, 0.85283, 1.06383, 1.02058, 0.75945, 0.9219, 0.75945, 1.17337, 0.88465, 0.88465, 0.88465, 0.88465, 0.88465, 0.88465, 0.88465, 0.88465, 0.88465, 0.88465, 0.75945, 0.75945, 1.02058, 1.02058, 1.02058, 0.69046, 0.70926, 0.85158, 0.77812, 0.76852, 0.89591, 0.70466, 0.76125, 0.80094, 0.86822, 0.83864, 0.728, 0.77212, 0.79475, 0.93637, 0.87514, 0.8588, 0.76013, 0.8588, 0.72421, 0.69866, 0.77598, 0.85991, 0.80811, 0.87832, 0.78112, 0.77512, 0.8562, 1.0222, 1.18417, 1.0222, 1.27014, 0.89903, 1.15012, 0.93859, 0.94399, 0.846, 0.94399, 0.81453, 1.0186, 0.94219, 0.96017, 1.03075, 1.02175, 0.912, 1.03075, 0.96998, 0.96017, 0.93859, 0.94399, 0.94399, 0.95493, 0.746, 1.12658, 0.94578, 0.91, 0.979, 0.882, 0.882, 0.83, 0.85034, 0.83537, 0.85034, 1.02058, 0.70869, 0.88465, 0.88465, 0.88465, 0.88465, 0.83537, 0.90083, 1.15012, 0.9161, 0.94565, 0.73541, 1.02058, 0.53609, 0.69353, 0.79519, 1.08595, 1, 1, 1.15012, 1, 0.91974, 0.75945, 1.15012, 1, 0.9446, 0.73361, 0.9005, 0.9005, 0.9005, 0.62864, 0.85158, 0.85158, 0.85158, 0.85158, 0.85158, 0.85158, 0.773, 0.76852, 0.70466, 0.70466, 0.70466, 0.70466, 0.83864, 0.83864, 0.83864, 0.83864, 0.90561, 0.87514, 0.8588, 0.8588, 0.8588, 0.8588, 0.8588, 1.02058, 0.85751, 0.85991, 0.85991, 0.85991, 0.85991, 0.77512, 0.76013, 0.88075, 0.93859, 0.93859, 0.93859, 0.93859, 0.93859, 0.93859, 0.8075, 0.846, 0.81453, 0.81453, 0.81453, 0.81453, 0.82424, 0.82424, 0.82424, 0.82424, 0.9278, 0.96017, 0.93859, 0.93859, 0.93859, 0.93859, 0.93859, 1.08595, 0.8562, 0.94578, 0.94578, 0.94578, 0.94578, 0.882, 0.94578, 0.882, 0.85158, 0.93859, 0.85158, 0.93859, 0.85158, 0.93859, 0.76852, 0.846, 0.76852, 0.846, 0.76852, 0.846, 0.76852, 0.846, 0.89591, 0.8544, 0.90561, 0.94399, 0.70466, 0.81453, 0.70466, 0.81453, 0.70466, 0.81453, 0.70466, 0.81453, 0.70466, 0.81453, 0.80094, 0.94219, 0.80094, 0.94219, 0.80094, 0.94219, 1, 1, 0.86822, 0.96017, 0.86822, 0.96017, 0.83864, 0.82424, 0.83864, 0.82424, 0.83864, 0.82424, 0.83864, 1.03075, 0.83864, 0.82424, 0.81402, 1.02738, 0.728, 1.02175, 1, 1, 0.912, 0.79475, 1.03075, 1, 1, 0.79475, 0.83911, 0.79475, 0.66266, 0.80553, 1.06676, 0.87514, 0.96017, 1, 1, 0.87514, 0.96017, 0.86865, 0.87396, 0.96017, 0.8588, 0.93859, 0.8588, 0.93859, 0.8588, 0.93859, 0.867, 0.84759, 0.72421, 0.95493, 1, 1, 0.72421, 0.95493, 0.69866, 0.746, 0.69866, 0.746, 1, 1, 0.69866, 0.746, 1, 1, 0.77598, 0.88417, 0.77598, 1.12658, 0.85991, 0.94578, 0.85991, 0.94578, 0.85991, 0.94578, 0.85991, 0.94578, 0.85991, 0.94578, 0.85991, 0.94578, 0.87832, 0.979, 0.77512, 0.882, 0.77512, 0.8562, 0.83, 0.8562, 0.83, 0.8562, 0.83, 1, 0.88465, 0.85158, 0.93859, 0.773, 0.8075, 0.85751, 0.8562, 1, 1, 0.77598, 1.12658, 1.15012, 1.15012, 1.15012, 1.15012, 1.15012, 1.15313, 1.15012, 1.15012, 1.15012, 1.08106, 1.03901, 0.85158, 0.77025, 0.62264, 0.7646, 0.65351, 0.86026, 0.69461, 0.89947, 1.03075, 0.85158, 0.77812, 0.76449, 0.88836, 0.70466, 0.8562, 0.86822, 0.8588, 0.83864, 0.77212, 0.85308, 0.93637, 0.87514, 0.82352, 0.8588, 0.85701, 0.76013, 0.89058, 0.77598, 0.8156, 0.82565, 0.78112, 0.77899, 0.89386, 0.83864, 0.8156, 0.9486, 0.92388, 0.96186, 1.03075, 0.91123, 0.9486, 0.93298, 0.878, 0.93942, 0.92388, 0.84596, 0.96186, 0.95119, 1.03075, 0.922, 0.88787, 0.95829, 0.88, 0.93559, 0.93859, 0.78815, 0.93758, 1, 0.89217, 1.03737, 0.91123, 0.93969, 0.77487, 0.85769, 0.86799, 1.03075, 0.91123, 0.93859, 0.91123, 0.86799, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.87832, 0.979, 0.87832, 0.979, 0.87832, 0.979, 0.77512, 0.882, 0.9219, 1, 0.89903, 1, 1, 1, 0.87321, 0.87321, 0.87321, 1, 1.027, 1.027, 1.027, 0.86847, 0.86847, 0.79121, 1, 1.124, 1, 1, 0.73572, 0.73572, 1, 1, 0.85034, 1, 1, 1, 1, 0.88465, 1, 1, 1, 0.669, 1, 1.36145, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.04828, 1, 0.74948, 0.75187, 1.02058, 0.98391, 1.02119, 1, 1, 1.06233, 1.08595, 1.08595, 1, 1.08595, 1.08595, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.05233, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
28640const MyriadProItalicMetrics = {
28641  lineHeight: 1.2,
28642  lineGap: 0.2
28643};
28644const MyriadProRegularFactors = [1.36898, 1, 1, 0.76305, 0.82784, 0.94935, 0.89364, 0.92241, 0.89073, 0.90706, 0.98472, 0.85283, 0.85283, 1.0664, 1.02058, 0.74505, 0.9219, 0.74505, 1.23456, 0.92241, 0.92241, 0.92241, 0.92241, 0.92241, 0.92241, 0.92241, 0.92241, 0.92241, 0.92241, 0.74505, 0.74505, 1.02058, 1.02058, 1.02058, 0.73002, 0.72601, 0.91755, 0.8126, 0.80314, 0.92222, 0.73764, 0.79726, 0.83051, 0.90284, 0.86023, 0.74, 0.8126, 0.84869, 0.96518, 0.91115, 0.8858, 0.79761, 0.8858, 0.74498, 0.73914, 0.81363, 0.89591, 0.83659, 0.89633, 0.85608, 0.8111, 0.90531, 1.0222, 1.22736, 1.0222, 1.27014, 0.89903, 0.90088, 0.86667, 1.0231, 0.896, 1.01411, 0.90083, 1.05099, 1.00512, 0.99793, 1.05326, 1.09377, 0.938, 1.06226, 1.00119, 0.99793, 0.98714, 1.0231, 1.01231, 0.98196, 0.792, 1.19137, 0.99074, 0.962, 1.01915, 0.926, 0.942, 0.856, 0.85034, 0.92006, 0.85034, 1.02058, 0.69067, 0.92241, 0.92241, 0.92241, 0.92241, 0.92006, 0.9332, 0.90088, 0.91882, 0.93484, 0.75339, 1.02058, 0.56866, 0.54324, 0.79519, 1.08595, 1, 1, 0.90088, 1, 0.95325, 0.74505, 0.90088, 1, 0.97198, 0.75339, 0.91009, 0.91009, 0.91009, 0.66466, 0.91755, 0.91755, 0.91755, 0.91755, 0.91755, 0.91755, 0.788, 0.80314, 0.73764, 0.73764, 0.73764, 0.73764, 0.86023, 0.86023, 0.86023, 0.86023, 0.92915, 0.91115, 0.8858, 0.8858, 0.8858, 0.8858, 0.8858, 1.02058, 0.8858, 0.89591, 0.89591, 0.89591, 0.89591, 0.8111, 0.79611, 0.89713, 0.86667, 0.86667, 0.86667, 0.86667, 0.86667, 0.86667, 0.86936, 0.896, 0.90083, 0.90083, 0.90083, 0.90083, 0.84224, 0.84224, 0.84224, 0.84224, 0.97276, 0.99793, 0.98714, 0.98714, 0.98714, 0.98714, 0.98714, 1.08595, 0.89876, 0.99074, 0.99074, 0.99074, 0.99074, 0.942, 1.0231, 0.942, 0.91755, 0.86667, 0.91755, 0.86667, 0.91755, 0.86667, 0.80314, 0.896, 0.80314, 0.896, 0.80314, 0.896, 0.80314, 0.896, 0.92222, 0.93372, 0.92915, 1.01411, 0.73764, 0.90083, 0.73764, 0.90083, 0.73764, 0.90083, 0.73764, 0.90083, 0.73764, 0.90083, 0.83051, 1.00512, 0.83051, 1.00512, 0.83051, 1.00512, 1, 1, 0.90284, 0.99793, 0.90976, 0.99793, 0.86023, 0.84224, 0.86023, 0.84224, 0.86023, 0.84224, 0.86023, 1.05326, 0.86023, 0.84224, 0.82873, 1.07469, 0.74, 1.09377, 1, 1, 0.938, 0.84869, 1.06226, 1, 1, 0.84869, 0.83704, 0.84869, 0.81441, 0.85588, 1.08927, 0.91115, 0.99793, 1, 1, 0.91115, 0.99793, 0.91887, 0.90991, 0.99793, 0.8858, 0.98714, 0.8858, 0.98714, 0.8858, 0.98714, 0.894, 0.91434, 0.74498, 0.98196, 1, 1, 0.74498, 0.98196, 0.73914, 0.792, 0.73914, 0.792, 1, 1, 0.73914, 0.792, 1, 1, 0.81363, 0.904, 0.81363, 1.19137, 0.89591, 0.99074, 0.89591, 0.99074, 0.89591, 0.99074, 0.89591, 0.99074, 0.89591, 0.99074, 0.89591, 0.99074, 0.89633, 1.01915, 0.8111, 0.942, 0.8111, 0.90531, 0.856, 0.90531, 0.856, 0.90531, 0.856, 1, 0.92241, 0.91755, 0.86667, 0.788, 0.86936, 0.8858, 0.89876, 1, 1, 0.81363, 1.19137, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90388, 1.03901, 0.92138, 0.78105, 0.7154, 0.86169, 0.80513, 0.94007, 0.82528, 0.98612, 1.06226, 0.91755, 0.8126, 0.81884, 0.92819, 0.73764, 0.90531, 0.90284, 0.8858, 0.86023, 0.8126, 0.91172, 0.96518, 0.91115, 0.83089, 0.8858, 0.87791, 0.79761, 0.89297, 0.81363, 0.88157, 0.89992, 0.85608, 0.81992, 0.94307, 0.86023, 0.88157, 0.95308, 0.98699, 0.99793, 1.06226, 0.95817, 0.95308, 0.97358, 0.928, 0.98088, 0.98699, 0.92761, 0.99793, 0.96017, 1.06226, 0.986, 0.944, 0.95978, 0.938, 0.96705, 0.98714, 0.80442, 0.98972, 1, 0.89762, 1.04552, 0.95817, 0.99007, 0.87064, 0.91879, 0.88888, 1.06226, 0.95817, 0.98714, 0.95817, 0.88888, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.89633, 1.01915, 0.89633, 1.01915, 0.89633, 1.01915, 0.8111, 0.942, 0.9219, 1, 0.89903, 1, 1, 1, 0.93173, 0.93173, 0.93173, 1, 1.06304, 1.06304, 1.06904, 0.89903, 0.89903, 0.80549, 1, 1.156, 1, 1, 0.76575, 0.76575, 1, 1, 0.72458, 1, 1, 1, 1, 0.92241, 1, 1, 1, 0.619, 1, 1.36145, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.07257, 1, 0.74705, 0.71119, 1.02058, 1.024, 1.02119, 1, 1, 1.1536, 1.08595, 1.08595, 1, 1.08595, 1.08595, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.05638, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
28645const MyriadProRegularMetrics = {
28646  lineHeight: 1.2,
28647  lineGap: 0.2
28648};
28649
28650;// ./src/core/segoeui_factors.js
28651const SegoeuiBoldFactors = [1.76738, 1, 1, 0.99297, 0.9824, 1.04016, 1.06497, 1.03424, 0.97529, 1.17647, 1.23203, 1.1085, 1.1085, 1.16939, 1.2107, 0.9754, 1.21408, 0.9754, 1.59578, 1.03424, 1.03424, 1.03424, 1.03424, 1.03424, 1.03424, 1.03424, 1.03424, 1.03424, 1.03424, 0.81378, 0.81378, 1.2107, 1.2107, 1.2107, 0.71703, 0.97847, 0.97363, 0.88776, 0.8641, 1.02096, 0.79795, 0.85132, 0.914, 1.06085, 1.1406, 0.8007, 0.89858, 0.83693, 1.14889, 1.09398, 0.97489, 0.92094, 0.97489, 0.90399, 0.84041, 0.95923, 1.00135, 1, 1.06467, 0.98243, 0.90996, 0.99361, 1.1085, 1.56942, 1.1085, 1.2107, 0.74627, 0.94282, 0.96752, 1.01519, 0.86304, 1.01359, 0.97278, 1.15103, 1.01359, 0.98561, 1.02285, 1.02285, 1.00527, 1.02285, 1.0302, 0.99041, 1.0008, 1.01519, 1.01359, 1.02258, 0.79104, 1.16862, 0.99041, 0.97454, 1.02511, 0.99298, 0.96752, 0.95801, 0.94856, 1.16579, 0.94856, 1.2107, 0.9824, 1.03424, 1.03424, 1, 1.03424, 1.16579, 0.8727, 1.3871, 1.18622, 1.10818, 1.04478, 1.2107, 1.18622, 0.75155, 0.94994, 1.28826, 1.21408, 1.21408, 0.91056, 1, 0.91572, 0.9754, 0.64663, 1.18328, 1.24866, 1.04478, 1.14169, 1.15749, 1.17389, 0.71703, 0.97363, 0.97363, 0.97363, 0.97363, 0.97363, 0.97363, 0.93506, 0.8641, 0.79795, 0.79795, 0.79795, 0.79795, 1.1406, 1.1406, 1.1406, 1.1406, 1.02096, 1.09398, 0.97426, 0.97426, 0.97426, 0.97426, 0.97426, 1.2107, 0.97489, 1.00135, 1.00135, 1.00135, 1.00135, 0.90996, 0.92094, 1.02798, 0.96752, 0.96752, 0.96752, 0.96752, 0.96752, 0.96752, 0.93136, 0.86304, 0.97278, 0.97278, 0.97278, 0.97278, 1.02285, 1.02285, 1.02285, 1.02285, 0.97122, 0.99041, 1, 1, 1, 1, 1, 1.28826, 1.0008, 0.99041, 0.99041, 0.99041, 0.99041, 0.96752, 1.01519, 0.96752, 0.97363, 0.96752, 0.97363, 0.96752, 0.97363, 0.96752, 0.8641, 0.86304, 0.8641, 0.86304, 0.8641, 0.86304, 0.8641, 0.86304, 1.02096, 1.03057, 1.02096, 1.03517, 0.79795, 0.97278, 0.79795, 0.97278, 0.79795, 0.97278, 0.79795, 0.97278, 0.79795, 0.97278, 0.914, 1.01359, 0.914, 1.01359, 0.914, 1.01359, 1, 1, 1.06085, 0.98561, 1.06085, 1.00879, 1.1406, 1.02285, 1.1406, 1.02285, 1.1406, 1.02285, 1.1406, 1.02285, 1.1406, 1.02285, 0.97138, 1.08692, 0.8007, 1.02285, 1, 1, 1.00527, 0.83693, 1.02285, 1, 1, 0.83693, 0.9455, 0.83693, 0.90418, 0.83693, 1.13005, 1.09398, 0.99041, 1, 1, 1.09398, 0.99041, 0.96692, 1.09251, 0.99041, 0.97489, 1.0008, 0.97489, 1.0008, 0.97489, 1.0008, 0.93994, 0.97931, 0.90399, 1.02258, 1, 1, 0.90399, 1.02258, 0.84041, 0.79104, 0.84041, 0.79104, 0.84041, 0.79104, 0.84041, 0.79104, 1, 1, 0.95923, 1.07034, 0.95923, 1.16862, 1.00135, 0.99041, 1.00135, 0.99041, 1.00135, 0.99041, 1.00135, 0.99041, 1.00135, 0.99041, 1.00135, 0.99041, 1.06467, 1.02511, 0.90996, 0.96752, 0.90996, 0.99361, 0.95801, 0.99361, 0.95801, 0.99361, 0.95801, 1.07733, 1.03424, 0.97363, 0.96752, 0.93506, 0.93136, 0.97489, 1.0008, 1, 1, 0.95923, 1.16862, 1.15103, 1.15103, 1.01173, 1.03959, 0.75953, 0.81378, 0.79912, 1.15103, 1.21994, 0.95161, 0.87815, 1.01149, 0.81525, 0.7676, 0.98167, 1.01134, 1.02546, 0.84097, 1.03089, 1.18102, 0.97363, 0.88776, 0.85134, 0.97826, 0.79795, 0.99361, 1.06085, 0.97489, 1.1406, 0.89858, 1.0388, 1.14889, 1.09398, 0.86039, 0.97489, 1.0595, 0.92094, 0.94793, 0.95923, 0.90996, 0.99346, 0.98243, 1.02112, 0.95493, 1.1406, 0.90996, 1.03574, 1.02597, 1.0008, 1.18102, 1.06628, 1.03574, 1.0192, 1.01932, 1.00886, 0.97531, 1.0106, 1.0008, 1.13189, 1.18102, 1.02277, 0.98683, 1.0016, 0.99561, 1.07237, 1.0008, 0.90434, 0.99921, 0.93803, 0.8965, 1.23085, 1.06628, 1.04983, 0.96268, 1.0499, 0.98439, 1.18102, 1.06628, 1.0008, 1.06628, 0.98439, 0.79795, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.09466, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.97278, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.02065, 1, 1, 1, 1, 1, 1, 1.06467, 1.02511, 1.06467, 1.02511, 1.06467, 1.02511, 0.90996, 0.96752, 1, 1.21408, 0.89903, 1, 1, 0.75155, 1.04394, 1.04394, 1.04394, 1.04394, 0.98633, 0.98633, 0.98633, 0.73047, 0.73047, 1.20642, 0.91211, 1.25635, 1.222, 1.02956, 1.03372, 1.03372, 0.96039, 1.24633, 1, 1.12454, 0.93503, 1.03424, 1.19687, 1.03424, 1, 1, 1, 0.771, 1, 1, 1.15749, 1.15749, 1.15749, 1.10948, 0.86279, 0.94434, 0.86279, 0.94434, 0.86182, 1, 1, 1.16897, 1, 0.96085, 0.90137, 1.2107, 1.18416, 1.13973, 0.69825, 0.9716, 2.10339, 1.29004, 1.29004, 1.21172, 1.29004, 1.29004, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.42603, 1, 0.99862, 0.99862, 1, 0.87025, 0.87025, 0.87025, 0.87025, 1.18874, 1.42603, 1, 1.42603, 1.42603, 0.99862, 1, 1, 1, 1, 1, 1.2886, 1.04315, 1.15296, 1.34163, 1, 1, 1, 1.09193, 1.09193, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
28652const SegoeuiBoldMetrics = {
28653  lineHeight: 1.33008,
28654  lineGap: 0
28655};
28656const SegoeuiBoldItalicFactors = [1.76738, 1, 1, 0.98946, 1.03959, 1.04016, 1.02809, 1.036, 0.97639, 1.10953, 1.23203, 1.11144, 1.11144, 1.16939, 1.21237, 0.9754, 1.21261, 0.9754, 1.59754, 1.036, 1.036, 1.036, 1.036, 1.036, 1.036, 1.036, 1.036, 1.036, 1.036, 0.81378, 0.81378, 1.21237, 1.21237, 1.21237, 0.73541, 0.97847, 0.97363, 0.89723, 0.87897, 1.0426, 0.79429, 0.85292, 0.91149, 1.05815, 1.1406, 0.79631, 0.90128, 0.83853, 1.04396, 1.10615, 0.97552, 0.94436, 0.97552, 0.88641, 0.80527, 0.96083, 1.00135, 1, 1.06777, 0.9817, 0.91142, 0.99361, 1.11144, 1.57293, 1.11144, 1.21237, 0.74627, 1.31818, 1.06585, 0.97042, 0.83055, 0.97042, 0.93503, 1.1261, 0.97042, 0.97922, 1.14236, 0.94552, 1.01054, 1.14236, 1.02471, 0.97922, 0.94165, 0.97042, 0.97042, 1.0276, 0.78929, 1.1261, 0.97922, 0.95874, 1.02197, 0.98507, 0.96752, 0.97168, 0.95107, 1.16579, 0.95107, 1.21237, 1.03959, 1.036, 1.036, 1, 1.036, 1.16579, 0.87357, 1.31818, 1.18754, 1.26781, 1.05356, 1.21237, 1.18622, 0.79487, 0.94994, 1.29004, 1.24047, 1.24047, 1.31818, 1, 0.91484, 0.9754, 1.31818, 1.1349, 1.24866, 1.05356, 1.13934, 1.15574, 1.17389, 0.73541, 0.97363, 0.97363, 0.97363, 0.97363, 0.97363, 0.97363, 0.94385, 0.87897, 0.79429, 0.79429, 0.79429, 0.79429, 1.1406, 1.1406, 1.1406, 1.1406, 1.0426, 1.10615, 0.97552, 0.97552, 0.97552, 0.97552, 0.97552, 1.21237, 0.97552, 1.00135, 1.00135, 1.00135, 1.00135, 0.91142, 0.94436, 0.98721, 1.06585, 1.06585, 1.06585, 1.06585, 1.06585, 1.06585, 0.96705, 0.83055, 0.93503, 0.93503, 0.93503, 0.93503, 1.14236, 1.14236, 1.14236, 1.14236, 0.93125, 0.97922, 0.94165, 0.94165, 0.94165, 0.94165, 0.94165, 1.29004, 0.94165, 0.97922, 0.97922, 0.97922, 0.97922, 0.96752, 0.97042, 0.96752, 0.97363, 1.06585, 0.97363, 1.06585, 0.97363, 1.06585, 0.87897, 0.83055, 0.87897, 0.83055, 0.87897, 0.83055, 0.87897, 0.83055, 1.0426, 1.0033, 1.0426, 0.97042, 0.79429, 0.93503, 0.79429, 0.93503, 0.79429, 0.93503, 0.79429, 0.93503, 0.79429, 0.93503, 0.91149, 0.97042, 0.91149, 0.97042, 0.91149, 0.97042, 1, 1, 1.05815, 0.97922, 1.05815, 0.97922, 1.1406, 1.14236, 1.1406, 1.14236, 1.1406, 1.14236, 1.1406, 1.14236, 1.1406, 1.14236, 0.97441, 1.04302, 0.79631, 1.01582, 1, 1, 1.01054, 0.83853, 1.14236, 1, 1, 0.83853, 1.09125, 0.83853, 0.90418, 0.83853, 1.19508, 1.10615, 0.97922, 1, 1, 1.10615, 0.97922, 1.01034, 1.10466, 0.97922, 0.97552, 0.94165, 0.97552, 0.94165, 0.97552, 0.94165, 0.91602, 0.91981, 0.88641, 1.0276, 1, 1, 0.88641, 1.0276, 0.80527, 0.78929, 0.80527, 0.78929, 0.80527, 0.78929, 0.80527, 0.78929, 1, 1, 0.96083, 1.05403, 0.95923, 1.16862, 1.00135, 0.97922, 1.00135, 0.97922, 1.00135, 0.97922, 1.00135, 0.97922, 1.00135, 0.97922, 1.00135, 0.97922, 1.06777, 1.02197, 0.91142, 0.96752, 0.91142, 0.99361, 0.97168, 0.99361, 0.97168, 0.99361, 0.97168, 1.23199, 1.036, 0.97363, 1.06585, 0.94385, 0.96705, 0.97552, 0.94165, 1, 1, 0.96083, 1.1261, 1.31818, 1.31818, 1.31818, 1.31818, 1.31818, 1.31818, 1.31818, 1.31818, 1.31818, 0.95161, 1.27126, 1.00811, 0.83284, 0.77702, 0.99137, 0.95253, 1.0347, 0.86142, 1.07205, 1.14236, 0.97363, 0.89723, 0.86869, 1.09818, 0.79429, 0.99361, 1.05815, 0.97552, 1.1406, 0.90128, 1.06662, 1.04396, 1.10615, 0.84918, 0.97552, 1.04694, 0.94436, 0.98015, 0.96083, 0.91142, 1.00356, 0.9817, 1.01945, 0.98999, 1.1406, 0.91142, 1.04961, 0.9898, 1.00639, 1.14236, 1.07514, 1.04961, 0.99607, 1.02897, 1.008, 0.9898, 0.95134, 1.00639, 1.11121, 1.14236, 1.00518, 0.97981, 1.02186, 1, 1.08578, 0.94165, 0.99314, 0.98387, 0.93028, 0.93377, 1.35125, 1.07514, 1.10687, 0.93491, 1.04232, 1.00351, 1.14236, 1.07514, 0.94165, 1.07514, 1.00351, 0.79429, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.09097, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.93503, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.96609, 1, 1, 1, 1, 1, 1, 1.06777, 1.02197, 1.06777, 1.02197, 1.06777, 1.02197, 0.91142, 0.96752, 1, 1.21261, 0.89903, 1, 1, 0.75155, 1.04745, 1.04745, 1.04745, 1.04394, 0.98633, 0.98633, 0.98633, 0.72959, 0.72959, 1.20502, 0.91406, 1.26514, 1.222, 1.02956, 1.03372, 1.03372, 0.96039, 1.24633, 1, 1.09125, 0.93327, 1.03336, 1.16541, 1.036, 1, 1, 1, 0.771, 1, 1, 1.15574, 1.15574, 1.15574, 1.15574, 0.86364, 0.94434, 0.86279, 0.94434, 0.86224, 1, 1, 1.16798, 1, 0.96085, 0.90068, 1.21237, 1.18416, 1.13904, 0.69825, 0.9716, 2.10339, 1.29004, 1.29004, 1.21339, 1.29004, 1.29004, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.42603, 1, 0.99862, 0.99862, 1, 0.87025, 0.87025, 0.87025, 0.87025, 1.18775, 1.42603, 1, 1.42603, 1.42603, 0.99862, 1, 1, 1, 1, 1, 1.2886, 1.04315, 1.15296, 1.34163, 1, 1, 1, 1.13269, 1.13269, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
28657const SegoeuiBoldItalicMetrics = {
28658  lineHeight: 1.33008,
28659  lineGap: 0
28660};
28661const SegoeuiItalicFactors = [1.76738, 1, 1, 0.98946, 1.14763, 1.05365, 1.06234, 0.96927, 0.92586, 1.15373, 1.18414, 0.91349, 0.91349, 1.07403, 1.17308, 0.78383, 1.20088, 0.78383, 1.42531, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.78383, 0.78383, 1.17308, 1.17308, 1.17308, 0.77349, 0.94565, 0.94729, 0.85944, 0.88506, 0.9858, 0.74817, 0.80016, 0.88449, 0.98039, 0.95782, 0.69238, 0.89898, 0.83231, 0.98183, 1.03989, 0.96924, 0.86237, 0.96924, 0.80595, 0.74524, 0.86091, 0.95402, 0.94143, 0.98448, 0.8858, 0.83089, 0.93285, 1.0949, 1.39016, 1.0949, 1.45994, 0.74627, 1.04839, 0.97454, 0.97454, 0.87207, 0.97454, 0.87533, 1.06151, 0.97454, 1.00176, 1.16484, 1.08132, 0.98047, 1.16484, 1.02989, 1.01054, 0.96225, 0.97454, 0.97454, 1.06598, 0.79004, 1.16344, 1.00351, 0.94629, 0.9973, 0.91016, 0.96777, 0.9043, 0.91082, 0.92481, 0.91082, 1.17308, 0.95748, 0.96927, 0.96927, 1, 0.96927, 0.92481, 0.80597, 1.04839, 1.23393, 1.1781, 0.9245, 1.17308, 1.20808, 0.63218, 0.94261, 1.24822, 1.09971, 1.09971, 1.04839, 1, 0.85273, 0.78032, 1.04839, 1.09971, 1.22326, 0.9245, 1.09836, 1.13525, 1.15222, 0.70424, 0.94729, 0.94729, 0.94729, 0.94729, 0.94729, 0.94729, 0.85498, 0.88506, 0.74817, 0.74817, 0.74817, 0.74817, 0.95782, 0.95782, 0.95782, 0.95782, 0.9858, 1.03989, 0.96924, 0.96924, 0.96924, 0.96924, 0.96924, 1.17308, 0.96924, 0.95402, 0.95402, 0.95402, 0.95402, 0.83089, 0.86237, 0.88409, 0.97454, 0.97454, 0.97454, 0.97454, 0.97454, 0.97454, 0.92916, 0.87207, 0.87533, 0.87533, 0.87533, 0.87533, 0.93146, 0.93146, 0.93146, 0.93146, 0.93854, 1.01054, 0.96225, 0.96225, 0.96225, 0.96225, 0.96225, 1.24822, 0.8761, 1.00351, 1.00351, 1.00351, 1.00351, 0.96777, 0.97454, 0.96777, 0.94729, 0.97454, 0.94729, 0.97454, 0.94729, 0.97454, 0.88506, 0.87207, 0.88506, 0.87207, 0.88506, 0.87207, 0.88506, 0.87207, 0.9858, 0.95391, 0.9858, 0.97454, 0.74817, 0.87533, 0.74817, 0.87533, 0.74817, 0.87533, 0.74817, 0.87533, 0.74817, 0.87533, 0.88449, 0.97454, 0.88449, 0.97454, 0.88449, 0.97454, 1, 1, 0.98039, 1.00176, 0.98039, 1.00176, 0.95782, 0.93146, 0.95782, 0.93146, 0.95782, 0.93146, 0.95782, 1.16484, 0.95782, 0.93146, 0.84421, 1.12761, 0.69238, 1.08132, 1, 1, 0.98047, 0.83231, 1.16484, 1, 1, 0.84723, 1.04861, 0.84723, 0.78755, 0.83231, 1.23736, 1.03989, 1.01054, 1, 1, 1.03989, 1.01054, 0.9857, 1.03849, 1.01054, 0.96924, 0.96225, 0.96924, 0.96225, 0.96924, 0.96225, 0.92383, 0.90171, 0.80595, 1.06598, 1, 1, 0.80595, 1.06598, 0.74524, 0.79004, 0.74524, 0.79004, 0.74524, 0.79004, 0.74524, 0.79004, 1, 1, 0.86091, 1.02759, 0.85771, 1.16344, 0.95402, 1.00351, 0.95402, 1.00351, 0.95402, 1.00351, 0.95402, 1.00351, 0.95402, 1.00351, 0.95402, 1.00351, 0.98448, 0.9973, 0.83089, 0.96777, 0.83089, 0.93285, 0.9043, 0.93285, 0.9043, 0.93285, 0.9043, 1.31868, 0.96927, 0.94729, 0.97454, 0.85498, 0.92916, 0.96924, 0.8761, 1, 1, 0.86091, 1.16344, 1.04839, 1.04839, 1.04839, 1.04839, 1.04839, 1.04839, 1.04839, 1.04839, 1.04839, 0.81965, 0.81965, 0.94729, 0.78032, 0.71022, 0.90883, 0.84171, 0.99877, 0.77596, 1.05734, 1.2, 0.94729, 0.85944, 0.82791, 0.9607, 0.74817, 0.93285, 0.98039, 0.96924, 0.95782, 0.89898, 0.98316, 0.98183, 1.03989, 0.78614, 0.96924, 0.97642, 0.86237, 0.86075, 0.86091, 0.83089, 0.90082, 0.8858, 0.97296, 1.01284, 0.95782, 0.83089, 1.0976, 1.04, 1.03342, 1.2, 1.0675, 1.0976, 0.98205, 1.03809, 1.05097, 1.04, 0.95364, 1.03342, 1.05401, 1.2, 1.02148, 1.0119, 1.04724, 1.0127, 1.02732, 0.96225, 0.8965, 0.97783, 0.93574, 0.94818, 1.30679, 1.0675, 1.11826, 0.99821, 1.0557, 1.0326, 1.2, 1.0675, 0.96225, 1.0675, 1.0326, 0.74817, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.03754, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.87533, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.98705, 1, 1, 1, 1, 1, 1, 0.98448, 0.9973, 0.98448, 0.9973, 0.98448, 0.9973, 0.83089, 0.96777, 1, 1.20088, 0.89903, 1, 1, 0.75155, 0.94945, 0.94945, 0.94945, 0.94945, 1.12317, 1.12317, 1.12317, 0.67603, 0.67603, 1.15621, 0.73584, 1.21191, 1.22135, 1.06483, 0.94868, 0.94868, 0.95996, 1.24633, 1, 1.07497, 0.87709, 0.96927, 1.01473, 0.96927, 1, 1, 1, 0.77295, 1, 1, 1.09836, 1.09836, 1.09836, 1.01522, 0.86321, 0.94434, 0.8649, 0.94434, 0.86182, 1, 1, 1.083, 1, 0.91578, 0.86438, 1.17308, 1.18416, 1.14589, 0.69825, 0.97622, 1.96791, 1.24822, 1.24822, 1.17308, 1.24822, 1.24822, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.42603, 1, 0.99862, 0.99862, 1, 0.87025, 0.87025, 0.87025, 0.87025, 1.17984, 1.42603, 1, 1.42603, 1.42603, 0.99862, 1, 1, 1, 1, 1, 1.2886, 1.04315, 1.15296, 1.34163, 1, 1, 1, 1.10742, 1.10742, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
28662const SegoeuiItalicMetrics = {
28663  lineHeight: 1.33008,
28664  lineGap: 0
28665};
28666const SegoeuiRegularFactors = [1.76738, 1, 1, 0.98594, 1.02285, 1.10454, 1.06234, 0.96927, 0.92037, 1.19985, 1.2046, 0.90616, 0.90616, 1.07152, 1.1714, 0.78032, 1.20088, 0.78032, 1.40246, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.78032, 0.78032, 1.1714, 1.1714, 1.1714, 0.80597, 0.94084, 0.96706, 0.85944, 0.85734, 0.97093, 0.75842, 0.79936, 0.88198, 0.9831, 0.95782, 0.71387, 0.86969, 0.84636, 1.07796, 1.03584, 0.96924, 0.83968, 0.96924, 0.82826, 0.79649, 0.85771, 0.95132, 0.93119, 0.98965, 0.88433, 0.8287, 0.93365, 1.08612, 1.3638, 1.08612, 1.45786, 0.74627, 0.80499, 0.91484, 1.05707, 0.92383, 1.05882, 0.9403, 1.12654, 1.05882, 1.01756, 1.09011, 1.09011, 0.99414, 1.09011, 1.034, 1.01756, 1.05356, 1.05707, 1.05882, 1.04399, 0.84863, 1.21968, 1.01756, 0.95801, 1.00068, 0.91797, 0.96777, 0.9043, 0.90351, 0.92105, 0.90351, 1.1714, 0.85337, 0.96927, 0.96927, 0.99912, 0.96927, 0.92105, 0.80597, 1.2434, 1.20808, 1.05937, 0.90957, 1.1714, 1.20808, 0.75155, 0.94261, 1.24644, 1.09971, 1.09971, 0.84751, 1, 0.85273, 0.78032, 0.61584, 1.05425, 1.17914, 0.90957, 1.08665, 1.11593, 1.14169, 0.73381, 0.96706, 0.96706, 0.96706, 0.96706, 0.96706, 0.96706, 0.86035, 0.85734, 0.75842, 0.75842, 0.75842, 0.75842, 0.95782, 0.95782, 0.95782, 0.95782, 0.97093, 1.03584, 0.96924, 0.96924, 0.96924, 0.96924, 0.96924, 1.1714, 0.96924, 0.95132, 0.95132, 0.95132, 0.95132, 0.8287, 0.83968, 0.89049, 0.91484, 0.91484, 0.91484, 0.91484, 0.91484, 0.91484, 0.93575, 0.92383, 0.9403, 0.9403, 0.9403, 0.9403, 0.8717, 0.8717, 0.8717, 0.8717, 1.00527, 1.01756, 1.05356, 1.05356, 1.05356, 1.05356, 1.05356, 1.24644, 0.95923, 1.01756, 1.01756, 1.01756, 1.01756, 0.96777, 1.05707, 0.96777, 0.96706, 0.91484, 0.96706, 0.91484, 0.96706, 0.91484, 0.85734, 0.92383, 0.85734, 0.92383, 0.85734, 0.92383, 0.85734, 0.92383, 0.97093, 1.0969, 0.97093, 1.05882, 0.75842, 0.9403, 0.75842, 0.9403, 0.75842, 0.9403, 0.75842, 0.9403, 0.75842, 0.9403, 0.88198, 1.05882, 0.88198, 1.05882, 0.88198, 1.05882, 1, 1, 0.9831, 1.01756, 0.9831, 1.01756, 0.95782, 0.8717, 0.95782, 0.8717, 0.95782, 0.8717, 0.95782, 1.09011, 0.95782, 0.8717, 0.84784, 1.11551, 0.71387, 1.09011, 1, 1, 0.99414, 0.84636, 1.09011, 1, 1, 0.84636, 1.0536, 0.84636, 0.94298, 0.84636, 1.23297, 1.03584, 1.01756, 1, 1, 1.03584, 1.01756, 1.00323, 1.03444, 1.01756, 0.96924, 1.05356, 0.96924, 1.05356, 0.96924, 1.05356, 0.93066, 0.98293, 0.82826, 1.04399, 1, 1, 0.82826, 1.04399, 0.79649, 0.84863, 0.79649, 0.84863, 0.79649, 0.84863, 0.79649, 0.84863, 1, 1, 0.85771, 1.17318, 0.85771, 1.21968, 0.95132, 1.01756, 0.95132, 1.01756, 0.95132, 1.01756, 0.95132, 1.01756, 0.95132, 1.01756, 0.95132, 1.01756, 0.98965, 1.00068, 0.8287, 0.96777, 0.8287, 0.93365, 0.9043, 0.93365, 0.9043, 0.93365, 0.9043, 1.08571, 0.96927, 0.96706, 0.91484, 0.86035, 0.93575, 0.96924, 0.95923, 1, 1, 0.85771, 1.21968, 1.11437, 1.11437, 0.93109, 0.91202, 0.60411, 0.84164, 0.55572, 1.01173, 0.97361, 0.81818, 0.81818, 0.96635, 0.78032, 0.72727, 0.92366, 0.98601, 1.03405, 0.77968, 1.09799, 1.2, 0.96706, 0.85944, 0.85638, 0.96491, 0.75842, 0.93365, 0.9831, 0.96924, 0.95782, 0.86969, 0.94152, 1.07796, 1.03584, 0.78437, 0.96924, 0.98715, 0.83968, 0.83491, 0.85771, 0.8287, 0.94492, 0.88433, 0.9287, 1.0098, 0.95782, 0.8287, 1.0625, 0.98248, 1.03424, 1.2, 1.01071, 1.0625, 0.95246, 1.03809, 1.04912, 0.98248, 1.00221, 1.03424, 1.05443, 1.2, 1.04785, 0.99609, 1.00169, 1.05176, 0.99346, 1.05356, 0.9087, 1.03004, 0.95542, 0.93117, 1.23362, 1.01071, 1.07831, 1.02512, 1.05205, 1.03502, 1.2, 1.01071, 1.05356, 1.01071, 1.03502, 0.75842, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.03719, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.9403, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.04021, 1, 1, 1, 1, 1, 1, 0.98965, 1.00068, 0.98965, 1.00068, 0.98965, 1.00068, 0.8287, 0.96777, 1, 1.20088, 0.89903, 1, 1, 0.75155, 1.03077, 1.03077, 1.03077, 1.03077, 1.13196, 1.13196, 1.13196, 0.67428, 0.67428, 1.16039, 0.73291, 1.20996, 1.22135, 1.06483, 0.94868, 0.94868, 0.95996, 1.24633, 1, 1.07497, 0.87796, 0.96927, 1.01518, 0.96927, 1, 1, 1, 0.77295, 1, 1, 1.10539, 1.10539, 1.11358, 1.06967, 0.86279, 0.94434, 0.86279, 0.94434, 0.86182, 1, 1, 1.083, 1, 0.91578, 0.86507, 1.1714, 1.18416, 1.14589, 0.69825, 0.97622, 1.9697, 1.24822, 1.24822, 1.17238, 1.24822, 1.24822, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.42603, 1, 0.99862, 0.99862, 1, 0.87025, 0.87025, 0.87025, 0.87025, 1.18083, 1.42603, 1, 1.42603, 1.42603, 0.99862, 1, 1, 1, 1, 1, 1.2886, 1.04315, 1.15296, 1.34163, 1, 1, 1, 1.10938, 1.10938, 1, 1, 1, 1.05425, 1.09971, 1.09971, 1.09971, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
28667const SegoeuiRegularMetrics = {
28668  lineHeight: 1.33008,
28669  lineGap: 0
28670};
28671
28672;// ./src/core/xfa_fonts.js
28673
28674
28675
28676
28677
28678
28679
28680
28681const getXFAFontMap = getLookupTableFactory(function (t) {
28682  t["MyriadPro-Regular"] = t["PdfJS-Fallback-Regular"] = {
28683    name: "LiberationSans-Regular",
28684    factors: MyriadProRegularFactors,
28685    baseWidths: LiberationSansRegularWidths,
28686    baseMapping: LiberationSansRegularMapping,
28687    metrics: MyriadProRegularMetrics
28688  };
28689  t["MyriadPro-Bold"] = t["PdfJS-Fallback-Bold"] = {
28690    name: "LiberationSans-Bold",
28691    factors: MyriadProBoldFactors,
28692    baseWidths: LiberationSansBoldWidths,
28693    baseMapping: LiberationSansBoldMapping,
28694    metrics: MyriadProBoldMetrics
28695  };
28696  t["MyriadPro-It"] = t["MyriadPro-Italic"] = t["PdfJS-Fallback-Italic"] = {
28697    name: "LiberationSans-Italic",
28698    factors: MyriadProItalicFactors,
28699    baseWidths: LiberationSansItalicWidths,
28700    baseMapping: LiberationSansItalicMapping,
28701    metrics: MyriadProItalicMetrics
28702  };
28703  t["MyriadPro-BoldIt"] = t["MyriadPro-BoldItalic"] = t["PdfJS-Fallback-BoldItalic"] = {
28704    name: "LiberationSans-BoldItalic",
28705    factors: MyriadProBoldItalicFactors,
28706    baseWidths: LiberationSansBoldItalicWidths,
28707    baseMapping: LiberationSansBoldItalicMapping,
28708    metrics: MyriadProBoldItalicMetrics
28709  };
28710  t.ArialMT = t.Arial = t["Arial-Regular"] = {
28711    name: "LiberationSans-Regular",
28712    baseWidths: LiberationSansRegularWidths,
28713    baseMapping: LiberationSansRegularMapping
28714  };
28715  t["Arial-BoldMT"] = t["Arial-Bold"] = {
28716    name: "LiberationSans-Bold",
28717    baseWidths: LiberationSansBoldWidths,
28718    baseMapping: LiberationSansBoldMapping
28719  };
28720  t["Arial-ItalicMT"] = t["Arial-Italic"] = {
28721    name: "LiberationSans-Italic",
28722    baseWidths: LiberationSansItalicWidths,
28723    baseMapping: LiberationSansItalicMapping
28724  };
28725  t["Arial-BoldItalicMT"] = t["Arial-BoldItalic"] = {
28726    name: "LiberationSans-BoldItalic",
28727    baseWidths: LiberationSansBoldItalicWidths,
28728    baseMapping: LiberationSansBoldItalicMapping
28729  };
28730  t["Calibri-Regular"] = {
28731    name: "LiberationSans-Regular",
28732    factors: CalibriRegularFactors,
28733    baseWidths: LiberationSansRegularWidths,
28734    baseMapping: LiberationSansRegularMapping,
28735    metrics: CalibriRegularMetrics
28736  };
28737  t["Calibri-Bold"] = {
28738    name: "LiberationSans-Bold",
28739    factors: CalibriBoldFactors,
28740    baseWidths: LiberationSansBoldWidths,
28741    baseMapping: LiberationSansBoldMapping,
28742    metrics: CalibriBoldMetrics
28743  };
28744  t["Calibri-Italic"] = {
28745    name: "LiberationSans-Italic",
28746    factors: CalibriItalicFactors,
28747    baseWidths: LiberationSansItalicWidths,
28748    baseMapping: LiberationSansItalicMapping,
28749    metrics: CalibriItalicMetrics
28750  };
28751  t["Calibri-BoldItalic"] = {
28752    name: "LiberationSans-BoldItalic",
28753    factors: CalibriBoldItalicFactors,
28754    baseWidths: LiberationSansBoldItalicWidths,
28755    baseMapping: LiberationSansBoldItalicMapping,
28756    metrics: CalibriBoldItalicMetrics
28757  };
28758  t["Segoeui-Regular"] = {
28759    name: "LiberationSans-Regular",
28760    factors: SegoeuiRegularFactors,
28761    baseWidths: LiberationSansRegularWidths,
28762    baseMapping: LiberationSansRegularMapping,
28763    metrics: SegoeuiRegularMetrics
28764  };
28765  t["Segoeui-Bold"] = {
28766    name: "LiberationSans-Bold",
28767    factors: SegoeuiBoldFactors,
28768    baseWidths: LiberationSansBoldWidths,
28769    baseMapping: LiberationSansBoldMapping,
28770    metrics: SegoeuiBoldMetrics
28771  };
28772  t["Segoeui-Italic"] = {
28773    name: "LiberationSans-Italic",
28774    factors: SegoeuiItalicFactors,
28775    baseWidths: LiberationSansItalicWidths,
28776    baseMapping: LiberationSansItalicMapping,
28777    metrics: SegoeuiItalicMetrics
28778  };
28779  t["Segoeui-BoldItalic"] = {
28780    name: "LiberationSans-BoldItalic",
28781    factors: SegoeuiBoldItalicFactors,
28782    baseWidths: LiberationSansBoldItalicWidths,
28783    baseMapping: LiberationSansBoldItalicMapping,
28784    metrics: SegoeuiBoldItalicMetrics
28785  };
28786  t["Helvetica-Regular"] = t.Helvetica = {
28787    name: "LiberationSans-Regular",
28788    factors: HelveticaRegularFactors,
28789    baseWidths: LiberationSansRegularWidths,
28790    baseMapping: LiberationSansRegularMapping,
28791    metrics: HelveticaRegularMetrics
28792  };
28793  t["Helvetica-Bold"] = {
28794    name: "LiberationSans-Bold",
28795    factors: HelveticaBoldFactors,
28796    baseWidths: LiberationSansBoldWidths,
28797    baseMapping: LiberationSansBoldMapping,
28798    metrics: HelveticaBoldMetrics
28799  };
28800  t["Helvetica-Italic"] = {
28801    name: "LiberationSans-Italic",
28802    factors: HelveticaItalicFactors,
28803    baseWidths: LiberationSansItalicWidths,
28804    baseMapping: LiberationSansItalicMapping,
28805    metrics: HelveticaItalicMetrics
28806  };
28807  t["Helvetica-BoldItalic"] = {
28808    name: "LiberationSans-BoldItalic",
28809    factors: HelveticaBoldItalicFactors,
28810    baseWidths: LiberationSansBoldItalicWidths,
28811    baseMapping: LiberationSansBoldItalicMapping,
28812    metrics: HelveticaBoldItalicMetrics
28813  };
28814});
28815function getXfaFontName(name) {
28816  const fontName = normalizeFontName(name);
28817  const fontMap = getXFAFontMap();
28818  return fontMap[fontName];
28819}
28820function getXfaFontWidths(name) {
28821  const info = getXfaFontName(name);
28822  if (!info) {
28823    return null;
28824  }
28825  const {
28826    baseWidths,
28827    baseMapping,
28828    factors
28829  } = info;
28830  const rescaledBaseWidths = !factors ? baseWidths : baseWidths.map((w, i) => w * factors[i]);
28831  let currentCode = -2;
28832  let currentArray;
28833  const newWidths = [];
28834  for (const [unicode, glyphIndex] of baseMapping.map((charUnicode, index) => [charUnicode, index]).sort(([unicode1], [unicode2]) => unicode1 - unicode2)) {
28835    if (unicode === -1) {
28836      continue;
28837    }
28838    if (unicode === currentCode + 1) {
28839      currentArray.push(rescaledBaseWidths[glyphIndex]);
28840      currentCode += 1;
28841    } else {
28842      currentCode = unicode;
28843      currentArray = [rescaledBaseWidths[glyphIndex]];
28844      newWidths.push(unicode, currentArray);
28845    }
28846  }
28847  return newWidths;
28848}
28849function getXfaFontDict(name) {
28850  const widths = getXfaFontWidths(name);
28851  const dict = new Dict(null);
28852  dict.set("BaseFont", Name.get(name));
28853  dict.set("Type", Name.get("Font"));
28854  dict.set("Subtype", Name.get("CIDFontType2"));
28855  dict.set("Encoding", Name.get("Identity-H"));
28856  dict.set("CIDToGIDMap", Name.get("Identity"));
28857  dict.set("W", widths);
28858  dict.set("FirstChar", widths[0]);
28859  dict.set("LastChar", widths.at(-2) + widths.at(-1).length - 1);
28860  const descriptor = new Dict(null);
28861  dict.set("FontDescriptor", descriptor);
28862  const systemInfo = new Dict(null);
28863  systemInfo.set("Ordering", "Identity");
28864  systemInfo.set("Registry", "Adobe");
28865  systemInfo.set("Supplement", 0);
28866  dict.set("CIDSystemInfo", systemInfo);
28867  return dict;
28868}
28869
28870;// ./src/core/postscript/lexer.js
28871const TOKEN = {
28872  number: 0,
28873  lbrace: 1,
28874  rbrace: 2,
28875  true: 3,
28876  false: 4,
28877  add: 5,
28878  sub: 6,
28879  mul: 7,
28880  div: 8,
28881  idiv: 9,
28882  mod: 10,
28883  exp: 11,
28884  eq: 12,
28885  ne: 13,
28886  gt: 14,
28887  ge: 15,
28888  lt: 16,
28889  le: 17,
28890  and: 18,
28891  or: 19,
28892  xor: 20,
28893  bitshift: 21,
28894  abs: 22,
28895  neg: 23,
28896  ceiling: 24,
28897  floor: 25,
28898  round: 26,
28899  truncate: 27,
28900  not: 28,
28901  sqrt: 29,
28902  sin: 30,
28903  cos: 31,
28904  ln: 32,
28905  log: 33,
28906  atan: 34,
28907  cvi: 35,
28908  cvr: 36,
28909  dup: 37,
28910  exch: 38,
28911  pop: 39,
28912  copy: 40,
28913  index: 41,
28914  roll: 42,
28915  if: 43,
28916  ifelse: 44,
28917  eof: 45,
28918  min: 46,
28919  max: 47
28920};
28921class Token {
28922  constructor(id, value = null) {
28923    this.id = id;
28924    this.value = value;
28925  }
28926}
28927class lexer_Lexer {
28928  static #singletons = null;
28929  static #operatorSingletons = null;
28930  static #initSingletons() {
28931    const singletons = Object.create(null);
28932    const operatorSingletons = Object.create(null);
28933    for (const [name, id] of Object.entries(TOKEN)) {
28934      if (name === "number") {
28935        continue;
28936      }
28937      const isOperator = id >= TOKEN.true && id <= TOKEN.ifelse;
28938      const token = new Token(id, isOperator ? name : null);
28939      singletons[name] = token;
28940      if (isOperator) {
28941        operatorSingletons[name] = token;
28942      }
28943    }
28944    this.#singletons = singletons;
28945    this.#operatorSingletons = operatorSingletons;
28946  }
28947  constructor(data) {
28948    if (!lexer_Lexer.#singletons) {
28949      lexer_Lexer.#initSingletons();
28950    }
28951    this.data = data;
28952    this.pos = 0;
28953    this.len = data.length;
28954    this._numberPattern = /[+-]?(?:\d+
28954\.?\d*|\.\d+)(?:[eE][+-]?\d+)?/
vendor: 45,959 bytes, lines 28954-30652
28954y;
28955    this._identifierPattern = /[a-z]+/y;
28956  }
28957  _skipComment() {
28958    const lf = this.data.indexOf("\n", this.pos);
28959    const cr = this.data.indexOf("\r", this.pos);
28960    const eol = Math.min(lf < 0 ? this.len : lf, cr < 0 ? this.len : cr);
28961    this.pos = Math.min(eol + 1, this.len);
28962  }
28963  _getNumber() {
28964    this._numberPattern.lastIndex = this.pos;
28965    const match = this._numberPattern.exec(this.data);
28966    if (!match) {
28967      return new Token(TOKEN.number, 0);
28968    }
28969    const number = parseFloat(match[0]);
28970    if (!Number.isFinite(number)) {
28971      return new Token(TOKEN.number, 0);
28972    }
28973    this.pos = this._numberPattern.lastIndex;
28974    return new Token(TOKEN.number, number);
28975  }
28976  _getOperator() {
28977    this._identifierPattern.lastIndex = this.pos;
28978    const match = this._identifierPattern.exec(this.data);
28979    if (!match) {
28980      return new Token(TOKEN.number, 0);
28981    }
28982    this.pos = this._identifierPattern.lastIndex;
28983    const op = match[0];
28984    const token = lexer_Lexer.#operatorSingletons[op];
28985    if (!token) {
28986      return new Token(TOKEN.number, 0);
28987    }
28988    return token;
28989  }
28990  next() {
28991    while (this.pos < this.len) {
28992      const ch = this.data.charCodeAt(this.pos++);
28993      switch (ch) {
28994        case 0x00:
28995        case 0x09:
28996        case 0x0a:
28997        case 0x0c:
28998        case 0x0d:
28999        case 0x20:
29000          break;
29001        case 0x25:
29002          this._skipComment();
29003          break;
29004        case 0x7b:
29005          return lexer_Lexer.#singletons.lbrace;
29006        case 0x7d:
29007          return lexer_Lexer.#singletons.rbrace;
29008        case 0x2b:
29009        case 0x2d:
29010          this.pos--;
29011          return this._getNumber();
29012        case 0x2e:
29013          this.pos--;
29014          return this._getNumber();
29015        default:
29016          if (ch >= 0x30 && ch <= 0x39) {
29017            this.pos--;
29018            return this._getNumber();
29019          }
29020          if (ch >= 0x61 && ch <= 0x7a) {
29021            this.pos--;
29022            return this._getOperator();
29023          }
29024          return new Token(TOKEN.number, 0);
29025      }
29026    }
29027    return lexer_Lexer.#singletons.eof;
29028  }
29029}
29030
29031;// ./src/core/postscript/ast.js
29032
29033
29034const PS_VALUE_TYPE = {
29035  numeric: 0,
29036  boolean: 1,
29037  unknown: 2
29038};
29039const PS_NODE = {
29040  program: 0,
29041  block: 1,
29042  number: 2,
29043  operator: 3,
29044  if: 4,
29045  ifelse: 5,
29046  arg: 6,
29047  const: 7,
29048  unary: 8,
29049  binary: 9,
29050  ternary: 10
29051};
29052class PsNode {
29053  constructor(type) {
29054    this.type = type;
29055  }
29056}
29057class PsProgram extends PsNode {
29058  constructor(body) {
29059    super(PS_NODE.program);
29060    this.body = body;
29061  }
29062}
29063class PsBlock extends PsNode {
29064  constructor(instructions) {
29065    super(PS_NODE.block);
29066    this.instructions = instructions;
29067  }
29068}
29069class PsNumber extends PsNode {
29070  constructor(value) {
29071    super(PS_NODE.number);
29072    this.value = value;
29073  }
29074}
29075class PsOperator extends PsNode {
29076  constructor(op) {
29077    super(PS_NODE.operator);
29078    this.op = op;
29079  }
29080}
29081class PsIf extends PsNode {
29082  constructor(then) {
29083    super(PS_NODE.if);
29084    this.then = then;
29085  }
29086}
29087class PsIfElse extends PsNode {
29088  constructor(then, otherwise) {
29089    super(PS_NODE.ifelse);
29090    this.then = then;
29091    this.otherwise = otherwise;
29092  }
29093}
29094class PsArgNode extends PsNode {
29095  constructor(index) {
29096    super(PS_NODE.arg);
29097    this.index = index;
29098    this.valueType = PS_VALUE_TYPE.numeric;
29099  }
29100}
29101class PsConstNode extends PsNode {
29102  constructor(value) {
29103    super(PS_NODE.const);
29104    this.value = value;
29105    this.valueType = typeof value === "boolean" ? PS_VALUE_TYPE.boolean : PS_VALUE_TYPE.numeric;
29106  }
29107}
29108class PsUnaryNode extends PsNode {
29109  constructor(op, operand, valueType = PS_VALUE_TYPE.unknown) {
29110    super(PS_NODE.unary);
29111    this.op = op;
29112    this.operand = operand;
29113    this.valueType = valueType;
29114  }
29115}
29116class PsBinaryNode extends PsNode {
29117  constructor(op, first, second, valueType = PS_VALUE_TYPE.unknown) {
29118    super(PS_NODE.binary);
29119    this.op = op;
29120    this.first = first;
29121    this.second = second;
29122    this.valueType = valueType;
29123  }
29124}
29125class PsTernaryNode extends PsNode {
29126  constructor(cond, then, otherwise, valueType = PS_VALUE_TYPE.unknown) {
29127    super(PS_NODE.ternary);
29128    this.cond = cond;
29129    this.then = then;
29130    this.otherwise = otherwise;
29131    this.valueType = valueType;
29132  }
29133}
29134class ast_Parser {
29135  constructor(lexer) {
29136    this.lexer = lexer;
29137    this._token = null;
29138  }
29139  static _isRegularOperator(id) {
29140    return id >= TOKEN.true && id < TOKEN.if;
29141  }
29142  _advance() {
29143    this._token = this.lexer.next();
29144  }
29145  _expect(id) {
29146    if (this._token.id !== id) {
29147      throw new FormatError(`PostScript function: expected token id ${id}, got ${this._token.id}.`);
29148    }
29149    const tok = this._token;
29150    this._advance();
29151    return tok;
29152  }
29153  parse() {
29154    this._advance();
29155    this._expect(TOKEN.lbrace);
29156    const block = this._parseBlock();
29157    this._expect(TOKEN.rbrace);
29158    if (this._token.id !== TOKEN.eof) {
29159      warn("PostScript function: unexpected content after closing brace.");
29160    }
29161    return new PsProgram(block);
29162  }
29163  _parseBlock() {
29164    const instructions = [];
29165    while (true) {
29166      const tok = this._token;
29167      switch (tok.id) {
29168        case TOKEN.number:
29169          instructions.push(new PsNumber(tok.value));
29170          this._advance();
29171          break;
29172        case TOKEN.lbrace:
29173          {
29174            this._advance();
29175            const thenBlock = this._parseBlock();
29176            this._expect(TOKEN.rbrace);
29177            if (this._token.id === TOKEN.if) {
29178              this._advance();
29179              instructions.push(new PsIf(thenBlock));
29180            } else if (this._token.id === TOKEN.lbrace) {
29181              this._advance();
29182              const elseBlock = this._parseBlock();
29183              this._expect(TOKEN.rbrace);
29184              this._expect(TOKEN.ifelse);
29185              instructions.push(new PsIfElse(thenBlock, elseBlock));
29186            } else {
29187              throw new FormatError("PostScript function: a procedure block must be followed by 'if' or '{…} ifelse'.");
29188            }
29189            break;
29190          }
29191        case TOKEN.rbrace:
29192        case TOKEN.eof:
29193          return new PsBlock(instructions);
29194        case TOKEN.if:
29195        case TOKEN.ifelse:
29196          throw new FormatError(`PostScript function: unexpected '${tok.value}' operator.`);
29197        default:
29198          if (ast_Parser._isRegularOperator(tok.id)) {
29199            instructions.push(new PsOperator(tok.id));
29200            this._advance();
29201            break;
29202          }
29203          throw new FormatError(`PostScript function: unexpected token id ${tok.id}.`);
29204      }
29205    }
29206  }
29207}
29208function parsePostScriptFunction(source) {
29209  return new ast_Parser(new lexer_Lexer(source)).parse();
29210}
29211function _nodesEqual(a, b) {
29212  if (a === b) {
29213    return true;
29214  }
29215  if (a.type !== b.type) {
29216    return false;
29217  }
29218  switch (a.type) {
29219    case PS_NODE.arg:
29220      return a.index === b.index;
29221    case PS_NODE.const:
29222      return a.value === b.value;
29223    case PS_NODE.unary:
29224      return a.op === b.op && _nodesEqual(a.operand, b.operand);
29225    case PS_NODE.binary:
29226      return a.op === b.op && _nodesEqual(a.first, b.first) && _nodesEqual(a.second, b.second);
29227    case PS_NODE.ternary:
29228      return _nodesEqual(a.cond, b.cond) && _nodesEqual(a.then, b.then) && _nodesEqual(a.otherwise, b.otherwise);
29229    default:
29230      return false;
29231  }
29232}
29233function _evalBinaryConst(op, a, b) {
29234  switch (op) {
29235    case TOKEN.add:
29236      return a + b;
29237    case TOKEN.sub:
29238      return a - b;
29239    case TOKEN.mul:
29240      return a * b;
29241    case TOKEN.div:
29242      return b !== 0 ? a / b : 0;
29243    case TOKEN.idiv:
29244      return b !== 0 ? Math.trunc(a / b) : 0;
29245    case TOKEN.mod:
29246      return b !== 0 ? a - Math.trunc(a / b) * b : 0;
29247    case TOKEN.exp:
29248      {
29249        const r = a ** b;
29250        return Number.isFinite(r) ? r : undefined;
29251      }
29252    case TOKEN.atan:
29253      {
29254        let deg = Math.atan2(a, b) * (180 / Math.PI);
29255        if (deg < 0) {
29256          deg += 360;
29257        }
29258        return deg;
29259      }
29260    case TOKEN.eq:
29261      return a === b;
29262    case TOKEN.ne:
29263      return a !== b;
29264    case TOKEN.gt:
29265      return a > b;
29266    case TOKEN.ge:
29267      return a >= b;
29268    case TOKEN.lt:
29269      return a < b;
29270    case TOKEN.le:
29271      return a <= b;
29272    case TOKEN.and:
29273      return typeof a === "boolean" ? a && b : a & b | 0;
29274    case TOKEN.or:
29275      return typeof a === "boolean" ? a || b : a | b | 0;
29276    case TOKEN.xor:
29277      return typeof a === "boolean" ? a !== b : a ^ b | 0;
29278    case TOKEN.bitshift:
29279      return b >= 0 ? a << b | 0 : a >> -b | 0;
29280    case TOKEN.min:
29281      return Math.min(a, b);
29282    case TOKEN.max:
29283      return Math.max(a, b);
29284    default:
29285      return undefined;
29286  }
29287}
29288function _evalUnaryConst(op, v) {
29289  switch (op) {
29290    case TOKEN.abs:
29291      return Math.abs(v);
29292    case TOKEN.neg:
29293      return -v;
29294    case TOKEN.ceiling:
29295      return Math.ceil(v);
29296    case TOKEN.floor:
29297      return Math.floor(v);
29298    case TOKEN.round:
29299      return Math.round(v);
29300    case TOKEN.truncate:
29301      return Math.trunc(v);
29302    case TOKEN.sqrt:
29303      {
29304        const r = Math.sqrt(v);
29305        return Number.isFinite(r) ? r : undefined;
29306      }
29307    case TOKEN.sin:
29308      return Math.sin(v % 360 * Math.PI / 180);
29309    case TOKEN.cos:
29310      return Math.cos(v % 360 * Math.PI / 180);
29311    case TOKEN.ln:
29312      {
29313        const r = Math.log(v);
29314        return Number.isFinite(r) ? r : undefined;
29315      }
29316    case TOKEN.log:
29317      {
29318        const r = Math.log10(v);
29319        return Number.isFinite(r) ? r : undefined;
29320      }
29321    case TOKEN.cvi:
29322      return Math.trunc(v);
29323    case TOKEN.cvr:
29324      return v;
29325    case TOKEN.not:
29326      return typeof v === "boolean" ? !v : ~v;
29327    default:
29328      return undefined;
29329  }
29330}
29331const MAX_STACK_SIZE = 100;
29332function _unaryValueType(op, operandType) {
29333  return op === TOKEN.not ? operandType : PS_VALUE_TYPE.numeric;
29334}
29335function _binaryValueType(op, firstType, secondType) {
29336  switch (op) {
29337    case TOKEN.eq:
29338    case TOKEN.ne:
29339    case TOKEN.gt:
29340    case TOKEN.ge:
29341    case TOKEN.lt:
29342    case TOKEN.le:
29343      return PS_VALUE_TYPE.boolean;
29344    case TOKEN.and:
29345    case TOKEN.or:
29346    case TOKEN.xor:
29347      return firstType === secondType && firstType !== PS_VALUE_TYPE.unknown ? firstType : PS_VALUE_TYPE.unknown;
29348    default:
29349      return PS_VALUE_TYPE.numeric;
29350  }
29351}
29352class PSStackToTree {
29353  static #binaryOps = null;
29354  static #unaryOps = null;
29355  static #idempotentUnary = null;
29356  static #negatedComparison = null;
29357  static #init() {
29358    this.#binaryOps = new Set([TOKEN.add, TOKEN.sub, TOKEN.mul, TOKEN.div, TOKEN.idiv, TOKEN.mod, TOKEN.exp, TOKEN.atan, TOKEN.eq, TOKEN.ne, TOKEN.gt, TOKEN.ge, TOKEN.lt, TOKEN.le, TOKEN.and, TOKEN.or, TOKEN.xor, TOKEN.bitshift]);
29359    this.#unaryOps = new Set([TOKEN.abs, TOKEN.neg, TOKEN.ceiling, TOKEN.floor, TOKEN.round, TOKEN.truncate, TOKEN.sqrt, TOKEN.sin, TOKEN.cos, TOKEN.ln, TOKEN.log, TOKEN.cvi, TOKEN.cvr, TOKEN.not]);
29360    this.#idempotentUnary = new Set([TOKEN.abs, TOKEN.ceiling, TOKEN.cvi, TOKEN.cvr, TOKEN.floor, TOKEN.round, TOKEN.truncate]);
29361    this.#negatedComparison = new Map([[TOKEN.eq, TOKEN.ne], [TOKEN.ne, TOKEN.eq], [TOKEN.lt, TOKEN.ge], [TOKEN.le, TOKEN.gt], [TOKEN.gt, TOKEN.le], [TOKEN.ge, TOKEN.lt]]);
29362  }
29363  evaluate(program, numInputs) {
29364    if (!PSStackToTree.#binaryOps) {
29365      PSStackToTree.#init();
29366    }
29367    this._failed = false;
29368    if (numInputs > MAX_STACK_SIZE) {
29369      return null;
29370    }
29371    const stack = [];
29372    for (let i = 0; i < numInputs; i++) {
29373      stack.push(new PsArgNode(i));
29374    }
29375    this._evalBlock(program.body, stack);
29376    if (this._failed) {
29377      return null;
29378    }
29379    PSStackToTree.#markShared(stack);
29380    return stack;
29381  }
29382  static #markShared(outputs) {
29383    const refCount = new Map();
29384    const visit = node => {
29385      if (!node || node.type === PS_NODE.arg || node.type === PS_NODE.const) {
29386        return;
29387      }
29388      const prev = refCount.get(node) ?? 0;
29389      refCount.set(node, prev + 1);
29390      if (prev > 0) {
29391        return;
29392      }
29393      switch (node.type) {
29394        case PS_NODE.unary:
29395          visit(node.operand);
29396          break;
29397        case PS_NODE.binary:
29398          visit(node.first);
29399          visit(node.second);
29400          break;
29401        case PS_NODE.ternary:
29402          visit(node.cond);
29403          visit(node.then);
29404          visit(node.otherwise);
29405          break;
29406      }
29407    };
29408    for (const output of outputs) {
29409      visit(output);
29410    }
29411    for (const [node, count] of refCount) {
29412      if (count > 1) {
29413        node.shared = true;
29414        node.sharedCount = count;
29415      }
29416    }
29417  }
29418  _evalBlock(block, stack) {
29419    this._evalBlockFrom(block.instructions, 0, stack);
29420  }
29421  _evalBlockFrom(instructions, startIdx, stack) {
29422    for (let idx = startIdx; idx < instructions.length; idx++) {
29423      if (this._failed) {
29424        break;
29425      }
29426      const instr = instructions[idx];
29427      switch (instr.type) {
29428        case PS_NODE.number:
29429          stack.push(new PsConstNode(instr.value));
29430          if (stack.length > MAX_STACK_SIZE) {
29431            this._failed = true;
29432          }
29433          break;
29434        case PS_NODE.operator:
29435          this._evalOp(instr.op, stack);
29436          break;
29437        case PS_NODE.if:
29438          {
29439            if (stack.length < 1) {
29440              this._failed = true;
29441              break;
29442            }
29443            const cond = stack.pop();
29444            const saved = stack.slice();
29445            this._evalBlock(instr.then, stack);
29446            if (this._failed) {
29447              break;
29448            }
29449            if (stack.length === saved.length) {
29450              for (let i = 0; i < stack.length; i++) {
29451                if (stack[i] !== saved[i]) {
29452                  stack[i] = this._makeTernary(cond, stack[i], saved[i]);
29453                }
29454              }
29455            } else if (stack.length > saved.length) {
29456              if (cond.type === PS_NODE.const) {
29457                if (!cond.value) {
29458                  stack.length = 0;
29459                  stack.push(...saved);
29460                }
29461                break;
29462              }
29463              const trueStack = stack.slice();
29464              this._evalBlockFrom(instructions, idx + 1, trueStack);
29465              if (this._failed) {
29466                break;
29467              }
29468              const falseStack = saved;
29469              this._evalBlockFrom(instructions, idx + 1, falseStack);
29470              if (this._failed) {
29471                break;
29472              }
29473              if (trueStack.length !== falseStack.length) {
29474                const zero = new PsConstNode(0);
29475                while (trueStack.length < falseStack.length) {
29476                  trueStack.push(zero);
29477                }
29478                while (falseStack.length < trueStack.length) {
29479                  falseStack.push(zero);
29480                }
29481              }
29482              stack.length = 0;
29483              for (let i = 0; i < trueStack.length; i++) {
29484                stack.push(this._makeTernary(cond, trueStack[i], falseStack[i]));
29485              }
29486              return;
29487            } else {
29488              this._failed = true;
29489            }
29490            break;
29491          }
29492        case PS_NODE.ifelse:
29493          {
29494            if (stack.length < 1) {
29495              this._failed = true;
29496              break;
29497            }
29498            const cond = stack.pop();
29499            const snapshot = stack.slice();
29500            const thenStack = snapshot.slice();
29501            this._evalBlock(instr.then, thenStack);
29502            if (this._failed) {
29503              break;
29504            }
29505            const elseStack = snapshot.slice();
29506            this._evalBlock(instr.otherwise, elseStack);
29507            if (this._failed) {
29508              break;
29509            }
29510            if (thenStack.length !== elseStack.length) {
29511              const zero = new PsConstNode(0);
29512              while (thenStack.length < elseStack.length) {
29513                thenStack.push(zero);
29514              }
29515              while (elseStack.length < thenStack.length) {
29516                elseStack.push(zero);
29517              }
29518            }
29519            stack.length = 0;
29520            for (let i = 0; i < thenStack.length; i++) {
29521              stack.push(this._makeTernary(cond, thenStack[i], elseStack[i]));
29522            }
29523            break;
29524          }
29525      }
29526    }
29527  }
29528  _evalOp(op, stack) {
29529    if (PSStackToTree.#binaryOps.has(op)) {
29530      if (stack.length < 2) {
29531        this._failed = true;
29532        return;
29533      }
29534      const first = stack.pop();
29535      const second = stack.pop();
29536      stack.push(this._makeBinary(op, first, second));
29537      return;
29538    }
29539    if (PSStackToTree.#unaryOps.has(op)) {
29540      if (stack.length < 1) {
29541        this._failed = true;
29542        return;
29543      }
29544      stack.push(this._makeUnary(op, stack.pop()));
29545      return;
29546    }
29547    switch (op) {
29548      case TOKEN.true:
29549        stack.push(new PsConstNode(true));
29550        if (stack.length > MAX_STACK_SIZE) {
29551          this._failed = true;
29552        }
29553        break;
29554      case TOKEN.false:
29555        stack.push(new PsConstNode(false));
29556        if (stack.length > MAX_STACK_SIZE) {
29557          this._failed = true;
29558        }
29559        break;
29560      case TOKEN.dup:
29561        if (stack.length < 1) {
29562          this._failed = true;
29563          break;
29564        }
29565        stack.push(stack.at(-1));
29566        if (stack.length > MAX_STACK_SIZE) {
29567          this._failed = true;
29568        }
29569        break;
29570      case TOKEN.exch:
29571        {
29572          if (stack.length < 2) {
29573            this._failed = true;
29574            break;
29575          }
29576          const a = stack.pop();
29577          const b = stack.pop();
29578          stack.push(a, b);
29579          break;
29580        }
29581      case TOKEN.pop:
29582        if (stack.length < 1) {
29583          this._failed = true;
29584          break;
29585        }
29586        stack.pop();
29587        break;
29588      case TOKEN.copy:
29589        {
29590          if (stack.length < 1) {
29591            this._failed = true;
29592            break;
29593          }
29594          const nNode = stack.pop();
29595          if (nNode.type === PS_NODE.const) {
29596            const n = nNode.value | 0;
29597            if (n === 0) {} else if (n < 0 || n > stack.length) {
29598              this._failed = true;
29599            } else {
29600              stack.push(...stack.slice(-n));
29601              if (stack.length > MAX_STACK_SIZE) {
29602                this._failed = true;
29603              }
29604            }
29605          } else {
29606            this._failed = true;
29607          }
29608          break;
29609        }
29610      case TOKEN.index:
29611        {
29612          if (stack.length < 1) {
29613            this._failed = true;
29614            break;
29615          }
29616          const nNode = stack.pop();
29617          if (nNode.type === PS_NODE.const) {
29618            const n = nNode.value | 0;
29619            if (n < 0 || n >= stack.length) {
29620              this._failed = true;
29621            } else {
29622              stack.push(stack.at(-n - 1));
29623            }
29624          } else {
29625            this._failed = true;
29626          }
29627          break;
29628        }
29629      case TOKEN.roll:
29630        {
29631          if (stack.length < 2) {
29632            this._failed = true;
29633            break;
29634          }
29635          const jNode = stack.pop();
29636          const nNode = stack.pop();
29637          if (nNode.type === PS_NODE.const && jNode.type === PS_NODE.const) {
29638            const n = nNode.value | 0;
29639            if (n === 0) {} else if (n < 0 || n > stack.length) {
29640              this._failed = true;
29641            } else {
29642              const j = ((jNode.value | 0) % n + n) % n;
29643              if (j > 0) {
29644                const slice = stack.splice(-n, n);
29645                stack.push(...slice.slice(n - j), ...slice.slice(0, n - j));
29646              }
29647            }
29648          } else {
29649            this._failed = true;
29650          }
29651          break;
29652        }
29653      default:
29654        this._failed = true;
29655        break;
29656    }
29657  }
29658  _makeBinary(op, first, second) {
29659    if (first.type === PS_NODE.const && second.type === PS_NODE.const) {
29660      const v = _evalBinaryConst(op, second.value, first.value);
29661      if (v !== undefined) {
29662        return new PsConstNode(v);
29663      }
29664    }
29665    if (_nodesEqual(first, second)) {
29666      switch (op) {
29667        case TOKEN.sub:
29668          return new PsConstNode(0);
29669        case TOKEN.xor:
29670          return new PsConstNode(first.valueType === PS_VALUE_TYPE.boolean ? false : 0);
29671        case TOKEN.and:
29672        case TOKEN.or:
29673          return first;
29674        case TOKEN.min:
29675        case TOKEN.max:
29676          return first;
29677        case TOKEN.eq:
29678        case TOKEN.ge:
29679        case TOKEN.le:
29680          return new PsConstNode(true);
29681        case TOKEN.ne:
29682        case TOKEN.gt:
29683        case TOKEN.lt:
29684          return new PsConstNode(false);
29685      }
29686    }
29687    if (first.type === PS_NODE.const) {
29688      const b = first.value;
29689      switch (op) {
29690        case TOKEN.add:
29691          if (b === 0) {
29692            return second;
29693          }
29694          break;
29695        case TOKEN.sub:
29696          if (b === 0) {
29697            return second;
29698          }
29699          break;
29700        case TOKEN.mul:
29701          if (b === 1) {
29702            return second;
29703          }
29704          if (b === 0) {
29705            return first;
29706          }
29707          if (b === -1) {
29708            return this._makeUnary(TOKEN.neg, second);
29709          }
29710          break;
29711        case TOKEN.div:
29712          if (b !== 0) {
29713            return this._makeBinary(TOKEN.mul, new PsConstNode(1 / b), second);
29714          }
29715          break;
29716        case TOKEN.idiv:
29717          if (b === 1) {
29718            return second;
29719          }
29720          break;
29721        case TOKEN.exp:
29722          if (b === 1) {
29723            return second;
29724          }
29725          if (b === -1) {
29726            return this._makeBinary(TOKEN.div, second, new PsConstNode(1));
29727          }
29728          if (b === 0.5) {
29729            return this._makeUnary(TOKEN.sqrt, second);
29730          }
29731          if (b === 0.25) {
29732            const sqrtOnce = this._makeUnary(TOKEN.sqrt, second);
29733            return this._makeUnary(TOKEN.sqrt, sqrtOnce);
29734          }
29735          if (b === 2) {
29736            return this._makeBinary(TOKEN.mul, second, second);
29737          }
29738          if (b === 3) {
29739            return this._makeBinary(TOKEN.mul, this._makeBinary(TOKEN.mul, second, second), second);
29740          }
29741          if (b === 4) {
29742            const square = this._makeBinary(TOKEN.mul, second, second);
29743            return this._makeBinary(TOKEN.mul, square, square);
29744          }
29745          if (b === 0) {
29746            return new PsConstNode(1);
29747          }
29748          break;
29749        case TOKEN.and:
29750          if (b === true) {
29751            return second;
29752          }
29753          if (b === false) {
29754            return first;
29755          }
29756          break;
29757        case TOKEN.or:
29758          if (b === false) {
29759            return second;
29760          }
29761          if (b === true) {
29762            return first;
29763          }
29764          break;
29765        case TOKEN.min:
29766          if (second.type === PS_NODE.binary && second.op === TOKEN.max && second.first.type === PS_NODE.const && second.first.value >= b) {
29767            return first;
29768          }
29769          break;
29770        case TOKEN.max:
29771          if (second.type === PS_NODE.binary && second.op === TOKEN.min && second.first.type === PS_NODE.const && second.first.value <= b) {
29772            return first;
29773          }
29774          break;
29775      }
29776    }
29777    if (second.type === PS_NODE.const) {
29778      const a = second.value;
29779      switch (op) {
29780        case TOKEN.add:
29781          if (a === 0) {
29782            return first;
29783          }
29784          break;
29785        case TOKEN.sub:
29786          if (a === 0) {
29787            return this._makeUnary(TOKEN.neg, first);
29788          }
29789          break;
29790        case TOKEN.mul:
29791          if (a === 1) {
29792            return first;
29793          }
29794          if (a === 0) {
29795            return second;
29796          }
29797          if (a === -1) {
29798            return this._makeUnary(TOKEN.neg, first);
29799          }
29800          break;
29801        case TOKEN.and:
29802          if (a === true) {
29803            return first;
29804          }
29805          if (a === false) {
29806            return second;
29807          }
29808          break;
29809        case TOKEN.or:
29810          if (a === false) {
29811            return first;
29812          }
29813          if (a === true) {
29814            return second;
29815          }
29816          break;
29817      }
29818    }
29819    return new PsBinaryNode(op, first, second, _binaryValueType(op, first.valueType, second.valueType));
29820  }
29821  _makeUnary(op, operand) {
29822    if (operand.type === PS_NODE.const) {
29823      const v = _evalUnaryConst(op, operand.value);
29824      if (v !== undefined) {
29825        return new PsConstNode(v);
29826      }
29827    }
29828    if (op === TOKEN.not && operand.type === PS_NODE.binary) {
29829      const negated = PSStackToTree.#negatedComparison.get(operand.op);
29830      if (negated !== undefined) {
29831        return new PsBinaryNode(negated, operand.first, operand.second, PS_VALUE_TYPE.boolean);
29832      }
29833    }
29834    if (op === TOKEN.neg && operand.type === PS_NODE.binary && operand.op === TOKEN.sub) {
29835      return this._makeBinary(TOKEN.sub, operand.second, operand.first);
29836    }
29837    if (operand.type === PS_NODE.unary) {
29838      if (op === TOKEN.neg && operand.op === TOKEN.neg || op === TOKEN.not && operand.op === TOKEN.not) {
29839        return operand.operand;
29840      }
29841      if (op === TOKEN.abs && operand.op === TOKEN.neg) {
29842        return this._makeUnary(TOKEN.abs, operand.operand);
29843      }
29844      if (PSStackToTree.#idempotentUnary.has(op) && op === operand.op) {
29845        return operand;
29846      }
29847    }
29848    return new PsUnaryNode(op, operand, _unaryValueType(op, operand.valueType));
29849  }
29850  _makeTernary(cond, then, otherwise) {
29851    if (cond.type === PS_NODE.const) {
29852      return cond.value ? then : otherwise;
29853    }
29854    if (_nodesEqual(then, otherwise)) {
29855      return then;
29856    }
29857    if (then.type === PS_NODE.const && otherwise.type === PS_NODE.const) {
29858      if (then.value === true && otherwise.value === false) {
29859        return cond;
29860      }
29861      if (then.value === false && otherwise.value === true) {
29862        return this._makeUnary(TOKEN.not, cond);
29863      }
29864    }
29865    if (cond.type === PS_NODE.binary) {
29866      const {
29867        op: cop,
29868        first: cf,
29869        second: cs
29870      } = cond;
29871      if (cop === TOKEN.gt || cop === TOKEN.ge) {
29872        if (_nodesEqual(then, cf) && _nodesEqual(otherwise, cs)) {
29873          return this._makeBinary(TOKEN.min, cf, cs);
29874        }
29875        if (_nodesEqual(then, cs) && _nodesEqual(otherwise, cf)) {
29876          return this._makeBinary(TOKEN.max, cf, cs);
29877        }
29878      } else if (cop === TOKEN.lt || cop === TOKEN.le) {
29879        if (_nodesEqual(then, cf) && _nodesEqual(otherwise, cs)) {
29880          return this._makeBinary(TOKEN.max, cf, cs);
29881        }
29882        if (_nodesEqual(then, cs) && _nodesEqual(otherwise, cf)) {
29883          return this._makeBinary(TOKEN.min, cf, cs);
29884        }
29885      }
29886    }
29887    return new PsTernaryNode(cond, then, otherwise, then.valueType === otherwise.valueType ? then.valueType : PS_VALUE_TYPE.unknown);
29888  }
29889}
29890
29891;// ./src/core/postscript/js_evaluator.js
29892
29893
29894
29895const OP = {
29896  ARG: 0,
29897  CONST: 1,
29898  STORE: 2,
29899  IF: 3,
29900  JUMP: 4,
29901  ABS: 5,
29902  NEG: 6,
29903  CEIL: 7,
29904  FLOOR: 8,
29905  ROUND: 9,
29906  TRUNC: 10,
29907  NOT_B: 11,
29908  NOT_N: 12,
29909  SQRT: 13,
29910  SIN: 14,
29911  COS: 15,
29912  LN: 16,
29913  LOG10: 17,
29914  CVI: 18,
29915  SHIFT: 19,
29916  ADD: 20,
29917  SUB: 21,
29918  MUL: 22,
29919  DIV: 23,
29920  IDIV: 24,
29921  MOD: 25,
29922  POW: 26,
29923  EQ: 27,
29924  NE: 28,
29925  GT: 29,
29926  GE: 30,
29927  LT: 31,
29928  LE: 32,
29929  AND: 33,
29930  OR: 34,
29931  XOR: 35,
29932  ATAN: 36,
29933  MIN: 37,
29934  MAX: 38,
29935  TEE_TMP: 39,
29936  LOAD_TMP: 40
29937};
29938const _DEG_TO_RAD = Math.PI / 180;
29939const _RAD_TO_DEG = 180 / Math.PI;
29940class PsJsCompiler {
29941  static #stack = new Float64Array(64);
29942  static #tmp = new Float64Array(64);
29943  constructor(domain, range) {
29944    this.nIn = domain.length >> 1;
29945    this.nOut = range.length >> 1;
29946    this.range = range;
29947    this.ir = [];
29948    this._tmpMap = new Map();
29949    this._nextTmp = 0;
29950  }
29951  _compileNode(node) {
29952    if (node.shared) {
29953      const cached = this._tmpMap.get(node);
29954      if (cached !== undefined) {
29955        this.ir.push(OP.LOAD_TMP, cached);
29956        return true;
29957      }
29958      if (!this._compileNodeImpl(node)) {
29959        return false;
29960      }
29961      const slot = this._nextTmp++;
29962      this._tmpMap.set(node, slot);
29963      this.ir.push(OP.TEE_TMP, slot);
29964      return true;
29965    }
29966    return this._compileNodeImpl(node);
29967  }
29968  _compileNodeImpl(node) {
29969    switch (node.type) {
29970      case PS_NODE.arg:
29971        this.ir.push(OP.ARG, node.index);
29972        return true;
29973      case PS_NODE.const:
29974        {
29975          const v = node.value;
29976          this.ir.push(OP.CONST, typeof v === "boolean" ? Number(v) : v);
29977          return true;
29978        }
29979      case PS_NODE.unary:
29980        return this._compileUnary(node);
29981      case PS_NODE.binary:
29982        return this._compileBinary(node);
29983      case PS_NODE.ternary:
29984        return this._compileTernary(node);
29985      default:
29986        return false;
29987    }
29988  }
29989  _compileUnary(node) {
29990    const {
29991      op,
29992      operand,
29993      valueType
29994    } = node;
29995    if (op === TOKEN.cvr) {
29996      return this._compileNode(operand);
29997    }
29998    if (!this._compileNode(operand)) {
29999      return false;
30000    }
30001    switch (op) {
30002      case TOKEN.abs:
30003        this.ir.push(OP.ABS);
30004        break;
30005      case TOKEN.neg:
30006        this.ir.push(OP.NEG);
30007        break;
30008      case TOKEN.ceiling:
30009        this.ir.push(OP.CEIL);
30010        break;
30011      case TOKEN.floor:
30012        this.ir.push(OP.FLOOR);
30013        break;
30014      case TOKEN.round:
30015        this.ir.push(OP.ROUND);
30016        break;
30017      case TOKEN.truncate:
30018        this.ir.push(OP.TRUNC);
30019        break;
30020      case TOKEN.sqrt:
30021        this.ir.push(OP.SQRT);
30022        break;
30023      case TOKEN.sin:
30024        this.ir.push(OP.SIN);
30025        break;
30026      case TOKEN.cos:
30027        this.ir.push(OP.COS);
30028        break;
30029      case TOKEN.ln:
30030        this.ir.push(OP.LN);
30031        break;
30032      case TOKEN.log:
30033        this.ir.push(OP.LOG10);
30034        break;
30035      case TOKEN.cvi:
30036        this.ir.push(OP.CVI);
30037        break;
30038      case TOKEN.not:
30039        if (valueType === PS_VALUE_TYPE.boolean) {
30040          this.ir.push(OP.NOT_B);
30041        } else if (valueType === PS_VALUE_TYPE.numeric) {
30042          this.ir.push(OP.NOT_N);
30043        } else {
30044          return false;
30045        }
30046        break;
30047      default:
30048        return false;
30049    }
30050    return true;
30051  }
30052  _compileBinary(node) {
30053    const {
30054      op,
30055      first,
30056      second
30057    } = node;
30058    if (op === TOKEN.bitshift) {
30059      if (first.type !== PS_NODE.const || !Number.isInteger(first.value)) {
30060        return false;
30061      }
30062      if (!this._compileNode(second)) {
30063        return false;
30064      }
30065      this.ir.push(OP.SHIFT, first.value);
30066      return true;
30067    }
30068    if (!this._compileNode(second)) {
30069      return false;
30070    }
30071    if (!this._compileNode(first)) {
30072      return false;
30073    }
30074    switch (op) {
30075      case TOKEN.add:
30076        this.ir.push(OP.ADD);
30077        break;
30078      case TOKEN.sub:
30079        this.ir.push(OP.SUB);
30080        break;
30081      case TOKEN.mul:
30082        this.ir.push(OP.MUL);
30083        break;
30084      case TOKEN.div:
30085        this.ir.push(OP.DIV);
30086        break;
30087      case TOKEN.idiv:
30088        this.ir.push(OP.IDIV);
30089        break;
30090      case TOKEN.mod:
30091        this.ir.push(OP.MOD);
30092        break;
30093      case TOKEN.exp:
30094        this.ir.push(OP.POW);
30095        break;
30096      case TOKEN.eq:
30097        this.ir.push(OP.EQ);
30098        break;
30099      case TOKEN.ne:
30100        this.ir.push(OP.NE);
30101        break;
30102      case TOKEN.gt:
30103        this.ir.push(OP.GT);
30104        break;
30105      case TOKEN.ge:
30106        this.ir.push(OP.GE);
30107        break;
30108      case TOKEN.lt:
30109        this.ir.push(OP.LT);
30110        break;
30111      case TOKEN.le:
30112        this.ir.push(OP.LE);
30113        break;
30114      case TOKEN.and:
30115        this.ir.push(OP.AND);
30116        break;
30117      case TOKEN.or:
30118        this.ir.push(OP.OR);
30119        break;
30120      case TOKEN.xor:
30121        this.ir.push(OP.XOR);
30122        break;
30123      case TOKEN.atan:
30124        this.ir.push(OP.ATAN);
30125        break;
30126      case TOKEN.min:
30127        this.ir.push(OP.MIN);
30128        break;
30129      case TOKEN.max:
30130        this.ir.push(OP.MAX);
30131        break;
30132      default:
30133        return false;
30134    }
30135    return true;
30136  }
30137  _compileTernary(node) {
30138    if (!this._compileNode(node.cond)) {
30139      return false;
30140    }
30141    this.ir.push(OP.IF, 0);
30142    const ifPatch = this.ir.length - 1;
30143    if (!this._compileNode(node.then)) {
30144      return false;
30145    }
30146    this.ir.push(OP.JUMP, 0);
30147    const jumpPatch = this.ir.length - 1;
30148    this.ir[ifPatch] = this.ir.length;
30149    if (!this._compileNode(node.otherwise)) {
30150      return false;
30151    }
30152    this.ir[jumpPatch] = this.ir.length;
30153    return true;
30154  }
30155  compile(program) {
30156    const outputs = new PSStackToTree().evaluate(program, this.nIn);
30157    if (!outputs || outputs.length < this.nOut) {
30158      return null;
30159    }
30160    for (let i = 0; i < this.nOut; i++) {
30161      if (!this._compileNode(outputs[i])) {
30162        return null;
30163      }
30164      const min = this.range[i * 2];
30165      const max = this.range[i * 2 + 1];
30166      this.ir.push(OP.STORE, i, min, max);
30167    }
30168    return new Float64Array(this.ir);
30169  }
30170  static execute(ir, src, srcOffset, dest, destOffset) {
30171    let ip = 0,
30172      sp = 0;
30173    const n = ir.length;
30174    const stack = this.#stack;
30175    const tmp = this.#tmp;
30176    while (ip < n) {
30177      switch (ir[ip++] | 0) {
30178        case OP.ARG:
30179          stack[sp++] = src[srcOffset + (ir[ip++] | 0)];
30180          break;
30181        case OP.CONST:
30182          stack[sp++] = ir[ip++];
30183          break;
30184        case OP.STORE:
30185          {
30186            const slot = ir[ip++] | 0;
30187            const min = ir[ip++];
30188            const max = ir[ip++];
30189            dest[destOffset + slot] = MathClamp(stack[--sp], min, max);
30190            break;
30191          }
30192        case OP.IF:
30193          {
30194            const tgt = ir[ip++];
30195            if (stack[--sp] === 0) {
30196              ip = tgt;
30197            }
30198            break;
30199          }
30200        case OP.JUMP:
30201          ip = ir[ip];
30202          break;
30203        case OP.ABS:
30204          stack[sp - 1] = Math.abs(stack[sp - 1]);
30205          break;
30206        case OP.NEG:
30207          stack[sp - 1] = -stack[sp - 1];
30208          break;
30209        case OP.CEIL:
30210          stack[sp - 1] = Math.ceil(stack[sp - 1]);
30211          break;
30212        case OP.FLOOR:
30213          stack[sp - 1] = Math.floor(stack[sp - 1]);
30214          break;
30215        case OP.ROUND:
30216          stack[sp - 1] = Math.floor(stack[sp - 1] + 0.5);
30217          break;
30218        case OP.TRUNC:
30219          stack[sp - 1] = Math.trunc(stack[sp - 1]);
30220          break;
30221        case OP.NOT_B:
30222          stack[sp - 1] = stack[sp - 1] !== 0 ? 0 : 1;
30223          break;
30224        case OP.NOT_N:
30225          stack[sp - 1] = ~(stack[sp - 1] | 0);
30226          break;
30227        case OP.SQRT:
30228          stack[sp - 1] = Math.sqrt(stack[sp - 1]);
30229          break;
30230        case OP.SIN:
30231          stack[sp - 1] = Math.sin(stack[sp - 1] % 360 * _DEG_TO_RAD);
30232          break;
30233        case OP.COS:
30234          stack[sp - 1] = Math.cos(stack[sp - 1] % 360 * _DEG_TO_RAD);
30235          break;
30236        case OP.LN:
30237          stack[sp - 1] = Math.log(stack[sp - 1]);
30238          break;
30239        case OP.LOG10:
30240          stack[sp - 1] = Math.log10(stack[sp - 1]);
30241          break;
30242        case OP.CVI:
30243          stack[sp - 1] = Math.trunc(stack[sp - 1]) | 0;
30244          break;
30245        case OP.SHIFT:
30246          {
30247            const amt = ir[ip++];
30248            const v = stack[sp - 1] | 0;
30249            if (amt > 0) {
30250              stack[sp - 1] = v << amt;
30251            } else if (amt < 0) {
30252              stack[sp - 1] = v >> -amt;
30253            } else {
30254              stack[sp - 1] = v;
30255            }
30256            break;
30257          }
30258        case OP.ADD:
30259          {
30260            const b = stack[--sp];
30261            stack[sp - 1] += b;
30262            break;
30263          }
30264        case OP.SUB:
30265          {
30266            const b = stack[--sp];
30267            stack[sp - 1] -= b;
30268            break;
30269          }
30270        case OP.MUL:
30271          {
30272            const b = stack[--sp];
30273            stack[sp - 1] *= b;
30274            break;
30275          }
30276        case OP.DIV:
30277          {
30278            const b = stack[--sp];
30279            stack[sp - 1] = b !== 0 ? stack[sp - 1] / b : 0;
30280            break;
30281          }
30282        case OP.IDIV:
30283          {
30284            const b = stack[--sp];
30285            stack[sp - 1] = b !== 0 ? Math.trunc(stack[sp - 1] / b) : 0;
30286            break;
30287          }
30288        case OP.MOD:
30289          {
30290            const b = stack[--sp];
30291            stack[sp - 1] = b !== 0 ? stack[sp - 1] % b : 0;
30292            break;
30293          }
30294        case OP.POW:
30295          {
30296            const b = stack[--sp];
30297            stack[sp - 1] **= b;
30298            break;
30299          }
30300        case OP.EQ:
30301          {
30302            const b = stack[--sp];
30303            stack[sp - 1] = stack[sp - 1] === b ? 1 : 0;
30304            break;
30305          }
30306        case OP.NE:
30307          {
30308            const b = stack[--sp];
30309            stack[sp - 1] = stack[sp - 1] !== b ? 1 : 0;
30310            break;
30311          }
30312        case OP.GT:
30313          {
30314            const b = stack[--sp];
30315            stack[sp - 1] = stack[sp - 1] > b ? 1 : 0;
30316            break;
30317          }
30318        case OP.GE:
30319          {
30320            const b = stack[--sp];
30321            stack[sp - 1] = stack[sp - 1] >= b ? 1 : 0;
30322            break;
30323          }
30324        case OP.LT:
30325          {
30326            const b = stack[--sp];
30327            stack[sp - 1] = stack[sp - 1] < b ? 1 : 0;
30328            break;
30329          }
30330        case OP.LE:
30331          {
30332            const b = stack[--sp];
30333            stack[sp - 1] = stack[sp - 1] <= b ? 1 : 0;
30334            break;
30335          }
30336        case OP.AND:
30337          {
30338            const b = stack[--sp] | 0;
30339            stack[sp - 1] = (stack[sp - 1] | 0) & b;
30340            break;
30341          }
30342        case OP.OR:
30343          {
30344            const b = stack[--sp] | 0;
30345            stack[sp - 1] = stack[sp - 1] | 0 | b;
30346            break;
30347          }
30348        case OP.XOR:
30349          {
30350            const b = stack[--sp] | 0;
30351            stack[sp - 1] = (stack[sp - 1] | 0) ^ b;
30352            break;
30353          }
30354        case OP.ATAN:
30355          {
30356            const b = stack[--sp];
30357            const deg = Math.atan2(stack[sp - 1], b) * _RAD_TO_DEG;
30358            stack[sp - 1] = deg < 0 ? deg + 360 : deg;
30359            break;
30360          }
30361        case OP.MIN:
30362          {
30363            const b = stack[--sp];
30364            stack[sp - 1] = Math.min(stack[sp - 1], b);
30365            break;
30366          }
30367        case OP.MAX:
30368          {
30369            const b = stack[--sp];
30370            stack[sp - 1] = Math.max(stack[sp - 1], b);
30371            break;
30372          }
30373        case OP.TEE_TMP:
30374          tmp[ir[ip++] | 0] = stack[sp - 1];
30375          break;
30376        case OP.LOAD_TMP:
30377          stack[sp++] = tmp[ir[ip++] | 0];
30378          break;
30379      }
30380    }
30381  }
30382}
30383class PSStackBasedInterpreter {
30384  static #stack = new Float64Array(100);
30385  static #sp = 0;
30386  static #push(v) {
30387    if (this.#sp < this.#stack.length) {
30388      this.#stack[this.#sp++] = v;
30389    }
30390  }
30391  static #execOp(op) {
30392    const stack = this.#stack;
30393    switch (op) {
30394      case TOKEN.true:
30395        this.#push(1);
30396        break;
30397      case TOKEN.false:
30398        this.#push(0);
30399        break;
30400      case TOKEN.abs:
30401        stack[this.#sp - 1] = Math.abs(stack[this.#sp - 1]);
30402        break;
30403      case TOKEN.neg:
30404        stack[this.#sp - 1] = -stack[this.#sp - 1];
30405        break;
30406      case TOKEN.ceiling:
30407        stack[this.#sp - 1] = Math.ceil(stack[this.#sp - 1]);
30408        break;
30409      case TOKEN.floor:
30410        stack[this.#sp - 1] = Math.floor(stack[this.#sp - 1]);
30411        break;
30412      case TOKEN.round:
30413        stack[this.#sp - 1] = Math.floor(stack[this.#sp - 1] + 0.5);
30414        break;
30415      case TOKEN.truncate:
30416        stack[this.#sp - 1] = Math.trunc(stack[this.#sp - 1]);
30417        break;
30418      case TOKEN.sqrt:
30419        stack[this.#sp - 1] = Math.sqrt(stack[this.#sp - 1]);
30420        break;
30421      case TOKEN.sin:
30422        stack[this.#sp - 1] = Math.sin(stack[this.#sp - 1] % 360 * _DEG_TO_RAD);
30423        break;
30424      case TOKEN.cos:
30425        stack[this.#sp - 1] = Math.cos(stack[this.#sp - 1] % 360 * _DEG_TO_RAD);
30426        break;
30427      case TOKEN.ln:
30428        stack[this.#sp - 1] = Math.log(stack[this.#sp - 1]);
30429        break;
30430      case TOKEN.log:
30431        stack[this.#sp - 1] = Math.log10(stack[this.#sp - 1]);
30432        break;
30433      case TOKEN.cvi:
30434        stack[this.#sp - 1] = Math.trunc(stack[this.#sp - 1]) | 0;
30435        break;
30436      case TOKEN.cvr:
30437        break;
30438      case TOKEN.not:
30439        {
30440          const v = stack[this.#sp - 1];
30441          stack[this.#sp - 1] = v === 0 || v === 1 ? 1 - v : ~(v | 0);
30442          break;
30443        }
30444      case TOKEN.add:
30445        {
30446          const b = stack[--this.#sp];
30447          stack[this.#sp - 1] += b;
30448          break;
30449        }
30450      case TOKEN.sub:
30451        {
30452          const b = stack[--this.#sp];
30453          stack[this.#sp - 1] -= b;
30454          break;
30455        }
30456      case TOKEN.mul:
30457        {
30458          const b = stack[--this.#sp];
30459          stack[this.#sp - 1] *= b;
30460          break;
30461        }
30462      case TOKEN.div:
30463        {
30464          const b = stack[--this.#sp];
30465          stack[this.#sp - 1] = b !== 0 ? stack[this.#sp - 1] / b : 0;
30466          break;
30467        }
30468      case TOKEN.idiv:
30469        {
30470          const b = stack[--this.#sp];
30471          stack[this.#sp - 1] = b !== 0 ? Math.trunc(stack[this.#sp - 1] / b) : 0;
30472          break;
30473        }
30474      case TOKEN.mod:
30475        {
30476          const b = stack[--this.#sp];
30477          stack[this.#sp - 1] = b !== 0 ? stack[this.#sp - 1] % b : 0;
30478          break;
30479        }
30480      case TOKEN.exp:
30481        {
30482          const b = stack[--this.#sp];
30483          stack[this.#sp - 1] **= b;
30484          break;
30485        }
30486      case TOKEN.atan:
30487        {
30488          const dx = stack[--this.#sp];
30489          const deg = Math.atan2(stack[this.#sp - 1], dx) * _RAD_TO_DEG;
30490          stack[this.#sp - 1] = deg < 0 ? deg + 360 : deg;
30491          break;
30492        }
30493      case TOKEN.eq:
30494        {
30495          const b = stack[--this.#sp];
30496          stack[this.#sp - 1] = stack[this.#sp - 1] === b ? 1 : 0;
30497          break;
30498        }
30499      case TOKEN.ne:
30500        {
30501          const b = stack[--this.#sp];
30502          stack[this.#sp - 1] = stack[this.#sp - 1] !== b ? 1 : 0;
30503          break;
30504        }
30505      case TOKEN.gt:
30506        {
30507          const b = stack[--this.#sp];
30508          stack[this.#sp - 1] = stack[this.#sp - 1] > b ? 1 : 0;
30509          break;
30510        }
30511      case TOKEN.ge:
30512        {
30513          const b = stack[--this.#sp];
30514          stack[this.#sp - 1] = stack[this.#sp - 1] >= b ? 1 : 0;
30515          break;
30516        }
30517      case TOKEN.lt:
30518        {
30519          const b = stack[--this.#sp];
30520          stack[this.#sp - 1] = stack[this.#sp - 1] < b ? 1 : 0;
30521          break;
30522        }
30523      case TOKEN.le:
30524        {
30525          const b = stack[--this.#sp];
30526          stack[this.#sp - 1] = stack[this.#sp - 1] <= b ? 1 : 0;
30527          break;
30528        }
30529      case TOKEN.and:
30530        {
30531          const b = stack[--this.#sp] | 0;
30532          stack[this.#sp - 1] = (stack[this.#sp - 1] | 0) & b;
30533          break;
30534        }
30535      case TOKEN.or:
30536        {
30537          const b = stack[--this.#sp] | 0;
30538          stack[this.#sp - 1] = stack[this.#sp - 1] | 0 | b;
30539          break;
30540        }
30541      case TOKEN.xor:
30542        {
30543          const b = stack[--this.#sp] | 0;
30544          stack[this.#sp - 1] = (stack[this.#sp - 1] | 0) ^ b;
30545          break;
30546        }
30547      case TOKEN.bitshift:
30548        {
30549          const amt = stack[--this.#sp] | 0;
30550          const v = stack[this.#sp - 1] | 0;
30551          stack[this.#sp - 1] = amt > 0 ? v << amt : v >> -amt;
30552          break;
30553        }
30554      case TOKEN.min:
30555        {
30556          const b = stack[--this.#sp];
30557          stack[this.#sp - 1] = Math.min(stack[this.#sp - 1], b);
30558          break;
30559        }
30560      case TOKEN.max:
30561        {
30562          const b = stack[--this.#sp];
30563          stack[this.#sp - 1] = Math.max(stack[this.#sp - 1], b);
30564          break;
30565        }
30566      case TOKEN.dup:
30567        this.#push(stack[this.#sp - 1]);
30568        break;
30569      case TOKEN.exch:
30570        {
30571          const a = stack[--this.#sp];
30572          const b = stack[--this.#sp];
30573          this.#push(a);
30574          this.#push(b);
30575          break;
30576        }
30577      case TOKEN.pop:
30578        this.#sp--;
30579        break;
30580      case TOKEN.copy:
30581        {
30582          const n = Math.trunc(stack[--this.#sp]);
30583          const base = this.#sp - n;
30584          for (let k = 0; k < n; k++) {
30585            this.#push(stack[base + k]);
30586          }
30587          break;
30588        }
30589      case TOKEN.index:
30590        {
30591          const i = Math.trunc(stack[--this.#sp]);
30592          this.#push(stack[this.#sp - 1 - i]);
30593          break;
30594        }
30595      case TOKEN.roll:
30596        {
30597          const j = Math.trunc(stack[--this.#sp]);
30598          const n = Math.trunc(stack[--this.#sp]);
30599          if (n > 1 && j !== 0) {
30600            const mod = (j % n + n) % n;
30601            if (mod !== 0) {
30602              const base = this.#sp - n;
30603              const sub = stack.slice(base, this.#sp);
30604              for (let k = 0; k < n; k++) {
30605                stack[base + k] = sub[(k - mod + n) % n];
30606              }
30607            }
30608          }
30609          break;
30610        }
30611    }
30612  }
30613  static #execBlock(instructions) {
30614    for (const instr of instructions) {
30615      switch (instr.type) {
30616        case PS_NODE.number:
30617          this.#push(instr.value);
30618          break;
30619        case PS_NODE.operator:
30620          this.#execOp(instr.op);
30621          break;
30622        case PS_NODE.if:
30623          if (this.#stack[--this.#sp] !== 0) {
30624            this.#execBlock(instr.then.instructions);
30625          }
30626          break;
30627        case PS_NODE.ifelse:
30628          if (this.#stack[--this.#sp] !== 0) {
30629            this.#execBlock(instr.then.instructions);
30630          } else {
30631            this.#execBlock(instr.otherwise.instructions);
30632          }
30633          break;
30634      }
30635    }
30636  }
30637  static build(program, domain, range) {
30638    const nIn = domain.length >> 1;
30639    const nOut = range.length >> 1;
30640    const {
30641      instructions
30642    } = program.body;
30643    return (src, srcOffset, dest, destOffset) => {
30644      this.#sp = 0;
30645      for (let i = 0; i < nIn; i++) {
30646        this.#push(src[srcOffset + i]);
30647      }
30648      this.#execBlock(instructions);
30649      const base = this.#sp - nOut;
30650      for (let i = 0; i < nOut; i++) {
30651        const v = base + i >= 0 ? this.#stack[base + i] : 0;
30652        dest[destOffset + i] = MathClamp(
30652range[i * 2 + 1], range[i * 2], v);
30653      }
30654    };
30655  }
30656}
30657function buildPostScriptJsFunction(source, domain, range, forceInterpreter = false) {
30658  const program = parsePostScriptFunction(source);
30659  const ir = !forceInterpreter && new PsJsCompiler(domain, range).compile(program);
30660  if (ir) {
30661    return (src, srcOffset, dest, destOffset) => {
30662      PsJsCompiler.execute(ir, src, srcOffset, dest, destOffset);
30663    };
30664  }
30665  return PSStackBasedInterpreter.build(program, domain, range);
30666}
30667
30668;// ./src/core/postscript/wasm_compiler.js
30669
30670
30671const wasm_compiler_OP = {
30672  if: 0x04,
30673  else: 0x05,
30674  end: 0x0b,
30675  select: 0x1b,
30676  call: 0x10,
30677  local_get: 0x20,
30678  local_set: 0x21,
30679  local_tee: 0x22,
30680  i32_const: 0x41,
30681  i32_eqz: 0x45,
30682  i32_and: 0x71,
30683  i32_or: 0x72,
30684  i32_xor: 0x73,
30685  i32_shl: 0x74,
30686  i32_shr_s: 0x75,
vendor: 4,156 bytes, lines 30687-30817
30687  i32_trunc_f64_s: 0xaa,
30688  f64_const: 0x44,
30689  f64_eq: 0x61,
30690  f64_ne: 0x62,
30691  f64_lt: 0x63,
30692  f64_gt: 0x64,
30693  f64_le: 0x65,
30694  f64_ge: 0x66,
30695  f64_abs: 0x99,
30696  f64_neg: 0x9a,
30697  f64_ceil: 0x9b,
30698  f64_floor: 0x9c,
30699  f64_trunc: 0x9d,
30700  f64_nearest: 0x9e,
30701  f64_sqrt: 0x9f,
30702  f64_add: 0xa0,
30703  f64_sub: 0xa1,
30704  f64_mul: 0xa2,
30705  f64_div: 0xa3,
30706  f64_min: 0xa4,
30707  f64_max: 0xa5,
30708  f64_convert_i32_s: 0xb7,
30709  f64_store: 0x39
30710};
30711const FUNC_TYPE = 0x60;
30712const F64 = 0x7c;
30713const SECTION = {
30714  type: 0x01,
30715  import: 0x02,
30716  function: 0x03,
30717  memory: 0x05,
30718  export: 0x07,
30719  code: 0x0a
30720};
30721const EXTERN_FUNC = 0x00;
30722const EXTERN_MEM = 0x02;
30723function unsignedLEB128(n) {
30724  const out = [];
30725  do {
30726    let byte = n & 0x7f;
30727    n >>>= 7;
30728    if (n !== 0) {
30729      byte |= 0x80;
30730    }
30731    out.push(byte);
30732  } while (n !== 0);
30733  return out;
30734}
30735function encodeASCIIString(s) {
30736  return [...unsignedLEB128(s.length), ...Array.from(s, c => c.charCodeAt(0))];
30737}
30738function section(id, data) {
30739  return [id, ...unsignedLEB128(data.length), ...data];
30740}
30741function vec(items) {
30742  const out = unsignedLEB128(items.length);
30743  for (const item of items) {
30744    if (typeof item === "number") {
30745      out.push(item);
30746      continue;
30747    }
30748    for (const byte of item) {
30749      out.push(byte);
30750    }
30751  }
30752  return out;
30753}
30754const MATH_IMPORTS = [["sin", "Math", "sin", [F64], [F64]], ["cos", "Math", "cos", [F64], [F64]], ["atan2", "Math", "atan2", [F64, F64], [F64]], ["log", "Math", "log", [F64], [F64]], ["log10", "Math", "log10", [F64], [F64]], ["pow", "Math", "pow", [F64, F64], [F64]]];
30755const _mathImportObject = {
30756  Math: Object.fromEntries(MATH_IMPORTS.map(([name]) => [name, Math[name]]))
30757};
30758class PsWasmCompiler {
30759  static #initialized = false;
30760  static #comparisonToOp = null;
30761  static #importIdx = null;
30762  static #degToRad = 0;
30763  static #radToDeg = 0;
30764  static #importTypeEntries = null;
30765  static #importSection = null;
30766  static #functionSection = null;
30767  static #memorySection = null;
30768  static #exportSection = null;
30769  static #wasmMagicVersion = null;
30770  static #f64View = null;
30771  static #f64Arr = null;
30772  static #init() {
30773    this.#comparisonToOp = new Map([[TOKEN.eq, wasm_compiler_OP.f64_eq], [TOKEN.ne, wasm_compiler_OP.f64_ne], [TOKEN.lt, wasm_compiler_OP.f64_lt], [TOKEN.le, wasm_compiler_OP.f64_le], [TOKEN.gt, wasm_compiler_OP.f64_gt], [TOKEN.ge, wasm_compiler_OP.f64_ge]]);
30774    this.#importIdx = Object.create(null);
30775    for (let i = 0; i < MATH_IMPORTS.length; i++) {
30776      this.#importIdx[MATH_IMPORTS[i][0]] = i;
30777    }
30778    this.#degToRad = Math.PI / 180;
30779    this.#radToDeg = 180 / Math.PI;
30780    this.#importTypeEntries = MATH_IMPORTS.map(([,,, params, results]) => [FUNC_TYPE, ...vec(params), ...vec(results)]);
30781    this.#importSection = new Uint8Array(section(SECTION.import, vec(MATH_IMPORTS.map(([, mod, field], i) => [...encodeASCIIString(mod), ...encodeASCIIString(field), EXTERN_FUNC, ...unsignedLEB128(i + 1)]))));
30782    this.#functionSection = new Uint8Array(section(SECTION.function, vec([[0]])));
30783    this.#memorySection = new Uint8Array(section(SECTION.memory, vec([[0x00, 0x01]])));
30784    this.#exportSection = new Uint8Array(section(SECTION.export, vec([[...encodeASCIIString("fn"), EXTERN_FUNC, ...unsignedLEB128(MATH_IMPORTS.length)], [...encodeASCIIString("mem"), EXTERN_MEM, 0x00]])));
30785    this.#wasmMagicVersion = new Uint8Array([0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00]);
30786    const f64Buf = new ArrayBuffer(8);
30787    this.#f64View = new DataView(f64Buf);
30788    this.#f64Arr = new Uint8Array(f64Buf);
30789    this.#initialized = true;
30790  }
30791  constructor(domain, range) {
30792    if (!PsWasmCompiler.#initialized) {
30793      PsWasmCompiler.#init();
30794    }
30795    this._nIn = domain.length >> 1;
30796    this._nOut = range.length >> 1;
30797    this._range = range;
30798    this._code = [];
30799    this._nextLocal = this._nIn;
30800    this._freeLocals = [];
30801    this._sharedLocals = new Map();
30802  }
30803  _allocLocal() {
30804    return this._freeLocals.pop() ?? this._nextLocal++;
30805  }
30806  _releaseLocal(idx) {
30807    this._freeLocals.push(idx);
30808  }
30809  _emitULEB128(n) {
30810    do {
30811      let b = n & 0x7f;
30812      n >>>= 7;
30813      if (n !== 0) {
30814        b |= 0x80;
30815      }
30816      this._code.push(b);
30817    } while (n !== 0);
vendor: 6,123 bytes, lines 30817-31027
30817
30818  }
30819  _emitF64Const(value) {
30820    this._code.push(wasm_compiler_OP.f64_const);
30821    PsWasmCompiler.#f64View.setFloat64(0, value, true);
30822    for (let i = 0; i < 8; i++) {
30823      this._code.push(PsWasmCompiler.#f64Arr[i]);
30824    }
30825  }
30826  _emitLocalGet(idx) {
30827    this._code.push(wasm_compiler_OP.local_get);
30828    this._emitULEB128(idx);
30829  }
30830  _emitLocalSet(idx) {
30831    this._code.push(wasm_compiler_OP.local_set);
30832    this._emitULEB128(idx);
30833  }
30834  _emitLocalTee(idx) {
30835    this._code.push(wasm_compiler_OP.local_tee);
30836    this._emitULEB128(idx);
30837  }
30838  _compileNode(node) {
30839    if (node.shared) {
30840      const entry = this._sharedLocals.get(node);
30841      if (entry !== undefined) {
30842        this._emitLocalGet(entry.local);
30843        if (--entry.remaining === 0) {
30844          this._releaseLocal(entry.local);
30845        }
30846        return true;
30847      }
30848      if (!this._compileNodeImpl(node)) {
30849        return false;
30850      }
30851      const local = this._allocLocal();
30852      this._sharedLocals.set(node, {
30853        local,
30854        remaining: node.sharedCount - 1
30855      });
30856      this._emitLocalTee(local);
30857      return true;
30858    }
30859    return this._compileNodeImpl(node);
30860  }
30861  _compileNodeImpl(node) {
30862    switch (node.type) {
30863      case PS_NODE.arg:
30864        this._emitLocalGet(node.index);
30865        return true;
30866      case PS_NODE.const:
30867        {
30868          let v = node.value;
30869          if (typeof v === "boolean") {
30870            v = v ? 1 : 0;
30871          }
30872          this._emitF64Const(v);
30873          return true;
30874        }
30875      case PS_NODE.unary:
30876        return this._compileUnaryNode(node);
30877      case PS_NODE.binary:
30878        return this._compileBinaryNode(node);
30879      case PS_NODE.ternary:
30880        return this._compileTernaryNode(node);
30881      default:
30882        return false;
30883    }
30884  }
30885  _compileSinCosNode(node) {
30886    const local = this._allocLocal();
30887    try {
30888      if (!this._compileNode(node.operand)) {
30889        return false;
30890      }
30891      const code = this._code;
30892      this._emitLocalSet(local);
30893      this._emitLocalGet(local);
30894      this._emitLocalGet(local);
30895      this._emitF64Const(360);
30896      code.push(wasm_compiler_OP.f64_div, wasm_compiler_OP.f64_trunc);
30897      this._emitF64Const(360);
30898      code.push(wasm_compiler_OP.f64_mul, wasm_compiler_OP.f64_sub);
30899      this._emitF64Const(PsWasmCompiler.#degToRad);
30900      code.push(wasm_compiler_OP.f64_mul, wasm_compiler_OP.call);
30901      this._emitULEB128(PsWasmCompiler.#importIdx[node.op === TOKEN.sin ? "sin" : "cos"]);
30902      return true;
30903    } finally {
30904      this._releaseLocal(local);
30905    }
30906  }
30907  _compileUnaryNode(node) {
30908    const code = this._code;
30909    if (node.op === TOKEN.sin || node.op === TOKEN.cos) {
30910      return this._compileSinCosNode(node);
30911    }
30912    if (node.op === TOKEN.not) {
30913      if (node.valueType === PS_VALUE_TYPE.boolean) {
30914        if (!this._compileNodeAsBoolI32(node.operand)) {
30915          return false;
30916        }
30917        code.push(wasm_compiler_OP.i32_eqz, wasm_compiler_OP.f64_convert_i32_s);
30918        return true;
30919      }
30920      if (node.valueType === PS_VALUE_TYPE.numeric) {
30921        if (!this._compileNode(node.operand)) {
30922          return false;
30923        }
30924        code.push(wasm_compiler_OP.i32_trunc_f64_s, wasm_compiler_OP.i32_const, 0x7f, wasm_compiler_OP.i32_xor, wasm_compiler_OP.f64_convert_i32_s);
30925        return true;
30926      }
30927      return false;
30928    }
30929    if (!this._compileNode(node.operand)) {
30930      return false;
30931    }
30932    switch (node.op) {
30933      case TOKEN.abs:
30934        code.push(wasm_compiler_OP.f64_abs);
30935        break;
30936      case TOKEN.neg:
30937        code.push(wasm_compiler_OP.f64_neg);
30938        break;
30939      case TOKEN.sqrt:
30940        code.push(wasm_compiler_OP.f64_sqrt);
30941        break;
30942      case TOKEN.floor:
30943        code.push(wasm_compiler_OP.f64_floor);
30944        break;
30945      case TOKEN.ceiling:
30946        code.push(wasm_compiler_OP.f64_ceil);
30947        break;
30948      case TOKEN.round:
30949        this._emitF64Const(0.5);
30950        code.push(wasm_compiler_OP.f64_add, wasm_compiler_OP.f64_floor);
30951        break;
30952      case TOKEN.truncate:
30953        code.push(wasm_compiler_OP.f64_trunc);
30954        break;
30955      case TOKEN.cvi:
30956        code.push(wasm_compiler_OP.i32_trunc_f64_s, wasm_compiler_OP.f64_convert_i32_s);
30957        break;
30958      case TOKEN.cvr:
30959        break;
30960      case TOKEN.ln:
30961        code.push(wasm_compiler_OP.call);
30962        this._emitULEB128(PsWasmCompiler.#importIdx.log);
30963        break;
30964      case TOKEN.log:
30965        code.push(wasm_compiler_OP.call);
30966        this._emitULEB128(PsWasmCompiler.#importIdx.log10);
30967        break;
30968      default:
30969        return false;
30970    }
30971    return true;
30972  }
30973  _compileSafeDivNode(first, second) {
30974    const tmp = this._allocLocal();
30975    try {
30976      if (!this._compileNode(second)) {
30977        return false;
30978      }
30979      if (!this._compileNode(first)) {
30980        return false;
30981      }
30982      const code = this._code;
30983      this._emitLocalTee(tmp);
30984      code.push(wasm_compiler_OP.f64_div);
30985      this._emitF64Const(0);
30986      this._emitLocalGet(tmp);
30987      this._emitF64Const(0);
30988      code.push(wasm_compiler_OP.f64_ne, wasm_compiler_OP.select);
30989      return true;
30990    } finally {
30991      this._releaseLocal(tmp);
30992    }
30993  }
30994  _compileSafeIdivNode(first, second) {
30995    const tmp = this._allocLocal();
30996    try {
30997      if (!this._compileNode(second)) {
30998        return false;
30999      }
31000      if (!this._compileNode(first)) {
31001        return false;
31002      }
31003      const code = this._code;
31004      this._emitLocalTee(tmp);
31005      code.push(wasm_compiler_OP.f64_div, wasm_compiler_OP.f64_trunc);
31006      this._emitF64Const(0);
31007      this._emitLocalGet(tmp);
31008      this._emitF64Const(0);
31009      code.push(wasm_compiler_OP.f64_ne, wasm_compiler_OP.select);
31010      return true;
31011    } finally {
31012      this._releaseLocal(tmp);
31013    }
31014  }
31015  _compileBitshiftNode(first, second) {
31016    if (first.type !== PS_NODE.const || !Number.isInteger(first.value)) {
31017      return false;
31018    }
31019    if (!this._compileNode(second)) {
31020      return false;
31021    }
31022    const code = this._code;
31023    code.push(wasm_compiler_OP.i32_trunc_f64_s);
31024    const shift = first.value;
31025    if (shift > 0) {
31026      code.push(wasm_compiler_OP.i32_const);
31027      this._emit
31027ULEB128(shift);
31028      code.push(wasm_compiler_OP.i32_shl);
31029    } else if (shift < 0) {
31030      code.push(wasm_compiler_OP.i32_const);
31031      this._emitU
vendor: 8,478 bytes, lines 31031-31312
31031LEB128(-shift);
31032      code.push(wasm_compiler_OP.i32_shr_s);
31033    }
31034    code.push(wasm_compiler_OP.f64_convert_i32_s);
31035    return true;
31036  }
31037  _compileModNode(first, second) {
31038    if (first.type === PS_NODE.const && first.value === 0) {
31039      if (!this._compileNode(second)) {
31040        return false;
31041      }
31042      this._code.push(wasm_compiler_OP.drop);
31043      this._emitF64Const(0);
31044      return true;
31045    }
31046    const localA = this._allocLocal();
31047    try {
31048      if (!this._compileNode(second)) {
31049        return false;
31050      }
31051      this._emitLocalTee(localA);
31052      const code = this._code;
31053      if (first.type === PS_NODE.const) {
31054        this._emitLocalGet(localA);
31055        this._emitF64Const(first.value);
31056        code.push(wasm_compiler_OP.f64_div, wasm_compiler_OP.f64_trunc);
31057        this._emitF64Const(first.value);
31058        code.push(wasm_compiler_OP.f64_mul, wasm_compiler_OP.f64_sub);
31059      } else {
31060        const localB = this._allocLocal();
31061        try {
31062          if (!this._compileNode(first)) {
31063            return false;
31064          }
31065          this._emitLocalSet(localB);
31066          this._emitLocalGet(localA);
31067          this._emitLocalGet(localB);
31068          code.push(wasm_compiler_OP.f64_div, wasm_compiler_OP.f64_trunc);
31069          this._emitLocalGet(localB);
31070          code.push(wasm_compiler_OP.f64_mul, wasm_compiler_OP.f64_sub);
31071          this._emitF64Const(0);
31072          this._emitLocalGet(localB);
31073          this._emitF64Const(0);
31074          code.push(wasm_compiler_OP.f64_ne, wasm_compiler_OP.select);
31075        } finally {
31076          this._releaseLocal(localB);
31077        }
31078      }
31079      return true;
31080    } finally {
31081      this._releaseLocal(localA);
31082    }
31083  }
31084  _compileAtanNode(first, second) {
31085    const localR = this._allocLocal();
31086    try {
31087      if (!this._compileNode(second)) {
31088        return false;
31089      }
31090      if (!this._compileNode(first)) {
31091        return false;
31092      }
31093      const code = this._code;
31094      code.push(wasm_compiler_OP.call);
31095      this._emitULEB128(PsWasmCompiler.#importIdx.atan2);
31096      this._emitF64Const(PsWasmCompiler.#radToDeg);
31097      code.push(wasm_compiler_OP.f64_mul);
31098      this._emitLocalTee(localR);
31099      this._emitF64Const(0);
31100      code.push(wasm_compiler_OP.f64_lt, wasm_compiler_OP.if, F64);
31101      this._emitLocalGet(localR);
31102      this._emitF64Const(360);
31103      code.push(wasm_compiler_OP.f64_add, wasm_compiler_OP.else);
31104      this._emitLocalGet(localR);
31105      code.push(wasm_compiler_OP.end);
31106      return true;
31107    } finally {
31108      this._releaseLocal(localR);
31109    }
31110  }
31111  _compileBitwiseNode(op, first, second) {
31112    if (!this._compileBitwiseOperandI32(second)) {
31113      return false;
31114    }
31115    if (!this._compileBitwiseOperandI32(first)) {
31116      return false;
31117    }
31118    const code = this._code;
31119    switch (op) {
31120      case TOKEN.and:
31121        code.push(wasm_compiler_OP.i32_and);
31122        break;
31123      case TOKEN.or:
31124        code.push(wasm_compiler_OP.i32_or);
31125        break;
31126      case TOKEN.xor:
31127        code.push(wasm_compiler_OP.i32_xor);
31128        break;
31129      default:
31130        return false;
31131    }
31132    code.push(wasm_compiler_OP.f64_convert_i32_s);
31133    return true;
31134  }
31135  _compileBitwiseOperandI32(node) {
31136    if (node.valueType === PS_VALUE_TYPE.boolean) {
31137      return this._compileNodeAsBoolI32(node);
31138    }
31139    if (!this._compileNode(node)) {
31140      return false;
31141    }
31142    this._code.push(wasm_compiler_OP.i32_trunc_f64_s);
31143    return true;
31144  }
31145  _compileStandardBinaryNode(op, first, second) {
31146    if (first === second && first.type !== PS_NODE.arg && first.type !== PS_NODE.const && !first.shared) {
31147      const tmp = this._allocLocal();
31148      try {
31149        if (!this._compileNode(first)) {
31150          return false;
31151        }
31152        this._emitLocalTee(tmp);
31153        this._emitLocalGet(tmp);
31154      } finally {
31155        this._releaseLocal(tmp);
31156      }
31157    } else {
31158      if (!this._compileNode(second)) {
31159        return false;
31160      }
31161      if (!this._compileNode(first)) {
31162        return false;
31163      }
31164    }
31165    const code = this._code;
31166    switch (op) {
31167      case TOKEN.add:
31168        code.push(wasm_compiler_OP.f64_add);
31169        break;
31170      case TOKEN.sub:
31171        code.push(wasm_compiler_OP.f64_sub);
31172        break;
31173      case TOKEN.mul:
31174        code.push(wasm_compiler_OP.f64_mul);
31175        break;
31176      case TOKEN.exp:
31177        code.push(wasm_compiler_OP.call);
31178        this._emitULEB128(PsWasmCompiler.#importIdx.pow);
31179        break;
31180      case TOKEN.eq:
31181        code.push(wasm_compiler_OP.f64_eq, wasm_compiler_OP.f64_convert_i32_s);
31182        break;
31183      case TOKEN.ne:
31184        code.push(wasm_compiler_OP.f64_ne, wasm_compiler_OP.f64_convert_i32_s);
31185        break;
31186      case TOKEN.lt:
31187        code.push(wasm_compiler_OP.f64_lt, wasm_compiler_OP.f64_convert_i32_s);
31188        break;
31189      case TOKEN.le:
31190        code.push(wasm_compiler_OP.f64_le, wasm_compiler_OP.f64_convert_i32_s);
31191        break;
31192      case TOKEN.gt:
31193        code.push(wasm_compiler_OP.f64_gt, wasm_compiler_OP.f64_convert_i32_s);
31194        break;
31195      case TOKEN.ge:
31196        code.push(wasm_compiler_OP.f64_ge, wasm_compiler_OP.f64_convert_i32_s);
31197        break;
31198      case TOKEN.min:
31199        code.push(wasm_compiler_OP.f64_min);
31200        break;
31201      case TOKEN.max:
31202        code.push(wasm_compiler_OP.f64_max);
31203        break;
31204      default:
31205        return false;
31206    }
31207    return true;
31208  }
31209  _compileBinaryNode(node) {
31210    const {
31211      op,
31212      first,
31213      second
31214    } = node;
31215    if (op === TOKEN.bitshift) {
31216      return this._compileBitshiftNode(first, second);
31217    }
31218    if (op === TOKEN.div) {
31219      return this._compileSafeDivNode(first, second);
31220    }
31221    if (op === TOKEN.idiv) {
31222      return this._compileSafeIdivNode(first, second);
31223    }
31224    if (op === TOKEN.mod) {
31225      return this._compileModNode(first, second);
31226    }
31227    if (op === TOKEN.atan) {
31228      return this._compileAtanNode(first, second);
31229    }
31230    if (op === TOKEN.and || op === TOKEN.or || op === TOKEN.xor) {
31231      return this._compileBitwiseNode(op, first, second);
31232    }
31233    return this._compileStandardBinaryNode(op, first, second);
31234  }
31235  _compileNodeAsBoolI32(node) {
31236    if (node.type === PS_NODE.binary) {
31237      const wasmOp = PsWasmCompiler.#comparisonToOp.get(node.op);
31238      if (wasmOp !== undefined) {
31239        if (!this._compileNode(node.second)) {
31240          return false;
31241        }
31242        if (!this._compileNode(node.first)) {
31243          return false;
31244        }
31245        this._code.push(wasmOp);
31246        return true;
31247      }
31248      if (node.valueType === PS_VALUE_TYPE.boolean && (node.op === TOKEN.and || node.op === TOKEN.or || node.op === TOKEN.xor)) {
31249        if (!this._compileNodeAsBoolI32(node.second)) {
31250          return false;
31251        }
31252        if (!this._compileNodeAsBoolI32(node.first)) {
31253          return false;
31254        }
31255        switch (node.op) {
31256          case TOKEN.and:
31257            this._code.push(wasm_compiler_OP.i32_and);
31258            break;
31259          case TOKEN.or:
31260            this._code.push(wasm_compiler_OP.i32_or);
31261            break;
31262          case TOKEN.xor:
31263            this._code.push(wasm_compiler_OP.i32_xor);
31264            break;
31265        }
31266        return true;
31267      }
31268    }
31269    if (node.type === PS_NODE.unary && node.op === TOKEN.not && node.valueType === PS_VALUE_TYPE.boolean) {
31270      if (!this._compileNodeAsBoolI32(node.operand)) {
31271        return false;
31272      }
31273      this._code.push(wasm_compiler_OP.i32_eqz);
31274      return true;
31275    }
31276    if (!this._compileNode(node)) {
31277      return false;
31278    }
31279    if (node.valueType === PS_VALUE_TYPE.boolean) {
31280      this._code.push(wasm_compiler_OP.i32_trunc_f64_s);
31281    } else {
31282      this._emitF64Const(0);
31283      this._code.push(wasm_compiler_OP.f64_ne);
31284    }
31285    return true;
31286  }
31287  _compileTernaryNode(node) {
31288    if (!this._compileNodeAsBoolI32(node.cond)) {
31289      return false;
31290    }
31291    this._code.push(wasm_compiler_OP.if, F64);
31292    if (!this._compileNode(node.then)) {
31293      return false;
31294    }
31295    this._code.push(wasm_compiler_OP.else);
31296    if (!this._compileNode(node.otherwise)) {
31297      return false;
31298    }
31299    this._code.push(wasm_compiler_OP.end);
31300    return true;
31301  }
31302  compile(program) {
31303    const outputs = new PSStackToTree().evaluate(program, this._nIn);
31304    if (!outputs || outputs.length < this._nOut) {
31305      return null;
31306    }
31307    const code = this._code;
31308    for (let i = 0; i < this._nOut; i++) {
31309      const min = this._range[i * 2];
31310      const max = this._range[i * 2 + 1];
31311      code.push(wasm_compiler_OP.i32_const);
31312      this._emit
vendor: 8,718 bytes, lines 31312-31619
31312ULEB128(i * 8);
31313      if (!this._compileNode(outputs[i])) {
31314        return null;
31315      }
31316      this._emitF64Const(max);
31317      code.push(wasm_compiler_OP.f64_min);
31318      this._emitF64Const(min);
31319      code.push(wasm_compiler_OP.f64_max, wasm_compiler_OP.f64_store, 0x03, 0x00);
31320    }
31321    code.push(wasm_compiler_OP.end);
31322    const nIn = this._nIn;
31323    const nLocals = this._nextLocal - nIn;
31324    const paramTypes = Array(nIn).fill(F64);
31325    const resultTypes = [];
31326    const funcType = [FUNC_TYPE, ...vec(paramTypes), ...vec(resultTypes)];
31327    const typeSectionBytes = new Uint8Array(section(SECTION.type, vec([funcType, ...PsWasmCompiler.#importTypeEntries])));
31328    const localDecls = nLocals > 0 ? vec([[...unsignedLEB128(nLocals), F64]]) : vec([]);
31329    const funcBodyLen = localDecls.length + code.length;
31330    const codeSectionBytes = new Uint8Array(section(SECTION.code, vec([[...unsignedLEB128(funcBodyLen), ...localDecls, ...code]])));
31331    const magicVersion = PsWasmCompiler.#wasmMagicVersion;
31332    const importSection = PsWasmCompiler.#importSection;
31333    const functionSection = PsWasmCompiler.#functionSection;
31334    const memorySection = PsWasmCompiler.#memorySection;
31335    const exportSection = PsWasmCompiler.#exportSection;
31336    const totalLen = magicVersion.length + typeSectionBytes.length + importSection.length + functionSection.length + memorySection.length + exportSection.length + codeSectionBytes.length;
31337    const result = new Uint8Array(totalLen);
31338    let off = 0;
31339    result.set(magicVersion, off);
31340    off += magicVersion.length;
31341    result.set(typeSectionBytes, off);
31342    off += typeSectionBytes.length;
31343    result.set(importSection, off);
31344    off += importSection.length;
31345    result.set(functionSection, off);
31346    off += functionSection.length;
31347    result.set(memorySection, off);
31348    off += memorySection.length;
31349    result.set(exportSection, off);
31350    off += exportSection.length;
31351    result.set(codeSectionBytes, off);
31352    return result;
31353  }
31354}
31355function compilePostScriptToWasm(source, domain, range) {
31356  return new PsWasmCompiler(domain, range).compile(parsePostScriptFunction(source));
31357}
31358function _makeWrapper(exports, nIn, nOut) {
31359  const {
31360    fn,
31361    mem
31362  } = exports;
31363  const outView = new Float64Array(mem.buffer, 0, nOut);
31364  let writeOut;
31365  switch (nOut) {
31366    case 1:
31367      writeOut = (dest, destOffset) => {
31368        dest[destOffset] = outView[0];
31369      };
31370      break;
31371    case 2:
31372      writeOut = (dest, destOffset) => {
31373        dest[destOffset] = outView[0];
31374        dest[destOffset + 1] = outView[1];
31375      };
31376      break;
31377    case 3:
31378      writeOut = (dest, destOffset) => {
31379        dest[destOffset] = outView[0];
31380        dest[destOffset + 1] = outView[1];
31381        dest[destOffset + 2] = outView[2];
31382      };
31383      break;
31384    case 4:
31385      writeOut = (dest, destOffset) => {
31386        dest[destOffset] = outView[0];
31387        dest[destOffset + 1] = outView[1];
31388        dest[destOffset + 2] = outView[2];
31389        dest[destOffset + 3] = outView[3];
31390      };
31391      break;
31392    default:
31393      writeOut = (dest, destOffset) => {
31394        for (let i = 0; i < nOut; i++) {
31395          dest[destOffset + i] = outView[i];
31396        }
31397      };
31398  }
31399  switch (nIn) {
31400    case 1:
31401      return (src, srcOffset, dest, destOffset) => {
31402        fn(src[srcOffset]);
31403        writeOut(dest, destOffset);
31404      };
31405    case 2:
31406      return (src, srcOffset, dest, destOffset) => {
31407        fn(src[srcOffset], src[srcOffset + 1]);
31408        writeOut(dest, destOffset);
31409      };
31410    case 3:
31411      return (src, srcOffset, dest, destOffset) => {
31412        fn(src[srcOffset], src[srcOffset + 1], src[srcOffset + 2]);
31413        writeOut(dest, destOffset);
31414      };
31415    case 4:
31416      return (src, srcOffset, dest, destOffset) => {
31417        fn(src[srcOffset], src[srcOffset + 1], src[srcOffset + 2], src[srcOffset + 3]);
31418        writeOut(dest, destOffset);
31419      };
31420    default:
31421      {
31422        const inBuf = new Float64Array(nIn);
31423        return (src, srcOffset, dest, destOffset) => {
31424          for (let i = 0; i < nIn; i++) {
31425            inBuf[i] = src[srcOffset + i];
31426          }
31427          fn(...inBuf);
31428          writeOut(dest, destOffset);
31429        };
31430      }
31431  }
31432}
31433function buildPostScriptWasmFunction(source, domain, range) {
31434  const bytes = compilePostScriptToWasm(source, domain, range);
31435  if (!bytes) {
31436    return null;
31437  }
31438  try {
31439    const instance = new WebAssembly.Instance(new WebAssembly.Module(bytes), _mathImportObject);
31440    return _makeWrapper(instance.exports, domain.length >> 1, range.length >> 1);
31441  } catch {
31442    return null;
31443  }
31444}
31445
31446;// ./src/core/image_utils.js
31447
31448
31449class BaseLocalCache {
31450  constructor(options) {
31451    this._onlyRefs = options?.onlyRefs === true;
31452    if (!this._onlyRefs) {
31453      this._nameRefMap = new Map();
31454      this._imageMap = new Map();
31455    }
31456    this._imageCache = new RefSetCache();
31457  }
31458  getByName(name) {
31459    if (this._onlyRefs) {
31460      unreachable("Should not call `getByName` method.");
31461    }
31462    const ref = this._nameRefMap.get(name);
31463    if (ref) {
31464      return this.getByRef(ref);
31465    }
31466    return this._imageMap.get(name) || null;
31467  }
31468  getByRef(ref) {
31469    return this._imageCache.get(ref) || null;
31470  }
31471  set(name, ref, data) {
31472    unreachable("Abstract method `set` called.");
31473  }
31474}
31475class LocalImageCache extends BaseLocalCache {
31476  set(name, ref = null, data) {
31477    if (typeof name !== "string") {
31478      throw new Error('LocalImageCache.set - expected "name" argument.');
31479    }
31480    if (ref) {
31481      if (this._imageCache.has(ref)) {
31482        return;
31483      }
31484      this._nameRefMap.set(name, ref);
31485      this._imageCache.put(ref, data);
31486      return;
31487    }
31488    if (this._imageMap.has(name)) {
31489      return;
31490    }
31491    this._imageMap.set(name, data);
31492  }
31493}
31494class LocalColorSpaceCache extends BaseLocalCache {
31495  set(name = null, ref = null, data) {
31496    if (typeof name !== "string" && !ref) {
31497      throw new Error('LocalColorSpaceCache.set - expected "name" and/or "ref" argument.');
31498    }
31499    if (ref) {
31500      if (this._imageCache.has(ref)) {
31501        return;
31502      }
31503      if (name !== null) {
31504        this._nameRefMap.set(name, ref);
31505      }
31506      this._imageCache.put(ref, data);
31507      return;
31508    }
31509    if (this._imageMap.has(name)) {
31510      return;
31511    }
31512    this._imageMap.set(name, data);
31513  }
31514}
31515class LocalFunctionCache extends BaseLocalCache {
31516  constructor(options) {
31517    super({
31518      onlyRefs: true
31519    });
31520  }
31521  set(name = null, ref, data) {
31522    if (!ref) {
31523      throw new Error('LocalFunctionCache.set - expected "ref" argument.');
31524    }
31525    if (this._imageCache.has(ref)) {
31526      return;
31527    }
31528    this._imageCache.put(ref, data);
31529  }
31530}
31531class LocalGStateCache extends BaseLocalCache {
31532  set(name, ref = null, data) {
31533    if (typeof name !== "string") {
31534      throw new Error('LocalGStateCache.set - expected "name" argument.');
31535    }
31536    if (ref) {
31537      if (this._imageCache.has(ref)) {
31538        return;
31539      }
31540      this._nameRefMap.set(name, ref);
31541      this._imageCache.put(ref, data);
31542      return;
31543    }
31544    if (this._imageMap.has(name)) {
31545      return;
31546    }
31547    this._imageMap.set(name, data);
31548  }
31549}
31550class LocalTilingPatternCache extends BaseLocalCache {
31551  constructor(options) {
31552    super({
31553      onlyRefs: true
31554    });
31555  }
31556  set(name = null, ref, data) {
31557    if (!ref) {
31558      throw new Error('LocalTilingPatternCache.set - expected "ref" argument.');
31559    }
31560    if (this._imageCache.has(ref)) {
31561      return;
31562    }
31563    this._imageCache.put(ref, data);
31564  }
31565}
31566class RegionalImageCache extends BaseLocalCache {
31567  constructor(options) {
31568    super({
31569      onlyRefs: true
31570    });
31571  }
31572  set(name = null, ref, data) {
31573    if (!ref) {
31574      throw new Error('RegionalImageCache.set - expected "ref" argument.');
31575    }
31576    if (this._imageCache.has(ref)) {
31577      return;
31578    }
31579    this._imageCache.put(ref, data);
31580  }
31581}
31582class GlobalColorSpaceCache extends BaseLocalCache {
31583  constructor(options) {
31584    super({
31585      onlyRefs: true
31586    });
31587  }
31588  set(name = null, ref, data) {
31589    if (!ref) {
31590      throw new Error('GlobalColorSpaceCache.set - expected "ref" argument.');
31591    }
31592    if (this._imageCache.has(ref)) {
31593      return;
31594    }
31595    this._imageCache.put(ref, data);
31596  }
31597  clear() {
31598    this._imageCache.clear();
31599  }
31600}
31601class GlobalImageCache {
31602  static NUM_PAGES_THRESHOLD = 2;
31603  static MIN_IMAGES_TO_CACHE = 10;
31604  static MAX_BYTE_SIZE = 5e7;
31605  #decodeFailedSet = new RefSet();
31606  constructor() {
31607    this._refCache = new RefSetCache();
31608    this._imageCache = new RefSetCache();
31609  }
31610  get #byteSize() {
31611    let byteSize = 0;
31612    for (const imageData of this._imageCache) {
31613      byteSize += imageData.byteSize;
31614    }
31615    return byteSize;
31616  }
31617  get #cacheLimitReached() {
31618    if (this._imageCache.size < GlobalImageCache.MIN_IMAGES_TO_CACHE) {
31619      return false;
31620    }
31621    if (this.#byteSize < GlobalImageCache.MAX_BYTE_SIZE) {
31622      return false;
31623    }
31624    return true;
31625  }
31626  shouldCache(ref, pageIndex) {
31627    let pageIndexSet = this._refCache.get(ref);
31628    if (!pageIndexSet) {
31629      pageIndexSet = new Set();
31630      this._refCache.put(ref, pageIndexSet);
31631    }
vendor: 18,826 bytes, lines 31631-32221
31631
31632    pageIndexSet.add(pageIndex);
31633    if (pageIndexSet.size < GlobalImageCache.NUM_PAGES_THRESHOLD) {
31634      return false;
31635    }
31636    if (!this._imageCache.has(ref) && this.#cacheLimitReached) {
31637      return false;
31638    }
31639    return true;
31640  }
31641  addDecodeFailed(ref) {
31642    this.#decodeFailedSet.put(ref);
31643  }
31644  hasDecodeFailed(ref) {
31645    return this.#decodeFailedSet.has(ref);
31646  }
31647  addByteSize(ref, byteSize) {
31648    const imageData = this._imageCache.get(ref);
31649    if (!imageData) {
31650      return;
31651    }
31652    if (imageData.byteSize) {
31653      return;
31654    }
31655    imageData.byteSize = byteSize;
31656  }
31657  getData(ref, pageIndex) {
31658    const pageIndexSet = this._refCache.get(ref);
31659    if (!pageIndexSet) {
31660      return null;
31661    }
31662    if (pageIndexSet.size < GlobalImageCache.NUM_PAGES_THRESHOLD) {
31663      return null;
31664    }
31665    const imageData = this._imageCache.get(ref);
31666    if (!imageData) {
31667      return null;
31668    }
31669    pageIndexSet.add(pageIndex);
31670    return imageData;
31671  }
31672  setData(ref, data) {
31673    if (!this._refCache.has(ref)) {
31674      throw new Error('GlobalImageCache.setData - expected "shouldCache" to have been called.');
31675    }
31676    if (this._imageCache.has(ref)) {
31677      return;
31678    }
31679    if (this.#cacheLimitReached) {
31680      warn("GlobalImageCache.setData - cache limit reached.");
31681      return;
31682    }
31683    this._imageCache.put(ref, data);
31684  }
31685  clear(onlyData = false) {
31686    if (!onlyData) {
31687      this.#decodeFailedSet.clear();
31688      this._refCache.clear();
31689    }
31690    this._imageCache.clear();
31691  }
31692}
31693
31694;// ./src/core/function.js
31695
31696
31697
31698
31699
31700
31701
31702
31703const FunctionType = {
31704  SAMPLED: 0,
31705  EXPONENTIAL_INTERPOLATION: 2,
31706  STITCHING: 3,
31707  POSTSCRIPT_CALCULATOR: 4
31708};
31709class PDFFunctionFactory {
31710  static #useWasm = true;
31711  static setOptions({
31712    useWasm
31713  }) {
31714    this.#useWasm = useWasm;
31715  }
31716  constructor({
31717    xref
31718  }) {
31719    this.xref = xref;
31720  }
31721  get useWasm() {
31722    return PDFFunctionFactory.#useWasm;
31723  }
31724  create(fn, parseArray = false) {
31725    let fnRef, parsedFn;
31726    if (fn instanceof Ref) {
31727      fnRef = fn;
31728    } else if (fn instanceof Dict) {
31729      fnRef = fn.objId;
31730    } else if (fn instanceof BaseStream) {
31731      fnRef = fn.dict?.objId;
31732    }
31733    if (fnRef) {
31734      const cachedFn = this._localFunctionCache.getByRef(fnRef);
31735      if (cachedFn) {
31736        return cachedFn;
31737      }
31738    }
31739    const fnObj = this.xref.fetchIfRef(fn);
31740    if (Array.isArray(fnObj)) {
31741      if (!parseArray) {
31742        throw new Error('PDFFunctionFactory.create - expected "parseArray" argument.');
31743      }
31744      parsedFn = PDFFunction.parseArray(this, fnObj);
31745    } else {
31746      parsedFn = PDFFunction.parse(this, fnObj);
31747    }
31748    if (fnRef) {
31749      this._localFunctionCache.set(null, fnRef, parsedFn);
31750    }
31751    return parsedFn;
31752  }
31753  get _localFunctionCache() {
31754    return shadow(this, "_localFunctionCache", new LocalFunctionCache());
31755  }
31756}
31757function toNumberArray(arr) {
31758  if (!Array.isArray(arr)) {
31759    return null;
31760  }
31761  if (!isNumberArray(arr, null)) {
31762    return arr.map(x => +x);
31763  }
31764  return arr;
31765}
31766class PDFFunction {
31767  static getSampleArray(size, outputSize, bps, stream) {
31768    let length = outputSize;
31769    for (const s of size) {
31770      length *= s;
31771    }
31772    const array = new Array(length);
31773    let codeSize = 0;
31774    let codeBuf = 0;
31775    const sampleMul = 1.0 / (2.0 ** bps - 1);
31776    const strBytes = stream.getBytes((length * bps + 7) / 8);
31777    let strIdx = 0;
31778    for (let i = 0; i < length; i++) {
31779      while (codeSize < bps) {
31780        codeBuf <<= 8;
31781        codeBuf |= strBytes[strIdx++];
31782        codeSize += 8;
31783      }
31784      codeSize -= bps;
31785      array[i] = (codeBuf >> codeSize) * sampleMul;
31786      codeBuf &= (1 << codeSize) - 1;
31787    }
31788    return array;
31789  }
31790  static parse(factory, fn) {
31791    const dict = fn.dict || fn;
31792    const typeNum = dict.get("FunctionType");
31793    switch (typeNum) {
31794      case FunctionType.SAMPLED:
31795        return this.constructSampled(factory, fn, dict);
31796      case FunctionType.EXPONENTIAL_INTERPOLATION:
31797        return this.constructInterpolated(factory, dict);
31798      case FunctionType.STITCHING:
31799        return this.constructStiched(factory, dict);
31800      case FunctionType.POSTSCRIPT_CALCULATOR:
31801        return this.constructPostScript(factory, fn, dict);
31802    }
31803    throw new FormatError(`Unknown function type: ${typeNum}`);
31804  }
31805  static parseArray(factory, fnObj) {
31806    const {
31807      xref
31808    } = factory;
31809    const fnArray = [];
31810    for (const fn of fnObj) {
31811      fnArray.push(this.parse(factory, xref.fetchIfRef(fn)));
31812    }
31813    return function (src, srcOffset, dest, destOffset) {
31814      for (let i = 0, ii = fnArray.length; i < ii; i++) {
31815        fnArray[i](src, srcOffset, dest, destOffset + i);
31816      }
31817    };
31818  }
31819  static constructSampled(factory, fn, dict) {
31820    function interpolate(x, xmin, xmax, ymin, ymax) {
31821      return ymin + (x - xmin) * ((ymax - ymin) / (xmax - xmin));
31822    }
31823    const domain = toNumberArray(dict.getArray("Domain"));
31824    const range = toNumberArray(dict.getArray("Range"));
31825    if (!domain || !range) {
31826      throw new FormatError("No domain or range");
31827    }
31828    const inputSize = domain.length / 2;
31829    const outputSize = range.length / 2;
31830    const size = toNumberArray(dict.getArray("Size"));
31831    const bps = dict.get("BitsPerSample");
31832    const order = dict.get("Order") || 1;
31833    if (order !== 1) {
31834      info("No support for cubic spline interpolation: " + order);
31835    }
31836    let encode = toNumberArray(dict.getArray("Encode"));
31837    if (!encode) {
31838      encode = [];
31839      for (let i = 0; i < inputSize; ++i) {
31840        encode.push(0, size[i] - 1);
31841      }
31842    }
31843    const decode = toNumberArray(dict.getArray("Decode")) || range;
31844    const samples = this.getSampleArray(size, outputSize, bps, fn);
31845    return function constructSampledFn(src, srcOffset, dest, destOffset) {
31846      const cubeVertices = 1 << inputSize;
31847      const cubeN = new Float64Array(cubeVertices).fill(1);
31848      const cubeVertex = new Uint32Array(cubeVertices);
31849      let i, j;
31850      let k = outputSize,
31851        pos = 1;
31852      for (i = 0; i < inputSize; ++i) {
31853        const domain_2i = domain[2 * i];
31854        const domain_2i_1 = domain[2 * i + 1];
31855        const xi = MathClamp(src[srcOffset + i], domain_2i, domain_2i_1);
31856        let e = interpolate(xi, domain_2i, domain_2i_1, encode[2 * i], encode[2 * i + 1]);
31857        const size_i = size[i];
31858        e = MathClamp(e, 0, size_i - 1);
31859        const e0 = e < size_i - 1 ? Math.floor(e) : e - 1;
31860        const n0 = e0 + 1 - e;
31861        const n1 = e - e0;
31862        const offset0 = e0 * k;
31863        const offset1 = offset0 + k;
31864        for (j = 0; j < cubeVertices; j++) {
31865          if (j & pos) {
31866            cubeN[j] *= n1;
31867            cubeVertex[j] += offset1;
31868          } else {
31869            cubeN[j] *= n0;
31870            cubeVertex[j] += offset0;
31871          }
31872        }
31873        k *= size_i;
31874        pos <<= 1;
31875      }
31876      for (j = 0; j < outputSize; ++j) {
31877        let rj = 0;
31878        for (i = 0; i < cubeVertices; i++) {
31879          rj += samples[cubeVertex[i] + j] * cubeN[i];
31880        }
31881        rj = interpolate(rj, 0, 1, decode[2 * j], decode[2 * j + 1]);
31882        dest[destOffset + j] = MathClamp(rj, range[2 * j], range[2 * j + 1]);
31883      }
31884    };
31885  }
31886  static constructInterpolated(factory, dict) {
31887    const c0 = toNumberArray(dict.getArray("C0")) || [0];
31888    const c1 = toNumberArray(dict.getArray("C1")) || [1];
31889    const n = dict.get("N");
31890    const diff = [];
31891    for (let i = 0, ii = c0.length; i < ii; ++i) {
31892      diff.push(c1[i] - c0[i]);
31893    }
31894    const length = diff.length;
31895    return function constructInterpolatedFn(src, srcOffset, dest, destOffset) {
31896      const x = n === 1 ? src[srcOffset] : src[srcOffset] ** n;
31897      for (let j = 0; j < length; ++j) {
31898        dest[destOffset + j] = c0[j] + x * diff[j];
31899      }
31900    };
31901  }
31902  static constructStiched(factory, dict) {
31903    const domain = toNumberArray(dict.getArray("Domain"));
31904    if (!domain) {
31905      throw new FormatError("No domain");
31906    }
31907    const inputSize = domain.length / 2;
31908    if (inputSize !== 1) {
31909      throw new FormatError("Bad domain for stiched function");
31910    }
31911    const {
31912      xref
31913    } = factory;
31914    const fns = [];
31915    for (const fn of dict.get("Functions")) {
31916      fns.push(this.parse(factory, xref.fetchIfRef(fn)));
31917    }
31918    const bounds = toNumberArray(dict.getArray("Bounds"));
31919    const encode = toNumberArray(dict.getArray("Encode"));
31920    const tmpBuf = new Float32Array(1);
31921    return function constructStichedFn(src, srcOffset, dest, destOffset) {
31922      const v = MathClamp(src[srcOffset], domain[0], domain[1]);
31923      const length = bounds.length;
31924      let i;
31925      for (i = 0; i < length; ++i) {
31926        if (v < bounds[i]) {
31927          break;
31928        }
31929      }
31930      const dmin = i > 0 ? bounds[i - 1] : domain[0];
31931      const dmax = i < length ? bounds[i] : domain[1];
31932      const rmin = encode[2 * i];
31933      const rmax = encode[2 * i + 1];
31934      tmpBuf[0] = dmin === dmax ? rmin : rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin);
31935      fns[i](tmpBuf, 0, dest, destOffset);
31936    };
31937  }
31938  static constructPostScript(factory, fn, dict) {
31939    const domain = toNumberArray(dict.getArray("Domain"));
31940    const range = toNumberArray(dict.getArray("Range"));
31941    if (!domain) {
31942      throw new FormatError("No domain.");
31943    }
31944    if (!range) {
31945      throw new FormatError("No range.");
31946    }
31947    const psCode = fn.getString();
31948    try {
31949      if (factory.useWasm) {
31950        const wasmFn = buildPostScriptWasmFunction(psCode, domain, range);
31951        if (wasmFn) {
31952          return wasmFn;
31953        }
31954      }
31955    } catch {}
31956    warn("Failed to compile PostScript function to wasm, falling back to JS");
31957    return buildPostScriptJsFunction(psCode, domain, range);
31958  }
31959}
31960function isPDFFunction(v) {
31961  let fnDict;
31962  if (v instanceof Dict) {
31963    fnDict = v;
31964  } else if (v instanceof BaseStream) {
31965    fnDict = v.dict;
31966  } else {
31967    return false;
31968  }
31969  return fnDict.has("FunctionType");
31970}
31971
31972;// ./src/core/bidi.js
31973
31974const baseTypes = ["BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "S", "B", "S", "WS", "B", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "B", "B", "B", "S", "WS", "ON", "ON", "ET", "ET", "ET", "ON", "ON", "ON", "ON", "ON", "ES", "CS", "ES", "CS", "CS", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "CS", "ON", "ON", "ON", "ON", "ON", "ON", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "ON", "ON", "ON", "ON", "ON", "ON", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "ON", "ON", "ON", "ON", "BN", "BN", "BN", "BN", "BN", "BN", "B", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "CS", "ON", "ET", "ET", "ET", "ET", "ON", "ON", "ON", "ON", "L", "ON", "ON", "BN", "ON", "ON", "ET", "ET", "EN", "EN", "ON", "L", "ON", "ON", "ON", "EN", "L", "ON", "ON", "ON", "ON", "ON", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "ON", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "ON", "L", "L", "L", "L", "L", "L", "L", "L"];
31975const arabicTypes = ["AN", "AN", "AN", "AN", "AN", "AN", "ON", "ON", "AL", "ET", "ET", "AL", "CS", "AL", "ON", "ON", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "AL", "AL", "", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "AN", "AN", "AN", "AN", "AN", "AN", "AN", "AN", "AN", "AN", "ET", "AN", "AN", "AL", "AL", "AL", "NSM", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "AN", "ON", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "AL", "AL", "NSM", "NSM", "ON", "NSM", "NSM", "NSM", "NSM", "AL", "AL", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "AL", "AL", "AL", "AL", "AL", "AL"];
31976function isOdd(i) {
31977  return (i & 1) !== 0;
31978}
31979function isEven(i) {
31980  return (i & 1) === 0;
31981}
31982function findUnequal(arr, start, value) {
31983  let j, jj;
31984  for (j = start, jj = arr.length; j < jj; ++j) {
31985    if (arr[j] !== value) {
31986      return j;
31987    }
31988  }
31989  return j;
31990}
31991function reverseValues(arr, start, end) {
31992  for (let i = start, j = end - 1; i < j; ++i, --j) {
31993    const temp = arr[i];
31994    arr[i] = arr[j];
31995    arr[j] = temp;
31996  }
31997}
31998function createBidiText(str, isLTR, vertical = false) {
31999  let dir = "ltr";
32000  if (vertical) {
32001    dir = "ttb";
32002  } else if (!isLTR) {
32003    dir = "rtl";
32004  }
32005  return {
32006    str,
32007    dir
32008  };
32009}
32010const chars = [];
32011const types = [];
32012function bidi(str, startLevel = -1, vertical = false) {
32013  let isLTR = true;
32014  const strLength = str.length;
32015  if (strLength === 0 || vertical) {
32016    return createBidiText(str, isLTR, vertical);
32017  }
32018  chars.length = strLength;
32019  types.length = strLength;
32020  let numBidi = 0;
32021  let i, ii;
32022  for (i = 0; i < strLength; ++i) {
32023    chars[i] = str.charAt(i);
32024    const charCode = str.charCodeAt(i);
32025    let charType = "L";
32026    if (charCode <= 0x00ff) {
32027      charType = baseTypes[charCode];
32028    } else if (0x0590 <= charCode && charCode <= 0x05f4) {
32029      charType = "R";
32030    } else if (0x0600 <= charCode && charCode <= 0x06ff) {
32031      charType = arabicTypes[charCode & 0xff];
32032      if (!charType) {
32033        warn("Bidi: invalid Unicode character " + charCode.toString(16));
32034      }
32035    } else if (0x0700 <= charCode && charCode <= 0x08ac || 0xfb50 <= charCode && charCode <= 0xfdff || 0xfe70 <= charCode && charCode <= 0xfeff) {
32036      charType = "AL";
32037    }
32038    if (charType === "R" || charType === "AL" || charType === "AN") {
32039      numBidi++;
32040    }
32041    types[i] = charType;
32042  }
32043  if (numBidi === 0) {
32044    isLTR = true;
32045    return createBidiText(str, isLTR);
32046  }
32047  if (startLevel === -1) {
32048    if (numBidi / strLength < 0.3 && strLength > 4) {
32049      isLTR = true;
32050      startLevel = 0;
32051    } else {
32052      isLTR = false;
32053      startLevel = 1;
32054    }
32055  }
32056  const levels = [];
32057  for (i = 0; i < strLength; ++i) {
32058    levels[i] = startLevel;
32059  }
32060  const e = isOdd(startLevel) ? "R" : "L";
32061  const sor = e;
32062  const eor = sor;
32063  let lastType = sor;
32064  for (i = 0; i < strLength; ++i) {
32065    if (types[i] === "NSM") {
32066      types[i] = lastType;
32067    } else {
32068      lastType = types[i];
32069    }
32070  }
32071  lastType = sor;
32072  let t;
32073  for (i = 0; i < strLength; ++i) {
32074    t = types[i];
32075    if (t === "EN") {
32076      types[i] = lastType === "AL" ? "AN" : "EN";
32077    } else if (t === "R" || t === "L" || t === "AL") {
32078      lastType = t;
32079    }
32080  }
32081  for (i = 0; i < strLength; ++i) {
32082    t = types[i];
32083    if (t === "AL") {
32084      types[i] = "R";
32085    }
32086  }
32087  for (i = 1; i < strLength - 1; ++i) {
32088    if (types[i] === "ES" && types[i - 1] === "EN" && types[i + 1] === "EN") {
32089      types[i] = "EN";
32090    }
32091    if (types[i] === "CS" && (types[i - 1] === "EN" || types[i - 1] === "AN") && types[i + 1] === types[i - 1]) {
32092      types[i] = types[i - 1];
32093    }
32094  }
32095  for (i = 0; i < strLength; ++i) {
32096    if (types[i] === "EN") {
32097      for (let j = i - 1; j >= 0; --j) {
32098        if (types[j] !== "ET") {
32099          break;
32100        }
32101        types[j] = "EN";
32102      }
32103      for (let j = i + 1; j < strLength; ++j) {
32104        if (types[j] !== "ET") {
32105          break;
32106        }
32107        types[j] = "EN";
32108      }
32109    }
32110  }
32111  for (i = 0; i < strLength; ++i) {
32112    t = types[i];
32113    if (t === "WS" || t === "ES" || t === "ET" || t === "CS") {
32114      types[i] = "ON";
32115    }
32116  }
32117  lastType = sor;
32118  for (i = 0; i < strLength; ++i) {
32119    t = types[i];
32120    if (t === "EN") {
32121      types[i] = lastType === "L" ? "L" : "EN";
32122    } else if (t === "R" || t === "L") {
32123      lastType = t;
32124    }
32125  }
32126  for (i = 0; i < strLength; ++i) {
32127    if (types[i] === "ON") {
32128      const end = findUnequal(types, i + 1, "ON");
32129      let before = sor;
32130      for (let j = i - 1; j >= 0; j--) {
32131        const tt = types[j];
32132        if (tt === "L") {
32133          before = "L";
32134          break;
32135        }
32136        if (tt === "R" || tt === "EN" || tt === "AN") {
32137          before = "R";
32138          break;
32139        }
32140      }
32141      let after = eor;
32142      for (let j = end; j < strLength; j++) {
32143        const tt = types[j];
32144        if (tt === "L") {
32145          after = "L";
32146          break;
32147        }
32148        if (tt === "R" || tt === "EN" || tt === "AN") {
32149          after = "R";
32150          break;
32151        }
32152      }
32153      if (before === after) {
32154        types.fill(before, i, end);
32155      }
32156      i = end - 1;
32157    }
32158  }
32159  for (i = 0; i < strLength; ++i) {
32160    if (types[i] === "ON") {
32161      types[i] = e;
32162    }
32163  }
32164  for (i = 0; i < strLength; ++i) {
32165    t = types[i];
32166    if (isEven(levels[i])) {
32167      if (t === "R") {
32168        levels[i] += 1;
32169      } else if (t === "AN" || t === "EN") {
32170        levels[i] += 2;
32171      }
32172    } else if (t === "L" || t === "AN" || t === "EN") {
32173      levels[i] += 1;
32174    }
32175  }
32176  let highestLevel = -1;
32177  let lowestOddLevel = 99;
32178  let level;
32179  for (i = 0, ii = levels.length; i < ii; ++i) {
32180    level = levels[i];
32181    if (highestLevel < level) {
32182      highestLevel = level;
32183    }
32184    if (lowestOddLevel > level && isOdd(level)) {
32185      lowestOddLevel = level;
32186    }
32187  }
32188  for (level = highestLevel; level >= lowestOddLevel; --level) {
32189    let start = -1;
32190    for (i = 0, ii = levels.length; i < ii; ++i) {
32191      if (levels[i] < level) {
32192        if (start >= 0) {
32193          reverseValues(chars, start, i);
32194          start = -1;
32195        }
32196      } else if (start < 0) {
32197        start = i;
32198      }
32199    }
32200    if (start >= 0) {
32201      reverseValues(chars, start, levels.length);
32202    }
32203  }
32204  for (i = 0, ii = chars.length; i < ii; ++i) {
32205    const ch = chars[i];
32206    if (ch === "<" || ch === ">") {
32207      chars[i] = "";
32208    }
32209  }
32210  return createBidiText(chars.join(""), isLTR);
32211}
32212
32213;// ./src/core/font_substitutions.js
32214
32215
32216
32217const NORMAL = {
32218  style: "normal",
32219  weight: "normal"
32220};
32221const 
32221BOLD = {
32222  style: "normal",
32223  weight: "bold"
32224};
32225const ITALIC = {
32226  style: "italic",
32227  weight: "normal"
32228};
32229const BOLDITALIC = {
32230  style: "italic",
32231  weight: "bold"
32232};
32233const substitutionMap = new Map([["Times-Roman", {
32234  local: ["Times New Roman", "Times-Roman", "Times", "Liberation Serif", "Nimbus Roman", "Nimbus Roman 
vendor: 14,490 bytes, lines 32234-32702
32234L", "Tinos", "Thorndale", "TeX Gyre Termes", "FreeSerif", "Linux Libertine O", "Libertinus Serif", "PT Astra Serif", "DejaVu Serif", "Bitstream Vera Serif", "Ubuntu"],
32235  style: NORMAL,
32236  ultimate: "serif"
32237}], ["Times-Bold", {
32238  alias: "Times-Roman",
32239  style: BOLD,
32240  ultimate: "serif"
32241}], ["Times-Italic", {
32242  alias: "Times-Roman",
32243  style: ITALIC,
32244  ultimate: "serif"
32245}], ["Times-BoldItalic", {
32246  alias: "Times-Roman",
32247  style: BOLDITALIC,
32248  ultimate: "serif"
32249}], ["Helvetica", {
32250  local: ["Helvetica", "Helvetica Neue", "Arial", "Arial Nova", "Liberation Sans", "Arimo", "Nimbus Sans", "Nimbus Sans L", "A030", "TeX Gyre Heros", "FreeSans", "DejaVu Sans", "Albany", "Bitstream Vera Sans", "Arial Unicode MS", "Microsoft Sans Serif", "Apple Symbols", "Cantarell"],
32251  path: "LiberationSans-Regular.ttf",
32252  style: NORMAL,
32253  ultimate: "sans-serif"
32254}], ["Helvetica-Bold", {
32255  alias: "Helvetica",
32256  path: "LiberationSans-Bold.ttf",
32257  style: BOLD,
32258  ultimate: "sans-serif"
32259}], ["Helvetica-Oblique", {
32260  alias: "Helvetica",
32261  path: "LiberationSans-Italic.ttf",
32262  style: ITALIC,
32263  ultimate: "sans-serif"
32264}], ["Helvetica-BoldOblique", {
32265  alias: "Helvetica",
32266  path: "LiberationSans-BoldItalic.ttf",
32267  style: BOLDITALIC,
32268  ultimate: "sans-serif"
32269}], ["Courier", {
32270  local: ["Courier", "Courier New", "Liberation Mono", "Nimbus Mono", "Nimbus Mono L", "Cousine", "Cumberland", "TeX Gyre Cursor", "FreeMono", "Linux Libertine Mono O", "Libertinus Mono"],
32271  style: NORMAL,
32272  ultimate: "monospace"
32273}], ["Courier-Bold", {
32274  alias: "Courier",
32275  style: BOLD,
32276  ultimate: "monospace"
32277}], ["Courier-Oblique", {
32278  alias: "Courier",
32279  style: ITALIC,
32280  ultimate: "monospace"
32281}], ["Courier-BoldOblique", {
32282  alias: "Courier",
32283  style: BOLDITALIC,
32284  ultimate: "monospace"
32285}], ["ArialBlack", {
32286  local: ["Arial Black"],
32287  style: {
32288    style: "normal",
32289    weight: "900"
32290  },
32291  fallback: "Helvetica-Bold"
32292}], ["ArialBlack-Bold", {
32293  alias: "ArialBlack"
32294}], ["ArialBlack-Italic", {
32295  alias: "ArialBlack",
32296  style: {
32297    style: "italic",
32298    weight: "900"
32299  },
32300  fallback: "Helvetica-BoldOblique"
32301}], ["ArialBlack-BoldItalic", {
32302  alias: "ArialBlack-Italic"
32303}], ["ArialNarrow", {
32304  local: ["Arial Narrow", "Liberation Sans Narrow", "Helvetica Condensed", "Nimbus Sans Narrow", "TeX Gyre Heros Cn"],
32305  style: NORMAL,
32306  fallback: "Helvetica"
32307}], ["ArialNarrow-Bold", {
32308  alias: "ArialNarrow",
32309  style: BOLD,
32310  fallback: "Helvetica-Bold"
32311}], ["ArialNarrow-Italic", {
32312  alias: "ArialNarrow",
32313  style: ITALIC,
32314  fallback: "Helvetica-Oblique"
32315}], ["ArialNarrow-BoldItalic", {
32316  alias: "ArialNarrow",
32317  style: BOLDITALIC,
32318  fallback: "Helvetica-BoldOblique"
32319}], ["Calibri", {
32320  local: ["Calibri", "Carlito"],
32321  style: NORMAL,
32322  fallback: "Helvetica"
32323}], ["Calibri-Bold", {
32324  alias: "Calibri",
32325  style: BOLD,
32326  fallback: "Helvetica-Bold"
32327}], ["Calibri-Italic", {
32328  alias: "Calibri",
32329  style: ITALIC,
32330  fallback: "Helvetica-Oblique"
32331}], ["Calibri-BoldItalic", {
32332  alias: "Calibri",
32333  style: BOLDITALIC,
32334  fallback: "Helvetica-BoldOblique"
32335}], ["Wingdings", {
32336  local: ["Wingdings", "URW Dingbats"],
32337  style: NORMAL
32338}], ["Wingdings-Regular", {
32339  alias: "Wingdings"
32340}], ["Wingdings-Bold", {
32341  alias: "Wingdings"
32342}], ["\xCB\xCE\xCC\xE5", {
32343  local: ["SimSun", "SimSun Regular", "NSimSun"],
32344  style: NORMAL,
32345  ultimate: "serif"
32346}], ["\xBA\xDA\xCC\xE5", {
32347  local: ["SimHei", "SimHei Regular"],
32348  style: NORMAL,
32349  ultimate: "sans-serif"
32350}], ["\xBF\xAC\xCC\xE5", {
32351  local: ["KaiTi", "SimKai", "SimKai Regular"],
32352  style: NORMAL,
32353  ultimate: "sans-serif"
32354}], ["\xB7\xC2\xCB\xCE", {
32355  local: ["FangSong", "SimFang", "SimFang Regular"],
32356  style: NORMAL,
32357  ultimate: "serif"
32358}], ["\xBF\xAC\xCC\xE5_GB2312", {
32359  alias: "\xBF\xAC\xCC\xE5"
32360}], ["\xB7\xC2\xCB\xCE_GB2312", {
32361  alias: "\xB7\xC2\xCB\xCE"
32362}], ["\xC1\xA5\xCA\xE9", {
32363  local: ["SimLi", "SimLi Regular"],
32364  style: NORMAL,
32365  ultimate: "serif"
32366}], ["\xD0\xC2\xCB\xCE", {
32367  alias: "\xCB\xCE\xCC\xE5"
32368}]]);
32369const fontAliases = new Map([["Arial-Black", "ArialBlack"]]);
32370function getStyleToAppend(style) {
32371  switch (style) {
32372    case BOLD:
32373      return "Bold";
32374    case ITALIC:
32375      return "Italic";
32376    case BOLDITALIC:
32377      return "Bold Italic";
32378    default:
32379      if (style?.weight === "bold") {
32380        return "Bold";
32381      }
32382      if (style?.style === "italic") {
32383        return "Italic";
32384      }
32385  }
32386  return "";
32387}
32388function getFamilyName(str) {
32389  const keywords = new Set(["thin", "extralight", "ultralight", "demilight", "semilight", "light", "book", "regular", "normal", "medium", "demibold", "semibold", "bold", "extrabold", "ultrabold", "black", "heavy", "extrablack", "ultrablack", "roman", "italic", "oblique", "ultracondensed", "extracondensed", "condensed", "semicondensed", "normal", "semiexpanded", "expanded", "extraexpanded", "ultraexpanded", "bolditalic"]);
32390  return str.split(/[- ,+]+/g).filter(tok => !keywords.has(tok.toLowerCase())).join(" ");
32391}
32392function generateFont({
32393  alias,
32394  local,
32395  path,
32396  fallback,
32397  style,
32398  ultimate
32399}, src, localFontPath, useFallback = true, usePath = true, append = "") {
32400  const result = {
32401    style: null,
32402    ultimate: null
32403  };
32404  if (local) {
32405    const extra = append ? ` ${append}` : "";
32406    for (const name of local) {
32407      src.push(`local(${name}${extra})`);
32408    }
32409  }
32410  if (alias) {
32411    const substitution = substitutionMap.get(alias);
32412    const aliasAppend = append || getStyleToAppend(style);
32413    Object.assign(result, generateFont(substitution, src, localFontPath, useFallback && !fallback, usePath && !path, aliasAppend));
32414  }
32415  if (style) {
32416    result.style = style;
32417  }
32418  if (ultimate) {
32419    result.ultimate = ultimate;
32420  }
32421  if (useFallback && fallback) {
32422    const fallbackInfo = substitutionMap.get(fallback);
32423    const {
32424      ultimate: fallbackUltimate
32425    } = generateFont(fallbackInfo, src, localFontPath, useFallback, usePath && !path, append);
32426    result.ultimate ||= fallbackUltimate;
32427  }
32428  if (usePath && path && localFontPath) {
32429    src.push(`url(${localFontPath}${path})`);
32430  }
32431  return result;
32432}
32433function getFontSubstitution(systemFontCache, idFactory, localFontPath, baseFontName, standardFontName, type) {
32434  if (baseFontName.startsWith("InvalidPDFjsFont_")) {
32435    return null;
32436  }
32437  if ((type === "TrueType" || type === "Type1") && /^[A-Z]{6}\+/.test(baseFontName)) {
32438    baseFontName = baseFontName.slice(7);
32439  }
32440  baseFontName = normalizeFontName(baseFontName);
32441  const key = baseFontName;
32442  let substitutionInfo = systemFontCache.get(key);
32443  if (substitutionInfo) {
32444    return substitutionInfo;
32445  }
32446  let substitution = substitutionMap.get(baseFontName);
32447  if (!substitution) {
32448    for (const [alias, subst] of fontAliases) {
32449      if (baseFontName.startsWith(alias)) {
32450        baseFontName = `${subst}${baseFontName.substring(alias.length)}`;
32451        substitution = substitutionMap.get(baseFontName);
32452        break;
32453      }
32454    }
32455  }
32456  let mustAddBaseFont = false;
32457  if (!substitution) {
32458    substitution = substitutionMap.get(standardFontName);
32459    mustAddBaseFont = true;
32460  }
32461  const loadedName = `${idFactory.getDocId()}_s${idFactory.createFontId()}`;
32462  if (!substitution) {
32463    if (!validateFontName(baseFontName)) {
32464      warn(`Cannot substitute the font because of its name: ${baseFontName}`);
32465      systemFontCache.set(key, null);
32466      return null;
32467    }
32468    const bold = /bold/gi.test(baseFontName);
32469    const italic = /oblique|italic/gi.test(baseFontName);
32470    const style = bold && italic && BOLDITALIC || bold && BOLD || italic && ITALIC || NORMAL;
32471    substitutionInfo = {
32472      css: `"${getFamilyName(baseFontName)}",${loadedName}`,
32473      guessFallback: true,
32474      loadedName,
32475      baseFontName,
32476      src: `local(${baseFontName})`,
32477      style
32478    };
32479    systemFontCache.set(key, substitutionInfo);
32480    return substitutionInfo;
32481  }
32482  const src = [];
32483  if (mustAddBaseFont && validateFontName(baseFontName)) {
32484    src.push(`local(${baseFontName})`);
32485  }
32486  const {
32487    style,
32488    ultimate
32489  } = generateFont(substitution, src, localFontPath);
32490  const guessFallback = ultimate === null;
32491  const fallback = guessFallback ? "" : `,${ultimate}`;
32492  substitutionInfo = {
32493    css: `"${getFamilyName(baseFontName)}",${loadedName}${fallback}`,
32494    guessFallback,
32495    loadedName,
32496    baseFontName,
32497    src: src.join(","),
32498    style
32499  };
32500  systemFontCache.set(key, substitutionInfo);
32501  return substitutionInfo;
32502}
32503
32504;// ./src/shared/murmurhash3.js
32505const SEED = 0xc3d2e1f0;
32506const MASK_HIGH = 0xffff0000;
32507const MASK_LOW = 0xffff;
32508class MurmurHash3_64 {
32509  constructor(seed) {
32510    this.h1 = seed ? seed & 0xffffffff : SEED;
32511    this.h2 = seed ? seed & 0xffffffff : SEED;
32512  }
32513  update(input) {
32514    let data, length;
32515    if (typeof input === "string") {
32516      data = new Uint8Array(input.length * 2);
32517      length = 0;
32518      for (let i = 0, ii = input.length; i < ii; i++) {
32519        const code = input.charCodeAt(i);
32520        if (code <= 0xff) {
32521          data[length++] = code;
32522        } else {
32523          data[length++] = code >>> 8;
32524          data[length++] = code & 0xff;
32525        }
32526      }
32527    } else if (ArrayBuffer.isView(input)) {
32528      data = input.slice();
32529      length = data.byteLength;
32530    } else {
32531      throw new Error("Invalid data format, must be a string or TypedArray.");
32532    }
32533    const blockCounts = length >> 2;
32534    const tailLength = length - blockCounts * 4;
32535    const dataUint32 = new Uint32Array(data.buffer, 0, blockCounts);
32536    let k1 = 0,
32537      k2 = 0;
32538    let h1 = this.h1,
32539      h2 = this.h2;
32540    const C1 = 0xcc9e2d51,
32541      C2 = 0x1b873593;
32542    const C1_LOW = C1 & MASK_LOW,
32543      C2_LOW = C2 & MASK_LOW;
32544    for (let i = 0; i < blockCounts; i++) {
32545      if (i & 1) {
32546        k1 = dataUint32[i];
32547        k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
32548        k1 = k1 << 15 | k1 >>> 17;
32549        k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
32550        h1 ^= k1;
32551        h1 = h1 << 13 | h1 >>> 19;
32552        h1 = h1 * 5 + 0xe6546b64;
32553      } else {
32554        k2 = dataUint32[i];
32555        k2 = k2 * C1 & MASK_HIGH | k2 * C1_LOW & MASK_LOW;
32556        k2 = k2 << 15 | k2 >>> 17;
32557        k2 = k2 * C2 & MASK_HIGH | k2 * C2_LOW & MASK_LOW;
32558        h2 ^= k2;
32559        h2 = h2 << 13 | h2 >>> 19;
32560        h2 = h2 * 5 + 0xe6546b64;
32561      }
32562    }
32563    k1 = 0;
32564    switch (tailLength) {
32565      case 3:
32566        k1 ^= data[blockCounts * 4 + 2] << 16;
32567      case 2:
32568        k1 ^= data[blockCounts * 4 + 1] << 8;
32569      case 1:
32570        k1 ^= data[blockCounts * 4];
32571        k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
32572        k1 = k1 << 15 | k1 >>> 17;
32573        k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
32574        if (blockCounts & 1) {
32575          h1 ^= k1;
32576        } else {
32577          h2 ^= k1;
32578        }
32579    }
32580    this.h1 = h1;
32581    this.h2 = h2;
32582  }
32583  hexdigest() {
32584    let h1 = this.h1,
32585      h2 = this.h2;
32586    h1 ^= h2 >>> 1;
32587    h1 = h1 * 0xed558ccd & MASK_HIGH | h1 * 0x8ccd & MASK_LOW;
32588    h2 = h2 * 0xff51afd7 & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xafd7ed55 & MASK_HIGH) >>> 16;
32589    h1 ^= h2 >>> 1;
32590    h1 = h1 * 0x1a85ec53 & MASK_HIGH | h1 * 0xec53 & MASK_LOW;
32591    h2 = h2 * 0xc4ceb9fe & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xb9fe1a85 & MASK_HIGH) >>> 16;
32592    h1 ^= h2 >>> 1;
32593    return (h1 >>> 0).toString(16).padStart(8, "0") + (h2 >>> 0).toString(16).padStart(8, "0");
32594  }
32595}
32596
32597;// ./src/core/image.js
32598
32599
32600
32601
32602
32603
32604
32605
32606
32607
32608
32609class PDFImage {
32610  constructor({
32611    xref,
32612    res,
32613    image,
32614    isInline = false,
32615    smask = null,
32616    mask = null,
32617    isMask = false,
32618    pdfFunctionFactory,
32619    globalColorSpaceCache,
32620    localColorSpaceCache
32621  }) {
32622    this.image = image;
32623    const dict = image.dict;
32624    const filter = dict.get("F", "Filter");
32625    let filterName;
32626    if (filter instanceof Name) {
32627      filterName = filter.name;
32628    } else if (Array.isArray(filter)) {
32629      const filterZero = xref.fetchIfRef(filter[0]);
32630      if (filterZero instanceof Name) {
32631        filterName = filterZero.name;
32632      }
32633    }
32634    switch (filterName) {
32635      case "JPXDecode":
32636        ({
32637          width: image.width,
32638          height: image.height,
32639          componentsCount: image.numComps,
32640          bitsPerComponent: image.bitsPerComponent
32641        } = JpxImage.parseImageProperties(image.stream));
32642        image.stream.reset();
32643        const reducePower = ImageResizer.getReducePowerForJPX(image.width, image.height, image.numComps);
32644        this.jpxDecoderOptions = {
32645          numComponents: 0,
32646          isIndexedColormap: false,
32647          smaskInData: dict.has("SMaskInData"),
32648          reducePower
32649        };
32650        if (reducePower) {
32651          const factor = 2 ** reducePower;
32652          image.width = Math.ceil(image.width / factor);
32653          image.height = Math.ceil(image.height / factor);
32654        }
32655        break;
32656      case "JBIG2Decode":
32657        image.bitsPerComponent = 1;
32658        image.numComps = 1;
32659        break;
32660    }
32661    let width = dict.get("W", "Width");
32662    let height = dict.get("H", "Height");
32663    if (Number.isInteger(image.width) && image.width > 0 && Number.isInteger(image.height) && image.height > 0 && (image.width !== width || image.height !== height)) {
32664      warn("PDFImage - using the Width/Height of the image data, " + "rather than the image dictionary.");
32665      width = image.width;
32666      height = image.height;
32667    } else {
32668      const validWidth = typeof width === "number" && width > 0,
32669        validHeight = typeof height === "number" && height > 0;
32670      if (!validWidth || !validHeight) {
32671        if (!image.fallbackDims) {
32672          throw new FormatError(`Invalid image width: ${width} or height: ${height}`);
32673        }
32674        warn("PDFImage - using the Width/Height of the parent image, for SMask/Mask data.");
32675        if (!validWidth) {
32676          width = image.fallbackDims.width;
32677        }
32678        if (!validHeight) {
32679          height = image.fallbackDims.height;
32680        }
32681      }
32682    }
32683    this.width = width;
32684    this.height = height;
32685    this.interpolate = dict.get("I", "Interpolate");
32686    this.imageMask = dict.get("IM", "ImageMask") || false;
32687    this.matte = dict.get("Matte") || false;
32688    let bitsPerComponent = image.bitsPerComponent;
32689    if (!bitsPerComponent) {
32690      bitsPerComponent = dict.get("BPC", "BitsPerComponent");
32691      if (!bitsPerComponent) {
32692        if (this.imageMask) {
32693          bitsPerComponent = 1;
32694        } else {
32695          throw new FormatError(`Bits per component missing in image: ${this.imageMask}`);
32696        }
32697      }
32698    }
32699    this.bpc = bitsPerComponent;
32700    if (!this.imageMask) {
32701      let colorSpace = dict.getRaw("CS") || dict.getRaw("ColorSpace");
32702      const hasColorSpace = !!colorSpace;
vendor: 8,738 bytes, lines 32702-33008
32702
32703      if (!hasColorSpace) {
32704        if (this.jpxDecoderOptions) {
32705          colorSpace = Name.get("DeviceRGBA");
32706        } else {
32707          switch (image.numComps) {
32708            case 1:
32709              colorSpace = Name.get("DeviceGray");
32710              break;
32711            case 3:
32712              colorSpace = Name.get("DeviceRGB");
32713              break;
32714            case 4:
32715              colorSpace = Name.get("DeviceCMYK");
32716              break;
32717            default:
32718              throw new Error(`Images with ${image.numComps} color components not supported.`);
32719          }
32720        }
32721      } else if (this.jpxDecoderOptions?.smaskInData) {
32722        colorSpace = Name.get("DeviceRGBA");
32723      }
32724      this.colorSpace = ColorSpaceUtils.parse({
32725        cs: colorSpace,
32726        xref,
32727        resources: isInline ? res : null,
32728        pdfFunctionFactory,
32729        globalColorSpaceCache,
32730        localColorSpaceCache
32731      });
32732      this.numComps = this.colorSpace.numComps;
32733      if (this.jpxDecoderOptions) {
32734        this.jpxDecoderOptions.numComponents = hasColorSpace ? this.numComps : 0;
32735        this.jpxDecoderOptions.isIndexedColormap = this.colorSpace.name === "Indexed";
32736      }
32737    } else {
32738      this.numComps = 1;
32739    }
32740    this.decode = dict.getArray("D", "Decode");
32741    this.needsDecode = false;
32742    if (this.decode && (this.colorSpace && !this.colorSpace.isDefaultDecode(this.decode, bitsPerComponent) || isMask && !ColorSpace.isDefaultDecode(this.decode, 1))) {
32743      this.needsDecode = true;
32744      const max = (1 << bitsPerComponent) - 1;
32745      this.decodeCoefficients = [];
32746      this.decodeAddends = [];
32747      const isIndexed = this.colorSpace?.name === "Indexed";
32748      for (let i = 0, j = 0; i < this.decode.length; i += 2, ++j) {
32749        const dmin = this.decode[i];
32750        const dmax = this.decode[i + 1];
32751        this.decodeCoefficients[j] = isIndexed ? (dmax - dmin) / max : dmax - dmin;
32752        this.decodeAddends[j] = isIndexed ? dmin : max * dmin;
32753      }
32754    }
32755    if (smask) {
32756      smask.fallbackDims ??= {
32757        width,
32758        height
32759      };
32760      this.smask = new PDFImage({
32761        xref,
32762        res,
32763        image: smask,
32764        isInline,
32765        pdfFunctionFactory,
32766        globalColorSpaceCache,
32767        localColorSpaceCache
32768      });
32769    } else if (mask) {
32770      if (mask instanceof BaseStream) {
32771        const maskDict = mask.dict,
32772          imageMask = maskDict.get("IM", "ImageMask");
32773        if (!imageMask) {
32774          warn("Ignoring /Mask in image without /ImageMask.");
32775        } else {
32776          mask.fallbackDims ??= {
32777            width,
32778            height
32779          };
32780          this.mask = new PDFImage({
32781            xref,
32782            res,
32783            image: mask,
32784            isInline,
32785            isMask: true,
32786            pdfFunctionFactory,
32787            globalColorSpaceCache,
32788            localColorSpaceCache
32789          });
32790        }
32791      } else {
32792        this.mask = mask;
32793      }
32794    }
32795  }
32796  static async buildImage({
32797    xref,
32798    res,
32799    image,
32800    isInline = false,
32801    pdfFunctionFactory,
32802    globalColorSpaceCache,
32803    localColorSpaceCache
32804  }) {
32805    const imageData = image;
32806    let smaskData = null;
32807    let maskData = null;
32808    const smask = image.dict.get("SMask");
32809    const mask = image.dict.get("Mask");
32810    if (smask) {
32811      if (smask instanceof BaseStream) {
32812        smaskData = smask;
32813      } else {
32814        warn("Unsupported /SMask format.");
32815      }
32816    } else if (mask) {
32817      if (mask instanceof BaseStream || Array.isArray(mask)) {
32818        maskData = mask;
32819      } else {
32820        warn("Unsupported /Mask format.");
32821      }
32822    }
32823    return new PDFImage({
32824      xref,
32825      res,
32826      image: imageData,
32827      isInline,
32828      smask: smaskData,
32829      mask: maskData,
32830      pdfFunctionFactory,
32831      globalColorSpaceCache,
32832      localColorSpaceCache
32833    });
32834  }
32835  static async createMask({
32836    image,
32837    isOffscreenCanvasSupported = false
32838  }) {
32839    const {
32840      dict
32841    } = image;
32842    const width = dict.get("W", "Width");
32843    const height = dict.get("H", "Height");
32844    const interpolate = dict.get("I", "Interpolate");
32845    const decode = dict.getArray("D", "Decode");
32846    const inverseDecode = decode?.[0] > 0;
32847    const computedLength = (width + 7 >> 3) * height;
32848    const imgArray = await image.getImageData(computedLength);
32849    const isSingleOpaquePixel = width === 1 && height === 1 && inverseDecode === (imgArray.length === 0 || !!(imgArray[0] & 128));
32850    if (isSingleOpaquePixel) {
32851      return {
32852        isSingleOpaquePixel
32853      };
32854    }
32855    if (isOffscreenCanvasSupported) {
32856      if (ImageResizer.needsToBeResized(width, height)) {
32857        const data = new Uint8ClampedArray(width * height * 4);
32858        convertBlackAndWhiteToRGBA({
32859          src: imgArray,
32860          dest: data,
32861          width,
32862          height,
32863          nonBlackColor: 0,
32864          inverseDecode
32865        });
32866        return ImageResizer.createImage({
32867          kind: ImageKind.RGBA_32BPP,
32868          data,
32869          width,
32870          height,
32871          interpolate
32872        });
32873      }
32874      const canvas = new OffscreenCanvas(width, height);
32875      const ctx = canvas.getContext("2d");
32876      const imgData = ctx.createImageData(width, height);
32877      convertBlackAndWhiteToRGBA({
32878        src: imgArray,
32879        dest: imgData.data,
32880        width,
32881        height,
32882        nonBlackColor: 0,
32883        inverseDecode
32884      });
32885      ctx.putImageData(imgData, 0, 0);
32886      const bitmap = canvas.transferToImageBitmap();
32887      return {
32888        data: null,
32889        width,
32890        height,
32891        interpolate,
32892        bitmap
32893      };
32894    }
32895    const actualLength = imgArray.byteLength;
32896    const haveFullData = computedLength === actualLength;
32897    let data;
32898    if (image instanceof DecodeStream && (!inverseDecode || haveFullData)) {
32899      data = imgArray;
32900    } else if (!inverseDecode) {
32901      data = new Uint8Array(imgArray);
32902    } else {
32903      data = new Uint8Array(computedLength);
32904      data.set(imgArray);
32905      data.fill(0xff, actualLength);
32906    }
32907    if (inverseDecode) {
32908      for (let i = 0; i < actualLength; i++) {
32909        data[i] ^= 0xff;
32910      }
32911    }
32912    return {
32913      data,
32914      width,
32915      height,
32916      interpolate
32917    };
32918  }
32919  get drawWidth() {
32920    return Math.max(this.width, this.smask?.width || 0, this.mask?.width || 0);
32921  }
32922  get drawHeight() {
32923    return Math.max(this.height, this.smask?.height || 0, this.mask?.height || 0);
32924  }
32925  decodeBuffer(buffer) {
32926    const bpc = this.bpc;
32927    const numComps = this.numComps;
32928    const decodeAddends = this.decodeAddends;
32929    const decodeCoefficients = this.decodeCoefficients;
32930    const max = (1 << bpc) - 1;
32931    let i, ii;
32932    if (bpc === 1) {
32933      for (i = 0, ii = buffer.length; i < ii; i++) {
32934        buffer[i] = +!buffer[i];
32935      }
32936      return;
32937    }
32938    let index = 0;
32939    for (i = 0, ii = this.width * this.height; i < ii; i++) {
32940      for (let j = 0; j < numComps; j++) {
32941        buffer[index] = MathClamp(decodeAddends[j] + buffer[index] * decodeCoefficients[j], 0, max);
32942        index++;
32943      }
32944    }
32945  }
32946  getComponents(buffer) {
32947    const bpc = this.bpc;
32948    if (bpc === 8) {
32949      return buffer;
32950    }
32951    const width = this.width;
32952    const height = this.height;
32953    const numComps = this.numComps;
32954    const length = width * height * numComps;
32955    let bufferPos = 0;
32956    let output;
32957    if (bpc <= 8) {
32958      output = new Uint8Array(length);
32959    } else if (bpc <= 16) {
32960      output = new Uint16Array(length);
32961    } else {
32962      output = new Uint32Array(length);
32963    }
32964    const rowComps = width * numComps;
32965    const max = (1 << bpc) - 1;
32966    let i = 0,
32967      ii,
32968      buf;
32969    if (bpc === 1) {
32970      let mask, loop1End, loop2End;
32971      for (let j = 0; j < height; j++) {
32972        loop1End = i + (rowComps & ~7);
32973        loop2End = i + rowComps;
32974        while (i < loop1End) {
32975          buf = buffer[bufferPos++];
32976          output[i] = buf >> 7 & 1;
32977          output[i + 1] = buf >> 6 & 1;
32978          output[i + 2] = buf >> 5 & 1;
32979          output[i + 3] = buf >> 4 & 1;
32980          output[i + 4] = buf >> 3 & 1;
32981          output[i + 5] = buf >> 2 & 1;
32982          output[i + 6] = buf >> 1 & 1;
32983          output[i + 7] = buf & 1;
32984          i += 8;
32985        }
32986        if (i < loop2End) {
32987          buf = buffer[bufferPos++];
32988          mask = 128;
32989          while (i < loop2End) {
32990            output[i++] = +!!(buf & mask);
32991            mask >>= 1;
32992          }
32993        }
32994      }
32995    } else {
32996      let bits = 0;
32997      buf = 0;
32998      for (i = 0, ii = length; i < ii; ++i) {
32999        if (i % rowComps === 0) {
33000          buf = 0;
33001          bits = 0;
33002        }
33003        while (bits < bpc) {
33004          buf = buf << 8 | buffer[bufferPos++];
33005          bits += 8;
33006        }
33007        const remainingBits = bits - bpc;
33008        
vendor: 1,863 bytes, lines 33008-33073
33008let value = buf >> remainingBits;
33009        if (value < 0) {
33010          value = 0;
33011        } else if (value > max) {
33012          value = max;
33013        }
33014        output[i] = value;
33015        buf &= (1 << remainingBits) - 1;
33016        bits = remainingBits;
33017      }
33018    }
33019    return output;
33020  }
33021  async fillOpacity(rgbaBuf, width, height, actualHeight, image) {
33022    let apply;
33023    if (this.smask) {
33024      apply = (buffer, options) => this.smask.fillGrayBuffer(buffer, {
33025        ...options,
33026        destWidth: width,
33027        destHeight: height
33028      });
33029    } else if (this.mask) {
33030      if (this.mask instanceof PDFImage) {
33031        apply = (buffer, options) => this.mask.fillGrayBuffer(buffer, {
33032          ...options,
33033          invertOutput: true,
33034          destWidth: width,
33035          destHeight: height
33036        });
33037      } else if (Array.isArray(this.mask)) {
33038        apply = (buffer, {
33039          maxRows,
33040          offset,
33041          stride
33042        }) => {
33043          for (let i = 0, ii = width * maxRows; i < ii; ++i) {
33044            let opacity = 0;
33045            const imageOffset = i * this.numComps;
33046            for (let j = 0; j < this.numComps; ++j) {
33047              const color = image[imageOffset + j];
33048              const maskOffset = j * 2;
33049              if (color < this.mask[maskOffset] || color > this.mask[maskOffset + 1]) {
33050                opacity = 255;
33051                break;
33052              }
33053            }
33054            buffer[i * stride + offset] = opacity;
33055          }
33056        };
33057      } else {
33058        throw new FormatError("Unknown mask format.");
33059      }
33060    } else {
33061      apply = (buffer, {
33062        maxRows,
33063        offset,
33064        stride
33065      }) => {
33066        for (let i = 0, ii = width * maxRows; i < ii; ++i) {
33067          buffer[i * stride + offset] = 255;
33068        }
33069      };
33070    }
33071    await apply(rgbaBuf, {
33072      maxRows: actualHeight,
33073      offset: 3,
vendor: 5,378 bytes, lines 33074-33224
33074      stride: 4
33075    });
33076  }
33077  undoPreblend(buffer, width, height) {
33078    const matte = this.smask?.matte;
33079    if (!matte) {
33080      return;
33081    }
33082    const matteRgb = this.colorSpace.getRgb(matte, 0);
33083    const matteR = matteRgb[0];
33084    const matteG = matteRgb[1];
33085    const matteB = matteRgb[2];
33086    const length = width * height * 4;
33087    for (let i = 0; i < length; i += 4) {
33088      const alpha = buffer[i + 3];
33089      if (alpha === 0) {
33090        buffer[i] = 255;
33091        buffer[i + 1] = 255;
33092        buffer[i + 2] = 255;
33093        continue;
33094      }
33095      const k = 255 / alpha;
33096      buffer[i] = (buffer[i] - matteR) * k + matteR;
33097      buffer[i + 1] = (buffer[i + 1] - matteG) * k + matteG;
33098      buffer[i + 2] = (buffer[i + 2] - matteB) * k + matteB;
33099    }
33100  }
33101  async createImageData(forceRGBA = false, isOffscreenCanvasSupported = false) {
33102    const drawWidth = this.drawWidth;
33103    const drawHeight = this.drawHeight;
33104    const imgData = {
33105      width: drawWidth,
33106      height: drawHeight,
33107      interpolate: this.interpolate,
33108      kind: 0,
33109      data: null
33110    };
33111    const numComps = this.numComps;
33112    const originalWidth = this.width;
33113    const originalHeight = this.height;
33114    const bpc = this.bpc;
33115    const rowBytes = originalWidth * numComps * bpc + 7 >> 3;
33116    const mustBeResized = isOffscreenCanvasSupported && ImageResizer.needsToBeResized(drawWidth, drawHeight);
33117    if (!this.smask && !this.mask && this.colorSpace.name === "DeviceRGBA") {
33118      imgData.kind = ImageKind.RGBA_32BPP;
33119      const imgArray = imgData.data = await this.getImageBytes(originalHeight * originalWidth * 4, {
33120        internal: isOffscreenCanvasSupported && mustBeResized
33121      });
33122      if (isOffscreenCanvasSupported) {
33123        if (!mustBeResized) {
33124          return this.createBitmap(ImageKind.RGBA_32BPP, drawWidth, drawHeight, imgArray);
33125        }
33126        return ImageResizer.createImage(imgData, false);
33127      }
33128      return imgData;
33129    }
33130    if (!forceRGBA) {
33131      let kind;
33132      if (this.colorSpace.name === "DeviceGray" && bpc === 1) {
33133        kind = ImageKind.GRAYSCALE_1BPP;
33134      } else if (this.colorSpace.name === "DeviceRGB" && bpc === 8 && !this.needsDecode) {
33135        kind = ImageKind.RGB_24BPP;
33136      }
33137      if (kind && !this.smask && !this.mask && drawWidth === originalWidth && drawHeight === originalHeight) {
33138        const image = await this.#getImage(originalWidth, originalHeight);
33139        if (image) {
33140          return image;
33141        }
33142        const data = await this.getImageBytes(originalHeight * rowBytes, {
33143          internal: isOffscreenCanvasSupported && mustBeResized
33144        });
33145        if (isOffscreenCanvasSupported) {
33146          if (mustBeResized) {
33147            return ImageResizer.createImage({
33148              data,
33149              kind,
33150              width: drawWidth,
33151              height: drawHeight,
33152              interpolate: this.interpolate
33153            }, this.needsDecode);
33154          }
33155          return this.createBitmap(kind, originalWidth, originalHeight, data);
33156        }
33157        imgData.kind = kind;
33158        imgData.data = data;
33159        if (this.needsDecode) {
33160          assert(kind === ImageKind.GRAYSCALE_1BPP, "PDFImage.createImageData: The image must be grayscale.");
33161          const buffer = imgData.data;
33162          for (let i = 0, ii = buffer.length; i < ii; i++) {
33163            buffer[i] ^= 0xff;
33164          }
33165        }
33166        return imgData;
33167      }
33168      if (this.image instanceof JpegStream && !this.smask && !this.mask && !this.needsDecode) {
33169        let imageLength = originalHeight * rowBytes;
33170        if (isOffscreenCanvasSupported && !mustBeResized) {
33171          let isHandled = false;
33172          switch (this.colorSpace.name) {
33173            case "DeviceGray":
33174              imageLength *= 4;
33175              isHandled = true;
33176              break;
33177            case "DeviceRGB":
33178              imageLength = imageLength / 3 * 4;
33179              isHandled = true;
33180              break;
33181            case "DeviceCMYK":
33182              isHandled = true;
33183              break;
33184          }
33185          if (isHandled) {
33186            const image = await this.#getImage(drawWidth, drawHeight);
33187            if (image) {
33188              return image;
33189            }
33190            const rgba = await this.getImageBytes(imageLength, {
33191              drawWidth,
33192              drawHeight,
33193              forceRGBA: true,
33194              internal: true
33195            });
33196            return this.createBitmap(ImageKind.RGBA_32BPP, drawWidth, drawHeight, rgba);
33197          }
33198        } else {
33199          switch (this.colorSpace.name) {
33200            case "DeviceGray":
33201              imageLength *= 3;
33202            case "DeviceRGB":
33203            case "DeviceCMYK":
33204              imgData.kind = ImageKind.RGB_24BPP;
33205              imgData.data = await this.getImageBytes(imageLength, {
33206                drawWidth,
33207                drawHeight,
33208                forceRGB: true,
33209                internal: mustBeResized
33210              });
33211              if (mustBeResized) {
33212                return ImageResizer.createImage(imgData);
33213              }
33214              return imgData;
33215          }
33216        }
33217      }
33218    }
33219    const imgArray = await this.getImageBytes(originalHeight * rowBytes, {
33220      internal: true
33221    });
33222    const actualHeight = 0 | imgArray.length / rowBytes * drawHeight / originalHeight;
33223    const comps = this.getComponents(imgArray);
33224    let alpha01, maybeUndoPreblend;
vendor: 8,475 bytes, lines 33225-33538
33225    let canvas, ctx, canvasImgData, data;
33226    if (isOffscreenCanvasSupported && !mustBeResized) {
33227      canvas = new OffscreenCanvas(drawWidth, drawHeight);
33228      ctx = canvas.getContext("2d");
33229      canvasImgData = ctx.createImageData(drawWidth, drawHeight);
33230      data = canvasImgData.data;
33231    }
33232    imgData.kind = ImageKind.RGBA_32BPP;
33233    if (!forceRGBA && !this.smask && !this.mask) {
33234      if (!isOffscreenCanvasSupported || mustBeResized) {
33235        imgData.kind = ImageKind.RGB_24BPP;
33236        data = new Uint8ClampedArray(drawWidth * drawHeight * 3);
33237        alpha01 = 0;
33238      } else {
33239        const arr = new Uint32Array(data.buffer);
33240        arr.fill(FeatureTest.isLittleEndian ? 0xff000000 : 0x000000ff);
33241        alpha01 = 1;
33242      }
33243      maybeUndoPreblend = false;
33244    } else {
33245      if (!isOffscreenCanvasSupported || mustBeResized) {
33246        data = new Uint8ClampedArray(drawWidth * drawHeight * 4);
33247      }
33248      alpha01 = 1;
33249      maybeUndoPreblend = true;
33250      await this.fillOpacity(data, drawWidth, drawHeight, actualHeight, comps);
33251    }
33252    if (this.needsDecode) {
33253      this.decodeBuffer(comps);
33254    }
33255    this.colorSpace.fillRgb(data, originalWidth, originalHeight, drawWidth, drawHeight, actualHeight, bpc, comps, alpha01);
33256    if (maybeUndoPreblend) {
33257      this.undoPreblend(data, drawWidth, actualHeight);
33258    }
33259    if (isOffscreenCanvasSupported && !mustBeResized) {
33260      ctx.putImageData(canvasImgData, 0, 0);
33261      const bitmap = canvas.transferToImageBitmap();
33262      return {
33263        data: null,
33264        width: drawWidth,
33265        height: drawHeight,
33266        bitmap,
33267        interpolate: this.interpolate
33268      };
33269    }
33270    imgData.data = data;
33271    if (mustBeResized) {
33272      return ImageResizer.createImage(imgData);
33273    }
33274    return imgData;
33275  }
33276  async fillGrayBuffer(buffer, {
33277    destWidth,
33278    destHeight,
33279    invertOutput,
33280    maxRows,
33281    offset = 0,
33282    stride = 1
33283  } = {}) {
33284    const numComps = this.numComps;
33285    if (numComps !== 1) {
33286      throw new FormatError(`Reading gray scale from a color image: ${numComps}`);
33287    }
33288    const srcWidth = this.width;
33289    const srcHeight = this.height;
33290    const bpc = this.bpc;
33291    const rowBytes = srcWidth * numComps * bpc + 7 >> 3;
33292    const imgArray = await this.getImageBytes(srcHeight * rowBytes, {
33293      internal: true
33294    });
33295    const comps = this.getComponents(imgArray);
33296    const resolvedDestWidth = destWidth ?? srcWidth;
33297    const resolvedDestHeight = destHeight ?? srcHeight;
33298    const needsResampling = resolvedDestWidth !== srcWidth || resolvedDestHeight !== srcHeight;
33299    const rows = maxRows === undefined ? resolvedDestHeight : Math.min(resolvedDestHeight, maxRows);
33300    let outputWidth = srcWidth;
33301    let yRatio = 0;
33302    let xScaled = null;
33303    if (needsResampling) {
33304      outputWidth = resolvedDestWidth;
33305      yRatio = srcHeight / resolvedDestHeight;
33306      const xRatio = srcWidth / resolvedDestWidth;
33307      xScaled = new Uint32Array(resolvedDestWidth);
33308      for (let i = 0; i < resolvedDestWidth; i++) {
33309        xScaled[i] = Math.floor(i * xRatio);
33310      }
33311    }
33312    const mask = invertOutput ? 0xff : 0;
33313    if (bpc === 1) {
33314      if (xScaled) {
33315        const xMap = xScaled;
33316        let destIndex = offset;
33317        if (this.needsDecode) {
33318          for (let row = 0; row < rows; row++) {
33319            const py = Math.floor(row * yRatio) * srcWidth;
33320            for (let col = 0; col < outputWidth; col++) {
33321              buffer[destIndex] = comps[py + xMap[col]] - 1 & 255 ^ mask;
33322              destIndex += stride;
33323            }
33324          }
33325        } else {
33326          for (let row = 0; row < rows; row++) {
33327            const py = Math.floor(row * yRatio) * srcWidth;
33328            for (let col = 0; col < outputWidth; col++) {
33329              buffer[destIndex] = -comps[py + xMap[col]] & 255 ^ mask;
33330              destIndex += stride;
33331            }
33332          }
33333        }
33334      } else {
33335        const length = outputWidth * rows;
33336        if (this.needsDecode) {
33337          for (let i = 0; i < length; ++i) {
33338            buffer[i * stride + offset] = comps[i] - 1 & 255 ^ mask;
33339          }
33340        } else {
33341          for (let i = 0; i < length; ++i) {
33342            buffer[i * stride + offset] = -comps[i] & 255 ^ mask;
33343          }
33344        }
33345      }
33346      return;
33347    }
33348    if (this.needsDecode) {
33349      this.decodeBuffer(comps);
33350    }
33351    const scale = 255 / ((1 << bpc) - 1);
33352    if (xScaled) {
33353      const xMap = xScaled;
33354      let destIndex = offset;
33355      for (let row = 0; row < rows; row++) {
33356        const py = Math.floor(row * yRatio) * srcWidth;
33357        for (let col = 0; col < outputWidth; col++) {
33358          buffer[destIndex] = scale * comps[py + xMap[col]] ^ mask;
33359          destIndex += stride;
33360        }
33361      }
33362    } else {
33363      const length = outputWidth * rows;
33364      for (let i = 0; i < length; ++i) {
33365        buffer[i * stride + offset] = scale * comps[i] ^ mask;
33366      }
33367    }
33368  }
33369  createBitmap(kind, width, height, src) {
33370    const canvas = new OffscreenCanvas(width, height);
33371    const ctx = canvas.getContext("2d");
33372    let imgData;
33373    if (kind === ImageKind.RGBA_32BPP) {
33374      imgData = new ImageData(src, width, height);
33375    } else {
33376      imgData = ctx.createImageData(width, height);
33377      convertToRGBA({
33378        kind,
33379        src,
33380        dest: new Uint32Array(imgData.data.buffer),
33381        width,
33382        height,
33383        inverseDecode: this.needsDecode
33384      });
33385    }
33386    ctx.putImageData(imgData, 0, 0);
33387    const bitmap = canvas.transferToImageBitmap();
33388    return {
33389      data: null,
33390      width,
33391      height,
33392      bitmap,
33393      interpolate: this.interpolate
33394    };
33395  }
33396  async #getImage(width, height) {
33397    const bitmap = await this.image.getTransferableImage();
33398    if (!bitmap) {
33399      return null;
33400    }
33401    return {
33402      data: null,
33403      width,
33404      height,
33405      bitmap,
33406      interpolate: this.interpolate
33407    };
33408  }
33409  async getImageBytes(length, {
33410    drawWidth,
33411    drawHeight,
33412    forceRGBA = false,
33413    forceRGB = false,
33414    internal = false
33415  }) {
33416    this.image.reset();
33417    this.image.drawWidth = drawWidth || this.width;
33418    this.image.drawHeight = drawHeight || this.height;
33419    this.image.forceRGBA = !!forceRGBA;
33420    this.image.forceRGB = !!forceRGB;
33421    const imageBytes = await this.image.getImageData(length, this.jpxDecoderOptions);
33422    if (internal || this.image instanceof DecodeStream) {
33423      return imageBytes;
33424    }
33425    assert(imageBytes instanceof Uint8Array, 'PDFImage.getImageBytes: Unsupported "imageBytes" type.');
33426    return new Uint8Array(imageBytes);
33427  }
33428}
33429
33430;// ./src/core/evaluator.js
33431
33432
33433
33434
33435
33436
33437
33438
33439
33440
33441
33442
33443
33444
33445
33446
33447
33448
33449
33450
33451
33452
33453
33454
33455
33456
33457
33458const DefaultPartialEvaluatorOptions = Object.freeze({
33459  maxImageSize: -1,
33460  disableFontFace: false,
33461  ignoreErrors: false,
33462  isOffscreenCanvasSupported: false,
33463  isImageDecoderSupported: false,
33464  canvasMaxAreaInBytes: -1,
33465  fontExtraProperties: false,
33466  useSystemFonts: true,
33467  useWasm: true,
33468  useWorkerFetch: true,
33469  cMapUrl: null,
33470  cMapPacked: true,
33471  iccUrl: null,
33472  standardFontDataUrl: null,
33473  wasmUrl: null,
33474  hasGPU: false
33475});
33476const PatternType = {
33477  TILING: 1,
33478  SHADING: 2
33479};
33480const TEXT_CHUNK_BATCH_SIZE = 10;
33481const deferred = Promise.resolve();
33482function normalizeBlendMode(value, parsingArray = false) {
33483  if (Array.isArray(value)) {
33484    for (const val of value) {
33485      const maybeBM = normalizeBlendMode(val, true);
33486      if (maybeBM) {
33487        return maybeBM;
33488      }
33489    }
33490    warn(`Unsupported blend mode Array: ${value}`);
33491    return "source-over";
33492  }
33493  if (!(value instanceof Name)) {
33494    if (parsingArray) {
33495      return null;
33496    }
33497    return "source-over";
33498  }
33499  switch (value.name) {
33500    case "Normal":
33501    case "Compatible":
33502      return "source-over";
33503    case "Multiply":
33504      return "multiply";
33505    case "Screen":
33506      return "screen";
33507    case "Overlay":
33508      return "overlay";
33509    case "Darken":
33510      return "darken";
33511    case "Lighten":
33512      return "lighten";
33513    case "ColorDodge":
33514      return "color-dodge";
33515    case "ColorBurn":
33516      return "color-burn";
33517    case "HardLight":
33518      return "hard-light";
33519    case "SoftLight":
33520      return "soft-light";
33521    case "Difference":
33522      return "difference";
33523    case "Exclusion":
33524      return "exclusion";
33525    case "Hue":
33526      return "hue";
33527    case "Saturation":
33528      return "saturation";
33529    case "Color":
33530      return "color";
33531    case "Luminosity":
33532      return "luminosity";
33533  }
33534  if (parsingArray) {
33535    return null;
33536  }
33537  warn(`Unsupported blend mode: ${value.name}`);
33538  return
vendor: 7,338 bytes, lines 33538-33787
33538 "source-over";
33539}
33540function addCachedImageOps(opList, {
33541  objId,
33542  fn,
33543  args,
33544  optionalContent,
33545  hasMask
33546}) {
33547  if (objId) {
33548    opList.addDependency(objId);
33549  }
33550  opList.addImageOps(fn, args, optionalContent, hasMask);
33551  if (fn === OPS.paintImageMaskXObject && args[0]?.count > 0) {
33552    args[0].count++;
33553  }
33554}
33555class TimeSlotManager {
33556  static TIME_SLOT_DURATION_MS = 20;
33557  static CHECK_TIME_EVERY = 100;
33558  constructor() {
33559    this.reset();
33560  }
33561  check() {
33562    if (++this.checked < TimeSlotManager.CHECK_TIME_EVERY) {
33563      return false;
33564    }
33565    this.checked = 0;
33566    return this.endTime <= Date.now();
33567  }
33568  reset() {
33569    this.endTime = Date.now() + TimeSlotManager.TIME_SLOT_DURATION_MS;
33570    this.checked = 0;
33571  }
33572}
33573class PartialEvaluator {
33574  constructor({
33575    xref,
33576    handler,
33577    pageIndex,
33578    idFactory,
33579    fontCache,
33580    builtInCMapCache,
33581    standardFontDataCache,
33582    globalColorSpaceCache,
33583    globalImageCache,
33584    systemFontCache,
33585    options = null
33586  }) {
33587    this.xref = xref;
33588    this.handler = handler;
33589    this.pageIndex = pageIndex;
33590    this.idFactory = idFactory;
33591    this.fontCache = fontCache;
33592    this.builtInCMapCache = builtInCMapCache;
33593    this.standardFontDataCache = standardFontDataCache;
33594    this.globalColorSpaceCache = globalColorSpaceCache;
33595    this.globalImageCache = globalImageCache;
33596    this.systemFontCache = systemFontCache;
33597    this.options = options || DefaultPartialEvaluatorOptions;
33598    this.type3FontRefs = null;
33599    this._regionalImageCache = new RegionalImageCache();
33600    this._fetchBuiltInCMapBound = this.fetchBuiltInCMap.bind(this);
33601  }
33602  get _pdfFunctionFactory() {
33603    return shadow(this, "_pdfFunctionFactory", new PDFFunctionFactory({
33604      xref: this.xref
33605    }));
33606  }
33607  get parsingType3Font() {
33608    return !!this.type3FontRefs;
33609  }
33610  clone(newOptions = null) {
33611    const newEvaluator = Object.create(this);
33612    newEvaluator.options = Object.assign(Object.create(null), this.options, newOptions);
33613    return newEvaluator;
33614  }
33615  hasBlendModes(resources, nonBlendModesSet) {
33616    if (!(resources instanceof Dict)) {
33617      return false;
33618    }
33619    if (resources.objId && nonBlendModesSet.has(resources.objId)) {
33620      return false;
33621    }
33622    const processed = new RefSet(nonBlendModesSet);
33623    if (resources.objId) {
33624      processed.put(resources.objId);
33625    }
33626    const nodes = [resources],
33627      xref = this.xref;
33628    while (nodes.length) {
33629      const node = nodes.shift();
33630      const graphicStates = node.get("ExtGState");
33631      if (graphicStates instanceof Dict) {
33632        for (let graphicState of graphicStates.getRawValues()) {
33633          if (graphicState instanceof Ref) {
33634            if (processed.has(graphicState)) {
33635              continue;
33636            }
33637            try {
33638              graphicState = xref.fetch(graphicState);
33639            } catch (ex) {
33640              processed.put(graphicState);
33641              info(`hasBlendModes - ignoring ExtGState: "${ex}".`);
33642              continue;
33643            }
33644          }
33645          if (!(graphicState instanceof Dict)) {
33646            continue;
33647          }
33648          if (graphicState.objId) {
33649            processed.put(graphicState.objId);
33650          }
33651          const bm = graphicState.get("BM");
33652          if (bm instanceof Name) {
33653            if (bm.name !== "Normal") {
33654              return true;
33655            }
33656            continue;
33657          }
33658          if (bm !== undefined && Array.isArray(bm)) {
33659            for (const element of bm) {
33660              if (element instanceof Name && element.name !== "Normal") {
33661                return true;
33662              }
33663            }
33664          }
33665        }
33666      }
33667      const xObjects = node.get("XObject");
33668      if (!(xObjects instanceof Dict)) {
33669        continue;
33670      }
33671      for (let xObject of xObjects.getRawValues()) {
33672        if (xObject instanceof Ref) {
33673          if (processed.has(xObject)) {
33674            continue;
33675          }
33676          try {
33677            xObject = xref.fetch(xObject);
33678          } catch (ex) {
33679            processed.put(xObject);
33680            info(`hasBlendModes - ignoring XObject: "${ex}".`);
33681            continue;
33682          }
33683        }
33684        if (!(xObject instanceof BaseStream)) {
33685          continue;
33686        }
33687        if (xObject.dict.objId) {
33688          processed.put(xObject.dict.objId);
33689        }
33690        const xResources = xObject.dict.get("Resources");
33691        if (!(xResources instanceof Dict)) {
33692          continue;
33693        }
33694        if (xResources.objId && processed.has(xResources.objId)) {
33695          continue;
33696        }
33697        nodes.push(xResources);
33698        if (xResources.objId) {
33699          processed.put(xResources.objId);
33700        }
33701      }
33702    }
33703    for (const ref of processed) {
33704      nonBlendModesSet.put(ref);
33705    }
33706    return false;
33707  }
33708  async fetchBuiltInCMap(name) {
33709    const cachedData = this.builtInCMapCache.get(name);
33710    if (cachedData) {
33711      return cachedData;
33712    }
33713    let data;
33714    if (this.options.useWorkerFetch) {
33715      data = {
33716        cMapData: await fetchBinaryData(`${this.options.cMapUrl}${name}.bcmap`),
33717        isCompressed: true
33718      };
33719    } else {
33720      data = {
33721        cMapData: await this.handler.sendWithPromise("FetchBinaryData", {
33722          kind: "cMapUrl",
33723          filename: `${name}${this.options.cMapPacked ? ".bcmap" : ""}`
33724        }),
33725        isCompressed: this.options.cMapPacked
33726      };
33727    }
33728    this.builtInCMapCache.set(name, data);
33729    return data;
33730  }
33731  async fetchStandardFontData(name) {
33732    const cachedData = this.standardFontDataCache.get(name);
33733    if (cachedData) {
33734      return new Stream(cachedData);
33735    }
33736    if (this.options.useSystemFonts && name !== "Symbol" && name !== "ZapfDingbats") {
33737      return null;
33738    }
33739    const standardFontNameToFileName = getFontNameToFileMap(),
33740      filename = standardFontNameToFileName[name];
33741    let data;
33742    try {
33743      if (this.options.useWorkerFetch) {
33744        data = await fetchBinaryData(`${this.options.standardFontDataUrl}${filename}`);
33745      } else {
33746        data = await this.handler.sendWithPromise("FetchBinaryData", {
33747          kind: "standardFontDataUrl",
33748          filename
33749        });
33750      }
33751    } catch (ex) {
33752      warn(ex);
33753      return null;
33754    }
33755    this.standardFontDataCache.set(name, data);
33756    return new Stream(data);
33757  }
33758  async buildFormXObject(resources, xobj, smask, operatorList, task, initialState, localColorSpaceCache, seenRefs) {
33759    const {
33760      dict
33761    } = xobj;
33762    const matrix = lookupMatrix(dict.getArray("Matrix"), null);
33763    const bbox = lookupNormalRect(dict.getArray("BBox"), null);
33764    let f32bbox = bbox && new Float32Array(bbox);
33765    if (f32bbox?.some(x => !isFinite(x))) {
33766      f32bbox = null;
33767    }
33768    let optionalContent, groupOptions;
33769    if (dict.has("OC")) {
33770      optionalContent = await this.parseMarkedContentProps(dict.get("OC"), resources);
33771    }
33772    if (optionalContent !== undefined) {
33773      operatorList.addOp(OPS.beginMarkedContentProps, ["OC", optionalContent]);
33774    }
33775    const group = dict.get("Group");
33776    let newOpList;
33777    const f32matrix = matrix && new Float32Array(matrix);
33778    const args = [f32matrix, !group && f32bbox || null];
33779    const localResources = dict.get("Resources");
33780    if (group) {
33781      groupOptions = {
33782        matrix,
33783        bbox: f32bbox,
33784        smask,
33785        isolated: false,
33786        knockout: false,
33787        needsIsolation: false
33787
33788      };
33789      const groupSubtype = group.get("S");
33790      let colorSpace = null;
33791      if (isName(groupSubtype, "Transparency")) {
33792        groupOptions.isolated = group.get("I") || false;
33793        groupOptions.knockout = group.get("K") || false;
33794        if (group.has("CS")) {
33795          const cs = this._getColorSpace(group.getRaw("CS"), resources, localColorSpaceCache);
33796          colorSpace = cs instanceof ColorSpace ? cs : await this._handleColorSpace(cs);
33797        }
33798      }
33799      if (smask?.backdrop) {
33800        colorSpace ||= ColorSpaceUtils.rgb;
33801        smask.backdrop = colorSpace.getRgbHex(smask.backdrop, 0);
33802      }
33803      newOpList = new CheckedOperatorList();
33804    } else {
33805      newOpList = operatorList;
33806      operatorList.addOp(OPS.paintFormXObjectBegin, args);
33807    }
33808    await this.getOperatorList({
33809      stream: xobj,
33810      task,
33811      resources: localResources instanceof Dict ? localResources : resources,
33812      operatorList: newOpList,
33813      initialState,
33814      prevRefs: seenRefs
33815    });
33816    if (group) {
33817      groupOptions.needsIsolation = newOpList.needsIsolation
vendor: 7,352 bytes, lines 33817-34040
33817 || !!smask;
33818      operatorList.addOp(OPS.beginGroup, [groupOptions]);
33819      operatorList.addOp(OPS.paintFormXObjectBegin, args);
33820      operatorList.addOpList(newOpList);
33821      operatorList.addOp(OPS.paintFormXObjectEnd, []);
33822      operatorList.addOp(OPS.endGroup, [groupOptions]);
33823    } else {
33824      operatorList.addOp(OPS.paintFormXObjectEnd, []);
33825    }
33826    if (optionalContent !== undefined) {
33827      operatorList.addOp(OPS.endMarkedContent, []);
33828    }
33829  }
33830  _sendImgData(objId, imgData, cacheGlobally = false) {
33831    const transfers = imgData ? [imgData.bitmap || imgData.data.buffer] : null;
33832    if (this.parsingType3Font || cacheGlobally) {
33833      return this.handler.send("commonobj", [objId, "Image", imgData], transfers);
33834    }
33835    return this.handler.send("obj", [objId, this.pageIndex, "Image", imgData], transfers);
33836  }
33837  async buildPaintImageXObject({
33838    resources,
33839    image,
33840    isInline = false,
33841    operatorList,
33842    cacheKey,
33843    localImageCache,
33844    localColorSpaceCache
33845  }) {
33846    const {
33847      maxImageSize,
33848      ignoreErrors,
33849      isOffscreenCanvasSupported
33850    } = this.options;
33851    const {
33852      dict
33853    } = image;
33854    const imageRef = dict.objId;
33855    const w = dict.get("W", "Width");
33856    const h = dict.get("H", "Height");
33857    if (!(w && typeof w === "number") || !(h && typeof h === "number")) {
33858      warn("Image dimensions are missing, or not numbers.");
33859      return;
33860    }
33861    if (maxImageSize !== -1 && w * h > maxImageSize) {
33862      const msg = "Image exceeded maximum allowed size and was removed.";
33863      if (!ignoreErrors) {
33864        throw new Error(msg);
33865      }
33866      warn(msg);
33867      return;
33868    }
33869    let optionalContent;
33870    if (dict.has("OC")) {
33871      optionalContent = await this.parseMarkedContentProps(dict.get("OC"), resources);
33872    }
33873    const imageMask = dict.get("IM", "ImageMask") || false;
33874    let imgData, fn, args;
33875    if (imageMask) {
33876      imgData = await PDFImage.createMask({
33877        image,
33878        isOffscreenCanvasSupported: isOffscreenCanvasSupported && !this.parsingType3Font
33879      });
33880      if (imgData.isSingleOpaquePixel) {
33881        fn = OPS.paintSolidColorImageMask;
33882        args = [];
33883        operatorList.addImageOps(fn, args, optionalContent);
33884        if (cacheKey) {
33885          const cacheData = {
33886            fn,
33887            args,
33888            optionalContent
33889          };
33890          localImageCache.set(cacheKey, imageRef, cacheData);
33891          if (imageRef) {
33892            this._regionalImageCache.set(null, imageRef, cacheData);
33893          }
33894        }
33895        return;
33896      }
33897      if (this.parsingType3Font) {
33898        args = compileType3Glyph(imgData);
33899        if (args) {
33900          operatorList.addImageOps(OPS.constructPath, args, optionalContent);
33901          return;
33902        }
33903        warn("Cannot compile Type3 glyph.");
33904        operatorList.addImageOps(OPS.paintImageMaskXObject, [imgData], optionalContent);
33905        return;
33906      }
33907      const objId = `mask_${this.idFactory.createObjId()}`;
33908      operatorList.addDependency(objId);
33909      imgData.dataLen = imgData.bitmap ? imgData.width * imgData.height * 4 : imgData.data.length;
33910      this._sendImgData(objId, imgData);
33911      fn = OPS.paintImageMaskXObject;
33912      args = [{
33913        data: objId,
33914        width: imgData.width,
33915        height: imgData.height,
33916        interpolate: imgData.interpolate,
33917        count: 1
33918      }];
33919      operatorList.addImageOps(fn, args, optionalContent);
33920      if (cacheKey) {
33921        const cacheData = {
33922          objId,
33923          fn,
33924          args,
33925          optionalContent
33926        };
33927        localImageCache.set(cacheKey, imageRef, cacheData);
33928        if (imageRef) {
33929          this._regionalImageCache.set(null, imageRef, cacheData);
33930        }
33931      }
33932      return;
33933    }
33934    const SMALL_IMAGE_DIMENSIONS = 200;
33935    const hasMask = dict.has("SMask") || dict.has("Mask");
33936    if (isInline && w + h < SMALL_IMAGE_DIMENSIONS && !hasMask) {
33937      try {
33938        const imageObj = new PDFImage({
33939          xref: this.xref,
33940          res: resources,
33941          image,
33942          isInline,
33943          pdfFunctionFactory: this._pdfFunctionFactory,
33944          globalColorSpaceCache: this.globalColorSpaceCache,
33945          localColorSpaceCache
33946        });
33947        imgData = await imageObj.createImageData(true, false);
33948        operatorList.addImageOps(OPS.paintInlineImageXObject, [imgData], optionalContent);
33949      } catch (reason) {
33950        const msg = `Unable to decode inline image: "${reason}".`;
33951        if (!ignoreErrors) {
33952          throw new Error(msg);
33953        }
33954        warn(msg);
33955      }
33956      return;
33957    }
33958    let objId = `img_${this.idFactory.createObjId()}`,
33959      cacheGlobally = false,
33960      globalCacheData = null;
33961    if (this.parsingType3Font) {
33962      objId = `${this.idFactory.getDocId()}_type3_${objId}`;
33963    } else if (cacheKey && imageRef) {
33964      cacheGlobally = this.globalImageCache.shouldCache(imageRef, this.pageIndex);
33965      if (cacheGlobally) {
33966        assert(!isInline, "Cannot cache an inline image globally.");
33967        objId = `${this.idFactory.getDocId()}_${objId}`;
33968      }
33969    }
33970    operatorList.addDependency(objId);
33971    fn = OPS.paintImageXObject;
33972    args = [objId, w, h];
33973    operatorList.addImageOps(fn, args, optionalContent, hasMask);
33974    if (cacheGlobally) {
33975      globalCacheData = {
33976        objId,
33977        fn,
33978        args,
33979        optionalContent,
33980        hasMask,
33981        byteSize: 0
33982      };
33983      if (this.globalImageCache.hasDecodeFailed(imageRef)) {
33984        this.globalImageCache.setData(imageRef, globalCacheData);
33985        this._sendImgData(objId, null, cacheGlobally);
33986        return;
33987      }
33988      if (w * h > 250000 || hasMask) {
33989        const localLength = await this.handler.sendWithPromise("commonobj", [objId, "CopyLocalImage", {
33990          imageRef
33991        }]);
33992        if (localLength) {
33993          this.globalImageCache.setData(imageRef, globalCacheData);
33994          this.globalImageCache.addByteSize(imageRef, localLength);
33995          return;
33996        }
33997      }
33998    }
33999    PDFImage.buildImage({
34000      xref: this.xref,
34001      res: resources,
34002      image,
34003      isInline,
34004      pdfFunctionFactory: this._pdfFunctionFactory,
34005      globalColorSpaceCache: this.globalColorSpaceCache,
34006      localColorSpaceCache
34007    }).then(async imageObj => {
34008      imgData = await imageObj.createImageData(false, isOffscreenCanvasSupported);
34009      imgData.dataLen = imgData.bitmap ? imgData.width * imgData.height * 4 : imgData.data.length;
34010      imgData.ref = imageRef;
34011      if (cacheGlobally) {
34012        this.globalImageCache.addByteSize(imageRef, imgData.dataLen);
34013      }
34014      return this._sendImgData(objId, imgData, cacheGlobally);
34015    }).catch(reason => {
34016      warn(`Unable to decode image "${objId}": "${reason}".`);
34017      if (imageRef) {
34018        this.globalImageCache.addDecodeFailed(imageRef);
34019      }
34020      return this._sendImgData(objId, null, cacheGlobally);
34021    });
34022    if (cacheKey) {
34023      const cacheData = {
34024        objId,
34025        fn,
34026        args,
34027        optionalContent,
34028        hasMask
34029      };
34030      localImageCache.set(cacheKey, imageRef, cacheData);
34031      if (imageRef) {
34032        this._regionalImageCache.set(null, imageRef, cacheData);
34033        if (cacheGlobally) {
34034          assert(globalCacheData, "The global cache-data must be available.");
34035          this.globalImageCache.setData(imageRef, globalCacheData);
34036        }
34037      }
34038    }
34039  }
34040  
vendor: 2,429 bytes, lines 34040-34113
34040handleSMask(smask, resources, operatorList, task, stateManager, localColorSpaceCache, seenRefs) {
34041    const smaskContent = smask.get("G");
34042    const smaskOptions = {
34043      subtype: smask.get("S").name,
34044      backdrop: smask.get("BC")
34045    };
34046    const transferObj = smask.get("TR");
34047    if (isPDFFunction(transferObj)) {
34048      const transferFn = this._pdfFunctionFactory.create(transferObj);
34049      const transferMap = new Uint8Array(256);
34050      const tmp = new Float32Array(1);
34051      for (let i = 0; i < 256; i++) {
34052        tmp[0] = i / 255;
34053        transferFn(tmp, 0, tmp, 0);
34054        transferMap[i] = tmp[0] * 255 | 0;
34055      }
34056      smaskOptions.transferMap = transferMap;
34057    }
34058    return this.buildFormXObject(resources, smaskContent, smaskOptions, operatorList, task, stateManager.state.clone({
34059      newPath: true
34060    }), localColorSpaceCache, seenRefs);
34061  }
34062  handleTransferFunction(tr) {
34063    let transferArray;
34064    if (Array.isArray(tr)) {
34065      transferArray = tr;
34066      if (tr.length > 1 && tr.every(map => map === tr[0])) {
34067        transferArray = [tr[0]];
34068      }
34069    } else if (isPDFFunction(tr)) {
34070      transferArray = [tr];
34071    } else {
34072      return null;
34073    }
34074    const transferMaps = [];
34075    let numFns = 0,
34076      numEffectfulFns = 0;
34077    for (const entry of transferArray) {
34078      const transferObj = this.xref.fetchIfRef(entry);
34079      numFns++;
34080      if (isName(transferObj, "Identity")) {
34081        transferMaps.push(null);
34082        continue;
34083      } else if (!isPDFFunction(transferObj)) {
34084        return null;
34085      }
34086      const transferFn = this._pdfFunctionFactory.create(transferObj);
34087      const transferMap = new Uint8Array(256),
34088        tmp = new Float32Array(1);
34089      for (let j = 0; j < 256; j++) {
34090        tmp[0] = j / 255;
34091        transferFn(tmp, 0, tmp, 0);
34092        transferMap[j] = tmp[0] * 255 | 0;
34093      }
34094      transferMaps.push(transferMap);
34095      numEffectfulFns++;
34096    }
34097    if (!(numFns === 1 || numFns === 4)) {
34098      return null;
34099    }
34100    if (numEffectfulFns === 0) {
34101      return null;
34102    }
34103    return transferMaps;
34104  }
34105  handleTilingType(fn, color, resources, pattern, patternDict, operatorList, task, localTilingPatternCache) {
34106    const tilingOpList = new CheckedOperatorList();
34107    const patternResources = Dict.merge({
34108      xref: this.xref,
34109      dictArray: [patternDict.get("Resources"), resources]
34110    });
34111    return this.getOperatorList({
34112      stream: pattern,
34113      task,
vendor: 1,402 bytes, lines 34114-34151
34114      resources: patternResources,
34115      operatorList: tilingOpList
34116    }).then(function () {
34117      const operatorListIR = tilingOpList.getIR();
34118      const {
34119        needsIsolation
34120      } = tilingOpList;
34121      const tilingPatternIR = getTilingPatternIR(operatorListIR, patternDict, color, needsIsolation);
34122      operatorList.addDependencies(tilingOpList.dependencies);
34123      operatorList.addOp(fn, tilingPatternIR);
34124      if (patternDict.objId) {
34125        localTilingPatternCache.set(null, patternDict.objId, {
34126          operatorListIR,
34127          needsIsolation,
34128          dict: patternDict
34129        });
34130      }
34131    }).catch(reason => {
34132      if (reason instanceof AbortException) {
34133        return;
34134      }
34135      if (this.options.ignoreErrors) {
34136        warn(`handleTilingType - ignoring pattern: "${reason}".`);
34137        return;
34138      }
34139      throw reason;
34140    });
34141  }
34142  async handleSetFont(resources, fontArgs, fontRef, operatorList, task, state, fallbackFontDict = null, cssFontInfo = null) {
34143    const fontName = fontArgs?.[0] instanceof Name ? fontArgs[0].name : null;
34144    const translated = await this.loadFont(fontName, fontRef, resources, task, fallbackFontDict, cssFontInfo);
34145    if (translated.font.isType3Font) {
34146      operatorList.addDependencies(translated.type3Dependencies);
34147    }
34148    state.font = translated.font;
34149    translated.send(this.handler);
34150    return translated.loadedName;
34151  }
vendor: 8,782 bytes, lines 34152-34430
34152  handleText(chars, state) {
34153    const font = state.font;
34154    const glyphs = font.charsToGlyphs(chars);
34155    if (font.data) {
34156      const isAddToPathSet = !!(state.textRenderingMode & TextRenderingMode.ADD_TO_PATH_FLAG);
34157      if (isAddToPathSet || state.fillColorSpace.name === "Pattern" || state.strokeColorSpace.name === "Pattern" || font.disableFontFace) {
34158        PartialEvaluator.buildFontPaths(font, glyphs, this.handler, this.options);
34159      }
34160    }
34161    return glyphs;
34162  }
34163  ensureStateFont(state) {
34164    if (state.font) {
34165      return;
34166    }
34167    const reason = new FormatError("Missing setFont (Tf) operator before text rendering operator.");
34168    if (this.options.ignoreErrors) {
34169      warn(`ensureStateFont: "${reason}".`);
34170      return;
34171    }
34172    throw reason;
34173  }
34174  async setGState({
34175    resources,
34176    gState,
34177    operatorList,
34178    cacheKey,
34179    task,
34180    stateManager,
34181    localGStateCache,
34182    localColorSpaceCache,
34183    seenRefs
34184  }) {
34185    const gStateRef = gState.objId;
34186    let isSimpleGState = true;
34187    const gStateObj = [];
34188    let promise = Promise.resolve();
34189    for (const [key, value] of gState) {
34190      switch (key) {
34191        case "Type":
34192          break;
34193        case "LW":
34194          if (typeof value !== "number") {
34195            warn(`Invalid LW (line width): ${value}`);
34196            break;
34197          }
34198          gStateObj.push([key, Math.abs(value)]);
34199          break;
34200        case "LC":
34201        case "LJ":
34202        case "ML":
34203        case "D":
34204        case "RI":
34205        case "FL":
34206        case "CA":
34207        case "ca":
34208          gStateObj.push([key, value]);
34209          break;
34210        case "Font":
34211          isSimpleGState = false;
34212          promise = promise.then(() => this.handleSetFont(resources, null, value[0], operatorList, task, stateManager.state).then(function (loadedName) {
34213            operatorList.addDependency(loadedName);
34214            gStateObj.push([key, [loadedName, value[1]]]);
34215          }));
34216          break;
34217        case "BM":
34218          gStateObj.push([key, normalizeBlendMode(value)]);
34219          break;
34220        case "SMask":
34221          if (isName(value, "None")) {
34222            gStateObj.push([key, false]);
34223            break;
34224          }
34225          if (value instanceof Dict) {
34226            isSimpleGState = false;
34227            promise = promise.then(() => this.handleSMask(value, resources, operatorList, task, stateManager, localColorSpaceCache, seenRefs));
34228            gStateObj.push([key, true]);
34229          } else {
34230            warn("Unsupported SMask type");
34231          }
34232          break;
34233        case "TR":
34234          const transferMaps = this.handleTransferFunction(value);
34235          gStateObj.push([key, transferMaps]);
34236          break;
34237        case "OP":
34238        case "op":
34239        case "OPM":
34240        case "BG":
34241        case "BG2":
34242        case "UCR":
34243        case "UCR2":
34244        case "TR2":
34245        case "HT":
34246        case "SM":
34247        case "SA":
34248        case "AIS":
34249        case "TK":
34250          info("graphic state operator " + key);
34251          break;
34252        default:
34253          info("Unknown graphic state operator " + key);
34254          break;
34255      }
34256    }
34257    await promise;
34258    if (gStateObj.length > 0) {
34259      operatorList.addOp(OPS.setGState, [gStateObj]);
34260    }
34261    if (isSimpleGState) {
34262      localGStateCache.set(cacheKey, gStateRef, gStateObj);
34263    }
34264  }
34265  loadFont(fontName, font, resources, task, fallbackFontDict = null, cssFontInfo = null) {
34266    const errorFont = async () => new TranslatedFont({
34267      loadedName: "g_font_error",
34268      font: new ErrorFont(`Font "${fontName}" is not available.`),
34269      dict: font
34270    });
34271    let fontRef;
34272    if (font) {
34273      if (font instanceof Ref) {
34274        fontRef = font;
34275      }
34276    } else {
34277      const fontRes = resources.get("Font");
34278      if (fontRes) {
34279        fontRef = fontRes.getRaw(fontName);
34280      }
34281    }
34282    if (fontRef) {
34283      if (this.type3FontRefs?.has(fontRef)) {
34284        return errorFont();
34285      }
34286      if (this.fontCache.has(fontRef)) {
34287        return this.fontCache.get(fontRef);
34288      }
34289      try {
34290        font = this.xref.fetchIfRef(fontRef);
34291      } catch (ex) {
34292        warn(`loadFont - lookup failed: "${ex}".`);
34293      }
34294    }
34295    if (!(font instanceof Dict)) {
34296      if (!this.options.ignoreErrors && !this.parsingType3Font) {
34297        warn(`Font "${fontName}" is not available.`);
34298        return errorFont();
34299      }
34300      warn(`Font "${fontName}" is not available -- attempting to fallback to a default font.`);
34301      font = fallbackFontDict || PartialEvaluator.fallbackFontDict;
34302    }
34303    if (font.cacheKey && this.fontCache.has(font.cacheKey)) {
34304      return this.fontCache.get(font.cacheKey);
34305    }
34306    const {
34307      promise,
34308      resolve
34309    } = Promise.withResolvers();
34310    let preEvaluatedFont;
34311    try {
34312      preEvaluatedFont = this.preEvaluateFont(font);
34313      preEvaluatedFont.cssFontInfo = cssFontInfo;
34314    } catch (reason) {
34315      warn(`loadFont - preEvaluateFont failed: "${reason}".`);
34316      return errorFont();
34317    }
34318    const {
34319      descriptor,
34320      hash
34321    } = preEvaluatedFont;
34322    const fontRefIsRef = fontRef instanceof Ref;
34323    let fontID;
34324    if (hash && descriptor instanceof Dict) {
34325      const fontAliases = descriptor.fontAliases ||= Object.create(null);
34326      if (fontAliases[hash]) {
34327        const aliasFontRef = fontAliases[hash].aliasRef;
34328        if (fontRefIsRef && aliasFontRef && this.fontCache.has(aliasFontRef)) {
34329          this.fontCache.putAlias(fontRef, aliasFontRef);
34330          return this.fontCache.get(fontRef);
34331        }
34332      } else {
34333        fontAliases[hash] = {
34334          fontID: this.idFactory.createFontId()
34335        };
34336      }
34337      if (fontRefIsRef) {
34338        fontAliases[hash].aliasRef = fontRef;
34339      }
34340      fontID = fontAliases[hash].fontID;
34341    } else {
34342      fontID = this.idFactory.createFontId();
34343    }
34344    assert(fontID?.startsWith("f"), 'The "fontID" must be (correctly) defined.');
34345    if (fontRefIsRef) {
34346      this.fontCache.put(fontRef, promise);
34347    } else {
34348      font.cacheKey = `cacheKey_${fontID}`;
34349      this.fontCache.put(font.cacheKey, promise);
34350    }
34351    font.loadedName = `${this.idFactory.getDocId()}_${fontID}`;
34352    this.translateFont(preEvaluatedFont).then(async translatedFont => {
34353      const translated = new TranslatedFont({
34354        loadedName: font.loadedName,
34355        font: translatedFont,
34356        dict: font
34357      });
34358      if (translatedFont.isType3Font) {
34359        try {
34360          await translated.loadType3Data(this, resources, task);
34361        } catch (reason) {
34362          throw new Error(`Type3 font load error: ${reason}`);
34363        }
34364      }
34365      resolve(translated);
34366    }).catch(reason => {
34367      warn(`loadFont - translateFont failed: "${reason}".`);
34368      resolve(new TranslatedFont({
34369        loadedName: font.loadedName,
34370        font: new ErrorFont(reason?.message),
34371        dict: font
34372      }));
34373    });
34374    return promise;
34375  }
34376  buildPath(fn, args, state) {
34377    const {
34378      pathMinMax: minMax,
34379      pathBuffer
34380    } = state;
34381    switch (fn | 0) {
34382      case OPS.rectangle:
34383        {
34384          const x = state.currentPointX = args[0];
34385          const y = state.currentPointY = args[1];
34386          const width = args[2];
34387          const height = args[3];
34388          const xw = x + width;
34389          const yh = y + height;
34390          if (width === 0 || height === 0) {
34391            pathBuffer.push(DrawOPS.moveTo, x, y, DrawOPS.lineTo, xw, yh, DrawOPS.closePath);
34392          } else {
34393            pathBuffer.push(DrawOPS.moveTo, x, y, DrawOPS.lineTo, xw, y, DrawOPS.lineTo, xw, yh, DrawOPS.lineTo, x, yh, DrawOPS.closePath);
34394          }
34395          Util.rectBoundingBox(x, y, xw, yh, minMax);
34396          break;
34397        }
34398      case OPS.moveTo:
34399        {
34400          const x = state.currentPointX = args[0];
34401          const y = state.currentPointY = args[1];
34402          pathBuffer.push(DrawOPS.moveTo, x, y);
34403          Util.pointBoundingBox(x, y, minMax);
34404          break;
34405        }
34406      case OPS.lineTo:
34407        {
34408          const x = state.currentPointX = args[0];
34409          const y = state.currentPointY = args[1];
34410          pathBuffer.push(DrawOPS.lineTo, x, y);
34411          Util.pointBoundingBox(x, y, minMax);
34412          break;
34413        }
34414      case OPS.curveTo:
34415        {
34416          const startX = state.currentPointX;
34417          const startY = state.currentPointY;
34418          const [x1, y1, x2, y2, x, y] = args;
34419          state.currentPointX = x;
34420          state.currentPointY = y;
34421          pathBuffer.push(DrawOPS.curveTo, x1, y1, x2, y2, x, y);
34422          Util.bezierBoundingBox(startX, startY, x1, y1, x2, y2, x, y, minMax);
34423          break;
34424        }
34425      case OPS.curveTo2:
34426        {
34427          const startX = state.currentPointX;
34428          const startY = state.currentPointY;
34429          const [x1, y1, x, y] = args;
34430          state.currentPointX = x;
vendor: 7,673 bytes, lines 34431-34655
34431          state.currentPointY = y;
34432          pathBuffer.push(DrawOPS.curveTo, startX, startY, x1, y1, x, y);
34433          Util.bezierBoundingBox(startX, startY, startX, startY, x1, y1, x, y, minMax);
34434          break;
34435        }
34436      case OPS.curveTo3:
34437        {
34438          const startX = state.currentPointX;
34439          const startY = state.currentPointY;
34440          const [x1, y1, x, y] = args;
34441          state.currentPointX = x;
34442          state.currentPointY = y;
34443          pathBuffer.push(DrawOPS.curveTo, x1, y1, x, y, x, y);
34444          Util.bezierBoundingBox(startX, startY, x1, y1, x, y, x, y, minMax);
34445          break;
34446        }
34447      case OPS.closePath:
34448        pathBuffer.push(DrawOPS.closePath);
34449        break;
34450    }
34451  }
34452  _getColorSpace(cs, resources, localColorSpaceCache) {
34453    return ColorSpaceUtils.parse({
34454      cs,
34455      xref: this.xref,
34456      resources,
34457      pdfFunctionFactory: this._pdfFunctionFactory,
34458      globalColorSpaceCache: this.globalColorSpaceCache,
34459      localColorSpaceCache,
34460      asyncIfNotCached: true
34461    });
34462  }
34463  async _handleColorSpace(csPromise) {
34464    try {
34465      return await csPromise;
34466    } catch (ex) {
34467      if (ex instanceof AbortException) {
34468        return null;
34469      }
34470      if (this.options.ignoreErrors) {
34471        warn(`_handleColorSpace - ignoring ColorSpace: "${ex}".`);
34472        return null;
34473      }
34474      throw ex;
34475    }
34476  }
34477  parseShading({
34478    shading,
34479    resources,
34480    localColorSpaceCache,
34481    localShadingPatternCache
34482  }) {
34483    let id = localShadingPatternCache.get(shading);
34484    if (id) {
34485      return id;
34486    }
34487    let patternIR;
34488    try {
34489      const shadingFill = Pattern.parseShading(shading, this.xref, resources, this._pdfFunctionFactory, this.globalColorSpaceCache, localColorSpaceCache);
34490      patternIR = shadingFill.getIR();
34491    } catch (reason) {
34492      if (reason instanceof AbortException) {
34493        return null;
34494      }
34495      if (this.options.ignoreErrors) {
34496        warn(`parseShading - ignoring shading: "${reason}".`);
34497        localShadingPatternCache.set(shading, null);
34498        return null;
34499      }
34500      throw reason;
34501    }
34502    id = `pattern_${this.idFactory.createObjId()}`;
34503    if (this.parsingType3Font) {
34504      id = `${this.idFactory.getDocId()}_type3_${id}`;
34505    }
34506    localShadingPatternCache.set(shading, id);
34507    if (this.parsingType3Font) {
34508      const buffer = compilePatternInfo(patternIR);
34509      this.handler.send("commonobj", [id, "Pattern", buffer], [buffer]);
34510    } else {
34511      this.handler.send("obj", [id, this.pageIndex, "Pattern", patternIR]);
34512    }
34513    return id;
34514  }
34515  handleColorN(operatorList, fn, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache) {
34516    const patternName = args.pop();
34517    if (patternName instanceof Name) {
34518      const rawPattern = patterns.getRaw(patternName.name);
34519      const localTilingPattern = rawPattern instanceof Ref && localTilingPatternCache.getByRef(rawPattern);
34520      if (localTilingPattern) {
34521        try {
34522          const color = cs.base ? cs.base.getRgbHex(args, 0) : null;
34523          const tilingPatternIR = getTilingPatternIR(localTilingPattern.operatorListIR, localTilingPattern.dict, color, localTilingPattern.needsIsolation);
34524          operatorList.addOp(fn, tilingPatternIR);
34525          return undefined;
34526        } catch {}
34527      }
34528      const pattern = this.xref.fetchIfRef(rawPattern);
34529      if (pattern) {
34530        const dict = pattern instanceof BaseStream ? pattern.dict : pattern;
34531        const typeNum = dict.get("PatternType");
34532        if (typeNum === PatternType.TILING) {
34533          const color = cs.base ? cs.base.getRgbHex(args, 0) : null;
34534          return this.handleTilingType(fn, color, resources, pattern, dict, operatorList, task, localTilingPatternCache);
34535        } else if (typeNum === PatternType.SHADING) {
34536          const shading = dict.get("Shading");
34537          const objId = this.parseShading({
34538            shading,
34539            resources,
34540            localColorSpaceCache,
34541            localShadingPatternCache
34542          });
34543          if (objId) {
34544            const matrix = lookupMatrix(dict.getArray("Matrix"), null);
34545            operatorList.addOp(fn, ["Shading", objId, matrix]);
34546          }
34547          return undefined;
34548        }
34549        throw new FormatError(`Unknown PatternType: ${typeNum}`);
34550      }
34551    }
34552    throw new FormatError(`Unknown PatternName: ${patternName}`);
34553  }
34554  _parseVisibilityExpression(array, nestingCounter, currentResult) {
34555    const MAX_NESTING = 10;
34556    if (++nestingCounter > MAX_NESTING) {
34557      warn("Visibility expression is too deeply nested");
34558      return;
34559    }
34560    const length = array.length;
34561    const operator = this.xref.fetchIfRef(array[0]);
34562    if (length < 2 || !(operator instanceof Name)) {
34563      warn("Invalid visibility expression");
34564      return;
34565    }
34566    switch (operator.name) {
34567      case "And":
34568      case "Or":
34569      case "Not":
34570        currentResult.push(operator.name);
34571        break;
34572      default:
34573        warn(`Invalid operator ${operator.name} in visibility expression`);
34574        return;
34575    }
34576    for (let i = 1; i < length; i++) {
34577      const raw = array[i];
34578      const object = this.xref.fetchIfRef(raw);
34579      if (Array.isArray(object)) {
34580        const nestedResult = [];
34581        currentResult.push(nestedResult);
34582        this._parseVisibilityExpression(object, nestingCounter, nestedResult);
34583      } else if (raw instanceof Ref) {
34584        currentResult.push(raw.toString());
34585      }
34586    }
34587  }
34588  async parseMarkedContentProps(contentProperties, resources) {
34589    let optionalContent;
34590    if (contentProperties instanceof Name) {
34591      const properties = resources.get("Properties");
34592      optionalContent = properties.get(contentProperties.name);
34593    } else if (contentProperties instanceof Dict) {
34594      optionalContent = contentProperties;
34595    } else {
34596      throw new FormatError("Optional content properties malformed.");
34597    }
34598    const optionalContentType = optionalContent.get("Type")?.name;
34599    if (optionalContentType === "OCG") {
34600      return {
34601        type: optionalContentType,
34602        id: optionalContent.objId
34603      };
34604    } else if (optionalContentType === "OCMD") {
34605      const expression = optionalContent.get("VE");
34606      if (Array.isArray(expression)) {
34607        const result = [];
34608        this._parseVisibilityExpression(expression, 0, result);
34609        if (result.length > 0) {
34610          return {
34611            type: "OCMD",
34612            expression: result
34613          };
34614        }
34615      }
34616      const optionalContentGroups = optionalContent.get("OCGs");
34617      if (Array.isArray(optionalContentGroups) || optionalContentGroups instanceof Dict) {
34618        const groupIds = [];
34619        if (Array.isArray(optionalContentGroups)) {
34620          for (const ocg of optionalContentGroups) {
34621            groupIds.push(ocg.toString());
34622          }
34623        } else {
34624          groupIds.push(optionalContentGroups.objId);
34625        }
34626        return {
34627          type: optionalContentType,
34628          ids: groupIds,
34629          policy: optionalContent.get("P") instanceof Name ? optionalContent.get("P").name : null,
34630          expression: null
34631        };
34632      } else if (optionalContentGroups instanceof Ref) {
34633        return {
34634          type: optionalContentType,
34635          id: optionalContentGroups.toString()
34636        };
34637      }
34638    }
34639    return null;
34640  }
34641  async getOperatorList({
34642    stream,
34643    task,
34644    resources,
34645    operatorList,
34646    initialState = null,
34647    fallbackFontDict = null,
34648    prevRefs = null
34649  }) {
34650    if (stream.isAsync) {
34651      const bytes = await stream.asyncGetBytes();
34652      if (bytes) {
34653        stream = new Stream(bytes, 0, bytes.length, stream.dict);
34654      }
34655    }
vendor: 16,897 bytes, lines 34655-35090
34655
34656    const objId = stream.dict?.objId;
34657    const seenRefs = new RefSet(prevRefs);
34658    if (objId) {
34659      if (prevRefs?.has(objId)) {
34660        throw new Error(`getOperatorList - ignoring circular reference: ${objId}`);
34661      }
34662      seenRefs.put(objId);
34663    }
34664    resources ||= Dict.empty;
34665    initialState ||= new EvalState();
34666    if (!operatorList) {
34667      throw new Error('getOperatorList: missing "operatorList" parameter');
34668    }
34669    const self = this;
34670    const xref = this.xref;
34671    const localImageCache = new LocalImageCache();
34672    const localColorSpaceCache = new LocalColorSpaceCache();
34673    const localGStateCache = new LocalGStateCache();
34674    const localTilingPatternCache = new LocalTilingPatternCache();
34675    const localShadingPatternCache = new Map();
34676    const xobjs = resources.get("XObject") || Dict.empty;
34677    const patterns = resources.get("Pattern") || Dict.empty;
34678    const stateManager = new StateManager(initialState);
34679    const preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
34680    const timeSlotManager = new TimeSlotManager();
34681    function closePendingRestoreOPS(argument) {
34682      for (let i = 0, ii = preprocessor.savedStatesDepth; i < ii; i++) {
34683        operatorList.addOp(OPS.restore, []);
34684      }
34685    }
34686    return new Promise(function promiseBody(resolve, reject) {
34687      const next = function (promise) {
34688        Promise.all([promise, operatorList.ready]).then(function () {
34689          try {
34690            promiseBody(resolve, reject);
34691          } catch (ex) {
34692            reject(ex);
34693          }
34694        }, reject);
34695      };
34696      task.ensureNotTerminated();
34697      timeSlotManager.reset();
34698      const operation = {};
34699      let stop, i, ii, cs, name, isValidName;
34700      while (!(stop = timeSlotManager.check())) {
34701        operation.args = null;
34702        if (!preprocessor.read(operation)) {
34703          break;
34704        }
34705        let args = operation.args;
34706        let fn = operation.fn;
34707        switch (fn | 0) {
34708          case OPS.paintXObject:
34709            isValidName = args[0] instanceof Name;
34710            name = args[0].name;
34711            if (isValidName) {
34712              const localImage = localImageCache.getByName(name);
34713              if (localImage) {
34714                addCachedImageOps(operatorList, localImage);
34715                args = null;
34716                continue;
34717              }
34718            }
34719            next(new Promise(function (resolveXObject, rejectXObject) {
34720              if (!isValidName) {
34721                throw new FormatError("XObject must be referred to by name.");
34722              }
34723              let xobj = xobjs.getRaw(name);
34724              if (xobj instanceof Ref) {
34725                const cachedImage = localImageCache.getByRef(xobj) || self._regionalImageCache.getByRef(xobj) || self.globalImageCache.getData(xobj, self.pageIndex);
34726                if (cachedImage) {
34727                  addCachedImageOps(operatorList, cachedImage);
34728                  resolveXObject();
34729                  return;
34730                }
34731                xobj = xref.fetch(xobj);
34732              }
34733              if (!(xobj instanceof BaseStream)) {
34734                throw new FormatError("XObject should be a stream");
34735              }
34736              const type = xobj.dict.get("Subtype");
34737              if (!(type instanceof Name)) {
34738                throw new FormatError("XObject should have a Name subtype");
34739              }
34740              if (type.name === "Form") {
34741                stateManager.save();
34742                self.buildFormXObject(resources, xobj, null, operatorList, task, stateManager.state.clone({
34743                  newPath: true
34744                }), localColorSpaceCache, seenRefs).then(function () {
34745                  stateManager.restore();
34746                  resolveXObject();
34747                }, rejectXObject);
34748                return;
34749              } else if (type.name === "Image") {
34750                self.buildPaintImageXObject({
34751                  resources,
34752                  image: xobj,
34753                  operatorList,
34754                  cacheKey: name,
34755                  localImageCache,
34756                  localColorSpaceCache
34757                }).then(resolveXObject, rejectXObject);
34758                return;
34759              } else if (type.name === "PS") {
34760                info("Ignored XObject subtype PS");
34761              } else {
34762                throw new FormatError(`Unhandled XObject subtype ${type.name}`);
34763              }
34764              resolveXObject();
34765            }).catch(function (reason) {
34766              if (reason instanceof AbortException) {
34767                return;
34768              }
34769              if (self.options.ignoreErrors) {
34770                warn(`getOperatorList - ignoring XObject: "${reason}".`);
34771                return;
34772              }
34773              throw reason;
34774            }));
34775            return;
34776          case OPS.setFont:
34777            const fontSize = args[1];
34778            next(self.handleSetFont(resources, args, null, operatorList, task, stateManager.state, fallbackFontDict).then(function (loadedName) {
34779              operatorList.addDependency(loadedName);
34780              operatorList.addOp(OPS.setFont, [loadedName, fontSize]);
34781            }));
34782            return;
34783          case OPS.endInlineImage:
34784            const cacheKey = args[0].cacheKey;
34785            if (cacheKey) {
34786              const localImage = localImageCache.getByName(cacheKey);
34787              if (localImage) {
34788                addCachedImageOps(operatorList, localImage);
34789                args = null;
34790                continue;
34791              }
34792            }
34793            next(self.buildPaintImageXObject({
34794              resources,
34795              image: args[0],
34796              isInline: true,
34797              operatorList,
34798              cacheKey,
34799              localImageCache,
34800              localColorSpaceCache
34801            }));
34802            return;
34803          case OPS.showText:
34804            if (!stateManager.state.font) {
34805              self.ensureStateFont(stateManager.state);
34806              continue;
34807            }
34808            args[0] = self.handleText(args[0], stateManager.state);
34809            break;
34810          case OPS.showSpacedText:
34811            if (!stateManager.state.font) {
34812              self.ensureStateFont(stateManager.state);
34813              continue;
34814            }
34815            const combinedGlyphs = [],
34816              state = stateManager.state;
34817            for (const arrItem of args[0]) {
34818              if (typeof arrItem === "string") {
34819                combinedGlyphs.push(...self.handleText(arrItem, state));
34820              } else if (typeof arrItem === "number") {
34821                combinedGlyphs.push(arrItem);
34822              }
34823            }
34824            args[0] = combinedGlyphs;
34825            fn = OPS.showText;
34826            break;
34827          case OPS.nextLineShowText:
34828            if (!stateManager.state.font) {
34829              self.ensureStateFont(stateManager.state);
34830              continue;
34831            }
34832            operatorList.addOp(OPS.nextLine);
34833            args[0] = self.handleText(args[0], stateManager.state);
34834            fn = OPS.showText;
34835            break;
34836          case OPS.nextLineSetSpacingShowText:
34837            if (!stateManager.state.font) {
34838              self.ensureStateFont(stateManager.state);
34839              continue;
34840            }
34841            operatorList.addOp(OPS.nextLine);
34842            operatorList.addOp(OPS.setWordSpacing, [args.shift()]);
34843            operatorList.addOp(OPS.setCharSpacing, [args.shift()]);
34844            args[0] = self.handleText(args[0], stateManager.state);
34845            fn = OPS.showText;
34846            break;
34847          case OPS.setTextRenderingMode:
34848            stateManager.state.textRenderingMode = args[0];
34849            break;
34850          case OPS.setFillColorSpace:
34851            {
34852              const fillCS = self._getColorSpace(args[0], resources, localColorSpaceCache);
34853              if (fillCS instanceof ColorSpace) {
34854                stateManager.state.fillColorSpace = fillCS;
34855                continue;
34856              }
34857              next(self._handleColorSpace(fillCS).then(colorSpace => {
34858                stateManager.state.fillColorSpace = colorSpace || ColorSpaceUtils.gray;
34859              }));
34860              return;
34861            }
34862          case OPS.setStrokeColorSpace:
34863            {
34864              const strokeCS = self._getColorSpace(args[0], resources, localColorSpaceCache);
34865              if (strokeCS instanceof ColorSpace) {
34866                stateManager.state.strokeColorSpace = strokeCS;
34867                continue;
34868              }
34869              next(self._handleColorSpace(strokeCS).then(colorSpace => {
34870                stateManager.state.strokeColorSpace = colorSpace || ColorSpaceUtils.gray;
34871              }));
34872              return;
34873            }
34874          case OPS.setFillColor:
34875            cs = stateManager.state.fillColorSpace;
34876            args = [cs.getRgbHex(args, 0)];
34877            fn = OPS.setFillRGBColor;
34878            break;
34879          case OPS.setStrokeColor:
34880            cs = stateManager.state.strokeColorSpace;
34881            args = [cs.getRgbHex(args, 0)];
34882            fn = OPS.setStrokeRGBColor;
34883            break;
34884          case OPS.setFillGray:
34885            stateManager.state.fillColorSpace = ColorSpaceUtils.gray;
34886            args = [ColorSpaceUtils.gray.getRgbHex(args, 0)];
34887            fn = OPS.setFillRGBColor;
34888            break;
34889          case OPS.setStrokeGray:
34890            stateManager.state.strokeColorSpace = ColorSpaceUtils.gray;
34891            args = [ColorSpaceUtils.gray.getRgbHex(args, 0)];
34892            fn = OPS.setStrokeRGBColor;
34893            break;
34894          case OPS.setFillCMYKColor:
34895            stateManager.state.fillColorSpace = ColorSpaceUtils.cmyk;
34896            args = [ColorSpaceUtils.cmyk.getRgbHex(args, 0)];
34897            fn = OPS.setFillRGBColor;
34898            break;
34899          case OPS.setStrokeCMYKColor:
34900            stateManager.state.strokeColorSpace = ColorSpaceUtils.cmyk;
34901            args = [ColorSpaceUtils.cmyk.getRgbHex(args, 0)];
34902            fn = OPS.setStrokeRGBColor;
34903            break;
34904          case OPS.setFillRGBColor:
34905            stateManager.state.fillColorSpace = ColorSpaceUtils.rgb;
34906            args = [ColorSpaceUtils.rgb.getRgbHex(args, 0)];
34907            break;
34908          case OPS.setStrokeRGBColor:
34909            stateManager.state.strokeColorSpace = ColorSpaceUtils.rgb;
34910            args = [ColorSpaceUtils.rgb.getRgbHex(args, 0)];
34911            break;
34912          case OPS.setFillColorN:
34913            cs = stateManager.state.patternFillColorSpace;
34914            if (!cs) {
34915              if (isNumberArray(args, null)) {
34916                args = [ColorSpaceUtils.gray.getRgbHex(args, 0)];
34917                fn = OPS.setFillRGBColor;
34918                break;
34919              }
34920              args = [];
34921              fn = OPS.setFillTransparent;
34922              break;
34923            }
34924            if (cs.name === "Pattern") {
34925              next(self.handleColorN(operatorList, OPS.setFillColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache));
34926              return;
34927            }
34928            args = [cs.getRgbHex(args, 0)];
34929            fn = OPS.setFillRGBColor;
34930            break;
34931          case OPS.setStrokeColorN:
34932            cs = stateManager.state.patternStrokeColorSpace;
34933            if (!cs) {
34934              if (isNumberArray(args, null)) {
34935                args = [ColorSpaceUtils.gray.getRgbHex(args, 0)];
34936                fn = OPS.setStrokeRGBColor;
34937                break;
34938              }
34939              args = [];
34940              fn = OPS.setStrokeTransparent;
34941              break;
34942            }
34943            if (cs.name === "Pattern") {
34944              next(self.handleColorN(operatorList, OPS.setStrokeColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache));
34945              return;
34946            }
34947            args = [cs.getRgbHex(args, 0)];
34948            fn = OPS.setStrokeRGBColor;
34949            break;
34950          case OPS.shadingFill:
34951            let shading;
34952            try {
34953              const shadingRes = resources.get("Shading");
34954              if (!shadingRes) {
34955                throw new FormatError("No shading resource found");
34956              }
34957              shading = shadingRes.get(args[0].name);
34958              if (!shading) {
34959                throw new FormatError("No shading object found");
34960              }
34961            } catch (reason) {
34962              if (reason instanceof AbortException) {
34963                continue;
34964              }
34965              if (self.options.ignoreErrors) {
34966                warn(`getOperatorList - ignoring Shading: "${reason}".`);
34967                continue;
34968              }
34969              throw reason;
34970            }
34971            const patternId = self.parseShading({
34972              shading,
34973              resources,
34974              localColorSpaceCache,
34975              localShadingPatternCache
34976            });
34977            if (!patternId) {
34978              continue;
34979            }
34980            args = [patternId];
34981            fn = OPS.shadingFill;
34982            break;
34983          case OPS.setGState:
34984            isValidName = args[0] instanceof Name;
34985            name = args[0].name;
34986            if (isValidName) {
34987              const localGStateObj = localGStateCache.getByName(name);
34988              if (localGStateObj) {
34989                if (localGStateObj.length > 0) {
34990                  operatorList.addOp(OPS.setGState, [localGStateObj]);
34991                }
34992                args = null;
34993                continue;
34994              }
34995            }
34996            next(new Promise(function (resolveGState, rejectGState) {
34997              if (!isValidName) {
34998                throw new FormatError("GState must be referred to by name.");
34999              }
35000              const extGState = resources.get("ExtGState");
35001              if (!(extGState instanceof Dict)) {
35002                throw new FormatError("ExtGState should be a dictionary.");
35003              }
35004              const gState = extGState.get(name);
35005              if (!(gState instanceof Dict)) {
35006                throw new FormatError("GState should be a dictionary.");
35007              }
35008              self.setGState({
35009                resources,
35010                gState,
35011                operatorList,
35012                cacheKey: name,
35013                task,
35014                stateManager,
35015                localGStateCache,
35016                localColorSpaceCache,
35017                seenRefs
35018              }).then(resolveGState, rejectGState);
35019            }).catch(function (reason) {
35020              if (reason instanceof AbortException) {
35021                return;
35022              }
35023              if (self.options.ignoreErrors) {
35024                warn(`getOperatorList - ignoring ExtGState: "${reason}".`);
35025                return;
35026              }
35027              throw reason;
35028            }));
35029            return;
35030          case OPS.setLineWidth:
35031            {
35032              const [thickness] = args;
35033              if (typeof thickness !== "number") {
35034                warn(`Invalid setLineWidth: ${thickness}`);
35035                continue;
35036              }
35037              args[0] = Math.abs(thickness);
35038              break;
35039            }
35040          case OPS.setDash:
35041            {
35042              const dashPhase = args[1];
35043              if (typeof dashPhase !== "number") {
35044                warn(`Invalid setDash: ${dashPhase}`);
35045                continue;
35046              }
35047              const dashArray = args[0];
35048              if (!Array.isArray(dashArray)) {
35049                warn(`Invalid setDash: ${dashArray}`);
35050                continue;
35051              }
35052              if (dashArray.some(x => typeof x !== "number")) {
35053                args[0] = dashArray.filter(x => typeof x === "number");
35054              }
35055              break;
35056            }
35057          case OPS.moveTo:
35058          case OPS.lineTo:
35059          case OPS.curveTo:
35060          case OPS.curveTo2:
35061          case OPS.curveTo3:
35062          case OPS.closePath:
35063          case OPS.rectangle:
35064            self.buildPath(fn, args, stateManager.state);
35065            continue;
35066          case OPS.stroke:
35067          case OPS.closeStroke:
35068          case OPS.fill:
35069          case OPS.eoFill:
35070          case OPS.fillStroke:
35071          case OPS.eoFillStroke:
35072          case OPS.closeFillStroke:
35073          case OPS.closeEOFillStroke:
35074          case OPS.endPath:
35075            {
35076              const {
35077                state: {
35078                  pathBuffer,
35079                  pathMinMax
35080                }
35081              } = stateManager;
35082              if (fn === OPS.closeStroke || fn === OPS.closeFillStroke || fn === OPS.closeEOFillStroke) {
35083                pathBuffer.push(DrawOPS.closePath);
35084              }
35085              if (pathBuffer.length === 0) {
35086                operatorList.addOp(OPS.constructPath, [fn, [null], null]);
35087              } else {
35088                operatorList.addOp(OPS.constructPath, [fn, [new Float32Array(pathBuffer)], pathMinMax.slice()]);
35089                pathBuffer.length = 0;
35090                pathMinMax.set(
vendor: 1,311 bytes, lines 35090-35123
35090BBOX_INIT, 0);
35091              }
35092              continue;
35093            }
35094          case OPS.setTextMatrix:
35095            operatorList.addOp(fn, [new Float32Array(args)]);
35096            continue;
35097          case OPS.markPoint:
35098          case OPS.markPointProps:
35099          case OPS.beginCompat:
35100          case OPS.endCompat:
35101            continue;
35102          case OPS.beginMarkedContentProps:
35103            if (!(args[0] instanceof Name)) {
35104              warn(`Expected name for beginMarkedContentProps arg0=${args[0]}`);
35105              operatorList.addOp(OPS.beginMarkedContentProps, ["OC", null]);
35106              continue;
35107            }
35108            if (args[0].name === "OC") {
35109              next(self.parseMarkedContentProps(args[1], resources).then(data => {
35110                operatorList.addOp(OPS.beginMarkedContentProps, ["OC", data]);
35111              }).catch(reason => {
35112                if (reason instanceof AbortException) {
35113                  return;
35114                }
35115                if (self.options.ignoreErrors) {
35116                  warn(`getOperatorList - ignoring beginMarkedContentProps: "${reason}".`);
35117                  operatorList.addOp(OPS.beginMarkedContentProps, ["OC", null]);
35118                  return;
35119                }
35120                throw reason;
35121              }));
35122              return;
35123            }
vendor: 1,987 bytes, lines 35124-35197
35124            args = [args[0].name, args[1] instanceof Dict ? args[1].get("MCID") : null];
35125            break;
35126          case OPS.beginMarkedContent:
35127          case OPS.endMarkedContent:
35128          default:
35129            if (args !== null) {
35130              for (i = 0, ii = args.length; i < ii; i++) {
35131                if (args[i] instanceof Dict) {
35132                  break;
35133                }
35134              }
35135              if (i < ii) {
35136                warn("getOperatorList - ignoring operator: " + fn);
35137                continue;
35138              }
35139            }
35140        }
35141        operatorList.addOp(fn, args);
35142      }
35143      if (stop) {
35144        next(deferred);
35145        return;
35146      }
35147      closePendingRestoreOPS();
35148      resolve();
35149    }).catch(reason => {
35150      if (reason instanceof AbortException) {
35151        return;
35152      }
35153      if (this.options.ignoreErrors) {
35154        warn(`getOperatorList - ignoring errors during "${task.name}" ` + `task: "${reason}".`);
35155        closePendingRestoreOPS();
35156        return;
35157      }
35158      throw reason;
35159    });
35160  }
35161  async getTextContent({
35162    stream,
35163    task,
35164    resources,
35165    stateManager = null,
35166    includeMarkedContent = false,
35167    sink,
35168    seenStyles = new Set(),
35169    viewBox,
35170    lang = null,
35171    markedContentData = null,
35172    disableNormalization = false,
35173    keepWhiteSpace = false,
35174    prevRefs = null,
35175    intersector = null
35176  }) {
35177    if (stream.isAsync) {
35178      const bytes = await stream.asyncGetBytes();
35179      if (bytes) {
35180        stream = new Stream(bytes, 0, bytes.length, stream.dict);
35181      }
35182    }
35183    const objId = stream.dict?.objId;
35184    const seenRefs = new RefSet(prevRefs);
35185    if (objId) {
35186      if (prevRefs?.has(objId)) {
35187        throw new Error(`getTextContent - ignoring circular reference: ${objId}`);
35188      }
35189      seenRefs.put(objId);
35190    }
35191    resources ||= Dict.empty;
35192    stateManager ||= new StateManager(new TextState());
35193    if (includeMarkedContent) {
35194      markedContentData ||= {
35195        level: 0
35196      };
35197    }
vendor: 17,316 bytes, lines 35197-35663
35197
35198    const textContent = {
35199      items: [],
35200      styles: Object.create(null),
35201      lang
35202    };
35203    const textContentItem = {
35204      initialized: false,
35205      str: [],
35206      totalWidth: 0,
35207      totalHeight: 0,
35208      width: 0,
35209      height: 0,
35210      vertical: false,
35211      prevTransform: null,
35212      prevTextRise: 0,
35213      textAdvanceScale: 0,
35214      spaceInFlowMin: 0,
35215      spaceInFlowMax: 0,
35216      trackingSpaceMin: Infinity,
35217      negativeSpaceMax: -Infinity,
35218      notASpace: -Infinity,
35219      transform: null,
35220      fontName: null,
35221      hasEOL: false
35222    };
35223    const twoLastChars = [" ", " "];
35224    let twoLastCharsPos = 0;
35225    function saveLastChar(char) {
35226      const nextPos = (twoLastCharsPos + 1) % 2;
35227      const ret = twoLastChars[twoLastCharsPos] !== " " && twoLastChars[nextPos] === " ";
35228      twoLastChars[twoLastCharsPos] = char;
35229      twoLastCharsPos = nextPos;
35230      return !keepWhiteSpace && ret;
35231    }
35232    function shouldAddWhitepsace() {
35233      return !keepWhiteSpace && twoLastChars[twoLastCharsPos] !== " " && twoLastChars[(twoLastCharsPos + 1) % 2] === " ";
35234    }
35235    function resetLastChars() {
35236      twoLastChars[0] = twoLastChars[1] = " ";
35237      twoLastCharsPos = 0;
35238    }
35239    const TRACKING_SPACE_FACTOR = 0.102;
35240    const NOT_A_SPACE_FACTOR = 0.03;
35241    const NEGATIVE_SPACE_FACTOR = -0.2;
35242    const SPACE_IN_FLOW_MIN_FACTOR = 0.102;
35243    const SPACE_IN_FLOW_MAX_FACTOR = 0.6;
35244    const VERTICAL_SHIFT_RATIO = 0.25;
35245    const self = this;
35246    const xref = this.xref;
35247    const showSpacedTextBuffer = [];
35248    let xobjs = null;
35249    const emptyXObjectCache = new LocalImageCache();
35250    const emptyGStateCache = new LocalGStateCache();
35251    const preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
35252    let textState, currentTextState;
35253    function pushWhitespace({
35254      width = 0,
35255      height = 0,
35256      transform = textContentItem.prevTransform,
35257      fontName = textContentItem.fontName
35258    }) {
35259      intersector?.addExtraChar(" ");
35260      textContent.items.push({
35261        str: " ",
35262        dir: "ltr",
35263        width,
35264        height,
35265        transform,
35266        fontName,
35267        hasEOL: false
35268      });
35269    }
35270    function getCurrentTextTransform() {
35271      const font = textState.font;
35272      const tsm = [textState.fontSize * textState.textHScale, 0, 0, textState.fontSize, 0, textState.textRise];
35273      if (font.isType3Font && (textState.fontSize <= 1 || font.isCharBBox) && !isArrayEqual(textState.fontMatrix, FONT_IDENTITY_MATRIX)) {
35274        const glyphHeight = font.bbox[3] - font.bbox[1];
35275        if (glyphHeight > 0) {
35276          tsm[3] *= glyphHeight * textState.fontMatrix[3];
35277        }
35278      }
35279      return Util.transform(textState.ctm, Util.transform(textState.textMatrix, tsm));
35280    }
35281    function ensureTextContentItem() {
35282      if (textContentItem.initialized) {
35283        return textContentItem;
35284      }
35285      const {
35286        font,
35287        loadedName
35288      } = textState;
35289      if (!seenStyles.has(loadedName)) {
35290        seenStyles.add(loadedName);
35291        textContent.styles[loadedName] = {
35292          fontFamily: font.fallbackName,
35293          ascent: font.ascent,
35294          descent: font.descent,
35295          vertical: font.vertical
35296        };
35297        if (self.options.fontExtraProperties && font.systemFontInfo) {
35298          const style = textContent.styles[loadedName];
35299          style.fontSubstitution = font.systemFontInfo.css;
35300          style.fontSubstitutionLoadedName = font.systemFontInfo.loadedName;
35301        }
35302      }
35303      textContentItem.fontName = loadedName;
35304      const trm = textContentItem.transform = getCurrentTextTransform();
35305      if (!font.vertical) {
35306        textContentItem.width = textContentItem.totalWidth = 0;
35307        textContentItem.height = textContentItem.totalHeight = Math.hypot(trm[2], trm[3]);
35308        textContentItem.vertical = false;
35309      } else {
35310        textContentItem.width = textContentItem.totalWidth = Math.hypot(trm[0], trm[1]);
35311        textContentItem.height = textContentItem.totalHeight = 0;
35312        textContentItem.vertical = true;
35313      }
35314      const scaleLineX = Math.hypot(textState.textLineMatrix[0], textState.textLineMatrix[1]);
35315      const scaleCtmX = Math.hypot(textState.ctm[0], textState.ctm[1]);
35316      textContentItem.textAdvanceScale = scaleCtmX * scaleLineX;
35317      const {
35318        fontSize
35319      } = textState;
35320      textContentItem.trackingSpaceMin = fontSize * TRACKING_SPACE_FACTOR;
35321      textContentItem.notASpace = fontSize * NOT_A_SPACE_FACTOR;
35322      textContentItem.negativeSpaceMax = fontSize * NEGATIVE_SPACE_FACTOR;
35323      textContentItem.spaceInFlowMin = fontSize * SPACE_IN_FLOW_MIN_FACTOR;
35324      textContentItem.spaceInFlowMax = fontSize * SPACE_IN_FLOW_MAX_FACTOR;
35325      textContentItem.hasEOL = false;
35326      textContentItem.initialized = true;
35327      return textContentItem;
35328    }
35329    function updateAdvanceScale() {
35330      if (!textContentItem.initialized) {
35331        return;
35332      }
35333      const scaleLineX = Math.hypot(textState.textLineMatrix[0], textState.textLineMatrix[1]);
35334      const scaleCtmX = Math.hypot(textState.ctm[0], textState.ctm[1]);
35335      const scaleFactor = scaleCtmX * scaleLineX;
35336      if (scaleFactor === textContentItem.textAdvanceScale) {
35337        return;
35338      }
35339      if (!textContentItem.vertical) {
35340        textContentItem.totalWidth += textContentItem.width * textContentItem.textAdvanceScale;
35341        textContentItem.width = 0;
35342      } else {
35343        textContentItem.totalHeight += textContentItem.height * textContentItem.textAdvanceScale;
35344        textContentItem.height = 0;
35345      }
35346      textContentItem.textAdvanceScale = scaleFactor;
35347    }
35348    function runBidiTransform(textChunk) {
35349      let text = textChunk.str.join("");
35350      if (!disableNormalization) {
35351        text = normalizeUnicode(text);
35352      }
35353      const bidiResult = bidi(text, -1, textChunk.vertical);
35354      return {
35355        str: bidiResult.str,
35356        dir: bidiResult.dir,
35357        width: Math.abs(textChunk.totalWidth),
35358        height: Math.abs(textChunk.totalHeight),
35359        transform: textChunk.transform,
35360        fontName: textChunk.fontName,
35361        hasEOL: textChunk.hasEOL
35362      };
35363    }
35364    async function handleSetFont(fontName, fontRef) {
35365      const translated = await self.loadFont(fontName, fontRef, resources, task);
35366      textState.loadedName = translated.loadedName;
35367      textState.font = translated.font;
35368      textState.fontMatrix = translated.font.fontMatrix || FONT_IDENTITY_MATRIX;
35369    }
35370    function applyInverseRotation(x, y, matrix) {
35371      const scale = Math.hypot(matrix[0], matrix[1]);
35372      return [(matrix[0] * x + matrix[1] * y) / scale, (matrix[2] * x + matrix[3] * y) / scale];
35373    }
35374    function compareWithLastPosition(glyphWidth) {
35375      const currentTransform = getCurrentTextTransform();
35376      let posX = currentTransform[4];
35377      let posY = currentTransform[5];
35378      if (textState.font?.vertical) {
35379        if (posX < viewBox[0] || posX > viewBox[2] || posY + glyphWidth < viewBox[1] || posY > viewBox[3]) {
35380          return false;
35381        }
35382      } else if (posX + glyphWidth < viewBox[0] || posX > viewBox[2] || posY < viewBox[1] || posY > viewBox[3]) {
35383        return false;
35384      }
35385      if (!textState.font || !textContentItem.prevTransform) {
35386        return true;
35387      }
35388      let lastPosX = textContentItem.prevTransform[4];
35389      let lastPosY = textContentItem.prevTransform[5];
35390      if (lastPosX === posX && lastPosY === posY) {
35391        return true;
35392      }
35393      let rotate = -1;
35394      if (currentTransform[0] && currentTransform[1] === 0 && currentTransform[2] === 0) {
35395        rotate = currentTransform[0] > 0 ? 0 : 180;
35396      } else if (currentTransform[1] && currentTransform[0] === 0 && currentTransform[3] === 0) {
35397        rotate = currentTransform[1] > 0 ? 90 : 270;
35398      }
35399      switch (rotate) {
35400        case 0:
35401          break;
35402        case 90:
35403          [posX, posY] = [posY, posX];
35404          [lastPosX, lastPosY] = [lastPosY, lastPosX];
35405          break;
35406        case 180:
35407          [posX, posY, lastPosX, lastPosY] = [-posX, -posY, -lastPosX, -lastPosY];
35408          break;
35409        case 270:
35410          [posX, posY] = [-posY, -posX];
35411          [lastPosX, lastPosY] = [-lastPosY, -lastPosX];
35412          break;
35413        default:
35414          [posX, posY] = applyInverseRotation(posX, posY, currentTransform);
35415          [lastPosX, lastPosY] = applyInverseRotation(lastPosX, lastPosY, textContentItem.prevTransform);
35416      }
35417      if (textState.font.vertical) {
35418        const advanceY = (lastPosY - posY) / textContentItem.textAdvanceScale;
35419        const advanceX = posX - lastPosX;
35420        const textOrientation = Math.sign(textContentItem.height || textContentItem.totalHeight);
35421        if (advanceY < textOrientation * textContentItem.negativeSpaceMax) {
35422          if (Math.abs(advanceX) > 0.5 * textContentItem.width) {
35423            appendEOL();
35424            return true;
35425          }
35426          resetLastChars();
35427          flushTextContentItem();
35428          return true;
35429        }
35430        if (Math.abs(advanceX) > textContentItem.width) {
35431          appendEOL();
35432          return true;
35433        }
35434        if (advanceY <= textOrientation * textContentItem.notASpace) {
35435          resetLastChars();
35436        }
35437        if (advanceY <= textOrientation * textContentItem.trackingSpaceMin) {
35438          if (shouldAddWhitepsace()) {
35439            resetLastChars();
35440            flushTextContentItem();
35441            pushWhitespace({
35442              height: Math.abs(advanceY)
35443            });
35444          } else {
35445            textContentItem.height += advanceY;
35446          }
35447        } else if (!addFakeSpaces(advanceY, textContentItem.prevTransform, textOrientation)) {
35448          if (textContentItem.str.length === 0) {
35449            resetLastChars();
35450            pushWhitespace({
35451              height: Math.abs(advanceY)
35452            });
35453          } else {
35454            textContentItem.height += advanceY;
35455          }
35456        }
35457        if (Math.abs(advanceX) > textContentItem.width * VERTICAL_SHIFT_RATIO) {
35458          flushTextContentItem();
35459        }
35460        return true;
35461      }
35462      const advanceX = (posX - lastPosX) / textContentItem.textAdvanceScale;
35463      const advanceY = posY - lastPosY;
35464      const textOrientation = Math.sign(textContentItem.width || textContentItem.totalWidth);
35465      if (advanceX < textOrientation * textContentItem.negativeSpaceMax) {
35466        if (Math.abs(advanceY) > 0.5 * textContentItem.height) {
35467          appendEOL();
35468          return true;
35469        }
35470        resetLastChars();
35471        flushTextContentItem();
35472        return true;
35473      }
35474      const textRiseDelta = textState.textRise - textContentItem.prevTextRise;
35475      const advanceYCorrected = textRiseDelta === 0 ? advanceY : advanceY - currentTransform[3] / textState.fontSize * textRiseDelta;
35476      if (Math.abs(advanceYCorrected) > textContentItem.height) {
35477        appendEOL();
35478        return true;
35479      }
35480      if (advanceX <= textOrientation * textContentItem.notASpace) {
35481        resetLastChars();
35482      }
35483      if (advanceX <= textOrientation * textContentItem.trackingSpaceMin) {
35484        if (shouldAddWhitepsace()) {
35485          resetLastChars();
35486          flushTextContentItem();
35487          pushWhitespace({
35488            width: Math.abs(advanceX)
35489          });
35490        } else {
35491          textContentItem.width += advanceX;
35492        }
35493      } else if (!addFakeSpaces(advanceX, textContentItem.prevTransform, textOrientation)) {
35494        if (textContentItem.str.length === 0) {
35495          resetLastChars();
35496          pushWhitespace({
35497            width: Math.abs(advanceX)
35498          });
35499        } else {
35500          textContentItem.width += advanceX;
35501        }
35502      }
35503      if (Math.abs(advanceY) > textContentItem.height * VERTICAL_SHIFT_RATIO) {
35504        flushTextContentItem();
35505      }
35506      return true;
35507    }
35508    function buildTextContentItem({
35509      chars,
35510      extraSpacing
35511    }) {
35512      if (currentTextState !== textState && (currentTextState.fontSize !== textState.fontSize || currentTextState.fontName !== textState.fontName && (currentTextState.font.name !== textState.font.name || currentTextState.font.vertical !== textState.font.vertical))) {
35513        flushTextContentItem();
35514        currentTextState = textState.clone();
35515      }
35516      const font = textState.font;
35517      const baseCharSpacing = font.vertical ? -textState.charSpacing : textState.charSpacing;
35518      if (!chars) {
35519        const charSpacing = baseCharSpacing + extraSpacing;
35520        if (charSpacing) {
35521          if (!font.vertical) {
35522            textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
35523          } else {
35524            textState.translateTextMatrix(0, -charSpacing);
35525          }
35526        }
35527        if (keepWhiteSpace) {
35528          compareWithLastPosition(0);
35529        }
35530        return;
35531      }
35532      const glyphs = font.charsToGlyphs(chars);
35533      const scale = textState.fontMatrix[0] * textState.fontSize;
35534      for (let i = 0, ii = glyphs.length; i < ii; i++) {
35535        const glyph = glyphs[i];
35536        const {
35537          category,
35538          originalCharCode
35539        } = glyph;
35540        if (category.isInvisibleFormatMark) {
35541          continue;
35542        }
35543        let charSpacing = baseCharSpacing + (i + 1 === ii ? extraSpacing : 0);
35544        let glyphWidth = glyph.width;
35545        if (font.vertical) {
35546          glyphWidth = glyph.vmetric ? glyph.vmetric[0] : -glyphWidth;
35547        }
35548        let scaledDim = glyphWidth * scale;
35549        if (originalCharCode === 0x20) {
35550          charSpacing += textState.wordSpacing;
35551        }
35552        if (!keepWhiteSpace && category.isWhitespace) {
35553          if (!font.vertical) {
35554            charSpacing += scaledDim;
35555            textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
35556          } else {
35557            charSpacing += -scaledDim;
35558            textState.translateTextMatrix(0, -charSpacing);
35559          }
35560          saveLastChar(" ");
35561          continue;
35562        }
35563        if (!category.isZeroWidthDiacritic && !compareWithLastPosition(scaledDim)) {
35564          if (!font.vertical) {
35565            textState.translateTextMatrix(scaledDim * textState.textHScale, 0);
35566          } else {
35567            textState.translateTextMatrix(0, scaledDim);
35568          }
35569          continue;
35570        }
35571        const textChunk = ensureTextContentItem();
35572        if (category.isZeroWidthDiacritic) {
35573          scaledDim = 0;
35574        }
35575        if (!font.vertical) {
35576          scaledDim *= textState.textHScale;
35577          intersector?.addGlyph(getCurrentTextTransform(), scaledDim, 0, glyph.unicode);
35578          textState.translateTextMatrix(scaledDim, 0);
35579          textChunk.width += scaledDim;
35580        } else {
35581          intersector?.addGlyph(getCurrentTextTransform(), 0, scaledDim, glyph.unicode);
35582          textState.translateTextMatrix(0, scaledDim);
35583          scaledDim = Math.abs(scaledDim);
35584          textChunk.height += scaledDim;
35585        }
35586        if (scaledDim) {
35587          textChunk.prevTransform = getCurrentTextTransform();
35588          textChunk.prevTextRise = textState.textRise;
35589        }
35590        const glyphUnicode = glyph.unicode;
35591        if (saveLastChar(glyphUnicode)) {
35592          textChunk.str.push(" ");
35593          intersector?.addExtraChar(" ");
35594        }
35595        if (!intersector) {
35596          textChunk.str.push(glyphUnicode);
35597        }
35598        if (charSpacing) {
35599          if (!font.vertical) {
35600            textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
35601          } else {
35602            textState.translateTextMatrix(0, -charSpacing);
35603          }
35604        }
35605      }
35606    }
35607    function appendEOL() {
35608      intersector?.addExtraChar("\n");
35609      resetLastChars();
35610      if (textContentItem.initialized) {
35611        textContentItem.hasEOL = true;
35612        flushTextContentItem();
35613      } else {
35614        textContent.items.push({
35615          str: "",
35616          dir: "ltr",
35617          width: 0,
35618          height: 0,
35619          transform: getCurrentTextTransform(),
35620          fontName: textState.loadedName,
35621          hasEOL: true
35622        });
35623      }
35624    }
35625    function addFakeSpaces(width, transf, textOrientation) {
35626      if (textOrientation * textContentItem.spaceInFlowMin <= width && width <= textOrientation * textContentItem.spaceInFlowMax) {
35627        if (textContentItem.initialized) {
35628          resetLastChars();
35629          textContentItem.str.push(" ");
35630          intersector?.addExtraChar(" ");
35631        }
35632        return false;
35633      }
35634      const fontName = textContentItem.fontName;
35635      let height = 0;
35636      if (textContentItem.vertical) {
35637        height = width;
35638        width = 0;
35639      }
35640      flushTextContentItem();
35641      resetLastChars();
35642      pushWhitespace({
35643        width: Math.abs(width),
35644        height: Math.abs(height),
35645        transform: transf || getCurrentTextTransform(),
35646        fontName
35647      });
35648      return true;
35649    }
35650    function flushTextContentItem() {
35651      if (!textContentItem.initialized || !textContentItem.str) {
35652        return;
35653      }
35654      if (!textContentItem.vertical) {
35655        textContentItem.totalWidth += textContentItem.width * textContentItem.textAdvanceScale;
35656      } else {
35657        textContentItem.totalHeight += textContentItem.height * textContentItem.textAdvanceScale;
35658      }
35659      textContent.items.push(runBidiTransform(textContentItem));
35660      textContentItem.initialized = false;
35661      textContentItem.str.length = 0;
35662    }
35663    function 
vendor: 1,497 bytes, lines 35663-35710
35663enqueueChunk(batch = false) {
35664      const length = textContent.items.length;
35665      if (length === 0) {
35666        return;
35667      }
35668      if (batch && length < TEXT_CHUNK_BATCH_SIZE) {
35669        return;
35670      }
35671      sink?.enqueue(textContent, length);
35672      textContent.items = [];
35673      textContent.styles = Object.create(null);
35674    }
35675    const timeSlotManager = new TimeSlotManager();
35676    return new Promise(function promiseBody(resolve, reject) {
35677      const next = function (promise) {
35678        enqueueChunk(true);
35679        Promise.all([promise, sink?.ready]).then(function () {
35680          try {
35681            promiseBody(resolve, reject);
35682          } catch (ex) {
35683            reject(ex);
35684          }
35685        }, reject);
35686      };
35687      task.ensureNotTerminated();
35688      timeSlotManager.reset();
35689      const operation = {};
35690      let stop,
35691        name,
35692        isValidName,
35693        args = [];
35694      while (!(stop = timeSlotManager.check())) {
35695        args.length = 0;
35696        operation.args = args;
35697        if (!preprocessor.read(operation)) {
35698          break;
35699        }
35700        textState = stateManager.state;
35701        currentTextState ||= textState.clone();
35702        const fn = operation.fn;
35703        args = operation.args;
35704        switch (fn | 0) {
35705          case OPS.setFont:
35706            const fontNameArg = args[0].name,
35707              fontSizeArg = args[1];
35708            if (textState.font && fontNameArg === textState.fontName && fontSizeArg === textState.fontSize) {
35709              break;
35710            }
vendor: 10,289 bytes, lines 35710-35982
35710
35711            textState.fontName = fontNameArg;
35712            textState.fontSize = fontSizeArg;
35713            next(handleSetFont(fontNameArg, null));
35714            return;
35715          case OPS.setTextRise:
35716            textState.textRise = args[0];
35717            break;
35718          case OPS.setHScale:
35719            textState.textHScale = args[0] / 100;
35720            break;
35721          case OPS.setLeading:
35722            textState.leading = args[0];
35723            break;
35724          case OPS.moveText:
35725            textState.translateTextLineMatrix(args[0], args[1]);
35726            textState.textMatrix = textState.textLineMatrix.slice();
35727            break;
35728          case OPS.setLeadingMoveText:
35729            textState.leading = -args[1];
35730            textState.translateTextLineMatrix(args[0], args[1]);
35731            textState.textMatrix = textState.textLineMatrix.slice();
35732            break;
35733          case OPS.nextLine:
35734            textState.carriageReturn();
35735            break;
35736          case OPS.setTextMatrix:
35737            textState.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
35738            textState.setTextLineMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
35739            updateAdvanceScale();
35740            break;
35741          case OPS.setCharSpacing:
35742            textState.charSpacing = args[0];
35743            break;
35744          case OPS.setWordSpacing:
35745            textState.wordSpacing = args[0];
35746            break;
35747          case OPS.beginText:
35748            textState.textMatrix = IDENTITY_MATRIX.slice();
35749            textState.textLineMatrix = IDENTITY_MATRIX.slice();
35750            break;
35751          case OPS.showSpacedText:
35752            if (!stateManager.state.font) {
35753              self.ensureStateFont(stateManager.state);
35754              continue;
35755            }
35756            const spaceFactor = (textState.font.vertical ? 1 : -1) * textState.fontSize / 1000;
35757            const elements = args[0];
35758            for (let i = 0, ii = elements.length; i < ii; i++) {
35759              const item = elements[i];
35760              if (typeof item === "string") {
35761                showSpacedTextBuffer.push(item);
35762              } else if (typeof item === "number" && item !== 0) {
35763                const str = showSpacedTextBuffer.join("");
35764                showSpacedTextBuffer.length = 0;
35765                buildTextContentItem({
35766                  chars: str,
35767                  extraSpacing: item * spaceFactor
35768                });
35769              }
35770            }
35771            if (showSpacedTextBuffer.length > 0) {
35772              const str = showSpacedTextBuffer.join("");
35773              showSpacedTextBuffer.length = 0;
35774              buildTextContentItem({
35775                chars: str,
35776                extraSpacing: 0
35777              });
35778            }
35779            break;
35780          case OPS.showText:
35781            if (!stateManager.state.font) {
35782              self.ensureStateFont(stateManager.state);
35783              continue;
35784            }
35785            buildTextContentItem({
35786              chars: args[0],
35787              extraSpacing: 0
35788            });
35789            break;
35790          case OPS.nextLineShowText:
35791            if (!stateManager.state.font) {
35792              self.ensureStateFont(stateManager.state);
35793              continue;
35794            }
35795            textState.carriageReturn();
35796            buildTextContentItem({
35797              chars: args[0],
35798              extraSpacing: 0
35799            });
35800            break;
35801          case OPS.nextLineSetSpacingShowText:
35802            if (!stateManager.state.font) {
35803              self.ensureStateFont(stateManager.state);
35804              continue;
35805            }
35806            textState.wordSpacing = args[0];
35807            textState.charSpacing = args[1];
35808            textState.carriageReturn();
35809            buildTextContentItem({
35810              chars: args[2],
35811              extraSpacing: 0
35812            });
35813            break;
35814          case OPS.paintXObject:
35815            flushTextContentItem();
35816            xobjs ??= resources.get("XObject") || Dict.empty;
35817            isValidName = args[0] instanceof Name;
35818            name = args[0].name;
35819            if (isValidName && emptyXObjectCache.getByName(name)) {
35820              break;
35821            }
35822            next(new Promise(function (resolveXObject, rejectXObject) {
35823              if (!isValidName) {
35824                throw new FormatError("XObject must be referred to by name.");
35825              }
35826              let xobj = xobjs.getRaw(name);
35827              if (xobj instanceof Ref) {
35828                if (emptyXObjectCache.getByRef(xobj)) {
35829                  resolveXObject();
35830                  return;
35831                }
35832                const globalImage = self.globalImageCache.getData(xobj, self.pageIndex);
35833                if (globalImage) {
35834                  resolveXObject();
35835                  return;
35836                }
35837                xobj = xref.fetch(xobj);
35838              }
35839              if (!(xobj instanceof BaseStream)) {
35840                throw new FormatError("XObject should be a stream");
35841              }
35842              const {
35843                dict
35844              } = xobj;
35845              const type = dict.get("Subtype");
35846              if (!(type instanceof Name)) {
35847                throw new FormatError("XObject should have a Name subtype");
35848              }
35849              if (type.name !== "Form") {
35850                emptyXObjectCache.set(name, dict.objId, true);
35851                resolveXObject();
35852                return;
35853              }
35854              const currentState = stateManager.state.clone();
35855              const xObjStateManager = new StateManager(currentState);
35856              const matrix = lookupMatrix(dict.getArray("Matrix"), null);
35857              if (matrix) {
35858                xObjStateManager.transform(matrix);
35859              }
35860              const localResources = dict.get("Resources");
35861              enqueueChunk();
35862              const sinkWrapper = {
35863                enqueueInvoked: false,
35864                enqueue(chunk, size) {
35865                  this.enqueueInvoked = true;
35866                  sink.enqueue(chunk, size);
35867                },
35868                get desiredSize() {
35869                  return sink.desiredSize ?? 0;
35870                },
35871                get ready() {
35872                  return sink.ready;
35873                }
35874              };
35875              self.getTextContent({
35876                stream: xobj,
35877                task,
35878                resources: localResources instanceof Dict ? localResources : resources,
35879                stateManager: xObjStateManager,
35880                includeMarkedContent,
35881                sink: sink && sinkWrapper,
35882                seenStyles,
35883                viewBox,
35884                lang,
35885                markedContentData,
35886                disableNormalization,
35887                keepWhiteSpace,
35888                prevRefs: seenRefs
35889              }).then(function () {
35890                if (!sinkWrapper.enqueueInvoked) {
35891                  emptyXObjectCache.set(name, dict.objId, true);
35892                }
35893                resolveXObject();
35894              }, rejectXObject);
35895            }).catch(function (reason) {
35896              if (reason instanceof AbortException) {
35897                return;
35898              }
35899              if (self.options.ignoreErrors) {
35900                warn(`getTextContent - ignoring XObject: "${reason}".`);
35901                return;
35902              }
35903              throw reason;
35904            }));
35905            return;
35906          case OPS.setGState:
35907            isValidName = args[0] instanceof Name;
35908            name = args[0].name;
35909            if (isValidName && emptyGStateCache.getByName(name)) {
35910              break;
35911            }
35912            next(new Promise(function (resolveGState, rejectGState) {
35913              if (!isValidName) {
35914                throw new FormatError("GState must be referred to by name.");
35915              }
35916              const extGState = resources.get("ExtGState");
35917              if (!(extGState instanceof Dict)) {
35918                throw new FormatError("ExtGState should be a dictionary.");
35919              }
35920              const gState = extGState.get(name);
35921              if (!(gState instanceof Dict)) {
35922                throw new FormatError("GState should be a dictionary.");
35923              }
35924              const gStateFont = gState.get("Font");
35925              if (!gStateFont) {
35926                emptyGStateCache.set(name, gState.objId, true);
35927                resolveGState();
35928                return;
35929              }
35930              flushTextContentItem();
35931              textState.fontName = null;
35932              textState.fontSize = gStateFont[1];
35933              handleSetFont(null, gStateFont[0]).then(resolveGState, rejectGState);
35934            }).catch(function (reason) {
35935              if (reason instanceof AbortException) {
35936                return;
35937              }
35938              if (self.options.ignoreErrors) {
35939                warn(`getTextContent - ignoring ExtGState: "${reason}".`);
35940                return;
35941              }
35942              throw reason;
35943            }));
35944            return;
35945          case OPS.beginMarkedContent:
35946            flushTextContentItem();
35947            if (includeMarkedContent) {
35948              markedContentData.level++;
35949              textContent.items.push({
35950                type: "beginMarkedContent",
35951                tag: args[0] instanceof Name ? args[0].name : null
35952              });
35953            }
35954            break;
35955          case OPS.beginMarkedContentProps:
35956            flushTextContentItem();
35957            if (includeMarkedContent) {
35958              markedContentData.level++;
35959              let mcid = null;
35960              if (args[1] instanceof Dict) {
35961                mcid = args[1].get("MCID");
35962              }
35963              textContent.items.push({
35964                type: "beginMarkedContentProps",
35965                id: Number.isInteger(mcid) ? `${self.idFactory.getPageObjId()}_mc${mcid}` : null,
35966                tag: args[0] instanceof Name ? args[0].name : null
35967              });
35968            }
35969            break;
35970          case OPS.endMarkedContent:
35971            flushTextContentItem();
35972            if (includeMarkedContent) {
35973              if (markedContentData.level === 0) {
35974                break;
35975              }
35976              markedContentData.level--;
35977              textContent.items.push({
35978                type: "endMarkedContent"
35979              });
35980            }
35981            break;
35982        
35982}
35983        if (textContent.items.length >= (sink?.desiredSize ?? 1)) {
35984          stop = true;
35985          break;
35986        }
35987      }
35988      if (stop) {
35989        next(deferred);
35990        return;
35991      }
35992      flushTextContentItem();
35993      enqueueChunk();
35994      resolve();
35995    }).catch(reason => {
35996      if (reason instanceof AbortException) {
35997        return;
35998      }
35999      if (this.options.ignoreErrors) {
36000        warn(`getTextContent - ignoring errors during "${task.name}" ` + `task: "${reason}".`);
36001        flushTextContentItem
vendor: 16,169 bytes, lines 36001-36449
36001();
36002        enqueueChunk();
36003        return;
36004      }
36005      throw reason;
36006    });
36007  }
36008  async extractDataStructures(dict, properties) {
36009    const xref = this.xref;
36010    let cidToGidBytes;
36011    const toUnicodePromise = this.readToUnicode(properties.toUnicode);
36012    if (properties.composite) {
36013      const cidSystemInfo = dict.get("CIDSystemInfo");
36014      if (cidSystemInfo instanceof Dict && !properties.cidSystemInfo) {
36015        properties.cidSystemInfo = {
36016          registry: stringToPDFString(cidSystemInfo.get("Registry")),
36017          ordering: stringToPDFString(cidSystemInfo.get("Ordering")),
36018          supplement: cidSystemInfo.get("Supplement")
36019        };
36020      }
36021      try {
36022        const cidToGidMap = dict.get("CIDToGIDMap");
36023        if (cidToGidMap instanceof BaseStream) {
36024          cidToGidBytes = cidToGidMap.getBytes();
36025        }
36026      } catch (ex) {
36027        if (!this.options.ignoreErrors) {
36028          throw ex;
36029        }
36030        warn(`extractDataStructures - ignoring CIDToGIDMap data: "${ex}".`);
36031      }
36032    }
36033    const differences = [];
36034    let baseEncodingName = null;
36035    let encoding;
36036    if (dict.has("Encoding")) {
36037      encoding = dict.get("Encoding");
36038      if (encoding instanceof Dict) {
36039        baseEncodingName = encoding.get("BaseEncoding");
36040        baseEncodingName = baseEncodingName instanceof Name ? baseEncodingName.name : null;
36041        if (encoding.has("Differences")) {
36042          const diffEncoding = encoding.get("Differences");
36043          let index = 0;
36044          for (const entry of diffEncoding) {
36045            const data = xref.fetchIfRef(entry);
36046            if (typeof data === "number") {
36047              index = data;
36048            } else if (data instanceof Name) {
36049              differences[index++] = data.name;
36050            } else {
36051              throw new FormatError(`Invalid entry in 'Differences' array: ${data}`);
36052            }
36053          }
36054        }
36055      } else if (encoding instanceof Name) {
36056        baseEncodingName = encoding.name;
36057      } else {
36058        const msg = "Encoding is not a Name nor a Dict";
36059        if (!this.options.ignoreErrors) {
36060          throw new FormatError(msg);
36061        }
36062        warn(msg);
36063      }
36064      if (baseEncodingName !== "MacRomanEncoding" && baseEncodingName !== "MacExpertEncoding" && baseEncodingName !== "WinAnsiEncoding") {
36065        baseEncodingName = null;
36066      }
36067    }
36068    const nonEmbeddedFont = !properties.file || properties.isInternalFont,
36069      isSymbolsFontName = getSymbolsFonts()[properties.name];
36070    if (baseEncodingName && nonEmbeddedFont && isSymbolsFontName) {
36071      baseEncodingName = null;
36072    }
36073    if (baseEncodingName === "WinAnsiEncoding" && nonEmbeddedFont && properties.name?.charCodeAt(0) >= 0xb7) {
36074      const fontName = properties.name;
36075      const chineseFontNames = ["\xCB\xCE\xCC\xE5", "\xBA\xDA\xCC\xE5", "\xBF\xAC\xCC\xE5", "\xB7\xC2\xCB\xCE", "\xBF\xAC\xCC\xE5_GB2312", "\xB7\xC2\xCB\xCE_GB2312", "\xC1\xA5\xCA\xE9", "\xD0\xC2\xCB\xCE", "\xB7\xC2\xCB\xCE\xCC\xE5", "\xD0\xA1\xB1\xEA\xCB\xCE"];
36076      if (chineseFontNames.includes(fontName)) {
36077        baseEncodingName = null;
36078        properties.defaultEncoding = "Adobe-GB1-UCS2";
36079        properties.composite = true;
36080        properties.cidEncoding = Name.get("GBK-EUC-H");
36081        const cMap = await CMapFactory.create({
36082          encoding: properties.cidEncoding,
36083          fetchBuiltInCMap: this._fetchBuiltInCMapBound,
36084          useCMap: null
36085        });
36086        properties.cMap = cMap;
36087        properties.vertical = properties.cMap.vertical;
36088        properties.cidSystemInfo = {
36089          registry: "Adobe",
36090          ordering: "GB1",
36091          supplement: 0
36092        };
36093      }
36094    }
36095    if (baseEncodingName) {
36096      properties.defaultEncoding = getEncoding(baseEncodingName);
36097    } else {
36098      let isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
36099      const isNonsymbolicFont = !!(properties.flags & FontFlags.Nonsymbolic);
36100      if (properties.type === "TrueType" && isSymbolicFont && isNonsymbolicFont && differences.length !== 0) {
36101        properties.flags &= ~FontFlags.Symbolic;
36102        isSymbolicFont = false;
36103      }
36104      encoding = StandardEncoding;
36105      if (properties.type === "TrueType" && !isNonsymbolicFont) {
36106        encoding = WinAnsiEncoding;
36107      }
36108      if (isSymbolicFont || isSymbolsFontName) {
36109        encoding = MacRomanEncoding;
36110        if (nonEmbeddedFont) {
36111          if (/Symbol/i.test(properties.name)) {
36112            encoding = SymbolSetEncoding;
36113          } else if (/Dingbats/i.test(properties.name)) {
36114            encoding = ZapfDingbatsEncoding;
36115          } else if (/Wingdings/i.test(properties.name)) {
36116            encoding = WinAnsiEncoding;
36117          }
36118        }
36119      }
36120      properties.defaultEncoding = encoding;
36121    }
36122    properties.differences = differences;
36123    properties.baseEncodingName = baseEncodingName;
36124    properties.hasEncoding = !!baseEncodingName || differences.length > 0;
36125    properties.dict = dict;
36126    properties.toUnicode = await toUnicodePromise;
36127    const builtToUnicode = await this.buildToUnicode(properties);
36128    properties.toUnicode = builtToUnicode;
36129    if (cidToGidBytes) {
36130      properties.cidToGidMap = this.readCidToGidMap(cidToGidBytes, builtToUnicode);
36131    }
36132    return properties;
36133  }
36134  _simpleFontToUnicode(properties, forceGlyphs = false) {
36135    assert(!properties.composite, "Must be a simple font.");
36136    const toUnicode = [];
36137    const encoding = properties.defaultEncoding.slice();
36138    const baseEncodingName = properties.baseEncodingName;
36139    const differences = properties.differences;
36140    for (const charcode in differences) {
36141      const glyphName = differences[charcode];
36142      if (glyphName === ".notdef") {
36143        continue;
36144      }
36145      encoding[charcode] = glyphName;
36146    }
36147    const glyphsUnicodeMap = getGlyphsUnicode();
36148    for (const charcode in encoding) {
36149      let glyphName = encoding[charcode];
36150      if (glyphName === "") {
36151        continue;
36152      }
36153      let unicode = glyphsUnicodeMap[glyphName];
36154      if (unicode !== undefined) {
36155        toUnicode[charcode] = String.fromCharCode(unicode);
36156        continue;
36157      }
36158      let code = 0;
36159      switch (glyphName[0]) {
36160        case "G":
36161          if (glyphName.length === 3) {
36162            code = parseInt(glyphName.substring(1), 16);
36163          }
36164          break;
36165        case "g":
36166          if (glyphName.length === 5) {
36167            code = parseInt(glyphName.substring(1), 16);
36168          }
36169          break;
36170        case "C":
36171        case "c":
36172          if (glyphName.length >= 3 && glyphName.length <= 4) {
36173            const codeStr = glyphName.substring(1);
36174            if (forceGlyphs) {
36175              code = parseInt(codeStr, 16);
36176              break;
36177            }
36178            code = +codeStr;
36179            if (Number.isNaN(code) && Number.isInteger(parseInt(codeStr, 16))) {
36180              return this._simpleFontToUnicode(properties, true);
36181            }
36182          }
36183          break;
36184        case "u":
36185          unicode = getUnicodeForGlyph(glyphName, glyphsUnicodeMap);
36186          if (unicode !== -1) {
36187            code = unicode;
36188          }
36189          break;
36190        default:
36191          switch (glyphName) {
36192            case "f_h":
36193            case "f_t":
36194            case "T_h":
36195              toUnicode[charcode] = glyphName.replaceAll("_", "");
36196              continue;
36197          }
36198          break;
36199      }
36200      if (code > 0 && code <= 0x10ffff && Number.isInteger(code)) {
36201        if (baseEncodingName && code === +charcode) {
36202          const baseEncoding = getEncoding(baseEncodingName);
36203          if (baseEncoding && (glyphName = baseEncoding[charcode])) {
36204            toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
36205            continue;
36206          }
36207        }
36208        toUnicode[charcode] = String.fromCodePoint(code);
36209      }
36210    }
36211    return toUnicode;
36212  }
36213  async buildToUnicode(properties) {
36214    properties.hasIncludedToUnicodeMap = properties.toUnicode?.length > 0;
36215    if (properties.hasIncludedToUnicodeMap) {
36216      if (!properties.composite && properties.hasEncoding) {
36217        properties.fallbackToUnicode = this._simpleFontToUnicode(properties);
36218      }
36219      return properties.toUnicode;
36220    }
36221    if (!properties.composite) {
36222      return new ToUnicodeMap(this._simpleFontToUnicode(properties));
36223    }
36224    if (properties.composite && (properties.cMap.builtInCMap && !(properties.cMap instanceof IdentityCMap) || properties.cidSystemInfo?.registry === "Adobe" && (properties.cidSystemInfo.ordering === "GB1" || properties.cidSystemInfo.ordering === "CNS1" || properties.cidSystemInfo.ordering === "Japan1" || properties.cidSystemInfo.ordering === "Korea1"))) {
36225      const {
36226        registry,
36227        ordering
36228      } = properties.cidSystemInfo;
36229      const ucs2CMapName = Name.get(`${registry}-${ordering}-UCS2`);
36230      const ucs2CMap = await CMapFactory.create({
36231        encoding: ucs2CMapName,
36232        fetchBuiltInCMap: this._fetchBuiltInCMapBound,
36233        useCMap: null
36234      });
36235      const toUnicode = [],
36236        buf = [];
36237      properties.cMap.forEach(function (charcode, cid) {
36238        if (cid > 0xffff) {
36239          throw new FormatError("Max size of CID is 65,535");
36240        }
36241        const ucs2 = ucs2CMap.lookup(cid);
36242        if (ucs2) {
36243          buf.length = 0;
36244          for (let i = 0, ii = ucs2.length; i < ii; i += 2) {
36245            buf.push((ucs2.charCodeAt(i) << 8) + ucs2.charCodeAt(i + 1));
36246          }
36247          toUnicode[charcode] = String.fromCharCode(...buf);
36248        }
36249      });
36250      return new ToUnicodeMap(toUnicode);
36251    }
36252    return new IdentityToUnicodeMap(properties.firstChar, properties.lastChar);
36253  }
36254  async readToUnicode(cmapObj) {
36255    if (!cmapObj) {
36256      return null;
36257    }
36258    if (cmapObj instanceof Name) {
36259      const cmap = await CMapFactory.create({
36260        encoding: cmapObj,
36261        fetchBuiltInCMap: this._fetchBuiltInCMapBound,
36262        useCMap: null
36263      });
36264      if (cmap instanceof IdentityCMap) {
36265        return new IdentityToUnicodeMap(0, 0xffff);
36266      }
36267      return new ToUnicodeMap(cmap.getMap());
36268    }
36269    if (cmapObj instanceof BaseStream) {
36270      try {
36271        const cmap = await CMapFactory.create({
36272          encoding: cmapObj,
36273          fetchBuiltInCMap: this._fetchBuiltInCMapBound,
36274          useCMap: null
36275        });
36276        if (cmap instanceof IdentityCMap) {
36277          return new IdentityToUnicodeMap(0, 0xffff);
36278        }
36279        const map = new Array(cmap.length);
36280        cmap.forEach(function (charCode, token) {
36281          if (typeof token === "number") {
36282            map[charCode] = String.fromCodePoint(token);
36283            return;
36284          }
36285          if (token.length % 2 !== 0) {
36286            token = "\u0000" + token;
36287          }
36288          const str = [];
36289          for (let k = 0; k < token.length; k += 2) {
36290            const w1 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
36291            if ((w1 & 0xf800) !== 0xd800) {
36292              str.push(w1);
36293              continue;
36294            }
36295            k += 2;
36296            const w2 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
36297            str.push(((w1 & 0x3ff) << 10) + (w2 & 0x3ff) + 0x10000);
36298          }
36299          map[charCode] = String.fromCodePoint(...str);
36300        });
36301        return new ToUnicodeMap(map);
36302      } catch (reason) {
36303        if (reason instanceof AbortException) {
36304          return null;
36305        }
36306        if (this.options.ignoreErrors) {
36307          warn(`readToUnicode - ignoring ToUnicode data: "${reason}".`);
36308          return null;
36309        }
36310        throw reason;
36311      }
36312    }
36313    return null;
36314  }
36315  readCidToGidMap(glyphsData, toUnicode) {
36316    const result = [];
36317    for (let j = 0, jj = glyphsData.length; j < jj; j++) {
36318      const glyphID = glyphsData[j++] << 8 | glyphsData[j];
36319      const code = j >> 1;
36320      if (glyphID === 0 && !toUnicode.has(code)) {
36321        continue;
36322      }
36323      result[code] = glyphID;
36324    }
36325    return result;
36326  }
36327  extractWidths(dict, descriptor, properties) {
36328    const xref = this.xref;
36329    let glyphsWidths = [];
36330    let defaultWidth = 0;
36331    const glyphsVMetrics = [];
36332    let defaultVMetrics;
36333    if (properties.composite) {
36334      const dw = dict.get("DW");
36335      defaultWidth = typeof dw === "number" ? Math.ceil(dw) : 1000;
36336      const widths = dict.get("W");
36337      if (Array.isArray(widths)) {
36338        for (let i = 0, ii = widths.length; i < ii; i++) {
36339          let start = xref.fetchIfRef(widths[i++]);
36340          if (!Number.isInteger(start)) {
36341            break;
36342          }
36343          const code = xref.fetchIfRef(widths[i]);
36344          if (Array.isArray(code)) {
36345            for (const c of code) {
36346              const width = xref.fetchIfRef(c);
36347              if (typeof width === "number") {
36348                glyphsWidths[start] = width;
36349              }
36350              start++;
36351            }
36352          } else if (Number.isInteger(code)) {
36353            const width = xref.fetchIfRef(widths[++i]);
36354            if (typeof width !== "number") {
36355              continue;
36356            }
36357            for (let j = start; j <= code; j++) {
36358              glyphsWidths[j] = width;
36359            }
36360          } else {
36361            break;
36362          }
36363        }
36364      }
36365      if (properties.vertical) {
36366        const dw2 = dict.getArray("DW2");
36367        let vmetrics = isNumberArray(dw2, 2) ? dw2 : [880, -1000];
36368        defaultVMetrics = [vmetrics[1], defaultWidth * 0.5, vmetrics[0]];
36369        vmetrics = dict.get("W2");
36370        if (Array.isArray(vmetrics)) {
36371          for (let i = 0, ii = vmetrics.length; i < ii; i++) {
36372            let start = xref.fetchIfRef(vmetrics[i++]);
36373            if (!Number.isInteger(start)) {
36374              break;
36375            }
36376            const code = xref.fetchIfRef(vmetrics[i]);
36377            if (Array.isArray(code)) {
36378              for (let j = 0, jj = code.length; j < jj; j++) {
36379                const vmetric = [xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j])];
36380                if (isNumberArray(vmetric, null)) {
36381                  glyphsVMetrics[start] = vmetric;
36382                }
36383                start++;
36384              }
36385            } else if (Number.isInteger(code)) {
36386              const vmetric = [xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i])];
36387              if (!isNumberArray(vmetric, null)) {
36388                continue;
36389              }
36390              for (let j = start; j <= code; j++) {
36391                glyphsVMetrics[j] = vmetric;
36392              }
36393            } else {
36394              break;
36395            }
36396          }
36397        }
36398      }
36399    } else {
36400      const widths = dict.get("Widths");
36401      if (Array.isArray(widths)) {
36402        let j = properties.firstChar;
36403        for (const w of widths) {
36404          const width = xref.fetchIfRef(w);
36405          if (typeof width === "number") {
36406            glyphsWidths[j] = width;
36407          }
36408          j++;
36409        }
36410        const missingWidth = descriptor.get("MissingWidth");
36411        defaultWidth = typeof missingWidth === "number" ? missingWidth : 0;
36412      } else {
36413        const baseFontName = dict.get("BaseFont");
36414        if (baseFontName instanceof Name) {
36415          const metrics = this.getBaseFontMetrics(baseFontName.name);
36416          glyphsWidths = this.buildCharCodeToWidth(metrics.widths, properties);
36417          defaultWidth = metrics.defaultWidth;
36418        }
36419      }
36420    }
36421    let isMonospace = true;
36422    let firstWidth = defaultWidth;
36423    for (const glyph in glyphsWidths) {
36424      const glyphWidth = glyphsWidths[glyph];
36425      if (!glyphWidth) {
36426        continue;
36427      }
36428      if (!firstWidth) {
36429        firstWidth = glyphWidth;
36430        continue;
36431      }
36432      if (firstWidth !== glyphWidth) {
36433        isMonospace = false;
36434        break;
36435      }
36436    }
36437    if (isMonospace) {
36438      properties.flags |= FontFlags.FixedPitch;
36439    } else {
36440      properties.flags &= ~FontFlags.FixedPitch;
36441    }
36442    properties.defaultWidth = defaultWidth;
36443    properties.widths = glyphsWidths;
36444    properties.defaultVMetrics = defaultVMetrics;
36445    properties.vmetrics = glyphsVMetrics;
36446  }
36447  isSerifFont(baseFontName) {
36448    const fontNameWoStyle = baseFontName.split("-", 1)[0];
36449    return fontNameWoStyle in getSerifFonts() || /serif/
vendor: 10,254 bytes, lines 36449-36735
36449gi.test(fontNameWoStyle);
36450  }
36451  getBaseFontMetrics(name) {
36452    let defaultWidth = 0;
36453    let widths = Object.create(null);
36454    let monospace = false;
36455    let fontName = normalizeFontName(name);
36456    const stdFontMap = getStdFontMap();
36457    fontName = stdFontMap[fontName] || fontName;
36458    const Metrics = getMetrics();
36459    const glyphWidths = Metrics[fontName] ?? Metrics[this.isSerifFont(name) ? "Times-Roman" : "Helvetica"];
36460    if (typeof glyphWidths === "number") {
36461      defaultWidth = glyphWidths;
36462      monospace = true;
36463    } else {
36464      widths = glyphWidths();
36465    }
36466    return {
36467      defaultWidth,
36468      monospace,
36469      widths
36470    };
36471  }
36472  buildCharCodeToWidth(widthsByGlyphName, properties) {
36473    const widths = Object.create(null);
36474    const differences = properties.differences;
36475    const encoding = properties.defaultEncoding;
36476    for (let charCode = 0; charCode < 256; charCode++) {
36477      if (charCode in differences && widthsByGlyphName[differences[charCode]]) {
36478        widths[charCode] = widthsByGlyphName[differences[charCode]];
36479        continue;
36480      }
36481      if (charCode in encoding && widthsByGlyphName[encoding[charCode]]) {
36482        widths[charCode] = widthsByGlyphName[encoding[charCode]];
36483        continue;
36484      }
36485    }
36486    return widths;
36487  }
36488  preEvaluateFont(dict) {
36489    const baseDict = dict;
36490    let type = dict.get("Subtype");
36491    if (!(type instanceof Name)) {
36492      throw new FormatError("invalid font Subtype");
36493    }
36494    let composite = false;
36495    let hash;
36496    if (type.name === "Type0") {
36497      const df = dict.get("DescendantFonts");
36498      if (!df) {
36499        throw new FormatError("Descendant fonts are not specified");
36500      }
36501      dict = Array.isArray(df) ? this.xref.fetchIfRef(df[0]) : df;
36502      if (!(dict instanceof Dict)) {
36503        throw new FormatError("Descendant font is not a dictionary.");
36504      }
36505      type = dict.get("Subtype");
36506      if (!(type instanceof Name)) {
36507        throw new FormatError("invalid font Subtype");
36508      }
36509      composite = true;
36510    }
36511    let firstChar = dict.get("FirstChar");
36512    if (!Number.isInteger(firstChar)) {
36513      firstChar = 0;
36514    }
36515    let lastChar = dict.get("LastChar");
36516    if (!Number.isInteger(lastChar)) {
36517      lastChar = composite ? 0xffff : 0xff;
36518    }
36519    const descriptor = dict.get("FontDescriptor");
36520    const toUnicode = dict.get("ToUnicode") || baseDict.get("ToUnicode");
36521    if (descriptor) {
36522      hash = new MurmurHash3_64();
36523      const encoding = baseDict.getRaw("Encoding");
36524      if (encoding instanceof Name) {
36525        hash.update(encoding.name);
36526      } else if (encoding instanceof Ref) {
36527        hash.update(encoding.toString());
36528      } else if (encoding instanceof Dict) {
36529        for (const entry of encoding.getRawValues()) {
36530          if (entry instanceof Name) {
36531            hash.update(entry.name);
36532          } else if (entry instanceof Ref) {
36533            hash.update(entry.toString());
36534          } else if (Array.isArray(entry)) {
36535            const diffLength = entry.length,
36536              diffBuf = new Array(diffLength);
36537            for (let j = 0; j < diffLength; j++) {
36538              const diffEntry = entry[j];
36539              if (diffEntry instanceof Name) {
36540                diffBuf[j] = diffEntry.name;
36541              } else if (typeof diffEntry === "number" || diffEntry instanceof Ref) {
36542                diffBuf[j] = diffEntry.toString();
36543              }
36544            }
36545            hash.update(diffBuf.join());
36546          }
36547        }
36548      }
36549      hash.update(`${firstChar}-${lastChar}`);
36550      if (toUnicode instanceof BaseStream) {
36551        const stream = toUnicode.stream || toUnicode;
36552        const uint8array = stream.buffer ? new Uint8Array(stream.buffer.buffer, 0, stream.bufferLength) : new Uint8Array(stream.bytes.buffer, stream.start, stream.end - stream.start);
36553        hash.update(uint8array);
36554      } else if (toUnicode instanceof Name) {
36555        hash.update(toUnicode.name);
36556      }
36557      const widths = dict.get("Widths") || baseDict.get("Widths");
36558      if (Array.isArray(widths)) {
36559        const widthsBuf = [];
36560        for (const entry of widths) {
36561          if (typeof entry === "number" || entry instanceof Ref) {
36562            widthsBuf.push(entry.toString());
36563          }
36564        }
36565        hash.update(widthsBuf.join());
36566      }
36567      if (composite) {
36568        hash.update("compositeFont");
36569        const compositeWidths = dict.get("W") || baseDict.get("W");
36570        if (Array.isArray(compositeWidths)) {
36571          const widthsBuf = [];
36572          for (const entry of compositeWidths) {
36573            if (typeof entry === "number" || entry instanceof Ref) {
36574              widthsBuf.push(entry.toString());
36575            } else if (Array.isArray(entry)) {
36576              const subWidthsBuf = [];
36577              for (const element of entry) {
36578                if (typeof element === "number" || element instanceof Ref) {
36579                  subWidthsBuf.push(element.toString());
36580                }
36581              }
36582              widthsBuf.push(`[${subWidthsBuf.join()}]`);
36583            }
36584          }
36585          hash.update(widthsBuf.join());
36586        }
36587        const cidToGidMap = dict.getRaw("CIDToGIDMap") || baseDict.getRaw("CIDToGIDMap");
36588        if (cidToGidMap instanceof Name) {
36589          hash.update(cidToGidMap.name);
36590        } else if (cidToGidMap instanceof Ref) {
36591          hash.update(cidToGidMap.toString());
36592        } else if (cidToGidMap instanceof BaseStream) {
36593          hash.update(cidToGidMap.peekBytes());
36594        }
36595      }
36596      if (type.name === "Type3") {
36597        const charProcs = baseDict.get("CharProcs");
36598        if (charProcs instanceof Dict) {
36599          for (const [key, entry] of charProcs.getRawEntries()) {
36600            hash.update(entry instanceof Ref ? `${key}\0${entry}` : key);
36601          }
36602        }
36603      }
36604    }
36605    return {
36606      descriptor,
36607      dict,
36608      baseDict,
36609      composite,
36610      type: type.name,
36611      firstChar,
36612      lastChar,
36613      toUnicode,
36614      hash: hash ? hash.hexdigest() : ""
36615    };
36616  }
36617  async translateFont({
36618    descriptor,
36619    dict,
36620    baseDict,
36621    composite,
36622    type,
36623    firstChar,
36624    lastChar,
36625    toUnicode,
36626    cssFontInfo
36627  }) {
36628    const isType3Font = type === "Type3";
36629    if (!descriptor) {
36630      if (isType3Font) {
36631        descriptor = Dict.empty;
36632      } else {
36633        let baseFontName = dict.get("BaseFont");
36634        if (!(baseFontName instanceof Name)) {
36635          throw new FormatError("Base font is not specified");
36636        }
36637        baseFontName = normalizeFontName(baseFontName.name);
36638        const metrics = this.getBaseFontMetrics(baseFontName);
36639        const fontNameWoStyle = baseFontName.split("-", 1)[0];
36640        const flags = (this.isSerifFont(fontNameWoStyle) ? FontFlags.Serif : 0) | (metrics.monospace ? FontFlags.FixedPitch : 0) | (getSymbolsFonts()[fontNameWoStyle] ? FontFlags.Symbolic : FontFlags.Nonsymbolic);
36641        const properties = {
36642          type,
36643          name: baseFontName,
36644          loadedName: baseDict.loadedName,
36645          systemFontInfo: null,
36646          widths: metrics.widths,
36647          defaultWidth: metrics.defaultWidth,
36648          isSimulatedFlags: true,
36649          flags,
36650          firstChar,
36651          lastChar,
36652          toUnicode,
36653          xHeight: 0,
36654          capHeight: 0,
36655          italicAngle: 0,
36656          isType3Font
36657        };
36658        const widths = dict.get("Widths");
36659        const standardFontName = getStandardFontName(baseFontName);
36660        let file = null;
36661        if (standardFontName) {
36662          file = await this.fetchStandardFontData(standardFontName);
36663          properties.isInternalFont = !!file;
36664        }
36665        if (!properties.isInternalFont && this.options.useSystemFonts) {
36666          properties.systemFontInfo = getFontSubstitution(this.systemFontCache, this.idFactory, this.options.standardFontDataUrl, baseFontName, standardFontName, type);
36667        }
36668        const newProperties = await this.extractDataStructures(dict, properties);
36669        if (Array.isArray(widths)) {
36670          const glyphWidths = [];
36671          let j = firstChar;
36672          for (const w of widths) {
36673            const width = this.xref.fetchIfRef(w);
36674            if (typeof width === "number") {
36675              glyphWidths[j] = width;
36676            }
36677            j++;
36678          }
36679          newProperties.widths = glyphWidths;
36680        } else {
36681          newProperties.widths = this.buildCharCodeToWidth(metrics.widths, newProperties);
36682        }
36683        return new Font(baseFontName, file, newProperties, this.options);
36684      }
36685    }
36686    let fontName = descriptor.get("FontName");
36687    let baseFont = dict.get("BaseFont");
36688    if (typeof fontName === "string") {
36689      fontName = Name.get(fontName);
36690    }
36691    if (typeof baseFont === "string") {
36692      baseFont = Name.get(baseFont);
36693    }
36694    const fontNameStr = fontName?.name;
36695    const baseFontStr = baseFont?.name;
36696    if (isType3Font) {
36697      if (!fontNameStr) {
36698        fontName = Name.get(type);
36699      }
36700    } else if (fontNameStr !== baseFontStr) {
36701      info(`The FontDescriptor's FontName is "${fontNameStr}" but ` + `should be the same as the Font's BaseFont "${baseFontStr}".`);
36702      if (fontNameStr && baseFontStr && (baseFontStr.startsWith(fontNameStr) || !isKnownFontName(fontNameStr) && isKnownFontName(baseFontStr))) {
36703        fontName = null;
36704      }
36705      fontName ||= baseFont;
36706    }
36707    if (!(fontName instanceof Name)) {
36708      throw new FormatError("invalid font name");
36709    }
36710    let fontFile, subtype, length1, length2, length3;
36711    try {
36712      fontFile = descriptor.get("FontFile", "FontFile2", "FontFile3");
36713      if (fontFile) {
36714        if (!(fontFile instanceof BaseStream)) {
36715          throw new FormatError("FontFile should be a stream");
36716        } else {
36717          if (fontFile.isAsync) {
36718            const bytes = await fontFile.asyncGetBytes();
36719            if (bytes) {
36720              fontFile = new Stream(bytes, 0, bytes.length, fontFile.dict);
36721            }
36722          }
36723          if (fontFile.isEmpty) {
36724            throw new FormatError("FontFile is empty");
36725          }
36726        }
36727      }
36728    } catch (ex) {
36729      if (!this.options.ignoreErrors) {
36730        throw ex;
36731      }
36732      warn(`translateFont - fetching "${fontName.name}" font file: "${ex}".`);
36733      fontFile = null;
36734    }
36735    let isInternalFont = false;
vendor: 7,687 bytes, lines 36736-36965
36736    let glyphScaleFactors = null;
36737    let systemFontInfo = null;
36738    if (fontFile) {
36739      if (fontFile.dict) {
36740        const subtypeEntry = fontFile.dict.get("Subtype");
36741        if (subtypeEntry instanceof Name) {
36742          subtype = subtypeEntry.name;
36743        }
36744        length1 = fontFile.dict.get("Length1");
36745        length2 = fontFile.dict.get("Length2");
36746        length3 = fontFile.dict.get("Length3");
36747      }
36748    } else if (cssFontInfo) {
36749      const standardFontName = getXfaFontName(fontName.name);
36750      if (standardFontName) {
36751        cssFontInfo.fontFamily = `${cssFontInfo.fontFamily}-PdfJS-XFA`;
36752        cssFontInfo.metrics = standardFontName.metrics || null;
36753        glyphScaleFactors = standardFontName.factors || null;
36754        fontFile = await this.fetchStandardFontData(standardFontName.name);
36755        isInternalFont = !!fontFile;
36756        baseDict = dict = getXfaFontDict(fontName.name);
36757        composite = true;
36758      }
36759    } else if (!isType3Font) {
36760      const standardFontName = getStandardFontName(fontName.name);
36761      if (standardFontName) {
36762        fontFile = await this.fetchStandardFontData(standardFontName);
36763        isInternalFont = !!fontFile;
36764      }
36765      if (!isInternalFont && this.options.useSystemFonts) {
36766        systemFontInfo = getFontSubstitution(this.systemFontCache, this.idFactory, this.options.standardFontDataUrl, fontName.name, standardFontName, type);
36767      }
36768    }
36769    const fontMatrix = lookupMatrix(dict.getArray("FontMatrix"), FONT_IDENTITY_MATRIX);
36770    const bbox = lookupNormalRect(descriptor.getArray("FontBBox") || dict.getArray("FontBBox"), isType3Font ? [0, 0, 0, 0] : undefined);
36771    let ascent = descriptor.get("Ascent");
36772    if (typeof ascent !== "number") {
36773      ascent = undefined;
36774    }
36775    let descent = descriptor.get("Descent");
36776    if (typeof descent !== "number") {
36777      descent = undefined;
36778    }
36779    let xHeight = descriptor.get("XHeight");
36780    if (typeof xHeight !== "number") {
36781      xHeight = 0;
36782    }
36783    let capHeight = descriptor.get("CapHeight");
36784    if (typeof capHeight !== "number") {
36785      capHeight = 0;
36786    }
36787    let flags = descriptor.get("Flags");
36788    if (!Number.isInteger(flags)) {
36789      flags = 0;
36790    }
36791    let italicAngle = descriptor.get("ItalicAngle");
36792    if (typeof italicAngle !== "number") {
36793      italicAngle = 0;
36794    }
36795    const properties = {
36796      type,
36797      name: fontName.name,
36798      subtype,
36799      file: fontFile,
36800      length1,
36801      length2,
36802      length3,
36803      isInternalFont,
36804      loadedName: baseDict.loadedName,
36805      composite,
36806      fixedPitch: false,
36807      fontMatrix,
36808      firstChar,
36809      lastChar,
36810      toUnicode,
36811      bbox,
36812      ascent,
36813      descent,
36814      xHeight,
36815      capHeight,
36816      flags,
36817      italicAngle,
36818      isType3Font,
36819      cssFontInfo,
36820      scaleFactors: glyphScaleFactors,
36821      systemFontInfo
36822    };
36823    if (composite) {
36824      const cidEncoding = baseDict.get("Encoding");
36825      if (cidEncoding instanceof Name) {
36826        properties.cidEncoding = cidEncoding.name;
36827      }
36828      const cMap = await CMapFactory.create({
36829        encoding: cidEncoding,
36830        fetchBuiltInCMap: this._fetchBuiltInCMapBound,
36831        useCMap: null
36832      });
36833      properties.cMap = cMap;
36834      properties.vertical = properties.cMap.vertical;
36835    }
36836    const newProperties = await this.extractDataStructures(dict, properties);
36837    this.extractWidths(dict, descriptor, newProperties);
36838    return new Font(fontName.name, fontFile, newProperties, this.options);
36839  }
36840  static buildFontPaths(font, glyphs, handler, evaluatorOptions) {
36841    function buildPath(fontChar) {
36842      const glyphName = `${font.loadedName}_path_${fontChar}`;
36843      try {
36844        if (font.renderer.hasBuiltPath(fontChar)) {
36845          return;
36846        }
36847        const buffer = compileFontPathInfo(font.renderer.getPathJs(fontChar));
36848        handler.send("commonobj", [glyphName, "FontPath", buffer], [buffer]);
36849      } catch (reason) {
36850        if (evaluatorOptions.ignoreErrors) {
36851          warn(`buildFontPaths - ignoring ${glyphName} glyph: "${reason}".`);
36852          return;
36853        }
36854        throw reason;
36855      }
36856    }
36857    for (const glyph of glyphs) {
36858      buildPath(glyph.fontChar);
36859      const accent = glyph.accent;
36860      if (accent?.fontChar) {
36861        buildPath(accent.fontChar);
36862      }
36863    }
36864  }
36865  static get fallbackFontDict() {
36866    const dict = new Dict();
36867    dict.set("BaseFont", Name.get("Helvetica"));
36868    dict.set("Type", Name.get("FallbackType"));
36869    dict.set("Subtype", Name.get("FallbackType"));
36870    dict.set("Encoding", Name.get("WinAnsiEncoding"));
36871    return shadow(this, "fallbackFontDict", dict);
36872  }
36873}
36874class TranslatedFont {
36875  #sent = false;
36876  #type3Loaded = null;
36877  constructor({
36878    loadedName,
36879    font,
36880    dict
36881  }) {
36882    this.loadedName = loadedName;
36883    this.font = font;
36884    this.dict = dict;
36885    this.type3Dependencies = font.isType3Font ? new Set() : null;
36886  }
36887  send(handler) {
36888    if (this.#sent) {
36889      return;
36890    }
36891    this.#sent = true;
36892    const fontData = this.font.exportData(),
36893      transfers = fontData.buffer ? [fontData.buffer] : null;
36894    handler.send("commonobj", [this.loadedName, "Font", fontData], transfers);
36895  }
36896  fallback(handler, evaluatorOptions) {
36897    if (!this.font.data) {
36898      return;
36899    }
36900    this.font.disableFontFace = true;
36901    PartialEvaluator.buildFontPaths(this.font, this.font.glyphCacheValues, handler, evaluatorOptions);
36902  }
36903  loadType3Data(evaluator, resources, task) {
36904    if (this.#type3Loaded) {
36905      return this.#type3Loaded;
36906    }
36907    const {
36908      font,
36909      type3Dependencies
36910    } = this;
36911    assert(font.isType3Font, "Must be a Type3 font.");
36912    const type3Evaluator = evaluator.clone({
36913      ignoreErrors: false
36914    });
36915    const type3FontRefs = new RefSet(evaluator.type3FontRefs);
36916    if (this.dict.objId && !type3FontRefs.has(this.dict.objId)) {
36917      type3FontRefs.put(this.dict.objId);
36918    }
36919    type3Evaluator.type3FontRefs = type3FontRefs;
36920    let loadCharProcsPromise = Promise.resolve();
36921    const charProcs = this.dict.get("CharProcs");
36922    const fontResources = this.dict.get("Resources") || resources;
36923    const charProcOperatorList = Object.create(null);
36924    const [x0, y0, x1, y1] = font.bbox,
36925      width = x1 - x0,
36926      height = y1 - y0;
36927    const fontBBoxSize = Math.hypot(width, height);
36928    for (const key of charProcs.getKeys()) {
36929      loadCharProcsPromise = loadCharProcsPromise.then(() => {
36930        const glyphStream = charProcs.get(key);
36931        const operatorList = new OperatorList();
36932        return type3Evaluator.getOperatorList({
36933          stream: glyphStream,
36934          task,
36935          resources: fontResources,
36936          operatorList
36937        }).then(() => {
36938          switch (operatorList.fnArray[0]) {
36939            case OPS.setCharWidthAndBounds:
36940              this.#removeType3ColorOperators(operatorList, fontBBoxSize);
36941              break;
36942            case OPS.setCharWidth:
36943              if (!fontBBoxSize) {
36944                this.#guessType3FontBBox(operatorList);
36945              }
36946              break;
36947          }
36948          charProcOperatorList[key] = operatorList.getIR();
36949          for (const dependency of operatorList.dependencies) {
36950            type3Dependencies.add(dependency);
36951          }
36952        }).catch(function (reason) {
36953          warn(`Type3 font resource "${key}" is not available.`);
36954          const dummyOperatorList = new OperatorList();
36955          charProcOperatorList[key] = dummyOperatorList.getIR();
36956        });
36957      });
36958    }
36959    this.#type3Loaded = loadCharProcsPromise.then(() => {
36960      font.charProcOperatorList = charProcOperatorList;
36961      if (this._bbox) {
36962        font.isCharBBox = true;
36963        font.bbox = this._bbox;
36964      }
36965    }
vendor: 15,527 bytes, lines 36965-37636
36965);
36966    return this.#type3Loaded;
36967  }
36968  #removeType3ColorOperators(operatorList, fontBBoxSize = NaN) {
36969    const charBBox = Util.normalizeRect(operatorList.argsArray[0].slice(2)),
36970      width = charBBox[2] - charBBox[0],
36971      height = charBBox[3] - charBBox[1];
36972    const charBBoxSize = Math.hypot(width, height);
36973    if (width === 0 || height === 0) {
36974      operatorList.fnArray.splice(0, 1);
36975      operatorList.argsArray.splice(0, 1);
36976    } else if (fontBBoxSize === 0 || Math.round(charBBoxSize / fontBBoxSize) >= 10) {
36977      this._bbox ??= BBOX_INIT.slice();
36978      Util.rectBoundingBox(...charBBox, this._bbox);
36979    }
36980    let i = 0,
36981      ii = operatorList.length;
36982    while (i < ii) {
36983      switch (operatorList.fnArray[i]) {
36984        case OPS.setCharWidthAndBounds:
36985          break;
36986        case OPS.setStrokeColorSpace:
36987        case OPS.setFillColorSpace:
36988        case OPS.setStrokeColor:
36989        case OPS.setStrokeColorN:
36990        case OPS.setFillColor:
36991        case OPS.setFillColorN:
36992        case OPS.setStrokeGray:
36993        case OPS.setFillGray:
36994        case OPS.setStrokeRGBColor:
36995        case OPS.setFillRGBColor:
36996        case OPS.setStrokeCMYKColor:
36997        case OPS.setFillCMYKColor:
36998        case OPS.shadingFill:
36999        case OPS.setRenderingIntent:
37000          operatorList.fnArray.splice(i, 1);
37001          operatorList.argsArray.splice(i, 1);
37002          ii--;
37003          continue;
37004        case OPS.setGState:
37005          const [gStateObj] = operatorList.argsArray[i];
37006          let j = 0,
37007            jj = gStateObj.length;
37008          while (j < jj) {
37009            const [gStateKey] = gStateObj[j];
37010            switch (gStateKey) {
37011              case "TR":
37012              case "TR2":
37013              case "HT":
37014              case "BG":
37015              case "BG2":
37016              case "UCR":
37017              case "UCR2":
37018                gStateObj.splice(j, 1);
37019                jj--;
37020                continue;
37021            }
37022            j++;
37023          }
37024          break;
37025      }
37026      i++;
37027    }
37028  }
37029  #guessType3FontBBox(operatorList) {
37030    let i = 1;
37031    const ii = operatorList.length;
37032    while (i < ii) {
37033      switch (operatorList.fnArray[i]) {
37034        case OPS.constructPath:
37035          const minMax = operatorList.argsArray[i][2];
37036          this._bbox ??= BBOX_INIT.slice();
37037          Util.rectBoundingBox(...minMax, this._bbox);
37038          break;
37039      }
37040      i++;
37041    }
37042  }
37043}
37044class StateManager {
37045  constructor(initialState = new EvalState()) {
37046    this.state = initialState;
37047    this.stateStack = [];
37048  }
37049  save() {
37050    const old = this.state;
37051    this.stateStack.push(this.state);
37052    this.state = old.clone();
37053  }
37054  restore() {
37055    const prev = this.stateStack.pop();
37056    if (prev) {
37057      this.state = prev;
37058    }
37059  }
37060  transform(args) {
37061    this.state.ctm = Util.transform(this.state.ctm, args);
37062  }
37063}
37064class TextState {
37065  ctm = new Float32Array(IDENTITY_MATRIX);
37066  fontName = null;
37067  fontSize = 0;
37068  loadedName = null;
37069  font = null;
37070  fontMatrix = FONT_IDENTITY_MATRIX;
37071  textMatrix = IDENTITY_MATRIX.slice();
37072  textLineMatrix = IDENTITY_MATRIX.slice();
37073  charSpacing = 0;
37074  wordSpacing = 0;
37075  leading = 0;
37076  textHScale = 1;
37077  textRise = 0;
37078  setTextMatrix(a, b, c, d, e, f) {
37079    const m = this.textMatrix;
37080    m[0] = a;
37081    m[1] = b;
37082    m[2] = c;
37083    m[3] = d;
37084    m[4] = e;
37085    m[5] = f;
37086  }
37087  setTextLineMatrix(a, b, c, d, e, f) {
37088    const m = this.textLineMatrix;
37089    m[0] = a;
37090    m[1] = b;
37091    m[2] = c;
37092    m[3] = d;
37093    m[4] = e;
37094    m[5] = f;
37095  }
37096  translateTextMatrix(x, y) {
37097    const m = this.textMatrix;
37098    m[4] = m[0] * x + m[2] * y + m[4];
37099    m[5] = m[1] * x + m[3] * y + m[5];
37100  }
37101  translateTextLineMatrix(x, y) {
37102    const m = this.textLineMatrix;
37103    m[4] = m[0] * x + m[2] * y + m[4];
37104    m[5] = m[1] * x + m[3] * y + m[5];
37105  }
37106  carriageReturn() {
37107    this.translateTextLineMatrix(0, -this.leading);
37108    this.textMatrix = this.textLineMatrix.slice();
37109  }
37110  clone() {
37111    const clone = Object.assign(Object.create(this), this);
37112    clone.textMatrix = this.textMatrix.slice();
37113    clone.textLineMatrix = this.textLineMatrix.slice();
37114    clone.fontMatrix = this.fontMatrix.slice();
37115    return clone;
37116  }
37117}
37118class EvalState {
37119  ctm = new Float32Array(IDENTITY_MATRIX);
37120  font = null;
37121  textRenderingMode = TextRenderingMode.FILL;
37122  _fillColorSpace = ColorSpaceUtils.gray;
37123  _strokeColorSpace = ColorSpaceUtils.gray;
37124  patternFillColorSpace = null;
37125  patternStrokeColorSpace = null;
37126  currentPointX = 0;
37127  currentPointY = 0;
37128  pathMinMax = F32_BBOX_INIT.slice();
37129  pathBuffer = [];
37130  get fillColorSpace() {
37131    return this._fillColorSpace;
37132  }
37133  set fillColorSpace(colorSpace) {
37134    this._fillColorSpace = this.patternFillColorSpace = colorSpace;
37135  }
37136  get strokeColorSpace() {
37137    return this._strokeColorSpace;
37138  }
37139  set strokeColorSpace(colorSpace) {
37140    this._strokeColorSpace = this.patternStrokeColorSpace = colorSpace;
37141  }
37142  clone({
37143    newPath = false
37144  } = {}) {
37145    const clone = Object.create(this);
37146    if (newPath) {
37147      clone.pathBuffer = [];
37148      clone.pathMinMax = F32_BBOX_INIT.slice();
37149    }
37150    return clone;
37151  }
37152}
37153class EvaluatorPreprocessor {
37154  static get opMap() {
37155    return shadow(this, "opMap", Object.assign(Object.create(null), {
37156      w: {
37157        id: OPS.setLineWidth,
37158        numArgs: 1,
37159        variableArgs: false
37160      },
37161      J: {
37162        id: OPS.setLineCap,
37163        numArgs: 1,
37164        variableArgs: false
37165      },
37166      j: {
37167        id: OPS.setLineJoin,
37168        numArgs: 1,
37169        variableArgs: false
37170      },
37171      M: {
37172        id: OPS.setMiterLimit,
37173        numArgs: 1,
37174        variableArgs: false
37175      },
37176      d: {
37177        id: OPS.setDash,
37178        numArgs: 2,
37179        variableArgs: false
37180      },
37181      ri: {
37182        id: OPS.setRenderingIntent,
37183        numArgs: 1,
37184        variableArgs: false
37185      },
37186      i: {
37187        id: OPS.setFlatness,
37188        numArgs: 1,
37189        variableArgs: false
37190      },
37191      gs: {
37192        id: OPS.setGState,
37193        numArgs: 1,
37194        variableArgs: false
37195      },
37196      q: {
37197        id: OPS.save,
37198        numArgs: 0,
37199        variableArgs: false
37200      },
37201      Q: {
37202        id: OPS.restore,
37203        numArgs: 0,
37204        variableArgs: false
37205      },
37206      cm: {
37207        id: OPS.transform,
37208        numArgs: 6,
37209        variableArgs: false
37210      },
37211      m: {
37212        id: OPS.moveTo,
37213        numArgs: 2,
37214        variableArgs: false
37215      },
37216      l: {
37217        id: OPS.lineTo,
37218        numArgs: 2,
37219        variableArgs: false
37220      },
37221      c: {
37222        id: OPS.curveTo,
37223        numArgs: 6,
37224        variableArgs: false
37225      },
37226      v: {
37227        id: OPS.curveTo2,
37228        numArgs: 4,
37229        variableArgs: false
37230      },
37231      y: {
37232        id: OPS.curveTo3,
37233        numArgs: 4,
37234        variableArgs: false
37235      },
37236      h: {
37237        id: OPS.closePath,
37238        numArgs: 0,
37239        variableArgs: false
37240      },
37241      re: {
37242        id: OPS.rectangle,
37243        numArgs: 4,
37244        variableArgs: false
37245      },
37246      S: {
37247        id: OPS.stroke,
37248        numArgs: 0,
37249        variableArgs: false
37250      },
37251      s: {
37252        id: OPS.closeStroke,
37253        numArgs: 0,
37254        variableArgs: false
37255      },
37256      f: {
37257        id: OPS.fill,
37258        numArgs: 0,
37259        variableArgs: false
37260      },
37261      F: {
37262        id: OPS.fill,
37263        numArgs: 0,
37264        variableArgs: false
37265      },
37266      "f*": {
37267        id: OPS.eoFill,
37268        numArgs: 0,
37269        variableArgs: false
37270      },
37271      B: {
37272        id: OPS.fillStroke,
37273        numArgs: 0,
37274        variableArgs: false
37275      },
37276      "B*": {
37277        id: OPS.eoFillStroke,
37278        numArgs: 0,
37279        variableArgs: false
37280      },
37281      b: {
37282        id: OPS.closeFillStroke,
37283        numArgs: 0,
37284        variableArgs: false
37285      },
37286      "b*": {
37287        id: OPS.closeEOFillStroke,
37288        numArgs: 0,
37289        variableArgs: false
37290      },
37291      n: {
37292        id: OPS.endPath,
37293        numArgs: 0,
37294        variableArgs: false
37295      },
37296      W: {
37297        id: OPS.clip,
37298        numArgs: 0,
37299        variableArgs: false
37300      },
37301      "W*": {
37302        id: OPS.eoClip,
37303        numArgs: 0,
37304        variableArgs: false
37305      },
37306      BT: {
37307        id: OPS.beginText,
37308        numArgs: 0,
37309        variableArgs: false
37310      },
37311      ET: {
37312        id: OPS.endText,
37313        numArgs: 0,
37314        variableArgs: false
37315      },
37316      Tc: {
37317        id: OPS.setCharSpacing,
37318        numArgs: 1,
37319        variableArgs: false
37320      },
37321      Tw: {
37322        id: OPS.setWordSpacing,
37323        numArgs: 1,
37324        variableArgs: false
37325      },
37326      Tz: {
37327        id: OPS.setHScale,
37328        numArgs: 1,
37329        variableArgs: false
37330      },
37331      TL: {
37332        id: OPS.setLeading,
37333        numArgs: 1,
37334        variableArgs: false
37335      },
37336      Tf: {
37337        id: OPS.setFont,
37338        numArgs: 2,
37339        variableArgs: false
37340      },
37341      Tr: {
37342        id: OPS.setTextRenderingMode,
37343        numArgs: 1,
37344        variableArgs: false
37345      },
37346      Ts: {
37347        id: OPS.setTextRise,
37348        numArgs: 1,
37349        variableArgs: false
37350      },
37351      Td: {
37352        id: OPS.moveText,
37353        numArgs: 2,
37354        variableArgs: false
37355      },
37356      TD: {
37357        id: OPS.setLeadingMoveText,
37358        numArgs: 2,
37359        variableArgs: false
37360      },
37361      Tm: {
37362        id: OPS.setTextMatrix,
37363        numArgs: 6,
37364        variableArgs: false
37365      },
37366      "T*": {
37367        id: OPS.nextLine,
37368        numArgs: 0,
37369        variableArgs: false
37370      },
37371      Tj: {
37372        id: OPS.showText,
37373        numArgs: 1,
37374        variableArgs: false
37375      },
37376      TJ: {
37377        id: OPS.showSpacedText,
37378        numArgs: 1,
37379        variableArgs: false
37380      },
37381      "'": {
37382        id: OPS.nextLineShowText,
37383        numArgs: 1,
37384        variableArgs: false
37385      },
37386      '"': {
37387        id: OPS.nextLineSetSpacingShowText,
37388        numArgs: 3,
37389        variableArgs: false
37390      },
37391      d0: {
37392        id: OPS.setCharWidth,
37393        numArgs: 2,
37394        variableArgs: false
37395      },
37396      d1: {
37397        id: OPS.setCharWidthAndBounds,
37398        numArgs: 6,
37399        variableArgs: false
37400      },
37401      CS: {
37402        id: OPS.setStrokeColorSpace,
37403        numArgs: 1,
37404        variableArgs: false
37405      },
37406      cs: {
37407        id: OPS.setFillColorSpace,
37408        numArgs: 1,
37409        variableArgs: false
37410      },
37411      SC: {
37412        id: OPS.setStrokeColor,
37413        numArgs: 4,
37414        variableArgs: true
37415      },
37416      SCN: {
37417        id: OPS.setStrokeColorN,
37418        numArgs: 33,
37419        variableArgs: true
37420      },
37421      sc: {
37422        id: OPS.setFillColor,
37423        numArgs: 4,
37424        variableArgs: true
37425      },
37426      scn: {
37427        id: OPS.setFillColorN,
37428        numArgs: 33,
37429        variableArgs: true
37430      },
37431      G: {
37432        id: OPS.setStrokeGray,
37433        numArgs: 1,
37434        variableArgs: false
37435      },
37436      g: {
37437        id: OPS.setFillGray,
37438        numArgs: 1,
37439        variableArgs: false
37440      },
37441      RG: {
37442        id: OPS.setStrokeRGBColor,
37443        numArgs: 3,
37444        variableArgs: false
37445      },
37446      rg: {
37447        id: OPS.setFillRGBColor,
37448        numArgs: 3,
37449        variableArgs: false
37450      },
37451      K: {
37452        id: OPS.setStrokeCMYKColor,
37453        numArgs: 4,
37454        variableArgs: false
37455      },
37456      k: {
37457        id: OPS.setFillCMYKColor,
37458        numArgs: 4,
37459        variableArgs: false
37460      },
37461      sh: {
37462        id: OPS.shadingFill,
37463        numArgs: 1,
37464        variableArgs: false
37465      },
37466      BI: {
37467        id: OPS.beginInlineImage,
37468        numArgs: 0,
37469        variableArgs: false
37470      },
37471      ID: {
37472        id: OPS.beginImageData,
37473        numArgs: 0,
37474        variableArgs: false
37475      },
37476      EI: {
37477        id: OPS.endInlineImage,
37478        numArgs: 1,
37479        variableArgs: false
37480      },
37481      Do: {
37482        id: OPS.paintXObject,
37483        numArgs: 1,
37484        variableArgs: false
37485      },
37486      MP: {
37487        id: OPS.markPoint,
37488        numArgs: 1,
37489        variableArgs: false
37490      },
37491      DP: {
37492        id: OPS.markPointProps,
37493        numArgs: 2,
37494        variableArgs: false
37495      },
37496      BMC: {
37497        id: OPS.beginMarkedContent,
37498        numArgs: 1,
37499        variableArgs: false
37500      },
37501      BDC: {
37502        id: OPS.beginMarkedContentProps,
37503        numArgs: 2,
37504        variableArgs: false
37505      },
37506      EMC: {
37507        id: OPS.endMarkedContent,
37508        numArgs: 0,
37509        variableArgs: false
37510      },
37511      BX: {
37512        id: OPS.beginCompat,
37513        numArgs: 0,
37514        variableArgs: false
37515      },
37516      EX: {
37517        id: OPS.endCompat,
37518        numArgs: 0,
37519        variableArgs: false
37520      },
37521      BM: null,
37522      BD: null,
37523      true: null,
37524      fa: null,
37525      fal: null,
37526      fals: null,
37527      false: null,
37528      nu: null,
37529      nul: null,
37530      null: null
37531    }));
37532  }
37533  static MAX_INVALID_PATH_OPS = 10;
37534  constructor(stream, xref, stateManager = new StateManager()) {
37535    this.parser = new Parser({
37536      lexer: new Lexer(stream, EvaluatorPreprocessor.opMap),
37537      xref
37538    });
37539    this.stateManager = stateManager;
37540    this.nonProcessedArgs = [];
37541    this._isPathOp = false;
37542    this._numInvalidPathOPS = 0;
37543  }
37544  get savedStatesDepth() {
37545    return this.stateManager.stateStack.length;
37546  }
37547  read(operation) {
37548    let args = operation.args;
37549    while (true) {
37550      const obj = this.parser.getObj();
37551      if (obj instanceof Cmd) {
37552        const cmd = obj.cmd;
37553        const opSpec = EvaluatorPreprocessor.opMap[cmd];
37554        if (!opSpec) {
37555          warn(`Unknown command "${cmd}".`);
37556          continue;
37557        }
37558        const fn = opSpec.id;
37559        const numArgs = opSpec.numArgs;
37560        let argsLength = args !== null ? args.length : 0;
37561        if (!this._isPathOp) {
37562          this._numInvalidPathOPS = 0;
37563        }
37564        this._isPathOp = fn >= OPS.moveTo && fn <= OPS.endPath;
37565        if (!opSpec.variableArgs) {
37566          if (argsLength !== numArgs) {
37567            const nonProcessedArgs = this.nonProcessedArgs;
37568            while (argsLength > numArgs) {
37569              nonProcessedArgs.push(args.shift());
37570              argsLength--;
37571            }
37572            while (argsLength < numArgs && nonProcessedArgs.length !== 0) {
37573              if (args === null) {
37574                args = [];
37575              }
37576              args.unshift(nonProcessedArgs.pop());
37577              argsLength++;
37578            }
37579          }
37580          if (argsLength < numArgs) {
37581            const partialMsg = `command ${cmd}: expected ${numArgs} args, ` + `but received ${argsLength} args.`;
37582            if (this._isPathOp && ++this._numInvalidPathOPS > EvaluatorPreprocessor.MAX_INVALID_PATH_OPS) {
37583              throw new FormatError(`Invalid ${partialMsg}`);
37584            }
37585            warn(`Skipping ${partialMsg}`);
37586            if (args !== null) {
37587              args.length = 0;
37588            }
37589            continue;
37590          }
37591        } else if (argsLength > numArgs) {
37592          info(`Command ${cmd}: expected [0, ${numArgs}] args, ` + `but received ${argsLength} args.`);
37593        }
37594        this.preprocessCommand(fn, args);
37595        operation.fn = fn;
37596        operation.args = args;
37597        return true;
37598      }
37599      if (obj === EOF) {
37600        return false;
37601      }
37602      if (obj !== null) {
37603        if (args === null) {
37604          args = [];
37605        }
37606        args.push(obj);
37607        if (args.length > 33) {
37608          throw new FormatError("Too many arguments");
37609        }
37610      }
37611    }
37612  }
37613  preprocessCommand(fn, args) {
37614    switch (fn | 0) {
37615      case OPS.save:
37616        this.stateManager.save();
37617        break;
37618      case OPS.restore:
37619        this.stateManager.restore();
37620        break;
37621      case OPS.transform:
37622        this.stateManager.transform(args);
37623        break;
37624    }
37625  }
37626}
37627
37628;// ./src/core/default_appearance.js
37629
37630
37631
37632
37633
37634
37635
37636
vendor: 7,137 bytes, lines 37637-37855
37637class DefaultAppearanceEvaluator extends EvaluatorPreprocessor {
37638  constructor(str) {
37639    super(new StringStream(str));
37640  }
37641  parse() {
37642    const operation = {
37643      fn: 0,
37644      args: []
37645    };
37646    const result = {
37647      fontSize: 0,
37648      fontName: "",
37649      fontColor: new Uint8ClampedArray(3)
37650    };
37651    try {
37652      while (true) {
37653        operation.args.length = 0;
37654        if (!this.read(operation)) {
37655          break;
37656        }
37657        if (this.savedStatesDepth !== 0) {
37658          continue;
37659        }
37660        const {
37661          fn,
37662          args
37663        } = operation;
37664        switch (fn | 0) {
37665          case OPS.setFont:
37666            const [fontName, fontSize] = args;
37667            if (fontName instanceof Name) {
37668              result.fontName = fontName.name;
37669            }
37670            if (typeof fontSize === "number" && fontSize > 0) {
37671              result.fontSize = fontSize;
37672            }
37673            break;
37674          case OPS.setFillRGBColor:
37675            ColorSpaceUtils.rgb.getRgbItem(args, 0, result.fontColor, 0);
37676            break;
37677          case OPS.setFillGray:
37678            ColorSpaceUtils.gray.getRgbItem(args, 0, result.fontColor, 0);
37679            break;
37680          case OPS.setFillCMYKColor:
37681            ColorSpaceUtils.cmyk.getRgbItem(args, 0, result.fontColor, 0);
37682            break;
37683        }
37684      }
37685    } catch (reason) {
37686      warn(`parseDefaultAppearance - ignoring errors: "${reason}".`);
37687    }
37688    return result;
37689  }
37690}
37691function parseDefaultAppearance(str) {
37692  return new DefaultAppearanceEvaluator(str).parse();
37693}
37694class AppearanceStreamEvaluator extends EvaluatorPreprocessor {
37695  constructor(stream, xref, globalColorSpaceCache) {
37696    super(stream);
37697    this.stream = stream;
37698    this.xref = xref;
37699    this.globalColorSpaceCache = globalColorSpaceCache;
37700    this.resources = stream.dict?.get("Resources");
37701  }
37702  parse() {
37703    const operation = {
37704      fn: 0,
37705      args: []
37706    };
37707    let result = {
37708      scaleFactor: 1,
37709      fontSize: 0,
37710      fontName: "",
37711      fontColor: new Uint8ClampedArray(3),
37712      fillColorSpace: ColorSpaceUtils.gray
37713    };
37714    let breakLoop = false;
37715    const stack = [];
37716    try {
37717      while (true) {
37718        operation.args.length = 0;
37719        if (breakLoop || !this.read(operation)) {
37720          break;
37721        }
37722        const {
37723          fn,
37724          args
37725        } = operation;
37726        switch (fn | 0) {
37727          case OPS.save:
37728            stack.push({
37729              scaleFactor: result.scaleFactor,
37730              fontSize: result.fontSize,
37731              fontName: result.fontName,
37732              fontColor: result.fontColor.slice(),
37733              fillColorSpace: result.fillColorSpace
37734            });
37735            break;
37736          case OPS.restore:
37737            result = stack.pop() || result;
37738            break;
37739          case OPS.setTextMatrix:
37740            result.scaleFactor *= Math.hypot(args[0], args[1]);
37741            break;
37742          case OPS.setFont:
37743            const [fontName, fontSize] = args;
37744            if (fontName instanceof Name) {
37745              result.fontName = fontName.name;
37746            }
37747            if (typeof fontSize === "number" && fontSize > 0) {
37748              result.fontSize = fontSize * result.scaleFactor;
37749            }
37750            break;
37751          case OPS.setFillColorSpace:
37752            result.fillColorSpace = ColorSpaceUtils.parse({
37753              cs: args[0],
37754              xref: this.xref,
37755              resources: this.resources,
37756              pdfFunctionFactory: this._pdfFunctionFactory,
37757              globalColorSpaceCache: this.globalColorSpaceCache,
37758              localColorSpaceCache: this._localColorSpaceCache
37759            });
37760            break;
37761          case OPS.setFillColor:
37762            const cs = result.fillColorSpace;
37763            cs.getRgbItem(args, 0, result.fontColor, 0);
37764            break;
37765          case OPS.setFillRGBColor:
37766            ColorSpaceUtils.rgb.getRgbItem(args, 0, result.fontColor, 0);
37767            break;
37768          case OPS.setFillGray:
37769            ColorSpaceUtils.gray.getRgbItem(args, 0, result.fontColor, 0);
37770            break;
37771          case OPS.setFillCMYKColor:
37772            ColorSpaceUtils.cmyk.getRgbItem(args, 0, result.fontColor, 0);
37773            break;
37774          case OPS.showText:
37775          case OPS.showSpacedText:
37776          case OPS.nextLineShowText:
37777          case OPS.nextLineSetSpacingShowText:
37778            breakLoop = true;
37779            break;
37780        }
37781      }
37782    } catch (reason) {
37783      warn(`parseAppearanceStream - ignoring errors: "${reason}".`);
37784    }
37785    this.stream.reset();
37786    delete result.scaleFactor;
37787    delete result.fillColorSpace;
37788    return result;
37789  }
37790  get _localColorSpaceCache() {
37791    return shadow(this, "_localColorSpaceCache", new LocalColorSpaceCache());
37792  }
37793  get _pdfFunctionFactory() {
37794    return shadow(this, "_pdfFunctionFactory", new PDFFunctionFactory({
37795      xref: this.xref
37796    }));
37797  }
37798}
37799function parseAppearanceStream(stream, xref, globalColorSpaceCache) {
37800  return new AppearanceStreamEvaluator(stream, xref, globalColorSpaceCache).parse();
37801}
37802function getPdfColor(color, isFill) {
37803  if (color[0] === color[1] && color[1] === color[2]) {
37804    const gray = color[0] / 255;
37805    return `${numberToString(gray)} ${isFill ? "g" : "G"}`;
37806  }
37807  return Array.from(color, c => numberToString(c / 255)).join(" ") + ` ${isFill ? "rg" : "RG"}`;
37808}
37809function createDefaultAppearance({
37810  fontSize,
37811  fontName,
37812  fontColor
37813}) {
37814  return `/${escapePDFName(fontName)} ${fontSize} Tf ${getPdfColor(fontColor, true)}`;
37815}
37816class FakeUnicodeFont {
37817  static #fontNameId = 1;
37818  constructor(xref, fontFamily) {
37819    this.xref = xref;
37820    this.widths = null;
37821    this.firstChar = Infinity;
37822    this.lastChar = -Infinity;
37823    this.fontFamily = fontFamily;
37824    const canvas = new OffscreenCanvas(1, 1);
37825    this.ctxMeasure = canvas.getContext("2d", {
37826      willReadFrequently: true
37827    });
37828    this.fontName = Name.get(`InvalidPDFjsFont_${fontFamily}_${FakeUnicodeFont.#fontNameId++}`);
37829  }
37830  get fontDescriptorRef() {
37831    if (!FakeUnicodeFont._fontDescriptorRef) {
37832      const fontDescriptor = new Dict(this.xref);
37833      fontDescriptor.setIfName("Type", "FontDescriptor");
37834      fontDescriptor.set("FontName", this.fontName);
37835      fontDescriptor.set("FontFamily", "MyriadPro Regular");
37836      fontDescriptor.set("FontBBox", [0, 0, 0, 0]);
37837      fontDescriptor.setIfName("FontStretch", "Normal");
37838      fontDescriptor.set("FontWeight", 400);
37839      fontDescriptor.set("ItalicAngle", 0);
37840      FakeUnicodeFont._fontDescriptorRef = this.xref.getNewPersistentRef(fontDescriptor);
37841    }
37842    return FakeUnicodeFont._fontDescriptorRef;
37843  }
37844  get descendantFontRef() {
37845    const descendantFont = new Dict(this.xref);
37846    descendantFont.set("BaseFont", this.fontName);
37847    descendantFont.setIfName("Type", "Font");
37848    descendantFont.setIfName("Subtype", "CIDFontType0");
37849    descendantFont.setIfName("CIDToGIDMap", "Identity");
37850    descendantFont.set("FirstChar", this.firstChar);
37851    descendantFont.set("LastChar", this.lastChar);
37852    descendantFont.set("FontDescriptor", this.fontDescriptorRef);
37853    descendantFont.set("DW", 1000);
37854    const widths = [];
37855    const chars = [...this.widths
vendor: 5,572 bytes, lines 37855-38014
37855].sort();
37856    let currentChar = null;
37857    let currentWidths = null;
37858    for (const [char, width] of chars) {
37859      if (!currentChar) {
37860        currentChar = char;
37861        currentWidths = [width];
37862        continue;
37863      }
37864      if (char === currentChar + currentWidths.length) {
37865        currentWidths.push(width);
37866      } else {
37867        widths.push(currentChar, currentWidths);
37868        currentChar = char;
37869        currentWidths = [width];
37870      }
37871    }
37872    if (currentChar) {
37873      widths.push(currentChar, currentWidths);
37874    }
37875    descendantFont.set("W", widths);
37876    const cidSystemInfo = new Dict(this.xref);
37877    cidSystemInfo.set("Ordering", "Identity");
37878    cidSystemInfo.set("Registry", "Adobe");
37879    cidSystemInfo.set("Supplement", 0);
37880    descendantFont.set("CIDSystemInfo", cidSystemInfo);
37881    return this.xref.getNewPersistentRef(descendantFont);
37882  }
37883  get baseFontRef() {
37884    const baseFont = new Dict(this.xref);
37885    baseFont.set("BaseFont", this.fontName);
37886    baseFont.setIfName("Type", "Font");
37887    baseFont.setIfName("Subtype", "Type0");
37888    baseFont.setIfName("Encoding", "Identity-H");
37889    baseFont.set("DescendantFonts", [this.descendantFontRef]);
37890    baseFont.setIfName("ToUnicode", "Identity-H");
37891    return this.xref.getNewPersistentRef(baseFont);
37892  }
37893  get resources() {
37894    const resources = new Dict(this.xref);
37895    const font = new Dict(this.xref);
37896    font.set(this.fontName.name, this.baseFontRef);
37897    resources.set("Font", font);
37898    return resources;
37899  }
37900  _createContext() {
37901    this.widths = new Map();
37902    this.ctxMeasure.font = `1000px ${this.fontFamily}`;
37903    return this.ctxMeasure;
37904  }
37905  createFontResources(text) {
37906    const ctx = this._createContext();
37907    for (const line of text.split(/\r\n?|\n/)) {
37908      for (const char of line.split("")) {
37909        const code = char.charCodeAt(0);
37910        if (this.widths.has(code)) {
37911          continue;
37912        }
37913        const metrics = ctx.measureText(char);
37914        const width = Math.ceil(metrics.width);
37915        this.widths.set(code, width);
37916        this.firstChar = Math.min(code, this.firstChar);
37917        this.lastChar = Math.max(code, this.lastChar);
37918      }
37919    }
37920    return this.resources;
37921  }
37922  static getFirstPositionInfo(rect, rotation, fontSize) {
37923    const [x1, y1, x2, y2] = rect;
37924    let w = x2 - x1;
37925    let h = y2 - y1;
37926    if (rotation % 180 !== 0) {
37927      [w, h] = [h, w];
37928    }
37929    const lineHeight = LINE_FACTOR * fontSize;
37930    const lineDescent = LINE_DESCENT_FACTOR * fontSize;
37931    return {
37932      coords: [0, h + lineDescent - lineHeight],
37933      bbox: [0, 0, w, h],
37934      matrix: rotation !== 0 ? getRotationMatrix(rotation, h, lineHeight) : undefined
37935    };
37936  }
37937  createAppearance(text, rect, rotation, fontSize, bgColor, strokeAlpha) {
37938    const ctx = this._createContext();
37939    const lines = [];
37940    let maxWidth = -Infinity;
37941    for (const line of text.split(/\r\n?|\n/)) {
37942      lines.push(line);
37943      const lineWidth = ctx.measureText(line).width;
37944      maxWidth = Math.max(maxWidth, lineWidth);
37945      for (const code of codePointIter(line)) {
37946        const char = String.fromCodePoint(code);
37947        let width = this.widths.get(code);
37948        if (width === undefined) {
37949          const metrics = ctx.measureText(char);
37950          width = Math.ceil(metrics.width);
37951          this.widths.set(code, width);
37952          this.firstChar = Math.min(code, this.firstChar);
37953          this.lastChar = Math.max(code, this.lastChar);
37954        }
37955      }
37956    }
37957    maxWidth *= fontSize / 1000;
37958    const [x1, y1, x2, y2] = rect;
37959    let w = x2 - x1;
37960    let h = y2 - y1;
37961    if (rotation % 180 !== 0) {
37962      [w, h] = [h, w];
37963    }
37964    let hscale = 1;
37965    if (maxWidth > w) {
37966      hscale = w / maxWidth;
37967    }
37968    let vscale = 1;
37969    const lineHeight = LINE_FACTOR * fontSize;
37970    const lineDescent = LINE_DESCENT_FACTOR * fontSize;
37971    const maxHeight = lineHeight * lines.length;
37972    if (maxHeight > h) {
37973      vscale = h / maxHeight;
37974    }
37975    const fscale = Math.min(hscale, vscale);
37976    const newFontSize = fontSize * fscale;
37977    const buffer = ["q", `0 0 ${numberToString(w)} ${numberToString(h)} re W n`, `BT`, `1 0 0 1 0 ${numberToString(h + lineDescent)} Tm 0 Tc ${getPdfColor(bgColor, true)}`, `/${this.fontName.name} ${numberToString(newFontSize)} Tf`];
37978    const {
37979      resources
37980    } = this;
37981    strokeAlpha = typeof strokeAlpha === "number" && strokeAlpha >= 0 && strokeAlpha <= 1 ? strokeAlpha : 1;
37982    if (strokeAlpha !== 1) {
37983      buffer.push("/R0 gs");
37984      const extGState = new Dict(this.xref);
37985      const r0 = new Dict(this.xref);
37986      r0.set("ca", strokeAlpha);
37987      r0.set("CA", strokeAlpha);
37988      r0.setIfName("Type", "ExtGState");
37989      extGState.set("R0", r0);
37990      resources.set("ExtGState", extGState);
37991    }
37992    const vShift = numberToString(lineHeight);
37993    for (const line of lines) {
37994      buffer.push(`0 -${vShift} Td <${stringToUTF16HexString(line)}> Tj`);
37995    }
37996    buffer.push("ET", "Q");
37997    const appearance = buffer.join("\n");
37998    const appearanceStreamDict = new Dict(this.xref);
37999    appearanceStreamDict.setIfName("Subtype", "Form");
38000    appearanceStreamDict.setIfName("Type", "XObject");
38001    appearanceStreamDict.set("BBox", [0, 0, w, h]);
38002    appearanceStreamDict.set("Length", appearance.length);
38003    appearanceStreamDict.set("Resources", resources);
38004    if (rotation) {
38005      const matrix = getRotationMatrix(rotation, w, h);
38006      appearanceStreamDict.set("Matrix", matrix);
38007    }
38008    const ap = new StringStream(appearance);
38009    ap.dict = appearanceStreamDict;
38010    return ap;
38011  }
38012}
38013
38014;// ./src/shared/scripting_utils.js
vendor: 5,388 bytes, lines 38015-38227
38015/* unused harmony import specifier */ var scripting_utils_MathClamp;
38016
38017function makeColorComp(n) {
38018  return Math.floor(scripting_utils_MathClamp(n, 0, 1) * 255).toString(16).padStart(2, "0");
38019}
38020function scaleAndClamp(x) {
38021  return scripting_utils_MathClamp(x, 0, 1) * 255;
38022}
38023class ColorConverters {
38024  static CMYK_G([c, y, m, k]) {
38025    return ["G", 1 - Math.min(1, 0.3 * c + 0.59 * m + 0.11 * y + k)];
38026  }
38027  static G_CMYK([g]) {
38028    return ["CMYK", 0, 0, 0, 1 - g];
38029  }
38030  static G_RGB([g]) {
38031    return ["RGB", g, g, g];
38032  }
38033  static G_rgb([g]) {
38034    g = scaleAndClamp(g);
38035    return [g, g, g];
38036  }
38037  static G_HTML([g]) {
38038    const G = makeColorComp(g);
38039    return `#${G}${G}${G}`;
38040  }
38041  static RGB_G([r, g, b]) {
38042    return ["G", 0.3 * r + 0.59 * g + 0.11 * b];
38043  }
38044  static RGB_rgb(color) {
38045    return color.map(scaleAndClamp);
38046  }
38047  static RGB_HTML(color) {
38048    return `#${color.map(makeColorComp).join("")}`;
38049  }
38050  static T_HTML() {
38051    return "#00000000";
38052  }
38053  static T_rgb() {
38054    return [null];
38055  }
38056  static CMYK_RGB([c, y, m, k]) {
38057    return ["RGB", 1 - Math.min(1, c + k), 1 - Math.min(1, m + k), 1 - Math.min(1, y + k)];
38058  }
38059  static CMYK_rgb([c, y, m, k]) {
38060    return [scaleAndClamp(1 - Math.min(1, c + k)), scaleAndClamp(1 - Math.min(1, m + k)), scaleAndClamp(1 - Math.min(1, y + k))];
38061  }
38062  static CMYK_HTML(components) {
38063    const rgb = this.CMYK_RGB(components).slice(1);
38064    return this.RGB_HTML(rgb);
38065  }
38066  static RGB_CMYK([r, g, b]) {
38067    const c = 1 - r;
38068    const m = 1 - g;
38069    const y = 1 - b;
38070    const k = Math.min(c, m, y);
38071    return ["CMYK", c, m, y, k];
38072  }
38073}
38074const DateFormats = ["m/d", "m/d/yy", "mm/dd/yy", "mm/yy", "d-mmm", "d-mmm-yy", "dd-mmm-yy", "yy-mm-dd", "mmm-yy", "mmmm-yy", "mmm d, yyyy", "mmmm d, yyyy", "m/d/yy h:MM tt", "m/d/yy HH:MM"];
38075const TimeFormats = ["HH:MM", "h:MM tt", "HH:MM:ss", "h:MM:ss tt"];
38076
38077;// ./src/core/name_number_tree.js
38078
38079
38080class NameOrNumberTree {
38081  constructor(root, xref, type) {
38082    this.root = root;
38083    this.xref = xref;
38084    this._type = type;
38085  }
38086  getAll(isRaw = false) {
38087    const map = new Map();
38088    if (!this.root) {
38089      return map;
38090    }
38091    const xref = this.xref;
38092    const processed = new RefSet();
38093    if (this.root instanceof Ref) {
38094      processed.put(this.root);
38095    }
38096    const queue = [this.root];
38097    while (queue.length > 0) {
38098      const obj = xref.fetchIfRef(queue.shift());
38099      if (!(obj instanceof Dict)) {
38100        continue;
38101      }
38102      if (obj.has("Kids")) {
38103        const kids = obj.get("Kids");
38104        if (!Array.isArray(kids)) {
38105          continue;
38106        }
38107        for (const kid of kids) {
38108          if (kid instanceof Ref) {
38109            if (processed.has(kid)) {
38110              throw new FormatError(`Duplicate entry in "${this._type}" tree.`);
38111            }
38112            processed.put(kid);
38113          }
38114          queue.push(kid);
38115        }
38116        continue;
38117      }
38118      const entries = obj.get(this._type);
38119      if (!Array.isArray(entries)) {
38120        continue;
38121      }
38122      for (let i = 0, ii = entries.length; i < ii; i += 2) {
38123        map.set(xref.fetchIfRef(entries[i]), isRaw ? entries[i + 1] : xref.fetchIfRef(entries[i + 1]));
38124      }
38125    }
38126    return map;
38127  }
38128  getRaw(key) {
38129    if (!this.root) {
38130      return null;
38131    }
38132    const xref = this.xref;
38133    let kidsOrEntries = xref.fetchIfRef(this.root);
38134    let loopCount = 0;
38135    const MAX_LEVELS = 10;
38136    while (kidsOrEntries.has("Kids")) {
38137      if (++loopCount > MAX_LEVELS) {
38138        warn(`Search depth limit reached for "${this._type}" tree.`);
38139        return null;
38140      }
38141      const kids = kidsOrEntries.get("Kids");
38142      if (!Array.isArray(kids)) {
38143        return null;
38144      }
38145      let l = 0,
38146        r = kids.length - 1;
38147      while (l <= r) {
38148        const m = l + r >> 1;
38149        const kid = xref.fetchIfRef(kids[m]);
38150        const limits = kid.get("Limits");
38151        if (key < xref.fetchIfRef(limits[0])) {
38152          r = m - 1;
38153        } else if (key > xref.fetchIfRef(limits[1])) {
38154          l = m + 1;
38155        } else {
38156          kidsOrEntries = kid;
38157          break;
38158        }
38159      }
38160      if (l > r) {
38161        return null;
38162      }
38163    }
38164    const entries = kidsOrEntries.get(this._type);
38165    if (Array.isArray(entries)) {
38166      let l = 0,
38167        r = entries.length - 2;
38168      while (l <= r) {
38169        const tmp = l + r >> 1,
38170          m = tmp + (tmp & 1);
38171        const currentKey = xref.fetchIfRef(entries[m]);
38172        if (key < currentKey) {
38173          r = m - 2;
38174        } else if (key > currentKey) {
38175          l = m + 2;
38176        } else {
38177          return entries[m + 1];
38178        }
38179      }
38180    }
38181    return null;
38182  }
38183  get(key) {
38184    return this.xref.fetchIfRef(this.getRaw(key));
38185  }
38186}
38187class NameTree extends NameOrNumberTree {
38188  constructor(root, xref) {
38189    super(root, xref, "Names");
38190  }
38191}
38192class NumberTree extends NameOrNumberTree {
38193  constructor(root, xref) {
38194    super(root, xref, "Nums");
38195  }
38196}
38197
38198;// ./src/core/cleanup_helper.js
38199
38200
38201
38202
38203
38204function clearGlobalCaches() {
38205  clearPatternCaches();
38206  clearPrimitiveCaches();
38207  clearUnicodeCaches();
38208  JBig2CCITTFaxImage.cleanup();
38209  JpxImage.cleanup();
38210}
38211
38212;// ./src/core/file_spec.js
38213
38214
38215
38216function pickPlatformItem(dict) {
38217  if (dict instanceof Dict) {
38218    for (const key of ["UF", "F", "Unix", "Mac", "DOS"]) {
38219      if (dict.has(key)) {
38220        return dict.get(key);
38221      }
38222    }
38223  }
38224  return null;
38225}
38226class FileSpec {
38227  #contentAvailable = false;
38228  constructor(root, skipContent = false) {
38229    if (!(root instanceof Dict)) {
38230      return;
38231    }
38232    this.root = root;
38233    if (root.has("FS")) {
38234      this.fs = root.get("FS");
38235    }
38236    if (root.has("RF")) {
38237      warn("Related file specifications are not supported");
38238    }
38239    if (!skipContent) {
38240      if (root.has("EF")) {
38241        this.#contentAvailable = true;
38242      } else {
38243        warn("Non-embedded file specifications are not supported");
38244      }
38245    }
38246  }
38247  get filename() {
38248    const item = pickPlatformItem(this.root);
38249    if (item && typeof item === "string") {
38250      return stringToPDFString(item, true).replaceAll("\\\\", "\\").replaceAll("\\/", "/").replaceAll("\\", "/");
38251    }
38252    return "";
38253  }
38254  get content() {
38255    if (!this.#contentAvailable) {
38256      return null;
38257    }
38258    const ef = pickPlatformItem(this.root?.get("EF"));
38259    if (ef instanceof BaseStream) {
38260      return ef.getBytes();
38261    }
38262    warn("Embedded file specification points to non-existing/invalid content");
38263    return null;
38264  }
38265  get description() {
38266    const desc = this.root?.get("Desc");
38267    if (desc && typeof desc === "string") {
38268      return stringToPDFString(desc);
38269    }
38270    return "";
38271  }
38272  get serializable() {
38273    const {
38274      filename,
38275      content,
38276      description
38277    } = this;
38278    return {
38279      rawFilename: filename,
38280      filename: stripPath(filename) || "unnamed",
38281      content,
38282      description
38283    };
38284  }
38285}
38286
38287;// ./src/core/xml_parser.js
vendor: 11,669 bytes, lines 38287-38704
38287
38288
38289const XMLParserErrorCode = {
38290  NoError: 0,
38291  EndOfDocument: -1,
38292  UnterminatedCdat: -2,
38293  UnterminatedXmlDeclaration: -3,
38294  UnterminatedDoctypeDeclaration: -4,
38295  UnterminatedComment: -5,
38296  MalformedElement: -6,
38297  OutOfMemory: -7,
38298  UnterminatedAttributeValue: -8,
38299  UnterminatedElement: -9,
38300  ElementNeverBegun: -10
38301};
38302function isWhitespace(s, index) {
38303  const ch = s[index];
38304  return ch === " " || ch === "\n" || ch === "\r" || ch === "\t";
38305}
38306function isWhitespaceString(s) {
38307  for (let i = 0, ii = s.length; i < ii; i++) {
38308    if (!isWhitespace(s, i)) {
38309      return false;
38310    }
38311  }
38312  return true;
38313}
38314class XMLParserBase {
38315  _resolveEntities(s) {
38316    return s.replaceAll(/&([^;]+);/g, (all, entity) => {
38317      if (entity.substring(0, 2) === "#x") {
38318        return String.fromCodePoint(parseInt(entity.substring(2), 16));
38319      } else if (entity.substring(0, 1) === "#") {
38320        return String.fromCodePoint(parseInt(entity.substring(1), 10));
38321      }
38322      switch (entity) {
38323        case "lt":
38324          return "<";
38325        case "gt":
38326          return ">";
38327        case "amp":
38328          return "&";
38329        case "quot":
38330          return '"';
38331        case "apos":
38332          return "'";
38333      }
38334      return this.onResolveEntity(entity);
38335    });
38336  }
38337  _parseContent(s, start) {
38338    const attributes = [];
38339    let pos = start;
38340    function skipWs() {
38341      while (pos < s.length && isWhitespace(s, pos)) {
38342        ++pos;
38343      }
38344    }
38345    while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "/") {
38346      ++pos;
38347    }
38348    const name = s.substring(start, pos);
38349    skipWs();
38350    while (pos < s.length && s[pos] !== ">" && s[pos] !== "/" && s[pos] !== "?") {
38351      skipWs();
38352      let attrName = "",
38353        attrValue = "";
38354      while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== "=") {
38355        attrName += s[pos];
38356        ++pos;
38357      }
38358      skipWs();
38359      if (s[pos] !== "=") {
38360        return null;
38361      }
38362      ++pos;
38363      skipWs();
38364      const attrEndChar = s[pos];
38365      if (attrEndChar !== '"' && attrEndChar !== "'") {
38366        return null;
38367      }
38368      const attrEndIndex = s.indexOf(attrEndChar, ++pos);
38369      if (attrEndIndex < 0) {
38370        return null;
38371      }
38372      attrValue = s.substring(pos, attrEndIndex);
38373      attributes.push({
38374        name: attrName,
38375        value: this._resolveEntities(attrValue)
38376      });
38377      pos = attrEndIndex + 1;
38378      skipWs();
38379    }
38380    return {
38381      name,
38382      attributes,
38383      parsed: pos - start
38384    };
38385  }
38386  _parseProcessingInstruction(s, start) {
38387    let pos = start;
38388    function skipWs() {
38389      while (pos < s.length && isWhitespace(s, pos)) {
38390        ++pos;
38391      }
38392    }
38393    while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "?" && s[pos] !== "/") {
38394      ++pos;
38395    }
38396    const name = s.substring(start, pos);
38397    skipWs();
38398    const attrStart = pos;
38399    while (pos < s.length && (s[pos] !== "?" || s[pos + 1] !== ">")) {
38400      ++pos;
38401    }
38402    const value = s.substring(attrStart, pos);
38403    return {
38404      name,
38405      value,
38406      parsed: pos - start
38407    };
38408  }
38409  parseXml(s) {
38410    let i = 0;
38411    while (i < s.length) {
38412      const ch = s[i];
38413      let j = i;
38414      if (ch === "<") {
38415        ++j;
38416        const ch2 = s[j];
38417        let q;
38418        switch (ch2) {
38419          case "/":
38420            ++j;
38421            q = s.indexOf(">", j);
38422            if (q < 0) {
38423              this.onError(XMLParserErrorCode.UnterminatedElement);
38424              return;
38425            }
38426            this.onEndElement(s.substring(j, q));
38427            j = q + 1;
38428            break;
38429          case "?":
38430            ++j;
38431            const pi = this._parseProcessingInstruction(s, j);
38432            if (s.substring(j + pi.parsed, j + pi.parsed + 2) !== "?>") {
38433              this.onError(XMLParserErrorCode.UnterminatedXmlDeclaration);
38434              return;
38435            }
38436            this.onPi(pi.name, pi.value);
38437            j += pi.parsed + 2;
38438            break;
38439          case "!":
38440            if (s.substring(j + 1, j + 3) === "--") {
38441              q = s.indexOf("-->", j + 3);
38442              if (q < 0) {
38443                this.onError(XMLParserErrorCode.UnterminatedComment);
38444                return;
38445              }
38446              this.onComment(s.substring(j + 3, q));
38447              j = q + 3;
38448            } else if (s.substring(j + 1, j + 8) === "[CDATA[") {
38449              q = s.indexOf("]]>", j + 8);
38450              if (q < 0) {
38451                this.onError(XMLParserErrorCode.UnterminatedCdat);
38452                return;
38453              }
38454              this.onCdata(s.substring(j + 8, q));
38455              j = q + 3;
38456            } else if (s.substring(j + 1, j + 8) === "DOCTYPE") {
38457              const q2 = s.indexOf("[", j + 8);
38458              let complexDoctype = false;
38459              q = s.indexOf(">", j + 8);
38460              if (q < 0) {
38461                this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration);
38462                return;
38463              }
38464              if (q2 > 0 && q > q2) {
38465                q = s.indexOf("]>", j + 8);
38466                if (q < 0) {
38467                  this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration);
38468                  return;
38469                }
38470                complexDoctype = true;
38471              }
38472              const doctypeContent = s.substring(j + 8, q + (complexDoctype ? 1 : 0));
38473              this.onDoctype(doctypeContent);
38474              j = q + (complexDoctype ? 2 : 1);
38475            } else {
38476              this.onError(XMLParserErrorCode.MalformedElement);
38477              return;
38478            }
38479            break;
38480          default:
38481            const content = this._parseContent(s, j);
38482            if (content === null) {
38483              this.onError(XMLParserErrorCode.MalformedElement);
38484              return;
38485            }
38486            let isClosed = false;
38487            if (s.substring(j + content.parsed, j + content.parsed + 2) === "/>") {
38488              isClosed = true;
38489            } else if (s.substring(j + content.parsed, j + content.parsed + 1) !== ">") {
38490              this.onError(XMLParserErrorCode.UnterminatedElement);
38491              return;
38492            }
38493            this.onBeginElement(content.name, content.attributes, isClosed);
38494            j += content.parsed + (isClosed ? 2 : 1);
38495            break;
38496        }
38497      } else {
38498        while (j < s.length && s[j] !== "<") {
38499          j++;
38500        }
38501        const text = s.substring(i, j);
38502        this.onText(this._resolveEntities(text));
38503      }
38504      i = j;
38505    }
38506  }
38507  onResolveEntity(name) {
38508    return `&${name};`;
38509  }
38510  onPi(name, value) {}
38511  onComment(text) {}
38512  onCdata(text) {}
38513  onDoctype(doctypeContent) {}
38514  onText(text) {}
38515  onBeginElement(name, attributes, isEmpty) {}
38516  onEndElement(name) {}
38517  onError(code) {}
38518}
38519class SimpleDOMNode {
38520  constructor(nodeName, nodeValue) {
38521    this.nodeName = nodeName;
38522    this.nodeValue = nodeValue;
38523    Object.defineProperty(this, "parentNode", {
38524      value: null,
38525      writable: true
38526    });
38527  }
38528  get firstChild() {
38529    return this.childNodes?.[0];
38530  }
38531  get nextSibling() {
38532    const childNodes = this.parentNode.childNodes;
38533    if (!childNodes) {
38534      return undefined;
38535    }
38536    const index = childNodes.indexOf(this);
38537    if (index === -1) {
38538      return undefined;
38539    }
38540    return childNodes[index + 1];
38541  }
38542  get textContent() {
38543    if (!this.childNodes) {
38544      return this.nodeValue || "";
38545    }
38546    return this.childNodes.map(child => child.textContent).join("");
38547  }
38548  get children() {
38549    return this.childNodes || [];
38550  }
38551  hasChildNodes() {
38552    return this.childNodes?.length > 0;
38553  }
38554  searchNode(paths, pos) {
38555    if (pos >= paths.length) {
38556      return this;
38557    }
38558    const component = paths[pos];
38559    if (component.name.startsWith("#") && pos < paths.length - 1) {
38560      return this.searchNode(paths, pos + 1);
38561    }
38562    const stack = [];
38563    let node = this;
38564    while (true) {
38565      if (component.name === node.nodeName) {
38566        if (component.pos === 0) {
38567          const res = node.searchNode(paths, pos + 1);
38568          if (res !== null) {
38569            return res;
38570          }
38571        } else if (stack.length === 0) {
38572          return null;
38573        } else {
38574          const [parent] = stack.pop();
38575          let siblingPos = 0;
38576          for (const child of parent.childNodes) {
38577            if (component.name === child.nodeName) {
38578              if (siblingPos === component.pos) {
38579                return child.searchNode(paths, pos + 1);
38580              }
38581              siblingPos++;
38582            }
38583          }
38584          return node.searchNode(paths, pos + 1);
38585        }
38586      }
38587      if (node.childNodes?.length > 0) {
38588        stack.push([node, 0]);
38589        node = node.childNodes[0];
38590      } else if (stack.length === 0) {
38591        return null;
38592      } else {
38593        while (stack.length !== 0) {
38594          const [parent, currentPos] = stack.pop();
38595          const newPos = currentPos + 1;
38596          if (newPos < parent.childNodes.length) {
38597            stack.push([parent, newPos]);
38598            node = parent.childNodes[newPos];
38599            break;
38600          }
38601        }
38602        if (stack.length === 0) {
38603          return null;
38604        }
38605      }
38606    }
38607  }
38608  dump(buffer) {
38609    if (this.nodeName === "#text") {
38610      buffer.push(encodeToXmlString(this.nodeValue));
38611      return;
38612    }
38613    buffer.push(`<${this.nodeName}`);
38614    if (this.attributes) {
38615      for (const attribute of this.attributes) {
38616        buffer.push(` ${attribute.name}="${encodeToXmlString(attribute.value)}"`);
38617      }
38618    }
38619    if (this.hasChildNodes()) {
38620      buffer.push(">");
38621      for (const child of this.childNodes) {
38622        child.dump(buffer);
38623      }
38624      buffer.push(`</${this.nodeName}>`);
38625    } else if (this.nodeValue) {
38626      buffer.push(`>${encodeToXmlString(this.nodeValue)}</${this.nodeName}>`);
38627    } else {
38628      buffer.push("/>");
38629    }
38630  }
38631}
38632class SimpleXMLParser extends XMLParserBase {
38633  constructor({
38634    hasAttributes = false,
38635    lowerCaseName = false
38636  }) {
38637    super();
38638    this._currentFragment = null;
38639    this._stack = null;
38640    this._errorCode = XMLParserErrorCode.NoError;
38641    this._hasAttributes = hasAttributes;
38642    this._lowerCaseName = lowerCaseName;
38643  }
38644  parseFromString(data) {
38645    this._currentFragment = [];
38646    this._stack = [];
38647    this._errorCode = XMLParserErrorCode.NoError;
38648    this.parseXml(data);
38649    if (this._errorCode !== XMLParserErrorCode.NoError) {
38650      return undefined;
38651    }
38652    const [documentElement] = this._currentFragment;
38653    if (!documentElement) {
38654      return undefined;
38655    }
38656    return {
38657      documentElement
38658    };
38659  }
38660  onText(text) {
38661    if (isWhitespaceString(text)) {
38662      return;
38663    }
38664    const node = new SimpleDOMNode("#text", text);
38665    this._currentFragment.push(node);
38666  }
38667  onCdata(text) {
38668    const node = new SimpleDOMNode("#text", text);
38669    this._currentFragment.push(node);
38670  }
38671  onBeginElement(name, attributes, isEmpty) {
38672    if (this._lowerCaseName) {
38673      name = name.toLowerCase();
38674    }
38675    const node = new SimpleDOMNode(name);
38676    node.childNodes = [];
38677    if (this._hasAttributes) {
38678      node.attributes = attributes;
38679    }
38680    this._currentFragment.push(node);
38681    if (isEmpty) {
38682      return;
38683    }
38684    this._stack.push(this._currentFragment);
38685    this._currentFragment = node.childNodes;
38686  }
38687  onEndElement(name) {
38688    this._currentFragment = this._stack.pop() || [];
38689    const lastElement = this._currentFragment.at(-1);
38690    if (!lastElement) {
38691      return null;
38692    }
38693    for (const childNode of lastElement.childNodes) {
38694      childNode.parentNode = lastElement;
38695    }
38696    return lastElement;
38697  }
38698  onError(code) {
38699    this._errorCode = code;
38700  }
38701}
38702
38703;// ./src/core/metadata_parser.js
38704
vendor: 4,159 bytes, lines 38705-38851
38705class MetadataParser {
38706  constructor(data) {
38707    data = this._repair(data);
38708    const parser = new SimpleXMLParser({
38709      lowerCaseName: true
38710    });
38711    const xmlDocument = parser.parseFromString(data);
38712    this._metadataMap = new Map();
38713    this._data = data;
38714    if (xmlDocument) {
38715      this._parse(xmlDocument);
38716    }
38717  }
38718  _repair(data) {
38719    return data.replace(/^[^<]+/, "").replaceAll(/>\\376\\377([^<]+)/g, function (all, codes) {
38720      const bytes = codes.replaceAll(/\\([0-3])([0-7])([0-7])/g, function (code, d1, d2, d3) {
38721        return String.fromCharCode(d1 * 64 + d2 * 8 + d3 * 1);
38722      }).replaceAll(/&(amp|apos|gt|lt|quot);/g, function (str, name) {
38723        switch (name) {
38724          case "amp":
38725            return "&";
38726          case "apos":
38727            return "'";
38728          case "gt":
38729            return ">";
38730          case "lt":
38731            return "<";
38732          case "quot":
38733            return '"';
38734        }
38735        throw new Error(`_repair: ${name} isn't defined.`);
38736      });
38737      const charBuf = [">"];
38738      for (let i = 0, ii = bytes.length; i < ii; i += 2) {
38739        const code = bytes.charCodeAt(i) * 256 + bytes.charCodeAt(i + 1);
38740        if (code >= 32 && code < 127 && code !== 60 && code !== 62 && code !== 38) {
38741          charBuf.push(String.fromCharCode(code));
38742        } else {
38743          charBuf.push("&#x" + (0x10000 + code).toString(16).substring(1) + ";");
38744        }
38745      }
38746      return charBuf.join("");
38747    });
38748  }
38749  _getSequence(entry) {
38750    const name = entry.nodeName;
38751    if (name !== "rdf:bag" && name !== "rdf:seq" && name !== "rdf:alt") {
38752      return null;
38753    }
38754    return entry.childNodes.filter(node => node.nodeName === "rdf:li");
38755  }
38756  _parseArray(entry) {
38757    if (!entry.hasChildNodes()) {
38758      return;
38759    }
38760    const [seqNode] = entry.childNodes;
38761    const sequence = this._getSequence(seqNode) || [];
38762    this._metadataMap.set(entry.nodeName, sequence.map(node => node.textContent.trim()));
38763  }
38764  _parse(xmlDocument) {
38765    let rdf = xmlDocument.documentElement;
38766    if (rdf.nodeName !== "rdf:rdf") {
38767      rdf = rdf.firstChild;
38768      while (rdf && rdf.nodeName !== "rdf:rdf") {
38769        rdf = rdf.nextSibling;
38770      }
38771    }
38772    if (!rdf || rdf.nodeName !== "rdf:rdf" || !rdf.hasChildNodes()) {
38773      return;
38774    }
38775    for (const desc of rdf.childNodes) {
38776      if (desc.nodeName !== "rdf:description") {
38777        continue;
38778      }
38779      for (const entry of desc.childNodes) {
38780        const name = entry.nodeName;
38781        switch (name) {
38782          case "#text":
38783            continue;
38784          case "dc:creator":
38785          case "dc:subject":
38786            this._parseArray(entry);
38787            continue;
38788        }
38789        this._metadataMap.set(name, entry.textContent.trim());
38790      }
38791    }
38792  }
38793  get serializable() {
38794    return {
38795      parsedData: this._metadataMap,
38796      rawData: this._data
38797    };
38798  }
38799}
38800
38801;// ./src/core/struct_tree.js
38802
38803
38804
38805
38806
38807const MAX_DEPTH = 40;
38808const StructElementType = {
38809  PAGE_CONTENT: 1,
38810  STREAM_CONTENT: 2,
38811  OBJECT: 3,
38812  ANNOTATION: 4,
38813  ELEMENT: 5
38814};
38815class StructTreeRoot {
38816  constructor(xref, rootDict, rootRef) {
38817    this.xref = xref;
38818    this.dict = rootDict;
38819    this.ref = rootRef instanceof Ref ? rootRef : null;
38820    this.roleMap = new Map();
38821    this.structParentIds = null;
38822    this.kidRefToPosition = undefined;
38823    this.parentTree = null;
38824  }
38825  getKidPosition(kidRef) {
38826    if (this.kidRefToPosition === undefined) {
38827      const obj = this.dict.get("K");
38828      if (Array.isArray(obj)) {
38829        const map = this.kidRefToPosition = new Map();
38830        for (let i = 0, ii = obj.length; i < ii; i++) {
38831          const ref = obj[i];
38832          if (ref) {
38833            map.set(ref.toString(), i);
38834          }
38835        }
38836      } else if (obj instanceof Dict) {
38837        this.kidRefToPosition = new Map([[obj.objId, 0]]);
38838      } else if (!obj) {
38839        this.kidRefToPosition = new Map();
38840      } else {
38841        this.kidRefToPosition = null;
38842      }
38843    }
38844    return this.kidRefToPosition ? this.kidRefToPosition.get(kidRef) ?? NaN : -1;
38845  }
38846  init() {
38847    this.readRoleMap();
38848    const parentTree = this.dict.get("ParentTree");
38849    if (!parentTree) {
38850      return;
38851    }
vendor: 4,229 bytes, lines 38852-38992
38852    this.parentTree = new NumberTree(parentTree, this.xref);
38853  }
38854  #addIdToPage(pageRef, id, type) {
38855    if (!(pageRef instanceof Ref) || id < 0) {
38856      return;
38857    }
38858    this.structParentIds ||= new RefSetCache();
38859    let ids = this.structParentIds.get(pageRef);
38860    if (!ids) {
38861      ids = [];
38862      this.structParentIds.put(pageRef, ids);
38863    }
38864    ids.push([id, type]);
38865  }
38866  addAnnotationIdToPage(pageRef, id) {
38867    this.#addIdToPage(pageRef, id, StructElementType.ANNOTATION);
38868  }
38869  readRoleMap() {
38870    const roleMapDict = this.dict.get("RoleMap");
38871    if (!(roleMapDict instanceof Dict)) {
38872      return;
38873    }
38874    for (const [key, value] of roleMapDict) {
38875      if (value instanceof Name) {
38876        this.roleMap.set(key, value.name);
38877      }
38878    }
38879  }
38880  static async canCreateStructureTree({
38881    catalogRef,
38882    pdfManager,
38883    newAnnotationsByPage
38884  }) {
38885    if (!(catalogRef instanceof Ref)) {
38886      warn("Cannot save the struct tree: no catalog reference.");
38887      return false;
38888    }
38889    let nextKey = 0;
38890    let hasNothingToUpdate = true;
38891    for (const [pageIndex, elements] of newAnnotationsByPage) {
38892      const {
38893        ref: pageRef
38894      } = await pdfManager.getPage(pageIndex);
38895      if (!(pageRef instanceof Ref)) {
38896        warn(`Cannot save the struct tree: page ${pageIndex} has no ref.`);
38897        hasNothingToUpdate = true;
38898        break;
38899      }
38900      for (const element of elements) {
38901        if (element.accessibilityData?.type) {
38902          element.parentTreeId = nextKey++;
38903          hasNothingToUpdate = false;
38904        }
38905      }
38906    }
38907    if (hasNothingToUpdate) {
38908      for (const elements of newAnnotationsByPage.values()) {
38909        for (const element of elements) {
38910          delete element.parentTreeId;
38911        }
38912      }
38913      return false;
38914    }
38915    return true;
38916  }
38917  static async createStructureTree({
38918    newAnnotationsByPage,
38919    xref,
38920    catalogRef,
38921    pdfManager,
38922    changes
38923  }) {
38924    const root = await pdfManager.ensureCatalog("cloneDict");
38925    const cache = new RefSetCache();
38926    cache.put(catalogRef, root);
38927    const structTreeRootRef = xref.getNewTemporaryRef();
38928    root.set("StructTreeRoot", structTreeRootRef);
38929    const structTreeRoot = new Dict(xref);
38930    structTreeRoot.set("Type", Name.get("StructTreeRoot"));
38931    const parentTreeRef = xref.getNewTemporaryRef();
38932    structTreeRoot.set("ParentTree", parentTreeRef);
38933    const kids = [];
38934    structTreeRoot.set("K", kids);
38935    cache.put(structTreeRootRef, structTreeRoot);
38936    const parentTree = new Dict(xref);
38937    const nums = [];
38938    parentTree.set("Nums", nums);
38939    const nextKey = await this.#writeKids({
38940      newAnnotationsByPage,
38941      structTreeRootRef,
38942      structTreeRoot: null,
38943      kids,
38944      nums,
38945      xref,
38946      pdfManager,
38947      changes,
38948      cache
38949    });
38950    structTreeRoot.set("ParentTreeNextKey", nextKey);
38951    cache.put(parentTreeRef, parentTree);
38952    for (const [ref, obj] of cache.items()) {
38953      changes.put(ref, {
38954        data: obj
38955      });
38956    }
38957  }
38958  async canUpdateStructTree({
38959    pdfManager,
38960    newAnnotationsByPage
38961  }) {
38962    if (!this.ref) {
38963      warn("Cannot update the struct tree: no root reference.");
38964      return false;
38965    }
38966    let nextKey = this.dict.get("ParentTreeNextKey");
38967    if (!Number.isInteger(nextKey) || nextKey < 0) {
38968      warn("Cannot update the struct tree: invalid next key.");
38969      return false;
38970    }
38971    const parentTree = this.dict.get("ParentTree");
38972    if (!(parentTree instanceof Dict)) {
38973      warn("Cannot update the struct tree: ParentTree isn't a dict.");
38974      return false;
38975    }
38976    const nums = parentTree.get("Nums");
38977    if (!Array.isArray(nums)) {
38978      warn("Cannot update the struct tree: nums isn't an array.");
38979      return false;
38980    }
38981    const numberTree = new NumberTree(parentTree, this.xref);
38982    for (const pageIndex of newAnnotationsByPage.keys()) {
38983      const {
38984        pageDict
38985      } = await pdfManager.getPage(pageIndex);
38986      if (!pageDict.has("StructParents")) {
38987        continue;
38988      }
38989      const id = pageDict.get("StructParents");
38990      if (!Number.isInteger(id) || !Array.isArray(numberTree.get(id))) {
38991        warn(`Cannot save the struct tree: page ${pageIndex} has a wrong id.`);
38992        return false;
vendor: 15,201 bytes, lines 38993-39553
38993      }
38994    }
38995    let hasNothingToUpdate = true;
38996    for (const [pageIndex, elements] of newAnnotationsByPage) {
38997      const {
38998        pageDict
38999      } = await pdfManager.getPage(pageIndex);
39000      StructTreeRoot.#collectParents({
39001        elements,
39002        xref: this.xref,
39003        pageDict,
39004        numberTree
39005      });
39006      for (const element of elements) {
39007        if (element.accessibilityData?.type) {
39008          if (!(element.accessibilityData.structParent >= 0)) {
39009            element.parentTreeId = nextKey++;
39010          }
39011          hasNothingToUpdate = false;
39012        }
39013      }
39014    }
39015    if (hasNothingToUpdate) {
39016      for (const elements of newAnnotationsByPage.values()) {
39017        for (const element of elements) {
39018          delete element.parentTreeId;
39019          delete element.structTreeParent;
39020        }
39021      }
39022      return false;
39023    }
39024    return true;
39025  }
39026  async updateStructureTree({
39027    newAnnotationsByPage,
39028    pdfManager,
39029    changes
39030  }) {
39031    const {
39032      ref: structTreeRootRef,
39033      xref
39034    } = this;
39035    const structTreeRoot = this.dict.clone();
39036    const cache = new RefSetCache();
39037    cache.put(structTreeRootRef, structTreeRoot);
39038    let parentTreeRef = structTreeRoot.getRaw("ParentTree");
39039    let parentTree;
39040    if (parentTreeRef instanceof Ref) {
39041      parentTree = xref.fetch(parentTreeRef);
39042    } else {
39043      parentTree = parentTreeRef;
39044      parentTreeRef = xref.getNewTemporaryRef();
39045      structTreeRoot.set("ParentTree", parentTreeRef);
39046    }
39047    parentTree = parentTree.clone();
39048    cache.put(parentTreeRef, parentTree);
39049    let nums = parentTree.getRaw("Nums");
39050    let numsRef = null;
39051    if (nums instanceof Ref) {
39052      numsRef = nums;
39053      nums = xref.fetch(numsRef);
39054    }
39055    nums = nums.slice();
39056    if (!numsRef) {
39057      parentTree.set("Nums", nums);
39058    }
39059    const newNextKey = await StructTreeRoot.#writeKids({
39060      newAnnotationsByPage,
39061      structTreeRootRef,
39062      structTreeRoot: this,
39063      kids: null,
39064      nums,
39065      xref,
39066      pdfManager,
39067      changes,
39068      cache
39069    });
39070    if (newNextKey === -1) {
39071      return;
39072    }
39073    structTreeRoot.set("ParentTreeNextKey", newNextKey);
39074    if (numsRef) {
39075      cache.put(numsRef, nums);
39076    }
39077    for (const [ref, obj] of cache.items()) {
39078      changes.put(ref, {
39079        data: obj
39080      });
39081    }
39082  }
39083  static async #writeKids({
39084    newAnnotationsByPage,
39085    structTreeRootRef,
39086    structTreeRoot,
39087    kids,
39088    nums,
39089    xref,
39090    pdfManager,
39091    changes,
39092    cache
39093  }) {
39094    const objr = Name.get("OBJR");
39095    let nextKey = -1;
39096    let structTreePageObjs;
39097    for (const [pageIndex, elements] of newAnnotationsByPage) {
39098      const page = await pdfManager.getPage(pageIndex);
39099      const {
39100        ref: pageRef
39101      } = page;
39102      const isPageRef = pageRef instanceof Ref;
39103      for (const {
39104        accessibilityData,
39105        ref,
39106        parentTreeId,
39107        structTreeParent
39108      } of elements) {
39109        if (!accessibilityData?.type) {
39110          continue;
39111        }
39112        const {
39113          structParent
39114        } = accessibilityData;
39115        if (structTreeRoot && Number.isInteger(structParent) && structParent >= 0) {
39116          let objs = (structTreePageObjs ||= new Map()).get(pageIndex);
39117          if (objs === undefined) {
39118            const structTreePage = new StructTreePage(structTreeRoot, page.pageDict);
39119            objs = structTreePage.collectObjects(pageRef);
39120            structTreePageObjs.set(pageIndex, objs);
39121          }
39122          const objRef = objs?.get(structParent);
39123          if (objRef) {
39124            const tagDict = xref.fetch(objRef).clone();
39125            StructTreeRoot.#writeProperties(tagDict, accessibilityData);
39126            changes.put(objRef, {
39127              data: tagDict
39128            });
39129            continue;
39130          }
39131        }
39132        nextKey = Math.max(nextKey, parentTreeId);
39133        const tagRef = xref.getNewTemporaryRef();
39134        const tagDict = new Dict(xref);
39135        StructTreeRoot.#writeProperties(tagDict, accessibilityData);
39136        await this.#updateParentTag({
39137          structTreeParent,
39138          tagDict,
39139          newTagRef: tagRef,
39140          structTreeRootRef,
39141          fallbackKids: kids,
39142          xref,
39143          cache
39144        });
39145        const objDict = new Dict(xref);
39146        tagDict.set("K", objDict);
39147        objDict.set("Type", objr);
39148        if (isPageRef) {
39149          objDict.set("Pg", pageRef);
39150        }
39151        objDict.set("Obj", ref);
39152        cache.put(tagRef, tagDict);
39153        nums.push(parentTreeId, tagRef);
39154      }
39155    }
39156    return nextKey + 1;
39157  }
39158  static #writeProperties(tagDict, {
39159    type,
39160    title,
39161    lang,
39162    alt,
39163    expanded,
39164    actualText
39165  }) {
39166    tagDict.set("S", Name.get(type));
39167    if (title) {
39168      tagDict.set("T", stringToAsciiOrUTF16BE(title));
39169    }
39170    if (lang) {
39171      tagDict.set("Lang", stringToAsciiOrUTF16BE(lang));
39172    }
39173    if (alt) {
39174      tagDict.set("Alt", stringToAsciiOrUTF16BE(alt));
39175    }
39176    if (expanded) {
39177      tagDict.set("E", stringToAsciiOrUTF16BE(expanded));
39178    }
39179    if (actualText) {
39180      tagDict.set("ActualText", stringToAsciiOrUTF16BE(actualText));
39181    }
39182  }
39183  static #collectParents({
39184    elements,
39185    xref,
39186    pageDict,
39187    numberTree
39188  }) {
39189    const idToElements = new Map();
39190    for (const element of elements) {
39191      if (element.structTreeParentId) {
39192        const id = parseInt(element.structTreeParentId.split("_mc")[1], 10);
39193        idToElements.getOrInsertComputed(id, makeArr).push(element);
39194      }
39195    }
39196    const id = pageDict.get("StructParents");
39197    if (!Number.isInteger(id)) {
39198      return;
39199    }
39200    const parentArray = numberTree.get(id);
39201    const updateElement = (kid, pageKid, kidRef) => {
39202      const elems = idToElements.get(kid);
39203      if (elems) {
39204        const parentRef = pageKid.getRaw("P");
39205        const parentDict = xref.fetchIfRef(parentRef);
39206        if (parentRef instanceof Ref && parentDict instanceof Dict) {
39207          const params = {
39208            ref: kidRef,
39209            dict: pageKid
39210          };
39211          for (const element of elems) {
39212            element.structTreeParent = params;
39213          }
39214        }
39215        return true;
39216      }
39217      return false;
39218    };
39219    for (const kidRef of parentArray) {
39220      if (!(kidRef instanceof Ref)) {
39221        continue;
39222      }
39223      const pageKid = xref.fetch(kidRef);
39224      const k = pageKid.get("K");
39225      if (Number.isInteger(k)) {
39226        updateElement(k, pageKid, kidRef);
39227        continue;
39228      }
39229      if (!Array.isArray(k)) {
39230        continue;
39231      }
39232      for (let kid of k) {
39233        kid = xref.fetchIfRef(kid);
39234        if (Number.isInteger(kid) && updateElement(kid, pageKid, kidRef)) {
39235          break;
39236        }
39237        if (!(kid instanceof Dict)) {
39238          continue;
39239        }
39240        if (!isName(kid.get("Type"), "MCR")) {
39241          break;
39242        }
39243        const mcid = kid.get("MCID");
39244        if (Number.isInteger(mcid) && updateElement(mcid, pageKid, kidRef)) {
39245          break;
39246        }
39247      }
39248    }
39249  }
39250  static async #updateParentTag({
39251    structTreeParent,
39252    tagDict,
39253    newTagRef,
39254    structTreeRootRef,
39255    fallbackKids,
39256    xref,
39257    cache
39258  }) {
39259    let ref = null;
39260    let parentRef;
39261    if (structTreeParent) {
39262      ({
39263        ref
39264      } = structTreeParent);
39265      parentRef = structTreeParent.dict.getRaw("P") || structTreeRootRef;
39266    } else {
39267      parentRef = structTreeRootRef;
39268    }
39269    tagDict.set("P", parentRef);
39270    const parentDict = xref.fetchIfRef(parentRef);
39271    if (!parentDict) {
39272      fallbackKids.push(newTagRef);
39273      return;
39274    }
39275    let cachedParentDict = cache.get(parentRef);
39276    if (!cachedParentDict) {
39277      cachedParentDict = parentDict.clone();
39278      cache.put(parentRef, cachedParentDict);
39279    }
39280    const parentKidsRaw = cachedParentDict.getRaw("K");
39281    let cachedParentKids = parentKidsRaw instanceof Ref ? cache.get(parentKidsRaw) : null;
39282    if (!cachedParentKids) {
39283      cachedParentKids = xref.fetchIfRef(parentKidsRaw);
39284      cachedParentKids = Array.isArray(cachedParentKids) ? cachedParentKids.slice() : [parentKidsRaw];
39285      const parentKidsRef = xref.getNewTemporaryRef();
39286      cachedParentDict.set("K", parentKidsRef);
39287      cache.put(parentKidsRef, cachedParentKids);
39288    }
39289    const index = cachedParentKids.indexOf(ref);
39290    cachedParentKids.splice(index >= 0 ? index + 1 : cachedParentKids.length, 0, newTagRef);
39291  }
39292}
39293class StructElementNode {
39294  constructor(tree, dict) {
39295    this.tree = tree;
39296    this.xref = tree.xref;
39297    this.dict = dict;
39298    this.kids = [];
39299    this.parseKids();
39300  }
39301  get role() {
39302    const nameObj = this.dict.get("S");
39303    const name = nameObj instanceof Name ? nameObj.name : "";
39304    const {
39305      root
39306    } = this.tree;
39307    return root.roleMap.get(name) ?? name;
39308  }
39309  get mathML() {
39310    let AFs = this.dict.get("AF") || [];
39311    if (!Array.isArray(AFs)) {
39312      AFs = [AFs];
39313    }
39314    for (let af of AFs) {
39315      af = this.xref.fetchIfRef(af);
39316      if (!(af instanceof Dict)) {
39317        continue;
39318      }
39319      if (!isName(af.get("Type"), "Filespec")) {
39320        continue;
39321      }
39322      if (!isName(af.get("AFRelationship"), "Supplement")) {
39323        continue;
39324      }
39325      const ef = af.get("EF");
39326      if (!(ef instanceof Dict)) {
39327        continue;
39328      }
39329      const fileStream = ef.get("UF") || ef.get("F");
39330      if (!(fileStream instanceof BaseStream)) {
39331        continue;
39332      }
39333      if (!isName(fileStream.dict.get("Type"), "EmbeddedFile")) {
39334        continue;
39335      }
39336      if (!isName(fileStream.dict.get("Subtype"), "application/mathml+xml")) {
39337        continue;
39338      }
39339      return stringToUTF8String(fileStream.getString());
39340    }
39341    const A = this.dict.get("A");
39342    if (A instanceof Dict) {
39343      const O = A.get("O");
39344      if (isName(O, "MSFT_Office")) {
39345        const mathml = A.get("MSFT_MathML");
39346        return mathml ? stringToPDFString(mathml) : null;
39347      }
39348    }
39349    return null;
39350  }
39351  parseKids() {
39352    let pageObjId = null;
39353    const objRef = this.dict.getRaw("Pg");
39354    if (objRef instanceof Ref) {
39355      pageObjId = objRef.toString();
39356    }
39357    const kids = this.dict.get("K");
39358    if (Array.isArray(kids)) {
39359      for (const kid of kids) {
39360        const element = this.parseKid(pageObjId, this.xref.fetchIfRef(kid));
39361        if (element) {
39362          this.kids.push(element);
39363        }
39364      }
39365    } else {
39366      const element = this.parseKid(pageObjId, kids);
39367      if (element) {
39368        this.kids.push(element);
39369      }
39370    }
39371  }
39372  parseKid(pageObjId, kid) {
39373    if (Number.isInteger(kid)) {
39374      if (this.tree.pageDict.objId !== pageObjId) {
39375        return null;
39376      }
39377      return new StructElement({
39378        type: StructElementType.PAGE_CONTENT,
39379        mcid: kid,
39380        pageObjId
39381      });
39382    }
39383    if (!(kid instanceof Dict)) {
39384      return null;
39385    }
39386    const pageRef = kid.getRaw("Pg");
39387    if (pageRef instanceof Ref) {
39388      pageObjId = pageRef.toString();
39389    }
39390    const type = kid.get("Type") instanceof Name ? kid.get("Type").name : null;
39391    if (type === "MCR") {
39392      if (this.tree.pageDict.objId !== pageObjId) {
39393        return null;
39394      }
39395      const kidRef = kid.getRaw("Stm");
39396      return new StructElement({
39397        type: StructElementType.STREAM_CONTENT,
39398        refObjId: kidRef instanceof Ref ? kidRef.toString() : null,
39399        pageObjId,
39400        mcid: kid.get("MCID")
39401      });
39402    }
39403    if (type === "OBJR") {
39404      if (this.tree.pageDict.objId !== pageObjId) {
39405        return null;
39406      }
39407      const kidRef = kid.getRaw("Obj");
39408      return new StructElement({
39409        type: StructElementType.OBJECT,
39410        refObjId: kidRef instanceof Ref ? kidRef.toString() : null,
39411        pageObjId
39412      });
39413    }
39414    return new StructElement({
39415      type: StructElementType.ELEMENT,
39416      dict: kid
39417    });
39418  }
39419}
39420class StructElement {
39421  constructor({
39422    type,
39423    dict = null,
39424    mcid = null,
39425    pageObjId = null,
39426    refObjId = null
39427  }) {
39428    this.type = type;
39429    this.dict = dict;
39430    this.mcid = mcid;
39431    this.pageObjId = pageObjId;
39432    this.refObjId = refObjId;
39433    this.parentNode = null;
39434  }
39435}
39436class StructTreePage {
39437  constructor(structTreeRoot, pageDict) {
39438    this.root = structTreeRoot;
39439    this.xref = structTreeRoot?.xref ?? null;
39440    this.rootDict = structTreeRoot?.dict ?? null;
39441    this.pageDict = pageDict;
39442    this.nodes = [];
39443  }
39444  collectObjects(pageRef) {
39445    if (!this.root || !this.rootDict || !(pageRef instanceof Ref)) {
39446      return null;
39447    }
39448    const parentTree = this.rootDict.get("ParentTree");
39449    if (!parentTree) {
39450      return null;
39451    }
39452    const ids = this.root.structParentIds?.get(pageRef);
39453    if (!ids) {
39454      return null;
39455    }
39456    const map = new Map();
39457    const numberTree = new NumberTree(parentTree, this.xref);
39458    for (const [elemId] of ids) {
39459      const obj = numberTree.getRaw(elemId);
39460      if (obj instanceof Ref) {
39461        map.set(elemId, obj);
39462      }
39463    }
39464    return map;
39465  }
39466  parse(pageRef) {
39467    if (!this.root || !this.rootDict || !(pageRef instanceof Ref)) {
39468      return;
39469    }
39470    const {
39471      parentTree
39472    } = this.root;
39473    if (!parentTree) {
39474      return;
39475    }
39476    const id = this.pageDict.get("StructParents");
39477    const ids = this.root.structParentIds?.get(pageRef);
39478    if (!Number.isInteger(id) && !ids) {
39479      return;
39480    }
39481    const map = new Map();
39482    if (Number.isInteger(id)) {
39483      const parentArray = parentTree.get(id);
39484      if (Array.isArray(parentArray)) {
39485        for (const ref of parentArray) {
39486          if (ref instanceof Ref) {
39487            this.addNode(this.xref.fetch(ref), map);
39488          }
39489        }
39490      }
39491    }
39492    if (!ids) {
39493      return;
39494    }
39495    for (const [elemId, type] of ids) {
39496      const obj = parentTree.get(elemId);
39497      if (obj) {
39498        const elem = this.addNode(this.xref.fetchIfRef(obj), map);
39499        if (elem?.kids?.length === 1 && elem.kids[0].type === StructElementType.OBJECT) {
39500          elem.kids[0].type = type;
39501        }
39502      }
39503    }
39504  }
39505  addNode(dict, map, level = 0) {
39506    if (level > MAX_DEPTH) {
39507      warn("StructTree MAX_DEPTH reached.");
39508      return null;
39509    }
39510    if (!(dict instanceof Dict)) {
39511      return null;
39512    }
39513    if (map.has(dict)) {
39514      return map.get(dict);
39515    }
39516    const element = new StructElementNode(this, dict);
39517    map.set(dict, element);
39518    switch (element.role) {
39519      case "L":
39520      case "LBody":
39521      case "LI":
39522      case "Table":
39523      case "THead":
39524      case "TBody":
39525      case "TFoot":
39526      case "TR":
39527        {
39528          for (const kid of element.kids) {
39529            if (kid.type === StructElementType.ELEMENT) {
39530              this.addNode(kid.dict, map, level - 1);
39531            }
39532          }
39533        }
39534    }
39535    const parent = dict.get("P");
39536    if (!(parent instanceof Dict) || isName(parent.get("Type"), "StructTreeRoot")) {
39537      if (!this.addTopLevelNode(dict, element)) {
39538        map.delete(dict);
39539      }
39540      return element;
39541    }
39542    const parentNode = this.addNode(parent, map, level + 1);
39543    if (!parentNode) {
39544      return element;
39545    }
39546    let save = false;
39547    for (const kid of parentNode.kids) {
39548      if (kid.type === StructElementType.ELEMENT && kid.dict === dict) {
39549        kid.parentNode = element;
39550        save = true;
39551      }
39552    }
39553    if (!save) {
39554      map.delete(dict);
39555    }
39556    return element;
39557  }
39558  addTopLevelNode(dict, element) {
39559    const index = this.root.getKidPosition(dict.objId);
39560    if (isNaN(index)) {
39561      return false;
39562    }
39563    if (index !== -1) {
39564      this.nodes[index] = element;
39565    }
39566    return true;
39567  }
39568  get serializable() {
39569    function nodeToSerializable(node, parent, level = 0) {
39570      if (level > MAX_DEPTH) {
39571        warn("StructTree too deep to be fully serialized.");
39572        return;
39573      }
39574      const obj = Object.create(null);
39575      obj.role = node.role;
39576      obj.children = [];
39577      parent.children.push(obj);
39578      let alt = node.dict.get("Alt");
39579      if (typeof alt !== "string") {
39580        alt = node.dict.get("ActualText");
39581      }
39582      if (typeof alt === "string") {
39583        obj.alt = stringToPDFString(alt);
39584      }
39585      if (obj.role === "Formula") {
39586        const {
39587          mathML
39588        } = node;
39589        if (mathML) {
39590          obj.mathML = mathML;
39591        }
39592      }
39593      const a = node.dict.get("A");
39594      if (a instanceof Dict) {
39595        const bbox = lookupNormalRect(a.getArray("BBox"), null);
39596        if (bbox) {
39597          obj.bbox = bbox;
39598        } else {
39599          const width = a.get("Width");
39600          const height = a.get("Height");
39601          if (typeof width === "number" && width > 0 && typeof height === "number" && height > 0) {
39602            obj.bbox = [0, 0, width, height];
39603          }
39604        }
39605      }
39606      const lang = node.dict.get("Lang");
39607      if (typeof lang === "string") {
39608        obj.lang = stringToPDFString(lang);
39609      }
39610      for (const kid of node.kids) {
39611        const kidElement = kid.type === StructElementType.ELEMENT ? kid.parentNode : null;
39612        if (kidElement) {
vendor: 26,147 bytes, lines 39613-40516
39613          nodeToSerializable(kidElement, obj, level + 1);
39614          continue;
39615        } else if (kid.type === StructElementType.PAGE_CONTENT || kid.type === StructElementType.STREAM_CONTENT) {
39616          obj.children.push({
39617            type: "content",
39618            id: `p${kid.pageObjId}_mc${kid.mcid}`
39619          });
39620        } else if (kid.type === StructElementType.OBJECT) {
39621          obj.children.push({
39622            type: "object",
39623            id: kid.refObjId
39624          });
39625        } else if (kid.type === StructElementType.ANNOTATION) {
39626          obj.children.push({
39627            type: "annotation",
39628            id: `${AnnotationPrefix}${kid.refObjId}`
39629          });
39630        }
39631      }
39632    }
39633    const root = Object.create(null);
39634    root.children = [];
39635    root.role = "Root";
39636    for (const child of this.nodes) {
39637      if (!child) {
39638        continue;
39639      }
39640      nodeToSerializable(child, root);
39641    }
39642    return root;
39643  }
39644}
39645
39646;// ./src/core/catalog.js
39647
39648
39649
39650
39651
39652
39653
39654
39655
39656
39657
39658const isRef = v => v instanceof Ref;
39659const isValidExplicitDest = _isValidExplicitDest.bind(null, isRef, isName);
39660function fetchDest(dest) {
39661  if (dest instanceof Dict) {
39662    dest = dest.get("D");
39663  }
39664  return isValidExplicitDest(dest) ? dest : null;
39665}
39666function fetchRemoteDest(action) {
39667  let dest = action.get("D");
39668  if (dest) {
39669    if (dest instanceof Name) {
39670      dest = dest.name;
39671    }
39672    if (typeof dest === "string") {
39673      return stringToPDFString(dest, true);
39674    } else if (isValidExplicitDest(dest)) {
39675      return JSON.stringify(dest);
39676    }
39677  }
39678  return null;
39679}
39680class Catalog {
39681  #actualNumPages = null;
39682  #catDict = null;
39683  builtInCMapCache = new Map();
39684  fontCache = new RefSetCache();
39685  globalColorSpaceCache = new GlobalColorSpaceCache();
39686  globalImageCache = new GlobalImageCache();
39687  nonBlendModesSet = new RefSet();
39688  pageDictCache = new RefSetCache();
39689  pageIndexCache = new RefSetCache();
39690  pageKidsCountCache = new RefSetCache();
39691  standardFontDataCache = new Map();
39692  systemFontCache = new Map();
39693  constructor(pdfManager, xref) {
39694    this.pdfManager = pdfManager;
39695    this.xref = xref;
39696    this.#catDict = xref.getCatalogObj();
39697    if (!(this.#catDict instanceof Dict)) {
39698      throw new FormatError("Catalog object is not a dictionary.");
39699    }
39700    this.toplevelPagesDict;
39701  }
39702  cloneDict() {
39703    return this.#catDict.clone();
39704  }
39705  get version() {
39706    const version = this.#catDict.get("Version");
39707    if (version instanceof Name) {
39708      if (PDF_VERSION_REGEXP.test(version.name)) {
39709        return shadow(this, "version", version.name);
39710      }
39711      warn(`Invalid PDF catalog version: ${version.name}`);
39712    }
39713    return shadow(this, "version", null);
39714  }
39715  get lang() {
39716    const lang = this.#catDict.get("Lang");
39717    return shadow(this, "lang", lang && typeof lang === "string" ? stringToPDFString(lang) : null);
39718  }
39719  get needsRendering() {
39720    const needsRendering = this.#catDict.get("NeedsRendering");
39721    return shadow(this, "needsRendering", typeof needsRendering === "boolean" ? needsRendering : false);
39722  }
39723  get collection() {
39724    let collection = null;
39725    try {
39726      const obj = this.#catDict.get("Collection");
39727      if (obj instanceof Dict && obj.size > 0) {
39728        collection = obj;
39729      }
39730    } catch (ex) {
39731      if (ex instanceof MissingDataException) {
39732        throw ex;
39733      }
39734      info("Cannot fetch Collection entry; assuming no collection is present.");
39735    }
39736    return shadow(this, "collection", collection);
39737  }
39738  get acroForm() {
39739    let acroForm = null;
39740    try {
39741      const obj = this.#catDict.get("AcroForm");
39742      if (obj instanceof Dict && obj.size > 0) {
39743        acroForm = obj;
39744      }
39745    } catch (ex) {
39746      if (ex instanceof MissingDataException) {
39747        throw ex;
39748      }
39749      info("Cannot fetch AcroForm entry; assuming no forms are present.");
39750    }
39751    return shadow(this, "acroForm", acroForm);
39752  }
39753  get acroFormRef() {
39754    const value = this.#catDict.getRaw("AcroForm");
39755    return shadow(this, "acroFormRef", value instanceof Ref ? value : null);
39756  }
39757  get metadata() {
39758    const streamRef = this.#catDict.getRaw("Metadata");
39759    if (!(streamRef instanceof Ref)) {
39760      return shadow(this, "metadata", null);
39761    }
39762    let metadata = null;
39763    try {
39764      const stream = this.xref.fetch(streamRef, !this.xref.encrypt?.encryptMetadata);
39765      if (stream instanceof BaseStream && stream.dict instanceof Dict) {
39766        const type = stream.dict.get("Type");
39767        const subtype = stream.dict.get("Subtype");
39768        if (isName(type, "Metadata") && isName(subtype, "XML")) {
39769          const data = stringToUTF8String(stream.getString());
39770          if (data) {
39771            metadata = new MetadataParser(data).serializable;
39772          }
39773        }
39774      }
39775    } catch (ex) {
39776      if (ex instanceof MissingDataException) {
39777        throw ex;
39778      }
39779      info(`Skipping invalid Metadata: "${ex}".`);
39780    }
39781    return shadow(this, "metadata", metadata);
39782  }
39783  get markInfo() {
39784    let markInfo = null;
39785    try {
39786      markInfo = this.#readMarkInfo();
39787    } catch (ex) {
39788      if (ex instanceof MissingDataException) {
39789        throw ex;
39790      }
39791      warn("Unable to read mark info.");
39792    }
39793    return shadow(this, "markInfo", markInfo);
39794  }
39795  #readMarkInfo() {
39796    const obj = this.#catDict.get("MarkInfo");
39797    if (!(obj instanceof Dict)) {
39798      return null;
39799    }
39800    const markInfo = {
39801      Marked: false,
39802      UserProperties: false,
39803      Suspects: false
39804    };
39805    for (const key in markInfo) {
39806      const value = obj.get(key);
39807      if (typeof value === "boolean") {
39808        markInfo[key] = value;
39809      }
39810    }
39811    return markInfo;
39812  }
39813  get hasStructTree() {
39814    return this.#catDict.has("StructTreeRoot");
39815  }
39816  get structTreeRoot() {
39817    let structTree = null;
39818    try {
39819      structTree = this.#readStructTreeRoot();
39820    } catch (ex) {
39821      if (ex instanceof MissingDataException) {
39822        throw ex;
39823      }
39824      warn("Unable read to structTreeRoot info.");
39825    }
39826    return shadow(this, "structTreeRoot", structTree);
39827  }
39828  #readStructTreeRoot() {
39829    const rawObj = this.#catDict.getRaw("StructTreeRoot");
39830    const obj = this.xref.fetchIfRef(rawObj);
39831    if (!(obj instanceof Dict)) {
39832      return null;
39833    }
39834    const root = new StructTreeRoot(this.xref, obj, rawObj);
39835    root.init();
39836    return root;
39837  }
39838  get toplevelPagesDict() {
39839    const pagesObj = this.#catDict.get("Pages");
39840    if (!(pagesObj instanceof Dict)) {
39841      throw new FormatError("Invalid top-level pages dictionary.");
39842    }
39843    return shadow(this, "toplevelPagesDict", pagesObj);
39844  }
39845  get documentOutline() {
39846    let obj = null;
39847    try {
39848      obj = this.#readDocumentOutline();
39849    } catch (ex) {
39850      if (ex instanceof MissingDataException) {
39851        throw ex;
39852      }
39853      warn("Unable to read document outline.");
39854    }
39855    return shadow(this, "documentOutline", obj);
39856  }
39857  #readDocumentOutline(options = {}) {
39858    let obj = this.#catDict.get("Outlines");
39859    if (!(obj instanceof Dict)) {
39860      return null;
39861    }
39862    obj = obj.getRaw("First");
39863    if (!(obj instanceof Ref)) {
39864      return null;
39865    }
39866    const root = {
39867      items: []
39868    };
39869    const queue = [{
39870      obj,
39871      parent: root
39872    }];
39873    const processed = new RefSet();
39874    processed.put(obj);
39875    const xref = this.xref,
39876      blackColor = new Uint8ClampedArray(3);
39877    while (queue.length > 0) {
39878      const i = queue.shift();
39879      const outlineDict = xref.fetchIfRef(i.obj);
39880      if (outlineDict === null) {
39881        continue;
39882      }
39883      if (!outlineDict.has("Title")) {
39884        warn("Invalid outline item encountered.");
39885      }
39886      const data = {
39887        url: null,
39888        dest: null,
39889        action: null
39890      };
39891      Catalog.parseDestDictionary({
39892        destDict: outlineDict,
39893        resultObj: data,
39894        docBaseUrl: this.baseUrl,
39895        docAttachments: this.attachments
39896      });
39897      const title = outlineDict.get("Title");
39898      const flags = outlineDict.get("F") || 0;
39899      const color = outlineDict.getArray("C");
39900      const count = outlineDict.get("Count");
39901      let rgbColor = blackColor;
39902      if (isNumberArray(color, 3) && (color[0] !== 0 || color[1] !== 0 || color[2] !== 0)) {
39903        rgbColor = ColorSpaceUtils.rgb.getRgb(color, 0);
39904      }
39905      const outlineItem = {
39906        action: data.action,
39907        attachment: data.attachment,
39908        dest: data.dest,
39909        url: data.url,
39910        unsafeUrl: data.unsafeUrl,
39911        newWindow: data.newWindow,
39912        setOCGState: data.setOCGState,
39913        title: typeof title === "string" ? stringToPDFString(title) : "",
39914        color: rgbColor,
39915        count: Number.isInteger(count) ? count : undefined,
39916        bold: !!(flags & 2),
39917        italic: !!(flags & 1),
39918        items: []
39919      };
39920      if (options.keepRawDict) {
39921        outlineItem.rawDict = outlineDict;
39922      }
39923      i.parent.items.push(outlineItem);
39924      obj = outlineDict.getRaw("First");
39925      if (obj instanceof Ref && !processed.has(obj)) {
39926        queue.push({
39927          obj,
39928          parent: outlineItem
39929        });
39930        processed.put(obj);
39931      }
39932      obj = outlineDict.getRaw("Next");
39933      if (obj instanceof Ref && !processed.has(obj)) {
39934        queue.push({
39935          obj,
39936          parent: i.parent
39937        });
39938        processed.put(obj);
39939      }
39940    }
39941    return root.items.length > 0 ? root.items : null;
39942  }
39943  get documentOutlineForEditor() {
39944    let obj = null;
39945    try {
39946      obj = this.#readDocumentOutline({
39947        keepRawDict: true
39948      });
39949    } catch (ex) {
39950      if (ex instanceof MissingDataException) {
39951        throw ex;
39952      }
39953      warn("Unable to read document outline.");
39954    }
39955    return shadow(this, "documentOutlineForEditor", obj);
39956  }
39957  get permissions() {
39958    let permissions = null;
39959    try {
39960      permissions = this.#readPermissions();
39961    } catch (ex) {
39962      if (ex instanceof MissingDataException) {
39963        throw ex;
39964      }
39965      warn("Unable to read permissions.");
39966    }
39967    return shadow(this, "permissions", permissions);
39968  }
39969  #readPermissions() {
39970    const encrypt = this.xref.trailer.get("Encrypt");
39971    if (!(encrypt instanceof Dict)) {
39972      return null;
39973    }
39974    let flags = encrypt.get("P");
39975    if (typeof flags !== "number") {
39976      return null;
39977    }
39978    flags += 2 ** 32;
39979    const permissions = [];
39980    for (const key in PermissionFlag) {
39981      const value = PermissionFlag[key];
39982      if (flags & value) {
39983        permissions.push(value);
39984      }
39985    }
39986    return permissions;
39987  }
39988  get optionalContentConfig() {
39989    let config = null;
39990    try {
39991      const properties = this.#catDict.get("OCProperties");
39992      if (!properties) {
39993        return shadow(this, "optionalContentConfig", null);
39994      }
39995      const defaultConfig = properties.get("D");
39996      if (!defaultConfig) {
39997        return shadow(this, "optionalContentConfig", null);
39998      }
39999      const groupsData = properties.get("OCGs");
40000      if (!Array.isArray(groupsData)) {
40001        return shadow(this, "optionalContentConfig", null);
40002      }
40003      const groupRefCache = new RefSetCache();
40004      for (const groupRef of groupsData) {
40005        if (!(groupRef instanceof Ref) || groupRefCache.has(groupRef)) {
40006          continue;
40007        }
40008        groupRefCache.put(groupRef, this.#readOptionalContentGroup(groupRef));
40009      }
40010      config = this.#readOptionalContentConfig(defaultConfig, groupRefCache);
40011    } catch (ex) {
40012      if (ex instanceof MissingDataException) {
40013        throw ex;
40014      }
40015      warn(`Unable to read optional content config: ${ex}`);
40016    }
40017    return shadow(this, "optionalContentConfig", config);
40018  }
40019  #readOptionalContentGroup(groupRef) {
40020    const group = this.xref.fetch(groupRef);
40021    const obj = {
40022      id: groupRef.toString(),
40023      name: null,
40024      intent: null,
40025      usage: {
40026        print: null,
40027        view: null
40028      },
40029      rbGroups: []
40030    };
40031    const name = group.get("Name");
40032    if (typeof name === "string") {
40033      obj.name = stringToPDFString(name);
40034    }
40035    let intent = group.getArray("Intent");
40036    if (!Array.isArray(intent)) {
40037      intent = [intent];
40038    }
40039    if (intent.every(i => i instanceof Name)) {
40040      obj.intent = intent.map(i => i.name);
40041    }
40042    const usage = group.get("Usage");
40043    if (!(usage instanceof Dict)) {
40044      return obj;
40045    }
40046    const usageObj = obj.usage;
40047    const print = usage.get("Print");
40048    if (print instanceof Dict) {
40049      const printState = print.get("PrintState");
40050      if (printState instanceof Name) {
40051        switch (printState.name) {
40052          case "ON":
40053          case "OFF":
40054            usageObj.print = {
40055              printState: printState.name
40056            };
40057        }
40058      }
40059    }
40060    const view = usage.get("View");
40061    if (view instanceof Dict) {
40062      const viewState = view.get("ViewState");
40063      if (viewState instanceof Name) {
40064        switch (viewState.name) {
40065          case "ON":
40066          case "OFF":
40067            usageObj.view = {
40068              viewState: viewState.name
40069            };
40070        }
40071      }
40072    }
40073    return obj;
40074  }
40075  #readOptionalContentConfig(config, groupRefCache) {
40076    function parseOnOff(refs) {
40077      const onParsed = [];
40078      if (Array.isArray(refs)) {
40079        for (const value of refs) {
40080          if (value instanceof Ref && groupRefCache.has(value)) {
40081            onParsed.push(value.toString());
40082          }
40083        }
40084      }
40085      return onParsed;
40086    }
40087    function parseOrder(refs, nestedLevels = 0) {
40088      if (!Array.isArray(refs)) {
40089        return null;
40090      }
40091      const order = [];
40092      for (const value of refs) {
40093        if (value instanceof Ref && groupRefCache.has(value)) {
40094          parsedOrderRefs.put(value);
40095          order.push(value.toString());
40096          continue;
40097        }
40098        const nestedOrder = parseNestedOrder(value, nestedLevels);
40099        if (nestedOrder) {
40100          order.push(nestedOrder);
40101        }
40102      }
40103      if (nestedLevels > 0) {
40104        return order;
40105      }
40106      const hiddenGroups = [];
40107      for (const [groupRef] of groupRefCache.items()) {
40108        if (parsedOrderRefs.has(groupRef)) {
40109          continue;
40110        }
40111        hiddenGroups.push(groupRef.toString());
40112      }
40113      if (hiddenGroups.length) {
40114        order.push({
40115          name: null,
40116          order: hiddenGroups
40117        });
40118      }
40119      return order;
40120    }
40121    function parseNestedOrder(ref, nestedLevels) {
40122      if (++nestedLevels > MAX_NESTED_LEVELS) {
40123        warn("parseNestedOrder - reached MAX_NESTED_LEVELS.");
40124        return null;
40125      }
40126      const value = xref.fetchIfRef(ref);
40127      if (!Array.isArray(value)) {
40128        return null;
40129      }
40130      const nestedName = xref.fetchIfRef(value[0]);
40131      if (typeof nestedName !== "string") {
40132        return null;
40133      }
40134      const nestedOrder = parseOrder(value.slice(1), nestedLevels);
40135      if (!nestedOrder?.length) {
40136        return null;
40137      }
40138      return {
40139        name: stringToPDFString(nestedName),
40140        order: nestedOrder
40141      };
40142    }
40143    function parseRBGroups(rbGroups) {
40144      if (!Array.isArray(rbGroups)) {
40145        return;
40146      }
40147      for (const value of rbGroups) {
40148        const rbGroup = xref.fetchIfRef(value);
40149        if (!Array.isArray(rbGroup) || !rbGroup.length) {
40150          continue;
40151        }
40152        const parsedRbGroup = new Set();
40153        for (const ref of rbGroup) {
40154          if (ref instanceof Ref && groupRefCache.has(ref) && !parsedRbGroup.has(ref.toString())) {
40155            parsedRbGroup.add(ref.toString());
40156            groupRefCache.get(ref).rbGroups.push(parsedRbGroup);
40157          }
40158        }
40159      }
40160    }
40161    const xref = this.xref,
40162      parsedOrderRefs = new RefSet(),
40163      MAX_NESTED_LEVELS = 10;
40164    parseRBGroups(config.get("RBGroups"));
40165    return {
40166      name: typeof config.get("Name") === "string" ? stringToPDFString(config.get("Name")) : null,
40167      creator: typeof config.get("Creator") === "string" ? stringToPDFString(config.get("Creator")) : null,
40168      baseState: config.get("BaseState") instanceof Name ? config.get("BaseState").name : null,
40169      on: parseOnOff(config.get("ON")),
40170      off: parseOnOff(config.get("OFF")),
40171      order: parseOrder(config.get("Order")),
40172      groups: [...groupRefCache]
40173    };
40174  }
40175  setActualNumPages(num = null) {
40176    this.#actualNumPages = num;
40177  }
40178  get hasActualNumPages() {
40179    return this.#actualNumPages !== null;
40180  }
40181  get _pagesCount() {
40182    const obj = this.toplevelPagesDict.get("Count");
40183    if (!Number.isInteger(obj)) {
40184      throw new FormatError("Page count in top-level pages dictionary is not an integer.");
40185    }
40186    return shadow(this, "_pagesCount", obj);
40187  }
40188  get numPages() {
40189    return this.#actualNumPages ?? this._pagesCount;
40190  }
40191  get destinations() {
40192    const rawDests = this.#readDests(),
40193      dests = Object.create(null);
40194    for (const obj of rawDests) {
40195      if (obj instanceof NameTree) {
40196        for (const [key, value] of obj.getAll()) {
40197          const dest = fetchDest(value);
40198          if (dest) {
40199            dests[stringToPDFString(key, true)] = dest;
40200          }
40201        }
40202      } else if (obj instanceof Dict) {
40203        for (const [key, value] of obj) {
40204          const dest = fetchDest(value);
40205          if (dest) {
40206            dests[stringToPDFString(key, true)] ||= dest;
40207          }
40208        }
40209      }
40210    }
40211    return shadow(this, "destinations", dests);
40212  }
40213  getDestination(id) {
40214    if (Object.hasOwn(this, "destinations")) {
40215      return this.destinations[id] ?? null;
40216    }
40217    const rawDests = this.#readDests();
40218    for (const obj of rawDests) {
40219      if (obj instanceof NameTree || obj instanceof Dict) {
40220        const dest = fetchDest(obj.get(id));
40221        if (dest) {
40222          return dest;
40223        }
40224      }
40225    }
40226    if (rawDests.length) {
40227      const dest = this.destinations[id];
40228      if (dest) {
40229        return dest;
40230      }
40231    }
40232    return null;
40233  }
40234  #readDests() {
40235    const obj = this.#catDict.get("Names");
40236    const rawDests = [];
40237    if (obj?.has("Dests")) {
40238      rawDests.push(new NameTree(obj.getRaw("Dests"), this.xref));
40239    }
40240    if (this.#catDict.has("Dests")) {
40241      rawDests.push(this.#catDict.get("Dests"));
40242    }
40243    return rawDests;
40244  }
40245  get rawPageLabels() {
40246    const obj = this.#catDict.getRaw("PageLabels");
40247    if (!obj) {
40248      return null;
40249    }
40250    const numberTree = new NumberTree(obj, this.xref);
40251    return numberTree.getAll();
40252  }
40253  get pageLabels() {
40254    let obj = null;
40255    try {
40256      obj = this.#readPageLabels();
40257    } catch (ex) {
40258      if (ex instanceof MissingDataException) {
40259        throw ex;
40260      }
40261      warn("Unable to read page labels.");
40262    }
40263    return shadow(this, "pageLabels", obj);
40264  }
40265  #readPageLabels() {
40266    const nums = this.rawPageLabels;
40267    if (!nums) {
40268      return null;
40269    }
40270    const pageLabels = new Array(this.numPages);
40271    let style = null,
40272      prefix = "";
40273    let currentLabel = "",
40274      currentIndex = 1;
40275    for (let i = 0, ii = this.numPages; i < ii; i++) {
40276      const labelDict = nums.get(i);
40277      if (labelDict !== undefined) {
40278        if (!(labelDict instanceof Dict)) {
40279          throw new FormatError("PageLabel is not a dictionary.");
40280        }
40281        if (labelDict.has("Type") && !isName(labelDict.get("Type"), "PageLabel")) {
40282          throw new FormatError("Invalid type in PageLabel dictionary.");
40283        }
40284        if (labelDict.has("S")) {
40285          const s = labelDict.get("S");
40286          if (!(s instanceof Name)) {
40287            throw new FormatError("Invalid style in PageLabel dictionary.");
40288          }
40289          style = s.name;
40290        } else {
40291          style = null;
40292        }
40293        if (labelDict.has("P")) {
40294          const p = labelDict.get("P");
40295          if (typeof p !== "string") {
40296            throw new FormatError("Invalid prefix in PageLabel dictionary.");
40297          }
40298          prefix = stringToPDFString(p);
40299        } else {
40300          prefix = "";
40301        }
40302        if (labelDict.has("St")) {
40303          const st = labelDict.get("St");
40304          if (!(Number.isInteger(st) && st >= 1)) {
40305            throw new FormatError("Invalid start in PageLabel dictionary.");
40306          }
40307          currentIndex = st;
40308        } else {
40309          currentIndex = 1;
40310        }
40311      }
40312      switch (style) {
40313        case "D":
40314          currentLabel = currentIndex;
40315          break;
40316        case "R":
40317        case "r":
40318          currentLabel = toRomanNumerals(currentIndex, style === "r");
40319          break;
40320        case "A":
40321        case "a":
40322          const LIMIT = 26;
40323          const A_UPPER_CASE = 0x41,
40324            A_LOWER_CASE = 0x61;
40325          const baseCharCode = style === "a" ? A_LOWER_CASE : A_UPPER_CASE;
40326          const letterIndex = currentIndex - 1;
40327          const character = String.fromCharCode(baseCharCode + letterIndex % LIMIT);
40328          currentLabel = character.repeat(Math.floor(letterIndex / LIMIT) + 1);
40329          break;
40330        default:
40331          if (style) {
40332            throw new FormatError(`Invalid style "${style}" in PageLabel dictionary.`);
40333          }
40334          currentLabel = "";
40335      }
40336      pageLabels[i] = prefix + currentLabel;
40337      currentIndex++;
40338    }
40339    return pageLabels;
40340  }
40341  get pageLayout() {
40342    const obj = this.#catDict.get("PageLayout");
40343    let pageLayout = "";
40344    if (obj instanceof Name) {
40345      switch (obj.name) {
40346        case "SinglePage":
40347        case "OneColumn":
40348        case "TwoColumnLeft":
40349        case "TwoColumnRight":
40350        case "TwoPageLeft":
40351        case "TwoPageRight":
40352          pageLayout = obj.name;
40353      }
40354    }
40355    return shadow(this, "pageLayout", pageLayout);
40356  }
40357  get pageMode() {
40358    const obj = this.#catDict.get("PageMode");
40359    let pageMode = "UseNone";
40360    if (obj instanceof Name) {
40361      switch (obj.name) {
40362        case "UseNone":
40363        case "UseOutlines":
40364        case "UseThumbs":
40365        case "FullScreen":
40366        case "UseOC":
40367        case "UseAttachments":
40368          pageMode = obj.name;
40369      }
40370    }
40371    return shadow(this, "pageMode", pageMode);
40372  }
40373  get viewerPreferences() {
40374    const obj = this.#catDict.get("ViewerPreferences");
40375    if (!(obj instanceof Dict)) {
40376      return shadow(this, "viewerPreferences", null);
40377    }
40378    let prefs = null;
40379    for (const [key, value] of obj) {
40380      let prefValue;
40381      switch (key) {
40382        case "HideToolbar":
40383        case "HideMenubar":
40384        case "HideWindowUI":
40385        case "FitWindow":
40386        case "CenterWindow":
40387        case "DisplayDocTitle":
40388        case "PickTrayByPDFSize":
40389          if (typeof value === "boolean") {
40390            prefValue = value;
40391          }
40392          break;
40393        case "NonFullScreenPageMode":
40394          if (value instanceof Name) {
40395            switch (value.name) {
40396              case "UseNone":
40397              case "UseOutlines":
40398              case "UseThumbs":
40399              case "UseOC":
40400                prefValue = value.name;
40401                break;
40402              default:
40403                prefValue = "UseNone";
40404            }
40405          }
40406          break;
40407        case "Direction":
40408          if (value instanceof Name) {
40409            switch (value.name) {
40410              case "L2R":
40411              case "R2L":
40412                prefValue = value.name;
40413                break;
40414              default:
40415                prefValue = "L2R";
40416            }
40417          }
40418          break;
40419        case "ViewArea":
40420        case "ViewClip":
40421        case "PrintArea":
40422        case "PrintClip":
40423          if (value instanceof Name) {
40424            switch (value.name) {
40425              case "MediaBox":
40426              case "CropBox":
40427              case "BleedBox":
40428              case "TrimBox":
40429              case "ArtBox":
40430                prefValue = value.name;
40431                break;
40432              default:
40433                prefValue = "CropBox";
40434            }
40435          }
40436          break;
40437        case "PrintScaling":
40438          if (value instanceof Name) {
40439            switch (value.name) {
40440              case "None":
40441              case "AppDefault":
40442                prefValue = value.name;
40443                break;
40444              default:
40445                prefValue = "AppDefault";
40446            }
40447          }
40448          break;
40449        case "Duplex":
40450          if (value instanceof Name) {
40451            switch (value.name) {
40452              case "Simplex":
40453              case "DuplexFlipShortEdge":
40454              case "DuplexFlipLongEdge":
40455                prefValue = value.name;
40456                break;
40457              default:
40458                prefValue = "None";
40459            }
40460          }
40461          break;
40462        case "PrintPageRange":
40463          if (Array.isArray(value) && value.length % 2 === 0) {
40464            const isValid = value.every((page, i, arr) => Number.isInteger(page) && page > 0 && (i === 0 || page >= arr[i - 1]) && page <= this.numPages);
40465            if (isValid) {
40466              prefValue = value;
40467            }
40468          }
40469          break;
40470        case "NumCopies":
40471          if (Number.isInteger(value) && value > 0) {
40472            prefValue = value;
40473          }
40474          break;
40475        default:
40476          warn(`Ignoring non-standard key in ViewerPreferences: ${key}.`);
40477          continue;
40478      }
40479      if (prefValue === undefined) {
40480        warn(`Bad value, for key "${key}", in ViewerPreferences: ${value}.`);
40481        continue;
40482      }
40483      prefs ??= Object.create(null);
40484      prefs[key] = prefValue;
40485    }
40486    return shadow(this, "viewerPreferences", prefs);
40487  }
40488  get openAction() {
40489    const obj = this.#catDict.get("OpenAction");
40490    const openAction = Object.create(null);
40491    if (obj instanceof Dict) {
40492      const destDict = new Dict(this.xref);
40493      destDict.set("A", obj);
40494      const resultObj = {
40495        url: null,
40496        dest: null,
40497        action: null
40498      };
40499      Catalog.parseDestDictionary({
40500        destDict,
40501        resultObj
40502      });
40503      if (Array.isArray(resultObj.dest)) {
40504        openAction.dest = resultObj.dest;
40505      } else if (resultObj.action) {
40506        openAction.action = resultObj.action;
40507      }
40508    } else if (isValidExplicitDest(obj)) {
40509      openAction.dest = obj;
40510    }
40511    return shadow(this, "openAction", objectSize(openAction) > 0 ? openAction : null);
40512  }
40513  get attachments() {
40514    const obj = this.#catDict.get("Names");
40515    let attachments = null;
40516    if (obj instanceof Dict && obj.has("EmbeddedFiles")) {
40517      const nameTree = new NameTree(obj.getRaw("EmbeddedFiles"), this.xref);
40518      for (const [key, value] of nameTree.getAll()) {
40519        const fs = new FileSpec(value);
40520        attachments ??= Object.create(null);
40521        attachments[stringToPDFString(key, true)] = fs.serializable;
40522      }
40523    }
40524    return shadow(this, "attachments", attachments);
40525  }
40526  get rawEmbeddedFiles() {
40527    const obj = this.#catDict.get("Names");
40528    if (!(obj instanceof Dict) || !obj.has("EmbeddedFiles")) {
40529      return null;
40530    }
40531    const nameTree = new NameTree(obj.getRaw("EmbeddedFiles"), this.xref);
40532    return nameTree.getAll(true
vendor: 11,484 bytes, lines 40532-40893
40532);
40533  }
40534  get xfaImages() {
40535    const obj = this.#catDict.get("Names");
40536    let xfaImages = null;
40537    if (obj instanceof Dict && obj.has("XFAImages")) {
40538      const nameTree = new NameTree(obj.getRaw("XFAImages"), this.xref);
40539      for (const [key, value] of nameTree.getAll()) {
40540        if (value instanceof BaseStream) {
40541          xfaImages ??= new Map();
40542          xfaImages.set(stringToPDFString(key, true), value.getBytes());
40543        }
40544      }
40545    }
40546    return shadow(this, "xfaImages", xfaImages);
40547  }
40548  #collectJavaScript() {
40549    const obj = this.#catDict.get("Names");
40550    let javaScript = null;
40551    function appendIfJavaScriptDict(name, jsDict) {
40552      if (!(jsDict instanceof Dict)) {
40553        return;
40554      }
40555      if (!isName(jsDict.get("S"), "JavaScript")) {
40556        return;
40557      }
40558      let js = jsDict.get("JS");
40559      if (js instanceof BaseStream) {
40560        js = js.getString();
40561      } else if (typeof js !== "string") {
40562        return;
40563      }
40564      js = stringToPDFString(js, true).replaceAll("\x00", "");
40565      if (js) {
40566        (javaScript ||= new Map()).set(name, js);
40567      }
40568    }
40569    if (obj instanceof Dict && obj.has("JavaScript")) {
40570      const nameTree = new NameTree(obj.getRaw("JavaScript"), this.xref);
40571      for (const [key, value] of nameTree.getAll()) {
40572        appendIfJavaScriptDict(stringToPDFString(key, true), value);
40573      }
40574    }
40575    const openAction = this.#catDict.get("OpenAction");
40576    if (openAction) {
40577      appendIfJavaScriptDict("OpenAction", openAction);
40578    }
40579    return javaScript;
40580  }
40581  get jsActions() {
40582    const javaScript = this.#collectJavaScript();
40583    let actions = collectActions(this.xref, this.#catDict, DocumentActionEventType);
40584    if (javaScript) {
40585      actions ||= Object.create(null);
40586      for (const [key, val] of javaScript) {
40587        if (key in actions) {
40588          actions[key].push(val);
40589        } else {
40590          actions[key] = [val];
40591        }
40592      }
40593    }
40594    return shadow(this, "jsActions", actions);
40595  }
40596  async cleanup(manuallyTriggered = false) {
40597    clearGlobalCaches();
40598    this.globalColorSpaceCache.clear();
40599    this.globalImageCache.clear(manuallyTriggered);
40600    this.pageKidsCountCache.clear();
40601    this.pageIndexCache.clear();
40602    this.pageDictCache.clear();
40603    this.nonBlendModesSet.clear();
40604    for (const {
40605      dict
40606    } of await Promise.all(this.fontCache)) {
40607      delete dict.cacheKey;
40608    }
40609    this.fontCache.clear();
40610    this.builtInCMapCache.clear();
40611    this.standardFontDataCache.clear();
40612    this.systemFontCache.clear();
40613  }
40614  async getPageDict(pageIndex) {
40615    const nodesToVisit = [this.toplevelPagesDict];
40616    const visitedNodes = new RefSet();
40617    const pagesRef = this.#catDict.getRaw("Pages");
40618    if (pagesRef instanceof Ref) {
40619      visitedNodes.put(pagesRef);
40620    }
40621    const xref = this.xref,
40622      pageKidsCountCache = this.pageKidsCountCache,
40623      pageIndexCache = this.pageIndexCache,
40624      pageDictCache = this.pageDictCache;
40625    let currentPageIndex = 0;
40626    while (nodesToVisit.length) {
40627      const currentNode = nodesToVisit.pop();
40628      if (currentNode instanceof Ref) {
40629        const count = pageKidsCountCache.get(currentNode);
40630        if (count >= 0 && currentPageIndex + count <= pageIndex) {
40631          currentPageIndex += count;
40632          continue;
40633        }
40634        if (visitedNodes.has(currentNode)) {
40635          throw new FormatError("Pages tree contains circular reference.");
40636        }
40637        visitedNodes.put(currentNode);
40638        const obj = await (pageDictCache.get(currentNode) || xref.fetchAsync(currentNode));
40639        if (obj instanceof Dict) {
40640          let type = obj.getRaw("Type");
40641          if (type instanceof Ref) {
40642            type = await xref.fetchAsync(type);
40643          }
40644          if (isName(type, "Page") || !obj.has("Kids")) {
40645            if (!pageKidsCountCache.has(currentNode)) {
40646              pageKidsCountCache.put(currentNode, 1);
40647            }
40648            if (!pageIndexCache.has(currentNode)) {
40649              pageIndexCache.put(currentNode, currentPageIndex);
40650            }
40651            if (currentPageIndex === pageIndex) {
40652              return [obj, currentNode];
40653            }
40654            currentPageIndex++;
40655            continue;
40656          }
40657        }
40658        nodesToVisit.push(obj);
40659        continue;
40660      }
40661      if (!(currentNode instanceof Dict)) {
40662        throw new FormatError("Page dictionary kid reference points to wrong type of object.");
40663      }
40664      const {
40665        objId
40666      } = currentNode;
40667      let count = currentNode.getRaw("Count");
40668      if (count instanceof Ref) {
40669        count = await xref.fetchAsync(count);
40670      }
40671      if (Number.isInteger(count) && count >= 0) {
40672        if (objId && !pageKidsCountCache.has(objId)) {
40673          pageKidsCountCache.put(objId, count);
40674        }
40675        if (currentPageIndex + count <= pageIndex) {
40676          currentPageIndex += count;
40677          continue;
40678        }
40679      }
40680      let kids = currentNode.getRaw("Kids");
40681      if (kids instanceof Ref) {
40682        kids = await xref.fetchAsync(kids);
40683      }
40684      if (!Array.isArray(kids)) {
40685        let type = currentNode.getRaw("Type");
40686        if (type instanceof Ref) {
40687          type = await xref.fetchAsync(type);
40688        }
40689        if (isName(type, "Page") || !currentNode.has("Kids")) {
40690          if (currentPageIndex === pageIndex) {
40691            return [currentNode, null];
40692          }
40693          currentPageIndex++;
40694          continue;
40695        }
40696        throw new FormatError("Page dictionary kids object is not an array.");
40697      }
40698      for (let last = kids.length - 1; last >= 0; last--) {
40699        const lastKid = kids[last];
40700        nodesToVisit.push(lastKid);
40701        if (currentNode === this.toplevelPagesDict && lastKid instanceof Ref && !pageDictCache.has(lastKid)) {
40702          pageDictCache.put(lastKid, xref.fetchAsync(lastKid));
40703        }
40704      }
40705    }
40706    throw new Error(`Page index ${pageIndex} not found.`);
40707  }
40708  async getAllPageDicts(recoveryMode = false) {
40709    const {
40710      ignoreErrors
40711    } = this.pdfManager.evaluatorOptions;
40712    const queue = [{
40713      currentNode: this.toplevelPagesDict,
40714      posInKids: 0
40715    }];
40716    const visitedNodes = new RefSet();
40717    const pagesRef = this.#catDict.getRaw("Pages");
40718    if (pagesRef instanceof Ref) {
40719      visitedNodes.put(pagesRef);
40720    }
40721    const map = new Map(),
40722      xref = this.xref,
40723      pageIndexCache = this.pageIndexCache;
40724    let pageIndex = 0;
40725    function addPageDict(pageDict, pageRef) {
40726      if (pageRef && !pageIndexCache.has(pageRef)) {
40727        pageIndexCache.put(pageRef, pageIndex);
40728      }
40729      map.set(pageIndex++, [pageDict, pageRef]);
40730    }
40731    function addPageError(error) {
40732      if (error instanceof XRefEntryException && !recoveryMode) {
40733        throw error;
40734      }
40735      if (recoveryMode && ignoreErrors && pageIndex === 0) {
40736        warn(`getAllPageDicts - Skipping invalid first page: "${error}".`);
40737        error = Dict.empty;
40738      }
40739      map.set(pageIndex++, [error, null]);
40740    }
40741    while (queue.length > 0) {
40742      const queueItem = queue.at(-1);
40743      const {
40744        currentNode,
40745        posInKids
40746      } = queueItem;
40747      let kids = currentNode.getRaw("Kids");
40748      if (kids instanceof Ref) {
40749        try {
40750          kids = await xref.fetchAsync(kids);
40751        } catch (ex) {
40752          addPageError(ex);
40753          break;
40754        }
40755      }
40756      if (!Array.isArray(kids)) {
40757        addPageError(new FormatError("Page dictionary kids object is not an array."));
40758        break;
40759      }
40760      if (posInKids >= kids.length) {
40761        queue.pop();
40762        continue;
40763      }
40764      const kidObj = kids[posInKids];
40765      let obj;
40766      if (kidObj instanceof Ref) {
40767        if (visitedNodes.has(kidObj)) {
40768          addPageError(new FormatError("Pages tree contains circular reference."));
40769          break;
40770        }
40771        visitedNodes.put(kidObj);
40772        try {
40773          obj = await xref.fetchAsync(kidObj);
40774        } catch (ex) {
40775          addPageError(ex);
40776          break;
40777        }
40778      } else {
40779        obj = kidObj;
40780      }
40781      if (!(obj instanceof Dict)) {
40782        addPageError(new FormatError("Page dictionary kid reference points to wrong type of object."));
40783        break;
40784      }
40785      let type = obj.getRaw("Type");
40786      if (type instanceof Ref) {
40787        try {
40788          type = await xref.fetchAsync(type);
40789        } catch (ex) {
40790          addPageError(ex);
40791          break;
40792        }
40793      }
40794      if (isName(type, "Page") || !obj.has("Kids")) {
40795        addPageDict(obj, kidObj instanceof Ref ? kidObj : null);
40796      } else {
40797        queue.push({
40798          currentNode: obj,
40799          posInKids: 0
40800        });
40801      }
40802      queueItem.posInKids++;
40803    }
40804    return map;
40805  }
40806  getPageIndex(pageRef) {
40807    const cachedPageIndex = this.pageIndexCache.get(pageRef);
40808    if (cachedPageIndex !== undefined) {
40809      return Promise.resolve(cachedPageIndex);
40810    }
40811    const xref = this.xref;
40812    function pagesBeforeRef(kidRef) {
40813      let total = 0,
40814        parentRef;
40815      return xref.fetchAsync(kidRef).then(function (node) {
40816        if (isRefsEqual(kidRef, pageRef) && !isDict(node, "Page") && !(node instanceof Dict && !node.has("Type") && node.has("Contents"))) {
40817          throw new FormatError("The reference does not point to a /Page dictionary.");
40818        }
40819        if (!node) {
40820          return null;
40821        }
40822        if (!(node instanceof Dict)) {
40823          throw new FormatError("Node must be a dictionary.");
40824        }
40825        parentRef = node.getRaw("Parent");
40826        return node.getAsync("Parent");
40827      }).then(function (parent) {
40828        if (!parent) {
40829          return null;
40830        }
40831        if (!(parent instanceof Dict)) {
40832          throw new FormatError("Parent must be a dictionary.");
40833        }
40834        return parent.getAsync("Kids");
40835      }).then(function (kids) {
40836        if (!kids) {
40837          return null;
40838        }
40839        const kidPromises = [];
40840        let found = false;
40841        for (const kid of kids) {
40842          if (!(kid instanceof Ref)) {
40843            throw new FormatError("Kid must be a reference.");
40844          }
40845          if (isRefsEqual(kid, kidRef)) {
40846            found = true;
40847            break;
40848          }
40849          kidPromises.push(xref.fetchAsync(kid).then(function (obj) {
40850            if (!(obj instanceof Dict)) {
40851              throw new FormatError("Kid node must be a dictionary.");
40852            }
40853            if (obj.has("Count")) {
40854              total += obj.get("Count");
40855            } else {
40856              total++;
40857            }
40858          }));
40859        }
40860        if (!found) {
40861          throw new FormatError("Kid reference not found in parent's kids.");
40862        }
40863        return Promise.all(kidPromises).then(() => [total, parentRef]);
40864      });
40865    }
40866    let total = 0;
40867    const next = ref => pagesBeforeRef(ref).then(args => {
40868      if (!args) {
40869        this.pageIndexCache.put(pageRef, total);
40870        return total;
40871      }
40872      const [count, parentRef] = args;
40873      total += count;
40874      return next(parentRef);
40875    });
40876    return next(pageRef);
40877  }
40878  get baseUrl() {
40879    const uri = this.#catDict.get("URI");
40880    if (uri instanceof Dict) {
40881      const base = uri.get("Base");
40882      if (typeof base === "string") {
40883        const absoluteUrl = createValidAbsoluteUrl(base, null, {
40884          tryConvertEncoding: true
40885        });
40886        if (absoluteUrl) {
40887          return shadow(this, "baseUrl", absoluteUrl.href);
40888        }
40889      }
40890    }
40891    return shadow(this, "baseUrl", this.pdfManager.docBaseUrl);
40892  }
40893  static 
vendor: 14,418 bytes, lines 40893-41395
40893#getDestFromStructElement(xref, seRef) {
40894    const seDict = xref.fetchIfRef(seRef);
40895    if (!(seDict instanceof Dict)) {
40896      return null;
40897    }
40898    let pageRef = null;
40899    const directPg = seDict.getRaw("Pg");
40900    if (directPg instanceof Ref) {
40901      pageRef = directPg;
40902    }
40903    if (!pageRef) {
40904      const queue = [seDict];
40905      while (queue.length > 0 && !pageRef) {
40906        const node = queue.shift();
40907        const kids = node.get("K");
40908        let kidsArr;
40909        if (Array.isArray(kids)) {
40910          kidsArr = kids;
40911        } else if (kids) {
40912          kidsArr = [kids];
40913        } else {
40914          continue;
40915        }
40916        for (const kid of kidsArr) {
40917          const kidObj = xref.fetchIfRef(kid);
40918          if (!(kidObj instanceof Dict)) {
40919            continue;
40920          }
40921          const pg = kidObj.getRaw("Pg");
40922          if (pg instanceof Ref) {
40923            pageRef = pg;
40924            break;
40925          }
40926          queue.push(kidObj);
40927        }
40928      }
40929    }
40930    if (!pageRef) {
40931      const MAX_DEPTH = 40;
40932      let current = seDict;
40933      for (let depth = 0; depth < MAX_DEPTH; depth++) {
40934        const parentRaw = current.getRaw("P");
40935        if (!(parentRaw instanceof Ref)) {
40936          break;
40937        }
40938        const parentDict = xref.fetch(parentRaw);
40939        if (!(parentDict instanceof Dict)) {
40940          break;
40941        }
40942        if (isName(parentDict.get("Type"), "StructTreeRoot")) {
40943          break;
40944        }
40945        const pg = parentDict.getRaw("Pg");
40946        if (pg instanceof Ref) {
40947          pageRef = pg;
40948          break;
40949        }
40950        current = parentDict;
40951      }
40952    }
40953    if (!pageRef) {
40954      return null;
40955    }
40956    let x = null,
40957      y = null;
40958    const attrs = seDict.get("A");
40959    if (attrs instanceof Dict) {
40960      const bbox = lookupRect(attrs.getArray("BBox"), null);
40961      if (bbox) {
40962        x = bbox[0];
40963        y = bbox[3];
40964      }
40965    }
40966    return [pageRef, {
40967      name: "XYZ"
40968    }, x, y, null];
40969  }
40970  static parseDestDictionary({
40971    destDict,
40972    resultObj,
40973    docBaseUrl = null,
40974    docAttachments = null
40975  }) {
40976    if (!(destDict instanceof Dict)) {
40977      warn("parseDestDictionary: `destDict` must be a dictionary.");
40978      return;
40979    }
40980    let action = destDict.get("A"),
40981      url,
40982      dest;
40983    if (!(action instanceof Dict)) {
40984      if (destDict.has("Dest")) {
40985        action = destDict.get("Dest");
40986      } else {
40987        action = destDict.get("AA");
40988        if (action instanceof Dict) {
40989          if (action.has("D")) {
40990            action = action.get("D");
40991          } else if (action.has("U")) {
40992            action = action.get("U");
40993          }
40994        }
40995      }
40996    }
40997    if (action instanceof Dict) {
40998      const actionType = action.get("S");
40999      if (!(actionType instanceof Name)) {
41000        warn("parseDestDictionary: Invalid type in Action dictionary.");
41001        return;
41002      }
41003      const actionName = actionType.name;
41004      switch (actionName) {
41005        case "ResetForm":
41006          const flags = action.get("Flags");
41007          const include = ((typeof flags === "number" ? flags : 0) & 1) === 0;
41008          const fields = [];
41009          const refs = [];
41010          for (const obj of action.get("Fields") || []) {
41011            if (obj instanceof Ref) {
41012              refs.push(obj.toString());
41013            } else if (typeof obj === "string") {
41014              fields.push(stringToPDFString(obj));
41015            }
41016          }
41017          resultObj.resetForm = {
41018            fields,
41019            refs,
41020            include
41021          };
41022          break;
41023        case "URI":
41024          url = action.get("URI");
41025          if (url instanceof Name) {
41026            url = "/" + url.name;
41027          }
41028          break;
41029        case "GoTo":
41030          dest = action.get("D");
41031          break;
41032        case "Launch":
41033        case "GoToR":
41034          const urlDict = action.get("F");
41035          if (urlDict instanceof Dict) {
41036            const fs = new FileSpec(urlDict, true);
41037            ({
41038              rawFilename: url
41039            } = fs.serializable);
41040          } else if (typeof urlDict === "string") {
41041            url = urlDict;
41042          } else {
41043            break;
41044          }
41045          const remoteDest = fetchRemoteDest(action);
41046          if (remoteDest) {
41047            url = url.split("#", 1)[0] + "#" + remoteDest;
41048          }
41049          const newWindow = action.get("NewWindow");
41050          if (typeof newWindow === "boolean") {
41051            resultObj.newWindow = newWindow;
41052          }
41053          break;
41054        case "GoToE":
41055          const target = action.get("T");
41056          let attachment;
41057          if (docAttachments && target instanceof Dict) {
41058            const relationship = target.get("R");
41059            const name = target.get("N");
41060            if (isName(relationship, "C") && typeof name === "string") {
41061              attachment = docAttachments[stringToPDFString(name, true)];
41062            }
41063          }
41064          if (attachment) {
41065            resultObj.attachment = attachment;
41066            const attachmentDest = fetchRemoteDest(action);
41067            if (attachmentDest) {
41068              resultObj.attachmentDest = attachmentDest;
41069            }
41070          } else {
41071            warn(`parseDestDictionary - unimplemented "GoToE" action.`);
41072          }
41073          break;
41074        case "Named":
41075          const namedAction = action.get("N");
41076          if (namedAction instanceof Name) {
41077            resultObj.action = namedAction.name;
41078          }
41079          break;
41080        case "SetOCGState":
41081          const state = action.get("State");
41082          const preserveRB = action.get("PreserveRB");
41083          if (!Array.isArray(state) || state.length === 0) {
41084            break;
41085          }
41086          const stateArr = [];
41087          for (const elem of state) {
41088            if (elem instanceof Name) {
41089              switch (elem.name) {
41090                case "ON":
41091                case "OFF":
41092                case "Toggle":
41093                  stateArr.push(elem.name);
41094                  break;
41095              }
41096            } else if (elem instanceof Ref) {
41097              stateArr.push(elem.toString());
41098            }
41099          }
41100          if (stateArr.length !== state.length) {
41101            break;
41102          }
41103          resultObj.setOCGState = {
41104            state: stateArr,
41105            preserveRB: typeof preserveRB === "boolean" ? preserveRB : true
41106          };
41107          break;
41108        case "JavaScript":
41109          const jsAction = action.get("JS");
41110          let js;
41111          if (jsAction instanceof BaseStream) {
41112            js = jsAction.getString();
41113          } else if (typeof jsAction === "string") {
41114            js = jsAction;
41115          }
41116          const jsURL = js && recoverJsURL(stringToPDFString(js, true));
41117          if (jsURL) {
41118            url = jsURL.url;
41119            resultObj.newWindow = jsURL.newWindow;
41120            break;
41121          }
41122        default:
41123          if (actionName === "JavaScript" || actionName === "SubmitForm") {
41124            break;
41125          }
41126          warn(`parseDestDictionary - unsupported action: "${actionName}".`);
41127          break;
41128      }
41129    } else if (destDict.has("Dest")) {
41130      dest = destDict.get("Dest");
41131    }
41132    if (typeof url === "string") {
41133      const absoluteUrl = createValidAbsoluteUrl(url, docBaseUrl, {
41134        addDefaultProtocol: true,
41135        tryConvertEncoding: true
41136      });
41137      if (absoluteUrl) {
41138        resultObj.url = absoluteUrl.href;
41139      }
41140      resultObj.unsafeUrl = url;
41141    }
41142    if (dest) {
41143      if (dest instanceof Name) {
41144        dest = dest.name;
41145      }
41146      if (typeof dest === "string") {
41147        resultObj.dest = stringToPDFString(dest, true);
41148      } else if (isValidExplicitDest(dest)) {
41149        resultObj.dest = dest;
41150      }
41151    }
41152    if (!resultObj.dest && !resultObj.url && !resultObj.action && !resultObj.attachment && !resultObj.setOCGState && !resultObj.resetForm) {
41153      const seRef = destDict.getRaw("SE");
41154      if (seRef instanceof Ref) {
41155        try {
41156          const seDest = Catalog.#getDestFromStructElement(destDict.xref, seRef);
41157          if (seDest) {
41158            resultObj.dest = seDest;
41159          }
41160        } catch (ex) {
41161          if (ex instanceof MissingDataException) {
41162            throw ex;
41163          }
41164          info("SE parsing failed.");
41165        }
41166      }
41167    }
41168  }
41169}
41170
41171;// ./src/core/object_loader.js
41172
41173
41174
41175
41176function mayHaveChildren(value) {
41177  return value instanceof Ref || value instanceof Dict || value instanceof BaseStream || Array.isArray(value);
41178}
41179function addChildren(node, nodesToVisit) {
41180  if (node instanceof Dict) {
41181    node = node.getRawValues();
41182  } else if (node instanceof BaseStream) {
41183    node = node.dict.getRawValues();
41184  } else if (!Array.isArray(node)) {
41185    return;
41186  }
41187  for (const rawValue of node) {
41188    if (mayHaveChildren(rawValue)) {
41189      nodesToVisit.push(rawValue);
41190    }
41191  }
41192}
41193class ObjectLoader {
41194  refSet = new RefSet();
41195  constructor(dict, keys, xref) {
41196    this.dict = dict;
41197    this.keys = keys;
41198    this.xref = xref;
41199  }
41200  async load() {
41201    const {
41202      keys,
41203      dict
41204    } = this;
41205    const nodesToVisit = [];
41206    for (const key of keys) {
41207      const rawValue = dict.getRaw(key);
41208      if (rawValue !== undefined) {
41209        nodesToVisit.push(rawValue);
41210      }
41211    }
41212    await this.#walk(nodesToVisit);
41213    this.refSet = null;
41214  }
41215  async #walk(nodesToVisit) {
41216    const nodesToRevisit = [];
41217    const pendingRequests = [];
41218    while (nodesToVisit.length) {
41219      let currentNode = nodesToVisit.pop();
41220      if (currentNode instanceof Ref) {
41221        if (this.refSet.has(currentNode)) {
41222          continue;
41223        }
41224        try {
41225          this.refSet.put(currentNode);
41226          currentNode = this.xref.fetch(currentNode);
41227        } catch (ex) {
41228          if (!(ex instanceof MissingDataException)) {
41229            warn(`ObjectLoader.#walk - requesting all data: "${ex}".`);
41230            await this.xref.stream.manager.requestAllChunks();
41231            return;
41232          }
41233          nodesToRevisit.push(currentNode);
41234          pendingRequests.push({
41235            begin: ex.begin,
41236            end: ex.end
41237          });
41238        }
41239      }
41240      if (currentNode instanceof BaseStream) {
41241        const baseStreams = currentNode.getBaseStreams();
41242        if (baseStreams) {
41243          let foundMissingData = false;
41244          for (const stream of baseStreams) {
41245            if (stream.isDataLoaded) {
41246              continue;
41247            }
41248            foundMissingData = true;
41249            pendingRequests.push({
41250              begin: stream.start,
41251              end: stream.end
41252            });
41253          }
41254          if (foundMissingData) {
41255            nodesToRevisit.push(currentNode);
41256          }
41257        }
41258      }
41259      addChildren(currentNode, nodesToVisit);
41260    }
41261    if (pendingRequests.length) {
41262      await this.xref.stream.manager.requestRanges(pendingRequests);
41263      for (const node of nodesToRevisit) {
41264        if (node instanceof Ref) {
41265          this.refSet.remove(node);
41266        }
41267      }
41268      await this.#walk(nodesToRevisit);
41269    }
41270  }
41271  static async load(obj, keys, xref) {
41272    if (xref.stream.isDataLoaded) {
41273      return;
41274    }
41275    const objLoader = new ObjectLoader(obj, keys, xref);
41276    await objLoader.load();
41277  }
41278}
41279
41280;// ./src/core/xfa/symbol_utils.js
41281const $acceptWhitespace = Symbol();
41282const $addHTML = Symbol();
41283const $appendChild = Symbol();
41284const $childrenToHTML = Symbol();
41285const $clean = Symbol();
41286const $cleanPage = Symbol();
41287const $cleanup = Symbol();
41288const $clone = Symbol();
41289const $consumed = Symbol();
41290const $content = Symbol("content");
41291const $data = Symbol("data");
41292const $dump = Symbol();
41293const $extra = Symbol("extra");
41294const $finalize = Symbol();
41295const $flushHTML = Symbol();
41296const $getAttributeIt = Symbol();
41297const $getAttributes = Symbol();
41298const $getAvailableSpace = Symbol();
41299const $getChildrenByClass = Symbol();
41300const $getChildrenByName = Symbol();
41301const $getChildrenByNameIt = Symbol();
41302const $getDataValue = Symbol();
41303const $getExtra = Symbol();
41304const $getRealChildrenByNameIt = Symbol();
41305const $getChildren = Symbol();
41306const $getContainedChildren = Symbol();
41307const $getNextPage = Symbol();
41308const $getSubformParent = Symbol();
41309const $getParent = Symbol();
41310const $getTemplateRoot = Symbol();
41311const $globalData = Symbol();
41312const $hasSettableValue = Symbol();
41313const $ids = Symbol();
41314const $indexOf = Symbol();
41315const $insertAt = Symbol();
41316const $isCDATAXml = Symbol();
41317const $isBindable = Symbol();
41318const $isDataValue = Symbol();
41319const $isDescendent = Symbol();
41320const $isNsAgnostic = Symbol();
41321const $isSplittable = Symbol();
41322const $isThereMoreWidth = Symbol();
41323const $isTransparent = Symbol();
41324const $isUsable = Symbol();
41325const $lastAttribute = Symbol();
41326const $namespaceId = Symbol("namespaceId");
41327const $nodeName = Symbol("nodeName");
41328const $nsAttributes = Symbol();
41329const $onChild = Symbol();
41330const $onChildCheck = Symbol();
41331const $onText = Symbol();
41332const $pushGlyphs = Symbol();
41333const $popPara = Symbol();
41334const $pushPara = Symbol();
41335const $removeChild = Symbol();
41336const $root = Symbol("root");
41337const $resolvePrototypes = Symbol();
41338const $searchNode = Symbol();
41339const $setId = Symbol();
41340const $setSetAttributes = Symbol();
41341const $setValue = Symbol();
41342const $tabIndex = Symbol();
41343const $text = Symbol();
41344const $toPages = Symbol();
41345const $toHTML = Symbol();
41346const $toString = Symbol();
41347const $toStyle = Symbol();
41348const $uid = Symbol("uid");
41349
41350;// ./src/core/xfa/namespaces.js
41351const $buildXFAObject = Symbol();
41352const NamespaceIds = {
41353  config: {
41354    id: 0,
41355    check: ns => ns.startsWith("http://www.xfa.org/schema/xci/")
41356  },
41357  connectionSet: {
41358    id: 1,
41359    check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-connection-set/")
41360  },
41361  datasets: {
41362    id: 2,
41363    check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-data/")
41364  },
41365  form: {
41366    id: 3,
41367    check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-form/")
41368  },
41369  localeSet: {
41370    id: 4,
41371    check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-locale-set/")
41372  },
41373  pdf: {
41374    id: 5,
41375    check: ns => ns === "http://ns.adobe.com/xdp/pdf/"
41376  },
41377  signature: {
41378    id: 6,
41379    check: ns => ns === "http://www.w3.org/2000/09/xmldsig#"
41380  },
41381  sourceSet: {
41382    id: 7,
41383    check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-source-set/")
41384  },
41385  stylesheet: {
41386    id: 8,
41387    check: ns => ns === "http://www.w3.org/1999/XSL/Transform"
41388  },
41389  template: {
41390    id: 9,
41391    check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-template/")
41392  },
41393  xdc: {
41394    id: 10,
41395    check: ns =>
vendor: 7,585 bytes, lines 41395-41730
41395 ns.startsWith("http://www.xfa.org/schema/xdc/")
41396  },
41397  xdp: {
41398    id: 11,
41399    check: ns => ns === "http://ns.adobe.com/xdp/"
41400  },
41401  xfdf: {
41402    id: 12,
41403    check: ns => ns === "http://ns.adobe.com/xfdf/"
41404  },
41405  xhtml: {
41406    id: 13,
41407    check: ns => ns === "http://www.w3.org/1999/xhtml"
41408  },
41409  xmpmeta: {
41410    id: 14,
41411    check: ns => ns === "http://ns.adobe.com/xmpmeta/"
41412  }
41413};
41414
41415;// ./src/core/xfa/utils.js
41416
41417
41418const dimConverters = {
41419  pt: x => x,
41420  cm: x => x / 2.54 * 72,
41421  mm: x => x / (10 * 2.54) * 72,
41422  in: x => x * 72,
41423  px: x => x
41424};
41425const measurementPattern = /([+-]?\d+\.?\d*)(.*)/;
41426function stripQuotes(str) {
41427  if (str.startsWith("'") || str.startsWith('"')) {
41428    return str.slice(1, -1);
41429  }
41430  return str;
41431}
41432function getInteger({
41433  data,
41434  defaultValue,
41435  validate
41436}) {
41437  if (!data) {
41438    return defaultValue;
41439  }
41440  data = data.trim();
41441  const n = parseInt(data, 10);
41442  if (!isNaN(n) && validate(n)) {
41443    return n;
41444  }
41445  return defaultValue;
41446}
41447function getFloat({
41448  data,
41449  defaultValue,
41450  validate
41451}) {
41452  if (!data) {
41453    return defaultValue;
41454  }
41455  data = data.trim();
41456  const n = parseFloat(data);
41457  if (!isNaN(n) && validate(n)) {
41458    return n;
41459  }
41460  return defaultValue;
41461}
41462function getKeyword({
41463  data,
41464  defaultValue,
41465  validate
41466}) {
41467  if (!data) {
41468    return defaultValue;
41469  }
41470  data = data.trim();
41471  if (validate(data)) {
41472    return data;
41473  }
41474  return defaultValue;
41475}
41476function getStringOption(data, options) {
41477  return getKeyword({
41478    data,
41479    defaultValue: options[0],
41480    validate: k => options.includes(k)
41481  });
41482}
41483function getMeasurement(str, def = "0") {
41484  def ||= "0";
41485  if (!str) {
41486    return getMeasurement(def);
41487  }
41488  const match = str.trim().match(measurementPattern);
41489  if (!match) {
41490    return getMeasurement(def);
41491  }
41492  const [, valueStr, unit] = match;
41493  const value = parseFloat(valueStr);
41494  if (isNaN(value)) {
41495    return getMeasurement(def);
41496  }
41497  if (value === 0) {
41498    return 0;
41499  }
41500  const conv = dimConverters[unit];
41501  if (conv) {
41502    return conv(value);
41503  }
41504  return value;
41505}
41506function getRatio(data) {
41507  if (!data) {
41508    return {
41509      num: 1,
41510      den: 1
41511    };
41512  }
41513  const ratio = data.split(":", 2).map(x => parseFloat(x.trim())).filter(x => !isNaN(x));
41514  if (ratio.length === 1) {
41515    ratio.push(1);
41516  }
41517  if (ratio.length === 0) {
41518    return {
41519      num: 1,
41520      den: 1
41521    };
41522  }
41523  const [num, den] = ratio;
41524  return {
41525    num,
41526    den
41527  };
41528}
41529function getRelevant(data) {
41530  if (!data) {
41531    return [];
41532  }
41533  return data.trim().split(/\s+/).map(e => ({
41534    excluded: e[0] === "-",
41535    viewname: e.substring(1)
41536  }));
41537}
41538function getColor(data, def = [0, 0, 0]) {
41539  let [r, g, b] = def;
41540  if (!data) {
41541    return {
41542      r,
41543      g,
41544      b
41545    };
41546  }
41547  const color = data.split(",", 3).map(c => MathClamp(parseInt(c.trim(), 10), 0, 255)).map(c => isNaN(c) ? 0 : c);
41548  if (color.length < 3) {
41549    return {
41550      r,
41551      g,
41552      b
41553    };
41554  }
41555  [r, g, b] = color;
41556  return {
41557    r,
41558    g,
41559    b
41560  };
41561}
41562function getBBox(data) {
41563  const def = -1;
41564  if (!data) {
41565    return {
41566      x: def,
41567      y: def,
41568      width: def,
41569      height: def
41570    };
41571  }
41572  const bbox = data.split(",", 4).map(m => getMeasurement(m.trim(), "-1"));
41573  if (bbox.length < 4 || bbox[2] < 0 || bbox[3] < 0) {
41574    return {
41575      x: def,
41576      y: def,
41577      width: def,
41578      height: def
41579    };
41580  }
41581  const [x, y, width, height] = bbox;
41582  return {
41583    x,
41584    y,
41585    width,
41586    height
41587  };
41588}
41589class HTMLResult {
41590  static get FAILURE() {
41591    return shadow(this, "FAILURE", new HTMLResult(false, null, null, null));
41592  }
41593  static get EMPTY() {
41594    return shadow(this, "EMPTY", new HTMLResult(true, null, null, null));
41595  }
41596  constructor(success, html, bbox, breakNode) {
41597    this.success = success;
41598    this.html = html;
41599    this.bbox = bbox;
41600    this.breakNode = breakNode;
41601  }
41602  isBreak() {
41603    return !!this.breakNode;
41604  }
41605  static breakNode(node) {
41606    return new HTMLResult(false, null, null, node);
41607  }
41608  static success(html, bbox = null) {
41609    return new HTMLResult(true, html, bbox, null);
41610  }
41611}
41612
41613;// ./src/core/xfa/fonts.js
41614
41615
41616
41617class FontFinder {
41618  constructor(pdfFonts) {
41619    this.fonts = new Map();
41620    this.cache = new Map();
41621    this.warned = new Set();
41622    this.defaultFont = null;
41623    this.add(pdfFonts);
41624  }
41625  add(pdfFonts, reallyMissingFonts = null) {
41626    for (const pdfFont of pdfFonts) {
41627      this.addPdfFont(pdfFont);
41628    }
41629    for (const pdfFont of this.fonts.values()) {
41630      if (!pdfFont.regular) {
41631        pdfFont.regular = pdfFont.italic || pdfFont.bold || pdfFont.bolditalic;
41632      }
41633    }
41634    if (!reallyMissingFonts || reallyMissingFonts.size === 0) {
41635      return;
41636    }
41637    const myriad = this.fonts.get("PdfJS-Fallback-PdfJS-XFA");
41638    for (const missing of reallyMissingFonts) {
41639      this.fonts.set(missing, myriad);
41640    }
41641  }
41642  addPdfFont(pdfFont) {
41643    const cssFontInfo = pdfFont.cssFontInfo;
41644    const name = cssFontInfo.fontFamily;
41645    const font = this.fonts.getOrInsertComputed(name, makeObj);
41646    this.defaultFont ??= font;
41647    let property = "";
41648    const fontWeight = parseFloat(cssFontInfo.fontWeight);
41649    if (parseFloat(cssFontInfo.italicAngle) !== 0) {
41650      property = fontWeight >= 700 ? "bolditalic" : "italic";
41651    } else if (fontWeight >= 700) {
41652      property = "bold";
41653    }
41654    if (!property) {
41655      if (pdfFont.name.includes("Bold") || pdfFont.psName?.includes("Bold")) {
41656        property = "bold";
41657      }
41658      if (pdfFont.name.includes("Italic") || pdfFont.name.endsWith("It") || pdfFont.psName?.includes("Italic") || pdfFont.psName?.endsWith("It")) {
41659        property += "italic";
41660      }
41661    }
41662    if (!property) {
41663      property = "regular";
41664    }
41665    font[property] = pdfFont;
41666  }
41667  getDefault() {
41668    return this.defaultFont;
41669  }
41670  find(fontName, mustWarn = true) {
41671    let font = this.fonts.get(fontName) || this.cache.get(fontName);
41672    if (font) {
41673      return font;
41674    }
41675    const pattern = /,|-|_| |bolditalic|bold|italic|regular|it/gi;
41676    let name = fontName.replaceAll(pattern, "");
41677    font = this.fonts.get(name);
41678    if (font) {
41679      this.cache.set(fontName, font);
41680      return font;
41681    }
41682    name = name.toLowerCase();
41683    const maybe = [];
41684    for (const [family, pdfFont] of this.fonts) {
41685      if (family.replaceAll(pattern, "").toLowerCase().startsWith(name)) {
41686        maybe.push(pdfFont);
41687      }
41688    }
41689    if (maybe.length === 0) {
41690      for (const pdfFont of this.fonts.values()) {
41691        if (pdfFont.regular.name?.replaceAll(pattern, "").toLowerCase().startsWith(name)) {
41692          maybe.push(pdfFont);
41693        }
41694      }
41695    }
41696    if (maybe.length === 0) {
41697      name = name.replaceAll(/psmt|mt/gi, "");
41698      for (const [family, pdfFont] of this.fonts) {
41699        if (family.replaceAll(pattern, "").toLowerCase().startsWith(name)) {
41700          maybe.push(pdfFont);
41701        }
41702      }
41703    }
41704    if (maybe.length === 0) {
41705      for (const pdfFont of this.fonts.values()) {
41706        if (pdfFont.regular.name?.replaceAll(pattern, "").toLowerCase().startsWith(name)) {
41707          maybe.push(pdfFont);
41708        }
41709      }
41710    }
41711    if (maybe.length >= 1) {
41712      if (maybe.length !== 1 && mustWarn) {
41713        warn(`XFA - Too many choices to guess the correct font: ${fontName}`);
41714      }
41715      this.cache.set(fontName, maybe[0]);
41716      return maybe[0];
41717    }
41718    if (mustWarn && !this.warned.has(fontName)) {
41719      this.warned.add(fontName);
41720      warn(`XFA - Cannot find the font: ${fontName}`);
41721    }
41722    return null;
41723  }
41724}
41725function selectFont(xfaFont, typeface) {
41726  if (xfaFont.posture === "italic") {
41727    if (xfaFont.weight === "bold") {
41728      return typeface.bolditalic;
41729    }
41730    return
vendor: 17,669 bytes, lines 41730-42359
41730 typeface.italic;
41731  } else if (xfaFont.weight === "bold") {
41732    return typeface.bold;
41733  }
41734  return typeface.regular;
41735}
41736function fonts_getMetrics(xfaFont, real = false) {
41737  let pdfFont = null;
41738  if (xfaFont) {
41739    const name = stripQuotes(xfaFont.typeface);
41740    const typeface = xfaFont[$globalData].fontFinder.find(name);
41741    pdfFont = selectFont(xfaFont, typeface);
41742  }
41743  if (!pdfFont) {
41744    return {
41745      lineHeight: 12,
41746      lineGap: 2,
41747      lineNoGap: 10
41748    };
41749  }
41750  const size = xfaFont.size || 10;
41751  const lineHeight = pdfFont.lineHeight ? Math.max(real ? 0 : 1.2, pdfFont.lineHeight) : 1.2;
41752  const lineGap = pdfFont.lineGap === undefined ? 0.2 : pdfFont.lineGap;
41753  return {
41754    lineHeight: lineHeight * size,
41755    lineGap: lineGap * size,
41756    lineNoGap: Math.max(1, lineHeight - lineGap) * size
41757  };
41758}
41759
41760;// ./src/core/xfa/text.js
41761
41762const WIDTH_FACTOR = 1.02;
41763class FontInfo {
41764  constructor(xfaFont, margin, lineHeight, fontFinder) {
41765    this.lineHeight = lineHeight;
41766    this.paraMargin = margin || {
41767      top: 0,
41768      bottom: 0,
41769      left: 0,
41770      right: 0
41771    };
41772    if (!xfaFont) {
41773      [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
41774      return;
41775    }
41776    this.xfaFont = {
41777      typeface: xfaFont.typeface,
41778      posture: xfaFont.posture,
41779      weight: xfaFont.weight,
41780      size: xfaFont.size,
41781      letterSpacing: xfaFont.letterSpacing
41782    };
41783    const typeface = fontFinder.find(xfaFont.typeface);
41784    if (!typeface) {
41785      [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
41786      return;
41787    }
41788    this.pdfFont = selectFont(xfaFont, typeface);
41789    if (!this.pdfFont) {
41790      [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
41791    }
41792  }
41793  defaultFont(fontFinder) {
41794    const font = fontFinder.find("Helvetica", false) || fontFinder.find("Myriad Pro", false) || fontFinder.find("Arial", false) || fontFinder.getDefault();
41795    if (font?.regular) {
41796      const pdfFont = font.regular;
41797      const info = pdfFont.cssFontInfo;
41798      const xfaFont = {
41799        typeface: info.fontFamily,
41800        posture: "normal",
41801        weight: "normal",
41802        size: 10,
41803        letterSpacing: 0
41804      };
41805      return [pdfFont, xfaFont];
41806    }
41807    const xfaFont = {
41808      typeface: "Courier",
41809      posture: "normal",
41810      weight: "normal",
41811      size: 10,
41812      letterSpacing: 0
41813    };
41814    return [null, xfaFont];
41815  }
41816}
41817class FontSelector {
41818  constructor(defaultXfaFont, defaultParaMargin, defaultLineHeight, fontFinder) {
41819    this.fontFinder = fontFinder;
41820    this.stack = [new FontInfo(defaultXfaFont, defaultParaMargin, defaultLineHeight, fontFinder)];
41821  }
41822  pushData(xfaFont, margin, lineHeight) {
41823    const lastFont = this.stack.at(-1);
41824    for (const name of ["typeface", "posture", "weight", "size", "letterSpacing"]) {
41825      xfaFont[name] ||= lastFont.xfaFont[name];
41826    }
41827    for (const name of ["top", "bottom", "left", "right"]) {
41828      if (isNaN(margin[name])) {
41829        margin[name] = lastFont.paraMargin[name];
41830      }
41831    }
41832    const fontInfo = new FontInfo(xfaFont, margin, lineHeight || lastFont.lineHeight, this.fontFinder);
41833    fontInfo.pdfFont ||= lastFont.pdfFont;
41834    this.stack.push(fontInfo);
41835  }
41836  popFont() {
41837    this.stack.pop();
41838  }
41839  topFont() {
41840    return this.stack.at(-1);
41841  }
41842}
41843class TextMeasure {
41844  constructor(defaultXfaFont, defaultParaMargin, defaultLineHeight, fonts) {
41845    this.glyphs = [];
41846    this.fontSelector = new FontSelector(defaultXfaFont, defaultParaMargin, defaultLineHeight, fonts);
41847    this.extraHeight = 0;
41848  }
41849  pushData(xfaFont, margin, lineHeight) {
41850    this.fontSelector.pushData(xfaFont, margin, lineHeight);
41851  }
41852  popFont(xfaFont) {
41853    return this.fontSelector.popFont();
41854  }
41855  addPara() {
41856    const lastFont = this.fontSelector.topFont();
41857    this.extraHeight += lastFont.paraMargin.top + lastFont.paraMargin.bottom;
41858  }
41859  addString(str) {
41860    if (!str) {
41861      return;
41862    }
41863    const lastFont = this.fontSelector.topFont();
41864    const fontSize = lastFont.xfaFont.size;
41865    if (lastFont.pdfFont) {
41866      const letterSpacing = lastFont.xfaFont.letterSpacing;
41867      const pdfFont = lastFont.pdfFont;
41868      const fontLineHeight = pdfFont.lineHeight || 1.2;
41869      const lineHeight = lastFont.lineHeight || Math.max(1.2, fontLineHeight) * fontSize;
41870      const lineGap = pdfFont.lineGap === undefined ? 0.2 : pdfFont.lineGap;
41871      const noGap = fontLineHeight - lineGap;
41872      const firstLineHeight = Math.max(1, noGap) * fontSize;
41873      const scale = fontSize / 1000;
41874      const fallbackWidth = pdfFont.defaultWidth || pdfFont.charsToGlyphs(" ")[0].width;
41875      for (const line of str.split(/[\u2029\n]/)) {
41876        const encodedLine = pdfFont.encodeString(line).join("");
41877        const glyphs = pdfFont.charsToGlyphs(encodedLine);
41878        for (const glyph of glyphs) {
41879          const width = glyph.width || fallbackWidth;
41880          this.glyphs.push([width * scale + letterSpacing, lineHeight, firstLineHeight, glyph.unicode, false]);
41881        }
41882        this.glyphs.push([0, 0, 0, "\n", true]);
41883      }
41884      this.glyphs.pop();
41885      return;
41886    }
41887    for (const line of str.split(/[\u2029\n]/)) {
41888      for (const char of line.split("")) {
41889        this.glyphs.push([fontSize, 1.2 * fontSize, fontSize, char, false]);
41890      }
41891      this.glyphs.push([0, 0, 0, "\n", true]);
41892    }
41893    this.glyphs.pop();
41894  }
41895  compute(maxWidth) {
41896    let lastSpacePos = -1,
41897      lastSpaceWidth = 0,
41898      width = 0,
41899      height = 0,
41900      currentLineWidth = 0,
41901      currentLineHeight = 0;
41902    let isBroken = false;
41903    let isFirstLine = true;
41904    for (let i = 0, ii = this.glyphs.length; i < ii; i++) {
41905      const [glyphWidth, lineHeight, firstLineHeight, char, isEOL] = this.glyphs[i];
41906      const isSpace = char === " ";
41907      const glyphHeight = isFirstLine ? firstLineHeight : lineHeight;
41908      if (isEOL) {
41909        width = Math.max(width, currentLineWidth);
41910        currentLineWidth = 0;
41911        height += currentLineHeight;
41912        currentLineHeight = glyphHeight;
41913        lastSpacePos = -1;
41914        lastSpaceWidth = 0;
41915        isFirstLine = false;
41916        continue;
41917      }
41918      if (isSpace) {
41919        if (currentLineWidth + glyphWidth > maxWidth) {
41920          width = Math.max(width, currentLineWidth);
41921          currentLineWidth = 0;
41922          height += currentLineHeight;
41923          currentLineHeight = glyphHeight;
41924          lastSpacePos = -1;
41925          lastSpaceWidth = 0;
41926          isBroken = true;
41927          isFirstLine = false;
41928        } else {
41929          currentLineHeight = Math.max(glyphHeight, currentLineHeight);
41930          lastSpaceWidth = currentLineWidth;
41931          currentLineWidth += glyphWidth;
41932          lastSpacePos = i;
41933        }
41934        continue;
41935      }
41936      if (currentLineWidth + glyphWidth > maxWidth) {
41937        height += currentLineHeight;
41938        currentLineHeight = glyphHeight;
41939        if (lastSpacePos !== -1) {
41940          i = lastSpacePos;
41941          width = Math.max(width, lastSpaceWidth);
41942          currentLineWidth = 0;
41943          lastSpacePos = -1;
41944          lastSpaceWidth = 0;
41945        } else {
41946          width = Math.max(width, currentLineWidth);
41947          currentLineWidth = glyphWidth;
41948        }
41949        isBroken = true;
41950        isFirstLine = false;
41951        continue;
41952      }
41953      currentLineWidth += glyphWidth;
41954      currentLineHeight = Math.max(glyphHeight, currentLineHeight);
41955    }
41956    width = Math.max(width, currentLineWidth);
41957    height += currentLineHeight + this.extraHeight;
41958    return {
41959      width: WIDTH_FACTOR * width,
41960      height,
41961      isBroken
41962    };
41963  }
41964}
41965
41966;// ./src/core/xfa/som.js
41967
41968
41969const namePattern = /^[^.[]+/;
41970const indexPattern = /^[^\]]+/;
41971const operators = {
41972  dot: 0,
41973  dotDot: 1,
41974  dotHash: 2,
41975  dotBracket: 3,
41976  dotParen: 4
41977};
41978const shortcuts = new Map([["$data", (root, current) => root.datasets ? root.datasets.data : root], ["$record", (root, current) => (root.datasets ? root.datasets.data : root)[$getChildren]()[0]], ["$template", (root, current) => root.template], ["$connectionSet", (root, current) => root.connectionSet], ["$form", (root, current) => root.form], ["$layout", (root, current) => root.layout], ["$host", (root, current) => root.host], ["$dataWindow", (root, current) => root.dataWindow], ["$event", (root, current) => root.event], ["!", (root, current) => root.datasets], ["$xfa", (root, current) => root], ["xfa", (root, current) => root], ["$", (root, current) => current]]);
41979const somCache = new WeakMap();
41980function parseIndex(index) {
41981  index = index.trim();
41982  if (index === "*") {
41983    return Infinity;
41984  }
41985  return parseInt(index, 10) || 0;
41986}
41987function parseExpression(expr, dotDotAllowed, noExpr = true) {
41988  let match = expr.match(namePattern);
41989  if (!match) {
41990    return null;
41991  }
41992  let [name] = match;
41993  const parsed = [{
41994    name,
41995    cacheName: "." + name,
41996    index: 0,
41997    js: null,
41998    formCalc: null,
41999    operator: operators.dot
42000  }];
42001  let pos = name.length;
42002  while (pos < expr.length) {
42003    const spos = pos;
42004    const char = expr.charAt(pos++);
42005    if (char === "[") {
42006      match = expr.slice(pos).match(indexPattern);
42007      if (!match) {
42008        warn("XFA - Invalid index in SOM expression");
42009        return null;
42010      }
42011      parsed.at(-1).index = parseIndex(match[0]);
42012      pos += match[0].length + 1;
42013      continue;
42014    }
42015    let operator;
42016    switch (expr.charAt(pos)) {
42017      case ".":
42018        if (!dotDotAllowed) {
42019          return null;
42020        }
42021        pos++;
42022        operator = operators.dotDot;
42023        break;
42024      case "#":
42025        pos++;
42026        operator = operators.dotHash;
42027        break;
42028      case "[":
42029        if (noExpr) {
42030          warn("XFA - SOM expression contains a FormCalc subexpression which is not supported for now.");
42031          return null;
42032        }
42033        operator = operators.dotBracket;
42034        break;
42035      case "(":
42036        if (noExpr) {
42037          warn("XFA - SOM expression contains a JavaScript subexpression which is not supported for now.");
42038          return null;
42039        }
42040        operator = operators.dotParen;
42041        break;
42042      default:
42043        operator = operators.dot;
42044        break;
42045    }
42046    match = expr.slice(pos).match(namePattern);
42047    if (!match) {
42048      break;
42049    }
42050    [name] = match;
42051    pos += name.length;
42052    parsed.push({
42053      name,
42054      cacheName: expr.slice(spos, pos),
42055      operator,
42056      index: 0,
42057      js: null,
42058      formCalc: null
42059    });
42060  }
42061  return parsed;
42062}
42063function searchNode(root, container, expr, dotDotAllowed = true, useCache = true) {
42064  const parsed = parseExpression(expr, dotDotAllowed);
42065  if (!parsed) {
42066    return null;
42067  }
42068  const fn = shortcuts.get(parsed[0].name);
42069  let i = 0;
42070  let isQualified;
42071  if (fn) {
42072    isQualified = true;
42073    root = [fn(root, container)];
42074    i = 1;
42075  } else {
42076    isQualified = container === null;
42077    root = [container || root];
42078  }
42079  for (let ii = parsed.length; i < ii; i++) {
42080    const {
42081      name,
42082      cacheName,
42083      operator,
42084      index
42085    } = parsed[i];
42086    const nodes = [];
42087    for (const node of root) {
42088      if (!node.isXFAObject) {
42089        continue;
42090      }
42091      let children, cached;
42092      if (useCache) {
42093        cached = somCache.getOrInsertComputed(node, makeMap);
42094        children = cached.get(cacheName);
42095      }
42096      if (!children) {
42097        switch (operator) {
42098          case operators.dot:
42099            children = node[$getChildrenByName](name, false);
42100            break;
42101          case operators.dotDot:
42102            children = node[$getChildrenByName](name, true);
42103            break;
42104          case operators.dotHash:
42105            children = node[$getChildrenByClass](name);
42106            children = children.isXFAObjectArray ? children.children : [children];
42107            break;
42108          default:
42109            break;
42110        }
42111        if (useCache) {
42112          cached.set(cacheName, children);
42113        }
42114      }
42115      if (children.length > 0) {
42116        nodes.push(children);
42117      }
42118    }
42119    if (nodes.length === 0 && !isQualified && i === 0) {
42120      const parent = container[$getParent]();
42121      container = parent;
42122      if (!container) {
42123        return null;
42124      }
42125      i = -1;
42126      root = [container];
42127      continue;
42128    }
42129    root = isFinite(index) ? nodes.filter(node => index < node.length).map(node => node[index]) : nodes.flat();
42130  }
42131  if (root.length === 0) {
42132    return null;
42133  }
42134  return root;
42135}
42136function createDataNode(root, container, expr) {
42137  const parsed = parseExpression(expr);
42138  if (!parsed) {
42139    return null;
42140  }
42141  if (parsed.some(x => x.operator === operators.dotDot)) {
42142    return null;
42143  }
42144  const fn = shortcuts.get(parsed[0].name);
42145  let i = 0;
42146  if (fn) {
42147    root = fn(root, container);
42148    i = 1;
42149  } else {
42150    root = container || root;
42151  }
42152  for (let ii = parsed.length; i < ii; i++) {
42153    const {
42154      name,
42155      operator,
42156      index
42157    } = parsed[i];
42158    if (!isFinite(index)) {
42159      parsed[i].index = 0;
42160      return root.createNodes(parsed.slice(i));
42161    }
42162    let children;
42163    switch (operator) {
42164      case operators.dot:
42165        children = root[$getChildrenByName](name, false);
42166        break;
42167      case operators.dotDot:
42168        children = root[$getChildrenByName](name, true);
42169        break;
42170      case operators.dotHash:
42171        children = root[$getChildrenByClass](name);
42172        children = children.isXFAObjectArray ? children.children : [children];
42173        break;
42174      default:
42175        break;
42176    }
42177    if (children.length === 0) {
42178      return root.createNodes(parsed.slice(i));
42179    }
42180    if (index < children.length) {
42181      const child = children[index];
42182      if (!child.isXFAObject) {
42183        warn(`XFA - Cannot create a node.`);
42184        return null;
42185      }
42186      root = child;
42187    } else {
42188      parsed[i].index = index - children.length;
42189      return root.createNodes(parsed.slice(i));
42190    }
42191  }
42192  return null;
42193}
42194
42195;// ./src/core/xfa/xfa_object.js
42196
42197
42198
42199
42200
42201
42202const _applyPrototype = Symbol();
42203const _attributes = Symbol();
42204const _attributeNames = Symbol();
42205const _children = Symbol("_children");
42206const _cloneAttribute = Symbol();
42207const _dataValue = Symbol();
42208const _defaultValue = Symbol();
42209const _filteredChildrenGenerator = Symbol();
42210const _getPrototype = Symbol();
42211const _getUnsetAttributes = Symbol();
42212const _hasChildren = Symbol();
42213const _max = Symbol();
42214const _options = Symbol();
42215const _parent = Symbol("parent");
42216const _resolvePrototypesHelper = Symbol();
42217const _setAttributes = Symbol();
42218const _validator = Symbol();
42219let uid = 0;
42220const NS_DATASETS = NamespaceIds.datasets.id;
42221class XFAObject {
42222  constructor(nsId, name, hasChildren = false) {
42223    this[$namespaceId] = nsId;
42224    this[$nodeName] = name;
42225    this[_hasChildren] = hasChildren;
42226    this[_parent] = null;
42227    this[_children] = [];
42228    this[$uid] = `${name}${uid++}`;
42229    this[$globalData] = null;
42230  }
42231  get isXFAObject() {
42232    return true;
42233  }
42234  get isXFAObjectArray() {
42235    return false;
42236  }
42237  createNodes(path) {
42238    let root = this,
42239      node = null;
42240    for (const {
42241      name,
42242      index
42243    } of path) {
42244      for (let i = 0, ii = isFinite(index) ? index : 0; i <= ii; i++) {
42245        const nsId = root[$namespaceId] === NS_DATASETS ? -1 : root[$namespaceId];
42246        node = new XmlObject(nsId, name);
42247        root[$appendChild](node);
42248      }
42249      root = node;
42250    }
42251    return node;
42252  }
42253  [$onChild](child) {
42254    if (!this[_hasChildren] || !this[$onChildCheck](child)) {
42255      return false;
42256    }
42257    const name = child[$nodeName];
42258    const node = this[name];
42259    if (node instanceof XFAObjectArray) {
42260      if (node.push(child)) {
42261        this[$appendChild](child);
42262        return true;
42263      }
42264    } else {
42265      if (node !== null) {
42266        this[$removeChild](node);
42267      }
42268      this[name] = child;
42269      this[$appendChild](child);
42270      return true;
42271    }
42272    let id = "";
42273    if (this.id) {
42274      id = ` (id: ${this.id})`;
42275    } else if (this.name) {
42276      id = ` (name: ${this.name} ${this.h.value})`;
42277    }
42278    warn(`XFA - node "${this[$nodeName]}"${id} has already enough "${name}"!`);
42279    return false;
42280  }
42281  [$onChildCheck](child) {
42282    return Object.hasOwn(this, child[$nodeName]) && child[$namespaceId] === this[$namespaceId];
42283  }
42284  [$isNsAgnostic]() {
42285    return false;
42286  }
42287  [$acceptWhitespace]() {
42288    return false;
42289  }
42290  [$isCDATAXml]() {
42291    return false;
42292  }
42293  [$isBindable]() {
42294    return false;
42295  }
42296  [$popPara]() {
42297    if (this.para) {
42298      this[$getTemplateRoot]()[$extra].paraStack.pop();
42299    }
42300  }
42301  [$pushPara]() {
42302    this[$getTemplateRoot]()[$extra].paraStack.push(this.para);
42303  }
42304  [$setId](ids) {
42305    if (this.id && this[$namespaceId] === NamespaceIds.template.id) {
42306      ids.set(this.id, this);
42307    }
42308  }
42309  [$getTemplateRoot]() {
42310    return this[$globalData].template;
42311  }
42312  [$isSplittable]() {
42313    return false;
42314  }
42315  [$isThereMoreWidth]() {
42316    return false;
42317  }
42318  [$appendChild](child) {
42319    child[_parent] = this;
42320    this[_children].push(child);
42321    if (!child[$globalData] && this[$globalData]) {
42322      child[$globalData] = this[$globalData];
42323    }
42324  }
42325  [$removeChild](child) {
42326    const i = this[_children].indexOf(child);
42327    this[_children].splice(i, 1);
42328  }
42329  [$hasSettableValue]() {
42330    return Object.hasOwn(this, "value");
42331  }
42332  [$setValue](_) {}
42333  [$onText](_) {}
42334  [$finalize]() {}
42335  [$clean](builder) {
42336    delete this[_hasChildren];
42337    if (this[$cleanup]) {
42338      builder.clean(this[$cleanup]);
42339      delete this[$cleanup];
42340    }
42341  }
42342  [$indexOf](child) {
42343    return this[_children].indexOf(child);
42344  }
42345  [$insertAt](i, child) {
42346    child[_parent] = this;
42347    this[_children].splice(i, 0, child);
42348    if (!child[$globalData] && this[$globalData]) {
42349      child[$globalData] = this[$globalData];
42350    }
42351  }
42352  [$isTransparent]() {
42353    return !this.name;
42354  }
42355  [$lastAttribute]() {
42356    return "";
42357  }
42358  [$text]() {
42359    
vendor: 11,412 bytes, lines 42359-42768
42359if (this[_children].length === 0) {
42360      return this[$content];
42361    }
42362    return this[_children].map(c => c[$text]()).join("");
42363  }
42364  get [_attributeNames]() {
42365    const proto = Object.getPrototypeOf(this);
42366    if (!proto._attributes) {
42367      const attributes = proto._attributes = new Set();
42368      for (const name of Object.getOwnPropertyNames(this)) {
42369        if (this[name] === null || this[name] instanceof XFAObject || this[name] instanceof XFAObjectArray) {
42370          break;
42371        }
42372        attributes.add(name);
42373      }
42374    }
42375    return shadow(this, _attributeNames, proto._attributes);
42376  }
42377  [$isDescendent](parent) {
42378    let node = this;
42379    while (node) {
42380      if (node === parent) {
42381        return true;
42382      }
42383      node = node[$getParent]();
42384    }
42385    return false;
42386  }
42387  [$getParent]() {
42388    return this[_parent];
42389  }
42390  [$getSubformParent]() {
42391    return this[$getParent]();
42392  }
42393  [$getChildren](name = null) {
42394    if (!name) {
42395      return this[_children];
42396    }
42397    return this[name];
42398  }
42399  [$dump]() {
42400    const dumped = Object.create(null);
42401    if (this[$content]) {
42402      dumped.$content = this[$content];
42403    }
42404    for (const name of Object.getOwnPropertyNames(this)) {
42405      const value = this[name];
42406      if (value === null) {
42407        continue;
42408      }
42409      if (value instanceof XFAObject) {
42410        dumped[name] = value[$dump]();
42411      } else if (value instanceof XFAObjectArray) {
42412        if (!value.isEmpty()) {
42413          dumped[name] = value.dump();
42414        }
42415      } else {
42416        dumped[name] = value;
42417      }
42418    }
42419    return dumped;
42420  }
42421  [$toStyle]() {
42422    return null;
42423  }
42424  [$toHTML]() {
42425    return HTMLResult.EMPTY;
42426  }
42427  *[$getContainedChildren]() {
42428    for (const node of this[$getChildren]()) {
42429      yield node;
42430    }
42431  }
42432  *[_filteredChildrenGenerator](filter, include) {
42433    for (const node of this[$getContainedChildren]()) {
42434      if (!filter || include === filter.has(node[$nodeName])) {
42435        const availableSpace = this[$getAvailableSpace]();
42436        const res = node[$toHTML](availableSpace);
42437        if (!res.success) {
42438          this[$extra].failingNode = node;
42439        }
42440        yield res;
42441      }
42442    }
42443  }
42444  [$flushHTML]() {
42445    return null;
42446  }
42447  [$addHTML](html, bbox) {
42448    this[$extra].children.push(html);
42449  }
42450  [$getAvailableSpace]() {}
42451  [$childrenToHTML]({
42452    filter = null,
42453    include = true
42454  }) {
42455    if (!this[$extra].generator) {
42456      this[$extra].generator = this[_filteredChildrenGenerator](filter, include);
42457    } else {
42458      const availableSpace = this[$getAvailableSpace]();
42459      const res = this[$extra].failingNode[$toHTML](availableSpace);
42460      if (!res.success) {
42461        return res;
42462      }
42463      if (res.html) {
42464        this[$addHTML](res.html, res.bbox);
42465      }
42466      delete this[$extra].failingNode;
42467    }
42468    while (true) {
42469      const gen = this[$extra].generator.next();
42470      if (gen.done) {
42471        break;
42472      }
42473      const res = gen.value;
42474      if (!res.success) {
42475        return res;
42476      }
42477      if (res.html) {
42478        this[$addHTML](res.html, res.bbox);
42479      }
42480    }
42481    this[$extra].generator = null;
42482    return HTMLResult.EMPTY;
42483  }
42484  [$setSetAttributes](attributes) {
42485    this[_setAttributes] = new Set(Object.keys(attributes));
42486  }
42487  [_getUnsetAttributes](protoAttributes) {
42488    const allAttr = this[_attributeNames];
42489    const setAttr = this[_setAttributes];
42490    return [...protoAttributes].filter(x => allAttr.has(x) && !setAttr.has(x));
42491  }
42492  [$resolvePrototypes](ids, ancestors = new Set()) {
42493    for (const child of this[_children]) {
42494      child[_resolvePrototypesHelper](ids, ancestors);
42495    }
42496  }
42497  [_resolvePrototypesHelper](ids, ancestors) {
42498    const proto = this[_getPrototype](ids, ancestors);
42499    if (proto) {
42500      this[_applyPrototype](proto, ids, ancestors);
42501    } else {
42502      this[$resolvePrototypes](ids, ancestors);
42503    }
42504  }
42505  [_getPrototype](ids, ancestors) {
42506    const {
42507      use,
42508      usehref
42509    } = this;
42510    if (!use && !usehref) {
42511      return null;
42512    }
42513    let proto = null;
42514    let somExpression = null;
42515    let id = null;
42516    let ref = use;
42517    if (usehref) {
42518      ref = usehref;
42519      if (usehref.startsWith("#som(") && usehref.endsWith(")")) {
42520        somExpression = usehref.slice("#som(".length, -1);
42521      } else if (usehref.startsWith(".#som(") && usehref.endsWith(")")) {
42522        somExpression = usehref.slice(".#som(".length, -1);
42523      } else if (usehref.startsWith("#")) {
42524        id = usehref.slice(1);
42525      } else if (usehref.startsWith(".#")) {
42526        id = usehref.slice(2);
42527      }
42528    } else if (use.startsWith("#")) {
42529      id = use.slice(1);
42530    } else {
42531      somExpression = use;
42532    }
42533    this.use = this.usehref = "";
42534    if (id) {
42535      proto = ids.get(id);
42536    } else {
42537      proto = searchNode(ids.get($root), this, somExpression, true, false);
42538      if (proto) {
42539        proto = proto[0];
42540      }
42541    }
42542    if (!proto) {
42543      warn(`XFA - Invalid prototype reference: ${ref}.`);
42544      return null;
42545    }
42546    if (proto[$nodeName] !== this[$nodeName]) {
42547      warn(`XFA - Incompatible prototype: ${proto[$nodeName]} !== ${this[$nodeName]}.`);
42548      return null;
42549    }
42550    if (ancestors.has(proto)) {
42551      warn(`XFA - Cycle detected in prototypes use.`);
42552      return null;
42553    }
42554    ancestors.add(proto);
42555    const protoProto = proto[_getPrototype](ids, ancestors);
42556    if (protoProto) {
42557      proto[_applyPrototype](protoProto, ids, ancestors);
42558    }
42559    proto[$resolvePrototypes](ids, ancestors);
42560    ancestors.delete(proto);
42561    return proto;
42562  }
42563  [_applyPrototype](proto, ids, ancestors) {
42564    if (ancestors.has(proto)) {
42565      warn(`XFA - Cycle detected in prototypes use.`);
42566      return;
42567    }
42568    if (!this[$content] && proto[$content]) {
42569      this[$content] = proto[$content];
42570    }
42571    const newAncestors = new Set(ancestors);
42572    newAncestors.add(proto);
42573    for (const unsetAttrName of this[_getUnsetAttributes](proto[_setAttributes])) {
42574      this[unsetAttrName] = proto[unsetAttrName];
42575      if (this[_setAttributes]) {
42576        this[_setAttributes].add(unsetAttrName);
42577      }
42578    }
42579    for (const name of Object.getOwnPropertyNames(this)) {
42580      if (this[_attributeNames].has(name)) {
42581        continue;
42582      }
42583      const value = this[name];
42584      const protoValue = proto[name];
42585      if (value instanceof XFAObjectArray) {
42586        for (const child of value[_children]) {
42587          child[_resolvePrototypesHelper](ids, ancestors);
42588        }
42589        for (let i = value[_children].length, ii = protoValue[_children].length; i < ii; i++) {
42590          const child = proto[_children][i][$clone]();
42591          if (value.push(child)) {
42592            child[_parent] = this;
42593            this[_children].push(child);
42594            child[_resolvePrototypesHelper](ids, ancestors);
42595          } else {
42596            break;
42597          }
42598        }
42599        continue;
42600      }
42601      if (value !== null) {
42602        value[$resolvePrototypes](ids, ancestors);
42603        if (protoValue) {
42604          value[_applyPrototype](protoValue, ids, ancestors);
42605        }
42606        continue;
42607      }
42608      if (protoValue !== null) {
42609        const child = protoValue[$clone]();
42610        child[_parent] = this;
42611        this[name] = child;
42612        this[_children].push(child);
42613        child[_resolvePrototypesHelper](ids, ancestors);
42614      }
42615    }
42616  }
42617  static [_cloneAttribute](obj) {
42618    if (Array.isArray(obj)) {
42619      return obj.map(x => XFAObject[_cloneAttribute](x));
42620    }
42621    if (typeof obj === "object" && obj !== null) {
42622      return Object.assign({}, obj);
42623    }
42624    return obj;
42625  }
42626  [$clone]() {
42627    const clone = Object.create(Object.getPrototypeOf(this));
42628    for (const $symbol of Object.getOwnPropertySymbols(this)) {
42629      try {
42630        clone[$symbol] = this[$symbol];
42631      } catch {
42632        shadow(clone, $symbol, this[$symbol]);
42633      }
42634    }
42635    clone[$uid] = `${clone[$nodeName]}${uid++}`;
42636    clone[_children] = [];
42637    for (const name of Object.getOwnPropertyNames(this)) {
42638      if (this[_attributeNames].has(name)) {
42639        clone[name] = XFAObject[_cloneAttribute](this[name]);
42640        continue;
42641      }
42642      const value = this[name];
42643      clone[name] = value instanceof XFAObjectArray ? new XFAObjectArray(value[_max]) : null;
42644    }
42645    for (const child of this[_children]) {
42646      const name = child[$nodeName];
42647      const clonedChild = child[$clone]();
42648      clone[_children].push(clonedChild);
42649      clonedChild[_parent] = clone;
42650      if (clone[name] === null) {
42651        clone[name] = clonedChild;
42652      } else {
42653        clone[name][_children].push(clonedChild);
42654      }
42655    }
42656    return clone;
42657  }
42658  [$getChildren](name = null) {
42659    if (!name) {
42660      return this[_children];
42661    }
42662    return this[_children].filter(c => c[$nodeName] === name);
42663  }
42664  [$getChildrenByClass](name) {
42665    return this[name];
42666  }
42667  [$getChildrenByName](name, allTransparent, first = true) {
42668    return Array.from(this[$getChildrenByNameIt](name, allTransparent, first));
42669  }
42670  *[$getChildrenByNameIt](name, allTransparent, first = true) {
42671    if (name === "parent") {
42672      yield this[_parent];
42673      return;
42674    }
42675    for (const child of this[_children]) {
42676      if (child[$nodeName] === name) {
42677        yield child;
42678      }
42679      if (child.name === name) {
42680        yield child;
42681      }
42682      if (allTransparent || child[$isTransparent]()) {
42683        yield* child[$getChildrenByNameIt](name, allTransparent, false);
42684      }
42685    }
42686    if (first && this[_attributeNames].has(name)) {
42687      yield new XFAAttribute(this, name, this[name]);
42688    }
42689  }
42690}
42691class XFAObjectArray {
42692  constructor(max = Infinity) {
42693    this[_max] = max;
42694    this[_children] = [];
42695  }
42696  get isXFAObject() {
42697    return false;
42698  }
42699  get isXFAObjectArray() {
42700    return true;
42701  }
42702  push(child) {
42703    const len = this[_children].length;
42704    if (len <= this[_max]) {
42705      this[_children].push(child);
42706      return true;
42707    }
42708    warn(`XFA - node "${child[$nodeName]}" accepts no more than ${this[_max]} children`);
42709    return false;
42710  }
42711  isEmpty() {
42712    return this[_children].length === 0;
42713  }
42714  dump() {
42715    return this[_children].length === 1 ? this[_children][0][$dump]() : this[_children].map(x => x[$dump]());
42716  }
42717  [$clone]() {
42718    const clone = new XFAObjectArray(this[_max]);
42719    clone[_children] = this[_children].map(c => c[$clone]());
42720    return clone;
42721  }
42722  get children() {
42723    return this[_children];
42724  }
42725  clear() {
42726    this[_children].length = 0;
42727  }
42728}
42729class XFAAttribute {
42730  constructor(node, name, value) {
42731    this[_parent] = node;
42732    this[$nodeName] = name;
42733    this[$content] = value;
42734    this[$consumed] = false;
42735    this[$uid] = `attribute${uid++}`;
42736  }
42737  [$getParent]() {
42738    return this[_parent];
42739  }
42740  [$isDataValue]() {
42741    return true;
42742  }
42743  [$getDataValue]() {
42744    return this[$content].trim();
42745  }
42746  [$setValue](value) {
42747    value = value.value || "";
42748    this[$content] = value.toString();
42749  }
42750  [$text]() {
42751    return this[$content];
42752  }
42753  [$isDescendent](parent) {
42754    return this[_parent] === parent || this[_parent][$isDescendent](parent);
42755  }
42756}
42757class XmlObject extends XFAObject {
42758  constructor(nsId, name, attributes = {}) {
42759    super(nsId, name);
42760    this[$content] = "";
42761    this[_dataValue] = null;
42762    if (name !== "#text") {
42763      const map = new Map();
42764      this[_attributes] = map;
42765      for (const [attrName, value] of Object.entries(attributes)) {
42766        map.set(attrName, new XFAAttribute(this, attrName, value));
42767      }
42768      if (
vendor: 3,433 bytes, lines 42768-42889
42768Object.hasOwn(attributes, $nsAttributes)) {
42769        const dataNode = attributes[$nsAttributes].xfa.dataNode;
42770        if (dataNode !== undefined) {
42771          if (dataNode === "dataGroup") {
42772            this[_dataValue] = false;
42773          } else if (dataNode === "dataValue") {
42774            this[_dataValue] = true;
42775          }
42776        }
42777      }
42778    }
42779    this[$consumed] = false;
42780  }
42781  [$toString](buf) {
42782    const tagName = this[$nodeName];
42783    if (tagName === "#text") {
42784      buf.push(encodeToXmlString(this[$content]));
42785      return;
42786    }
42787    const utf8TagName = utf8StringToString(tagName);
42788    const prefix = this[$namespaceId] === NS_DATASETS ? "xfa:" : "";
42789    buf.push(`<${prefix}${utf8TagName}`);
42790    for (const [name, value] of this[_attributes]) {
42791      const utf8Name = utf8StringToString(name);
42792      buf.push(` ${utf8Name}="${encodeToXmlString(value[$content])}"`);
42793    }
42794    if (this[_dataValue] !== null) {
42795      if (this[_dataValue]) {
42796        buf.push(` xfa:dataNode="dataValue"`);
42797      } else {
42798        buf.push(` xfa:dataNode="dataGroup"`);
42799      }
42800    }
42801    if (!this[$content] && this[_children].length === 0) {
42802      buf.push("/>");
42803      return;
42804    }
42805    buf.push(">");
42806    if (this[$content]) {
42807      if (typeof this[$content] === "string") {
42808        buf.push(encodeToXmlString(this[$content]));
42809      } else {
42810        this[$content][$toString](buf);
42811      }
42812    } else {
42813      for (const child of this[_children]) {
42814        child[$toString](buf);
42815      }
42816    }
42817    buf.push(`</${prefix}${utf8TagName}>`);
42818  }
42819  [$onChild](child) {
42820    if (this[$content]) {
42821      const node = new XmlObject(this[$namespaceId], "#text");
42822      this[$appendChild](node);
42823      node[$content] = this[$content];
42824      this[$content] = "";
42825    }
42826    this[$appendChild](child);
42827    return true;
42828  }
42829  [$onText](str) {
42830    this[$content] += str;
42831  }
42832  [$finalize]() {
42833    if (this[$content] && this[_children].length > 0) {
42834      const node = new XmlObject(this[$namespaceId], "#text");
42835      this[$appendChild](node);
42836      node[$content] = this[$content];
42837      delete this[$content];
42838    }
42839  }
42840  [$toHTML]() {
42841    if (this[$nodeName] === "#text") {
42842      return HTMLResult.success({
42843        name: "#text",
42844        value: this[$content]
42845      });
42846    }
42847    return HTMLResult.EMPTY;
42848  }
42849  [$getChildren](name = null) {
42850    if (!name) {
42851      return this[_children];
42852    }
42853    return this[_children].filter(c => c[$nodeName] === name);
42854  }
42855  [$getAttributes]() {
42856    return this[_attributes];
42857  }
42858  [$getChildrenByClass](name) {
42859    const value = this[_attributes].get(name);
42860    if (value !== undefined) {
42861      return value;
42862    }
42863    return this[$getChildren](name);
42864  }
42865  *[$getChildrenByNameIt](name, allTransparent) {
42866    const value = this[_attributes].get(name);
42867    if (value) {
42868      yield value;
42869    }
42870    for (const child of this[_children]) {
42871      if (child[$nodeName] === name) {
42872        yield child;
42873      }
42874      if (allTransparent) {
42875        yield* child[$getChildrenByNameIt](name, allTransparent);
42876      }
42877    }
42878  }
42879  *[$getAttributeIt](name, skipConsumed) {
42880    const value = this[_attributes].get(name);
42881    if (value && (!skipConsumed || !value[$consumed])) {
42882      yield value;
42883    }
42884    for (const child of this[_children]) {
42885      yield* child[$getAttributeIt](name, skipConsumed);
42886    }
42887  }
42888  *[$getRealChildrenByNameIt](name, allTransparent, skipConsumed) {
42889    for (const child of this[_children]) {
vendor: 2,860 bytes, lines 42890-43002
42890      if (child[$nodeName] === name && (!skipConsumed || !child[$consumed])) {
42891        yield child;
42892      }
42893      if (allTransparent) {
42894        yield* child[$getRealChildrenByNameIt](name, allTransparent, skipConsumed);
42895      }
42896    }
42897  }
42898  [$isDataValue]() {
42899    if (this[_dataValue] === null) {
42900      return this[_children].length === 0 || this[_children][0][$namespaceId] === NamespaceIds.xhtml.id;
42901    }
42902    return this[_dataValue];
42903  }
42904  [$getDataValue]() {
42905    if (this[_dataValue] === null) {
42906      if (this[_children].length === 0) {
42907        return this[$content].trim();
42908      }
42909      if (this[_children][0][$namespaceId] === NamespaceIds.xhtml.id) {
42910        return this[_children][0][$text]().trim();
42911      }
42912      return null;
42913    }
42914    return this[$content].trim();
42915  }
42916  [$setValue](value) {
42917    value = value.value || "";
42918    this[$content] = value.toString();
42919  }
42920  [$dump](hasNS = false) {
42921    const dumped = Object.create(null);
42922    if (hasNS) {
42923      dumped.$ns = this[$namespaceId];
42924    }
42925    if (this[$content]) {
42926      dumped.$content = this[$content];
42927    }
42928    dumped.$name = this[$nodeName];
42929    dumped.children = [];
42930    for (const child of this[_children]) {
42931      dumped.children.push(child[$dump](hasNS));
42932    }
42933    dumped.attributes = Object.create(null);
42934    for (const [name, value] of this[_attributes]) {
42935      dumped.attributes[name] = value[$content];
42936    }
42937    return dumped;
42938  }
42939}
42940class ContentObject extends XFAObject {
42941  constructor(nsId, name) {
42942    super(nsId, name);
42943    this[$content] = "";
42944  }
42945  [$onText](text) {
42946    this[$content] += text;
42947  }
42948  [$finalize]() {}
42949}
42950class OptionObject extends ContentObject {
42951  constructor(nsId, name, options) {
42952    super(nsId, name);
42953    this[_options] = options;
42954  }
42955  [$finalize]() {
42956    this[$content] = getKeyword({
42957      data: this[$content],
42958      defaultValue: this[_options][0],
42959      validate: k => this[_options].includes(k)
42960    });
42961  }
42962  [$clean](builder) {
42963    super[$clean](builder);
42964    delete this[_options];
42965  }
42966}
42967class StringObject extends ContentObject {
42968  [$finalize]() {
42969    this[$content] = this[$content].trim();
42970  }
42971}
42972class IntegerObject extends ContentObject {
42973  constructor(nsId, name, defaultValue, validator) {
42974    super(nsId, name);
42975    this[_defaultValue] = defaultValue;
42976    this[_validator] = validator;
42977  }
42978  [$finalize]() {
42979    this[$content] = getInteger({
42980      data: this[$content],
42981      defaultValue: this[_defaultValue],
42982      validate: this[_validator]
42983    });
42984  }
42985  [$clean](builder) {
42986    super[$clean](builder);
42987    delete this[_defaultValue];
42988    delete this[_validator];
42989  }
42990}
42991class Option01 extends IntegerObject {
42992  constructor(nsId, name) {
42993    super(nsId, name, 0, n => n === 1);
42994  }
42995}
42996class Option10 extends IntegerObject {
42997  constructor(nsId, name) {
42998    super(nsId, name, 1, n => n === 0);
42999  }
43000}
43001
43002;// ./src/core/xfa/html_utils.js
vendor: 13,429 bytes, lines 43002-43476
43002
43003
43004
43005
43006
43007
43008
43009function measureToString(m) {
43010  if (typeof m === "string") {
43011    return "0px";
43012  }
43013  return Number.isInteger(m) ? `${m}px` : `${m.toFixed(2)}px`;
43014}
43015const converters = {
43016  anchorType(node, style) {
43017    const parent = node[$getSubformParent]();
43018    if (!parent || parent.layout && parent.layout !== "position") {
43019      return;
43020    }
43021    if (!("transform" in style)) {
43022      style.transform = "";
43023    }
43024    switch (node.anchorType) {
43025      case "bottomCenter":
43026        style.transform += "translate(-50%, -100%)";
43027        break;
43028      case "bottomLeft":
43029        style.transform += "translate(0,-100%)";
43030        break;
43031      case "bottomRight":
43032        style.transform += "translate(-100%,-100%)";
43033        break;
43034      case "middleCenter":
43035        style.transform += "translate(-50%,-50%)";
43036        break;
43037      case "middleLeft":
43038        style.transform += "translate(0,-50%)";
43039        break;
43040      case "middleRight":
43041        style.transform += "translate(-100%,-50%)";
43042        break;
43043      case "topCenter":
43044        style.transform += "translate(-50%,0)";
43045        break;
43046      case "topRight":
43047        style.transform += "translate(-100%,0)";
43048        break;
43049    }
43050  },
43051  dimensions(node, style) {
43052    const parent = node[$getSubformParent]();
43053    let width = node.w;
43054    const height = node.h;
43055    if (parent.layout?.includes("row")) {
43056      const extra = parent[$extra];
43057      const colSpan = node.colSpan;
43058      let w;
43059      if (colSpan === -1) {
43060        w = Math.sumPrecise(extra.columnWidths.slice(extra.currentColumn));
43061        extra.currentColumn = 0;
43062      } else {
43063        w = Math.sumPrecise(extra.columnWidths.slice(extra.currentColumn, extra.currentColumn + colSpan));
43064        extra.currentColumn = (extra.currentColumn + node.colSpan) % extra.columnWidths.length;
43065      }
43066      if (!isNaN(w)) {
43067        width = node.w = w;
43068      }
43069    }
43070    style.width = width !== "" ? measureToString(width) : "auto";
43071    style.height = height !== "" ? measureToString(height) : "auto";
43072  },
43073  position(node, style) {
43074    const parent = node[$getSubformParent]();
43075    if (parent?.layout && parent.layout !== "position") {
43076      return;
43077    }
43078    style.position = "absolute";
43079    style.left = measureToString(node.x);
43080    style.top = measureToString(node.y);
43081  },
43082  rotate(node, style) {
43083    if (node.rotate) {
43084      if (!("transform" in style)) {
43085        style.transform = "";
43086      }
43087      style.transform += `rotate(-${node.rotate}deg)`;
43088      style.transformOrigin = "top left";
43089    }
43090  },
43091  presence(node, style) {
43092    switch (node.presence) {
43093      case "invisible":
43094        style.visibility = "hidden";
43095        break;
43096      case "hidden":
43097      case "inactive":
43098        style.display = "none";
43099        break;
43100    }
43101  },
43102  hAlign(node, style) {
43103    if (node[$nodeName] === "para") {
43104      switch (node.hAlign) {
43105        case "justifyAll":
43106          style.textAlign = "justify-all";
43107          break;
43108        case "radix":
43109          style.textAlign = "left";
43110          break;
43111        default:
43112          style.textAlign = node.hAlign;
43113      }
43114    } else {
43115      switch (node.hAlign) {
43116        case "left":
43117          style.alignSelf = "start";
43118          break;
43119        case "center":
43120          style.alignSelf = "center";
43121          break;
43122        case "right":
43123          style.alignSelf = "end";
43124          break;
43125      }
43126    }
43127  },
43128  margin(node, style) {
43129    if (node.margin) {
43130      style.margin = node.margin[$toStyle]().margin;
43131    }
43132  }
43133};
43134function setMinMaxDimensions(node, style) {
43135  const parent = node[$getSubformParent]();
43136  if (parent.layout === "position") {
43137    if (node.minW > 0) {
43138      style.minWidth = measureToString(node.minW);
43139    }
43140    if (node.maxW > 0) {
43141      style.maxWidth = measureToString(node.maxW);
43142    }
43143    if (node.minH > 0) {
43144      style.minHeight = measureToString(node.minH);
43145    }
43146    if (node.maxH > 0) {
43147      style.maxHeight = measureToString(node.maxH);
43148    }
43149  }
43150}
43151function layoutText(text, xfaFont, margin, lineHeight, fontFinder, width) {
43152  const measure = new TextMeasure(xfaFont, margin, lineHeight, fontFinder);
43153  if (typeof text === "string") {
43154    measure.addString(text);
43155  } else {
43156    text[$pushGlyphs](measure);
43157  }
43158  return measure.compute(width);
43159}
43160function layoutNode(node, availableSpace) {
43161  let height = null;
43162  let width = null;
43163  let isBroken = false;
43164  if ((!node.w || !node.h) && node.value) {
43165    let marginH = 0;
43166    let marginV = 0;
43167    if (node.margin) {
43168      marginH = node.margin.leftInset + node.margin.rightInset;
43169      marginV = node.margin.topInset + node.margin.bottomInset;
43170    }
43171    let lineHeight = null;
43172    let margin = null;
43173    if (node.para) {
43174      margin = Object.create(null);
43175      lineHeight = node.para.lineHeight === "" ? null : node.para.lineHeight;
43176      margin.top = node.para.spaceAbove === "" ? 0 : node.para.spaceAbove;
43177      margin.bottom = node.para.spaceBelow === "" ? 0 : node.para.spaceBelow;
43178      margin.left = node.para.marginLeft === "" ? 0 : node.para.marginLeft;
43179      margin.right = node.para.marginRight === "" ? 0 : node.para.marginRight;
43180    }
43181    let font = node.font;
43182    if (!font) {
43183      const root = node[$getTemplateRoot]();
43184      let parent = node[$getParent]();
43185      while (parent && parent !== root) {
43186        if (parent.font) {
43187          font = parent.font;
43188          break;
43189        }
43190        parent = parent[$getParent]();
43191      }
43192    }
43193    const maxWidth = (node.w || availableSpace.width) - marginH;
43194    const fontFinder = node[$globalData].fontFinder;
43195    if (node.value.exData && node.value.exData[$content] && node.value.exData.contentType === "text/html") {
43196      const res = layoutText(node.value.exData[$content], font, margin, lineHeight, fontFinder, maxWidth);
43197      width = res.width;
43198      height = res.height;
43199      isBroken = res.isBroken;
43200    } else {
43201      const text = node.value[$text]();
43202      if (text) {
43203        const res = layoutText(text, font, margin, lineHeight, fontFinder, maxWidth);
43204        width = res.width;
43205        height = res.height;
43206        isBroken = res.isBroken;
43207      }
43208    }
43209    if (width !== null && !node.w) {
43210      width += marginH;
43211    }
43212    if (height !== null && !node.h) {
43213      height += marginV;
43214    }
43215  }
43216  return {
43217    w: width,
43218    h: height,
43219    isBroken
43220  };
43221}
43222function computeBbox(node, html, availableSpace) {
43223  let bbox;
43224  if (node.w !== "" && node.h !== "") {
43225    bbox = [node.x, node.y, node.w, node.h];
43226  } else {
43227    if (!availableSpace) {
43228      return null;
43229    }
43230    let width = node.w;
43231    if (width === "") {
43232      if (node.maxW === 0) {
43233        const parent = node[$getSubformParent]();
43234        width = parent.layout === "position" && parent.w !== "" ? 0 : node.minW;
43235      } else {
43236        width = Math.min(node.maxW, availableSpace.width);
43237      }
43238      html.attributes.style.width = measureToString(width);
43239    }
43240    let height = node.h;
43241    if (height === "") {
43242      if (node.maxH === 0) {
43243        const parent = node[$getSubformParent]();
43244        height = parent.layout === "position" && parent.h !== "" ? 0 : node.minH;
43245      } else {
43246        height = Math.min(node.maxH, availableSpace.height);
43247      }
43248      html.attributes.style.height = measureToString(height);
43249    }
43250    bbox = [node.x, node.y, width, height];
43251  }
43252  return bbox;
43253}
43254function fixDimensions(node) {
43255  const parent = node[$getSubformParent]();
43256  if (parent.layout?.includes("row")) {
43257    const extra = parent[$extra];
43258    const colSpan = node.colSpan;
43259    let width;
43260    if (colSpan === -1) {
43261      width = Math.sumPrecise(extra.columnWidths.slice(extra.currentColumn));
43262    } else {
43263      width = Math.sumPrecise(extra.columnWidths.slice(extra.currentColumn, extra.currentColumn + colSpan));
43264    }
43265    if (!isNaN(width)) {
43266      node.w = width;
43267    }
43268  }
43269  if (parent.layout && parent.layout !== "position") {
43270    node.x = node.y = 0;
43271  }
43272  if (node.layout === "table") {
43273    if (node.w === "" && Array.isArray(node.columnWidths)) {
43274      node.w = Math.sumPrecise(node.columnWidths);
43275    }
43276  }
43277}
43278function layoutClass(node) {
43279  switch (node.layout) {
43280    case "position":
43281      return "xfaPosition";
43282    case "lr-tb":
43283      return "xfaLrTb";
43284    case "rl-row":
43285      return "xfaRlRow";
43286    case "rl-tb":
43287      return "xfaRlTb";
43288    case "row":
43289      return "xfaRow";
43290    case "table":
43291      return "xfaTable";
43292    case "tb":
43293      return "xfaTb";
43294    default:
43295      return "xfaPosition";
43296  }
43297}
43298function toStyle(node, ...names) {
43299  const style = Object.create(null);
43300  for (const name of names) {
43301    const value = node[name];
43302    if (value === null) {
43303      continue;
43304    }
43305    if (Object.hasOwn(converters, name)) {
43306      converters[name](node, style);
43307      continue;
43308    }
43309    if (value instanceof XFAObject) {
43310      const newStyle = value[$toStyle]();
43311      if (newStyle) {
43312        Object.assign(style, newStyle);
43313      } else {
43314        warn(`(DEBUG) - XFA - style for ${name} not implemented yet`);
43315      }
43316    }
43317  }
43318  return style;
43319}
43320function createWrapper(node, html) {
43321  const {
43322    attributes
43323  } = html;
43324  const {
43325    style
43326  } = attributes;
43327  const wrapper = {
43328    name: "div",
43329    attributes: {
43330      class: ["xfaWrapper"],
43331      style: Object.create(null)
43332    },
43333    children: []
43334  };
43335  attributes.class.push("xfaWrapped");
43336  if (node.border) {
43337    const {
43338      widths,
43339      insets
43340    } = node.border[$extra];
43341    let width, height;
43342    let top = insets[0];
43343    let left = insets[3];
43344    const insetsH = insets[0] + insets[2];
43345    const insetsW = insets[1] + insets[3];
43346    switch (node.border.hand) {
43347      case "even":
43348        top -= widths[0] / 2;
43349        left -= widths[3] / 2;
43350        width = `calc(100% + ${(widths[1] + widths[3]) / 2 - insetsW}px)`;
43351        height = `calc(100% + ${(widths[0] + widths[2]) / 2 - insetsH}px)`;
43352        break;
43353      case "left":
43354        top -= widths[0];
43355        left -= widths[3];
43356        width = `calc(100% + ${widths[1] + widths[3] - insetsW}px)`;
43357        height = `calc(100% + ${widths[0] + widths[2] - insetsH}px)`;
43358        break;
43359      case "right":
43360        width = insetsW ? `calc(100% - ${insetsW}px)` : "100%";
43361        height = insetsH ? `calc(100% - ${insetsH}px)` : "100%";
43362        break;
43363    }
43364    const classNames = ["xfaBorder"];
43365    if (isPrintOnly(node.border)) {
43366      classNames.push("xfaPrintOnly");
43367    }
43368    const border = {
43369      name: "div",
43370      attributes: {
43371        class: classNames,
43372        style: {
43373          top: `${top}px`,
43374          left: `${left}px`,
43375          width,
43376          height
43377        }
43378      },
43379      children: []
43380    };
43381    for (const key of ["border", "borderWidth", "borderColor", "borderRadius", "borderStyle"]) {
43382      if (style[key] !== undefined) {
43383        border.attributes.style[key] = style[key];
43384        delete style[key];
43385      }
43386    }
43387    wrapper.children.push(border, html);
43388  } else {
43389    wrapper.children.push(html);
43390  }
43391  for (const key of ["background", "backgroundClip", "top", "left", "width", "height", "minWidth", "minHeight", "maxWidth", "maxHeight", "transform", "transformOrigin", "visibility"]) {
43392    if (style[key] !== undefined) {
43393      wrapper.attributes.style[key] = style[key];
43394      delete style[key];
43395    }
43396  }
43397  wrapper.attributes.style.position = style.position === "absolute" ? "absolute" : "relative";
43398  delete style.position;
43399  if (style.alignSelf) {
43400    wrapper.attributes.style.alignSelf = style.alignSelf;
43401    delete style.alignSelf;
43402  }
43403  return wrapper;
43404}
43405function fixTextIndent(styles) {
43406  const indent = getMeasurement(styles.textIndent, "0px");
43407  if (indent >= 0) {
43408    return;
43409  }
43410  const align = styles.textAlign === "right" ? "right" : "left";
43411  const name = "padding" + (align === "left" ? "Left" : "Right");
43412  const padding = getMeasurement(styles[name], "0px");
43413  styles[name] = `${padding - indent}px`;
43414}
43415function setAccess(node, classNames) {
43416  switch (node.access) {
43417    case "nonInteractive":
43418      classNames.push("xfaNonInteractive");
43419      break;
43420    case "readOnly":
43421      classNames.push("xfaReadOnly");
43422      break;
43423    case "protected":
43424      classNames.push("xfaDisabled");
43425      break;
43426  }
43427}
43428function isPrintOnly(node) {
43429  return node.relevant.length > 0 && !node.relevant[0].excluded && node.relevant[0].viewname === "print";
43430}
43431function getCurrentPara(node) {
43432  const stack = node[$getTemplateRoot]()[$extra].paraStack;
43433  return stack.length ? stack.at(-1) : null;
43434}
43435function setPara(node, nodeStyle, value) {
43436  if (value.attributes.class?.includes("xfaRich")) {
43437    if (nodeStyle) {
43438      if (node.h === "") {
43439        nodeStyle.height = "auto";
43440      }
43441      if (node.w === "") {
43442        nodeStyle.width = "auto";
43443      }
43444    }
43445    const para = getCurrentPara(node);
43446    if (para) {
43447      const valueStyle = value.attributes.style;
43448      valueStyle.display = "flex";
43449      valueStyle.flexDirection = "column";
43450      switch (para.vAlign) {
43451        case "top":
43452          valueStyle.justifyContent = "start";
43453          break;
43454        case "bottom":
43455          valueStyle.justifyContent = "end";
43456          break;
43457        case "middle":
43458          valueStyle.justifyContent = "center";
43459          break;
43460      }
43461      const paraStyle = para[$toStyle]();
43462      for (const [key, val] of Object.entries(paraStyle)) {
43463        if (!(key in valueStyle)) {
43464          valueStyle[key] = val;
43465        }
43466      }
43467    }
43468  }
43469}
43470function setFontFamily(xfaFont, node, fontFinder, style) {
43471  if (!fontFinder) {
43472    delete style.fontFamily;
43473    return;
43474  }
43475  const name = stripQuotes(xfaFont.typeface);
43476  style.fontFamily = 
vendor: 4,766 bytes, lines 43476-43652
43476`"${name}"`;
43477  const typeface = fontFinder.find(name);
43478  if (typeface) {
43479    const {
43480      fontFamily
43481    } = typeface.regular.cssFontInfo;
43482    if (fontFamily !== name) {
43483      style.fontFamily = `"${fontFamily}"`;
43484    }
43485    const para = getCurrentPara(node);
43486    if (para && para.lineHeight !== "") {
43487      return;
43488    }
43489    if (style.lineHeight) {
43490      return;
43491    }
43492    const pdfFont = selectFont(xfaFont, typeface);
43493    if (pdfFont) {
43494      style.lineHeight = Math.max(1.2, pdfFont.lineHeight);
43495    }
43496  }
43497}
43498function fixURL(str) {
43499  const absoluteUrl = createValidAbsoluteUrl(str, null, {
43500    addDefaultProtocol: true,
43501    tryConvertEncoding: true
43502  });
43503  return absoluteUrl ? absoluteUrl.href : null;
43504}
43505
43506;// ./src/core/xfa/layout.js
43507
43508
43509
43510function createLine(node, children) {
43511  return {
43512    name: "div",
43513    attributes: {
43514      class: [node.layout === "lr-tb" ? "xfaLr" : "xfaRl"]
43515    },
43516    children
43517  };
43518}
43519function flushHTML(node) {
43520  if (!node[$extra]) {
43521    return null;
43522  }
43523  const attributes = node[$extra].attributes;
43524  const html = {
43525    name: "div",
43526    attributes,
43527    children: node[$extra].children
43528  };
43529  if (node[$extra].failingNode) {
43530    const htmlFromFailing = node[$extra].failingNode[$flushHTML]();
43531    if (htmlFromFailing) {
43532      if (node.layout.endsWith("-tb")) {
43533        html.children.push(createLine(node, [htmlFromFailing]));
43534      } else {
43535        html.children.push(htmlFromFailing);
43536      }
43537    }
43538  }
43539  if (html.children.length === 0) {
43540    return null;
43541  }
43542  return html;
43543}
43544function addHTML(node, html, bbox) {
43545  const extra = node[$extra];
43546  const availableSpace = extra.availableSpace;
43547  const [x, y, w, h] = bbox;
43548  switch (node.layout) {
43549    case "position":
43550      {
43551        extra.width = Math.max(extra.width, x + w);
43552        extra.height = Math.max(extra.height, y + h);
43553        extra.children.push(html);
43554        break;
43555      }
43556    case "lr-tb":
43557    case "rl-tb":
43558      if (!extra.line || extra.attempt === 1) {
43559        extra.line = createLine(node, []);
43560        extra.children.push(extra.line);
43561        extra.numberInLine = 0;
43562      }
43563      extra.numberInLine += 1;
43564      extra.line.children.push(html);
43565      if (extra.attempt === 0) {
43566        extra.currentWidth += w;
43567        extra.height = Math.max(extra.height, extra.prevHeight + h);
43568      } else {
43569        extra.currentWidth = w;
43570        extra.prevHeight = extra.height;
43571        extra.height += h;
43572        extra.attempt = 0;
43573      }
43574      extra.width = Math.max(extra.width, extra.currentWidth);
43575      break;
43576    case "rl-row":
43577    case "row":
43578      {
43579        extra.children.push(html);
43580        extra.width += w;
43581        extra.height = Math.max(extra.height, h);
43582        const height = measureToString(extra.height);
43583        for (const child of extra.children) {
43584          child.attributes.style.height = height;
43585        }
43586        break;
43587      }
43588    case "table":
43589      {
43590        extra.width = MathClamp(w, extra.width, availableSpace.width);
43591        extra.height += h;
43592        extra.children.push(html);
43593        break;
43594      }
43595    case "tb":
43596      {
43597        extra.width = MathClamp(w, extra.width, availableSpace.width);
43598        extra.height += h;
43599        extra.children.push(html);
43600        break;
43601      }
43602  }
43603}
43604function getAvailableSpace(node) {
43605  const availableSpace = node[$extra].availableSpace;
43606  const marginV = node.margin ? node.margin.topInset + node.margin.bottomInset : 0;
43607  const marginH = node.margin ? node.margin.leftInset + node.margin.rightInset : 0;
43608  switch (node.layout) {
43609    case "lr-tb":
43610    case "rl-tb":
43611      if (node[$extra].attempt === 0) {
43612        return {
43613          width: availableSpace.width - marginH - node[$extra].currentWidth,
43614          height: availableSpace.height - marginV - node[$extra].prevHeight
43615        };
43616      }
43617      return {
43618        width: availableSpace.width - marginH,
43619        height: availableSpace.height - marginV - node[$extra].height
43620      };
43621    case "rl-row":
43622    case "row":
43623      const width = Math.sumPrecise(node[$extra].columnWidths.slice(node[$extra].currentColumn));
43624      return {
43625        width,
43626        height: availableSpace.height - marginH
43627      };
43628    case "table":
43629    case "tb":
43630      return {
43631        width: availableSpace.width - marginH,
43632        height: availableSpace.height - marginV - node[$extra].height
43633      };
43634    case "position":
43635    default:
43636      return availableSpace;
43637  }
43638}
43639function getTransformedBBox(node) {
43640  let w = node.w === "" ? NaN : node.w;
43641  let h = node.h === "" ? NaN : node.h;
43642  let [centerX, centerY] = [0, 0];
43643  switch (node.anchorType || "") {
43644    case "bottomCenter":
43645      [centerX, centerY] = [w / 2, h];
43646      break;
43647    case "bottomLeft":
43648      [centerX, centerY] = [0, h];
43649      break;
43650    case "bottomRight":
43651      [centerX, centerY] = [w, h];
43652      break;
vendor: 3,501 bytes, lines 43653-43787
43653    case "middleCenter":
43654      [centerX, centerY] = [w / 2, h / 2];
43655      break;
43656    case "middleLeft":
43657      [centerX, centerY] = [0, h / 2];
43658      break;
43659    case "middleRight":
43660      [centerX, centerY] = [w, h / 2];
43661      break;
43662    case "topCenter":
43663      [centerX, centerY] = [w / 2, 0];
43664      break;
43665    case "topRight":
43666      [centerX, centerY] = [w, 0];
43667      break;
43668  }
43669  let x, y;
43670  switch (node.rotate || 0) {
43671    case 0:
43672      [x, y] = [-centerX, -centerY];
43673      break;
43674    case 90:
43675      [x, y] = [-centerY, centerX];
43676      [w, h] = [h, -w];
43677      break;
43678    case 180:
43679      [x, y] = [centerX, centerY];
43680      [w, h] = [-w, -h];
43681      break;
43682    case 270:
43683      [x, y] = [centerY, -centerX];
43684      [w, h] = [-h, w];
43685      break;
43686  }
43687  return [node.x + x + Math.min(0, w), node.y + y + Math.min(0, h), Math.abs(w), Math.abs(h)];
43688}
43689function checkDimensions(node, space) {
43690  if (node[$getTemplateRoot]()[$extra].firstUnsplittable === null) {
43691    return true;
43692  }
43693  if (node.w === 0 || node.h === 0) {
43694    return true;
43695  }
43696  const ERROR = 2;
43697  const parent = node[$getSubformParent]();
43698  const attempt = parent[$extra]?.attempt || 0;
43699  const [, y, w, h] = getTransformedBBox(node);
43700  switch (parent.layout) {
43701    case "lr-tb":
43702    case "rl-tb":
43703      if (attempt === 0) {
43704        if (!node[$getTemplateRoot]()[$extra].noLayoutFailure) {
43705          if (node.h !== "" && Math.round(h - space.height) > ERROR) {
43706            return false;
43707          }
43708          if (node.w !== "") {
43709            if (Math.round(w - space.width) <= ERROR) {
43710              return true;
43711            }
43712            if (parent[$extra].numberInLine === 0) {
43713              return space.height > ERROR;
43714            }
43715            return false;
43716          }
43717          return space.width > ERROR;
43718        }
43719        if (node.w !== "") {
43720          return Math.round(w - space.width) <= ERROR;
43721        }
43722        return space.width > ERROR;
43723      }
43724      if (node[$getTemplateRoot]()[$extra].noLayoutFailure) {
43725        return true;
43726      }
43727      if (node.h !== "" && Math.round(h - space.height) > ERROR) {
43728        return false;
43729      }
43730      if (node.w === "" || Math.round(w - space.width) <= ERROR) {
43731        return space.height > ERROR;
43732      }
43733      if (parent[$isThereMoreWidth]()) {
43734        return false;
43735      }
43736      return space.height > ERROR;
43737    case "table":
43738    case "tb":
43739      if (node[$getTemplateRoot]()[$extra].noLayoutFailure) {
43740        return true;
43741      }
43742      if (node.h !== "" && !node[$isSplittable]()) {
43743        return Math.round(h - space.height) <= ERROR;
43744      }
43745      if (node.w === "" || Math.round(w - space.width) <= ERROR) {
43746        return space.height > ERROR;
43747      }
43748      if (parent[$isThereMoreWidth]()) {
43749        return false;
43750      }
43751      return space.height > ERROR;
43752    case "position":
43753      if (node[$getTemplateRoot]()[$extra].noLayoutFailure) {
43754        return true;
43755      }
43756      if (node.h === "" || Math.round(h + y - space.height) <= ERROR) {
43757        return true;
43758      }
43759      const area = node[$getTemplateRoot]()[$extra].currentContentArea;
43760      return h + y > area.h;
43761    case "rl-row":
43762    case "row":
43763      if (node[$getTemplateRoot]()[$extra].noLayoutFailure) {
43764        return true;
43765      }
43766      if (node.h !== "") {
43767        return Math.round(h - space.height) <= ERROR;
43768      }
43769      return true;
43770    default:
43771      return true;
43772  }
43773}
43774
43775;// ./src/core/xfa/template.js
43776
43777
43778
43779
43780
43781
43782
43783
43784
43785
43786const TEMPLATE_NS_ID = NamespaceIds.template.id;
43787const SVG_NS = "http://www.w3.org/2000/svg"
vendor: 61,840 bytes, lines 43787-45714
43787;
43788const MAX_ATTEMPTS_FOR_LRTB_LAYOUT = 2;
43789const MAX_EMPTY_PAGES = 3;
43790const DEFAULT_TAB_INDEX = 5000;
43791const HEADING_PATTERN = /^H(\d+)$/;
43792const MIMES = new Set(["image/gif", "image/jpeg", "image/jpg", "image/pjpeg", "image/png", "image/apng", "image/x-png", "image/bmp", "image/x-ms-bmp", "image/tiff", "image/tif", "application/octet-stream"]);
43793const IMAGES_HEADERS = [[[0x42, 0x4d], "image/bmp"], [[0xff, 0xd8, 0xff], "image/jpeg"], [[0x49, 0x49, 0x2a, 0x00], "image/tiff"], [[0x4d, 0x4d, 0x00, 0x2a], "image/tiff"], [[0x47, 0x49, 0x46, 0x38, 0x39, 0x61], "image/gif"], [[0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a], "image/png"]];
43794function getBorderDims(node) {
43795  if (!node || !node.border) {
43796    return {
43797      w: 0,
43798      h: 0
43799    };
43800  }
43801  const borderExtra = node.border[$getExtra]();
43802  if (!borderExtra) {
43803    return {
43804      w: 0,
43805      h: 0
43806    };
43807  }
43808  return {
43809    w: borderExtra.widths[0] + borderExtra.widths[2] + borderExtra.insets[0] + borderExtra.insets[2],
43810    h: borderExtra.widths[1] + borderExtra.widths[3] + borderExtra.insets[1] + borderExtra.insets[3]
43811  };
43812}
43813function hasMargin(node) {
43814  return node.margin && (node.margin.topInset || node.margin.rightInset || node.margin.bottomInset || node.margin.leftInset);
43815}
43816function _setValue(templateNode, value) {
43817  if (!templateNode.value) {
43818    const nodeValue = new Value({});
43819    templateNode[$appendChild](nodeValue);
43820    templateNode.value = nodeValue;
43821  }
43822  templateNode.value[$setValue](value);
43823}
43824function* getContainedChildren(node) {
43825  for (const child of node[$getChildren]()) {
43826    if (child instanceof SubformSet) {
43827      yield* child[$getContainedChildren]();
43828      continue;
43829    }
43830    yield child;
43831  }
43832}
43833function isRequired(node) {
43834  return node.validate?.nullTest === "error";
43835}
43836function setTabIndex(node) {
43837  while (node) {
43838    if (!node.traversal) {
43839      node[$tabIndex] = node[$getParent]()[$tabIndex];
43840      return;
43841    }
43842    if (node[$tabIndex]) {
43843      return;
43844    }
43845    let next = null;
43846    for (const child of node.traversal[$getChildren]()) {
43847      if (child.operation === "next") {
43848        next = child;
43849        break;
43850      }
43851    }
43852    if (!next || !next.ref) {
43853      node[$tabIndex] = node[$getParent]()[$tabIndex];
43854      return;
43855    }
43856    const root = node[$getTemplateRoot]();
43857    node[$tabIndex] = ++root[$tabIndex];
43858    const ref = root[$searchNode](next.ref, node);
43859    if (!ref) {
43860      return;
43861    }
43862    node = ref[0];
43863  }
43864}
43865function applyAssist(obj, attributes) {
43866  const assist = obj.assist;
43867  if (assist) {
43868    const assistTitle = assist[$toHTML]();
43869    if (assistTitle) {
43870      attributes.title = assistTitle;
43871    }
43872    const role = assist.role;
43873    const match = role.match(HEADING_PATTERN);
43874    if (match) {
43875      const ariaRole = "heading";
43876      const ariaLevel = match[1];
43877      attributes.role = ariaRole;
43878      attributes["aria-level"] = ariaLevel;
43879    }
43880  }
43881  if (obj.layout === "table") {
43882    attributes.role = "table";
43883  } else if (obj.layout === "row") {
43884    attributes.role = "row";
43885  } else {
43886    const parent = obj[$getParent]();
43887    if (parent.layout === "row") {
43888      attributes.role = parent.assist?.role === "TH" ? "columnheader" : "cell";
43889    }
43890  }
43891}
43892function ariaLabel(obj) {
43893  if (!obj.assist) {
43894    return null;
43895  }
43896  const assist = obj.assist;
43897  if (assist.speak && assist.speak[$content] !== "") {
43898    return assist.speak[$content];
43899  }
43900  if (assist.toolTip) {
43901    return assist.toolTip[$content];
43902  }
43903  return null;
43904}
43905function valueToHtml(value) {
43906  return HTMLResult.success({
43907    name: "div",
43908    attributes: {
43909      class: ["xfaRich"],
43910      style: Object.create(null)
43911    },
43912    children: [{
43913      name: "span",
43914      attributes: {
43915        style: Object.create(null)
43916      },
43917      value
43918    }]
43919  });
43920}
43921function setFirstUnsplittable(node) {
43922  const root = node[$getTemplateRoot]();
43923  if (root[$extra].firstUnsplittable === null) {
43924    root[$extra].firstUnsplittable = node;
43925    root[$extra].noLayoutFailure = true;
43926  }
43927}
43928function unsetFirstUnsplittable(node) {
43929  const root = node[$getTemplateRoot]();
43930  if (root[$extra].firstUnsplittable === node) {
43931    root[$extra].noLayoutFailure = false;
43932  }
43933}
43934function handleBreak(node) {
43935  if (node[$extra]) {
43936    return false;
43937  }
43938  node[$extra] = Object.create(null);
43939  if (node.targetType === "auto") {
43940    return false;
43941  }
43942  const root = node[$getTemplateRoot]();
43943  let target = null;
43944  if (node.target) {
43945    target = root[$searchNode](node.target, node[$getParent]());
43946    if (!target) {
43947      return false;
43948    }
43949    target = target[0];
43950  }
43951  const {
43952    currentPageArea,
43953    currentContentArea
43954  } = root[$extra];
43955  if (node.targetType === "pageArea") {
43956    if (!(target instanceof PageArea)) {
43957      target = null;
43958    }
43959    if (node.startNew) {
43960      node[$extra].target = target || currentPageArea;
43961      return true;
43962    } else if (target && target !== currentPageArea) {
43963      node[$extra].target = target;
43964      return true;
43965    }
43966    return false;
43967  }
43968  if (!(target instanceof ContentArea)) {
43969    target = null;
43970  }
43971  const pageArea = target && target[$getParent]();
43972  let index;
43973  let nextPageArea = pageArea;
43974  if (node.startNew) {
43975    if (target) {
43976      const contentAreas = pageArea.contentArea.children;
43977      const indexForCurrent = contentAreas.indexOf(currentContentArea);
43978      const indexForTarget = contentAreas.indexOf(target);
43979      if (indexForCurrent !== -1 && indexForCurrent < indexForTarget) {
43980        nextPageArea = null;
43981      }
43982      index = indexForTarget - 1;
43983    } else {
43984      index = currentPageArea.contentArea.children.indexOf(currentContentArea);
43985    }
43986  } else if (target && target !== currentContentArea) {
43987    const contentAreas = pageArea.contentArea.children;
43988    index = contentAreas.indexOf(target) - 1;
43989    nextPageArea = pageArea === currentPageArea ? null : pageArea;
43990  } else {
43991    return false;
43992  }
43993  node[$extra].target = nextPageArea;
43994  node[$extra].index = index;
43995  return true;
43996}
43997function handleOverflow(node, extraNode, space) {
43998  const root = node[$getTemplateRoot]();
43999  const saved = root[$extra].noLayoutFailure;
44000  const savedMethod = extraNode[$getSubformParent];
44001  extraNode[$getSubformParent] = () => node;
44002  root[$extra].noLayoutFailure = true;
44003  const res = extraNode[$toHTML](space);
44004  node[$addHTML](res.html, res.bbox);
44005  root[$extra].noLayoutFailure = saved;
44006  extraNode[$getSubformParent] = savedMethod;
44007}
44008class AppearanceFilter extends StringObject {
44009  constructor(attributes) {
44010    super(TEMPLATE_NS_ID, "appearanceFilter");
44011    this.id = attributes.id || "";
44012    this.type = getStringOption(attributes.type, ["optional", "required"]);
44013    this.use = attributes.use || "";
44014    this.usehref = attributes.usehref || "";
44015  }
44016}
44017class Arc extends XFAObject {
44018  constructor(attributes) {
44019    super(TEMPLATE_NS_ID, "arc", true);
44020    this.circular = getInteger({
44021      data: attributes.circular,
44022      defaultValue: 0,
44023      validate: x => x === 1
44024    });
44025    this.hand = getStringOption(attributes.hand, ["even", "left", "right"]);
44026    this.id = attributes.id || "";
44027    this.startAngle = getFloat({
44028      data: attributes.startAngle,
44029      defaultValue: 0,
44030      validate: x => true
44031    });
44032    this.sweepAngle = getFloat({
44033      data: attributes.sweepAngle,
44034      defaultValue: 360,
44035      validate: x => true
44036    });
44037    this.use = attributes.use || "";
44038    this.usehref = attributes.usehref || "";
44039    this.edge = null;
44040    this.fill = null;
44041  }
44042  [$toHTML]() {
44043    const edge = this.edge || new Edge({});
44044    const edgeStyle = edge[$toStyle]();
44045    const style = Object.create(null);
44046    if (this.fill?.presence === "visible") {
44047      Object.assign(style, this.fill[$toStyle]());
44048    } else {
44049      style.fill = "transparent";
44050    }
44051    style.strokeWidth = measureToString(edge.presence === "visible" ? edge.thickness : 0);
44052    style.stroke = edgeStyle.color;
44053    let arc;
44054    const attributes = {
44055      xmlns: SVG_NS,
44056      style: {
44057        width: "100%",
44058        height: "100%",
44059        overflow: "visible"
44060      }
44061    };
44062    if (this.sweepAngle === 360) {
44063      arc = {
44064        name: "ellipse",
44065        attributes: {
44066          xmlns: SVG_NS,
44067          cx: "50%",
44068          cy: "50%",
44069          rx: "50%",
44070          ry: "50%",
44071          style
44072        }
44073      };
44074    } else {
44075      const startAngle = this.startAngle * Math.PI / 180;
44076      const sweepAngle = this.sweepAngle * Math.PI / 180;
44077      const largeArc = this.sweepAngle > 180 ? 1 : 0;
44078      const [x1, y1, x2, y2] = [50 * (1 + Math.cos(startAngle)), 50 * (1 - Math.sin(startAngle)), 50 * (1 + Math.cos(startAngle + sweepAngle)), 50 * (1 - Math.sin(startAngle + sweepAngle))];
44079      arc = {
44080        name: "path",
44081        attributes: {
44082          xmlns: SVG_NS,
44083          d: `M ${x1} ${y1} A 50 50 0 ${largeArc} 0 ${x2} ${y2}`,
44084          vectorEffect: "non-scaling-stroke",
44085          style
44086        }
44087      };
44088      Object.assign(attributes, {
44089        viewBox: "0 0 100 100",
44090        preserveAspectRatio: "none"
44091      });
44092    }
44093    const svg = {
44094      name: "svg",
44095      children: [arc],
44096      attributes
44097    };
44098    const parent = this[$getParent]()[$getParent]();
44099    if (hasMargin(parent)) {
44100      return HTMLResult.success({
44101        name: "div",
44102        attributes: {
44103          style: {
44104            display: "inline",
44105            width: "100%",
44106            height: "100%"
44107          }
44108        },
44109        children: [svg]
44110      });
44111    }
44112    svg.attributes.style.position = "absolute";
44113    return HTMLResult.success(svg);
44114  }
44115}
44116class Area extends XFAObject {
44117  constructor(attributes) {
44118    super(TEMPLATE_NS_ID, "area", true);
44119    this.colSpan = getInteger({
44120      data: attributes.colSpan,
44121      defaultValue: 1,
44122      validate: n => n >= 1 || n === -1
44123    });
44124    this.id = attributes.id || "";
44125    this.name = attributes.name || "";
44126    this.relevant = getRelevant(attributes.relevant);
44127    this.use = attributes.use || "";
44128    this.usehref = attributes.usehref || "";
44129    this.x = getMeasurement(attributes.x, "0pt");
44130    this.y = getMeasurement(attributes.y, "0pt");
44131    this.desc = null;
44132    this.extras = null;
44133    this.area = new XFAObjectArray();
44134    this.draw = new XFAObjectArray();
44135    this.exObject = new XFAObjectArray();
44136    this.exclGroup = new XFAObjectArray();
44137    this.field = new XFAObjectArray();
44138    this.subform = new XFAObjectArray();
44139    this.subformSet = new XFAObjectArray();
44140  }
44141  *[$getContainedChildren]() {
44142    yield* getContainedChildren(this);
44143  }
44144  [$isTransparent]() {
44145    return true;
44146  }
44147  [$isBindable]() {
44148    return true;
44149  }
44150  [$addHTML](html, bbox) {
44151    const [x, y, w, h] = bbox;
44152    this[$extra].width = Math.max(this[$extra].width, x + w);
44153    this[$extra].height = Math.max(this[$extra].height, y + h);
44154    this[$extra].children.push(html);
44155  }
44156  [$getAvailableSpace]() {
44157    return this[$extra].availableSpace;
44158  }
44159  [$toHTML](availableSpace) {
44160    const style = toStyle(this, "position");
44161    const attributes = {
44162      style,
44163      id: this[$uid],
44164      class: ["xfaArea"]
44165    };
44166    if (isPrintOnly(this)) {
44167      attributes.class.push("xfaPrintOnly");
44168    }
44169    if (this.name) {
44170      attributes.xfaName = this.name;
44171    }
44172    const children = [];
44173    this[$extra] = {
44174      children,
44175      width: 0,
44176      height: 0,
44177      availableSpace
44178    };
44179    const result = this[$childrenToHTML]({
44180      filter: new Set(["area", "draw", "field", "exclGroup", "subform", "subformSet"]),
44181      include: true
44182    });
44183    if (!result.success) {
44184      if (result.isBreak()) {
44185        return result;
44186      }
44187      delete this[$extra];
44188      return HTMLResult.FAILURE;
44189    }
44190    style.width = measureToString(this[$extra].width);
44191    style.height = measureToString(this[$extra].height);
44192    const html = {
44193      name: "div",
44194      attributes,
44195      children
44196    };
44197    const bbox = [this.x, this.y, this[$extra].width, this[$extra].height];
44198    delete this[$extra];
44199    return HTMLResult.success(html, bbox);
44200  }
44201}
44202class Assist extends XFAObject {
44203  constructor(attributes) {
44204    super(TEMPLATE_NS_ID, "assist", true);
44205    this.id = attributes.id || "";
44206    this.role = attributes.role || "";
44207    this.use = attributes.use || "";
44208    this.usehref = attributes.usehref || "";
44209    this.speak = null;
44210    this.toolTip = null;
44211  }
44212  [$toHTML]() {
44213    return this.toolTip?.[$content] || null;
44214  }
44215}
44216class Barcode extends XFAObject {
44217  constructor(attributes) {
44218    super(TEMPLATE_NS_ID, "barcode", true);
44219    this.charEncoding = getKeyword({
44220      data: attributes.charEncoding ? attributes.charEncoding.toLowerCase() : "",
44221      defaultValue: "",
44222      validate: k => ["utf-8", "big-five", "fontspecific", "gbk", "gb-18030", "gb-2312", "ksc-5601", "none", "shift-jis", "ucs-2", "utf-16"].includes(k) || k.match(/iso-8859-\d{2}/)
44223    });
44224    this.checksum = getStringOption(attributes.checksum, ["none", "1mod10", "1mod10_1mod11", "2mod10", "auto"]);
44225    this.dataColumnCount = getInteger({
44226      data: attributes.dataColumnCount,
44227      defaultValue: -1,
44228      validate: x => x >= 0
44229    });
44230    this.dataLength = getInteger({
44231      data: attributes.dataLength,
44232      defaultValue: -1,
44233      validate: x => x >= 0
44234    });
44235    this.dataPrep = getStringOption(attributes.dataPrep, ["none", "flateCompress"]);
44236    this.dataRowCount = getInteger({
44237      data: attributes.dataRowCount,
44238      defaultValue: -1,
44239      validate: x => x >= 0
44240    });
44241    this.endChar = attributes.endChar || "";
44242    this.errorCorrectionLevel = getInteger({
44243      data: attributes.errorCorrectionLevel,
44244      defaultValue: -1,
44245      validate: x => x >= 0 && x <= 8
44246    });
44247    this.id = attributes.id || "";
44248    this.moduleHeight = getMeasurement(attributes.moduleHeight, "5mm");
44249    this.moduleWidth = getMeasurement(attributes.moduleWidth, "0.25mm");
44250    this.printCheckDigit = getInteger({
44251      data: attributes.printCheckDigit,
44252      defaultValue: 0,
44253      validate: x => x === 1
44254    });
44255    this.rowColumnRatio = getRatio(attributes.rowColumnRatio);
44256    this.startChar = attributes.startChar || "";
44257    this.textLocation = getStringOption(attributes.textLocation, ["below", "above", "aboveEmbedded", "belowEmbedded", "none"]);
44258    this.truncate = getInteger({
44259      data: attributes.truncate,
44260      defaultValue: 0,
44261      validate: x => x === 1
44262    });
44263    this.type = getStringOption(attributes.type ? attributes.type.toLowerCase() : "", ["aztec", "codabar", "code2of5industrial", "code2of5interleaved", "code2of5matrix", "code2of5standard", "code3of9", "code3of9extended", "code11", "code49", "code93", "code128", "code128a", "code128b", "code128c", "code128sscc", "datamatrix", "ean8", "ean8add2", "ean8add5", "ean13", "ean13add2", "ean13add5", "ean13pwcd", "fim", "logmars", "maxicode", "msi", "pdf417", "pdf417macro", "plessey", "postauscust2", "postauscust3", "postausreplypaid", "postausstandard", "postukrm4scc", "postusdpbc", "postusimb", "postusstandard", "postus5zip", "qrcode", "rfid", "rss14", "rss14expanded", "rss14limited", "rss14stacked", "rss14stackedomni", "rss14truncated", "telepen", "ucc128", "ucc128random", "ucc128sscc", "upca", "upcaadd2", "upcaadd5", "upcapwcd", "upce", "upceadd2", "upceadd5", "upcean2", "upcean5", "upsmaxicode"]);
44264    this.upsMode = getStringOption(attributes.upsMode, ["usCarrier", "internationalCarrier", "secureSymbol", "standardSymbol"]);
44265    this.use = attributes.use || "";
44266    this.usehref = attributes.usehref || "";
44267    this.wideNarrowRatio = getRatio(attributes.wideNarrowRatio);
44268    this.encrypt = null;
44269    this.extras = null;
44270  }
44271}
44272class Bind extends XFAObject {
44273  constructor(attributes) {
44274    super(TEMPLATE_NS_ID, "bind", true);
44275    this.match = getStringOption(attributes.match, ["once", "dataRef", "global", "none"]);
44276    this.ref = attributes.ref || "";
44277    this.picture = null;
44278  }
44279}
44280class BindItems extends XFAObject {
44281  constructor(attributes) {
44282    super(TEMPLATE_NS_ID, "bindItems");
44283    this.connection = attributes.connection || "";
44284    this.labelRef = attributes.labelRef || "";
44285    this.ref = attributes.ref || "";
44286    this.valueRef = attributes.valueRef || "";
44287  }
44288}
44289class Bookend extends XFAObject {
44290  constructor(attributes) {
44291    super(TEMPLATE_NS_ID, "bookend");
44292    this.id = attributes.id || "";
44293    this.leader = attributes.leader || "";
44294    this.trailer = attributes.trailer || "";
44295    this.use = attributes.use || "";
44296    this.usehref = attributes.usehref || "";
44297  }
44298}
44299class BooleanElement extends Option01 {
44300  constructor(attributes) {
44301    super(TEMPLATE_NS_ID, "boolean");
44302    this.id = attributes.id || "";
44303    this.name = attributes.name || "";
44304    this.use = attributes.use || "";
44305    this.usehref = attributes.usehref || "";
44306  }
44307  [$toHTML](availableSpace) {
44308    return valueToHtml(this[$content] === 1 ? "1" : "0");
44309  }
44310}
44311class Border extends XFAObject {
44312  constructor(attributes) {
44313    super(TEMPLATE_NS_ID, "border", true);
44314    this.break = getStringOption(attributes.break, ["close", "open"]);
44315    this.hand = getStringOption(attributes.hand, ["even", "left", "right"]);
44316    this.id = attributes.id || "";
44317    this.presence = getStringOption(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
44318    this.relevant = getRelevant(attributes.relevant);
44319    this.use = attributes.use || "";
44320    this.usehref = attributes.usehref || "";
44321    this.corner = new XFAObjectArray(4);
44322    this.edge = new XFAObjectArray(4);
44323    this.extras = null;
44324    this.fill = null;
44325    this.margin = null;
44326  }
44327  [$getExtra]() {
44328    if (!this[$extra]) {
44329      const edges = this.edge.children.slice();
44330      if (edges.length < 4) {
44331        const defaultEdge = edges.at(-1) || new Edge({});
44332        for (let i = edges.length; i < 4; i++) {
44333          edges.push(defaultEdge);
44334        }
44335      }
44336      const widths = edges.map(edge => edge.thickness);
44337      const insets = [0, 0, 0, 0];
44338      if (this.margin) {
44339        insets[0] = this.margin.topInset;
44340        insets[1] = this.margin.rightInset;
44341        insets[2] = this.margin.bottomInset;
44342        insets[3] = this.margin.leftInset;
44343      }
44344      this[$extra] = {
44345        widths,
44346        insets,
44347        edges
44348      };
44349    }
44350    return this[$extra];
44351  }
44352  [$toStyle]() {
44353    const {
44354      edges
44355    } = this[$getExtra]();
44356    const edgeStyles = edges.map(node => {
44357      const style = node[$toStyle]();
44358      style.color ||= "#000000";
44359      return style;
44360    });
44361    const style = Object.create(null);
44362    if (this.margin) {
44363      Object.assign(style, this.margin[$toStyle]());
44364    }
44365    if (this.fill?.presence === "visible") {
44366      Object.assign(style, this.fill[$toStyle]());
44367    }
44368    if (this.corner.children.some(node => node.radius !== 0)) {
44369      const cornerStyles = this.corner.children.map(node => node[$toStyle]());
44370      if (cornerStyles.length === 2 || cornerStyles.length === 3) {
44371        const last = cornerStyles.at(-1);
44372        for (let i = cornerStyles.length; i < 4; i++) {
44373          cornerStyles.push(last);
44374        }
44375      }
44376      style.borderRadius = cornerStyles.map(s => s.radius).join(" ");
44377    }
44378    switch (this.presence) {
44379      case "invisible":
44380      case "hidden":
44381        style.borderStyle = "";
44382        break;
44383      case "inactive":
44384        style.borderStyle = "none";
44385        break;
44386      default:
44387        style.borderStyle = edgeStyles.map(s => s.style).join(" ");
44388        break;
44389    }
44390    style.borderWidth = edgeStyles.map(s => s.width).join(" ");
44391    style.borderColor = edgeStyles.map(s => s.color).join(" ");
44392    return style;
44393  }
44394}
44395class Break extends XFAObject {
44396  constructor(attributes) {
44397    super(TEMPLATE_NS_ID, "break", true);
44398    this.after = getStringOption(attributes.after, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]);
44399    this.afterTarget = attributes.afterTarget || "";
44400    this.before = getStringOption(attributes.before, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]);
44401    this.beforeTarget = attributes.beforeTarget || "";
44402    this.bookendLeader = attributes.bookendLeader || "";
44403    this.bookendTrailer = attributes.bookendTrailer || "";
44404    this.id = attributes.id || "";
44405    this.overflowLeader = attributes.overflowLeader || "";
44406    this.overflowTarget = attributes.overflowTarget || "";
44407    this.overflowTrailer = attributes.overflowTrailer || "";
44408    this.startNew = getInteger({
44409      data: attributes.startNew,
44410      defaultValue: 0,
44411      validate: x => x === 1
44412    });
44413    this.use = attributes.use || "";
44414    this.usehref = attributes.usehref || "";
44415    this.extras = null;
44416  }
44417}
44418class BreakAfter extends XFAObject {
44419  constructor(attributes) {
44420    super(TEMPLATE_NS_ID, "breakAfter", true);
44421    this.id = attributes.id || "";
44422    this.leader = attributes.leader || "";
44423    this.startNew = getInteger({
44424      data: attributes.startNew,
44425      defaultValue: 0,
44426      validate: x => x === 1
44427    });
44428    this.target = attributes.target || "";
44429    this.targetType = getStringOption(attributes.targetType, ["auto", "contentArea", "pageArea"]);
44430    this.trailer = attributes.trailer || "";
44431    this.use = attributes.use || "";
44432    this.usehref = attributes.usehref || "";
44433    this.script = null;
44434  }
44435}
44436class BreakBefore extends XFAObject {
44437  constructor(attributes) {
44438    super(TEMPLATE_NS_ID, "breakBefore", true);
44439    this.id = attributes.id || "";
44440    this.leader = attributes.leader || "";
44441    this.startNew = getInteger({
44442      data: attributes.startNew,
44443      defaultValue: 0,
44444      validate: x => x === 1
44445    });
44446    this.target = attributes.target || "";
44447    this.targetType = getStringOption(attributes.targetType, ["auto", "contentArea", "pageArea"]);
44448    this.trailer = attributes.trailer || "";
44449    this.use = attributes.use || "";
44450    this.usehref = attributes.usehref || "";
44451    this.script = null;
44452  }
44453  [$toHTML](availableSpace) {
44454    this[$extra] = {};
44455    return HTMLResult.FAILURE;
44456  }
44457}
44458class Button extends XFAObject {
44459  constructor(attributes) {
44460    super(TEMPLATE_NS_ID, "button", true);
44461    this.highlight = getStringOption(attributes.highlight, ["inverted", "none", "outline", "push"]);
44462    this.id = attributes.id || "";
44463    this.use = attributes.use || "";
44464    this.usehref = attributes.usehref || "";
44465    this.extras = null;
44466  }
44467  [$toHTML](availableSpace) {
44468    const parent = this[$getParent]();
44469    const grandpa = parent[$getParent]();
44470    const htmlButton = {
44471      name: "button",
44472      attributes: {
44473        id: this[$uid],
44474        class: ["xfaButton"],
44475        style: {}
44476      },
44477      children: []
44478    };
44479    for (const event of grandpa.event.children) {
44480      if (event.activity !== "click" || !event.script) {
44481        continue;
44482      }
44483      const jsURL = recoverJsURL(event.script[$content]);
44484      if (!jsURL) {
44485        continue;
44486      }
44487      const href = fixURL(jsURL.url);
44488      if (!href) {
44489        continue;
44490      }
44491      htmlButton.children.push({
44492        name: "a",
44493        attributes: {
44494          id: "link" + this[$uid],
44495          href,
44496          newWindow: jsURL.newWindow,
44497          class: ["xfaLink"],
44498          style: {}
44499        },
44500        children: []
44501      });
44502    }
44503    return HTMLResult.success(htmlButton);
44504  }
44505}
44506class Calculate extends XFAObject {
44507  constructor(attributes) {
44508    super(TEMPLATE_NS_ID, "calculate", true);
44509    this.id = attributes.id || "";
44510    this.override = getStringOption(attributes.override, ["disabled", "error", "ignore", "warning"]);
44511    this.use = attributes.use || "";
44512    this.usehref = attributes.usehref || "";
44513    this.extras = null;
44514    this.message = null;
44515    this.script = null;
44516  }
44517}
44518class Caption extends XFAObject {
44519  constructor(attributes) {
44520    super(TEMPLATE_NS_ID, "caption", true);
44521    this.id = attributes.id || "";
44522    this.placement = getStringOption(attributes.placement, ["left", "bottom", "inline", "right", "top"]);
44523    this.presence = getStringOption(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
44524    this.reserve = Math.ceil(getMeasurement(attributes.reserve));
44525    this.use = attributes.use || "";
44526    this.usehref = attributes.usehref || "";
44527    this.extras = null;
44528    this.font = null;
44529    this.margin = null;
44530    this.para = null;
44531    this.value = null;
44532  }
44533  [$setValue](value) {
44534    _setValue(this, value);
44535  }
44536  [$getExtra](availableSpace) {
44537    if (!this[$extra]) {
44538      let {
44539        width,
44540        height
44541      } = availableSpace;
44542      switch (this.placement) {
44543        case "left":
44544        case "right":
44545        case "inline":
44546          width = this.reserve <= 0 ? width : this.reserve;
44547          break;
44548        case "top":
44549        case "bottom":
44550          height = this.reserve <= 0 ? height : this.reserve;
44551          break;
44552      }
44553      this[$extra] = layoutNode(this, {
44554        width,
44555        height
44556      });
44557    }
44558    return this[$extra];
44559  }
44560  [$toHTML](availableSpace) {
44561    if (!this.value) {
44562      return HTMLResult.EMPTY;
44563    }
44564    this[$pushPara]();
44565    const value = this.value[$toHTML](availableSpace).html;
44566    if (!value) {
44567      this[$popPara]();
44568      return HTMLResult.EMPTY;
44569    }
44570    const savedReserve = this.reserve;
44571    if (this.reserve <= 0) {
44572      const {
44573        w,
44574        h
44575      } = this[$getExtra](availableSpace);
44576      switch (this.placement) {
44577        case "left":
44578        case "right":
44579        case "inline":
44580          this.reserve = w;
44581          break;
44582        case "top":
44583        case "bottom":
44584          this.reserve = h;
44585          break;
44586      }
44587    }
44588    const children = [];
44589    if (typeof value === "string") {
44590      children.push({
44591        name: "#text",
44592        value
44593      });
44594    } else {
44595      children.push(value);
44596    }
44597    const style = toStyle(this, "font", "margin", "visibility");
44598    switch (this.placement) {
44599      case "left":
44600      case "right":
44601        if (this.reserve > 0) {
44602          style.width = measureToString(this.reserve);
44603        }
44604        break;
44605      case "top":
44606      case "bottom":
44607        if (this.reserve > 0) {
44608          style.height = measureToString(this.reserve);
44609        }
44610        break;
44611    }
44612    setPara(this, null, value);
44613    this[$popPara]();
44614    this.reserve = savedReserve;
44615    return HTMLResult.success({
44616      name: "div",
44617      attributes: {
44618        style,
44619        class: ["xfaCaption"]
44620      },
44621      children
44622    });
44623  }
44624}
44625class Certificate extends StringObject {
44626  constructor(attributes) {
44627    super(TEMPLATE_NS_ID, "certificate");
44628    this.id = attributes.id || "";
44629    this.name = attributes.name || "";
44630    this.use = attributes.use || "";
44631    this.usehref = attributes.usehref || "";
44632  }
44633}
44634class Certificates extends XFAObject {
44635  constructor(attributes) {
44636    super(TEMPLATE_NS_ID, "certificates", true);
44637    this.credentialServerPolicy = getStringOption(attributes.credentialServerPolicy, ["optional", "required"]);
44638    this.id = attributes.id || "";
44639    this.url = attributes.url || "";
44640    this.urlPolicy = attributes.urlPolicy || "";
44641    this.use = attributes.use || "";
44642    this.usehref = attributes.usehref || "";
44643    this.encryption = null;
44644    this.issuers = null;
44645    this.keyUsage = null;
44646    this.oids = null;
44647    this.signing = null;
44648    this.subjectDNs = null;
44649  }
44650}
44651class CheckButton extends XFAObject {
44652  constructor(attributes) {
44653    super(TEMPLATE_NS_ID, "checkButton", true);
44654    this.id = attributes.id || "";
44655    this.mark = getStringOption(attributes.mark, ["default", "check", "circle", "cross", "diamond", "square", "star"]);
44656    this.shape = getStringOption(attributes.shape, ["square", "round"]);
44657    this.size = getMeasurement(attributes.size, "10pt");
44658    this.use = attributes.use || "";
44659    this.usehref = attributes.usehref || "";
44660    this.border = null;
44661    this.extras = null;
44662    this.margin = null;
44663  }
44664  [$toHTML](availableSpace) {
44665    const style = toStyle(this, "margin");
44666    const size = measureToString(this.size);
44667    style.width = style.height = size;
44668    let type;
44669    let className;
44670    let groupId;
44671    const field = this[$getParent]()[$getParent]();
44672    const items = field.items.children.length && field.items.children[0][$toHTML]().html || [];
44673    const exportedValue = {
44674      on: (items[0] !== undefined ? items[0] : "on").toString(),
44675      off: (items[1] !== undefined ? items[1] : "off").toString()
44676    };
44677    const value = field.value?.[$text]() || "off";
44678    const checked = value === exportedValue.on || undefined;
44679    const container = field[$getSubformParent]();
44680    const fieldId = field[$uid];
44681    let dataId;
44682    if (container instanceof ExclGroup) {
44683      groupId = container[$uid];
44684      type = "radio";
44685      className = "xfaRadio";
44686      dataId = container[$data]?.[$uid] || container[$uid];
44687    } else {
44688      type = "checkbox";
44689      className = "xfaCheckbox";
44690      dataId = field[$data]?.[$uid] || field[$uid];
44691    }
44692    const input = {
44693      name: "input",
44694      attributes: {
44695        class: [className],
44696        style,
44697        fieldId,
44698        dataId,
44699        type,
44700        checked,
44701        xfaOn: exportedValue.on,
44702        xfaOff: exportedValue.off,
44703        "aria-label": ariaLabel(field),
44704        "aria-required": false
44705      }
44706    };
44707    if (groupId) {
44708      input.attributes.name = groupId;
44709    }
44710    if (isRequired(field)) {
44711      input.attributes["aria-required"] = true;
44712      input.attributes.required = true;
44713    }
44714    return HTMLResult.success({
44715      name: "label",
44716      attributes: {
44717        class: ["xfaLabel"]
44718      },
44719      children: [input]
44720    });
44721  }
44722}
44723class ChoiceList extends XFAObject {
44724  constructor(attributes) {
44725    super(TEMPLATE_NS_ID, "choiceList", true);
44726    this.commitOn = getStringOption(attributes.commitOn, ["select", "exit"]);
44727    this.id = attributes.id || "";
44728    this.open = getStringOption(attributes.open, ["userControl", "always", "multiSelect", "onEntry"]);
44729    this.textEntry = getInteger({
44730      data: attributes.textEntry,
44731      defaultValue: 0,
44732      validate: x => x === 1
44733    });
44734    this.use = attributes.use || "";
44735    this.usehref = attributes.usehref || "";
44736    this.border = null;
44737    this.extras = null;
44738    this.margin = null;
44739  }
44740  [$toHTML](availableSpace) {
44741    const style = toStyle(this, "border", "margin");
44742    const ui = this[$getParent]();
44743    const field = ui[$getParent]();
44744    const fontSize = field.font?.size || 10;
44745    const optionStyle = {
44746      fontSize: `calc(${fontSize}px * var(--total-scale-factor))`
44747    };
44748    const children = [];
44749    if (field.items.children.length > 0) {
44750      const items = field.items;
44751      let displayedIndex = 0;
44752      let saveIndex = 0;
44753      if (items.children.length === 2) {
44754        displayedIndex = items.children[0].save;
44755        saveIndex = 1 - displayedIndex;
44756      }
44757      const displayed = items.children[displayedIndex][$toHTML]().html;
44758      const values = items.children[saveIndex][$toHTML]().html;
44759      let selected = false;
44760      const value = field.value?.[$text]() || "";
44761      for (let i = 0, ii = displayed.length; i < ii; i++) {
44762        const option = {
44763          name: "option",
44764          attributes: {
44765            value: values[i] || displayed[i],
44766            style: optionStyle
44767          },
44768          value: displayed[i]
44769        };
44770        if (values[i] === value) {
44771          option.attributes.selected = selected = true;
44772        }
44773        children.push(option);
44774      }
44775      if (!selected) {
44776        children.splice(0, 0, {
44777          name: "option",
44778          attributes: {
44779            hidden: true,
44780            selected: true
44781          },
44782          value: " "
44783        });
44784      }
44785    }
44786    const selectAttributes = {
44787      class: ["xfaSelect"],
44788      fieldId: field[$uid],
44789      dataId: field[$data]?.[$uid] || field[$uid],
44790      style,
44791      "aria-label": ariaLabel(field),
44792      "aria-required": false
44793    };
44794    if (isRequired(field)) {
44795      selectAttributes["aria-required"] = true;
44796      selectAttributes.required = true;
44797    }
44798    if (this.open === "multiSelect") {
44799      selectAttributes.multiple = true;
44800    }
44801    return HTMLResult.success({
44802      name: "label",
44803      attributes: {
44804        class: ["xfaLabel"]
44805      },
44806      children: [{
44807        name: "select",
44808        children,
44809        attributes: selectAttributes
44810      }]
44811    });
44812  }
44813}
44814class Color extends XFAObject {
44815  constructor(attributes) {
44816    super(TEMPLATE_NS_ID, "color", true);
44817    this.cSpace = getStringOption(attributes.cSpace, ["SRGB"]);
44818    this.id = attributes.id || "";
44819    this.use = attributes.use || "";
44820    this.usehref = attributes.usehref || "";
44821    this.value = attributes.value ? getColor(attributes.value) : "";
44822    this.extras = null;
44823  }
44824  [$hasSettableValue]() {
44825    return false;
44826  }
44827  [$toStyle]() {
44828    return this.value ? Util.makeHexColor(this.value.r, this.value.g, this.value.b) : null;
44829  }
44830}
44831class Comb extends XFAObject {
44832  constructor(attributes) {
44833    super(TEMPLATE_NS_ID, "comb");
44834    this.id = attributes.id || "";
44835    this.numberOfCells = getInteger({
44836      data: attributes.numberOfCells,
44837      defaultValue: 0,
44838      validate: x => x >= 0
44839    });
44840    this.use = attributes.use || "";
44841    this.usehref = attributes.usehref || "";
44842  }
44843}
44844class Connect extends XFAObject {
44845  constructor(attributes) {
44846    super(TEMPLATE_NS_ID, "connect", true);
44847    this.connection = attributes.connection || "";
44848    this.id = attributes.id || "";
44849    this.ref = attributes.ref || "";
44850    this.usage = getStringOption(attributes.usage, ["exportAndImport", "exportOnly", "importOnly"]);
44851    this.use = attributes.use || "";
44852    this.usehref = attributes.usehref || "";
44853    this.picture = null;
44854  }
44855}
44856class ContentArea extends XFAObject {
44857  constructor(attributes) {
44858    super(TEMPLATE_NS_ID, "contentArea", true);
44859    this.h = getMeasurement(attributes.h);
44860    this.id = attributes.id || "";
44861    this.name = attributes.name || "";
44862    this.relevant = getRelevant(attributes.relevant);
44863    this.use = attributes.use || "";
44864    this.usehref = attributes.usehref || "";
44865    this.w = getMeasurement(attributes.w);
44866    this.x = getMeasurement(attributes.x, "0pt");
44867    this.y = getMeasurement(attributes.y, "0pt");
44868    this.desc = null;
44869    this.extras = null;
44870  }
44871  [$toHTML](availableSpace) {
44872    const left = measureToString(this.x);
44873    const top = measureToString(this.y);
44874    const style = {
44875      left,
44876      top,
44877      width: measureToString(this.w),
44878      height: measureToString(this.h)
44879    };
44880    const classNames = ["xfaContentarea"];
44881    if (isPrintOnly(this)) {
44882      classNames.push("xfaPrintOnly");
44883    }
44884    return HTMLResult.success({
44885      name: "div",
44886      children: [],
44887      attributes: {
44888        style,
44889        class: classNames,
44890        id: this[$uid]
44891      }
44892    });
44893  }
44894}
44895class Corner extends XFAObject {
44896  constructor(attributes) {
44897    super(TEMPLATE_NS_ID, "corner", true);
44898    this.id = attributes.id || "";
44899    this.inverted = getInteger({
44900      data: attributes.inverted,
44901      defaultValue: 0,
44902      validate: x => x === 1
44903    });
44904    this.join = getStringOption(attributes.join, ["square", "round"]);
44905    this.presence = getStringOption(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
44906    this.radius = getMeasurement(attributes.radius);
44907    this.stroke = getStringOption(attributes.stroke, ["solid", "dashDot", "dashDotDot", "dashed", "dotted", "embossed", "etched", "lowered", "raised"]);
44908    this.thickness = getMeasurement(attributes.thickness, "0.5pt");
44909    this.use = attributes.use || "";
44910    this.usehref = attributes.usehref || "";
44911    this.color = null;
44912    this.extras = null;
44913  }
44914  [$toStyle]() {
44915    const style = toStyle(this, "visibility");
44916    style.radius = measureToString(this.join === "square" ? 0 : this.radius);
44917    return style;
44918  }
44919}
44920class DateElement extends ContentObject {
44921  constructor(attributes) {
44922    super(TEMPLATE_NS_ID, "date");
44923    this.id = attributes.id || "";
44924    this.name = attributes.name || "";
44925    this.use = attributes.use || "";
44926    this.usehref = attributes.usehref || "";
44927  }
44928  [$finalize]() {
44929    const date = this[$content].trim();
44930    this[$content] = date ? new Date(date) : null;
44931  }
44932  [$toHTML](availableSpace) {
44933    return valueToHtml(this[$content] ? this[$content].toString() : "");
44934  }
44935}
44936class DateTime extends ContentObject {
44937  constructor(attributes) {
44938    super(TEMPLATE_NS_ID, "dateTime");
44939    this.id = attributes.id || "";
44940    this.name = attributes.name || "";
44941    this.use = attributes.use || "";
44942    this.usehref = attributes.usehref || "";
44943  }
44944  [$finalize]() {
44945    const date = this[$content].trim();
44946    this[$content] = date ? new Date(date) : null;
44947  }
44948  [$toHTML](availableSpace) {
44949    return valueToHtml(this[$content] ? this[$content].toString() : "");
44950  }
44951}
44952class DateTimeEdit extends XFAObject {
44953  constructor(attributes) {
44954    super(TEMPLATE_NS_ID, "dateTimeEdit", true);
44955    this.hScrollPolicy = getStringOption(attributes.hScrollPolicy, ["auto", "off", "on"]);
44956    this.id = attributes.id || "";
44957    this.picker = getStringOption(attributes.picker, ["host", "none"]);
44958    this.use = attributes.use || "";
44959    this.usehref = attributes.usehref || "";
44960    this.border = null;
44961    this.comb = null;
44962    this.extras = null;
44963    this.margin = null;
44964  }
44965  [$toHTML](availableSpace) {
44966    const style = toStyle(this, "border", "font", "margin");
44967    const field = this[$getParent]()[$getParent]();
44968    const html = {
44969      name: "input",
44970      attributes: {
44971        type: "text",
44972        fieldId: field[$uid],
44973        dataId: field[$data]?.[$uid] || field[$uid],
44974        class: ["xfaTextfield"],
44975        style,
44976        "aria-label": ariaLabel(field),
44977        "aria-required": false
44978      }
44979    };
44980    if (isRequired(field)) {
44981      html.attributes["aria-required"] = true;
44982      html.attributes.required = true;
44983    }
44984    return HTMLResult.success({
44985      name: "label",
44986      attributes: {
44987        class: ["xfaLabel"]
44988      },
44989      children: [html]
44990    });
44991  }
44992}
44993class Decimal extends ContentObject {
44994  constructor(attributes) {
44995    super(TEMPLATE_NS_ID, "decimal");
44996    this.fracDigits = getInteger({
44997      data: attributes.fracDigits,
44998      defaultValue: 2,
44999      validate: x => true
45000    });
45001    this.id = attributes.id || "";
45002    this.leadDigits = getInteger({
45003      data: attributes.leadDigits,
45004      defaultValue: -1,
45005      validate: x => true
45006    });
45007    this.name = attributes.name || "";
45008    this.use = attributes.use || "";
45009    this.usehref = attributes.usehref || "";
45010  }
45011  [$finalize]() {
45012    const number = parseFloat(this[$content].trim());
45013    this[$content] = isNaN(number) ? null : number;
45014  }
45015  [$toHTML](availableSpace) {
45016    return valueToHtml(this[$content] !== null ? this[$content].toString() : "");
45017  }
45018}
45019class DefaultUi extends XFAObject {
45020  constructor(attributes) {
45021    super(TEMPLATE_NS_ID, "defaultUi", true);
45022    this.id = attributes.id || "";
45023    this.use = attributes.use || "";
45024    this.usehref = attributes.usehref || "";
45025    this.extras = null;
45026  }
45027}
45028class Desc extends XFAObject {
45029  constructor(attributes) {
45030    super(TEMPLATE_NS_ID, "desc", true);
45031    this.id = attributes.id || "";
45032    this.use = attributes.use || "";
45033    this.usehref = attributes.usehref || "";
45034    this.boolean = new XFAObjectArray();
45035    this.date = new XFAObjectArray();
45036    this.dateTime = new XFAObjectArray();
45037    this.decimal = new XFAObjectArray();
45038    this.exData = new XFAObjectArray();
45039    this.float = new XFAObjectArray();
45040    this.image = new XFAObjectArray();
45041    this.integer = new XFAObjectArray();
45042    this.text = new XFAObjectArray();
45043    this.time = new XFAObjectArray();
45044  }
45045}
45046class DigestMethod extends OptionObject {
45047  constructor(attributes) {
45048    super(TEMPLATE_NS_ID, "digestMethod", ["", "SHA1", "SHA256", "SHA512", "RIPEMD160"]);
45049    this.id = attributes.id || "";
45050    this.use = attributes.use || "";
45051    this.usehref = attributes.usehref || "";
45052  }
45053}
45054class DigestMethods extends XFAObject {
45055  constructor(attributes) {
45056    super(TEMPLATE_NS_ID, "digestMethods", true);
45057    this.id = attributes.id || "";
45058    this.type = getStringOption(attributes.type, ["optional", "required"]);
45059    this.use = attributes.use || "";
45060    this.usehref = attributes.usehref || "";
45061    this.digestMethod = new XFAObjectArray();
45062  }
45063}
45064class Draw extends XFAObject {
45065  constructor(attributes) {
45066    super(TEMPLATE_NS_ID, "draw", true);
45067    this.anchorType = getStringOption(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
45068    this.colSpan = getInteger({
45069      data: attributes.colSpan,
45070      defaultValue: 1,
45071      validate: n => n >= 1 || n === -1
45072    });
45073    this.h = attributes.h ? getMeasurement(attributes.h) : "";
45074    this.hAlign = getStringOption(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
45075    this.id = attributes.id || "";
45076    this.locale = attributes.locale || "";
45077    this.maxH = getMeasurement(attributes.maxH, "0pt");
45078    this.maxW = getMeasurement(attributes.maxW, "0pt");
45079    this.minH = getMeasurement(attributes.minH, "0pt");
45080    this.minW = getMeasurement(attributes.minW, "0pt");
45081    this.name = attributes.name || "";
45082    this.presence = getStringOption(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
45083    this.relevant = getRelevant(attributes.relevant);
45084    this.rotate = getInteger({
45085      data: attributes.rotate,
45086      defaultValue: 0,
45087      validate: x => x % 90 === 0
45088    });
45089    this.use = attributes.use || "";
45090    this.usehref = attributes.usehref || "";
45091    this.w = attributes.w ? getMeasurement(attributes.w) : "";
45092    this.x = getMeasurement(attributes.x, "0pt");
45093    this.y = getMeasurement(attributes.y, "0pt");
45094    this.assist = null;
45095    this.border = null;
45096    this.caption = null;
45097    this.desc = null;
45098    this.extras = null;
45099    this.font = null;
45100    this.keep = null;
45101    this.margin = null;
45102    this.para = null;
45103    this.traversal = null;
45104    this.ui = null;
45105    this.value = null;
45106    this.setProperty = new XFAObjectArray();
45107  }
45108  [$setValue](value) {
45109    _setValue(this, value);
45110  }
45111  [$toHTML](availableSpace) {
45112    setTabIndex(this);
45113    if (this.presence === "hidden" || this.presence === "inactive") {
45114      return HTMLResult.EMPTY;
45115    }
45116    fixDimensions(this);
45117    this[$pushPara]();
45118    const savedW = this.w;
45119    const savedH = this.h;
45120    const {
45121      w,
45122      h,
45123      isBroken
45124    } = layoutNode(this, availableSpace);
45125    if (w && this.w === "") {
45126      if (isBroken && this[$getSubformParent]()[$isThereMoreWidth]()) {
45127        this[$popPara]();
45128        return HTMLResult.FAILURE;
45129      }
45130      this.w = w;
45131    }
45132    if (h && this.h === "") {
45133      this.h = h;
45134    }
45135    setFirstUnsplittable(this);
45136    if (!checkDimensions(this, availableSpace)) {
45137      this.w = savedW;
45138      this.h = savedH;
45139      this[$popPara]();
45140      return HTMLResult.FAILURE;
45141    }
45142    unsetFirstUnsplittable(this);
45143    const style = toStyle(this, "font", "hAlign", "dimensions", "position", "presence", "rotate", "anchorType", "border", "margin");
45144    setMinMaxDimensions(this, style);
45145    if (style.margin) {
45146      style.padding = style.margin;
45147      delete style.margin;
45148    }
45149    const classNames = ["xfaDraw"];
45150    if (this.font) {
45151      classNames.push("xfaFont");
45152    }
45153    if (isPrintOnly(this)) {
45154      classNames.push("xfaPrintOnly");
45155    }
45156    const attributes = {
45157      style,
45158      id: this[$uid],
45159      class: classNames
45160    };
45161    if (this.name) {
45162      attributes.xfaName = this.name;
45163    }
45164    const html = {
45165      name: "div",
45166      attributes,
45167      children: []
45168    };
45169    applyAssist(this, attributes);
45170    const bbox = computeBbox(this, html, availableSpace);
45171    const value = this.value ? this.value[$toHTML](availableSpace).html : null;
45172    if (value === null) {
45173      this.w = savedW;
45174      this.h = savedH;
45175      this[$popPara]();
45176      return HTMLResult.success(createWrapper(this, html), bbox);
45177    }
45178    html.children.push(value);
45179    setPara(this, style, value);
45180    this.w = savedW;
45181    this.h = savedH;
45182    this[$popPara]();
45183    return HTMLResult.success(createWrapper(this, html), bbox);
45184  }
45185}
45186class Edge extends XFAObject {
45187  constructor(attributes) {
45188    super(TEMPLATE_NS_ID, "edge", true);
45189    this.cap = getStringOption(attributes.cap, ["square", "butt", "round"]);
45190    this.id = attributes.id || "";
45191    this.presence = getStringOption(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
45192    this.stroke = getStringOption(attributes.stroke, ["solid", "dashDot", "dashDotDot", "dashed", "dotted", "embossed", "etched", "lowered", "raised"]);
45193    this.thickness = getMeasurement(attributes.thickness, "0.5pt");
45194    this.use = attributes.use || "";
45195    this.usehref = attributes.usehref || "";
45196    this.color = null;
45197    this.extras = null;
45198  }
45199  [$toStyle]() {
45200    const style = toStyle(this, "visibility");
45201    Object.assign(style, {
45202      linecap: this.cap,
45203      width: measureToString(this.thickness),
45204      color: this.color ? this.color[$toStyle]() : "#000000",
45205      style: ""
45206    });
45207    if (this.presence !== "visible") {
45208      style.style = "none";
45209    } else {
45210      switch (this.stroke) {
45211        case "solid":
45212          style.style = "solid";
45213          break;
45214        case "dashDot":
45215          style.style = "dashed";
45216          break;
45217        case "dashDotDot":
45218          style.style = "dashed";
45219          break;
45220        case "dashed":
45221          style.style = "dashed";
45222          break;
45223        case "dotted":
45224          style.style = "dotted";
45225          break;
45226        case "embossed":
45227          style.style = "ridge";
45228          break;
45229        case "etched":
45230          style.style = "groove";
45231          break;
45232        case "lowered":
45233          style.style = "inset";
45234          break;
45235        case "raised":
45236          style.style = "outset";
45237          break;
45238      }
45239    }
45240    return style;
45241  }
45242}
45243class Encoding extends OptionObject {
45244  constructor(attributes) {
45245    super(TEMPLATE_NS_ID, "encoding", ["adbe.x509.rsa_sha1", "adbe.pkcs7.detached", "adbe.pkcs7.sha1"]);
45246    this.id = attributes.id || "";
45247    this.use = attributes.use || "";
45248    this.usehref = attributes.usehref || "";
45249  }
45250}
45251class Encodings extends XFAObject {
45252  constructor(attributes) {
45253    super(TEMPLATE_NS_ID, "encodings", true);
45254    this.id = attributes.id || "";
45255    this.type = getStringOption(attributes.type, ["optional", "required"]);
45256    this.use = attributes.use || "";
45257    this.usehref = attributes.usehref || "";
45258    this.encoding = new XFAObjectArray();
45259  }
45260}
45261class Encrypt extends XFAObject {
45262  constructor(attributes) {
45263    super(TEMPLATE_NS_ID, "encrypt", true);
45264    this.id = attributes.id || "";
45265    this.use = attributes.use || "";
45266    this.usehref = attributes.usehref || "";
45267    this.certificate = null;
45268  }
45269}
45270class EncryptData extends XFAObject {
45271  constructor(attributes) {
45272    super(TEMPLATE_NS_ID, "encryptData", true);
45273    this.id = attributes.id || "";
45274    this.operation = getStringOption(attributes.operation, ["encrypt", "decrypt"]);
45275    this.target = attributes.target || "";
45276    this.use = attributes.use || "";
45277    this.usehref = attributes.usehref || "";
45278    this.filter = null;
45279    this.manifest = null;
45280  }
45281}
45282class Encryption extends XFAObject {
45283  constructor(attributes) {
45284    super(TEMPLATE_NS_ID, "encryption", true);
45285    this.id = attributes.id || "";
45286    this.type = getStringOption(attributes.type, ["optional", "required"]);
45287    this.use = attributes.use || "";
45288    this.usehref = attributes.usehref || "";
45289    this.certificate = new XFAObjectArray();
45290  }
45291}
45292class EncryptionMethod extends OptionObject {
45293  constructor(attributes) {
45294    super(TEMPLATE_NS_ID, "encryptionMethod", ["", "AES256-CBC", "TRIPLEDES-CBC", "AES128-CBC", "AES192-CBC"]);
45295    this.id = attributes.id || "";
45296    this.use = attributes.use || "";
45297    this.usehref = attributes.usehref || "";
45298  }
45299}
45300class EncryptionMethods extends XFAObject {
45301  constructor(attributes) {
45302    super(TEMPLATE_NS_ID, "encryptionMethods", true);
45303    this.id = attributes.id || "";
45304    this.type = getStringOption(attributes.type, ["optional", "required"]);
45305    this.use = attributes.use || "";
45306    this.usehref = attributes.usehref || "";
45307    this.encryptionMethod = new XFAObjectArray();
45308  }
45309}
45310class Event extends XFAObject {
45311  constructor(attributes) {
45312    super(TEMPLATE_NS_ID, "event", true);
45313    this.activity = getStringOption(attributes.activity, ["click", "change", "docClose", "docReady", "enter", "exit", "full", "indexChange", "initialize", "mouseDown", "mouseEnter", "mouseExit", "mouseUp", "postExecute", "postOpen", "postPrint", "postSave", "postSign", "postSubmit", "preExecute", "preOpen", "prePrint", "preSave", "preSign", "preSubmit", "ready", "validationState"]);
45314    this.id = attributes.id || "";
45315    this.listen = getStringOption(attributes.listen, ["refOnly", "refAndDescendents"]);
45316    this.name = attributes.name || "";
45317    this.ref = attributes.ref || "";
45318    this.use = attributes.use || "";
45319    this.usehref = attributes.usehref || "";
45320    this.extras = null;
45321    this.encryptData = null;
45322    this.execute = null;
45323    this.script = null;
45324    this.signData = null;
45325    this.submit = null;
45326  }
45327}
45328class ExData extends ContentObject {
45329  constructor(attributes) {
45330    super(TEMPLATE_NS_ID, "exData");
45331    this.contentType = attributes.contentType || "";
45332    this.href = attributes.href || "";
45333    this.id = attributes.id || "";
45334    this.maxLength = getInteger({
45335      data: attributes.maxLength,
45336      defaultValue: -1,
45337      validate: x => x >= -1
45338    });
45339    this.name = attributes.name || "";
45340    this.rid = attributes.rid || "";
45341    this.transferEncoding = getStringOption(attributes.transferEncoding, ["none", "base64", "package"]);
45342    this.use = attributes.use || "";
45343    this.usehref = attributes.usehref || "";
45344  }
45345  [$isCDATAXml]() {
45346    return this.contentType === "text/html";
45347  }
45348  [$onChild](child) {
45349    if (this.contentType === "text/html" && child[$namespaceId] === NamespaceIds.xhtml.id) {
45350      this[$content] = child;
45351      return true;
45352    }
45353    if (this.contentType === "text/xml") {
45354      this[$content] = child;
45355      return true;
45356    }
45357    return false;
45358  }
45359  [$toHTML](availableSpace) {
45360    if (this.contentType !== "text/html" || !this[$content]) {
45361      return HTMLResult.EMPTY;
45362    }
45363    return this[$content][$toHTML](availableSpace);
45364  }
45365}
45366class ExObject extends XFAObject {
45367  constructor(attributes) {
45368    super(TEMPLATE_NS_ID, "exObject", true);
45369    this.archive = attributes.archive || "";
45370    this.classId = attributes.classId || "";
45371    this.codeBase = attributes.codeBase || "";
45372    this.codeType = attributes.codeType || "";
45373    this.id = attributes.id || "";
45374    this.name = attributes.name || "";
45375    this.use = attributes.use || "";
45376    this.usehref = attributes.usehref || "";
45377    this.extras = null;
45378    this.boolean = new XFAObjectArray();
45379    this.date = new XFAObjectArray();
45380    this.dateTime = new XFAObjectArray();
45381    this.decimal = new XFAObjectArray();
45382    this.exData = new XFAObjectArray();
45383    this.exObject = new XFAObjectArray();
45384    this.float = new XFAObjectArray();
45385    this.image = new XFAObjectArray();
45386    this.integer = new XFAObjectArray();
45387    this.text = new XFAObjectArray();
45388    this.time = new XFAObjectArray();
45389  }
45390}
45391class ExclGroup extends XFAObject {
45392  constructor(attributes) {
45393    super(TEMPLATE_NS_ID, "exclGroup", true);
45394    this.access = getStringOption(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
45395    this.accessKey = attributes.accessKey || "";
45396    this.anchorType = getStringOption(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
45397    this.colSpan = getInteger({
45398      data: attributes.colSpan,
45399      defaultValue: 1,
45400      validate: n => n >= 1 || n === -1
45401    });
45402    this.h = attributes.h ? getMeasurement(attributes.h) : "";
45403    this.hAlign = getStringOption(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
45404    this.id = attributes.id || "";
45405    this.layout = getStringOption(attributes.layout, ["position", "lr-tb", "rl-row", "rl-tb", "row", "table", "tb"]);
45406    this.maxH = getMeasurement(attributes.maxH, "0pt");
45407    this.maxW = getMeasurement(attributes.maxW, "0pt");
45408    this.minH = getMeasurement(attributes.minH, "0pt");
45409    this.minW = getMeasurement(attributes.minW, "0pt");
45410    this.name = attributes.name || "";
45411    this.presence = getStringOption(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
45412    this.relevant = getRelevant(attributes.relevant);
45413    this.use = attributes.use || "";
45414    this.usehref = attributes.usehref || "";
45415    this.w = attributes.w ? getMeasurement(attributes.w) : "";
45416    this.x = getMeasurement(attributes.x, "0pt");
45417    this.y = getMeasurement(attributes.y, "0pt");
45418    this.assist = null;
45419    this.bind = null;
45420    this.border = null;
45421    this.calculate = null;
45422    this.caption = null;
45423    this.desc = null;
45424    this.extras = null;
45425    this.margin = null;
45426    this.para = null;
45427    this.traversal = null;
45428    this.validate = null;
45429    this.connect = new XFAObjectArray();
45430    this.event = new XFAObjectArray();
45431    this.field = new XFAObjectArray();
45432    this.setProperty = new XFAObjectArray();
45433  }
45434  [$isBindable]() {
45435    return true;
45436  }
45437  [$hasSettableValue]() {
45438    return true;
45439  }
45440  [$setValue](value) {
45441    for (const field of this.field.children) {
45442      if (!field.value) {
45443        const nodeValue = new Value({});
45444        field[$appendChild](nodeValue);
45445        field.value = nodeValue;
45446      }
45447      field.value[$setValue](value);
45448    }
45449  }
45450  [$isThereMoreWidth]() {
45451    return this.layout.endsWith("-tb") && this[$extra].attempt === 0 && this[$extra].numberInLine > 0 || this[$getParent]()[$isThereMoreWidth]();
45452  }
45453  [$isSplittable]() {
45454    const parent = this[$getSubformParent]();
45455    if (!parent[$isSplittable]()) {
45456      return false;
45457    }
45458    if (this[$extra]._isSplittable !== undefined) {
45459      return this[$extra]._isSplittable;
45460    }
45461    if (this.layout === "position" || this.layout.includes("row")) {
45462      this[$extra]._isSplittable = false;
45463      return false;
45464    }
45465    if (parent.layout?.endsWith("-tb") && parent[$extra].numberInLine !== 0) {
45466      return false;
45467    }
45468    this[$extra]._isSplittable = true;
45469    return true;
45470  }
45471  [$flushHTML]() {
45472    return flushHTML(this);
45473  }
45474  [$addHTML](html, bbox) {
45475    addHTML(this, html, bbox);
45476  }
45477  [$getAvailableSpace]() {
45478    return getAvailableSpace(this);
45479  }
45480  [$toHTML](availableSpace) {
45481    setTabIndex(this);
45482    if (this.presence === "hidden" || this.presence === "inactive" || this.h === 0 || this.w === 0) {
45483      return HTMLResult.EMPTY;
45484    }
45485    fixDimensions(this);
45486    const children = [];
45487    const attributes = {
45488      id: this[$uid],
45489      class: []
45490    };
45491    setAccess(this, attributes.class);
45492    this[$extra] ||= Object.create(null);
45493    Object.assign(this[$extra], {
45494      children,
45495      attributes,
45496      attempt: 0,
45497      line: null,
45498      numberInLine: 0,
45499      availableSpace: {
45500        width: Math.min(this.w || Infinity, availableSpace.width),
45501        height: Math.min(this.h || Infinity, availableSpace.height)
45502      },
45503      width: 0,
45504      height: 0,
45505      prevHeight: 0,
45506      currentWidth: 0
45507    });
45508    const isSplittable = this[$isSplittable]();
45509    if (!isSplittable) {
45510      setFirstUnsplittable(this);
45511    }
45512    if (!checkDimensions(this, availableSpace)) {
45513      return HTMLResult.FAILURE;
45514    }
45515    const filter = new Set(["field"]);
45516    if (this.layout.includes("row")) {
45517      const columnWidths = this[$getSubformParent]().columnWidths;
45518      if (Array.isArray(columnWidths) && columnWidths.length > 0) {
45519        this[$extra].columnWidths = columnWidths;
45520        this[$extra].currentColumn = 0;
45521      }
45522    }
45523    const style = toStyle(this, "anchorType", "dimensions", "position", "presence", "border", "margin", "hAlign");
45524    const classNames = ["xfaExclgroup"];
45525    const cl = layoutClass(this);
45526    if (cl) {
45527      classNames.push(cl);
45528    }
45529    if (isPrintOnly(this)) {
45530      classNames.push("xfaPrintOnly");
45531    }
45532    attributes.style = style;
45533    attributes.class = classNames;
45534    if (this.name) {
45535      attributes.xfaName = this.name;
45536    }
45537    this[$pushPara]();
45538    const isLrTb = this.layout === "lr-tb" || this.layout === "rl-tb";
45539    const maxRun = isLrTb ? MAX_ATTEMPTS_FOR_LRTB_LAYOUT : 1;
45540    for (; this[$extra].attempt < maxRun; this[$extra].attempt++) {
45541      if (isLrTb && this[$extra].attempt === MAX_ATTEMPTS_FOR_LRTB_LAYOUT - 1) {
45542        this[$extra].numberInLine = 0;
45543      }
45544      const result = this[$childrenToHTML]({
45545        filter,
45546        include: true
45547      });
45548      if (result.success) {
45549        break;
45550      }
45551      if (result.isBreak()) {
45552        this[$popPara]();
45553        return result;
45554      }
45555      if (isLrTb && this[$extra].attempt === 0 && this[$extra].numberInLine === 0 && !this[$getTemplateRoot]()[$extra].noLayoutFailure) {
45556        this[$extra].attempt = maxRun;
45557        break;
45558      }
45559    }
45560    this[$popPara]();
45561    if (!isSplittable) {
45562      unsetFirstUnsplittable(this);
45563    }
45564    if (this[$extra].attempt === maxRun) {
45565      if (!isSplittable) {
45566        delete this[$extra];
45567      }
45568      return HTMLResult.FAILURE;
45569    }
45570    let marginH = 0;
45571    let marginV = 0;
45572    if (this.margin) {
45573      marginH = this.margin.leftInset + this.margin.rightInset;
45574      marginV = this.margin.topInset + this.margin.bottomInset;
45575    }
45576    const width = Math.max(this[$extra].width + marginH, this.w || 0);
45577    const height = Math.max(this[$extra].height + marginV, this.h || 0);
45578    const bbox = [this.x, this.y, width, height];
45579    if (this.w === "") {
45580      style.width = measureToString(width);
45581    }
45582    if (this.h === "") {
45583      style.height = measureToString(height);
45584    }
45585    const html = {
45586      name: "div",
45587      attributes,
45588      children
45589    };
45590    applyAssist(this, attributes);
45591    delete this[$extra];
45592    return HTMLResult.success(createWrapper(this, html), bbox);
45593  }
45594}
45595class Execute extends XFAObject {
45596  constructor(attributes) {
45597    super(TEMPLATE_NS_ID, "execute");
45598    this.connection = attributes.connection || "";
45599    this.executeType = getStringOption(attributes.executeType, ["import", "remerge"]);
45600    this.id = attributes.id || "";
45601    this.runAt = getStringOption(attributes.runAt, ["client", "both", "server"]);
45602    this.use = attributes.use || "";
45603    this.usehref = attributes.usehref || "";
45604  }
45605}
45606class Extras extends XFAObject {
45607  constructor(attributes) {
45608    super(TEMPLATE_NS_ID, "extras", true);
45609    this.id = attributes.id || "";
45610    this.name = attributes.name || "";
45611    this.use = attributes.use || "";
45612    this.usehref = attributes.usehref || "";
45613    this.boolean = new XFAObjectArray();
45614    this.date = new XFAObjectArray();
45615    this.dateTime = new XFAObjectArray();
45616    this.decimal = new XFAObjectArray();
45617    this.exData = new XFAObjectArray();
45618    this.extras = new XFAObjectArray();
45619    this.float = new XFAObjectArray();
45620    this.image = new XFAObjectArray();
45621    this.integer = new XFAObjectArray();
45622    this.text = new XFAObjectArray();
45623    this.time = new XFAObjectArray();
45624  }
45625}
45626class Field extends XFAObject {
45627  constructor(attributes) {
45628    super(TEMPLATE_NS_ID, "field", true);
45629    this.access = getStringOption(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
45630    this.accessKey = attributes.accessKey || "";
45631    this.anchorType = getStringOption(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
45632    this.colSpan = getInteger({
45633      data: attributes.colSpan,
45634      defaultValue: 1,
45635      validate: n => n >= 1 || n === -1
45636    });
45637    this.h = attributes.h ? getMeasurement(attributes.h) : "";
45638    this.hAlign = getStringOption(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
45639    this.id = attributes.id || "";
45640    this.locale = attributes.locale || "";
45641    this.maxH = getMeasurement(attributes.maxH, "0pt");
45642    this.maxW = getMeasurement(attributes.maxW, "0pt");
45643    this.minH = getMeasurement(attributes.minH, "0pt");
45644    this.minW = getMeasurement(attributes.minW, "0pt");
45645    this.name = attributes.name || "";
45646    this.presence = getStringOption(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
45647    this.relevant = getRelevant(attributes.relevant);
45648    this.rotate = getInteger({
45649      data: attributes.rotate,
45650      defaultValue: 0,
45651      validate: x => x % 90 === 0
45652    });
45653    this.use = attributes.use || "";
45654    this.usehref = attributes.usehref || "";
45655    this.w = attributes.w ? getMeasurement(attributes.w) : "";
45656    this.x = getMeasurement(attributes.x, "0pt");
45657    this.y = getMeasurement(attributes.y, "0pt");
45658    this.assist = null;
45659    this.bind = null;
45660    this.border = null;
45661    this.calculate = null;
45662    this.caption = null;
45663    this.desc = null;
45664    this.extras = null;
45665    this.font = null;
45666    this.format = null;
45667    this.items = new XFAObjectArray(2);
45668    this.keep = null;
45669    this.margin = null;
45670    this.para = null;
45671    this.traversal = null;
45672    this.ui = null;
45673    this.validate = null;
45674    this.value = null;
45675    this.bindItems = new XFAObjectArray();
45676    this.connect = new XFAObjectArray();
45677    this.event = new XFAObjectArray();
45678    this.setProperty = new XFAObjectArray();
45679  }
45680  [$isBindable]() {
45681    return true;
45682  }
45683  [$setValue](value) {
45684    _setValue(this, value);
45685  }
45686  [$toHTML](availableSpace) {
45687    setTabIndex(this);
45688    if (!this.ui) {
45689      this.ui = new Ui({});
45690      this.ui[$globalData] = this[$globalData];
45691      this[$appendChild](this.ui);
45692      let node;
45693      switch (this.items.children.length) {
45694        case 0:
45695          node = new TextEdit({});
45696          this.ui.textEdit = node;
45697          break;
45698        case 1:
45699          node = new CheckButton({});
45700          this.ui.checkButton = node;
45701          break;
45702        case 2:
45703          node = new ChoiceList({});
45704          this.ui.choiceList = node;
45705          break;
45706      }
45707      this.ui[$appendChild](node);
45708    }
45709    if (!this.ui || this.presence === "hidden" || this.presence === "inactive" || this.h === 0 || this.w === 0) {
45710      return HTMLResult.EMPTY;
45711    }
45712    if (this.caption) {
45713      delete this.caption[$extra];
45714    }
vendor: 6,271 bytes, lines 45715-45918
45715    this[$pushPara]();
45716    const caption = this.caption ? this.caption[$toHTML](availableSpace).html : null;
45717    const savedW = this.w;
45718    const savedH = this.h;
45719    let marginH = 0;
45720    let marginV = 0;
45721    if (this.margin) {
45722      marginH = this.margin.leftInset + this.margin.rightInset;
45723      marginV = this.margin.topInset + this.margin.bottomInset;
45724    }
45725    let borderDims = null;
45726    if (this.w === "" || this.h === "") {
45727      let width = null;
45728      let height = null;
45729      let uiW = 0;
45730      let uiH = 0;
45731      if (this.ui.checkButton) {
45732        uiW = uiH = this.ui.checkButton.size;
45733      } else {
45734        const {
45735          w,
45736          h
45737        } = layoutNode(this, availableSpace);
45738        if (w !== null) {
45739          uiW = w;
45740          uiH = h;
45741        } else {
45742          uiH = fonts_getMetrics(this.font, true).lineNoGap;
45743        }
45744      }
45745      borderDims = getBorderDims(this.ui[$getExtra]());
45746      uiW += borderDims.w;
45747      uiH += borderDims.h;
45748      if (this.caption) {
45749        const {
45750          w,
45751          h,
45752          isBroken
45753        } = this.caption[$getExtra](availableSpace);
45754        if (isBroken && this[$getSubformParent]()[$isThereMoreWidth]()) {
45755          this[$popPara]();
45756          return HTMLResult.FAILURE;
45757        }
45758        width = w;
45759        height = h;
45760        switch (this.caption.placement) {
45761          case "left":
45762          case "right":
45763          case "inline":
45764            width += uiW;
45765            break;
45766          case "top":
45767          case "bottom":
45768            height += uiH;
45769            break;
45770        }
45771      } else {
45772        width = uiW;
45773        height = uiH;
45774      }
45775      if (width && this.w === "") {
45776        width += marginH;
45777        this.w = Math.min(this.maxW <= 0 ? Infinity : this.maxW, this.minW + 1 < width ? width : this.minW);
45778      }
45779      if (height && this.h === "") {
45780        height += marginV;
45781        this.h = Math.min(this.maxH <= 0 ? Infinity : this.maxH, this.minH + 1 < height ? height : this.minH);
45782      }
45783    }
45784    this[$popPara]();
45785    fixDimensions(this);
45786    setFirstUnsplittable(this);
45787    if (!checkDimensions(this, availableSpace)) {
45788      this.w = savedW;
45789      this.h = savedH;
45790      this[$popPara]();
45791      return HTMLResult.FAILURE;
45792    }
45793    unsetFirstUnsplittable(this);
45794    const style = toStyle(this, "font", "dimensions", "position", "rotate", "anchorType", "presence", "margin", "hAlign");
45795    setMinMaxDimensions(this, style);
45796    const classNames = ["xfaField"];
45797    if (this.font) {
45798      classNames.push("xfaFont");
45799    }
45800    if (isPrintOnly(this)) {
45801      classNames.push("xfaPrintOnly");
45802    }
45803    const attributes = {
45804      style,
45805      id: this[$uid],
45806      class: classNames
45807    };
45808    if (style.margin) {
45809      style.padding = style.margin;
45810      delete style.margin;
45811    }
45812    setAccess(this, classNames);
45813    if (this.name) {
45814      attributes.xfaName = this.name;
45815    }
45816    const children = [];
45817    const html = {
45818      name: "div",
45819      attributes,
45820      children
45821    };
45822    applyAssist(this, attributes);
45823    const borderStyle = this.border ? this.border[$toStyle]() : null;
45824    const bbox = computeBbox(this, html, availableSpace);
45825    const ui = this.ui[$toHTML]().html;
45826    if (!ui) {
45827      Object.assign(style, borderStyle);
45828      return HTMLResult.success(createWrapper(this, html), bbox);
45829    }
45830    if (this[$tabIndex]) {
45831      if (ui.children?.[0]) {
45832        ui.children[0].attributes.tabindex = this[$tabIndex];
45833      } else {
45834        ui.attributes.tabindex = this[$tabIndex];
45835      }
45836    }
45837    ui.attributes.style ||= Object.create(null);
45838    let aElement = null;
45839    if (this.ui.button) {
45840      if (ui.children.length === 1) {
45841        [aElement] = ui.children.splice(0, 1);
45842      }
45843      Object.assign(ui.attributes.style, borderStyle);
45844    } else {
45845      Object.assign(style, borderStyle);
45846    }
45847    children.push(ui);
45848    if (this.value) {
45849      if (this.ui.imageEdit) {
45850        ui.children.push(this.value[$toHTML]().html);
45851      } else if (!this.ui.button) {
45852        let value = "";
45853        if (this.value.exData) {
45854          value = this.value.exData[$text]();
45855        } else if (this.value.text) {
45856          value = this.value.text[$getExtra]();
45857        } else {
45858          const htmlValue = this.value[$toHTML]().html;
45859          if (htmlValue !== null) {
45860            value = htmlValue.children[0].value;
45861          }
45862        }
45863        if (this.ui.textEdit && this.value.text?.maxChars) {
45864          ui.children[0].attributes.maxLength = this.value.text.maxChars;
45865        }
45866        if (value) {
45867          if (this.ui.numericEdit) {
45868            value = parseFloat(value);
45869            value = isNaN(value) ? "" : value.toString();
45870          }
45871          if (ui.children[0].name === "textarea") {
45872            ui.children[0].attributes.textContent = value;
45873          } else {
45874            ui.children[0].attributes.value = value;
45875          }
45876        }
45877      }
45878    }
45879    if (!this.ui.imageEdit && ui.children?.[0] && this.h) {
45880      borderDims = borderDims || getBorderDims(this.ui[$getExtra]());
45881      let captionHeight = 0;
45882      if (this.caption && ["top", "bottom"].includes(this.caption.placement)) {
45883        captionHeight = this.caption.reserve;
45884        if (captionHeight <= 0) {
45885          captionHeight = this.caption[$getExtra](availableSpace).h;
45886        }
45887        const inputHeight = this.h - captionHeight - marginV - borderDims.h;
45888        ui.children[0].attributes.style.height = measureToString(inputHeight);
45889      } else {
45890        ui.children[0].attributes.style.height = "100%";
45891      }
45892    }
45893    if (aElement) {
45894      ui.children.push(aElement);
45895    }
45896    if (!caption) {
45897      if (ui.attributes.class) {
45898        ui.attributes.class.push("xfaLeft");
45899      }
45900      this.w = savedW;
45901      this.h = savedH;
45902      return HTMLResult.success(createWrapper(this, html), bbox);
45903    }
45904    if (this.ui.button) {
45905      if (style.padding) {
45906        delete style.padding;
45907      }
45908      if (caption.name === "div") {
45909        caption.name = "span";
45910      }
45911      ui.children.push(caption);
45912      return HTMLResult.success(html, bbox);
45913    } else if (this.ui.checkButton) {
45914      caption.attributes.class[0] = "xfaCaptionForCheckButton";
45915    }
45916    ui.attributes.class ||= [];
45917    ui.children.splice(0, 0, caption);
45918    switch (this.caption.placement) {
vendor: 67,244 bytes, lines 45919-47928
45919      case "left":
45920        ui.attributes.class.push("xfaLeft");
45921        break;
45922      case "right":
45923        ui.attributes.class.push("xfaRight");
45924        break;
45925      case "top":
45926        ui.attributes.class.push("xfaTop");
45927        break;
45928      case "bottom":
45929        ui.attributes.class.push("xfaBottom");
45930        break;
45931      case "inline":
45932        ui.attributes.class.push("xfaLeft");
45933        break;
45934    }
45935    this.w = savedW;
45936    this.h = savedH;
45937    return HTMLResult.success(createWrapper(this, html), bbox);
45938  }
45939}
45940class Fill extends XFAObject {
45941  constructor(attributes) {
45942    super(TEMPLATE_NS_ID, "fill", true);
45943    this.id = attributes.id || "";
45944    this.presence = getStringOption(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
45945    this.use = attributes.use || "";
45946    this.usehref = attributes.usehref || "";
45947    this.color = null;
45948    this.extras = null;
45949    this.linear = null;
45950    this.pattern = null;
45951    this.radial = null;
45952    this.solid = null;
45953    this.stipple = null;
45954  }
45955  [$toStyle]() {
45956    const parent = this[$getParent]();
45957    const grandpa = parent[$getParent]();
45958    const ggrandpa = grandpa[$getParent]();
45959    const style = Object.create(null);
45960    let propName = "color";
45961    let altPropName = propName;
45962    if (parent instanceof Border) {
45963      propName = "background-color";
45964      altPropName = "background";
45965      if (ggrandpa instanceof Ui) {
45966        style.backgroundColor = "white";
45967      }
45968    }
45969    if (parent instanceof Rectangle || parent instanceof Arc) {
45970      propName = altPropName = "fill";
45971      style.fill = "white";
45972    }
45973    for (const name of Object.getOwnPropertyNames(this)) {
45974      if (name === "extras" || name === "color") {
45975        continue;
45976      }
45977      const obj = this[name];
45978      if (!(obj instanceof XFAObject)) {
45979        continue;
45980      }
45981      const color = obj[$toStyle](this.color);
45982      if (color) {
45983        style[color.startsWith("#") ? propName : altPropName] = color;
45984      }
45985      return style;
45986    }
45987    if (this.color?.value) {
45988      const color = this.color[$toStyle]();
45989      style[color.startsWith("#") ? propName : altPropName] = color;
45990    }
45991    return style;
45992  }
45993}
45994class Filter extends XFAObject {
45995  constructor(attributes) {
45996    super(TEMPLATE_NS_ID, "filter", true);
45997    this.addRevocationInfo = getStringOption(attributes.addRevocationInfo, ["", "required", "optional", "none"]);
45998    this.id = attributes.id || "";
45999    this.name = attributes.name || "";
46000    this.use = attributes.use || "";
46001    this.usehref = attributes.usehref || "";
46002    this.version = getInteger({
46003      data: this.version,
46004      defaultValue: 5,
46005      validate: x => x >= 1 && x <= 5
46006    });
46007    this.appearanceFilter = null;
46008    this.certificates = null;
46009    this.digestMethods = null;
46010    this.encodings = null;
46011    this.encryptionMethods = null;
46012    this.handler = null;
46013    this.lockDocument = null;
46014    this.mdp = null;
46015    this.reasons = null;
46016    this.timeStamp = null;
46017  }
46018}
46019class Float extends ContentObject {
46020  constructor(attributes) {
46021    super(TEMPLATE_NS_ID, "float");
46022    this.id = attributes.id || "";
46023    this.name = attributes.name || "";
46024    this.use = attributes.use || "";
46025    this.usehref = attributes.usehref || "";
46026  }
46027  [$finalize]() {
46028    const number = parseFloat(this[$content].trim());
46029    this[$content] = isNaN(number) ? null : number;
46030  }
46031  [$toHTML](availableSpace) {
46032    return valueToHtml(this[$content] !== null ? this[$content].toString() : "");
46033  }
46034}
46035class template_Font extends XFAObject {
46036  constructor(attributes) {
46037    super(TEMPLATE_NS_ID, "font", true);
46038    this.baselineShift = getMeasurement(attributes.baselineShift);
46039    this.fontHorizontalScale = getFloat({
46040      data: attributes.fontHorizontalScale,
46041      defaultValue: 100,
46042      validate: x => x >= 0
46043    });
46044    this.fontVerticalScale = getFloat({
46045      data: attributes.fontVerticalScale,
46046      defaultValue: 100,
46047      validate: x => x >= 0
46048    });
46049    this.id = attributes.id || "";
46050    this.kerningMode = getStringOption(attributes.kerningMode, ["none", "pair"]);
46051    this.letterSpacing = getMeasurement(attributes.letterSpacing, "0");
46052    this.lineThrough = getInteger({
46053      data: attributes.lineThrough,
46054      defaultValue: 0,
46055      validate: x => x === 1 || x === 2
46056    });
46057    this.lineThroughPeriod = getStringOption(attributes.lineThroughPeriod, ["all", "word"]);
46058    this.overline = getInteger({
46059      data: attributes.overline,
46060      defaultValue: 0,
46061      validate: x => x === 1 || x === 2
46062    });
46063    this.overlinePeriod = getStringOption(attributes.overlinePeriod, ["all", "word"]);
46064    this.posture = getStringOption(attributes.posture, ["normal", "italic"]);
46065    this.size = getMeasurement(attributes.size, "10pt");
46066    this.typeface = attributes.typeface || "Courier";
46067    this.underline = getInteger({
46068      data: attributes.underline,
46069      defaultValue: 0,
46070      validate: x => x === 1 || x === 2
46071    });
46072    this.underlinePeriod = getStringOption(attributes.underlinePeriod, ["all", "word"]);
46073    this.use = attributes.use || "";
46074    this.usehref = attributes.usehref || "";
46075    this.weight = getStringOption(attributes.weight, ["normal", "bold"]);
46076    this.extras = null;
46077    this.fill = null;
46078  }
46079  [$clean](builder) {
46080    super[$clean](builder);
46081    this[$globalData].usedTypefaces.add(this.typeface);
46082  }
46083  [$toStyle]() {
46084    const style = toStyle(this, "fill");
46085    const color = style.color;
46086    if (color) {
46087      if (color === "#000000") {
46088        delete style.color;
46089      } else if (!color.startsWith("#")) {
46090        style.background = color;
46091        style.backgroundClip = "text";
46092        style.color = "transparent";
46093      }
46094    }
46095    if (this.baselineShift) {
46096      style.verticalAlign = measureToString(this.baselineShift);
46097    }
46098    style.fontKerning = this.kerningMode === "none" ? "none" : "normal";
46099    style.letterSpacing = measureToString(this.letterSpacing);
46100    if (this.lineThrough !== 0) {
46101      style.textDecoration = "line-through";
46102      if (this.lineThrough === 2) {
46103        style.textDecorationStyle = "double";
46104      }
46105    }
46106    if (this.overline !== 0) {
46107      style.textDecoration = "overline";
46108      if (this.overline === 2) {
46109        style.textDecorationStyle = "double";
46110      }
46111    }
46112    style.fontStyle = this.posture;
46113    style.fontSize = measureToString(0.99 * this.size);
46114    setFontFamily(this, this, this[$globalData].fontFinder, style);
46115    if (this.underline !== 0) {
46116      style.textDecoration = "underline";
46117      if (this.underline === 2) {
46118        style.textDecorationStyle = "double";
46119      }
46120    }
46121    style.fontWeight = this.weight;
46122    return style;
46123  }
46124}
46125class Format extends XFAObject {
46126  constructor(attributes) {
46127    super(TEMPLATE_NS_ID, "format", true);
46128    this.id = attributes.id || "";
46129    this.use = attributes.use || "";
46130    this.usehref = attributes.usehref || "";
46131    this.extras = null;
46132    this.picture = null;
46133  }
46134}
46135class Handler extends StringObject {
46136  constructor(attributes) {
46137    super(TEMPLATE_NS_ID, "handler");
46138    this.id = attributes.id || "";
46139    this.type = getStringOption(attributes.type, ["optional", "required"]);
46140    this.use = attributes.use || "";
46141    this.usehref = attributes.usehref || "";
46142  }
46143}
46144class Hyphenation extends XFAObject {
46145  constructor(attributes) {
46146    super(TEMPLATE_NS_ID, "hyphenation");
46147    this.excludeAllCaps = getInteger({
46148      data: attributes.excludeAllCaps,
46149      defaultValue: 0,
46150      validate: x => x === 1
46151    });
46152    this.excludeInitialCap = getInteger({
46153      data: attributes.excludeInitialCap,
46154      defaultValue: 0,
46155      validate: x => x === 1
46156    });
46157    this.hyphenate = getInteger({
46158      data: attributes.hyphenate,
46159      defaultValue: 0,
46160      validate: x => x === 1
46161    });
46162    this.id = attributes.id || "";
46163    this.pushCharacterCount = getInteger({
46164      data: attributes.pushCharacterCount,
46165      defaultValue: 3,
46166      validate: x => x >= 0
46167    });
46168    this.remainCharacterCount = getInteger({
46169      data: attributes.remainCharacterCount,
46170      defaultValue: 3,
46171      validate: x => x >= 0
46172    });
46173    this.use = attributes.use || "";
46174    this.usehref = attributes.usehref || "";
46175    this.wordCharacterCount = getInteger({
46176      data: attributes.wordCharacterCount,
46177      defaultValue: 7,
46178      validate: x => x >= 0
46179    });
46180  }
46181}
46182class Image extends StringObject {
46183  constructor(attributes) {
46184    super(TEMPLATE_NS_ID, "image");
46185    this.aspect = getStringOption(attributes.aspect, ["fit", "actual", "height", "none", "width"]);
46186    this.contentType = attributes.contentType || "";
46187    this.href = attributes.href || "";
46188    this.id = attributes.id || "";
46189    this.name = attributes.name || "";
46190    this.transferEncoding = getStringOption(attributes.transferEncoding, ["base64", "none", "package"]);
46191    this.use = attributes.use || "";
46192    this.usehref = attributes.usehref || "";
46193  }
46194  [$toHTML]() {
46195    if (this.contentType && !MIMES.has(this.contentType.toLowerCase())) {
46196      return HTMLResult.EMPTY;
46197    }
46198    let buffer = this[$globalData].images?.get(this.href);
46199    if (!buffer && (this.href || !this[$content])) {
46200      return HTMLResult.EMPTY;
46201    }
46202    if (!buffer && this.transferEncoding === "base64") {
46203      buffer = Uint8Array.fromBase64(this[$content]);
46204    }
46205    if (!buffer) {
46206      return HTMLResult.EMPTY;
46207    }
46208    if (!this.contentType) {
46209      for (const [header, type] of IMAGES_HEADERS) {
46210        if (buffer.length > header.length && header.every((x, i) => x === buffer[i])) {
46211          this.contentType = type;
46212          break;
46213        }
46214      }
46215      if (!this.contentType) {
46216        return HTMLResult.EMPTY;
46217      }
46218    }
46219    const blob = new Blob([buffer], {
46220      type: this.contentType
46221    });
46222    let style;
46223    switch (this.aspect) {
46224      case "fit":
46225      case "actual":
46226        break;
46227      case "height":
46228        style = {
46229          height: "100%",
46230          objectFit: "fill"
46231        };
46232        break;
46233      case "none":
46234        style = {
46235          width: "100%",
46236          height: "100%",
46237          objectFit: "fill"
46238        };
46239        break;
46240      case "width":
46241        style = {
46242          width: "100%",
46243          objectFit: "fill"
46244        };
46245        break;
46246    }
46247    const parent = this[$getParent]();
46248    return HTMLResult.success({
46249      name: "img",
46250      attributes: {
46251        class: ["xfaImage"],
46252        style,
46253        src: URL.createObjectURL(blob),
46254        alt: parent ? ariaLabel(parent[$getParent]()) : null
46255      }
46256    });
46257  }
46258}
46259class ImageEdit extends XFAObject {
46260  constructor(attributes) {
46261    super(TEMPLATE_NS_ID, "imageEdit", true);
46262    this.data = getStringOption(attributes.data, ["link", "embed"]);
46263    this.id = attributes.id || "";
46264    this.use = attributes.use || "";
46265    this.usehref = attributes.usehref || "";
46266    this.border = null;
46267    this.extras = null;
46268    this.margin = null;
46269  }
46270  [$toHTML](availableSpace) {
46271    if (this.data === "embed") {
46272      return HTMLResult.success({
46273        name: "div",
46274        children: [],
46275        attributes: {}
46276      });
46277    }
46278    return HTMLResult.EMPTY;
46279  }
46280}
46281class Integer extends ContentObject {
46282  constructor(attributes) {
46283    super(TEMPLATE_NS_ID, "integer");
46284    this.id = attributes.id || "";
46285    this.name = attributes.name || "";
46286    this.use = attributes.use || "";
46287    this.usehref = attributes.usehref || "";
46288  }
46289  [$finalize]() {
46290    const number = parseInt(this[$content].trim(), 10);
46291    this[$content] = isNaN(number) ? null : number;
46292  }
46293  [$toHTML](availableSpace) {
46294    return valueToHtml(this[$content] !== null ? this[$content].toString() : "");
46295  }
46296}
46297class Issuers extends XFAObject {
46298  constructor(attributes) {
46299    super(TEMPLATE_NS_ID, "issuers", true);
46300    this.id = attributes.id || "";
46301    this.type = getStringOption(attributes.type, ["optional", "required"]);
46302    this.use = attributes.use || "";
46303    this.usehref = attributes.usehref || "";
46304    this.certificate = new XFAObjectArray();
46305  }
46306}
46307class Items extends XFAObject {
46308  constructor(attributes) {
46309    super(TEMPLATE_NS_ID, "items", true);
46310    this.id = attributes.id || "";
46311    this.name = attributes.name || "";
46312    this.presence = getStringOption(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
46313    this.ref = attributes.ref || "";
46314    this.save = getInteger({
46315      data: attributes.save,
46316      defaultValue: 0,
46317      validate: x => x === 1
46318    });
46319    this.use = attributes.use || "";
46320    this.usehref = attributes.usehref || "";
46321    this.boolean = new XFAObjectArray();
46322    this.date = new XFAObjectArray();
46323    this.dateTime = new XFAObjectArray();
46324    this.decimal = new XFAObjectArray();
46325    this.exData = new XFAObjectArray();
46326    this.float = new XFAObjectArray();
46327    this.image = new XFAObjectArray();
46328    this.integer = new XFAObjectArray();
46329    this.text = new XFAObjectArray();
46330    this.time = new XFAObjectArray();
46331  }
46332  [$toHTML]() {
46333    const output = [];
46334    for (const child of this[$getChildren]()) {
46335      output.push(child[$text]());
46336    }
46337    return HTMLResult.success(output);
46338  }
46339}
46340class Keep extends XFAObject {
46341  constructor(attributes) {
46342    super(TEMPLATE_NS_ID, "keep", true);
46343    this.id = attributes.id || "";
46344    const options = ["none", "contentArea", "pageArea"];
46345    this.intact = getStringOption(attributes.intact, options);
46346    this.next = getStringOption(attributes.next, options);
46347    this.previous = getStringOption(attributes.previous, options);
46348    this.use = attributes.use || "";
46349    this.usehref = attributes.usehref || "";
46350    this.extras = null;
46351  }
46352}
46353class KeyUsage extends XFAObject {
46354  constructor(attributes) {
46355    super(TEMPLATE_NS_ID, "keyUsage");
46356    const options = ["", "yes", "no"];
46357    this.crlSign = getStringOption(attributes.crlSign, options);
46358    this.dataEncipherment = getStringOption(attributes.dataEncipherment, options);
46359    this.decipherOnly = getStringOption(attributes.decipherOnly, options);
46360    this.digitalSignature = getStringOption(attributes.digitalSignature, options);
46361    this.encipherOnly = getStringOption(attributes.encipherOnly, options);
46362    this.id = attributes.id || "";
46363    this.keyAgreement = getStringOption(attributes.keyAgreement, options);
46364    this.keyCertSign = getStringOption(attributes.keyCertSign, options);
46365    this.keyEncipherment = getStringOption(attributes.keyEncipherment, options);
46366    this.nonRepudiation = getStringOption(attributes.nonRepudiation, options);
46367    this.type = getStringOption(attributes.type, ["optional", "required"]);
46368    this.use = attributes.use || "";
46369    this.usehref = attributes.usehref || "";
46370  }
46371}
46372class Line extends XFAObject {
46373  constructor(attributes) {
46374    super(TEMPLATE_NS_ID, "line", true);
46375    this.hand = getStringOption(attributes.hand, ["even", "left", "right"]);
46376    this.id = attributes.id || "";
46377    this.slope = getStringOption(attributes.slope, ["\\", "/"]);
46378    this.use = attributes.use || "";
46379    this.usehref = attributes.usehref || "";
46380    this.edge = null;
46381  }
46382  [$toHTML]() {
46383    const parent = this[$getParent]()[$getParent]();
46384    const edge = this.edge || new Edge({});
46385    const edgeStyle = edge[$toStyle]();
46386    const style = Object.create(null);
46387    const thickness = edge.presence === "visible" ? edge.thickness : 0;
46388    style.strokeWidth = measureToString(thickness);
46389    style.stroke = edgeStyle.color;
46390    let x1, y1, x2, y2;
46391    let width = "100%";
46392    let height = "100%";
46393    if (parent.w <= thickness) {
46394      [x1, y1, x2, y2] = ["50%", 0, "50%", "100%"];
46395      width = style.strokeWidth;
46396    } else if (parent.h <= thickness) {
46397      [x1, y1, x2, y2] = [0, "50%", "100%", "50%"];
46398      height = style.strokeWidth;
46399    } else if (this.slope === "\\") {
46400      [x1, y1, x2, y2] = [0, 0, "100%", "100%"];
46401    } else {
46402      [x1, y1, x2, y2] = [0, "100%", "100%", 0];
46403    }
46404    const line = {
46405      name: "line",
46406      attributes: {
46407        xmlns: SVG_NS,
46408        x1,
46409        y1,
46410        x2,
46411        y2,
46412        style
46413      }
46414    };
46415    const svg = {
46416      name: "svg",
46417      children: [line],
46418      attributes: {
46419        xmlns: SVG_NS,
46420        width,
46421        height,
46422        style: {
46423          overflow: "visible"
46424        }
46425      }
46426    };
46427    if (hasMargin(parent)) {
46428      return HTMLResult.success({
46429        name: "div",
46430        attributes: {
46431          style: {
46432            display: "inline",
46433            width: "100%",
46434            height: "100%"
46435          }
46436        },
46437        children: [svg]
46438      });
46439    }
46440    svg.attributes.style.position = "absolute";
46441    return HTMLResult.success(svg);
46442  }
46443}
46444class Linear extends XFAObject {
46445  constructor(attributes) {
46446    super(TEMPLATE_NS_ID, "linear", true);
46447    this.id = attributes.id || "";
46448    this.type = getStringOption(attributes.type, ["toRight", "toBottom", "toLeft", "toTop"]);
46449    this.use = attributes.use || "";
46450    this.usehref = attributes.usehref || "";
46451    this.color = null;
46452    this.extras = null;
46453  }
46454  [$toStyle](startColor) {
46455    startColor = startColor ? startColor[$toStyle]() : "#FFFFFF";
46456    const transf = this.type.replace(/([RBLT])/, " $1").toLowerCase();
46457    const endColor = this.color ? this.color[$toStyle]() : "#000000";
46458    return `linear-gradient(${transf}, ${startColor}, ${endColor})`;
46459  }
46460}
46461class LockDocument extends ContentObject {
46462  constructor(attributes) {
46463    super(TEMPLATE_NS_ID, "lockDocument");
46464    this.id = attributes.id || "";
46465    this.type = getStringOption(attributes.type, ["optional", "required"]);
46466    this.use = attributes.use || "";
46467    this.usehref = attributes.usehref || "";
46468  }
46469  [$finalize]() {
46470    this[$content] = getStringOption(this[$content], ["auto", "0", "1"]);
46471  }
46472}
46473class Manifest extends XFAObject {
46474  constructor(attributes) {
46475    super(TEMPLATE_NS_ID, "manifest", true);
46476    this.action = getStringOption(attributes.action, ["include", "all", "exclude"]);
46477    this.id = attributes.id || "";
46478    this.name = attributes.name || "";
46479    this.use = attributes.use || "";
46480    this.usehref = attributes.usehref || "";
46481    this.extras = null;
46482    this.ref = new XFAObjectArray();
46483  }
46484}
46485class Margin extends XFAObject {
46486  constructor(attributes) {
46487    super(TEMPLATE_NS_ID, "margin", true);
46488    this.bottomInset = getMeasurement(attributes.bottomInset, "0");
46489    this.id = attributes.id || "";
46490    this.leftInset = getMeasurement(attributes.leftInset, "0");
46491    this.rightInset = getMeasurement(attributes.rightInset, "0");
46492    this.topInset = getMeasurement(attributes.topInset, "0");
46493    this.use = attributes.use || "";
46494    this.usehref = attributes.usehref || "";
46495    this.extras = null;
46496  }
46497  [$toStyle]() {
46498    return {
46499      margin: measureToString(this.topInset) + " " + measureToString(this.rightInset) + " " + measureToString(this.bottomInset) + " " + measureToString(this.leftInset)
46500    };
46501  }
46502}
46503class Mdp extends XFAObject {
46504  constructor(attributes) {
46505    super(TEMPLATE_NS_ID, "mdp");
46506    this.id = attributes.id || "";
46507    this.permissions = getInteger({
46508      data: attributes.permissions,
46509      defaultValue: 2,
46510      validate: x => x === 1 || x === 3
46511    });
46512    this.signatureType = getStringOption(attributes.signatureType, ["filler", "author"]);
46513    this.use = attributes.use || "";
46514    this.usehref = attributes.usehref || "";
46515  }
46516}
46517class Medium extends XFAObject {
46518  constructor(attributes) {
46519    super(TEMPLATE_NS_ID, "medium");
46520    this.id = attributes.id || "";
46521    this.imagingBBox = getBBox(attributes.imagingBBox);
46522    this.long = getMeasurement(attributes.long);
46523    this.orientation = getStringOption(attributes.orientation, ["portrait", "landscape"]);
46524    this.short = getMeasurement(attributes.short);
46525    this.stock = attributes.stock || "";
46526    this.trayIn = getStringOption(attributes.trayIn, ["auto", "delegate", "pageFront"]);
46527    this.trayOut = getStringOption(attributes.trayOut, ["auto", "delegate"]);
46528    this.use = attributes.use || "";
46529    this.usehref = attributes.usehref || "";
46530  }
46531}
46532class Message extends XFAObject {
46533  constructor(attributes) {
46534    super(TEMPLATE_NS_ID, "message", true);
46535    this.id = attributes.id || "";
46536    this.use = attributes.use || "";
46537    this.usehref = attributes.usehref || "";
46538    this.text = new XFAObjectArray();
46539  }
46540}
46541class NumericEdit extends XFAObject {
46542  constructor(attributes) {
46543    super(TEMPLATE_NS_ID, "numericEdit", true);
46544    this.hScrollPolicy = getStringOption(attributes.hScrollPolicy, ["auto", "off", "on"]);
46545    this.id = attributes.id || "";
46546    this.use = attributes.use || "";
46547    this.usehref = attributes.usehref || "";
46548    this.border = null;
46549    this.comb = null;
46550    this.extras = null;
46551    this.margin = null;
46552  }
46553  [$toHTML](availableSpace) {
46554    const style = toStyle(this, "border", "font", "margin");
46555    const field = this[$getParent]()[$getParent]();
46556    const html = {
46557      name: "input",
46558      attributes: {
46559        type: "text",
46560        fieldId: field[$uid],
46561        dataId: field[$data]?.[$uid] || field[$uid],
46562        class: ["xfaTextfield"],
46563        style,
46564        "aria-label": ariaLabel(field),
46565        "aria-required": false
46566      }
46567    };
46568    if (isRequired(field)) {
46569      html.attributes["aria-required"] = true;
46570      html.attributes.required = true;
46571    }
46572    return HTMLResult.success({
46573      name: "label",
46574      attributes: {
46575        class: ["xfaLabel"]
46576      },
46577      children: [html]
46578    });
46579  }
46580}
46581class Occur extends XFAObject {
46582  constructor(attributes) {
46583    super(TEMPLATE_NS_ID, "occur", true);
46584    this.id = attributes.id || "";
46585    this.initial = attributes.initial !== "" ? getInteger({
46586      data: attributes.initial,
46587      defaultValue: "",
46588      validate: x => true
46589    }) : "";
46590    this.max = attributes.max !== "" ? getInteger({
46591      data: attributes.max,
46592      defaultValue: -1,
46593      validate: x => true
46594    }) : "";
46595    this.min = attributes.min !== "" ? getInteger({
46596      data: attributes.min,
46597      defaultValue: 1,
46598      validate: x => true
46599    }) : "";
46600    this.use = attributes.use || "";
46601    this.usehref = attributes.usehref || "";
46602    this.extras = null;
46603  }
46604  [$clean]() {
46605    const parent = this[$getParent]();
46606    const originalMin = this.min;
46607    if (this.min === "") {
46608      this.min = parent instanceof PageArea || parent instanceof PageSet ? 0 : 1;
46609    }
46610    if (this.max === "") {
46611      if (originalMin === "") {
46612        this.max = parent instanceof PageArea || parent instanceof PageSet ? -1 : 1;
46613      } else {
46614        this.max = this.min;
46615      }
46616    }
46617    if (this.max !== -1 && this.max < this.min) {
46618      this.max = this.min;
46619    }
46620    if (this.initial === "") {
46621      this.initial = parent instanceof Template ? 1 : this.min;
46622    }
46623  }
46624}
46625class Oid extends StringObject {
46626  constructor(attributes) {
46627    super(TEMPLATE_NS_ID, "oid");
46628    this.id = attributes.id || "";
46629    this.name = attributes.name || "";
46630    this.use = attributes.use || "";
46631    this.usehref = attributes.usehref || "";
46632  }
46633}
46634class Oids extends XFAObject {
46635  constructor(attributes) {
46636    super(TEMPLATE_NS_ID, "oids", true);
46637    this.id = attributes.id || "";
46638    this.type = getStringOption(attributes.type, ["optional", "required"]);
46639    this.use = attributes.use || "";
46640    this.usehref = attributes.usehref || "";
46641    this.oid = new XFAObjectArray();
46642  }
46643}
46644class Overflow extends XFAObject {
46645  constructor(attributes) {
46646    super(TEMPLATE_NS_ID, "overflow");
46647    this.id = attributes.id || "";
46648    this.leader = attributes.leader || "";
46649    this.target = attributes.target || "";
46650    this.trailer = attributes.trailer || "";
46651    this.use = attributes.use || "";
46652    this.usehref = attributes.usehref || "";
46653  }
46654  [$getExtra]() {
46655    if (!this[$extra]) {
46656      const parent = this[$getParent]();
46657      const root = this[$getTemplateRoot]();
46658      const target = root[$searchNode](this.target, parent);
46659      const leader = root[$searchNode](this.leader, parent);
46660      const trailer = root[$searchNode](this.trailer, parent);
46661      this[$extra] = {
46662        target: target?.[0] || null,
46663        leader: leader?.[0] || null,
46664        trailer: trailer?.[0] || null,
46665        addLeader: false,
46666        addTrailer: false
46667      };
46668    }
46669    return this[$extra];
46670  }
46671}
46672class PageArea extends XFAObject {
46673  constructor(attributes) {
46674    super(TEMPLATE_NS_ID, "pageArea", true);
46675    this.blankOrNotBlank = getStringOption(attributes.blankOrNotBlank, ["any", "blank", "notBlank"]);
46676    this.id = attributes.id || "";
46677    this.initialNumber = getInteger({
46678      data: attributes.initialNumber,
46679      defaultValue: 1,
46680      validate: x => true
46681    });
46682    this.name = attributes.name || "";
46683    this.numbered = getInteger({
46684      data: attributes.numbered,
46685      defaultValue: 1,
46686      validate: x => true
46687    });
46688    this.oddOrEven = getStringOption(attributes.oddOrEven, ["any", "even", "odd"]);
46689    this.pagePosition = getStringOption(attributes.pagePosition, ["any", "first", "last", "only", "rest"]);
46690    this.relevant = getRelevant(attributes.relevant);
46691    this.use = attributes.use || "";
46692    this.usehref = attributes.usehref || "";
46693    this.desc = null;
46694    this.extras = null;
46695    this.medium = null;
46696    this.occur = null;
46697    this.area = new XFAObjectArray();
46698    this.contentArea = new XFAObjectArray();
46699    this.draw = new XFAObjectArray();
46700    this.exclGroup = new XFAObjectArray();
46701    this.field = new XFAObjectArray();
46702    this.subform = new XFAObjectArray();
46703  }
46704  [$isUsable]() {
46705    if (!this[$extra]) {
46706      this[$extra] = {
46707        numberOfUse: 0
46708      };
46709      return true;
46710    }
46711    return !this.occur || this.occur.max === -1 || this[$extra].numberOfUse < this.occur.max;
46712  }
46713  [$cleanPage]() {
46714    delete this[$extra];
46715  }
46716  [$getNextPage]() {
46717    this[$extra] ||= {
46718      numberOfUse: 0
46719    };
46720    const parent = this[$getParent]();
46721    if (parent.relation === "orderedOccurrence") {
46722      if (this[$isUsable]()) {
46723        this[$extra].numberOfUse += 1;
46724        return this;
46725      }
46726    }
46727    return parent[$getNextPage]();
46728  }
46729  [$getAvailableSpace]() {
46730    return this[$extra].space || {
46731      width: 0,
46732      height: 0
46733    };
46734  }
46735  [$toHTML]() {
46736    this[$extra] ||= {
46737      numberOfUse: 1
46738    };
46739    const children = [];
46740    this[$extra].children = children;
46741    const style = Object.create(null);
46742    if (this.medium && this.medium.short && this.medium.long) {
46743      style.width = measureToString(this.medium.short);
46744      style.height = measureToString(this.medium.long);
46745      this[$extra].space = {
46746        width: this.medium.short,
46747        height: this.medium.long
46748      };
46749      if (this.medium.orientation === "landscape") {
46750        const x = style.width;
46751        style.width = style.height;
46752        style.height = x;
46753        this[$extra].space = {
46754          width: this.medium.long,
46755          height: this.medium.short
46756        };
46757      }
46758    } else {
46759      warn("XFA - No medium specified in pageArea: please file a bug.");
46760    }
46761    this[$childrenToHTML]({
46762      filter: new Set(["area", "draw", "field", "subform"]),
46763      include: true
46764    });
46765    this[$childrenToHTML]({
46766      filter: new Set(["contentArea"]),
46767      include: true
46768    });
46769    return HTMLResult.success({
46770      name: "div",
46771      children,
46772      attributes: {
46773        class: ["xfaPage"],
46774        id: this[$uid],
46775        style,
46776        xfaName: this.name
46777      }
46778    });
46779  }
46780}
46781class PageSet extends XFAObject {
46782  constructor(attributes) {
46783    super(TEMPLATE_NS_ID, "pageSet", true);
46784    this.duplexImposition = getStringOption(attributes.duplexImposition, ["longEdge", "shortEdge"]);
46785    this.id = attributes.id || "";
46786    this.name = attributes.name || "";
46787    this.relation = getStringOption(attributes.relation, ["orderedOccurrence", "duplexPaginated", "simplexPaginated"]);
46788    this.relevant = getRelevant(attributes.relevant);
46789    this.use = attributes.use || "";
46790    this.usehref = attributes.usehref || "";
46791    this.extras = null;
46792    this.occur = null;
46793    this.pageArea = new XFAObjectArray();
46794    this.pageSet = new XFAObjectArray();
46795  }
46796  [$cleanPage]() {
46797    for (const page of this.pageArea.children) {
46798      page[$cleanPage]();
46799    }
46800    for (const page of this.pageSet.children) {
46801      page[$cleanPage]();
46802    }
46803  }
46804  [$isUsable]() {
46805    return !this.occur || this.occur.max === -1 || this[$extra].numberOfUse < this.occur.max;
46806  }
46807  [$getNextPage]() {
46808    this[$extra] ||= {
46809      numberOfUse: 1,
46810      pageIndex: -1,
46811      pageSetIndex: -1
46812    };
46813    if (this.relation === "orderedOccurrence") {
46814      if (this[$extra].pageIndex + 1 < this.pageArea.children.length) {
46815        this[$extra].pageIndex += 1;
46816        const pageArea = this.pageArea.children[this[$extra].pageIndex];
46817        return pageArea[$getNextPage]();
46818      }
46819      if (this[$extra].pageSetIndex + 1 < this.pageSet.children.length) {
46820        this[$extra].pageSetIndex += 1;
46821        return this.pageSet.children[this[$extra].pageSetIndex][$getNextPage]();
46822      }
46823      if (this[$isUsable]()) {
46824        this[$extra].numberOfUse += 1;
46825        this[$extra].pageIndex = -1;
46826        this[$extra].pageSetIndex = -1;
46827        return this[$getNextPage]();
46828      }
46829      const parent = this[$getParent]();
46830      if (parent instanceof PageSet) {
46831        return parent[$getNextPage]();
46832      }
46833      this[$cleanPage]();
46834      return this[$getNextPage]();
46835    }
46836    const pageNumber = this[$getTemplateRoot]()[$extra].pageNumber;
46837    const parity = pageNumber % 2 === 0 ? "even" : "odd";
46838    const position = pageNumber === 0 ? "first" : "rest";
46839    let page = this.pageArea.children.find(p => p.oddOrEven === parity && p.pagePosition === position);
46840    if (page) {
46841      return page;
46842    }
46843    page = this.pageArea.children.find(p => p.oddOrEven === "any" && p.pagePosition === position);
46844    if (page) {
46845      return page;
46846    }
46847    page = this.pageArea.children.find(p => p.oddOrEven === "any" && p.pagePosition === "any");
46848    if (page) {
46849      return page;
46850    }
46851    return this.pageArea.children[0];
46852  }
46853}
46854class Para extends XFAObject {
46855  constructor(attributes) {
46856    super(TEMPLATE_NS_ID, "para", true);
46857    this.hAlign = getStringOption(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
46858    this.id = attributes.id || "";
46859    this.lineHeight = attributes.lineHeight ? getMeasurement(attributes.lineHeight, "0pt") : "";
46860    this.marginLeft = attributes.marginLeft ? getMeasurement(attributes.marginLeft, "0pt") : "";
46861    this.marginRight = attributes.marginRight ? getMeasurement(attributes.marginRight, "0pt") : "";
46862    this.orphans = getInteger({
46863      data: attributes.orphans,
46864      defaultValue: 0,
46865      validate: x => x >= 0
46866    });
46867    this.preserve = attributes.preserve || "";
46868    this.radixOffset = attributes.radixOffset ? getMeasurement(attributes.radixOffset, "0pt") : "";
46869    this.spaceAbove = attributes.spaceAbove ? getMeasurement(attributes.spaceAbove, "0pt") : "";
46870    this.spaceBelow = attributes.spaceBelow ? getMeasurement(attributes.spaceBelow, "0pt") : "";
46871    this.tabDefault = attributes.tabDefault ? getMeasurement(this.tabDefault) : "";
46872    this.tabStops = (attributes.tabStops || "").trim().split(/\s+/).map((x, i) => i % 2 === 1 ? getMeasurement(x) : x);
46873    this.textIndent = attributes.textIndent ? getMeasurement(attributes.textIndent, "0pt") : "";
46874    this.use = attributes.use || "";
46875    this.usehref = attributes.usehref || "";
46876    this.vAlign = getStringOption(attributes.vAlign, ["top", "bottom", "middle"]);
46877    this.widows = getInteger({
46878      data: attributes.widows,
46879      defaultValue: 0,
46880      validate: x => x >= 0
46881    });
46882    this.hyphenation = null;
46883  }
46884  [$toStyle]() {
46885    const style = toStyle(this, "hAlign");
46886    if (this.marginLeft !== "") {
46887      style.paddingLeft = measureToString(this.marginLeft);
46888    }
46889    if (this.marginRight !== "") {
46890      style.paddingRight = measureToString(this.marginRight);
46891    }
46892    if (this.spaceAbove !== "") {
46893      style.paddingTop = measureToString(this.spaceAbove);
46894    }
46895    if (this.spaceBelow !== "") {
46896      style.paddingBottom = measureToString(this.spaceBelow);
46897    }
46898    if (this.textIndent !== "") {
46899      style.textIndent = measureToString(this.textIndent);
46900      fixTextIndent(style);
46901    }
46902    if (this.lineHeight > 0) {
46903      style.lineHeight = measureToString(this.lineHeight);
46904    }
46905    if (this.tabDefault !== "") {
46906      style.tabSize = measureToString(this.tabDefault);
46907    }
46908    if (this.tabStops.length > 0) {}
46909    if (this.hyphenatation) {
46910      Object.assign(style, this.hyphenatation[$toStyle]());
46911    }
46912    return style;
46913  }
46914}
46915class PasswordEdit extends XFAObject {
46916  constructor(attributes) {
46917    super(TEMPLATE_NS_ID, "passwordEdit", true);
46918    this.hScrollPolicy = getStringOption(attributes.hScrollPolicy, ["auto", "off", "on"]);
46919    this.id = attributes.id || "";
46920    this.passwordChar = attributes.passwordChar || "*";
46921    this.use = attributes.use || "";
46922    this.usehref = attributes.usehref || "";
46923    this.border = null;
46924    this.extras = null;
46925    this.margin = null;
46926  }
46927}
46928class template_Pattern extends XFAObject {
46929  constructor(attributes) {
46930    super(TEMPLATE_NS_ID, "pattern", true);
46931    this.id = attributes.id || "";
46932    this.type = getStringOption(attributes.type, ["crossHatch", "crossDiagonal", "diagonalLeft", "diagonalRight", "horizontal", "vertical"]);
46933    this.use = attributes.use || "";
46934    this.usehref = attributes.usehref || "";
46935    this.color = null;
46936    this.extras = null;
46937  }
46938  [$toStyle](startColor) {
46939    startColor = startColor ? startColor[$toStyle]() : "#FFFFFF";
46940    const endColor = this.color ? this.color[$toStyle]() : "#000000";
46941    const width = 5;
46942    const cmd = "repeating-linear-gradient";
46943    const colors = `${startColor},${startColor} ${width}px,${endColor} ${width}px,${endColor} ${2 * width}px`;
46944    switch (this.type) {
46945      case "crossHatch":
46946        return `${cmd}(to top,${colors}) ${cmd}(to right,${colors})`;
46947      case "crossDiagonal":
46948        return `${cmd}(45deg,${colors}) ${cmd}(-45deg,${colors})`;
46949      case "diagonalLeft":
46950        return `${cmd}(45deg,${colors})`;
46951      case "diagonalRight":
46952        return `${cmd}(-45deg,${colors})`;
46953      case "horizontal":
46954        return `${cmd}(to top,${colors})`;
46955      case "vertical":
46956        return `${cmd}(to right,${colors})`;
46957    }
46958    return "";
46959  }
46960}
46961class Picture extends StringObject {
46962  constructor(attributes) {
46963    super(TEMPLATE_NS_ID, "picture");
46964    this.id = attributes.id || "";
46965    this.use = attributes.use || "";
46966    this.usehref = attributes.usehref || "";
46967  }
46968}
46969class Proto extends XFAObject {
46970  constructor(attributes) {
46971    super(TEMPLATE_NS_ID, "proto", true);
46972    this.appearanceFilter = new XFAObjectArray();
46973    this.arc = new XFAObjectArray();
46974    this.area = new XFAObjectArray();
46975    this.assist = new XFAObjectArray();
46976    this.barcode = new XFAObjectArray();
46977    this.bindItems = new XFAObjectArray();
46978    this.bookend = new XFAObjectArray();
46979    this.boolean = new XFAObjectArray();
46980    this.border = new XFAObjectArray();
46981    this.break = new XFAObjectArray();
46982    this.breakAfter = new XFAObjectArray();
46983    this.breakBefore = new XFAObjectArray();
46984    this.button = new XFAObjectArray();
46985    this.calculate = new XFAObjectArray();
46986    this.caption = new XFAObjectArray();
46987    this.certificate = new XFAObjectArray();
46988    this.certificates = new XFAObjectArray();
46989    this.checkButton = new XFAObjectArray();
46990    this.choiceList = new XFAObjectArray();
46991    this.color = new XFAObjectArray();
46992    this.comb = new XFAObjectArray();
46993    this.connect = new XFAObjectArray();
46994    this.contentArea = new XFAObjectArray();
46995    this.corner = new XFAObjectArray();
46996    this.date = new XFAObjectArray();
46997    this.dateTime = new XFAObjectArray();
46998    this.dateTimeEdit = new XFAObjectArray();
46999    this.decimal = new XFAObjectArray();
47000    this.defaultUi = new XFAObjectArray();
47001    this.desc = new XFAObjectArray();
47002    this.digestMethod = new XFAObjectArray();
47003    this.digestMethods = new XFAObjectArray();
47004    this.draw = new XFAObjectArray();
47005    this.edge = new XFAObjectArray();
47006    this.encoding = new XFAObjectArray();
47007    this.encodings = new XFAObjectArray();
47008    this.encrypt = new XFAObjectArray();
47009    this.encryptData = new XFAObjectArray();
47010    this.encryption = new XFAObjectArray();
47011    this.encryptionMethod = new XFAObjectArray();
47012    this.encryptionMethods = new XFAObjectArray();
47013    this.event = new XFAObjectArray();
47014    this.exData = new XFAObjectArray();
47015    this.exObject = new XFAObjectArray();
47016    this.exclGroup = new XFAObjectArray();
47017    this.execute = new XFAObjectArray();
47018    this.extras = new XFAObjectArray();
47019    this.field = new XFAObjectArray();
47020    this.fill = new XFAObjectArray();
47021    this.filter = new XFAObjectArray();
47022    this.float = new XFAObjectArray();
47023    this.font = new XFAObjectArray();
47024    this.format = new XFAObjectArray();
47025    this.handler = new XFAObjectArray();
47026    this.hyphenation = new XFAObjectArray();
47027    this.image = new XFAObjectArray();
47028    this.imageEdit = new XFAObjectArray();
47029    this.integer = new XFAObjectArray();
47030    this.issuers = new XFAObjectArray();
47031    this.items = new XFAObjectArray();
47032    this.keep = new XFAObjectArray();
47033    this.keyUsage = new XFAObjectArray();
47034    this.line = new XFAObjectArray();
47035    this.linear = new XFAObjectArray();
47036    this.lockDocument = new XFAObjectArray();
47037    this.manifest = new XFAObjectArray();
47038    this.margin = new XFAObjectArray();
47039    this.mdp = new XFAObjectArray();
47040    this.medium = new XFAObjectArray();
47041    this.message = new XFAObjectArray();
47042    this.numericEdit = new XFAObjectArray();
47043    this.occur = new XFAObjectArray();
47044    this.oid = new XFAObjectArray();
47045    this.oids = new XFAObjectArray();
47046    this.overflow = new XFAObjectArray();
47047    this.pageArea = new XFAObjectArray();
47048    this.pageSet = new XFAObjectArray();
47049    this.para = new XFAObjectArray();
47050    this.passwordEdit = new XFAObjectArray();
47051    this.pattern = new XFAObjectArray();
47052    this.picture = new XFAObjectArray();
47053    this.radial = new XFAObjectArray();
47054    this.reason = new XFAObjectArray();
47055    this.reasons = new XFAObjectArray();
47056    this.rectangle = new XFAObjectArray();
47057    this.ref = new XFAObjectArray();
47058    this.script = new XFAObjectArray();
47059    this.setProperty = new XFAObjectArray();
47060    this.signData = new XFAObjectArray();
47061    this.signature = new XFAObjectArray();
47062    this.signing = new XFAObjectArray();
47063    this.solid = new XFAObjectArray();
47064    this.speak = new XFAObjectArray();
47065    this.stipple = new XFAObjectArray();
47066    this.subform = new XFAObjectArray();
47067    this.subformSet = new XFAObjectArray();
47068    this.subjectDN = new XFAObjectArray();
47069    this.subjectDNs = new XFAObjectArray();
47070    this.submit = new XFAObjectArray();
47071    this.text = new XFAObjectArray();
47072    this.textEdit = new XFAObjectArray();
47073    this.time = new XFAObjectArray();
47074    this.timeStamp = new XFAObjectArray();
47075    this.toolTip = new XFAObjectArray();
47076    this.traversal = new XFAObjectArray();
47077    this.traverse = new XFAObjectArray();
47078    this.ui = new XFAObjectArray();
47079    this.validate = new XFAObjectArray();
47080    this.value = new XFAObjectArray();
47081    this.variables = new XFAObjectArray();
47082  }
47083}
47084class Radial extends XFAObject {
47085  constructor(attributes) {
47086    super(TEMPLATE_NS_ID, "radial", true);
47087    this.id = attributes.id || "";
47088    this.type = getStringOption(attributes.type, ["toEdge", "toCenter"]);
47089    this.use = attributes.use || "";
47090    this.usehref = attributes.usehref || "";
47091    this.color = null;
47092    this.extras = null;
47093  }
47094  [$toStyle](startColor) {
47095    startColor = startColor ? startColor[$toStyle]() : "#FFFFFF";
47096    const endColor = this.color ? this.color[$toStyle]() : "#000000";
47097    const colors = this.type === "toEdge" ? `${startColor},${endColor}` : `${endColor},${startColor}`;
47098    return `radial-gradient(circle at center, ${colors})`;
47099  }
47100}
47101class Reason extends StringObject {
47102  constructor(attributes) {
47103    super(TEMPLATE_NS_ID, "reason");
47104    this.id = attributes.id || "";
47105    this.name = attributes.name || "";
47106    this.use = attributes.use || "";
47107    this.usehref = attributes.usehref || "";
47108  }
47109}
47110class Reasons extends XFAObject {
47111  constructor(attributes) {
47112    super(TEMPLATE_NS_ID, "reasons", true);
47113    this.id = attributes.id || "";
47114    this.type = getStringOption(attributes.type, ["optional", "required"]);
47115    this.use = attributes.use || "";
47116    this.usehref = attributes.usehref || "";
47117    this.reason = new XFAObjectArray();
47118  }
47119}
47120class Rectangle extends XFAObject {
47121  constructor(attributes) {
47122    super(TEMPLATE_NS_ID, "rectangle", true);
47123    this.hand = getStringOption(attributes.hand, ["even", "left", "right"]);
47124    this.id = attributes.id || "";
47125    this.use = attributes.use || "";
47126    this.usehref = attributes.usehref || "";
47127    this.corner = new XFAObjectArray(4);
47128    this.edge = new XFAObjectArray(4);
47129    this.fill = null;
47130  }
47131  [$toHTML]() {
47132    const edge = this.edge.children.length ? this.edge.children[0] : new Edge({});
47133    const edgeStyle = edge[$toStyle]();
47134    const style = Object.create(null);
47135    if (this.fill?.presence === "visible") {
47136      Object.assign(style, this.fill[$toStyle]());
47137    } else {
47138      style.fill = "transparent";
47139    }
47140    style.strokeWidth = measureToString(edge.presence === "visible" ? edge.thickness : 0);
47141    style.stroke = edgeStyle.color;
47142    const corner = this.corner.children.length ? this.corner.children[0] : new Corner({});
47143    const cornerStyle = corner[$toStyle]();
47144    const rect = {
47145      name: "rect",
47146      attributes: {
47147        xmlns: SVG_NS,
47148        width: "100%",
47149        height: "100%",
47150        x: 0,
47151        y: 0,
47152        rx: cornerStyle.radius,
47153        ry: cornerStyle.radius,
47154        style
47155      }
47156    };
47157    const svg = {
47158      name: "svg",
47159      children: [rect],
47160      attributes: {
47161        xmlns: SVG_NS,
47162        style: {
47163          overflow: "visible"
47164        },
47165        width: "100%",
47166        height: "100%"
47167      }
47168    };
47169    const parent = this[$getParent]()[$getParent]();
47170    if (hasMargin(parent)) {
47171      return HTMLResult.success({
47172        name: "div",
47173        attributes: {
47174          style: {
47175            display: "inline",
47176            width: "100%",
47177            height: "100%"
47178          }
47179        },
47180        children: [svg]
47181      });
47182    }
47183    svg.attributes.style.position = "absolute";
47184    return HTMLResult.success(svg);
47185  }
47186}
47187class RefElement extends StringObject {
47188  constructor(attributes) {
47189    super(TEMPLATE_NS_ID, "ref");
47190    this.id = attributes.id || "";
47191    this.use = attributes.use || "";
47192    this.usehref = attributes.usehref || "";
47193  }
47194}
47195class Script extends StringObject {
47196  constructor(attributes) {
47197    super(TEMPLATE_NS_ID, "script");
47198    this.binding = attributes.binding || "";
47199    this.contentType = attributes.contentType || "";
47200    this.id = attributes.id || "";
47201    this.name = attributes.name || "";
47202    this.runAt = getStringOption(attributes.runAt, ["client", "both", "server"]);
47203    this.use = attributes.use || "";
47204    this.usehref = attributes.usehref || "";
47205  }
47206}
47207class SetProperty extends XFAObject {
47208  constructor(attributes) {
47209    super(TEMPLATE_NS_ID, "setProperty");
47210    this.connection = attributes.connection || "";
47211    this.ref = attributes.ref || "";
47212    this.target = attributes.target || "";
47213  }
47214}
47215class SignData extends XFAObject {
47216  constructor(attributes) {
47217    super(TEMPLATE_NS_ID, "signData", true);
47218    this.id = attributes.id || "";
47219    this.operation = getStringOption(attributes.operation, ["sign", "clear", "verify"]);
47220    this.ref = attributes.ref || "";
47221    this.target = attributes.target || "";
47222    this.use = attributes.use || "";
47223    this.usehref = attributes.usehref || "";
47224    this.filter = null;
47225    this.manifest = null;
47226  }
47227}
47228class Signature extends XFAObject {
47229  constructor(attributes) {
47230    super(TEMPLATE_NS_ID, "signature", true);
47231    this.id = attributes.id || "";
47232    this.type = getStringOption(attributes.type, ["PDF1.3", "PDF1.6"]);
47233    this.use = attributes.use || "";
47234    this.usehref = attributes.usehref || "";
47235    this.border = null;
47236    this.extras = null;
47237    this.filter = null;
47238    this.manifest = null;
47239    this.margin = null;
47240  }
47241}
47242class Signing extends XFAObject {
47243  constructor(attributes) {
47244    super(TEMPLATE_NS_ID, "signing", true);
47245    this.id = attributes.id || "";
47246    this.type = getStringOption(attributes.type, ["optional", "required"]);
47247    this.use = attributes.use || "";
47248    this.usehref = attributes.usehref || "";
47249    this.certificate = new XFAObjectArray();
47250  }
47251}
47252class Solid extends XFAObject {
47253  constructor(attributes) {
47254    super(TEMPLATE_NS_ID, "solid", true);
47255    this.id = attributes.id || "";
47256    this.use = attributes.use || "";
47257    this.usehref = attributes.usehref || "";
47258    this.extras = null;
47259  }
47260  [$toStyle](startColor) {
47261    return startColor ? startColor[$toStyle]() : "#FFFFFF";
47262  }
47263}
47264class Speak extends StringObject {
47265  constructor(attributes) {
47266    super(TEMPLATE_NS_ID, "speak");
47267    this.disable = getInteger({
47268      data: attributes.disable,
47269      defaultValue: 0,
47270      validate: x => x === 1
47271    });
47272    this.id = attributes.id || "";
47273    this.priority = getStringOption(attributes.priority, ["custom", "caption", "name", "toolTip"]);
47274    this.rid = attributes.rid || "";
47275    this.use = attributes.use || "";
47276    this.usehref = attributes.usehref || "";
47277  }
47278}
47279class Stipple extends XFAObject {
47280  constructor(attributes) {
47281    super(TEMPLATE_NS_ID, "stipple", true);
47282    this.id = attributes.id || "";
47283    this.rate = getInteger({
47284      data: attributes.rate,
47285      defaultValue: 50,
47286      validate: x => x >= 0 && x <= 100
47287    });
47288    this.use = attributes.use || "";
47289    this.usehref = attributes.usehref || "";
47290    this.color = null;
47291    this.extras = null;
47292  }
47293  [$toStyle](bgColor) {
47294    const alpha = this.rate / 100;
47295    return Util.makeHexColor(Math.round(bgColor.value.r * (1 - alpha) + this.value.r * alpha), Math.round(bgColor.value.g * (1 - alpha) + this.value.g * alpha), Math.round(bgColor.value.b * (1 - alpha) + this.value.b * alpha));
47296  }
47297}
47298class Subform extends XFAObject {
47299  constructor(attributes) {
47300    super(TEMPLATE_NS_ID, "subform", true);
47301    this.access = getStringOption(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
47302    this.allowMacro = getInteger({
47303      data: attributes.allowMacro,
47304      defaultValue: 0,
47305      validate: x => x === 1
47306    });
47307    this.anchorType = getStringOption(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
47308    this.colSpan = getInteger({
47309      data: attributes.colSpan,
47310      defaultValue: 1,
47311      validate: n => n >= 1 || n === -1
47312    });
47313    this.columnWidths = (attributes.columnWidths || "").trim().split(/\s+/).map(x => x === "-1" ? -1 : getMeasurement(x));
47314    this.h = attributes.h ? getMeasurement(attributes.h) : "";
47315    this.hAlign = getStringOption(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
47316    this.id = attributes.id || "";
47317    this.layout = getStringOption(attributes.layout, ["position", "lr-tb", "rl-row", "rl-tb", "row", "table", "tb"]);
47318    this.locale = attributes.locale || "";
47319    this.maxH = getMeasurement(attributes.maxH, "0pt");
47320    this.maxW = getMeasurement(attributes.maxW, "0pt");
47321    this.mergeMode = getStringOption(attributes.mergeMode, ["consumeData", "matchTemplate"]);
47322    this.minH = getMeasurement(attributes.minH, "0pt");
47323    this.minW = getMeasurement(attributes.minW, "0pt");
47324    this.name = attributes.name || "";
47325    this.presence = getStringOption(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
47326    this.relevant = getRelevant(attributes.relevant);
47327    this.restoreState = getStringOption(attributes.restoreState, ["manual", "auto"]);
47328    this.scope = getStringOption(attributes.scope, ["name", "none"]);
47329    this.use = attributes.use || "";
47330    this.usehref = attributes.usehref || "";
47331    this.w = attributes.w ? getMeasurement(attributes.w) : "";
47332    this.x = getMeasurement(attributes.x, "0pt");
47333    this.y = getMeasurement(attributes.y, "0pt");
47334    this.assist = null;
47335    this.bind = null;
47336    this.bookend = null;
47337    this.border = null;
47338    this.break = null;
47339    this.calculate = null;
47340    this.desc = null;
47341    this.extras = null;
47342    this.keep = null;
47343    this.margin = null;
47344    this.occur = null;
47345    this.overflow = null;
47346    this.pageSet = null;
47347    this.para = null;
47348    this.traversal = null;
47349    this.validate = null;
47350    this.variables = null;
47351    this.area = new XFAObjectArray();
47352    this.breakAfter = new XFAObjectArray();
47353    this.breakBefore = new XFAObjectArray();
47354    this.connect = new XFAObjectArray();
47355    this.draw = new XFAObjectArray();
47356    this.event = new XFAObjectArray();
47357    this.exObject = new XFAObjectArray();
47358    this.exclGroup = new XFAObjectArray();
47359    this.field = new XFAObjectArray();
47360    this.proto = new XFAObjectArray();
47361    this.setProperty = new XFAObjectArray();
47362    this.subform = new XFAObjectArray();
47363    this.subformSet = new XFAObjectArray();
47364  }
47365  [$getSubformParent]() {
47366    const parent = this[$getParent]();
47367    if (parent instanceof SubformSet) {
47368      return parent[$getSubformParent]();
47369    }
47370    return parent;
47371  }
47372  [$isBindable]() {
47373    return true;
47374  }
47375  [$isThereMoreWidth]() {
47376    return this.layout.endsWith("-tb") && this[$extra].attempt === 0 && this[$extra].numberInLine > 0 || this[$getParent]()[$isThereMoreWidth]();
47377  }
47378  *[$getContainedChildren]() {
47379    yield* getContainedChildren(this);
47380  }
47381  [$flushHTML]() {
47382    return flushHTML(this);
47383  }
47384  [$addHTML](html, bbox) {
47385    addHTML(this, html, bbox);
47386  }
47387  [$getAvailableSpace]() {
47388    return getAvailableSpace(this);
47389  }
47390  [$isSplittable]() {
47391    const parent = this[$getSubformParent]();
47392    if (!parent[$isSplittable]()) {
47393      return false;
47394    }
47395    if (this[$extra]._isSplittable !== undefined) {
47396      return this[$extra]._isSplittable;
47397    }
47398    if (this.layout === "position" || this.layout.includes("row")) {
47399      this[$extra]._isSplittable = false;
47400      return false;
47401    }
47402    if (this.keep && this.keep.intact !== "none") {
47403      this[$extra]._isSplittable = false;
47404      return false;
47405    }
47406    if (parent.layout?.endsWith("-tb") && parent[$extra].numberInLine !== 0) {
47407      return false;
47408    }
47409    this[$extra]._isSplittable = true;
47410    return true;
47411  }
47412  [$toHTML](availableSpace) {
47413    setTabIndex(this);
47414    if (this.break) {
47415      if (this.break.after !== "auto" || this.break.afterTarget !== "") {
47416        const node = new BreakAfter({
47417          targetType: this.break.after,
47418          target: this.break.afterTarget,
47419          startNew: this.break.startNew.toString()
47420        });
47421        node[$globalData] = this[$globalData];
47422        this[$appendChild](node);
47423        this.breakAfter.push(node);
47424      }
47425      if (this.break.before !== "auto" || this.break.beforeTarget !== "") {
47426        const node = new BreakBefore({
47427          targetType: this.break.before,
47428          target: this.break.beforeTarget,
47429          startNew: this.break.startNew.toString()
47430        });
47431        node[$globalData] = this[$globalData];
47432        this[$appendChild](node);
47433        this.breakBefore.push(node);
47434      }
47435      if (this.break.overflowTarget !== "") {
47436        const node = new Overflow({
47437          target: this.break.overflowTarget,
47438          leader: this.break.overflowLeader,
47439          trailer: this.break.overflowTrailer
47440        });
47441        node[$globalData] = this[$globalData];
47442        this[$appendChild](node);
47443        this.overflow.push(node);
47444      }
47445      this[$removeChild](this.break);
47446      this.break = null;
47447    }
47448    if (this.presence === "hidden" || this.presence === "inactive") {
47449      return HTMLResult.EMPTY;
47450    }
47451    if (this.breakBefore.children.length > 1 || this.breakAfter.children.length > 1) {
47452      warn("XFA - Several breakBefore or breakAfter in subforms: please file a bug.");
47453    }
47454    if (this.breakBefore.children.length >= 1) {
47455      const breakBefore = this.breakBefore.children[0];
47456      if (handleBreak(breakBefore)) {
47457        return HTMLResult.breakNode(breakBefore);
47458      }
47459    }
47460    if (this[$extra]?.afterBreakAfter) {
47461      return HTMLResult.EMPTY;
47462    }
47463    fixDimensions(this);
47464    const children = [];
47465    const attributes = {
47466      id: this[$uid],
47467      class: []
47468    };
47469    setAccess(this, attributes.class);
47470    this[$extra] ||= Object.create(null);
47471    Object.assign(this[$extra], {
47472      children,
47473      line: null,
47474      attributes,
47475      attempt: 0,
47476      numberInLine: 0,
47477      availableSpace: {
47478        width: Math.min(this.w || Infinity, availableSpace.width),
47479        height: Math.min(this.h || Infinity, availableSpace.height)
47480      },
47481      width: 0,
47482      height: 0,
47483      prevHeight: 0,
47484      currentWidth: 0
47485    });
47486    const root = this[$getTemplateRoot]();
47487    const savedNoLayoutFailure = root[$extra].noLayoutFailure;
47488    const isSplittable = this[$isSplittable]();
47489    if (!isSplittable) {
47490      setFirstUnsplittable(this);
47491    }
47492    if (!checkDimensions(this, availableSpace)) {
47493      return HTMLResult.FAILURE;
47494    }
47495    const filter = new Set(["area", "draw", "exclGroup", "field", "subform", "subformSet"]);
47496    if (this.layout.includes("row")) {
47497      const columnWidths = this[$getSubformParent]().columnWidths;
47498      if (Array.isArray(columnWidths) && columnWidths.length > 0) {
47499        this[$extra].columnWidths = columnWidths;
47500        this[$extra].currentColumn = 0;
47501      }
47502    }
47503    const style = toStyle(this, "anchorType", "dimensions", "position", "presence", "border", "margin", "hAlign");
47504    const classNames = ["xfaSubform"];
47505    const cl = layoutClass(this);
47506    if (cl) {
47507      classNames.push(cl);
47508    }
47509    attributes.style = style;
47510    attributes.class = classNames;
47511    if (this.name) {
47512      attributes.xfaName = this.name;
47513    }
47514    if (this.overflow) {
47515      const overflowExtra = this.overflow[$getExtra]();
47516      if (overflowExtra.addLeader) {
47517        overflowExtra.addLeader = false;
47518        handleOverflow(this, overflowExtra.leader, availableSpace);
47519      }
47520    }
47521    this[$pushPara]();
47522    const isLrTb = this.layout === "lr-tb" || this.layout === "rl-tb";
47523    const maxRun = isLrTb ? MAX_ATTEMPTS_FOR_LRTB_LAYOUT : 1;
47524    for (; this[$extra].attempt < maxRun; this[$extra].attempt++) {
47525      if (isLrTb && this[$extra].attempt === MAX_ATTEMPTS_FOR_LRTB_LAYOUT - 1) {
47526        this[$extra].numberInLine = 0;
47527      }
47528      const result = this[$childrenToHTML]({
47529        filter,
47530        include: true
47531      });
47532      if (result.success) {
47533        break;
47534      }
47535      if (result.isBreak()) {
47536        this[$popPara]();
47537        return result;
47538      }
47539      if (isLrTb && this[$extra].attempt === 0 && this[$extra].numberInLine === 0 && !root[$extra].noLayoutFailure) {
47540        this[$extra].attempt = maxRun;
47541        break;
47542      }
47543    }
47544    this[$popPara]();
47545    if (!isSplittable) {
47546      unsetFirstUnsplittable(this);
47547    }
47548    root[$extra].noLayoutFailure = savedNoLayoutFailure;
47549    if (this[$extra].attempt === maxRun) {
47550      if (this.overflow) {
47551        this[$getTemplateRoot]()[$extra].overflowNode = this.overflow;
47552      }
47553      if (!isSplittable) {
47554        delete this[$extra];
47555      }
47556      return HTMLResult.FAILURE;
47557    }
47558    if (this.overflow) {
47559      const overflowExtra = this.overflow[$getExtra]();
47560      if (overflowExtra.addTrailer) {
47561        overflowExtra.addTrailer = false;
47562        handleOverflow(this, overflowExtra.trailer, availableSpace);
47563      }
47564    }
47565    let marginH = 0;
47566    let marginV = 0;
47567    if (this.margin) {
47568      marginH = this.margin.leftInset + this.margin.rightInset;
47569      marginV = this.margin.topInset + this.margin.bottomInset;
47570    }
47571    const width = Math.max(this[$extra].width + marginH, this.w || 0);
47572    const height = Math.max(this[$extra].height + marginV, this.h || 0);
47573    const bbox = [this.x, this.y, width, height];
47574    if (this.w === "") {
47575      style.width = measureToString(width);
47576    }
47577    if (this.h === "") {
47578      style.height = measureToString(height);
47579    }
47580    if ((style.width === "0px" || style.height === "0px") && children.length === 0) {
47581      return HTMLResult.EMPTY;
47582    }
47583    const html = {
47584      name: "div",
47585      attributes,
47586      children
47587    };
47588    applyAssist(this, attributes);
47589    const result = HTMLResult.success(createWrapper(this, html), bbox);
47590    if (this.breakAfter.children.length >= 1) {
47591      const breakAfter = this.breakAfter.children[0];
47592      if (handleBreak(breakAfter)) {
47593        this[$extra].afterBreakAfter = result;
47594        return HTMLResult.breakNode(breakAfter);
47595      }
47596    }
47597    delete this[$extra];
47598    return result;
47599  }
47600}
47601class SubformSet extends XFAObject {
47602  constructor(attributes) {
47603    super(TEMPLATE_NS_ID, "subformSet", true);
47604    this.id = attributes.id || "";
47605    this.name = attributes.name || "";
47606    this.relation = getStringOption(attributes.relation, ["ordered", "choice", "unordered"]);
47607    this.relevant = getRelevant(attributes.relevant);
47608    this.use = attributes.use || "";
47609    this.usehref = attributes.usehref || "";
47610    this.bookend = null;
47611    this.break = null;
47612    this.desc = null;
47613    this.extras = null;
47614    this.occur = null;
47615    this.overflow = null;
47616    this.breakAfter = new XFAObjectArray();
47617    this.breakBefore = new XFAObjectArray();
47618    this.subform = new XFAObjectArray();
47619    this.subformSet = new XFAObjectArray();
47620  }
47621  *[$getContainedChildren]() {
47622    yield* getContainedChildren(this);
47623  }
47624  [$getSubformParent]() {
47625    let parent = this[$getParent]();
47626    while (!(parent instanceof Subform)) {
47627      parent = parent[$getParent]();
47628    }
47629    return parent;
47630  }
47631  [$isBindable]() {
47632    return true;
47633  }
47634}
47635class SubjectDN extends ContentObject {
47636  constructor(attributes) {
47637    super(TEMPLATE_NS_ID, "subjectDN");
47638    this.delimiter = attributes.delimiter || ",";
47639    this.id = attributes.id || "";
47640    this.name = attributes.name || "";
47641    this.use = attributes.use || "";
47642    this.usehref = attributes.usehref || "";
47643  }
47644  [$finalize]() {
47645    this[$content] = new Map(this[$content].split(this.delimiter).map(kv => {
47646      kv = kv.split("=", 2);
47647      kv[0] = kv[0].trim();
47648      return kv;
47649    }));
47650  }
47651}
47652class SubjectDNs extends XFAObject {
47653  constructor(attributes) {
47654    super(TEMPLATE_NS_ID, "subjectDNs", true);
47655    this.id = attributes.id || "";
47656    this.type = getStringOption(attributes.type, ["optional", "required"]);
47657    this.use = attributes.use || "";
47658    this.usehref = attributes.usehref || "";
47659    this.subjectDN = new XFAObjectArray();
47660  }
47661}
47662class Submit extends XFAObject {
47663  constructor(attributes) {
47664    super(TEMPLATE_NS_ID, "submit", true);
47665    this.embedPDF = getInteger({
47666      data: attributes.embedPDF,
47667      defaultValue: 0,
47668      validate: x => x === 1
47669    });
47670    this.format = getStringOption(attributes.format, ["xdp", "formdata", "pdf", "urlencoded", "xfd", "xml"]);
47671    this.id = attributes.id || "";
47672    this.target = attributes.target || "";
47673    this.textEncoding = getKeyword({
47674      data: attributes.textEncoding ? attributes.textEncoding.toLowerCase() : "",
47675      defaultValue: "",
47676      validate: k => ["utf-8", "big-five", "fontspecific", "gbk", "gb-18030", "gb-2312", "ksc-5601", "none", "shift-jis", "ucs-2", "utf-16"].includes(k) || k.match(/iso-8859-\d{2}/)
47677    });
47678    this.use = attributes.use || "";
47679    this.usehref = attributes.usehref || "";
47680    this.xdpContent = attributes.xdpContent || "";
47681    this.encrypt = null;
47682    this.encryptData = new XFAObjectArray();
47683    this.signData = new XFAObjectArray();
47684  }
47685}
47686class Template extends XFAObject {
47687  constructor(attributes) {
47688    super(TEMPLATE_NS_ID, "template", true);
47689    this.baseProfile = getStringOption(attributes.baseProfile, ["full", "interactiveForms"]);
47690    this.extras = null;
47691    this.subform = new XFAObjectArray();
47692  }
47693  [$finalize]() {
47694    if (this.subform.children.length === 0) {
47695      warn("XFA - No subforms in template node.");
47696    }
47697    if (this.subform.children.length >= 2) {
47698      warn("XFA - Several subforms in template node: please file a bug.");
47699    }
47700    this[$tabIndex] = DEFAULT_TAB_INDEX;
47701  }
47702  [$isSplittable]() {
47703    return true;
47704  }
47705  [$searchNode](expr, container) {
47706    if (expr.startsWith("#")) {
47707      return [this[$ids].get(expr.slice(1))];
47708    }
47709    return searchNode(this, container, expr, true, true);
47710  }
47711  *[$toPages]() {
47712    if (!this.subform.children.length) {
47713      return HTMLResult.success({
47714        name: "div",
47715        children: []
47716      });
47717    }
47718    this[$extra] = {
47719      overflowNode: null,
47720      firstUnsplittable: null,
47721      currentContentArea: null,
47722      currentPageArea: null,
47723      noLayoutFailure: false,
47724      pageNumber: 1,
47725      pagePosition: "first",
47726      oddOrEven: "odd",
47727      blankOrNotBlank: "nonBlank",
47728      paraStack: []
47729    };
47730    const root = this.subform.children[0];
47731    root.pageSet[$cleanPage]();
47732    const pageAreas = root.pageSet.pageArea.children;
47733    const mainHtml = {
47734      name: "div",
47735      children: []
47736    };
47737    let pageArea = null;
47738    let breakBefore = null;
47739    let breakBeforeTarget = null;
47740    if (root.breakBefore.children.length >= 1) {
47741      breakBefore = root.breakBefore.children[0];
47742      breakBeforeTarget = breakBefore.target;
47743    } else if (root.subform.children.length >= 1 && root.subform.children[0].breakBefore.children.length >= 1) {
47744      breakBefore = root.subform.children[0].breakBefore.children[0];
47745      breakBeforeTarget = breakBefore.target;
47746    } else if (root.break?.beforeTarget) {
47747      breakBefore = root.break;
47748      breakBeforeTarget = breakBefore.beforeTarget;
47749    } else if (root.subform.children.length >= 1 && root.subform.children[0].break?.beforeTarget) {
47750      breakBefore = root.subform.children[0].break;
47751      breakBeforeTarget = breakBefore.beforeTarget;
47752    }
47753    if (breakBefore) {
47754      const target = this[$searchNode](breakBeforeTarget, breakBefore[$getParent]());
47755      if (target instanceof PageArea) {
47756        pageArea = target;
47757        breakBefore[$extra] = {};
47758      }
47759    }
47760    pageArea ||= pageAreas[0];
47761    pageArea[$extra] = {
47762      numberOfUse: 1
47763    };
47764    const pageAreaParent = pageArea[$getParent]();
47765    pageAreaParent[$extra] = {
47766      numberOfUse: 1,
47767      pageIndex: pageAreaParent.pageArea.children.indexOf(pageArea),
47768      pageSetIndex: 0
47769    };
47770    let targetPageArea;
47771    let leader = null;
47772    let trailer = null;
47773    let hasSomething = true;
47774    let hasSomethingCounter = 0;
47775    let startIndex = 0;
47776    while (true) {
47777      if (!hasSomething) {
47778        mainHtml.children.pop();
47779        if (++hasSomethingCounter === MAX_EMPTY_PAGES) {
47780          warn("XFA - Something goes wrong: please file a bug.");
47781          return mainHtml;
47782        }
47783      } else {
47784        hasSomethingCounter = 0;
47785      }
47786      targetPageArea = null;
47787      this[$extra].currentPageArea = pageArea;
47788      const page = pageArea[$toHTML]().html;
47789      mainHtml.children.push(page);
47790      if (leader) {
47791        this[$extra].noLayoutFailure = true;
47792        page.children.push(leader[$toHTML](pageArea[$extra].space).html);
47793        leader = null;
47794      }
47795      if (trailer) {
47796        this[$extra].noLayoutFailure = true;
47797        page.children.push(trailer[$toHTML](pageArea[$extra].space).html);
47798        trailer = null;
47799      }
47800      const contentAreas = pageArea.contentArea.children;
47801      const htmlContentAreas = page.children.filter(node => node.attributes.class.includes("xfaContentarea"));
47802      hasSomething = false;
47803      this[$extra].firstUnsplittable = null;
47804      this[$extra].noLayoutFailure = false;
47805      const flush = index => {
47806        const html = root[$flushHTML]();
47807        if (html) {
47808          hasSomething ||= html.children?.length > 0;
47809          htmlContentAreas[index].children.push(html);
47810        }
47811      };
47812      for (let i = startIndex, ii = contentAreas.length; i < ii; i++) {
47813        const contentArea = this[$extra].currentContentArea = contentAreas[i];
47814        const space = {
47815          width: contentArea.w,
47816          height: contentArea.h
47817        };
47818        startIndex = 0;
47819        if (leader) {
47820          htmlContentAreas[i].children.push(leader[$toHTML](space).html);
47821          leader = null;
47822        }
47823        if (trailer) {
47824          htmlContentAreas[i].children.push(trailer[$toHTML](space).html);
47825          trailer = null;
47826        }
47827        const html = root[$toHTML](space);
47828        if (html.success) {
47829          if (html.html) {
47830            hasSomething ||= html.html.children?.length > 0;
47831            htmlContentAreas[i].children.push(html.html);
47832          } else if (!hasSomething && mainHtml.children.length > 1) {
47833            mainHtml.children.pop();
47834          }
47835          return mainHtml;
47836        }
47837        if (html.isBreak()) {
47838          const node = html.breakNode;
47839          flush(i);
47840          if (node.targetType === "auto") {
47841            continue;
47842          }
47843          if (node.leader) {
47844            leader = this[$searchNode](node.leader, node[$getParent]());
47845            leader = leader ? leader[0] : null;
47846          }
47847          if (node.trailer) {
47848            trailer = this[$searchNode](node.trailer, node[$getParent]());
47849            trailer = trailer ? trailer[0] : null;
47850          }
47851          if (node.targetType === "pageArea") {
47852            targetPageArea = node[$extra].target;
47853            i = Infinity;
47854          } else if (!node[$extra].target) {
47855            i = node[$extra].index;
47856          } else {
47857            targetPageArea = node[$extra].target;
47858            startIndex = node[$extra].index + 1;
47859            i = Infinity;
47860          }
47861          continue;
47862        }
47863        if (this[$extra].overflowNode) {
47864          const node = this[$extra].overflowNode;
47865          this[$extra].overflowNode = null;
47866          const overflowExtra = node[$getExtra]();
47867          const target = overflowExtra.target;
47868          overflowExtra.addLeader = overflowExtra.leader !== null;
47869          overflowExtra.addTrailer = overflowExtra.trailer !== null;
47870          flush(i);
47871          const currentIndex = i;
47872          i = Infinity;
47873          if (target instanceof PageArea) {
47874            targetPageArea = target;
47875          } else if (target instanceof ContentArea) {
47876            const index = contentAreas.indexOf(target);
47877            if (index !== -1) {
47878              if (index > currentIndex) {
47879                i = index - 1;
47880              } else {
47881                startIndex = index;
47882              }
47883            } else {
47884              targetPageArea = target[$getParent]();
47885              startIndex = targetPageArea.contentArea.children.indexOf(target);
47886            }
47887          }
47888          continue;
47889        }
47890        flush(i);
47891      }
47892      this[$extra].pageNumber += 1;
47893      if (targetPageArea) {
47894        if (targetPageArea[$isUsable]()) {
47895          targetPageArea[$extra].numberOfUse += 1;
47896        } else {
47897          targetPageArea = null;
47898        }
47899      }
47900      pageArea = targetPageArea || pageArea[$getNextPage]();
47901      yield null;
47902    }
47903  }
47904}
47905class Text extends ContentObject {
47906  constructor(attributes) {
47907    super(TEMPLATE_NS_ID, "text");
47908    this.id = attributes.id || "";
47909    this.maxChars = getInteger({
47910      data: attributes.maxChars,
47911      defaultValue: 0,
47912      validate: x => x >= 0
47913    });
47914    this.name = attributes.name || "";
47915    this.rid = attributes.rid || "";
47916    this.use = attributes.use || "";
47917    this.usehref = attributes.usehref || "";
47918  }
47919  [$acceptWhitespace]() {
47920    return true;
47921  }
47922  [$onChild](child) {
47923    if (child[$namespaceId] === NamespaceIds.xhtml.id) {
47924      this[$content] = child;
47925      return true;
47926    }
47927    warn(`XFA - Invalid content in Text: ${child[$nodeName]}.`);
47928    return false;
vendor: 10,112 bytes, lines 47929-48280
47929  }
47930  [$onText](str) {
47931    if (this[$content] instanceof XFAObject) {
47932      return;
47933    }
47934    super[$onText](str);
47935  }
47936  [$finalize]() {
47937    if (typeof this[$content] === "string") {
47938      this[$content] = this[$content].replaceAll("\r\n", "\n");
47939    }
47940  }
47941  [$getExtra]() {
47942    if (typeof this[$content] === "string") {
47943      return this[$content].split(/[\u2029\u2028\n]/).filter(line => !!line).join("\n");
47944    }
47945    return this[$content][$text]();
47946  }
47947  [$toHTML](availableSpace) {
47948    if (typeof this[$content] === "string") {
47949      const html = valueToHtml(this[$content]).html;
47950      if (this[$content].includes("\u2029")) {
47951        html.name = "div";
47952        html.children = [];
47953        this[$content].split("\u2029").map(para => para.split(/[\u2028\n]/).flatMap(line => [{
47954          name: "span",
47955          value: line
47956        }, {
47957          name: "br"
47958        }])).forEach(lines => {
47959          html.children.push({
47960            name: "p",
47961            children: lines
47962          });
47963        });
47964      } else if (/[\u2028\n]/.test(this[$content])) {
47965        html.name = "div";
47966        html.children = [];
47967        this[$content].split(/[\u2028\n]/).forEach(line => {
47968          html.children.push({
47969            name: "span",
47970            value: line
47971          }, {
47972            name: "br"
47973          });
47974        });
47975      }
47976      return HTMLResult.success(html);
47977    }
47978    return this[$content][$toHTML](availableSpace);
47979  }
47980}
47981class TextEdit extends XFAObject {
47982  constructor(attributes) {
47983    super(TEMPLATE_NS_ID, "textEdit", true);
47984    this.allowRichText = getInteger({
47985      data: attributes.allowRichText,
47986      defaultValue: 0,
47987      validate: x => x === 1
47988    });
47989    this.hScrollPolicy = getStringOption(attributes.hScrollPolicy, ["auto", "off", "on"]);
47990    this.id = attributes.id || "";
47991    this.multiLine = getInteger({
47992      data: attributes.multiLine,
47993      defaultValue: "",
47994      validate: x => x === 0 || x === 1
47995    });
47996    this.use = attributes.use || "";
47997    this.usehref = attributes.usehref || "";
47998    this.vScrollPolicy = getStringOption(attributes.vScrollPolicy, ["auto", "off", "on"]);
47999    this.border = null;
48000    this.comb = null;
48001    this.extras = null;
48002    this.margin = null;
48003  }
48004  [$toHTML](availableSpace) {
48005    const style = toStyle(this, "border", "font", "margin");
48006    let html;
48007    const field = this[$getParent]()[$getParent]();
48008    if (this.multiLine === "") {
48009      this.multiLine = field instanceof Draw ? 1 : 0;
48010    }
48011    if (this.multiLine === 1) {
48012      html = {
48013        name: "textarea",
48014        attributes: {
48015          dataId: field[$data]?.[$uid] || field[$uid],
48016          fieldId: field[$uid],
48017          class: ["xfaTextfield"],
48018          style,
48019          "aria-label": ariaLabel(field),
48020          "aria-required": false
48021        }
48022      };
48023    } else {
48024      html = {
48025        name: "input",
48026        attributes: {
48027          type: "text",
48028          dataId: field[$data]?.[$uid] || field[$uid],
48029          fieldId: field[$uid],
48030          class: ["xfaTextfield"],
48031          style,
48032          "aria-label": ariaLabel(field),
48033          "aria-required": false
48034        }
48035      };
48036    }
48037    if (isRequired(field)) {
48038      html.attributes["aria-required"] = true;
48039      html.attributes.required = true;
48040    }
48041    return HTMLResult.success({
48042      name: "label",
48043      attributes: {
48044        class: ["xfaLabel"]
48045      },
48046      children: [html]
48047    });
48048  }
48049}
48050class Time extends StringObject {
48051  constructor(attributes) {
48052    super(TEMPLATE_NS_ID, "time");
48053    this.id = attributes.id || "";
48054    this.name = attributes.name || "";
48055    this.use = attributes.use || "";
48056    this.usehref = attributes.usehref || "";
48057  }
48058  [$finalize]() {
48059    const date = this[$content].trim();
48060    this[$content] = date ? new Date(date) : null;
48061  }
48062  [$toHTML](availableSpace) {
48063    return valueToHtml(this[$content] ? this[$content].toString() : "");
48064  }
48065}
48066class TimeStamp extends XFAObject {
48067  constructor(attributes) {
48068    super(TEMPLATE_NS_ID, "timeStamp");
48069    this.id = attributes.id || "";
48070    this.server = attributes.server || "";
48071    this.type = getStringOption(attributes.type, ["optional", "required"]);
48072    this.use = attributes.use || "";
48073    this.usehref = attributes.usehref || "";
48074  }
48075}
48076class ToolTip extends StringObject {
48077  constructor(attributes) {
48078    super(TEMPLATE_NS_ID, "toolTip");
48079    this.id = attributes.id || "";
48080    this.rid = attributes.rid || "";
48081    this.use = attributes.use || "";
48082    this.usehref = attributes.usehref || "";
48083  }
48084}
48085class Traversal extends XFAObject {
48086  constructor(attributes) {
48087    super(TEMPLATE_NS_ID, "traversal", true);
48088    this.id = attributes.id || "";
48089    this.use = attributes.use || "";
48090    this.usehref = attributes.usehref || "";
48091    this.extras = null;
48092    this.traverse = new XFAObjectArray();
48093  }
48094}
48095class Traverse extends XFAObject {
48096  constructor(attributes) {
48097    super(TEMPLATE_NS_ID, "traverse", true);
48098    this.id = attributes.id || "";
48099    this.operation = getStringOption(attributes.operation, ["next", "back", "down", "first", "left", "right", "up"]);
48100    this.ref = attributes.ref || "";
48101    this.use = attributes.use || "";
48102    this.usehref = attributes.usehref || "";
48103    this.extras = null;
48104    this.script = null;
48105  }
48106  get name() {
48107    return this.operation;
48108  }
48109  [$isTransparent]() {
48110    return false;
48111  }
48112}
48113class Ui extends XFAObject {
48114  constructor(attributes) {
48115    super(TEMPLATE_NS_ID, "ui", true);
48116    this.id = attributes.id || "";
48117    this.use = attributes.use || "";
48118    this.usehref = attributes.usehref || "";
48119    this.extras = null;
48120    this.picture = null;
48121    this.barcode = null;
48122    this.button = null;
48123    this.checkButton = null;
48124    this.choiceList = null;
48125    this.dateTimeEdit = null;
48126    this.defaultUi = null;
48127    this.imageEdit = null;
48128    this.numericEdit = null;
48129    this.passwordEdit = null;
48130    this.signature = null;
48131    this.textEdit = null;
48132  }
48133  [$getExtra]() {
48134    if (this[$extra] === undefined) {
48135      for (const name of Object.getOwnPropertyNames(this)) {
48136        if (name === "extras" || name === "picture") {
48137          continue;
48138        }
48139        const obj = this[name];
48140        if (!(obj instanceof XFAObject)) {
48141          continue;
48142        }
48143        this[$extra] = obj;
48144        return obj;
48145      }
48146      this[$extra] = null;
48147    }
48148    return this[$extra];
48149  }
48150  [$toHTML](availableSpace) {
48151    const obj = this[$getExtra]();
48152    if (obj) {
48153      return obj[$toHTML](availableSpace);
48154    }
48155    return HTMLResult.EMPTY;
48156  }
48157}
48158class Validate extends XFAObject {
48159  constructor(attributes) {
48160    super(TEMPLATE_NS_ID, "validate", true);
48161    this.formatTest = getStringOption(attributes.formatTest, ["warning", "disabled", "error"]);
48162    this.id = attributes.id || "";
48163    this.nullTest = getStringOption(attributes.nullTest, ["disabled", "error", "warning"]);
48164    this.scriptTest = getStringOption(attributes.scriptTest, ["error", "disabled", "warning"]);
48165    this.use = attributes.use || "";
48166    this.usehref = attributes.usehref || "";
48167    this.extras = null;
48168    this.message = null;
48169    this.picture = null;
48170    this.script = null;
48171  }
48172}
48173class Value extends XFAObject {
48174  constructor(attributes) {
48175    super(TEMPLATE_NS_ID, "value", true);
48176    this.id = attributes.id || "";
48177    this.override = getInteger({
48178      data: attributes.override,
48179      defaultValue: 0,
48180      validate: x => x === 1
48181    });
48182    this.relevant = getRelevant(attributes.relevant);
48183    this.use = attributes.use || "";
48184    this.usehref = attributes.usehref || "";
48185    this.arc = null;
48186    this.boolean = null;
48187    this.date = null;
48188    this.dateTime = null;
48189    this.decimal = null;
48190    this.exData = null;
48191    this.float = null;
48192    this.image = null;
48193    this.integer = null;
48194    this.line = null;
48195    this.rectangle = null;
48196    this.text = null;
48197    this.time = null;
48198  }
48199  [$setValue](value) {
48200    const parent = this[$getParent]();
48201    if (parent instanceof Field) {
48202      if (parent.ui?.imageEdit) {
48203        if (!this.image) {
48204          this.image = new Image({});
48205          this[$appendChild](this.image);
48206        }
48207        this.image[$content] = value[$content];
48208        return;
48209      }
48210    }
48211    const valueName = value[$nodeName];
48212    if (this[valueName] !== null) {
48213      this[valueName][$content] = value[$content];
48214      return;
48215    }
48216    for (const name of Object.getOwnPropertyNames(this)) {
48217      const obj = this[name];
48218      if (obj instanceof XFAObject) {
48219        this[name] = null;
48220        this[$removeChild](obj);
48221      }
48222    }
48223    this[value[$nodeName]] = value;
48224    this[$appendChild](value);
48225  }
48226  [$text]() {
48227    if (this.exData) {
48228      if (typeof this.exData[$content] === "string") {
48229        return this.exData[$content].trim();
48230      }
48231      return this.exData[$content][$text]().trim();
48232    }
48233    for (const name of Object.getOwnPropertyNames(this)) {
48234      if (name === "image") {
48235        continue;
48236      }
48237      const obj = this[name];
48238      if (obj instanceof XFAObject) {
48239        return (obj[$content] || "").toString().trim();
48240      }
48241    }
48242    return null;
48243  }
48244  [$toHTML](availableSpace) {
48245    for (const name of Object.getOwnPropertyNames(this)) {
48246      const obj = this[name];
48247      if (!(obj instanceof XFAObject)) {
48248        continue;
48249      }
48250      return obj[$toHTML](availableSpace);
48251    }
48252    return HTMLResult.EMPTY;
48253  }
48254}
48255class Variables extends XFAObject {
48256  constructor(attributes) {
48257    super(TEMPLATE_NS_ID, "variables", true);
48258    this.id = attributes.id || "";
48259    this.use = attributes.use || "";
48260    this.usehref = attributes.usehref || "";
48261    this.boolean = new XFAObjectArray();
48262    this.date = new XFAObjectArray();
48263    this.dateTime = new XFAObjectArray();
48264    this.decimal = new XFAObjectArray();
48265    this.exData = new XFAObjectArray();
48266    this.float = new XFAObjectArray();
48267    this.image = new XFAObjectArray();
48268    this.integer = new XFAObjectArray();
48269    this.manifest = new XFAObjectArray();
48270    this.script = new XFAObjectArray();
48271    this.text = new XFAObjectArray();
48272    this.time = new XFAObjectArray();
48273  }
48274  [$isTransparent]() {
48275    return true;
48276  }
48277}
48278class TemplateNamespace {
48279  static [$buildXFAObject](name, attributes) {
48280    if (
48280Object.hasOwn(TemplateNamespace, name)) {
48281      const node = TemplateNamespace[name](attributes);
48282      node[$setSetAttributes](attributes);
48283      return node;
48284    }
48285    return undefined;
48286  }
48287  static appearanceFilter(attrs) {
48288    return new AppearanceFilter(attrs);
48289  }
48290  static arc(attrs) {
48291    return new Arc(attrs);
48292  }
48293  static area(attrs) {
48294    return new Area(attrs);
48295  }
48296  static assist(attrs) {
48297    return new Assist(attrs);
48298  }
48299  static barcode(attrs) {
48300    return new Barcode(attrs);
48301  }
48302  static bind(attrs) {
48303    return new Bind(attrs);
48304  }
48305  static bindItems(attrs) {
48306    return new BindItems(attrs);
48307  }
48308  static bookend(attrs) {
48309    return new Bookend(attrs);
48310  }
48311  static boolean(attrs) {
48312    return new BooleanElement(attrs);
48313  }
48314  static border(attrs) {
48315    return new Border(attrs);
48316  }
48317  static break(attrs) {
48318    return new Break(attrs);
48319  }
48320  static breakAfter(attrs) {
48321    return new BreakAfter(attrs);
48322  }
48323  static breakBefore(attrs) {
48324    return new BreakBefore(attrs);
48325  }
48326  static button(attrs) {
48327    return new Button(attrs);
48328  }
48329  static calculate(attrs) {
48330    return new Calculate(attrs);
48331  }
48332  static caption(attrs) {
48333    return new Caption(attrs);
48334  }
48335  static certificate(attrs) {
48336    return new Certificate(attrs);
48337  }
48338  static certificates(attrs) {
48339    return new Certificates(attrs);
48340  }
48341  static checkButton(attrs) {
48342    return new CheckButton(attrs);
48343  }
48344  static choiceList(attrs) {
48345    return new ChoiceList(attrs);
48346  }
48347  static color(attrs) {
48348    return new Color(attrs);
48349  }
48350  static comb(attrs) {
48351    return new Comb(attrs);
48352  }
48353  static connect(attrs) {
48354    return new Connect(attrs);
48355  }
48356  static contentArea(attrs) {
48357    return new ContentArea(attrs);
48358  }
48359  static corner(attrs) {
48360    return new Corner(attrs);
48361  }
48362  static date(attrs) {
48363    return new DateElement(attrs);
48364  }
48365  static dateTime(attrs) {
48366    return new DateTime(attrs);
48367  }
48368  static dateTimeEdit(attrs) {
48369    return new DateTimeEdit(attrs);
48370  }
48371  static decimal(attrs) {
48372    return new Decimal(attrs);
48373  }
48374  static defaultUi(attrs) {
48375    return new DefaultUi(attrs);
48376  }
48377  static desc(attrs) {
48378    return new Desc(attrs);
48379  }
48380  static digestMethod(attrs) {
48381    return new DigestMethod(attrs);
48382  }
48383  static digestMethods(attrs) {
48384    return new DigestMethods(attrs);
48385  }
48386  static draw(attrs) {
48387    return new Draw(attrs);
48388  }
48389  static edge(attrs) {
48390    return new Edge(attrs);
48391  }
48392  static encoding(attrs) {
48393    return new Encoding(attrs);
48394  }
48395  static encodings(attrs) {
48396    return new Encodings(attrs);
48397  }
48398  static encrypt(attrs) {
48399    return new Encrypt(attrs);
48400  }
48401  static encryptData(attrs) {
48402    return new EncryptData(attrs);
48403  }
48404  static encryption(attrs) {
48405    return new Encryption(attrs);
48406  }
48407  static encryptionMethod(attrs) {
48408    return new EncryptionMethod(attrs);
48409  }
48410  static encryptionMethods(attrs) {
48411    return new EncryptionMethods(attrs);
48412  }
48413  static event(attrs) {
48414    return new Event(attrs);
48415  }
48416  static exData(attrs) {
48417    return new ExData(attrs);
48418  }
48419  static exObject(attrs) {
48420    return new ExObject(attrs);
48421  }
48422  static exclGroup(attrs) {
48423    return new ExclGroup(attrs);
48424  }
48425  static execute(attrs) {
48426    return new Execute(attrs);
48427  }
48428  static extras(attrs) {
48429    return new Extras(attrs);
48430  }
48431  static field(attrs) {
48432    return new Field(attrs);
48433  }
48434  static fill(attrs) {
48435    return new Fill(attrs);
48436  }
48437  static filter(attrs) {
48438    return new Filter(attrs);
48439  }
48440  static float(attrs) {
48441    return new Float(attrs);
48442  }
48443  static font(attrs) {
48444    return new template_Font(attrs);
48445  }
48446  static format(attrs) {
48447    return new Format(attrs);
48448  }
48449  static handler(attrs) {
48450    return new Handler(attrs);
48451  }
48452  static hyphenation(attrs) {
48453    return new Hyphenation(attrs);
48454  }
48455  static image(attrs) {
48456    return new Image(attrs);
48457  }
48458  static imageEdit(attrs) {
48459    return new ImageEdit(attrs);
48460  }
48461  static integer(attrs) {
48462    return new Integer(attrs);
48463  }
48464  static issuers(attrs) {
48465    return new Issuers(attrs);
48466  }
48467  static items(attrs) {
48468    return new Items(attrs);
48469  }
48470  static keep(attrs) {
48471    return new Keep(attrs);
48472  }
48473  static keyUsage(attrs) {
48474    return new KeyUsage(attrs);
48475  }
48476  static line(attrs) {
48477    return new Line(attrs);
48478  }
48479  static linear(attrs) {
48480    return new Linear(attrs);
48481  }
48482  static lockDocument(attrs) {
48483    return new LockDocument(attrs);
48484  }
48485  static manifest(attrs) {
48486    return new Manifest(attrs);
48487  }
48488  static margin(attrs) {
48489    return new Margin(attrs);
48490  }
48491  static mdp(attrs) {
48492    return new Mdp(attrs);
48493  }
48494  static medium(attrs) {
48495    return new Medium(attrs);
48496  }
48497  static message(attrs) {
vendor: 4,621 bytes, lines 48498-48696
48498    return new Message(attrs);
48499  }
48500  static numericEdit(attrs) {
48501    return new NumericEdit(attrs);
48502  }
48503  static occur(attrs) {
48504    return new Occur(attrs);
48505  }
48506  static oid(attrs) {
48507    return new Oid(attrs);
48508  }
48509  static oids(attrs) {
48510    return new Oids(attrs);
48511  }
48512  static overflow(attrs) {
48513    return new Overflow(attrs);
48514  }
48515  static pageArea(attrs) {
48516    return new PageArea(attrs);
48517  }
48518  static pageSet(attrs) {
48519    return new PageSet(attrs);
48520  }
48521  static para(attrs) {
48522    return new Para(attrs);
48523  }
48524  static passwordEdit(attrs) {
48525    return new PasswordEdit(attrs);
48526  }
48527  static pattern(attrs) {
48528    return new template_Pattern(attrs);
48529  }
48530  static picture(attrs) {
48531    return new Picture(attrs);
48532  }
48533  static proto(attrs) {
48534    return new Proto(attrs);
48535  }
48536  static radial(attrs) {
48537    return new Radial(attrs);
48538  }
48539  static reason(attrs) {
48540    return new Reason(attrs);
48541  }
48542  static reasons(attrs) {
48543    return new Reasons(attrs);
48544  }
48545  static rectangle(attrs) {
48546    return new Rectangle(attrs);
48547  }
48548  static ref(attrs) {
48549    return new RefElement(attrs);
48550  }
48551  static script(attrs) {
48552    return new Script(attrs);
48553  }
48554  static setProperty(attrs) {
48555    return new SetProperty(attrs);
48556  }
48557  static signData(attrs) {
48558    return new SignData(attrs);
48559  }
48560  static signature(attrs) {
48561    return new Signature(attrs);
48562  }
48563  static signing(attrs) {
48564    return new Signing(attrs);
48565  }
48566  static solid(attrs) {
48567    return new Solid(attrs);
48568  }
48569  static speak(attrs) {
48570    return new Speak(attrs);
48571  }
48572  static stipple(attrs) {
48573    return new Stipple(attrs);
48574  }
48575  static subform(attrs) {
48576    return new Subform(attrs);
48577  }
48578  static subformSet(attrs) {
48579    return new SubformSet(attrs);
48580  }
48581  static subjectDN(attrs) {
48582    return new SubjectDN(attrs);
48583  }
48584  static subjectDNs(attrs) {
48585    return new SubjectDNs(attrs);
48586  }
48587  static submit(attrs) {
48588    return new Submit(attrs);
48589  }
48590  static template(attrs) {
48591    return new Template(attrs);
48592  }
48593  static text(attrs) {
48594    return new Text(attrs);
48595  }
48596  static textEdit(attrs) {
48597    return new TextEdit(attrs);
48598  }
48599  static time(attrs) {
48600    return new Time(attrs);
48601  }
48602  static timeStamp(attrs) {
48603    return new TimeStamp(attrs);
48604  }
48605  static toolTip(attrs) {
48606    return new ToolTip(attrs);
48607  }
48608  static traversal(attrs) {
48609    return new Traversal(attrs);
48610  }
48611  static traverse(attrs) {
48612    return new Traverse(attrs);
48613  }
48614  static ui(attrs) {
48615    return new Ui(attrs);
48616  }
48617  static validate(attrs) {
48618    return new Validate(attrs);
48619  }
48620  static value(attrs) {
48621    return new Value(attrs);
48622  }
48623  static variables(attrs) {
48624    return new Variables(attrs);
48625  }
48626}
48627
48628;// ./src/core/xfa/bind.js
48629
48630
48631
48632
48633
48634
48635const bind_NS_DATASETS = NamespaceIds.datasets.id;
48636function createText(content) {
48637  const node = new Text({});
48638  node[$content] = content;
48639  return node;
48640}
48641class Binder {
48642  constructor(root) {
48643    this.root = root;
48644    this.datasets = root.datasets;
48645    this.data = root.datasets?.data || new XmlObject(NamespaceIds.datasets.id, "data");
48646    this.emptyMerge = this.data[$getChildren]().length === 0;
48647    this.root.form = this.form = root.template[$clone]();
48648  }
48649  _isConsumeData() {
48650    return !this.emptyMerge && this._mergeMode;
48651  }
48652  _isMatchTemplate() {
48653    return !this._isConsumeData();
48654  }
48655  bind() {
48656    this._bindElement(this.form, this.data);
48657    return this.form;
48658  }
48659  getData() {
48660    return this.data;
48661  }
48662  _bindValue(formNode, data, picture) {
48663    formNode[$data] = data;
48664    if (formNode[$hasSettableValue]()) {
48665      if (data[$isDataValue]()) {
48666        const value = data[$getDataValue]();
48667        formNode[$setValue](createText(value));
48668      } else if (formNode instanceof Field && formNode.ui?.choiceList?.open === "multiSelect") {
48669        const value = data[$getChildren]().map(child => child[$content].trim()).join("\n");
48670        formNode[$setValue](createText(value));
48671      } else if (this._isConsumeData()) {
48672        warn(`XFA - Nodes haven't the same type.`);
48673      }
48674    } else if (!data[$isDataValue]() || this._isMatchTemplate()) {
48675      this._bindElement(formNode, data);
48676    } else {
48677      warn(`XFA - Nodes haven't the same type.`);
48678    }
48679  }
48680  _findDataByNameToConsume(name, isValue, dataNode, global) {
48681    if (!name) {
48682      return null;
48683    }
48684    let generator, match;
48685    for (let i = 0; i < 3; i++) {
48686      generator = dataNode[$getRealChildrenByNameIt](name, false, true);
48687      while (true) {
48688        match = generator.next().value;
48689        if (!match) {
48690          break;
48691        }
48692        if (isValue === match[$isDataValue]()) {
48693          return match;
48694        }
48695      }
48696      if (dataNode[$namespaceId] === NamespaceIds.datasets.id
vendor: 20,716 bytes, lines 48696-49401
48696 && dataNode[$nodeName] === "data") {
48697        break;
48698      }
48699      dataNode = dataNode[$getParent]();
48700    }
48701    if (!global) {
48702      return null;
48703    }
48704    generator = this.data[$getRealChildrenByNameIt](name, true, false);
48705    match = generator.next().value;
48706    if (match) {
48707      return match;
48708    }
48709    generator = this.data[$getAttributeIt](name, true);
48710    match = generator.next().value;
48711    if (match?.[$isDataValue]()) {
48712      return match;
48713    }
48714    return null;
48715  }
48716  _setProperties(formNode, dataNode) {
48717    if (!Object.hasOwn(formNode, "setProperty")) {
48718      return;
48719    }
48720    for (const {
48721      ref,
48722      target,
48723      connection
48724    } of formNode.setProperty.children) {
48725      if (connection) {
48726        continue;
48727      }
48728      if (!ref) {
48729        continue;
48730      }
48731      const nodes = searchNode(this.root, dataNode, ref, false, false);
48732      if (!nodes) {
48733        warn(`XFA - Invalid reference: ${ref}.`);
48734        continue;
48735      }
48736      const [node] = nodes;
48737      if (!node[$isDescendent](this.data)) {
48738        warn(`XFA - Invalid node: must be a data node.`);
48739        continue;
48740      }
48741      const targetNodes = searchNode(this.root, formNode, target, false, false);
48742      if (!targetNodes) {
48743        warn(`XFA - Invalid target: ${target}.`);
48744        continue;
48745      }
48746      const [targetNode] = targetNodes;
48747      if (!targetNode[$isDescendent](formNode)) {
48748        warn(`XFA - Invalid target: must be a property or subproperty.`);
48749        continue;
48750      }
48751      const targetParent = targetNode[$getParent]();
48752      if (targetNode instanceof SetProperty || targetParent instanceof SetProperty) {
48753        warn(`XFA - Invalid target: cannot be a setProperty or one of its properties.`);
48754        continue;
48755      }
48756      if (targetNode instanceof BindItems || targetParent instanceof BindItems) {
48757        warn(`XFA - Invalid target: cannot be a bindItems or one of its properties.`);
48758        continue;
48759      }
48760      const content = node[$text]();
48761      const name = targetNode[$nodeName];
48762      if (targetNode instanceof XFAAttribute) {
48763        const attrs = Object.create(null);
48764        attrs[name] = content;
48765        const obj = Reflect.construct(Object.getPrototypeOf(targetParent).constructor, [attrs]);
48766        targetParent[name] = obj[name];
48767        continue;
48768      }
48769      if (!Object.hasOwn(targetNode, $content)) {
48770        warn(`XFA - Invalid node to use in setProperty`);
48771        continue;
48772      }
48773      targetNode[$data] = node;
48774      targetNode[$content] = content;
48775      targetNode[$finalize]();
48776    }
48777  }
48778  _bindItems(formNode, dataNode) {
48779    if (!Object.hasOwn(formNode, "items") || !Object.hasOwn(formNode, "bindItems") || formNode.bindItems.isEmpty()) {
48780      return;
48781    }
48782    for (const item of formNode.items.children) {
48783      formNode[$removeChild](item);
48784    }
48785    formNode.items.clear();
48786    const labels = new Items({});
48787    const values = new Items({});
48788    formNode[$appendChild](labels);
48789    formNode.items.push(labels);
48790    formNode[$appendChild](values);
48791    formNode.items.push(values);
48792    for (const {
48793      ref,
48794      labelRef,
48795      valueRef,
48796      connection
48797    } of formNode.bindItems.children) {
48798      if (connection) {
48799        continue;
48800      }
48801      if (!ref) {
48802        continue;
48803      }
48804      const nodes = searchNode(this.root, dataNode, ref, false, false);
48805      if (!nodes) {
48806        warn(`XFA - Invalid reference: ${ref}.`);
48807        continue;
48808      }
48809      for (const node of nodes) {
48810        if (!node[$isDescendent](this.datasets)) {
48811          warn(`XFA - Invalid ref (${ref}): must be a datasets child.`);
48812          continue;
48813        }
48814        const labelNodes = searchNode(this.root, node, labelRef, true, false);
48815        if (!labelNodes) {
48816          warn(`XFA - Invalid label: ${labelRef}.`);
48817          continue;
48818        }
48819        const [labelNode] = labelNodes;
48820        if (!labelNode[$isDescendent](this.datasets)) {
48821          warn(`XFA - Invalid label: must be a datasets child.`);
48822          continue;
48823        }
48824        const valueNodes = searchNode(this.root, node, valueRef, true, false);
48825        if (!valueNodes) {
48826          warn(`XFA - Invalid value: ${valueRef}.`);
48827          continue;
48828        }
48829        const [valueNode] = valueNodes;
48830        if (!valueNode[$isDescendent](this.datasets)) {
48831          warn(`XFA - Invalid value: must be a datasets child.`);
48832          continue;
48833        }
48834        const label = createText(labelNode[$text]());
48835        const value = createText(valueNode[$text]());
48836        labels[$appendChild](label);
48837        labels.text.push(label);
48838        values[$appendChild](value);
48839        values.text.push(value);
48840      }
48841    }
48842  }
48843  _bindOccurrences(formNode, matches, picture) {
48844    let baseClone;
48845    if (matches.length > 1) {
48846      baseClone = formNode[$clone]();
48847      baseClone[$removeChild](baseClone.occur);
48848      baseClone.occur = null;
48849    }
48850    this._bindValue(formNode, matches[0], picture);
48851    this._setProperties(formNode, matches[0]);
48852    this._bindItems(formNode, matches[0]);
48853    if (matches.length === 1) {
48854      return;
48855    }
48856    const parent = formNode[$getParent]();
48857    const name = formNode[$nodeName];
48858    const pos = parent[$indexOf](formNode);
48859    for (let i = 1, ii = matches.length; i < ii; i++) {
48860      const match = matches[i];
48861      const clone = baseClone[$clone]();
48862      parent[name].push(clone);
48863      parent[$insertAt](pos + i, clone);
48864      this._bindValue(clone, match, picture);
48865      this._setProperties(clone, match);
48866      this._bindItems(clone, match);
48867    }
48868  }
48869  _createOccurrences(formNode) {
48870    if (!this.emptyMerge) {
48871      return;
48872    }
48873    const {
48874      occur
48875    } = formNode;
48876    if (!occur || occur.initial <= 1) {
48877      return;
48878    }
48879    const parent = formNode[$getParent]();
48880    const name = formNode[$nodeName];
48881    if (!(parent[name] instanceof XFAObjectArray)) {
48882      return;
48883    }
48884    let currentNumber;
48885    if (formNode.name) {
48886      currentNumber = parent[name].children.filter(e => e.name === formNode.name).length;
48887    } else {
48888      currentNumber = parent[name].children.length;
48889    }
48890    const pos = parent[$indexOf](formNode) + 1;
48891    const ii = occur.initial - currentNumber;
48892    if (ii) {
48893      const nodeClone = formNode[$clone]();
48894      nodeClone[$removeChild](nodeClone.occur);
48895      nodeClone.occur = null;
48896      parent[name].push(nodeClone);
48897      parent[$insertAt](pos, nodeClone);
48898      for (let i = 1; i < ii; i++) {
48899        const clone = nodeClone[$clone]();
48900        parent[name].push(clone);
48901        parent[$insertAt](pos + i, clone);
48902      }
48903    }
48904  }
48905  _getOccurInfo(formNode) {
48906    const {
48907      name,
48908      occur
48909    } = formNode;
48910    if (!occur || !name) {
48911      return [1, 1];
48912    }
48913    const max = occur.max === -1 ? Infinity : occur.max;
48914    return [occur.min, max];
48915  }
48916  _setAndBind(formNode, dataNode) {
48917    this._setProperties(formNode, dataNode);
48918    this._bindItems(formNode, dataNode);
48919    this._bindElement(formNode, dataNode);
48920  }
48921  _bindElement(formNode, dataNode) {
48922    const uselessNodes = [];
48923    this._createOccurrences(formNode);
48924    for (const child of formNode[$getChildren]()) {
48925      if (child[$data]) {
48926        continue;
48927      }
48928      if (this._mergeMode === undefined && child[$nodeName] === "subform") {
48929        this._mergeMode = child.mergeMode === "consumeData";
48930        const dataChildren = dataNode[$getChildren]();
48931        if (dataChildren.length > 0) {
48932          this._bindOccurrences(child, [dataChildren[0]], null);
48933        } else if (this.emptyMerge) {
48934          const nsId = dataNode[$namespaceId] === bind_NS_DATASETS ? -1 : dataNode[$namespaceId];
48935          const dataChild = child[$data] = new XmlObject(nsId, child.name || "root");
48936          dataNode[$appendChild](dataChild);
48937          this._bindElement(child, dataChild);
48938        }
48939        continue;
48940      }
48941      if (!child[$isBindable]()) {
48942        continue;
48943      }
48944      let global = false;
48945      let picture = null;
48946      let ref = null;
48947      let match = null;
48948      if (child.bind) {
48949        switch (child.bind.match) {
48950          case "none":
48951            this._setAndBind(child, dataNode);
48952            continue;
48953          case "global":
48954            global = true;
48955            break;
48956          case "dataRef":
48957            if (!child.bind.ref) {
48958              warn(`XFA - ref is empty in node ${child[$nodeName]}.`);
48959              this._setAndBind(child, dataNode);
48960              continue;
48961            }
48962            ref = child.bind.ref;
48963            break;
48964          default:
48965            break;
48966        }
48967        if (child.bind.picture) {
48968          picture = child.bind.picture[$content];
48969        }
48970      }
48971      const [min, max] = this._getOccurInfo(child);
48972      if (ref) {
48973        match = searchNode(this.root, dataNode, ref, true, false);
48974        if (match === null) {
48975          match = createDataNode(this.data, dataNode, ref);
48976          if (!match) {
48977            continue;
48978          }
48979          if (this._isConsumeData()) {
48980            match[$consumed] = true;
48981          }
48982          this._setAndBind(child, match);
48983          continue;
48984        } else {
48985          if (this._isConsumeData()) {
48986            match = match.filter(node => !node[$consumed]);
48987          }
48988          if (match.length > max) {
48989            match = match.slice(0, max);
48990          } else if (match.length === 0) {
48991            match = null;
48992          }
48993          if (match && this._isConsumeData()) {
48994            match.forEach(node => {
48995              node[$consumed] = true;
48996            });
48997          }
48998        }
48999      } else {
49000        if (!child.name) {
49001          this._setAndBind(child, dataNode);
49002          continue;
49003        }
49004        if (this._isConsumeData()) {
49005          const matches = [];
49006          while (matches.length < max) {
49007            const found = this._findDataByNameToConsume(child.name, child[$hasSettableValue](), dataNode, global);
49008            if (!found) {
49009              break;
49010            }
49011            found[$consumed] = true;
49012            matches.push(found);
49013          }
49014          match = matches.length > 0 ? matches : null;
49015        } else {
49016          match = dataNode[$getRealChildrenByNameIt](child.name, false, this.emptyMerge).next().value;
49017          if (!match) {
49018            if (min === 0) {
49019              uselessNodes.push(child);
49020              continue;
49021            }
49022            const nsId = dataNode[$namespaceId] === bind_NS_DATASETS ? -1 : dataNode[$namespaceId];
49023            match = child[$data] = new XmlObject(nsId, child.name);
49024            if (this.emptyMerge) {
49025              match[$consumed] = true;
49026            }
49027            dataNode[$appendChild](match);
49028            this._setAndBind(child, match);
49029            continue;
49030          }
49031          if (this.emptyMerge) {
49032            match[$consumed] = true;
49033          }
49034          match = [match];
49035        }
49036      }
49037      if (match) {
49038        this._bindOccurrences(child, match, picture);
49039      } else if (min > 0) {
49040        this._setAndBind(child, dataNode);
49041      } else {
49042        uselessNodes.push(child);
49043      }
49044    }
49045    uselessNodes.forEach(node => node[$getParent]()[$removeChild](node));
49046  }
49047}
49048
49049;// ./src/core/xfa/data.js
49050
49051class DataHandler {
49052  constructor(root, data) {
49053    this.data = data;
49054    this.dataset = root.datasets || null;
49055  }
49056  serialize(storage) {
49057    const stack = [[-1, this.data[$getChildren]()]];
49058    while (stack.length > 0) {
49059      const last = stack.at(-1);
49060      const [i, children] = last;
49061      if (i + 1 === children.length) {
49062        stack.pop();
49063        continue;
49064      }
49065      const child = children[++last[0]];
49066      const storageEntry = storage.get(child[$uid]);
49067      if (storageEntry) {
49068        child[$setValue](storageEntry);
49069      } else {
49070        const attributes = child[$getAttributes]();
49071        for (const value of attributes.values()) {
49072          const entry = storage.get(value[$uid]);
49073          if (entry) {
49074            value[$setValue](entry);
49075            break;
49076          }
49077        }
49078      }
49079      const nodes = child[$getChildren]();
49080      if (nodes.length > 0) {
49081        stack.push([-1, nodes]);
49082      }
49083    }
49084    const buf = [`<xfa:datasets xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">`];
49085    if (this.dataset) {
49086      for (const child of this.dataset[$getChildren]()) {
49087        if (child[$nodeName] !== "data") {
49088          child[$toString](buf);
49089        }
49090      }
49091    }
49092    this.data[$toString](buf);
49093    buf.push("</xfa:datasets>");
49094    return buf.join("");
49095  }
49096}
49097
49098;// ./src/core/xfa/config.js
49099
49100
49101
49102
49103
49104const CONFIG_NS_ID = NamespaceIds.config.id;
49105class Acrobat extends XFAObject {
49106  constructor(attributes) {
49107    super(CONFIG_NS_ID, "acrobat", true);
49108    this.acrobat7 = null;
49109    this.autoSave = null;
49110    this.common = null;
49111    this.validate = null;
49112    this.validateApprovalSignatures = null;
49113    this.submitUrl = new XFAObjectArray();
49114  }
49115}
49116class Acrobat7 extends XFAObject {
49117  constructor(attributes) {
49118    super(CONFIG_NS_ID, "acrobat7", true);
49119    this.dynamicRender = null;
49120  }
49121}
49122class ADBE_JSConsole extends OptionObject {
49123  constructor(attributes) {
49124    super(CONFIG_NS_ID, "ADBE_JSConsole", ["delegate", "Enable", "Disable"]);
49125  }
49126}
49127class ADBE_JSDebugger extends OptionObject {
49128  constructor(attributes) {
49129    super(CONFIG_NS_ID, "ADBE_JSDebugger", ["delegate", "Enable", "Disable"]);
49130  }
49131}
49132class AddSilentPrint extends Option01 {
49133  constructor(attributes) {
49134    super(CONFIG_NS_ID, "addSilentPrint");
49135  }
49136}
49137class AddViewerPreferences extends Option01 {
49138  constructor(attributes) {
49139    super(CONFIG_NS_ID, "addViewerPreferences");
49140  }
49141}
49142class AdjustData extends Option10 {
49143  constructor(attributes) {
49144    super(CONFIG_NS_ID, "adjustData");
49145  }
49146}
49147class AdobeExtensionLevel extends IntegerObject {
49148  constructor(attributes) {
49149    super(CONFIG_NS_ID, "adobeExtensionLevel", 0, n => n >= 1 && n <= 8);
49150  }
49151}
49152class Agent extends XFAObject {
49153  constructor(attributes) {
49154    super(CONFIG_NS_ID, "agent", true);
49155    this.name = attributes.name ? attributes.name.trim() : "";
49156    this.common = new XFAObjectArray();
49157  }
49158}
49159class AlwaysEmbed extends ContentObject {
49160  constructor(attributes) {
49161    super(CONFIG_NS_ID, "alwaysEmbed");
49162  }
49163}
49164class Amd extends StringObject {
49165  constructor(attributes) {
49166    super(CONFIG_NS_ID, "amd");
49167  }
49168}
49169class config_Area extends XFAObject {
49170  constructor(attributes) {
49171    super(CONFIG_NS_ID, "area");
49172    this.level = getInteger({
49173      data: attributes.level,
49174      defaultValue: 0,
49175      validate: n => n >= 1 && n <= 3
49176    });
49177    this.name = getStringOption(attributes.name, ["", "barcode", "coreinit", "deviceDriver", "font", "general", "layout", "merge", "script", "signature", "sourceSet", "templateCache"]);
49178  }
49179}
49180class Attributes extends OptionObject {
49181  constructor(attributes) {
49182    super(CONFIG_NS_ID, "attributes", ["preserve", "delegate", "ignore"]);
49183  }
49184}
49185class AutoSave extends OptionObject {
49186  constructor(attributes) {
49187    super(CONFIG_NS_ID, "autoSave", ["disabled", "enabled"]);
49188  }
49189}
49190class Base extends StringObject {
49191  constructor(attributes) {
49192    super(CONFIG_NS_ID, "base");
49193  }
49194}
49195class BatchOutput extends XFAObject {
49196  constructor(attributes) {
49197    super(CONFIG_NS_ID, "batchOutput");
49198    this.format = getStringOption(attributes.format, ["none", "concat", "zip", "zipCompress"]);
49199  }
49200}
49201class BehaviorOverride extends ContentObject {
49202  constructor(attributes) {
49203    super(CONFIG_NS_ID, "behaviorOverride");
49204  }
49205  [$finalize]() {
49206    this[$content] = new Map(this[$content].trim().split(/\s+/).filter(x => x.includes(":")).map(x => x.split(":", 2)));
49207  }
49208}
49209class Cache extends XFAObject {
49210  constructor(attributes) {
49211    super(CONFIG_NS_ID, "cache", true);
49212    this.templateCache = null;
49213  }
49214}
49215class Change extends Option01 {
49216  constructor(attributes) {
49217    super(CONFIG_NS_ID, "change");
49218  }
49219}
49220class Common extends XFAObject {
49221  constructor(attributes) {
49222    super(CONFIG_NS_ID, "common", true);
49223    this.data = null;
49224    this.locale = null;
49225    this.localeSet = null;
49226    this.messaging = null;
49227    this.suppressBanner = null;
49228    this.template = null;
49229    this.validationMessaging = null;
49230    this.versionControl = null;
49231    this.log = new XFAObjectArray();
49232  }
49233}
49234class Compress extends XFAObject {
49235  constructor(attributes) {
49236    super(CONFIG_NS_ID, "compress");
49237    this.scope = getStringOption(attributes.scope, ["imageOnly", "document"]);
49238  }
49239}
49240class CompressLogicalStructure extends Option01 {
49241  constructor(attributes) {
49242    super(CONFIG_NS_ID, "compressLogicalStructure");
49243  }
49244}
49245class CompressObjectStream extends Option10 {
49246  constructor(attributes) {
49247    super(CONFIG_NS_ID, "compressObjectStream");
49248  }
49249}
49250class Compression extends XFAObject {
49251  constructor(attributes) {
49252    super(CONFIG_NS_ID, "compression", true);
49253    this.compressLogicalStructure = null;
49254    this.compressObjectStream = null;
49255    this.level = null;
49256    this.type = null;
49257  }
49258}
49259class Config extends XFAObject {
49260  constructor(attributes) {
49261    super(CONFIG_NS_ID, "config", true);
49262    this.acrobat = null;
49263    this.present = null;
49264    this.trace = null;
49265    this.agent = new XFAObjectArray();
49266  }
49267}
49268class Conformance extends OptionObject {
49269  constructor(attributes) {
49270    super(CONFIG_NS_ID, "conformance", ["A", "B"]);
49271  }
49272}
49273class ContentCopy extends Option01 {
49274  constructor(attributes) {
49275    super(CONFIG_NS_ID, "contentCopy");
49276  }
49277}
49278class Copies extends IntegerObject {
49279  constructor(attributes) {
49280    super(CONFIG_NS_ID, "copies", 1, n => n >= 1);
49281  }
49282}
49283class Creator extends StringObject {
49284  constructor(attributes) {
49285    super(CONFIG_NS_ID, "creator");
49286  }
49287}
49288class CurrentPage extends IntegerObject {
49289  constructor(attributes) {
49290    super(CONFIG_NS_ID, "currentPage", 0, n => n >= 0);
49291  }
49292}
49293class Data extends XFAObject {
49294  constructor(attributes) {
49295    super(CONFIG_NS_ID, "data", true);
49296    this.adjustData = null;
49297    this.attributes = null;
49298    this.incrementalLoad = null;
49299    this.outputXSL = null;
49300    this.range = null;
49301    this.record = null;
49302    this.startNode = null;
49303    this.uri = null;
49304    this.window = null;
49305    this.xsl = null;
49306    this.excludeNS = new XFAObjectArray();
49307    this.transform = new XFAObjectArray();
49308  }
49309}
49310class Debug extends XFAObject {
49311  constructor(attributes) {
49312    super(CONFIG_NS_ID, "debug", true);
49313    this.uri = null;
49314  }
49315}
49316class DefaultTypeface extends ContentObject {
49317  constructor(attributes) {
49318    super(CONFIG_NS_ID, "defaultTypeface");
49319    this.writingScript = getStringOption(attributes.writingScript, ["*", "Arabic", "Cyrillic", "EastEuropeanRoman", "Greek", "Hebrew", "Japanese", "Korean", "Roman", "SimplifiedChinese", "Thai", "TraditionalChinese", "Vietnamese"]);
49320  }
49321}
49322class Destination extends OptionObject {
49323  constructor(attributes) {
49324    super(CONFIG_NS_ID, "destination", ["pdf", "pcl", "ps", "webClient", "zpl"]);
49325  }
49326}
49327class DocumentAssembly extends Option01 {
49328  constructor(attributes) {
49329    super(CONFIG_NS_ID, "documentAssembly");
49330  }
49331}
49332class Driver extends XFAObject {
49333  constructor(attributes) {
49334    super(CONFIG_NS_ID, "driver", true);
49335    this.name = attributes.name ? attributes.name.trim() : "";
49336    this.fontInfo = null;
49337    this.xdc = null;
49338  }
49339}
49340class DuplexOption extends OptionObject {
49341  constructor(attributes) {
49342    super(CONFIG_NS_ID, "duplexOption", ["simplex", "duplexFlipLongEdge", "duplexFlipShortEdge"]);
49343  }
49344}
49345class DynamicRender extends OptionObject {
49346  constructor(attributes) {
49347    super(CONFIG_NS_ID, "dynamicRender", ["forbidden", "required"]);
49348  }
49349}
49350class Embed extends Option01 {
49351  constructor(attributes) {
49352    super(CONFIG_NS_ID, "embed");
49353  }
49354}
49355class config_Encrypt extends Option01 {
49356  constructor(attributes) {
49357    super(CONFIG_NS_ID, "encrypt");
49358  }
49359}
49360class config_Encryption extends XFAObject {
49361  constructor(attributes) {
49362    super(CONFIG_NS_ID, "encryption", true);
49363    this.encrypt = null;
49364    this.encryptionLevel = null;
49365    this.permissions = null;
49366  }
49367}
49368class EncryptionLevel extends OptionObject {
49369  constructor(attributes) {
49370    super(CONFIG_NS_ID, "encryptionLevel", ["40bit", "128bit"]);
49371  }
49372}
49373class Enforce extends StringObject {
49374  constructor(attributes) {
49375    super(CONFIG_NS_ID, "enforce");
49376  }
49377}
49378class Equate extends XFAObject {
49379  constructor(attributes) {
49380    super(CONFIG_NS_ID, "equate");
49381    this.force = getInteger({
49382      data: attributes.force,
49383      defaultValue: 1,
49384      validate: n => n === 0
49385    });
49386    this.from = attributes.from || "";
49387    this.to = attributes.to || "";
49388  }
49389}
49390class EquateRange extends XFAObject {
49391  constructor(attributes) {
49392    super(CONFIG_NS_ID, "equateRange");
49393    this.from = attributes.from || "";
49394    this.to = attributes.to || "";
49395    this._unicodeRange = attributes.unicodeRange || "";
49396  }
49397  get unicodeRange() {
49398    const ranges = [];
49399    const unicodeRegex = /U\+([0-9a-fA-F]+)/;
49400    const unicodeRange = this._unicodeRange;
49401    for (let range of unicodeRange.split(",").map(x => x.trim()).filter(
vendor: 15,639 bytes, lines 49401-49994
49401x => !!x)) {
49402      range = range.split("-", 2).map(x => {
49403        const found = x.match(unicodeRegex);
49404        if (!found) {
49405          return 0;
49406        }
49407        return parseInt(found[1], 16);
49408      });
49409      if (range.length === 1) {
49410        range.push(range[0]);
49411      }
49412      ranges.push(range);
49413    }
49414    return shadow(this, "unicodeRange", ranges);
49415  }
49416}
49417class Exclude extends ContentObject {
49418  constructor(attributes) {
49419    super(CONFIG_NS_ID, "exclude");
49420  }
49421  [$finalize]() {
49422    this[$content] = this[$content].trim().split(/\s+/).filter(x => x && ["calculate", "close", "enter", "exit", "initialize", "ready", "validate"].includes(x));
49423  }
49424}
49425class ExcludeNS extends StringObject {
49426  constructor(attributes) {
49427    super(CONFIG_NS_ID, "excludeNS");
49428  }
49429}
49430class FlipLabel extends OptionObject {
49431  constructor(attributes) {
49432    super(CONFIG_NS_ID, "flipLabel", ["usePrinterSetting", "on", "off"]);
49433  }
49434}
49435class config_FontInfo extends XFAObject {
49436  constructor(attributes) {
49437    super(CONFIG_NS_ID, "fontInfo", true);
49438    this.embed = null;
49439    this.map = null;
49440    this.subsetBelow = null;
49441    this.alwaysEmbed = new XFAObjectArray();
49442    this.defaultTypeface = new XFAObjectArray();
49443    this.neverEmbed = new XFAObjectArray();
49444  }
49445}
49446class FormFieldFilling extends Option01 {
49447  constructor(attributes) {
49448    super(CONFIG_NS_ID, "formFieldFilling");
49449  }
49450}
49451class GroupParent extends StringObject {
49452  constructor(attributes) {
49453    super(CONFIG_NS_ID, "groupParent");
49454  }
49455}
49456class IfEmpty extends OptionObject {
49457  constructor(attributes) {
49458    super(CONFIG_NS_ID, "ifEmpty", ["dataValue", "dataGroup", "ignore", "remove"]);
49459  }
49460}
49461class IncludeXDPContent extends StringObject {
49462  constructor(attributes) {
49463    super(CONFIG_NS_ID, "includeXDPContent");
49464  }
49465}
49466class IncrementalLoad extends OptionObject {
49467  constructor(attributes) {
49468    super(CONFIG_NS_ID, "incrementalLoad", ["none", "forwardOnly"]);
49469  }
49470}
49471class IncrementalMerge extends Option01 {
49472  constructor(attributes) {
49473    super(CONFIG_NS_ID, "incrementalMerge");
49474  }
49475}
49476class Interactive extends Option01 {
49477  constructor(attributes) {
49478    super(CONFIG_NS_ID, "interactive");
49479  }
49480}
49481class Jog extends OptionObject {
49482  constructor(attributes) {
49483    super(CONFIG_NS_ID, "jog", ["usePrinterSetting", "none", "pageSet"]);
49484  }
49485}
49486class LabelPrinter extends XFAObject {
49487  constructor(attributes) {
49488    super(CONFIG_NS_ID, "labelPrinter", true);
49489    this.name = getStringOption(attributes.name, ["zpl", "dpl", "ipl", "tcpl"]);
49490    this.batchOutput = null;
49491    this.flipLabel = null;
49492    this.fontInfo = null;
49493    this.xdc = null;
49494  }
49495}
49496class Layout extends OptionObject {
49497  constructor(attributes) {
49498    super(CONFIG_NS_ID, "layout", ["paginate", "panel"]);
49499  }
49500}
49501class Level extends IntegerObject {
49502  constructor(attributes) {
49503    super(CONFIG_NS_ID, "level", 0, n => n > 0);
49504  }
49505}
49506class Linearized extends Option01 {
49507  constructor(attributes) {
49508    super(CONFIG_NS_ID, "linearized");
49509  }
49510}
49511class Locale extends StringObject {
49512  constructor(attributes) {
49513    super(CONFIG_NS_ID, "locale");
49514  }
49515}
49516class LocaleSet extends StringObject {
49517  constructor(attributes) {
49518    super(CONFIG_NS_ID, "localeSet");
49519  }
49520}
49521class Log extends XFAObject {
49522  constructor(attributes) {
49523    super(CONFIG_NS_ID, "log", true);
49524    this.mode = null;
49525    this.threshold = null;
49526    this.to = null;
49527    this.uri = null;
49528  }
49529}
49530class MapElement extends XFAObject {
49531  constructor(attributes) {
49532    super(CONFIG_NS_ID, "map", true);
49533    this.equate = new XFAObjectArray();
49534    this.equateRange = new XFAObjectArray();
49535  }
49536}
49537class MediumInfo extends XFAObject {
49538  constructor(attributes) {
49539    super(CONFIG_NS_ID, "mediumInfo", true);
49540    this.map = null;
49541  }
49542}
49543class config_Message extends XFAObject {
49544  constructor(attributes) {
49545    super(CONFIG_NS_ID, "message", true);
49546    this.msgId = null;
49547    this.severity = null;
49548  }
49549}
49550class Messaging extends XFAObject {
49551  constructor(attributes) {
49552    super(CONFIG_NS_ID, "messaging", true);
49553    this.message = new XFAObjectArray();
49554  }
49555}
49556class Mode extends OptionObject {
49557  constructor(attributes) {
49558    super(CONFIG_NS_ID, "mode", ["append", "overwrite"]);
49559  }
49560}
49561class ModifyAnnots extends Option01 {
49562  constructor(attributes) {
49563    super(CONFIG_NS_ID, "modifyAnnots");
49564  }
49565}
49566class MsgId extends IntegerObject {
49567  constructor(attributes) {
49568    super(CONFIG_NS_ID, "msgId", 1, n => n >= 1);
49569  }
49570}
49571class NameAttr extends StringObject {
49572  constructor(attributes) {
49573    super(CONFIG_NS_ID, "nameAttr");
49574  }
49575}
49576class NeverEmbed extends ContentObject {
49577  constructor(attributes) {
49578    super(CONFIG_NS_ID, "neverEmbed");
49579  }
49580}
49581class NumberOfCopies extends IntegerObject {
49582  constructor(attributes) {
49583    super(CONFIG_NS_ID, "numberOfCopies", null, n => n >= 2 && n <= 5);
49584  }
49585}
49586class OpenAction extends XFAObject {
49587  constructor(attributes) {
49588    super(CONFIG_NS_ID, "openAction", true);
49589    this.destination = null;
49590  }
49591}
49592class Output extends XFAObject {
49593  constructor(attributes) {
49594    super(CONFIG_NS_ID, "output", true);
49595    this.to = null;
49596    this.type = null;
49597    this.uri = null;
49598  }
49599}
49600class OutputBin extends StringObject {
49601  constructor(attributes) {
49602    super(CONFIG_NS_ID, "outputBin");
49603  }
49604}
49605class OutputXSL extends XFAObject {
49606  constructor(attributes) {
49607    super(CONFIG_NS_ID, "outputXSL", true);
49608    this.uri = null;
49609  }
49610}
49611class Overprint extends OptionObject {
49612  constructor(attributes) {
49613    super(CONFIG_NS_ID, "overprint", ["none", "both", "draw", "field"]);
49614  }
49615}
49616class Packets extends StringObject {
49617  constructor(attributes) {
49618    super(CONFIG_NS_ID, "packets");
49619  }
49620  [$finalize]() {
49621    if (this[$content] === "*") {
49622      return;
49623    }
49624    this[$content] = this[$content].trim().split(/\s+/).filter(x => ["config", "datasets", "template", "xfdf", "xslt"].includes(x));
49625  }
49626}
49627class PageOffset extends XFAObject {
49628  constructor(attributes) {
49629    super(CONFIG_NS_ID, "pageOffset");
49630    this.x = getInteger({
49631      data: attributes.x,
49632      defaultValue: "useXDCSetting",
49633      validate: n => true
49634    });
49635    this.y = getInteger({
49636      data: attributes.y,
49637      defaultValue: "useXDCSetting",
49638      validate: n => true
49639    });
49640  }
49641}
49642class PageRange extends StringObject {
49643  constructor(attributes) {
49644    super(CONFIG_NS_ID, "pageRange");
49645  }
49646  [$finalize]() {
49647    const numbers = this[$content].trim().split(/\s+/).map(x => parseInt(x, 10));
49648    const ranges = [];
49649    for (let i = 0, ii = numbers.length; i < ii; i += 2) {
49650      ranges.push(numbers.slice(i, i + 2));
49651    }
49652    this[$content] = ranges;
49653  }
49654}
49655class Pagination extends OptionObject {
49656  constructor(attributes) {
49657    super(CONFIG_NS_ID, "pagination", ["simplex", "duplexShortEdge", "duplexLongEdge"]);
49658  }
49659}
49660class PaginationOverride extends OptionObject {
49661  constructor(attributes) {
49662    super(CONFIG_NS_ID, "paginationOverride", ["none", "forceDuplex", "forceDuplexLongEdge", "forceDuplexShortEdge", "forceSimplex"]);
49663  }
49664}
49665class Part extends IntegerObject {
49666  constructor(attributes) {
49667    super(CONFIG_NS_ID, "part", 1, n => false);
49668  }
49669}
49670class Pcl extends XFAObject {
49671  constructor(attributes) {
49672    super(CONFIG_NS_ID, "pcl", true);
49673    this.name = attributes.name || "";
49674    this.batchOutput = null;
49675    this.fontInfo = null;
49676    this.jog = null;
49677    this.mediumInfo = null;
49678    this.outputBin = null;
49679    this.pageOffset = null;
49680    this.staple = null;
49681    this.xdc = null;
49682  }
49683}
49684class Pdf extends XFAObject {
49685  constructor(attributes) {
49686    super(CONFIG_NS_ID, "pdf", true);
49687    this.name = attributes.name || "";
49688    this.adobeExtensionLevel = null;
49689    this.batchOutput = null;
49690    this.compression = null;
49691    this.creator = null;
49692    this.encryption = null;
49693    this.fontInfo = null;
49694    this.interactive = null;
49695    this.linearized = null;
49696    this.openAction = null;
49697    this.pdfa = null;
49698    this.producer = null;
49699    this.renderPolicy = null;
49700    this.scriptModel = null;
49701    this.silentPrint = null;
49702    this.submitFormat = null;
49703    this.tagged = null;
49704    this.version = null;
49705    this.viewerPreferences = null;
49706    this.xdc = null;
49707  }
49708}
49709class Pdfa extends XFAObject {
49710  constructor(attributes) {
49711    super(CONFIG_NS_ID, "pdfa", true);
49712    this.amd = null;
49713    this.conformance = null;
49714    this.includeXDPContent = null;
49715    this.part = null;
49716  }
49717}
49718class Permissions extends XFAObject {
49719  constructor(attributes) {
49720    super(CONFIG_NS_ID, "permissions", true);
49721    this.accessibleContent = null;
49722    this.change = null;
49723    this.contentCopy = null;
49724    this.documentAssembly = null;
49725    this.formFieldFilling = null;
49726    this.modifyAnnots = null;
49727    this.plaintextMetadata = null;
49728    this.print = null;
49729    this.printHighQuality = null;
49730  }
49731}
49732class PickTrayByPDFSize extends Option01 {
49733  constructor(attributes) {
49734    super(CONFIG_NS_ID, "pickTrayByPDFSize");
49735  }
49736}
49737class config_Picture extends StringObject {
49738  constructor(attributes) {
49739    super(CONFIG_NS_ID, "picture");
49740  }
49741}
49742class PlaintextMetadata extends Option01 {
49743  constructor(attributes) {
49744    super(CONFIG_NS_ID, "plaintextMetadata");
49745  }
49746}
49747class Presence extends OptionObject {
49748  constructor(attributes) {
49749    super(CONFIG_NS_ID, "presence", ["preserve", "dissolve", "dissolveStructure", "ignore", "remove"]);
49750  }
49751}
49752class Present extends XFAObject {
49753  constructor(attributes) {
49754    super(CONFIG_NS_ID, "present", true);
49755    this.behaviorOverride = null;
49756    this.cache = null;
49757    this.common = null;
49758    this.copies = null;
49759    this.destination = null;
49760    this.incrementalMerge = null;
49761    this.layout = null;
49762    this.output = null;
49763    this.overprint = null;
49764    this.pagination = null;
49765    this.paginationOverride = null;
49766    this.script = null;
49767    this.validate = null;
49768    this.xdp = null;
49769    this.driver = new XFAObjectArray();
49770    this.labelPrinter = new XFAObjectArray();
49771    this.pcl = new XFAObjectArray();
49772    this.pdf = new XFAObjectArray();
49773    this.ps = new XFAObjectArray();
49774    this.submitUrl = new XFAObjectArray();
49775    this.webClient = new XFAObjectArray();
49776    this.zpl = new XFAObjectArray();
49777  }
49778}
49779class Print extends Option01 {
49780  constructor(attributes) {
49781    super(CONFIG_NS_ID, "print");
49782  }
49783}
49784class PrintHighQuality extends Option01 {
49785  constructor(attributes) {
49786    super(CONFIG_NS_ID, "printHighQuality");
49787  }
49788}
49789class PrintScaling extends OptionObject {
49790  constructor(attributes) {
49791    super(CONFIG_NS_ID, "printScaling", ["appdefault", "noScaling"]);
49792  }
49793}
49794class PrinterName extends StringObject {
49795  constructor(attributes) {
49796    super(CONFIG_NS_ID, "printerName");
49797  }
49798}
49799class Producer extends StringObject {
49800  constructor(attributes) {
49801    super(CONFIG_NS_ID, "producer");
49802  }
49803}
49804class Ps extends XFAObject {
49805  constructor(attributes) {
49806    super(CONFIG_NS_ID, "ps", true);
49807    this.name = attributes.name || "";
49808    this.batchOutput = null;
49809    this.fontInfo = null;
49810    this.jog = null;
49811    this.mediumInfo = null;
49812    this.outputBin = null;
49813    this.staple = null;
49814    this.xdc = null;
49815  }
49816}
49817class Range extends ContentObject {
49818  constructor(attributes) {
49819    super(CONFIG_NS_ID, "range");
49820  }
49821  [$finalize]() {
49822    this[$content] = this[$content].split(",", 2).map(range => range.split("-").map(x => parseInt(x.trim(), 10))).filter(range => range.every(x => !isNaN(x))).map(range => {
49823      if (range.length === 1) {
49824        range.push(range[0]);
49825      }
49826      return range;
49827    });
49828  }
49829}
49830class Record extends ContentObject {
49831  constructor(attributes) {
49832    super(CONFIG_NS_ID, "record");
49833  }
49834  [$finalize]() {
49835    this[$content] = this[$content].trim();
49836    const n = parseInt(this[$content], 10);
49837    if (!isNaN(n) && n >= 0) {
49838      this[$content] = n;
49839    }
49840  }
49841}
49842class Relevant extends ContentObject {
49843  constructor(attributes) {
49844    super(CONFIG_NS_ID, "relevant");
49845  }
49846  [$finalize]() {
49847    this[$content] = this[$content].trim().split(/\s+/);
49848  }
49849}
49850class Rename extends ContentObject {
49851  constructor(attributes) {
49852    super(CONFIG_NS_ID, "rename");
49853  }
49854  [$finalize]() {
49855    this[$content] = this[$content].trim();
49856    if (this[$content].toLowerCase().startsWith("xml") || new RegExp("[\\p{L}_][\\p{L}\\d._\\p{M}-]*", "u").test(this[$content])) {
49857      warn("XFA - Rename: invalid XFA name");
49858    }
49859  }
49860}
49861class RenderPolicy extends OptionObject {
49862  constructor(attributes) {
49863    super(CONFIG_NS_ID, "renderPolicy", ["server", "client"]);
49864  }
49865}
49866class RunScripts extends OptionObject {
49867  constructor(attributes) {
49868    super(CONFIG_NS_ID, "runScripts", ["both", "client", "none", "server"]);
49869  }
49870}
49871class config_Script extends XFAObject {
49872  constructor(attributes) {
49873    super(CONFIG_NS_ID, "script", true);
49874    this.currentPage = null;
49875    this.exclude = null;
49876    this.runScripts = null;
49877  }
49878}
49879class ScriptModel extends OptionObject {
49880  constructor(attributes) {
49881    super(CONFIG_NS_ID, "scriptModel", ["XFA", "none"]);
49882  }
49883}
49884class Severity extends OptionObject {
49885  constructor(attributes) {
49886    super(CONFIG_NS_ID, "severity", ["ignore", "error", "information", "trace", "warning"]);
49887  }
49888}
49889class SilentPrint extends XFAObject {
49890  constructor(attributes) {
49891    super(CONFIG_NS_ID, "silentPrint", true);
49892    this.addSilentPrint = null;
49893    this.printerName = null;
49894  }
49895}
49896class Staple extends XFAObject {
49897  constructor(attributes) {
49898    super(CONFIG_NS_ID, "staple");
49899    this.mode = getStringOption(attributes.mode, ["usePrinterSetting", "on", "off"]);
49900  }
49901}
49902class StartNode extends StringObject {
49903  constructor(attributes) {
49904    super(CONFIG_NS_ID, "startNode");
49905  }
49906}
49907class StartPage extends IntegerObject {
49908  constructor(attributes) {
49909    super(CONFIG_NS_ID, "startPage", 0, n => true);
49910  }
49911}
49912class SubmitFormat extends OptionObject {
49913  constructor(attributes) {
49914    super(CONFIG_NS_ID, "submitFormat", ["html", "delegate", "fdf", "xml", "pdf"]);
49915  }
49916}
49917class SubmitUrl extends StringObject {
49918  constructor(attributes) {
49919    super(CONFIG_NS_ID, "submitUrl");
49920  }
49921}
49922class SubsetBelow extends IntegerObject {
49923  constructor(attributes) {
49924    super(CONFIG_NS_ID, "subsetBelow", 100, n => n >= 0 && n <= 100);
49925  }
49926}
49927class SuppressBanner extends Option01 {
49928  constructor(attributes) {
49929    super(CONFIG_NS_ID, "suppressBanner");
49930  }
49931}
49932class Tagged extends Option01 {
49933  constructor(attributes) {
49934    super(CONFIG_NS_ID, "tagged");
49935  }
49936}
49937class config_Template extends XFAObject {
49938  constructor(attributes) {
49939    super(CONFIG_NS_ID, "template", true);
49940    this.base = null;
49941    this.relevant = null;
49942    this.startPage = null;
49943    this.uri = null;
49944    this.xsl = null;
49945  }
49946}
49947class Threshold extends OptionObject {
49948  constructor(attributes) {
49949    super(CONFIG_NS_ID, "threshold", ["trace", "error", "information", "warning"]);
49950  }
49951}
49952class To extends OptionObject {
49953  constructor(attributes) {
49954    super(CONFIG_NS_ID, "to", ["null", "memory", "stderr", "stdout", "system", "uri"]);
49955  }
49956}
49957class TemplateCache extends XFAObject {
49958  constructor(attributes) {
49959    super(CONFIG_NS_ID, "templateCache");
49960    this.maxEntries = getInteger({
49961      data: attributes.maxEntries,
49962      defaultValue: 5,
49963      validate: n => n >= 0
49964    });
49965  }
49966}
49967class Trace extends XFAObject {
49968  constructor(attributes) {
49969    super(CONFIG_NS_ID, "trace", true);
49970    this.area = new XFAObjectArray();
49971  }
49972}
49973class Transform extends XFAObject {
49974  constructor(attributes) {
49975    super(CONFIG_NS_ID, "transform", true);
49976    this.groupParent = null;
49977    this.ifEmpty = null;
49978    this.nameAttr = null;
49979    this.picture = null;
49980    this.presence = null;
49981    this.rename = null;
49982    this.whitespace = null;
49983  }
49984}
49985class Type extends OptionObject {
49986  constructor(attributes) {
49987    super(CONFIG_NS_ID, "type", ["none", "ascii85", "asciiHex", "ccittfax", "flate", "lzw", "runLength", "native", "xdp", "mergedXDP"]);
49988  }
49989}
49990class Uri extends StringObject {
49991  constructor(attributes) {
49992    super(CONFIG_NS_ID, "uri");
49993  }
49994}
vendor: 28,463 bytes, lines 49995-51064
49995class config_Validate extends OptionObject {
49996  constructor(attributes) {
49997    super(CONFIG_NS_ID, "validate", ["preSubmit", "prePrint", "preExecute", "preSave"]);
49998  }
49999}
50000class ValidateApprovalSignatures extends ContentObject {
50001  constructor(attributes) {
50002    super(CONFIG_NS_ID, "validateApprovalSignatures");
50003  }
50004  [$finalize]() {
50005    this[$content] = this[$content].trim().split(/\s+/).filter(x => ["docReady", "postSign"].includes(x));
50006  }
50007}
50008class ValidationMessaging extends OptionObject {
50009  constructor(attributes) {
50010    super(CONFIG_NS_ID, "validationMessaging", ["allMessagesIndividually", "allMessagesTogether", "firstMessageOnly", "noMessages"]);
50011  }
50012}
50013class Version extends OptionObject {
50014  constructor(attributes) {
50015    super(CONFIG_NS_ID, "version", ["1.7", "1.6", "1.5", "1.4", "1.3", "1.2"]);
50016  }
50017}
50018class VersionControl extends XFAObject {
50019  constructor(attributes) {
50020    super(CONFIG_NS_ID, "VersionControl");
50021    this.outputBelow = getStringOption(attributes.outputBelow, ["warn", "error", "update"]);
50022    this.sourceAbove = getStringOption(attributes.sourceAbove, ["warn", "error"]);
50023    this.sourceBelow = getStringOption(attributes.sourceBelow, ["update", "maintain"]);
50024  }
50025}
50026class ViewerPreferences extends XFAObject {
50027  constructor(attributes) {
50028    super(CONFIG_NS_ID, "viewerPreferences", true);
50029    this.ADBE_JSConsole = null;
50030    this.ADBE_JSDebugger = null;
50031    this.addViewerPreferences = null;
50032    this.duplexOption = null;
50033    this.enforce = null;
50034    this.numberOfCopies = null;
50035    this.pageRange = null;
50036    this.pickTrayByPDFSize = null;
50037    this.printScaling = null;
50038  }
50039}
50040class WebClient extends XFAObject {
50041  constructor(attributes) {
50042    super(CONFIG_NS_ID, "webClient", true);
50043    this.name = attributes.name ? attributes.name.trim() : "";
50044    this.fontInfo = null;
50045    this.xdc = null;
50046  }
50047}
50048class Whitespace extends OptionObject {
50049  constructor(attributes) {
50050    super(CONFIG_NS_ID, "whitespace", ["preserve", "ltrim", "normalize", "rtrim", "trim"]);
50051  }
50052}
50053class Window extends ContentObject {
50054  constructor(attributes) {
50055    super(CONFIG_NS_ID, "window");
50056  }
50057  [$finalize]() {
50058    const pair = this[$content].split(",", 2).map(x => parseInt(x.trim(), 10));
50059    if (pair.some(x => isNaN(x))) {
50060      this[$content] = [0, 0];
50061      return;
50062    }
50063    if (pair.length === 1) {
50064      pair.push(pair[0]);
50065    }
50066    this[$content] = pair;
50067  }
50068}
50069class Xdc extends XFAObject {
50070  constructor(attributes) {
50071    super(CONFIG_NS_ID, "xdc", true);
50072    this.uri = new XFAObjectArray();
50073    this.xsl = new XFAObjectArray();
50074  }
50075}
50076class Xdp extends XFAObject {
50077  constructor(attributes) {
50078    super(CONFIG_NS_ID, "xdp", true);
50079    this.packets = null;
50080  }
50081}
50082class Xsl extends XFAObject {
50083  constructor(attributes) {
50084    super(CONFIG_NS_ID, "xsl", true);
50085    this.debug = null;
50086    this.uri = null;
50087  }
50088}
50089class Zpl extends XFAObject {
50090  constructor(attributes) {
50091    super(CONFIG_NS_ID, "zpl", true);
50092    this.name = attributes.name ? attributes.name.trim() : "";
50093    this.batchOutput = null;
50094    this.flipLabel = null;
50095    this.fontInfo = null;
50096    this.xdc = null;
50097  }
50098}
50099class ConfigNamespace {
50100  static [$buildXFAObject](name, attributes) {
50101    if (Object.hasOwn(ConfigNamespace, name)) {
50102      return ConfigNamespace[name](attributes);
50103    }
50104    return undefined;
50105  }
50106  static acrobat(attrs) {
50107    return new Acrobat(attrs);
50108  }
50109  static acrobat7(attrs) {
50110    return new Acrobat7(attrs);
50111  }
50112  static ADBE_JSConsole(attrs) {
50113    return new ADBE_JSConsole(attrs);
50114  }
50115  static ADBE_JSDebugger(attrs) {
50116    return new ADBE_JSDebugger(attrs);
50117  }
50118  static addSilentPrint(attrs) {
50119    return new AddSilentPrint(attrs);
50120  }
50121  static addViewerPreferences(attrs) {
50122    return new AddViewerPreferences(attrs);
50123  }
50124  static adjustData(attrs) {
50125    return new AdjustData(attrs);
50126  }
50127  static adobeExtensionLevel(attrs) {
50128    return new AdobeExtensionLevel(attrs);
50129  }
50130  static agent(attrs) {
50131    return new Agent(attrs);
50132  }
50133  static alwaysEmbed(attrs) {
50134    return new AlwaysEmbed(attrs);
50135  }
50136  static amd(attrs) {
50137    return new Amd(attrs);
50138  }
50139  static area(attrs) {
50140    return new config_Area(attrs);
50141  }
50142  static attributes(attrs) {
50143    return new Attributes(attrs);
50144  }
50145  static autoSave(attrs) {
50146    return new AutoSave(attrs);
50147  }
50148  static base(attrs) {
50149    return new Base(attrs);
50150  }
50151  static batchOutput(attrs) {
50152    return new BatchOutput(attrs);
50153  }
50154  static behaviorOverride(attrs) {
50155    return new BehaviorOverride(attrs);
50156  }
50157  static cache(attrs) {
50158    return new Cache(attrs);
50159  }
50160  static change(attrs) {
50161    return new Change(attrs);
50162  }
50163  static common(attrs) {
50164    return new Common(attrs);
50165  }
50166  static compress(attrs) {
50167    return new Compress(attrs);
50168  }
50169  static compressLogicalStructure(attrs) {
50170    return new CompressLogicalStructure(attrs);
50171  }
50172  static compressObjectStream(attrs) {
50173    return new CompressObjectStream(attrs);
50174  }
50175  static compression(attrs) {
50176    return new Compression(attrs);
50177  }
50178  static config(attrs) {
50179    return new Config(attrs);
50180  }
50181  static conformance(attrs) {
50182    return new Conformance(attrs);
50183  }
50184  static contentCopy(attrs) {
50185    return new ContentCopy(attrs);
50186  }
50187  static copies(attrs) {
50188    return new Copies(attrs);
50189  }
50190  static creator(attrs) {
50191    return new Creator(attrs);
50192  }
50193  static currentPage(attrs) {
50194    return new CurrentPage(attrs);
50195  }
50196  static data(attrs) {
50197    return new Data(attrs);
50198  }
50199  static debug(attrs) {
50200    return new Debug(attrs);
50201  }
50202  static defaultTypeface(attrs) {
50203    return new DefaultTypeface(attrs);
50204  }
50205  static destination(attrs) {
50206    return new Destination(attrs);
50207  }
50208  static documentAssembly(attrs) {
50209    return new DocumentAssembly(attrs);
50210  }
50211  static driver(attrs) {
50212    return new Driver(attrs);
50213  }
50214  static duplexOption(attrs) {
50215    return new DuplexOption(attrs);
50216  }
50217  static dynamicRender(attrs) {
50218    return new DynamicRender(attrs);
50219  }
50220  static embed(attrs) {
50221    return new Embed(attrs);
50222  }
50223  static encrypt(attrs) {
50224    return new config_Encrypt(attrs);
50225  }
50226  static encryption(attrs) {
50227    return new config_Encryption(attrs);
50228  }
50229  static encryptionLevel(attrs) {
50230    return new EncryptionLevel(attrs);
50231  }
50232  static enforce(attrs) {
50233    return new Enforce(attrs);
50234  }
50235  static equate(attrs) {
50236    return new Equate(attrs);
50237  }
50238  static equateRange(attrs) {
50239    return new EquateRange(attrs);
50240  }
50241  static exclude(attrs) {
50242    return new Exclude(attrs);
50243  }
50244  static excludeNS(attrs) {
50245    return new ExcludeNS(attrs);
50246  }
50247  static flipLabel(attrs) {
50248    return new FlipLabel(attrs);
50249  }
50250  static fontInfo(attrs) {
50251    return new config_FontInfo(attrs);
50252  }
50253  static formFieldFilling(attrs) {
50254    return new FormFieldFilling(attrs);
50255  }
50256  static groupParent(attrs) {
50257    return new GroupParent(attrs);
50258  }
50259  static ifEmpty(attrs) {
50260    return new IfEmpty(attrs);
50261  }
50262  static includeXDPContent(attrs) {
50263    return new IncludeXDPContent(attrs);
50264  }
50265  static incrementalLoad(attrs) {
50266    return new IncrementalLoad(attrs);
50267  }
50268  static incrementalMerge(attrs) {
50269    return new IncrementalMerge(attrs);
50270  }
50271  static interactive(attrs) {
50272    return new Interactive(attrs);
50273  }
50274  static jog(attrs) {
50275    return new Jog(attrs);
50276  }
50277  static labelPrinter(attrs) {
50278    return new LabelPrinter(attrs);
50279  }
50280  static layout(attrs) {
50281    return new Layout(attrs);
50282  }
50283  static level(attrs) {
50284    return new Level(attrs);
50285  }
50286  static linearized(attrs) {
50287    return new Linearized(attrs);
50288  }
50289  static locale(attrs) {
50290    return new Locale(attrs);
50291  }
50292  static localeSet(attrs) {
50293    return new LocaleSet(attrs);
50294  }
50295  static log(attrs) {
50296    return new Log(attrs);
50297  }
50298  static map(attrs) {
50299    return new MapElement(attrs);
50300  }
50301  static mediumInfo(attrs) {
50302    return new MediumInfo(attrs);
50303  }
50304  static message(attrs) {
50305    return new config_Message(attrs);
50306  }
50307  static messaging(attrs) {
50308    return new Messaging(attrs);
50309  }
50310  static mode(attrs) {
50311    return new Mode(attrs);
50312  }
50313  static modifyAnnots(attrs) {
50314    return new ModifyAnnots(attrs);
50315  }
50316  static msgId(attrs) {
50317    return new MsgId(attrs);
50318  }
50319  static nameAttr(attrs) {
50320    return new NameAttr(attrs);
50321  }
50322  static neverEmbed(attrs) {
50323    return new NeverEmbed(attrs);
50324  }
50325  static numberOfCopies(attrs) {
50326    return new NumberOfCopies(attrs);
50327  }
50328  static openAction(attrs) {
50329    return new OpenAction(attrs);
50330  }
50331  static output(attrs) {
50332    return new Output(attrs);
50333  }
50334  static outputBin(attrs) {
50335    return new OutputBin(attrs);
50336  }
50337  static outputXSL(attrs) {
50338    return new OutputXSL(attrs);
50339  }
50340  static overprint(attrs) {
50341    return new Overprint(attrs);
50342  }
50343  static packets(attrs) {
50344    return new Packets(attrs);
50345  }
50346  static pageOffset(attrs) {
50347    return new PageOffset(attrs);
50348  }
50349  static pageRange(attrs) {
50350    return new PageRange(attrs);
50351  }
50352  static pagination(attrs) {
50353    return new Pagination(attrs);
50354  }
50355  static paginationOverride(attrs) {
50356    return new PaginationOverride(attrs);
50357  }
50358  static part(attrs) {
50359    return new Part(attrs);
50360  }
50361  static pcl(attrs) {
50362    return new Pcl(attrs);
50363  }
50364  static pdf(attrs) {
50365    return new Pdf(attrs);
50366  }
50367  static pdfa(attrs) {
50368    return new Pdfa(attrs);
50369  }
50370  static permissions(attrs) {
50371    return new Permissions(attrs);
50372  }
50373  static pickTrayByPDFSize(attrs) {
50374    return new PickTrayByPDFSize(attrs);
50375  }
50376  static picture(attrs) {
50377    return new config_Picture(attrs);
50378  }
50379  static plaintextMetadata(attrs) {
50380    return new PlaintextMetadata(attrs);
50381  }
50382  static presence(attrs) {
50383    return new Presence(attrs);
50384  }
50385  static present(attrs) {
50386    return new Present(attrs);
50387  }
50388  static print(attrs) {
50389    return new Print(attrs);
50390  }
50391  static printHighQuality(attrs) {
50392    return new PrintHighQuality(attrs);
50393  }
50394  static printScaling(attrs) {
50395    return new PrintScaling(attrs);
50396  }
50397  static printerName(attrs) {
50398    return new PrinterName(attrs);
50399  }
50400  static producer(attrs) {
50401    return new Producer(attrs);
50402  }
50403  static ps(attrs) {
50404    return new Ps(attrs);
50405  }
50406  static range(attrs) {
50407    return new Range(attrs);
50408  }
50409  static record(attrs) {
50410    return new Record(attrs);
50411  }
50412  static relevant(attrs) {
50413    return new Relevant(attrs);
50414  }
50415  static rename(attrs) {
50416    return new Rename(attrs);
50417  }
50418  static renderPolicy(attrs) {
50419    return new RenderPolicy(attrs);
50420  }
50421  static runScripts(attrs) {
50422    return new RunScripts(attrs);
50423  }
50424  static script(attrs) {
50425    return new config_Script(attrs);
50426  }
50427  static scriptModel(attrs) {
50428    return new ScriptModel(attrs);
50429  }
50430  static severity(attrs) {
50431    return new Severity(attrs);
50432  }
50433  static silentPrint(attrs) {
50434    return new SilentPrint(attrs);
50435  }
50436  static staple(attrs) {
50437    return new Staple(attrs);
50438  }
50439  static startNode(attrs) {
50440    return new StartNode(attrs);
50441  }
50442  static startPage(attrs) {
50443    return new StartPage(attrs);
50444  }
50445  static submitFormat(attrs) {
50446    return new SubmitFormat(attrs);
50447  }
50448  static submitUrl(attrs) {
50449    return new SubmitUrl(attrs);
50450  }
50451  static subsetBelow(attrs) {
50452    return new SubsetBelow(attrs);
50453  }
50454  static suppressBanner(attrs) {
50455    return new SuppressBanner(attrs);
50456  }
50457  static tagged(attrs) {
50458    return new Tagged(attrs);
50459  }
50460  static template(attrs) {
50461    return new config_Template(attrs);
50462  }
50463  static templateCache(attrs) {
50464    return new TemplateCache(attrs);
50465  }
50466  static threshold(attrs) {
50467    return new Threshold(attrs);
50468  }
50469  static to(attrs) {
50470    return new To(attrs);
50471  }
50472  static trace(attrs) {
50473    return new Trace(attrs);
50474  }
50475  static transform(attrs) {
50476    return new Transform(attrs);
50477  }
50478  static type(attrs) {
50479    return new Type(attrs);
50480  }
50481  static uri(attrs) {
50482    return new Uri(attrs);
50483  }
50484  static validate(attrs) {
50485    return new config_Validate(attrs);
50486  }
50487  static validateApprovalSignatures(attrs) {
50488    return new ValidateApprovalSignatures(attrs);
50489  }
50490  static validationMessaging(attrs) {
50491    return new ValidationMessaging(attrs);
50492  }
50493  static version(attrs) {
50494    return new Version(attrs);
50495  }
50496  static versionControl(attrs) {
50497    return new VersionControl(attrs);
50498  }
50499  static viewerPreferences(attrs) {
50500    return new ViewerPreferences(attrs);
50501  }
50502  static webClient(attrs) {
50503    return new WebClient(attrs);
50504  }
50505  static whitespace(attrs) {
50506    return new Whitespace(attrs);
50507  }
50508  static window(attrs) {
50509    return new Window(attrs);
50510  }
50511  static xdc(attrs) {
50512    return new Xdc(attrs);
50513  }
50514  static xdp(attrs) {
50515    return new Xdp(attrs);
50516  }
50517  static xsl(attrs) {
50518    return new Xsl(attrs);
50519  }
50520  static zpl(attrs) {
50521    return new Zpl(attrs);
50522  }
50523}
50524
50525;// ./src/core/xfa/connection_set.js
50526
50527
50528const CONNECTION_SET_NS_ID = NamespaceIds.connectionSet.id;
50529class ConnectionSet extends XFAObject {
50530  constructor(attributes) {
50531    super(CONNECTION_SET_NS_ID, "connectionSet", true);
50532    this.wsdlConnection = new XFAObjectArray();
50533    this.xmlConnection = new XFAObjectArray();
50534    this.xsdConnection = new XFAObjectArray();
50535  }
50536}
50537class EffectiveInputPolicy extends XFAObject {
50538  constructor(attributes) {
50539    super(CONNECTION_SET_NS_ID, "effectiveInputPolicy");
50540    this.id = attributes.id || "";
50541    this.name = attributes.name || "";
50542    this.use = attributes.use || "";
50543    this.usehref = attributes.usehref || "";
50544  }
50545}
50546class EffectiveOutputPolicy extends XFAObject {
50547  constructor(attributes) {
50548    super(CONNECTION_SET_NS_ID, "effectiveOutputPolicy");
50549    this.id = attributes.id || "";
50550    this.name = attributes.name || "";
50551    this.use = attributes.use || "";
50552    this.usehref = attributes.usehref || "";
50553  }
50554}
50555class Operation extends StringObject {
50556  constructor(attributes) {
50557    super(CONNECTION_SET_NS_ID, "operation");
50558    this.id = attributes.id || "";
50559    this.input = attributes.input || "";
50560    this.name = attributes.name || "";
50561    this.output = attributes.output || "";
50562    this.use = attributes.use || "";
50563    this.usehref = attributes.usehref || "";
50564  }
50565}
50566class RootElement extends StringObject {
50567  constructor(attributes) {
50568    super(CONNECTION_SET_NS_ID, "rootElement");
50569    this.id = attributes.id || "";
50570    this.name = attributes.name || "";
50571    this.use = attributes.use || "";
50572    this.usehref = attributes.usehref || "";
50573  }
50574}
50575class SoapAction extends StringObject {
50576  constructor(attributes) {
50577    super(CONNECTION_SET_NS_ID, "soapAction");
50578    this.id = attributes.id || "";
50579    this.name = attributes.name || "";
50580    this.use = attributes.use || "";
50581    this.usehref = attributes.usehref || "";
50582  }
50583}
50584class SoapAddress extends StringObject {
50585  constructor(attributes) {
50586    super(CONNECTION_SET_NS_ID, "soapAddress");
50587    this.id = attributes.id || "";
50588    this.name = attributes.name || "";
50589    this.use = attributes.use || "";
50590    this.usehref = attributes.usehref || "";
50591  }
50592}
50593class connection_set_Uri extends StringObject {
50594  constructor(attributes) {
50595    super(CONNECTION_SET_NS_ID, "uri");
50596    this.id = attributes.id || "";
50597    this.name = attributes.name || "";
50598    this.use = attributes.use || "";
50599    this.usehref = attributes.usehref || "";
50600  }
50601}
50602class WsdlAddress extends StringObject {
50603  constructor(attributes) {
50604    super(CONNECTION_SET_NS_ID, "wsdlAddress");
50605    this.id = attributes.id || "";
50606    this.name = attributes.name || "";
50607    this.use = attributes.use || "";
50608    this.usehref = attributes.usehref || "";
50609  }
50610}
50611class WsdlConnection extends XFAObject {
50612  constructor(attributes) {
50613    super(CONNECTION_SET_NS_ID, "wsdlConnection", true);
50614    this.dataDescription = attributes.dataDescription || "";
50615    this.name = attributes.name || "";
50616    this.effectiveInputPolicy = null;
50617    this.effectiveOutputPolicy = null;
50618    this.operation = null;
50619    this.soapAction = null;
50620    this.soapAddress = null;
50621    this.wsdlAddress = null;
50622  }
50623}
50624class XmlConnection extends XFAObject {
50625  constructor(attributes) {
50626    super(CONNECTION_SET_NS_ID, "xmlConnection", true);
50627    this.dataDescription = attributes.dataDescription || "";
50628    this.name = attributes.name || "";
50629    this.uri = null;
50630  }
50631}
50632class XsdConnection extends XFAObject {
50633  constructor(attributes) {
50634    super(CONNECTION_SET_NS_ID, "xsdConnection", true);
50635    this.dataDescription = attributes.dataDescription || "";
50636    this.name = attributes.name || "";
50637    this.rootElement = null;
50638    this.uri = null;
50639  }
50640}
50641class ConnectionSetNamespace {
50642  static [$buildXFAObject](name, attributes) {
50643    if (Object.hasOwn(ConnectionSetNamespace, name)) {
50644      return ConnectionSetNamespace[name](attributes);
50645    }
50646    return undefined;
50647  }
50648  static connectionSet(attrs) {
50649    return new ConnectionSet(attrs);
50650  }
50651  static effectiveInputPolicy(attrs) {
50652    return new EffectiveInputPolicy(attrs);
50653  }
50654  static effectiveOutputPolicy(attrs) {
50655    return new EffectiveOutputPolicy(attrs);
50656  }
50657  static operation(attrs) {
50658    return new Operation(attrs);
50659  }
50660  static rootElement(attrs) {
50661    return new RootElement(attrs);
50662  }
50663  static soapAction(attrs) {
50664    return new SoapAction(attrs);
50665  }
50666  static soapAddress(attrs) {
50667    return new SoapAddress(attrs);
50668  }
50669  static uri(attrs) {
50670    return new connection_set_Uri(attrs);
50671  }
50672  static wsdlAddress(attrs) {
50673    return new WsdlAddress(attrs);
50674  }
50675  static wsdlConnection(attrs) {
50676    return new WsdlConnection(attrs);
50677  }
50678  static xmlConnection(attrs) {
50679    return new XmlConnection(attrs);
50680  }
50681  static xsdConnection(attrs) {
50682    return new XsdConnection(attrs);
50683  }
50684}
50685
50686;// ./src/core/xfa/datasets.js
50687
50688
50689
50690const DATASETS_NS_ID = NamespaceIds.datasets.id;
50691class datasets_Data extends XmlObject {
50692  constructor(attributes) {
50693    super(DATASETS_NS_ID, "data", attributes);
50694  }
50695  [$isNsAgnostic]() {
50696    return true;
50697  }
50698}
50699class Datasets extends XFAObject {
50700  constructor(attributes) {
50701    super(DATASETS_NS_ID, "datasets", true);
50702    this.data = null;
50703    this.Signature = null;
50704  }
50705  [$onChild](child) {
50706    const name = child[$nodeName];
50707    if (name === "data" && child[$namespaceId] === DATASETS_NS_ID || name === "Signature" && child[$namespaceId] === NamespaceIds.signature.id) {
50708      this[name] = child;
50709    }
50710    this[$appendChild](child);
50711  }
50712}
50713class DatasetsNamespace {
50714  static [$buildXFAObject](name, attributes) {
50715    if (Object.hasOwn(DatasetsNamespace, name)) {
50716      return DatasetsNamespace[name](attributes);
50717    }
50718    return undefined;
50719  }
50720  static datasets(attributes) {
50721    return new Datasets(attributes);
50722  }
50723  static data(attributes) {
50724    return new datasets_Data(attributes);
50725  }
50726}
50727
50728;// ./src/core/xfa/locale_set.js
50729
50730
50731
50732const LOCALE_SET_NS_ID = NamespaceIds.localeSet.id;
50733class CalendarSymbols extends XFAObject {
50734  constructor(attributes) {
50735    super(LOCALE_SET_NS_ID, "calendarSymbols", true);
50736    this.name = "gregorian";
50737    this.dayNames = new XFAObjectArray(2);
50738    this.eraNames = null;
50739    this.meridiemNames = null;
50740    this.monthNames = new XFAObjectArray(2);
50741  }
50742}
50743class CurrencySymbol extends StringObject {
50744  constructor(attributes) {
50745    super(LOCALE_SET_NS_ID, "currencySymbol");
50746    this.name = getStringOption(attributes.name, ["symbol", "isoname", "decimal"]);
50747  }
50748}
50749class CurrencySymbols extends XFAObject {
50750  constructor(attributes) {
50751    super(LOCALE_SET_NS_ID, "currencySymbols", true);
50752    this.currencySymbol = new XFAObjectArray(3);
50753  }
50754}
50755class DatePattern extends StringObject {
50756  constructor(attributes) {
50757    super(LOCALE_SET_NS_ID, "datePattern");
50758    this.name = getStringOption(attributes.name, ["full", "long", "med", "short"]);
50759  }
50760}
50761class DatePatterns extends XFAObject {
50762  constructor(attributes) {
50763    super(LOCALE_SET_NS_ID, "datePatterns", true);
50764    this.datePattern = new XFAObjectArray(4);
50765  }
50766}
50767class DateTimeSymbols extends ContentObject {
50768  constructor(attributes) {
50769    super(LOCALE_SET_NS_ID, "dateTimeSymbols");
50770  }
50771}
50772class Day extends StringObject {
50773  constructor(attributes) {
50774    super(LOCALE_SET_NS_ID, "day");
50775  }
50776}
50777class DayNames extends XFAObject {
50778  constructor(attributes) {
50779    super(LOCALE_SET_NS_ID, "dayNames", true);
50780    this.abbr = getInteger({
50781      data: attributes.abbr,
50782      defaultValue: 0,
50783      validate: x => x === 1
50784    });
50785    this.day = new XFAObjectArray(7);
50786  }
50787}
50788class Era extends StringObject {
50789  constructor(attributes) {
50790    super(LOCALE_SET_NS_ID, "era");
50791  }
50792}
50793class EraNames extends XFAObject {
50794  constructor(attributes) {
50795    super(LOCALE_SET_NS_ID, "eraNames", true);
50796    this.era = new XFAObjectArray(2);
50797  }
50798}
50799class locale_set_Locale extends XFAObject {
50800  constructor(attributes) {
50801    super(LOCALE_SET_NS_ID, "locale", true);
50802    this.desc = attributes.desc || "";
50803    this.name = "isoname";
50804    this.calendarSymbols = null;
50805    this.currencySymbols = null;
50806    this.datePatterns = null;
50807    this.dateTimeSymbols = null;
50808    this.numberPatterns = null;
50809    this.numberSymbols = null;
50810    this.timePatterns = null;
50811    this.typeFaces = null;
50812  }
50813}
50814class locale_set_LocaleSet extends XFAObject {
50815  constructor(attributes) {
50816    super(LOCALE_SET_NS_ID, "localeSet", true);
50817    this.locale = new XFAObjectArray();
50818  }
50819}
50820class Meridiem extends StringObject {
50821  constructor(attributes) {
50822    super(LOCALE_SET_NS_ID, "meridiem");
50823  }
50824}
50825class MeridiemNames extends XFAObject {
50826  constructor(attributes) {
50827    super(LOCALE_SET_NS_ID, "meridiemNames", true);
50828    this.meridiem = new XFAObjectArray(2);
50829  }
50830}
50831class Month extends StringObject {
50832  constructor(attributes) {
50833    super(LOCALE_SET_NS_ID, "month");
50834  }
50835}
50836class MonthNames extends XFAObject {
50837  constructor(attributes) {
50838    super(LOCALE_SET_NS_ID, "monthNames", true);
50839    this.abbr = getInteger({
50840      data: attributes.abbr,
50841      defaultValue: 0,
50842      validate: x => x === 1
50843    });
50844    this.month = new XFAObjectArray(12);
50845  }
50846}
50847class NumberPattern extends StringObject {
50848  constructor(attributes) {
50849    super(LOCALE_SET_NS_ID, "numberPattern");
50850    this.name = getStringOption(attributes.name, ["full", "long", "med", "short"]);
50851  }
50852}
50853class NumberPatterns extends XFAObject {
50854  constructor(attributes) {
50855    super(LOCALE_SET_NS_ID, "numberPatterns", true);
50856    this.numberPattern = new XFAObjectArray(4);
50857  }
50858}
50859class NumberSymbol extends StringObject {
50860  constructor(attributes) {
50861    super(LOCALE_SET_NS_ID, "numberSymbol");
50862    this.name = getStringOption(attributes.name, ["decimal", "grouping", "percent", "minus", "zero"]);
50863  }
50864}
50865class NumberSymbols extends XFAObject {
50866  constructor(attributes) {
50867    super(LOCALE_SET_NS_ID, "numberSymbols", true);
50868    this.numberSymbol = new XFAObjectArray(5);
50869  }
50870}
50871class TimePattern extends StringObject {
50872  constructor(attributes) {
50873    super(LOCALE_SET_NS_ID, "timePattern");
50874    this.name = getStringOption(attributes.name, ["full", "long", "med", "short"]);
50875  }
50876}
50877class TimePatterns extends XFAObject {
50878  constructor(attributes) {
50879    super(LOCALE_SET_NS_ID, "timePatterns", true);
50880    this.timePattern = new XFAObjectArray(4);
50881  }
50882}
50883class TypeFace extends XFAObject {
50884  constructor(attributes) {
50885    super(LOCALE_SET_NS_ID, "typeFace", true);
50886    this.name = attributes.name | "";
50887  }
50888}
50889class TypeFaces extends XFAObject {
50890  constructor(attributes) {
50891    super(LOCALE_SET_NS_ID, "typeFaces", true);
50892    this.typeFace = new XFAObjectArray();
50893  }
50894}
50895class LocaleSetNamespace {
50896  static [$buildXFAObject](name, attributes) {
50897    if (Object.hasOwn(LocaleSetNamespace, name)) {
50898      return LocaleSetNamespace[name](attributes);
50899    }
50900    return undefined;
50901  }
50902  static calendarSymbols(attrs) {
50903    return new CalendarSymbols(attrs);
50904  }
50905  static currencySymbol(attrs) {
50906    return new CurrencySymbol(attrs);
50907  }
50908  static currencySymbols(attrs) {
50909    return new CurrencySymbols(attrs);
50910  }
50911  static datePattern(attrs) {
50912    return new DatePattern(attrs);
50913  }
50914  static datePatterns(attrs) {
50915    return new DatePatterns(attrs);
50916  }
50917  static dateTimeSymbols(attrs) {
50918    return new DateTimeSymbols(attrs);
50919  }
50920  static day(attrs) {
50921    return new Day(attrs);
50922  }
50923  static dayNames(attrs) {
50924    return new DayNames(attrs);
50925  }
50926  static era(attrs) {
50927    return new Era(attrs);
50928  }
50929  static eraNames(attrs) {
50930    return new EraNames(attrs);
50931  }
50932  static locale(attrs) {
50933    return new locale_set_Locale(attrs);
50934  }
50935  static localeSet(attrs) {
50936    return new locale_set_LocaleSet(attrs);
50937  }
50938  static meridiem(attrs) {
50939    return new Meridiem(attrs);
50940  }
50941  static meridiemNames(attrs) {
50942    return new MeridiemNames(attrs);
50943  }
50944  static month(attrs) {
50945    return new Month(attrs);
50946  }
50947  static monthNames(attrs) {
50948    return new MonthNames(attrs);
50949  }
50950  static numberPattern(attrs) {
50951    return new NumberPattern(attrs);
50952  }
50953  static numberPatterns(attrs) {
50954    return new NumberPatterns(attrs);
50955  }
50956  static numberSymbol(attrs) {
50957    return new NumberSymbol(attrs);
50958  }
50959  static numberSymbols(attrs) {
50960    return new NumberSymbols(attrs);
50961  }
50962  static timePattern(attrs) {
50963    return new TimePattern(attrs);
50964  }
50965  static timePatterns(attrs) {
50966    return new TimePatterns(attrs);
50967  }
50968  static typeFace(attrs) {
50969    return new TypeFace(attrs);
50970  }
50971  static typeFaces(attrs) {
50972    return new TypeFaces(attrs);
50973  }
50974}
50975
50976;// ./src/core/xfa/signature.js
50977
50978
50979const SIGNATURE_NS_ID = NamespaceIds.signature.id;
50980class signature_Signature extends XFAObject {
50981  constructor(attributes) {
50982    super(SIGNATURE_NS_ID, "signature", true);
50983  }
50984}
50985class SignatureNamespace {
50986  static [$buildXFAObject](name, attributes) {
50987    if (Object.hasOwn(SignatureNamespace, name)) {
50988      return SignatureNamespace[name](attributes);
50989    }
50990    return undefined;
50991  }
50992  static signature(attributes) {
50993    return new signature_Signature(attributes);
50994  }
50995}
50996
50997;// ./src/core/xfa/stylesheet.js
50998
50999
51000const STYLESHEET_NS_ID = NamespaceIds.stylesheet.id;
51001class Stylesheet extends XFAObject {
51002  constructor(attributes) {
51003    super(STYLESHEET_NS_ID, "stylesheet", true);
51004  }
51005}
51006class StylesheetNamespace {
51007  static [$buildXFAObject](name, attributes) {
51008    if (Object.hasOwn(StylesheetNamespace, name)) {
51009      return StylesheetNamespace[name](attributes);
51010    }
51011    return undefined;
51012  }
51013  static stylesheet(attributes) {
51014    return new Stylesheet(attributes);
51015  }
51016}
51017
51018;// ./src/core/xfa/xdp.js
51019
51020
51021
51022const XDP_NS_ID = NamespaceIds.xdp.id;
51023class xdp_Xdp extends XFAObject {
51024  constructor(attributes) {
51025    super(XDP_NS_ID, "xdp", true);
51026    this.uuid = attributes.uuid || "";
51027    this.timeStamp = attributes.timeStamp || "";
51028    this.config = null;
51029    this.connectionSet = null;
51030    this.datasets = null;
51031    this.localeSet = null;
51032    this.stylesheet = new XFAObjectArray();
51033    this.template = null;
51034  }
51035  [$onChildCheck](child) {
51036    const ns = NamespaceIds[child[$nodeName]];
51037    return ns && child[$namespaceId] === ns.id;
51038  }
51039}
51040class XdpNamespace {
51041  static [$buildXFAObject](name, attributes) {
51042    if (Object.hasOwn(XdpNamespace, name)) {
51043      return XdpNamespace[name](attributes);
51044    }
51045    return undefined;
51046  }
51047  static xdp(attributes) {
51048    return new xdp_Xdp(attributes);
51049  }
51050}
51051
51052;// ./src/core/xfa/xhtml.js
51053
51054
51055
51056
51057
51058const XHTML_NS_ID = NamespaceIds.xhtml.id;
51059const $richText = Symbol();
51060const VALID_STYLES = new Set(["color", "font", "font-family", "font-size", "font-stretch", "font-style", "font-weight", "margin", "margin-bottom", "margin-left", "margin-right", "margin-top", "letter-spacing", "line-height", "orphans", "page-break-after", "page-break-before", "page-break-inside", "tab-interval", "tab-stop", "text-align", "text-decoration", "text-indent", "vertical-align", "widows", "kerning-mode", "xfa-font-horizontal-scale", "xfa-font-vertical-scale", "xfa-spacerun", "xfa-tab-stops"]);
51061const StyleMapping = new Map([["page-break-after", "breakAfter"], ["page-break-before", "breakBefore"], ["page-break-inside", "breakInside"], ["kerning-mode", value => value === "none" ? "none" : "normal"], ["xfa-font-horizontal-scale", value => `scaleX(${Math.max(0, parseInt(value, 10) / 100).toFixed(2)})`], ["xfa-font-vertical-scale", value => `scaleY(${Math.max(0, parseInt(value, 10) / 100).toFixed(2)})`], ["xfa-spacerun", ""], ["xfa-tab-stops", ""], ["font-size", (value, original) => {
51062  value = original.fontSize = Math.abs(getMeasurement(value));
51063  return measureToString(0.99 * value);
51064}], ["letter-spacing", value => measureToString(getMeasurement(value))], ["line-height", value => measureToString(getMeasurement(value))], ["margin", value => measureToString(getMeasurement(value))], ["margin-bottom", value => measureToString(getMeasurement(value))], ["margin-left", value => measureToString(getMeasurement(value))], ["margin-right", value => measureToString(getMeasurement(value))], ["margin-top", value => measureToString(getMeasurement(value))], ["text-indent", value => measureToString(getMeasurement(value))], ["font-family", value => value], ["vertical-align", value => measureToString(getMeasurement(value))]]);
vendor: 4,725 bytes, lines 51065-51213
51065const spacesRegExp = /\s+/g;
51066const crlfRegExp = /[\r\n]+/g;
51067const crlfForRichTextRegExp = /\r\n?/g;
51068function mapStyle(styleStr, node, richText) {
51069  const style = Object.create(null);
51070  if (!styleStr) {
51071    return style;
51072  }
51073  const original = Object.create(null);
51074  for (const [key, value] of styleStr.split(";").map(s => s.split(":", 2))) {
51075    const mapping = StyleMapping.get(key);
51076    if (mapping === "") {
51077      continue;
51078    }
51079    let newValue = value;
51080    if (mapping) {
51081      newValue = typeof mapping === "string" ? mapping : mapping(value, original);
51082    }
51083    if (key.endsWith("scale")) {
51084      style.transform = style.transform ? `${style[key]} ${newValue}` : newValue;
51085    } else {
51086      style[key.replaceAll(/-([a-zA-Z])/g, (_, x) => x.toUpperCase())] = newValue;
51087    }
51088  }
51089  if (style.fontFamily) {
51090    setFontFamily({
51091      typeface: style.fontFamily,
51092      weight: style.fontWeight || "normal",
51093      posture: style.fontStyle || "normal",
51094      size: original.fontSize || 0
51095    }, node, node[$globalData].fontFinder, style);
51096  }
51097  if (richText && style.verticalAlign && style.verticalAlign !== "0px" && style.fontSize) {
51098    const SUB_SUPER_SCRIPT_FACTOR = 0.583;
51099    const VERTICAL_FACTOR = 0.333;
51100    const fontSize = getMeasurement(style.fontSize);
51101    style.fontSize = measureToString(fontSize * SUB_SUPER_SCRIPT_FACTOR);
51102    style.verticalAlign = measureToString(Math.sign(getMeasurement(style.verticalAlign)) * fontSize * VERTICAL_FACTOR);
51103  }
51104  if (richText && style.fontSize) {
51105    style.fontSize = `calc(${style.fontSize} * var(--total-scale-factor))`;
51106  }
51107  fixTextIndent(style);
51108  return style;
51109}
51110function checkStyle(node) {
51111  if (!node.style) {
51112    return "";
51113  }
51114  return node.style.split(";").filter(s => !!s.trim()).map(s => s.split(":", 2).map(t => t.trim())).filter(([key, value]) => {
51115    if (key === "font-family") {
51116      node[$globalData].usedTypefaces.add(value);
51117    }
51118    return VALID_STYLES.has(key);
51119  }).map(kv => kv.join(":")).join(";");
51120}
51121const NoWhites = new Set(["body", "html"]);
51122class XhtmlObject extends XmlObject {
51123  constructor(attributes, name) {
51124    super(XHTML_NS_ID, name);
51125    this[$richText] = false;
51126    this.style = attributes.style || "";
51127  }
51128  [$clean](builder) {
51129    super[$clean](builder);
51130    this.style = checkStyle(this);
51131  }
51132  [$acceptWhitespace]() {
51133    return !NoWhites.has(this[$nodeName]);
51134  }
51135  [$onText](str, richText = false) {
51136    if (!richText) {
51137      str = str.replaceAll(crlfRegExp, "");
51138      if (!this.style.includes("xfa-spacerun:yes")) {
51139        str = str.replaceAll(spacesRegExp, " ");
51140      }
51141    } else {
51142      this[$richText] = true;
51143    }
51144    if (str) {
51145      this[$content] += str;
51146    }
51147  }
51148  [$pushGlyphs](measure, mustPop = true) {
51149    const xfaFont = Object.create(null);
51150    const margin = {
51151      top: NaN,
51152      bottom: NaN,
51153      left: NaN,
51154      right: NaN
51155    };
51156    let lineHeight = null;
51157    for (const [key, value] of this.style.split(";").map(s => s.split(":", 2))) {
51158      switch (key) {
51159        case "font-family":
51160          xfaFont.typeface = stripQuotes(value);
51161          break;
51162        case "font-size":
51163          xfaFont.size = getMeasurement(value);
51164          break;
51165        case "font-weight":
51166          xfaFont.weight = value;
51167          break;
51168        case "font-style":
51169          xfaFont.posture = value;
51170          break;
51171        case "letter-spacing":
51172          xfaFont.letterSpacing = getMeasurement(value);
51173          break;
51174        case "margin":
51175          const values = value.split(/ \t/).map(x => getMeasurement(x));
51176          switch (values.length) {
51177            case 1:
51178              margin.top = margin.bottom = margin.left = margin.right = values[0];
51179              break;
51180            case 2:
51181              margin.top = margin.bottom = values[0];
51182              margin.left = margin.right = values[1];
51183              break;
51184            case 3:
51185              margin.top = values[0];
51186              margin.bottom = values[2];
51187              margin.left = margin.right = values[1];
51188              break;
51189            case 4:
51190              margin.top = values[0];
51191              margin.left = values[1];
51192              margin.bottom = values[2];
51193              margin.right = values[3];
51194              break;
51195          }
51196          break;
51197        case "margin-top":
51198          margin.top = getMeasurement(value);
51199          break;
51200        case "margin-bottom":
51201          margin.bottom = getMeasurement(value);
51202          break;
51203        case "margin-left":
51204          margin.left = getMeasurement(value);
51205          break;
51206        case "margin-right":
51207          margin.right = getMeasurement(value);
51208          break;
51209        case "line-height":
51210          lineHeight = getMeasurement(value);
51211          break;
51212      }
51213    }
vendor: 9,313 bytes, lines 51214-51635
51214    measure.pushData(xfaFont, margin, lineHeight);
51215    if (this[$content]) {
51216      measure.addString(this[$content]);
51217    } else {
51218      for (const child of this[$getChildren]()) {
51219        if (child[$nodeName] === "#text") {
51220          measure.addString(child[$content]);
51221          continue;
51222        }
51223        child[$pushGlyphs](measure);
51224      }
51225    }
51226    if (mustPop) {
51227      measure.popFont();
51228    }
51229  }
51230  [$toHTML](availableSpace) {
51231    const children = [];
51232    this[$extra] = {
51233      children
51234    };
51235    this[$childrenToHTML]({});
51236    if (children.length === 0 && !this[$content]) {
51237      return HTMLResult.EMPTY;
51238    }
51239    let value;
51240    if (this[$richText]) {
51241      value = this[$content] ? this[$content].replaceAll(crlfForRichTextRegExp, "\n") : undefined;
51242    } else {
51243      value = this[$content] || undefined;
51244    }
51245    return HTMLResult.success({
51246      name: this[$nodeName],
51247      attributes: {
51248        href: this.href,
51249        style: mapStyle(this.style, this, this[$richText])
51250      },
51251      children,
51252      value
51253    });
51254  }
51255}
51256class A extends XhtmlObject {
51257  constructor(attributes) {
51258    super(attributes, "a");
51259    this.href = fixURL(attributes.href) || "";
51260  }
51261}
51262class B extends XhtmlObject {
51263  constructor(attributes) {
51264    super(attributes, "b");
51265  }
51266  [$pushGlyphs](measure) {
51267    measure.pushFont({
51268      weight: "bold"
51269    });
51270    super[$pushGlyphs](measure);
51271    measure.popFont();
51272  }
51273}
51274class Body extends XhtmlObject {
51275  constructor(attributes) {
51276    super(attributes, "body");
51277  }
51278  [$toHTML](availableSpace) {
51279    const res = super[$toHTML](availableSpace);
51280    const {
51281      html
51282    } = res;
51283    if (!html) {
51284      return HTMLResult.EMPTY;
51285    }
51286    html.name = "div";
51287    html.attributes.class = ["xfaRich"];
51288    return res;
51289  }
51290}
51291class Br extends XhtmlObject {
51292  constructor(attributes) {
51293    super(attributes, "br");
51294  }
51295  [$text]() {
51296    return "\n";
51297  }
51298  [$pushGlyphs](measure) {
51299    measure.addString("\n");
51300  }
51301  [$toHTML](availableSpace) {
51302    return HTMLResult.success({
51303      name: "br"
51304    });
51305  }
51306}
51307class Html extends XhtmlObject {
51308  constructor(attributes) {
51309    super(attributes, "html");
51310  }
51311  [$toHTML](availableSpace) {
51312    const children = [];
51313    this[$extra] = {
51314      children
51315    };
51316    this[$childrenToHTML]({});
51317    if (children.length === 0) {
51318      return HTMLResult.success({
51319        name: "div",
51320        attributes: {
51321          class: ["xfaRich"],
51322          style: {}
51323        },
51324        value: this[$content] || ""
51325      });
51326    }
51327    if (children.length === 1) {
51328      const child = children[0];
51329      if (child.attributes?.class.includes("xfaRich")) {
51330        return HTMLResult.success(child);
51331      }
51332    }
51333    return HTMLResult.success({
51334      name: "div",
51335      attributes: {
51336        class: ["xfaRich"],
51337        style: {}
51338      },
51339      children
51340    });
51341  }
51342}
51343class I extends XhtmlObject {
51344  constructor(attributes) {
51345    super(attributes, "i");
51346  }
51347  [$pushGlyphs](measure) {
51348    measure.pushFont({
51349      posture: "italic"
51350    });
51351    super[$pushGlyphs](measure);
51352    measure.popFont();
51353  }
51354}
51355class Li extends XhtmlObject {
51356  constructor(attributes) {
51357    super(attributes, "li");
51358  }
51359}
51360class Ol extends XhtmlObject {
51361  constructor(attributes) {
51362    super(attributes, "ol");
51363  }
51364}
51365class P extends XhtmlObject {
51366  constructor(attributes) {
51367    super(attributes, "p");
51368  }
51369  [$pushGlyphs](measure) {
51370    super[$pushGlyphs](measure, false);
51371    measure.addString("\n");
51372    measure.addPara();
51373    measure.popFont();
51374  }
51375  [$text]() {
51376    const siblings = this[$getParent]()[$getChildren]();
51377    if (siblings.at(-1) === this) {
51378      return super[$text]();
51379    }
51380    return super[$text]() + "\n";
51381  }
51382}
51383class Span extends XhtmlObject {
51384  constructor(attributes) {
51385    super(attributes, "span");
51386  }
51387}
51388class Sub extends XhtmlObject {
51389  constructor(attributes) {
51390    super(attributes, "sub");
51391  }
51392}
51393class Sup extends XhtmlObject {
51394  constructor(attributes) {
51395    super(attributes, "sup");
51396  }
51397}
51398class Ul extends XhtmlObject {
51399  constructor(attributes) {
51400    super(attributes, "ul");
51401  }
51402}
51403class XhtmlNamespace {
51404  static [$buildXFAObject](name, attributes) {
51405    if (Object.hasOwn(XhtmlNamespace, name)) {
51406      return XhtmlNamespace[name](attributes);
51407    }
51408    return undefined;
51409  }
51410  static a(attributes) {
51411    return new A(attributes);
51412  }
51413  static b(attributes) {
51414    return new B(attributes);
51415  }
51416  static body(attributes) {
51417    return new Body(attributes);
51418  }
51419  static br(attributes) {
51420    return new Br(attributes);
51421  }
51422  static html(attributes) {
51423    return new Html(attributes);
51424  }
51425  static i(attributes) {
51426    return new I(attributes);
51427  }
51428  static li(attributes) {
51429    return new Li(attributes);
51430  }
51431  static ol(attributes) {
51432    return new Ol(attributes);
51433  }
51434  static p(attributes) {
51435    return new P(attributes);
51436  }
51437  static span(attributes) {
51438    return new Span(attributes);
51439  }
51440  static sub(attributes) {
51441    return new Sub(attributes);
51442  }
51443  static sup(attributes) {
51444    return new Sup(attributes);
51445  }
51446  static ul(attributes) {
51447    return new Ul(attributes);
51448  }
51449}
51450
51451;// ./src/core/xfa/setup.js
51452
51453
51454
51455
51456
51457
51458
51459
51460
51461const NamespaceSetUp = {
51462  config: ConfigNamespace,
51463  connection: ConnectionSetNamespace,
51464  datasets: DatasetsNamespace,
51465  localeSet: LocaleSetNamespace,
51466  signature: SignatureNamespace,
51467  stylesheet: StylesheetNamespace,
51468  template: TemplateNamespace,
51469  xdp: XdpNamespace,
51470  xhtml: XhtmlNamespace
51471};
51472
51473;// ./src/core/xfa/unknown.js
51474
51475
51476class UnknownNamespace {
51477  constructor(nsId) {
51478    this.namespaceId = nsId;
51479  }
51480  [$buildXFAObject](name, attributes) {
51481    return new XmlObject(this.namespaceId, name, attributes);
51482  }
51483}
51484
51485;// ./src/core/xfa/builder.js
51486
51487
51488
51489
51490
51491
51492
51493class Root extends XFAObject {
51494  constructor(ids) {
51495    super(-1, "root", Object.create(null));
51496    this.element = null;
51497    this[$ids] = ids;
51498  }
51499  [$onChild](child) {
51500    this.element = child;
51501    return true;
51502  }
51503  [$finalize]() {
51504    super[$finalize]();
51505    if (this.element.template instanceof Template) {
51506      this[$ids].set($root, this.element);
51507      this.element.template[$resolvePrototypes](this[$ids]);
51508      this.element.template[$ids] = this[$ids];
51509    }
51510  }
51511}
51512class Empty extends XFAObject {
51513  constructor() {
51514    super(-1, "", Object.create(null));
51515  }
51516  [$onChild](_) {
51517    return false;
51518  }
51519}
51520class Builder {
51521  constructor(rootNameSpace = null) {
51522    this._namespaceStack = [];
51523    this._nsAgnosticLevel = 0;
51524    this._namespacePrefixes = new Map();
51525    this._namespaces = new Map();
51526    this._nextNsId = Math.max(...Object.values(NamespaceIds).map(({
51527      id
51528    }) => id));
51529    this._currentNamespace = rootNameSpace || new UnknownNamespace(++this._nextNsId);
51530  }
51531  buildRoot(ids) {
51532    return new Root(ids);
51533  }
51534  build({
51535    nsPrefix,
51536    name,
51537    attributes,
51538    namespace,
51539    prefixes
51540  }) {
51541    const hasNamespaceDef = namespace !== null;
51542    if (hasNamespaceDef) {
51543      this._namespaceStack.push(this._currentNamespace);
51544      this._currentNamespace = this._searchNamespace(namespace);
51545    }
51546    if (prefixes) {
51547      this._addNamespacePrefix(prefixes);
51548    }
51549    if (Object.hasOwn(attributes, $nsAttributes)) {
51550      const dataTemplate = NamespaceSetUp.datasets;
51551      const nsAttrs = attributes[$nsAttributes];
51552      let xfaAttrs = null;
51553      for (const [ns, attrs] of Object.entries(nsAttrs)) {
51554        const nsToUse = this._getNamespaceToUse(ns);
51555        if (nsToUse === dataTemplate) {
51556          xfaAttrs = {
51557            xfa: attrs
51558          };
51559          break;
51560        }
51561      }
51562      if (xfaAttrs) {
51563        attributes[$nsAttributes] = xfaAttrs;
51564      } else {
51565        delete attributes[$nsAttributes];
51566      }
51567    }
51568    const namespaceToUse = this._getNamespaceToUse(nsPrefix);
51569    const node = namespaceToUse?.[$buildXFAObject](name, attributes) || new Empty();
51570    if (node[$isNsAgnostic]()) {
51571      this._nsAgnosticLevel++;
51572    }
51573    if (hasNamespaceDef || prefixes || node[$isNsAgnostic]()) {
51574      node[$cleanup] = {
51575        hasNamespace: hasNamespaceDef,
51576        prefixes,
51577        nsAgnostic: node[$isNsAgnostic]()
51578      };
51579    }
51580    return node;
51581  }
51582  isNsAgnostic() {
51583    return this._nsAgnosticLevel > 0;
51584  }
51585  _searchNamespace(nsName) {
51586    let ns = this._namespaces.get(nsName);
51587    if (ns) {
51588      return ns;
51589    }
51590    for (const [name, {
51591      check
51592    }] of Object.entries(NamespaceIds)) {
51593      if (check(nsName)) {
51594        ns = NamespaceSetUp[name];
51595        if (ns) {
51596          this._namespaces.set(nsName, ns);
51597          return ns;
51598        }
51599        break;
51600      }
51601    }
51602    ns = new UnknownNamespace(++this._nextNsId);
51603    this._namespaces.set(nsName, ns);
51604    return ns;
51605  }
51606  _addNamespacePrefix(prefixes) {
51607    for (const {
51608      prefix,
51609      value
51610    } of prefixes) {
51611      const namespace = this._searchNamespace(value);
51612      this._namespacePrefixes.getOrInsertComputed(prefix, makeArr).push(namespace);
51613    }
51614  }
51615  _getNamespaceToUse(prefix) {
51616    if (!prefix) {
51617      return this._currentNamespace;
51618    }
51619    const prefixStack = this._namespacePrefixes.get(prefix);
51620    if (prefixStack?.length > 0) {
51621      return prefixStack.at(-1);
51622    }
51623    warn(`Unknown namespace prefix: ${prefix}.`);
51624    return null;
51625  }
51626  clean(data) {
51627    const {
51628      hasNamespace,
51629      prefixes,
51630      nsAgnostic
51631    } = data;
51632    if (hasNamespace) {
51633      this._currentNamespace = this._namespaceStack.pop();
51634    }
51635    
vendor: 20,041 bytes, lines 51635-52282
51635if (prefixes) {
51636      prefixes.forEach(({
51637        prefix
51638      }) => {
51639        this._namespacePrefixes.get(prefix).pop();
51640      });
51641    }
51642    if (nsAgnostic) {
51643      this._nsAgnosticLevel--;
51644    }
51645  }
51646}
51647
51648;// ./src/core/xfa/parser.js
51649
51650
51651
51652
51653class XFAParser extends XMLParserBase {
51654  constructor(rootNameSpace = null, richText = false) {
51655    super();
51656    this._builder = new Builder(rootNameSpace);
51657    this._stack = [];
51658    this._globalData = {
51659      usedTypefaces: new Set()
51660    };
51661    this._ids = new Map();
51662    this._current = this._builder.buildRoot(this._ids);
51663    this._errorCode = XMLParserErrorCode.NoError;
51664    this._whiteRegex = /^\s+$/;
51665    this._nbsps = /\xa0+/g;
51666    this._richText = richText;
51667  }
51668  parse(data) {
51669    this.parseXml(data);
51670    if (this._errorCode !== XMLParserErrorCode.NoError) {
51671      return undefined;
51672    }
51673    this._current[$finalize]();
51674    return this._current.element;
51675  }
51676  onText(text) {
51677    text = text.replace(this._nbsps, match => match.slice(1) + " ");
51678    if (this._richText || this._current[$acceptWhitespace]()) {
51679      this._current[$onText](text, this._richText);
51680      return;
51681    }
51682    if (this._whiteRegex.test(text)) {
51683      return;
51684    }
51685    this._current[$onText](text.trim());
51686  }
51687  onCdata(text) {
51688    this._current[$onText](text);
51689  }
51690  _mkAttributes(attributes, tagName) {
51691    let namespace = null;
51692    let prefixes = null;
51693    const attributeObj = Object.create({});
51694    for (const {
51695      name,
51696      value
51697    } of attributes) {
51698      if (name === "xmlns") {
51699        if (!namespace) {
51700          namespace = value;
51701        } else {
51702          warn(`XFA - multiple namespace definition in <${tagName}>`);
51703        }
51704      } else if (name.startsWith("xmlns:")) {
51705        const prefix = name.substring("xmlns:".length);
51706        prefixes ??= [];
51707        prefixes.push({
51708          prefix,
51709          value
51710        });
51711      } else {
51712        const i = name.indexOf(":");
51713        if (i === -1) {
51714          attributeObj[name] = value;
51715        } else {
51716          const nsAttrs = attributeObj[$nsAttributes] ??= Object.create(null);
51717          const [ns, attrName] = [name.slice(0, i), name.slice(i + 1)];
51718          const attrs = nsAttrs[ns] ||= Object.create(null);
51719          attrs[attrName] = value;
51720        }
51721      }
51722    }
51723    return [namespace, prefixes, attributeObj];
51724  }
51725  _getNameAndPrefix(name, nsAgnostic) {
51726    const i = name.indexOf(":");
51727    if (i === -1) {
51728      return [name, null];
51729    }
51730    return [name.substring(i + 1), nsAgnostic ? "" : name.substring(0, i)];
51731  }
51732  onBeginElement(tagName, attributes, isEmpty) {
51733    const [namespace, prefixes, attributesObj] = this._mkAttributes(attributes, tagName);
51734    const [name, nsPrefix] = this._getNameAndPrefix(tagName, this._builder.isNsAgnostic());
51735    const node = this._builder.build({
51736      nsPrefix,
51737      name,
51738      attributes: attributesObj,
51739      namespace,
51740      prefixes
51741    });
51742    node[$globalData] = this._globalData;
51743    if (isEmpty) {
51744      node[$finalize]();
51745      if (this._current[$onChild](node)) {
51746        node[$setId](this._ids);
51747      }
51748      node[$clean](this._builder);
51749      return;
51750    }
51751    this._stack.push(this._current);
51752    this._current = node;
51753  }
51754  onEndElement(name) {
51755    const node = this._current;
51756    if (node[$isCDATAXml]() && typeof node[$content] === "string") {
51757      const parser = new XFAParser();
51758      parser._globalData = this._globalData;
51759      const root = parser.parse(node[$content]);
51760      node[$content] = null;
51761      node[$onChild](root);
51762    }
51763    node[$finalize]();
51764    this._current = this._stack.pop();
51765    if (this._current[$onChild](node)) {
51766      node[$setId](this._ids);
51767    }
51768    node[$clean](this._builder);
51769  }
51770  onError(code) {
51771    this._errorCode = code;
51772  }
51773}
51774
51775;// ./src/core/xfa/factory.js
51776
51777
51778
51779
51780
51781
51782
51783
51784class XFAFactory {
51785  constructor(data) {
51786    try {
51787      this.root = new XFAParser().parse(XFAFactory._createDocument(data));
51788      const binder = new Binder(this.root);
51789      this.form = binder.bind();
51790      this.dataHandler = new DataHandler(this.root, binder.getData());
51791      this.form[$globalData].template = this.form;
51792    } catch (e) {
51793      warn(`XFA - an error occurred during parsing and binding: ${e}`);
51794    }
51795  }
51796  isValid() {
51797    return !!(this.root && this.form);
51798  }
51799  _createPagesHelper() {
51800    const iterator = this.form[$toPages]();
51801    return new Promise((resolve, reject) => {
51802      const nextIteration = () => {
51803        try {
51804          const value = iterator.next();
51805          if (value.done) {
51806            resolve(value.value);
51807          } else {
51808            setTimeout(nextIteration, 0);
51809          }
51810        } catch (e) {
51811          reject(e);
51812        }
51813      };
51814      setTimeout(nextIteration, 0);
51815    });
51816  }
51817  async _createPages() {
51818    try {
51819      this.pages = await this._createPagesHelper();
51820      this.dims = this.pages.children.map(c => {
51821        const {
51822          width,
51823          height
51824        } = c.attributes.style;
51825        return [0, 0, parseInt(width, 10), parseInt(height, 10)];
51826      });
51827    } catch (e) {
51828      warn(`XFA - an error occurred during layout: ${e}`);
51829    }
51830  }
51831  getBoundingBox(pageIndex) {
51832    return this.dims[pageIndex];
51833  }
51834  async getNumPages() {
51835    if (!this.pages) {
51836      await this._createPages();
51837    }
51838    return this.dims.length;
51839  }
51840  setImages(images) {
51841    this.form[$globalData].images = images;
51842  }
51843  setFonts(fonts) {
51844    this.form[$globalData].fontFinder = new FontFinder(fonts);
51845    const missingFonts = [];
51846    for (let typeface of this.form[$globalData].usedTypefaces) {
51847      typeface = stripQuotes(typeface);
51848      const font = this.form[$globalData].fontFinder.find(typeface);
51849      if (!font) {
51850        missingFonts.push(typeface);
51851      }
51852    }
51853    if (missingFonts.length > 0) {
51854      return missingFonts;
51855    }
51856    return null;
51857  }
51858  appendFonts(fonts, reallyMissingFonts) {
51859    this.form[$globalData].fontFinder.add(fonts, reallyMissingFonts);
51860  }
51861  async getPages() {
51862    if (!this.pages) {
51863      await this._createPages();
51864    }
51865    const pages = this.pages;
51866    this.pages = null;
51867    return pages;
51868  }
51869  serializeData(storage) {
51870    return this.dataHandler.serialize(storage);
51871  }
51872  static _createDocument(data) {
51873    if (!data["/xdp:xdp"]) {
51874      return data["xdp:xdp"];
51875    }
51876    return Object.values(data).join("");
51877  }
51878  static getRichTextAsHtml(rc) {
51879    if (!rc || typeof rc !== "string") {
51880      return null;
51881    }
51882    try {
51883      let root = new XFAParser(XhtmlNamespace, true).parse(rc);
51884      if (!["body", "xhtml"].includes(root[$nodeName])) {
51885        const newRoot = XhtmlNamespace.body({});
51886        newRoot[$appendChild](root);
51887        root = newRoot;
51888      }
51889      const result = root[$toHTML]();
51890      if (!result.success) {
51891        return null;
51892      }
51893      const {
51894        html
51895      } = result;
51896      const {
51897        attributes
51898      } = html;
51899      if (attributes) {
51900        if (attributes.class) {
51901          attributes.class = attributes.class.filter(attr => !attr.startsWith("xfa"));
51902        }
51903        attributes.dir = "auto";
51904      }
51905      return {
51906        html,
51907        str: root[$text]()
51908      };
51909    } catch (e) {
51910      warn(`XFA - an error occurred during parsing of rich text: ${e}`);
51911    }
51912    return null;
51913  }
51914}
51915
51916;// ./src/core/annotation.js
51917
51918
51919
51920
51921
51922
51923
51924
51925
51926
51927
51928
51929
51930
51931
51932class AnnotationFactory {
51933  static createGlobals(pdfManager) {
51934    return Promise.all([pdfManager.ensureCatalog("acroForm"), pdfManager.ensureDoc("xfaDatasets"), pdfManager.ensureCatalog("structTreeRoot"), pdfManager.ensureCatalog("baseUrl"), pdfManager.ensureCatalog("attachments"), pdfManager.ensureCatalog("globalColorSpaceCache")]).then(([acroForm, xfaDatasets, structTreeRoot, baseUrl, attachments, globalColorSpaceCache]) => ({
51935      pdfManager,
51936      acroForm: acroForm instanceof Dict ? acroForm : Dict.empty,
51937      xfaDatasets,
51938      structTreeRoot,
51939      baseUrl,
51940      attachments,
51941      globalColorSpaceCache
51942    }), reason => {
51943      warn(`createGlobals: "${reason}".`);
51944      return null;
51945    });
51946  }
51947  static async create(xref, ref, annotationGlobals, idFactory, collectFields, orphanFields, collectByType, pageRef) {
51948    const pageIndex = collectFields ? await this._getPageIndex(xref, ref, annotationGlobals.pdfManager) : null;
51949    return annotationGlobals.pdfManager.ensure(this, "_create", [xref, ref, annotationGlobals, idFactory, collectFields, orphanFields, collectByType, pageIndex, pageRef]);
51950  }
51951  static _create(xref, ref, annotationGlobals, idFactory, collectFields = false, orphanFields = null, collectByType = null, pageIndex = null, pageRef = null) {
51952    const dict = xref.fetchIfRef(ref);
51953    if (!(dict instanceof Dict)) {
51954      return undefined;
51955    }
51956    let subtype = dict.get("Subtype");
51957    subtype = subtype instanceof Name ? subtype.name : null;
51958    if (collectByType && !collectByType.has(AnnotationType[subtype?.toUpperCase()])) {
51959      return null;
51960    }
51961    const {
51962      acroForm,
51963      pdfManager
51964    } = annotationGlobals;
51965    const id = ref instanceof Ref ? ref.toString() : `annot_${idFactory.createObjId()}`;
51966    const parameters = {
51967      xref,
51968      ref,
51969      dict,
51970      subtype,
51971      id,
51972      annotationGlobals,
51973      collectFields,
51974      orphanFields,
51975      needAppearances: !collectFields && acroForm.get("NeedAppearances") === true,
51976      pageIndex,
51977      evaluatorOptions: pdfManager.evaluatorOptions,
51978      pageRef
51979    };
51980    switch (subtype) {
51981      case "Link":
51982        return new LinkAnnotation(parameters);
51983      case "Text":
51984        return new TextAnnotation(parameters);
51985      case "Widget":
51986        let fieldType = getInheritableProperty({
51987          dict,
51988          key: "FT"
51989        });
51990        fieldType = fieldType instanceof Name ? fieldType.name : null;
51991        switch (fieldType) {
51992          case "Tx":
51993            return new TextWidgetAnnotation(parameters);
51994          case "Btn":
51995            return new ButtonWidgetAnnotation(parameters);
51996          case "Ch":
51997            return new ChoiceWidgetAnnotation(parameters);
51998          case "Sig":
51999            return new SignatureWidgetAnnotation(parameters);
52000        }
52001        warn(`Unimplemented widget field type "${fieldType}", ` + "falling back to base field type.");
52002        return new WidgetAnnotation(parameters);
52003      case "Popup":
52004        return new PopupAnnotation(parameters);
52005      case "FreeText":
52006        return new FreeTextAnnotation(parameters);
52007      case "Line":
52008        return new LineAnnotation(parameters);
52009      case "Square":
52010        return new SquareAnnotation(parameters);
52011      case "Circle":
52012        return new CircleAnnotation(parameters);
52013      case "PolyLine":
52014        return new PolylineAnnotation(parameters);
52015      case "Polygon":
52016        return new PolygonAnnotation(parameters);
52017      case "Caret":
52018        return new CaretAnnotation(parameters);
52019      case "Ink":
52020        return new InkAnnotation(parameters);
52021      case "Highlight":
52022        return new HighlightAnnotation(parameters);
52023      case "Underline":
52024        return new UnderlineAnnotation(parameters);
52025      case "Squiggly":
52026        return new SquigglyAnnotation(parameters);
52027      case "StrikeOut":
52028        return new StrikeOutAnnotation(parameters);
52029      case "Stamp":
52030        return new StampAnnotation(parameters);
52031      case "FileAttachment":
52032        return new FileAttachmentAnnotation(parameters);
52033      default:
52034        if (!collectFields) {
52035          if (!subtype) {
52036            warn("Annotation is missing the required /Subtype.");
52037          } else {
52038            warn(`Unimplemented annotation type "${subtype}", ` + "falling back to base annotation.");
52039          }
52040        }
52041        return new Annotation(parameters);
52042    }
52043  }
52044  static async _getPageIndex(xref, ref, pdfManager) {
52045    try {
52046      const annotDict = await xref.fetchIfRefAsync(ref);
52047      if (!(annotDict instanceof Dict)) {
52048        return -1;
52049      }
52050      const pageRef = annotDict.getRaw("P");
52051      if (pageRef instanceof Ref) {
52052        try {
52053          const pageIndex = await pdfManager.ensureCatalog("getPageIndex", [pageRef]);
52054          return pageIndex;
52055        } catch (ex) {
52056          info(`_getPageIndex -- not a valid page reference: "${ex}".`);
52057        }
52058      }
52059      if (annotDict.has("Kids")) {
52060        return -1;
52061      }
52062      const numPages = await pdfManager.ensureDoc("numPages");
52063      for (let pageIndex = 0; pageIndex < numPages; pageIndex++) {
52064        const page = await pdfManager.getPage(pageIndex);
52065        const annotations = await pdfManager.ensure(page, "annotations");
52066        for (const annotRef of annotations) {
52067          if (annotRef instanceof Ref && isRefsEqual(annotRef, ref)) {
52068            return pageIndex;
52069          }
52070        }
52071      }
52072    } catch (ex) {
52073      warn(`_getPageIndex: "${ex}".`);
52074    }
52075    return -1;
52076  }
52077  static generateImages(annotations, xref, isOffscreenCanvasSupported) {
52078    if (!isOffscreenCanvasSupported) {
52079      warn("generateImages: OffscreenCanvas is not supported, cannot save or print some annotations with images.");
52080      return null;
52081    }
52082    let imagePromises;
52083    for (const {
52084      bitmapId,
52085      bitmap
52086    } of annotations) {
52087      if (!bitmap) {
52088        continue;
52089      }
52090      imagePromises ||= new Map();
52091      imagePromises.set(bitmapId, StampAnnotation.createImage(bitmap, xref));
52092    }
52093    return imagePromises;
52094  }
52095  static async saveNewAnnotations(evaluator, xref, task, annotations, imagePromises, changes) {
52096    let baseFontRef;
52097    const promises = [];
52098    const {
52099      isOffscreenCanvasSupported
52100    } = evaluator.options;
52101    for (const annotation of annotations) {
52102      if (annotation.deleted) {
52103        continue;
52104      }
52105      switch (annotation.annotationType) {
52106        case AnnotationEditorType.FREETEXT:
52107          if (!baseFontRef) {
52108            const baseFont = new Dict(xref);
52109            baseFont.setIfName("BaseFont", "Helvetica");
52110            baseFont.setIfName("Type", "Font");
52111            baseFont.setIfName("Subtype", "Type1");
52112            baseFont.setIfName("Encoding", "WinAnsiEncoding");
52113            baseFontRef = xref.getNewTemporaryRef();
52114            changes.put(baseFontRef, {
52115              data: baseFont
52116            });
52117          }
52118          promises.push(FreeTextAnnotation.createNewAnnotation(xref, annotation, changes, {
52119            evaluator,
52120            task,
52121            baseFontRef
52122          }));
52123          break;
52124        case AnnotationEditorType.HIGHLIGHT:
52125          if (annotation.quadPoints) {
52126            promises.push(HighlightAnnotation.createNewAnnotation(xref, annotation, changes));
52127          } else {
52128            promises.push(InkAnnotation.createNewAnnotation(xref, annotation, changes));
52129          }
52130          break;
52131        case AnnotationEditorType.INK:
52132          promises.push(InkAnnotation.createNewAnnotation(xref, annotation, changes));
52133          break;
52134        case AnnotationEditorType.STAMP:
52135          const image = isOffscreenCanvasSupported ? await imagePromises?.get(annotation.bitmapId) : null;
52136          if (image?.imageStream) {
52137            const {
52138              imageStream,
52139              smaskStream
52140            } = image;
52141            if (smaskStream) {
52142              const smaskRef = xref.getNewTemporaryRef();
52143              changes.put(smaskRef, {
52144                data: smaskStream
52145              });
52146              imageStream.dict.set("SMask", smaskRef);
52147            }
52148            const imageRef = image.imageRef = xref.getNewTemporaryRef();
52149            changes.put(imageRef, {
52150              data: imageStream
52151            });
52152            image.imageStream = image.smaskStream = null;
52153          }
52154          promises.push(StampAnnotation.createNewAnnotation(xref, annotation, changes, {
52155            image
52156          }));
52157          break;
52158        case AnnotationEditorType.SIGNATURE:
52159          promises.push(StampAnnotation.createNewAnnotation(xref, annotation, changes, {}));
52160          break;
52161      }
52162    }
52163    return {
52164      annotations: (await Promise.all(promises)).flat()
52165    };
52166  }
52167  static async printNewAnnotations(annotationGlobals, evaluator, task, annotations, imagePromises) {
52168    if (!annotations) {
52169      return null;
52170    }
52171    const {
52172      options,
52173      xref
52174    } = evaluator;
52175    const promises = [];
52176    for (const annotation of annotations) {
52177      if (annotation.deleted) {
52178        continue;
52179      }
52180      switch (annotation.annotationType) {
52181        case AnnotationEditorType.FREETEXT:
52182          promises.push(FreeTextAnnotation.createNewPrintAnnotation(annotationGlobals, xref, annotation, {
52183            evaluator,
52184            task,
52185            evaluatorOptions: options
52186          }));
52187          break;
52188        case AnnotationEditorType.HIGHLIGHT:
52189          if (annotation.quadPoints) {
52190            promises.push(HighlightAnnotation.createNewPrintAnnotation(annotationGlobals, xref, annotation, {
52191              evaluatorOptions: options
52192            }));
52193          } else {
52194            promises.push(InkAnnotation.createNewPrintAnnotation(annotationGlobals, xref, annotation, {
52195              evaluatorOptions: options
52196            }));
52197          }
52198          break;
52199        case AnnotationEditorType.INK:
52200          promises.push(InkAnnotation.createNewPrintAnnotation(annotationGlobals, xref, annotation, {
52201            evaluatorOptions: options
52202          }));
52203          break;
52204        case AnnotationEditorType.STAMP:
52205          const image = options.isOffscreenCanvasSupported ? await imagePromises?.get(annotation.bitmapId) : null;
52206          if (image?.imageStream) {
52207            const {
52208              imageStream,
52209              smaskStream
52210            } = image;
52211            if (smaskStream) {
52212              imageStream.dict.set("SMask", smaskStream);
52213            }
52214            image.imageRef = new JpegStream(imageStream, imageStream.length);
52215            image.imageStream = image.smaskStream = null;
52216          }
52217          promises.push(StampAnnotation.createNewPrintAnnotation(annotationGlobals, xref, annotation, {
52218            image,
52219            evaluatorOptions: options
52220          }));
52221          break;
52222        case AnnotationEditorType.SIGNATURE:
52223          promises.push(StampAnnotation.createNewPrintAnnotation(annotationGlobals, xref, annotation, {
52224            evaluatorOptions: options
52225          }));
52226          break;
52227      }
52228    }
52229    return Promise.all(promises);
52230  }
52231}
52232function getRgbColor(color, defaultColor = new Uint8ClampedArray(3)) {
52233  if (!Array.isArray(color)) {
52234    return defaultColor;
52235  }
52236  const rgbColor = defaultColor || new Uint8ClampedArray(3);
52237  switch (color.length) {
52238    case 0:
52239      return null;
52240    case 1:
52241      ColorSpaceUtils.gray.getRgbItem(color, 0, rgbColor, 0);
52242      return rgbColor;
52243    case 3:
52244      ColorSpaceUtils.rgb.getRgbItem(color, 0, rgbColor, 0);
52245      return rgbColor;
52246    case 4:
52247      ColorSpaceUtils.cmyk.getRgbItem(color, 0, rgbColor, 0);
52248      return rgbColor;
52249    default:
52250      return defaultColor;
52251  }
52252}
52253function getPdfColorArray(color, defaultValue = null) {
52254  return color && Array.from(color, c => c / 255) || defaultValue;
52255}
52256function getQuadPoints(dict, rect) {
52257  const quadPoints = dict.getArray("QuadPoints");
52258  if (!isNumberArray(quadPoints, null) || quadPoints.length === 0 || quadPoints.length % 8 > 0) {
52259    return null;
52260  }
52261  const newQuadPoints = new Float32Array(quadPoints.length);
52262  for (let i = 0, ii = quadPoints.length; i < ii; i += 8) {
52263    const [x1, y1, x2, y2, x3, y3, x4, y4] = quadPoints.slice(i, i + 8);
52264    const minX = Math.min(x1, x2, x3, x4);
52265    const maxX = Math.max(x1, x2, x3, x4);
52266    const minY = Math.min(y1, y2, y3, y4);
52267    const maxY = Math.max(y1, y2, y3, y4);
52268    if (rect !== null && (minX < rect[0] || maxX > rect[2] || minY < rect[1] || maxY > rect[3])) {
52269      return null;
52270    }
52271    newQuadPoints.set([minX, maxY, maxX, maxY, minX, minY, maxX, minY], i);
52272  }
52273  return newQuadPoints;
52274}
52275function getTransformMatrix(rect, bbox, matrix) {
52276  const minMax = F32_BBOX_INIT.slice();
52277  Util.axialAlignedBoundingBox(bbox, matrix, minMax);
52278  const [minX, minY, maxX, maxY] = minMax;
52279  if (minX === maxX || minY === maxY) {
52280    return [1, 0, 0, 1, rect[0], rect[1]];
52281  }
52282  const xRatio = (rect[2] - rect[0]) / (maxX - minX);
vendor: 9,708 bytes, lines 52283-52589
52283  const yRatio = (rect[3] - rect[1]) / (maxY - minY);
52284  return [xRatio, 0, 0, yRatio, rect[0] - minX * xRatio, rect[1] - minY * yRatio];
52285}
52286class Annotation {
52287  constructor(params) {
52288    const {
52289      annotationGlobals,
52290      dict,
52291      orphanFields,
52292      ref,
52293      subtype,
52294      xref
52295    } = params;
52296    const parentRef = orphanFields?.get(ref);
52297    if (parentRef) {
52298      dict.set("Parent", parentRef);
52299    }
52300    this.setTitle(dict.get("T"));
52301    this.setContents(dict.get("Contents"));
52302    this.setModificationDate(dict.get("M"));
52303    this.setFlags(dict.get("F"));
52304    this.setRectangle(dict.getArray("Rect"));
52305    this.setColor(dict.getArray("C"));
52306    this.setBorderStyle(dict);
52307    this.setAppearance(dict);
52308    this.setOptionalContent(dict);
52309    const MK = dict.get("MK");
52310    this.setBorderAndBackgroundColors(MK);
52311    this.setRotation(MK, dict);
52312    this.ref = params.ref instanceof Ref ? params.ref : null;
52313    this._streams = [];
52314    if (this.appearance) {
52315      this._streams.push(this.appearance);
52316    }
52317    const isLocked = !!(this.flags & AnnotationFlag.LOCKED);
52318    const isContentLocked = !!(this.flags & AnnotationFlag.LOCKEDCONTENTS);
52319    this.data = {
52320      annotationType: AnnotationType[subtype?.toUpperCase()],
52321      annotationFlags: this.flags,
52322      borderStyle: this.borderStyle,
52323      color: this.color,
52324      backgroundColor: this.backgroundColor,
52325      borderColor: this.borderColor,
52326      rotation: this.rotation,
52327      contentsObj: this._contents,
52328      hasAppearance: !!this.appearance,
52329      id: params.id,
52330      modificationDate: this.modificationDate,
52331      rect: this.rectangle,
52332      subtype,
52333      hasOwnCanvas: false,
52334      noRotate: !!(this.flags & AnnotationFlag.NOROTATE),
52335      noHTML: isLocked && isContentLocked,
52336      isEditable: false,
52337      structParent: -1
52338    };
52339    if (annotationGlobals.structTreeRoot) {
52340      let structParent = dict.get("StructParent");
52341      this.data.structParent = structParent = Number.isInteger(structParent) && structParent >= 0 ? structParent : -1;
52342      annotationGlobals.structTreeRoot.addAnnotationIdToPage(params.pageRef, structParent);
52343    }
52344    if (params.collectFields) {
52345      const kids = dict.get("Kids");
52346      if (Array.isArray(kids)) {
52347        const kidIds = [];
52348        for (const kid of kids) {
52349          if (kid instanceof Ref) {
52350            kidIds.push(kid.toString());
52351          }
52352        }
52353        if (kidIds.length !== 0) {
52354          this.data.kidIds = kidIds;
52355        }
52356      }
52357      this.data.actions = collectActions(xref, dict, AnnotationActionEventType);
52358      this.data.fieldName = this._constructFieldName(dict);
52359      this.data.pageIndex = params.pageIndex;
52360    }
52361    const it = dict.get("IT");
52362    if (it instanceof Name) {
52363      this.data.it = it.name;
52364    }
52365    this._isOffscreenCanvasSupported = params.evaluatorOptions.isOffscreenCanvasSupported;
52366    this._fallbackFontDict = null;
52367    this._needAppearances = false;
52368  }
52369  _hasFlag(flags, flag) {
52370    return !!(flags & flag);
52371  }
52372  _buildFlags(noView, noPrint) {
52373    let {
52374      flags
52375    } = this;
52376    if (noView === undefined) {
52377      if (noPrint === undefined) {
52378        return undefined;
52379      }
52380      if (noPrint) {
52381        return flags & ~AnnotationFlag.PRINT;
52382      }
52383      return flags & ~AnnotationFlag.HIDDEN | AnnotationFlag.PRINT;
52384    }
52385    if (noView) {
52386      flags |= AnnotationFlag.PRINT;
52387      if (noPrint) {
52388        return flags & ~AnnotationFlag.NOVIEW | AnnotationFlag.HIDDEN;
52389      }
52390      return flags & ~AnnotationFlag.HIDDEN | AnnotationFlag.NOVIEW;
52391    }
52392    flags &= ~(AnnotationFlag.HIDDEN | AnnotationFlag.NOVIEW);
52393    if (noPrint) {
52394      return flags & ~AnnotationFlag.PRINT;
52395    }
52396    return flags | AnnotationFlag.PRINT;
52397  }
52398  _isViewable(flags) {
52399    return !this._hasFlag(flags, AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, AnnotationFlag.NOVIEW);
52400  }
52401  _isPrintable(flags) {
52402    return this._hasFlag(flags, AnnotationFlag.PRINT) && !this._hasFlag(flags, AnnotationFlag.HIDDEN) && !this._hasFlag(flags, AnnotationFlag.INVISIBLE);
52403  }
52404  mustBeViewed(annotationStorage, _renderForms) {
52405    const noView = annotationStorage?.get(this.data.id)?.noView;
52406    if (noView !== undefined) {
52407      return !noView;
52408    }
52409    return this.viewable && !this._hasFlag(this.flags, AnnotationFlag.HIDDEN);
52410  }
52411  mustBePrinted(annotationStorage) {
52412    const noPrint = annotationStorage?.get(this.data.id)?.noPrint;
52413    if (noPrint !== undefined) {
52414      return !noPrint;
52415    }
52416    return this.printable;
52417  }
52418  mustBeViewedWhenEditing(isEditing, modifiedIds = null) {
52419    return isEditing ? !this.data.isEditable : !modifiedIds?.has(this.data.id);
52420  }
52421  get viewable() {
52422    if (this.data.quadPoints === null) {
52423      return false;
52424    }
52425    if (this.flags === 0) {
52426      return true;
52427    }
52428    return this._isViewable(this.flags);
52429  }
52430  get printable() {
52431    if (this.data.quadPoints === null) {
52432      return false;
52433    }
52434    if (this.flags === 0) {
52435      return false;
52436    }
52437    return this._isPrintable(this.flags);
52438  }
52439  _parseStringHelper(data) {
52440    const str = typeof data === "string" ? stringToPDFString(data) : "";
52441    const dir = str && bidi(str).dir === "rtl" ? "rtl" : "ltr";
52442    return {
52443      str,
52444      dir
52445    };
52446  }
52447  setDefaultAppearance(params) {
52448    const {
52449      dict,
52450      annotationGlobals
52451    } = params;
52452    const defaultAppearance = getInheritableProperty({
52453      dict,
52454      key: "DA"
52455    }) || annotationGlobals.acroForm.get("DA");
52456    this._defaultAppearance = typeof defaultAppearance === "string" ? defaultAppearance : "";
52457    this.data.defaultAppearanceData = parseDefaultAppearance(this._defaultAppearance);
52458  }
52459  setTitle(title) {
52460    this._title = this._parseStringHelper(title);
52461  }
52462  setContents(contents) {
52463    this._contents = this._parseStringHelper(contents);
52464  }
52465  setModificationDate(modificationDate) {
52466    this.modificationDate = typeof modificationDate === "string" ? modificationDate : null;
52467  }
52468  setFlags(flags) {
52469    this.flags = Number.isInteger(flags) && flags > 0 ? flags : 0;
52470    if (this.flags & AnnotationFlag.INVISIBLE && this.constructor.name !== "Annotation") {
52471      this.flags ^= AnnotationFlag.INVISIBLE;
52472    }
52473  }
52474  hasFlag(flag) {
52475    return this._hasFlag(this.flags, flag);
52476  }
52477  setRectangle(rectangle) {
52478    this.rectangle = lookupNormalRect(rectangle, [0, 0, 0, 0]);
52479  }
52480  setColor(color) {
52481    this.color = getRgbColor(color);
52482  }
52483  setLineEndings(lineEndings) {
52484    this.lineEndings = ["None", "None"];
52485    if (Array.isArray(lineEndings) && lineEndings.length === 2) {
52486      for (let i = 0; i < 2; i++) {
52487        const obj = lineEndings[i];
52488        if (obj instanceof Name) {
52489          switch (obj.name) {
52490            case "None":
52491              continue;
52492            case "Square":
52493            case "Circle":
52494            case "Diamond":
52495            case "OpenArrow":
52496            case "ClosedArrow":
52497            case "Butt":
52498            case "ROpenArrow":
52499            case "RClosedArrow":
52500            case "Slash":
52501              this.lineEndings[i] = obj.name;
52502              continue;
52503          }
52504        }
52505        warn(`Ignoring invalid lineEnding: ${obj}`);
52506      }
52507    }
52508  }
52509  setRotation(mk, dict) {
52510    this.rotation = 0;
52511    let angle = mk instanceof Dict ? mk.get("R") || 0 : dict.get("Rotate") || 0;
52512    if (Number.isInteger(angle) && angle !== 0) {
52513      angle %= 360;
52514      if (angle < 0) {
52515        angle += 360;
52516      }
52517      if (angle % 90 === 0) {
52518        this.rotation = angle;
52519      }
52520    }
52521  }
52522  setBorderAndBackgroundColors(mk) {
52523    if (mk instanceof Dict) {
52524      this.borderColor = getRgbColor(mk.getArray("BC"), null);
52525      this.backgroundColor = getRgbColor(mk.getArray("BG"), null);
52526    } else {
52527      this.borderColor = this.backgroundColor = null;
52528    }
52529  }
52530  setBorderStyle(borderStyle) {
52531    this.borderStyle = new AnnotationBorderStyle();
52532    if (!(borderStyle instanceof Dict)) {
52533      return;
52534    }
52535    if (borderStyle.has("BS")) {
52536      const dict = borderStyle.get("BS");
52537      if (dict instanceof Dict) {
52538        const dictType = dict.get("Type");
52539        if (!dictType || isName(dictType, "Border")) {
52540          this.borderStyle.setWidth(dict.get("W"), this.rectangle);
52541          this.borderStyle.setStyle(dict.get("S"));
52542          this.borderStyle.setDashArray(dict.getArray("D"));
52543        }
52544      }
52545    } else if (borderStyle.has("Border")) {
52546      const array = borderStyle.getArray("Border");
52547      if (Array.isArray(array)) {
52548        if (array.length >= 3) {
52549          this.borderStyle.setHorizontalCornerRadius(array[0]);
52550          this.borderStyle.setVerticalCornerRadius(array[1]);
52551          this.borderStyle.setWidth(array[2], this.rectangle);
52552          if (array.length === 4) {
52553            this.borderStyle.setDashArray(array[3], true);
52554          }
52555        } else if (array.length === 0) {
52556          this.borderStyle.setWidth(0);
52557        }
52558      }
52559    } else {
52560      this.borderStyle.setWidth(0);
52561    }
52562  }
52563  setAppearance(dict) {
52564    this.appearance = null;
52565    const appearanceStates = dict.get("AP");
52566    if (!(appearanceStates instanceof Dict)) {
52567      return;
52568    }
52569    const normalAppearanceState = appearanceStates.get("N");
52570    if (normalAppearanceState instanceof BaseStream) {
52571      this.appearance = normalAppearanceState;
52572      return;
52573    }
52574    if (!(normalAppearanceState instanceof Dict)) {
52575      return;
52576    }
52577    const as = dict.get("AS");
52578    if (!(as instanceof Name) || !normalAppearanceState.has(as.name)) {
52579      return;
52580    }
52581    const appearance = normalAppearanceState.get(as.name);
52582    if (appearance instanceof BaseStream) {
52583      this.appearance = appearance;
52584    }
52585  }
52586  setOptionalContent(dict) {
52587    this.oc = null;
52588    const oc = dict.get("OC");
52589    if (oc instanceof Name) {
vendor: 15,323 bytes, lines 52590-53089
52590      warn("setOptionalContent: Support for /Name-entry is not implemented.");
52591    } else if (oc instanceof Dict) {
52592      this.oc = oc;
52593    }
52594  }
52595  async loadResources(keys, appearance) {
52596    const resources = await appearance.dict.getAsync("Resources");
52597    if (resources) {
52598      await ObjectLoader.load(resources, keys, resources.xref);
52599    }
52600    return resources;
52601  }
52602  async getOperatorList(evaluator, task, intent, annotationStorage) {
52603    const {
52604      hasOwnCanvas,
52605      id,
52606      rect
52607    } = this.data;
52608    let appearance = this.appearance;
52609    const isUsingOwnCanvas = !!(hasOwnCanvas && intent & RenderingIntentFlag.DISPLAY);
52610    if (isUsingOwnCanvas && (this.width === 0 || this.height === 0)) {
52611      this.data.hasOwnCanvas = false;
52612      return {
52613        opList: new OperatorList(),
52614        separateForm: false,
52615        separateCanvas: false
52616      };
52617    }
52618    if (!appearance) {
52619      if (!isUsingOwnCanvas) {
52620        return {
52621          opList: new OperatorList(),
52622          separateForm: false,
52623          separateCanvas: false
52624        };
52625      }
52626      appearance = new StringStream("");
52627      appearance.dict = new Dict();
52628    }
52629    const appearanceDict = appearance.dict;
52630    const resources = await this.loadResources(RESOURCES_KEYS_OPERATOR_LIST, appearance);
52631    const bbox = lookupRect(appearanceDict.getArray("BBox"), [0, 0, 1, 1]);
52632    const matrix = lookupMatrix(appearanceDict.getArray("Matrix"), IDENTITY_MATRIX);
52633    const transform = getTransformMatrix(rect, bbox, matrix);
52634    const opList = new OperatorList();
52635    let optionalContent;
52636    if (this.oc) {
52637      optionalContent = await evaluator.parseMarkedContentProps(this.oc, null);
52638    }
52639    if (optionalContent !== undefined) {
52640      opList.addOp(OPS.beginMarkedContentProps, ["OC", optionalContent]);
52641    }
52642    opList.addOp(OPS.beginAnnotation, [id, rect, transform, matrix, isUsingOwnCanvas]);
52643    await evaluator.getOperatorList({
52644      stream: appearance,
52645      task,
52646      resources,
52647      operatorList: opList,
52648      fallbackFontDict: this._fallbackFontDict
52649    });
52650    opList.addOp(OPS.endAnnotation, []);
52651    if (optionalContent !== undefined) {
52652      opList.addOp(OPS.endMarkedContent, []);
52653    }
52654    this.reset();
52655    return {
52656      opList,
52657      separateForm: false,
52658      separateCanvas: isUsingOwnCanvas
52659    };
52660  }
52661  async save(evaluator, task, annotationStorage, changes) {
52662    return null;
52663  }
52664  get overlaysTextContent() {
52665    return false;
52666  }
52667  get hasTextContent() {
52668    return false;
52669  }
52670  async extractTextContent(evaluator, task, viewBox) {
52671    if (!this.appearance) {
52672      return;
52673    }
52674    const resources = await this.loadResources(RESOURCES_KEYS_TEXT_CONTENT, this.appearance);
52675    const text = [];
52676    const buffer = [];
52677    let firstPosition = null;
52678    const sink = {
52679      desiredSize: Math.Infinity,
52680      ready: true,
52681      enqueue(chunk, size) {
52682        for (const item of chunk.items) {
52683          if (item.str === undefined) {
52684            continue;
52685          }
52686          firstPosition ||= item.transform.slice(-2);
52687          buffer.push(item.str);
52688          if (item.hasEOL) {
52689            text.push(buffer.join("").trimEnd());
52690            buffer.length = 0;
52691          }
52692        }
52693      }
52694    };
52695    await evaluator.getTextContent({
52696      stream: this.appearance,
52697      task,
52698      resources,
52699      includeMarkedContent: true,
52700      keepWhiteSpace: true,
52701      sink,
52702      viewBox
52703    });
52704    this.reset();
52705    if (buffer.length) {
52706      text.push(buffer.join("").trimEnd());
52707    }
52708    if (text.length > 1 || text[0]) {
52709      const appearanceDict = this.appearance.dict;
52710      const bbox = lookupRect(appearanceDict.getArray("BBox"), null);
52711      const matrix = lookupMatrix(appearanceDict.getArray("Matrix"), null);
52712      this.data.textPosition = this._transformPoint(firstPosition, bbox, matrix);
52713      this.data.textContent = text;
52714    }
52715  }
52716  _transformPoint(coords, bbox, matrix) {
52717    const {
52718      rect
52719    } = this.data;
52720    bbox ||= [0, 0, 1, 1];
52721    matrix ||= [1, 0, 0, 1, 0, 0];
52722    const transform = getTransformMatrix(rect, bbox, matrix);
52723    transform[4] -= rect[0];
52724    transform[5] -= rect[1];
52725    const p = coords.slice();
52726    Util.applyTransform(p, transform);
52727    Util.applyTransform(p, matrix);
52728    return p;
52729  }
52730  getFieldObject() {
52731    if (this.data.kidIds) {
52732      return {
52733        id: this.data.id,
52734        actions: this.data.actions,
52735        name: this.data.fieldName,
52736        strokeColor: this.data.borderColor,
52737        fillColor: this.data.backgroundColor,
52738        type: "",
52739        kidIds: this.data.kidIds,
52740        page: this.data.pageIndex,
52741        rotation: this.rotation
52742      };
52743    }
52744    return null;
52745  }
52746  reset() {
52747    for (const stream of this._streams) {
52748      stream.reset();
52749    }
52750  }
52751  _constructFieldName(dict) {
52752    if (!dict.has("T") && !dict.has("Parent")) {
52753      warn("Unknown field name, falling back to empty field name.");
52754      return "";
52755    }
52756    if (!dict.has("Parent")) {
52757      return stringToPDFString(dict.get("T"));
52758    }
52759    const fieldName = [];
52760    if (dict.has("T")) {
52761      fieldName.unshift(stringToPDFString(dict.get("T")));
52762    }
52763    let loopDict = dict;
52764    const visited = new RefSet();
52765    if (dict.objId) {
52766      visited.put(dict.objId);
52767    }
52768    while (loopDict.has("Parent")) {
52769      loopDict = loopDict.get("Parent");
52770      if (!(loopDict instanceof Dict) || loopDict.objId && visited.has(loopDict.objId)) {
52771        break;
52772      }
52773      if (loopDict.objId) {
52774        visited.put(loopDict.objId);
52775      }
52776      if (loopDict.has("T")) {
52777        fieldName.unshift(stringToPDFString(loopDict.get("T")));
52778      }
52779    }
52780    return fieldName.join(".");
52781  }
52782  get width() {
52783    return this.data.rect[2] - this.data.rect[0];
52784  }
52785  get height() {
52786    return this.data.rect[3] - this.data.rect[1];
52787  }
52788}
52789class AnnotationBorderStyle {
52790  width = 1;
52791  rawWidth = 1;
52792  style = AnnotationBorderStyleType.SOLID;
52793  dashArray = [3];
52794  horizontalCornerRadius = 0;
52795  verticalCornerRadius = 0;
52796  setWidth(width, rect = [0, 0, 0, 0]) {
52797    if (width instanceof Name) {
52798      this.width = 0;
52799      return;
52800    }
52801    if (typeof width === "number") {
52802      if (width > 0) {
52803        this.rawWidth = width;
52804        const maxWidth = (rect[2] - rect[0]) / 2;
52805        const maxHeight = (rect[3] - rect[1]) / 2;
52806        if (maxWidth > 0 && maxHeight > 0 && (width > maxWidth || width > maxHeight)) {
52807          warn(`AnnotationBorderStyle.setWidth - ignoring width: ${width}`);
52808          width = 1;
52809        }
52810      }
52811      this.width = width;
52812    }
52813  }
52814  setStyle(style) {
52815    if (!(style instanceof Name)) {
52816      return;
52817    }
52818    switch (style.name) {
52819      case "S":
52820        this.style = AnnotationBorderStyleType.SOLID;
52821        break;
52822      case "D":
52823        this.style = AnnotationBorderStyleType.DASHED;
52824        break;
52825      case "B":
52826        this.style = AnnotationBorderStyleType.BEVELED;
52827        break;
52828      case "I":
52829        this.style = AnnotationBorderStyleType.INSET;
52830        break;
52831      case "U":
52832        this.style = AnnotationBorderStyleType.UNDERLINE;
52833        break;
52834      default:
52835        break;
52836    }
52837  }
52838  setDashArray(dashArray, forceStyle = false) {
52839    if (Array.isArray(dashArray)) {
52840      let isValid = true;
52841      let allZeros = true;
52842      for (const element of dashArray) {
52843        const validNumber = +element >= 0;
52844        if (!validNumber) {
52845          isValid = false;
52846          break;
52847        } else if (element > 0) {
52848          allZeros = false;
52849        }
52850      }
52851      if (dashArray.length === 0 || isValid && !allZeros) {
52852        this.dashArray = dashArray;
52853        if (forceStyle) {
52854          this.setStyle(Name.get("D"));
52855        }
52856      } else {
52857        this.width = 0;
52858      }
52859    } else if (dashArray) {
52860      this.width = 0;
52861    }
52862  }
52863  setHorizontalCornerRadius(radius) {
52864    if (Number.isInteger(radius)) {
52865      this.horizontalCornerRadius = radius;
52866    }
52867  }
52868  setVerticalCornerRadius(radius) {
52869    if (Number.isInteger(radius)) {
52870      this.verticalCornerRadius = radius;
52871    }
52872  }
52873}
52874class MarkupAnnotation extends Annotation {
52875  constructor(params) {
52876    super(params);
52877    const {
52878      dict
52879    } = params;
52880    if (dict.has("IRT")) {
52881      const rawIRT = dict.getRaw("IRT");
52882      this.data.inReplyTo = rawIRT instanceof Ref ? rawIRT.toString() : null;
52883      const rt = dict.get("RT");
52884      this.data.replyType = rt instanceof Name ? rt.name : AnnotationReplyType.REPLY;
52885    }
52886    let popupRef = null;
52887    if (this.data.replyType === AnnotationReplyType.GROUP) {
52888      const parent = dict.get("IRT");
52889      this.setTitle(parent.get("T"));
52890      this.data.titleObj = this._title;
52891      this.setContents(parent.get("Contents"));
52892      this.data.contentsObj = this._contents;
52893      if (!parent.has("CreationDate")) {
52894        this.data.creationDate = null;
52895      } else {
52896        this.setCreationDate(parent.get("CreationDate"));
52897        this.data.creationDate = this.creationDate;
52898      }
52899      if (!parent.has("M")) {
52900        this.data.modificationDate = null;
52901      } else {
52902        this.setModificationDate(parent.get("M"));
52903        this.data.modificationDate = this.modificationDate;
52904      }
52905      popupRef = parent.getRaw("Popup");
52906      if (!parent.has("C")) {
52907        this.data.color = null;
52908      } else {
52909        this.setColor(parent.getArray("C"));
52910        this.data.color = this.color;
52911      }
52912    } else {
52913      this.data.titleObj = this._title;
52914      this.setCreationDate(dict.get("CreationDate"));
52915      this.data.creationDate = this.creationDate;
52916      popupRef = dict.getRaw("Popup");
52917      if (!dict.has("C")) {
52918        this.data.color = null;
52919      }
52920    }
52921    this.data.popupRef = popupRef instanceof Ref ? popupRef.toString() : null;
52922    if (dict.has("RC")) {
52923      this.data.richText = XFAFactory.getRichTextAsHtml(dict.get("RC"));
52924    }
52925  }
52926  setCreationDate(creationDate) {
52927    this.creationDate = typeof creationDate === "string" ? creationDate : null;
52928  }
52929  _setDefaultAppearance({
52930    xref,
52931    extra,
52932    strokeColor,
52933    fillColor,
52934    blendMode,
52935    strokeAlpha,
52936    fillAlpha,
52937    pointsCallback
52938  }) {
52939    const bbox = this.data.rect = BBOX_INIT.slice();
52940    const buffer = ["q"];
52941    if (extra) {
52942      buffer.push(extra);
52943    }
52944    if (strokeColor) {
52945      buffer.push(`${strokeColor[0]} ${strokeColor[1]} ${strokeColor[2]} RG`);
52946    }
52947    if (fillColor) {
52948      buffer.push(`${fillColor[0]} ${fillColor[1]} ${fillColor[2]} rg`);
52949    }
52950    const pointsArray = this.data.quadPoints || Float32Array.from([this.rectangle[0], this.rectangle[3], this.rectangle[2], this.rectangle[3], this.rectangle[0], this.rectangle[1], this.rectangle[2], this.rectangle[1]]);
52951    for (let i = 0, ii = pointsArray.length; i < ii; i += 8) {
52952      const points = pointsCallback(buffer, pointsArray.subarray(i, i + 8));
52953      Util.rectBoundingBox(...points, bbox);
52954    }
52955    buffer.push("Q");
52956    const formDict = new Dict(xref);
52957    const appearanceStreamDict = new Dict(xref);
52958    appearanceStreamDict.setIfName("Subtype", "Form");
52959    const appearanceStream = new StringStream(buffer.join(" "));
52960    appearanceStream.dict = appearanceStreamDict;
52961    formDict.set("Fm0", appearanceStream);
52962    const gsDict = new Dict(xref);
52963    if (blendMode) {
52964      gsDict.setIfName("BM", blendMode);
52965    }
52966    gsDict.setIfNumber("CA", strokeAlpha);
52967    gsDict.setIfNumber("ca", fillAlpha);
52968    const stateDict = new Dict(xref);
52969    stateDict.set("GS0", gsDict);
52970    const resources = new Dict(xref);
52971    resources.set("ExtGState", stateDict);
52972    resources.set("XObject", formDict);
52973    const appearanceDict = new Dict(xref);
52974    appearanceDict.set("Resources", resources);
52975    appearanceDict.set("BBox", bbox);
52976    this.appearance = new StringStream("/GS0 gs /Fm0 Do");
52977    this.appearance.dict = appearanceDict;
52978    this._streams.push(this.appearance, appearanceStream);
52979  }
52980  static async createNewAnnotation(xref, annotation, changes, params) {
52981    const annotationRef = annotation.ref ||= xref.getNewTemporaryRef();
52982    const ap = await this.createNewAppearanceStream(annotation, xref, params);
52983    let annotationDict;
52984    if (ap) {
52985      const apRef = xref.getNewTemporaryRef();
52986      annotationDict = this.createNewDict(annotation, xref, {
52987        apRef
52988      });
52989      changes.put(apRef, {
52990        data: ap
52991      });
52992    } else {
52993      annotationDict = this.createNewDict(annotation, xref, {});
52994    }
52995    if (Number.isInteger(annotation.parentTreeId)) {
52996      annotationDict.set("StructParent", annotation.parentTreeId);
52997    }
52998    changes.put(annotationRef, {
52999      data: annotationDict
53000    });
53001    const retRef = {
53002      ref: annotationRef
53003    };
53004    const {
53005      popup
53006    } = annotation;
53007    if (popup) {
53008      if (popup.deleted) {
53009        annotationDict.delete("Popup");
53010        annotationDict.delete("Contents");
53011        annotationDict.delete("RC");
53012        return retRef;
53013      }
53014      const popupRef = popup.ref ||= xref.getNewTemporaryRef();
53015      popup.parent = annotationRef;
53016      const popupDict = PopupAnnotation.createNewDict(popup, xref);
53017      changes.put(popupRef, {
53018        data: popupDict
53019      });
53020      annotationDict.setIfDefined("Contents", stringToAsciiOrUTF16BE(popup.contents));
53021      annotationDict.set("Popup", popupRef);
53022      return [retRef, {
53023        ref: popupRef
53024      }];
53025    }
53026    return retRef;
53027  }
53028  static async createNewPrintAnnotation(annotationGlobals, xref, annotation, params) {
53029    const ap = await this.createNewAppearanceStream(annotation, xref, params);
53030    const annotationDict = this.createNewDict(annotation, xref, ap ? {
53031      ap
53032    } : {});
53033    const newAnnotation = new this.prototype.constructor({
53034      dict: annotationDict,
53035      xref,
53036      annotationGlobals,
53037      evaluatorOptions: params.evaluatorOptions
53038    });
53039    if (annotation.ref) {
53040      newAnnotation.ref = newAnnotation.refToReplace = annotation.ref;
53041    }
53042    return newAnnotation;
53043  }
53044}
53045class WidgetAnnotation extends Annotation {
53046  constructor(params) {
53047    super(params);
53048    const {
53049      dict,
53050      xref,
53051      annotationGlobals
53052    } = params;
53053    const data = this.data;
53054    this._needAppearances = params.needAppearances;
53055    if (data.fieldName === undefined) {
53056      data.fieldName = this._constructFieldName(dict);
53057    }
53058    if (data.actions === undefined) {
53059      data.actions = collectActions(xref, dict, AnnotationActionEventType);
53060    }
53061    let fieldValue = getInheritableProperty({
53062      dict,
53063      key: "V",
53064      getArray: true
53065    });
53066    data.fieldValue = this._decodeFormValue(fieldValue);
53067    const defaultFieldValue = getInheritableProperty({
53068      dict,
53069      key: "DV",
53070      getArray: true
53071    });
53072    data.defaultFieldValue = this._decodeFormValue(defaultFieldValue);
53073    if (fieldValue === undefined && annotationGlobals.xfaDatasets) {
53074      const path = this._title.str;
53075      if (path) {
53076        this._hasValueFromXFA = true;
53077        data.fieldValue = fieldValue = annotationGlobals.xfaDatasets.getValue(path);
53078      }
53079    }
53080    if (fieldValue === undefined && data.defaultFieldValue !== null) {
53081      data.fieldValue = data.defaultFieldValue;
53082    }
53083    data.alternativeText = stringToPDFString(dict.get("TU") || "");
53084    this.setDefaultAppearance(params);
53085    data.hasAppearance ||= this._needAppearances && data.fieldValue !== undefined && data.fieldValue !== null;
53086    const fieldType = getInheritableProperty({
53087      dict,
53088      key: "FT"
53089    });
vendor: 10,950 bytes, lines 53090-53399
53090    data.fieldType = fieldType instanceof Name ? fieldType.name : null;
53091    const localResources = getInheritableProperty({
53092      dict,
53093      key: "DR"
53094    });
53095    const acroFormResources = annotationGlobals.acroForm.get("DR");
53096    const appearanceResources = this.appearance?.dict.get("Resources");
53097    this._fieldResources = {
53098      localResources,
53099      acroFormResources,
53100      appearanceResources,
53101      mergedResources: Dict.merge({
53102        xref,
53103        dictArray: [localResources, appearanceResources, acroFormResources],
53104        mergeSubDicts: true
53105      })
53106    };
53107    data.fieldFlags = getInheritableProperty({
53108      dict,
53109      key: "Ff"
53110    });
53111    if (!Number.isInteger(data.fieldFlags) || data.fieldFlags < 0) {
53112      data.fieldFlags = 0;
53113    }
53114    data.password = this.hasFieldFlag(AnnotationFieldFlag.PASSWORD);
53115    data.readOnly = this.hasFieldFlag(AnnotationFieldFlag.READONLY);
53116    data.required = this.hasFieldFlag(AnnotationFieldFlag.REQUIRED);
53117    data.hidden = this._hasFlag(data.annotationFlags, AnnotationFlag.HIDDEN) || this._hasFlag(data.annotationFlags, AnnotationFlag.NOVIEW);
53118  }
53119  _decodeFormValue(formValue) {
53120    if (Array.isArray(formValue)) {
53121      const arr = formValue.map(item => this._decodeFormValue(item)).filter(item => item !== null);
53122      return arr.length > 0 ? arr : null;
53123    } else if (formValue instanceof Name) {
53124      return formValue.name;
53125    } else if (typeof formValue === "string") {
53126      return stringToPDFString(formValue);
53127    }
53128    return null;
53129  }
53130  hasFieldFlag(flag) {
53131    return !!(this.data.fieldFlags & flag);
53132  }
53133  _isViewable(flags) {
53134    return true;
53135  }
53136  mustBeViewed(annotationStorage, renderForms) {
53137    if (renderForms) {
53138      return this.viewable;
53139    }
53140    return super.mustBeViewed(annotationStorage, renderForms) && !this._hasFlag(this.flags, AnnotationFlag.NOVIEW);
53141  }
53142  getRotationMatrix(annotationStorage) {
53143    let rotation = annotationStorage?.get(this.data.id)?.rotation;
53144    if (rotation === undefined) {
53145      rotation = this.rotation;
53146    }
53147    return rotation === 0 ? IDENTITY_MATRIX : getRotationMatrix(rotation, this.width, this.height);
53148  }
53149  getBorderAndBackgroundAppearances(annotationStorage) {
53150    let rotation = annotationStorage?.get(this.data.id)?.rotation;
53151    if (rotation === undefined) {
53152      rotation = this.rotation;
53153    }
53154    if (!this.backgroundColor && !this.borderColor) {
53155      return "";
53156    }
53157    const rect = rotation === 0 || rotation === 180 ? `0 0 ${this.width} ${this.height} re` : `0 0 ${this.height} ${this.width} re`;
53158    let str = "";
53159    if (this.backgroundColor) {
53160      str = `${getPdfColor(this.backgroundColor, true)} ${rect} f `;
53161    }
53162    if (this.borderColor) {
53163      const borderWidth = this.borderStyle.width || 1;
53164      str += `${borderWidth} w ${getPdfColor(this.borderColor, false)} ${rect} S `;
53165    }
53166    return str;
53167  }
53168  async getOperatorList(evaluator, task, intent, annotationStorage) {
53169    if (intent & RenderingIntentFlag.ANNOTATIONS_FORMS && !(this instanceof SignatureWidgetAnnotation) && !this.data.noHTML && !this.data.hasOwnCanvas) {
53170      return {
53171        opList: new OperatorList(),
53172        separateForm: true,
53173        separateCanvas: false
53174      };
53175    }
53176    if (!this._hasText) {
53177      return super.getOperatorList(evaluator, task, intent, annotationStorage);
53178    }
53179    const content = await this._getAppearance(evaluator, task, intent, annotationStorage);
53180    if (this.appearance && content === null) {
53181      return super.getOperatorList(evaluator, task, intent, annotationStorage);
53182    }
53183    const opList = new OperatorList();
53184    if (!this._defaultAppearance || content === null) {
53185      return {
53186        opList,
53187        separateForm: false,
53188        separateCanvas: false
53189      };
53190    }
53191    const isUsingOwnCanvas = !!(this.data.hasOwnCanvas && intent & RenderingIntentFlag.DISPLAY);
53192    const matrix = [1, 0, 0, 1, 0, 0];
53193    const bbox = [0, 0, this.width, this.height];
53194    const transform = getTransformMatrix(this.data.rect, bbox, matrix);
53195    let optionalContent;
53196    if (this.oc) {
53197      optionalContent = await evaluator.parseMarkedContentProps(this.oc, null);
53198    }
53199    if (optionalContent !== undefined) {
53200      opList.addOp(OPS.beginMarkedContentProps, ["OC", optionalContent]);
53201    }
53202    opList.addOp(OPS.beginAnnotation, [this.data.id, this.data.rect, transform, this.getRotationMatrix(annotationStorage), isUsingOwnCanvas]);
53203    const stream = new StringStream(content);
53204    await evaluator.getOperatorList({
53205      stream,
53206      task,
53207      resources: this._fieldResources.mergedResources,
53208      operatorList: opList
53209    });
53210    opList.addOp(OPS.endAnnotation, []);
53211    if (optionalContent !== undefined) {
53212      opList.addOp(OPS.endMarkedContent, []);
53213    }
53214    return {
53215      opList,
53216      separateForm: false,
53217      separateCanvas: isUsingOwnCanvas
53218    };
53219  }
53220  _getMKDict(rotation) {
53221    const mk = new Dict(null);
53222    if (rotation) {
53223      mk.set("R", rotation);
53224    }
53225    mk.setIfArray("BC", getPdfColorArray(this.borderColor));
53226    mk.setIfArray("BG", getPdfColorArray(this.backgroundColor));
53227    return mk.size > 0 ? mk : null;
53228  }
53229  amendSavedDict(annotationStorage, dict) {}
53230  setValue(dict, value, xref, changes) {
53231    const {
53232      dict: parentDict,
53233      ref: parentRef
53234    } = getParentToUpdate(dict, this.ref, xref);
53235    if (!parentDict) {
53236      dict.set("V", value);
53237    } else if (!changes.has(parentRef)) {
53238      const newParentDict = parentDict.clone();
53239      newParentDict.set("V", value);
53240      changes.put(parentRef, {
53241        data: newParentDict
53242      });
53243      return newParentDict;
53244    }
53245    return null;
53246  }
53247  async save(evaluator, task, annotationStorage, changes) {
53248    const storageEntry = annotationStorage?.get(this.data.id);
53249    const flags = this._buildFlags(storageEntry?.noView, storageEntry?.noPrint);
53250    let value = storageEntry?.value,
53251      rotation = storageEntry?.rotation;
53252    if (value === this.data.fieldValue || value === undefined) {
53253      if (!this._hasValueFromXFA && rotation === undefined && flags === undefined) {
53254        return;
53255      }
53256      value ||= this.data.fieldValue;
53257    }
53258    if (rotation === undefined && !this._hasValueFromXFA && Array.isArray(value) && Array.isArray(this.data.fieldValue) && isArrayEqual(value, this.data.fieldValue) && flags === undefined) {
53259      return;
53260    }
53261    if (rotation === undefined) {
53262      rotation = this.rotation;
53263    }
53264    let appearance = null;
53265    if (!this._needAppearances) {
53266      appearance = await this._getAppearance(evaluator, task, RenderingIntentFlag.SAVE, annotationStorage);
53267      if (appearance === null && flags === undefined) {
53268        return;
53269      }
53270    } else {}
53271    let needAppearances = false;
53272    if (appearance?.needAppearances) {
53273      needAppearances = true;
53274      appearance = null;
53275    }
53276    const {
53277      xref
53278    } = evaluator;
53279    const originalDict = xref.fetchIfRef(this.ref);
53280    if (!(originalDict instanceof Dict)) {
53281      return;
53282    }
53283    const dict = new Dict(xref);
53284    for (const [key, rawVal] of originalDict.getRawEntries()) {
53285      if (key !== "AP") {
53286        dict.set(key, rawVal);
53287      }
53288    }
53289    if (flags !== undefined) {
53290      dict.set("F", flags);
53291      if (appearance === null && !needAppearances) {
53292        const ap = originalDict.getRaw("AP");
53293        if (ap) {
53294          dict.set("AP", ap);
53295        }
53296      }
53297    }
53298    const xfa = {
53299      path: this.data.fieldName,
53300      value
53301    };
53302    const newParentDict = this.setValue(dict, Array.isArray(value) ? value.map(stringToAsciiOrUTF16BE) : stringToAsciiOrUTF16BE(value), xref, changes);
53303    this.amendSavedDict(annotationStorage, newParentDict || dict);
53304    const maybeMK = this._getMKDict(rotation);
53305    if (maybeMK) {
53306      dict.set("MK", maybeMK);
53307    }
53308    changes.put(this.ref, {
53309      data: dict,
53310      xfa,
53311      needAppearances
53312    });
53313    if (appearance !== null) {
53314      const newRef = xref.getNewTemporaryRef();
53315      const AP = new Dict(xref);
53316      dict.set("AP", AP);
53317      AP.set("N", newRef);
53318      const resources = this._getSaveFieldResources(xref);
53319      const appearanceStream = new StringStream(appearance);
53320      const appearanceDict = appearanceStream.dict = new Dict(xref);
53321      appearanceDict.setIfName("Subtype", "Form");
53322      appearanceDict.set("Resources", resources);
53323      const bbox = rotation % 180 === 0 ? [0, 0, this.width, this.height] : [0, 0, this.height, this.width];
53324      appearanceDict.set("BBox", bbox);
53325      const rotationMatrix = this.getRotationMatrix(annotationStorage);
53326      if (rotationMatrix !== IDENTITY_MATRIX) {
53327        appearanceDict.set("Matrix", rotationMatrix);
53328      }
53329      changes.put(newRef, {
53330        data: appearanceStream,
53331        xfa: null,
53332        needAppearances: false
53333      });
53334    }
53335    dict.set("M", `D:${getModificationDate()}`);
53336  }
53337  async _getAppearance(evaluator, task, intent, annotationStorage) {
53338    if (this.data.password) {
53339      return null;
53340    }
53341    const storageEntry = annotationStorage?.get(this.data.id);
53342    let value, rotation;
53343    if (storageEntry) {
53344      value = storageEntry.formattedValue || storageEntry.value;
53345      rotation = storageEntry.rotation;
53346    }
53347    if (rotation === undefined && value === undefined && !this._needAppearances) {
53348      if (!this._hasValueFromXFA || this.appearance) {
53349        return null;
53350      }
53351    }
53352    const colors = this.getBorderAndBackgroundAppearances(annotationStorage);
53353    if (value === undefined) {
53354      value = this.data.fieldValue;
53355      if (!value) {
53356        return `/Tx BMC q ${colors}Q EMC`;
53357      }
53358    }
53359    if (Array.isArray(value) && value.length === 1) {
53360      value = value[0];
53361    }
53362    assert(typeof value === "string", "Expected `value` to be a string.");
53363    value = value.trimEnd();
53364    if (this.data.combo) {
53365      const option = this.data.options.find(({
53366        exportValue
53367      }) => value === exportValue);
53368      value = option?.displayValue || value;
53369    }
53370    if (value === "") {
53371      return `/Tx BMC q ${colors}Q EMC`;
53372    }
53373    if (rotation === undefined) {
53374      rotation = this.rotation;
53375    }
53376    let lineCount = -1;
53377    let lines;
53378    if (this.data.multiLine) {
53379      lines = value.split(/\r\n?|\n/).map(line => line.normalize("NFC"));
53380      lineCount = lines.length;
53381    } else {
53382      lines = [value.replace(/\r\n?|\n/, "").normalize("NFC")];
53383    }
53384    const defaultPadding = 1;
53385    const defaultHPadding = 2;
53386    let {
53387      width: totalWidth,
53388      height: totalHeight
53389    } = this;
53390    if (rotation === 90 || rotation === 270) {
53391      [totalWidth, totalHeight] = [totalHeight, totalWidth];
53392    }
53393    if (!this._defaultAppearance) {
53394      this.data.defaultAppearanceData = parseDefaultAppearance(this._defaultAppearance = "/Helvetica 0 Tf 0 g");
53395    }
53396    let font = await WidgetAnnotation._getFontData(evaluator, task, this.data.defaultAppearanceData, this._fieldResources.mergedResources);
53397    let defaultAppearance, fontSize, lineHeight;
53398    const encodedLines = [];
53399    let encodingError = false;
vendor: 11,251 bytes, lines 53400-53691
53400    for (const line of lines) {
53401      const encodedString = font.encodeString(line);
53402      if (encodedString.length > 1) {
53403        encodingError = true;
53404      }
53405      encodedLines.push(encodedString.join(""));
53406    }
53407    if (encodingError && intent & RenderingIntentFlag.SAVE) {
53408      return {
53409        needAppearances: true
53410      };
53411    }
53412    if (encodingError && this._isOffscreenCanvasSupported) {
53413      const fontFamily = this.data.comb ? "monospace" : "sans-serif";
53414      const fakeUnicodeFont = new FakeUnicodeFont(evaluator.xref, fontFamily);
53415      const resources = fakeUnicodeFont.createFontResources(lines.join(""));
53416      const newFont = resources.getRaw("Font");
53417      if (this._fieldResources.mergedResources.has("Font")) {
53418        const oldFont = this._fieldResources.mergedResources.get("Font");
53419        for (const [key, rawVal] of newFont.getRawEntries()) {
53420          oldFont.set(key, rawVal);
53421        }
53422      } else {
53423        this._fieldResources.mergedResources.set("Font", newFont);
53424      }
53425      const fontName = fakeUnicodeFont.fontName.name;
53426      font = await WidgetAnnotation._getFontData(evaluator, task, {
53427        fontName,
53428        fontSize: 0
53429      }, resources);
53430      for (let i = 0, ii = encodedLines.length; i < ii; i++) {
53431        encodedLines[i] = stringToUTF16String(lines[i]);
53432      }
53433      const savedDefaultAppearance = Object.assign(Object.create(null), this.data.defaultAppearanceData);
53434      this.data.defaultAppearanceData.fontSize = 0;
53435      this.data.defaultAppearanceData.fontName = fontName;
53436      [defaultAppearance, fontSize, lineHeight] = this._computeFontSize(totalHeight - 2 * defaultPadding, totalWidth - 2 * defaultHPadding, value, font, lineCount);
53437      this.data.defaultAppearanceData = savedDefaultAppearance;
53438    } else {
53439      if (!this._isOffscreenCanvasSupported) {
53440        warn("_getAppearance: OffscreenCanvas is not supported, annotation may not render correctly.");
53441      }
53442      [defaultAppearance, fontSize, lineHeight] = this._computeFontSize(totalHeight - 2 * defaultPadding, totalWidth - 2 * defaultHPadding, value, font, lineCount);
53443    }
53444    let descent = font.descent;
53445    if (isNaN(descent)) {
53446      descent = BASELINE_FACTOR * lineHeight;
53447    } else {
53448      descent = Math.max(BASELINE_FACTOR * lineHeight, Math.abs(descent) * fontSize);
53449    }
53450    const defaultVPadding = Math.min(Math.floor((totalHeight - fontSize) / 2), defaultPadding);
53451    const alignment = this.data.textAlignment;
53452    if (this.data.multiLine) {
53453      return this._getMultilineAppearance(defaultAppearance, encodedLines, font, fontSize, totalWidth, totalHeight, alignment, defaultHPadding, defaultVPadding, descent, lineHeight, annotationStorage);
53454    }
53455    if (this.data.comb) {
53456      return this._getCombAppearance(defaultAppearance, font, encodedLines[0], fontSize, totalWidth, totalHeight, defaultHPadding, defaultVPadding, descent, lineHeight, alignment, bidi(lines[0]).dir === "rtl", annotationStorage);
53457    }
53458    const bottomPadding = defaultVPadding + descent;
53459    if (alignment === 0 || alignment > 2) {
53460      return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 ${numberToString(defaultHPadding)} ${numberToString(bottomPadding)} Tm (${escapeString(encodedLines[0])}) Tj` + " ET Q EMC";
53461    }
53462    const prevInfo = {
53463      shift: 0
53464    };
53465    const renderedText = this._renderText(encodedLines[0], font, fontSize, totalWidth, alignment, prevInfo, defaultHPadding, bottomPadding);
53466    return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 0 0 Tm ${renderedText}` + " ET Q EMC";
53467  }
53468  static async _getFontData(evaluator, task, appearanceData, resources) {
53469    const operatorList = new OperatorList();
53470    const initialState = {
53471      font: null,
53472      clone() {
53473        return this;
53474      }
53475    };
53476    const {
53477      fontName,
53478      fontSize
53479    } = appearanceData;
53480    await evaluator.handleSetFont(resources, [fontName && Name.get(fontName), fontSize], null, operatorList, task, initialState, null);
53481    return initialState.font;
53482  }
53483  _getTextWidth(text, font) {
53484    return Math.sumPrecise(font.charsToGlyphs(text).map(g => g.width)) / 1000;
53485  }
53486  _computeFontSize(height, width, text, font, lineCount) {
53487    let {
53488      fontSize
53489    } = this.data.defaultAppearanceData;
53490    let lineHeight = (fontSize || 12) * LINE_FACTOR,
53491      numberOfLines = Math.round(height / lineHeight);
53492    if (!fontSize) {
53493      const roundWithTwoDigits = x => Math.floor(x * 100) / 100;
53494      if (lineCount === -1) {
53495        const textWidth = this._getTextWidth(text, font);
53496        fontSize = roundWithTwoDigits(Math.min(height / LINE_FACTOR, width / textWidth));
53497        numberOfLines = 1;
53498      } else {
53499        const lines = text.split(/\r\n?|\n/);
53500        const cachedLines = [];
53501        for (const line of lines) {
53502          const encoded = font.encodeString(line).join("");
53503          const glyphs = font.charsToGlyphs(encoded);
53504          const positions = font.getCharPositions(encoded);
53505          cachedLines.push({
53506            line: encoded,
53507            glyphs,
53508            positions
53509          });
53510        }
53511        const isTooBig = fsize => {
53512          let totalHeight = 0;
53513          for (const cache of cachedLines) {
53514            const chunks = this._splitLine(null, font, fsize, width, cache);
53515            totalHeight += chunks.length * fsize;
53516            if (totalHeight > height) {
53517              return true;
53518            }
53519          }
53520          return false;
53521        };
53522        numberOfLines = Math.max(numberOfLines, lineCount);
53523        while (true) {
53524          lineHeight = height / numberOfLines;
53525          fontSize = roundWithTwoDigits(lineHeight / LINE_FACTOR);
53526          if (isTooBig(fontSize)) {
53527            numberOfLines++;
53528            continue;
53529          }
53530          break;
53531        }
53532      }
53533      const {
53534        fontName,
53535        fontColor
53536      } = this.data.defaultAppearanceData;
53537      this._defaultAppearance = createDefaultAppearance({
53538        fontSize,
53539        fontName,
53540        fontColor
53541      });
53542    }
53543    return [this._defaultAppearance, fontSize, height / numberOfLines];
53544  }
53545  _renderText(text, font, fontSize, totalWidth, alignment, prevInfo, hPadding, vPadding) {
53546    let shift;
53547    if (alignment === 1) {
53548      const width = this._getTextWidth(text, font) * fontSize;
53549      shift = (totalWidth - width) / 2;
53550    } else if (alignment === 2) {
53551      const width = this._getTextWidth(text, font) * fontSize;
53552      shift = totalWidth - width - hPadding;
53553    } else {
53554      shift = hPadding;
53555    }
53556    const shiftStr = numberToString(shift - prevInfo.shift);
53557    prevInfo.shift = shift;
53558    vPadding = numberToString(vPadding);
53559    return `${shiftStr} ${vPadding} Td (${escapeString(text)}) Tj`;
53560  }
53561  _getSaveFieldResources(xref) {
53562    const {
53563      localResources,
53564      appearanceResources,
53565      acroFormResources
53566    } = this._fieldResources;
53567    const fontName = this.data.defaultAppearanceData?.fontName;
53568    if (!fontName) {
53569      return localResources || Dict.empty;
53570    }
53571    for (const resources of [localResources, appearanceResources]) {
53572      if (resources instanceof Dict) {
53573        const localFont = resources.get("Font");
53574        if (localFont instanceof Dict && localFont.has(fontName)) {
53575          return resources;
53576        }
53577      }
53578    }
53579    if (acroFormResources instanceof Dict) {
53580      const acroFormFont = acroFormResources.get("Font");
53581      if (acroFormFont instanceof Dict && acroFormFont.has(fontName)) {
53582        const subFontDict = new Dict(xref);
53583        subFontDict.set(fontName, acroFormFont.getRaw(fontName));
53584        const subResourcesDict = new Dict(xref);
53585        subResourcesDict.set("Font", subFontDict);
53586        return Dict.merge({
53587          xref,
53588          dictArray: [subResourcesDict, localResources],
53589          mergeSubDicts: true
53590        });
53591      }
53592    }
53593    return localResources || Dict.empty;
53594  }
53595  getFieldObject() {
53596    return null;
53597  }
53598}
53599class TextWidgetAnnotation extends WidgetAnnotation {
53600  constructor(params) {
53601    super(params);
53602    const {
53603      dict
53604    } = params;
53605    if (dict.has("PMD")) {
53606      this.flags |= AnnotationFlag.HIDDEN;
53607      this.data.hidden = true;
53608      warn("Barcodes are not supported");
53609    }
53610    this.data.hasOwnCanvas = this.data.readOnly && !this.data.noHTML;
53611    this._hasText = true;
53612    if (typeof this.data.fieldValue !== "string") {
53613      this.data.fieldValue = "";
53614    }
53615    let alignment = getInheritableProperty({
53616      dict,
53617      key: "Q"
53618    });
53619    if (!Number.isInteger(alignment) || alignment < 0 || alignment > 2) {
53620      alignment = null;
53621    }
53622    this.data.textAlignment = alignment;
53623    let maximumLength = getInheritableProperty({
53624      dict,
53625      key: "MaxLen"
53626    });
53627    if (!Number.isInteger(maximumLength) || maximumLength < 0) {
53628      maximumLength = 0;
53629    }
53630    this.data.maxLen = maximumLength;
53631    this.data.multiLine = this.hasFieldFlag(AnnotationFieldFlag.MULTILINE);
53632    this.data.comb = this.hasFieldFlag(AnnotationFieldFlag.COMB) && !this.data.multiLine && !this.data.password && !this.hasFieldFlag(AnnotationFieldFlag.FILESELECT) && this.data.maxLen !== 0;
53633    this.data.doNotScroll = this.hasFieldFlag(AnnotationFieldFlag.DONOTSCROLL);
53634    const {
53635      data: {
53636        actions
53637      }
53638    } = this;
53639    if (!actions) {
53640      return;
53641    }
53642    const AFDateTime = /^AF(Date|Time)_(?:Keystroke|Format)(?:Ex)?\(['"]?([^'"]+)['"]?\);$/;
53643    let canUseHTMLDateTime = false;
53644    if (actions.Format?.length === 1 && actions.Keystroke?.length === 1 && AFDateTime.test(actions.Format[0]) && AFDateTime.test(actions.Keystroke[0]) || actions.Format?.length === 0 && actions.Keystroke?.length === 1 && AFDateTime.test(actions.Keystroke[0]) || actions.Keystroke?.length === 0 && actions.Format?.length === 1 && AFDateTime.test(actions.Format[0])) {
53645      canUseHTMLDateTime = true;
53646    }
53647    const actionsToVisit = [];
53648    if (actions.Format) {
53649      actionsToVisit.push(...actions.Format);
53650    }
53651    if (actions.Keystroke) {
53652      actionsToVisit.push(...actions.Keystroke);
53653    }
53654    if (canUseHTMLDateTime) {
53655      delete actions.Keystroke;
53656      actions.Format = actionsToVisit;
53657    }
53658    for (const formatAction of actionsToVisit) {
53659      const m = formatAction.match(AFDateTime);
53660      if (!m) {
53661        continue;
53662      }
53663      const isDate = m[1] === "Date";
53664      let format = m[2];
53665      const num = parseInt(format, 10);
53666      if (!isNaN(num) && Math.floor(Math.log10(num)) + 1 === m[2].length) {
53667        format = (isDate ? DateFormats : TimeFormats)[num] ?? format;
53668      }
53669      this.data.datetimeFormat = format;
53670      if (!canUseHTMLDateTime) {
53671        break;
53672      }
53673      if (isDate) {
53674        if (/HH|MM|ss|h/.test(format)) {
53675          this.data.datetimeType = "datetime-local";
53676          this.data.timeStep = /ss/.test(format) ? 1 : 60;
53677        } else {
53678          this.data.datetimeType = "date";
53679        }
53680        break;
53681      }
53682      this.data.datetimeType = "time";
53683      this.data.timeStep = /ss/.test(format) ? 1 : 60;
53684      break;
53685    }
53686  }
53687  get hasTextContent() {
53688    return !!this.appearance && !this._needAppearances;
53689  }
53690  _getCombAppearance(defaultAppearance, font, text, fontSize, width, height, hPadding, vPadding, descent, lineHeight, alignment, isRTL, annotationStorage) {
53691    const combWidth = width / this.data.maxLen;
53692    const colors = this.getBorderAndBackgroundAppearances(annotationStorage);
53693    const buf = [];
53694    const positions = font.getCharPositions(text);
53695    for (const [start, end] of positions) {
53696      buf.push(`(${escapeString(text.substring(start, end))}) Tj`);
53697    }
53698    if (isRTL) {
53699      buf.reverse();
53700    }
53701    const textWidth = combWidth * positions.length;
53702    let hShift = hPadding;
53703    if (alignment === 1) {
53704      hShift += Math.floor((width - textWidth) / (2 * combWidth)) * combWidth;
53705    } else if (alignment === 2) {
53706      hShift += width - textWidth;
53707    }
53708    const renderedComb = buf.join(` ${numberToString(combWidth)} 0 Td `);
53709    return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 ${numberToString(hShift
vendor: 11,937 bytes, lines 53709-54046
53709)} ${numberToString(vPadding + descent)} Tm ${renderedComb}` + " ET Q EMC";
53710  }
53711  _getMultilineAppearance(defaultAppearance, lines, font, fontSize, width, height, alignment, hPadding, vPadding, descent, lineHeight, annotationStorage) {
53712    const buf = [];
53713    const totalWidth = width - 2 * hPadding;
53714    const prevInfo = {
53715      shift: 0
53716    };
53717    for (let i = 0, ii = lines.length; i < ii; i++) {
53718      const line = lines[i];
53719      const chunks = this._splitLine(line, font, fontSize, totalWidth);
53720      for (let j = 0, jj = chunks.length; j < jj; j++) {
53721        const chunk = chunks[j];
53722        const vShift = i === 0 && j === 0 ? -vPadding - (lineHeight - descent) : -lineHeight;
53723        buf.push(this._renderText(chunk, font, fontSize, width, alignment, prevInfo, hPadding, vShift));
53724      }
53725    }
53726    const colors = this.getBorderAndBackgroundAppearances(annotationStorage);
53727    const renderedText = buf.join("\n");
53728    return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 0 ${numberToString(height)} Tm ${renderedText}` + " ET Q EMC";
53729  }
53730  _splitLine(line, font, fontSize, width, cache = {}) {
53731    line = cache.line || line;
53732    const glyphs = cache.glyphs || font.charsToGlyphs(line);
53733    if (glyphs.length <= 1) {
53734      return [line];
53735    }
53736    const positions = cache.positions || font.getCharPositions(line);
53737    const scale = fontSize / 1000;
53738    const chunks = [];
53739    let lastSpacePosInStringStart = -1,
53740      lastSpacePosInStringEnd = -1,
53741      lastSpacePos = -1,
53742      startChunk = 0,
53743      currentWidth = 0;
53744    for (let i = 0, ii = glyphs.length; i < ii; i++) {
53745      const [start, end] = positions[i];
53746      const glyph = glyphs[i];
53747      const glyphWidth = glyph.width * scale;
53748      if (glyph.unicode === " ") {
53749        if (currentWidth + glyphWidth > width) {
53750          chunks.push(line.substring(startChunk, start));
53751          startChunk = start;
53752          currentWidth = glyphWidth;
53753          lastSpacePosInStringStart = -1;
53754          lastSpacePos = -1;
53755        } else {
53756          currentWidth += glyphWidth;
53757          lastSpacePosInStringStart = start;
53758          lastSpacePosInStringEnd = end;
53759          lastSpacePos = i;
53760        }
53761      } else if (currentWidth + glyphWidth > width) {
53762        if (lastSpacePosInStringStart !== -1) {
53763          chunks.push(line.substring(startChunk, lastSpacePosInStringEnd));
53764          startChunk = lastSpacePosInStringEnd;
53765          i = lastSpacePos + 1;
53766          lastSpacePosInStringStart = -1;
53767          currentWidth = 0;
53768        } else {
53769          chunks.push(line.substring(startChunk, start));
53770          startChunk = start;
53771          currentWidth = glyphWidth;
53772        }
53773      } else {
53774        currentWidth += glyphWidth;
53775      }
53776    }
53777    if (startChunk < line.length) {
53778      chunks.push(line.substring(startChunk, line.length));
53779    }
53780    return chunks;
53781  }
53782  async extractTextContent(evaluator, task, viewBox) {
53783    await super.extractTextContent(evaluator, task, viewBox);
53784    const text = this.data.textContent;
53785    if (!text) {
53786      return;
53787    }
53788    const allText = text.join("\n");
53789    if (allText === this.data.fieldValue) {
53790      return;
53791    }
53792    const regex = allText.replaceAll(/([.*+?^${}()|[\]\\])|(\s+)/g, (_m, p1) => p1 ? `\\${p1}` : "\\s+");
53793    if (new RegExp(`^\\s*${regex}\\s*$`).test(this.data.fieldValue)) {
53794      this.data.textContent = this.data.fieldValue.split("\n");
53795    }
53796  }
53797  getFieldObject() {
53798    return {
53799      id: this.data.id,
53800      value: this.data.fieldValue,
53801      defaultValue: this.data.defaultFieldValue || "",
53802      multiline: this.data.multiLine,
53803      password: this.data.password,
53804      charLimit: this.data.maxLen,
53805      comb: this.data.comb,
53806      editable: !this.data.readOnly,
53807      hidden: this.data.hidden,
53808      name: this.data.fieldName,
53809      rect: this.data.rect,
53810      actions: this.data.actions,
53811      page: this.data.pageIndex,
53812      strokeColor: this.data.borderColor,
53813      fillColor: this.data.backgroundColor,
53814      rotation: this.rotation,
53815      datetimeFormat: this.data.datetimeFormat,
53816      hasDatetimeHTML: !!this.data.datetimeType,
53817      type: "text"
53818    };
53819  }
53820}
53821class ButtonWidgetAnnotation extends WidgetAnnotation {
53822  constructor(params) {
53823    super(params);
53824    this.checkedAppearance = null;
53825    this.uncheckedAppearance = null;
53826    const isRadio = this.hasFieldFlag(AnnotationFieldFlag.RADIO),
53827      isPushButton = this.hasFieldFlag(AnnotationFieldFlag.PUSHBUTTON);
53828    this.data.checkBox = !isRadio && !isPushButton;
53829    this.data.radioButton = isRadio && !isPushButton;
53830    this.data.pushButton = isPushButton;
53831    this.data.isTooltipOnly = false;
53832    if (this.data.checkBox) {
53833      this._processCheckBox(params);
53834    } else if (this.data.radioButton) {
53835      this._processRadioButton(params);
53836    } else if (this.data.pushButton) {
53837      this.data.hasOwnCanvas = true;
53838      this.data.noHTML = false;
53839      this._processPushButton(params);
53840    } else {
53841      warn("Invalid field flags for button widget annotation");
53842    }
53843  }
53844  async getOperatorList(evaluator, task, intent, annotationStorage) {
53845    if (this.data.pushButton) {
53846      return super.getOperatorList(evaluator, task, intent, false, annotationStorage);
53847    }
53848    let value = null;
53849    let rotation = null;
53850    if (annotationStorage) {
53851      const storageEntry = annotationStorage.get(this.data.id);
53852      value = storageEntry ? storageEntry.value : null;
53853      rotation = storageEntry ? storageEntry.rotation : null;
53854    }
53855    if (value === null && this.appearance) {
53856      return super.getOperatorList(evaluator, task, intent, annotationStorage);
53857    }
53858    if (value === null || value === undefined) {
53859      value = this.data.checkBox ? this.data.fieldValue === this.data.exportValue : this.data.fieldValue === this.data.buttonValue;
53860    }
53861    const appearance = value ? this.checkedAppearance : this.uncheckedAppearance;
53862    if (appearance) {
53863      const savedAppearance = this.appearance;
53864      const savedMatrix = lookupMatrix(appearance.dict.getArray("Matrix"), IDENTITY_MATRIX);
53865      if (rotation) {
53866        appearance.dict.set("Matrix", this.getRotationMatrix(annotationStorage));
53867      }
53868      this.appearance = appearance;
53869      const operatorList = super.getOperatorList(evaluator, task, intent, annotationStorage);
53870      this.appearance = savedAppearance;
53871      appearance.dict.set("Matrix", savedMatrix);
53872      return operatorList;
53873    }
53874    return {
53875      opList: new OperatorList(),
53876      separateForm: false,
53877      separateCanvas: false
53878    };
53879  }
53880  async save(evaluator, task, annotationStorage, changes) {
53881    if (this.data.checkBox) {
53882      this._saveCheckbox(evaluator, task, annotationStorage, changes);
53883      return;
53884    }
53885    if (this.data.radioButton) {
53886      this._saveRadioButton(evaluator, task, annotationStorage, changes);
53887    }
53888  }
53889  async _saveCheckbox(evaluator, task, annotationStorage, changes) {
53890    if (!annotationStorage) {
53891      return;
53892    }
53893    const storageEntry = annotationStorage.get(this.data.id);
53894    const flags = this._buildFlags(storageEntry?.noView, storageEntry?.noPrint);
53895    let rotation = storageEntry?.rotation,
53896      value = storageEntry?.value;
53897    if (rotation === undefined && flags === undefined) {
53898      if (value === undefined) {
53899        return;
53900      }
53901      const defaultValue = this.data.fieldValue === this.data.exportValue;
53902      if (defaultValue === value) {
53903        return;
53904      }
53905    }
53906    let dict = evaluator.xref.fetchIfRef(this.ref);
53907    if (!(dict instanceof Dict)) {
53908      return;
53909    }
53910    dict = dict.clone();
53911    if (rotation === undefined) {
53912      rotation = this.rotation;
53913    }
53914    if (value === undefined) {
53915      value = this.data.fieldValue === this.data.exportValue;
53916    }
53917    const xfa = {
53918      path: this.data.fieldName,
53919      value: value ? this.data.exportValue : ""
53920    };
53921    const name = Name.get(value ? this.data.exportValue : "Off");
53922    this.setValue(dict, name, evaluator.xref, changes);
53923    dict.set("AS", name);
53924    dict.set("M", `D:${getModificationDate()}`);
53925    if (flags !== undefined) {
53926      dict.set("F", flags);
53927    }
53928    const maybeMK = this._getMKDict(rotation);
53929    if (maybeMK) {
53930      dict.set("MK", maybeMK);
53931    }
53932    changes.put(this.ref, {
53933      data: dict,
53934      xfa,
53935      needAppearances: false
53936    });
53937  }
53938  async _saveRadioButton(evaluator, task, annotationStorage, changes) {
53939    if (!annotationStorage) {
53940      return;
53941    }
53942    const storageEntry = annotationStorage.get(this.data.id);
53943    const flags = this._buildFlags(storageEntry?.noView, storageEntry?.noPrint);
53944    let rotation = storageEntry?.rotation,
53945      value = storageEntry?.value;
53946    if (rotation === undefined && flags === undefined) {
53947      if (value === undefined) {
53948        return;
53949      }
53950      const defaultValue = this.data.fieldValue === this.data.buttonValue;
53951      if (defaultValue === value) {
53952        return;
53953      }
53954    }
53955    let dict = evaluator.xref.fetchIfRef(this.ref);
53956    if (!(dict instanceof Dict)) {
53957      return;
53958    }
53959    dict = dict.clone();
53960    if (value === undefined) {
53961      value = this.data.fieldValue === this.data.buttonValue;
53962    }
53963    if (rotation === undefined) {
53964      rotation = this.rotation;
53965    }
53966    const xfa = {
53967      path: this.data.fieldName,
53968      value: value ? this.data.buttonValue : ""
53969    };
53970    const name = Name.get(value ? this.data.buttonValue : "Off");
53971    if (value) {
53972      this.setValue(dict, name, evaluator.xref, changes);
53973    }
53974    dict.set("AS", name);
53975    dict.set("M", `D:${getModificationDate()}`);
53976    if (flags !== undefined) {
53977      dict.set("F", flags);
53978    }
53979    const maybeMK = this._getMKDict(rotation);
53980    if (maybeMK) {
53981      dict.set("MK", maybeMK);
53982    }
53983    changes.put(this.ref, {
53984      data: dict,
53985      xfa,
53986      needAppearances: false
53987    });
53988  }
53989  _getDefaultCheckedAppearance(params, type) {
53990    const {
53991      width,
53992      height
53993    } = this;
53994    const bbox = [0, 0, width, height];
53995    const FONT_RATIO = 0.8;
53996    const fontSize = Math.min(width, height) * FONT_RATIO;
53997    let metrics, char;
53998    if (type === "check") {
53999      metrics = {
54000        width: 0.755 * fontSize,
54001        height: 0.705 * fontSize
54002      };
54003      char = "\x33";
54004    } else if (type === "disc") {
54005      metrics = {
54006        width: 0.791 * fontSize,
54007        height: 0.705 * fontSize
54008      };
54009      char = "\x6C";
54010    } else {
54011      unreachable(`_getDefaultCheckedAppearance - unsupported type: ${type}`);
54012    }
54013    const xShift = numberToString((width - metrics.width) / 2);
54014    const yShift = numberToString((height - metrics.height) / 2);
54015    const appearance = `q BT /PdfJsZaDb ${fontSize} Tf 0 g ${xShift} ${yShift} Td (${char}) Tj ET Q`;
54016    const appearanceStreamDict = new Dict(params.xref);
54017    appearanceStreamDict.set("FormType", 1);
54018    appearanceStreamDict.setIfName("Subtype", "Form");
54019    appearanceStreamDict.setIfName("Type", "XObject");
54020    appearanceStreamDict.set("BBox", bbox);
54021    appearanceStreamDict.set("Matrix", [1, 0, 0, 1, 0, 0]);
54022    appearanceStreamDict.set("Length", appearance.length);
54023    const resources = new Dict(params.xref);
54024    const font = new Dict(params.xref);
54025    font.set("PdfJsZaDb", this.fallbackFontDict);
54026    resources.set("Font", font);
54027    appearanceStreamDict.set("Resources", resources);
54028    this.checkedAppearance = new StringStream(appearance);
54029    this.checkedAppearance.dict = appearanceStreamDict;
54030    this._streams.push(this.checkedAppearance);
54031  }
54032  _processCheckBox(params) {
54033    const customAppearance = params.dict.get("AP");
54034    if (!(customAppearance instanceof Dict)) {
54035      return;
54036    }
54037    const normalAppearance = customAppearance.get("N");
54038    if (!(normalAppearance instanceof Dict)) {
54039      return;
54040    }
54041    const asValue = this._decodeFormValue(params.dict.get("AS"));
54042    if (typeof asValue === "string") {
54043      this.data.fieldValue = asValue;
54044    }
54045    const yes = this.data.fieldValue !== null && this.data.fieldValue !== "Off" ? this.data.fieldValue : "Yes";
54046    const exportValues = 
vendor: 21,448 bytes, lines 54046-54694
54046[...normalAppearance.getKeys()];
54047    if (exportValues.length === 0) {
54048      exportValues.push("Off", yes);
54049    } else if (exportValues.length === 1) {
54050      if (exportValues[0] === "Off") {
54051        exportValues.push(yes);
54052      } else {
54053        exportValues.unshift("Off");
54054      }
54055    } else if (exportValues.includes(yes)) {
54056      exportValues.length = 0;
54057      exportValues.push("Off", yes);
54058    } else {
54059      const otherYes = exportValues.find(v => v !== "Off");
54060      exportValues.length = 0;
54061      exportValues.push("Off", otherYes);
54062    }
54063    if (!exportValues.includes(this.data.fieldValue)) {
54064      this.data.fieldValue = "Off";
54065    }
54066    this.data.exportValue = exportValues[1];
54067    const checkedAppearance = normalAppearance.get(this.data.exportValue);
54068    this.checkedAppearance = checkedAppearance instanceof BaseStream ? checkedAppearance : null;
54069    const uncheckedAppearance = normalAppearance.get("Off");
54070    this.uncheckedAppearance = uncheckedAppearance instanceof BaseStream ? uncheckedAppearance : null;
54071    if (this.checkedAppearance) {
54072      this._streams.push(this.checkedAppearance);
54073    } else {
54074      this._getDefaultCheckedAppearance(params, "check");
54075    }
54076    if (this.uncheckedAppearance) {
54077      this._streams.push(this.uncheckedAppearance);
54078    }
54079    this._fallbackFontDict = this.fallbackFontDict;
54080    if (this.data.defaultFieldValue === null) {
54081      this.data.defaultFieldValue = "Off";
54082    }
54083  }
54084  _processRadioButton(params) {
54085    this.data.buttonValue = null;
54086    const fieldParent = params.dict.get("Parent");
54087    if (fieldParent instanceof Dict) {
54088      this.parent = params.dict.getRaw("Parent");
54089      const fieldParentValue = fieldParent.get("V");
54090      if (fieldParentValue instanceof Name) {
54091        this.data.fieldValue = this._decodeFormValue(fieldParentValue);
54092      }
54093    }
54094    const appearanceStates = params.dict.get("AP");
54095    if (!(appearanceStates instanceof Dict)) {
54096      return;
54097    }
54098    const normalAppearance = appearanceStates.get("N");
54099    if (!(normalAppearance instanceof Dict)) {
54100      return;
54101    }
54102    for (const key of normalAppearance.getKeys()) {
54103      if (key !== "Off") {
54104        this.data.buttonValue = key;
54105        break;
54106      }
54107    }
54108    const checkedAppearance = normalAppearance.get(this.data.buttonValue);
54109    this.checkedAppearance = checkedAppearance instanceof BaseStream ? checkedAppearance : null;
54110    const uncheckedAppearance = normalAppearance.get("Off");
54111    this.uncheckedAppearance = uncheckedAppearance instanceof BaseStream ? uncheckedAppearance : null;
54112    if (this.checkedAppearance) {
54113      this._streams.push(this.checkedAppearance);
54114    } else {
54115      this._getDefaultCheckedAppearance(params, "disc");
54116    }
54117    if (this.uncheckedAppearance) {
54118      this._streams.push(this.uncheckedAppearance);
54119    }
54120    this._fallbackFontDict = this.fallbackFontDict;
54121    if (this.data.defaultFieldValue === null) {
54122      this.data.defaultFieldValue = "Off";
54123    }
54124  }
54125  _processPushButton(params) {
54126    const {
54127      dict,
54128      annotationGlobals
54129    } = params;
54130    if (!dict.has("A") && !dict.has("AA") && !this.data.alternativeText) {
54131      warn("Push buttons without action dictionaries are not supported");
54132      return;
54133    }
54134    this.data.isTooltipOnly = !dict.has("A") && !dict.has("AA");
54135    Catalog.parseDestDictionary({
54136      destDict: dict,
54137      resultObj: this.data,
54138      docBaseUrl: annotationGlobals.baseUrl,
54139      docAttachments: annotationGlobals.attachments
54140    });
54141  }
54142  getFieldObject() {
54143    let type = "button";
54144    let exportValues;
54145    if (this.data.checkBox) {
54146      type = "checkbox";
54147      exportValues = this.data.exportValue;
54148    } else if (this.data.radioButton) {
54149      type = "radiobutton";
54150      exportValues = this.data.buttonValue;
54151    }
54152    return {
54153      id: this.data.id,
54154      value: this.data.fieldValue || "Off",
54155      defaultValue: this.data.defaultFieldValue,
54156      exportValues,
54157      editable: !this.data.readOnly,
54158      name: this.data.fieldName,
54159      rect: this.data.rect,
54160      hidden: this.data.hidden,
54161      actions: this.data.actions,
54162      page: this.data.pageIndex,
54163      strokeColor: this.data.borderColor,
54164      fillColor: this.data.backgroundColor,
54165      rotation: this.rotation,
54166      type
54167    };
54168  }
54169  get fallbackFontDict() {
54170    const dict = new Dict();
54171    dict.setIfName("BaseFont", "ZapfDingbats");
54172    dict.setIfName("Type", "FallbackType");
54173    dict.setIfName("Subtype", "FallbackType");
54174    dict.setIfName("Encoding", "ZapfDingbatsEncoding");
54175    return shadow(this, "fallbackFontDict", dict);
54176  }
54177}
54178class ChoiceWidgetAnnotation extends WidgetAnnotation {
54179  constructor(params) {
54180    super(params);
54181    const {
54182      dict,
54183      xref
54184    } = params;
54185    this.indices = dict.getArray("I");
54186    this.hasIndices = Array.isArray(this.indices) && this.indices.length > 0;
54187    this.data.options = [];
54188    const options = getInheritableProperty({
54189      dict,
54190      key: "Opt"
54191    });
54192    if (Array.isArray(options)) {
54193      for (let i = 0, ii = options.length; i < ii; i++) {
54194        const option = xref.fetchIfRef(options[i]);
54195        const isOptionArray = Array.isArray(option);
54196        this.data.options[i] = {
54197          exportValue: this._decodeFormValue(isOptionArray ? xref.fetchIfRef(option[0]) : option),
54198          displayValue: this._decodeFormValue(isOptionArray ? xref.fetchIfRef(option[1]) : option)
54199        };
54200      }
54201    }
54202    if (!this.hasIndices) {
54203      if (typeof this.data.fieldValue === "string") {
54204        this.data.fieldValue = [this.data.fieldValue];
54205      } else {
54206        this.data.fieldValue ||= [];
54207      }
54208    } else {
54209      this.data.fieldValue = [];
54210      const ii = this.data.options.length;
54211      for (const i of this.indices) {
54212        if (Number.isInteger(i) && i >= 0 && i < ii) {
54213          this.data.fieldValue.push(this.data.options[i].exportValue);
54214        }
54215      }
54216    }
54217    if (this.data.options.length === 0 && this.data.fieldValue.length > 0) {
54218      this.data.options = this.data.fieldValue.map(value => ({
54219        exportValue: value,
54220        displayValue: value
54221      }));
54222    }
54223    this.data.combo = this.hasFieldFlag(AnnotationFieldFlag.COMBO);
54224    this.data.multiSelect = this.hasFieldFlag(AnnotationFieldFlag.MULTISELECT);
54225    this._hasText = true;
54226  }
54227  getFieldObject() {
54228    const type = this.data.combo ? "combobox" : "listbox";
54229    const value = this.data.fieldValue.length > 0 ? this.data.fieldValue[0] : null;
54230    return {
54231      id: this.data.id,
54232      value,
54233      defaultValue: this.data.defaultFieldValue,
54234      editable: !this.data.readOnly,
54235      name: this.data.fieldName,
54236      rect: this.data.rect,
54237      numItems: this.data.fieldValue.length,
54238      multipleSelection: this.data.multiSelect,
54239      hidden: this.data.hidden,
54240      actions: this.data.actions,
54241      items: this.data.options,
54242      page: this.data.pageIndex,
54243      strokeColor: this.data.borderColor,
54244      fillColor: this.data.backgroundColor,
54245      rotation: this.rotation,
54246      type
54247    };
54248  }
54249  amendSavedDict(annotationStorage, dict) {
54250    if (!this.hasIndices) {
54251      return;
54252    }
54253    let values = annotationStorage?.get(this.data.id)?.value;
54254    if (!Array.isArray(values)) {
54255      values = [values];
54256    }
54257    const indices = [];
54258    const {
54259      options
54260    } = this.data;
54261    for (let i = 0, j = 0, ii = options.length; i < ii; i++) {
54262      if (options[i].exportValue === values[j]) {
54263        indices.push(i);
54264        j += 1;
54265      }
54266    }
54267    dict.set("I", indices);
54268  }
54269  async _getAppearance(evaluator, task, intent, annotationStorage) {
54270    if (this.data.combo) {
54271      return super._getAppearance(evaluator, task, intent, annotationStorage);
54272    }
54273    let exportedValue, rotation;
54274    const storageEntry = annotationStorage?.get(this.data.id);
54275    if (storageEntry) {
54276      rotation = storageEntry.rotation;
54277      exportedValue = storageEntry.value;
54278    }
54279    if (rotation === undefined && exportedValue === undefined && !this._needAppearances) {
54280      return null;
54281    }
54282    if (exportedValue === undefined) {
54283      exportedValue = this.data.fieldValue;
54284    } else if (!Array.isArray(exportedValue)) {
54285      exportedValue = [exportedValue];
54286    }
54287    const defaultPadding = 1;
54288    const defaultHPadding = 2;
54289    let {
54290      width: totalWidth,
54291      height: totalHeight
54292    } = this;
54293    if (rotation === 90 || rotation === 270) {
54294      [totalWidth, totalHeight] = [totalHeight, totalWidth];
54295    }
54296    const lineCount = this.data.options.length;
54297    const valueIndices = [];
54298    for (let i = 0; i < lineCount; i++) {
54299      const {
54300        exportValue
54301      } = this.data.options[i];
54302      if (exportedValue.includes(exportValue)) {
54303        valueIndices.push(i);
54304      }
54305    }
54306    if (!this._defaultAppearance) {
54307      this.data.defaultAppearanceData = parseDefaultAppearance(this._defaultAppearance = "/Helvetica 0 Tf 0 g");
54308    }
54309    const font = await WidgetAnnotation._getFontData(evaluator, task, this.data.defaultAppearanceData, this._fieldResources.mergedResources);
54310    let defaultAppearance;
54311    let {
54312      fontSize
54313    } = this.data.defaultAppearanceData;
54314    if (!fontSize) {
54315      const lineHeight = (totalHeight - defaultPadding) / lineCount;
54316      let lineWidth = -1;
54317      let value;
54318      for (const {
54319        displayValue
54320      } of this.data.options) {
54321        const width = this._getTextWidth(displayValue, font);
54322        if (width > lineWidth) {
54323          lineWidth = width;
54324          value = displayValue;
54325        }
54326      }
54327      [defaultAppearance, fontSize] = this._computeFontSize(lineHeight, totalWidth - 2 * defaultHPadding, value, font, -1);
54328    } else {
54329      defaultAppearance = this._defaultAppearance;
54330    }
54331    const lineHeight = fontSize * LINE_FACTOR;
54332    const vPadding = (lineHeight - fontSize) / 2;
54333    const numberOfVisibleLines = Math.floor(totalHeight / lineHeight);
54334    let firstIndex = 0;
54335    if (valueIndices.length > 0) {
54336      const minIndex = Math.min(...valueIndices);
54337      const maxIndex = Math.max(...valueIndices);
54338      firstIndex = Math.max(0, maxIndex - numberOfVisibleLines + 1);
54339      if (firstIndex > minIndex) {
54340        firstIndex = minIndex;
54341      }
54342    }
54343    const end = Math.min(firstIndex + numberOfVisibleLines + 1, lineCount);
54344    const buf = ["/Tx BMC q", `1 1 ${totalWidth} ${totalHeight} re W n`];
54345    if (valueIndices.length) {
54346      buf.push("0.600006 0.756866 0.854904 rg");
54347      for (const index of valueIndices) {
54348        if (firstIndex <= index && index < end) {
54349          buf.push(`1 ${totalHeight - (index - firstIndex + 1) * lineHeight} ${totalWidth} ${lineHeight} re f`);
54350        }
54351      }
54352    }
54353    buf.push("BT", defaultAppearance, `1 0 0 1 0 ${totalHeight} Tm`);
54354    const prevInfo = {
54355      shift: 0
54356    };
54357    for (let i = firstIndex; i < end; i++) {
54358      const {
54359        displayValue
54360      } = this.data.options[i];
54361      const vpadding = i === firstIndex ? vPadding : 0;
54362      buf.push(this._renderText(displayValue, font, fontSize, totalWidth, 0, prevInfo, defaultHPadding, -lineHeight + vpadding));
54363    }
54364    buf.push("ET Q EMC");
54365    return buf.join("\n");
54366  }
54367}
54368class SignatureWidgetAnnotation extends WidgetAnnotation {
54369  constructor(params) {
54370    super(params);
54371    this.data.fieldValue = null;
54372    this.data.hasOwnCanvas = this.data.noRotate;
54373    this.data.noHTML = !this.data.hasOwnCanvas;
54374  }
54375  getFieldObject() {
54376    return {
54377      id: this.data.id,
54378      value: null,
54379      page: this.data.pageIndex,
54380      type: "signature"
54381    };
54382  }
54383}
54384class TextAnnotation extends MarkupAnnotation {
54385  constructor(params) {
54386    const DEFAULT_ICON_SIZE = 22;
54387    super(params);
54388    this.data.noRotate = true;
54389    this.data.hasOwnCanvas = this.data.noRotate;
54390    this.data.noHTML = false;
54391    const {
54392      dict
54393    } = params;
54394    if (this.data.hasAppearance) {
54395      this.data.name = "NoIcon";
54396    } else {
54397      this.data.rect[1] = this.data.rect[3] - DEFAULT_ICON_SIZE;
54398      this.data.rect[2] = this.data.rect[0] + DEFAULT_ICON_SIZE;
54399      this.data.name = dict.has("Name") ? dict.get("Name").name : "Note";
54400    }
54401    if (dict.has("State")) {
54402      this.data.state = dict.get("State") || null;
54403      this.data.stateModel = dict.get("StateModel") || null;
54404    } else {
54405      this.data.state = null;
54406      this.data.stateModel = null;
54407    }
54408  }
54409}
54410class LinkAnnotation extends Annotation {
54411  constructor(params) {
54412    super(params);
54413    const {
54414      dict,
54415      annotationGlobals
54416    } = params;
54417    this.data.noHTML = false;
54418    const quadPoints = getQuadPoints(dict, this.rectangle);
54419    if (quadPoints) {
54420      this.data.quadPoints = quadPoints;
54421    }
54422    this.data.borderColor ||= this.data.color;
54423    Catalog.parseDestDictionary({
54424      destDict: dict,
54425      resultObj: this.data,
54426      docBaseUrl: annotationGlobals.baseUrl,
54427      docAttachments: annotationGlobals.attachments
54428    });
54429  }
54430  get overlaysTextContent() {
54431    return true;
54432  }
54433}
54434class PopupAnnotation extends Annotation {
54435  constructor(params) {
54436    super(params);
54437    const {
54438      dict
54439    } = params;
54440    this.data.noHTML = false;
54441    if (this.width === 0 || this.height === 0) {
54442      this.data.rect = null;
54443    }
54444    let parentItem = dict.get("Parent");
54445    if (!parentItem) {
54446      warn("Popup annotation has a missing or invalid parent annotation.");
54447      return;
54448    }
54449    this.data.parentRect = lookupNormalRect(parentItem.getArray("Rect"), null);
54450    this.data.creationDate = parentItem.get("CreationDate") || "";
54451    const rt = parentItem.get("RT");
54452    if (isName(rt, AnnotationReplyType.GROUP)) {
54453      parentItem = parentItem.get("IRT");
54454    }
54455    if (!parentItem.has("M")) {
54456      this.data.modificationDate = null;
54457    } else {
54458      this.setModificationDate(parentItem.get("M"));
54459      this.data.modificationDate = this.modificationDate;
54460    }
54461    if (!parentItem.has("C")) {
54462      this.data.color = null;
54463    } else {
54464      this.setColor(parentItem.getArray("C"));
54465      this.data.color = this.color;
54466    }
54467    if (!this.viewable) {
54468      const parentFlags = parentItem.get("F");
54469      if (this._isViewable(parentFlags)) {
54470        this.setFlags(parentFlags);
54471      }
54472    }
54473    this.setTitle(parentItem.get("T"));
54474    this.data.titleObj = this._title;
54475    this.setContents(parentItem.get("Contents"));
54476    this.data.contentsObj = this._contents;
54477    if (parentItem.has("RC")) {
54478      this.data.richText = XFAFactory.getRichTextAsHtml(parentItem.get("RC"));
54479    }
54480    this.data.open = !!dict.get("Open");
54481  }
54482  static createNewDict(annotation, xref, _params) {
54483    const {
54484      oldAnnotation,
54485      rect,
54486      parent
54487    } = annotation;
54488    const popup = oldAnnotation || new Dict(xref);
54489    popup.setIfNotExists("Type", Name.get("Annot"));
54490    popup.setIfNotExists("Subtype", Name.get("Popup"));
54491    popup.setIfNotExists("Open", false);
54492    popup.setIfArray("Rect", rect);
54493    popup.set("Parent", parent);
54494    return popup;
54495  }
54496  static async createNewAppearanceStream(annotation, xref, params) {
54497    return null;
54498  }
54499}
54500class FreeTextAnnotation extends MarkupAnnotation {
54501  constructor(params) {
54502    super(params);
54503    this.data.hasOwnCanvas = this.data.noRotate;
54504    this.data.isEditable = !this.data.noHTML;
54505    this.data.noHTML = false;
54506    const {
54507      annotationGlobals,
54508      xref
54509    } = params;
54510    this.setDefaultAppearance(params);
54511    this._hasAppearance = !!this.appearance;
54512    if (this._hasAppearance) {
54513      const {
54514        fontColor,
54515        fontSize
54516      } = parseAppearanceStream(this.appearance, xref, annotationGlobals.globalColorSpaceCache);
54517      this.data.defaultAppearanceData.fontColor = fontColor;
54518      this.data.defaultAppearanceData.fontSize = fontSize || 10;
54519    } else {
54520      this.data.defaultAppearanceData.fontSize ||= 10;
54521      const {
54522        fontColor,
54523        fontSize
54524      } = this.data.defaultAppearanceData;
54525      if (this._contents.str) {
54526        this.data.textContent = this._contents.str.split(/\r\n?|\n/).map(line => line.trimEnd());
54527        const {
54528          coords,
54529          bbox,
54530          matrix
54531        } = FakeUnicodeFont.getFirstPositionInfo(this.rectangle, this.rotation, fontSize);
54532        this.data.textPosition = this._transformPoint(coords, bbox, matrix);
54533      }
54534      if (this._isOffscreenCanvasSupported) {
54535        const strokeAlpha = params.dict.get("CA");
54536        const fakeUnicodeFont = new FakeUnicodeFont(xref, "sans-serif");
54537        this.appearance = fakeUnicodeFont.createAppearance(this._contents.str, this.rectangle, this.rotation, fontSize, fontColor, strokeAlpha);
54538        this._streams.push(this.appearance);
54539      } else {
54540        warn("FreeTextAnnotation: OffscreenCanvas is not supported, annotation may not render correctly.");
54541      }
54542    }
54543  }
54544  get hasTextContent() {
54545    return this._hasAppearance;
54546  }
54547  static createNewDict(annotation, xref, {
54548    apRef,
54549    ap
54550  }) {
54551    const {
54552      color,
54553      date,
54554      fontSize,
54555      oldAnnotation,
54556      rect,
54557      rotation,
54558      user,
54559      value
54560    } = annotation;
54561    const freetext = oldAnnotation || new Dict(xref);
54562    freetext.setIfNotExists("Type", Name.get("Annot"));
54563    freetext.setIfNotExists("Subtype", Name.get("FreeText"));
54564    freetext.set(oldAnnotation ? "M" : "CreationDate", `D:${getModificationDate(date)}`);
54565    if (oldAnnotation) {
54566      freetext.delete("RC");
54567    }
54568    freetext.setIfArray("Rect", rect);
54569    const da = `/Helv ${fontSize} Tf ${getPdfColor(color, true)}`;
54570    freetext.set("DA", da);
54571    freetext.setIfDefined("Contents", stringToAsciiOrUTF16BE(value));
54572    freetext.setIfNotExists("F", 4);
54573    freetext.setIfNotExists("Border", [0, 0, 0]);
54574    freetext.setIfNumber("Rotate", rotation);
54575    freetext.setIfDefined("T", stringToAsciiOrUTF16BE(user));
54576    if (apRef || ap) {
54577      const n = new Dict(xref);
54578      freetext.set("AP", n);
54579      n.set("N", apRef || ap);
54580    }
54581    return freetext;
54582  }
54583  static async createNewAppearanceStream(annotation, xref, params) {
54584    const {
54585      baseFontRef,
54586      evaluator,
54587      task
54588    } = params;
54589    const {
54590      color,
54591      fontSize,
54592      rect,
54593      rotation,
54594      value
54595    } = annotation;
54596    if (!color) {
54597      return null;
54598    }
54599    const resources = new Dict(xref);
54600    const font = new Dict(xref);
54601    if (baseFontRef) {
54602      font.set("Helv", baseFontRef);
54603    } else {
54604      const baseFont = new Dict(xref);
54605      baseFont.setIfName("BaseFont", "Helvetica");
54606      baseFont.setIfName("Type", "Font");
54607      baseFont.setIfName("Subtype", "Type1");
54608      baseFont.setIfName("Encoding", "WinAnsiEncoding");
54609      font.set("Helv", baseFont);
54610    }
54611    resources.set("Font", font);
54612    const helv = await WidgetAnnotation._getFontData(evaluator, task, {
54613      fontName: "Helv",
54614      fontSize
54615    }, resources);
54616    const [x1, y1, x2, y2] = rect;
54617    let w = x2 - x1;
54618    let h = y2 - y1;
54619    if (rotation % 180 !== 0) {
54620      [w, h] = [h, w];
54621    }
54622    const lines = value.split("\n");
54623    const scale = fontSize / 1000;
54624    let totalWidth = -Infinity;
54625    const encodedLines = [];
54626    for (let line of lines) {
54627      const encoded = helv.encodeString(line);
54628      if (encoded.length > 1) {
54629        return null;
54630      }
54631      line = encoded.join("");
54632      encodedLines.push(line);
54633      let lineWidth = 0;
54634      const glyphs = helv.charsToGlyphs(line);
54635      for (const glyph of glyphs) {
54636        lineWidth += glyph.width * scale;
54637      }
54638      totalWidth = Math.max(totalWidth, lineWidth);
54639    }
54640    let hscale = 1;
54641    if (totalWidth > w) {
54642      hscale = w / totalWidth;
54643    }
54644    let vscale = 1;
54645    const lineHeight = LINE_FACTOR * fontSize;
54646    const lineAscent = (LINE_FACTOR - LINE_DESCENT_FACTOR) * fontSize;
54647    const totalHeight = lineHeight * lines.length;
54648    if (totalHeight > h) {
54649      vscale = h / totalHeight;
54650    }
54651    const fscale = Math.min(hscale, vscale);
54652    const newFontSize = fontSize * fscale;
54653    let firstPoint, clipBox, matrix;
54654    switch (rotation) {
54655      case 0:
54656        matrix = [1, 0, 0, 1];
54657        clipBox = [rect[0], rect[1], w, h];
54658        firstPoint = [rect[0], rect[3] - lineAscent];
54659        break;
54660      case 90:
54661        matrix = [0, 1, -1, 0];
54662        clipBox = [rect[1], -rect[2], w, h];
54663        firstPoint = [rect[1], -rect[0] - lineAscent];
54664        break;
54665      case 180:
54666        matrix = [-1, 0, 0, -1];
54667        clipBox = [-rect[2], -rect[3], w, h];
54668        firstPoint = [-rect[2], -rect[1] - lineAscent];
54669        break;
54670      case 270:
54671        matrix = [0, -1, 1, 0];
54672        clipBox = [-rect[3], rect[0], w, h];
54673        firstPoint = [-rect[3], rect[2] - lineAscent];
54674        break;
54675    }
54676    const buffer = ["q", `${matrix.join(" ")} 0 0 cm`, `${clipBox.join(" ")} re W n`, `BT`, `${getPdfColor(color, true)}`, `0 Tc /Helv ${numberToString(newFontSize)} Tf`];
54677    buffer.push(`${firstPoint.join(" ")} Td (${escapeString(encodedLines[0])}) Tj`);
54678    const vShift = numberToString(lineHeight);
54679    for (let i = 1, ii = encodedLines.length; i < ii; i++) {
54680      const line = encodedLines[i];
54681      buffer.push(`0 -${vShift} Td (${escapeString(line)}) Tj`);
54682    }
54683    buffer.push("ET", "Q");
54684    const appearance = buffer.join("\n");
54685    const appearanceStreamDict = new Dict(xref);
54686    appearanceStreamDict.set("FormType", 1);
54687    appearanceStreamDict.setIfName("Subtype", "Form");
54688    appearanceStreamDict.setIfName("Type", "XObject");
54689    appearanceStreamDict.set("BBox", rect);
54690    appearanceStreamDict.set("Resources", resources);
54691    appearanceStreamDict.set("Matrix", [1, 0, 0, 1, -rect[0], -rect[1]]);
54692    const ap = new StringStream(appearance);
54693    ap.dict = appearanceStreamDict;
54694    return ap
vendor: 5,658 bytes, lines 54694-54847
54694;
54695  }
54696}
54697class LineAnnotation extends MarkupAnnotation {
54698  constructor(params) {
54699    super(params);
54700    const {
54701      dict,
54702      xref
54703    } = params;
54704    this.data.hasOwnCanvas = this.data.noRotate;
54705    this.data.noHTML = false;
54706    const lineCoordinates = lookupRect(dict.getArray("L"), [0, 0, 0, 0]);
54707    this.data.lineCoordinates = Util.normalizeRect(lineCoordinates);
54708    this.setLineEndings(dict.getArray("LE"));
54709    this.data.lineEndings = this.lineEndings;
54710    if (!this.appearance) {
54711      const strokeColor = getPdfColorArray(this.color, [0, 0, 0]);
54712      const strokeAlpha = dict.get("CA");
54713      const interiorColor = getRgbColor(dict.getArray("IC"), null);
54714      const fillColor = getPdfColorArray(interiorColor);
54715      const fillAlpha = fillColor ? strokeAlpha : null;
54716      const borderWidth = this.borderStyle.width || 1,
54717        borderAdjust = 2 * borderWidth;
54718      const bbox = [this.data.lineCoordinates[0] - borderAdjust, this.data.lineCoordinates[1] - borderAdjust, this.data.lineCoordinates[2] + borderAdjust, this.data.lineCoordinates[3] + borderAdjust];
54719      if (!Util.intersect(this.rectangle, bbox)) {
54720        this.rectangle = bbox;
54721      }
54722      this._setDefaultAppearance({
54723        xref,
54724        extra: `${borderWidth} w`,
54725        strokeColor,
54726        fillColor,
54727        strokeAlpha,
54728        fillAlpha,
54729        pointsCallback: (buffer, points) => {
54730          buffer.push(`${lineCoordinates[0]} ${lineCoordinates[1]} m`, `${lineCoordinates[2]} ${lineCoordinates[3]} l`, "S");
54731          return [points[0] - borderWidth, points[7] - borderWidth, points[2] + borderWidth, points[3] + borderWidth];
54732        }
54733      });
54734    }
54735  }
54736}
54737class SquareAnnotation extends MarkupAnnotation {
54738  constructor(params) {
54739    super(params);
54740    const {
54741      dict,
54742      xref
54743    } = params;
54744    this.data.hasOwnCanvas = this.data.noRotate;
54745    this.data.noHTML = false;
54746    if (!this.appearance) {
54747      const strokeColor = getPdfColorArray(this.color, [0, 0, 0]);
54748      const strokeAlpha = dict.get("CA");
54749      const interiorColor = getRgbColor(dict.getArray("IC"), null);
54750      const fillColor = getPdfColorArray(interiorColor);
54751      const fillAlpha = fillColor ? strokeAlpha : null;
54752      if (this.borderStyle.width === 0 && !fillColor) {
54753        return;
54754      }
54755      this._setDefaultAppearance({
54756        xref,
54757        extra: `${this.borderStyle.width} w`,
54758        strokeColor,
54759        fillColor,
54760        strokeAlpha,
54761        fillAlpha,
54762        pointsCallback: (buffer, points) => {
54763          const x = points[4] + this.borderStyle.width / 2;
54764          const y = points[5] + this.borderStyle.width / 2;
54765          const width = points[6] - points[4] - this.borderStyle.width;
54766          const height = points[3] - points[7] - this.borderStyle.width;
54767          buffer.push(`${x} ${y} ${width} ${height} re`);
54768          if (fillColor) {
54769            buffer.push("B");
54770          } else {
54771            buffer.push("S");
54772          }
54773          return [points[0], points[7], points[2], points[3]];
54774        }
54775      });
54776    }
54777  }
54778}
54779class CircleAnnotation extends MarkupAnnotation {
54780  constructor(params) {
54781    super(params);
54782    const {
54783      dict,
54784      xref
54785    } = params;
54786    if (!this.appearance) {
54787      const strokeColor = getPdfColorArray(this.color, [0, 0, 0]);
54788      const strokeAlpha = dict.get("CA");
54789      const interiorColor = getRgbColor(dict.getArray("IC"), null);
54790      const fillColor = getPdfColorArray(interiorColor);
54791      const fillAlpha = fillColor ? strokeAlpha : null;
54792      if (this.borderStyle.width === 0 && !fillColor) {
54793        return;
54794      }
54795      const controlPointsDistance = 4 / 3 * Math.tan(Math.PI / (2 * 4));
54796      this._setDefaultAppearance({
54797        xref,
54798        extra: `${this.borderStyle.width} w`,
54799        strokeColor,
54800        fillColor,
54801        strokeAlpha,
54802        fillAlpha,
54803        pointsCallback: (buffer, points) => {
54804          const x0 = points[0] + this.borderStyle.width / 2;
54805          const y0 = points[1] - this.borderStyle.width / 2;
54806          const x1 = points[6] - this.borderStyle.width / 2;
54807          const y1 = points[7] + this.borderStyle.width / 2;
54808          const xMid = x0 + (x1 - x0) / 2;
54809          const yMid = y0 + (y1 - y0) / 2;
54810          const xOffset = (x1 - x0) / 2 * controlPointsDistance;
54811          const yOffset = (y1 - y0) / 2 * controlPointsDistance;
54812          buffer.push(`${xMid} ${y1} m`, `${xMid + xOffset} ${y1} ${x1} ${yMid + yOffset} ${x1} ${yMid} c`, `${x1} ${yMid - yOffset} ${xMid + xOffset} ${y0} ${xMid} ${y0} c`, `${xMid - xOffset} ${y0} ${x0} ${yMid - yOffset} ${x0} ${yMid} c`, `${x0} ${yMid + yOffset} ${xMid - xOffset} ${y1} ${xMid} ${y1} c`, "h");
54813          if (fillColor) {
54814            buffer.push("B");
54815          } else {
54816            buffer.push("S");
54817          }
54818          return [points[0], points[7], points[2], points[3]];
54819        }
54820      });
54821    }
54822  }
54823}
54824class PolylineAnnotation extends MarkupAnnotation {
54825  constructor(params) {
54826    super(params);
54827    const {
54828      dict,
54829      xref
54830    } = params;
54831    this.data.hasOwnCanvas = this.data.noRotate;
54832    this.data.noHTML = false;
54833    this.data.vertices = null;
54834    if (!(this instanceof PolygonAnnotation)) {
54835      this.setLineEndings(dict.getArray("LE"));
54836      this.data.lineEndings = this.lineEndings;
54837    }
54838    const rawVertices = dict.getArray("Vertices");
54839    if (!isNumberArray(rawVertices, null)) {
54840      return;
54841    }
54842    const vertices = this.data.vertices = Float32Array.from(rawVertices);
54843    if (!this.appearance) {
54844      const strokeColor = getPdfColorArray(this.color, [0, 0, 0]);
54845      const strokeAlpha = dict.get("CA");
54846      let fillColor = getRgbColor(dict.getArray("IC"), null);
54847      
vendor: 23,598 bytes, lines 54847-55542
54847if (fillColor) {
54848        fillColor = getPdfColorArray(fillColor);
54849      }
54850      let operator;
54851      if (fillColor) {
54852        if (this.color) {
54853          operator = fillColor.every((c, i) => c === strokeColor[i]) ? "f" : "B";
54854        } else {
54855          operator = "f";
54856        }
54857      } else {
54858        operator = "S";
54859      }
54860      const borderWidth = this.borderStyle.width || 1,
54861        borderAdjust = 2 * borderWidth;
54862      const bbox = BBOX_INIT.slice();
54863      for (let i = 0, ii = vertices.length; i < ii; i += 2) {
54864        Util.rectBoundingBox(vertices[i] - borderAdjust, vertices[i + 1] - borderAdjust, vertices[i] + borderAdjust, vertices[i + 1] + borderAdjust, bbox);
54865      }
54866      if (!Util.intersect(this.rectangle, bbox)) {
54867        this.rectangle = bbox;
54868      }
54869      this._setDefaultAppearance({
54870        xref,
54871        extra: `${borderWidth} w`,
54872        strokeColor,
54873        strokeAlpha,
54874        fillColor,
54875        fillAlpha: fillColor ? strokeAlpha : null,
54876        pointsCallback: (buffer, points) => {
54877          for (let i = 0, ii = vertices.length; i < ii; i += 2) {
54878            buffer.push(`${vertices[i]} ${vertices[i + 1]} ${i === 0 ? "m" : "l"}`);
54879          }
54880          buffer.push(operator);
54881          return [points[0], points[7], points[2], points[3]];
54882        }
54883      });
54884    }
54885  }
54886}
54887class PolygonAnnotation extends PolylineAnnotation {}
54888class CaretAnnotation extends MarkupAnnotation {}
54889class InkAnnotation extends MarkupAnnotation {
54890  constructor(params) {
54891    super(params);
54892    this.data.hasOwnCanvas = this.data.noRotate;
54893    this.data.noHTML = false;
54894    const {
54895      dict,
54896      xref
54897    } = params;
54898    this.data.inkLists = [];
54899    this.data.isEditable = !this.data.noHTML;
54900    this.data.noHTML = false;
54901    this.data.opacity = dict.get("CA") || 1;
54902    const rawInkLists = dict.getArray("InkList");
54903    if (!Array.isArray(rawInkLists)) {
54904      return;
54905    }
54906    for (let i = 0, ii = rawInkLists.length; i < ii; ++i) {
54907      if (!Array.isArray(rawInkLists[i])) {
54908        continue;
54909      }
54910      const inkList = new Float32Array(rawInkLists[i].length);
54911      this.data.inkLists.push(inkList);
54912      for (let j = 0, jj = rawInkLists[i].length; j < jj; j += 2) {
54913        const x = xref.fetchIfRef(rawInkLists[i][j]),
54914          y = xref.fetchIfRef(rawInkLists[i][j + 1]);
54915        if (typeof x === "number" && typeof y === "number") {
54916          inkList[j] = x;
54917          inkList[j + 1] = y;
54918        }
54919      }
54920    }
54921    if (!this.appearance) {
54922      const strokeColor = getPdfColorArray(this.color, [0, 0, 0]);
54923      const strokeAlpha = dict.get("CA");
54924      const borderWidth = this.borderStyle.width || 1,
54925        borderAdjust = 2 * borderWidth;
54926      const bbox = BBOX_INIT.slice();
54927      for (const inkList of this.data.inkLists) {
54928        for (let i = 0, ii = inkList.length; i < ii; i += 2) {
54929          Util.rectBoundingBox(inkList[i] - borderAdjust, inkList[i + 1] - borderAdjust, inkList[i] + borderAdjust, inkList[i + 1] + borderAdjust, bbox);
54930        }
54931      }
54932      if (!Util.intersect(this.rectangle, bbox)) {
54933        this.rectangle = bbox;
54934      }
54935      this._setDefaultAppearance({
54936        xref,
54937        extra: `${borderWidth} w`,
54938        strokeColor,
54939        strokeAlpha,
54940        pointsCallback: (buffer, points) => {
54941          for (const inkList of this.data.inkLists) {
54942            for (let i = 0, ii = inkList.length; i < ii; i += 2) {
54943              buffer.push(`${inkList[i]} ${inkList[i + 1]} ${i === 0 ? "m" : "l"}`);
54944            }
54945            buffer.push("S");
54946          }
54947          return [points[0], points[7], points[2], points[3]];
54948        }
54949      });
54950    }
54951  }
54952  static createNewDict(annotation, xref, {
54953    apRef,
54954    ap
54955  }) {
54956    const {
54957      oldAnnotation,
54958      color,
54959      date,
54960      opacity,
54961      paths,
54962      outlines,
54963      rect,
54964      rotation,
54965      thickness,
54966      user
54967    } = annotation;
54968    const ink = oldAnnotation || new Dict(xref);
54969    ink.setIfNotExists("Type", Name.get("Annot"));
54970    ink.setIfNotExists("Subtype", Name.get("Ink"));
54971    ink.set(oldAnnotation ? "M" : "CreationDate", `D:${getModificationDate(date)}`);
54972    ink.setIfArray("Rect", rect);
54973    ink.setIfArray("InkList", outlines?.points || paths?.points);
54974    ink.setIfNotExists("F", 4);
54975    ink.setIfNumber("Rotate", rotation);
54976    ink.setIfDefined("T", stringToAsciiOrUTF16BE(user));
54977    if (outlines) {
54978      ink.setIfName("IT", "InkHighlight");
54979    }
54980    if (thickness > 0) {
54981      const bs = new Dict(xref);
54982      ink.set("BS", bs);
54983      bs.set("W", thickness);
54984    }
54985    ink.setIfArray("C", getPdfColorArray(color));
54986    ink.setIfNumber("CA", opacity);
54987    if (ap || apRef) {
54988      const n = new Dict(xref);
54989      ink.set("AP", n);
54990      n.set("N", apRef || ap);
54991    }
54992    return ink;
54993  }
54994  static async createNewAppearanceStream(annotation, xref, params) {
54995    if (annotation.outlines) {
54996      return this.createNewAppearanceStreamForHighlight(annotation, xref, params);
54997    }
54998    const {
54999      color,
55000      rect,
55001      paths,
55002      thickness,
55003      opacity
55004    } = annotation;
55005    if (!color) {
55006      return null;
55007    }
55008    const appearanceBuffer = [`${thickness} w 1 J 1 j`, `${getPdfColor(color, false)}`];
55009    if (opacity !== 1) {
55010      appearanceBuffer.push("/R0 gs");
55011    }
55012    for (const outline of paths.lines) {
55013      appearanceBuffer.push(`${numberToString(outline[4])} ${numberToString(outline[5])} m`);
55014      for (let i = 6, ii = outline.length; i < ii; i += 6) {
55015        if (isNaN(outline[i])) {
55016          appearanceBuffer.push(`${numberToString(outline[i + 4])} ${numberToString(outline[i + 5])} l`);
55017        } else {
55018          const [c1x, c1y, c2x, c2y, x, y] = outline.slice(i, i + 6);
55019          appearanceBuffer.push([c1x, c1y, c2x, c2y, x, y].map(numberToString).join(" ") + " c");
55020        }
55021      }
55022      if (outline.length === 6) {
55023        appearanceBuffer.push(`${numberToString(outline[4])} ${numberToString(outline[5])} l`);
55024      }
55025    }
55026    appearanceBuffer.push("S");
55027    const appearance = appearanceBuffer.join("\n");
55028    const appearanceStreamDict = new Dict(xref);
55029    appearanceStreamDict.set("FormType", 1);
55030    appearanceStreamDict.setIfName("Subtype", "Form");
55031    appearanceStreamDict.setIfName("Type", "XObject");
55032    appearanceStreamDict.set("BBox", rect);
55033    appearanceStreamDict.set("Length", appearance.length);
55034    if (opacity !== 1) {
55035      const resources = new Dict(xref);
55036      const extGState = new Dict(xref);
55037      const r0 = new Dict(xref);
55038      r0.set("CA", opacity);
55039      r0.setIfName("Type", "ExtGState");
55040      extGState.set("R0", r0);
55041      resources.set("ExtGState", extGState);
55042      appearanceStreamDict.set("Resources", resources);
55043    }
55044    const ap = new StringStream(appearance);
55045    ap.dict = appearanceStreamDict;
55046    return ap;
55047  }
55048  static async createNewAppearanceStreamForHighlight(annotation, xref, params) {
55049    const {
55050      color,
55051      rect,
55052      outlines: {
55053        outline
55054      },
55055      opacity
55056    } = annotation;
55057    if (!color) {
55058      return null;
55059    }
55060    const appearanceBuffer = [`${getPdfColor(color, true)}`, "/R0 gs"];
55061    appearanceBuffer.push(`${numberToString(outline[4])} ${numberToString(outline[5])} m`);
55062    for (let i = 6, ii = outline.length; i < ii; i += 6) {
55063      if (isNaN(outline[i])) {
55064        appearanceBuffer.push(`${numberToString(outline[i + 4])} ${numberToString(outline[i + 5])} l`);
55065      } else {
55066        const [c1x, c1y, c2x, c2y, x, y] = outline.slice(i, i + 6);
55067        appearanceBuffer.push([c1x, c1y, c2x, c2y, x, y].map(numberToString).join(" ") + " c");
55068      }
55069    }
55070    appearanceBuffer.push("h f");
55071    const appearance = appearanceBuffer.join("\n");
55072    const appearanceStreamDict = new Dict(xref);
55073    appearanceStreamDict.set("FormType", 1);
55074    appearanceStreamDict.setIfName("Subtype", "Form");
55075    appearanceStreamDict.setIfName("Type", "XObject");
55076    appearanceStreamDict.set("BBox", rect);
55077    appearanceStreamDict.set("Length", appearance.length);
55078    const resources = new Dict(xref);
55079    const extGState = new Dict(xref);
55080    resources.set("ExtGState", extGState);
55081    appearanceStreamDict.set("Resources", resources);
55082    const r0 = new Dict(xref);
55083    extGState.set("R0", r0);
55084    r0.setIfName("BM", "Multiply");
55085    if (opacity !== 1) {
55086      r0.set("ca", opacity);
55087      r0.setIfName("Type", "ExtGState");
55088    }
55089    const ap = new StringStream(appearance);
55090    ap.dict = appearanceStreamDict;
55091    return ap;
55092  }
55093}
55094class HighlightAnnotation extends MarkupAnnotation {
55095  constructor(params) {
55096    super(params);
55097    const {
55098      dict,
55099      xref
55100    } = params;
55101    this.data.isEditable = !this.data.noHTML;
55102    this.data.noHTML = false;
55103    this.data.opacity = dict.get("CA") || 1;
55104    const quadPoints = this.data.quadPoints = getQuadPoints(dict, null);
55105    if (quadPoints) {
55106      const resources = this.appearance?.dict.get("Resources");
55107      if (!this.appearance || !resources?.has("ExtGState")) {
55108        if (this.appearance) {
55109          warn("HighlightAnnotation - ignoring built-in appearance stream.");
55110        }
55111        const fillColor = getPdfColorArray(this.color, [1, 1, 0]);
55112        const fillAlpha = dict.get("CA");
55113        this._setDefaultAppearance({
55114          xref,
55115          fillColor,
55116          blendMode: "Multiply",
55117          fillAlpha,
55118          pointsCallback: (buffer, points) => {
55119            buffer.push(`${points[0]} ${points[1]} m`, `${points[2]} ${points[3]} l`, `${points[6]} ${points[7]} l`, `${points[4]} ${points[5]} l`, "f");
55120            return [points[0], points[7], points[2], points[3]];
55121          }
55122        });
55123      }
55124    } else {
55125      this.data.popupRef = null;
55126    }
55127  }
55128  get overlaysTextContent() {
55129    return true;
55130  }
55131  static createNewDict(annotation, xref, {
55132    apRef,
55133    ap
55134  }) {
55135    const {
55136      color,
55137      date,
55138      oldAnnotation,
55139      opacity,
55140      rect,
55141      rotation,
55142      user,
55143      quadPoints
55144    } = annotation;
55145    const highlight = oldAnnotation || new Dict(xref);
55146    highlight.setIfNotExists("Type", Name.get("Annot"));
55147    highlight.setIfNotExists("Subtype", Name.get("Highlight"));
55148    highlight.set(oldAnnotation ? "M" : "CreationDate", `D:${getModificationDate(date)}`);
55149    highlight.setIfArray("Rect", rect);
55150    highlight.setIfNotExists("F", 4);
55151    highlight.setIfNotExists("Border", [0, 0, 0]);
55152    highlight.setIfNumber("Rotate", rotation);
55153    highlight.setIfArray("QuadPoints", quadPoints);
55154    highlight.setIfArray("C", getPdfColorArray(color));
55155    highlight.setIfNumber("CA", opacity);
55156    highlight.setIfDefined("T", stringToAsciiOrUTF16BE(user));
55157    if (apRef || ap) {
55158      const n = new Dict(xref);
55159      highlight.set("AP", n);
55160      n.set("N", apRef || ap);
55161    }
55162    return highlight;
55163  }
55164  static async createNewAppearanceStream(annotation, xref, params) {
55165    const {
55166      color,
55167      rect,
55168      outlines,
55169      opacity
55170    } = annotation;
55171    if (!color) {
55172      return null;
55173    }
55174    const appearanceBuffer = [`${getPdfColor(color, true)}`, "/R0 gs"];
55175    const buffer = [];
55176    for (const outline of outlines) {
55177      buffer.length = 0;
55178      buffer.push(`${numberToString(outline[0])} ${numberToString(outline[1])} m`);
55179      for (let i = 2, ii = outline.length; i < ii; i += 2) {
55180        buffer.push(`${numberToString(outline[i])} ${numberToString(outline[i + 1])} l`);
55181      }
55182      buffer.push("h");
55183      appearanceBuffer.push(buffer.join("\n"));
55184    }
55185    appearanceBuffer.push("f*");
55186    const appearance = appearanceBuffer.join("\n");
55187    const appearanceStreamDict = new Dict(xref);
55188    appearanceStreamDict.set("FormType", 1);
55189    appearanceStreamDict.setIfName("Subtype", "Form");
55190    appearanceStreamDict.setIfName("Type", "XObject");
55191    appearanceStreamDict.set("BBox", rect);
55192    appearanceStreamDict.set("Length", appearance.length);
55193    const resources = new Dict(xref);
55194    const extGState = new Dict(xref);
55195    resources.set("ExtGState", extGState);
55196    appearanceStreamDict.set("Resources", resources);
55197    const r0 = new Dict(xref);
55198    extGState.set("R0", r0);
55199    r0.setIfName("BM", "Multiply");
55200    if (opacity !== 1) {
55201      r0.set("ca", opacity);
55202      r0.setIfName("Type", "ExtGState");
55203    }
55204    const ap = new StringStream(appearance);
55205    ap.dict = appearanceStreamDict;
55206    return ap;
55207  }
55208}
55209class UnderlineAnnotation extends MarkupAnnotation {
55210  constructor(params) {
55211    super(params);
55212    const {
55213      dict,
55214      xref
55215    } = params;
55216    const quadPoints = this.data.quadPoints = getQuadPoints(dict, null);
55217    if (quadPoints) {
55218      if (!this.appearance) {
55219        const strokeColor = getPdfColorArray(this.color, [0, 0, 0]);
55220        const strokeAlpha = dict.get("CA");
55221        this._setDefaultAppearance({
55222          xref,
55223          extra: "[] 0 d 0.571 w",
55224          strokeColor,
55225          strokeAlpha,
55226          pointsCallback: (buffer, points) => {
55227            buffer.push(`${points[4]} ${points[5] + 1.3} m`, `${points[6]} ${points[7] + 1.3} l`, "S");
55228            return [points[0], points[7], points[2], points[3]];
55229          }
55230        });
55231      }
55232    } else {
55233      this.data.popupRef = null;
55234    }
55235  }
55236  get overlaysTextContent() {
55237    return true;
55238  }
55239}
55240class SquigglyAnnotation extends MarkupAnnotation {
55241  constructor(params) {
55242    super(params);
55243    const {
55244      dict,
55245      xref
55246    } = params;
55247    const quadPoints = this.data.quadPoints = getQuadPoints(dict, null);
55248    if (quadPoints) {
55249      if (!this.appearance) {
55250        const strokeColor = getPdfColorArray(this.color, [0, 0, 0]);
55251        const strokeAlpha = dict.get("CA");
55252        this._setDefaultAppearance({
55253          xref,
55254          extra: "[] 0 d 1 w",
55255          strokeColor,
55256          strokeAlpha,
55257          pointsCallback: (buffer, points) => {
55258            const dy = (points[1] - points[5]) / 6;
55259            let shift = dy;
55260            let x = points[4];
55261            const y = points[5];
55262            const xEnd = points[6];
55263            buffer.push(`${x} ${y + shift} m`);
55264            do {
55265              x += 2;
55266              shift = shift === 0 ? dy : 0;
55267              buffer.push(`${x} ${y + shift} l`);
55268            } while (x < xEnd);
55269            buffer.push("S");
55270            return [points[4], y - 2 * dy, xEnd, y + 2 * dy];
55271          }
55272        });
55273      }
55274    } else {
55275      this.data.popupRef = null;
55276    }
55277  }
55278  get overlaysTextContent() {
55279    return true;
55280  }
55281}
55282class StrikeOutAnnotation extends MarkupAnnotation {
55283  constructor(params) {
55284    super(params);
55285    const {
55286      dict,
55287      xref
55288    } = params;
55289    const quadPoints = this.data.quadPoints = getQuadPoints(dict, null);
55290    if (quadPoints) {
55291      if (!this.appearance) {
55292        const strokeColor = getPdfColorArray(this.color, [0, 0, 0]);
55293        const strokeAlpha = dict.get("CA");
55294        this._setDefaultAppearance({
55295          xref,
55296          extra: "[] 0 d 1 w",
55297          strokeColor,
55298          strokeAlpha,
55299          pointsCallback: (buffer, points) => {
55300            buffer.push(`${(points[0] + points[4]) / 2} ` + `${(points[1] + points[5]) / 2} m`, `${(points[2] + points[6]) / 2} ` + `${(points[3] + points[7]) / 2} l`, "S");
55301            return [points[0], points[7], points[2], points[3]];
55302          }
55303        });
55304      }
55305    } else {
55306      this.data.popupRef = null;
55307    }
55308  }
55309  get overlaysTextContent() {
55310    return true;
55311  }
55312}
55313class StampAnnotation extends MarkupAnnotation {
55314  #savedHasOwnCanvas = null;
55315  constructor(params) {
55316    super(params);
55317    this.data.hasOwnCanvas = this.data.noRotate;
55318    this.data.isEditable = !this.data.noHTML;
55319    this.data.noHTML = false;
55320  }
55321  mustBeViewedWhenEditing(isEditing, modifiedIds = null) {
55322    if (isEditing) {
55323      if (!this.data.isEditable) {
55324        return true;
55325      }
55326      this.#savedHasOwnCanvas ??= this.data.hasOwnCanvas;
55327      this.data.hasOwnCanvas = true;
55328      return true;
55329    }
55330    if (this.#savedHasOwnCanvas !== null) {
55331      this.data.hasOwnCanvas = this.#savedHasOwnCanvas;
55332      this.#savedHasOwnCanvas = null;
55333    }
55334    return !modifiedIds?.has(this.data.id);
55335  }
55336  static async createImage(bitmap, xref) {
55337    const {
55338      width,
55339      height
55340    } = bitmap;
55341    const canvas = new OffscreenCanvas(width, height);
55342    const ctx = canvas.getContext("2d", {
55343      alpha: true
55344    });
55345    ctx.drawImage(bitmap, 0, 0);
55346    const data = ctx.getImageData(0, 0, width, height).data;
55347    const buf32 = new Uint32Array(data.buffer);
55348    const hasAlpha = buf32.some(FeatureTest.isLittleEndian ? x => x >>> 24 !== 0xff : x => (x & 0xff) !== 0xff);
55349    if (hasAlpha) {
55350      ctx.fillStyle = "white";
55351      ctx.fillRect(0, 0, width, height);
55352      ctx.drawImage(bitmap, 0, 0);
55353    }
55354    const jpegBytesPromise = canvas.convertToBlob({
55355      type: "image/jpeg",
55356      quality: 1
55357    }).then(blob => blob.bytes());
55358    const xobjectName = Name.get("XObject");
55359    const imageName = Name.get("Image");
55360    const image = new Dict(xref);
55361    image.set("Type", xobjectName);
55362    image.set("Subtype", imageName);
55363    image.set("BitsPerComponent", 8);
55364    image.setIfName("ColorSpace", "DeviceRGB");
55365    image.setIfName("Filter", "DCTDecode");
55366    image.set("BBox", [0, 0, width, height]);
55367    image.set("Width", width);
55368    image.set("Height", height);
55369    let smaskStream = null;
55370    if (hasAlpha) {
55371      const alphaBuffer = new Uint8Array(buf32.length);
55372      if (FeatureTest.isLittleEndian) {
55373        for (let i = 0, ii = buf32.length; i < ii; i++) {
55374          alphaBuffer[i] = buf32[i] >>> 24;
55375        }
55376      } else {
55377        for (let i = 0, ii = buf32.length; i < ii; i++) {
55378          alphaBuffer[i] = buf32[i] & 0xff;
55379        }
55380      }
55381      const smask = new Dict(xref);
55382      smask.set("Type", xobjectName);
55383      smask.set("Subtype", imageName);
55384      smask.set("BitsPerComponent", 8);
55385      smask.setIfName("ColorSpace", "DeviceGray");
55386      smask.set("Width", width);
55387      smask.set("Height", height);
55388      smaskStream = new Stream(alphaBuffer, 0, 0, smask);
55389    }
55390    const imageStream = new Stream(await jpegBytesPromise, 0, 0, image);
55391    return {
55392      imageStream,
55393      smaskStream,
55394      width,
55395      height
55396    };
55397  }
55398  static createNewDict(annotation, xref, {
55399    apRef,
55400    ap
55401  }) {
55402    const {
55403      date,
55404      oldAnnotation,
55405      rect,
55406      rotation,
55407      user
55408    } = annotation;
55409    const stamp = oldAnnotation || new Dict(xref);
55410    stamp.setIfNotExists("Type", Name.get("Annot"));
55411    stamp.setIfNotExists("Subtype", Name.get("Stamp"));
55412    stamp.set(oldAnnotation ? "M" : "CreationDate", `D:${getModificationDate(date)}`);
55413    stamp.setIfArray("Rect", rect);
55414    stamp.setIfNotExists("F", 4);
55415    stamp.setIfNotExists("Border", [0, 0, 0]);
55416    stamp.setIfNumber("Rotate", rotation);
55417    stamp.setIfDefined("T", stringToAsciiOrUTF16BE(user));
55418    if (apRef || ap) {
55419      const n = new Dict(xref);
55420      stamp.set("AP", n);
55421      n.set("N", apRef || ap);
55422    }
55423    return stamp;
55424  }
55425  static async #createNewAppearanceStreamForDrawing(annotation, xref) {
55426    const {
55427      areContours,
55428      color,
55429      rect,
55430      lines,
55431      thickness
55432    } = annotation;
55433    if (!color) {
55434      return null;
55435    }
55436    const appearanceBuffer = [`${thickness} w 1 J 1 j`, `${getPdfColor(color, areContours)}`];
55437    for (const line of lines) {
55438      appearanceBuffer.push(`${numberToString(line[4])} ${numberToString(line[5])} m`);
55439      for (let i = 6, ii = line.length; i < ii; i += 6) {
55440        if (isNaN(line[i])) {
55441          appearanceBuffer.push(`${numberToString(line[i + 4])} ${numberToString(line[i + 5])} l`);
55442        } else {
55443          const [c1x, c1y, c2x, c2y, x, y] = line.slice(i, i + 6);
55444          appearanceBuffer.push([c1x, c1y, c2x, c2y, x, y].map(numberToString).join(" ") + " c");
55445        }
55446      }
55447      if (line.length === 6) {
55448        appearanceBuffer.push(`${numberToString(line[4])} ${numberToString(line[5])} l`);
55449      }
55450    }
55451    appearanceBuffer.push(areContours ? "F" : "S");
55452    const appearance = appearanceBuffer.join("\n");
55453    const appearanceStreamDict = new Dict(xref);
55454    appearanceStreamDict.set("FormType", 1);
55455    appearanceStreamDict.setIfName("Subtype", "Form");
55456    appearanceStreamDict.setIfName("Type", "XObject");
55457    appearanceStreamDict.set("BBox", rect);
55458    appearanceStreamDict.set("Length", appearance.length);
55459    const ap = new StringStream(appearance);
55460    ap.dict = appearanceStreamDict;
55461    return ap;
55462  }
55463  static async createNewAppearanceStream(annotation, xref, params) {
55464    if (annotation.oldAnnotation) {
55465      return null;
55466    }
55467    if (annotation.isSignature) {
55468      return this.#createNewAppearanceStreamForDrawing(annotation, xref);
55469    }
55470    const {
55471      rotation
55472    } = annotation;
55473    const {
55474      imageRef,
55475      width,
55476      height
55477    } = params.image;
55478    const resources = new Dict(xref);
55479    const xobject = new Dict(xref);
55480    resources.set("XObject", xobject);
55481    xobject.set("Im0", imageRef);
55482    const appearance = `q ${width} 0 0 ${height} 0 0 cm /Im0 Do Q`;
55483    const appearanceStreamDict = new Dict(xref);
55484    appearanceStreamDict.set("FormType", 1);
55485    appearanceStreamDict.setIfName("Subtype", "Form");
55486    appearanceStreamDict.setIfName("Type", "XObject");
55487    appearanceStreamDict.set("BBox", [0, 0, width, height]);
55488    appearanceStreamDict.set("Resources", resources);
55489    if (rotation) {
55490      const matrix = getRotationMatrix(rotation, width, height);
55491      appearanceStreamDict.set("Matrix", matrix);
55492    }
55493    const ap = new StringStream(appearance);
55494    ap.dict = appearanceStreamDict;
55495    return ap;
55496  }
55497}
55498class FileAttachmentAnnotation extends MarkupAnnotation {
55499  constructor(params) {
55500    super(params);
55501    const {
55502      dict
55503    } = params;
55504    const file = new FileSpec(dict.get("FS"));
55505    this.data.hasOwnCanvas = this.data.noRotate;
55506    this.data.noHTML = false;
55507    this.data.file = file.serializable;
55508    const name = dict.get("Name");
55509    this.data.name = name instanceof Name ? stringToPDFString(name.name) : "PushPin";
55510    const fillAlpha = dict.get("ca");
55511    this.data.fillAlpha = typeof fillAlpha === "number" && fillAlpha >= 0 && fillAlpha <= 1 ? fillAlpha : null;
55512  }
55513}
55514
55515;// ./src/core/calculate_md5.js
55516
55517const PARAMS = {
55518  get r() {
55519    return shadow(this, "r", new Uint8Array([7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21]));
55520  },
55521  get k() {
55522    return shadow(this, "k", new Int32Array([-680876936, -389564586, 606105819, -1044525330, -176418897, 1200080426, -1473231341, -45705983, 1770035416, -1958414417, -42063, -1990404162, 1804603682, -40341101, -1502002290, 1236535329, -165796510, -1069501632, 643717713, -373897302, -701558691, 38016083, -660478335, -405537848, 568446438, -1019803690, -187363961, 1163531501, -1444681467, -51403784, 1735328473, -1926607734, -378558, -2022574463, 1839030562, -35309556, -1530992060, 1272893353, -155497632, -1094730640, 681279174, -358537222, -722521979, 76029189, -640364487, -421815835, 530742520, -995338651, -198630844, 1126891415, -1416354905, -57434055, 1700485571, -1894986606, -1051523, -2054922799, 1873313359, -30611744, -1560198380, 1309151649, -145523070, -1120210379, 718787259, -343485551]));
55523  }
55524};
55525function calculateMD5(data, offset, length) {
55526  let h0 = 1732584193,
55527    h1 = -271733879,
55528    h2 = -1732584194,
55529    h3 = 271733878;
55530  const paddedLength = length + 72 & ~63;
55531  const padded = new Uint8Array(paddedLength);
55532  let i, j;
55533  for (i = 0; i < length; ++i) {
55534    padded[i] = data[offset++];
55535  }
55536  padded[i++] = 0x80;
55537  const n = paddedLength - 8;
55538  if (i < n) {
55539    i = n;
55540  }
55541  padded[i++] = length << 3 & 0xff;
55542  padded[i++] = length >> 5 & 0xff;
vendor: 7,822 bytes, lines 55543-55829
55543  padded[i++] = length >> 13 & 0xff;
55544  padded[i++] = length >> 21 & 0xff;
55545  padded[i++] = length >>> 29 & 0xff;
55546  i += 3;
55547  const w = new Int32Array(16);
55548  const {
55549    k,
55550    r
55551  } = PARAMS;
55552  for (i = 0; i < paddedLength;) {
55553    for (j = 0; j < 16; ++j, i += 4) {
55554      w[j] = padded[i] | padded[i + 1] << 8 | padded[i + 2] << 16 | padded[i + 3] << 24;
55555    }
55556    let a = h0,
55557      b = h1,
55558      c = h2,
55559      d = h3,
55560      f,
55561      g;
55562    for (j = 0; j < 64; ++j) {
55563      if (j < 16) {
55564        f = b & c | ~b & d;
55565        g = j;
55566      } else if (j < 32) {
55567        f = d & b | ~d & c;
55568        g = 5 * j + 1 & 15;
55569      } else if (j < 48) {
55570        f = b ^ c ^ d;
55571        g = 3 * j + 5 & 15;
55572      } else {
55573        f = c ^ (b | ~d);
55574        g = 7 * j & 15;
55575      }
55576      const tmp = d,
55577        rotateArg = a + f + k[j] + w[g] | 0,
55578        rotate = r[j];
55579      d = c;
55580      c = b;
55581      b = b + (rotateArg << rotate | rotateArg >>> 32 - rotate) | 0;
55582      a = tmp;
55583    }
55584    h0 = h0 + a | 0;
55585    h1 = h1 + b | 0;
55586    h2 = h2 + c | 0;
55587    h3 = h3 + d | 0;
55588  }
55589  return new Uint8Array([h0 & 0xFF, h0 >> 8 & 0xFF, h0 >> 16 & 0xFF, h0 >>> 24 & 0xFF, h1 & 0xFF, h1 >> 8 & 0xFF, h1 >> 16 & 0xFF, h1 >>> 24 & 0xFF, h2 & 0xFF, h2 >> 8 & 0xFF, h2 >> 16 & 0xFF, h2 >>> 24 & 0xFF, h3 & 0xFF, h3 >> 8 & 0xFF, h3 >> 16 & 0xFF, h3 >>> 24 & 0xFF]);
55590}
55591
55592;// ./src/core/dataset_reader.js
55593
55594
55595
55596function decodeString(str) {
55597  try {
55598    return stringToUTF8String(str);
55599  } catch (ex) {
55600    warn(`UTF-8 decoding failed: "${ex}".`);
55601    return str;
55602  }
55603}
55604class DatasetXMLParser extends SimpleXMLParser {
55605  node = null;
55606  onEndElement(name) {
55607    const node = super.onEndElement(name);
55608    if (node && name === "xfa:datasets") {
55609      this.node = node;
55610      throw new Error("Aborting DatasetXMLParser.");
55611    }
55612  }
55613}
55614class DatasetReader {
55615  constructor(data) {
55616    if (data.datasets) {
55617      this.node = new SimpleXMLParser({
55618        hasAttributes: true
55619      }).parseFromString(data.datasets).documentElement;
55620    } else {
55621      const parser = new DatasetXMLParser({
55622        hasAttributes: true
55623      });
55624      try {
55625        parser.parseFromString(data["xdp:xdp"]);
55626      } catch {}
55627      this.node = parser.node;
55628    }
55629  }
55630  getValue(path) {
55631    if (!this.node || !path) {
55632      return "";
55633    }
55634    const node = this.node.searchNode(parseXFAPath(path), 0);
55635    if (!node) {
55636      return "";
55637    }
55638    const first = node.firstChild;
55639    if (first?.nodeName === "value") {
55640      return node.children.map(child => decodeString(child.textContent));
55641    }
55642    return decodeString(node.textContent);
55643  }
55644}
55645
55646;// ./src/core/intersector.js
55647class SingleIntersector {
55648  #annotation;
55649  minX = Infinity;
55650  minY = Infinity;
55651  maxX = -Infinity;
55652  maxY = -Infinity;
55653  #quadPoints = null;
55654  #text = [];
55655  #extraChars = [];
55656  #lastIntersectingQuadIndex = -1;
55657  #canTakeExtraChars = false;
55658  constructor(annotation) {
55659    this.#annotation = annotation;
55660    const quadPoints = annotation.data.quadPoints;
55661    if (!quadPoints) {
55662      [this.minX, this.minY, this.maxX, this.maxY] = annotation.data.rect;
55663      return;
55664    }
55665    for (let i = 0, ii = quadPoints.length; i < ii; i += 8) {
55666      this.minX = Math.min(this.minX, quadPoints[i]);
55667      this.maxX = Math.max(this.maxX, quadPoints[i + 2]);
55668      this.minY = Math.min(this.minY, quadPoints[i + 5]);
55669      this.maxY = Math.max(this.maxY, quadPoints[i + 1]);
55670    }
55671    if (quadPoints.length > 8) {
55672      this.#quadPoints = quadPoints;
55673    }
55674  }
55675  #intersects(x, y) {
55676    if (this.minX >= x || this.maxX <= x || this.minY >= y || this.maxY <= y) {
55677      return false;
55678    }
55679    const quadPoints = this.#quadPoints;
55680    if (!quadPoints) {
55681      return true;
55682    }
55683    if (this.#lastIntersectingQuadIndex >= 0) {
55684      const i = this.#lastIntersectingQuadIndex;
55685      if (!(quadPoints[i] >= x || quadPoints[i + 2] <= x || quadPoints[i + 5] >= y || quadPoints[i + 1] <= y)) {
55686        return true;
55687      }
55688      this.#lastIntersectingQuadIndex = -1;
55689    }
55690    for (let i = 0, ii = quadPoints.length; i < ii; i += 8) {
55691      if (!(quadPoints[i] >= x || quadPoints[i + 2] <= x || quadPoints[i + 5] >= y || quadPoints[i + 1] <= y)) {
55692        this.#lastIntersectingQuadIndex = i;
55693        return true;
55694      }
55695    }
55696    return false;
55697  }
55698  addGlyph(x, y, glyph) {
55699    if (!this.#intersects(x, y)) {
55700      this.disableExtraChars();
55701      return false;
55702    }
55703    if (this.#extraChars.length > 0) {
55704      this.#text.push(this.#extraChars.join(""));
55705      this.#extraChars.length = 0;
55706    }
55707    this.#text.push(glyph);
55708    this.#canTakeExtraChars = true;
55709    return true;
55710  }
55711  addExtraChar(char) {
55712    if (this.#canTakeExtraChars) {
55713      this.#extraChars.push(char);
55714    }
55715  }
55716  disableExtraChars() {
55717    if (!this.#canTakeExtraChars) {
55718      return;
55719    }
55720    this.#canTakeExtraChars = false;
55721    this.#extraChars.length = 0;
55722  }
55723  setText() {
55724    this.#annotation.data.overlaidText = this.#text.join("");
55725  }
55726}
55727const STEPS = 64;
55728class Intersector {
55729  #intersectors = [];
55730  #grid = [];
55731  #minX;
55732  #maxX;
55733  #minY;
55734  #maxY;
55735  #invXRatio;
55736  #invYRatio;
55737  constructor(annotations) {
55738    let minX = Infinity;
55739    let minY = Infinity;
55740    let maxX = -Infinity;
55741    let maxY = -Infinity;
55742    const intersectors = this.#intersectors;
55743    for (const annotation of annotations) {
55744      if (!annotation.data.quadPoints && !annotation.data.rect) {
55745        continue;
55746      }
55747      const intersector = new SingleIntersector(annotation);
55748      intersectors.push(intersector);
55749      minX = Math.min(minX, intersector.minX);
55750      minY = Math.min(minY, intersector.minY);
55751      maxX = Math.max(maxX, intersector.maxX);
55752      maxY = Math.max(maxY, intersector.maxY);
55753    }
55754    this.#minX = minX;
55755    this.#minY = minY;
55756    this.#maxX = maxX;
55757    this.#maxY = maxY;
55758    this.#invXRatio = (STEPS - 1) / (maxX - minX);
55759    this.#invYRatio = (STEPS - 1) / (maxY - minY);
55760    for (const intersector of intersectors) {
55761      const iMin = this.#getGridIndex(intersector.minX, intersector.minY);
55762      const iMax = this.#getGridIndex(intersector.maxX, intersector.maxY);
55763      const w = (iMax - iMin) % STEPS;
55764      const h = Math.floor((iMax - iMin) / STEPS);
55765      for (let i = iMin; i <= iMin + h * STEPS; i += STEPS) {
55766        for (let j = 0; j <= w; j++) {
55767          let existing = this.#grid[i + j];
55768          if (!existing) {
55769            this.#grid[i + j] = existing = [];
55770          }
55771          existing.push(intersector);
55772        }
55773      }
55774    }
55775  }
55776  #getGridIndex(x, y) {
55777    const i = Math.floor((x - this.#minX) * this.#invXRatio);
55778    const j = Math.floor((y - this.#minY) * this.#invYRatio);
55779    return i + j * STEPS;
55780  }
55781  addGlyph(transform, width, height, glyph) {
55782    const x = transform[4] + width / 2;
55783    const y = transform[5] + height / 2;
55784    if (x < this.#minX || y < this.#minY || x > this.#maxX || y > this.#maxY) {
55785      return;
55786    }
55787    const intersectors = this.#grid[this.#getGridIndex(x, y)];
55788    if (!intersectors) {
55789      return;
55790    }
55791    for (const intersector of intersectors) {
55792      intersector.addGlyph(x, y, glyph);
55793    }
55794  }
55795  addExtraChar(char) {
55796    for (const intersector of this.#intersectors) {
55797      intersector.addExtraChar(char);
55798    }
55799  }
55800  setText() {
55801    for (const intersector of this.#intersectors) {
55802      intersector.setText();
55803    }
55804  }
55805}
55806
55807;// ./src/core/calculate_sha_other.js
55808
55809class Word64 {
55810  constructor(highInteger, lowInteger) {
55811    this.high = highInteger | 0;
55812    this.low = lowInteger | 0;
55813  }
55814  and(word) {
55815    this.high &= word.high;
55816    this.low &= word.low;
55817  }
55818  xor(word) {
55819    this.high ^= word.high;
55820    this.low ^= word.low;
55821  }
55822  shiftRight(places) {
55823    if (places >= 32) {
55824      this.low = this.high >>> places - 32 | 0;
55825      this.high = 0;
55826    } else {
55827      this.low = this.low >>> places | this.high << 32 - places;
55828      this.high = this.high >>> places | 0;
55829    }
vendor: 12,638 bytes, lines 55829-56178
55829
55830  }
55831  rotateRight(places) {
55832    let low, high;
55833    if (places & 32) {
55834      high = this.low;
55835      low = this.high;
55836    } else {
55837      low = this.low;
55838      high = this.high;
55839    }
55840    places &= 31;
55841    this.low = low >>> places | high << 32 - places;
55842    this.high = high >>> places | low << 32 - places;
55843  }
55844  not() {
55845    this.high = ~this.high;
55846    this.low = ~this.low;
55847  }
55848  add(word) {
55849    const lowAdd = (this.low >>> 0) + (word.low >>> 0);
55850    let highAdd = (this.high >>> 0) + (word.high >>> 0);
55851    if (lowAdd > 0xffffffff) {
55852      highAdd += 1;
55853    }
55854    this.low = lowAdd | 0;
55855    this.high = highAdd | 0;
55856  }
55857  copyTo(bytes, offset) {
55858    bytes[offset] = this.high >>> 24 & 0xff;
55859    bytes[offset + 1] = this.high >> 16 & 0xff;
55860    bytes[offset + 2] = this.high >> 8 & 0xff;
55861    bytes[offset + 3] = this.high & 0xff;
55862    bytes[offset + 4] = this.low >>> 24 & 0xff;
55863    bytes[offset + 5] = this.low >> 16 & 0xff;
55864    bytes[offset + 6] = this.low >> 8 & 0xff;
55865    bytes[offset + 7] = this.low & 0xff;
55866  }
55867  assign(word) {
55868    this.high = word.high;
55869    this.low = word.low;
55870  }
55871}
55872const calculate_sha_other_PARAMS = {
55873  get k() {
55874    return shadow(this, "k", [new Word64(0x428a2f98, 0xd728ae22), new Word64(0x71374491, 0x23ef65cd), new Word64(0xb5c0fbcf, 0xec4d3b2f), new Word64(0xe9b5dba5, 0x8189dbbc), new Word64(0x3956c25b, 0xf348b538), new Word64(0x59f111f1, 0xb605d019), new Word64(0x923f82a4, 0xaf194f9b), new Word64(0xab1c5ed5, 0xda6d8118), new Word64(0xd807aa98, 0xa3030242), new Word64(0x12835b01, 0x45706fbe), new Word64(0x243185be, 0x4ee4b28c), new Word64(0x550c7dc3, 0xd5ffb4e2), new Word64(0x72be5d74, 0xf27b896f), new Word64(0x80deb1fe, 0x3b1696b1), new Word64(0x9bdc06a7, 0x25c71235), new Word64(0xc19bf174, 0xcf692694), new Word64(0xe49b69c1, 0x9ef14ad2), new Word64(0xefbe4786, 0x384f25e3), new Word64(0x0fc19dc6, 0x8b8cd5b5), new Word64(0x240ca1cc, 0x77ac9c65), new Word64(0x2de92c6f, 0x592b0275), new Word64(0x4a7484aa, 0x6ea6e483), new Word64(0x5cb0a9dc, 0xbd41fbd4), new Word64(0x76f988da, 0x831153b5), new Word64(0x983e5152, 0xee66dfab), new Word64(0xa831c66d, 0x2db43210), new Word64(0xb00327c8, 0x98fb213f), new Word64(0xbf597fc7, 0xbeef0ee4), new Word64(0xc6e00bf3, 0x3da88fc2), new Word64(0xd5a79147, 0x930aa725), new Word64(0x06ca6351, 0xe003826f), new Word64(0x14292967, 0x0a0e6e70), new Word64(0x27b70a85, 0x46d22ffc), new Word64(0x2e1b2138, 0x5c26c926), new Word64(0x4d2c6dfc, 0x5ac42aed), new Word64(0x53380d13, 0x9d95b3df), new Word64(0x650a7354, 0x8baf63de), new Word64(0x766a0abb, 0x3c77b2a8), new Word64(0x81c2c92e, 0x47edaee6), new Word64(0x92722c85, 0x1482353b), new Word64(0xa2bfe8a1, 0x4cf10364), new Word64(0xa81a664b, 0xbc423001), new Word64(0xc24b8b70, 0xd0f89791), new Word64(0xc76c51a3, 0x0654be30), new Word64(0xd192e819, 0xd6ef5218), new Word64(0xd6990624, 0x5565a910), new Word64(0xf40e3585, 0x5771202a), new Word64(0x106aa070, 0x32bbd1b8), new Word64(0x19a4c116, 0xb8d2d0c8), new Word64(0x1e376c08, 0x5141ab53), new Word64(0x2748774c, 0xdf8eeb99), new Word64(0x34b0bcb5, 0xe19b48a8), new Word64(0x391c0cb3, 0xc5c95a63), new Word64(0x4ed8aa4a, 0xe3418acb), new Word64(0x5b9cca4f, 0x7763e373), new Word64(0x682e6ff3, 0xd6b2b8a3), new Word64(0x748f82ee, 0x5defb2fc), new Word64(0x78a5636f, 0x43172f60), new Word64(0x84c87814, 0xa1f0ab72), new Word64(0x8cc70208, 0x1a6439ec), new Word64(0x90befffa, 0x23631e28), new Word64(0xa4506ceb, 0xde82bde9), new Word64(0xbef9a3f7, 0xb2c67915), new Word64(0xc67178f2, 0xe372532b), new Word64(0xca273ece, 0xea26619c), new Word64(0xd186b8c7, 0x21c0c207), new Word64(0xeada7dd6, 0xcde0eb1e), new Word64(0xf57d4f7f, 0xee6ed178), new Word64(0x06f067aa, 0x72176fba), new Word64(0x0a637dc5, 0xa2c898a6), new Word64(0x113f9804, 0xbef90dae), new Word64(0x1b710b35, 0x131c471b), new Word64(0x28db77f5, 0x23047d84), new Word64(0x32caab7b, 0x40c72493), new Word64(0x3c9ebe0a, 0x15c9bebc), new Word64(0x431d67c4, 0x9c100d4c), new Word64(0x4cc5d4be, 0xcb3e42b6), new Word64(0x597f299c, 0xfc657e2a), new Word64(0x5fcb6fab, 0x3ad6faec), new Word64(0x6c44198c, 0x4a475817)]);
55875  }
55876};
55877function ch(result, x, y, z, tmp) {
55878  result.assign(x);
55879  result.and(y);
55880  tmp.assign(x);
55881  tmp.not();
55882  tmp.and(z);
55883  result.xor(tmp);
55884}
55885function maj(result, x, y, z, tmp) {
55886  result.assign(x);
55887  result.and(y);
55888  tmp.assign(x);
55889  tmp.and(z);
55890  result.xor(tmp);
55891  tmp.assign(y);
55892  tmp.and(z);
55893  result.xor(tmp);
55894}
55895function sigma(result, x, tmp) {
55896  result.assign(x);
55897  result.rotateRight(28);
55898  tmp.assign(x);
55899  tmp.rotateRight(34);
55900  result.xor(tmp);
55901  tmp.assign(x);
55902  tmp.rotateRight(39);
55903  result.xor(tmp);
55904}
55905function sigmaPrime(result, x, tmp) {
55906  result.assign(x);
55907  result.rotateRight(14);
55908  tmp.assign(x);
55909  tmp.rotateRight(18);
55910  result.xor(tmp);
55911  tmp.assign(x);
55912  tmp.rotateRight(41);
55913  result.xor(tmp);
55914}
55915function littleSigma(result, x, tmp) {
55916  result.assign(x);
55917  result.rotateRight(1);
55918  tmp.assign(x);
55919  tmp.rotateRight(8);
55920  result.xor(tmp);
55921  tmp.assign(x);
55922  tmp.shiftRight(7);
55923  result.xor(tmp);
55924}
55925function littleSigmaPrime(result, x, tmp) {
55926  result.assign(x);
55927  result.rotateRight(19);
55928  tmp.assign(x);
55929  tmp.rotateRight(61);
55930  result.xor(tmp);
55931  tmp.assign(x);
55932  tmp.shiftRight(6);
55933  result.xor(tmp);
55934}
55935function calculateSHA512(data, offset, length, mode384 = false) {
55936  let h0, h1, h2, h3, h4, h5, h6, h7;
55937  if (!mode384) {
55938    h0 = new Word64(0x6a09e667, 0xf3bcc908);
55939    h1 = new Word64(0xbb67ae85, 0x84caa73b);
55940    h2 = new Word64(0x3c6ef372, 0xfe94f82b);
55941    h3 = new Word64(0xa54ff53a, 0x5f1d36f1);
55942    h4 = new Word64(0x510e527f, 0xade682d1);
55943    h5 = new Word64(0x9b05688c, 0x2b3e6c1f);
55944    h6 = new Word64(0x1f83d9ab, 0xfb41bd6b);
55945    h7 = new Word64(0x5be0cd19, 0x137e2179);
55946  } else {
55947    h0 = new Word64(0xcbbb9d5d, 0xc1059ed8);
55948    h1 = new Word64(0x629a292a, 0x367cd507);
55949    h2 = new Word64(0x9159015a, 0x3070dd17);
55950    h3 = new Word64(0x152fecd8, 0xf70e5939);
55951    h4 = new Word64(0x67332667, 0xffc00b31);
55952    h5 = new Word64(0x8eb44a87, 0x68581511);
55953    h6 = new Word64(0xdb0c2e0d, 0x64f98fa7);
55954    h7 = new Word64(0x47b5481d, 0xbefa4fa4);
55955  }
55956  const paddedLength = Math.ceil((length + 17) / 128) * 128;
55957  const padded = new Uint8Array(paddedLength);
55958  let i, j;
55959  for (i = 0; i < length; ++i) {
55960    padded[i] = data[offset++];
55961  }
55962  padded[i++] = 0x80;
55963  const n = paddedLength - 16;
55964  if (i < n) {
55965    i = n;
55966  }
55967  i += 11;
55968  padded[i++] = length >>> 29 & 0xff;
55969  padded[i++] = length >> 21 & 0xff;
55970  padded[i++] = length >> 13 & 0xff;
55971  padded[i++] = length >> 5 & 0xff;
55972  padded[i++] = length << 3 & 0xff;
55973  const w = new Array(80);
55974  for (i = 0; i < 80; i++) {
55975    w[i] = new Word64(0, 0);
55976  }
55977  const {
55978    k
55979  } = calculate_sha_other_PARAMS;
55980  let a = new Word64(0, 0),
55981    b = new Word64(0, 0),
55982    c = new Word64(0, 0);
55983  let d = new Word64(0, 0),
55984    e = new Word64(0, 0),
55985    f = new Word64(0, 0);
55986  let g = new Word64(0, 0),
55987    h = new Word64(0, 0);
55988  const t1 = new Word64(0, 0),
55989    t2 = new Word64(0, 0);
55990  const tmp1 = new Word64(0, 0),
55991    tmp2 = new Word64(0, 0);
55992  let tmp3;
55993  for (i = 0; i < paddedLength;) {
55994    for (j = 0; j < 16; ++j) {
55995      w[j].high = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
55996      w[j].low = padded[i + 4] << 24 | padded[i + 5] << 16 | padded[i + 6] << 8 | padded[i + 7];
55997      i += 8;
55998    }
55999    for (j = 16; j < 80; ++j) {
56000      tmp3 = w[j];
56001      littleSigmaPrime(tmp3, w[j - 2], tmp2);
56002      tmp3.add(w[j - 7]);
56003      littleSigma(tmp1, w[j - 15], tmp2);
56004      tmp3.add(tmp1);
56005      tmp3.add(w[j - 16]);
56006    }
56007    a.assign(h0);
56008    b.assign(h1);
56009    c.assign(h2);
56010    d.assign(h3);
56011    e.assign(h4);
56012    f.assign(h5);
56013    g.assign(h6);
56014    h.assign(h7);
56015    for (j = 0; j < 80; ++j) {
56016      t1.assign(h);
56017      sigmaPrime(tmp1, e, tmp2);
56018      t1.add(tmp1);
56019      ch(tmp1, e, f, g, tmp2);
56020      t1.add(tmp1);
56021      t1.add(k[j]);
56022      t1.add(w[j]);
56023      sigma(t2, a, tmp2);
56024      maj(tmp1, a, b, c, tmp2);
56025      t2.add(tmp1);
56026      tmp3 = h;
56027      h = g;
56028      g = f;
56029      f = e;
56030      d.add(t1);
56031      e = d;
56032      d = c;
56033      c = b;
56034      b = a;
56035      tmp3.assign(t1);
56036      tmp3.add(t2);
56037      a = tmp3;
56038    }
56039    h0.add(a);
56040    h1.add(b);
56041    h2.add(c);
56042    h3.add(d);
56043    h4.add(e);
56044    h5.add(f);
56045    h6.add(g);
56046    h7.add(h);
56047  }
56048  let result;
56049  if (!mode384) {
56050    result = new Uint8Array(64);
56051    h0.copyTo(result, 0);
56052    h1.copyTo(result, 8);
56053    h2.copyTo(result, 16);
56054    h3.copyTo(result, 24);
56055    h4.copyTo(result, 32);
56056    h5.copyTo(result, 40);
56057    h6.copyTo(result, 48);
56058    h7.copyTo(result, 56);
56059  } else {
56060    result = new Uint8Array(48);
56061    h0.copyTo(result, 0);
56062    h1.copyTo(result, 8);
56063    h2.copyTo(result, 16);
56064    h3.copyTo(result, 24);
56065    h4.copyTo(result, 32);
56066    h5.copyTo(result, 40);
56067  }
56068  return result;
56069}
56070function calculateSHA384(data, offset, length) {
56071  return calculateSHA512(data, offset, length, true);
56072}
56073
56074;// ./src/core/calculate_sha256.js
56075
56076const calculate_sha256_PARAMS = {
56077  get k() {
56078    return shadow(this, "k", [0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2]);
56079  }
56080};
56081function rotr(x, n) {
56082  return x >>> n | x << 32 - n;
56083}
56084function calculate_sha256_ch(x, y, z) {
56085  return x & y ^ ~x & z;
56086}
56087function calculate_sha256_maj(x, y, z) {
56088  return x & y ^ x & z ^ y & z;
56089}
56090function calculate_sha256_sigma(x) {
56091  return rotr(x, 2) ^ rotr(x, 13) ^ rotr(x, 22);
56092}
56093function calculate_sha256_sigmaPrime(x) {
56094  return rotr(x, 6) ^ rotr(x, 11) ^ rotr(x, 25);
56095}
56096function calculate_sha256_littleSigma(x) {
56097  return rotr(x, 7) ^ rotr(x, 18) ^ x >>> 3;
56098}
56099function calculate_sha256_littleSigmaPrime(x) {
56100  return rotr(x, 17) ^ rotr(x, 19) ^ x >>> 10;
56101}
56102function calculateSHA256(data, offset, length) {
56103  let h0 = 0x6a09e667,
56104    h1 = 0xbb67ae85,
56105    h2 = 0x3c6ef372,
56106    h3 = 0xa54ff53a,
56107    h4 = 0x510e527f,
56108    h5 = 0x9b05688c,
56109    h6 = 0x1f83d9ab,
56110    h7 = 0x5be0cd19;
56111  const paddedLength = Math.ceil((length + 9) / 64) * 64;
56112  const padded = new Uint8Array(paddedLength);
56113  let i, j;
56114  for (i = 0; i < length; ++i) {
56115    padded[i] = data[offset++];
56116  }
56117  padded[i++] = 0x80;
56118  const n = paddedLength - 8;
56119  if (i < n) {
56120    i = n;
56121  }
56122  i += 3;
56123  padded[i++] = length >>> 29 & 0xff;
56124  padded[i++] = length >> 21 & 0xff;
56125  padded[i++] = length >> 13 & 0xff;
56126  padded[i++] = length >> 5 & 0xff;
56127  padded[i++] = length << 3 & 0xff;
56128  const w = new Uint32Array(64);
56129  const {
56130    k
56131  } = calculate_sha256_PARAMS;
56132  for (i = 0; i < paddedLength;) {
56133    for (j = 0; j < 16; ++j) {
56134      w[j] = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
56135      i += 4;
56136    }
56137    for (j = 16; j < 64; ++j) {
56138      w[j] = calculate_sha256_littleSigmaPrime(w[j - 2]) + w[j - 7] + calculate_sha256_littleSigma(w[j - 15]) + w[j - 16] | 0;
56139    }
56140    let a = h0,
56141      b = h1,
56142      c = h2,
56143      d = h3,
56144      e = h4,
56145      f = h5,
56146      g = h6,
56147      h = h7,
56148      t1,
56149      t2;
56150    for (j = 0; j < 64; ++j) {
56151      t1 = h + calculate_sha256_sigmaPrime(e) + calculate_sha256_ch(e, f, g) + k[j] + w[j];
56152      t2 = calculate_sha256_sigma(a) + calculate_sha256_maj(a, b, c);
56153      h = g;
56154      g = f;
56155      f = e;
56156      e = d + t1 | 0;
56157      d = c;
56158      c = b;
56159      b = a;
56160      a = t1 + t2 | 0;
56161    }
56162    h0 = h0 + a | 0;
56163    h1 = h1 + b | 0;
56164    h2 = h2 + c | 0;
56165    h3 = h3 + d | 0;
56166    h4 = h4 + e | 0;
56167    h5 = h5 + f | 0;
56168    h6 = h6 + g | 0;
56169    h7 = h7 + h | 0;
56170  }
56171  return new Uint8Array([h0 >> 24 & 0xFF, h0 >> 16 & 0xFF, h0 >> 8 & 0xFF, h0 & 0xFF, h1 >> 24 & 0xFF, h1 >> 16 & 0xFF, h1 >> 8 & 0xFF, h1 & 0xFF, h2 >> 24 & 0xFF, h2 >> 16 & 0xFF, h2 >> 8 & 0xFF, h2 & 0xFF, h3 >> 24 & 0xFF, h3 >> 16 & 0xFF, h3 >> 8 & 0xFF, h3 & 0xFF, h4 >> 24 & 0xFF, h4 >> 16 & 0xFF, h4 >> 8 & 0xFF, h4 & 0xFF, h5 >> 24 & 0xFF, h5 >> 16 & 0xFF, h5 >> 8 & 0xFF, h5 & 0xFF, h6 >> 24 & 0xFF, h6 >> 16 & 0xFF, h6 >> 8 & 0xFF, h6 & 0xFF, h7 >> 24 & 0xFF, h7 >> 16 & 0xFF, h7 >> 8 & 0xFF, h7 & 0xFF]);
56172}
56173
56174;// ./src/core/decrypt_stream.js
56175
56176const chunkSize = 512;
56177class DecryptStream extends DecodeStream {
56178  
56178constructor(str, maybeLength, decrypt) {
56179    super(maybeLength);
56180    this.stream = str;
56181    this.dict = str.dict;
56182    this.decrypt = decrypt;
56183    this.nextChunk = null;
56184    this.initialized = false;
56185  }
56186  readBlock() {
vendor: 705 bytes, lines 56187-56213
56187    let chunk;
56188    if (this.initialized) {
56189      chunk = this.nextChunk;
56190    } else {
56191      chunk = this.stream.getBytes(chunkSize);
56192      this.initialized = true;
56193    }
56194    if (!chunk?.length) {
56195      this.eof = true;
56196      return;
56197    }
56198    this.nextChunk = this.stream.getBytes(chunkSize);
56199    const hasMoreData = this.nextChunk?.length > 0;
56200    const decrypt = this.decrypt;
56201    chunk = decrypt(chunk, !hasMoreData);
56202    const bufferLength = this.bufferLength,
56203      newLength = bufferLength + chunk.length,
56204      buffer = this.ensureBuffer(newLength);
56205    buffer.set(chunk, bufferLength);
56206    this.bufferLength = newLength;
56207  }
56208  getOriginalStream() {
56209    return this;
56210  }
56211}
56212
56213;// ./src/core/crypto.js
vendor: 5,193 bytes, lines 56213-56274
56213
56214
56215
56216
56217
56218
56219
56220class ARCFourCipher {
56221  a = 0;
56222  b = 0;
56223  constructor(key) {
56224    const s = new Uint8Array(256);
56225    const keyLength = key.length;
56226    for (let i = 0; i < 256; ++i) {
56227      s[i] = i;
56228    }
56229    for (let i = 0, j = 0; i < 256; ++i) {
56230      const tmp = s[i];
56231      j = j + tmp + key[i % keyLength] & 0xff;
56232      s[i] = s[j];
56233      s[j] = tmp;
56234    }
56235    this.s = s;
56236  }
56237  encryptBlock(data) {
56238    let a = this.a,
56239      b = this.b;
56240    const s = this.s;
56241    const n = data.length;
56242    const output = new Uint8Array(n);
56243    for (let i = 0; i < n; ++i) {
56244      a = a + 1 & 0xff;
56245      const tmp = s[a];
56246      b = b + tmp & 0xff;
56247      const tmp2 = s[b];
56248      s[a] = tmp2;
56249      s[b] = tmp;
56250      output[i] = data[i] ^ s[tmp + tmp2 & 0xff];
56251    }
56252    this.a = a;
56253    this.b = b;
56254    return output;
56255  }
56256  decryptBlock(data) {
56257    return this.encryptBlock(data);
56258  }
56259  encrypt(data) {
56260    return this.encryptBlock(data);
56261  }
56262}
56263class NullCipher {
56264  decryptBlock(data) {
56265    return data;
56266  }
56267  encrypt(data) {
56268    return data;
56269  }
56270}
56271class AESBaseCipher {
56272  _s = new Uint8Array([0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb, 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08, 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a, 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16]);
56273  _inv_s = new Uint8Array([0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb, 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb, 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e, 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2, 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25, 0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92, 0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda, 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84, 0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a, 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06, 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02, 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b, 0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73, 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e, 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b, 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4, 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f, 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef, 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d]);
56274  _mix = new Uint32Array([0x00000000, 0x0e090d0b, 0x1c121a16, 0x121b171d, 0x3824342c, 0x362d3927, 0x24362e3a, 0x2a3f2331, 0x70486858, 0x7e416553, 0x6c5a724e, 0x62537f45, 0x486c5c74, 0x4665517f, 0x547e4662, 0x5a774b69, 0xe090d0b0, 0xee99ddbb, 0xfc82caa6, 0xf28bc7ad, 0xd8b4e49c, 0xd6bde997, 0xc4a6fe8a, 0xcaaff381, 0x90d8b8e8, 0x9ed1b5e3, 0x8ccaa2fe, 0x82c3aff5, 0xa8fc8cc4, 0xa6f581cf, 0xb4ee96d2, 0xbae79bd9, 0xdb3bbb7b, 0xd532b670, 0xc729a16d, 0xc920ac66, 0xe31f8f57, 0xed16825c, 0xff0d9541, 0xf104984a, 0xab73d323, 0xa57ade28, 0xb761c935, 0xb968c43e, 0x9357e70f, 0x9d5eea04, 0x8f45fd19, 0x814cf012, 0x3bab6bcb, 0x35a266c0, 0x27b971dd, 0x29b07cd6, 0x038f5fe7, 0x0d8652ec, 0x1f9d45f1, 0x119448fa, 0x4be30393, 0x45ea0e98, 0x57f11985, 0x59f8148e, 0x73c737bf, 0x7dce3ab4, 0x6fd52da9, 0x61dc20a2, 0xad766df6, 0xa37f60fd, 0xb16477e0, 0xbf6d7aeb, 0x955259da, 0x9b5b54d1, 0x894043cc, 0x87494ec7, 0xdd3e05ae, 0xd33708a5, 0xc12c1fb8, 0xcf2512b3, 0xe51a3182, 0xeb133c89, 0xf9082b94, 0xf701269f, 0x4de6bd46, 0x43efb04d, 0x51f4a
vendor: 4,150 bytes, lines 56274-56350
56274750, 0x5ffdaa5b, 0x75c2896a, 0x7bcb8461, 0x69d0937c, 0x67d99e77, 0x3daed51e, 0x33a7d815, 0x21bccf08, 0x2fb5c203, 0x058ae132, 0x0b83ec39, 0x1998fb24, 0x1791f62f, 0x764dd68d, 0x7844db86, 0x6a5fcc9b, 0x6456c190, 0x4e69e2a1, 0x4060efaa, 0x527bf8b7, 0x5c72f5bc, 0x0605bed5, 0x080cb3de, 0x1a17a4c3, 0x141ea9c8, 0x3e218af9, 0x302887f2, 0x223390ef, 0x2c3a9de4, 0x96dd063d, 0x98d40b36, 0x8acf1c2b, 0x84c61120, 0xaef93211, 0xa0f03f1a, 0xb2eb2807, 0xbce2250c, 0xe6956e65, 0xe89c636e, 0xfa877473, 0xf48e7978, 0xdeb15a49, 0xd0b85742, 0xc2a3405f, 0xccaa4d54, 0x41ecdaf7, 0x4fe5d7fc, 0x5dfec0e1, 0x53f7cdea, 0x79c8eedb, 0x77c1e3d0, 0x65daf4cd, 0x6bd3f9c6, 0x31a4b2af, 0x3fadbfa4, 0x2db6a8b9, 0x23bfa5b2, 0x09808683, 0x07898b88, 0x15929c95, 0x1b9b919e, 0xa17c0a47, 0xaf75074c, 0xbd6e1051, 0xb3671d5a, 0x99583e6b, 0x97513360, 0x854a247d, 0x8b432976, 0xd134621f, 0xdf3d6f14, 0xcd267809, 0xc32f7502, 0xe9105633, 0xe7195b38, 0xf5024c25, 0xfb0b412e, 0x9ad7618c, 0x94de6c87, 0x86c57b9a, 0x88cc7691, 0xa2f355a0, 0xacfa58ab, 0xbee14fb6, 0xb0e842bd, 0xea9f09d4, 0xe49604df, 0xf68d13c2, 0xf8841ec9, 0xd2bb3df8, 0xdcb230f3, 0xcea927ee, 0xc0a02ae5, 0x7a47b13c, 0x744ebc37, 0x6655ab2a, 0x685ca621, 0x42638510, 0x4c6a881b, 0x5e719f06, 0x5078920d, 0x0a0fd964, 0x0406d46f, 0x161dc372, 0x1814ce79, 0x322bed48, 0x3c22e043, 0x2e39f75e, 0x2030fa55, 0xec9ab701, 0xe293ba0a, 0xf088ad17, 0xfe81a01c, 0xd4be832d, 0xdab78e26, 0xc8ac993b, 0xc6a59430, 0x9cd2df59, 0x92dbd252, 0x80c0c54f, 0x8ec9c844, 0xa4f6eb75, 0xaaffe67e, 0xb8e4f163, 0xb6edfc68, 0x0c0a67b1, 0x02036aba, 0x10187da7, 0x1e1170ac, 0x342e539d, 0x3a275e96, 0x283c498b, 0x26354480, 0x7c420fe9, 0x724b02e2, 0x605015ff, 0x6e5918f4, 0x44663bc5, 0x4a6f36ce, 0x587421d3, 0x567d2cd8, 0x37a10c7a, 0x39a80171, 0x2bb3166c, 0x25ba1b67, 0x0f853856, 0x018c355d, 0x13972240, 0x1d9e2f4b, 0x47e96422, 0x49e06929, 0x5bfb7e34, 0x55f2733f, 0x7fcd500e, 0x71c45d05, 0x63df4a18, 0x6dd64713, 0xd731dcca, 0xd938d1c1, 0xcb23c6dc, 0xc52acbd7, 0xef15e8e6, 0xe11ce5ed, 0xf307f2f0, 0xfd0efffb, 0xa779b492, 0xa970b999, 0xbb6bae84, 0xb562a38f, 0x9f5d80be, 0x91548db5, 0x834f9aa8, 0x8d4697a3]);
56275  _mixCol = new Uint8Array(256).map((_, i) => i < 128 ? i << 1 : i << 1 ^ 0x1b);
56276  constructor() {
56277    this.buffer = new Uint8Array(16);
56278    this.bufferPosition = 0;
56279  }
56280  _expandKey(cipherKey) {
56281    unreachable("Cannot call `_expandKey` on the base class");
56282  }
56283  _decrypt(input, key) {
56284    let t, u, v;
56285    const state = new Uint8Array(16);
56286    state.set(input);
56287    for (let j = 0, k = this._keySize; j < 16; ++j, ++k) {
56288      state[j] ^= key[k];
56289    }
56290    for (let i = this._cyclesOfRepetition - 1; i >= 1; --i) {
56291      t = state[13];
56292      state[13] = state[9];
56293      state[9] = state[5];
56294      state[5] = state[1];
56295      state[1] = t;
56296      t = state[14];
56297      u = state[10];
56298      state[14] = state[6];
56299      state[10] = state[2];
56300      state[6] = t;
56301      state[2] = u;
56302      t = state[15];
56303      u = state[11];
56304      v = state[7];
56305      state[15] = state[3];
56306      state[11] = t;
56307      state[7] = u;
56308      state[3] = v;
56309      for (let j = 0; j < 16; ++j) {
56310        state[j] = this._inv_s[state[j]];
56311      }
56312      for (let j = 0, k = i * 16; j < 16; ++j, ++k) {
56313        state[j] ^= key[k];
56314      }
56315      for (let j = 0; j < 16; j += 4) {
56316        const s0 = this._mix[state[j]];
56317        const s1 = this._mix[state[j + 1]];
56318        const s2 = this._mix[state[j + 2]];
56319        const s3 = this._mix[state[j + 3]];
56320        t = s0 ^ s1 >>> 8 ^ s1 << 24 ^ s2 >>> 16 ^ s2 << 16 ^ s3 >>> 24 ^ s3 << 8;
56321        state[j] = t >>> 24 & 0xff;
56322        state[j + 1] = t >> 16 & 0xff;
56323        state[j + 2] = t >> 8 & 0xff;
56324        state[j + 3] = t & 0xff;
56325      }
56326    }
56327    t = state[13];
56328    state[13] = state[9];
56329    state[9] = state[5];
56330    state[5] = state[1];
56331    state[1] = t;
56332    t = state[14];
56333    u = state[10];
56334    state[14] = state[6];
56335    state[10] = state[2];
56336    state[6] = t;
56337    state[2] = u;
56338    t = state[15];
56339    u = state[11];
56340    v = state[7];
56341    state[15] = state[3];
56342    state[11] = t;
56343    state[7] = u;
56344    state[3] = v;
56345    for (let j = 0; j < 16; ++j) {
56346      state[j] = this._inv_s[state[j]];
56347      state[j] ^= key[j];
56348    }
56349    return state;
56350  }
vendor: 8,061 bytes, lines 56351-56596
56351  _encrypt(input, key) {
56352    const s = this._s;
56353    let t, u, v;
56354    const state = new Uint8Array(16);
56355    state.set(input);
56356    for (let j = 0; j < 16; ++j) {
56357      state[j] ^= key[j];
56358    }
56359    for (let i = 1; i < this._cyclesOfRepetition; i++) {
56360      for (let j = 0; j < 16; ++j) {
56361        state[j] = s[state[j]];
56362      }
56363      v = state[1];
56364      state[1] = state[5];
56365      state[5] = state[9];
56366      state[9] = state[13];
56367      state[13] = v;
56368      v = state[2];
56369      u = state[6];
56370      state[2] = state[10];
56371      state[6] = state[14];
56372      state[10] = v;
56373      state[14] = u;
56374      v = state[3];
56375      u = state[7];
56376      t = state[11];
56377      state[3] = state[15];
56378      state[7] = v;
56379      state[11] = u;
56380      state[15] = t;
56381      for (let j = 0; j < 16; j += 4) {
56382        const s0 = state[j];
56383        const s1 = state[j + 1];
56384        const s2 = state[j + 2];
56385        const s3 = state[j + 3];
56386        t = s0 ^ s1 ^ s2 ^ s3;
56387        state[j] ^= t ^ this._mixCol[s0 ^ s1];
56388        state[j + 1] ^= t ^ this._mixCol[s1 ^ s2];
56389        state[j + 2] ^= t ^ this._mixCol[s2 ^ s3];
56390        state[j + 3] ^= t ^ this._mixCol[s3 ^ s0];
56391      }
56392      for (let j = 0, k = i * 16; j < 16; ++j, ++k) {
56393        state[j] ^= key[k];
56394      }
56395    }
56396    for (let j = 0; j < 16; ++j) {
56397      state[j] = s[state[j]];
56398    }
56399    v = state[1];
56400    state[1] = state[5];
56401    state[5] = state[9];
56402    state[9] = state[13];
56403    state[13] = v;
56404    v = state[2];
56405    u = state[6];
56406    state[2] = state[10];
56407    state[6] = state[14];
56408    state[10] = v;
56409    state[14] = u;
56410    v = state[3];
56411    u = state[7];
56412    t = state[11];
56413    state[3] = state[15];
56414    state[7] = v;
56415    state[11] = u;
56416    state[15] = t;
56417    for (let j = 0, k = this._keySize; j < 16; ++j, ++k) {
56418      state[j] ^= key[k];
56419    }
56420    return state;
56421  }
56422  _decryptBlock2(data, finalize) {
56423    const sourceLength = data.length;
56424    let buffer = this.buffer,
56425      bufferLength = this.bufferPosition;
56426    const result = [];
56427    let iv = this.iv;
56428    for (let i = 0; i < sourceLength; ++i) {
56429      buffer[bufferLength] = data[i];
56430      ++bufferLength;
56431      if (bufferLength < 16) {
56432        continue;
56433      }
56434      const plain = this._decrypt(buffer, this._key);
56435      for (let j = 0; j < 16; ++j) {
56436        plain[j] ^= iv[j];
56437      }
56438      iv = buffer;
56439      result.push(plain);
56440      buffer = new Uint8Array(16);
56441      bufferLength = 0;
56442    }
56443    this.buffer = buffer;
56444    this.bufferLength = bufferLength;
56445    this.iv = iv;
56446    if (result.length === 0) {
56447      return new Uint8Array(0);
56448    }
56449    let outputLength = 16 * result.length;
56450    if (finalize) {
56451      const lastBlock = result.at(-1);
56452      let psLen = lastBlock[15];
56453      if (psLen <= 16) {
56454        for (let i = 15, ii = 16 - psLen; i >= ii; --i) {
56455          if (lastBlock[i] !== psLen) {
56456            psLen = 0;
56457            break;
56458          }
56459        }
56460        outputLength -= psLen;
56461        result[result.length - 1] = lastBlock.subarray(0, 16 - psLen);
56462      }
56463    }
56464    const output = new Uint8Array(outputLength);
56465    for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
56466      output.set(result[i], j);
56467    }
56468    return output;
56469  }
56470  decryptBlock(data, finalize, iv = null) {
56471    const sourceLength = data.length;
56472    const buffer = this.buffer;
56473    let bufferLength = this.bufferPosition;
56474    if (iv) {
56475      this.iv = iv;
56476    } else {
56477      for (let i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) {
56478        buffer[bufferLength] = data[i];
56479      }
56480      if (bufferLength < 16) {
56481        this.bufferLength = bufferLength;
56482        return new Uint8Array(0);
56483      }
56484      this.iv = buffer;
56485      data = data.subarray(16);
56486    }
56487    this.buffer = new Uint8Array(16);
56488    this.bufferLength = 0;
56489    this.decryptBlock = this._decryptBlock2;
56490    return this.decryptBlock(data, finalize);
56491  }
56492  encrypt(data, iv) {
56493    const sourceLength = data.length;
56494    let buffer = this.buffer,
56495      bufferLength = this.bufferPosition;
56496    const result = [];
56497    iv ||= new Uint8Array(16);
56498    for (let i = 0; i < sourceLength; ++i) {
56499      buffer[bufferLength] = data[i];
56500      ++bufferLength;
56501      if (bufferLength < 16) {
56502        continue;
56503      }
56504      for (let j = 0; j < 16; ++j) {
56505        buffer[j] ^= iv[j];
56506      }
56507      const cipher = this._encrypt(buffer, this._key);
56508      iv = cipher;
56509      result.push(cipher);
56510      buffer = new Uint8Array(16);
56511      bufferLength = 0;
56512    }
56513    this.buffer = buffer;
56514    this.bufferLength = bufferLength;
56515    this.iv = iv;
56516    if (result.length === 0) {
56517      return new Uint8Array(0);
56518    }
56519    const outputLength = 16 * result.length;
56520    const output = new Uint8Array(outputLength);
56521    for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
56522      output.set(result[i], j);
56523    }
56524    return output;
56525  }
56526}
56527class AES128Cipher extends AESBaseCipher {
56528  _rcon = new Uint8Array([0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d]);
56529  constructor(key) {
56530    super();
56531    this._cyclesOfRepetition = 10;
56532    this._keySize = 160;
56533    this._key = this._expandKey(key);
56534  }
56535  _expandKey(cipherKey) {
56536    const b = 176;
56537    const s = this._s;
56538    const rcon = this._rcon;
56539    const result = new Uint8Array(b);
56540    result.set(cipherKey);
56541    for (let j = 16, i = 1; j < b; ++i) {
56542      let t1 = result[j - 3];
56543      let t2 = result[j - 2];
56544      let t3 = result[j - 1];
56545      let t4 = result[j - 4];
56546      t1 = s[t1];
56547      t2 = s[t2];
56548      t3 = s[t3];
56549      t4 = s[t4];
56550      t1 ^= rcon[i];
56551      for (let n = 0; n < 4; ++n) {
56552        result[j] = t1 ^= result[j - 16];
56553        j++;
56554        result[j] = t2 ^= result[j - 16];
56555        j++;
56556        result[j] = t3 ^= result[j - 16];
56557        j++;
56558        result[j] = t4 ^= result[j - 16];
56559        j++;
56560      }
56561    }
56562    return result;
56563  }
56564}
56565class AES256Cipher extends AESBaseCipher {
56566  constructor(key) {
56567    super();
56568    this._cyclesOfRepetition = 14;
56569    this._keySize = 224;
56570    this._key = this._expandKey(key);
56571  }
56572  _expandKey(cipherKey) {
56573    const b = 240;
56574    const s = this._s;
56575    const result = new Uint8Array(b);
56576    result.set(cipherKey);
56577    let r = 1;
56578    let t1, t2, t3, t4;
56579    for (let j = 32, i = 1; j < b; ++i) {
56580      if (j % 32 === 16) {
56581        t1 = s[t1];
56582        t2 = s[t2];
56583        t3 = s[t3];
56584        t4 = s[t4];
56585      } else if (j % 32 === 0) {
56586        t1 = result[j - 3];
56587        t2 = result[j - 2];
56588        t3 = result[j - 1];
56589        t4 = result[j - 4];
56590        t1 = s[t1];
56591        t2 = s[t2];
56592        t3 = s[t3];
56593        t4 = s[t4];
56594        t1 ^= r;
56595        if ((r <<= 1) >= 256) {
56596          r = (r ^ 0x1b) & 0xff;
vendor: 30,226 bytes, lines 56597-57478
56597        }
56598      }
56599      for (let n = 0; n < 4; ++n) {
56600        result[j] = t1 ^= result[j - 32];
56601        j++;
56602        result[j] = t2 ^= result[j - 32];
56603        j++;
56604        result[j] = t3 ^= result[j - 32];
56605        j++;
56606        result[j] = t4 ^= result[j - 32];
56607        j++;
56608      }
56609    }
56610    return result;
56611  }
56612}
56613class PDFBase {
56614  _hash(password, input, userBytes) {
56615    unreachable("Abstract method `_hash` called");
56616  }
56617  checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
56618    const hashData = new Uint8Array(password.length + 56);
56619    hashData.set(password, 0);
56620    hashData.set(ownerValidationSalt, password.length);
56621    hashData.set(userBytes, password.length + ownerValidationSalt.length);
56622    const result = this._hash(password, hashData, userBytes);
56623    return isArrayEqual(result, ownerPassword);
56624  }
56625  checkUserPassword(password, userValidationSalt, userPassword) {
56626    const hashData = new Uint8Array(password.length + 8);
56627    hashData.set(password, 0);
56628    hashData.set(userValidationSalt, password.length);
56629    const result = this._hash(password, hashData, []);
56630    return isArrayEqual(result, userPassword);
56631  }
56632  getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
56633    const hashData = new Uint8Array(password.length + 56);
56634    hashData.set(password, 0);
56635    hashData.set(ownerKeySalt, password.length);
56636    hashData.set(userBytes, password.length + ownerKeySalt.length);
56637    const key = this._hash(password, hashData, userBytes);
56638    const cipher = new AES256Cipher(key);
56639    return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
56640  }
56641  getUserKey(password, userKeySalt, userEncryption) {
56642    const hashData = new Uint8Array(password.length + 8);
56643    hashData.set(password, 0);
56644    hashData.set(userKeySalt, password.length);
56645    const key = this._hash(password, hashData, []);
56646    const cipher = new AES256Cipher(key);
56647    return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
56648  }
56649}
56650class PDF17 extends PDFBase {
56651  _hash(password, input, userBytes) {
56652    return calculateSHA256(input, 0, input.length);
56653  }
56654}
56655class PDF20 extends PDFBase {
56656  _hash(password, input, userBytes) {
56657    let k = calculateSHA256(input, 0, input.length).subarray(0, 32);
56658    let e = [0];
56659    let i = 0;
56660    while (i < 64 || e.at(-1) > i - 32) {
56661      const combinedLength = password.length + k.length + userBytes.length,
56662        combinedArray = new Uint8Array(combinedLength);
56663      let writeOffset = 0;
56664      combinedArray.set(password, writeOffset);
56665      writeOffset += password.length;
56666      combinedArray.set(k, writeOffset);
56667      writeOffset += k.length;
56668      combinedArray.set(userBytes, writeOffset);
56669      const k1 = new Uint8Array(combinedLength * 64);
56670      for (let j = 0, pos = 0; j < 64; j++, pos += combinedLength) {
56671        k1.set(combinedArray, pos);
56672      }
56673      const cipher = new AES128Cipher(k.subarray(0, 16));
56674      e = cipher.encrypt(k1, k.subarray(16, 32));
56675      const remainder = Math.sumPrecise(e.slice(0, 16)) % 3;
56676      if (remainder === 0) {
56677        k = calculateSHA256(e, 0, e.length);
56678      } else if (remainder === 1) {
56679        k = calculateSHA384(e, 0, e.length);
56680      } else if (remainder === 2) {
56681        k = calculateSHA512(e, 0, e.length);
56682      }
56683      i++;
56684    }
56685    return k.subarray(0, 32);
56686  }
56687}
56688class CipherTransform {
56689  constructor(stringCipherConstructor, streamCipherConstructor) {
56690    this.StringCipherConstructor = stringCipherConstructor;
56691    this.StreamCipherConstructor = streamCipherConstructor;
56692  }
56693  createStream(stream, length) {
56694    const cipher = new this.StreamCipherConstructor();
56695    return new DecryptStream(stream, length, function cipherTransformDecryptStream(data, finalize) {
56696      return cipher.decryptBlock(data, finalize);
56697    });
56698  }
56699  decryptString(s) {
56700    const cipher = new this.StringCipherConstructor();
56701    let data = stringToBytes(s);
56702    data = cipher.decryptBlock(data, true);
56703    return bytesToString(data);
56704  }
56705  encryptString(s) {
56706    const cipher = new this.StringCipherConstructor();
56707    if (cipher instanceof AESBaseCipher) {
56708      const strLen = s.length;
56709      const pad = 16 - strLen % 16;
56710      s += String.fromCharCode(pad).repeat(pad);
56711      const iv = new Uint8Array(16);
56712      crypto.getRandomValues(iv);
56713      let data = stringToBytes(s);
56714      data = cipher.encrypt(data, iv);
56715      const buf = new Uint8Array(16 + data.length);
56716      buf.set(iv);
56717      buf.set(data, 16);
56718      return bytesToString(buf);
56719    }
56720    let data = stringToBytes(s);
56721    data = cipher.encrypt(data);
56722    return bytesToString(data);
56723  }
56724}
56725class CipherTransformFactory {
56726  static get _defaultPasswordBytes() {
56727    return shadow(this, "_defaultPasswordBytes", new Uint8Array([0x28, 0xbf, 0x4e, 0x5e, 0x4e, 0x75, 0x8a, 0x41, 0x64, 0x00, 0x4e, 0x56, 0xff, 0xfa, 0x01, 0x08, 0x2e, 0x2e, 0x00, 0xb6, 0xd0, 0x68, 0x3e, 0x80, 0x2f, 0x0c, 0xa9, 0xfe, 0x64, 0x53, 0x69, 0x7a]));
56728  }
56729  #createEncryptionKey20(revision, password, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms) {
56730    if (password) {
56731      const passwordLength = Math.min(127, password.length);
56732      password = password.subarray(0, passwordLength);
56733    } else {
56734      password = [];
56735    }
56736    const pdfAlgorithm = revision === 6 ? new PDF20() : new PDF17();
56737    if (pdfAlgorithm.checkUserPassword(password, userValidationSalt, userPassword)) {
56738      return pdfAlgorithm.getUserKey(password, userKeySalt, userEncryption);
56739    } else if (password.length && pdfAlgorithm.checkOwnerPassword(password, ownerValidationSalt, uBytes, ownerPassword)) {
56740      return pdfAlgorithm.getOwnerKey(password, ownerKeySalt, uBytes, ownerEncryption);
56741    }
56742    return null;
56743  }
56744  #prepareKeyData(fileId, password, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata) {
56745    const hashDataSize = 40 + ownerPassword.length + fileId.length;
56746    const hashData = new Uint8Array(hashDataSize);
56747    let i = 0,
56748      j,
56749      n;
56750    if (password) {
56751      n = Math.min(32, password.length);
56752      for (; i < n; ++i) {
56753        hashData[i] = password[i];
56754      }
56755    }
56756    j = 0;
56757    while (i < 32) {
56758      hashData[i++] = CipherTransformFactory._defaultPasswordBytes[j++];
56759    }
56760    hashData.set(ownerPassword, i);
56761    i += ownerPassword.length;
56762    hashData[i++] = flags & 0xff;
56763    hashData[i++] = flags >> 8 & 0xff;
56764    hashData[i++] = flags >> 16 & 0xff;
56765    hashData[i++] = flags >>> 24 & 0xff;
56766    hashData.set(fileId, i);
56767    i += fileId.length;
56768    if (revision >= 4 && !encryptMetadata) {
56769      hashData.fill(0xff, i, i + 4);
56770      i += 4;
56771    }
56772    let hash = calculateMD5(hashData, 0, i);
56773    const keyLengthInBytes = keyLength >> 3;
56774    if (revision >= 3) {
56775      for (j = 0; j < 50; ++j) {
56776        hash = calculateMD5(hash, 0, keyLengthInBytes);
56777      }
56778    }
56779    const encryptionKey = hash.subarray(0, keyLengthInBytes);
56780    let cipher, checkData;
56781    if (revision >= 3) {
56782      i = 0;
56783      hashData.set(CipherTransformFactory._defaultPasswordBytes, i);
56784      i += 32;
56785      hashData.set(fileId, i);
56786      i += fileId.length;
56787      cipher = new ARCFourCipher(encryptionKey);
56788      checkData = cipher.encryptBlock(calculateMD5(hashData, 0, i));
56789      n = encryptionKey.length;
56790      const derivedKey = new Uint8Array(n);
56791      for (j = 1; j <= 19; ++j) {
56792        for (let k = 0; k < n; ++k) {
56793          derivedKey[k] = encryptionKey[k] ^ j;
56794        }
56795        cipher = new ARCFourCipher(derivedKey);
56796        checkData = cipher.encryptBlock(checkData);
56797      }
56798    } else {
56799      cipher = new ARCFourCipher(encryptionKey);
56800      checkData = cipher.encryptBlock(CipherTransformFactory._defaultPasswordBytes);
56801    }
56802    return checkData.every((data, k) => userPassword[k] === data) ? encryptionKey : null;
56803  }
56804  #decodeUserPassword(password, ownerPassword, revision, keyLength) {
56805    const hashData = new Uint8Array(32);
56806    let i = 0;
56807    const n = Math.min(32, password.length);
56808    for (; i < n; ++i) {
56809      hashData[i] = password[i];
56810    }
56811    let j = 0;
56812    while (i < 32) {
56813      hashData[i++] = CipherTransformFactory._defaultPasswordBytes[j++];
56814    }
56815    let hash = calculateMD5(hashData, 0, i);
56816    const keyLengthInBytes = keyLength >> 3;
56817    if (revision >= 3) {
56818      for (j = 0; j < 50; ++j) {
56819        hash = calculateMD5(hash, 0, hash.length);
56820      }
56821    }
56822    let cipher, userPassword;
56823    if (revision >= 3) {
56824      userPassword = ownerPassword;
56825      const derivedKey = new Uint8Array(keyLengthInBytes);
56826      for (j = 19; j >= 0; j--) {
56827        for (let k = 0; k < keyLengthInBytes; ++k) {
56828          derivedKey[k] = hash[k] ^ j;
56829        }
56830        cipher = new ARCFourCipher(derivedKey);
56831        userPassword = cipher.encryptBlock(userPassword);
56832      }
56833    } else {
56834      cipher = new ARCFourCipher(hash.subarray(0, keyLengthInBytes));
56835      userPassword = cipher.encryptBlock(ownerPassword);
56836    }
56837    return userPassword;
56838  }
56839  #buildObjectKey(num, gen, encryptionKey, isAes = false) {
56840    const n = encryptionKey.length;
56841    const key = new Uint8Array(n + 9);
56842    key.set(encryptionKey);
56843    let i = n;
56844    key[i++] = num & 0xff;
56845    key[i++] = num >> 8 & 0xff;
56846    key[i++] = num >> 16 & 0xff;
56847    key[i++] = gen & 0xff;
56848    key[i++] = gen >> 8 & 0xff;
56849    if (isAes) {
56850      key[i++] = 0x73;
56851      key[i++] = 0x41;
56852      key[i++] = 0x6c;
56853      key[i++] = 0x54;
56854    }
56855    const hash = calculateMD5(key, 0, i);
56856    return hash.subarray(0, Math.min(n + 5, 16));
56857  }
56858  #buildCipherConstructor(cf, name, num, gen, key) {
56859    if (!(name instanceof Name)) {
56860      throw new FormatError("Invalid crypt filter name.");
56861    }
56862    const self = this;
56863    const cryptFilter = cf.get(name.name);
56864    const cfm = cryptFilter?.get("CFM");
56865    if (!cfm || cfm.name === "None") {
56866      return function () {
56867        return new NullCipher();
56868      };
56869    }
56870    if (cfm.name === "V2") {
56871      return function () {
56872        return new ARCFourCipher(self.#buildObjectKey(num, gen, key, false));
56873      };
56874    }
56875    if (cfm.name === "AESV2") {
56876      return function () {
56877        return new AES128Cipher(self.#buildObjectKey(num, gen, key, true));
56878      };
56879    }
56880    if (cfm.name === "AESV3") {
56881      return function () {
56882        return new AES256Cipher(key);
56883      };
56884    }
56885    throw new FormatError("Unknown crypto method");
56886  }
56887  constructor(dict, fileId, password) {
56888    const filter = dict.get("Filter");
56889    if (!isName(filter, "Standard")) {
56890      throw new FormatError("unknown encryption method");
56891    }
56892    this.filterName = filter.name;
56893    this.dict = dict;
56894    const algorithm = dict.get("V");
56895    if (!Number.isInteger(algorithm) || algorithm !== 1 && algorithm !== 2 && algorithm !== 4 && algorithm !== 5) {
56896      throw new FormatError("unsupported encryption algorithm");
56897    }
56898    this.algorithm = algorithm;
56899    let keyLength = dict.get("Length");
56900    if (!keyLength) {
56901      if (algorithm <= 3) {
56902        keyLength = 40;
56903      } else {
56904        const cfDict = dict.get("CF");
56905        const streamCryptoName = dict.get("StmF");
56906        if (cfDict instanceof Dict && streamCryptoName instanceof Name) {
56907          cfDict.suppressEncryption = true;
56908          const handlerDict = cfDict.get(streamCryptoName.name);
56909          keyLength = handlerDict?.get("Length") || 128;
56910          if (keyLength < 40) {
56911            keyLength <<= 3;
56912          }
56913        }
56914      }
56915    }
56916    if (!Number.isInteger(keyLength) || keyLength < 40 || keyLength % 8 !== 0) {
56917      throw new FormatError("invalid key length");
56918    }
56919    const ownerBytes = stringToBytes(dict.get("O")),
56920      userBytes = stringToBytes(dict.get("U"));
56921    const ownerPassword = ownerBytes.subarray(0, 32);
56922    const userPassword = userBytes.subarray(0, 32);
56923    const flags = dict.get("P");
56924    const revision = dict.get("R");
56925    const encryptMetadata = (algorithm === 4 || algorithm === 5) && dict.get("EncryptMetadata") !== false;
56926    this.encryptMetadata = encryptMetadata;
56927    const fileIdBytes = stringToBytes(fileId);
56928    let passwordBytes;
56929    if (password) {
56930      if (revision === 6) {
56931        try {
56932          password = utf8StringToString(password);
56933        } catch {
56934          warn("CipherTransformFactory: Unable to convert UTF8 encoded password.");
56935        }
56936      }
56937      passwordBytes = stringToBytes(password);
56938    }
56939    let encryptionKey;
56940    if (algorithm !== 5) {
56941      encryptionKey = this.#prepareKeyData(fileIdBytes, passwordBytes, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
56942    } else {
56943      const ownerValidationSalt = ownerBytes.subarray(32, 40);
56944      const ownerKeySalt = ownerBytes.subarray(40, 48);
56945      const uBytes = userBytes.subarray(0, 48);
56946      const userValidationSalt = userBytes.subarray(32, 40);
56947      const userKeySalt = userBytes.subarray(40, 48);
56948      const ownerEncryption = stringToBytes(dict.get("OE"));
56949      const userEncryption = stringToBytes(dict.get("UE"));
56950      const perms = stringToBytes(dict.get("Perms"));
56951      encryptionKey = this.#createEncryptionKey20(revision, passwordBytes, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms);
56952    }
56953    if (!encryptionKey) {
56954      if (!password) {
56955        throw new PasswordException("No password given", PasswordResponses.NEED_PASSWORD);
56956      }
56957      const decodedPassword = this.#decodeUserPassword(passwordBytes, ownerPassword, revision, keyLength);
56958      encryptionKey = this.#prepareKeyData(fileIdBytes, decodedPassword, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
56959    }
56960    if (!encryptionKey) {
56961      throw new PasswordException("Incorrect Password", PasswordResponses.INCORRECT_PASSWORD);
56962    }
56963    if (algorithm === 4 && encryptionKey.length < 16) {
56964      this.encryptionKey = new Uint8Array(16);
56965      this.encryptionKey.set(encryptionKey);
56966    } else {
56967      this.encryptionKey = encryptionKey;
56968    }
56969    if (algorithm >= 4) {
56970      const cf = dict.get("CF");
56971      if (cf instanceof Dict) {
56972        cf.suppressEncryption = true;
56973      }
56974      this.cf = cf;
56975      this.stmf = dict.get("StmF") || Name.get("Identity");
56976      this.strf = dict.get("StrF") || Name.get("Identity");
56977      this.eff = dict.get("EFF") || this.stmf;
56978    }
56979  }
56980  createCipherTransform(num, gen) {
56981    if (this.algorithm === 4 || this.algorithm === 5) {
56982      return new CipherTransform(this.#buildCipherConstructor(this.cf, this.strf, num, gen, this.encryptionKey), this.#buildCipherConstructor(this.cf, this.stmf, num, gen, this.encryptionKey));
56983    }
56984    const key = this.#buildObjectKey(num, gen, this.encryptionKey, false);
56985    const cipherConstructor = function () {
56986      return new ARCFourCipher(key);
56987    };
56988    return new CipherTransform(cipherConstructor, cipherConstructor);
56989  }
56990}
56991
56992;// ./src/core/xref.js
56993
56994
56995
56996
56997
56998
56999class XRef {
57000  constructor(stream, pdfManager) {
57001    this.stream = stream;
57002    this.pdfManager = pdfManager;
57003    this.entries = [];
57004    this._xrefStms = new Set();
57005    this._cacheMap = new Map();
57006    this._pendingRefs = new RefSet();
57007    this._newPersistentRefNum = null;
57008    this._newTemporaryRefNum = null;
57009    this._persistentRefsCache = null;
57010  }
57011  getNewPersistentRef(obj) {
57012    if (this._newPersistentRefNum === null) {
57013      this._newPersistentRefNum = this.entries.length || 1;
57014    }
57015    const num = this._newPersistentRefNum++;
57016    this._cacheMap.set(num, obj);
57017    return Ref.get(num, 0);
57018  }
57019  getNewTemporaryRef() {
57020    if (this._newTemporaryRefNum === null) {
57021      this._newTemporaryRefNum = this.entries.length || 1;
57022      if (this._newPersistentRefNum) {
57023        this._persistentRefsCache = new Map();
57024        for (let i = this._newTemporaryRefNum; i < this._newPersistentRefNum; i++) {
57025          this._persistentRefsCache.set(i, this._cacheMap.get(i));
57026          this._cacheMap.delete(i);
57027        }
57028      }
57029    }
57030    return Ref.get(this._newTemporaryRefNum++, 0);
57031  }
57032  resetNewTemporaryRef() {
57033    this._newTemporaryRefNum = null;
57034    if (this._persistentRefsCache) {
57035      for (const [num, obj] of this._persistentRefsCache) {
57036        this._cacheMap.set(num, obj);
57037      }
57038    }
57039    this._persistentRefsCache = null;
57040  }
57041  setStartXRef(startXRef) {
57042    this.startXRefQueue = [startXRef];
57043  }
57044  parse(recoveryMode = false) {
57045    let trailerDict;
57046    if (!recoveryMode) {
57047      trailerDict = this.readXRef();
57048    } else {
57049      warn("Indexing all PDF objects");
57050      trailerDict = this.indexObjects();
57051    }
57052    trailerDict.assignXref(this);
57053    this.trailer = trailerDict;
57054    let encrypt;
57055    try {
57056      encrypt = trailerDict.get("Encrypt");
57057    } catch (ex) {
57058      if (ex instanceof MissingDataException) {
57059        throw ex;
57060      }
57061      warn(`XRef.parse - Invalid "Encrypt" reference: "${ex}".`);
57062    }
57063    if (encrypt instanceof Dict) {
57064      const ids = trailerDict.get("ID");
57065      const fileId = ids?.length ? ids[0] : "";
57066      encrypt.suppressEncryption = true;
57067      this.encrypt = new CipherTransformFactory(encrypt, fileId, this.pdfManager.password);
57068    }
57069    let root;
57070    try {
57071      root = trailerDict.get("Root");
57072    } catch (ex) {
57073      if (ex instanceof MissingDataException) {
57074        throw ex;
57075      }
57076      warn(`XRef.parse - Invalid "Root" reference: "${ex}".`);
57077    }
57078    if (root instanceof Dict) {
57079      try {
57080        const pages = root.get("Pages");
57081        if (pages instanceof Dict) {
57082          this.root = root;
57083          return;
57084        }
57085      } catch (ex) {
57086        if (ex instanceof MissingDataException) {
57087          throw ex;
57088        }
57089        warn(`XRef.parse - Invalid "Pages" reference: "${ex}".`);
57090      }
57091    }
57092    if (!recoveryMode) {
57093      throw new XRefParseException();
57094    }
57095    throw new InvalidPDFException("Invalid Root reference.");
57096  }
57097  processXRefTable(parser) {
57098    if (!("tableState" in this)) {
57099      this.tableState = {
57100        entryNum: 0,
57101        streamPos: parser.lexer.stream.pos,
57102        parserBuf1: parser.buf1,
57103        parserBuf2: parser.buf2
57104      };
57105    }
57106    const obj = this.readXRefTable(parser);
57107    if (!isCmd(obj, "trailer")) {
57108      throw new FormatError("Invalid XRef table: could not find trailer dictionary");
57109    }
57110    let dict = parser.getObj();
57111    if (!(dict instanceof Dict) && dict.dict) {
57112      dict = dict.dict;
57113    }
57114    if (!(dict instanceof Dict)) {
57115      throw new FormatError("Invalid XRef table: could not parse trailer dictionary");
57116    }
57117    delete this.tableState;
57118    return dict;
57119  }
57120  readXRefTable(parser) {
57121    const stream = parser.lexer.stream;
57122    const tableState = this.tableState;
57123    stream.pos = tableState.streamPos;
57124    parser.buf1 = tableState.parserBuf1;
57125    parser.buf2 = tableState.parserBuf2;
57126    let obj;
57127    while (true) {
57128      if (!("firstEntryNum" in tableState) || !("entryCount" in tableState)) {
57129        if (isCmd(obj = parser.getObj(), "trailer")) {
57130          break;
57131        }
57132        tableState.firstEntryNum = obj;
57133        tableState.entryCount = parser.getObj();
57134      }
57135      let first = tableState.firstEntryNum;
57136      const count = tableState.entryCount;
57137      if (!Number.isInteger(first) || !Number.isInteger(count)) {
57138        throw new FormatError("Invalid XRef table: wrong types in subsection header");
57139      }
57140      for (let i = tableState.entryNum; i < count; i++) {
57141        tableState.streamPos = stream.pos;
57142        tableState.entryNum = i;
57143        tableState.parserBuf1 = parser.buf1;
57144        tableState.parserBuf2 = parser.buf2;
57145        const entry = {};
57146        entry.offset = parser.getObj();
57147        entry.gen = parser.getObj();
57148        const type = parser.getObj();
57149        if (type instanceof Cmd) {
57150          switch (type.cmd) {
57151            case "f":
57152              entry.free = true;
57153              break;
57154            case "n":
57155              entry.uncompressed = true;
57156              break;
57157          }
57158        }
57159        if (!Number.isInteger(entry.offset) || !Number.isInteger(entry.gen) || !(entry.free || entry.uncompressed)) {
57160          throw new FormatError(`Invalid entry in XRef subsection: ${first}, ${count}`);
57161        }
57162        if (i === 0 && entry.free && first === 1) {
57163          first = 0;
57164        }
57165        if (!this.entries[i + first]) {
57166          this.entries[i + first] = entry;
57167        }
57168      }
57169      tableState.entryNum = 0;
57170      tableState.streamPos = stream.pos;
57171      tableState.parserBuf1 = parser.buf1;
57172      tableState.parserBuf2 = parser.buf2;
57173      delete tableState.firstEntryNum;
57174      delete tableState.entryCount;
57175    }
57176    if (this.entries[0] && !this.entries[0].free) {
57177      throw new FormatError("Invalid XRef table: unexpected first object");
57178    }
57179    return obj;
57180  }
57181  processXRefStream(stream) {
57182    if (!("streamState" in this)) {
57183      const {
57184        dict,
57185        pos
57186      } = stream;
57187      const byteWidths = dict.get("W");
57188      const range = dict.get("Index") || [0, dict.get("Size")];
57189      this.streamState = {
57190        entryRanges: range,
57191        byteWidths,
57192        entryNum: 0,
57193        streamPos: pos
57194      };
57195    }
57196    this.readXRefStream(stream);
57197    delete this.streamState;
57198    return stream.dict;
57199  }
57200  readXRefStream(stream) {
57201    const streamState = this.streamState;
57202    stream.pos = streamState.streamPos;
57203    const [typeFieldWidth, offsetFieldWidth, generationFieldWidth] = streamState.byteWidths;
57204    const entryRanges = streamState.entryRanges;
57205    while (entryRanges.length > 0) {
57206      const [first, n] = entryRanges;
57207      if (!Number.isInteger(first) || !Number.isInteger(n)) {
57208        throw new FormatError(`Invalid XRef range fields: ${first}, ${n}`);
57209      }
57210      if (!Number.isInteger(typeFieldWidth) || !Number.isInteger(offsetFieldWidth) || !Number.isInteger(generationFieldWidth)) {
57211        throw new FormatError(`Invalid XRef entry fields length: ${first}, ${n}`);
57212      }
57213      for (let i = streamState.entryNum; i < n; ++i) {
57214        streamState.entryNum = i;
57215        streamState.streamPos = stream.pos;
57216        let type = 0,
57217          offset = 0,
57218          generation = 0;
57219        for (let j = 0; j < typeFieldWidth; ++j) {
57220          const typeByte = stream.getByte();
57221          if (typeByte === -1) {
57222            throw new FormatError("Invalid XRef byteWidths 'type'.");
57223          }
57224          type = type << 8 | typeByte;
57225        }
57226        if (typeFieldWidth === 0) {
57227          type = 1;
57228        }
57229        for (let j = 0; j < offsetFieldWidth; ++j) {
57230          const offsetByte = stream.getByte();
57231          if (offsetByte === -1) {
57232            throw new FormatError("Invalid XRef byteWidths 'offset'.");
57233          }
57234          offset = offset << 8 | offsetByte;
57235        }
57236        for (let j = 0; j < generationFieldWidth; ++j) {
57237          const generationByte = stream.getByte();
57238          if (generationByte === -1) {
57239            throw new FormatError("Invalid XRef byteWidths 'generation'.");
57240          }
57241          generation = generation << 8 | generationByte;
57242        }
57243        const entry = {};
57244        entry.offset = offset;
57245        entry.gen = generation;
57246        switch (type) {
57247          case 0:
57248            entry.free = true;
57249            break;
57250          case 1:
57251            entry.uncompressed = true;
57252            break;
57253          case 2:
57254            break;
57255          default:
57256            throw new FormatError(`Invalid XRef entry type: ${type}`);
57257        }
57258        if (!this.entries[first + i]) {
57259          this.entries[first + i] = entry;
57260        }
57261      }
57262      streamState.entryNum = 0;
57263      streamState.streamPos = stream.pos;
57264      entryRanges.splice(0, 2);
57265    }
57266  }
57267  indexObjects() {
57268    const TAB = 0x9,
57269      LF = 0xa,
57270      CR = 0xd,
57271      SPACE = 0x20;
57272    const PERCENT = 0x25,
57273      LT = 0x3c;
57274    function readToken(data, offset) {
57275      let token = "",
57276        ch = data[offset];
57277      while (ch !== LF && ch !== CR && ch !== LT) {
57278        if (++offset >= data.length) {
57279          break;
57280        }
57281        token += String.fromCharCode(ch);
57282        ch = data[offset];
57283      }
57284      return token;
57285    }
57286    function skipUntil(data, offset, what) {
57287      const length = what.length,
57288        dataLength = data.length;
57289      let skipped = 0;
57290      while (offset < dataLength) {
57291        let i = 0;
57292        while (i < length && data[offset + i] === what[i]) {
57293          ++i;
57294        }
57295        if (i >= length) {
57296          break;
57297        }
57298        offset++;
57299        skipped++;
57300      }
57301      return skipped;
57302    }
57303    const gEndobjRegExp = /\b(endobj|\d+\s+\d+\s+obj|xref|trailer\s*<<)\b/g;
57304    const gStartxrefRegExp = /\b(startxref|\d+\s+\d+\s+obj)\b/g;
57305    const objRegExp = /^(\d+)\s+(\d+)\s+obj\b/;
57306    const trailerBytes = new Uint8Array([116, 114, 97, 105, 108, 101, 114]);
57307    const startxrefBytes = new Uint8Array([115, 116, 97, 114, 116, 120, 114, 101, 102]);
57308    const xrefBytes = new Uint8Array([47, 88, 82, 101, 102]);
57309    this.entries.length = 0;
57310    this._cacheMap.clear();
57311    const stream = this.stream;
57312    stream.pos = 0;
57313    const buffer = stream.getBytes(),
57314      bufferStr = bytesToString(buffer),
57315      length = buffer.length;
57316    let position = stream.start;
57317    const trailers = [],
57318      xrefStms = [];
57319    while (position < length) {
57320      let ch = buffer[position];
57321      if (ch === TAB || ch === LF || ch === CR || ch === SPACE) {
57322        ++position;
57323        continue;
57324      }
57325      if (ch === PERCENT) {
57326        do {
57327          ++position;
57328          if (position >= length) {
57329            break;
57330          }
57331          ch = buffer[position];
57332        } while (ch !== LF && ch !== CR);
57333        continue;
57334      }
57335      const token = readToken(buffer, position);
57336      let m;
57337      if (token.startsWith("xref") && (token.length === 4 || /\s/.test(token[4]))) {
57338        position += skipUntil(buffer, position, trailerBytes);
57339        trailers.push(position);
57340        position += skipUntil(buffer, position, startxrefBytes);
57341      } else if (m = objRegExp.exec(token)) {
57342        const num = m[1] | 0,
57343          gen = m[2] | 0;
57344        const startPos = position + token.length;
57345        let contentLength,
57346          updateEntries = false;
57347        if (!this.entries[num]) {
57348          updateEntries = true;
57349        } else if (this.entries[num].gen === gen) {
57350          try {
57351            const parser = new Parser({
57352              lexer: new Lexer(stream.makeSubStream(startPos))
57353            });
57354            parser.getObj();
57355            updateEntries = true;
57356          } catch (ex) {
57357            if (ex instanceof ParserEOFException) {
57358              warn(`indexObjects -- checking object (${token}): "${ex}".`);
57359            } else {
57360              updateEntries = true;
57361            }
57362          }
57363        }
57364        if (updateEntries) {
57365          this.entries[num] = {
57366            offset: position - stream.start,
57367            gen,
57368            uncompressed: true
57369          };
57370        }
57371        gEndobjRegExp.lastIndex = startPos;
57372        const match = gEndobjRegExp.exec(bufferStr);
57373        if (match) {
57374          const endPos = gEndobjRegExp.lastIndex + 1;
57375          contentLength = endPos - position;
57376          if (match[1] !== "endobj") {
57377            warn(`indexObjects: Found "${match[1]}" inside of another "obj", ` + 'caused by missing "endobj" -- trying to recover.');
57378            contentLength -= match[1].length + 1;
57379          }
57380        } else {
57381          contentLength = length - position;
57382        }
57383        const content = buffer.subarray(position, position + contentLength);
57384        const xrefTagOffset = skipUntil(content, 0, xrefBytes);
57385        if (xrefTagOffset < contentLength && content[xrefTagOffset + 5] < 64) {
57386          xrefStms.push(position - stream.start);
57387          this._xrefStms.add(position - stream.start);
57388        }
57389        position += contentLength;
57390      } else if (token.startsWith("trailer") && (token.length === 7 || /\s/.test(token[7]))) {
57391        trailers.push(position);
57392        const startPos = position + token.length;
57393        let contentLength;
57394        gStartxrefRegExp.lastIndex = startPos;
57395        const match = gStartxrefRegExp.exec(bufferStr);
57396        if (match) {
57397          const endPos = gStartxrefRegExp.lastIndex + 1;
57398          contentLength = endPos - position;
57399          if (match[1] !== "startxref") {
57400            warn(`indexObjects: Found "${match[1]}" after "trailer", ` + 'caused by missing "startxref" -- trying to recover.');
57401            contentLength -= match[1].length + 1;
57402          }
57403        } else {
57404          contentLength = length - position;
57405        }
57406        position += contentLength;
57407      } else {
57408        position += token.length + 1;
57409      }
57410    }
57411    for (const xrefStm of xrefStms) {
57412      this.startXRefQueue.push(xrefStm);
57413      this.readXRef(true);
57414    }
57415    const trailerDicts = [];
57416    let isEncrypted = false;
57417    for (const trailer of trailers) {
57418      stream.pos = trailer;
57419      const parser = new Parser({
57420        lexer: new Lexer(stream),
57421        xref: this,
57422        allowStreams: true,
57423        recoveryMode: true
57424      });
57425      const obj = parser.getObj();
57426      if (!isCmd(obj, "trailer")) {
57427        continue;
57428      }
57429      const dict = parser.getObj();
57430      if (!(dict instanceof Dict)) {
57431        continue;
57432      }
57433      trailerDicts.push(dict);
57434      if (dict.has("Encrypt")) {
57435        isEncrypted = true;
57436      }
57437    }
57438    let trailerDict, trailerError;
57439    for (const dict of [...trailerDicts, "genFallback", ...trailerDicts]) {
57440      if (dict === "genFallback") {
57441        if (!trailerError) {
57442          break;
57443        }
57444        this._generationFallback = true;
57445        continue;
57446      }
57447      let validPagesDict = false;
57448      try {
57449        const rootDict = dict.get("Root");
57450        if (!(rootDict instanceof Dict)) {
57451          continue;
57452        }
57453        const pagesDict = rootDict.get("Pages");
57454        if (!(pagesDict instanceof Dict)) {
57455          continue;
57456        }
57457        const pagesCount = pagesDict.get("Count");
57458        if (Number.isInteger(pagesCount)) {
57459          validPagesDict = true;
57460        }
57461      } catch (ex) {
57462        trailerError = ex;
57463        continue;
57464      }
57465      if (validPagesDict && (!isEncrypted || dict.has("Encrypt")) && dict.has("ID")) {
57466        return dict;
57467      }
57468      trailerDict = dict;
57469    }
57470    if (trailerDict) {
57471      return trailerDict;
57472    }
57473    if (this.topDict) {
57474      return this.topDict;
57475    }
57476    if (!trailerDicts.length) {
57477      for (const num in this.entries) {
57478        
57478const entry = this.entries[num];
57479        if (!entry) {
57480          continue;
57481        }
57482        const ref = Ref.get(parseInt(num, 10
vendor: 8,212 bytes, lines 57482-57760
57482), entry.gen);
57483        let obj;
57484        try {
57485          obj = this.fetch(ref);
57486        } catch {
57487          continue;
57488        }
57489        if (obj instanceof BaseStream) {
57490          obj = obj.dict;
57491        }
57492        if (obj instanceof Dict && obj.has("Root")) {
57493          return obj;
57494        }
57495      }
57496    }
57497    throw new InvalidPDFException("Invalid PDF structure.");
57498  }
57499  readXRef(recoveryMode = false) {
57500    const stream = this.stream;
57501    const startXRefParsedCache = new Set();
57502    while (this.startXRefQueue.length) {
57503      try {
57504        const startXRef = this.startXRefQueue[0];
57505        if (startXRefParsedCache.has(startXRef)) {
57506          warn("readXRef - skipping XRef table since it was already parsed.");
57507          this.startXRefQueue.shift();
57508          continue;
57509        }
57510        startXRefParsedCache.add(startXRef);
57511        stream.pos = startXRef + stream.start;
57512        const parser = new Parser({
57513          lexer: new Lexer(stream),
57514          xref: this,
57515          allowStreams: true
57516        });
57517        let obj = parser.getObj();
57518        let dict;
57519        if (isCmd(obj, "xref")) {
57520          dict = this.processXRefTable(parser);
57521          if (!this.topDict) {
57522            this.topDict = dict;
57523          }
57524          obj = dict.get("XRefStm");
57525          if (Number.isInteger(obj) && !this._xrefStms.has(obj)) {
57526            this._xrefStms.add(obj);
57527            this.startXRefQueue.push(obj);
57528          }
57529        } else if (Number.isInteger(obj)) {
57530          if (!Number.isInteger(parser.getObj()) || !isCmd(parser.getObj(), "obj") || !((obj = parser.getObj()) instanceof BaseStream)) {
57531            throw new FormatError("Invalid XRef stream");
57532          }
57533          dict = this.processXRefStream(obj);
57534          if (!this.topDict) {
57535            this.topDict = dict;
57536          }
57537          if (!dict) {
57538            throw new FormatError("Failed to read XRef stream");
57539          }
57540        } else {
57541          throw new FormatError("Invalid XRef stream header");
57542        }
57543        obj = dict.get("Prev");
57544        if (Number.isInteger(obj)) {
57545          this.startXRefQueue.push(obj);
57546        } else if (obj instanceof Ref) {
57547          this.startXRefQueue.push(obj.num);
57548        }
57549      } catch (e) {
57550        if (e instanceof MissingDataException) {
57551          throw e;
57552        }
57553        info("(while reading XRef): " + e);
57554      }
57555      this.startXRefQueue.shift();
57556    }
57557    if (this.topDict) {
57558      return this.topDict;
57559    }
57560    if (recoveryMode) {
57561      return undefined;
57562    }
57563    throw new XRefParseException();
57564  }
57565  getEntry(i) {
57566    const xrefEntry = this.entries[i];
57567    if (xrefEntry && !xrefEntry.free && xrefEntry.offset) {
57568      return xrefEntry;
57569    }
57570    return null;
57571  }
57572  fetchIfRef(obj, suppressEncryption = false) {
57573    if (obj instanceof Ref) {
57574      return this.fetch(obj, suppressEncryption);
57575    }
57576    return obj;
57577  }
57578  fetch(ref, suppressEncryption = false) {
57579    if (!(ref instanceof Ref)) {
57580      throw new Error("ref object is not a reference");
57581    }
57582    const num = ref.num;
57583    const cacheEntry = this._cacheMap.get(num);
57584    if (cacheEntry !== undefined) {
57585      if (cacheEntry instanceof Dict && !cacheEntry.objId) {
57586        cacheEntry.objId = ref.toString();
57587      }
57588      return cacheEntry;
57589    }
57590    let xrefEntry = this.getEntry(num);
57591    if (xrefEntry === null) {
57592      return xrefEntry;
57593    }
57594    if (this._pendingRefs.has(ref)) {
57595      this._pendingRefs.remove(ref);
57596      warn(`Ignoring circular reference: ${ref}.`);
57597      return CIRCULAR_REF;
57598    }
57599    this._pendingRefs.put(ref);
57600    try {
57601      xrefEntry = xrefEntry.uncompressed ? this.fetchUncompressed(ref, xrefEntry, suppressEncryption) : this.fetchCompressed(ref, xrefEntry, suppressEncryption);
57602      this._pendingRefs.remove(ref);
57603    } catch (ex) {
57604      this._pendingRefs.remove(ref);
57605      throw ex;
57606    }
57607    if (xrefEntry instanceof Dict) {
57608      xrefEntry.objId = ref.toString();
57609    } else if (xrefEntry instanceof BaseStream) {
57610      xrefEntry.dict.objId = ref.toString();
57611    }
57612    return xrefEntry;
57613  }
57614  fetchUncompressed(ref, xrefEntry, suppressEncryption = false) {
57615    const gen = ref.gen;
57616    let num = ref.num;
57617    if (xrefEntry.gen !== gen) {
57618      const msg = `Inconsistent generation in XRef: ${ref}`;
57619      if (this._generationFallback && xrefEntry.gen < gen) {
57620        warn(msg);
57621        return this.fetchUncompressed(Ref.get(num, xrefEntry.gen), xrefEntry, suppressEncryption);
57622      }
57623      throw new XRefEntryException(msg);
57624    }
57625    const stream = this.stream.makeSubStream(xrefEntry.offset + this.stream.start);
57626    const parser = new Parser({
57627      lexer: new Lexer(stream),
57628      xref: this,
57629      allowStreams: true
57630    });
57631    const obj1 = parser.getObj();
57632    const obj2 = parser.getObj();
57633    const obj3 = parser.getObj();
57634    if (obj1 !== num || obj2 !== gen || !(obj3 instanceof Cmd)) {
57635      throw new XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);
57636    }
57637    if (obj3.cmd !== "obj") {
57638      if (obj3.cmd.startsWith("obj")) {
57639        num = parseInt(obj3.cmd.substring(3), 10);
57640        if (!Number.isNaN(num)) {
57641          return num;
57642        }
57643      }
57644      throw new XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);
57645    }
57646    xrefEntry = this.encrypt && !suppressEncryption ? parser.getObj(this.encrypt.createCipherTransform(num, gen)) : parser.getObj();
57647    if (!(xrefEntry instanceof BaseStream)) {
57648      this._cacheMap.set(num, xrefEntry);
57649    }
57650    return xrefEntry;
57651  }
57652  fetchCompressed(ref, xrefEntry, suppressEncryption = false) {
57653    const tableOffset = xrefEntry.offset;
57654    const stream = this.fetch(Ref.get(tableOffset, 0));
57655    if (!(stream instanceof BaseStream)) {
57656      throw new FormatError("bad ObjStm stream");
57657    }
57658    const first = stream.dict.get("First");
57659    const n = stream.dict.get("N");
57660    if (!Number.isInteger(first) || !Number.isInteger(n)) {
57661      throw new FormatError("invalid first and n parameters for ObjStm stream");
57662    }
57663    let parser = new Parser({
57664      lexer: new Lexer(stream),
57665      xref: this,
57666      allowStreams: true
57667    });
57668    const nums = new Array(n);
57669    const offsets = new Array(n);
57670    for (let i = 0; i < n; ++i) {
57671      const num = parser.getObj();
57672      if (!Number.isInteger(num)) {
57673        throw new FormatError(`invalid object number in the ObjStm stream: ${num}`);
57674      }
57675      const offset = parser.getObj();
57676      if (!Number.isInteger(offset)) {
57677        throw new FormatError(`invalid object offset in the ObjStm stream: ${offset}`);
57678      }
57679      nums[i] = num;
57680      const entry = this.getEntry(num);
57681      if (entry?.offset === tableOffset && entry.gen !== i) {
57682        entry.gen = i;
57683      }
57684      offsets[i] = offset;
57685    }
57686    const start = (stream.start || 0) + first;
57687    const entries = new Array(n);
57688    for (let i = 0; i < n; ++i) {
57689      const length = i < n - 1 ? offsets[i + 1] - offsets[i] : undefined;
57690      if (length < 0) {
57691        throw new FormatError("Invalid offset in the ObjStm stream.");
57692      }
57693      parser = new Parser({
57694        lexer: new Lexer(stream.makeSubStream(start + offsets[i], length, stream.dict)),
57695        xref: this,
57696        allowStreams: true
57697      });
57698      const obj = parser.getObj();
57699      entries[i] = obj;
57700      if (obj instanceof BaseStream) {
57701        continue;
57702      }
57703      const num = nums[i],
57704        entry = this.entries[num];
57705      if (entry && entry.offset === tableOffset && entry.gen === i) {
57706        this._cacheMap.set(num, obj);
57707      }
57708    }
57709    xrefEntry = entries[xrefEntry.gen];
57710    if (xrefEntry === undefined) {
57711      throw new XRefEntryException(`Bad (compressed) XRef entry: ${ref}`);
57712    }
57713    return xrefEntry;
57714  }
57715  async fetchIfRefAsync(obj, suppressEncryption) {
57716    if (obj instanceof Ref) {
57717      return this.fetchAsync(obj, suppressEncryption);
57718    }
57719    return obj;
57720  }
57721  async fetchAsync(ref, suppressEncryption) {
57722    try {
57723      return this.fetch(ref, suppressEncryption);
57724    } catch (ex) {
57725      if (!(ex instanceof MissingDataException)) {
57726        throw ex;
57727      }
57728      await this.pdfManager.requestRange(ex.begin, ex.end);
57729      return this.fetchAsync(ref, suppressEncryption);
57730    }
57731  }
57732  getCatalogObj() {
57733    return this.root;
57734  }
57735}
57736
57737;// ./src/core/document.js
57738
57739
57740
57741
57742
57743
57744
57745
57746
57747
57748
57749
57750
57751
57752
57753
57754
57755
57756
57757
57758
57759
57760
vendor: 11,390 bytes, lines 57761-58094
57761const LETTER_SIZE_MEDIABOX = [0, 0, 612, 792];
57762class Page {
57763  #resourcesPromise = null;
57764  constructor({
57765    pdfManager,
57766    xref,
57767    pageIndex,
57768    pageDict,
57769    ref,
57770    globalIdFactory,
57771    fontCache,
57772    builtInCMapCache,
57773    standardFontDataCache,
57774    globalColorSpaceCache,
57775    globalImageCache,
57776    systemFontCache,
57777    nonBlendModesSet,
57778    xfaFactory
57779  }) {
57780    this.pdfManager = pdfManager;
57781    this.pageIndex = pageIndex;
57782    this.pageDict = pageDict;
57783    this.xref = xref;
57784    this.ref = ref;
57785    this.fontCache = fontCache;
57786    this.builtInCMapCache = builtInCMapCache;
57787    this.standardFontDataCache = standardFontDataCache;
57788    this.globalColorSpaceCache = globalColorSpaceCache;
57789    this.globalImageCache = globalImageCache;
57790    this.systemFontCache = systemFontCache;
57791    this.nonBlendModesSet = nonBlendModesSet;
57792    this.evaluatorOptions = pdfManager.evaluatorOptions;
57793    this.xfaFactory = xfaFactory;
57794    const idCounters = {
57795      obj: 0
57796    };
57797    this._localIdFactory = class extends globalIdFactory {
57798      static createObjId() {
57799        return `p${pageIndex}_${++idCounters.obj}`;
57800      }
57801      static getPageObjId() {
57802        return `p${ref.toString()}`;
57803      }
57804    };
57805  }
57806  #createPartialEvaluator(handler, pageIndex = this.pageIndex) {
57807    return new PartialEvaluator({
57808      xref: this.xref,
57809      handler,
57810      pageIndex,
57811      idFactory: this._localIdFactory,
57812      fontCache: this.fontCache,
57813      builtInCMapCache: this.builtInCMapCache,
57814      standardFontDataCache: this.standardFontDataCache,
57815      globalColorSpaceCache: this.globalColorSpaceCache,
57816      globalImageCache: this.globalImageCache,
57817      systemFontCache: this.systemFontCache,
57818      options: this.evaluatorOptions
57819    });
57820  }
57821  createAnnotationEvaluator(handler) {
57822    return this.#createPartialEvaluator(handler);
57823  }
57824  #getInheritableProperty(key, getArray = false) {
57825    const value = getInheritableProperty({
57826      dict: this.pageDict,
57827      key,
57828      getArray,
57829      stopWhenFound: false
57830    });
57831    if (!Array.isArray(value)) {
57832      return value;
57833    }
57834    if (value.length === 1 || !(value[0] instanceof Dict)) {
57835      return value[0];
57836    }
57837    return Dict.merge({
57838      xref: this.xref,
57839      dictArray: value
57840    });
57841  }
57842  get content() {
57843    return this.pageDict.getArray("Contents");
57844  }
57845  get resources() {
57846    const resources = this.#getInheritableProperty("Resources");
57847    return shadow(this, "resources", resources instanceof Dict ? resources : Dict.empty);
57848  }
57849  getBoundingBox(name) {
57850    if (this.xfaData) {
57851      return this.xfaData.bbox;
57852    }
57853    const box = lookupNormalRect(this.#getInheritableProperty(name, true), null);
57854    if (box) {
57855      if (box[2] - box[0] > 0 && box[3] - box[1] > 0) {
57856        return box;
57857      }
57858      warn(`Empty, or invalid, /${name} entry.`);
57859    }
57860    return null;
57861  }
57862  get mediaBox() {
57863    return shadow(this, "mediaBox", this.getBoundingBox("MediaBox") || LETTER_SIZE_MEDIABOX);
57864  }
57865  get cropBox() {
57866    return shadow(this, "cropBox", this.getBoundingBox("CropBox") || this.mediaBox);
57867  }
57868  get userUnit() {
57869    const obj = this.pageDict.get("UserUnit");
57870    return shadow(this, "userUnit", typeof obj === "number" && obj > 0 ? obj : 1.0);
57871  }
57872  get view() {
57873    const {
57874      cropBox,
57875      mediaBox
57876    } = this;
57877    if (cropBox !== mediaBox && !isArrayEqual(cropBox, mediaBox)) {
57878      const box = Util.intersect(cropBox, mediaBox);
57879      if (box && box[2] - box[0] > 0 && box[3] - box[1] > 0) {
57880        return shadow(this, "view", box);
57881      }
57882      warn("Empty /CropBox and /MediaBox intersection.");
57883    }
57884    return shadow(this, "view", mediaBox);
57885  }
57886  get rotate() {
57887    let rotate = this.#getInheritableProperty("Rotate") || 0;
57888    if (rotate % 90 !== 0) {
57889      rotate = 0;
57890    } else if (rotate >= 360) {
57891      rotate %= 360;
57892    } else if (rotate < 0) {
57893      rotate = (rotate % 360 + 360) % 360;
57894    }
57895    return shadow(this, "rotate", rotate);
57896  }
57897  #onSubStreamError(reason, objId) {
57898    if (this.evaluatorOptions.ignoreErrors) {
57899      warn(`getContentStream - ignoring sub-stream (${objId}): "${reason}".`);
57900      return;
57901    }
57902    throw reason;
57903  }
57904  async getContentStream() {
57905    const content = await this.pdfManager.ensure(this, "content");
57906    if (content instanceof BaseStream && !content.isImageStream) {
57907      if (content.isAsync) {
57908        const bytes = await content.asyncGetBytes();
57909        if (bytes) {
57910          return new Stream(bytes, 0, bytes.length, content.dict);
57911        }
57912      }
57913      return content;
57914    }
57915    if (Array.isArray(content)) {
57916      const promises = [];
57917      for (let i = 0, ii = content.length; i < ii; i++) {
57918        const item = content[i];
57919        if (item instanceof BaseStream && item.isAsync) {
57920          promises.push(item.asyncGetBytes().then(bytes => {
57921            if (bytes) {
57922              content[i] = new Stream(bytes, 0, bytes.length, item.dict);
57923            }
57924          }));
57925        }
57926      }
57927      if (promises.length > 0) {
57928        await Promise.all(promises);
57929      }
57930      return new StreamsSequenceStream(content, this.#onSubStreamError.bind(this));
57931    }
57932    return new NullStream();
57933  }
57934  get xfaData() {
57935    return shadow(this, "xfaData", this.xfaFactory ? {
57936      bbox: this.xfaFactory.getBoundingBox(this.pageIndex)
57937    } : null);
57938  }
57939  async #replaceIdByRef(annotations, deletedAnnotations, existingAnnotations) {
57940    const promises = [];
57941    for (const annotation of annotations) {
57942      if (annotation.id) {
57943        const ref = Ref.fromString(annotation.id);
57944        if (!ref) {
57945          warn(`A non-linked annotation cannot be modified: ${annotation.id}`);
57946          continue;
57947        }
57948        if (annotation.deleted) {
57949          deletedAnnotations.put(ref, ref);
57950          if (annotation.popupRef) {
57951            const popupRef = Ref.fromString(annotation.popupRef);
57952            if (popupRef) {
57953              deletedAnnotations.put(popupRef, popupRef);
57954            }
57955          }
57956          continue;
57957        }
57958        if (annotation.popup?.deleted) {
57959          const popupRef = Ref.fromString(annotation.popupRef);
57960          if (popupRef) {
57961            deletedAnnotations.put(popupRef, popupRef);
57962          }
57963        }
57964        existingAnnotations?.put(ref);
57965        annotation.ref = ref;
57966        promises.push(this.xref.fetchAsync(ref).then(obj => {
57967          if (obj instanceof Dict) {
57968            annotation.oldAnnotation = obj.clone();
57969          }
57970        }, () => {
57971          warn(`Cannot fetch \`oldAnnotation\` for: ${ref}.`);
57972        }));
57973        delete annotation.id;
57974      }
57975    }
57976    await Promise.all(promises);
57977  }
57978  async saveNewAnnotations(handler, task, annotations, imagePromises, changes) {
57979    if (this.xfaFactory) {
57980      throw new Error("XFA: Cannot save new annotations.");
57981    }
57982    const partialEvaluator = this.#createPartialEvaluator(handler);
57983    const deletedAnnotations = new RefSetCache();
57984    const existingAnnotations = new RefSet();
57985    await this.#replaceIdByRef(annotations, deletedAnnotations, existingAnnotations);
57986    const pageDict = this.pageDict;
57987    const annotationsArray = this.annotations.filter(a => !(a instanceof Ref && deletedAnnotations.has(a)));
57988    const newData = await AnnotationFactory.saveNewAnnotations(partialEvaluator, this.xref, task, annotations, imagePromises, changes);
57989    for (const {
57990      ref
57991    } of newData.annotations) {
57992      if (ref instanceof Ref && !existingAnnotations.has(ref)) {
57993        annotationsArray.push(ref);
57994      }
57995    }
57996    const dict = pageDict.clone();
57997    dict.set("Annots", annotationsArray);
57998    changes.put(this.ref, {
57999      data: dict
58000    });
58001    for (const deletedRef of deletedAnnotations) {
58002      changes.put(deletedRef, {
58003        data: null
58004      });
58005    }
58006  }
58007  async save(handler, task, annotationStorage, changes) {
58008    const partialEvaluator = this.#createPartialEvaluator(handler);
58009    const annotations = await this._parsedAnnotations;
58010    const promises = [];
58011    for (const annotation of annotations) {
58012      promises.push(annotation.save(partialEvaluator, task, annotationStorage, changes).catch(function (reason) {
58013        warn("save - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
58014        return null;
58015      }));
58016    }
58017    return Promise.all(promises);
58018  }
58019  async loadResources(keys) {
58020    await (this.#resourcesPromise ??= this.pdfManager.ensure(this, "resources"));
58021    await ObjectLoader.load(this.resources, keys, this.xref);
58022  }
58023  async #getMergedResources(streamDict, keys) {
58024    const localResources = streamDict?.get("Resources");
58025    if (!(localResources instanceof Dict && localResources.size)) {
58026      return this.resources;
58027    }
58028    await ObjectLoader.load(localResources, keys, this.xref);
58029    return Dict.merge({
58030      xref: this.xref,
58031      dictArray: [localResources, this.resources],
58032      mergeSubDicts: true
58033    });
58034  }
58035  async getOperatorList({
58036    handler,
58037    sink,
58038    task,
58039    intent,
58040    cacheKey,
58041    pageIndex = this.pageIndex,
58042    annotationStorage = null,
58043    modifiedIds = null
58044  }) {
58045    const contentStreamPromise = this.getContentStream();
58046    const resourcesPromise = this.loadResources(RESOURCES_KEYS_OPERATOR_LIST);
58047    const partialEvaluator = this.#createPartialEvaluator(handler, pageIndex);
58048    const newAnnotsByPage = !this.xfaFactory ? getNewAnnotationsMap(annotationStorage) : null;
58049    const newAnnots = newAnnotsByPage?.get(this.pageIndex);
58050    let newAnnotationsPromise = Promise.resolve(null);
58051    let deletedAnnotations = null;
58052    if (newAnnots) {
58053      const annotationGlobalsPromise = this.pdfManager.ensureDoc("annotationGlobals");
58054      let imagePromises;
58055      const missingBitmaps = new Set();
58056      for (const {
58057        bitmapId,
58058        bitmap
58059      } of newAnnots) {
58060        if (bitmapId && !bitmap && !missingBitmaps.has(bitmapId)) {
58061          missingBitmaps.add(bitmapId);
58062        }
58063      }
58064      const {
58065        isOffscreenCanvasSupported
58066      } = this.evaluatorOptions;
58067      if (missingBitmaps.size > 0) {
58068        const annotationWithBitmaps = newAnnots.slice();
58069        for (const [key, annotation] of annotationStorage) {
58070          if (!key.startsWith(AnnotationEditorPrefix)) {
58071            continue;
58072          }
58073          if (annotation.bitmap && missingBitmaps.has(annotation.bitmapId)) {
58074            annotationWithBitmaps.push(annotation);
58075          }
58076        }
58077        imagePromises = AnnotationFactory.generateImages(annotationWithBitmaps, this.xref, isOffscreenCanvasSupported);
58078      } else {
58079        imagePromises = AnnotationFactory.generateImages(newAnnots, this.xref, isOffscreenCanvasSupported);
58080      }
58081      deletedAnnotations = new RefSet();
58082      newAnnotationsPromise = Promise.all([annotationGlobalsPromise, this.#replaceIdByRef(newAnnots, deletedAnnotations, null)]).then(([annotationGlobals]) => {
58083        if (!annotationGlobals) {
58084          return null;
58085        }
58086        return AnnotationFactory.printNewAnnotations(annotationGlobals, partialEvaluator, task, newAnnots, imagePromises);
58087      });
58088    }
58089    const pageListPromise = Promise.all([contentStreamPromise, resourcesPromise]).then(async ([contentStream]) => {
58090      const resources = await this.#getMergedResources(contentStream.dict, RESOURCES_KEYS_OPERATOR_LIST);
58091      const opList = new OperatorList(intent, sink);
58092      handler.send("StartRenderPage", {
58093        transparency: partialEvaluator.hasBlendModes(resources, this.nonBlendModesSet),
58094        
vendor: 7,574 bytes, lines 58094-58300
58094pageIndex,
58095        cacheKey
58096      });
58097      await partialEvaluator.getOperatorList({
58098        stream: contentStream,
58099        task,
58100        resources,
58101        operatorList: opList
58102      });
58103      return opList;
58104    });
58105    let [pageOpList, annotations, newAnnotations] = await Promise.all([pageListPromise, this._parsedAnnotations, newAnnotationsPromise]);
58106    if (newAnnotations) {
58107      annotations = annotations.filter(a => !(a.ref && deletedAnnotations.has(a.ref)));
58108      for (let i = 0, ii = newAnnotations.length; i < ii; i++) {
58109        const newAnnotation = newAnnotations[i];
58110        if (newAnnotation.refToReplace) {
58111          const j = annotations.findIndex(a => a.ref && isRefsEqual(a.ref, newAnnotation.refToReplace));
58112          if (j >= 0) {
58113            annotations.splice(j, 1, newAnnotation);
58114            newAnnotations.splice(i--, 1);
58115            ii--;
58116          }
58117        }
58118      }
58119      annotations = annotations.concat(newAnnotations);
58120    }
58121    if (annotations.length === 0 || intent & RenderingIntentFlag.ANNOTATIONS_DISABLE) {
58122      pageOpList.flush(true);
58123      return {
58124        length: pageOpList.totalLength
58125      };
58126    }
58127    const renderForms = !!(intent & RenderingIntentFlag.ANNOTATIONS_FORMS),
58128      isEditing = !!(intent & RenderingIntentFlag.IS_EDITING),
58129      intentAny = !!(intent & RenderingIntentFlag.ANY),
58130      intentDisplay = !!(intent & RenderingIntentFlag.DISPLAY),
58131      intentPrint = !!(intent & RenderingIntentFlag.PRINT);
58132    const opListPromises = [];
58133    for (const annotation of annotations) {
58134      if (intentAny || intentDisplay && annotation.mustBeViewed(annotationStorage, renderForms) && annotation.mustBeViewedWhenEditing(isEditing, modifiedIds) || intentPrint && annotation.mustBePrinted(annotationStorage)) {
58135        opListPromises.push(annotation.getOperatorList(partialEvaluator, task, intent, annotationStorage).catch(function (reason) {
58136          warn("getOperatorList - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
58137          return {
58138            opList: null,
58139            separateForm: false,
58140            separateCanvas: false
58141          };
58142        }));
58143      }
58144    }
58145    const opLists = await Promise.all(opListPromises);
58146    let form = false,
58147      canvas = false;
58148    for (const {
58149      opList,
58150      separateForm,
58151      separateCanvas
58152    } of opLists) {
58153      pageOpList.addOpList(opList);
58154      form ||= separateForm;
58155      canvas ||= separateCanvas;
58156    }
58157    pageOpList.flush(true, {
58158      form,
58159      canvas
58160    });
58161    return {
58162      length: pageOpList.totalLength
58163    };
58164  }
58165  async extractTextContent({
58166    handler,
58167    task,
58168    includeMarkedContent,
58169    disableNormalization,
58170    sink,
58171    intersector = null
58172  }) {
58173    const contentStreamPromise = this.getContentStream();
58174    const resourcesPromise = this.loadResources(RESOURCES_KEYS_TEXT_CONTENT);
58175    const langPromise = this.pdfManager.ensureCatalog("lang");
58176    const [contentStream,, lang] = await Promise.all([contentStreamPromise, resourcesPromise, langPromise]);
58177    const resources = await this.#getMergedResources(contentStream.dict, RESOURCES_KEYS_TEXT_CONTENT);
58178    const partialEvaluator = this.#createPartialEvaluator(handler);
58179    return partialEvaluator.getTextContent({
58180      stream: contentStream,
58181      task,
58182      resources,
58183      includeMarkedContent,
58184      disableNormalization,
58185      sink,
58186      viewBox: this.view,
58187      lang,
58188      intersector
58189    });
58190  }
58191  async getStructTree() {
58192    const structTreeRoot = await this.pdfManager.ensureCatalog("structTreeRoot");
58193    if (!structTreeRoot) {
58194      return null;
58195    }
58196    await this._parsedAnnotations;
58197    try {
58198      const structTree = await this.pdfManager.ensure(this, "_parseStructTree", [structTreeRoot]);
58199      const data = await this.pdfManager.ensure(structTree, "serializable");
58200      return data;
58201    } catch (ex) {
58202      warn(`getStructTree: "${ex}".`);
58203      return null;
58204    }
58205  }
58206  _parseStructTree(structTreeRoot) {
58207    const tree = new StructTreePage(structTreeRoot, this.pageDict);
58208    tree.parse(this.ref);
58209    return tree;
58210  }
58211  async getAnnotationsData(handler, task, intent) {
58212    const annotations = await this._parsedAnnotations;
58213    if (annotations.length === 0) {
58214      return annotations;
58215    }
58216    const annotationsData = [],
58217      textContentPromises = [];
58218    let partialEvaluator;
58219    const intentAny = !!(intent & RenderingIntentFlag.ANY),
58220      intentDisplay = !!(intent & RenderingIntentFlag.DISPLAY),
58221      intentPrint = !!(intent & RenderingIntentFlag.PRINT);
58222    const highlightedAnnotations = [];
58223    for (const annotation of annotations) {
58224      const isVisible = intentAny || intentDisplay && annotation.viewable;
58225      if (isVisible || intentPrint && annotation.printable) {
58226        annotationsData.push(annotation.data);
58227      }
58228      if (annotation.hasTextContent && isVisible) {
58229        partialEvaluator ??= this.#createPartialEvaluator(handler);
58230        textContentPromises.push(annotation.extractTextContent(partialEvaluator, task, [-Infinity, -Infinity, Infinity, Infinity]).catch(function (reason) {
58231          warn(`getAnnotationsData - ignoring textContent during "${task.name}" task: "${reason}".`);
58232        }));
58233      } else if (annotation.overlaysTextContent && isVisible) {
58234        highlightedAnnotations.push(annotation);
58235      }
58236    }
58237    if (highlightedAnnotations.length > 0) {
58238      const intersector = new Intersector(highlightedAnnotations);
58239      textContentPromises.push(this.extractTextContent({
58240        handler,
58241        task,
58242        includeMarkedContent: false,
58243        disableNormalization: false,
58244        sink: null,
58245        viewBox: this.view,
58246        lang: null,
58247        intersector
58248      }).then(() => {
58249        intersector.setText();
58250      }));
58251    }
58252    await Promise.all(textContentPromises);
58253    return annotationsData;
58254  }
58255  get annotations() {
58256    const annots = this.#getInheritableProperty("Annots");
58257    return shadow(this, "annotations", Array.isArray(annots) ? annots : []);
58258  }
58259  get _parsedAnnotations() {
58260    const promise = this.pdfManager.ensure(this, "annotations").then(async annots => {
58261      if (annots.length === 0) {
58262        return annots;
58263      }
58264      const [annotationGlobals, fieldObjects] = await Promise.all([this.pdfManager.ensureDoc("annotationGlobals"), this.pdfManager.ensureDoc("fieldObjects")]);
58265      if (!annotationGlobals) {
58266        return [];
58267      }
58268      const orphanFields = fieldObjects?.orphanFields;
58269      const annotationPromises = [];
58270      for (const annotationRef of annots) {
58271        annotationPromises.push(AnnotationFactory.create(this.xref, annotationRef, annotationGlobals, this._localIdFactory, false, orphanFields, null, this.ref).catch(function (reason) {
58272          warn(`_parsedAnnotations: "${reason}".`);
58273          return null;
58274        }));
58275      }
58276      const sortedAnnotations = [];
58277      let popupAnnotations, widgetAnnotations;
58278      for (const annotation of await Promise.all(annotationPromises)) {
58279        if (!annotation) {
58280          continue;
58281        }
58282        if (annotation instanceof WidgetAnnotation) {
58283          (widgetAnnotations ||= []).push(annotation);
58284          continue;
58285        }
58286        if (annotation instanceof PopupAnnotation) {
58287          (popupAnnotations ||= []).push(annotation);
58288          continue;
58289        }
58290        sortedAnnotations.push(annotation);
58291      }
58292      if (widgetAnnotations) {
58293        sortedAnnotations.push(...widgetAnnotations);
58294      }
58295      if (popupAnnotations) {
58296        sortedAnnotations.push(...popupAnnotations);
58297      }
58298      return sortedAnnotations;
58299    });
58300    
vendor: 2,744 bytes, lines 58300-58380
58300return shadow(this, "_parsedAnnotations", promise);
58301  }
58302  get jsActions() {
58303    const actions = collectActions(this.xref, this.pageDict, PageActionEventType);
58304    return shadow(this, "jsActions", actions);
58305  }
58306  async collectAnnotationsByType(handler, task, types, promises, annotationGlobals) {
58307    const {
58308      pageIndex
58309    } = this;
58310    if (Object.hasOwn(this, "_parsedAnnotations")) {
58311      const cachedAnnotations = await this._parsedAnnotations;
58312      for (const {
58313        data
58314      } of cachedAnnotations) {
58315        if (!types || types.has(data.annotationType)) {
58316          data.pageIndex = pageIndex;
58317          promises.push(Promise.resolve(data));
58318        }
58319      }
58320      return;
58321    }
58322    const annots = await this.pdfManager.ensure(this, "annotations");
58323    let partialEvaluator;
58324    for (const annotationRef of annots) {
58325      promises.push(AnnotationFactory.create(this.xref, annotationRef, annotationGlobals, this._localIdFactory, false, null, types, this.ref).then(async annotation => {
58326        if (!annotation) {
58327          return null;
58328        }
58329        annotation.data.pageIndex = pageIndex;
58330        if (annotation.hasTextContent && annotation.viewable) {
58331          partialEvaluator ??= this.#createPartialEvaluator(handler);
58332          await annotation.extractTextContent(partialEvaluator, task, [-Infinity, -Infinity, Infinity, Infinity]);
58333        }
58334        return annotation.data;
58335      }).catch(function (reason) {
58336        warn(`collectAnnotationsByType: "${reason}".`);
58337        return null;
58338      }));
58339    }
58340  }
58341}
58342const PDF_HEADER_SIGNATURE = new Uint8Array([0x25, 0x50, 0x44, 0x46, 0x2d]);
58343const STARTXREF_SIGNATURE = new Uint8Array([0x73, 0x74, 0x61, 0x72, 0x74, 0x78, 0x72, 0x65, 0x66]);
58344const ENDOBJ_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64, 0x6f, 0x62, 0x6a]);
58345function find(stream, signature, limit = 1024, backwards = false) {
58346  const signatureLength = signature.length;
58347  const scanBytes = stream.peekBytes(limit);
58348  const scanLength = scanBytes.length - signatureLength;
58349  if (scanLength <= 0) {
58350    return false;
58351  }
58352  if (backwards) {
58353    const signatureEnd = signatureLength - 1;
58354    let pos = scanBytes.length - 1;
58355    while (pos >= signatureEnd) {
58356      let j = 0;
58357      while (j < signatureLength && scanBytes[pos - j] === signature[signatureEnd - j]) {
58358        j++;
58359      }
58360      if (j >= signatureLength) {
58361        stream.pos += pos - signatureEnd;
58362        return true;
58363      }
58364      pos--;
58365    }
58366  } else {
58367    let pos = 0;
58368    while (pos <= scanLength) {
58369      let j = 0;
58370      while (j < signatureLength && scanBytes[pos + j] === signature[j]) {
58371        j++;
58372      }
58373      if (j >= signatureLength) {
58374        stream.pos += pos;
58375        return true;
58376      }
58377      pos++;
58378    }
58379  }
58380  return false;
vendor: 8,602 bytes, lines 58381-58684
58381}
58382class PDFDocument {
58383  #pagePromises = new Map();
58384  #version = null;
58385  constructor(pdfManager, stream) {
58386    if (stream.length <= 0) {
58387      throw new InvalidPDFException("The PDF file is empty, i.e. its size is zero bytes.");
58388    }
58389    this.pdfManager = pdfManager;
58390    this.stream = stream;
58391    this.xref = new XRef(stream, pdfManager);
58392    const idCounters = {
58393      font: 0
58394    };
58395    this._globalIdFactory = class {
58396      static getDocId() {
58397        return `g_${pdfManager.docId}`;
58398      }
58399      static createFontId() {
58400        return `f${++idCounters.font}`;
58401      }
58402      static createObjId() {
58403        unreachable("Abstract method `createObjId` called.");
58404      }
58405      static getPageObjId() {
58406        unreachable("Abstract method `getPageObjId` called.");
58407      }
58408    };
58409  }
58410  parse(recoveryMode) {
58411    this.xref.parse(recoveryMode);
58412    this.catalog = new Catalog(this.pdfManager, this.xref);
58413  }
58414  get linearization() {
58415    let linearization = null;
58416    try {
58417      linearization = Linearization.create(this.stream);
58418    } catch (err) {
58419      if (err instanceof MissingDataException) {
58420        throw err;
58421      }
58422      info(err);
58423    }
58424    return shadow(this, "linearization", linearization);
58425  }
58426  get startXRef() {
58427    const stream = this.stream;
58428    let startXRef = 0;
58429    if (this.linearization) {
58430      stream.reset();
58431      if (find(stream, ENDOBJ_SIGNATURE)) {
58432        stream.skip(6);
58433        let ch = stream.peekByte();
58434        while (isWhiteSpace(ch)) {
58435          stream.pos++;
58436          ch = stream.peekByte();
58437        }
58438        startXRef = stream.pos - stream.start;
58439      }
58440    } else {
58441      const step = 1024;
58442      const startXRefLength = STARTXREF_SIGNATURE.length;
58443      let found = false,
58444        pos = stream.end;
58445      while (!found && pos > 0) {
58446        pos -= step - startXRefLength;
58447        if (pos < 0) {
58448          pos = 0;
58449        }
58450        stream.pos = pos;
58451        found = find(stream, STARTXREF_SIGNATURE, step, true);
58452      }
58453      if (found) {
58454        stream.skip(9);
58455        let ch;
58456        do {
58457          ch = stream.getByte();
58458        } while (isWhiteSpace(ch));
58459        let str = "";
58460        while (ch >= 0x20 && ch <= 0x39) {
58461          str += String.fromCharCode(ch);
58462          ch = stream.getByte();
58463        }
58464        startXRef = parseInt(str, 10);
58465        if (isNaN(startXRef)) {
58466          startXRef = 0;
58467        }
58468      }
58469    }
58470    return shadow(this, "startXRef", startXRef);
58471  }
58472  checkHeader() {
58473    const stream = this.stream;
58474    stream.reset();
58475    if (!find(stream, PDF_HEADER_SIGNATURE)) {
58476      return;
58477    }
58478    stream.moveStart();
58479    stream.skip(PDF_HEADER_SIGNATURE.length);
58480    let version = "",
58481      ch;
58482    while ((ch = stream.getByte()) > 0x20 && version.length < 7) {
58483      version += String.fromCharCode(ch);
58484    }
58485    if (PDF_VERSION_REGEXP.test(version)) {
58486      this.#version = version;
58487    } else {
58488      warn(`Invalid PDF header version: ${version}`);
58489    }
58490  }
58491  parseStartXRef() {
58492    this.xref.setStartXRef(this.startXRef);
58493  }
58494  get numPages() {
58495    let num = 0;
58496    if (this.catalog.hasActualNumPages) {
58497      num = this.catalog.numPages;
58498    } else if (this.xfaFactory) {
58499      num = this.xfaFactory.getNumPages();
58500    } else if (this.linearization) {
58501      num = this.linearization.numPages;
58502    } else {
58503      num = this.catalog.numPages;
58504    }
58505    return shadow(this, "numPages", num);
58506  }
58507  #hasOnlyDocumentSignatures(fields, recursionDepth = 0) {
58508    const RECURSION_LIMIT = 10;
58509    if (!Array.isArray(fields)) {
58510      return false;
58511    }
58512    return fields.every(field => {
58513      field = this.xref.fetchIfRef(field);
58514      if (!(field instanceof Dict)) {
58515        return false;
58516      }
58517      if (field.has("Kids")) {
58518        if (++recursionDepth > RECURSION_LIMIT) {
58519          warn("#hasOnlyDocumentSignatures: maximum recursion depth reached");
58520          return false;
58521        }
58522        return this.#hasOnlyDocumentSignatures(field.get("Kids"), recursionDepth);
58523      }
58524      const isSignature = isName(field.get("FT"), "Sig");
58525      const rectangle = field.get("Rect");
58526      const isInvisible = Array.isArray(rectangle) && rectangle.every(value => value === 0);
58527      return isSignature && isInvisible;
58528    });
58529  }
58530  get _xfaStreams() {
58531    const {
58532      acroForm
58533    } = this.catalog;
58534    if (!acroForm) {
58535      return null;
58536    }
58537    const xfa = acroForm.get("XFA");
58538    const entries = new Map(["xdp:xdp", "template", "datasets", "config", "connectionSet", "localeSet", "stylesheet", "/xdp:xdp"].map(e => [e, null]));
58539    if (xfa instanceof BaseStream && !xfa.isEmpty) {
58540      entries.set("xdp:xdp", xfa);
58541      return entries;
58542    }
58543    if (!Array.isArray(xfa) || xfa.length === 0) {
58544      return null;
58545    }
58546    for (let i = 0, ii = xfa.length; i < ii; i += 2) {
58547      let name;
58548      if (i === 0) {
58549        name = "xdp:xdp";
58550      } else if (i === ii - 2) {
58551        name = "/xdp:xdp";
58552      } else {
58553        name = xfa[i];
58554      }
58555      if (!entries.has(name)) {
58556        continue;
58557      }
58558      const data = this.xref.fetchIfRef(xfa[i + 1]);
58559      if (!(data instanceof BaseStream) || data.isEmpty) {
58560        continue;
58561      }
58562      entries.set(name, data);
58563    }
58564    return entries;
58565  }
58566  get xfaDatasets() {
58567    const streams = this._xfaStreams;
58568    if (!streams) {
58569      return shadow(this, "xfaDatasets", null);
58570    }
58571    for (const key of ["datasets", "xdp:xdp"]) {
58572      const stream = streams.get(key);
58573      if (!stream) {
58574        continue;
58575      }
58576      try {
58577        const str = stringToUTF8String(stream.getString());
58578        const data = {
58579          [key]: str
58580        };
58581        return shadow(this, "xfaDatasets", new DatasetReader(data));
58582      } catch {
58583        warn("XFA - Invalid utf-8 string.");
58584        break;
58585      }
58586    }
58587    return shadow(this, "xfaDatasets", null);
58588  }
58589  get xfaData() {
58590    const streams = this._xfaStreams;
58591    if (!streams) {
58592      return null;
58593    }
58594    const data = Object.create(null);
58595    for (const [key, stream] of streams) {
58596      if (!stream) {
58597        continue;
58598      }
58599      try {
58600        data[key] = stringToUTF8String(stream.getString());
58601      } catch {
58602        warn("XFA - Invalid utf-8 string.");
58603        return null;
58604      }
58605    }
58606    return data;
58607  }
58608  get xfaFactory() {
58609    let data;
58610    if (this.pdfManager.enableXfa && this.catalog.needsRendering && this.formInfo.hasXfa && !this.formInfo.hasAcroForm) {
58611      data = this.xfaData;
58612    }
58613    return shadow(this, "xfaFactory", data ? new XFAFactory(data) : null);
58614  }
58615  get isPureXfa() {
58616    return this.xfaFactory ? this.xfaFactory.isValid() : false;
58617  }
58618  get htmlForXfa() {
58619    return this.xfaFactory ? this.xfaFactory.getPages() : null;
58620  }
58621  async #loadXfaImages() {
58622    const xfaImages = await this.pdfManager.ensureCatalog("xfaImages");
58623    if (!xfaImages) {
58624      return;
58625    }
58626    this.xfaFactory.setImages(xfaImages);
58627  }
58628  async #loadXfaFonts(handler, task) {
58629    const acroForm = await this.pdfManager.ensureCatalog("acroForm");
58630    if (!acroForm) {
58631      return;
58632    }
58633    const resources = await acroForm.getAsync("DR");
58634    if (!(resources instanceof Dict)) {
58635      return;
58636    }
58637    await ObjectLoader.load(resources, ["Font"], this.xref);
58638    const fontRes = resources.get("Font");
58639    if (!(fontRes instanceof Dict)) {
58640      return;
58641    }
58642    const options = Object.assign(Object.create(null), this.pdfManager.evaluatorOptions, {
58643      useSystemFonts: false
58644    });
58645    const {
58646      builtInCMapCache,
58647      fontCache,
58648      standardFontDataCache
58649    } = this.catalog;
58650    const partialEvaluator = new PartialEvaluator({
58651      xref: this.xref,
58652      handler,
58653      pageIndex: -1,
58654      idFactory: this._globalIdFactory,
58655      fontCache,
58656      builtInCMapCache,
58657      standardFontDataCache,
58658      options
58659    });
58660    const operatorList = new OperatorList();
58661    const pdfFonts = [];
58662    const initialState = {
58663      get font() {
58664        return pdfFonts.at(-1);
58665      },
58666      set font(font) {
58667        pdfFonts.push(font);
58668      },
58669      clone() {
58670        return this;
58671      }
58672    };
58673    const parseFont = (fontName, fallbackFontDict, cssFontInfo) => partialEvaluator.handleSetFont(resources, [Name.get(fontName), 1], null, operatorList, task, initialState, fallbackFontDict, cssFontInfo).catch(reason => {
58674      warn(`loadXfaFonts: "${reason}".`);
58675      return null;
58676    });
58677    const promises = [];
58678    for (const [fontName, font] of fontRes) {
58679      const descriptor = font.get("FontDescriptor");
58680      if (!(descriptor instanceof Dict)) {
58681        continue;
58682      }
58683      let fontFamily = descriptor.get("FontFamily");
58684      fontFamily = fontFamily.replaceAll(/[ ]+(\d)/g, "$1"
vendor: 4,890 bytes, lines 58684-58849
58684);
58685      const fontWeight = descriptor.get("FontWeight");
58686      const italicAngle = -descriptor.get("ItalicAngle");
58687      const cssFontInfo = {
58688        fontFamily,
58689        fontWeight,
58690        italicAngle
58691      };
58692      if (!validateCSSFont(cssFontInfo)) {
58693        continue;
58694      }
58695      promises.push(parseFont(fontName, null, cssFontInfo));
58696    }
58697    await Promise.all(promises);
58698    const missingFonts = this.xfaFactory.setFonts(pdfFonts);
58699    if (!missingFonts) {
58700      return;
58701    }
58702    options.ignoreErrors = true;
58703    promises.length = 0;
58704    pdfFonts.length = 0;
58705    const reallyMissingFonts = new Set();
58706    for (const missing of missingFonts) {
58707      if (!getXfaFontName(`${missing}-Regular`)) {
58708        reallyMissingFonts.add(missing);
58709      }
58710    }
58711    if (reallyMissingFonts.size) {
58712      missingFonts.push("PdfJS-Fallback");
58713    }
58714    for (const missing of missingFonts) {
58715      if (reallyMissingFonts.has(missing)) {
58716        continue;
58717      }
58718      for (const fontInfo of [{
58719        name: "Regular",
58720        fontWeight: 400,
58721        italicAngle: 0
58722      }, {
58723        name: "Bold",
58724        fontWeight: 700,
58725        italicAngle: 0
58726      }, {
58727        name: "Italic",
58728        fontWeight: 400,
58729        italicAngle: 12
58730      }, {
58731        name: "BoldItalic",
58732        fontWeight: 700,
58733        italicAngle: 12
58734      }]) {
58735        const name = `${missing}-${fontInfo.name}`;
58736        promises.push(parseFont(name, getXfaFontDict(name), {
58737          fontFamily: missing,
58738          fontWeight: fontInfo.fontWeight,
58739          italicAngle: fontInfo.italicAngle
58740        }));
58741      }
58742    }
58743    await Promise.all(promises);
58744    this.xfaFactory.appendFonts(pdfFonts, reallyMissingFonts);
58745  }
58746  loadXfaResources(handler, task) {
58747    return Promise.all([this.#loadXfaFonts(handler, task).catch(() => {}), this.#loadXfaImages()]);
58748  }
58749  serializeXfaData(annotationStorage) {
58750    return this.xfaFactory ? this.xfaFactory.serializeData(annotationStorage) : null;
58751  }
58752  get version() {
58753    return this.catalog.version || this.#version;
58754  }
58755  get formInfo() {
58756    const formInfo = {
58757      hasFields: false,
58758      hasAcroForm: false,
58759      hasXfa: false,
58760      hasSignatures: false
58761    };
58762    const {
58763      acroForm
58764    } = this.catalog;
58765    if (!acroForm) {
58766      return shadow(this, "formInfo", formInfo);
58767    }
58768    try {
58769      const fields = acroForm.get("Fields");
58770      const hasFields = Array.isArray(fields) && fields.length > 0;
58771      formInfo.hasFields = hasFields;
58772      const xfa = acroForm.get("XFA");
58773      formInfo.hasXfa = Array.isArray(xfa) && xfa.length > 0 || xfa instanceof BaseStream && !xfa.isEmpty;
58774      const sigFlags = acroForm.get("SigFlags");
58775      const hasSignatures = !!(sigFlags & 0x1);
58776      const hasOnlyDocumentSignatures = hasSignatures && this.#hasOnlyDocumentSignatures(fields);
58777      formInfo.hasAcroForm = hasFields && !hasOnlyDocumentSignatures;
58778      formInfo.hasSignatures = hasSignatures;
58779    } catch (ex) {
58780      if (ex instanceof MissingDataException) {
58781        throw ex;
58782      }
58783      warn(`Cannot fetch form information: "${ex}".`);
58784    }
58785    return shadow(this, "formInfo", formInfo);
58786  }
58787  get documentInfo() {
58788    const {
58789      catalog,
58790      formInfo,
58791      xref
58792    } = this;
58793    const docInfo = {
58794      PDFFormatVersion: this.version,
58795      Language: catalog.lang,
58796      EncryptFilterName: xref.encrypt?.filterName ?? null,
58797      IsLinearized: !!this.linearization,
58798      IsAcroFormPresent: formInfo.hasAcroForm,
58799      IsXFAPresent: formInfo.hasXfa,
58800      IsCollectionPresent: !!catalog.collection,
58801      IsSignaturesPresent: formInfo.hasSignatures
58802    };
58803    let infoDict;
58804    try {
58805      infoDict = xref.trailer.get("Info");
58806    } catch (err) {
58807      if (err instanceof MissingDataException) {
58808        throw err;
58809      }
58810      info("The document information dictionary is invalid.");
58811    }
58812    if (!(infoDict instanceof Dict)) {
58813      return shadow(this, "documentInfo", docInfo);
58814    }
58815    for (const [key, value] of infoDict) {
58816      switch (key) {
58817        case "Title":
58818        case "Author":
58819        case "Subject":
58820        case "Keywords":
58821        case "Creator":
58822        case "Producer":
58823        case "CreationDate":
58824        case "ModDate":
58825          if (typeof value === "string") {
58826            docInfo[key] = stringToPDFString(value);
58827            continue;
58828          }
58829          break;
58830        case "Trapped":
58831          if (value instanceof Name) {
58832            docInfo[key] = value;
58833            continue;
58834          }
58835          break;
58836        default:
58837          let customValue;
58838          switch (typeof value) {
58839            case "string":
58840              customValue = stringToPDFString(value);
58841              break;
58842            case "number":
58843            case "boolean":
58844              customValue = value;
58845              break;
58846            default:
58847              if (value instanceof Name) {
58848                customValue = value;
58849              
vendor: 13,684 bytes, lines 58849-59283
58849}
58850              break;
58851          }
58852          if (customValue === undefined) {
58853            warn(`Bad value, for custom key "${key}", in Info: ${value}.`);
58854            continue;
58855          }
58856          docInfo.Custom ??= Object.create(null);
58857          docInfo.Custom[key] = customValue;
58858          continue;
58859      }
58860      warn(`Bad value, for key "${key}", in Info: ${value}.`);
58861    }
58862    return shadow(this, "documentInfo", docInfo);
58863  }
58864  get fingerprints() {
58865    const FINGERPRINT_FIRST_BYTES = 1024;
58866    const EMPTY_FINGERPRINT = "\x00".repeat(16);
58867    function validate(data) {
58868      return typeof data === "string" && data.length === 16 && data !== EMPTY_FINGERPRINT;
58869    }
58870    const id = this.xref.trailer.get("ID");
58871    let hashOriginal, hashModified;
58872    if (Array.isArray(id) && validate(id[0])) {
58873      hashOriginal = stringToBytes(id[0]);
58874      if (id[1] !== id[0] && validate(id[1])) {
58875        hashModified = stringToBytes(id[1]);
58876      }
58877    } else {
58878      hashOriginal = calculateMD5(this.stream.getByteRange(0, FINGERPRINT_FIRST_BYTES), 0, FINGERPRINT_FIRST_BYTES);
58879    }
58880    return shadow(this, "fingerprints", [hashOriginal.toHex(), hashModified?.toHex() ?? null]);
58881  }
58882  async #getLinearizationPage(pageIndex) {
58883    const {
58884      catalog,
58885      linearization,
58886      xref
58887    } = this;
58888    const ref = Ref.get(linearization.objectNumberFirst, 0);
58889    try {
58890      const obj = await xref.fetchAsync(ref);
58891      if (obj instanceof Dict) {
58892        let type = obj.getRaw("Type");
58893        if (type instanceof Ref) {
58894          type = await xref.fetchAsync(type);
58895        }
58896        if (isName(type, "Page") || !obj.has("Type") && !obj.has("Kids") && obj.has("Contents")) {
58897          if (!catalog.pageKidsCountCache.has(ref)) {
58898            catalog.pageKidsCountCache.put(ref, 1);
58899          }
58900          if (!catalog.pageIndexCache.has(ref)) {
58901            catalog.pageIndexCache.put(ref, 0);
58902          }
58903          return [obj, ref];
58904        }
58905      }
58906      throw new FormatError("The Linearization dictionary doesn't point to a valid Page dictionary.");
58907    } catch (reason) {
58908      warn(`_getLinearizationPage: "${reason.message}".`);
58909      return catalog.getPageDict(pageIndex);
58910    }
58911  }
58912  getPage(pageIndex) {
58913    const cachedPromise = this.#pagePromises.get(pageIndex);
58914    if (cachedPromise) {
58915      return cachedPromise;
58916    }
58917    const {
58918      catalog,
58919      linearization,
58920      xfaFactory
58921    } = this;
58922    let promise;
58923    if (xfaFactory) {
58924      promise = Promise.resolve([Dict.empty, null]);
58925    } else if (linearization?.pageFirst === pageIndex) {
58926      promise = this.#getLinearizationPage(pageIndex);
58927    } else {
58928      promise = catalog.getPageDict(pageIndex);
58929    }
58930    promise = promise.then(([pageDict, ref]) => new Page({
58931      pdfManager: this.pdfManager,
58932      xref: this.xref,
58933      pageIndex,
58934      pageDict,
58935      ref,
58936      globalIdFactory: this._globalIdFactory,
58937      fontCache: catalog.fontCache,
58938      builtInCMapCache: catalog.builtInCMapCache,
58939      standardFontDataCache: catalog.standardFontDataCache,
58940      globalColorSpaceCache: catalog.globalColorSpaceCache,
58941      globalImageCache: catalog.globalImageCache,
58942      systemFontCache: catalog.systemFontCache,
58943      nonBlendModesSet: catalog.nonBlendModesSet,
58944      xfaFactory
58945    }));
58946    this.#pagePromises.set(pageIndex, promise);
58947    return promise;
58948  }
58949  async checkFirstPage(recoveryMode = false) {
58950    if (recoveryMode) {
58951      return;
58952    }
58953    try {
58954      await this.getPage(0);
58955    } catch (reason) {
58956      if (reason instanceof XRefEntryException) {
58957        this.#pagePromises.delete(0);
58958        await this.cleanup();
58959        throw new XRefParseException();
58960      }
58961    }
58962  }
58963  async checkLastPage(recoveryMode = false) {
58964    const {
58965      catalog,
58966      pdfManager
58967    } = this;
58968    catalog.setActualNumPages();
58969    let numPages;
58970    try {
58971      await Promise.all([pdfManager.ensureDoc("xfaFactory"), pdfManager.ensureDoc("linearization"), pdfManager.ensureCatalog("numPages")]);
58972      if (this.xfaFactory) {
58973        return;
58974      } else if (this.linearization) {
58975        numPages = this.linearization.numPages;
58976      } else {
58977        numPages = catalog.numPages;
58978      }
58979      if (!Number.isInteger(numPages)) {
58980        throw new FormatError("Page count is not an integer.");
58981      } else if (numPages <= 1) {
58982        return;
58983      }
58984      await this.getPage(numPages - 1);
58985    } catch (reason) {
58986      this.#pagePromises.delete(numPages - 1);
58987      await this.cleanup();
58988      if (reason instanceof XRefEntryException && !recoveryMode) {
58989        throw new XRefParseException();
58990      }
58991      warn(`checkLastPage - invalid /Pages tree /Count: ${numPages}.`);
58992      let pagesTree;
58993      try {
58994        pagesTree = await catalog.getAllPageDicts(recoveryMode);
58995      } catch (reasonAll) {
58996        if (reasonAll instanceof XRefEntryException && !recoveryMode) {
58997          throw new XRefParseException();
58998        }
58999        catalog.setActualNumPages(1);
59000        return;
59001      }
59002      for (const [pageIndex, [pageDict, ref]] of pagesTree) {
59003        let promise;
59004        if (pageDict instanceof Error) {
59005          promise = Promise.reject(pageDict);
59006          promise.catch(() => {});
59007        } else {
59008          promise = Promise.resolve(new Page({
59009            pdfManager,
59010            xref: this.xref,
59011            pageIndex,
59012            pageDict,
59013            ref,
59014            globalIdFactory: this._globalIdFactory,
59015            fontCache: catalog.fontCache,
59016            builtInCMapCache: catalog.builtInCMapCache,
59017            standardFontDataCache: catalog.standardFontDataCache,
59018            globalColorSpaceCache: this.globalColorSpaceCache,
59019            globalImageCache: catalog.globalImageCache,
59020            systemFontCache: catalog.systemFontCache,
59021            nonBlendModesSet: catalog.nonBlendModesSet,
59022            xfaFactory: null
59023          }));
59024        }
59025        this.#pagePromises.set(pageIndex, promise);
59026      }
59027      catalog.setActualNumPages(pagesTree.size);
59028    }
59029  }
59030  async fontFallback(id, handler) {
59031    const {
59032      catalog,
59033      pdfManager
59034    } = this;
59035    for (const translatedFont of await Promise.all(catalog.fontCache)) {
59036      if (translatedFont.loadedName === id) {
59037        translatedFont.fallback(handler, pdfManager.evaluatorOptions);
59038        return;
59039      }
59040    }
59041  }
59042  async cleanup(manuallyTriggered = false) {
59043    return this.catalog ? this.catalog.cleanup(manuallyTriggered) : clearGlobalCaches();
59044  }
59045  async #collectFieldObjects(name, parentRef, fieldRef, promises, annotationGlobals, visitedRefs, orphanFields) {
59046    const {
59047      xref
59048    } = this;
59049    if (!(fieldRef instanceof Ref) || visitedRefs.has(fieldRef)) {
59050      return;
59051    }
59052    visitedRefs.put(fieldRef);
59053    const field = await xref.fetchAsync(fieldRef);
59054    if (!(field instanceof Dict)) {
59055      return;
59056    }
59057    let subtype = await field.getAsync("Subtype");
59058    subtype = subtype instanceof Name ? subtype.name : null;
59059    switch (subtype) {
59060      case "Link":
59061        return;
59062    }
59063    if (field.has("T")) {
59064      const partName = stringToPDFString(await field.getAsync("T"));
59065      name = name === "" ? partName : `${name}.${partName}`;
59066    } else {
59067      let obj = field;
59068      while (true) {
59069        obj = obj.getRaw("Parent") || parentRef;
59070        if (obj instanceof Ref) {
59071          if (visitedRefs.has(obj)) {
59072            break;
59073          }
59074          obj = await xref.fetchAsync(obj);
59075        }
59076        if (!(obj instanceof Dict)) {
59077          break;
59078        }
59079        if (obj.has("T")) {
59080          const partName = stringToPDFString(await obj.getAsync("T"));
59081          name = name === "" ? partName : `${name}.${partName}`;
59082          break;
59083        }
59084      }
59085    }
59086    if (parentRef && !field.has("Parent") && isName(field.get("Subtype"), "Widget")) {
59087      orphanFields.put(fieldRef, parentRef);
59088    }
59089    promises.getOrInsertComputed(name, makeArr).push(AnnotationFactory.create(xref, fieldRef, annotationGlobals, null, true, orphanFields, null, null).then(annotation => annotation?.getFieldObject()).catch(function (reason) {
59090      warn(`#collectFieldObjects: "${reason}".`);
59091      return null;
59092    }));
59093    if (!field.has("Kids")) {
59094      return;
59095    }
59096    const kids = await field.getAsync("Kids");
59097    if (Array.isArray(kids)) {
59098      for (const kid of kids) {
59099        await this.#collectFieldObjects(name, fieldRef, kid, promises, annotationGlobals, visitedRefs, orphanFields);
59100      }
59101    }
59102  }
59103  get fieldObjects() {
59104    const promise = this.pdfManager.ensureDoc("formInfo").then(async formInfo => {
59105      if (!formInfo.hasFields) {
59106        return null;
59107      }
59108      const annotationGlobals = await this.annotationGlobals;
59109      if (!annotationGlobals) {
59110        return null;
59111      }
59112      const {
59113        acroForm
59114      } = annotationGlobals;
59115      const visitedRefs = new RefSet();
59116      const allFields = Object.create(null);
59117      const fieldPromises = new Map();
59118      const orphanFields = new RefSetCache();
59119      for (const fieldRef of acroForm.get("Fields")) {
59120        await this.#collectFieldObjects("", null, fieldRef, fieldPromises, annotationGlobals, visitedRefs, orphanFields);
59121      }
59122      const allPromises = [];
59123      for (const [name, promises] of fieldPromises) {
59124        allPromises.push(Promise.all(promises).then(fields => {
59125          fields = fields.filter(field => !!field);
59126          if (fields.length > 0) {
59127            allFields[name] = fields;
59128          }
59129        }));
59130      }
59131      await Promise.all(allPromises);
59132      return {
59133        allFields: objectSize(allFields) > 0 ? allFields : null,
59134        orphanFields
59135      };
59136    });
59137    return shadow(this, "fieldObjects", promise);
59138  }
59139  get hasJSActions() {
59140    const promise = this.pdfManager.ensureDoc("_parseHasJSActions");
59141    return shadow(this, "hasJSActions", promise);
59142  }
59143  async _parseHasJSActions() {
59144    const [catalogJsActions, fieldObjects] = await Promise.all([this.pdfManager.ensureCatalog("jsActions"), this.pdfManager.ensureDoc("fieldObjects")]);
59145    if (catalogJsActions) {
59146      return true;
59147    }
59148    if (fieldObjects?.allFields) {
59149      return Object.values(fieldObjects.allFields).some(fieldObject => fieldObject.some(object => object.actions !== null));
59150    }
59151    return false;
59152  }
59153  get calculationOrderIds() {
59154    const calculationOrder = this.catalog.acroForm?.get("CO");
59155    if (!Array.isArray(calculationOrder) || calculationOrder.length === 0) {
59156      return shadow(this, "calculationOrderIds", null);
59157    }
59158    const ids = [];
59159    for (const id of calculationOrder) {
59160      if (id instanceof Ref) {
59161        ids.push(id.toString());
59162      }
59163    }
59164    return shadow(this, "calculationOrderIds", ids.length ? ids : null);
59165  }
59166  get annotationGlobals() {
59167    return shadow(this, "annotationGlobals", AnnotationFactory.createGlobals(this.pdfManager));
59168  }
59169  async toJSObject(value, firstCall = true) {
59170    throw new Error("Not implemented: toJSObject");
59171  }
59172}
59173
59174;// ./src/core/pdf_manager.js
59175
59176
59177
59178
59179
59180
59181
59182
59183
59184
59185
59186
59187
59188function parseDocBaseUrl(url) {
59189  if (url) {
59190    const absoluteUrl = createValidAbsoluteUrl(url);
59191    if (absoluteUrl) {
59192      return absoluteUrl.href;
59193    }
59194    warn(`Invalid absolute docBaseUrl: "${url}".`);
59195  }
59196  return null;
59197}
59198class BasePdfManager {
59199  constructor({
59200    docBaseUrl,
59201    docId,
59202    enableXfa,
59203    evaluatorOptions,
59204    handler,
59205    password
59206  }) {
59207    this._docBaseUrl = parseDocBaseUrl(docBaseUrl);
59208    this._docId = docId;
59209    this._password = password;
59210    this.enableXfa = enableXfa;
59211    evaluatorOptions.isOffscreenCanvasSupported &&= FeatureTest.isOffscreenCanvasSupported;
59212    evaluatorOptions.isImageDecoderSupported &&= FeatureTest.isImageDecoderSupported;
59213    this.evaluatorOptions = Object.freeze(evaluatorOptions);
59214    ImageResizer.setOptions(evaluatorOptions);
59215    JpegStream.setOptions(evaluatorOptions);
59216    OperatorList.setOptions(evaluatorOptions);
59217    const options = {
59218      ...evaluatorOptions,
59219      handler
59220    };
59221    JpxImage.setOptions(options);
59222    IccColorSpace.setOptions(options);
59223    CmykICCBasedCS.setOptions(options);
59224    JBig2CCITTFaxImage.setOptions(options);
59225    PDFFunctionFactory.setOptions(options);
59226    Pattern.setOptions(options);
59227  }
59228  get docId() {
59229    return this._docId;
59230  }
59231  get password() {
59232    return this._password;
59233  }
59234  get docBaseUrl() {
59235    return this._docBaseUrl;
59236  }
59237  ensureDoc(prop, args) {
59238    return this.ensure(this.pdfDocument, prop, args);
59239  }
59240  ensureXRef(prop, args) {
59241    return this.ensure(this.pdfDocument.xref, prop, args);
59242  }
59243  ensureCatalog(prop, args) {
59244    return this.ensure(this.pdfDocument.catalog, prop, args);
59245  }
59246  getPage(pageIndex) {
59247    return this.pdfDocument.getPage(pageIndex);
59248  }
59249  fontFallback(id, handler) {
59250    return this.pdfDocument.fontFallback(id, handler);
59251  }
59252  cleanup(manuallyTriggered = false) {
59253    return this.pdfDocument.cleanup(manuallyTriggered);
59254  }
59255  async ensure(obj, prop, args) {
59256    unreachable("Abstract method `ensure` called");
59257  }
59258  requestRange(begin, end) {
59259    unreachable("Abstract method `requestRange` called");
59260  }
59261  requestLoadedStream(noFetch = false) {
59262    unreachable("Abstract method `requestLoadedStream` called");
59263  }
59264  sendProgressiveData(chunk) {
59265    unreachable("Abstract method `sendProgressiveData` called");
59266  }
59267  updatePassword(password) {
59268    this._password = password;
59269  }
59270  terminate(reason) {
59271    unreachable("Abstract method `terminate` called");
59272  }
59273}
59274class LocalPdfManager extends BasePdfManager {
59275  constructor(args) {
59276    super(args);
59277    const stream = new Stream(args.source);
59278    this.pdfDocument = new PDFDocument(this, stream);
59279    this._loadedStreamPromise = Promise.resolve(stream);
59280  }
59281  async ensure(obj, prop, args) {
59282    const value = obj[prop];
59283    if (typeof value === "function") {
vendor: 37,591 bytes, lines 59284-60564
59284      return value.apply(obj, args);
59285    }
59286    return value;
59287  }
59288  requestRange(begin, end) {
59289    return Promise.resolve();
59290  }
59291  requestLoadedStream(noFetch = false) {
59292    return this._loadedStreamPromise;
59293  }
59294  terminate(reason) {}
59295}
59296class NetworkPdfManager extends BasePdfManager {
59297  constructor(args) {
59298    super(args);
59299    this.streamManager = new ChunkedStreamManager(args.source, {
59300      msgHandler: args.handler,
59301      length: args.length,
59302      disableAutoFetch: args.disableAutoFetch,
59303      rangeChunkSize: args.rangeChunkSize
59304    });
59305    this.pdfDocument = new PDFDocument(this, this.streamManager.getStream());
59306  }
59307  async ensure(obj, prop, args) {
59308    try {
59309      const value = obj[prop];
59310      if (typeof value === "function") {
59311        return await value.apply(obj, args);
59312      }
59313      return value;
59314    } catch (ex) {
59315      if (!(ex instanceof MissingDataException)) {
59316        throw ex;
59317      }
59318      await this.requestRange(ex.begin, ex.end);
59319      return this.ensure(obj, prop, args);
59320    }
59321  }
59322  requestRange(begin, end) {
59323    return this.streamManager.requestRange(begin, end);
59324  }
59325  requestLoadedStream(noFetch = false) {
59326    return this.streamManager.requestAllChunks(noFetch);
59327  }
59328  sendProgressiveData(chunk) {
59329    this.streamManager.onReceiveData({
59330      chunk
59331    });
59332  }
59333  terminate(reason) {
59334    this.streamManager.abort(reason);
59335  }
59336}
59337
59338;// ./src/shared/message_handler.js
59339
59340const CallbackKind = {
59341  DATA: 1,
59342  ERROR: 2
59343};
59344const StreamKind = {
59345  CANCEL: 1,
59346  CANCEL_COMPLETE: 2,
59347  CLOSE: 3,
59348  ENQUEUE: 4,
59349  ERROR: 5,
59350  PULL: 6,
59351  PULL_COMPLETE: 7,
59352  START_COMPLETE: 8
59353};
59354function onFn() {}
59355function wrapReason(ex) {
59356  if (ex instanceof AbortException || ex instanceof InvalidPDFException || ex instanceof PasswordException || ex instanceof ResponseException || ex instanceof UnknownErrorException) {
59357    return ex;
59358  }
59359  if (!(ex instanceof Error || typeof ex === "object" && ex !== null)) {
59360    unreachable('wrapReason: Expected "reason" to be a (possibly cloned) Error.');
59361  }
59362  switch (ex.name) {
59363    case "AbortException":
59364      return new AbortException(ex.message);
59365    case "InvalidPDFException":
59366      return new InvalidPDFException(ex.message);
59367    case "PasswordException":
59368      return new PasswordException(ex.message, ex.code);
59369    case "ResponseException":
59370      return new ResponseException(ex.message, ex.status, ex.missing);
59371    case "UnknownErrorException":
59372      return new UnknownErrorException(ex.message, ex.details);
59373  }
59374  return new UnknownErrorException(ex.message, ex.toString());
59375}
59376class MessageHandler {
59377  #messageAC = new AbortController();
59378  constructor(sourceName, targetName, comObj) {
59379    this.sourceName = sourceName;
59380    this.targetName = targetName;
59381    this.comObj = comObj;
59382    this.callbackId = 1;
59383    this.streamId = 1;
59384    this.streamSinks = Object.create(null);
59385    this.streamControllers = Object.create(null);
59386    this.callbackCapabilities = Object.create(null);
59387    this.actionHandler = Object.create(null);
59388    comObj.addEventListener("message", this.#onMessage.bind(this), {
59389      signal: this.#messageAC.signal
59390    });
59391  }
59392  #onMessage({
59393    data
59394  }) {
59395    if (data.targetName !== this.sourceName) {
59396      return;
59397    }
59398    if (data.stream) {
59399      this.#processStreamMessage(data);
59400      return;
59401    }
59402    if (data.callback) {
59403      const callbackId = data.callbackId;
59404      const capability = this.callbackCapabilities[callbackId];
59405      if (!capability) {
59406        throw new Error(`Cannot resolve callback ${callbackId}`);
59407      }
59408      delete this.callbackCapabilities[callbackId];
59409      if (data.callback === CallbackKind.DATA) {
59410        capability.resolve(data.data);
59411      } else if (data.callback === CallbackKind.ERROR) {
59412        capability.reject(wrapReason(data.reason));
59413      } else {
59414        throw new Error("Unexpected callback case");
59415      }
59416      return;
59417    }
59418    const action = this.actionHandler[data.action];
59419    if (!action) {
59420      throw new Error(`Unknown action from worker: ${data.action}`);
59421    }
59422    if (data.callbackId) {
59423      const sourceName = this.sourceName,
59424        targetName = data.sourceName,
59425        comObj = this.comObj;
59426      Promise.try(action, data.data).then(function (result) {
59427        comObj.postMessage({
59428          sourceName,
59429          targetName,
59430          callback: CallbackKind.DATA,
59431          callbackId: data.callbackId,
59432          data: result
59433        });
59434      }, function (reason) {
59435        comObj.postMessage({
59436          sourceName,
59437          targetName,
59438          callback: CallbackKind.ERROR,
59439          callbackId: data.callbackId,
59440          reason: wrapReason(reason)
59441        });
59442      });
59443      return;
59444    }
59445    if (data.streamId) {
59446      this.#createStreamSink(data);
59447      return;
59448    }
59449    action(data.data);
59450  }
59451  on(actionName, handler) {
59452    const ah = this.actionHandler;
59453    if (ah[actionName]) {
59454      throw new Error(`There is already an actionName called "${actionName}"`);
59455    }
59456    ah[actionName] = handler;
59457  }
59458  send(actionName, data, transfers) {
59459    this.comObj.postMessage({
59460      sourceName: this.sourceName,
59461      targetName: this.targetName,
59462      action: actionName,
59463      data
59464    }, transfers);
59465  }
59466  sendWithPromise(actionName, data, transfers) {
59467    const callbackId = this.callbackId++;
59468    const capability = Promise.withResolvers();
59469    this.callbackCapabilities[callbackId] = capability;
59470    try {
59471      this.comObj.postMessage({
59472        sourceName: this.sourceName,
59473        targetName: this.targetName,
59474        action: actionName,
59475        callbackId,
59476        data
59477      }, transfers);
59478    } catch (ex) {
59479      capability.reject(ex);
59480    }
59481    return capability.promise;
59482  }
59483  sendWithStream(actionName, data, queueingStrategy, transfers) {
59484    const streamId = this.streamId++,
59485      sourceName = this.sourceName,
59486      targetName = this.targetName,
59487      comObj = this.comObj;
59488    return new ReadableStream({
59489      start: controller => {
59490        const startCapability = Promise.withResolvers();
59491        this.streamControllers[streamId] = {
59492          controller,
59493          startCall: startCapability,
59494          pullCall: null,
59495          cancelCall: null,
59496          isClosed: false
59497        };
59498        comObj.postMessage({
59499          sourceName,
59500          targetName,
59501          action: actionName,
59502          streamId,
59503          data,
59504          desiredSize: controller.desiredSize
59505        }, transfers);
59506        return startCapability.promise;
59507      },
59508      pull: controller => {
59509        const pullCapability = Promise.withResolvers();
59510        this.streamControllers[streamId].pullCall = pullCapability;
59511        comObj.postMessage({
59512          sourceName,
59513          targetName,
59514          stream: StreamKind.PULL,
59515          streamId,
59516          desiredSize: controller.desiredSize
59517        });
59518        return pullCapability.promise;
59519      },
59520      cancel: reason => {
59521        assert(reason instanceof Error, "cancel must have a valid reason");
59522        const cancelCapability = Promise.withResolvers();
59523        this.streamControllers[streamId].cancelCall = cancelCapability;
59524        this.streamControllers[streamId].isClosed = true;
59525        comObj.postMessage({
59526          sourceName,
59527          targetName,
59528          stream: StreamKind.CANCEL,
59529          streamId,
59530          reason: wrapReason(reason)
59531        });
59532        return cancelCapability.promise;
59533      }
59534    }, queueingStrategy);
59535  }
59536  #createStreamSink(data) {
59537    const streamId = data.streamId,
59538      sourceName = this.sourceName,
59539      targetName = data.sourceName,
59540      comObj = this.comObj;
59541    const self = this,
59542      action = this.actionHandler[data.action];
59543    const streamSink = {
59544      enqueue(chunk, size = 1, transfers) {
59545        if (this.isCancelled) {
59546          return;
59547        }
59548        const lastDesiredSize = this.desiredSize;
59549        this.desiredSize -= size;
59550        if (lastDesiredSize > 0 && this.desiredSize <= 0) {
59551          this.sinkCapability = Promise.withResolvers();
59552          this.ready = this.sinkCapability.promise;
59553        }
59554        comObj.postMessage({
59555          sourceName,
59556          targetName,
59557          stream: StreamKind.ENQUEUE,
59558          streamId,
59559          chunk
59560        }, transfers);
59561      },
59562      close() {
59563        if (this.isCancelled) {
59564          return;
59565        }
59566        this.isCancelled = true;
59567        comObj.postMessage({
59568          sourceName,
59569          targetName,
59570          stream: StreamKind.CLOSE,
59571          streamId
59572        });
59573        delete self.streamSinks[streamId];
59574      },
59575      error(reason) {
59576        assert(reason instanceof Error, "error must have a valid reason");
59577        if (this.isCancelled) {
59578          return;
59579        }
59580        this.isCancelled = true;
59581        comObj.postMessage({
59582          sourceName,
59583          targetName,
59584          stream: StreamKind.ERROR,
59585          streamId,
59586          reason: wrapReason(reason)
59587        });
59588      },
59589      sinkCapability: Promise.withResolvers(),
59590      onPull: null,
59591      onCancel: null,
59592      isCancelled: false,
59593      desiredSize: data.desiredSize,
59594      ready: null
59595    };
59596    streamSink.sinkCapability.resolve();
59597    streamSink.ready = streamSink.sinkCapability.promise;
59598    this.streamSinks[streamId] = streamSink;
59599    Promise.try(action, data.data, streamSink).then(function () {
59600      comObj.postMessage({
59601        sourceName,
59602        targetName,
59603        stream: StreamKind.START_COMPLETE,
59604        streamId,
59605        success: true
59606      });
59607    }, function (reason) {
59608      comObj.postMessage({
59609        sourceName,
59610        targetName,
59611        stream: StreamKind.START_COMPLETE,
59612        streamId,
59613        reason: wrapReason(reason)
59614      });
59615    });
59616  }
59617  #processStreamMessage(data) {
59618    const streamId = data.streamId,
59619      sourceName = this.sourceName,
59620      targetName = data.sourceName,
59621      comObj = this.comObj;
59622    const streamController = this.streamControllers[streamId],
59623      streamSink = this.streamSinks[streamId];
59624    switch (data.stream) {
59625      case StreamKind.START_COMPLETE:
59626        if (data.success) {
59627          streamController.startCall.resolve();
59628        } else {
59629          streamController.startCall.reject(wrapReason(data.reason));
59630        }
59631        break;
59632      case StreamKind.PULL_COMPLETE:
59633        if (data.success) {
59634          streamController.pullCall.resolve();
59635        } else {
59636          streamController.pullCall.reject(wrapReason(data.reason));
59637        }
59638        break;
59639      case StreamKind.PULL:
59640        if (!streamSink) {
59641          comObj.postMessage({
59642            sourceName,
59643            targetName,
59644            stream: StreamKind.PULL_COMPLETE,
59645            streamId,
59646            success: true
59647          });
59648          break;
59649        }
59650        if (streamSink.desiredSize <= 0 && data.desiredSize > 0) {
59651          streamSink.sinkCapability.resolve();
59652        }
59653        streamSink.desiredSize = data.desiredSize;
59654        Promise.try(streamSink.onPull || onFn).then(function () {
59655          comObj.postMessage({
59656            sourceName,
59657            targetName,
59658            stream: StreamKind.PULL_COMPLETE,
59659            streamId,
59660            success: true
59661          });
59662        }, function (reason) {
59663          comObj.postMessage({
59664            sourceName,
59665            targetName,
59666            stream: StreamKind.PULL_COMPLETE,
59667            streamId,
59668            reason: wrapReason(reason)
59669          });
59670        });
59671        break;
59672      case StreamKind.ENQUEUE:
59673        assert(streamController, "enqueue should have stream controller");
59674        if (streamController.isClosed) {
59675          break;
59676        }
59677        streamController.controller.enqueue(data.chunk);
59678        break;
59679      case StreamKind.CLOSE:
59680        assert(streamController, "close should have stream controller");
59681        if (streamController.isClosed) {
59682          break;
59683        }
59684        streamController.isClosed = true;
59685        streamController.controller.close();
59686        this.#deleteStreamController(streamController, streamId);
59687        break;
59688      case StreamKind.ERROR:
59689        assert(streamController, "error should have stream controller");
59690        streamController.controller.error(wrapReason(data.reason));
59691        this.#deleteStreamController(streamController, streamId);
59692        break;
59693      case StreamKind.CANCEL_COMPLETE:
59694        if (data.success) {
59695          streamController.cancelCall.resolve();
59696        } else {
59697          streamController.cancelCall.reject(wrapReason(data.reason));
59698        }
59699        this.#deleteStreamController(streamController, streamId);
59700        break;
59701      case StreamKind.CANCEL:
59702        if (!streamSink) {
59703          break;
59704        }
59705        const dataReason = wrapReason(data.reason);
59706        Promise.try(streamSink.onCancel || onFn, dataReason).then(function () {
59707          comObj.postMessage({
59708            sourceName,
59709            targetName,
59710            stream: StreamKind.CANCEL_COMPLETE,
59711            streamId,
59712            success: true
59713          });
59714        }, function (reason) {
59715          comObj.postMessage({
59716            sourceName,
59717            targetName,
59718            stream: StreamKind.CANCEL_COMPLETE,
59719            streamId,
59720            reason: wrapReason(reason)
59721          });
59722        });
59723        streamSink.sinkCapability.reject(dataReason);
59724        streamSink.isCancelled = true;
59725        delete this.streamSinks[streamId];
59726        break;
59727      default:
59728        throw new Error("Unexpected stream case");
59729    }
59730  }
59731  async #deleteStreamController(streamController, streamId) {
59732    await Promise.allSettled([streamController.startCall?.promise, streamController.pullCall?.promise, streamController.cancelCall?.promise]);
59733    delete this.streamControllers[streamId];
59734  }
59735  destroy() {
59736    this.#messageAC?.abort();
59737    this.#messageAC = null;
59738  }
59739}
59740
59741;// ./src/core/writer.js
59742
59743
59744
59745
59746
59747
59748
59749async function writeObject(ref, obj, buffer, {
59750  encrypt = null,
59751  encryptRef = null
59752}) {
59753  const transform = encrypt && encryptRef !== ref ? encrypt.createCipherTransform(ref.num, ref.gen) : null;
59754  buffer.push(`${ref.num} ${ref.gen} obj\n`);
59755  await writeValue(obj, buffer, transform);
59756  buffer.push("\nendobj\n");
59757}
59758async function writeDict(dict, buffer, transform) {
59759  buffer.push("<<");
59760  for (const [key, rawObj] of dict.getRawEntries()) {
59761    buffer.push(` /${escapePDFName(key)} `);
59762    await writeValue(rawObj, buffer, transform);
59763  }
59764  buffer.push(">>");
59765}
59766async function writeStream(stream, buffer, transform) {
59767  stream = stream.getOriginalStream();
59768  stream.reset();
59769  let bytes = stream.getBytes();
59770  const {
59771    dict
59772  } = stream;
59773  const [filter, params] = await Promise.all([dict.getAsync("Filter"), dict.getAsync("DecodeParms")]);
59774  const filterZero = Array.isArray(filter) ? await dict.xref.fetchIfRefAsync(filter[0]) : filter;
59775  const isFilterZeroFlateDecode = isName(filterZero, "FlateDecode");
59776  const MIN_LENGTH_FOR_COMPRESSING = 256;
59777  if (bytes.length >= MIN_LENGTH_FOR_COMPRESSING && !isFilterZeroFlateDecode) {
59778    try {
59779      const cs = new CompressionStream("deflate");
59780      const writer = cs.writable.getWriter();
59781      await writer.ready;
59782      writer.write(bytes).then(async () => {
59783        await writer.ready;
59784        await writer.close();
59785      }).catch(() => {});
59786      bytes = await new Response(cs.readable).bytes();
59787      let newFilter, newParams;
59788      if (!filter) {
59789        newFilter = Name.get("FlateDecode");
59790      } else if (!isFilterZeroFlateDecode) {
59791        newFilter = Array.isArray(filter) ? [Name.get("FlateDecode"), ...filter] : [Name.get("FlateDecode"), filter];
59792        if (params) {
59793          newParams = Array.isArray(params) ? [null, ...params] : [null, params];
59794        }
59795      }
59796      if (newFilter) {
59797        dict.set("Filter", newFilter);
59798      }
59799      if (newParams) {
59800        dict.set("DecodeParms", newParams);
59801      }
59802    } catch (ex) {
59803      info(`writeStream - cannot compress data: "${ex}".`);
59804    }
59805  }
59806  let string = bytesToString(bytes);
59807  if (transform) {
59808    string = transform.encryptString(string);
59809  }
59810  dict.set("Length", string.length);
59811  await writeDict(dict, buffer, transform);
59812  buffer.push(" stream\n", string, "\nendstream");
59813}
59814async function writeArray(array, buffer, transform) {
59815  buffer.push("[");
59816  for (let i = 0, ii = array.length; i < ii; i++) {
59817    await writeValue(array[i], buffer, transform);
59818    if (i < ii - 1) {
59819      buffer.push(" ");
59820    }
59821  }
59822  buffer.push("]");
59823}
59824async function writeValue(value, buffer, transform) {
59825  if (value instanceof Name) {
59826    buffer.push(`/${escapePDFName(value.name)}`);
59827  } else if (value instanceof Ref) {
59828    buffer.push(`${value.num} ${value.gen} R`);
59829  } else if (Array.isArray(value) || ArrayBuffer.isView(value)) {
59830    await writeArray(value, buffer, transform);
59831  } else if (typeof value === "string") {
59832    if (transform) {
59833      value = transform.encryptString(value);
59834    }
59835    buffer.push(`(${escapeString(value)})`);
59836  } else if (typeof value === "number") {
59837    buffer.push(value.toFixed(10).replace(/\.?0+$/, ""));
59838  } else if (typeof value === "boolean") {
59839    buffer.push(value.toString());
59840  } else if (value instanceof Dict) {
59841    await writeDict(value, buffer, transform);
59842  } else if (value instanceof BaseStream) {
59843    await writeStream(value, buffer, transform);
59844  } else if (value === null) {
59845    buffer.push("null");
59846  } else {
59847    warn(`Unhandled value in writer: ${typeof value}, please file a bug.`);
59848  }
59849}
59850function writeInt(number, size, offset, buffer) {
59851  for (let i = size + offset - 1; i > offset - 1; i--) {
59852    buffer[i] = number & 0xff;
59853    number >>= 8;
59854  }
59855  return offset + size;
59856}
59857function writeString(string, offset, buffer) {
59858  const ii = string.length;
59859  for (let i = 0; i < ii; i++) {
59860    buffer[offset + i] = string.charCodeAt(i) & 0xff;
59861  }
59862  return offset + ii;
59863}
59864function computeMD5(filesize, xrefInfo) {
59865  const time = Math.floor(Date.now() / 1000);
59866  const filename = xrefInfo.filename || "";
59867  const md5Buffer = [time.toString(), filename, filesize.toString(), ...xrefInfo.infoMap.values()];
59868  const md5BufferLen = Math.sumPrecise(md5Buffer.map(str => str.length));
59869  const array = new Uint8Array(md5BufferLen);
59870  let offset = 0;
59871  for (const str of md5Buffer) {
59872    offset = writeString(str, offset, array);
59873  }
59874  return bytesToString(calculateMD5(array, 0, array.length));
59875}
59876function writeXFADataForAcroform(str, changes) {
59877  const xml = new SimpleXMLParser({
59878    hasAttributes: true
59879  }).parseFromString(str);
59880  for (const {
59881    xfa
59882  } of changes) {
59883    if (!xfa) {
59884      continue;
59885    }
59886    const {
59887      path,
59888      value
59889    } = xfa;
59890    if (!path) {
59891      continue;
59892    }
59893    const nodePath = parseXFAPath(path);
59894    let node = xml.documentElement.searchNode(nodePath, 0);
59895    if (!node && nodePath.length > 1) {
59896      node = xml.documentElement.searchNode([nodePath.at(-1)], 0);
59897    }
59898    if (node) {
59899      node.childNodes = Array.isArray(value) ? value.map(val => new SimpleDOMNode("value", val)) : [new SimpleDOMNode("#text", value)];
59900    } else {
59901      warn(`Node not found for path: ${path}`);
59902    }
59903  }
59904  const buffer = [];
59905  xml.documentElement.dump(buffer);
59906  return buffer.join("");
59907}
59908async function updateAcroform({
59909  xref,
59910  acroForm,
59911  acroFormRef,
59912  hasXfa,
59913  hasXfaDatasetsEntry,
59914  xfaDatasetsRef,
59915  needAppearances,
59916  changes
59917}) {
59918  if (hasXfa && !hasXfaDatasetsEntry && !xfaDatasetsRef) {
59919    warn("XFA - Cannot save it");
59920  }
59921  if (!needAppearances && (!hasXfa || !xfaDatasetsRef || hasXfaDatasetsEntry)) {
59922    return;
59923  }
59924  const dict = acroForm.clone();
59925  if (hasXfa && !hasXfaDatasetsEntry) {
59926    const newXfa = acroForm.get("XFA").slice();
59927    newXfa.splice(2, 0, "datasets");
59928    newXfa.splice(3, 0, xfaDatasetsRef);
59929    dict.set("XFA", newXfa);
59930  }
59931  if (needAppearances) {
59932    dict.set("NeedAppearances", true);
59933  }
59934  changes.put(acroFormRef, {
59935    data: dict
59936  });
59937}
59938function updateXFA({
59939  xfaData,
59940  xfaDatasetsRef,
59941  changes,
59942  xref
59943}) {
59944  if (xfaData === null) {
59945    const datasets = xref.fetchIfRef(xfaDatasetsRef);
59946    xfaData = writeXFADataForAcroform(datasets.getString(), changes);
59947  }
59948  const xfaDataStream = new StringStream(xfaData);
59949  xfaDataStream.dict = new Dict(xref);
59950  xfaDataStream.dict.setIfName("Type", "EmbeddedFile");
59951  changes.put(xfaDatasetsRef, {
59952    data: xfaDataStream
59953  });
59954}
59955async function getXRefTable(xrefInfo, baseOffset, newRefs, newXref, buffer) {
59956  buffer.push("xref\n");
59957  const indexes = getIndexes(newRefs);
59958  let indexesPosition = 0;
59959  for (const {
59960    ref,
59961    data
59962  } of newRefs) {
59963    if (ref.num === indexes[indexesPosition]) {
59964      buffer.push(`${indexes[indexesPosition]} ${indexes[indexesPosition + 1]}\n`);
59965      indexesPosition += 2;
59966    }
59967    if (data !== null) {
59968      buffer.push(`${baseOffset.toString().padStart(10, "0")} ${Math.min(ref.gen, 0xffff).toString().padStart(5, "0")} n\r\n`);
59969      baseOffset += data.length;
59970    } else {
59971      buffer.push(`0000000000 ${Math.min(ref.gen + 1, 0xffff).toString().padStart(5, "0")} f\r\n`);
59972    }
59973  }
59974  computeIDs(baseOffset, xrefInfo, newXref);
59975  buffer.push("trailer\n");
59976  await writeDict(newXref, buffer, null);
59977  buffer.push("\nstartxref\n", baseOffset.toString(), "\n%%EOF\n");
59978}
59979function getIndexes(newRefs) {
59980  const indexes = [];
59981  for (const {
59982    ref
59983  } of newRefs) {
59984    if (ref.num === indexes.at(-2) + indexes.at(-1)) {
59985      indexes[indexes.length - 1] += 1;
59986    } else {
59987      indexes.push(ref.num, 1);
59988    }
59989  }
59990  return indexes;
59991}
59992async function getXRefStreamTable(xrefInfo, baseOffset, newRefs, newXref, buffer) {
59993  const xrefTableData = [];
59994  let maxOffset = 0;
59995  let maxGen = 0;
59996  for (const {
59997    ref,
59998    data,
59999    objStreamRef,
60000    index
60001  } of newRefs) {
60002    let gen;
60003    maxOffset = Math.max(maxOffset, baseOffset);
60004    if (objStreamRef) {
60005      gen = index;
60006      xrefTableData.push([2, objStreamRef.num, gen]);
60007    } else if (data !== null) {
60008      gen = Math.min(ref.gen, 0xffff);
60009      xrefTableData.push([1, baseOffset, gen]);
60010      baseOffset += data.length;
60011    } else {
60012      gen = Math.min(ref.gen + 1, 0xffff);
60013      xrefTableData.push([0, 0, gen]);
60014    }
60015    maxGen = Math.max(maxGen, gen);
60016  }
60017  newXref.set("Index", getIndexes(newRefs));
60018  const offsetSize = getSizeInBytes(maxOffset);
60019  const maxGenSize = getSizeInBytes(maxGen);
60020  const sizes = [1, offsetSize, maxGenSize];
60021  newXref.set("W", sizes);
60022  computeIDs(baseOffset, xrefInfo, newXref);
60023  const structSize = Math.sumPrecise(sizes);
60024  const data = new Uint8Array(structSize * xrefTableData.length);
60025  const stream = new Stream(data);
60026  stream.dict = newXref;
60027  let offset = 0;
60028  for (const [type, objOffset, gen] of xrefTableData) {
60029    offset = writeInt(type, sizes[0], offset, data);
60030    offset = writeInt(objOffset, sizes[1], offset, data);
60031    offset = writeInt(gen, sizes[2], offset, data);
60032  }
60033  await writeObject(xrefInfo.newRef, stream, buffer, {});
60034  buffer.push("startxref\n", baseOffset.toString(), "\n%%EOF\n");
60035}
60036function computeIDs(baseOffset, xrefInfo, newXref) {
60037  if (Array.isArray(xrefInfo.fileIds) && xrefInfo.fileIds.length > 0) {
60038    const md5 = computeMD5(baseOffset, xrefInfo);
60039    newXref.set("ID", [xrefInfo.fileIds[0] || md5, md5]);
60040  }
60041}
60042function getTrailerDict(xrefInfo, changes, useXrefStream) {
60043  const newXref = new Dict(null);
60044  newXref.setIfDefined("Prev", xrefInfo?.startXRef);
60045  const refForXrefTable = xrefInfo.newRef;
60046  if (useXrefStream) {
60047    changes.put(refForXrefTable, {
60048      data: ""
60049    });
60050    newXref.set("Size", refForXrefTable.num + 1);
60051    newXref.setIfName("Type", "XRef");
60052  } else {
60053    newXref.set("Size", refForXrefTable.num);
60054  }
60055  newXref.setIfDefined("Root", xrefInfo?.rootRef);
60056  newXref.setIfDefined("Info", xrefInfo?.infoRef);
60057  newXref.setIfDefined("Encrypt", xrefInfo?.encryptRef);
60058  return newXref;
60059}
60060async function writeChanges(changes, xref, buffer = []) {
60061  const newRefs = [];
60062  for (const [ref, {
60063    data,
60064    objStreamRef,
60065    index
60066  }] of changes.items()) {
60067    if (objStreamRef) {
60068      newRefs.push({
60069        ref,
60070        data,
60071        objStreamRef,
60072        index
60073      });
60074      continue;
60075    }
60076    if (data === null || typeof data === "string") {
60077      newRefs.push({
60078        ref,
60079        data
60080      });
60081      continue;
60082    }
60083    await writeObject(ref, data, buffer, xref);
60084    newRefs.push({
60085      ref,
60086      data: buffer.join("")
60087    });
60088    buffer.length = 0;
60089  }
60090  return newRefs.sort((a, b) => a.ref.num - b.ref.num);
60091}
60092async function incrementalUpdate({
60093  originalData,
60094  xrefInfo,
60095  changes,
60096  xref = null,
60097  hasXfa = false,
60098  xfaDatasetsRef = null,
60099  hasXfaDatasetsEntry = false,
60100  needAppearances,
60101  acroFormRef = null,
60102  acroForm = null,
60103  xfaData = null,
60104  useXrefStream = false
60105}) {
60106  await updateAcroform({
60107    xref,
60108    acroForm,
60109    acroFormRef,
60110    hasXfa,
60111    hasXfaDatasetsEntry,
60112    xfaDatasetsRef,
60113    needAppearances,
60114    changes
60115  });
60116  if (hasXfa) {
60117    updateXFA({
60118      xfaData,
60119      xfaDatasetsRef,
60120      changes,
60121      xref
60122    });
60123  }
60124  const newXref = getTrailerDict(xrefInfo, changes, useXrefStream);
60125  const buffer = [];
60126  const newRefs = await writeChanges(changes, xref, buffer);
60127  let baseOffset = originalData.length;
60128  const lastByte = originalData.at(-1);
60129  if (lastByte !== 0x0a && lastByte !== 0x0d) {
60130    buffer.push("\n");
60131    baseOffset += 1;
60132  }
60133  for (const {
60134    data
60135  } of newRefs) {
60136    if (data !== null) {
60137      buffer.push(data);
60138    }
60139  }
60140  await (useXrefStream ? getXRefStreamTable(xrefInfo, baseOffset, newRefs, newXref, buffer) : getXRefTable(xrefInfo, baseOffset, newRefs, newXref, buffer));
60141  const totalLength = originalData.length + Math.sumPrecise(buffer.map(str => str.length));
60142  const array = new Uint8Array(totalLength);
60143  array.set(originalData);
60144  let offset = originalData.length;
60145  for (const str of buffer) {
60146    offset = writeString(str, offset, array);
60147  }
60148  return array;
60149}
60150
60151;// ./src/core/editor/pdf_editor.js
60152
60153
60154
60155
60156
60157
60158
60159
60160const MAX_LEAVES_PER_PAGES_NODE = 16;
60161const MAX_IN_NAME_TREE_NODE = 64;
60162class PageData {
60163  constructor(page, documentData) {
60164    this.page = page;
60165    this.documentData = documentData;
60166    this.annotations = null;
60167    this.pointingNamedDestinations = null;
60168    documentData.pagesMap.put(page.ref, this);
60169  }
60170}
60171class DocumentData {
60172  constructor(document) {
60173    this.document = document;
60174    this.destinations = null;
60175    this.pageLabels = null;
60176    this.pagesMap = new RefSetCache();
60177    this.oldRefMapping = new RefSetCache();
60178    this.dedupNamedDestinations = new Map();
60179    this.usedNamedDestinations = new Set();
60180    this.postponedRefCopies = new RefSetCache();
60181    this.usedStructParents = new Set();
60182    this.oldStructParentMapping = new Map();
60183    this.structTreeRoot = null;
60184    this.parentTree = null;
60185    this.idTree = null;
60186    this.roleMap = null;
60187    this.classMap = null;
60188    this.namespaces = null;
60189    this.structTreeAF = null;
60190    this.structTreePronunciationLexicon = [];
60191    this.acroForm = null;
60192    this.acroFormDefaultAppearance = "";
60193    this.acroFormDefaultResources = null;
60194    this.acroFormQ = 0;
60195    this.hasSignatureAnnotations = false;
60196    this.fieldToParent = new RefSetCache();
60197    this.outline = null;
60198    this.embeddedFiles = null;
60199  }
60200}
60201class XRefWrapper {
60202  constructor(entries, getNewRef) {
60203    this.entries = entries;
60204    this._getNewRef = getNewRef;
60205  }
60206  fetch(ref) {
60207    return ref instanceof Ref ? this.entries[ref.num] : ref;
60208  }
60209  fetchIfRefAsync(ref) {
60210    return Promise.resolve(this.fetch(ref));
60211  }
60212  fetchIfRef(ref) {
60213    return this.fetch(ref);
60214  }
60215  fetchAsync(ref) {
60216    return Promise.resolve(this.fetch(ref));
60217  }
60218  getNewTemporaryRef() {
60219    return this._getNewRef();
60220  }
60221}
60222class PDFEditor {
60223  hasSingleFile = false;
60224  isSingleFile = false;
60225  #newAnnotationsParams = null;
60226  currentDocument = null;
60227  oldPages = [];
60228  newPages = [];
60229  xref = [null];
60230  xrefWrapper = new XRefWrapper(this.xref, () => this.newRef);
60231  newRefCount = 1;
60232  namesDict = null;
60233  version = "1.7";
60234  pageLabels = null;
60235  namedDestinations = new Map();
60236  parentTree = new Map();
60237  structTreeKids = [];
60238  idTree = new Map();
60239  classMap = new Dict();
60240  roleMap = new Dict();
60241  namespaces = new Map();
60242  structTreeAF = [];
60243  structTreePronunciationLexicon = [];
60244  fields = [];
60245  acroFormDefaultAppearance = "";
60246  acroFormDefaultResources = null;
60247  acroFormNeedAppearances = false;
60248  acroFormSigFlags = 0;
60249  acroFormCalculationOrder = null;
60250  acroFormQ = 0;
60251  outlineItems = null;
60252  embeddedFiles = new Map();
60253  constructor({
60254    useObjectStreams = true,
60255    title = "",
60256    author = ""
60257  } = {}) {
60258    [this.rootRef, this.rootDict] = this.newDict;
60259    [this.infoRef, this.infoDict] = this.newDict;
60260    [this.pagesRef, this.pagesDict] = this.newDict;
60261    this.useObjectStreams = useObjectStreams;
60262    this.objStreamRefs = useObjectStreams ? new Set() : null;
60263    this.title = title;
60264    this.author = author;
60265  }
60266  get newRef() {
60267    const ref = Ref.get(this.newRefCount++, 0);
60268    return ref;
60269  }
60270  get newDict() {
60271    const ref = this.newRef;
60272    const dict = this.xref[ref.num] = new Dict();
60273    return [ref, dict];
60274  }
60275  async #cloneObject(obj, xref) {
60276    const ref = this.newRef;
60277    this.xref[ref.num] = await this.#collectDependencies(obj, true, xref);
60278    return ref;
60279  }
60280  cloneDict(dict) {
60281    const newDict = dict.clone();
60282    newDict.xref = this.xrefWrapper;
60283    return newDict;
60284  }
60285  async #collectDependencies(obj, mustClone, xref) {
60286    if (obj instanceof Ref) {
60287      const {
60288        currentDocument: {
60289          oldRefMapping
60290        }
60291      } = this;
60292      let newRef = oldRefMapping.get(obj);
60293      if (newRef) {
60294        return newRef;
60295      }
60296      const oldRef = obj;
60297      obj = await xref.fetchAsync(oldRef);
60298      if (typeof obj === "number") {
60299        return obj;
60300      }
60301      newRef = this.newRef;
60302      oldRefMapping.put(oldRef, newRef);
60303      this.xref[newRef.num] = await this.#collectDependencies(obj, true, xref);
60304      return newRef;
60305    }
60306    const promises = [];
60307    const {
60308      currentDocument: {
60309        postponedRefCopies
60310      }
60311    } = this;
60312    if (Array.isArray(obj)) {
60313      if (mustClone) {
60314        obj = obj.slice();
60315      }
60316      for (let i = 0, ii = obj.length; i < ii; i++) {
60317        const postponedActions = obj[i] instanceof Ref && postponedRefCopies.get(obj[i]);
60318        if (postponedActions) {
60319          postponedActions.push(ref => obj[i] = ref);
60320          continue;
60321        }
60322        promises.push(this.#collectDependencies(obj[i], true, xref).then(newObj => obj[i] = newObj));
60323      }
60324      await Promise.all(promises);
60325      return obj;
60326    }
60327    let dict;
60328    if (obj instanceof BaseStream) {
60329      ({
60330        dict
60331      } = obj = obj.getOriginalStream().clone());
60332      dict.xref = this.xrefWrapper;
60333    } else if (obj instanceof Dict) {
60334      if (mustClone) {
60335        obj = obj.clone();
60336        obj.xref = this.xrefWrapper;
60337      }
60338      dict = obj;
60339    }
60340    if (dict) {
60341      for (const [key, rawObj] of dict.getRawEntries()) {
60342        const postponedActions = rawObj instanceof Ref && postponedRefCopies.get(rawObj);
60343        if (postponedActions) {
60344          postponedActions.push(ref => dict.set(key, ref));
60345          continue;
60346        }
60347        promises.push(this.#collectDependencies(rawObj, true, xref).then(newObj => dict.set(key, newObj)));
60348      }
60349      await Promise.all(promises);
60350    }
60351    return obj;
60352  }
60353  async #cloneStructTreeNode(parentStructRef, node, xref, removedStructElements, dedupIDs, dedupClasses, dedupRoles, visited = new RefSet()) {
60354    const {
60355      currentDocument: {
60356        pagesMap,
60357        oldRefMapping
60358      }
60359    } = this;
60360    const pg = node.getRaw("Pg");
60361    if (pg instanceof Ref && !pagesMap.has(pg)) {
60362      return null;
60363    }
60364    let kids;
60365    const k = kids = node.getRaw("K");
60366    if (k instanceof Ref) {
60367      if (visited.has(k)) {
60368        return null;
60369      }
60370      kids = await xref.fetchAsync(k);
60371      if (!Array.isArray(kids)) {
60372        kids = [k];
60373      }
60374    }
60375    kids = Array.isArray(kids) ? kids : [kids];
60376    const newKids = [];
60377    const structElemIndices = [];
60378    for (let kid of kids) {
60379      const kidRef = kid instanceof Ref ? kid : null;
60380      if (kidRef) {
60381        if (visited.has(kidRef)) {
60382          continue;
60383        }
60384        visited.put(kidRef);
60385        kid = await xref.fetchAsync(kidRef);
60386      }
60387      if (typeof kid === "number") {
60388        newKids.push(kid);
60389        continue;
60390      }
60391      if (!(kid instanceof Dict)) {
60392        continue;
60393      }
60394      const pgRef = kid.getRaw("Pg");
60395      if (pgRef instanceof Ref && !pagesMap.has(pgRef)) {
60396        continue;
60397      }
60398      const type = kid.get("Type");
60399      if (!type || isName(type, "StructElem")) {
60400        let setAsSpan = false;
60401        if (kidRef && removedStructElements.has(kidRef)) {
60402          if (!isName(kid.get("S"), "Link")) {
60403            continue;
60404          }
60405          setAsSpan = true;
60406        }
60407        const newKidRef = await this.#cloneStructTreeNode(kidRef, kid, xref, removedStructElements, dedupIDs, dedupClasses, dedupRoles, visited);
60408        if (newKidRef) {
60409          structElemIndices.push(newKids.length);
60410          newKids.push(newKidRef);
60411          if (kidRef) {
60412            oldRefMapping.put(kidRef, newKidRef);
60413          }
60414          if (setAsSpan) {
60415            this.xref[newKidRef.num].setIfName("S", "Span");
60416          }
60417        }
60418        continue;
60419      }
60420      if (isName(type, "OBJR")) {
60421        if (!kidRef) {
60422          continue;
60423        }
60424        const newKidRef = oldRefMapping.get(kidRef);
60425        if (!newKidRef) {
60426          continue;
60427        }
60428        const newKid = this.xref[newKidRef.num];
60429        const objRef = newKid.getRaw("Obj");
60430        if (objRef instanceof Ref) {
60431          const obj = this.xref[objRef.num];
60432          if (obj instanceof Dict && !obj.has("StructParent") && parentStructRef) {
60433            const structParent = this.parentTree.size;
60434            this.parentTree.set(structParent, [oldRefMapping, parentStructRef]);
60435            obj.set("StructParent", structParent);
60436          }
60437        }
60438        newKids.push(newKidRef);
60439        continue;
60440      }
60441      if (isName(type, "MCR")) {
60442        const newKid = await this.#collectDependencies(kidRef || kid, true, xref);
60443        newKids.push(newKid);
60444        continue;
60445      }
60446      if (kidRef) {
60447        const newKidRef = await this.#collectDependencies(kidRef, true, xref);
60448        newKids.push(newKidRef);
60449      }
60450    }
60451    if (kids.length !== 0 && newKids.length === 0) {
60452      return null;
60453    }
60454    const newNodeRef = this.newRef;
60455    const newNode = this.xref[newNodeRef.num] = this.cloneDict(node);
60456    newNode.delete("ID");
60457    newNode.delete("C");
60458    newNode.delete("K");
60459    newNode.delete("P");
60460    newNode.delete("S");
60461    await this.#collectDependencies(newNode, false, xref);
60462    const classNames = node.get("C");
60463    if (classNames instanceof Name) {
60464      const newClassName = dedupClasses.get(classNames.name);
60465      if (newClassName) {
60466        newNode.set("C", Name.get(newClassName));
60467      } else {
60468        newNode.set("C", classNames);
60469      }
60470    } else if (Array.isArray(classNames)) {
60471      const newClassNames = [];
60472      for (const className of classNames) {
60473        if (className instanceof Name) {
60474          const newClassName = dedupClasses.get(className.name);
60475          if (newClassName) {
60476            newClassNames.push(Name.get(newClassName));
60477          } else {
60478            newClassNames.push(className);
60479          }
60480        }
60481      }
60482      newNode.set("C", newClassNames);
60483    }
60484    const roleName = node.get("S");
60485    if (roleName instanceof Name) {
60486      const newRoleName = dedupRoles.get(roleName.name);
60487      if (newRoleName) {
60488        newNode.set("S", Name.get(newRoleName));
60489      } else {
60490        newNode.set("S", roleName);
60491      }
60492    }
60493    const id = node.get("ID");
60494    if (typeof id === "string") {
60495      const stringId = stringToPDFString(id, false);
60496      const newId = dedupIDs.get(stringId);
60497      if (newId) {
60498        newNode.set("ID", stringToAsciiOrUTF16BE(newId));
60499      } else {
60500        newNode.set("ID", id);
60501      }
60502    }
60503    let attributes = newNode.get("A");
60504    if (attributes) {
60505      if (!Array.isArray(attributes)) {
60506        attributes = [attributes];
60507      }
60508      for (let attr of attributes) {
60509        attr = this.xrefWrapper.fetch(attr);
60510        if (isName(attr.get("O"), "Table") && attr.has("Headers")) {
60511          const headers = this.xrefWrapper.fetch(attr.getRaw("Headers"));
60512          if (Array.isArray(headers)) {
60513            for (let i = 0, ii = headers.length; i < ii; i++) {
60514              const newId = dedupIDs.get(stringToPDFString(headers[i], false));
60515              if (newId) {
60516                headers[i] = newId;
60517              }
60518            }
60519          }
60520        }
60521      }
60522    }
60523    for (const index of structElemIndices) {
60524      const structElemRef = newKids[index];
60525      const structElem = this.xref[structElemRef.num];
60526      structElem.set("P", newNodeRef);
60527    }
60528    if (newKids.length === 1) {
60529      newNode.set("K", newKids[0]);
60530    } else if (newKids.length > 1) {
60531      newNode.set("K", newKids);
60532    }
60533    return newNodeRef;
60534  }
60535  #getFilteredPageIndices({
60536    document,
60537    includePages,
60538    excludePages
60539  }) {
60540    if (!document) {
60541      return [];
60542    }
60543    let keptIndices, keptRanges, deletedIndices, deletedRanges;
60544    for (const page of includePages || []) {
60545      if (Array.isArray(page)) {
60546        (keptRanges ||= []).push(page);
60547      } else {
60548        (keptIndices ||= new Set()).add(page);
60549      }
60550    }
60551    for (const page of excludePages || []) {
60552      if (Array.isArray(page)) {
60553        (deletedRanges ||= []).push(page);
60554      } else {
60555        (deletedIndices ||= new Set()).add(page);
60556      }
60557    }
60558    const indices = [];
60559    for (let i = 0, ii = document.numPages; i < ii; i++) {
60560      if (deletedIndices?.has(i)) {
60561        continue;
60562      }
60563      if (deletedRanges) {
60564        let isDeleted = false;
60565        for (const [start, end] of deletedRanges) {
60566          if (i >= start && i <= end) {
60567            isDeleted = true;
60568            break;
60569          }
60570        }
60571        if (isDeleted) {
60572          continue;
60573        }
60574      }
60575      let takePage = false;
60576      if (keptIndices) {
60577        takePage = keptIndices.has(i);
60578      }
60579      if (!takePage && keptRanges) {
60580        for (const [start, end] of keptRanges) {
60581          if (i >= start && i <= end) {
60582            takePage = true;
60583            break;
60584          }
60585        }
60586      }
60587      if (!takePage && !keptIndices && !keptRanges) {
60588        takePage = true;
60589      }
60590      if (takePage) {
60591        indices.push(i);
60592      }
60593    }
60594    return indices;
60595  }
60596  #resolveInsertAfterIndices(pageInfos) {
60597    const sequence = [];
60598    const insertAfterList = [];
60599    for (let i = 0; i < pageInfos.length; i++) {
60600      const info = pageInfos[i];
60601      if (!info.document || info.pageIndices) {
60602        continue;
60603      }
60604      const count = this.#getFilteredPageIndices(info).length;
60605      if (info.insertAfter === undefined) {
60606        for (let j = 0; j < count; j++) {
60607          sequence.push(i);
60608        }
60609      } else {
60610        insertAfterList.push({
60611          i,
60612          insertAfter: info.insertAfter,
60613          count
60614        });
60615      }
60616    }
60617    insertAfterList.sort((a, b) => a.insertAfter - b.insertAfter);
60618    if (insertAfterList.length > 0) {
60619      for (const info of pageInfos) {
60620        if (!info.document || !info.pageIndices) {
60621          continue;
60622        }
60623        const filteredCount = this.#getFilteredPageIndices(info).length;
60624        if (info.pageIndices.length < filteredCount) {
60625          throw new Error("extractPages: partial pageIndices cannot be combined with insertAfter entries.");
60626        }
60627      }
60628    }
60629    const hasExplicitLayout = insertAfterList.length > 0 && pageInfos.some(info => info.document && info.pageIndices);
60630    if (sequence.length === 0 && hasExplicitLayout) {
60631      const updatedPageInfos = pageInfos.slice();
60632      let maxExistingPos = -1;
60633      for (const info of pageInfos) {
60634        if (info.document && info.pageIndices) {
60635          for (const idx of info.pageIndices) {
60636            if (idx > maxExistingPos) {
60637              maxExistingPos = idx;
60638            }
60639          }
60640        }
60641      }
60642      let offset = 0;
60643      for (const {
60644        i,
60645        insertAfter,
60646        count
60647      } of insertAfterList) {
60648        const threshold = Math.min(Math.max(insertAfter, -1) + offset, maxExistingPos);
60649        for (let j = 0; j < updatedPageInfos.length; j++) {
60650          const existingInfo = updatedPageInfos[j];
60651          if (!existingInfo.document || !existingInfo.pageIndices || existingInfo.pageIndices.every(idx => idx <= threshold)) {
60652            continue;
60653          }
60654          updatedPageInfos[j] = {
60655            ...existingInfo,
60656            pageIndices: existingInfo.pageIndices.map(idx => idx > threshold ? idx + count : idx)
60657          };
60658        }
60659        const insertedIndices = [];
60660        for (let k = 0; k < count; k++) {
60661          insertedIndices.push(threshold + 1 + k);
60662        }
60663        const newInfo = {
60664          ...updatedPageInfos[i],
60665          pageIndices: insertedIndices
60666        };
60667        delete newInfo.insertAfter;
60668        updatedPageInfos[i] = newInfo;
60669        offset += count;
60670        maxExistingPos += count;
60671      }
60672      return updatedPageInfos;
60673    }
60674    let offset = 0;
60675    for (const {
60676      i,
60677      insertAfter,
60678      count
60679    } of insertAfterList) {
60680      const insertPos = insertAfter + 1 + offset;
60681      sequence.splice(insertPos, 0, ...new Array(count).fill(i));
60682      offset += count;
60683    }
60684    const pageIndicesArr = new Array(pageInfos.length);
60685    for (let pos = 0; pos < sequence.length; pos++) {
60686      const infoIdx = sequence[pos];
60687      (pageIndicesArr[infoIdx] ||= []).push(pos);
60688    }
60689    return pageInfos.map((info, i) => {
60690      if (!info.document || info.pageIndices) {
60691        return info;
60692      }
60693      const newInfo = {
60694        ...info,
60695        pageIndices: pageIndicesArr[i] || []
60696      };
60697      delete newInfo.insertAfter;
60698      return newInfo;
60699    });
60700  }
60701  async extractPages(pageInfos, annotationStorage, handler, task) {
60702    if (pageInfos.some(info => info.insertAfter !== undefined)) {
60703      pageInfos = this.#resolveInsertAfterIndices(pageInfos);
60704    }
60705    const promises = [];
60706    let newIndex = 0;
60707    this.isSingleFile = pageInfos.length === 1 || pageInfos.every(info => info.document === pageInfos[0].document);
60708    this.hasSingleFile = pageInfos.length === 1;
60709    const allDocumentData = [];
60710    if (annotationStorage) {
60711      this.#newAnnotationsParams = {
60712        handler,
60713        task,
60714        newAnnotationsByPage: getNewAnnotationsMap(annotationStorage),
60715        imagesPromises: AnnotationFactory.generateImages(annotationStorage.values(), this.xrefWrapper, true)
60716      };
60717    }
60718    for (const {
60719      document,
60720      includePages,
60721      excludePages,
60722      pageIndices
60723    } of pageInfos) {
60724      if (!document) {
60725        continue;
60726      }
60727      if (pageIndices) {
60728        newIndex = -1;
60729      }
60730      const documentData = new DocumentData(document);
60731      allDocumentData.push(documentData);
60732      promises.push(this.#collectDocumentData(documentData));
60733      let pageIndex = 0;
60734      for (const i of this.#getFilteredPageIndices({
60735        document,
60736        includePages,
60737        excludePages
60738      })) {
60739        let newPageIndex;
60740        if (pageIndices) {
60741          newPageIndex = pageIndices[pageIndex++];
60742        }
60743        if (newPageIndex === undefined) {
60744          if (newIndex !== -1) {
60745            newPageIndex = newIndex++;
60746          } else {
60747            for (newPageIndex = 0; this.oldPages[newPageIndex] !== undefined; newPageIndex++) {}
60748          }
60749        }
60750        this.oldPages[newPageIndex] = null;
60751        promises.push(document.getPage(i).then(page => {
60752          this.oldPages[newPageIndex] = new PageData(page, documentData);
60753        }));
60754      }
60755    }
60756    await Promise.all(promises);
60757    promises.length = 0;
60758    this.#collectValidDestinations(allDocumentData);
60759    this.#collectOutlineDestinations(allDocumentData);
60760    this.#collectPageLabels();
60761    for (const page of this.oldPages) {
60762      promises.push(this.#postCollectPageData(page));
60763    }
60764    await Promise.all(promises);
60765    this.#findDuplicateNamedDestinations();
60766    this.#setPostponedRefCopies(allDocumentData);
60767    for (let i = 0, ii = this.oldPages.length; i < ii; i++) {
60768      this.newPages[i] = await this.#makePageCopy(i, null);
60769    }
60770    this.#fixPostponedRefCopies(allDocumentData);
60771    await this.#mergeStructTrees(allDocumentData);
60772    await this.#mergeAcroForms(allDocumentData);
60773    this.#buildOutline(allDocumentData);
60774    await this.#collectEmbeddedFiles(allDocumentData);
60775    return this.writePDF();
60776  }
60777  async #collectDocumentData(documentData) {
60778    const {
60779      document: {
60780        pdfManager,
60781        xref
60782      }
60783    } = documentData;
60784    await Promise.all([pdfManager.ensureCatalog("destinations").then(destinations => documentData.destinations = destinations), pdfManager.ensureCatalog("rawPageLabels").then(pageLabels => documentData.pageLabels = pageLabels), pdfManager.ensureCatalog("structTreeRoot").then(structTreeRoot => documentData.structTreeRoot = structTreeRoot), pdfManager.ensureCatalog("acroForm").then(acroForm => documentData.acroForm = acroForm), pdfManager.ensureCatalog("documentOutlineForEditor").then(outline => documentData.outline = outline), pdfManager.ensureCatalog("rawEmbeddedFiles").then(ef => documentData.embeddedFiles = ef)]);
60785    const structTreeRoot = documentData.structTreeRoot;
60786    if (structTreeRoot) {
60787      const rootDict = structTreeRoot.dict;
60788      const parentTree = rootDict.get("ParentTree");
60789      if (parentTree) {
vendor: 12,434 bytes, lines 60790-61173
60790        const numberTree = new NumberTree(parentTree, xref);
60791        documentData.parentTree = numberTree.getAll(true);
60792      }
60793      const idTree = rootDict.get("IDTree");
60794      if (idTree) {
60795        const nameTree = new NameTree(idTree, xref);
60796        documentData.idTree = nameTree.getAll(true);
60797      }
60798      documentData.roleMap = rootDict.get("RoleMap") || null;
60799      documentData.classMap = rootDict.get("ClassMap") || null;
60800      let namespaces = rootDict.get("Namespaces") || null;
60801      if (namespaces && !Array.isArray(namespaces)) {
60802        namespaces = [namespaces];
60803      }
60804      documentData.namespaces = namespaces;
60805      documentData.structTreeAF = rootDict.get("AF") || null;
60806      documentData.structTreePronunciationLexicon = rootDict.get("PronunciationLexicon") || null;
60807    }
60808  }
60809  async #postCollectPageData(pageData) {
60810    const {
60811      page: {
60812        xref,
60813        annotations
60814      },
60815      documentData: {
60816        pagesMap,
60817        destinations,
60818        usedNamedDestinations,
60819        fieldToParent
60820      }
60821    } = pageData;
60822    if (!annotations) {
60823      return;
60824    }
60825    const promises = [];
60826    let newAnnotations = [];
60827    let newIndex = 0;
60828    let {
60829      hasSignatureAnnotations
60830    } = pageData.documentData;
60831    for (const annotationRef of annotations) {
60832      const newAnnotationIndex = newIndex++;
60833      promises.push(xref.fetchIfRefAsync(annotationRef).then(async annotationDict => {
60834        if (!isName(annotationDict.get("Subtype"), "Link")) {
60835          if (isName(annotationDict.get("Subtype"), "Widget")) {
60836            hasSignatureAnnotations ||= isName(annotationDict.get("FT"), "Sig");
60837            const parentRef = annotationDict.get("Parent") || null;
60838            annotationDict.delete("Parent");
60839            fieldToParent.put(annotationRef, parentRef);
60840          }
60841          newAnnotations[newAnnotationIndex] = annotationRef;
60842          return;
60843        }
60844        const action = annotationDict.get("A");
60845        const dest = action instanceof Dict ? action.get("D") : annotationDict.get("Dest");
60846        if (!dest || Array.isArray(dest) && (!(dest[0] instanceof Ref) || pagesMap.has(dest[0]))) {
60847          newAnnotations[newAnnotationIndex] = annotationRef;
60848        } else if (typeof dest === "string") {
60849          const destString = stringToPDFString(dest, true);
60850          if (destinations.has(destString)) {
60851            newAnnotations[newAnnotationIndex] = annotationRef;
60852            usedNamedDestinations.add(destString);
60853          }
60854        }
60855      }));
60856    }
60857    await Promise.all(promises);
60858    newAnnotations = newAnnotations.filter(annot => !!annot);
60859    pageData.annotations = newAnnotations.length > 0 ? newAnnotations : null;
60860    pageData.documentData.hasSignatureAnnotations ||= hasSignatureAnnotations;
60861  }
60862  #setPostponedRefCopies(allDocumentData) {
60863    for (const {
60864      postponedRefCopies,
60865      pagesMap
60866    } of allDocumentData) {
60867      for (const oldPageRef of pagesMap.keys()) {
60868        postponedRefCopies.put(oldPageRef, []);
60869      }
60870    }
60871  }
60872  #fixPostponedRefCopies(allDocumentData) {
60873    for (const {
60874      postponedRefCopies,
60875      oldRefMapping
60876    } of allDocumentData) {
60877      for (const [oldRef, actions] of postponedRefCopies.items()) {
60878        const newRef = oldRefMapping.get(oldRef);
60879        for (const action of actions) {
60880          action(newRef);
60881        }
60882      }
60883      postponedRefCopies.clear();
60884    }
60885  }
60886  #visitObject(obj, callback, visited = new RefSet()) {
60887    if (obj instanceof Ref) {
60888      if (!visited.has(obj)) {
60889        visited.put(obj);
60890        this.#visitObject(this.xref[obj.num], callback, visited);
60891      }
60892      return;
60893    }
60894    if (Array.isArray(obj)) {
60895      for (const item of obj) {
60896        this.#visitObject(item, callback, visited);
60897      }
60898      return;
60899    }
60900    let dict;
60901    if (obj instanceof BaseStream) {
60902      ({
60903        dict
60904      } = obj);
60905    } else if (obj instanceof Dict) {
60906      dict = obj;
60907    }
60908    if (dict) {
60909      callback(dict);
60910      for (const value of dict.getRawValues()) {
60911        this.#visitObject(value, callback, visited);
60912      }
60913    }
60914  }
60915  async #mergeStructTrees(allDocumentData) {
60916    let newStructParentId = 0;
60917    const {
60918      parentTree: newParentTree
60919    } = this;
60920    for (let i = 0, ii = this.newPages.length; i < ii; i++) {
60921      const {
60922        documentData: {
60923          parentTree,
60924          oldRefMapping,
60925          oldStructParentMapping,
60926          usedStructParents,
60927          document: {
60928            xref
60929          }
60930        }
60931      } = this.oldPages[i];
60932      if (!parentTree) {
60933        continue;
60934      }
60935      const pageRef = this.newPages[i];
60936      const pageDict = this.xref[pageRef.num];
60937      const visited = new RefSet();
60938      visited.put(pageRef);
60939      this.#visitObject(pageDict, dict => {
60940        const structParent = dict.get("StructParent") ?? dict.get("StructParents");
60941        if (typeof structParent !== "number") {
60942          return;
60943        }
60944        usedStructParents.add(structParent);
60945        let parent = parentTree.get(structParent);
60946        const parentRef = parent instanceof Ref ? parent : null;
60947        if (parentRef) {
60948          const array = xref.fetch(parentRef);
60949          if (Array.isArray(array)) {
60950            parent = array;
60951          }
60952        }
60953        if (Array.isArray(parent) && parent.every(ref => ref === null)) {
60954          parent = null;
60955        }
60956        if (!parent) {
60957          if (dict.has("StructParent")) {
60958            dict.delete("StructParent");
60959          } else {
60960            dict.delete("StructParents");
60961          }
60962          return;
60963        }
60964        let newStructParent = oldStructParentMapping.get(structParent);
60965        if (newStructParent === undefined) {
60966          newStructParent = newStructParentId++;
60967          oldStructParentMapping.set(structParent, newStructParent);
60968          newParentTree.set(newStructParent, [oldRefMapping, parent]);
60969        }
60970        if (dict.has("StructParent")) {
60971          dict.set("StructParent", newStructParent);
60972        } else {
60973          dict.set("StructParents", newStructParent);
60974        }
60975      }, visited);
60976    }
60977    const {
60978      structTreeKids,
60979      idTree: newIdTree,
60980      classMap: newClassMap,
60981      roleMap: newRoleMap,
60982      namespaces: newNamespaces,
60983      structTreeAF: newStructTreeAF,
60984      structTreePronunciationLexicon: newStructTreePronunciationLexicon
60985    } = this;
60986    for (const documentData of allDocumentData) {
60987      const {
60988        document: {
60989          xref
60990        },
60991        oldRefMapping,
60992        parentTree,
60993        usedStructParents,
60994        structTreeRoot,
60995        idTree,
60996        classMap,
60997        roleMap,
60998        namespaces,
60999        structTreeAF,
61000        structTreePronunciationLexicon
61001      } = documentData;
61002      if (!structTreeRoot) {
61003        continue;
61004      }
61005      this.currentDocument = documentData;
61006      const removedStructElements = new RefSet();
61007      for (const [key, value] of parentTree || []) {
61008        if (!usedStructParents.has(key) && value instanceof Ref) {
61009          removedStructElements.put(value);
61010        }
61011      }
61012      const dedupIDs = new Map();
61013      for (const [id, nodeRef] of idTree || []) {
61014        let _id = id;
61015        if (newIdTree.has(id)) {
61016          for (let i = 1;; i++) {
61017            const newId = `${id}_${i}`;
61018            if (!newIdTree.has(newId)) {
61019              dedupIDs.set(id, newId);
61020              _id = newId;
61021              break;
61022            }
61023          }
61024        }
61025        newIdTree.set(_id, nodeRef);
61026      }
61027      const dedupClasses = new Map();
61028      if (classMap?.size > 0) {
61029        for (let [className, classDict] of classMap) {
61030          classDict = await this.#collectDependencies(classDict, true, xref);
61031          if (newClassMap.has(className)) {
61032            for (let i = 1;; i++) {
61033              const newClassName = `${className}_${i}`;
61034              if (!newClassMap.has(newClassName)) {
61035                dedupClasses.set(className, newClassName);
61036                className = newClassName;
61037                break;
61038              }
61039            }
61040          }
61041          newClassMap.set(className, classDict);
61042        }
61043      }
61044      const dedupRoles = new Map();
61045      if (roleMap?.size > 0) {
61046        for (const [roleName, mappedName] of roleMap) {
61047          const newMappedName = newRoleMap.get(roleName);
61048          if (!newMappedName) {
61049            newRoleMap.set(roleName, mappedName);
61050            continue;
61051          }
61052          if (newMappedName === mappedName) {
61053            continue;
61054          }
61055          for (let i = 1;; i++) {
61056            const newRoleName = `${roleName}_${i}`;
61057            if (!newRoleMap.has(newRoleName)) {
61058              dedupRoles.set(roleName, newRoleName);
61059              newRoleMap.set(newRoleName, mappedName);
61060              break;
61061            }
61062          }
61063        }
61064      }
61065      if (namespaces?.length > 0) {
61066        for (const namespaceRef of namespaces) {
61067          const namespace = await xref.fetchIfRefAsync(namespaceRef);
61068          let ns = namespace.get("NS");
61069          if (!ns || newNamespaces.has(ns)) {
61070            continue;
61071          }
61072          ns = stringToPDFString(ns, false);
61073          const newNamespace = await this.#collectDependencies(namespace, true, xref);
61074          newNamespaces.set(ns, newNamespace);
61075        }
61076      }
61077      if (structTreeAF) {
61078        for (const afRef of structTreeAF) {
61079          newStructTreeAF.push(await this.#collectDependencies(afRef, true, xref));
61080        }
61081      }
61082      if (structTreePronunciationLexicon) {
61083        for (const lexiconRef of structTreePronunciationLexicon) {
61084          newStructTreePronunciationLexicon.push(await this.#collectDependencies(lexiconRef, true, xref));
61085        }
61086      }
61087      let kids = structTreeRoot.dict.get("K");
61088      if (!kids) {
61089        continue;
61090      }
61091      kids = Array.isArray(kids) ? kids : [kids];
61092      for (let kid of kids) {
61093        const kidRef = kid instanceof Ref ? kid : null;
61094        if (kidRef && removedStructElements.has(kidRef)) {
61095          continue;
61096        }
61097        kid = await xref.fetchIfRefAsync(kid);
61098        const newKidRef = await this.#cloneStructTreeNode(kidRef, kid, xref, removedStructElements, dedupIDs, dedupClasses, dedupRoles);
61099        if (newKidRef) {
61100          structTreeKids.push(newKidRef);
61101        }
61102      }
61103      for (const [id, nodeRef] of idTree || []) {
61104        const newNodeRef = nodeRef instanceof Ref && oldRefMapping.get(nodeRef);
61105        const newId = dedupIDs.get(id) || id;
61106        if (newNodeRef) {
61107          newIdTree.set(newId, newNodeRef);
61108        } else {
61109          newIdTree.delete(newId);
61110        }
61111      }
61112    }
61113    for (const [key, [oldRefMapping, parent]] of newParentTree) {
61114      if (!parent) {
61115        newParentTree.delete(key);
61116        continue;
61117      }
61118      if (!Array.isArray(parent)) {
61119        const newParent = oldRefMapping.get(parent);
61120        if (newParent === undefined) {
61121          newParentTree.delete(key);
61122        } else {
61123          newParentTree.set(key, newParent);
61124        }
61125        continue;
61126      }
61127      const newParents = parent.map(ref => ref instanceof Ref && oldRefMapping.get(ref) || null);
61128      if (newParents.length === 0 || newParents.every(ref => ref === null)) {
61129        newParentTree.delete(key);
61130        continue;
61131      }
61132      newParentTree.set(key, newParents);
61133    }
61134    this.currentDocument = null;
61135  }
61136  #collectValidDestinations(allDocumentData) {
61137    for (const documentData of allDocumentData) {
61138      if (!documentData.destinations) {
61139        continue;
61140      }
61141      const {
61142        destinations,
61143        pagesMap
61144      } = documentData;
61145      const newDestinations = documentData.destinations = new Map();
61146      for (const [key, dest] of Object.entries(destinations)) {
61147        const pageRef = dest[0];
61148        const pageData = pageRef instanceof Ref && pagesMap.get(pageRef);
61149        if (!pageData) {
61150          continue;
61151        }
61152        (pageData.pointingNamedDestinations ||= new Set()).add(key);
61153        newDestinations.set(key, dest);
61154      }
61155    }
61156  }
61157  #findDuplicateNamedDestinations() {
61158    const {
61159      namedDestinations
61160    } = this;
61161    const getUniqueDestinationName = name => {
61162      if (!namedDestinations.has(name)) {
61163        return name;
61164      }
61165      for (let i = 1;; i++) {
61166        const dedupedName = `${name}_${i}`;
61167        if (!namedDestinations.has(dedupedName)) {
61168          return dedupedName;
61169        }
61170      }
61171    };
61172    for (let i = 0, ii = this.oldPages.length; i < ii; i++) {
61173      const page = this.oldPages[i];
vendor: 11,746 bytes, lines 61173-61537
61173
61174      const {
61175        documentData: {
61176          destinations,
61177          dedupNamedDestinations,
61178          usedNamedDestinations
61179        }
61180      } = page;
61181      let {
61182        pointingNamedDestinations
61183      } = page;
61184      if (!pointingNamedDestinations) {
61185        continue;
61186      }
61187      page.pointingNamedDestinations = pointingNamedDestinations = pointingNamedDestinations.intersection(usedNamedDestinations);
61188      for (const pointingDest of pointingNamedDestinations) {
61189        if (!usedNamedDestinations.has(pointingDest)) {
61190          continue;
61191        }
61192        const dest = destinations.get(pointingDest).slice();
61193        if (!namedDestinations.has(pointingDest)) {
61194          namedDestinations.set(pointingDest, dest);
61195          continue;
61196        }
61197        const newName = getUniqueDestinationName(`${pointingDest}_p${i + 1}`);
61198        dedupNamedDestinations.set(pointingDest, newName);
61199        namedDestinations.set(newName, dest);
61200      }
61201    }
61202  }
61203  #fixNamedDestinations(annotations, dedupNamedDestinations) {
61204    if (dedupNamedDestinations.size === 0) {
61205      return;
61206    }
61207    const fixDestination = (dict, key, dest) => {
61208      if (typeof dest === "string") {
61209        dict.set(key, dedupNamedDestinations.get(stringToPDFString(dest, true)) || dest);
61210      }
61211    };
61212    for (const annotRef of annotations) {
61213      const annotDict = this.xref[annotRef.num];
61214      if (!isName(annotDict.get("Subtype"), "Link")) {
61215        continue;
61216      }
61217      const action = annotDict.get("A");
61218      if (action instanceof Dict && action.has("D")) {
61219        const dest = action.get("D");
61220        fixDestination(action, "D", dest);
61221        continue;
61222      }
61223      const dest = annotDict.get("Dest");
61224      fixDestination(annotDict, "Dest", dest);
61225    }
61226  }
61227  #collectOutlineDestinations(allDocumentData) {
61228    const collect = (items, destinations, usedNamedDestinations) => {
61229      for (const item of items) {
61230        if (typeof item.dest === "string" && destinations?.has(item.dest)) {
61231          usedNamedDestinations.add(item.dest);
61232        }
61233        if (item.items.length > 0) {
61234          collect(item.items, destinations, usedNamedDestinations);
61235        }
61236      }
61237    };
61238    for (const documentData of allDocumentData) {
61239      const {
61240        outline,
61241        destinations,
61242        usedNamedDestinations
61243      } = documentData;
61244      if (outline?.length) {
61245        collect(outline, destinations, usedNamedDestinations);
61246      }
61247    }
61248  }
61249  #isValidOutlineDest(item, documentData) {
61250    const {
61251      dest,
61252      action,
61253      url,
61254      unsafeUrl,
61255      attachment,
61256      setOCGState
61257    } = item;
61258    if (action || url || unsafeUrl || attachment || setOCGState) {
61259      return true;
61260    }
61261    if (!dest) {
61262      return false;
61263    }
61264    if (typeof dest === "string") {
61265      const name = documentData.dedupNamedDestinations.get(dest) || dest;
61266      return this.namedDestinations.has(name);
61267    }
61268    if (Array.isArray(dest) && dest[0] instanceof Ref) {
61269      return !!documentData.oldRefMapping.get(dest[0]);
61270    }
61271    return false;
61272  }
61273  #filterOutlineItems(items, documentData) {
61274    const result = [];
61275    for (const item of items) {
61276      const filteredChildren = this.#filterOutlineItems(item.items, documentData);
61277      const hasValidOwnDest = this.#isValidOutlineDest(item, documentData);
61278      if (hasValidOwnDest || filteredChildren.length > 0) {
61279        result.push({
61280          ...item,
61281          dest: hasValidOwnDest ? item.dest : null,
61282          rawDict: hasValidOwnDest ? item.rawDict : null,
61283          items: filteredChildren,
61284          _documentData: documentData
61285        });
61286      }
61287    }
61288    return result;
61289  }
61290  #buildOutline(allDocumentData) {
61291    const outlineItems = [];
61292    for (const documentData of allDocumentData) {
61293      const {
61294        outline
61295      } = documentData;
61296      if (!outline?.length) {
61297        continue;
61298      }
61299      outlineItems.push(...this.#filterOutlineItems(outline, documentData));
61300    }
61301    this.outlineItems = outlineItems.length > 0 ? outlineItems : null;
61302  }
61303  async #setOutlineItemDest(itemDict, item) {
61304    const {
61305      dest,
61306      rawDict
61307    } = item;
61308    const documentData = item._documentData;
61309    if (dest) {
61310      if (typeof dest === "string") {
61311        const name = documentData.dedupNamedDestinations.get(dest) || dest;
61312        itemDict.set("Dest", stringToAsciiOrUTF16BE(name));
61313      } else if (Array.isArray(dest)) {
61314        const newDest = dest.slice();
61315        if (newDest[0] instanceof Ref) {
61316          newDest[0] = documentData.oldRefMapping.get(newDest[0]) || newDest[0];
61317        }
61318        itemDict.set("Dest", newDest);
61319      }
61320      return;
61321    }
61322    const actionDict = rawDict?.get("A");
61323    if (actionDict instanceof Dict) {
61324      this.currentDocument = documentData;
61325      const actionRef = await this.#cloneObject(actionDict, documentData.document.xref);
61326      this.currentDocument = null;
61327      itemDict.set("A", actionRef);
61328    }
61329  }
61330  async #makeOutline() {
61331    const {
61332      outlineItems
61333    } = this;
61334    if (!outlineItems?.length) {
61335      return;
61336    }
61337    const [outlineRootRef, outlineRootDict] = this.newDict;
61338    outlineRootDict.setIfName("Type", "Outlines");
61339    const assignRefs = items => {
61340      for (const item of items) {
61341        [item._ref] = this.newDict;
61342        if (item.items.length > 0) {
61343          assignRefs(item.items);
61344        }
61345      }
61346    };
61347    assignRefs(outlineItems);
61348    const fillItems = async (items, parentRef) => {
61349      let totalCount = 0;
61350      for (let i = 0; i < items.length; i++) {
61351        const item = items[i];
61352        const dict = this.xref[item._ref.num];
61353        dict.set("Title", stringToAsciiOrUTF16BE(item.title));
61354        dict.set("Parent", parentRef);
61355        if (i > 0) {
61356          dict.set("Prev", items[i - 1]._ref);
61357        }
61358        if (i < items.length - 1) {
61359          dict.set("Next", items[i + 1]._ref);
61360        }
61361        if (item.items.length > 0) {
61362          dict.set("First", item.items[0]._ref);
61363          dict.set("Last", item.items.at(-1)._ref);
61364          const childCount = await fillItems(item.items, item._ref);
61365          if (item.count !== undefined) {
61366            dict.set("Count", item.count < 0 ? -childCount : childCount);
61367          }
61368          totalCount += item.count !== undefined && item.count < 0 ? 1 : childCount + 1;
61369        } else {
61370          totalCount += 1;
61371        }
61372        await this.#setOutlineItemDest(dict, item);
61373        const flags = (item.bold ? 2 : 0) | (item.italic ? 1 : 0);
61374        if (flags !== 0) {
61375          dict.set("F", flags);
61376        }
61377        if (item.color && (item.color[0] !== 0 || item.color[1] !== 0 || item.color[2] !== 0)) {
61378          dict.set("C", [item.color[0] / 255, item.color[1] / 255, item.color[2] / 255]);
61379        }
61380      }
61381      return totalCount;
61382    };
61383    const totalCount = await fillItems(outlineItems, outlineRootRef);
61384    outlineRootDict.set("First", outlineItems[0]._ref);
61385    outlineRootDict.set("Last", outlineItems.at(-1)._ref);
61386    outlineRootDict.set("Count", totalCount);
61387    this.rootDict.set("Outlines", outlineRootRef);
61388  }
61389  async #mergeAcroForms(allDocumentData) {
61390    this.#setAcroFormDefaultBasicValues(allDocumentData);
61391    this.#setAcroFormDefaultAppearance(allDocumentData);
61392    this.#setAcroFormQ(allDocumentData);
61393    await this.#setAcroFormDefaultResources(allDocumentData);
61394    const newFields = this.fields;
61395    for (const documentData of allDocumentData) {
61396      let fields = documentData.acroForm?.get("Fields") || null;
61397      if (!fields && documentData.fieldToParent.size > 0) {
61398        fields = this.#fixFields(documentData.fieldToParent, documentData.document.xref);
61399      }
61400      if (Array.isArray(fields) && fields.length > 0) {
61401        this.currentDocument = documentData;
61402        await this.#cloneFields(newFields, fields);
61403        this.currentDocument = null;
61404      }
61405    }
61406    this.#setAcroFormCalculationOrder(allDocumentData);
61407  }
61408  #setAcroFormQ(allDocumentData) {
61409    let firstQ = 0;
61410    let firstDocData = null;
61411    for (const documentData of allDocumentData) {
61412      const q = documentData.acroForm?.get("Q");
61413      if (typeof q !== "number" || q === 0) {
61414        continue;
61415      }
61416      if (firstDocData?.acroFormQ > 0) {
61417        documentData.acroFormQ = q;
61418        continue;
61419      }
61420      if (firstQ === 0) {
61421        firstQ = q;
61422        firstDocData = documentData;
61423        continue;
61424      }
61425      if (q === firstQ) {
61426        continue;
61427      }
61428      firstDocData.acroFormQ ||= firstQ;
61429      documentData.acroFormQ = q;
61430      firstQ = 0;
61431    }
61432    if (firstQ > 0) {
61433      this.acroFormQ = firstQ;
61434    }
61435  }
61436  #setAcroFormDefaultBasicValues(allDocumentData) {
61437    let sigFlags = 0;
61438    let needAppearances = false;
61439    for (const documentData of allDocumentData) {
61440      if (!documentData.acroForm) {
61441        continue;
61442      }
61443      const sf = documentData.acroForm.get("SigFlags");
61444      if (typeof sf === "number" && documentData.hasSignatureAnnotations) {
61445        sigFlags |= sf;
61446      }
61447      if (documentData.acroForm.get("NeedAppearances") === true) {
61448        needAppearances = true;
61449      }
61450    }
61451    this.acroFormSigFlags = sigFlags;
61452    this.acroFormNeedAppearances = needAppearances;
61453  }
61454  #setAcroFormCalculationOrder(allDocumentData) {
61455    const calculationOrder = [];
61456    for (const documentData of allDocumentData) {
61457      const co = documentData.acroForm?.get("CO") || null;
61458      if (!Array.isArray(co)) {
61459        continue;
61460      }
61461      const {
61462        oldRefMapping
61463      } = documentData;
61464      for (const coRef of co) {
61465        const newCoRef = coRef instanceof Ref && oldRefMapping.get(coRef);
61466        if (newCoRef) {
61467          calculationOrder.push(newCoRef);
61468        }
61469      }
61470    }
61471    this.acroFormCalculationOrder = calculationOrder.length > 0 ? calculationOrder : null;
61472  }
61473  #setAcroFormDefaultAppearance(allDocumentData) {
61474    let firstDA = null;
61475    let firstDocData = null;
61476    for (const documentData of allDocumentData) {
61477      const da = documentData.acroForm?.get("DA") || null;
61478      if (!da || typeof da !== "string") {
61479        continue;
61480      }
61481      if (firstDocData?.acroFormDefaultAppearance) {
61482        documentData.acroFormDefaultAppearance = da;
61483        continue;
61484      }
61485      if (!firstDA) {
61486        firstDA = da;
61487        firstDocData = documentData;
61488        continue;
61489      }
61490      if (da === firstDA) {
61491        continue;
61492      }
61493      firstDocData.acroFormDefaultAppearance ||= firstDA;
61494      documentData.acroFormDefaultAppearance = da;
61495      firstDA = null;
61496    }
61497    if (firstDA) {
61498      this.acroFormDefaultAppearance = firstDA;
61499    }
61500  }
61501  async #setAcroFormDefaultResources(allDocumentData) {
61502    let firstDR = null;
61503    let firstDRRef = null;
61504    let firstDocData = null;
61505    for (const documentData of allDocumentData) {
61506      const dr = documentData.acroForm?.get("DR") || null;
61507      if (!dr || !(dr instanceof Dict)) {
61508        continue;
61509      }
61510      if (firstDocData?.acroFormDefaultResources) {
61511        documentData.acroFormDefaultResources = dr;
61512        continue;
61513      }
61514      if (!firstDR) {
61515        firstDR = dr;
61516        firstDRRef = documentData.acroForm.getRaw("DR");
61517        firstDocData = documentData;
61518        continue;
61519      }
61520      if (deepCompare(firstDR, dr)) {
61521        continue;
61522      }
61523      firstDocData.acroFormDefaultResources ||= firstDR;
61524      documentData.acroFormDefaultResources = dr;
61525      firstDR = null;
61526      firstDRRef = null;
61527    }
61528    if (firstDR) {
61529      this.currentDocument = firstDocData;
61530      this.acroFormDefaultResources = await this.#collectDependencies(firstDRRef, true, firstDocData.document.xref);
61531      this.currentDocument = null;
61532    }
61533  }
61534  #fixFields(fieldToParent, xref) {
61535    const newFields = [];
61536    const processed = new RefSet();
61537    for (const [fieldRef, parentRef] of fieldToParent
vendor: 31,732 bytes, lines 61537-62615
61537) {
61538      if (!parentRef) {
61539        newFields.push(fieldRef);
61540        continue;
61541      }
61542      let parent = parentRef;
61543      let lastNonNullParent = parentRef;
61544      while (true) {
61545        parent = xref.fetchIfRef(parent)?.getRaw("Parent") || null;
61546        if (!parent) {
61547          break;
61548        }
61549        lastNonNullParent = parent;
61550      }
61551      if (lastNonNullParent instanceof Ref && !processed.has(lastNonNullParent)) {
61552        newFields.push(lastNonNullParent);
61553        processed.put(lastNonNullParent);
61554      }
61555    }
61556    return newFields;
61557  }
61558  async #cloneFields(newFields, fields) {
61559    const processed = new RefSet();
61560    const stack = [{
61561      kids: fields,
61562      newKids: newFields,
61563      pos: 0,
61564      oldParentRef: null,
61565      parentRef: null,
61566      parent: null
61567    }];
61568    const {
61569      document: {
61570        xref
61571      },
61572      oldRefMapping,
61573      fieldToParent,
61574      acroFormDefaultAppearance,
61575      acroFormDefaultResources,
61576      acroFormQ
61577    } = this.currentDocument;
61578    const daToFix = [];
61579    const drToFix = [];
61580    while (stack.length > 0) {
61581      const data = stack.at(-1);
61582      const {
61583        kids,
61584        newKids,
61585        parent,
61586        pos
61587      } = data;
61588      if (pos === kids.length) {
61589        stack.pop();
61590        if (newKids.length === 0 || !parent) {
61591          continue;
61592        }
61593        const parentDict = this.xref[data.parentRef.num] = this.cloneDict(parent);
61594        parentDict.delete("Parent");
61595        parentDict.delete("Kids");
61596        await this.#collectDependencies(parentDict, false, xref);
61597        parentDict.set("Kids", newKids);
61598        if (stack.length > 0) {
61599          const lastData = stack.at(-1);
61600          if (!lastData.parentRef && lastData.oldParentRef) {
61601            const parentRef = lastData.parentRef = this.newRef;
61602            parentDict.set("Parent", parentRef);
61603            oldRefMapping.put(lastData.oldParentRef, parentRef);
61604          }
61605          lastData.newKids.push(data.parentRef);
61606        }
61607        continue;
61608      }
61609      const oldKidRef = kids[data.pos++];
61610      if (!(oldKidRef instanceof Ref) || processed.has(oldKidRef)) {
61611        continue;
61612      }
61613      processed.put(oldKidRef);
61614      const kid = xref.fetchIfRef(oldKidRef);
61615      if (kid.has("Kids")) {
61616        const kidsArray = kid.get("Kids");
61617        if (!Array.isArray(kidsArray)) {
61618          continue;
61619        }
61620        stack.push({
61621          kids: kidsArray,
61622          newKids: [],
61623          pos: 0,
61624          oldParentRef: oldKidRef,
61625          parentRef: null,
61626          parent: kid
61627        });
61628        continue;
61629      }
61630      if (!fieldToParent.has(oldKidRef)) {
61631        continue;
61632      }
61633      const newRef = oldRefMapping.get(oldKidRef);
61634      if (!newRef) {
61635        continue;
61636      }
61637      newKids.push(newRef);
61638      if (!data.parentRef && data.oldParentRef) {
61639        data.parentRef = this.newRef;
61640        oldRefMapping.put(data.oldParentRef, data.parentRef);
61641      }
61642      const newKid = this.xref[newRef.num];
61643      if (data.parentRef) {
61644        newKid.set("Parent", data.parentRef);
61645      }
61646      if (acroFormDefaultAppearance && isName(newKid.get("FT"), "Tx") && !newKid.has("DA")) {
61647        daToFix.push(newKid);
61648      }
61649      if (acroFormDefaultResources && !newKid.has("Kids") && newKid.get("AP") instanceof Dict) {
61650        drToFix.push(newKid);
61651      }
61652      if (acroFormQ && !newKid.has("Q")) {
61653        newKid.set("Q", acroFormQ);
61654      }
61655    }
61656    for (const field of daToFix) {
61657      const da = getInheritableProperty({
61658        dict: field,
61659        key: "DA"
61660      });
61661      if (!da) {
61662        field.set("DA", acroFormDefaultAppearance);
61663      }
61664    }
61665    const resourcesValuesCache = new Map();
61666    for (const field of drToFix) {
61667      const ap = field.get("AP");
61668      for (const [, value] of ap) {
61669        if (!(value instanceof BaseStream)) {
61670          continue;
61671        }
61672        let resources = value.dict.getRaw("Resources");
61673        if (!resources) {
61674          const newResourcesRef = await resourcesValuesCache.getOrInsertComputed(acroFormDefaultResources, () => this.#cloneObject(acroFormDefaultResources, xref));
61675          value.dict.set("Resources", newResourcesRef);
61676          continue;
61677        }
61678        resources = xref.fetchIfRef(resources);
61679        for (const [resKey, resValue] of acroFormDefaultResources.getRawEntries()) {
61680          if (!resources.has(resKey)) {
61681            let newResValue = resValue;
61682            if (resValue instanceof Ref) {
61683              newResValue = await this.#collectDependencies(resValue, true, xref);
61684            } else if (resValue instanceof Dict || resValue instanceof BaseStream || Array.isArray(resValue)) {
61685              newResValue = await resourcesValuesCache.getOrInsertComputed(resValue, () => this.#cloneObject(resValue, xref));
61686            }
61687            resources.set(resKey, newResValue);
61688          }
61689        }
61690      }
61691    }
61692  }
61693  async #collectPageLabels() {
61694    if (!this.hasSingleFile) {
61695      return;
61696    }
61697    const {
61698      documentData: {
61699        document,
61700        pageLabels
61701      }
61702    } = this.oldPages[0];
61703    if (!pageLabels) {
61704      return;
61705    }
61706    const numPages = document.numPages;
61707    const oldPageLabels = [];
61708    const oldPageIndices = new Set(this.oldPages.map(({
61709      page: {
61710        pageIndex
61711      }
61712    }) => pageIndex));
61713    let currentLabel = null;
61714    let stFirstIndex = -1;
61715    for (let i = 0; i < numPages; i++) {
61716      const newLabel = pageLabels.get(i);
61717      if (newLabel) {
61718        currentLabel = newLabel;
61719        stFirstIndex = currentLabel.has("St") ? i : -1;
61720      }
61721      if (!oldPageIndices.has(i)) {
61722        continue;
61723      }
61724      if (stFirstIndex !== -1) {
61725        const st = currentLabel.get("St");
61726        currentLabel = this.cloneDict(currentLabel);
61727        currentLabel.set("St", st + (i - stFirstIndex));
61728        stFirstIndex = -1;
61729      }
61730      oldPageLabels.push(currentLabel);
61731    }
61732    currentLabel = oldPageLabels[0];
61733    let currentIndex = 0;
61734    const newPageLabels = this.pageLabels = [[0, currentLabel]];
61735    for (let i = 0, ii = oldPageLabels.length; i < ii; i++) {
61736      const label = oldPageLabels[i];
61737      if (label === currentLabel) {
61738        continue;
61739      }
61740      currentIndex = i;
61741      currentLabel = label;
61742      newPageLabels.push([currentIndex, currentLabel]);
61743    }
61744  }
61745  async #makePageCopy(pageIndex) {
61746    const {
61747      page,
61748      documentData,
61749      annotations,
61750      pointingNamedDestinations
61751    } = this.oldPages[pageIndex];
61752    this.currentDocument = documentData;
61753    const {
61754      dedupNamedDestinations,
61755      oldRefMapping
61756    } = documentData;
61757    const {
61758      xref,
61759      rotate,
61760      mediaBox,
61761      resources,
61762      ref: oldPageRef
61763    } = page;
61764    const pageRef = this.newRef;
61765    const pageDict = this.xref[pageRef.num] = this.cloneDict(page.pageDict);
61766    oldRefMapping.put(oldPageRef, pageRef);
61767    if (pointingNamedDestinations) {
61768      for (const pointingDest of pointingNamedDestinations) {
61769        const name = dedupNamedDestinations.get(pointingDest) || pointingDest;
61770        const dest = this.namedDestinations.get(name);
61771        dest[0] = pageRef;
61772      }
61773    }
61774    for (const key of ["Rotate", "MediaBox", "CropBox", "BleedBox", "TrimBox", "ArtBox", "Resources", "Annots", "Parent", "UserUnit"]) {
61775      pageDict.delete(key);
61776    }
61777    const lastRef = this.newRefCount;
61778    await this.#collectDependencies(pageDict, false, xref);
61779    pageDict.set("Rotate", rotate);
61780    pageDict.set("MediaBox", mediaBox);
61781    for (const boxName of ["CropBox", "BleedBox", "TrimBox", "ArtBox"]) {
61782      const box = page.getBoundingBox(boxName);
61783      if (box?.some((value, index) => value !== mediaBox[index])) {
61784        pageDict.set(boxName, box);
61785      }
61786    }
61787    const userUnit = page.userUnit;
61788    if (userUnit !== 1) {
61789      pageDict.set("UserUnit", userUnit);
61790    }
61791    pageDict.setIfDict("Resources", await this.#collectDependencies(resources, true, xref));
61792    let newAnnots = null;
61793    if (annotations) {
61794      const newAnnotations = await this.#collectDependencies(annotations, true, xref);
61795      this.#fixNamedDestinations(newAnnotations, dedupNamedDestinations);
61796      if (Array.isArray(newAnnotations) && newAnnotations.length > 0) {
61797        newAnnots = newAnnotations;
61798      }
61799    }
61800    const newAnnotations = this.#newAnnotationsParams?.newAnnotationsByPage?.get(pageIndex);
61801    if (newAnnotations) {
61802      const {
61803        handler,
61804        task,
61805        imagesPromises
61806      } = this.#newAnnotationsParams;
61807      const changes = new RefSetCache();
61808      const newData = await AnnotationFactory.saveNewAnnotations(page.createAnnotationEvaluator(handler), this.xrefWrapper, task, newAnnotations, imagesPromises, changes);
61809      for (const [ref, {
61810        data
61811      }] of changes.items()) {
61812        this.xref[ref.num] = data;
61813      }
61814      newAnnots ||= [];
61815      for (const {
61816        ref
61817      } of newData.annotations) {
61818        newAnnots.push(ref);
61819      }
61820    }
61821    pageDict.setIfArray("Annots", newAnnots);
61822    if (this.useObjectStreams) {
61823      const newLastRef = this.newRefCount;
61824      const pageObjectRefs = [];
61825      for (let i = lastRef; i < newLastRef; i++) {
61826        const obj = this.xref[i];
61827        if (obj instanceof BaseStream) {
61828          continue;
61829        }
61830        pageObjectRefs.push(Ref.get(i, 0));
61831      }
61832      for (let i = 0; i < pageObjectRefs.length; i += 0xffff) {
61833        const objStreamRef = this.newRef;
61834        this.objStreamRefs.add(objStreamRef.num);
61835        this.xref[objStreamRef.num] = pageObjectRefs.slice(i, i + 0xffff);
61836      }
61837    }
61838    this.currentDocument = null;
61839    return pageRef;
61840  }
61841  #makePageTree() {
61842    const {
61843      newPages: pages,
61844      rootDict,
61845      pagesRef,
61846      pagesDict
61847    } = this;
61848    rootDict.set("Pages", pagesRef);
61849    pagesDict.setIfName("Type", "Pages");
61850    pagesDict.set("Count", pages.length);
61851    const maxLeaves = MAX_LEAVES_PER_PAGES_NODE <= 1 ? pages.length : MAX_LEAVES_PER_PAGES_NODE;
61852    const stack = [{
61853      dict: pagesDict,
61854      kids: pages,
61855      parentRef: pagesRef
61856    }];
61857    while (stack.length > 0) {
61858      const {
61859        dict,
61860        kids,
61861        parentRef
61862      } = stack.pop();
61863      if (kids.length <= maxLeaves) {
61864        dict.set("Kids", kids);
61865        for (const ref of kids) {
61866          this.xref[ref.num].set("Parent", parentRef);
61867        }
61868        continue;
61869      }
61870      const chunkSize = Math.max(maxLeaves, Math.ceil(kids.length / maxLeaves));
61871      const kidsChunks = [];
61872      for (let i = 0; i < kids.length; i += chunkSize) {
61873        kidsChunks.push(kids.slice(i, i + chunkSize));
61874      }
61875      const kidsRefs = [];
61876      dict.set("Kids", kidsRefs);
61877      for (const chunk of kidsChunks) {
61878        const [kidRef, kidDict] = this.newDict;
61879        kidsRefs.push(kidRef);
61880        kidDict.setIfName("Type", "Pages");
61881        kidDict.set("Parent", parentRef);
61882        kidDict.set("Count", chunk.length);
61883        stack.push({
61884          dict: kidDict,
61885          kids: chunk,
61886          parentRef: kidRef
61887        });
61888      }
61889    }
61890  }
61891  #makeNameNumTree(map, areNames) {
61892    const allEntries = map.sort(areNames ? ([keyA], [keyB]) => keyA.localeCompare(keyB) : ([keyA], [keyB]) => keyA - keyB);
61893    const maxLeaves = MAX_IN_NAME_TREE_NODE <= 1 ? allEntries.length : MAX_IN_NAME_TREE_NODE;
61894    const [treeRef, treeDict] = this.newDict;
61895    const stack = [{
61896      dict: treeDict,
61897      entries: allEntries,
61898      isRoot: true
61899    }];
61900    const valueType = areNames ? "Names" : "Nums";
61901    while (stack.length > 0) {
61902      const {
61903        dict,
61904        entries,
61905        isRoot
61906      } = stack.pop();
61907      if (entries.length <= maxLeaves) {
61908        if (!isRoot) {
61909          dict.set("Limits", [entries[0][0], entries.at(-1)[0]]);
61910        }
61911        dict.set(valueType, entries.flat());
61912        continue;
61913      }
61914      const entriesChunks = [];
61915      const chunkSize = Math.max(maxLeaves, Math.ceil(entries.length / maxLeaves));
61916      for (let i = 0; i < entries.length; i += chunkSize) {
61917        entriesChunks.push(entries.slice(i, i + chunkSize));
61918      }
61919      const entriesRefs = [];
61920      dict.set("Kids", entriesRefs);
61921      for (const chunk of entriesChunks) {
61922        const [entriesRef, entriesDict] = this.newDict;
61923        entriesRefs.push(entriesRef);
61924        entriesDict.set("Limits", [chunk[0][0], chunk.at(-1)[0]]);
61925        stack.push({
61926          dict: entriesDict,
61927          entries: chunk
61928        });
61929      }
61930    }
61931    return treeRef;
61932  }
61933  #makePageLabelsTree() {
61934    const {
61935      pageLabels
61936    } = this;
61937    if (!pageLabels || pageLabels.length === 0) {
61938      return;
61939    }
61940    const {
61941      rootDict
61942    } = this;
61943    const pageLabelsRef = this.#makeNameNumTree(this.pageLabels, false);
61944    rootDict.set("PageLabels", pageLabelsRef);
61945  }
61946  async #collectEmbeddedFiles(allDocumentData) {
61947    const {
61948      embeddedFiles
61949    } = this;
61950    for (const documentData of allDocumentData) {
61951      const {
61952        embeddedFiles: docEmbeddedFiles,
61953        document: {
61954          xref
61955        }
61956      } = documentData;
61957      if (!docEmbeddedFiles?.size) {
61958        continue;
61959      }
61960      this.currentDocument = documentData;
61961      for (const [key, valueRef] of docEmbeddedFiles) {
61962        let name = key;
61963        if (embeddedFiles.has(name)) {
61964          const displayName = stringToPDFString(key, true);
61965          for (let i = 1;; i++) {
61966            const deduped = `${displayName}_${i}`;
61967            if (!embeddedFiles.has(deduped)) {
61968              name = deduped;
61969              break;
61970            }
61971          }
61972        }
61973        embeddedFiles.set(name, await this.#collectDependencies(valueRef, true, xref));
61974      }
61975      this.currentDocument = null;
61976    }
61977  }
61978  #makeEmbeddedFilesTree() {
61979    const {
61980      embeddedFiles
61981    } = this;
61982    if (embeddedFiles.size === 0) {
61983      return;
61984    }
61985    if (!this.namesDict) {
61986      [this.namesRef, this.namesDict] = this.newDict;
61987      this.rootDict.set("Names", this.namesRef);
61988    }
61989    this.namesDict.set("EmbeddedFiles", this.#makeNameNumTree(Array.from(embeddedFiles.entries()), true));
61990  }
61991  #makeDestinationsTree() {
61992    const {
61993      namedDestinations
61994    } = this;
61995    if (namedDestinations.size === 0) {
61996      return;
61997    }
61998    if (!this.namesDict) {
61999      [this.namesRef, this.namesDict] = this.newDict;
62000      this.rootDict.set("Names", this.namesRef);
62001    }
62002    this.namesDict.set("Dests", this.#makeNameNumTree(Array.from(namedDestinations.entries()), true));
62003  }
62004  #makeStructTree() {
62005    const {
62006      structTreeKids
62007    } = this;
62008    if (!structTreeKids || structTreeKids.length === 0) {
62009      return;
62010    }
62011    const {
62012      rootDict
62013    } = this;
62014    const structTreeRef = this.newRef;
62015    const structTree = this.xref[structTreeRef.num] = new Dict();
62016    structTree.setIfName("Type", "StructTreeRoot");
62017    structTree.setIfArray("K", structTreeKids);
62018    for (const kidRef of structTreeKids) {
62019      const kid = this.xref[kidRef.num];
62020      const type = kid.get("Type");
62021      if (!type || isName(type, "StructElem")) {
62022        kid.set("P", structTreeRef);
62023      }
62024    }
62025    if (this.parentTree.size > 0) {
62026      const parentTreeRef = this.#makeNameNumTree(Array.from(this.parentTree.entries()), false);
62027      const parentTree = this.xref[parentTreeRef.num];
62028      parentTree.setIfName("Type", "ParentTree");
62029      structTree.set("ParentTree", parentTreeRef);
62030      structTree.set("ParentTreeNextKey", this.parentTree.size);
62031    }
62032    if (this.idTree.size > 0) {
62033      const idTreeRef = this.#makeNameNumTree(Array.from(this.idTree.entries()), true);
62034      const idTree = this.xref[idTreeRef.num];
62035      idTree.setIfName("Type", "IDTree");
62036      structTree.set("IDTree", idTreeRef);
62037    }
62038    if (this.classMap.size > 0) {
62039      const classMapRef = this.newRef;
62040      this.xref[classMapRef.num] = this.classMap;
62041      structTree.set("ClassMap", classMapRef);
62042    }
62043    if (this.roleMap.size > 0) {
62044      const roleMapRef = this.newRef;
62045      this.xref[roleMapRef.num] = this.roleMap;
62046      structTree.set("RoleMap", roleMapRef);
62047    }
62048    if (this.namespaces.size > 0) {
62049      const namespacesRef = this.newRef;
62050      this.xref[namespacesRef.num] = Array.from(this.namespaces.values());
62051      structTree.set("Namespaces", namespacesRef);
62052    }
62053    if (this.structTreeAF.length > 0) {
62054      const structTreeAFRef = this.newRef;
62055      this.xref[structTreeAFRef.num] = this.structTreeAF;
62056      structTree.set("AF", structTreeAFRef);
62057    }
62058    if (this.structTreePronunciationLexicon.length > 0) {
62059      const structTreePronunciationLexiconRef = this.newRef;
62060      this.xref[structTreePronunciationLexiconRef.num] = this.structTreePronunciationLexicon;
62061      structTree.set("PronunciationLexicon", structTreePronunciationLexiconRef);
62062    }
62063    rootDict.set("StructTreeRoot", structTreeRef);
62064  }
62065  #makeAcroForm() {
62066    if (this.fields.length === 0) {
62067      return;
62068    }
62069    const {
62070      rootDict
62071    } = this;
62072    const acroFormRef = this.newRef;
62073    const acroForm = this.xref[acroFormRef.num] = new Dict();
62074    rootDict.set("AcroForm", acroFormRef);
62075    acroForm.set("Fields", this.fields);
62076    if (this.acroFormNeedAppearances) {
62077      acroForm.set("NeedAppearances", true);
62078    }
62079    if (this.acroFormSigFlags > 0) {
62080      acroForm.set("SigFlags", this.acroFormSigFlags);
62081    }
62082    acroForm.setIfArray("CO", this.acroFormCalculationOrder);
62083    acroForm.setIfDict("DR", this.acroFormDefaultResources);
62084    if (this.acroFormDefaultAppearance) {
62085      acroForm.set("DA", this.acroFormDefaultAppearance);
62086    }
62087    if (this.acroFormQ > 0) {
62088      acroForm.set("Q", this.acroFormQ);
62089    }
62090  }
62091  async #makeRoot() {
62092    const {
62093      rootDict
62094    } = this;
62095    rootDict.setIfName("Type", "Catalog");
62096    rootDict.setIfName("Version", this.version);
62097    this.#makeAcroForm();
62098    this.#makePageTree();
62099    this.#makePageLabelsTree();
62100    this.#makeEmbeddedFilesTree();
62101    this.#makeDestinationsTree();
62102    this.#makeStructTree();
62103    await this.#makeOutline();
62104  }
62105  #makeInfo() {
62106    const infoMap = new Map();
62107    if (this.isSingleFile) {
62108      const {
62109        xref: {
62110          trailer
62111        }
62112      } = this.oldPages[0].documentData.document;
62113      const oldInfoDict = trailer.get("Info");
62114      for (const [key, value] of oldInfoDict || []) {
62115        if (typeof value === "string") {
62116          infoMap.set(key, stringToPDFString(value));
62117        }
62118      }
62119    }
62120    infoMap.delete("ModDate");
62121    infoMap.set("CreationDate", getModificationDate());
62122    infoMap.set("Creator", "PDF.js");
62123    infoMap.set("Producer", "Firefox");
62124    if (this.author) {
62125      infoMap.set("Author", this.author);
62126    }
62127    if (this.title) {
62128      infoMap.set("Title", this.title);
62129    }
62130    for (const [key, value] of infoMap) {
62131      this.infoDict.set(key, stringToAsciiOrUTF16BE(value));
62132    }
62133    return infoMap;
62134  }
62135  async #makeEncrypt() {
62136    if (!this.isSingleFile) {
62137      return [null, null, null];
62138    }
62139    const {
62140      documentData
62141    } = this.oldPages[0];
62142    const {
62143      document: {
62144        xref: {
62145          trailer,
62146          encrypt
62147        }
62148      }
62149    } = documentData;
62150    if (!trailer.has("Encrypt")) {
62151      return [null, null, null];
62152    }
62153    const encryptDict = trailer.get("Encrypt");
62154    if (!(encryptDict instanceof Dict)) {
62155      return [null, null, null];
62156    }
62157    this.currentDocument = documentData;
62158    const result = [await this.#cloneObject(encryptDict, trailer.xref), encrypt, trailer.get("ID")];
62159    this.currentDocument = null;
62160    return result;
62161  }
62162  async #createChanges() {
62163    const changes = new RefSetCache();
62164    changes.put(Ref.get(0, 0xffff), {
62165      data: null
62166    });
62167    for (let i = 1, ii = this.xref.length; i < ii; i++) {
62168      if (this.objStreamRefs?.has(i)) {
62169        await this.#createObjectStream(Ref.get(i, 0), this.xref[i], changes);
62170      } else {
62171        changes.put(Ref.get(i, 0), {
62172          data: this.xref[i]
62173        });
62174      }
62175    }
62176    return [changes, this.newRef];
62177  }
62178  async #createObjectStream(objStreamRef, objRefs, changes) {
62179    const streamBuffer = [""];
62180    const objOffsets = [];
62181    let offset = 0;
62182    const buffer = [];
62183    for (let i = 0, ii = objRefs.length; i < ii; i++) {
62184      const objRef = objRefs[i];
62185      changes.put(objRef, {
62186        data: null,
62187        objStreamRef,
62188        index: i
62189      });
62190      objOffsets.push(`${objRef.num} ${offset}`);
62191      const data = this.xref[objRef.num];
62192      await writeValue(data, buffer, null);
62193      const obj = buffer.join("");
62194      buffer.length = 0;
62195      streamBuffer.push(obj);
62196      offset += obj.length + 1;
62197    }
62198    streamBuffer[0] = objOffsets.join("\n");
62199    const objStream = new StringStream(streamBuffer.join("\n"));
62200    const objStreamDict = objStream.dict = new Dict();
62201    objStreamDict.setIfName("Type", "ObjStm");
62202    objStreamDict.set("N", objRefs.length);
62203    objStreamDict.set("First", streamBuffer[0].length + 1);
62204    changes.put(objStreamRef, {
62205      data: objStream
62206    });
62207  }
62208  async writePDF() {
62209    await this.#makeRoot();
62210    const infoMap = this.#makeInfo();
62211    const [encryptRef, encrypt, fileIds] = await this.#makeEncrypt();
62212    const [changes, xrefTableRef] = await this.#createChanges();
62213    const header = stringToBytes(`%PDF-${this.version}\n%\xfa\xde\xfa\xce`);
62214    return incrementalUpdate({
62215      originalData: header,
62216      changes,
62217      xrefInfo: {
62218        startXRef: null,
62219        rootRef: this.rootRef,
62220        infoRef: this.infoRef,
62221        encryptRef,
62222        newRef: xrefTableRef,
62223        fileIds: fileIds || [null, null],
62224        infoMap
62225      },
62226      useXrefStream: this.useObjectStreams,
62227      xref: {
62228        encrypt,
62229        encryptRef
62230      }
62231    });
62232  }
62233}
62234
62235;// ./src/shared/base_pdf_stream.js
62236
62237class BasePDFStream {
62238  #PDFStreamReader = null;
62239  #PDFStreamRangeReader = null;
62240  _fullReader = null;
62241  _rangeReaders = new Set();
62242  _source = null;
62243  constructor(source, PDFStreamReader, PDFStreamRangeReader) {
62244    this._source = source;
62245    this.#PDFStreamReader = PDFStreamReader;
62246    this.#PDFStreamRangeReader = PDFStreamRangeReader;
62247  }
62248  get _progressiveDataLength() {
62249    return this._fullReader?._loaded ?? 0;
62250  }
62251  getFullReader() {
62252    assert(!this._fullReader, "BasePDFStream.getFullReader can only be called once.");
62253    return this._fullReader = new this.#PDFStreamReader(this);
62254  }
62255  getRangeReader(begin, end) {
62256    if (end <= this._progressiveDataLength) {
62257      return null;
62258    }
62259    const reader = new this.#PDFStreamRangeReader(this, begin, end);
62260    this._rangeReaders.add(reader);
62261    return reader;
62262  }
62263  cancelAllRequests(reason) {
62264    this._fullReader?.cancel(reason);
62265    for (const reader of new Set(this._rangeReaders)) {
62266      reader.cancel(reason);
62267    }
62268  }
62269}
62270class BasePDFStreamReader {
62271  onProgress = null;
62272  _contentLength = 0;
62273  _filename = null;
62274  _headersCapability = Promise.withResolvers();
62275  _isRangeSupported = false;
62276  _isStreamingSupported = false;
62277  _loaded = 0;
62278  _stream = null;
62279  constructor(stream) {
62280    this._stream = stream;
62281  }
62282  _callOnProgress() {
62283    this.onProgress?.({
62284      loaded: this._loaded,
62285      total: this._contentLength
62286    });
62287  }
62288  get headersReady() {
62289    return this._headersCapability.promise;
62290  }
62291  get filename() {
62292    return this._filename;
62293  }
62294  get contentLength() {
62295    return this._contentLength;
62296  }
62297  get isRangeSupported() {
62298    return this._isRangeSupported;
62299  }
62300  get isStreamingSupported() {
62301    return this._isStreamingSupported;
62302  }
62303  async read() {
62304    unreachable("Abstract method `read` called");
62305  }
62306  cancel(reason) {
62307    unreachable("Abstract method `cancel` called");
62308  }
62309}
62310class BasePDFStreamRangeReader {
62311  _stream = null;
62312  constructor(stream, begin, end) {
62313    this._stream = stream;
62314  }
62315  async read() {
62316    unreachable("Abstract method `read` called");
62317  }
62318  cancel(reason) {
62319    unreachable("Abstract method `cancel` called");
62320  }
62321}
62322
62323;// ./src/core/worker_stream.js
62324
62325class PDFWorkerStream extends BasePDFStream {
62326  constructor(source) {
62327    super(source, PDFWorkerStreamReader, PDFWorkerStreamRangeReader);
62328  }
62329}
62330class PDFWorkerStreamReader extends BasePDFStreamReader {
62331  _reader = null;
62332  constructor(stream) {
62333    super(stream);
62334    const {
62335      msgHandler
62336    } = stream._source;
62337    const readableStream = msgHandler.sendWithStream("GetReader");
62338    this._reader = readableStream.getReader();
62339    msgHandler.sendWithPromise("ReaderHeadersReady").then(data => {
62340      this._contentLength = data.contentLength;
62341      this._isStreamingSupported = data.isStreamingSupported;
62342      this._isRangeSupported = data.isRangeSupported;
62343      this._headersCapability.resolve();
62344    }, this._headersCapability.reject);
62345  }
62346  async read() {
62347    const {
62348      value,
62349      done
62350    } = await this._reader.read();
62351    if (done) {
62352      return {
62353        value: undefined,
62354        done: true
62355      };
62356    }
62357    return {
62358      value: value.buffer,
62359      done: false
62360    };
62361  }
62362  cancel(reason) {
62363    this._reader.cancel(reason);
62364  }
62365}
62366class PDFWorkerStreamRangeReader extends BasePDFStreamRangeReader {
62367  _reader = null;
62368  constructor(stream, begin, end) {
62369    super(stream, begin, end);
62370    const {
62371      msgHandler
62372    } = stream._source;
62373    const readableStream = msgHandler.sendWithStream("GetRangeReader", {
62374      begin,
62375      end
62376    });
62377    this._reader = readableStream.getReader();
62378  }
62379  async read() {
62380    const {
62381      value,
62382      done
62383    } = await this._reader.read();
62384    if (done) {
62385      return {
62386        value: undefined,
62387        done: true
62388      };
62389    }
62390    return {
62391      value: value.buffer,
62392      done: false
62393    };
62394  }
62395  cancel(reason) {
62396    this._reader.cancel(reason);
62397  }
62398}
62399
62400;// ./src/core/worker.js
62401
62402
62403
62404
62405
62406
62407
62408
62409
62410
62411
62412class WorkerTask {
62413  constructor(name) {
62414    this.name = name;
62415    this.terminated = false;
62416    this._capability = Promise.withResolvers();
62417  }
62418  get finished() {
62419    return this._capability.promise;
62420  }
62421  finish() {
62422    this._capability.resolve();
62423  }
62424  terminate() {
62425    this.terminated = true;
62426  }
62427  ensureNotTerminated() {
62428    if (this.terminated) {
62429      throw new Error("Worker task was terminated");
62430    }
62431  }
62432}
62433class WorkerMessageHandler {
62434  static {
62435    if (typeof window === "undefined" && !isNodeJS && typeof self !== "undefined" && typeof self.postMessage === "function" && "onmessage" in self) {
62436      this.initializeFromPort(self);
62437    }
62438  }
62439  static setup(handler, port) {
62440    let testMessageProcessed = false;
62441    handler.on("test", data => {
62442      if (testMessageProcessed) {
62443        return;
62444      }
62445      testMessageProcessed = true;
62446      handler.send("test", data instanceof Uint8Array);
62447    });
62448    handler.on("configure", data => {
62449      setVerbosityLevel(data.verbosity);
62450    });
62451    handler.on("GetDocRequest", data => this.createDocumentHandler(data, port));
62452  }
62453  static createDocumentHandler(docParams, port) {
62454    let pdfManager;
62455    let terminated = false;
62456    let cancelXHRs = null;
62457    const WorkerTasks = new Set();
62458    const verbosity = getVerbosityLevel();
62459    const {
62460      docId,
62461      apiVersion
62462    } = docParams;
62463    const workerVersion = "5.7.284";
62464    if (apiVersion !== workerVersion) {
62465      throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`);
62466    }
62467    const buildMsg = (type, prop) => `The \`${type}.prototype\` contains unexpected enumerable property ` + `"${prop}", thus breaking e.g. \`for...in\` iteration of ${type}s.`;
62468    for (const prop in {}) {
62469      throw new Error(buildMsg("Object", prop));
62470    }
62471    for (const prop in []) {
62472      throw new Error(buildMsg("Array", prop));
62473    }
62474    const workerHandlerName = docId + "_worker";
62475    let handler = new MessageHandler(workerHandlerName, docId, port);
62476    function ensureNotTerminated() {
62477      if (terminated) {
62478        throw new Error("Worker was terminated");
62479      }
62480    }
62481    function startWorkerTask(task) {
62482      WorkerTasks.add(task);
62483    }
62484    function finishWorkerTask(task) {
62485      task.finish();
62486      WorkerTasks.delete(task);
62487    }
62488    async function loadDocument(recoveryMode) {
62489      await pdfManager.ensureDoc("checkHeader");
62490      await pdfManager.ensureDoc("parseStartXRef");
62491      await pdfManager.ensureDoc("parse", [recoveryMode]);
62492      await pdfManager.ensureDoc("checkFirstPage", [recoveryMode]);
62493      await pdfManager.ensureDoc("checkLastPage", [recoveryMode]);
62494      const isPureXfa = await pdfManager.ensureDoc("isPureXfa");
62495      if (isPureXfa) {
62496        const task = new WorkerTask("loadXfaResources");
62497        startWorkerTask(task);
62498        await pdfManager.ensureDoc("loadXfaResources", [handler, task]);
62499        finishWorkerTask(task);
62500      }
62501      const [numPages, fingerprints] = await Promise.all([pdfManager.ensureDoc("numPages"), pdfManager.ensureDoc("fingerprints")]);
62502      const htmlForXfa = isPureXfa ? await pdfManager.ensureDoc("htmlForXfa") : null;
62503      return {
62504        numPages,
62505        fingerprints,
62506        htmlForXfa
62507      };
62508    }
62509    async function getPdfManager({
62510      data,
62511      password,
62512      disableAutoFetch,
62513      rangeChunkSize,
62514      docBaseUrl,
62515      enableXfa,
62516      evaluatorOptions
62517    }) {
62518      const pdfManagerArgs = {
62519        source: null,
62520        disableAutoFetch,
62521        docBaseUrl,
62522        docId,
62523        enableXfa,
62524        evaluatorOptions,
62525        handler,
62526        length: 0,
62527        password,
62528        rangeChunkSize
62529      };
62530      if (data) {
62531        pdfManagerArgs.source = data;
62532        return new LocalPdfManager(pdfManagerArgs);
62533      }
62534      const pdfStream = new PDFWorkerStream({
62535          msgHandler: handler
62536        }),
62537        fullReader = pdfStream.getFullReader();
62538      const {
62539        promise,
62540        resolve,
62541        reject
62542      } = Promise.withResolvers();
62543      let newPdfManager,
62544        cachedChunks = [];
62545      cancelXHRs = reason => pdfStream.cancelAllRequests(reason);
62546      fullReader.headersReady.then(() => {
62547        if (!fullReader.isRangeSupported) {
62548          return;
62549        }
62550        pdfManagerArgs.source = pdfStream;
62551        pdfManagerArgs.length = fullReader.contentLength;
62552        pdfManagerArgs.disableAutoFetch ||= fullReader.isStreamingSupported;
62553        newPdfManager = new NetworkPdfManager(pdfManagerArgs);
62554        for (const chunk of cachedChunks) {
62555          newPdfManager.sendProgressiveData(chunk);
62556        }
62557        cachedChunks = null;
62558        resolve(newPdfManager);
62559        cancelXHRs = null;
62560      }).catch(reason => {
62561        reject(reason);
62562        cancelXHRs = null;
62563      });
62564      async function readData() {
62565        let loaded = 0;
62566        while (true) {
62567          const {
62568            value,
62569            done
62570          } = await fullReader.read();
62571          ensureNotTerminated();
62572          if (done) {
62573            break;
62574          }
62575          loaded += value.byteLength;
62576          if (!fullReader.isStreamingSupported) {
62577            handler.send("DocProgress", {
62578              loaded,
62579              total: fullReader.contentLength
62580            });
62581          }
62582          if (newPdfManager) {
62583            newPdfManager.sendProgressiveData(value);
62584          } else {
62585            cachedChunks.push(value);
62586          }
62587        }
62588        if (!newPdfManager) {
62589          pdfManagerArgs.source = arrayBuffersToBytes(cachedChunks);
62590          cachedChunks = null;
62591          newPdfManager = new LocalPdfManager(pdfManagerArgs);
62592          resolve(newPdfManager);
62593        }
62594        cancelXHRs = null;
62595      }
62596      readData().catch(reason => {
62597        reject(reason);
62598        cancelXHRs = null;
62599      });
62600      return promise;
62601    }
62602    function setupDoc(data) {
62603      function onSuccess(doc) {
62604        ensureNotTerminated();
62605        handler.send("GetDoc", {
62606          pdfInfo: doc
62607        });
62608      }
62609      function onFailure(ex) {
62610        if (terminated) {
62611          return;
62612        }
62613        if (ex instanceof PasswordException) {
62614          const task = new WorkerTask(`PasswordException: response ${ex.code}`);
62615          startWorkerTask(task);
vendor: 7,073 bytes, lines 62616-62809
62616          handler.sendWithPromise("PasswordRequest", ex).then(function ({
62617            password
62618          }) {
62619            finishWorkerTask(task);
62620            pdfManager.updatePassword(password);
62621            pdfManagerReady();
62622          }).catch(function () {
62623            finishWorkerTask(task);
62624            handler.send("DocException", ex);
62625          });
62626        } else {
62627          handler.send("DocException", wrapReason(ex));
62628        }
62629      }
62630      function pdfManagerReady() {
62631        ensureNotTerminated();
62632        loadDocument(false).then(onSuccess, function (reason) {
62633          ensureNotTerminated();
62634          if (!(reason instanceof XRefParseException)) {
62635            onFailure(reason);
62636            return;
62637          }
62638          pdfManager.requestLoadedStream().then(function () {
62639            ensureNotTerminated();
62640            loadDocument(true).then(onSuccess, onFailure);
62641          });
62642        });
62643      }
62644      ensureNotTerminated();
62645      getPdfManager(data).then(function (newPdfManager) {
62646        if (terminated) {
62647          newPdfManager.terminate(new AbortException("Worker was terminated."));
62648          throw new Error("Worker was terminated");
62649        }
62650        pdfManager = newPdfManager;
62651        pdfManager.requestLoadedStream(true).then(stream => {
62652          handler.send("DataLoaded", {
62653            length: stream.bytes.byteLength
62654          });
62655        });
62656      }).then(pdfManagerReady, onFailure);
62657    }
62658    handler.on("GetPage", function (data) {
62659      return pdfManager.getPage(data.pageIndex).then(function (page) {
62660        return Promise.all([pdfManager.ensure(page, "rotate"), pdfManager.ensure(page, "ref"), pdfManager.ensure(page, "userUnit"), pdfManager.ensure(page, "view")]).then(function ([rotate, ref, userUnit, view]) {
62661          return {
62662            rotate,
62663            ref,
62664            refStr: ref?.toString() ?? null,
62665            userUnit,
62666            view
62667          };
62668        });
62669      });
62670    });
62671    handler.on("GetPageIndex", function (data) {
62672      const pageRef = Ref.get(data.num, data.gen);
62673      return pdfManager.ensureCatalog("getPageIndex", [pageRef]);
62674    });
62675    handler.on("GetDestinations", function (data) {
62676      return pdfManager.ensureCatalog("destinations");
62677    });
62678    handler.on("GetDestination", function (data) {
62679      return pdfManager.ensureCatalog("getDestination", [data.id]);
62680    });
62681    handler.on("GetPageLabels", function (data) {
62682      return pdfManager.ensureCatalog("pageLabels");
62683    });
62684    handler.on("GetPageLayout", function (data) {
62685      return pdfManager.ensureCatalog("pageLayout");
62686    });
62687    handler.on("GetPageMode", function (data) {
62688      return pdfManager.ensureCatalog("pageMode");
62689    });
62690    handler.on("GetViewerPreferences", function (data) {
62691      return pdfManager.ensureCatalog("viewerPreferences");
62692    });
62693    handler.on("GetOpenAction", function (data) {
62694      return pdfManager.ensureCatalog("openAction");
62695    });
62696    handler.on("GetAttachments", function (data) {
62697      return pdfManager.ensureCatalog("attachments");
62698    });
62699    handler.on("GetDocJSActions", function (data) {
62700      return pdfManager.ensureCatalog("jsActions");
62701    });
62702    handler.on("GetPageJSActions", function ({
62703      pageIndex
62704    }) {
62705      return pdfManager.getPage(pageIndex).then(page => pdfManager.ensure(page, "jsActions"));
62706    });
62707    handler.on("GetAnnotationsByType", async function ({
62708      types,
62709      pageIndexesToSkip
62710    }) {
62711      const [numPages, annotationGlobals] = await Promise.all([pdfManager.ensureDoc("numPages"), pdfManager.ensureDoc("annotationGlobals")]);
62712      if (!annotationGlobals) {
62713        return null;
62714      }
62715      const pagePromises = [];
62716      const annotationPromises = [];
62717      let task = null;
62718      try {
62719        for (let i = 0, ii = numPages; i < ii; i++) {
62720          if (pageIndexesToSkip?.has(i)) {
62721            continue;
62722          }
62723          if (!task) {
62724            task = new WorkerTask("GetAnnotationsByType");
62725            startWorkerTask(task);
62726          }
62727          pagePromises.push(pdfManager.getPage(i).then(async page => {
62728            if (!page) {
62729              return [];
62730            }
62731            return page.collectAnnotationsByType(handler, task, types, annotationPromises, annotationGlobals) || [];
62732          }));
62733        }
62734        await Promise.all(pagePromises);
62735        const annotations = await Promise.all(annotationPromises);
62736        return annotations.filter(a => !!a);
62737      } finally {
62738        if (task) {
62739          finishWorkerTask(task);
62740        }
62741      }
62742    });
62743    handler.on("GetOutline", function (data) {
62744      return pdfManager.ensureCatalog("documentOutline");
62745    });
62746    handler.on("GetOptionalContentConfig", function (data) {
62747      return pdfManager.ensureCatalog("optionalContentConfig");
62748    });
62749    handler.on("GetPermissions", function (data) {
62750      return pdfManager.ensureCatalog("permissions");
62751    });
62752    handler.on("GetMetadata", function (data) {
62753      return Promise.all([pdfManager.ensureDoc("documentInfo"), pdfManager.ensureCatalog("metadata"), pdfManager.ensureCatalog("hasStructTree")]);
62754    });
62755    handler.on("GetMarkInfo", function (data) {
62756      return pdfManager.ensureCatalog("markInfo");
62757    });
62758    handler.on("GetData", function (data) {
62759      return pdfManager.requestLoadedStream().then(stream => stream.bytes);
62760    });
62761    handler.on("GetAnnotations", function ({
62762      pageIndex,
62763      intent
62764    }) {
62765      return pdfManager.getPage(pageIndex).then(function (page) {
62766        const task = new WorkerTask(`GetAnnotations: page ${pageIndex}`);
62767        startWorkerTask(task);
62768        return page.getAnnotationsData(handler, task, intent).then(data => {
62769          finishWorkerTask(task);
62770          return data;
62771        }, reason => {
62772          finishWorkerTask(task);
62773          throw reason;
62774        });
62775      });
62776    });
62777    handler.on("GetFieldObjects", function (data) {
62778      return pdfManager.ensureDoc("fieldObjects").then(fieldObjects => fieldObjects?.allFields || null);
62779    });
62780    handler.on("HasJSActions", function (data) {
62781      return pdfManager.ensureDoc("hasJSActions");
62782    });
62783    handler.on("GetCalculationOrderIds", function (data) {
62784      return pdfManager.ensureDoc("calculationOrderIds");
62785    });
62786    handler.on("ExtractPages", async function ({
62787      pageInfos,
62788      annotationStorage
62789    }) {
62790      if (!pageInfos) {
62791        warn("extractPages: nothing to extract.");
62792        return null;
62793      }
62794      if (!Array.isArray(pageInfos)) {
62795        pageInfos = [pageInfos];
62796      }
62797      let newDocumentId = 0;
62798      for (const pageInfo of pageInfos) {
62799        if (pageInfo.document === null) {
62800          pageInfo.document = pdfManager.pdfDocument;
62801        } else if (ArrayBuffer.isView(pageInfo.document)) {
62802          const manager = new LocalPdfManager({
62803            source: pageInfo.document,
62804            docId: `${docId}_extractPages_${newDocumentId++}`,
62805            handler,
62806            password: pageInfo.password ?? null,
62807            evaluatorOptions: Object.assign({}, pdfManager.evaluatorOptions)
62808          });
62809          let recoveryMode = false;
62810          let isValid = true;
62811          while (true) {
62812            try {
62813              await manager.requestLoadedStream();
62814              await manager.ensureDoc("checkHeader");
62815              await manager.ensureDoc("parseStartXRef");
62816              await manager.ensureDoc("parse", [recoveryMode]);
62817              break;
62818            } catch (e) {
62819              if (e instanceof XRefParseException) {
62820                if (recoveryMode === false) {
62821                  recoveryMode = true;
62822                  continue;
62823                } else {
62824                  isValid = false;
62825                  warn("extractPages: XRefParseException.");
62826                }
62827              } else if (e instanceof PasswordException) {
62828                const task = new WorkerTask(`PasswordException: response ${e.code}`);
62829                startWorkerTask(task);
62830                try {
62831                  const {
62832                    password
62833                  } = await handler.sendWithPromise("PasswordRequest", e);
62834                  manager.updatePassword(password);
62835                } catch {
62836                  isValid = false;
62837                  warn("extractPages: invalid password.");
62838                } finally {
62839                  finishWorkerTask(task);
62840                }
62841              } else {
62842                isValid = false;
62843                warn("extractPages: invalid document.");
62844              }
62845              if (!isValid) {
62846                break;
62847              }
62848            }
62849          }
62850          if (!isValid) {
62851            pageInfo.document = null;
62852          }
62853          const isPureXfa = await manager.ensureDoc("isPureXfa");
62854          if (isPureXfa) {
62855            pageInfo.document = null;
62856            warn("extractPages does not support pure XFA documents.");
62857          } else {
62858            pageInfo.document = manager.pdfDocument;
62859          }
62860        } else {
62861          warn("extractPages: invalid document.");
62862        }
62863      }
62864      let task;
vendor: 8,756 bytes, lines 62865-63112
62865      try {
62866        const pdfEditor = new PDFEditor();
62867        task = new WorkerTask(`ExtractPages: ${pageInfos.length} page(s)`);
62868        startWorkerTask(task);
62869        const buffer = await pdfEditor.extractPages(pageInfos, annotationStorage, handler, task);
62870        return buffer;
62871      } catch (reason) {
62872        warn(`extractPages: "${reason}".`);
62873        return null;
62874      } finally {
62875        if (task) {
62876          finishWorkerTask(task);
62877        }
62878      }
62879    });
62880    handler.on("SaveDocument", async function ({
62881      isPureXfa,
62882      numPages,
62883      annotationStorage,
62884      filename
62885    }) {
62886      const globalPromises = [pdfManager.requestLoadedStream(), pdfManager.ensureCatalog("acroForm"), pdfManager.ensureCatalog("acroFormRef"), pdfManager.ensureDoc("startXRef"), pdfManager.ensureDoc("xref"), pdfManager.ensureCatalog("structTreeRoot")];
62887      const changes = new RefSetCache();
62888      const promises = [];
62889      const newAnnotationsByPage = !isPureXfa ? getNewAnnotationsMap(annotationStorage) : null;
62890      const [stream, acroForm, acroFormRef, startXRef, xref, _structTreeRoot] = await Promise.all(globalPromises);
62891      const catalogRef = xref.trailer.getRaw("Root") || null;
62892      let structTreeRoot;
62893      if (newAnnotationsByPage) {
62894        if (!_structTreeRoot) {
62895          if (await StructTreeRoot.canCreateStructureTree({
62896            catalogRef,
62897            pdfManager,
62898            newAnnotationsByPage
62899          })) {
62900            structTreeRoot = null;
62901          }
62902        } else if (await _structTreeRoot.canUpdateStructTree({
62903          pdfManager,
62904          newAnnotationsByPage
62905        })) {
62906          structTreeRoot = _structTreeRoot;
62907        }
62908        const imagePromises = AnnotationFactory.generateImages(annotationStorage.values(), xref, pdfManager.evaluatorOptions.isOffscreenCanvasSupported);
62909        const newAnnotationPromises = structTreeRoot === undefined ? promises : [];
62910        for (const [pageIndex, annotations] of newAnnotationsByPage) {
62911          newAnnotationPromises.push(pdfManager.getPage(pageIndex).then(page => {
62912            const task = new WorkerTask(`Save (editor): page ${pageIndex}`);
62913            startWorkerTask(task);
62914            return page.saveNewAnnotations(handler, task, annotations, imagePromises, changes).finally(function () {
62915              finishWorkerTask(task);
62916            });
62917          }));
62918        }
62919        if (structTreeRoot === null) {
62920          promises.push(Promise.all(newAnnotationPromises).then(async () => {
62921            await StructTreeRoot.createStructureTree({
62922              newAnnotationsByPage,
62923              xref,
62924              catalogRef,
62925              pdfManager,
62926              changes
62927            });
62928          }));
62929        } else if (structTreeRoot) {
62930          promises.push(Promise.all(newAnnotationPromises).then(async () => {
62931            await structTreeRoot.updateStructureTree({
62932              newAnnotationsByPage,
62933              pdfManager,
62934              changes
62935            });
62936          }));
62937        }
62938      }
62939      if (isPureXfa) {
62940        promises.push(pdfManager.ensureDoc("serializeXfaData", [annotationStorage]));
62941      } else {
62942        for (let pageIndex = 0; pageIndex < numPages; pageIndex++) {
62943          promises.push(pdfManager.getPage(pageIndex).then(function (page) {
62944            const task = new WorkerTask(`Save: page ${pageIndex}`);
62945            startWorkerTask(task);
62946            return page.save(handler, task, annotationStorage, changes).finally(function () {
62947              finishWorkerTask(task);
62948            });
62949          }));
62950        }
62951      }
62952      const refs = await Promise.all(promises);
62953      let xfaData = null;
62954      if (isPureXfa) {
62955        xfaData = refs[0];
62956        if (!xfaData) {
62957          return stream.bytes;
62958        }
62959      } else if (changes.size === 0) {
62960        return stream.bytes;
62961      }
62962      const needAppearances = acroFormRef && acroForm instanceof Dict && changes.values().some(ref => ref.needAppearances);
62963      const xfa = acroForm instanceof Dict && acroForm.get("XFA") || null;
62964      let xfaDatasetsRef = null;
62965      let hasXfaDatasetsEntry = false;
62966      if (Array.isArray(xfa)) {
62967        for (let i = 0, ii = xfa.length; i < ii; i += 2) {
62968          if (xfa[i] === "datasets") {
62969            xfaDatasetsRef = xfa[i + 1];
62970            hasXfaDatasetsEntry = true;
62971          }
62972        }
62973        if (xfaDatasetsRef === null) {
62974          xfaDatasetsRef = xref.getNewTemporaryRef();
62975        }
62976      } else if (xfa) {
62977        warn("Unsupported XFA type.");
62978      }
62979      let newXrefInfo = Object.create(null);
62980      if (xref.trailer) {
62981        const infoMap = new Map();
62982        const xrefInfo = xref.trailer.get("Info") || null;
62983        if (xrefInfo instanceof Dict) {
62984          for (const [key, value] of xrefInfo) {
62985            if (typeof value === "string") {
62986              infoMap.set(key, stringToPDFString(value));
62987            }
62988          }
62989        }
62990        newXrefInfo = {
62991          rootRef: catalogRef,
62992          encryptRef: xref.trailer.getRaw("Encrypt") || null,
62993          newRef: xref.getNewTemporaryRef(),
62994          infoRef: xref.trailer.getRaw("Info") || null,
62995          infoMap,
62996          fileIds: xref.trailer.get("ID") || null,
62997          startXRef,
62998          filename
62999        };
63000      }
63001      return incrementalUpdate({
63002        originalData: stream.bytes,
63003        xrefInfo: newXrefInfo,
63004        changes,
63005        xref,
63006        hasXfa: !!xfa,
63007        xfaDatasetsRef,
63008        hasXfaDatasetsEntry,
63009        needAppearances,
63010        acroFormRef,
63011        acroForm,
63012        xfaData,
63013        useXrefStream: isDict(xref.topDict, "XRef")
63014      }).finally(() => {
63015        xref.resetNewTemporaryRef();
63016      });
63017    });
63018    handler.on("GetOperatorList", function (data, sink) {
63019      const {
63020        pageId,
63021        pageIndex
63022      } = data;
63023      pdfManager.getPage(pageId).then(function (page) {
63024        const task = new WorkerTask(`GetOperatorList: page ${pageIndex}`);
63025        startWorkerTask(task);
63026        const start = verbosity >= VerbosityLevel.INFOS ? Date.now() : 0;
63027        page.getOperatorList({
63028          handler,
63029          sink,
63030          task,
63031          intent: data.intent,
63032          cacheKey: data.cacheKey,
63033          annotationStorage: data.annotationStorage,
63034          modifiedIds: data.modifiedIds,
63035          pageIndex
63036        }).then(function (operatorListInfo) {
63037          finishWorkerTask(task);
63038          if (start) {
63039            info(`page=${pageIndex + 1} - getOperatorList: time=` + `${Date.now() - start}ms, len=${operatorListInfo.length}`);
63040          }
63041          sink.close();
63042        }, function (reason) {
63043          finishWorkerTask(task);
63044          if (task.terminated) {
63045            return;
63046          }
63047          sink.error(reason);
63048        });
63049      });
63050    });
63051    handler.on("GetTextContent", function (data, sink) {
63052      const {
63053        pageId,
63054        pageIndex,
63055        includeMarkedContent,
63056        disableNormalization
63057      } = data;
63058      pdfManager.getPage(pageId).then(function (page) {
63059        const task = new WorkerTask("GetTextContent: page " + pageIndex);
63060        startWorkerTask(task);
63061        const start = verbosity >= VerbosityLevel.INFOS ? Date.now() : 0;
63062        page.extractTextContent({
63063          handler,
63064          task,
63065          sink,
63066          includeMarkedContent,
63067          disableNormalization
63068        }).then(function () {
63069          finishWorkerTask(task);
63070          if (start) {
63071            info(`page=${pageIndex + 1} - getTextContent: time=` + `${Date.now() - start}ms`);
63072          }
63073          sink.close();
63074        }, function (reason) {
63075          finishWorkerTask(task);
63076          if (task.terminated) {
63077            return;
63078          }
63079          sink.error(reason);
63080        });
63081      });
63082    });
63083    handler.on("GetStructTree", function (data) {
63084      return pdfManager.getPage(data.pageIndex).then(page => pdfManager.ensure(page, "getStructTree"));
63085    });
63086    handler.on("FontFallback", function (data) {
63087      return pdfManager.fontFallback(data.id, handler);
63088    });
63089    handler.on("Cleanup", function (data) {
63090      return pdfManager.cleanup(true);
63091    });
63092    handler.on("Terminate", async function (data) {
63093      terminated = true;
63094      const waitOn = [];
63095      if (pdfManager) {
63096        pdfManager.terminate(new AbortException("Worker was terminated."));
63097        const cleanupPromise = pdfManager.cleanup();
63098        waitOn.push(cleanupPromise);
63099        pdfManager = null;
63100      } else {
63101        clearGlobalCaches();
63102      }
63103      cancelXHRs?.(new AbortException("Worker was terminated."));
63104      for (const task of WorkerTasks) {
63105        waitOn.push(task.finished);
63106        task.terminate();
63107      }
63108      await Promise.all(waitOn);
63109      handler.destroy();
63110      handler = null;
63111    });
63112    handler.on("Ready", function (data
vendor: 442 bytes, lines 63112-63133
63112) {
63113      setupDoc(docParams);
63114      docParams = null;
63115    });
63116    return workerHandlerName;
63117  }
63118  static initializeFromPort(port) {
63119    const handler = new MessageHandler("worker", "main", port);
63120    this.setup(handler, port);
63121    handler.send("ready", null);
63122  }
63123}
63124
63125;// ./src/pdf.worker.js
63126
63127globalThis.pdfjsWorker = {
63128  WorkerMessageHandler: WorkerMessageHandler
63129};
63130
63131export { WorkerMessageHandler };
63132
63133//# sourceMappingURL=pdf.worker.mjs.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.