PageSourceSearch

https://www.tokuco.ac.jp/shared/js/dest/script.js?ver=2.45.27

js tokuco.ac.jp collected 2026-09-28 12:48:00 UTC 3,013,233 bytes, 92,910 lines download raw bytes

vendor: 4,206 bytes, lines 1-107
1/******/ (() => { // webpackBootstrap
2/******/ 	var __webpack_modules__ = ({
3
4/***/ "./node_modules/canvas/build/Release/canvas.node"
5/*!*******************************************************!*\
6  !*** ./node_modules/canvas/build/Release/canvas.node ***!
7  \*******************************************************/
8() {
9
10throw new Error("Module parse failed: Unexpected character '�' (1:2)\nYou may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders\n(Source code omitted for this binary file)");
11
12/***/ },
13
14/***/ "./node_modules/canvas/index.js"
15/*!**************************************!*\
16  !*** ./node_modules/canvas/index.js ***!
17  \**************************************/
18(__unused_webpack_module, exports, __webpack_require__) {
19
20const Canvas = __webpack_require__(/*! ./lib/canvas */ "./node_modules/canvas/lib/canvas.js")
21const Image = __webpack_require__(/*! ./lib/image */ "./node_modules/canvas/lib/image.js")
22const CanvasRenderingContext2D = __webpack_require__(/*! ./lib/context2d */ "./node_modules/canvas/lib/context2d.js")
23const CanvasPattern = __webpack_require__(/*! ./lib/pattern */ "./node_modules/canvas/lib/pattern.js")
24const parseFont = __webpack_require__(/*! ./lib/parse-font */ "./node_modules/canvas/lib/parse-font.js")
25const packageJson = __webpack_require__(/*! ./package.json */ "./node_modules/canvas/package.json")
26const bindings = __webpack_require__(/*! ./lib/bindings */ "./node_modules/canvas/lib/bindings.js")
27const fs = __webpack_require__(/*! fs */ "fs")
28const PNGStream = __webpack_require__(/*! ./lib/pngstream */ "./node_modules/canvas/lib/pngstream.js")
29const PDFStream = __webpack_require__(/*! ./lib/pdfstream */ "./node_modules/canvas/lib/pdfstream.js")
30const JPEGStream = __webpack_require__(/*! ./lib/jpegstream */ "./node_modules/canvas/lib/jpegstream.js")
31const { DOMPoint, DOMMatrix } = __webpack_require__(/*! ./lib/DOMMatrix */ "./node_modules/canvas/lib/DOMMatrix.js")
32
33function createCanvas (width, height, type) {
34  return new Canvas(width, height, type)
35}
36
37function createImageData (array, width, height) {
38  return new bindings.ImageData(array, width, height)
39}
40
41function loadImage (src) {
42  return new Promise((resolve, reject) => {
43    const image = new Image()
44
45    function cleanup () {
46      image.onload = null
47      image.onerror = null
48    }
49
50    image.onload = () => { cleanup(); resolve(image) }
51    image.onerror = (err) => { cleanup(); reject(err) }
52
53    image.src = src
54  })
55}
56
57/**
58 * Resolve paths for registerFont. Must be called *before* creating a Canvas
59 * instance.
60 * @param src {string} Path to font file.
61 * @param fontFace {{family: string, weight?: string, style?: string}} Object
62 * specifying font information. `weight` and `style` default to `"normal"`.
63 */
64function registerFont (src, fontFace) {
65  // TODO this doesn't need to be on Canvas; it should just be a static method
66  // of `bindings`.
67  return Canvas._registerFont(fs.realpathSync(src), fontFace)
68}
69
70/**
71 * Unload all fonts from pango to free up memory
72 */
73function deregisterAllFonts () {
74  return Canvas._deregisterAllFonts()
75}
76
77exports.Canvas = Canvas
78exports.Context2d = CanvasRenderingContext2D // Legacy/compat export
79exports.CanvasRenderingContext2D = CanvasRenderingContext2D
80exports.CanvasGradient = bindings.CanvasGradient
81exports.CanvasPattern = CanvasPattern
82exports.Image = Image
83exports.ImageData = bindings.ImageData
84exports.PNGStream = PNGStream
85exports.PDFStream = PDFStream
86exports.JPEGStream = JPEGStream
87exports.DOMMatrix = DOMMatrix
88exports.DOMPoint = DOMPoint
89
90exports.registerFont = registerFont
91exports.deregisterAllFonts = deregisterAllFonts
92exports.parseFont = parseFont
93
94exports.createCanvas = createCanvas
95exports.createImageData = createImageData
96exports.loadImage = loadImage
97
98exports.backends = bindings.Backends
99
100/** Library version. */
101exports.version = packageJson.version
102/** Cairo version. */
103exports.cairoVersion = bindings.cairoVersion
104/** jpeglib version. */
105exports.jpegVersion = bindings.jpegVersion
106/** gif_lib version. */
107exports.gifVersion = bindings.gifVersion ? bindings.gifVersion.replace(/[^.\d]/g, '') 
107: undefined
108/** freetype version. */
109exports.freetypeVersion = bindings.freetypeVersion
110/** rsvg version. */
111exports.rsvgVersion = bindings.rsvgVersion
112/** pango version. */
113exports.pangoVersion = bindings.pangoVersion
114
115
116/***/ },
117
118/***/ "./node_modules/canvas/lib/DOMMatrix.js"
119/*!**********************************************!*\
120  !*** ./node_modules/canvas/lib/DOMMatrix.js ***!
121  \**********************************************/
122(module, __unused_webpack_exports, __webpack_require__) {
123
124"use strict";
125
126
127const util = __webpack_require__(/*! util */ "util")
128
129// DOMMatrix per https://drafts.fxtf.org/geometry/#DOMMatrix
130
131class DOMPoint {
132  constructor (x, y, z, w) {
133    if (typeof x === 'object' && x !== null) {
134      w = x.w
135      z = x.z
136      y = x.y
137      x = x.x
138    }
139    this.x = typeof x === 'number' ? x : 0
140    this.y = typeof y === 'number' ? y : 0
141    this.z = typeof z === 'number' ? z : 0
142    this.w = typeof w === 'number' ? w : 1
143  }
144}
145
146// Constants to index into _values (col-major)
147const M11 = 0; const M12 = 1; const M13 = 2; const M14 = 3
148const M21 = 4; const M22 = 5; const M23 = 6; const M24 = 7
149const M31 = 8; const M32 = 9; const M33 = 10; const M34 = 11
150const M41 = 12; const M42 = 13; const M43 = 14; const M44 = 15
151
152const DEGREE_PER_RAD = 180 / Math.PI
153const RAD_PER_DEGREE = Math.PI / 180
154
155function parseMatrix (init) {
156  let parsed = init.replace('matrix(', '')
157  parsed = parsed.split(',', 7) // 6 + 1 to handle too many params
158  if (parsed.length !== 6) throw new Error(`Failed to parse ${init}`)
159  parsed = parsed.map(parseFloat)
160  return [
161    parsed[0], parsed[1], 0, 0,
162    parsed[2], parsed[3], 0, 0,
163    0, 0, 1, 0,
164    parsed[4], parsed[5], 0, 1
165  ]
166}
167
168function parseMatrix3d (init) {
169  let parsed = init.replace('matrix3d(', '')
170  parsed = parsed.split(',', 17) // 16 + 1 to handle too many params
171  if (parsed.length !== 16) throw new Error(`Failed to parse ${init}`)
172  return parsed.map(parseFloat)
173}
174
175function parseTransform (tform) {
176  const type = tform.split('(', 1)[0]
177  switch (type) {
178    case 'matrix':
179      return parseMatrix(tform)
180    case 'matrix3d':
181      return parseMatrix3d(tform)
182    // TODO This is supposed to support any CSS transform value.
183    default:
184      throw new Error(`${type} parsing not implemented`)
185  }
186}
187
188class DOMMatrix {
189  constructor (init) {
190    this._is2D = true
191    this._values = new Float64Array([
192      1, 0, 0, 0,
193      0, 1, 0, 0,
194      0, 0, 1, 0,
195      0, 0, 0, 1
196    ])
197
198    let i
199
200    if (typeof init === 'string') { // parse CSS transformList
201      if (init === '') return // default identity matrix
202      const tforms = init.split(/\)\s+/, 20).map(parseTransform)
203      if (tforms.length === 0) return
204      init = tforms[0]
205      for (i = 1; i < tforms.length; i++) init = multiply(tforms[i], init)
206    }
207
208    i = 0
209    if (init && init.length === 6) {
210      setNumber2D(this, M11, init[i++])
211      setNumber2D(this, M12, init[i++])
212      setNumber2D(this, M21, init[i++])
213      setNumber2D(this, M22, init[i++])
214      setNumber2D(this, M41, init[i++])
215      setNumber2D(this, M42, init[i++])
216    } else if (init && init.length === 16) {
217      setNumber2D(this, M11, init[i++])
218      setNumber2D(this, M12, init[i++])
219      setNumber3D(this, M13, init[i++])
220      setNumber3D(this, M14, init[i++])
221      setNumber2D(this, M21, init[i++])
222      setNumber2D(this, M22, init[i++])
223      setNumber3D(this, M23, init[i++])
224      setNumber3D(this, M24, init[i++])
225      setNumber3D(this, M31, init[i++])
226      setNumber3D(this, M32, init[i++])
227      setNumber3D(this, M33, init[i++])
228      setNumber3D(this, M34, init[i++])
229      setNumber2D(this, M41, init[i++])
230      setNumber2D(this, M42, init[i++])
231      setNumber3D(this, M43, init[i++])
232      setNumber3D(this, M44, init[i])
233    } else if (init !== undefined) {
234      throw new TypeError('Expected string or array.')
235    }
236  }
237
238  toString () {
239    return this.is2D
240      ? `matrix(${this.a}, ${this.b}, ${this.c}, ${this.d}, ${this.e}, ${this.f})`
241      : `matrix3d(${this._values.join(', ')})`
242  }
243
244  multiply (other) {
245    return newInstance(this._values).multiplySelf(other)
246  }
247
248  multiplySelf (other) {
249    this._values = multiply(other._values, this._values)
250    if (!other.is2D) this._is2D = false
251    return this
252  }
253
254  preMultiplySelf (other) {
255    this._values = multiply(this._values, other._values)
256    if (!other.is2D) this._is2D = false
257    return this
258  }
259
260  translate (tx, ty, tz) {
261    return newInstance(this._values).translateSelf(tx, ty, tz)
262  }
263
264  translateSelf (tx, ty, tz) {
265    if (typeof tx !== 'number') tx = 0
266    if (typeof ty !== 'number') ty = 0
267    if (typeof tz !== 'number') tz = 0
268    this._values = multiply([
269      1, 0, 0, 0,
270      0, 1, 0, 0,
271      0, 0, 1, 0,
272      tx, ty, tz, 1
273    ], this._values)
274    if (tz !== 0) this._is2D = false
275    return this
276  }
277
278  scale (scaleX, scaleY, scaleZ, originX, originY, originZ) {
279    return newInstance(this._values).scaleSelf(scaleX, scaleY, scaleZ, originX, originY, originZ)
280  }
281
282  scale3d (scale, originX, originY, originZ) {
283    return newInstance(this._values).scale3dSelf(scale, originX, originY, originZ)
284  }
285
286  scale3dSelf (scale, originX, originY, originZ) {
287    return this.scaleSelf(scale, scale, scale, originX, originY, originZ)
288  }
289
290  scaleSelf (scaleX, scaleY, scaleZ, originX, originY, originZ) {
291    // Not redundant with translate's checks because we need to negate the values later.
292    if (typeof originX !== 'number') originX = 0
293    if (typeof originY !== 'number') originY = 0
294    if (typeof originZ !== 'number') originZ = 0
295    this.translateSelf(originX, originY, originZ)
296    if (typeof scaleX !== 'number') scaleX = 1
297    if (typeof scaleY !== 'number') scaleY = scaleX
298    if (typeof scaleZ !== 'number') scaleZ = 1
299    this._values = multiply([
300      scaleX, 0, 0, 0,
301      0, scaleY, 0, 0,
302      0, 0, scaleZ, 0,
303      0, 0, 0, 1
304    ], this._values)
305    this.translateSelf(-originX, -originY, -originZ)
306    if (scaleZ !== 1 || originZ !== 0) this._is2D = false
307    return this
308  }
309
310  rotateFromVector (x, y) {
311    return newInstance(this._values).rotateFromVectorSelf(x, y)
312  }
313
314  rotateFromVectorSelf (x, y) {
315    if (typeof x !== 'number') x = 0
316    if (typeof y !== 'number') y = 0
317    const theta = (x === 0 && y === 0) ? 0 : Math.atan2(y, x) * DEGREE_PER_RAD
318    return this.rotateSelf(theta)
319  }
320
321  rotate (rotX, rotY, rotZ) {
322    return newInstance(this._values).rotateSelf(rotX, rotY, rotZ)
323  }
324
325  rotateSelf (rotX, rotY, rotZ) {
326    if (rotY === undefined && rotZ === undefined) {
327      rotZ = rotX
328      rotX = rotY = 0
329    }
330    if (typeof rotY !== 'number') rotY = 0
331    if (typeof rotZ !== 'number') rotZ = 0
332    if (rotX !== 0 || rotY !== 0) this._is2D = false
333    rotX *= RAD_PER_DEGREE
334    rotY *= RAD_PER_DEGREE
335    rotZ *= RAD_PER_DEGREE
336    let c, s
337    c = Math.cos(rotZ)
338    s = Math.sin(rotZ)
339    this._values = multiply([
340      c, s, 0, 0,
341      -s, c, 0, 0,
342      0, 0, 1, 0,
343      0, 0, 0, 1
344    ], this._values)
345    c = Math.cos(rotY)
346    s = Math.sin(rotY)
347    this._values = multiply([
348      c, 0, -s, 0,
349      0, 1, 0, 0,
350      s, 0, c, 0,
351      0, 0, 0, 1
352    ], this._values)
353    c = Math.cos(rotX)
354    s = Math.sin(rotX)
355    this._values = multiply([
356      1, 0, 0, 0,
357      0, c, s, 0,
358      0, -s, c, 0,
359      0, 0, 0, 1
360    ], this._values)
361    return this
362  }
363
364  rotateAxisAngle (x, y, z, angle) {
365    return newInstance(this._values).rotateAxisAngleSelf(x, y, z, angle)
366  }
367
368  rotateAxisAngleSelf (x, y, z, angle) {
369    if (typeof x !== 'number') x = 0
370    if (typeof y !== 'number') y = 0
371    if (typeof z !== 'number') z = 0
372    // Normalize axis
373    const length = Math.sqrt(x * x + y * y + z * z)
374    if (length === 0) return this
375    if (length !== 1) {
376      x /= length
377      y /= length
378      z /= length
379    }
380    angle *= RAD_PER_DEGREE
381    const c = Math.cos(angle)
382    const s = Math.sin(angle)
383    const t = 1 - c
384    const tx = t * x
385    const ty = t * y
386    // NB: This is the generic transform. If the axis is a major axis, there are
387    // faster transforms.
388    this._values = multiply([
389      tx * x + c, tx * y + s * z, tx * z - s * y, 0,
390      tx * y - s * z, ty * y + c, ty * z + s * x, 0,
391      tx * z + s * y, ty * z - s * x, t * z * z + c, 0,
392      0, 0, 0, 1
393    ], this._values)
394    if (x !== 0 || y !== 0) this._is2D = false
395    return this
396  }
397
398  skewX (sx) {
399    return newInstance(this._values).skewXSelf(sx)
400  }
401
402  skewXSelf (sx) {
403    if (typeof sx !== 'number') return this
404    const t = Math.tan(sx * RAD_PER_DEGREE)
405    this._values = multiply([
406      1, 0, 0, 0,
407      t, 1, 0, 0,
408      0, 0, 1, 0,
409      0, 0, 0, 1
410    ], this._values)
411    return this
412  }
413
414  skewY (sy) {
415    return newInstance(this._values).skewYSelf(sy)
416  }
417
418  skewYSelf (sy) {
419    if (typeof sy !== 'number') return this
420    const t = Math.tan(sy * RAD_PER_DEGREE)
421    this._values = multiply([
422      1, t, 0, 0,
423      0, 1, 0, 0,
424      0, 0, 1, 0,
425      0, 0, 0, 1
426    ], this._values)
427    return this
428  }
429
430  flipX () {
431    return newInstance(multiply([
432      -1, 0, 0, 0,
433      0, 1, 0, 0,
434      0, 0, 1, 0,
435      0, 0, 0, 1
436    ], this._values))
437  }
438
439  flipY () {
440    return newInstance(multiply([
441      1, 0, 0, 0,
442      0, -1, 0, 0,
443      0, 0, 1, 0,
444      0, 0, 0, 1
445    ], this._values))
446  }
447
448  inverse () {
449    return newInstance(this._values).invertSelf()
450  }
451
452  invertSelf () {
453    const m = this._values
454    const inv = m.map(v => 0)
455
456    inv[0] = m[5] * m[10] * m[15] -
457            m[5] * m[11] * m[14] -
458            m[9] * m[6] * m[15] +
459            m[9] * m[7] * m[14] +
460            m[13] * m[6] * m[11] -
461            m[13] * m[7] * m[10]
462
463    inv[4] = -m[4] * m[10] * m[15] +
464            m[4] * m[11] * m[14] +
465            m[8] * m[6] * m[15] -
466            m[8] * m[7] * m[14] -
467            m[12] * m[6] * m[11] +
468            m[12] * m[7] * m[10]
469
470    inv[8] = m[4] * m[9] * m[15] -
471            m[4] * m[11] * m[13] -
472            m[8] * m[5] * m[15] +
473            m[8] * m[7] * m[13] +
474            m[12] * m[5] * m[11] -
475            m[12] * m[7] * m[9]
476
477    inv[12] = -m[4] * m[9] * m[14] +
478            m[4] * m[10] * m[13] +
479            m[8] * m[5] * m[14] -
480            m[8] * m[6] * m[13] -
481            m[12] * m[5] * m[10] +
482            m[12] * m[6] * m[9]
483
484    // If the determinant is zero, this matrix cannot be inverted, and all
485    // values should be set to NaN, with the is2D flag set to false.
486
487    const det = m[0] * inv[0] + m[1] * inv[4] + m[2] * inv[8] + m[3] * inv[12]
488
489    if (det === 0) {
490      this._values = m.map(v => NaN)
491      this._is2D = false
492      return this
493    }
494
495    inv[1] = -m[1] * m[10] * m[15] +
496            m[1] * m[11] * m[14] +
497            m[9] * m[2] * m[15] -
498            m[9] * m[3] * m[14] -
499            m[13] * m[2] * m[11] +
500            m[13] * m[3] * m[10]
501
502    inv[5] = m[0] * m[10] * m[15] -
503            m[0] * m[11] * m[14] -
504            m[8] * m[2] * m[15] +
505            m[8] * m[3] * m[14] +
506            m[12] * m[2] * m[11] -
507            m[12] * m[3] * m[10]
508
509    inv[9] = -m[0] * m[9] * m[15] +
510            m[0] * m[11] * m[13] +
511            m[8] * m[1] * m[15] -
512            m[8] * m[3] * m[13] -
513            m[12] * m[1] * m[11] +
514            m[12] * m[3] * m[9]
515
516    inv[13] = m[0] * m[9] * m[14] -
517            m[0] * m[10] * m[13] -
518            m[8] * m[1] * m[14] +
519            m[8] * m[2] * m[13] +
520            m[12] * m[1] * m[10] -
521            m[12] * m[2] * m[9]
522
523    inv[2] = m[1] * m[6] * m[15] -
524            m[1] * m[7] * m[14] -
525            m[5] * m[2] * m[15] +
526            m[5] * m[3] * m[14] +
527            m[13] * m[2] * m[7] -
528            m[13] * m[3] * m[6]
529
530    inv[6] = -m[0] * m[6] * m[15] +
531            m[0] * m[7] * m[14] +
532            m[4] * m[2] * m[15] -
533            m[4] * m[3] * m[14] -
534            m[12] * m[2] * m[7] +
535            m[12] * m[3] * m[6]
536
537    inv[10] = m[0] * m[5] * m[15] -
538            m[0] * m[7] * m[13] -
539            m[4] * m[1] * m[15] +
540            m[4] * m[3] * m[13] +
541            m[12] * m[1] * m[7] -
542            m[12] * m[3] * m[5]
543
544    inv[14] = -m[0] * m[5] * m[14] +
545            m[0] * m[6] * m[13] +
546            m[4] * m[1] * m[14] -
547            m[4] * m[2] * m[13] -
548            m[12] * m[1] * m[6] +
549            m[12] * m[2] * m[5]
550
551    inv[3] = -m[1] * m[6] * m[11] +
552            m[1] * m[7] * m[10] +
553            m[5] * m[2] * m[11] -
554            m[5] * m[3] * m[10] -
555            m[9] * m[2] * m[7] +
556            m[9] * m[3] * m[6]
557
558    inv[7] = m[0] * m[6] * m[11] -
559            m[0] * m[7] * m[10] -
560            m[4] * m[2] * m[11] +
561            m[4] * m[3] * m[10] +
562            m[8] * m[2] * m[7] -
563            m[8] * m[3] * m[6]
564
565    inv[11] = -m[0] * m[5] * m[11] +
566            m[0] * m[7] * m[9] +
567            m[4] * m[1] * m[11] -
568            m[4] * m[3] * m[9] -
569            m[8] * m[1] * m[7] +
570            m[8] * m[3] * m[5]
571
572    inv[15] = m[0] * m[5] * m[10] -
573            m[0] * m[6] * m[9] -
574            m[4] * m[1] * m[10] +
575            m[4] * m[2] * m[9] +
576            m[8] * m[1] * m[6] -
577            m[8] * m[2] * m[5]
578
579    inv.forEach((v, i) => { inv[i] = v / det })
580    this._values = inv
581    return this
582  }
583
584  setMatrixValue (transformList) {
585    const temp = new DOMMatrix(transformList)
586    this._values = temp._values
587    this._is2D = temp._is2D
588    return this
589  }
590
591  transformPoint (point) {
592    point = new DOMPoint(point)
593    const x = point.x
594    const y = point.y
595    const z = point.z
596    const w = point.w
597    const values = this._values
598    const nx = values[M11] * x + values[M21] * y + values[M31] * z + values[M41] * w
599    const ny = values[M12] * x + values[M22] * y + values[M32] * z + values[M42] * w
600    const nz = values[M13] * x + values[M23] * y + values[M33] * z + values[M43] * w
601    const nw = values[M14] * x + values[M24] * y + values[M34] * z + values[M44] * w
602    return new DOMPoint(nx, ny, nz, nw)
603  }
604
605  toFloat32Array () {
606    return Float32Array.from(this._values)
607  }
608
609  toFloat64Array () {
610    return this._values.slice(0)
611  }
612
613  static fromMatrix (init) {
614    if (!(init instanceof DOMMatrix)) throw new TypeError('Expected DOMMatrix')
615    return new DOMMatrix(init._values)
616  }
617
618  static fromFloat32Array (init) {
619    if (!(init instanceof Float32Array)) throw new TypeError('Expected Float32Array')
620    return new DOMMatrix(init)
621  }
622
623  static fromFloat64Array (init) {
624    if (!(init instanceof Float64Array)) throw new TypeError('Expected Float64Array')
625    return new DOMMatrix(init)
626  }
627
628  [util.inspect.custom || 'inspect'] (depth, options) {
629    if (depth < 0) return '[DOMMatrix]'
630
631    return `DOMMatrix [
632      a: ${this.a}
633      b: ${this.b}
634      c: ${this.c}
635      d: ${this.d}
636      e: ${this.e}
637      f: ${this.f}
638      m11: ${this.m11}
639      m12: ${this.m12}
640      m13: ${this.m13}
641      m14: ${this.m14}
642      m21: ${this.m21}
643      m22: ${this.m22}
644      m23: ${this.m23}
645      m23: ${this.m23}
646      m31: ${this.m31}
647      m32: ${this.m32}
648      m33: ${this.m33}
649      m34: ${this.m34}
650      m41: ${this.m41}
651      m42: ${this.m42}
652      m43: ${this.m43}
653      m44: ${this.m44}
654      is2D: ${this.is2D}
655      isIdentity: ${this.isIdentity} ]`
656  }
657}
658
659/**
660 * Checks that `value` is a number and sets the value.
661 */
662function setNumber2D (receiver, index, value) {
663  if (typeof value !== 'number') throw new TypeError('Expected number')
664  return (receiver._values[index] = value)
665}
666
667/**
668 * Checks that `value` is a number, sets `_is2D = false` if necessary and sets
669 * the value.
670 */
671function setNumber3D (receiver, index, value) {
672  if (typeof value !== 'number') throw new TypeError('Expected number')
673  if (index === M33 || index === M44) {
674    if (value !== 1) receiver._is2D = false
675  } else if (value !== 0) receiver._is2D = false
676  return (receiver._values[index] = value)
677}
678
679Object.defineProperties(DOMMatrix.prototype, {
680  m11: { get () { return this._values[M11] }, set (v) { return setNumber2D(this, M11, v) } },
681  m12: { get () { return this._values[M12] }, set (v) { return setNumber2D(this, M12, v) } },
682  m13: { get () { return this._values[M13] }, set (v) { return setNumber3D(this, M13, v) } },
683  m14: { get () { return this._values[M14] }, set (v) { return setNumber3D(this, M14, v) } },
684  m21: { get () { return this._values[M21] }, set (v) { return setNumber2D(this, M21, v) } },
685  m22: { get () { return this._values[M22] }, set (v) { return setNumber2D(this, M22, v) } },
686  m23: { get () { return this._values[M23] }, set (v) { return setNumber3D(this, M23, v) } },
687  m24: { get () { return this._values[M24] }, set (v) { return setNumber3D(this, M24, v) } },
688  m31: { get () { return this._values[M31] }, set (v) { return setNumber3D(this, M31, v) } },
689  m32: { get () { return this._values[M32] }, set (v) { return setNumber3D(this, M32, v) } },
690  m33: { get () { return this._values[M33] }, set (v) { return setNumber3D(this, M33, v) } },
691  m34: { get () { return this._values[M34] }, set (v) { return setNumber3D(this, M34, v) } },
692  m41: { get () { return this._values[M41] }, set (v) { return setNumber2D(this, M41, v) } },
693  m42: { get () { return this._values[M42] }, set (v) { return setNumber2D(this, M42, v) } },
694  m43: { get () { return this._values[M43] }, set (v) { return setNumber3D(this, M43, v) } },
695  m44: { get () { return this._values[M44] }, set (v) { return setNumber3D(this, M44, v) } },
696
697  a: { get () { return this.m11 }, set (v) { return (this.m11 = v) } },
698  b: { get () { return this.m12 }, set (v) { return (this.m12 = v) } },
699  c: { get () { return this.m21 }, set (v) { return (this.m21 = v) } },
700  d: { get () { return this.m22 }, set (v) { return (this.m22 = v) } },
701  e: { get () { return this.m41 }, set (v) { return (this.m41 = v) } },
702  f: { get () { return this.m42 }, set (v) { return (this.m42 = v) } },
703
704  is2D: { get () { return this._is2D } }, // read-only
705
706  isIdentity: {
707    get () {
708      const values = this._values
709      return (values[M11] === 1 && values[M12] === 0 && values[M13] === 0 && values[M14] === 0 &&
710             values[M21] === 0 && values[M22] === 1 && values[M23] === 0 && values[M24] === 0 &&
711             values[M31] === 0 && values[M32] === 0 && values[M33] === 1 && values[M34] === 0 &&
712             values[M41] === 0 && values[M42] === 0 && values[M43] === 0 && values[M44] === 1)
713    }
714  }
715})
716
717/**
718 * Instantiates a DOMMatrix, bypassing the constructor.
719 * @param {Float64Array} values Value to assign to `_values`. This is assigned
720 *   without copying (okay because all usages are followed by a  multiply).
721 */
722function newInstance (values) {
723  const instance = Object.create(DOMMatrix.prototype)
724  instance.constructor = DOMMatrix
725  instance._is2D = true
726  instance._values = values
727  return instance
728}
729
730function multiply (A, B) {
731  const dest = new Float64Array(16)
732  for (let i = 0; i < 4; i++) {
733    for (let j = 0; j < 4; j++) {
734      let sum = 0
735      for (let k = 0; k < 4; k++) {
736        sum += A[i * 4 + k] * B[k * 4 + j]
737      }
738      dest[i * 4 + j] = sum
739    }
740  }
741  return dest
742}
743
744module.exports = { DOMMatrix, DOMPoint }
745
746
747/***/ },
748
749/***/ "./node_modules/canvas/lib/bindings.js"
750/*!*********************************************!*\
751  !*** ./node_modules/canvas/lib/bindings.js ***!
752  \*********************************************/
753(module, __unused_webpack_exports, __webpack_require__) {
754
755"use strict";
756
757
758const bindings = __webpack_require__(/*! ../build/Release/canvas.node */ "./node_modules/canvas/build/Release/canvas.node")
759
760module.exports = bindings
761
762bindings.ImageData.prototype.toString = function () {
763	return '[object ImageData]'
764}
765
766bindings.CanvasGradient.prototype.toString = function () {
767	return '[object CanvasGradient]'
768}
769
770
771/***/ },
772
773/***/ "./node_modules/canvas/lib/canvas.js"
774/*!*******************************************!*\
775  !*** ./node_modules/canvas/lib/canvas.js ***!
776  \*******************************************/
777(module, __unused_webpack_exports, __webpack_require__) {
778
779"use strict";
780
781
782/*!
783 * Canvas
784 * Copyright (c) 2010 LearnBoost <[email protected]>
785 * MIT Licensed
786 */
787
788const bindings = __webpack_require__(/*! ./bindings */ "./node_modules/canvas/lib/bindings.js")
789const Canvas = module.exports = bindings.Canvas
790const Context2d = __webpack_require__(/*! ./context2d */ "./node_modules/canvas/lib/context2d.js")
791const PNGStream = __webpack_require__(/*! ./pngstream */ "./node_modules/canvas/lib/pngstream.js")
792const PDFStream = __webpack_require__(/*! ./pdfstream */ "./node_modules/canvas/lib/pdfstream.js")
793const JPEGStream = __webpack_require__(/*! ./jpegstream */ "./node_modules/canvas/lib/jpegstream.js")
794const FORMATS = ['image/png', 'image/jpeg']
795const util = __webpack_require__(/*! util */ "util")
796
797// TODO || is for Node.js pre-v6.6.0
798Canvas.prototype[util.inspect.custom || 'inspect'] = function () {
799  return `[Canvas ${this.width}x${this.height}]`
800}
801
802Canvas.prototype.getContext = function (contextType, contextAttributes) {
803  if (contextType == '2d') {
804    const ctx = this._context2d || (this._context2d = new Context2d(this, contextAttributes))
805    this.context = ctx
806    ctx.canvas = this
807    return ctx
808  }
809}
810
811Canvas.prototype.pngStream =
812Canvas.prototype.createPNGStream = function (options) {
813  return new PNGStream(this, options)
814}
815
816Canvas.prototype.pdfStream =
817Canvas.prototype.createPDFStream = function (options) {
818  return new PDFStream(this, options)
819}
820
821Canvas.prototype.jpegStream =
822Canvas.prototype.createJPEGStream = function (options) {
823  return new JPEGStream(this, options)
824}
825
826Canvas.prototype.toDataURL = function (a1, a2, a3) {
827  // valid arg patterns (args -> [type, opts, fn]):
828  // [] -> ['image/png', null, null]
829  // [qual] -> ['image/png', null, null]
830  // [undefined] -> ['image/png', null, null]
831  // ['image/png'] -> ['image/png', null, null]
832  // ['image/png', qual] -> ['image/png', null, null]
833  // [fn] -> ['image/png', null, fn]
834  // [type, fn] -> [type, null, fn]
835  // [undefined, fn] -> ['image/png', null, fn]
836  // ['image/png', qual, fn] -> ['image/png', null, fn]
837  // ['image/jpeg', fn] -> ['image/jpeg', null, fn]
838  // ['image/jpeg', opts, fn] -> ['image/jpeg', opts, fn]
839  // ['image/jpeg', qual, fn] -> ['image/jpeg', {quality: qual}, fn]
840  // ['image/jpeg', undefined, fn] -> ['image/jpeg', null, fn]
841  // ['image/jpeg'] -> ['image/jpeg', null, fn]
842  // ['image/jpeg', opts] -> ['image/jpeg', opts, fn]
843  // ['image/jpeg', qual] -> ['image/jpeg', {quality: qual}, fn]
844
845  let type = 'image/png'
846  let opts = {}
847  let fn
848
849  if (typeof a1 === 'function') {
850    fn = a1
851  } else {
852    if (typeof a1 === 'string' && FORMATS.includes(a1.toLowerCase())) {
853      type = a1.toLowerCase()
854    }
855
856    if (typeof a2 === 'function') {
857      fn = a2
858    } else {
859      if (typeof a2 === 'object') {
860        opts = a2
861      } else if (typeof a2 === 'number') {
862        opts = { quality: Math.max(0, Math.min(1, a2)) }
863      }
864
865      if (typeof a3 === 'function') {
866        fn = a3
867      } else if (undefined !== a3) {
868        throw new TypeError(`${typeof a3} is not a function`)
869      }
870    }
871  }
872
873  if (this.width === 0 || this.height === 0) {
874    // Per spec, if the bitmap has no pixels, return this string:
875    const str = 'data:,'
876    if (fn) {
877      setTimeout(() => fn(null, str))
878      return
879    } else {
880      return str
881    }
882  }
883
884  if (fn) {
885    this.toBuffer((err, buf) => {
886      if (err) return fn(err)
887      fn(null, `data:${type};base64,${buf.toString('base64')}`)
888    }, type, opts)
889  } else {
890    return `data:${type};base64,${this.toBuffer(type, opts).toString('base64')}`
891  }
892}
893
894
895/***/ },
896
897/***/ "./node_modules/canvas/lib/context2d.js"
898/*!**********************************************!*\
899  !*** ./node_modules/canvas/lib/context2d.js ***!
900  \**********************************************/
901(module, __unused_webpack_exports, __webpack_require__) {
902
903"use strict";
904
905
906/*!
907 * Canvas - Context2d
908 * Copyright (c) 2010 LearnBoost <[email protected]>
909 * MIT Licensed
910 */
911
912const bindings = __webpack_require__(/*! ./bindings */ "./node_modules/canvas/lib/bindings.js")
913const parseFont = __webpack_require__(/*! ./parse-font */ "./node_modules/canvas/lib/parse-font.js")
914const { DOMMatrix } = __webpack_require__(/*! ./DOMMatrix */ "./node_modules/canvas/lib/DOMMatrix.js")
915
916bindings.CanvasRenderingContext2dInit(DOMMatrix, parseFont)
917module.exports = bindings.CanvasRenderingContext2d
918
919
920/***/ },
921
922/***/ "./node_modules/canvas/lib/image.js"
923/*!******************************************!*\
924  !*** ./node_modules/canvas/lib/image.js ***!
925  \******************************************/
926(module, __unused_webpack_exports, __webpack_require__) {
927
928"use strict";
929
930
931/*!
932 * Canvas - Image
933 * Copyright (c) 2010 LearnBoost <[email protected]>
934 * MIT Licensed
935 */
936
937/**
938 * Module dependencies.
939 */
940
941const bindings = __webpack_require__(/*! ./bindings */ "./node_modules/canvas/lib/bindings.js")
942const Image = module.exports = bindings.Image
943const util = __webpack_require__(/*! util */ "util")
944
945// Lazily loaded simple-get
946let get
947
948const { GetSource, SetSource } = bindings
949
950Object.defineProperty(Image.prototype, 'src', {
951  /**
952   * src setter. Valid values:
953   *  * `data:` URI
954   *  * Local file path
955   *  * HTTP or HTTPS URL
956   *  * Buffer containing image data (i.e. not a `data:` URI stored in a Buffer)
957   *
958   * @param {String|Buffer} val filename, buffer, data URI, URL
959   * @api public
960   */
961  set (val) {
962    if (typeof val === 'string') {
963      if (/^\s*data:/.test(val)) { // data: URI
964        const commaI = val.indexOf(',')
965        // 'base64' must come before the comma
966        const isBase64 = val.lastIndexOf('base64', commaI) !== -1
967        const content = val.slice(commaI + 1)
968        setSource(this, Buffer.from(content, isBase64 ? 'base64' : 'utf8'), val)
969      } else if (/^\s*https?:\/\//.test(val)) { // remote URL
970        const onerror = err => {
971          if (typeof this.onerror === 'function') {
972            this.onerror(err)
973          } else {
974            throw err
975          }
976        }
977
978        if (!get) get = __webpack_require__(/*! simple-get */ "./node_modules/simple-get/index.js")
979
980        get.concat({
981          url: val,
982          headers: { 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36' }
983        }, (err, res, data) => {
984          if (err) return onerror(err)
985
986          if (res.statusCode < 200 || res.statusCode >= 300) {
987            return onerror(new Error(`Server responded with ${res.statusCode}`))
988          }
989
990          setSource(this, data)
991        })
992      } else { // local file path assumed
993        setSource(this, val)
994      }
995    } else if (Buffer.isBuffer(val)) {
996      setSource(this, val)
997    }
998  },
999
1000  get () {
1001    // TODO https://github.com/Automattic/node-canvas/issues/118
1002    return getSource(this)
1003  },
1004
1005  configurable: true
1006})
1007
1008// TODO || is for Node.js pre-v6.6.0
1009Image.prototype[util.inspect.custom || 'inspect'] = function () {
1010  return '[Image' +
1011    (this.complete ? ':' + this.width + 'x' + this.height : '') +
1012    (this.src ? ' ' + this.src : '') +
1013    (this.complete ? ' complete' : '') +
1014    ']'
1015}
1016
1017function getSource (img) {
1018  return img._originalSource || GetSource.call(img)
1019}
1020
1021function setSource (img, src, origSrc) {
1022  SetSource.call(img, src)
1023  img._originalSource = origSrc
1024}
1025
1026
1027/***/ },
1028
1029/***/ "./node_modules/canvas/lib/jpegstream.js"
1030/*!***********************************************!*\
1031  !*** ./node_modules/canvas/lib/jpegstream.js ***!
1032  \***********************************************/
1033(module, __unused_webpack_exports, __webpack_require__) {
1034
1035"use strict";
1036
1037
1038/*!
1039 * Canvas - JPEGStream
1040 * Copyright (c) 2010 LearnBoost <[email protected]>
1041 * MIT Licensed
1042 */
1043
1044const { Readable } = __webpack_require__(/*! stream */ "stream")
1045function noop () {}
1046
1047class JPEGStream extends Readable {
1048  constructor (canvas, options) {
1049    super()
1050
1051    if (canvas.streamJPEGSync === undefined) {
1052      throw new Error('node-canvas was built without JPEG support.')
1053    }
1054
1055    this.options = options
1056    this.canvas = canvas
1057  }
1058
1059  _read () {
1060    // For now we're not controlling the c++ code's data emission, so we only
1061    // call canvas.streamJPEGSync once and let it emit data at will.
1062    this._read = noop
1063
1064    this.canvas.streamJPEGSync(this.options, (err, chunk) => {
1065      if (err) {
1066        this.emit('error', err)
1067      } else if (chunk) {
1068        this.push(chunk)
1069      } else {
1070        this.push(null)
1071      }
1072    })
1073  }
1074};
1075
1076module.exports = JPEGStream
1077
1078
1079/***/ },
1080
1081/***/ "./node_modules/canvas/lib/parse-font.js"
1082/*!***********************************************!*\
1083  !*** ./node_modules/canvas/lib/parse-font.js ***!
1084  \***********************************************/
1085(module) {
1086
1087"use strict";
1088
1089
1090/**
1091 * Font RegExp helpers.
1092 */
1093
1094const weights = 'bold|bolder|lighter|[1-9]00'
1095const styles = 'italic|oblique'
1096const variants = 'small-caps'
1097const stretches = 'ultra-condensed|extra-condensed|condensed|semi-condensed|semi-expanded|expanded|extra-expanded|ultra-expanded'
1098const units = 'px|pt|pc|in|cm|mm|%|em|ex|ch|rem|q'
1099const string = '\'([^\']+)\'|"([^"]+)"|[\\w\\s-]+'
1100
1101// [ [ <‘font-style’> || <font-variant-css21> || <‘font-weight’> || <‘font-stretch’> ]?
1102//    <‘font-size’> [ / <‘line-height’> ]? <‘font-family’> ]
1103// https://drafts.csswg.org/css-fonts-3/#font-prop
1104const weightRe = new RegExp(`(${weights}) +`, 'i')
1105const styleRe = new RegExp(`(${styles}) +`, 'i')
1106const variantRe = new RegExp(`(${variants}) +`, 'i')
1107const stretchRe = new RegExp(`(${stretches}) +`, 'i')
1108const sizeFamilyRe = new RegExp(
1109  `([\\d\\.]+)(${units}) *((?:${string})( *, *(?:${string}))*)`)
1110
1111/**
1112 * Cache font parsing.
1113 */
1114
1115const cache = {}
1116
1117const defaultHeight = 16 // pt, common browser default
1118
1119/**
1120 * Parse font `str`.
1121 *
1122 * @param {String} str
1123 * @return {Object} Parsed font. `size` is in device units. `unit` is the unit
1124 *   appearing in the input string.
1125 * @api private
1126 */
1127
1128module.exports = str => {
1129  // Cached
1130  if (cache[str]) return cache[str]
1131
1132  // Try for required properties first.
1133  const sizeFamily = sizeFamilyRe.exec(str)
1134  if (!sizeFamily) return // invalid
1135
1136  // Default values and required properties
1137  const font = {
1138    weight: 'normal',
1139    style: 'normal',
1140    stretch: 'normal',
1141    variant: 'normal',
1142    size: parseFloat(sizeFamily[1]),
1143    unit: sizeFamily[2],
1144    family: sizeFamily[3].replace(/["']/g, '').replace(/ *, */g, ',')
1145  }
1146
1147  // Optional, unordered properties.
1148  let weight, style, variant, stretch
1149  // Stop search at `sizeFamily.index`
1150  const substr = str.substring(0, sizeFamily.index)
1151  if ((weight = weightRe.exec(substr))) font.weight = weight[1]
1152  if ((style = styleRe.exec(substr))) font.style = style[1]
1153  if ((variant = variantRe.exec(substr))) font.variant = variant[1]
1154  if ((stretch = stretchRe.exec(substr))) font.stretch = stretch[1]
1155
1156  // Convert to device units. (`font.unit` is the original unit)
1157  // TODO: ch, ex
1158  switch (font.unit) {
1159    case 'pt':
1160      font.size /= 0.75
1161      break
1162    case 'pc':
1163      font.size *= 16
1164      break
1165    case 'in':
1166      font.size *= 96
1167      break
1168    case 'cm':
1169      font.size *= 96.0 / 2.54
1170      break
1171    case 'mm':
1172      font.size *= 96.0 / 25.4
1173      break
1174    case '%':
1175      // TODO disabled because existing unit tests assume 100
1176      // font.size *= defaultHeight / 100 / 0.75
1177      break
1178    case 'em':
1179    case 'rem':
1180      font.size *= defaultHeight / 0.75
1181      break
1182    case 'q':
1183      font.size *= 96 / 25.4 / 4
1184      break
1185  }
1186
1187  return (cache[str] = font)
1188}
1189
1190
1191/***/ },
1192
1193/***/ "./node_modules/canvas/lib/pattern.js"
1194/*!********************************************!*\
1195  !*** ./node_modules/canvas/lib/pattern.js ***!
1196  \********************************************/
1197(module, __unused_webpack_exports, __webpack_require__) {
1198
1199"use strict";
1200
1201
1202/*!
1203 * Canvas - CanvasPattern
1204 * Copyright (c) 2010 LearnBoost <[email protected]>
1205 * MIT Licensed
1206 */
1207
1208const bindings = __webpack_require__(/*! ./bindings */ "./node_modules/canvas/lib/bindings.js")
1209const { DOMMatrix } = __webpack_require__(/*! ./DOMMatrix */ "./node_modules/canvas/lib/DOMMatrix.js")
1210
1211bindings.CanvasPatternInit(DOMMatrix)
1212module.exports = bindings.CanvasPattern
1213
1214bindings.CanvasPattern.prototype.toString = function () {
1215	return '[object CanvasPattern]'
1216}
1217
1218
1219/***/ },
1220
1221/***/ "./node_modules/canvas/lib/pdfstream.js"
1222/*!**********************************************!*\
1223  !*** ./node_modules/canvas/lib/pdfstream.js ***!
1224  \**********************************************/
1225(module, __unused_webpack_exports, __webpack_require__) {
1226
1227"use strict";
1228
1229
1230/*!
1231 * Canvas - PDFStream
1232 */
1233
1234const { Readable } = __webpack_require__(/*! stream */ "stream")
1235function noop () {}
1236
1237class PDFStream extends Readable {
1238  constructor (canvas, options) {
1239    super()
1240
1241    this.canvas = canvas
1242    this.options = options
1243  }
1244
1245  _read () {
1246    // For now we're not controlling the c++ code's data emission, so we only
1247    // call canvas.streamPDFSync once and let it emit data at will.
1248    this._read = noop
1249
1250    this.canvas.streamPDFSync((err, chunk, len) => {
1251      if (err) {
1252        this.emit('error', err)
1253      } else if (len) {
1254        this.push(chunk)
1255      } else {
1256        this.push(null)
1257      }
1258    }, this.options)
1259  }
1260}
1261
1262module.exports = PDFStream
1263
1264
1265/***/ },
1266
1267/***/ "./node_modules/canvas/lib/pngstream.js"
1268/*!**********************************************!*\
1269  !*** ./node_modules/canvas/lib/pngstream.js ***!
1270  \**********************************************/
1271(module, __unused_webpack_exports, __webpack_require__) {
1272
1273"use strict";
1274
1275
1276/*!
1277 * Canvas - PNGStream
1278 * Copyright (c) 2010 LearnBoost <[email protected]>
1279 * MIT Licensed
1280 */
1281
1282const { Readable } = __webpack_require__(/*! stream */ "stream")
1283function noop () {}
1284
1285class PNGStream extends Readable {
1286  constructor (canvas, options) {
1287    super()
1288
1289    if (options &&
1290      options.palette instanceof Uint8ClampedArray &&
1291      options.palette.length % 4 !== 0) {
1292      throw new Error('Palette length must be a multiple of 4.')
1293    }
1294    this.canvas = canvas
1295    this.options = options || {}
1296  }
1297
1298  _read () {
1299    // For now we're not controlling the c++ code's data emission, so we only
1300    // call canvas.streamPNGSync once and let it emit data at will.
1301    this._read = noop
1302
1303    this.canvas.streamPNGSync((err, chunk, len) => {
1304      if (err) {
1305        this.emit('error', err)
1306      } else if (len) {
1307        this.push(chunk)
1308      } else {
1309        this.push(null)
1310      }
1311    }, this.options)
1312  }
1313}
1314
1315module.exports = PNGStream
1316
1317
1318/***/ },
vendor: 12,684 bytes, lines 1318-1833
1318
1319
1320/***/ "./node_modules/jquery/dist/jquery.js"
1321/*!********************************************!*\
1322  !*** ./node_modules/jquery/dist/jquery.js ***!
1323  \********************************************/
1324(module, exports) {
1325
1326var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
1327 * jQuery JavaScript Library v3.7.1
1328 * https://jquery.com/
1329 *
1330 * Copyright OpenJS Foundation and other contributors
1331 * Released under the MIT license
1332 * https://jquery.org/license
1333 *
1334 * Date: 2023-08-28T13:37Z
1335 */
1336( function( global, factory ) {
1337
1338	"use strict";
1339
1340	if (  true && typeof module.exports === "object" ) {
1341
1342		// For CommonJS and CommonJS-like environments where a proper `window`
1343		// is present, execute the factory and get jQuery.
1344		// For environments that do not have a `window` with a `document`
1345		// (such as Node.js), expose a factory as module.exports.
1346		// This accentuates the need for the creation of a real `window`.
1347		// e.g. var jQuery = require("jquery")(window);
1348		// See ticket trac-14549 for more info.
1349		module.exports = global.document ?
1350			factory( global, true ) :
1351			function( w ) {
1352				if ( !w.document ) {
1353					throw new Error( "jQuery requires a window with a document" );
1354				}
1355				return factory( w );
1356			};
1357	} else {
1358		factory( global );
1359	}
1360
1361// Pass this if window is not defined yet
1362} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
1363
1364// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
1365// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
1366// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
1367// enough that all such attempts are guarded in a try block.
1368"use strict";
1369
1370var arr = [];
1371
1372var getProto = Object.getPrototypeOf;
1373
1374var slice = arr.slice;
1375
1376var flat = arr.flat ? function( array ) {
1377	return arr.flat.call( array );
1378} : function( array ) {
1379	return arr.concat.apply( [], array );
1380};
1381
1382
1383var push = arr.push;
1384
1385var indexOf = arr.indexOf;
1386
1387var class2type = {};
1388
1389var toString = class2type.toString;
1390
1391var hasOwn = class2type.hasOwnProperty;
1392
1393var fnToString = hasOwn.toString;
1394
1395var ObjectFunctionString = fnToString.call( Object );
1396
1397var support = {};
1398
1399var isFunction = function isFunction( obj ) {
1400
1401		// Support: Chrome <=57, Firefox <=52
1402		// In some browsers, typeof returns "function" for HTML <object> elements
1403		// (i.e., `typeof document.createElement( "object" ) === "function"`).
1404		// We don't want to classify *any* DOM node as a function.
1405		// Support: QtWeb <=3.8.5, WebKit <=534.34, wkhtmltopdf tool <=0.12.5
1406		// Plus for old WebKit, typeof returns "function" for HTML collections
1407		// (e.g., `typeof document.getElementsByTagName("div") === "function"`). (gh-4756)
1408		return typeof obj === "function" && typeof obj.nodeType !== "number" &&
1409			typeof obj.item !== "function";
1410	};
1411
1412
1413var isWindow = function isWindow( obj ) {
1414		return obj != null && obj === obj.window;
1415	};
1416
1417
1418var document = window.document;
1419
1420
1421
1422	var preservedScriptAttributes = {
1423		type: true,
1424		src: true,
1425		nonce: true,
1426		noModule: true
1427	};
1428
1429	function DOMEval( code, node, doc ) {
1430		doc = doc || document;
1431
1432		var i, val,
1433			script = doc.createElement( "script" );
1434
1435		script.text = code;
1436		if ( node ) {
1437			for ( i in preservedScriptAttributes ) {
1438
1439				// Support: Firefox 64+, Edge 18+
1440				// Some browsers don't support the "nonce" property on scripts.
1441				// On the other hand, just using `getAttribute` is not enough as
1442				// the `nonce` attribute is reset to an empty string whenever it
1443				// becomes browsing-context connected.
1444				// See https://github.com/whatwg/html/issues/2369
1445				// See https://html.spec.whatwg.org/#nonce-attributes
1446				// The `node.getAttribute` check was added for the sake of
1447				// `jQuery.globalEval` so that it can fake a nonce-containing node
1448				// via an object.
1449				val = node[ i ] || node.getAttribute && node.getAttribute( i );
1450				if ( val ) {
1451					script.setAttribute( i, val );
1452				}
1453			}
1454		}
1455		doc.head.appendChild( script ).parentNode.removeChild( script );
1456	}
1457
1458
1459function toType( obj ) {
1460	if ( obj == null ) {
1461		return obj + "";
1462	}
1463
1464	// Support: Android <=2.3 only (functionish RegExp)
1465	return typeof obj === "object" || typeof obj === "function" ?
1466		class2type[ toString.call( obj ) ] || "object" :
1467		typeof obj;
1468}
1469/* global Symbol */
1470// Defining this global in .eslintrc.json would create a danger of using the global
1471// unguarded in another place, it seems safer to define global only for this module
1472
1473
1474
1475var version = "3.7.1",
1476
1477	rhtmlSuffix = /HTML$/i,
1478
1479	// Define a local copy of jQuery
1480	jQuery = function( selector, context ) {
1481
1482		// The jQuery object is actually just the init constructor 'enhanced'
1483		// Need init if jQuery is called (just allow error to be thrown if not included)
1484		return new jQuery.fn.init( selector, context );
1485	};
1486
1487jQuery.fn = jQuery.prototype = {
1488
1489	// The current version of jQuery being used
1490	jquery: version,
1491
1492	constructor: jQuery,
1493
1494	// The default length of a jQuery object is 0
1495	length: 0,
1496
1497	toArray: function() {
1498		return slice.call( this );
1499	},
1500
1501	// Get the Nth element in the matched element set OR
1502	// Get the whole matched element set as a clean array
1503	get: function( num ) {
1504
1505		// Return all the elements in a clean array
1506		if ( num == null ) {
1507			return slice.call( this );
1508		}
1509
1510		// Return just the one element from the set
1511		return num < 0 ? this[ num + this.length ] : this[ num ];
1512	},
1513
1514	// Take an array of elements and push it onto the stack
1515	// (returning the new matched element set)
1516	pushStack: function( elems ) {
1517
1518		// Build a new jQuery matched element set
1519		var ret = jQuery.merge( this.constructor(), elems );
1520
1521		// Add the old object onto the stack (as a reference)
1522		ret.prevObject = this;
1523
1524		// Return the newly-formed element set
1525		return ret;
1526	},
1527
1528	// Execute a callback for every element in the matched set.
1529	each: function( callback ) {
1530		return jQuery.each( this, callback );
1531	},
1532
1533	map: function( callback ) {
1534		return this.pushStack( jQuery.map( this, function( elem, i ) {
1535			return callback.call( elem, i, elem );
1536		} ) );
1537	},
1538
1539	slice: function() {
1540		return this.pushStack( slice.apply( this, arguments ) );
1541	},
1542
1543	first: function() {
1544		return this.eq( 0 );
1545	},
1546
1547	last: function() {
1548		return this.eq( -1 );
1549	},
1550
1551	even: function() {
1552		return this.pushStack( jQuery.grep( this, function( _elem, i ) {
1553			return ( i + 1 ) % 2;
1554		} ) );
1555	},
1556
1557	odd: function() {
1558		return this.pushStack( jQuery.grep( this, function( _elem, i ) {
1559			return i % 2;
1560		} ) );
1561	},
1562
1563	eq: function( i ) {
1564		var len = this.length,
1565			j = +i + ( i < 0 ? len : 0 );
1566		return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
1567	},
1568
1569	end: function() {
1570		return this.prevObject || this.constructor();
1571	},
1572
1573	// For internal use only.
1574	// Behaves like an Array's method, not like a jQuery method.
1575	push: push,
1576	sort: arr.sort,
1577	splice: arr.splice
1578};
1579
1580jQuery.extend = jQuery.fn.extend = function() {
1581	var options, name, src, copy, copyIsArray, clone,
1582		target = arguments[ 0 ] || {},
1583		i = 1,
1584		length = arguments.length,
1585		deep = false;
1586
1587	// Handle a deep copy situation
1588	if ( typeof target === "boolean" ) {
1589		deep = target;
1590
1591		// Skip the boolean and the target
1592		target = arguments[ i ] || {};
1593		i++;
1594	}
1595
1596	// Handle case when target is a string or something (possible in deep copy)
1597	if ( typeof target !== "object" && !isFunction( target ) ) {
1598		target = {};
1599	}
1600
1601	// Extend jQuery itself if only one argument is passed
1602	if ( i === length ) {
1603		target = this;
1604		i--;
1605	}
1606
1607	for ( ; i < length; i++ ) {
1608
1609		// Only deal with non-null/undefined values
1610		if ( ( options = arguments[ i ] ) != null ) {
1611
1612			// Extend the base object
1613			for ( name in options ) {
1614				copy = options[ name ];
1615
1616				// Prevent Object.prototype pollution
1617				// Prevent never-ending loop
1618				if ( name === "__proto__" || target === copy ) {
1619					continue;
1620				}
1621
1622				// Recurse if we're merging plain objects or arrays
1623				if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
1624					( copyIsArray = Array.isArray( copy ) ) ) ) {
1625					src = target[ name ];
1626
1627					// Ensure proper type for the source value
1628					if ( copyIsArray && !Array.isArray( src ) ) {
1629						clone = [];
1630					} else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
1631						clone = {};
1632					} else {
1633						clone = src;
1634					}
1635					copyIsArray = false;
1636
1637					// Never move original objects, clone them
1638					target[ name ] = jQuery.extend( deep, clone, copy );
1639
1640				// Don't bring in undefined values
1641				} else if ( copy !== undefined ) {
1642					target[ name ] = copy;
1643				}
1644			}
1645		}
1646	}
1647
1648	// Return the modified object
1649	return target;
1650};
1651
1652jQuery.extend( {
1653
1654	// Unique for each copy of jQuery on the page
1655	expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
1656
1657	// Assume jQuery is ready without the ready module
1658	isReady: true,
1659
1660	error: function( msg ) {
1661		throw new Error( msg );
1662	},
1663
1664	noop: function() {},
1665
1666	isPlainObject: function( obj ) {
1667		var proto, Ctor;
1668
1669		// Detect obvious negatives
1670		// Use toString instead of jQuery.type to catch host objects
1671		if ( !obj || toString.call( obj ) !== "[object Object]" ) {
1672			return false;
1673		}
1674
1675		proto = getProto( obj );
1676
1677		// Objects with no prototype (e.g., `Object.create( null )`) are plain
1678		if ( !proto ) {
1679			return true;
1680		}
1681
1682		// Objects with prototype are plain iff they were constructed by a global Object function
1683		Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
1684		return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
1685	},
1686
1687	isEmptyObject: function( obj ) {
1688		var name;
1689
1690		for ( name in obj ) {
1691			return false;
1692		}
1693		return true;
1694	},
1695
1696	// Evaluates a script in a provided context; falls back to the global one
1697	// if not specified.
1698	globalEval: function( code, options, doc ) {
1699		DOMEval( code, { nonce: options && options.nonce }, doc );
1700	},
1701
1702	each: function( obj, callback ) {
1703		var length, i = 0;
1704
1705		if ( isArrayLike( obj ) ) {
1706			length = obj.length;
1707			for ( ; i < length; i++ ) {
1708				if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
1709					break;
1710				}
1711			}
1712		} else {
1713			for ( i in obj ) {
1714				if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
1715					break;
1716				}
1717			}
1718		}
1719
1720		return obj;
1721	},
1722
1723
1724	// Retrieve the text value of an array of DOM nodes
1725	text: function( elem ) {
1726		var node,
1727			ret = "",
1728			i = 0,
1729			nodeType = elem.nodeType;
1730
1731		if ( !nodeType ) {
1732
1733			// If no nodeType, this is expected to be an array
1734			while ( ( node = elem[ i++ ] ) ) {
1735
1736				// Do not traverse comment nodes
1737				ret += jQuery.text( node );
1738			}
1739		}
1740		if ( nodeType === 1 || nodeType === 11 ) {
1741			return elem.textContent;
1742		}
1743		if ( nodeType === 9 ) {
1744			return elem.documentElement.textContent;
1745		}
1746		if ( nodeType === 3 || nodeType === 4 ) {
1747			return elem.nodeValue;
1748		}
1749
1750		// Do not include comment or processing instruction nodes
1751
1752		return ret;
1753	},
1754
1755	// results is for internal usage only
1756	makeArray: function( arr, results ) {
1757		var ret = results || [];
1758
1759		if ( arr != null ) {
1760			if ( isArrayLike( Object( arr ) ) ) {
1761				jQuery.merge( ret,
1762					typeof arr === "string" ?
1763						[ arr ] : arr
1764				);
1765			} else {
1766				push.call( ret, arr );
1767			}
1768		}
1769
1770		return ret;
1771	},
1772
1773	inArray: function( elem, arr, i ) {
1774		return arr == null ? -1 : indexOf.call( arr, elem, i );
1775	},
1776
1777	isXMLDoc: function( elem ) {
1778		var namespace = elem && elem.namespaceURI,
1779			docElem = elem && ( elem.ownerDocument || elem ).documentElement;
1780
1781		// Assume HTML when documentElement doesn't yet exist, such as inside
1782		// document fragments.
1783		return !rhtmlSuffix.test( namespace || docElem && docElem.nodeName || "HTML" );
1784	},
1785
1786	// Support: Android <=4.0 only, PhantomJS 1 only
1787	// push.apply(_, arraylike) throws on ancient WebKit
1788	merge: function( first, second ) {
1789		var len = +second.length,
1790			j = 0,
1791			i = first.length;
1792
1793		for ( ; j < len; j++ ) {
1794			first[ i++ ] = second[ j ];
1795		}
1796
1797		first.length = i;
1798
1799		return first;
1800	},
1801
1802	grep: function( elems, callback, invert ) {
1803		var callbackInverse,
1804			matches = [],
1805			i = 0,
1806			length = elems.length,
1807			callbackExpect = !invert;
1808
1809		// Go through the array, only saving the items
1810		// that pass the validator function
1811		for ( ; i < length; i++ ) {
1812			callbackInverse = !callback( elems[ i ], i );
1813			if ( callbackInverse !== callbackExpect ) {
1814				matches.push( elems[ i ] );
1815			}
1816		}
1817
1818		return matches;
1819	},
1820
1821	// arg is for internal usage only
1822	map: function( elems, callback, arg ) {
1823		var length, value,
1824			i = 0,
1825			ret = [];
1826
1827		// Go through the array, translating each of the items to their new values
1828		if ( isArrayLike( elems ) ) {
1829			length = elems.length;
1830			for ( ; i < length; i++ ) {
1831				value = callback( elems[ i ], i, arg );
1832
1833				if ( value != null ) {
vendor: 17,514 bytes, lines 1834-2455
1834					ret.push( value );
1835				}
1836			}
1837
1838		// Go through every key on the object,
1839		} else {
1840			for ( i in elems ) {
1841				value = callback( elems[ i ], i, arg );
1842
1843				if ( value != null ) {
1844					ret.push( value );
1845				}
1846			}
1847		}
1848
1849		// Flatten any nested arrays
1850		return flat( ret );
1851	},
1852
1853	// A global GUID counter for objects
1854	guid: 1,
1855
1856	// jQuery.support is not used in Core but other projects attach their
1857	// properties to it so it needs to exist.
1858	support: support
1859} );
1860
1861if ( typeof Symbol === "function" ) {
1862	jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
1863}
1864
1865// Populate the class2type map
1866jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
1867	function( _i, name ) {
1868		class2type[ "[object " + name + "]" ] = name.toLowerCase();
1869	} );
1870
1871function isArrayLike( obj ) {
1872
1873	// Support: real iOS 8.2 only (not reproducible in simulator)
1874	// `in` check used to prevent JIT error (gh-2145)
1875	// hasOwn isn't used here due to false negatives
1876	// regarding Nodelist length in IE
1877	var length = !!obj && "length" in obj && obj.length,
1878		type = toType( obj );
1879
1880	if ( isFunction( obj ) || isWindow( obj ) ) {
1881		return false;
1882	}
1883
1884	return type === "array" || length === 0 ||
1885		typeof length === "number" && length > 0 && ( length - 1 ) in obj;
1886}
1887
1888
1889function nodeName( elem, name ) {
1890
1891	return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
1892
1893}
1894var pop = arr.pop;
1895
1896
1897var sort = arr.sort;
1898
1899
1900var splice = arr.splice;
1901
1902
1903var whitespace = "[\\x20\\t\\r\\n\\f]";
1904
1905
1906var rtrimCSS = new RegExp(
1907	"^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$",
1908	"g"
1909);
1910
1911
1912
1913
1914// Note: an element does not contain itself
1915jQuery.contains = function( a, b ) {
1916	var bup = b && b.parentNode;
1917
1918	return a === bup || !!( bup && bup.nodeType === 1 && (
1919
1920		// Support: IE 9 - 11+
1921		// IE doesn't have `contains` on SVG.
1922		a.contains ?
1923			a.contains( bup ) :
1924			a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
1925	) );
1926};
1927
1928
1929
1930
1931// CSS string/identifier serialization
1932// https://drafts.csswg.org/cssom/#common-serializing-idioms
1933var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g;
1934
1935function fcssescape( ch, asCodePoint ) {
1936	if ( asCodePoint ) {
1937
1938		// U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
1939		if ( ch === "\0" ) {
1940			return "\uFFFD";
1941		}
1942
1943		// Control characters and (dependent upon position) numbers get escaped as code points
1944		return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
1945	}
1946
1947	// Other potentially-special ASCII characters get backslash-escaped
1948	return "\\" + ch;
1949}
1950
1951jQuery.escapeSelector = function( sel ) {
1952	return ( sel + "" ).replace( rcssescape, fcssescape );
1953};
1954
1955
1956
1957
1958var preferredDoc = document,
1959	pushNative = push;
1960
1961( function() {
1962
1963var i,
1964	Expr,
1965	outermostContext,
1966	sortInput,
1967	hasDuplicate,
1968	push = pushNative,
1969
1970	// Local document vars
1971	document,
1972	documentElement,
1973	documentIsHTML,
1974	rbuggyQSA,
1975	matches,
1976
1977	// Instance-specific data
1978	expando = jQuery.expando,
1979	dirruns = 0,
1980	done = 0,
1981	classCache = createCache(),
1982	tokenCache = createCache(),
1983	compilerCache = createCache(),
1984	nonnativeSelectorCache = createCache(),
1985	sortOrder = function( a, b ) {
1986		if ( a === b ) {
1987			hasDuplicate = true;
1988		}
1989		return 0;
1990	},
1991
1992	booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|" +
1993		"loop|multiple|open|readonly|required|scoped",
1994
1995	// Regular expressions
1996
1997	// https://www.w3.org/TR/css-syntax-3/#ident-token-diagram
1998	identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace +
1999		"?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",
2000
2001	// Attribute selectors: https://www.w3.org/TR/selectors/#attribute-selectors
2002	attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
2003
2004		// Operator (capture 2)
2005		"*([*^$|!~]?=)" + whitespace +
2006
2007		// "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
2008		"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" +
2009		whitespace + "*\\]",
2010
2011	pseudos = ":(" + identifier + ")(?:\\((" +
2012
2013		// To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
2014		// 1. quoted (capture 3; capture 4 or capture 5)
2015		"('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
2016
2017		// 2. simple (capture 6)
2018		"((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
2019
2020		// 3. anything else (capture 2)
2021		".*" +
2022		")\\)|)",
2023
2024	// Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
2025	rwhitespace = new RegExp( whitespace + "+", "g" ),
2026
2027	rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
2028	rleadingCombinator = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" +
2029		whitespace + "*" ),
2030	rdescend = new RegExp( whitespace + "|>" ),
2031
2032	rpseudo = new RegExp( pseudos ),
2033	ridentifier = new RegExp( "^" + identifier + "$" ),
2034
2035	matchExpr = {
2036		ID: new RegExp( "^#(" + identifier + ")" ),
2037		CLASS: new RegExp( "^\\.(" + identifier + ")" ),
2038		TAG: new RegExp( "^(" + identifier + "|[*])" ),
2039		ATTR: new RegExp( "^" + attributes ),
2040		PSEUDO: new RegExp( "^" + pseudos ),
2041		CHILD: new RegExp(
2042			"^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" +
2043				whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" +
2044				whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
2045		bool: new RegExp( "^(?:" + booleans + ")$", "i" ),
2046
2047		// For use in libraries implementing .is()
2048		// We use this for POS matching in `select`
2049		needsContext: new RegExp( "^" + whitespace +
2050			"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace +
2051			"*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
2052	},
2053
2054	rinputs = /^(?:input|select|textarea|button)$/i,
2055	rheader = /^h\d$/i,
2056
2057	// Easily-parseable/retrievable ID or TAG or CLASS selectors
2058	rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
2059
2060	rsibling = /[+~]/,
2061
2062	// CSS escapes
2063	// https://www.w3.org/TR/CSS21/syndata.html#escaped-characters
2064	runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace +
2065		"?|\\\\([^\\r\\n\\f])", "g" ),
2066	funescape = function( escape, nonHex ) {
2067		var high = "0x" + escape.slice( 1 ) - 0x10000;
2068
2069		if ( nonHex ) {
2070
2071			// Strip the backslash prefix from a non-hex escape sequence
2072			return nonHex;
2073		}
2074
2075		// Replace a hexadecimal escape sequence with the encoded Unicode code point
2076		// Support: IE <=11+
2077		// For values outside the Basic Multilingual Plane (BMP), manually construct a
2078		// surrogate pair
2079		return high < 0 ?
2080			String.fromCharCode( high + 0x10000 ) :
2081			String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
2082	},
2083
2084	// Used for iframes; see `setDocument`.
2085	// Support: IE 9 - 11+, Edge 12 - 18+
2086	// Removing the function wrapper causes a "Permission Denied"
2087	// error in IE/Edge.
2088	unloadHandler = function() {
2089		setDocument();
2090	},
2091
2092	inDisabledFieldset = addCombinator(
2093		function( elem ) {
2094			return elem.disabled === true && nodeName( elem, "fieldset" );
2095		},
2096		{ dir: "parentNode", next: "legend" }
2097	);
2098
2099// Support: IE <=9 only
2100// Accessing document.activeElement can throw unexpectedly
2101// https://bugs.jquery.com/ticket/13393
2102function safeActiveElement() {
2103	try {
2104		return document.activeElement;
2105	} catch ( err ) { }
2106}
2107
2108// Optimize for push.apply( _, NodeList )
2109try {
2110	push.apply(
2111		( arr = slice.call( preferredDoc.childNodes ) ),
2112		preferredDoc.childNodes
2113	);
2114
2115	// Support: Android <=4.0
2116	// Detect silently failing push.apply
2117	// eslint-disable-next-line no-unused-expressions
2118	arr[ preferredDoc.childNodes.length ].nodeType;
2119} catch ( e ) {
2120	push = {
2121		apply: function( target, els ) {
2122			pushNative.apply( target, slice.call( els ) );
2123		},
2124		call: function( target ) {
2125			pushNative.apply( target, slice.call( arguments, 1 ) );
2126		}
2127	};
2128}
2129
2130function find( selector, context, results, seed ) {
2131	var m, i, elem, nid, match, groups, newSelector,
2132		newContext = context && context.ownerDocument,
2133
2134		// nodeType defaults to 9, since context defaults to document
2135		nodeType = context ? context.nodeType : 9;
2136
2137	results = results || [];
2138
2139	// Return early from calls with invalid selector or context
2140	if ( typeof selector !== "string" || !selector ||
2141		nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
2142
2143		return results;
2144	}
2145
2146	// Try to shortcut find operations (as opposed to filters) in HTML documents
2147	if ( !seed ) {
2148		setDocument( context );
2149		context = context || document;
2150
2151		if ( documentIsHTML ) {
2152
2153			// If the selector is sufficiently simple, try using a "get*By*" DOM method
2154			// (excepting DocumentFragment context, where the methods don't exist)
2155			if ( nodeType !== 11 && ( match = rquickExpr.exec( selector ) ) ) {
2156
2157				// ID selector
2158				if ( ( m = match[ 1 ] ) ) {
2159
2160					// Document context
2161					if ( nodeType === 9 ) {
2162						if ( ( elem = context.getElementById( m ) ) ) {
2163
2164							// Support: IE 9 only
2165							// getElementById can match elements by name instead of ID
2166							if ( elem.id === m ) {
2167								push.call( results, elem );
2168								return results;
2169							}
2170						} else {
2171							return results;
2172						}
2173
2174					// Element context
2175					} else {
2176
2177						// Support: IE 9 only
2178						// getElementById can match elements by name instead of ID
2179						if ( newContext && ( elem = newContext.getElementById( m ) ) &&
2180							find.contains( context, elem ) &&
2181							elem.id === m ) {
2182
2183							push.call( results, elem );
2184							return results;
2185						}
2186					}
2187
2188				// Type selector
2189				} else if ( match[ 2 ] ) {
2190					push.apply( results, context.getElementsByTagName( selector ) );
2191					return results;
2192
2193				// Class selector
2194				} else if ( ( m = match[ 3 ] ) && context.getElementsByClassName ) {
2195					push.apply( results, context.getElementsByClassName( m ) );
2196					return results;
2197				}
2198			}
2199
2200			// Take advantage of querySelectorAll
2201			if ( !nonnativeSelectorCache[ selector + " " ] &&
2202				( !rbuggyQSA || !rbuggyQSA.test( selector ) ) ) {
2203
2204				newSelector = selector;
2205				newContext = context;
2206
2207				// qSA considers elements outside a scoping root when evaluating child or
2208				// descendant combinators, which is not what we want.
2209				// In such cases, we work around the behavior by prefixing every selector in the
2210				// list with an ID selector referencing the scope context.
2211				// The technique has to be used as well when a leading combinator is used
2212				// as such selectors are not recognized by querySelectorAll.
2213				// Thanks to Andrew Dupont for this technique.
2214				if ( nodeType === 1 &&
2215					( rdescend.test( selector ) || rleadingCombinator.test( selector ) ) ) {
2216
2217					// Expand context for sibling selectors
2218					newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
2219						context;
2220
2221					// We can use :scope instead of the ID hack if the browser
2222					// supports it & if we're not changing the context.
2223					// Support: IE 11+, Edge 17 - 18+
2224					// IE/Edge sometimes throw a "Permission denied" error when
2225					// strict-comparing two documents; shallow comparisons work.
2226					// eslint-disable-next-line eqeqeq
2227					if ( newContext != context || !support.scope ) {
2228
2229						// Capture the context ID, setting it first if necessary
2230						if ( ( nid = context.getAttribute( "id" ) ) ) {
2231							nid = jQuery.escapeSelector( nid );
2232						} else {
2233							context.setAttribute( "id", ( nid = expando ) );
2234						}
2235					}
2236
2237					// Prefix every selector in the list
2238					groups = tokenize( selector );
2239					i = groups.length;
2240					while ( i-- ) {
2241						groups[ i ] = ( nid ? "#" + nid : ":scope" ) + " " +
2242							toSelector( groups[ i ] );
2243					}
2244					newSelector = groups.join( "," );
2245				}
2246
2247				try {
2248					push.apply( results,
2249						newContext.querySelectorAll( newSelector )
2250					);
2251					return results;
2252				} catch ( qsaError ) {
2253					nonnativeSelectorCache( selector, true );
2254				} finally {
2255					if ( nid === expando ) {
2256						context.removeAttribute( "id" );
2257					}
2258				}
2259			}
2260		}
2261	}
2262
2263	// All others
2264	return select( selector.replace( rtrimCSS, "$1" ), context, results, seed );
2265}
2266
2267/**
2268 * Create key-value caches of limited size
2269 * @returns {function(string, object)} Returns the Object data after storing it on itself with
2270 *	property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
2271 *	deleting the oldest entry
2272 */
2273function createCache() {
2274	var keys = [];
2275
2276	function cache( key, value ) {
2277
2278		// Use (key + " ") to avoid collision with native prototype properties
2279		// (see https://github.com/jquery/sizzle/issues/157)
2280		if ( keys.push( key + " " ) > Expr.cacheLength ) {
2281
2282			// Only keep the most recent entries
2283			delete cache[ keys.shift() ];
2284		}
2285		return ( cache[ key + " " ] = value );
2286	}
2287	return cache;
2288}
2289
2290/**
2291 * Mark a function for special use by jQuery selector module
2292 * @param {Function} fn The function to mark
2293 */
2294function markFunction( fn ) {
2295	fn[ expando ] = true;
2296	return fn;
2297}
2298
2299/**
2300 * Support testing using an element
2301 * @param {Function} fn Passed the created element and returns a boolean result
2302 */
2303function assert( fn ) {
2304	var el = document.createElement( "fieldset" );
2305
2306	try {
2307		return !!fn( el );
2308	} catch ( e ) {
2309		return false;
2310	} finally {
2311
2312		// Remove from its parent by default
2313		if ( el.parentNode ) {
2314			el.parentNode.removeChild( el );
2315		}
2316
2317		// release memory in IE
2318		el = null;
2319	}
2320}
2321
2322/**
2323 * Returns a function to use in pseudos for input types
2324 * @param {String} type
2325 */
2326function createInputPseudo( type ) {
2327	return function( elem ) {
2328		return nodeName( elem, "input" ) && elem.type === type;
2329	};
2330}
2331
2332/**
2333 * Returns a function to use in pseudos for buttons
2334 * @param {String} type
2335 */
2336function createButtonPseudo( type ) {
2337	return function( elem ) {
2338		return ( nodeName( elem, "input" ) || nodeName( elem, "button" ) ) &&
2339			elem.type === type;
2340	};
2341}
2342
2343/**
2344 * Returns a function to use in pseudos for :enabled/:disabled
2345 * @param {Boolean} disabled true for :disabled; false for :enabled
2346 */
2347function createDisabledPseudo( disabled ) {
2348
2349	// Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
2350	return function( elem ) {
2351
2352		// Only certain elements can match :enabled or :disabled
2353		// https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
2354		// https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
2355		if ( "form" in elem ) {
2356
2357			// Check for inherited disabledness on relevant non-disabled elements:
2358			// * listed form-associated elements in a disabled fieldset
2359			//   https://html.spec.whatwg.org/multipage/forms.html#category-listed
2360			//   https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
2361			// * option elements in a disabled optgroup
2362			//   https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
2363			// All such elements have a "form" property.
2364			if ( elem.parentNode && elem.disabled === false ) {
2365
2366				// Option elements defer to a parent optgroup if present
2367				if ( "label" in elem ) {
2368					if ( "label" in elem.parentNode ) {
2369						return elem.parentNode.disabled === disabled;
2370					} else {
2371						return elem.disabled === disabled;
2372					}
2373				}
2374
2375				// Support: IE 6 - 11+
2376				// Use the isDisabled shortcut property to check for disabled fieldset ancestors
2377				return elem.isDisabled === disabled ||
2378
2379					// Where there is no isDisabled, check manually
2380					elem.isDisabled !== !disabled &&
2381						inDisabledFieldset( elem ) === disabled;
2382			}
2383
2384			return elem.disabled === disabled;
2385
2386		// Try to winnow out elements that can't be disabled before trusting the disabled property.
2387		// Some victims get caught in our net (label, legend, menu, track), but it shouldn't
2388		// even exist on them, let alone have a boolean value.
2389		} else if ( "label" in elem ) {
2390			return elem.disabled === disabled;
2391		}
2392
2393		// Remaining elements are neither :enabled nor :disabled
2394		return false;
2395	};
2396}
2397
2398/**
2399 * Returns a function to use in pseudos for positionals
2400 * @param {Function} fn
2401 */
2402function createPositionalPseudo( fn ) {
2403	return markFunction( function( argument ) {
2404		argument = +argument;
2405		return markFunction( function( seed, matches ) {
2406			var j,
2407				matchIndexes = fn( [], seed.length, argument ),
2408				i = matchIndexes.length;
2409
2410			// Match elements found at the specified indexes
2411			while ( i-- ) {
2412				if ( seed[ ( j = matchIndexes[ i ] ) ] ) {
2413					seed[ j ] = !( matches[ j ] = seed[ j ] );
2414				}
2415			}
2416		} );
2417	} );
2418}
2419
2420/**
2421 * Checks a node for validity as a jQuery selector context
2422 * @param {Element|Object=} context
2423 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
2424 */
2425function testContext( context ) {
2426	return context && typeof context.getElementsByTagName !== "undefined" && context;
2427}
2428
2429/**
2430 * Sets document-related variables once based on the current document
2431 * @param {Element|Object} [node] An element or document object to use to set the document
2432 * @returns {Object} Returns the current document
2433 */
2434function setDocument( node ) {
2435	var subWindow,
2436		doc = node ? node.ownerDocument || node : preferredDoc;
2437
2438	// Return early if doc is invalid or already selected
2439	// Support: IE 11+, Edge 17 - 18+
2440	// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
2441	// two documents; shallow comparisons work.
2442	// eslint-disable-next-line eqeqeq
2443	if ( doc == document || doc.nodeType !== 9 || !doc.documentElement ) {
2444		return document;
2445	}
2446
2447	// Update global variables
2448	document = doc;
2449	documentElement = document.documentElement;
2450	documentIsHTML = !jQuery.isXMLDoc( document );
2451
2452	// Support: iOS 7 only, IE 9 - 11+
2453	// Older browsers didn't support unprefixed `matches`.
2454	matches = documentElement.matches ||
2455		documentElement.webkitMatchesSelector ||
vendor: 4,667 bytes, lines 2456-2607
2456		documentElement.msMatchesSelector;
2457
2458	// Support: IE 9 - 11+, Edge 12 - 18+
2459	// Accessing iframe documents after unload throws "permission denied" errors
2460	// (see trac-13936).
2461	// Limit the fix to IE & Edge Legacy; despite Edge 15+ implementing `matches`,
2462	// all IE 9+ and Edge Legacy versions implement `msMatchesSelector` as well.
2463	if ( documentElement.msMatchesSelector &&
2464
2465		// Support: IE 11+, Edge 17 - 18+
2466		// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
2467		// two documents; shallow comparisons work.
2468		// eslint-disable-next-line eqeqeq
2469		preferredDoc != document &&
2470		( subWindow = document.defaultView ) && subWindow.top !== subWindow ) {
2471
2472		// Support: IE 9 - 11+, Edge 12 - 18+
2473		subWindow.addEventListener( "unload", unloadHandler );
2474	}
2475
2476	// Support: IE <10
2477	// Check if getElementById returns elements by name
2478	// The broken getElementById methods don't pick up programmatically-set names,
2479	// so use a roundabout getElementsByName test
2480	support.getById = assert( function( el ) {
2481		documentElement.appendChild( el ).id = jQuery.expando;
2482		return !document.getElementsByName ||
2483			!document.getElementsByName( jQuery.expando ).length;
2484	} );
2485
2486	// Support: IE 9 only
2487	// Check to see if it's possible to do matchesSelector
2488	// on a disconnected node.
2489	support.disconnectedMatch = assert( function( el ) {
2490		return matches.call( el, "*" );
2491	} );
2492
2493	// Support: IE 9 - 11+, Edge 12 - 18+
2494	// IE/Edge don't support the :scope pseudo-class.
2495	support.scope = assert( function() {
2496		return document.querySelectorAll( ":scope" );
2497	} );
2498
2499	// Support: Chrome 105 - 111 only, Safari 15.4 - 16.3 only
2500	// Make sure the `:has()` argument is parsed unforgivingly.
2501	// We include `*` in the test to detect buggy implementations that are
2502	// _selectively_ forgiving (specifically when the list includes at least
2503	// one valid selector).
2504	// Note that we treat complete lack of support for `:has()` as if it were
2505	// spec-compliant support, which is fine because use of `:has()` in such
2506	// environments will fail in the qSA path and fall back to jQuery traversal
2507	// anyway.
2508	support.cssHas = assert( function() {
2509		try {
2510			document.querySelector( ":has(*,:jqfake)" );
2511			return false;
2512		} catch ( e ) {
2513			return true;
2514		}
2515	} );
2516
2517	// ID filter and find
2518	if ( support.getById ) {
2519		Expr.filter.ID = function( id ) {
2520			var attrId = id.replace( runescape, funescape );
2521			return function( elem ) {
2522				return elem.getAttribute( "id" ) === attrId;
2523			};
2524		};
2525		Expr.find.ID = function( id, context ) {
2526			if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
2527				var elem = context.getElementById( id );
2528				return elem ? [ elem ] : [];
2529			}
2530		};
2531	} else {
2532		Expr.filter.ID =  function( id ) {
2533			var attrId = id.replace( runescape, funescape );
2534			return function( elem ) {
2535				var node = typeof elem.getAttributeNode !== "undefined" &&
2536					elem.getAttributeNode( "id" );
2537				return node && node.value === attrId;
2538			};
2539		};
2540
2541		// Support: IE 6 - 7 only
2542		// getElementById is not reliable as a find shortcut
2543		Expr.find.ID = function( id, context ) {
2544			if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
2545				var node, i, elems,
2546					elem = context.getElementById( id );
2547
2548				if ( elem ) {
2549
2550					// Verify the id attribute
2551					node = elem.getAttributeNode( "id" );
2552					if ( node && node.value === id ) {
2553						return [ elem ];
2554					}
2555
2556					// Fall back on getElementsByName
2557					elems = context.getElementsByName( id );
2558					i = 0;
2559					while ( ( elem = elems[ i++ ] ) ) {
2560						node = elem.getAttributeNode( "id" );
2561						if ( node && node.value === id ) {
2562							return [ elem ];
2563						}
2564					}
2565				}
2566
2567				return [];
2568			}
2569		};
2570	}
2571
2572	// Tag
2573	Expr.find.TAG = function( tag, context ) {
2574		if ( typeof context.getElementsByTagName !== "undefined" ) {
2575			return context.getElementsByTagName( tag );
2576
2577		// DocumentFragment nodes don't have gEBTN
2578		} else {
2579			return context.querySelectorAll( tag );
2580		}
2581	};
2582
2583	// Class
2584	Expr.find.CLASS = function( className, context ) {
2585		if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
2586			return context.getElementsByClassName( className );
2587		}
2588	};
2589
2590	/* QSA/matchesSelector
2591	---------------------------------------------------------------------- */
2592
2593	// QSA and matchesSelector support
2594
2595	rbuggyQSA = [];
2596
2597	// Build QSA regex
2598	// Regex strategy adopted from Diego Perini
2599	assert( function( el ) {
2600
2601		var input;
2602
2603		documentElement.appendChild( el ).innerHTML =
2604			"<a id='" + expando + "' href='' disabled='disabled'></a>" +
2605			"<select id='" + expando + "-\r\\' disabled='disabled'>" +
2606			"<option selected=''></option></select>";
2607
vendor: 38,614 bytes, lines 2608-3979
2608		// Support: iOS <=7 - 8 only
2609		// Boolean attributes and "value" are not treated correctly in some XML documents
2610		if ( !el.querySelectorAll( "[selected]" ).length ) {
2611			rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
2612		}
2613
2614		// Support: iOS <=7 - 8 only
2615		if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
2616			rbuggyQSA.push( "~=" );
2617		}
2618
2619		// Support: iOS 8 only
2620		// https://bugs.webkit.org/show_bug.cgi?id=136851
2621		// In-page `selector#id sibling-combinator selector` fails
2622		if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
2623			rbuggyQSA.push( ".#.+[+~]" );
2624		}
2625
2626		// Support: Chrome <=105+, Firefox <=104+, Safari <=15.4+
2627		// In some of the document kinds, these selectors wouldn't work natively.
2628		// This is probably OK but for backwards compatibility we want to maintain
2629		// handling them through jQuery traversal in jQuery 3.x.
2630		if ( !el.querySelectorAll( ":checked" ).length ) {
2631			rbuggyQSA.push( ":checked" );
2632		}
2633
2634		// Support: Windows 8 Native Apps
2635		// The type and name attributes are restricted during .innerHTML assignment
2636		input = document.createElement( "input" );
2637		input.setAttribute( "type", "hidden" );
2638		el.appendChild( input ).setAttribute( "name", "D" );
2639
2640		// Support: IE 9 - 11+
2641		// IE's :disabled selector does not pick up the children of disabled fieldsets
2642		// Support: Chrome <=105+, Firefox <=104+, Safari <=15.4+
2643		// In some of the document kinds, these selectors wouldn't work natively.
2644		// This is probably OK but for backwards compatibility we want to maintain
2645		// handling them through jQuery traversal in jQuery 3.x.
2646		documentElement.appendChild( el ).disabled = true;
2647		if ( el.querySelectorAll( ":disabled" ).length !== 2 ) {
2648			rbuggyQSA.push( ":enabled", ":disabled" );
2649		}
2650
2651		// Support: IE 11+, Edge 15 - 18+
2652		// IE 11/Edge don't find elements on a `[name='']` query in some cases.
2653		// Adding a temporary attribute to the document before the selection works
2654		// around the issue.
2655		// Interestingly, IE 10 & older don't seem to have the issue.
2656		input = document.createElement( "input" );
2657		input.setAttribute( "name", "" );
2658		el.appendChild( input );
2659		if ( !el.querySelectorAll( "[name='']" ).length ) {
2660			rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" +
2661				whitespace + "*(?:''|\"\")" );
2662		}
2663	} );
2664
2665	if ( !support.cssHas ) {
2666
2667		// Support: Chrome 105 - 110+, Safari 15.4 - 16.3+
2668		// Our regular `try-catch` mechanism fails to detect natively-unsupported
2669		// pseudo-classes inside `:has()` (such as `:has(:contains("Foo"))`)
2670		// in browsers that parse the `:has()` argument as a forgiving selector list.
2671		// https://drafts.csswg.org/selectors/#relational now requires the argument
2672		// to be parsed unforgivingly, but browsers have not yet fully adjusted.
2673		rbuggyQSA.push( ":has" );
2674	}
2675
2676	rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) );
2677
2678	/* Sorting
2679	---------------------------------------------------------------------- */
2680
2681	// Document order sorting
2682	sortOrder = function( a, b ) {
2683
2684		// Flag for duplicate removal
2685		if ( a === b ) {
2686			hasDuplicate = true;
2687			return 0;
2688		}
2689
2690		// Sort on method existence if only one input has compareDocumentPosition
2691		var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
2692		if ( compare ) {
2693			return compare;
2694		}
2695
2696		// Calculate position if both inputs belong to the same document
2697		// Support: IE 11+, Edge 17 - 18+
2698		// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
2699		// two documents; shallow comparisons work.
2700		// eslint-disable-next-line eqeqeq
2701		compare = ( a.ownerDocument || a ) == ( b.ownerDocument || b ) ?
2702			a.compareDocumentPosition( b ) :
2703
2704			// Otherwise we know they are disconnected
2705			1;
2706
2707		// Disconnected nodes
2708		if ( compare & 1 ||
2709			( !support.sortDetached && b.compareDocumentPosition( a ) === compare ) ) {
2710
2711			// Choose the first element that is related to our preferred document
2712			// Support: IE 11+, Edge 17 - 18+
2713			// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
2714			// two documents; shallow comparisons work.
2715			// eslint-disable-next-line eqeqeq
2716			if ( a === document || a.ownerDocument == preferredDoc &&
2717				find.contains( preferredDoc, a ) ) {
2718				return -1;
2719			}
2720
2721			// Support: IE 11+, Edge 17 - 18+
2722			// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
2723			// two documents; shallow comparisons work.
2724			// eslint-disable-next-line eqeqeq
2725			if ( b === document || b.ownerDocument == preferredDoc &&
2726				find.contains( preferredDoc, b ) ) {
2727				return 1;
2728			}
2729
2730			// Maintain original order
2731			return sortInput ?
2732				( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :
2733				0;
2734		}
2735
2736		return compare & 4 ? -1 : 1;
2737	};
2738
2739	return document;
2740}
2741
2742find.matches = function( expr, elements ) {
2743	return find( expr, null, null, elements );
2744};
2745
2746find.matchesSelector = function( elem, expr ) {
2747	setDocument( elem );
2748
2749	if ( documentIsHTML &&
2750		!nonnativeSelectorCache[ expr + " " ] &&
2751		( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
2752
2753		try {
2754			var ret = matches.call( elem, expr );
2755
2756			// IE 9's matchesSelector returns false on disconnected nodes
2757			if ( ret || support.disconnectedMatch ||
2758
2759					// As well, disconnected nodes are said to be in a document
2760					// fragment in IE 9
2761					elem.document && elem.document.nodeType !== 11 ) {
2762				return ret;
2763			}
2764		} catch ( e ) {
2765			nonnativeSelectorCache( expr, true );
2766		}
2767	}
2768
2769	return find( expr, document, null, [ elem ] ).length > 0;
2770};
2771
2772find.contains = function( context, elem ) {
2773
2774	// Set document vars if needed
2775	// Support: IE 11+, Edge 17 - 18+
2776	// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
2777	// two documents; shallow comparisons work.
2778	// eslint-disable-next-line eqeqeq
2779	if ( ( context.ownerDocument || context ) != document ) {
2780		setDocument( context );
2781	}
2782	return jQuery.contains( context, elem );
2783};
2784
2785
2786find.attr = function( elem, name ) {
2787
2788	// Set document vars if needed
2789	// Support: IE 11+, Edge 17 - 18+
2790	// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
2791	// two documents; shallow comparisons work.
2792	// eslint-disable-next-line eqeqeq
2793	if ( ( elem.ownerDocument || elem ) != document ) {
2794		setDocument( elem );
2795	}
2796
2797	var fn = Expr.attrHandle[ name.toLowerCase() ],
2798
2799		// Don't get fooled by Object.prototype properties (see trac-13807)
2800		val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
2801			fn( elem, name, !documentIsHTML ) :
2802			undefined;
2803
2804	if ( val !== undefined ) {
2805		return val;
2806	}
2807
2808	return elem.getAttribute( name );
2809};
2810
2811find.error = function( msg ) {
2812	throw new Error( "Syntax error, unrecognized expression: " + msg );
2813};
2814
2815/**
2816 * Document sorting and removing duplicates
2817 * @param {ArrayLike} results
2818 */
2819jQuery.uniqueSort = function( results ) {
2820	var elem,
2821		duplicates = [],
2822		j = 0,
2823		i = 0;
2824
2825	// Unless we *know* we can detect duplicates, assume their presence
2826	//
2827	// Support: Android <=4.0+
2828	// Testing for detecting duplicates is unpredictable so instead assume we can't
2829	// depend on duplicate detection in all browsers without a stable sort.
2830	hasDuplicate = !support.sortStable;
2831	sortInput = !support.sortStable && slice.call( results, 0 );
2832	sort.call( results, sortOrder );
2833
2834	if ( hasDuplicate ) {
2835		while ( ( elem = results[ i++ ] ) ) {
2836			if ( elem === results[ i ] ) {
2837				j = duplicates.push( i );
2838			}
2839		}
2840		while ( j-- ) {
2841			splice.call( results, duplicates[ j ], 1 );
2842		}
2843	}
2844
2845	// Clear input after sorting to release objects
2846	// See https://github.com/jquery/sizzle/pull/225
2847	sortInput = null;
2848
2849	return results;
2850};
2851
2852jQuery.fn.uniqueSort = function() {
2853	return this.pushStack( jQuery.uniqueSort( slice.apply( this ) ) );
2854};
2855
2856Expr = jQuery.expr = {
2857
2858	// Can be adjusted by the user
2859	cacheLength: 50,
2860
2861	createPseudo: markFunction,
2862
2863	match: matchExpr,
2864
2865	attrHandle: {},
2866
2867	find: {},
2868
2869	relative: {
2870		">": { dir: "parentNode", first: true },
2871		" ": { dir: "parentNode" },
2872		"+": { dir: "previousSibling", first: true },
2873		"~": { dir: "previousSibling" }
2874	},
2875
2876	preFilter: {
2877		ATTR: function( match ) {
2878			match[ 1 ] = match[ 1 ].replace( runescape, funescape );
2879
2880			// Move the given value to match[3] whether quoted or unquoted
2881			match[ 3 ] = ( match[ 3 ] || match[ 4 ] || match[ 5 ] || "" )
2882				.replace( runescape, funescape );
2883
2884			if ( match[ 2 ] === "~=" ) {
2885				match[ 3 ] = " " + match[ 3 ] + " ";
2886			}
2887
2888			return match.slice( 0, 4 );
2889		},
2890
2891		CHILD: function( match ) {
2892
2893			/* matches from matchExpr["CHILD"]
2894				1 type (only|nth|...)
2895				2 what (child|of-type)
2896				3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
2897				4 xn-component of xn+y argument ([+-]?\d*n|)
2898				5 sign of xn-component
2899				6 x of xn-component
2900				7 sign of y-component
2901				8 y of y-component
2902			*/
2903			match[ 1 ] = match[ 1 ].toLowerCase();
2904
2905			if ( match[ 1 ].slice( 0, 3 ) === "nth" ) {
2906
2907				// nth-* requires argument
2908				if ( !match[ 3 ] ) {
2909					find.error( match[ 0 ] );
2910				}
2911
2912				// numeric x and y parameters for Expr.filter.CHILD
2913				// remember that false/true cast respectively to 0/1
2914				match[ 4 ] = +( match[ 4 ] ?
2915					match[ 5 ] + ( match[ 6 ] || 1 ) :
2916					2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" )
2917				);
2918				match[ 5 ] = +( ( match[ 7 ] + match[ 8 ] ) || match[ 3 ] === "odd" );
2919
2920			// other types prohibit arguments
2921			} else if ( match[ 3 ] ) {
2922				find.error( match[ 0 ] );
2923			}
2924
2925			return match;
2926		},
2927
2928		PSEUDO: function( match ) {
2929			var excess,
2930				unquoted = !match[ 6 ] && match[ 2 ];
2931
2932			if ( matchExpr.CHILD.test( match[ 0 ] ) ) {
2933				return null;
2934			}
2935
2936			// Accept quoted arguments as-is
2937			if ( match[ 3 ] ) {
2938				match[ 2 ] = match[ 4 ] || match[ 5 ] || "";
2939
2940			// Strip excess characters from unquoted arguments
2941			} else if ( unquoted && rpseudo.test( unquoted ) &&
2942
2943				// Get excess from tokenize (recursively)
2944				( excess = tokenize( unquoted, true ) ) &&
2945
2946				// advance to the next closing parenthesis
2947				( excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length ) ) {
2948
2949				// excess is a negative index
2950				match[ 0 ] = match[ 0 ].slice( 0, excess );
2951				match[ 2 ] = unquoted.slice( 0, excess );
2952			}
2953
2954			// Return only captures needed by the pseudo filter method (type and argument)
2955			return match.slice( 0, 3 );
2956		}
2957	},
2958
2959	filter: {
2960
2961		TAG: function( nodeNameSelector ) {
2962			var expectedNodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
2963			return nodeNameSelector === "*" ?
2964				function() {
2965					return true;
2966				} :
2967				function( elem ) {
2968					return nodeName( elem, expectedNodeName );
2969				};
2970		},
2971
2972		CLASS: function( className ) {
2973			var pattern = classCache[ className + " " ];
2974
2975			return pattern ||
2976				( pattern = new RegExp( "(^|" + whitespace + ")" + className +
2977					"(" + whitespace + "|$)" ) ) &&
2978				classCache( className, function( elem ) {
2979					return pattern.test(
2980						typeof elem.className === "string" && elem.className ||
2981							typeof elem.getAttribute !== "undefined" &&
2982								elem.getAttribute( "class" ) ||
2983							""
2984					);
2985				} );
2986		},
2987
2988		ATTR: function( name, operator, check ) {
2989			return function( elem ) {
2990				var result = find.attr( elem, name );
2991
2992				if ( result == null ) {
2993					return operator === "!=";
2994				}
2995				if ( !operator ) {
2996					return true;
2997				}
2998
2999				result += "";
3000
3001				if ( operator === "=" ) {
3002					return result === check;
3003				}
3004				if ( operator === "!=" ) {
3005					return result !== check;
3006				}
3007				if ( operator === "^=" ) {
3008					return check && result.indexOf( check ) === 0;
3009				}
3010				if ( operator === "*=" ) {
3011					return check && result.indexOf( check ) > -1;
3012				}
3013				if ( operator === "$=" ) {
3014					return check && result.slice( -check.length ) === check;
3015				}
3016				if ( operator === "~=" ) {
3017					return ( " " + result.replace( rwhitespace, " " ) + " " )
3018						.indexOf( check ) > -1;
3019				}
3020				if ( operator === "|=" ) {
3021					return result === check || result.slice( 0, check.length + 1 ) === check + "-";
3022				}
3023
3024				return false;
3025			};
3026		},
3027
3028		CHILD: function( type, what, _argument, first, last ) {
3029			var simple = type.slice( 0, 3 ) !== "nth",
3030				forward = type.slice( -4 ) !== "last",
3031				ofType = what === "of-type";
3032
3033			return first === 1 && last === 0 ?
3034
3035				// Shortcut for :nth-*(n)
3036				function( elem ) {
3037					return !!elem.parentNode;
3038				} :
3039
3040				function( elem, _context, xml ) {
3041					var cache, outerCache, node, nodeIndex, start,
3042						dir = simple !== forward ? "nextSibling" : "previousSibling",
3043						parent = elem.parentNode,
3044						name = ofType && elem.nodeName.toLowerCase(),
3045						useCache = !xml && !ofType,
3046						diff = false;
3047
3048					if ( parent ) {
3049
3050						// :(first|last|only)-(child|of-type)
3051						if ( simple ) {
3052							while ( dir ) {
3053								node = elem;
3054								while ( ( node = node[ dir ] ) ) {
3055									if ( ofType ?
3056										nodeName( node, name ) :
3057										node.nodeType === 1 ) {
3058
3059										return false;
3060									}
3061								}
3062
3063								// Reverse direction for :only-* (if we haven't yet done so)
3064								start = dir = type === "only" && !start && "nextSibling";
3065							}
3066							return true;
3067						}
3068
3069						start = [ forward ? parent.firstChild : parent.lastChild ];
3070
3071						// non-xml :nth-child(...) stores cache data on `parent`
3072						if ( forward && useCache ) {
3073
3074							// Seek `elem` from a previously-cached index
3075							outerCache = parent[ expando ] || ( parent[ expando ] = {} );
3076							cache = outerCache[ type ] || [];
3077							nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
3078							diff = nodeIndex && cache[ 2 ];
3079							node = nodeIndex && parent.childNodes[ nodeIndex ];
3080
3081							while ( ( node = ++nodeIndex && node && node[ dir ] ||
3082
3083								// Fallback to seeking `elem` from the start
3084								( diff = nodeIndex = 0 ) || start.pop() ) ) {
3085
3086								// When found, cache indexes on `parent` and break
3087								if ( node.nodeType === 1 && ++diff && node === elem ) {
3088									outerCache[ type ] = [ dirruns, nodeIndex, diff ];
3089									break;
3090								}
3091							}
3092
3093						} else {
3094
3095							// Use previously-cached element index if available
3096							if ( useCache ) {
3097								outerCache = elem[ expando ] || ( elem[ expando ] = {} );
3098								cache = outerCache[ type ] || [];
3099								nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
3100								diff = nodeIndex;
3101							}
3102
3103							// xml :nth-child(...)
3104							// or :nth-last-child(...) or :nth(-last)?-of-type(...)
3105							if ( diff === false ) {
3106
3107								// Use the same loop as above to seek `elem` from the start
3108								while ( ( node = ++nodeIndex && node && node[ dir ] ||
3109									( diff = nodeIndex = 0 ) || start.pop() ) ) {
3110
3111									if ( ( ofType ?
3112										nodeName( node, name ) :
3113										node.nodeType === 1 ) &&
3114										++diff ) {
3115
3116										// Cache the index of each encountered element
3117										if ( useCache ) {
3118											outerCache = node[ expando ] ||
3119												( node[ expando ] = {} );
3120											outerCache[ type ] = [ dirruns, diff ];
3121										}
3122
3123										if ( node === elem ) {
3124											break;
3125										}
3126									}
3127								}
3128							}
3129						}
3130
3131						// Incorporate the offset, then check against cycle size
3132						diff -= last;
3133						return diff === first || ( diff % first === 0 && diff / first >= 0 );
3134					}
3135				};
3136		},
3137
3138		PSEUDO: function( pseudo, argument ) {
3139
3140			// pseudo-class names are case-insensitive
3141			// https://www.w3.org/TR/selectors/#pseudo-classes
3142			// Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
3143			// Remember that setFilters inherits from pseudos
3144			var args,
3145				fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
3146					find.error( "unsupported pseudo: " + pseudo );
3147
3148			// The user may use createPseudo to indicate that
3149			// arguments are needed to create the filter function
3150			// just as jQuery does
3151			if ( fn[ expando ] ) {
3152				return fn( argument );
3153			}
3154
3155			// But maintain support for old signatures
3156			if ( fn.length > 1 ) {
3157				args = [ pseudo, pseudo, "", argument ];
3158				return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
3159					markFunction( function( seed, matches ) {
3160						var idx,
3161							matched = fn( seed, argument ),
3162							i = matched.length;
3163						while ( i-- ) {
3164							idx = indexOf.call( seed, matched[ i ] );
3165							seed[ idx ] = !( matches[ idx ] = matched[ i ] );
3166						}
3167					} ) :
3168					function( elem ) {
3169						return fn( elem, 0, args );
3170					};
3171			}
3172
3173			return fn;
3174		}
3175	},
3176
3177	pseudos: {
3178
3179		// Potentially complex pseudos
3180		not: markFunction( function( selector ) {
3181
3182			// Trim the selector passed to compile
3183			// to avoid treating leading and trailing
3184			// spaces as combinators
3185			var input = [],
3186				results = [],
3187				matcher = compile( selector.replace( rtrimCSS, "$1" ) );
3188
3189			return matcher[ expando ] ?
3190				markFunction( function( seed, matches, _context, xml ) {
3191					var elem,
3192						unmatched = matcher( seed, null, xml, [] ),
3193						i = seed.length;
3194
3195					// Match elements unmatched by `matcher`
3196					while ( i-- ) {
3197						if ( ( elem = unmatched[ i ] ) ) {
3198							seed[ i ] = !( matches[ i ] = elem );
3199						}
3200					}
3201				} ) :
3202				function( elem, _context, xml ) {
3203					input[ 0 ] = elem;
3204					matcher( input, null, xml, results );
3205
3206					// Don't keep the element
3207					// (see https://github.com/jquery/sizzle/issues/299)
3208					input[ 0 ] = null;
3209					return !results.pop();
3210				};
3211		} ),
3212
3213		has: markFunction( function( selector ) {
3214			return function( elem ) {
3215				return find( selector, elem ).length > 0;
3216			};
3217		} ),
3218
3219		contains: markFunction( function( text ) {
3220			text = text.replace( runescape, funescape );
3221			return function( elem ) {
3222				return ( elem.textContent || jQuery.text( elem ) ).indexOf( text ) > -1;
3223			};
3224		} ),
3225
3226		// "Whether an element is represented by a :lang() selector
3227		// is based solely on the element's language value
3228		// being equal to the identifier C,
3229		// or beginning with the identifier C immediately followed by "-".
3230		// The matching of C against the element's language value is performed case-insensitively.
3231		// The identifier C does not have to be a valid language name."
3232		// https://www.w3.org/TR/selectors/#lang-pseudo
3233		lang: markFunction( function( lang ) {
3234
3235			// lang value must be a valid identifier
3236			if ( !ridentifier.test( lang || "" ) ) {
3237				find.error( "unsupported lang: " + lang );
3238			}
3239			lang = lang.replace( runescape, funescape ).toLowerCase();
3240			return function( elem ) {
3241				var elemLang;
3242				do {
3243					if ( ( elemLang = documentIsHTML ?
3244						elem.lang :
3245						elem.getAttribute( "xml:lang" ) || elem.getAttribute( "lang" ) ) ) {
3246
3247						elemLang = elemLang.toLowerCase();
3248						return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
3249					}
3250				} while ( ( elem = elem.parentNode ) && elem.nodeType === 1 );
3251				return false;
3252			};
3253		} ),
3254
3255		// Miscellaneous
3256		target: function( elem ) {
3257			var hash = window.location && window.location.hash;
3258			return hash && hash.slice( 1 ) === elem.id;
3259		},
3260
3261		root: function( elem ) {
3262			return elem === documentElement;
3263		},
3264
3265		focus: function( elem ) {
3266			return elem === safeActiveElement() &&
3267				document.hasFocus() &&
3268				!!( elem.type || elem.href || ~elem.tabIndex );
3269		},
3270
3271		// Boolean properties
3272		enabled: createDisabledPseudo( false ),
3273		disabled: createDisabledPseudo( true ),
3274
3275		checked: function( elem ) {
3276
3277			// In CSS3, :checked should return both checked and selected elements
3278			// https://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
3279			return ( nodeName( elem, "input" ) && !!elem.checked ) ||
3280				( nodeName( elem, "option" ) && !!elem.selected );
3281		},
3282
3283		selected: function( elem ) {
3284
3285			// Support: IE <=11+
3286			// Accessing the selectedIndex property
3287			// forces the browser to treat the default option as
3288			// selected when in an optgroup.
3289			if ( elem.parentNode ) {
3290				// eslint-disable-next-line no-unused-expressions
3291				elem.parentNode.selectedIndex;
3292			}
3293
3294			return elem.selected === true;
3295		},
3296
3297		// Contents
3298		empty: function( elem ) {
3299
3300			// https://www.w3.org/TR/selectors/#empty-pseudo
3301			// :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
3302			//   but not by others (comment: 8; processing instruction: 7; etc.)
3303			// nodeType < 6 works because attributes (2) do not appear as children
3304			for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
3305				if ( elem.nodeType < 6 ) {
3306					return false;
3307				}
3308			}
3309			return true;
3310		},
3311
3312		parent: function( elem ) {
3313			return !Expr.pseudos.empty( elem );
3314		},
3315
3316		// Element/input types
3317		header: function( elem ) {
3318			return rheader.test( elem.nodeName );
3319		},
3320
3321		input: function( elem ) {
3322			return rinputs.test( elem.nodeName );
3323		},
3324
3325		button: function( elem ) {
3326			return nodeName( elem, "input" ) && elem.type === "button" ||
3327				nodeName( elem, "button" );
3328		},
3329
3330		text: function( elem ) {
3331			var attr;
3332			return nodeName( elem, "input" ) && elem.type === "text" &&
3333
3334				// Support: IE <10 only
3335				// New HTML5 attribute values (e.g., "search") appear
3336				// with elem.type === "text"
3337				( ( attr = elem.getAttribute( "type" ) ) == null ||
3338					attr.toLowerCase() === "text" );
3339		},
3340
3341		// Position-in-collection
3342		first: createPositionalPseudo( function() {
3343			return [ 0 ];
3344		} ),
3345
3346		last: createPositionalPseudo( function( _matchIndexes, length ) {
3347			return [ length - 1 ];
3348		} ),
3349
3350		eq: createPositionalPseudo( function( _matchIndexes, length, argument ) {
3351			return [ argument < 0 ? argument + length : argument ];
3352		} ),
3353
3354		even: createPositionalPseudo( function( matchIndexes, length ) {
3355			var i = 0;
3356			for ( ; i < length; i += 2 ) {
3357				matchIndexes.push( i );
3358			}
3359			return matchIndexes;
3360		} ),
3361
3362		odd: createPositionalPseudo( function( matchIndexes, length ) {
3363			var i = 1;
3364			for ( ; i < length; i += 2 ) {
3365				matchIndexes.push( i );
3366			}
3367			return matchIndexes;
3368		} ),
3369
3370		lt: createPositionalPseudo( function( matchIndexes, length, argument ) {
3371			var i;
3372
3373			if ( argument < 0 ) {
3374				i = argument + length;
3375			} else if ( argument > length ) {
3376				i = length;
3377			} else {
3378				i = argument;
3379			}
3380
3381			for ( ; --i >= 0; ) {
3382				matchIndexes.push( i );
3383			}
3384			return matchIndexes;
3385		} ),
3386
3387		gt: createPositionalPseudo( function( matchIndexes, length, argument ) {
3388			var i = argument < 0 ? argument + length : argument;
3389			for ( ; ++i < length; ) {
3390				matchIndexes.push( i );
3391			}
3392			return matchIndexes;
3393		} )
3394	}
3395};
3396
3397Expr.pseudos.nth = Expr.pseudos.eq;
3398
3399// Add button/input type pseudos
3400for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
3401	Expr.pseudos[ i ] = createInputPseudo( i );
3402}
3403for ( i in { submit: true, reset: true } ) {
3404	Expr.pseudos[ i ] = createButtonPseudo( i );
3405}
3406
3407// Easy API for creating new setFilters
3408function setFilters() {}
3409setFilters.prototype = Expr.filters = Expr.pseudos;
3410Expr.setFilters = new setFilters();
3411
3412function tokenize( selector, parseOnly ) {
3413	var matched, match, tokens, type,
3414		soFar, groups, preFilters,
3415		cached = tokenCache[ selector + " " ];
3416
3417	if ( cached ) {
3418		return parseOnly ? 0 : cached.slice( 0 );
3419	}
3420
3421	soFar = selector;
3422	groups = [];
3423	preFilters = Expr.preFilter;
3424
3425	while ( soFar ) {
3426
3427		// Comma and first run
3428		if ( !matched || ( match = rcomma.exec( soFar ) ) ) {
3429			if ( match ) {
3430
3431				// Don't consume trailing commas as valid
3432				soFar = soFar.slice( match[ 0 ].length ) || soFar;
3433			}
3434			groups.push( ( tokens = [] ) );
3435		}
3436
3437		matched = false;
3438
3439		// Combinators
3440		if ( ( match = rleadingCombinator.exec( soFar ) ) ) {
3441			matched = match.shift();
3442			tokens.push( {
3443				value: matched,
3444
3445				// Cast descendant combinators to space
3446				type: match[ 0 ].replace( rtrimCSS, " " )
3447			} );
3448			soFar = soFar.slice( matched.length );
3449		}
3450
3451		// Filters
3452		for ( type in Expr.filter ) {
3453			if ( ( match = matchExpr[ type ].exec( soFar ) ) && ( !preFilters[ type ] ||
3454				( match = preFilters[ type ]( match ) ) ) ) {
3455				matched = match.shift();
3456				tokens.push( {
3457					value: matched,
3458					type: type,
3459					matches: match
3460				} );
3461				soFar = soFar.slice( matched.length );
3462			}
3463		}
3464
3465		if ( !matched ) {
3466			break;
3467		}
3468	}
3469
3470	// Return the length of the invalid excess
3471	// if we're just parsing
3472	// Otherwise, throw an error or return tokens
3473	if ( parseOnly ) {
3474		return soFar.length;
3475	}
3476
3477	return soFar ?
3478		find.error( selector ) :
3479
3480		// Cache the tokens
3481		tokenCache( selector, groups ).slice( 0 );
3482}
3483
3484function toSelector( tokens ) {
3485	var i = 0,
3486		len = tokens.length,
3487		selector = "";
3488	for ( ; i < len; i++ ) {
3489		selector += tokens[ i ].value;
3490	}
3491	return selector;
3492}
3493
3494function addCombinator( matcher, combinator, base ) {
3495	var dir = combinator.dir,
3496		skip = combinator.next,
3497		key = skip || dir,
3498		checkNonElements = base && key === "parentNode",
3499		doneName = done++;
3500
3501	return combinator.first ?
3502
3503		// Check against closest ancestor/preceding element
3504		function( elem, context, xml ) {
3505			while ( ( elem = elem[ dir ] ) ) {
3506				if ( elem.nodeType === 1 || checkNonElements ) {
3507					return matcher( elem, context, xml );
3508				}
3509			}
3510			return false;
3511		} :
3512
3513		// Check against all ancestor/preceding elements
3514		function( elem, context, xml ) {
3515			var oldCache, outerCache,
3516				newCache = [ dirruns, doneName ];
3517
3518			// We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
3519			if ( xml ) {
3520				while ( ( elem = elem[ dir ] ) ) {
3521					if ( elem.nodeType === 1 || checkNonElements ) {
3522						if ( matcher( elem, context, xml ) ) {
3523							return true;
3524						}
3525					}
3526				}
3527			} else {
3528				while ( ( elem = elem[ dir ] ) ) {
3529					if ( elem.nodeType === 1 || checkNonElements ) {
3530						outerCache = elem[ expando ] || ( elem[ expando ] = {} );
3531
3532						if ( skip && nodeName( elem, skip ) ) {
3533							elem = elem[ dir ] || elem;
3534						} else if ( ( oldCache = outerCache[ key ] ) &&
3535							oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
3536
3537							// Assign to newCache so results back-propagate to previous elements
3538							return ( newCache[ 2 ] = oldCache[ 2 ] );
3539						} else {
3540
3541							// Reuse newcache so results back-propagate to previous elements
3542							outerCache[ key ] = newCache;
3543
3544							// A match means we're done; a fail means we have to keep checking
3545							if ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) {
3546								return true;
3547							}
3548						}
3549					}
3550				}
3551			}
3552			return false;
3553		};
3554}
3555
3556function elementMatcher( matchers ) {
3557	return matchers.length > 1 ?
3558		function( elem, context, xml ) {
3559			var i = matchers.length;
3560			while ( i-- ) {
3561				if ( !matchers[ i ]( elem, context, xml ) ) {
3562					return false;
3563				}
3564			}
3565			return true;
3566		} :
3567		matchers[ 0 ];
3568}
3569
3570function multipleContexts( selector, contexts, results ) {
3571	var i = 0,
3572		len = contexts.length;
3573	for ( ; i < len; i++ ) {
3574		find( selector, contexts[ i ], results );
3575	}
3576	return results;
3577}
3578
3579function condense( unmatched, map, filter, context, xml ) {
3580	var elem,
3581		newUnmatched = [],
3582		i = 0,
3583		len = unmatched.length,
3584		mapped = map != null;
3585
3586	for ( ; i < len; i++ ) {
3587		if ( ( elem = unmatched[ i ] ) ) {
3588			if ( !filter || filter( elem, context, xml ) ) {
3589				newUnmatched.push( elem );
3590				if ( mapped ) {
3591					map.push( i );
3592				}
3593			}
3594		}
3595	}
3596
3597	return newUnmatched;
3598}
3599
3600function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
3601	if ( postFilter && !postFilter[ expando ] ) {
3602		postFilter = setMatcher( postFilter );
3603	}
3604	if ( postFinder && !postFinder[ expando ] ) {
3605		postFinder = setMatcher( postFinder, postSelector );
3606	}
3607	return markFunction( function( seed, results, context, xml ) {
3608		var temp, i, elem, matcherOut,
3609			preMap = [],
3610			postMap = [],
3611			preexisting = results.length,
3612
3613			// Get initial elements from seed or context
3614			elems = seed ||
3615				multipleContexts( selector || "*",
3616					context.nodeType ? [ context ] : context, [] ),
3617
3618			// Prefilter to get matcher input, preserving a map for seed-results synchronization
3619			matcherIn = preFilter && ( seed || !selector ) ?
3620				condense( elems, preMap, preFilter, context, xml ) :
3621				elems;
3622
3623		if ( matcher ) {
3624
3625			// If we have a postFinder, or filtered seed, or non-seed postFilter
3626			// or preexisting results,
3627			matcherOut = postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
3628
3629				// ...intermediate processing is necessary
3630				[] :
3631
3632				// ...otherwise use results directly
3633				results;
3634
3635			// Find primary matches
3636			matcher( matcherIn, matcherOut, context, xml );
3637		} else {
3638			matcherOut = matcherIn;
3639		}
3640
3641		// Apply postFilter
3642		if ( postFilter ) {
3643			temp = condense( matcherOut, postMap );
3644			postFilter( temp, [], context, xml );
3645
3646			// Un-match failing elements by moving them back to matcherIn
3647			i = temp.length;
3648			while ( i-- ) {
3649				if ( ( elem = temp[ i ] ) ) {
3650					matcherOut[ postMap[ i ] ] = !( matcherIn[ postMap[ i ] ] = elem );
3651				}
3652			}
3653		}
3654
3655		if ( seed ) {
3656			if ( postFinder || preFilter ) {
3657				if ( postFinder ) {
3658
3659					// Get the final matcherOut by condensing this intermediate into postFinder contexts
3660					temp = [];
3661					i = matcherOut.length;
3662					while ( i-- ) {
3663						if ( ( elem = matcherOut[ i ] ) ) {
3664
3665							// Restore matcherIn since elem is not yet a final match
3666							temp.push( ( matcherIn[ i ] = elem ) );
3667						}
3668					}
3669					postFinder( null, ( matcherOut = [] ), temp, xml );
3670				}
3671
3672				// Move matched elements from seed to results to keep them synchronized
3673				i = matcherOut.length;
3674				while ( i-- ) {
3675					if ( ( elem = matcherOut[ i ] ) &&
3676						( temp = postFinder ? indexOf.call( seed, elem ) : preMap[ i ] ) > -1 ) {
3677
3678						seed[ temp ] = !( results[ temp ] = elem );
3679					}
3680				}
3681			}
3682
3683		// Add elements to results, through postFinder if defined
3684		} else {
3685			matcherOut = condense(
3686				matcherOut === results ?
3687					matcherOut.splice( preexisting, matcherOut.length ) :
3688					matcherOut
3689			);
3690			if ( postFinder ) {
3691				postFinder( null, results, matcherOut, xml );
3692			} else {
3693				push.apply( results, matcherOut );
3694			}
3695		}
3696	} );
3697}
3698
3699function matcherFromTokens( tokens ) {
3700	var checkContext, matcher, j,
3701		len = tokens.length,
3702		leadingRelative = Expr.relative[ tokens[ 0 ].type ],
3703		implicitRelative = leadingRelative || Expr.relative[ " " ],
3704		i = leadingRelative ? 1 : 0,
3705
3706		// The foundational matcher ensures that elements are reachable from top-level context(s)
3707		matchContext = addCombinator( function( elem ) {
3708			return elem === checkContext;
3709		}, implicitRelative, true ),
3710		matchAnyContext = addCombinator( function( elem ) {
3711			return indexOf.call( checkContext, elem ) > -1;
3712		}, implicitRelative, true ),
3713		matchers = [ function( elem, context, xml ) {
3714
3715			// Support: IE 11+, Edge 17 - 18+
3716			// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
3717			// two documents; shallow comparisons work.
3718			// eslint-disable-next-line eqeqeq
3719			var ret = ( !leadingRelative && ( xml || context != outermostContext ) ) || (
3720				( checkContext = context ).nodeType ?
3721					matchContext( elem, context, xml ) :
3722					matchAnyContext( elem, context, xml ) );
3723
3724			// Avoid hanging onto element
3725			// (see https://github.com/jquery/sizzle/issues/299)
3726			checkContext = null;
3727			return ret;
3728		} ];
3729
3730	for ( ; i < len; i++ ) {
3731		if ( ( matcher = Expr.relative[ tokens[ i ].type ] ) ) {
3732			matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ];
3733		} else {
3734			matcher = Expr.filter[ tokens[ i ].type ].apply( null, tokens[ i ].matches );
3735
3736			// Return special upon seeing a positional matcher
3737			if ( matcher[ expando ] ) {
3738
3739				// Find the next relative operator (if any) for proper handling
3740				j = ++i;
3741				for ( ; j < len; j++ ) {
3742					if ( Expr.relative[ tokens[ j ].type ] ) {
3743						break;
3744					}
3745				}
3746				return setMatcher(
3747					i > 1 && elementMatcher( matchers ),
3748					i > 1 && toSelector(
3749
3750						// If the preceding token was a descendant combinator, insert an implicit any-element `*`
3751						tokens.slice( 0, i - 1 )
3752							.concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } )
3753					).replace( rtrimCSS, "$1" ),
3754					matcher,
3755					i < j && matcherFromTokens( tokens.slice( i, j ) ),
3756					j < len && matcherFromTokens( ( tokens = tokens.slice( j ) ) ),
3757					j < len && toSelector( tokens )
3758				);
3759			}
3760			matchers.push( matcher );
3761		}
3762	}
3763
3764	return elementMatcher( matchers );
3765}
3766
3767function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
3768	var bySet = setMatchers.length > 0,
3769		byElement = elementMatchers.length > 0,
3770		superMatcher = function( seed, context, xml, results, outermost ) {
3771			var elem, j, matcher,
3772				matchedCount = 0,
3773				i = "0",
3774				unmatched = seed && [],
3775				setMatched = [],
3776				contextBackup = outermostContext,
3777
3778				// We must always have either seed elements or outermost context
3779				elems = seed || byElement && Expr.find.TAG( "*", outermost ),
3780
3781				// Use integer dirruns iff this is the outermost matcher
3782				dirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 ),
3783				len = elems.length;
3784
3785			if ( outermost ) {
3786
3787				// Support: IE 11+, Edge 17 - 18+
3788				// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
3789				// two documents; shallow comparisons work.
3790				// eslint-disable-next-line eqeqeq
3791				outermostContext = context == document || context || outermost;
3792			}
3793
3794			// Add elements passing elementMatchers directly to results
3795			// Support: iOS <=7 - 9 only
3796			// Tolerate NodeList properties (IE: "length"; Safari: <number>) matching
3797			// elements by id. (see trac-14142)
3798			for ( ; i !== len && ( elem = elems[ i ] ) != null; i++ ) {
3799				if ( byElement && elem ) {
3800					j = 0;
3801
3802					// Support: IE 11+, Edge 17 - 18+
3803					// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
3804					// two documents; shallow comparisons work.
3805					// eslint-disable-next-line eqeqeq
3806					if ( !context && elem.ownerDocument != document ) {
3807						setDocument( elem );
3808						xml = !documentIsHTML;
3809					}
3810					while ( ( matcher = elementMatchers[ j++ ] ) ) {
3811						if ( matcher( elem, context || document, xml ) ) {
3812							push.call( results, elem );
3813							break;
3814						}
3815					}
3816					if ( outermost ) {
3817						dirruns = dirrunsUnique;
3818					}
3819				}
3820
3821				// Track unmatched elements for set filters
3822				if ( bySet ) {
3823
3824					// They will have gone through all possible matchers
3825					if ( ( elem = !matcher && elem ) ) {
3826						matchedCount--;
3827					}
3828
3829					// Lengthen the array for every element, matched or not
3830					if ( seed ) {
3831						unmatched.push( elem );
3832					}
3833				}
3834			}
3835
3836			// `i` is now the count of elements visited above, and adding it to `matchedCount`
3837			// makes the latter nonnegative.
3838			matchedCount += i;
3839
3840			// Apply set filters to unmatched elements
3841			// NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
3842			// equals `i`), unless we didn't visit _any_ elements in the above loop because we have
3843			// no element matchers and no seed.
3844			// Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
3845			// case, which will result in a "00" `matchedCount` that differs from `i` but is also
3846			// numerically zero.
3847			if ( bySet && i !== matchedCount ) {
3848				j = 0;
3849				while ( ( matcher = setMatchers[ j++ ] ) ) {
3850					matcher( unmatched, setMatched, context, xml );
3851				}
3852
3853				if ( seed ) {
3854
3855					// Reintegrate element matches to eliminate the need for sorting
3856					if ( matchedCount > 0 ) {
3857						while ( i-- ) {
3858							if ( !( unmatched[ i ] || setMatched[ i ] ) ) {
3859								setMatched[ i ] = pop.call( results );
3860							}
3861						}
3862					}
3863
3864					// Discard index placeholder values to get only actual matches
3865					setMatched = condense( setMatched );
3866				}
3867
3868				// Add matches to results
3869				push.apply( results, setMatched );
3870
3871				// Seedless set matches succeeding multiple successful matchers stipulate sorting
3872				if ( outermost && !seed && setMatched.length > 0 &&
3873					( matchedCount + setMatchers.length ) > 1 ) {
3874
3875					jQuery.uniqueSort( results );
3876				}
3877			}
3878
3879			// Override manipulation of globals by nested matchers
3880			if ( outermost ) {
3881				dirruns = dirrunsUnique;
3882				outermostContext = contextBackup;
3883			}
3884
3885			return unmatched;
3886		};
3887
3888	return bySet ?
3889		markFunction( superMatcher ) :
3890		superMatcher;
3891}
3892
3893function compile( selector, match /* Internal Use Only */ ) {
3894	var i,
3895		setMatchers = [],
3896		elementMatchers = [],
3897		cached = compilerCache[ selector + " " ];
3898
3899	if ( !cached ) {
3900
3901		// Generate a function of recursive functions that can be used to check each element
3902		if ( !match ) {
3903			match = tokenize( selector );
3904		}
3905		i = match.length;
3906		while ( i-- ) {
3907			cached = matcherFromTokens( match[ i ] );
3908			if ( cached[ expando ] ) {
3909				setMatchers.push( cached );
3910			} else {
3911				elementMatchers.push( cached );
3912			}
3913		}
3914
3915		// Cache the compiled function
3916		cached = compilerCache( selector,
3917			matcherFromGroupMatchers( elementMatchers, setMatchers ) );
3918
3919		// Save selector and tokenization
3920		cached.selector = selector;
3921	}
3922	return cached;
3923}
3924
3925/**
3926 * A low-level selection function that works with jQuery's compiled
3927 *  selector functions
3928 * @param {String|Function} selector A selector or a pre-compiled
3929 *  selector function built with jQuery selector compile
3930 * @param {Element} context
3931 * @param {Array} [results]
3932 * @param {Array} [seed] A set of elements to match against
3933 */
3934function select( selector, context, results, seed ) {
3935	var i, tokens, token, type, find,
3936		compiled = typeof selector === "function" && selector,
3937		match = !seed && tokenize( ( selector = compiled.selector || selector ) );
3938
3939	results = results || [];
3940
3941	// Try to minimize operations if there is only one selector in the list and no seed
3942	// (the latter of which guarantees us context)
3943	if ( match.length === 1 ) {
3944
3945		// Reduce context if the leading compound selector is an ID
3946		tokens = match[ 0 ] = match[ 0 ].slice( 0 );
3947		if ( tokens.length > 2 && ( token = tokens[ 0 ] ).type === "ID" &&
3948				context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) {
3949
3950			context = ( Expr.find.ID(
3951				token.matches[ 0 ].replace( runescape, funescape ),
3952				context
3953			) || [] )[ 0 ];
3954			if ( !context ) {
3955				return results;
3956
3957			// Precompiled matchers will still verify ancestry, so step up a level
3958			} else if ( compiled ) {
3959				context = context.parentNode;
3960			}
3961
3962			selector = selector.slice( tokens.shift().value.length );
3963		}
3964
3965		// Fetch a seed set for right-to-left matching
3966		i = matchExpr.needsContext.test( selector ) ? 0 : tokens.length;
3967		while ( i-- ) {
3968			token = tokens[ i ];
3969
3970			// Abort if we hit a combinator
3971			if ( Expr.relative[ ( type = token.type ) ] ) {
3972				break;
3973			}
3974			if ( ( find = Expr.find[ type ] ) ) {
3975
3976				// Search, expanding context for leading sibling combinators
3977				if ( ( seed = find(
3978					token.matches[ 0 ].replace( runescape, funescape ),
3979					rsibling.test( tokens[ 0 ].type ) &&
vendor: 4,497 bytes, lines 3980-4164
3980						testContext( context.parentNode ) || context
3981				) ) ) {
3982
3983					// If seed is empty or no tokens remain, we can return early
3984					tokens.splice( i, 1 );
3985					selector = seed.length && toSelector( tokens );
3986					if ( !selector ) {
3987						push.apply( results, seed );
3988						return results;
3989					}
3990
3991					break;
3992				}
3993			}
3994		}
3995	}
3996
3997	// Compile and execute a filtering function if one is not provided
3998	// Provide `match` to avoid retokenization if we modified the selector above
3999	( compiled || compile( selector, match ) )(
4000		seed,
4001		context,
4002		!documentIsHTML,
4003		results,
4004		!context || rsibling.test( selector ) && testContext( context.parentNode ) || context
4005	);
4006	return results;
4007}
4008
4009// One-time assignments
4010
4011// Support: Android <=4.0 - 4.1+
4012// Sort stability
4013support.sortStable = expando.split( "" ).sort( sortOrder ).join( "" ) === expando;
4014
4015// Initialize against the default document
4016setDocument();
4017
4018// Support: Android <=4.0 - 4.1+
4019// Detached nodes confoundingly follow *each other*
4020support.sortDetached = assert( function( el ) {
4021
4022	// Should return 1, but returns 4 (following)
4023	return el.compareDocumentPosition( document.createElement( "fieldset" ) ) & 1;
4024} );
4025
4026jQuery.find = find;
4027
4028// Deprecated
4029jQuery.expr[ ":" ] = jQuery.expr.pseudos;
4030jQuery.unique = jQuery.uniqueSort;
4031
4032// These have always been private, but they used to be documented as part of
4033// Sizzle so let's maintain them for now for backwards compatibility purposes.
4034find.compile = compile;
4035find.select = select;
4036find.setDocument = setDocument;
4037find.tokenize = tokenize;
4038
4039find.escape = jQuery.escapeSelector;
4040find.getText = jQuery.text;
4041find.isXML = jQuery.isXMLDoc;
4042find.selectors = jQuery.expr;
4043find.support = jQuery.support;
4044find.uniqueSort = jQuery.uniqueSort;
4045
4046	/* eslint-enable */
4047
4048} )();
4049
4050
4051var dir = function( elem, dir, until ) {
4052	var matched = [],
4053		truncate = until !== undefined;
4054
4055	while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
4056		if ( elem.nodeType === 1 ) {
4057			if ( truncate && jQuery( elem ).is( until ) ) {
4058				break;
4059			}
4060			matched.push( elem );
4061		}
4062	}
4063	return matched;
4064};
4065
4066
4067var siblings = function( n, elem ) {
4068	var matched = [];
4069
4070	for ( ; n; n = n.nextSibling ) {
4071		if ( n.nodeType === 1 && n !== elem ) {
4072			matched.push( n );
4073		}
4074	}
4075
4076	return matched;
4077};
4078
4079
4080var rneedsContext = jQuery.expr.match.needsContext;
4081
4082var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
4083
4084
4085
4086// Implement the identical functionality for filter and not
4087function winnow( elements, qualifier, not ) {
4088	if ( isFunction( qualifier ) ) {
4089		return jQuery.grep( elements, function( elem, i ) {
4090			return !!qualifier.call( elem, i, elem ) !== not;
4091		} );
4092	}
4093
4094	// Single element
4095	if ( qualifier.nodeType ) {
4096		return jQuery.grep( elements, function( elem ) {
4097			return ( elem === qualifier ) !== not;
4098		} );
4099	}
4100
4101	// Arraylike of elements (jQuery, arguments, Array)
4102	if ( typeof qualifier !== "string" ) {
4103		return jQuery.grep( elements, function( elem ) {
4104			return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
4105		} );
4106	}
4107
4108	// Filtered directly for both simple and complex selectors
4109	return jQuery.filter( qualifier, elements, not );
4110}
4111
4112jQuery.filter = function( expr, elems, not ) {
4113	var elem = elems[ 0 ];
4114
4115	if ( not ) {
4116		expr = ":not(" + expr + ")";
4117	}
4118
4119	if ( elems.length === 1 && elem.nodeType === 1 ) {
4120		return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
4121	}
4122
4123	return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
4124		return elem.nodeType === 1;
4125	} ) );
4126};
4127
4128jQuery.fn.extend( {
4129	find: function( selector ) {
4130		var i, ret,
4131			len = this.length,
4132			self = this;
4133
4134		if ( typeof selector !== "string" ) {
4135			return this.pushStack( jQuery( selector ).filter( function() {
4136				for ( i = 0; i < len; i++ ) {
4137					if ( jQuery.contains( self[ i ], this ) ) {
4138						return true;
4139					}
4140				}
4141			} ) );
4142		}
4143
4144		ret = this.pushStack( [] );
4145
4146		for ( i = 0; i < len; i++ ) {
4147			jQuery.find( selector, self[ i ], ret );
4148		}
4149
4150		return len > 1 ? jQuery.uniqueSort( ret ) : ret;
4151	},
4152	filter: function( selector ) {
4153		return this.pushStack( winnow( this, selector || [], false ) );
4154	},
4155	not: function( selector ) {
4156		return this.pushStack( winnow( this, selector || [], true ) );
4157	},
4158	is: function( selector ) {
4159		return !!winnow(
4160			this,
4161
4162			// If this is a positional/relative selector, check membership in the returned set
4163			// so $("p:first").is("p:last") won't return true for a doc with two "p".
4164			typeof selector === "string" && rneedsContext.test( selector ) ?
vendor: 9,941 bytes, lines 4165-4553
4165				jQuery( selector ) :
4166				selector || [],
4167			false
4168		).length;
4169	}
4170} );
4171
4172
4173// Initialize a jQuery object
4174
4175
4176// A central reference to the root jQuery(document)
4177var rootjQuery,
4178
4179	// A simple way to check for HTML strings
4180	// Prioritize #id over <tag> to avoid XSS via location.hash (trac-9521)
4181	// Strict HTML recognition (trac-11290: must start with <)
4182	// Shortcut simple #id case for speed
4183	rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
4184
4185	init = jQuery.fn.init = function( selector, context, root ) {
4186		var match, elem;
4187
4188		// HANDLE: $(""), $(null), $(undefined), $(false)
4189		if ( !selector ) {
4190			return this;
4191		}
4192
4193		// Method init() accepts an alternate rootjQuery
4194		// so migrate can support jQuery.sub (gh-2101)
4195		root = root || rootjQuery;
4196
4197		// Handle HTML strings
4198		if ( typeof selector === "string" ) {
4199			if ( selector[ 0 ] === "<" &&
4200				selector[ selector.length - 1 ] === ">" &&
4201				selector.length >= 3 ) {
4202
4203				// Assume that strings that start and end with <> are HTML and skip the regex check
4204				match = [ null, selector, null ];
4205
4206			} else {
4207				match = rquickExpr.exec( selector );
4208			}
4209
4210			// Match html or make sure no context is specified for #id
4211			if ( match && ( match[ 1 ] || !context ) ) {
4212
4213				// HANDLE: $(html) -> $(array)
4214				if ( match[ 1 ] ) {
4215					context = context instanceof jQuery ? context[ 0 ] : context;
4216
4217					// Option to run scripts is true for back-compat
4218					// Intentionally let the error be thrown if parseHTML is not present
4219					jQuery.merge( this, jQuery.parseHTML(
4220						match[ 1 ],
4221						context && context.nodeType ? context.ownerDocument || context : document,
4222						true
4223					) );
4224
4225					// HANDLE: $(html, props)
4226					if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
4227						for ( match in context ) {
4228
4229							// Properties of context are called as methods if possible
4230							if ( isFunction( this[ match ] ) ) {
4231								this[ match ]( context[ match ] );
4232
4233							// ...and otherwise set as attributes
4234							} else {
4235								this.attr( match, context[ match ] );
4236							}
4237						}
4238					}
4239
4240					return this;
4241
4242				// HANDLE: $(#id)
4243				} else {
4244					elem = document.getElementById( match[ 2 ] );
4245
4246					if ( elem ) {
4247
4248						// Inject the element directly into the jQuery object
4249						this[ 0 ] = elem;
4250						this.length = 1;
4251					}
4252					return this;
4253				}
4254
4255			// HANDLE: $(expr, $(...))
4256			} else if ( !context || context.jquery ) {
4257				return ( context || root ).find( selector );
4258
4259			// HANDLE: $(expr, context)
4260			// (which is just equivalent to: $(context).find(expr)
4261			} else {
4262				return this.constructor( context ).find( selector );
4263			}
4264
4265		// HANDLE: $(DOMElement)
4266		} else if ( selector.nodeType ) {
4267			this[ 0 ] = selector;
4268			this.length = 1;
4269			return this;
4270
4271		// HANDLE: $(function)
4272		// Shortcut for document ready
4273		} else if ( isFunction( selector ) ) {
4274			return root.ready !== undefined ?
4275				root.ready( selector ) :
4276
4277				// Execute immediately if ready is not present
4278				selector( jQuery );
4279		}
4280
4281		return jQuery.makeArray( selector, this );
4282	};
4283
4284// Give the init function the jQuery prototype for later instantiation
4285init.prototype = jQuery.fn;
4286
4287// Initialize central reference
4288rootjQuery = jQuery( document );
4289
4290
4291var rparentsprev = /^(?:parents|prev(?:Until|All))/,
4292
4293	// Methods guaranteed to produce a unique set when starting from a unique set
4294	guaranteedUnique = {
4295		children: true,
4296		contents: true,
4297		next: true,
4298		prev: true
4299	};
4300
4301jQuery.fn.extend( {
4302	has: function( target ) {
4303		var targets = jQuery( target, this ),
4304			l = targets.length;
4305
4306		return this.filter( function() {
4307			var i = 0;
4308			for ( ; i < l; i++ ) {
4309				if ( jQuery.contains( this, targets[ i ] ) ) {
4310					return true;
4311				}
4312			}
4313		} );
4314	},
4315
4316	closest: function( selectors, context ) {
4317		var cur,
4318			i = 0,
4319			l = this.length,
4320			matched = [],
4321			targets = typeof selectors !== "string" && jQuery( selectors );
4322
4323		// Positional selectors never match, since there's no _selection_ context
4324		if ( !rneedsContext.test( selectors ) ) {
4325			for ( ; i < l; i++ ) {
4326				for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
4327
4328					// Always skip document fragments
4329					if ( cur.nodeType < 11 && ( targets ?
4330						targets.index( cur ) > -1 :
4331
4332						// Don't pass non-elements to jQuery#find
4333						cur.nodeType === 1 &&
4334							jQuery.find.matchesSelector( cur, selectors ) ) ) {
4335
4336						matched.push( cur );
4337						break;
4338					}
4339				}
4340			}
4341		}
4342
4343		return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
4344	},
4345
4346	// Determine the position of an element within the set
4347	index: function( elem ) {
4348
4349		// No argument, return index in parent
4350		if ( !elem ) {
4351			return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
4352		}
4353
4354		// Index in selector
4355		if ( typeof elem === "string" ) {
4356			return indexOf.call( jQuery( elem ), this[ 0 ] );
4357		}
4358
4359		// Locate the position of the desired element
4360		return indexOf.call( this,
4361
4362			// If it receives a jQuery object, the first element is used
4363			elem.jquery ? elem[ 0 ] : elem
4364		);
4365	},
4366
4367	add: function( selector, context ) {
4368		return this.pushStack(
4369			jQuery.uniqueSort(
4370				jQuery.merge( this.get(), jQuery( selector, context ) )
4371			)
4372		);
4373	},
4374
4375	addBack: function( selector ) {
4376		return this.add( selector == null ?
4377			this.prevObject : this.prevObject.filter( selector )
4378		);
4379	}
4380} );
4381
4382function sibling( cur, dir ) {
4383	while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
4384	return cur;
4385}
4386
4387jQuery.each( {
4388	parent: function( elem ) {
4389		var parent = elem.parentNode;
4390		return parent && parent.nodeType !== 11 ? parent : null;
4391	},
4392	parents: function( elem ) {
4393		return dir( elem, "parentNode" );
4394	},
4395	parentsUntil: function( elem, _i, until ) {
4396		return dir( elem, "parentNode", until );
4397	},
4398	next: function( elem ) {
4399		return sibling( elem, "nextSibling" );
4400	},
4401	prev: function( elem ) {
4402		return sibling( elem, "previousSibling" );
4403	},
4404	nextAll: function( elem ) {
4405		return dir( elem, "nextSibling" );
4406	},
4407	prevAll: function( elem ) {
4408		return dir( elem, "previousSibling" );
4409	},
4410	nextUntil: function( elem, _i, until ) {
4411		return dir( elem, "nextSibling", until );
4412	},
4413	prevUntil: function( elem, _i, until ) {
4414		return dir( elem, "previousSibling", until );
4415	},
4416	siblings: function( elem ) {
4417		return siblings( ( elem.parentNode || {} ).firstChild, elem );
4418	},
4419	children: function( elem ) {
4420		return siblings( elem.firstChild );
4421	},
4422	contents: function( elem ) {
4423		if ( elem.contentDocument != null &&
4424
4425			// Support: IE 11+
4426			// <object> elements with no `data` attribute has an object
4427			// `contentDocument` with a `null` prototype.
4428			getProto( elem.contentDocument ) ) {
4429
4430			return elem.contentDocument;
4431		}
4432
4433		// Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
4434		// Treat the template element as a regular one in browsers that
4435		// don't support it.
4436		if ( nodeName( elem, "template" ) ) {
4437			elem = elem.content || elem;
4438		}
4439
4440		return jQuery.merge( [], elem.childNodes );
4441	}
4442}, function( name, fn ) {
4443	jQuery.fn[ name ] = function( until, selector ) {
4444		var matched = jQuery.map( this, fn, until );
4445
4446		if ( name.slice( -5 ) !== "Until" ) {
4447			selector = until;
4448		}
4449
4450		if ( selector && typeof selector === "string" ) {
4451			matched = jQuery.filter( selector, matched );
4452		}
4453
4454		if ( this.length > 1 ) {
4455
4456			// Remove duplicates
4457			if ( !guaranteedUnique[ name ] ) {
4458				jQuery.uniqueSort( matched );
4459			}
4460
4461			// Reverse order for parents* and prev-derivatives
4462			if ( rparentsprev.test( name ) ) {
4463				matched.reverse();
4464			}
4465		}
4466
4467		return this.pushStack( matched );
4468	};
4469} );
4470var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
4471
4472
4473
4474// Convert String-formatted options into Object-formatted ones
4475function createOptions( options ) {
4476	var object = {};
4477	jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
4478		object[ flag ] = true;
4479	} );
4480	return object;
4481}
4482
4483/*
4484 * Create a callback list using the following parameters:
4485 *
4486 *	options: an optional list of space-separated options that will change how
4487 *			the callback list behaves or a more traditional option object
4488 *
4489 * By default a callback list will act like an event callback list and can be
4490 * "fired" multiple times.
4491 *
4492 * Possible options:
4493 *
4494 *	once:			will ensure the callback list can only be fired once (like a Deferred)
4495 *
4496 *	memory:			will keep track of previous values and will call any callback added
4497 *					after the list has been fired right away with the latest "memorized"
4498 *					values (like a Deferred)
4499 *
4500 *	unique:			will ensure a callback can only be added once (no duplicate in the list)
4501 *
4502 *	stopOnFalse:	interrupt callings when a callback returns false
4503 *
4504 */
4505jQuery.Callbacks = function( options ) {
4506
4507	// Convert options from String-formatted to Object-formatted if needed
4508	// (we check in cache first)
4509	options = typeof options === "string" ?
4510		createOptions( options ) :
4511		jQuery.extend( {}, options );
4512
4513	var // Flag to know if list is currently firing
4514		firing,
4515
4516		// Last fire value for non-forgettable lists
4517		memory,
4518
4519		// Flag to know if list was already fired
4520		fired,
4521
4522		// Flag to prevent firing
4523		locked,
4524
4525		// Actual callback list
4526		list = [],
4527
4528		// Queue of execution data for repeatable lists
4529		queue = [],
4530
4531		// Index of currently firing callback (modified by add/remove as needed)
4532		firingIndex = -1,
4533
4534		// Fire callbacks
4535		fire = function() {
4536
4537			// Enforce single-firing
4538			locked = locked || options.once;
4539
4540			// Execute callbacks for all pending executions,
4541			// respecting firingIndex overrides and runtime changes
4542			fired = firing = true;
4543			for ( ; queue.length; firingIndex = -1 ) {
4544				memory = queue.shift();
4545				while ( ++firingIndex < list.length ) {
4546
4547					// Run callback and check for early termination
4548					if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
4549						options.stopOnFalse ) {
4550
4551						// Jump to end and forget the data so .add doesn't re-fire
4552						firingIndex = list.length;
4553						memory = false;
vendor: 4,918 bytes, lines 4554-4763
4554					}
4555				}
4556			}
4557
4558			// Forget the data if we're done with it
4559			if ( !options.memory ) {
4560				memory = false;
4561			}
4562
4563			firing = false;
4564
4565			// Clean up if we're done firing for good
4566			if ( locked ) {
4567
4568				// Keep an empty list if we have data for future add calls
4569				if ( memory ) {
4570					list = [];
4571
4572				// Otherwise, this object is spent
4573				} else {
4574					list = "";
4575				}
4576			}
4577		},
4578
4579		// Actual Callbacks object
4580		self = {
4581
4582			// Add a callback or a collection of callbacks to the list
4583			add: function() {
4584				if ( list ) {
4585
4586					// If we have memory from a past run, we should fire after adding
4587					if ( memory && !firing ) {
4588						firingIndex = list.length - 1;
4589						queue.push( memory );
4590					}
4591
4592					( function add( args ) {
4593						jQuery.each( args, function( _, arg ) {
4594							if ( isFunction( arg ) ) {
4595								if ( !options.unique || !self.has( arg ) ) {
4596									list.push( arg );
4597								}
4598							} else if ( arg && arg.length && toType( arg ) !== "string" ) {
4599
4600								// Inspect recursively
4601								add( arg );
4602							}
4603						} );
4604					} )( arguments );
4605
4606					if ( memory && !firing ) {
4607						fire();
4608					}
4609				}
4610				return this;
4611			},
4612
4613			// Remove a callback from the list
4614			remove: function() {
4615				jQuery.each( arguments, function( _, arg ) {
4616					var index;
4617					while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
4618						list.splice( index, 1 );
4619
4620						// Handle firing indexes
4621						if ( index <= firingIndex ) {
4622							firingIndex--;
4623						}
4624					}
4625				} );
4626				return this;
4627			},
4628
4629			// Check if a given callback is in the list.
4630			// If no argument is given, return whether or not list has callbacks attached.
4631			has: function( fn ) {
4632				return fn ?
4633					jQuery.inArray( fn, list ) > -1 :
4634					list.length > 0;
4635			},
4636
4637			// Remove all callbacks from the list
4638			empty: function() {
4639				if ( list ) {
4640					list = [];
4641				}
4642				return this;
4643			},
4644
4645			// Disable .fire and .add
4646			// Abort any current/pending executions
4647			// Clear all callbacks and values
4648			disable: function() {
4649				locked = queue = [];
4650				list = memory = "";
4651				return this;
4652			},
4653			disabled: function() {
4654				return !list;
4655			},
4656
4657			// Disable .fire
4658			// Also disable .add unless we have memory (since it would have no effect)
4659			// Abort any pending executions
4660			lock: function() {
4661				locked = queue = [];
4662				if ( !memory && !firing ) {
4663					list = memory = "";
4664				}
4665				return this;
4666			},
4667			locked: function() {
4668				return !!locked;
4669			},
4670
4671			// Call all callbacks with the given context and arguments
4672			fireWith: function( context, args ) {
4673				if ( !locked ) {
4674					args = args || [];
4675					args = [ context, args.slice ? args.slice() : args ];
4676					queue.push( args );
4677					if ( !firing ) {
4678						fire();
4679					}
4680				}
4681				return this;
4682			},
4683
4684			// Call all the callbacks with the given arguments
4685			fire: function() {
4686				self.fireWith( this, arguments );
4687				return this;
4688			},
4689
4690			// To know if the callbacks have already been called at least once
4691			fired: function() {
4692				return !!fired;
4693			}
4694		};
4695
4696	return self;
4697};
4698
4699
4700function Identity( v ) {
4701	return v;
4702}
4703function Thrower( ex ) {
4704	throw ex;
4705}
4706
4707function adoptValue( value, resolve, reject, noValue ) {
4708	var method;
4709
4710	try {
4711
4712		// Check for promise aspect first to privilege synchronous behavior
4713		if ( value && isFunction( ( method = value.promise ) ) ) {
4714			method.call( value ).done( resolve ).fail( reject );
4715
4716		// Other thenables
4717		} else if ( value && isFunction( ( method = value.then ) ) ) {
4718			method.call( value, resolve, reject );
4719
4720		// Other non-thenables
4721		} else {
4722
4723			// Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
4724			// * false: [ value ].slice( 0 ) => resolve( value )
4725			// * true: [ value ].slice( 1 ) => resolve()
4726			resolve.apply( undefined, [ value ].slice( noValue ) );
4727		}
4728
4729	// For Promises/A+, convert exceptions into rejections
4730	// Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
4731	// Deferred#then to conditionally suppress rejection.
4732	} catch ( value ) {
4733
4734		// Support: Android 4.0 only
4735		// Strict mode functions invoked without .call/.apply get global-object context
4736		reject.apply( undefined, [ value ] );
4737	}
4738}
4739
4740jQuery.extend( {
4741
4742	Deferred: function( func ) {
4743		var tuples = [
4744
4745				// action, add listener, callbacks,
4746				// ... .then handlers, argument index, [final state]
4747				[ "notify", "progress", jQuery.Callbacks( "memory" ),
4748					jQuery.Callbacks( "memory" ), 2 ],
4749				[ "resolve", "done", jQuery.Callbacks( "once memory" ),
4750					jQuery.Callbacks( "once memory" ), 0, "resolved" ],
4751				[ "reject", "fail", jQuery.Callbacks( "once memory" ),
4752					jQuery.Callbacks( "once memory" ), 1, "rejected" ]
4753			],
4754			state = "pending",
4755			promise = {
4756				state: function() {
4757					return state;
4758				},
4759				always: function() {
4760					deferred.done( arguments ).fail( arguments );
4761					return this;
4762				},
4763				"catch": function( fn ) {
vendor: 28,472 bytes, lines 4764-5875
4764					return promise.then( null, fn );
4765				},
4766
4767				// Keep pipe for back-compat
4768				pipe: function( /* fnDone, fnFail, fnProgress */ ) {
4769					var fns = arguments;
4770
4771					return jQuery.Deferred( function( newDefer ) {
4772						jQuery.each( tuples, function( _i, tuple ) {
4773
4774							// Map tuples (progress, done, fail) to arguments (done, fail, progress)
4775							var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
4776
4777							// deferred.progress(function() { bind to newDefer or newDefer.notify })
4778							// deferred.done(function() { bind to newDefer or newDefer.resolve })
4779							// deferred.fail(function() { bind to newDefer or newDefer.reject })
4780							deferred[ tuple[ 1 ] ]( function() {
4781								var returned = fn && fn.apply( this, arguments );
4782								if ( returned && isFunction( returned.promise ) ) {
4783									returned.promise()
4784										.progress( newDefer.notify )
4785										.done( newDefer.resolve )
4786										.fail( newDefer.reject );
4787								} else {
4788									newDefer[ tuple[ 0 ] + "With" ](
4789										this,
4790										fn ? [ returned ] : arguments
4791									);
4792								}
4793							} );
4794						} );
4795						fns = null;
4796					} ).promise();
4797				},
4798				then: function( onFulfilled, onRejected, onProgress ) {
4799					var maxDepth = 0;
4800					function resolve( depth, deferred, handler, special ) {
4801						return function() {
4802							var that = this,
4803								args = arguments,
4804								mightThrow = function() {
4805									var returned, then;
4806
4807									// Support: Promises/A+ section 2.3.3.3.3
4808									// https://promisesaplus.com/#point-59
4809									// Ignore double-resolution attempts
4810									if ( depth < maxDepth ) {
4811										return;
4812									}
4813
4814									returned = handler.apply( that, args );
4815
4816									// Support: Promises/A+ section 2.3.1
4817									// https://promisesaplus.com/#point-48
4818									if ( returned === deferred.promise() ) {
4819										throw new TypeError( "Thenable self-resolution" );
4820									}
4821
4822									// Support: Promises/A+ sections 2.3.3.1, 3.5
4823									// https://promisesaplus.com/#point-54
4824									// https://promisesaplus.com/#point-75
4825									// Retrieve `then` only once
4826									then = returned &&
4827
4828										// Support: Promises/A+ section 2.3.4
4829										// https://promisesaplus.com/#point-64
4830										// Only check objects and functions for thenability
4831										( typeof returned === "object" ||
4832											typeof returned === "function" ) &&
4833										returned.then;
4834
4835									// Handle a returned thenable
4836									if ( isFunction( then ) ) {
4837
4838										// Special processors (notify) just wait for resolution
4839										if ( special ) {
4840											then.call(
4841												returned,
4842												resolve( maxDepth, deferred, Identity, special ),
4843												resolve( maxDepth, deferred, Thrower, special )
4844											);
4845
4846										// Normal processors (resolve) also hook into progress
4847										} else {
4848
4849											// ...and disregard older resolution values
4850											maxDepth++;
4851
4852											then.call(
4853												returned,
4854												resolve( maxDepth, deferred, Identity, special ),
4855												resolve( maxDepth, deferred, Thrower, special ),
4856												resolve( maxDepth, deferred, Identity,
4857													deferred.notifyWith )
4858											);
4859										}
4860
4861									// Handle all other returned values
4862									} else {
4863
4864										// Only substitute handlers pass on context
4865										// and multiple values (non-spec behavior)
4866										if ( handler !== Identity ) {
4867											that = undefined;
4868											args = [ returned ];
4869										}
4870
4871										// Process the value(s)
4872										// Default process is resolve
4873										( special || deferred.resolveWith )( that, args );
4874									}
4875								},
4876
4877								// Only normal processors (resolve) catch and reject exceptions
4878								process = special ?
4879									mightThrow :
4880									function() {
4881										try {
4882											mightThrow();
4883										} catch ( e ) {
4884
4885											if ( jQuery.Deferred.exceptionHook ) {
4886												jQuery.Deferred.exceptionHook( e,
4887													process.error );
4888											}
4889
4890											// Support: Promises/A+ section 2.3.3.3.4.1
4891											// https://promisesaplus.com/#point-61
4892											// Ignore post-resolution exceptions
4893											if ( depth + 1 >= maxDepth ) {
4894
4895												// Only substitute handlers pass on context
4896												// and multiple values (non-spec behavior)
4897												if ( handler !== Thrower ) {
4898													that = undefined;
4899													args = [ e ];
4900												}
4901
4902												deferred.rejectWith( that, args );
4903											}
4904										}
4905									};
4906
4907							// Support: Promises/A+ section 2.3.3.3.1
4908							// https://promisesaplus.com/#point-57
4909							// Re-resolve promises immediately to dodge false rejection from
4910							// subsequent errors
4911							if ( depth ) {
4912								process();
4913							} else {
4914
4915								// Call an optional hook to record the error, in case of exception
4916								// since it's otherwise lost when execution goes async
4917								if ( jQuery.Deferred.getErrorHook ) {
4918									process.error = jQuery.Deferred.getErrorHook();
4919
4920								// The deprecated alias of the above. While the name suggests
4921								// returning the stack, not an error instance, jQuery just passes
4922								// it directly to `console.warn` so both will work; an instance
4923								// just better cooperates with source maps.
4924								} else if ( jQuery.Deferred.getStackHook ) {
4925									process.error = jQuery.Deferred.getStackHook();
4926								}
4927								window.setTimeout( process );
4928							}
4929						};
4930					}
4931
4932					return jQuery.Deferred( function( newDefer ) {
4933
4934						// progress_handlers.add( ... )
4935						tuples[ 0 ][ 3 ].add(
4936							resolve(
4937								0,
4938								newDefer,
4939								isFunction( onProgress ) ?
4940									onProgress :
4941									Identity,
4942								newDefer.notifyWith
4943							)
4944						);
4945
4946						// fulfilled_handlers.add( ... )
4947						tuples[ 1 ][ 3 ].add(
4948							resolve(
4949								0,
4950								newDefer,
4951								isFunction( onFulfilled ) ?
4952									onFulfilled :
4953									Identity
4954							)
4955						);
4956
4957						// rejected_handlers.add( ... )
4958						tuples[ 2 ][ 3 ].add(
4959							resolve(
4960								0,
4961								newDefer,
4962								isFunction( onRejected ) ?
4963									onRejected :
4964									Thrower
4965							)
4966						);
4967					} ).promise();
4968				},
4969
4970				// Get a promise for this deferred
4971				// If obj is provided, the promise aspect is added to the object
4972				promise: function( obj ) {
4973					return obj != null ? jQuery.extend( obj, promise ) : promise;
4974				}
4975			},
4976			deferred = {};
4977
4978		// Add list-specific methods
4979		jQuery.each( tuples, function( i, tuple ) {
4980			var list = tuple[ 2 ],
4981				stateString = tuple[ 5 ];
4982
4983			// promise.progress = list.add
4984			// promise.done = list.add
4985			// promise.fail = list.add
4986			promise[ tuple[ 1 ] ] = list.add;
4987
4988			// Handle state
4989			if ( stateString ) {
4990				list.add(
4991					function() {
4992
4993						// state = "resolved" (i.e., fulfilled)
4994						// state = "rejected"
4995						state = stateString;
4996					},
4997
4998					// rejected_callbacks.disable
4999					// fulfilled_callbacks.disable
5000					tuples[ 3 - i ][ 2 ].disable,
5001
5002					// rejected_handlers.disable
5003					// fulfilled_handlers.disable
5004					tuples[ 3 - i ][ 3 ].disable,
5005
5006					// progress_callbacks.lock
5007					tuples[ 0 ][ 2 ].lock,
5008
5009					// progress_handlers.lock
5010					tuples[ 0 ][ 3 ].lock
5011				);
5012			}
5013
5014			// progress_handlers.fire
5015			// fulfilled_handlers.fire
5016			// rejected_handlers.fire
5017			list.add( tuple[ 3 ].fire );
5018
5019			// deferred.notify = function() { deferred.notifyWith(...) }
5020			// deferred.resolve = function() { deferred.resolveWith(...) }
5021			// deferred.reject = function() { deferred.rejectWith(...) }
5022			deferred[ tuple[ 0 ] ] = function() {
5023				deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
5024				return this;
5025			};
5026
5027			// deferred.notifyWith = list.fireWith
5028			// deferred.resolveWith = list.fireWith
5029			// deferred.rejectWith = list.fireWith
5030			deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
5031		} );
5032
5033		// Make the deferred a promise
5034		promise.promise( deferred );
5035
5036		// Call given func if any
5037		if ( func ) {
5038			func.call( deferred, deferred );
5039		}
5040
5041		// All done!
5042		return deferred;
5043	},
5044
5045	// Deferred helper
5046	when: function( singleValue ) {
5047		var
5048
5049			// count of uncompleted subordinates
5050			remaining = arguments.length,
5051
5052			// count of unprocessed arguments
5053			i = remaining,
5054
5055			// subordinate fulfillment data
5056			resolveContexts = Array( i ),
5057			resolveValues = slice.call( arguments ),
5058
5059			// the primary Deferred
5060			primary = jQuery.Deferred(),
5061
5062			// subordinate callback factory
5063			updateFunc = function( i ) {
5064				return function( value ) {
5065					resolveContexts[ i ] = this;
5066					resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
5067					if ( !( --remaining ) ) {
5068						primary.resolveWith( resolveContexts, resolveValues );
5069					}
5070				};
5071			};
5072
5073		// Single- and empty arguments are adopted like Promise.resolve
5074		if ( remaining <= 1 ) {
5075			adoptValue( singleValue, primary.done( updateFunc( i ) ).resolve, primary.reject,
5076				!remaining );
5077
5078			// Use .then() to unwrap secondary thenables (cf. gh-3000)
5079			if ( primary.state() === "pending" ||
5080				isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
5081
5082				return primary.then();
5083			}
5084		}
5085
5086		// Multiple arguments are aggregated like Promise.all array elements
5087		while ( i-- ) {
5088			adoptValue( resolveValues[ i ], updateFunc( i ), primary.reject );
5089		}
5090
5091		return primary.promise();
5092	}
5093} );
5094
5095
5096// These usually indicate a programmer mistake during development,
5097// warn about them ASAP rather than swallowing them by default.
5098var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
5099
5100// If `jQuery.Deferred.getErrorHook` is defined, `asyncError` is an error
5101// captured before the async barrier to get the original error cause
5102// which may otherwise be hidden.
5103jQuery.Deferred.exceptionHook = function( error, asyncError ) {
5104
5105	// Support: IE 8 - 9 only
5106	// Console exists when dev tools are open, which can happen at any time
5107	if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
5108		window.console.warn( "jQuery.Deferred exception: " + error.message,
5109			error.stack, asyncError );
5110	}
5111};
5112
5113
5114
5115
5116jQuery.readyException = function( error ) {
5117	window.setTimeout( function() {
5118		throw error;
5119	} );
5120};
5121
5122
5123
5124
5125// The deferred used on DOM ready
5126var readyList = jQuery.Deferred();
5127
5128jQuery.fn.ready = function( fn ) {
5129
5130	readyList
5131		.then( fn )
5132
5133		// Wrap jQuery.readyException in a function so that the lookup
5134		// happens at the time of error handling instead of callback
5135		// registration.
5136		.catch( function( error ) {
5137			jQuery.readyException( error );
5138		} );
5139
5140	return this;
5141};
5142
5143jQuery.extend( {
5144
5145	// Is the DOM ready to be used? Set to true once it occurs.
5146	isReady: false,
5147
5148	// A counter to track how many items to wait for before
5149	// the ready event fires. See trac-6781
5150	readyWait: 1,
5151
5152	// Handle when the DOM is ready
5153	ready: function( wait ) {
5154
5155		// Abort if there are pending holds or we're already ready
5156		if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
5157			return;
5158		}
5159
5160		// Remember that the DOM is ready
5161		jQuery.isReady = true;
5162
5163		// If a normal DOM Ready event fired, decrement, and wait if need be
5164		if ( wait !== true && --jQuery.readyWait > 0 ) {
5165			return;
5166		}
5167
5168		// If there are functions bound, to execute
5169		readyList.resolveWith( document, [ jQuery ] );
5170	}
5171} );
5172
5173jQuery.ready.then = readyList.then;
5174
5175// The ready event handler and self cleanup method
5176function completed() {
5177	document.removeEventListener( "DOMContentLoaded", completed );
5178	window.removeEventListener( "load", completed );
5179	jQuery.ready();
5180}
5181
5182// Catch cases where $(document).ready() is called
5183// after the browser event has already occurred.
5184// Support: IE <=9 - 10 only
5185// Older IE sometimes signals "interactive" too soon
5186if ( document.readyState === "complete" ||
5187	( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
5188
5189	// Handle it asynchronously to allow scripts the opportunity to delay ready
5190	window.setTimeout( jQuery.ready );
5191
5192} else {
5193
5194	// Use the handy event callback
5195	document.addEventListener( "DOMContentLoaded", completed );
5196
5197	// A fallback to window.onload, that will always work
5198	window.addEventListener( "load", completed );
5199}
5200
5201
5202
5203
5204// Multifunctional method to get and set values of a collection
5205// The value/s can optionally be executed if it's a function
5206var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
5207	var i = 0,
5208		len = elems.length,
5209		bulk = key == null;
5210
5211	// Sets many values
5212	if ( toType( key ) === "object" ) {
5213		chainable = true;
5214		for ( i in key ) {
5215			access( elems, fn, i, key[ i ], true, emptyGet, raw );
5216		}
5217
5218	// Sets one value
5219	} else if ( value !== undefined ) {
5220		chainable = true;
5221
5222		if ( !isFunction( value ) ) {
5223			raw = true;
5224		}
5225
5226		if ( bulk ) {
5227
5228			// Bulk operations run against the entire set
5229			if ( raw ) {
5230				fn.call( elems, value );
5231				fn = null;
5232
5233			// ...except when executing function values
5234			} else {
5235				bulk = fn;
5236				fn = function( elem, _key, value ) {
5237					return bulk.call( jQuery( elem ), value );
5238				};
5239			}
5240		}
5241
5242		if ( fn ) {
5243			for ( ; i < len; i++ ) {
5244				fn(
5245					elems[ i ], key, raw ?
5246						value :
5247						value.call( elems[ i ], i, fn( elems[ i ], key ) )
5248				);
5249			}
5250		}
5251	}
5252
5253	if ( chainable ) {
5254		return elems;
5255	}
5256
5257	// Gets
5258	if ( bulk ) {
5259		return fn.call( elems );
5260	}
5261
5262	return len ? fn( elems[ 0 ], key ) : emptyGet;
5263};
5264
5265
5266// Matches dashed string for camelizing
5267var rmsPrefix = /^-ms-/,
5268	rdashAlpha = /-([a-z])/g;
5269
5270// Used by camelCase as callback to replace()
5271function fcamelCase( _all, letter ) {
5272	return letter.toUpperCase();
5273}
5274
5275// Convert dashed to camelCase; used by the css and data modules
5276// Support: IE <=9 - 11, Edge 12 - 15
5277// Microsoft forgot to hump their vendor prefix (trac-9572)
5278function camelCase( string ) {
5279	return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
5280}
5281var acceptData = function( owner ) {
5282
5283	// Accepts only:
5284	//  - Node
5285	//    - Node.ELEMENT_NODE
5286	//    - Node.DOCUMENT_NODE
5287	//  - Object
5288	//    - Any
5289	return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
5290};
5291
5292
5293
5294
5295function Data() {
5296	this.expando = jQuery.expando + Data.uid++;
5297}
5298
5299Data.uid = 1;
5300
5301Data.prototype = {
5302
5303	cache: function( owner ) {
5304
5305		// Check if the owner object already has a cache
5306		var value = owner[ this.expando ];
5307
5308		// If not, create one
5309		if ( !value ) {
5310			value = {};
5311
5312			// We can accept data for non-element nodes in modern browsers,
5313			// but we should not, see trac-8335.
5314			// Always return an empty object.
5315			if ( acceptData( owner ) ) {
5316
5317				// If it is a node unlikely to be stringify-ed or looped over
5318				// use plain assignment
5319				if ( owner.nodeType ) {
5320					owner[ this.expando ] = value;
5321
5322				// Otherwise secure it in a non-enumerable property
5323				// configurable must be true to allow the property to be
5324				// deleted when data is removed
5325				} else {
5326					Object.defineProperty( owner, this.expando, {
5327						value: value,
5328						configurable: true
5329					} );
5330				}
5331			}
5332		}
5333
5334		return value;
5335	},
5336	set: function( owner, data, value ) {
5337		var prop,
5338			cache = this.cache( owner );
5339
5340		// Handle: [ owner, key, value ] args
5341		// Always use camelCase key (gh-2257)
5342		if ( typeof data === "string" ) {
5343			cache[ camelCase( data ) ] = value;
5344
5345		// Handle: [ owner, { properties } ] args
5346		} else {
5347
5348			// Copy the properties one-by-one to the cache object
5349			for ( prop in data ) {
5350				cache[ camelCase( prop ) ] = data[ prop ];
5351			}
5352		}
5353		return cache;
5354	},
5355	get: function( owner, key ) {
5356		return key === undefined ?
5357			this.cache( owner ) :
5358
5359			// Always use camelCase key (gh-2257)
5360			owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
5361	},
5362	access: function( owner, key, value ) {
5363
5364		// In cases where either:
5365		//
5366		//   1. No key was specified
5367		//   2. A string key was specified, but no value provided
5368		//
5369		// Take the "read" path and allow the get method to determine
5370		// which value to return, respectively either:
5371		//
5372		//   1. The entire cache object
5373		//   2. The data stored at the key
5374		//
5375		if ( key === undefined ||
5376				( ( key && typeof key === "string" ) && value === undefined ) ) {
5377
5378			return this.get( owner, key );
5379		}
5380
5381		// When the key is not a string, or both a key and value
5382		// are specified, set or extend (existing objects) with either:
5383		//
5384		//   1. An object of properties
5385		//   2. A key and value
5386		//
5387		this.set( owner, key, value );
5388
5389		// Since the "set" path can have two possible entry points
5390		// return the expected data based on which path was taken[*]
5391		return value !== undefined ? value : key;
5392	},
5393	remove: function( owner, key ) {
5394		var i,
5395			cache = owner[ this.expando ];
5396
5397		if ( cache === undefined ) {
5398			return;
5399		}
5400
5401		if ( key !== undefined ) {
5402
5403			// Support array or space separated string of keys
5404			if ( Array.isArray( key ) ) {
5405
5406				// If key is an array of keys...
5407				// We always set camelCase keys, so remove that.
5408				key = key.map( camelCase );
5409			} else {
5410				key = camelCase( key );
5411
5412				// If a key with the spaces exists, use it.
5413				// Otherwise, create an array by matching non-whitespace
5414				key = key in cache ?
5415					[ key ] :
5416					( key.match( rnothtmlwhite ) || [] );
5417			}
5418
5419			i = key.length;
5420
5421			while ( i-- ) {
5422				delete cache[ key[ i ] ];
5423			}
5424		}
5425
5426		// Remove the expando if there's no more data
5427		if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
5428
5429			// Support: Chrome <=35 - 45
5430			// Webkit & Blink performance suffers when deleting properties
5431			// from DOM nodes, so set to undefined instead
5432			// https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
5433			if ( owner.nodeType ) {
5434				owner[ this.expando ] = undefined;
5435			} else {
5436				delete owner[ this.expando ];
5437			}
5438		}
5439	},
5440	hasData: function( owner ) {
5441		var cache = owner[ this.expando ];
5442		return cache !== undefined && !jQuery.isEmptyObject( cache );
5443	}
5444};
5445var dataPriv = new Data();
5446
5447var dataUser = new Data();
5448
5449
5450
5451//	Implementation Summary
5452//
5453//	1. Enforce API surface and semantic compatibility with 1.9.x branch
5454//	2. Improve the module's maintainability by reducing the storage
5455//		paths to a single mechanism.
5456//	3. Use the same single mechanism to support "private" and "user" data.
5457//	4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
5458//	5. Avoid exposing implementation details on user objects (eg. expando properties)
5459//	6. Provide a clear path for implementation upgrade to WeakMap in 2014
5460
5461var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
5462	rmultiDash = /[A-Z]/g;
5463
5464function getData( data ) {
5465	if ( data === "true" ) {
5466		return true;
5467	}
5468
5469	if ( data === "false" ) {
5470		return false;
5471	}
5472
5473	if ( data === "null" ) {
5474		return null;
5475	}
5476
5477	// Only convert to a number if it doesn't change the string
5478	if ( data === +data + "" ) {
5479		return +data;
5480	}
5481
5482	if ( rbrace.test( data ) ) {
5483		return JSON.parse( data );
5484	}
5485
5486	return data;
5487}
5488
5489function dataAttr( elem, key, data ) {
5490	var name;
5491
5492	// If nothing was found internally, try to fetch any
5493	// data from the HTML5 data-* attribute
5494	if ( data === undefined && elem.nodeType === 1 ) {
5495		name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
5496		data = elem.getAttribute( name );
5497
5498		if ( typeof data === "string" ) {
5499			try {
5500				data = getData( data );
5501			} catch ( e ) {}
5502
5503			// Make sure we set the data so it isn't changed later
5504			dataUser.set( elem, key, data );
5505		} else {
5506			data = undefined;
5507		}
5508	}
5509	return data;
5510}
5511
5512jQuery.extend( {
5513	hasData: function( elem ) {
5514		return dataUser.hasData( elem ) || dataPriv.hasData( elem );
5515	},
5516
5517	data: function( elem, name, data ) {
5518		return dataUser.access( elem, name, data );
5519	},
5520
5521	removeData: function( elem, name ) {
5522		dataUser.remove( elem, name );
5523	},
5524
5525	// TODO: Now that all calls to _data and _removeData have been replaced
5526	// with direct calls to dataPriv methods, these can be deprecated.
5527	_data: function( elem, name, data ) {
5528		return dataPriv.access( elem, name, data );
5529	},
5530
5531	_removeData: function( elem, name ) {
5532		dataPriv.remove( elem, name );
5533	}
5534} );
5535
5536jQuery.fn.extend( {
5537	data: function( key, value ) {
5538		var i, name, data,
5539			elem = this[ 0 ],
5540			attrs = elem && elem.attributes;
5541
5542		// Gets all values
5543		if ( key === undefined ) {
5544			if ( this.length ) {
5545				data = dataUser.get( elem );
5546
5547				if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
5548					i = attrs.length;
5549					while ( i-- ) {
5550
5551						// Support: IE 11 only
5552						// The attrs elements can be null (trac-14894)
5553						if ( attrs[ i ] ) {
5554							name = attrs[ i ].name;
5555							if ( name.indexOf( "data-" ) === 0 ) {
5556								name = camelCase( name.slice( 5 ) );
5557								dataAttr( elem, name, data[ name ] );
5558							}
5559						}
5560					}
5561					dataPriv.set( elem, "hasDataAttrs", true );
5562				}
5563			}
5564
5565			return data;
5566		}
5567
5568		// Sets multiple values
5569		if ( typeof key === "object" ) {
5570			return this.each( function() {
5571				dataUser.set( this, key );
5572			} );
5573		}
5574
5575		return access( this, function( value ) {
5576			var data;
5577
5578			// The calling jQuery object (element matches) is not empty
5579			// (and therefore has an element appears at this[ 0 ]) and the
5580			// `value` parameter was not undefined. An empty jQuery object
5581			// will result in `undefined` for elem = this[ 0 ] which will
5582			// throw an exception if an attempt to read a data cache is made.
5583			if ( elem && value === undefined ) {
5584
5585				// Attempt to get data from the cache
5586				// The key will always be camelCased in Data
5587				data = dataUser.get( elem, key );
5588				if ( data !== undefined ) {
5589					return data;
5590				}
5591
5592				// Attempt to "discover" the data in
5593				// HTML5 custom data-* attrs
5594				data = dataAttr( elem, key );
5595				if ( data !== undefined ) {
5596					return data;
5597				}
5598
5599				// We tried really hard, but the data doesn't exist.
5600				return;
5601			}
5602
5603			// Set the data...
5604			this.each( function() {
5605
5606				// We always store the camelCased key
5607				dataUser.set( this, key, value );
5608			} );
5609		}, null, value, arguments.length > 1, null, true );
5610	},
5611
5612	removeData: function( key ) {
5613		return this.each( function() {
5614			dataUser.remove( this, key );
5615		} );
5616	}
5617} );
5618
5619
5620jQuery.extend( {
5621	queue: function( elem, type, data ) {
5622		var queue;
5623
5624		if ( elem ) {
5625			type = ( type || "fx" ) + "queue";
5626			queue = dataPriv.get( elem, type );
5627
5628			// Speed up dequeue by getting out quickly if this is just a lookup
5629			if ( data ) {
5630				if ( !queue || Array.isArray( data ) ) {
5631					queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
5632				} else {
5633					queue.push( data );
5634				}
5635			}
5636			return queue || [];
5637		}
5638	},
5639
5640	dequeue: function( elem, type ) {
5641		type = type || "fx";
5642
5643		var queue = jQuery.queue( elem, type ),
5644			startLength = queue.length,
5645			fn = queue.shift(),
5646			hooks = jQuery._queueHooks( elem, type ),
5647			next = function() {
5648				jQuery.dequeue( elem, type );
5649			};
5650
5651		// If the fx queue is dequeued, always remove the progress sentinel
5652		if ( fn === "inprogress" ) {
5653			fn = queue.shift();
5654			startLength--;
5655		}
5656
5657		if ( fn ) {
5658
5659			// Add a progress sentinel to prevent the fx queue from being
5660			// automatically dequeued
5661			if ( type === "fx" ) {
5662				queue.unshift( "inprogress" );
5663			}
5664
5665			// Clear up the last queue stop function
5666			delete hooks.stop;
5667			fn.call( elem, next, hooks );
5668		}
5669
5670		if ( !startLength && hooks ) {
5671			hooks.empty.fire();
5672		}
5673	},
5674
5675	// Not public - generate a queueHooks object, or return the current one
5676	_queueHooks: function( elem, type ) {
5677		var key = type + "queueHooks";
5678		return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
5679			empty: jQuery.Callbacks( "once memory" ).add( function() {
5680				dataPriv.remove( elem, [ type + "queue", key ] );
5681			} )
5682		} );
5683	}
5684} );
5685
5686jQuery.fn.extend( {
5687	queue: function( type, data ) {
5688		var setter = 2;
5689
5690		if ( typeof type !== "string" ) {
5691			data = type;
5692			type = "fx";
5693			setter--;
5694		}
5695
5696		if ( arguments.length < setter ) {
5697			return jQuery.queue( this[ 0 ], type );
5698		}
5699
5700		return data === undefined ?
5701			this :
5702			this.each( function() {
5703				var queue = jQuery.queue( this, type, data );
5704
5705				// Ensure a hooks for this queue
5706				jQuery._queueHooks( this, type );
5707
5708				if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
5709					jQuery.dequeue( this, type );
5710				}
5711			} );
5712	},
5713	dequeue: function( type ) {
5714		return this.each( function() {
5715			jQuery.dequeue( this, type );
5716		} );
5717	},
5718	clearQueue: function( type ) {
5719		return this.queue( type || "fx", [] );
5720	},
5721
5722	// Get a promise resolved when queues of a certain type
5723	// are emptied (fx is the type by default)
5724	promise: function( type, obj ) {
5725		var tmp,
5726			count = 1,
5727			defer = jQuery.Deferred(),
5728			elements = this,
5729			i = this.length,
5730			resolve = function() {
5731				if ( !( --count ) ) {
5732					defer.resolveWith( elements, [ elements ] );
5733				}
5734			};
5735
5736		if ( typeof type !== "string" ) {
5737			obj = type;
5738			type = undefined;
5739		}
5740		type = type || "fx";
5741
5742		while ( i-- ) {
5743			tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
5744			if ( tmp && tmp.empty ) {
5745				count++;
5746				tmp.empty.add( resolve );
5747			}
5748		}
5749		resolve();
5750		return defer.promise( obj );
5751	}
5752} );
5753var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
5754
5755var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
5756
5757
5758var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
5759
5760var documentElement = document.documentElement;
5761
5762
5763
5764	var isAttached = function( elem ) {
5765			return jQuery.contains( elem.ownerDocument, elem );
5766		},
5767		composed = { composed: true };
5768
5769	// Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
5770	// Check attachment across shadow DOM boundaries when possible (gh-3504)
5771	// Support: iOS 10.0-10.2 only
5772	// Early iOS 10 versions support `attachShadow` but not `getRootNode`,
5773	// leading to errors. We need to check for `getRootNode`.
5774	if ( documentElement.getRootNode ) {
5775		isAttached = function( elem ) {
5776			return jQuery.contains( elem.ownerDocument, elem ) ||
5777				elem.getRootNode( composed ) === elem.ownerDocument;
5778		};
5779	}
5780var isHiddenWithinTree = function( elem, el ) {
5781
5782		// isHiddenWithinTree might be called from jQuery#filter function;
5783		// in that case, element will be second argument
5784		elem = el || elem;
5785
5786		// Inline style trumps all
5787		return elem.style.display === "none" ||
5788			elem.style.display === "" &&
5789
5790			// Otherwise, check computed style
5791			// Support: Firefox <=43 - 45
5792			// Disconnected elements can have computed display: none, so first confirm that elem is
5793			// in the document.
5794			isAttached( elem ) &&
5795
5796			jQuery.css( elem, "display" ) === "none";
5797	};
5798
5799
5800
5801function adjustCSS( elem, prop, valueParts, tween ) {
5802	var adjusted, scale,
5803		maxIterations = 20,
5804		currentValue = tween ?
5805			function() {
5806				return tween.cur();
5807			} :
5808			function() {
5809				return jQuery.css( elem, prop, "" );
5810			},
5811		initial = currentValue(),
5812		unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
5813
5814		// Starting value computation is required for potential unit mismatches
5815		initialInUnit = elem.nodeType &&
5816			( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
5817			rcssNum.exec( jQuery.css( elem, prop ) );
5818
5819	if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
5820
5821		// Support: Firefox <=54
5822		// Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
5823		initial = initial / 2;
5824
5825		// Trust units reported by jQuery.css
5826		unit = unit || initialInUnit[ 3 ];
5827
5828		// Iteratively approximate from a nonzero starting point
5829		initialInUnit = +initial || 1;
5830
5831		while ( maxIterations-- ) {
5832
5833			// Evaluate and update our best guess (doubling guesses that zero out).
5834			// Finish if the scale equals or crosses 1 (making the old*new product non-positive).
5835			jQuery.style( elem, prop, initialInUnit + unit );
5836			if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
5837				maxIterations = 0;
5838			}
5839			initialInUnit = initialInUnit / scale;
5840
5841		}
5842
5843		initialInUnit = initialInUnit * 2;
5844		jQuery.style( elem, prop, initialInUnit + unit );
5845
5846		// Make sure we update the tween properties later on
5847		valueParts = valueParts || [];
5848	}
5849
5850	if ( valueParts ) {
5851		initialInUnit = +initialInUnit || +initial || 0;
5852
5853		// Apply relative offset (+=/-=) if specified
5854		adjusted = valueParts[ 1 ] ?
5855			initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
5856			+valueParts[ 2 ];
5857		if ( tween ) {
5858			tween.unit = unit;
5859			tween.start = initialInUnit;
5860			tween.end = adjusted;
5861		}
5862	}
5863	return adjusted;
5864}
5865
5866
5867var defaultDisplayMap = {};
5868
5869function getDefaultDisplay( elem ) {
5870	var temp,
5871		doc = elem.ownerDocument,
5872		nodeName = elem.nodeName,
5873		display = defaultDisplayMap[ nodeName ];
5874
5875	if ( display ) {
vendor: 2,317 bytes, lines 5876-5974
5876		return display;
5877	}
5878
5879	temp = doc.body.appendChild( doc.createElement( nodeName ) );
5880	display = jQuery.css( temp, "display" );
5881
5882	temp.parentNode.removeChild( temp );
5883
5884	if ( display === "none" ) {
5885		display = "block";
5886	}
5887	defaultDisplayMap[ nodeName ] = display;
5888
5889	return display;
5890}
5891
5892function showHide( elements, show ) {
5893	var display, elem,
5894		values = [],
5895		index = 0,
5896		length = elements.length;
5897
5898	// Determine new display value for elements that need to change
5899	for ( ; index < length; index++ ) {
5900		elem = elements[ index ];
5901		if ( !elem.style ) {
5902			continue;
5903		}
5904
5905		display = elem.style.display;
5906		if ( show ) {
5907
5908			// Since we force visibility upon cascade-hidden elements, an immediate (and slow)
5909			// check is required in this first loop unless we have a nonempty display value (either
5910			// inline or about-to-be-restored)
5911			if ( display === "none" ) {
5912				values[ index ] = dataPriv.get( elem, "display" ) || null;
5913				if ( !values[ index ] ) {
5914					elem.style.display = "";
5915				}
5916			}
5917			if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
5918				values[ index ] = getDefaultDisplay( elem );
5919			}
5920		} else {
5921			if ( display !== "none" ) {
5922				values[ index ] = "none";
5923
5924				// Remember what we're overwriting
5925				dataPriv.set( elem, "display", display );
5926			}
5927		}
5928	}
5929
5930	// Set the display of the elements in a second loop to avoid constant reflow
5931	for ( index = 0; index < length; index++ ) {
5932		if ( values[ index ] != null ) {
5933			elements[ index ].style.display = values[ index ];
5934		}
5935	}
5936
5937	return elements;
5938}
5939
5940jQuery.fn.extend( {
5941	show: function() {
5942		return showHide( this, true );
5943	},
5944	hide: function() {
5945		return showHide( this );
5946	},
5947	toggle: function( state ) {
5948		if ( typeof state === "boolean" ) {
5949			return state ? this.show() : this.hide();
5950		}
5951
5952		return this.each( function() {
5953			if ( isHiddenWithinTree( this ) ) {
5954				jQuery( this ).show();
5955			} else {
5956				jQuery( this ).hide();
5957			}
5958		} );
5959	}
5960} );
5961var rcheckableType = ( /^(?:checkbox|radio)$/i );
5962
5963var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
5964
5965var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
5966
5967
5968
5969( function() {
5970	var fragment = document.createDocumentFragment(),
5971		div = fragment.appendChild( document.createElement( "div" ) ),
5972		input = document.createElement( "input" );
5973
5974	// Support: Android 4.0 - 4.3 only
vendor: 10,092 bytes, lines 5975-6359
5975	// Check state lost if the name is set (trac-11217)
5976	// Support: Windows Web Apps (WWA)
5977	// `name` and `type` must use .setAttribute for WWA (trac-14901)
5978	input.setAttribute( "type", "radio" );
5979	input.setAttribute( "checked", "checked" );
5980	input.setAttribute( "name", "t" );
5981
5982	div.appendChild( input );
5983
5984	// Support: Android <=4.1 only
5985	// Older WebKit doesn't clone checked state correctly in fragments
5986	support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
5987
5988	// Support: IE <=11 only
5989	// Make sure textarea (and checkbox) defaultValue is properly cloned
5990	div.innerHTML = "<textarea>x</textarea>";
5991	support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
5992
5993	// Support: IE <=9 only
5994	// IE <=9 replaces <option> tags with their contents when inserted outside of
5995	// the select element.
5996	div.innerHTML = "<option></option>";
5997	support.option = !!div.lastChild;
5998} )();
5999
6000
6001// We have to close these tags to support XHTML (trac-13200)
6002var wrapMap = {
6003
6004	// XHTML parsers do not magically insert elements in the
6005	// same way that tag soup parsers do. So we cannot shorten
6006	// this by omitting <tbody> or other required elements.
6007	thead: [ 1, "<table>", "</table>" ],
6008	col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
6009	tr: [ 2, "<table><tbody>", "</tbody></table>" ],
6010	td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
6011
6012	_default: [ 0, "", "" ]
6013};
6014
6015wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
6016wrapMap.th = wrapMap.td;
6017
6018// Support: IE <=9 only
6019if ( !support.option ) {
6020	wrapMap.optgroup = wrapMap.option = [ 1, "<select multiple='multiple'>", "</select>" ];
6021}
6022
6023
6024function getAll( context, tag ) {
6025
6026	// Support: IE <=9 - 11 only
6027	// Use typeof to avoid zero-argument method invocation on host objects (trac-15151)
6028	var ret;
6029
6030	if ( typeof context.getElementsByTagName !== "undefined" ) {
6031		ret = context.getElementsByTagName( tag || "*" );
6032
6033	} else if ( typeof context.querySelectorAll !== "undefined" ) {
6034		ret = context.querySelectorAll( tag || "*" );
6035
6036	} else {
6037		ret = [];
6038	}
6039
6040	if ( tag === undefined || tag && nodeName( context, tag ) ) {
6041		return jQuery.merge( [ context ], ret );
6042	}
6043
6044	return ret;
6045}
6046
6047
6048// Mark scripts as having already been evaluated
6049function setGlobalEval( elems, refElements ) {
6050	var i = 0,
6051		l = elems.length;
6052
6053	for ( ; i < l; i++ ) {
6054		dataPriv.set(
6055			elems[ i ],
6056			"globalEval",
6057			!refElements || dataPriv.get( refElements[ i ], "globalEval" )
6058		);
6059	}
6060}
6061
6062
6063var rhtml = /<|&#?\w+;/;
6064
6065function buildFragment( elems, context, scripts, selection, ignored ) {
6066	var elem, tmp, tag, wrap, attached, j,
6067		fragment = context.createDocumentFragment(),
6068		nodes = [],
6069		i = 0,
6070		l = elems.length;
6071
6072	for ( ; i < l; i++ ) {
6073		elem = elems[ i ];
6074
6075		if ( elem || elem === 0 ) {
6076
6077			// Add nodes directly
6078			if ( toType( elem ) === "object" ) {
6079
6080				// Support: Android <=4.0 only, PhantomJS 1 only
6081				// push.apply(_, arraylike) throws on ancient WebKit
6082				jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
6083
6084			// Convert non-html into a text node
6085			} else if ( !rhtml.test( elem ) ) {
6086				nodes.push( context.createTextNode( elem ) );
6087
6088			// Convert html into DOM nodes
6089			} else {
6090				tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
6091
6092				// Deserialize a standard representation
6093				tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
6094				wrap = wrapMap[ tag ] || wrapMap._default;
6095				tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
6096
6097				// Descend through wrappers to the right content
6098				j = wrap[ 0 ];
6099				while ( j-- ) {
6100					tmp = tmp.lastChild;
6101				}
6102
6103				// Support: Android <=4.0 only, PhantomJS 1 only
6104				// push.apply(_, arraylike) throws on ancient WebKit
6105				jQuery.merge( nodes, tmp.childNodes );
6106
6107				// Remember the top-level container
6108				tmp = fragment.firstChild;
6109
6110				// Ensure the created nodes are orphaned (trac-12392)
6111				tmp.textContent = "";
6112			}
6113		}
6114	}
6115
6116	// Remove wrapper from fragment
6117	fragment.textContent = "";
6118
6119	i = 0;
6120	while ( ( elem = nodes[ i++ ] ) ) {
6121
6122		// Skip elements already in the context collection (trac-4087)
6123		if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
6124			if ( ignored ) {
6125				ignored.push( elem );
6126			}
6127			continue;
6128		}
6129
6130		attached = isAttached( elem );
6131
6132		// Append to fragment
6133		tmp = getAll( fragment.appendChild( elem ), "script" );
6134
6135		// Preserve script evaluation history
6136		if ( attached ) {
6137			setGlobalEval( tmp );
6138		}
6139
6140		// Capture executables
6141		if ( scripts ) {
6142			j = 0;
6143			while ( ( elem = tmp[ j++ ] ) ) {
6144				if ( rscriptType.test( elem.type || "" ) ) {
6145					scripts.push( elem );
6146				}
6147			}
6148		}
6149	}
6150
6151	return fragment;
6152}
6153
6154
6155var rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
6156
6157function returnTrue() {
6158	return true;
6159}
6160
6161function returnFalse() {
6162	return false;
6163}
6164
6165function on( elem, types, selector, data, fn, one ) {
6166	var origFn, type;
6167
6168	// Types can be a map of types/handlers
6169	if ( typeof types === "object" ) {
6170
6171		// ( types-Object, selector, data )
6172		if ( typeof selector !== "string" ) {
6173
6174			// ( types-Object, data )
6175			data = data || selector;
6176			selector = undefined;
6177		}
6178		for ( type in types ) {
6179			on( elem, type, selector, data, types[ type ], one );
6180		}
6181		return elem;
6182	}
6183
6184	if ( data == null && fn == null ) {
6185
6186		// ( types, fn )
6187		fn = selector;
6188		data = selector = undefined;
6189	} else if ( fn == null ) {
6190		if ( typeof selector === "string" ) {
6191
6192			// ( types, selector, fn )
6193			fn = data;
6194			data = undefined;
6195		} else {
6196
6197			// ( types, data, fn )
6198			fn = data;
6199			data = selector;
6200			selector = undefined;
6201		}
6202	}
6203	if ( fn === false ) {
6204		fn = returnFalse;
6205	} else if ( !fn ) {
6206		return elem;
6207	}
6208
6209	if ( one === 1 ) {
6210		origFn = fn;
6211		fn = function( event ) {
6212
6213			// Can use an empty set, since event contains the info
6214			jQuery().off( event );
6215			return origFn.apply( this, arguments );
6216		};
6217
6218		// Use same guid so caller can remove using origFn
6219		fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
6220	}
6221	return elem.each( function() {
6222		jQuery.event.add( this, types, fn, data, selector );
6223	} );
6224}
6225
6226/*
6227 * Helper functions for managing events -- not part of the public interface.
6228 * Props to Dean Edwards' addEvent library for many of the ideas.
6229 */
6230jQuery.event = {
6231
6232	global: {},
6233
6234	add: function( elem, types, handler, data, selector ) {
6235
6236		var handleObjIn, eventHandle, tmp,
6237			events, t, handleObj,
6238			special, handlers, type, namespaces, origType,
6239			elemData = dataPriv.get( elem );
6240
6241		// Only attach events to objects that accept data
6242		if ( !acceptData( elem ) ) {
6243			return;
6244		}
6245
6246		// Caller can pass in an object of custom data in lieu of the handler
6247		if ( handler.handler ) {
6248			handleObjIn = handler;
6249			handler = handleObjIn.handler;
6250			selector = handleObjIn.selector;
6251		}
6252
6253		// Ensure that invalid selectors throw exceptions at attach time
6254		// Evaluate against documentElement in case elem is a non-element node (e.g., document)
6255		if ( selector ) {
6256			jQuery.find.matchesSelector( documentElement, selector );
6257		}
6258
6259		// Make sure that the handler has a unique ID, used to find/remove it later
6260		if ( !handler.guid ) {
6261			handler.guid = jQuery.guid++;
6262		}
6263
6264		// Init the element's event structure and main handler, if this is the first
6265		if ( !( events = elemData.events ) ) {
6266			events = elemData.events = Object.create( null );
6267		}
6268		if ( !( eventHandle = elemData.handle ) ) {
6269			eventHandle = elemData.handle = function( e ) {
6270
6271				// Discard the second event of a jQuery.event.trigger() and
6272				// when an event is called after a page has unloaded
6273				return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
6274					jQuery.event.dispatch.apply( elem, arguments ) : undefined;
6275			};
6276		}
6277
6278		// Handle multiple events separated by a space
6279		types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
6280		t = types.length;
6281		while ( t-- ) {
6282			tmp = rtypenamespace.exec( types[ t ] ) || [];
6283			type = origType = tmp[ 1 ];
6284			namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
6285
6286			// There *must* be a type, no attaching namespace-only handlers
6287			if ( !type ) {
6288				continue;
6289			}
6290
6291			// If event changes its type, use the special event handlers for the changed type
6292			special = jQuery.event.special[ type ] || {};
6293
6294			// If selector defined, determine special event api type, otherwise given type
6295			type = ( selector ? special.delegateType : special.bindType ) || type;
6296
6297			// Update special based on newly reset type
6298			special = jQuery.event.special[ type ] || {};
6299
6300			// handleObj is passed to all event handlers
6301			handleObj = jQuery.extend( {
6302				type: type,
6303				origType: origType,
6304				data: data,
6305				handler: handler,
6306				guid: handler.guid,
6307				selector: selector,
6308				needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
6309				namespace: namespaces.join( "." )
6310			}, handleObjIn );
6311
6312			// Init the event handler queue if we're the first
6313			if ( !( handlers = events[ type ] ) ) {
6314				handlers = events[ type ] = [];
6315				handlers.delegateCount = 0;
6316
6317				// Only use addEventListener if the special events handler returns false
6318				if ( !special.setup ||
6319					special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
6320
6321					if ( elem.addEventListener ) {
6322						elem.addEventListener( type, eventHandle );
6323					}
6324				}
6325			}
6326
6327			if ( special.add ) {
6328				special.add.call( elem, handleObj );
6329
6330				if ( !handleObj.handler.guid ) {
6331					handleObj.handler.guid = handler.guid;
6332				}
6333			}
6334
6335			// Add to the element's handler list, delegates in front
6336			if ( selector ) {
6337				handlers.splice( handlers.delegateCount++, 0, handleObj );
6338			} else {
6339				handlers.push( handleObj );
6340			}
6341
6342			// Keep track of which events have ever been used, for event optimization
6343			jQuery.event.global[ type ] = true;
6344		}
6345
6346	},
6347
6348	// Detach an event or set of events from an element
6349	remove: function( elem, types, handler, selector, mappedTypes ) {
6350
6351		var j, origCount, tmp,
6352			events, t, handleObj,
6353			special, handlers, type, namespaces, origType,
6354			elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
6355
6356		if ( !elemData || !( events = elemData.events ) ) {
6357			return;
6358		}
6359
vendor: 4,197 bytes, lines 6360-6498
6360		// Once for each type.namespace in types; type may be omitted
6361		types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
6362		t = types.length;
6363		while ( t-- ) {
6364			tmp = rtypenamespace.exec( types[ t ] ) || [];
6365			type = origType = tmp[ 1 ];
6366			namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
6367
6368			// Unbind all events (on this namespace, if provided) for the element
6369			if ( !type ) {
6370				for ( type in events ) {
6371					jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
6372				}
6373				continue;
6374			}
6375
6376			special = jQuery.event.special[ type ] || {};
6377			type = ( selector ? special.delegateType : special.bindType ) || type;
6378			handlers = events[ type ] || [];
6379			tmp = tmp[ 2 ] &&
6380				new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
6381
6382			// Remove matching events
6383			origCount = j = handlers.length;
6384			while ( j-- ) {
6385				handleObj = handlers[ j ];
6386
6387				if ( ( mappedTypes || origType === handleObj.origType ) &&
6388					( !handler || handler.guid === handleObj.guid ) &&
6389					( !tmp || tmp.test( handleObj.namespace ) ) &&
6390					( !selector || selector === handleObj.selector ||
6391						selector === "**" && handleObj.selector ) ) {
6392					handlers.splice( j, 1 );
6393
6394					if ( handleObj.selector ) {
6395						handlers.delegateCount--;
6396					}
6397					if ( special.remove ) {
6398						special.remove.call( elem, handleObj );
6399					}
6400				}
6401			}
6402
6403			// Remove generic event handler if we removed something and no more handlers exist
6404			// (avoids potential for endless recursion during removal of special event handlers)
6405			if ( origCount && !handlers.length ) {
6406				if ( !special.teardown ||
6407					special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
6408
6409					jQuery.removeEvent( elem, type, elemData.handle );
6410				}
6411
6412				delete events[ type ];
6413			}
6414		}
6415
6416		// Remove data and the expando if it's no longer used
6417		if ( jQuery.isEmptyObject( events ) ) {
6418			dataPriv.remove( elem, "handle events" );
6419		}
6420	},
6421
6422	dispatch: function( nativeEvent ) {
6423
6424		var i, j, ret, matched, handleObj, handlerQueue,
6425			args = new Array( arguments.length ),
6426
6427			// Make a writable jQuery.Event from the native event object
6428			event = jQuery.event.fix( nativeEvent ),
6429
6430			handlers = (
6431				dataPriv.get( this, "events" ) || Object.create( null )
6432			)[ event.type ] || [],
6433			special = jQuery.event.special[ event.type ] || {};
6434
6435		// Use the fix-ed jQuery.Event rather than the (read-only) native event
6436		args[ 0 ] = event;
6437
6438		for ( i = 1; i < arguments.length; i++ ) {
6439			args[ i ] = arguments[ i ];
6440		}
6441
6442		event.delegateTarget = this;
6443
6444		// Call the preDispatch hook for the mapped type, and let it bail if desired
6445		if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
6446			return;
6447		}
6448
6449		// Determine handlers
6450		handlerQueue = jQuery.event.handlers.call( this, event, handlers );
6451
6452		// Run delegates first; they may want to stop propagation beneath us
6453		i = 0;
6454		while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
6455			event.currentTarget = matched.elem;
6456
6457			j = 0;
6458			while ( ( handleObj = matched.handlers[ j++ ] ) &&
6459				!event.isImmediatePropagationStopped() ) {
6460
6461				// If the event is namespaced, then each handler is only invoked if it is
6462				// specially universal or its namespaces are a superset of the event's.
6463				if ( !event.rnamespace || handleObj.namespace === false ||
6464					event.rnamespace.test( handleObj.namespace ) ) {
6465
6466					event.handleObj = handleObj;
6467					event.data = handleObj.data;
6468
6469					ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
6470						handleObj.handler ).apply( matched.elem, args );
6471
6472					if ( ret !== undefined ) {
6473						if ( ( event.result = ret ) === false ) {
6474							event.preventDefault();
6475							event.stopPropagation();
6476						}
6477					}
6478				}
6479			}
6480		}
6481
6482		// Call the postDispatch hook for the mapped type
6483		if ( special.postDispatch ) {
6484			special.postDispatch.call( this, event );
6485		}
6486
6487		return event.result;
6488	},
6489
6490	handlers: function( event, handlers ) {
6491		var i, handleObj, sel, matchedHandlers, matchedSelectors,
6492			handlerQueue = [],
6493			delegateCount = handlers.delegateCount,
6494			cur = event.target;
6495
6496		// Find delegate handlers
6497		if ( delegateCount &&
6498
vendor: 19,034 bytes, lines 6499-7145
6499			// Support: IE <=9
6500			// Black-hole SVG <use> instance trees (trac-13180)
6501			cur.nodeType &&
6502
6503			// Support: Firefox <=42
6504			// Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
6505			// https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
6506			// Support: IE 11 only
6507			// ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
6508			!( event.type === "click" && event.button >= 1 ) ) {
6509
6510			for ( ; cur !== this; cur = cur.parentNode || this ) {
6511
6512				// Don't check non-elements (trac-13208)
6513				// Don't process clicks on disabled elements (trac-6911, trac-8165, trac-11382, trac-11764)
6514				if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
6515					matchedHandlers = [];
6516					matchedSelectors = {};
6517					for ( i = 0; i < delegateCount; i++ ) {
6518						handleObj = handlers[ i ];
6519
6520						// Don't conflict with Object.prototype properties (trac-13203)
6521						sel = handleObj.selector + " ";
6522
6523						if ( matchedSelectors[ sel ] === undefined ) {
6524							matchedSelectors[ sel ] = handleObj.needsContext ?
6525								jQuery( sel, this ).index( cur ) > -1 :
6526								jQuery.find( sel, this, null, [ cur ] ).length;
6527						}
6528						if ( matchedSelectors[ sel ] ) {
6529							matchedHandlers.push( handleObj );
6530						}
6531					}
6532					if ( matchedHandlers.length ) {
6533						handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
6534					}
6535				}
6536			}
6537		}
6538
6539		// Add the remaining (directly-bound) handlers
6540		cur = this;
6541		if ( delegateCount < handlers.length ) {
6542			handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
6543		}
6544
6545		return handlerQueue;
6546	},
6547
6548	addProp: function( name, hook ) {
6549		Object.defineProperty( jQuery.Event.prototype, name, {
6550			enumerable: true,
6551			configurable: true,
6552
6553			get: isFunction( hook ) ?
6554				function() {
6555					if ( this.originalEvent ) {
6556						return hook( this.originalEvent );
6557					}
6558				} :
6559				function() {
6560					if ( this.originalEvent ) {
6561						return this.originalEvent[ name ];
6562					}
6563				},
6564
6565			set: function( value ) {
6566				Object.defineProperty( this, name, {
6567					enumerable: true,
6568					configurable: true,
6569					writable: true,
6570					value: value
6571				} );
6572			}
6573		} );
6574	},
6575
6576	fix: function( originalEvent ) {
6577		return originalEvent[ jQuery.expando ] ?
6578			originalEvent :
6579			new jQuery.Event( originalEvent );
6580	},
6581
6582	special: {
6583		load: {
6584
6585			// Prevent triggered image.load events from bubbling to window.load
6586			noBubble: true
6587		},
6588		click: {
6589
6590			// Utilize native event to ensure correct state for checkable inputs
6591			setup: function( data ) {
6592
6593				// For mutual compressibility with _default, replace `this` access with a local var.
6594				// `|| data` is dead code meant only to preserve the variable through minification.
6595				var el = this || data;
6596
6597				// Claim the first handler
6598				if ( rcheckableType.test( el.type ) &&
6599					el.click && nodeName( el, "input" ) ) {
6600
6601					// dataPriv.set( el, "click", ... )
6602					leverageNative( el, "click", true );
6603				}
6604
6605				// Return false to allow normal processing in the caller
6606				return false;
6607			},
6608			trigger: function( data ) {
6609
6610				// For mutual compressibility with _default, replace `this` access with a local var.
6611				// `|| data` is dead code meant only to preserve the variable through minification.
6612				var el = this || data;
6613
6614				// Force setup before triggering a click
6615				if ( rcheckableType.test( el.type ) &&
6616					el.click && nodeName( el, "input" ) ) {
6617
6618					leverageNative( el, "click" );
6619				}
6620
6621				// Return non-false to allow normal event-path propagation
6622				return true;
6623			},
6624
6625			// For cross-browser consistency, suppress native .click() on links
6626			// Also prevent it if we're currently inside a leveraged native-event stack
6627			_default: function( event ) {
6628				var target = event.target;
6629				return rcheckableType.test( target.type ) &&
6630					target.click && nodeName( target, "input" ) &&
6631					dataPriv.get( target, "click" ) ||
6632					nodeName( target, "a" );
6633			}
6634		},
6635
6636		beforeunload: {
6637			postDispatch: function( event ) {
6638
6639				// Support: Firefox 20+
6640				// Firefox doesn't alert if the returnValue field is not set.
6641				if ( event.result !== undefined && event.originalEvent ) {
6642					event.originalEvent.returnValue = event.result;
6643				}
6644			}
6645		}
6646	}
6647};
6648
6649// Ensure the presence of an event listener that handles manually-triggered
6650// synthetic events by interrupting progress until reinvoked in response to
6651// *native* events that it fires directly, ensuring that state changes have
6652// already occurred before other listeners are invoked.
6653function leverageNative( el, type, isSetup ) {
6654
6655	// Missing `isSetup` indicates a trigger call, which must force setup through jQuery.event.add
6656	if ( !isSetup ) {
6657		if ( dataPriv.get( el, type ) === undefined ) {
6658			jQuery.event.add( el, type, returnTrue );
6659		}
6660		return;
6661	}
6662
6663	// Register the controller as a special universal handler for all event namespaces
6664	dataPriv.set( el, type, false );
6665	jQuery.event.add( el, type, {
6666		namespace: false,
6667		handler: function( event ) {
6668			var result,
6669				saved = dataPriv.get( this, type );
6670
6671			if ( ( event.isTrigger & 1 ) && this[ type ] ) {
6672
6673				// Interrupt processing of the outer synthetic .trigger()ed event
6674				if ( !saved ) {
6675
6676					// Store arguments for use when handling the inner native event
6677					// There will always be at least one argument (an event object), so this array
6678					// will not be confused with a leftover capture object.
6679					saved = slice.call( arguments );
6680					dataPriv.set( this, type, saved );
6681
6682					// Trigger the native event and capture its result
6683					this[ type ]();
6684					result = dataPriv.get( this, type );
6685					dataPriv.set( this, type, false );
6686
6687					if ( saved !== result ) {
6688
6689						// Cancel the outer synthetic event
6690						event.stopImmediatePropagation();
6691						event.preventDefault();
6692
6693						return result;
6694					}
6695
6696				// If this is an inner synthetic event for an event with a bubbling surrogate
6697				// (focus or blur), assume that the surrogate already propagated from triggering
6698				// the native event and prevent that from happening again here.
6699				// This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
6700				// bubbling surrogate propagates *after* the non-bubbling base), but that seems
6701				// less bad than duplication.
6702				} else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
6703					event.stopPropagation();
6704				}
6705
6706			// If this is a native event triggered above, everything is now in order
6707			// Fire an inner synthetic event with the original arguments
6708			} else if ( saved ) {
6709
6710				// ...and capture the result
6711				dataPriv.set( this, type, jQuery.event.trigger(
6712					saved[ 0 ],
6713					saved.slice( 1 ),
6714					this
6715				) );
6716
6717				// Abort handling of the native event by all jQuery handlers while allowing
6718				// native handlers on the same element to run. On target, this is achieved
6719				// by stopping immediate propagation just on the jQuery event. However,
6720				// the native event is re-wrapped by a jQuery one on each level of the
6721				// propagation so the only way to stop it for jQuery is to stop it for
6722				// everyone via native `stopPropagation()`. This is not a problem for
6723				// focus/blur which don't bubble, but it does also stop click on checkboxes
6724				// and radios. We accept this limitation.
6725				event.stopPropagation();
6726				event.isImmediatePropagationStopped = returnTrue;
6727			}
6728		}
6729	} );
6730}
6731
6732jQuery.removeEvent = function( elem, type, handle ) {
6733
6734	// This "if" is needed for plain objects
6735	if ( elem.removeEventListener ) {
6736		elem.removeEventListener( type, handle );
6737	}
6738};
6739
6740jQuery.Event = function( src, props ) {
6741
6742	// Allow instantiation without the 'new' keyword
6743	if ( !( this instanceof jQuery.Event ) ) {
6744		return new jQuery.Event( src, props );
6745	}
6746
6747	// Event object
6748	if ( src && src.type ) {
6749		this.originalEvent = src;
6750		this.type = src.type;
6751
6752		// Events bubbling up the document may have been marked as prevented
6753		// by a handler lower down the tree; reflect the correct value.
6754		this.isDefaultPrevented = src.defaultPrevented ||
6755				src.defaultPrevented === undefined &&
6756
6757				// Support: Android <=2.3 only
6758				src.returnValue === false ?
6759			returnTrue :
6760			returnFalse;
6761
6762		// Create target properties
6763		// Support: Safari <=6 - 7 only
6764		// Target should not be a text node (trac-504, trac-13143)
6765		this.target = ( src.target && src.target.nodeType === 3 ) ?
6766			src.target.parentNode :
6767			src.target;
6768
6769		this.currentTarget = src.currentTarget;
6770		this.relatedTarget = src.relatedTarget;
6771
6772	// Event type
6773	} else {
6774		this.type = src;
6775	}
6776
6777	// Put explicitly provided properties onto the event object
6778	if ( props ) {
6779		jQuery.extend( this, props );
6780	}
6781
6782	// Create a timestamp if incoming event doesn't have one
6783	this.timeStamp = src && src.timeStamp || Date.now();
6784
6785	// Mark it as fixed
6786	this[ jQuery.expando ] = true;
6787};
6788
6789// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
6790// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
6791jQuery.Event.prototype = {
6792	constructor: jQuery.Event,
6793	isDefaultPrevented: returnFalse,
6794	isPropagationStopped: returnFalse,
6795	isImmediatePropagationStopped: returnFalse,
6796	isSimulated: false,
6797
6798	preventDefault: function() {
6799		var e = this.originalEvent;
6800
6801		this.isDefaultPrevented = returnTrue;
6802
6803		if ( e && !this.isSimulated ) {
6804			e.preventDefault();
6805		}
6806	},
6807	stopPropagation: function() {
6808		var e = this.originalEvent;
6809
6810		this.isPropagationStopped = returnTrue;
6811
6812		if ( e && !this.isSimulated ) {
6813			e.stopPropagation();
6814		}
6815	},
6816	stopImmediatePropagation: function() {
6817		var e = this.originalEvent;
6818
6819		this.isImmediatePropagationStopped = returnTrue;
6820
6821		if ( e && !this.isSimulated ) {
6822			e.stopImmediatePropagation();
6823		}
6824
6825		this.stopPropagation();
6826	}
6827};
6828
6829// Includes all common event props including KeyEvent and MouseEvent specific props
6830jQuery.each( {
6831	altKey: true,
6832	bubbles: true,
6833	cancelable: true,
6834	changedTouches: true,
6835	ctrlKey: true,
6836	detail: true,
6837	eventPhase: true,
6838	metaKey: true,
6839	pageX: true,
6840	pageY: true,
6841	shiftKey: true,
6842	view: true,
6843	"char": true,
6844	code: true,
6845	charCode: true,
6846	key: true,
6847	keyCode: true,
6848	button: true,
6849	buttons: true,
6850	clientX: true,
6851	clientY: true,
6852	offsetX: true,
6853	offsetY: true,
6854	pointerId: true,
6855	pointerType: true,
6856	screenX: true,
6857	screenY: true,
6858	targetTouches: true,
6859	toElement: true,
6860	touches: true,
6861	which: true
6862}, jQuery.event.addProp );
6863
6864jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
6865
6866	function focusMappedHandler( nativeEvent ) {
6867		if ( document.documentMode ) {
6868
6869			// Support: IE 11+
6870			// Attach a single focusin/focusout handler on the document while someone wants
6871			// focus/blur. This is because the former are synchronous in IE while the latter
6872			// are async. In other browsers, all those handlers are invoked synchronously.
6873
6874			// `handle` from private data would already wrap the event, but we need
6875			// to change the `type` here.
6876			var handle = dataPriv.get( this, "handle" ),
6877				event = jQuery.event.fix( nativeEvent );
6878			event.type = nativeEvent.type === "focusin" ? "focus" : "blur";
6879			event.isSimulated = true;
6880
6881			// First, handle focusin/focusout
6882			handle( nativeEvent );
6883
6884			// ...then, handle focus/blur
6885			//
6886			// focus/blur don't bubble while focusin/focusout do; simulate the former by only
6887			// invoking the handler at the lower level.
6888			if ( event.target === event.currentTarget ) {
6889
6890				// The setup part calls `leverageNative`, which, in turn, calls
6891				// `jQuery.event.add`, so event handle will already have been set
6892				// by this point.
6893				handle( event );
6894			}
6895		} else {
6896
6897			// For non-IE browsers, attach a single capturing handler on the document
6898			// while someone wants focusin/focusout.
6899			jQuery.event.simulate( delegateType, nativeEvent.target,
6900				jQuery.event.fix( nativeEvent ) );
6901		}
6902	}
6903
6904	jQuery.event.special[ type ] = {
6905
6906		// Utilize native event if possible so blur/focus sequence is correct
6907		setup: function() {
6908
6909			var attaches;
6910
6911			// Claim the first handler
6912			// dataPriv.set( this, "focus", ... )
6913			// dataPriv.set( this, "blur", ... )
6914			leverageNative( this, type, true );
6915
6916			if ( document.documentMode ) {
6917
6918				// Support: IE 9 - 11+
6919				// We use the same native handler for focusin & focus (and focusout & blur)
6920				// so we need to coordinate setup & teardown parts between those events.
6921				// Use `delegateType` as the key as `type` is already used by `leverageNative`.
6922				attaches = dataPriv.get( this, delegateType );
6923				if ( !attaches ) {
6924					this.addEventListener( delegateType, focusMappedHandler );
6925				}
6926				dataPriv.set( this, delegateType, ( attaches || 0 ) + 1 );
6927			} else {
6928
6929				// Return false to allow normal processing in the caller
6930				return false;
6931			}
6932		},
6933		trigger: function() {
6934
6935			// Force setup before trigger
6936			leverageNative( this, type );
6937
6938			// Return non-false to allow normal event-path propagation
6939			return true;
6940		},
6941
6942		teardown: function() {
6943			var attaches;
6944
6945			if ( document.documentMode ) {
6946				attaches = dataPriv.get( this, delegateType ) - 1;
6947				if ( !attaches ) {
6948					this.removeEventListener( delegateType, focusMappedHandler );
6949					dataPriv.remove( this, delegateType );
6950				} else {
6951					dataPriv.set( this, delegateType, attaches );
6952				}
6953			} else {
6954
6955				// Return false to indicate standard teardown should be applied
6956				return false;
6957			}
6958		},
6959
6960		// Suppress native focus or blur if we're currently inside
6961		// a leveraged native-event stack
6962		_default: function( event ) {
6963			return dataPriv.get( event.target, type );
6964		},
6965
6966		delegateType: delegateType
6967	};
6968
6969	// Support: Firefox <=44
6970	// Firefox doesn't have focus(in | out) events
6971	// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
6972	//
6973	// Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
6974	// focus(in | out) events fire after focus & blur events,
6975	// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
6976	// Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
6977	//
6978	// Support: IE 9 - 11+
6979	// To preserve relative focusin/focus & focusout/blur event order guaranteed on the 3.x branch,
6980	// attach a single handler for both events in IE.
6981	jQuery.event.special[ delegateType ] = {
6982		setup: function() {
6983
6984			// Handle: regular nodes (via `this.ownerDocument`), window
6985			// (via `this.document`) & document (via `this`).
6986			var doc = this.ownerDocument || this.document || this,
6987				dataHolder = document.documentMode ? this : doc,
6988				attaches = dataPriv.get( dataHolder, delegateType );
6989
6990			// Support: IE 9 - 11+
6991			// We use the same native handler for focusin & focus (and focusout & blur)
6992			// so we need to coordinate setup & teardown parts between those events.
6993			// Use `delegateType` as the key as `type` is already used by `leverageNative`.
6994			if ( !attaches ) {
6995				if ( document.documentMode ) {
6996					this.addEventListener( delegateType, focusMappedHandler );
6997				} else {
6998					doc.addEventListener( type, focusMappedHandler, true );
6999				}
7000			}
7001			dataPriv.set( dataHolder, delegateType, ( attaches || 0 ) + 1 );
7002		},
7003		teardown: function() {
7004			var doc = this.ownerDocument || this.document || this,
7005				dataHolder = document.documentMode ? this : doc,
7006				attaches = dataPriv.get( dataHolder, delegateType ) - 1;
7007
7008			if ( !attaches ) {
7009				if ( document.documentMode ) {
7010					this.removeEventListener( delegateType, focusMappedHandler );
7011				} else {
7012					doc.removeEventListener( type, focusMappedHandler, true );
7013				}
7014				dataPriv.remove( dataHolder, delegateType );
7015			} else {
7016				dataPriv.set( dataHolder, delegateType, attaches );
7017			}
7018		}
7019	};
7020} );
7021
7022// Create mouseenter/leave events using mouseover/out and event-time checks
7023// so that event delegation works in jQuery.
7024// Do the same for pointerenter/pointerleave and pointerover/pointerout
7025//
7026// Support: Safari 7 only
7027// Safari sends mouseenter too often; see:
7028// https://bugs.chromium.org/p/chromium/issues/detail?id=470258
7029// for the description of the bug (it existed in older Chrome versions as well).
7030jQuery.each( {
7031	mouseenter: "mouseover",
7032	mouseleave: "mouseout",
7033	pointerenter: "pointerover",
7034	pointerleave: "pointerout"
7035}, function( orig, fix ) {
7036	jQuery.event.special[ orig ] = {
7037		delegateType: fix,
7038		bindType: fix,
7039
7040		handle: function( event ) {
7041			var ret,
7042				target = this,
7043				related = event.relatedTarget,
7044				handleObj = event.handleObj;
7045
7046			// For mouseenter/leave call the handler if related is outside the target.
7047			// NB: No relatedTarget if the mouse left/entered the browser window
7048			if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
7049				event.type = handleObj.origType;
7050				ret = handleObj.handler.apply( this, arguments );
7051				event.type = fix;
7052			}
7053			return ret;
7054		}
7055	};
7056} );
7057
7058jQuery.fn.extend( {
7059
7060	on: function( types, selector, data, fn ) {
7061		return on( this, types, selector, data, fn );
7062	},
7063	one: function( types, selector, data, fn ) {
7064		return on( this, types, selector, data, fn, 1 );
7065	},
7066	off: function( types, selector, fn ) {
7067		var handleObj, type;
7068		if ( types && types.preventDefault && types.handleObj ) {
7069
7070			// ( event )  dispatched jQuery.Event
7071			handleObj = types.handleObj;
7072			jQuery( types.delegateTarget ).off(
7073				handleObj.namespace ?
7074					handleObj.origType + "." + handleObj.namespace :
7075					handleObj.origType,
7076				handleObj.selector,
7077				handleObj.handler
7078			);
7079			return this;
7080		}
7081		if ( typeof types === "object" ) {
7082
7083			// ( types-object [, selector] )
7084			for ( type in types ) {
7085				this.off( type, selector, types[ type ] );
7086			}
7087			return this;
7088		}
7089		if ( selector === false || typeof selector === "function" ) {
7090
7091			// ( types [, fn] )
7092			fn = selector;
7093			selector = undefined;
7094		}
7095		if ( fn === false ) {
7096			fn = returnFalse;
7097		}
7098		return this.each( function() {
7099			jQuery.event.remove( this, types, fn, selector );
7100		} );
7101	}
7102} );
7103
7104
7105var
7106
7107	// Support: IE <=10 - 11, Edge 12 - 13 only
7108	// In IE/Edge using regex groups here causes severe slowdowns.
7109	// See https://connect.microsoft.com/IE/feedback/details/1736512/
7110	rnoInnerhtml = /<script|<style|<link/i,
7111
7112	// checked="checked" or checked
7113	rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
7114
7115	rcleanScript = /^\s*<!\[CDATA\[|\]\]>\s*$/g;
7116
7117// Prefer a tbody over its parent table for containing new rows
7118function manipulationTarget( elem, content ) {
7119	if ( nodeName( elem, "table" ) &&
7120		nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
7121
7122		return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
7123	}
7124
7125	return elem;
7126}
7127
7128// Replace/restore the type attribute of script elements for safe DOM manipulation
7129function disableScript( elem ) {
7130	elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
7131	return elem;
7132}
7133function restoreScript( elem ) {
7134	if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
7135		elem.type = elem.type.slice( 5 );
7136	} else {
7137		elem.removeAttribute( "type" );
7138	}
7139
7140	return elem;
7141}
7142
7143function cloneCopyEvent( src, dest ) {
7144	var i, l, type, pdataOld, udataOld, udataCur, events;
7145
vendor: 6,382 bytes, lines 7146-7375
7146	if ( dest.nodeType !== 1 ) {
7147		return;
7148	}
7149
7150	// 1. Copy private data: events, handlers, etc.
7151	if ( dataPriv.hasData( src ) ) {
7152		pdataOld = dataPriv.get( src );
7153		events = pdataOld.events;
7154
7155		if ( events ) {
7156			dataPriv.remove( dest, "handle events" );
7157
7158			for ( type in events ) {
7159				for ( i = 0, l = events[ type ].length; i < l; i++ ) {
7160					jQuery.event.add( dest, type, events[ type ][ i ] );
7161				}
7162			}
7163		}
7164	}
7165
7166	// 2. Copy user data
7167	if ( dataUser.hasData( src ) ) {
7168		udataOld = dataUser.access( src );
7169		udataCur = jQuery.extend( {}, udataOld );
7170
7171		dataUser.set( dest, udataCur );
7172	}
7173}
7174
7175// Fix IE bugs, see support tests
7176function fixInput( src, dest ) {
7177	var nodeName = dest.nodeName.toLowerCase();
7178
7179	// Fails to persist the checked state of a cloned checkbox or radio button.
7180	if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
7181		dest.checked = src.checked;
7182
7183	// Fails to return the selected option to the default selected state when cloning options
7184	} else if ( nodeName === "input" || nodeName === "textarea" ) {
7185		dest.defaultValue = src.defaultValue;
7186	}
7187}
7188
7189function domManip( collection, args, callback, ignored ) {
7190
7191	// Flatten any nested arrays
7192	args = flat( args );
7193
7194	var fragment, first, scripts, hasScripts, node, doc,
7195		i = 0,
7196		l = collection.length,
7197		iNoClone = l - 1,
7198		value = args[ 0 ],
7199		valueIsFunction = isFunction( value );
7200
7201	// We can't cloneNode fragments that contain checked, in WebKit
7202	if ( valueIsFunction ||
7203			( l > 1 && typeof value === "string" &&
7204				!support.checkClone && rchecked.test( value ) ) ) {
7205		return collection.each( function( index ) {
7206			var self = collection.eq( index );
7207			if ( valueIsFunction ) {
7208				args[ 0 ] = value.call( this, index, self.html() );
7209			}
7210			domManip( self, args, callback, ignored );
7211		} );
7212	}
7213
7214	if ( l ) {
7215		fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
7216		first = fragment.firstChild;
7217
7218		if ( fragment.childNodes.length === 1 ) {
7219			fragment = first;
7220		}
7221
7222		// Require either new content or an interest in ignored elements to invoke the callback
7223		if ( first || ignored ) {
7224			scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
7225			hasScripts = scripts.length;
7226
7227			// Use the original fragment for the last item
7228			// instead of the first because it can end up
7229			// being emptied incorrectly in certain situations (trac-8070).
7230			for ( ; i < l; i++ ) {
7231				node = fragment;
7232
7233				if ( i !== iNoClone ) {
7234					node = jQuery.clone( node, true, true );
7235
7236					// Keep references to cloned scripts for later restoration
7237					if ( hasScripts ) {
7238
7239						// Support: Android <=4.0 only, PhantomJS 1 only
7240						// push.apply(_, arraylike) throws on ancient WebKit
7241						jQuery.merge( scripts, getAll( node, "script" ) );
7242					}
7243				}
7244
7245				callback.call( collection[ i ], node, i );
7246			}
7247
7248			if ( hasScripts ) {
7249				doc = scripts[ scripts.length - 1 ].ownerDocument;
7250
7251				// Re-enable scripts
7252				jQuery.map( scripts, restoreScript );
7253
7254				// Evaluate executable scripts on first document insertion
7255				for ( i = 0; i < hasScripts; i++ ) {
7256					node = scripts[ i ];
7257					if ( rscriptType.test( node.type || "" ) &&
7258						!dataPriv.access( node, "globalEval" ) &&
7259						jQuery.contains( doc, node ) ) {
7260
7261						if ( node.src && ( node.type || "" ).toLowerCase()  !== "module" ) {
7262
7263							// Optional AJAX dependency, but won't run scripts if not present
7264							if ( jQuery._evalUrl && !node.noModule ) {
7265								jQuery._evalUrl( node.src, {
7266									nonce: node.nonce || node.getAttribute( "nonce" )
7267								}, doc );
7268							}
7269						} else {
7270
7271							// Unwrap a CDATA section containing script contents. This shouldn't be
7272							// needed as in XML documents they're already not visible when
7273							// inspecting element contents and in HTML documents they have no
7274							// meaning but we're preserving that logic for backwards compatibility.
7275							// This will be removed completely in 4.0. See gh-4904.
7276							DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
7277						}
7278					}
7279				}
7280			}
7281		}
7282	}
7283
7284	return collection;
7285}
7286
7287function remove( elem, selector, keepData ) {
7288	var node,
7289		nodes = selector ? jQuery.filter( selector, elem ) : elem,
7290		i = 0;
7291
7292	for ( ; ( node = nodes[ i ] ) != null; i++ ) {
7293		if ( !keepData && node.nodeType === 1 ) {
7294			jQuery.cleanData( getAll( node ) );
7295		}
7296
7297		if ( node.parentNode ) {
7298			if ( keepData && isAttached( node ) ) {
7299				setGlobalEval( getAll( node, "script" ) );
7300			}
7301			node.parentNode.removeChild( node );
7302		}
7303	}
7304
7305	return elem;
7306}
7307
7308jQuery.extend( {
7309	htmlPrefilter: function( html ) {
7310		return html;
7311	},
7312
7313	clone: function( elem, dataAndEvents, deepDataAndEvents ) {
7314		var i, l, srcElements, destElements,
7315			clone = elem.cloneNode( true ),
7316			inPage = isAttached( elem );
7317
7318		// Fix IE cloning issues
7319		if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
7320				!jQuery.isXMLDoc( elem ) ) {
7321
7322			// We eschew jQuery#find here for performance reasons:
7323			// https://jsperf.com/getall-vs-sizzle/2
7324			destElements = getAll( clone );
7325			srcElements = getAll( elem );
7326
7327			for ( i = 0, l = srcElements.length; i < l; i++ ) {
7328				fixInput( srcElements[ i ], destElements[ i ] );
7329			}
7330		}
7331
7332		// Copy the events from the original to the clone
7333		if ( dataAndEvents ) {
7334			if ( deepDataAndEvents ) {
7335				srcElements = srcElements || getAll( elem );
7336				destElements = destElements || getAll( clone );
7337
7338				for ( i = 0, l = srcElements.length; i < l; i++ ) {
7339					cloneCopyEvent( srcElements[ i ], destElements[ i ] );
7340				}
7341			} else {
7342				cloneCopyEvent( elem, clone );
7343			}
7344		}
7345
7346		// Preserve script evaluation history
7347		destElements = getAll( clone, "script" );
7348		if ( destElements.length > 0 ) {
7349			setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
7350		}
7351
7352		// Return the cloned set
7353		return clone;
7354	},
7355
7356	cleanData: function( elems ) {
7357		var data, elem, type,
7358			special = jQuery.event.special,
7359			i = 0;
7360
7361		for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
7362			if ( acceptData( elem ) ) {
7363				if ( ( data = elem[ dataPriv.expando ] ) ) {
7364					if ( data.events ) {
7365						for ( type in data.events ) {
7366							if ( special[ type ] ) {
7367								jQuery.event.remove( elem, type );
7368
7369							// This is a shortcut to avoid jQuery.event.remove's overhead
7370							} else {
7371								jQuery.removeEvent( elem, type, data.handle );
7372							}
7373						}
7374					}
7375
vendor: 1,119 bytes, lines 7376-7420
7376					// Support: Chrome <=35 - 45+
7377					// Assign undefined instead of using delete, see Data#remove
7378					elem[ dataPriv.expando ] = undefined;
7379				}
7380				if ( elem[ dataUser.expando ] ) {
7381
7382					// Support: Chrome <=35 - 45+
7383					// Assign undefined instead of using delete, see Data#remove
7384					elem[ dataUser.expando ] = undefined;
7385				}
7386			}
7387		}
7388	}
7389} );
7390
7391jQuery.fn.extend( {
7392	detach: function( selector ) {
7393		return remove( this, selector, true );
7394	},
7395
7396	remove: function( selector ) {
7397		return remove( this, selector );
7398	},
7399
7400	text: function( value ) {
7401		return access( this, function( value ) {
7402			return value === undefined ?
7403				jQuery.text( this ) :
7404				this.empty().each( function() {
7405					if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
7406						this.textContent = value;
7407					}
7408				} );
7409		}, null, value, arguments.length );
7410	},
7411
7412	append: function() {
7413		return domManip( this, arguments, function( elem ) {
7414			if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
7415				var target = manipulationTarget( this, elem );
7416				target.appendChild( elem );
7417			}
7418		} );
7419	},
7420
vendor: 4,514 bytes, lines 7421-7612
7421	prepend: function() {
7422		return domManip( this, arguments, function( elem ) {
7423			if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
7424				var target = manipulationTarget( this, elem );
7425				target.insertBefore( elem, target.firstChild );
7426			}
7427		} );
7428	},
7429
7430	before: function() {
7431		return domManip( this, arguments, function( elem ) {
7432			if ( this.parentNode ) {
7433				this.parentNode.insertBefore( elem, this );
7434			}
7435		} );
7436	},
7437
7438	after: function() {
7439		return domManip( this, arguments, function( elem ) {
7440			if ( this.parentNode ) {
7441				this.parentNode.insertBefore( elem, this.nextSibling );
7442			}
7443		} );
7444	},
7445
7446	empty: function() {
7447		var elem,
7448			i = 0;
7449
7450		for ( ; ( elem = this[ i ] ) != null; i++ ) {
7451			if ( elem.nodeType === 1 ) {
7452
7453				// Prevent memory leaks
7454				jQuery.cleanData( getAll( elem, false ) );
7455
7456				// Remove any remaining nodes
7457				elem.textContent = "";
7458			}
7459		}
7460
7461		return this;
7462	},
7463
7464	clone: function( dataAndEvents, deepDataAndEvents ) {
7465		dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
7466		deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
7467
7468		return this.map( function() {
7469			return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
7470		} );
7471	},
7472
7473	html: function( value ) {
7474		return access( this, function( value ) {
7475			var elem = this[ 0 ] || {},
7476				i = 0,
7477				l = this.length;
7478
7479			if ( value === undefined && elem.nodeType === 1 ) {
7480				return elem.innerHTML;
7481			}
7482
7483			// See if we can take a shortcut and just use innerHTML
7484			if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
7485				!wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
7486
7487				value = jQuery.htmlPrefilter( value );
7488
7489				try {
7490					for ( ; i < l; i++ ) {
7491						elem = this[ i ] || {};
7492
7493						// Remove element nodes and prevent memory leaks
7494						if ( elem.nodeType === 1 ) {
7495							jQuery.cleanData( getAll( elem, false ) );
7496							elem.innerHTML = value;
7497						}
7498					}
7499
7500					elem = 0;
7501
7502				// If using innerHTML throws an exception, use the fallback method
7503				} catch ( e ) {}
7504			}
7505
7506			if ( elem ) {
7507				this.empty().append( value );
7508			}
7509		}, null, value, arguments.length );
7510	},
7511
7512	replaceWith: function() {
7513		var ignored = [];
7514
7515		// Make the changes, replacing each non-ignored context element with the new content
7516		return domManip( this, arguments, function( elem ) {
7517			var parent = this.parentNode;
7518
7519			if ( jQuery.inArray( this, ignored ) < 0 ) {
7520				jQuery.cleanData( getAll( this ) );
7521				if ( parent ) {
7522					parent.replaceChild( elem, this );
7523				}
7524			}
7525
7526		// Force callback invocation
7527		}, ignored );
7528	}
7529} );
7530
7531jQuery.each( {
7532	appendTo: "append",
7533	prependTo: "prepend",
7534	insertBefore: "before",
7535	insertAfter: "after",
7536	replaceAll: "replaceWith"
7537}, function( name, original ) {
7538	jQuery.fn[ name ] = function( selector ) {
7539		var elems,
7540			ret = [],
7541			insert = jQuery( selector ),
7542			last = insert.length - 1,
7543			i = 0;
7544
7545		for ( ; i <= last; i++ ) {
7546			elems = i === last ? this : this.clone( true );
7547			jQuery( insert[ i ] )[ original ]( elems );
7548
7549			// Support: Android <=4.0 only, PhantomJS 1 only
7550			// .get() because push.apply(_, arraylike) throws on ancient WebKit
7551			push.apply( ret, elems.get() );
7552		}
7553
7554		return this.pushStack( ret );
7555	};
7556} );
7557var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
7558
7559var rcustomProp = /^--/;
7560
7561
7562var getStyles = function( elem ) {
7563
7564		// Support: IE <=11 only, Firefox <=30 (trac-15098, trac-14150)
7565		// IE throws on elements created in popups
7566		// FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
7567		var view = elem.ownerDocument.defaultView;
7568
7569		if ( !view || !view.opener ) {
7570			view = window;
7571		}
7572
7573		return view.getComputedStyle( elem );
7574	};
7575
7576var swap = function( elem, options, callback ) {
7577	var ret, name,
7578		old = {};
7579
7580	// Remember the old values, and insert the new ones
7581	for ( name in options ) {
7582		old[ name ] = elem.style[ name ];
7583		elem.style[ name ] = options[ name ];
7584	}
7585
7586	ret = callback.call( elem );
7587
7588	// Revert the old values
7589	for ( name in options ) {
7590		elem.style[ name ] = old[ name ];
7591	}
7592
7593	return ret;
7594};
7595
7596
7597var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
7598
7599
7600
7601( function() {
7602
7603	// Executing both pixelPosition & boxSizingReliable tests require only one layout
7604	// so they're executed at the same time to save the second computation.
7605	function computeStyleTests() {
7606
7607		// This is a singleton, we need to execute it only once
7608		if ( !div ) {
7609			return;
7610		}
7611
7612		container.style.cssText = "position:absolute;
vendor: 4,156 bytes, lines 7612-7731
7612left:-11111px;width:60px;" +
7613			"margin-top:1px;padding:0;border:0";
7614		div.style.cssText =
7615			"position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
7616			"margin:auto;border:1px;padding:1px;" +
7617			"width:60%;top:1%";
7618		documentElement.appendChild( container ).appendChild( div );
7619
7620		var divStyle = window.getComputedStyle( div );
7621		pixelPositionVal = divStyle.top !== "1%";
7622
7623		// Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
7624		reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
7625
7626		// Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
7627		// Some styles come back with percentage values, even though they shouldn't
7628		div.style.right = "60%";
7629		pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
7630
7631		// Support: IE 9 - 11 only
7632		// Detect misreporting of content dimensions for box-sizing:border-box elements
7633		boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
7634
7635		// Support: IE 9 only
7636		// Detect overflow:scroll screwiness (gh-3699)
7637		// Support: Chrome <=64
7638		// Don't get tricked when zoom affects offsetWidth (gh-4029)
7639		div.style.position = "absolute";
7640		scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
7641
7642		documentElement.removeChild( container );
7643
7644		// Nullify the div so it wouldn't be stored in the memory and
7645		// it will also be a sign that checks already performed
7646		div = null;
7647	}
7648
7649	function roundPixelMeasures( measure ) {
7650		return Math.round( parseFloat( measure ) );
7651	}
7652
7653	var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
7654		reliableTrDimensionsVal, reliableMarginLeftVal,
7655		container = document.createElement( "div" ),
7656		div = document.createElement( "div" );
7657
7658	// Finish early in limited (non-browser) environments
7659	if ( !div.style ) {
7660		return;
7661	}
7662
7663	// Support: IE <=9 - 11 only
7664	// Style of cloned element affects source element cloned (trac-8908)
7665	div.style.backgroundClip = "content-box";
7666	div.cloneNode( true ).style.backgroundClip = "";
7667	support.clearCloneStyle = div.style.backgroundClip === "content-box";
7668
7669	jQuery.extend( support, {
7670		boxSizingReliable: function() {
7671			computeStyleTests();
7672			return boxSizingReliableVal;
7673		},
7674		pixelBoxStyles: function() {
7675			computeStyleTests();
7676			return pixelBoxStylesVal;
7677		},
7678		pixelPosition: function() {
7679			computeStyleTests();
7680			return pixelPositionVal;
7681		},
7682		reliableMarginLeft: function() {
7683			computeStyleTests();
7684			return reliableMarginLeftVal;
7685		},
7686		scrollboxSize: function() {
7687			computeStyleTests();
7688			return scrollboxSizeVal;
7689		},
7690
7691		// Support: IE 9 - 11+, Edge 15 - 18+
7692		// IE/Edge misreport `getComputedStyle` of table rows with width/height
7693		// set in CSS while `offset*` properties report correct values.
7694		// Behavior in IE 9 is more subtle than in newer versions & it passes
7695		// some versions of this test; make sure not to make it pass there!
7696		//
7697		// Support: Firefox 70+
7698		// Only Firefox includes border widths
7699		// in computed dimensions. (gh-4529)
7700		reliableTrDimensions: function() {
7701			var table, tr, trChild, trStyle;
7702			if ( reliableTrDimensionsVal == null ) {
7703				table = document.createElement( "table" );
7704				tr = document.createElement( "tr" );
7705				trChild = document.createElement( "div" );
7706
7707				table.style.cssText = "position:absolute;left:-11111px;border-collapse:separate";
7708				tr.style.cssText = "box-sizing:content-box;border:1px solid";
7709
7710				// Support: Chrome 86+
7711				// Height set through cssText does not get applied.
7712				// Computed height then comes back as 0.
7713				tr.style.height = "1px";
7714				trChild.style.height = "9px";
7715
7716				// Support: Android 8 Chrome 86+
7717				// In our bodyBackground.html iframe,
7718				// display for all div elements is set to "inline",
7719				// which causes a problem only in Android 8 Chrome 86.
7720				// Ensuring the div is `display: block`
7721				// gets around this issue.
7722				trChild.style.display = "block";
7723
7724				documentElement
7725					.appendChild( table )
7726					.appendChild( tr )
7727					.appendChild( trChild );
7728
7729				trStyle = window.getComputedStyle( tr );
7730				reliableTrDimensionsVal = ( parseInt( trStyle.height, 10 ) +
7731					parseInt( trStyle.borderTopWidth, 10 ) +
vendor: 12,879 bytes, lines 7732-8158
7732					parseInt( trStyle.borderBottomWidth, 10 ) ) === tr.offsetHeight;
7733
7734				documentElement.removeChild( table );
7735			}
7736			return reliableTrDimensionsVal;
7737		}
7738	} );
7739} )();
7740
7741
7742function curCSS( elem, name, computed ) {
7743	var width, minWidth, maxWidth, ret,
7744		isCustomProp = rcustomProp.test( name ),
7745
7746		// Support: Firefox 51+
7747		// Retrieving style before computed somehow
7748		// fixes an issue with getting wrong values
7749		// on detached elements
7750		style = elem.style;
7751
7752	computed = computed || getStyles( elem );
7753
7754	// getPropertyValue is needed for:
7755	//   .css('filter') (IE 9 only, trac-12537)
7756	//   .css('--customProperty) (gh-3144)
7757	if ( computed ) {
7758
7759		// Support: IE <=9 - 11+
7760		// IE only supports `"float"` in `getPropertyValue`; in computed styles
7761		// it's only available as `"cssFloat"`. We no longer modify properties
7762		// sent to `.css()` apart from camelCasing, so we need to check both.
7763		// Normally, this would create difference in behavior: if
7764		// `getPropertyValue` returns an empty string, the value returned
7765		// by `.css()` would be `undefined`. This is usually the case for
7766		// disconnected elements. However, in IE even disconnected elements
7767		// with no styles return `"none"` for `getPropertyValue( "float" )`
7768		ret = computed.getPropertyValue( name ) || computed[ name ];
7769
7770		if ( isCustomProp && ret ) {
7771
7772			// Support: Firefox 105+, Chrome <=105+
7773			// Spec requires trimming whitespace for custom properties (gh-4926).
7774			// Firefox only trims leading whitespace. Chrome just collapses
7775			// both leading & trailing whitespace to a single space.
7776			//
7777			// Fall back to `undefined` if empty string returned.
7778			// This collapses a missing definition with property defined
7779			// and set to an empty string but there's no standard API
7780			// allowing us to differentiate them without a performance penalty
7781			// and returning `undefined` aligns with older jQuery.
7782			//
7783			// rtrimCSS treats U+000D CARRIAGE RETURN and U+000C FORM FEED
7784			// as whitespace while CSS does not, but this is not a problem
7785			// because CSS preprocessing replaces them with U+000A LINE FEED
7786			// (which *is* CSS whitespace)
7787			// https://www.w3.org/TR/css-syntax-3/#input-preprocessing
7788			ret = ret.replace( rtrimCSS, "$1" ) || undefined;
7789		}
7790
7791		if ( ret === "" && !isAttached( elem ) ) {
7792			ret = jQuery.style( elem, name );
7793		}
7794
7795		// A tribute to the "awesome hack by Dean Edwards"
7796		// Android Browser returns percentage for some values,
7797		// but width seems to be reliably pixels.
7798		// This is against the CSSOM draft spec:
7799		// https://drafts.csswg.org/cssom/#resolved-values
7800		if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
7801
7802			// Remember the original values
7803			width = style.width;
7804			minWidth = style.minWidth;
7805			maxWidth = style.maxWidth;
7806
7807			// Put in the new values to get a computed value out
7808			style.minWidth = style.maxWidth = style.width = ret;
7809			ret = computed.width;
7810
7811			// Revert the changed values
7812			style.width = width;
7813			style.minWidth = minWidth;
7814			style.maxWidth = maxWidth;
7815		}
7816	}
7817
7818	return ret !== undefined ?
7819
7820		// Support: IE <=9 - 11 only
7821		// IE returns zIndex value as an integer.
7822		ret + "" :
7823		ret;
7824}
7825
7826
7827function addGetHookIf( conditionFn, hookFn ) {
7828
7829	// Define the hook, we'll check on the first run if it's really needed.
7830	return {
7831		get: function() {
7832			if ( conditionFn() ) {
7833
7834				// Hook not needed (or it's not possible to use it due
7835				// to missing dependency), remove it.
7836				delete this.get;
7837				return;
7838			}
7839
7840			// Hook needed; redefine it so that the support test is not executed again.
7841			return ( this.get = hookFn ).apply( this, arguments );
7842		}
7843	};
7844}
7845
7846
7847var cssPrefixes = [ "Webkit", "Moz", "ms" ],
7848	emptyStyle = document.createElement( "div" ).style,
7849	vendorProps = {};
7850
7851// Return a vendor-prefixed property or undefined
7852function vendorPropName( name ) {
7853
7854	// Check for vendor prefixed names
7855	var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
7856		i = cssPrefixes.length;
7857
7858	while ( i-- ) {
7859		name = cssPrefixes[ i ] + capName;
7860		if ( name in emptyStyle ) {
7861			return name;
7862		}
7863	}
7864}
7865
7866// Return a potentially-mapped jQuery.cssProps or vendor prefixed property
7867function finalPropName( name ) {
7868	var final = jQuery.cssProps[ name ] || vendorProps[ name ];
7869
7870	if ( final ) {
7871		return final;
7872	}
7873	if ( name in emptyStyle ) {
7874		return name;
7875	}
7876	return vendorProps[ name ] = vendorPropName( name ) || name;
7877}
7878
7879
7880var
7881
7882	// Swappable if display is none or starts with table
7883	// except "table", "table-cell", or "table-caption"
7884	// See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
7885	rdisplayswap = /^(none|table(?!-c[ea]).+)/,
7886	cssShow = { position: "absolute", visibility: "hidden", display: "block" },
7887	cssNormalTransform = {
7888		letterSpacing: "0",
7889		fontWeight: "400"
7890	};
7891
7892function setPositiveNumber( _elem, value, subtract ) {
7893
7894	// Any relative (+/-) values have already been
7895	// normalized at this point
7896	var matches = rcssNum.exec( value );
7897	return matches ?
7898
7899		// Guard against undefined "subtract", e.g., when used as in cssHooks
7900		Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
7901		value;
7902}
7903
7904function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
7905	var i = dimension === "width" ? 1 : 0,
7906		extra = 0,
7907		delta = 0,
7908		marginDelta = 0;
7909
7910	// Adjustment may not be necessary
7911	if ( box === ( isBorderBox ? "border" : "content" ) ) {
7912		return 0;
7913	}
7914
7915	for ( ; i < 4; i += 2 ) {
7916
7917		// Both box models exclude margin
7918		// Count margin delta separately to only add it after scroll gutter adjustment.
7919		// This is needed to make negative margins work with `outerHeight( true )` (gh-3982).
7920		if ( box === "margin" ) {
7921			marginDelta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
7922		}
7923
7924		// If we get here with a content-box, we're seeking "padding" or "border" or "margin"
7925		if ( !isBorderBox ) {
7926
7927			// Add padding
7928			delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
7929
7930			// For "border" or "margin", add border
7931			if ( box !== "padding" ) {
7932				delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
7933
7934			// But still keep track of it otherwise
7935			} else {
7936				extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
7937			}
7938
7939		// If we get here with a border-box (content + padding + border), we're seeking "content" or
7940		// "padding" or "margin"
7941		} else {
7942
7943			// For "content", subtract padding
7944			if ( box === "content" ) {
7945				delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
7946			}
7947
7948			// For "content" or "padding", subtract border
7949			if ( box !== "margin" ) {
7950				delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
7951			}
7952		}
7953	}
7954
7955	// Account for positive content-box scroll gutter when requested by providing computedVal
7956	if ( !isBorderBox && computedVal >= 0 ) {
7957
7958		// offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
7959		// Assuming integer scroll gutter, subtract the rest and round down
7960		delta += Math.max( 0, Math.ceil(
7961			elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
7962			computedVal -
7963			delta -
7964			extra -
7965			0.5
7966
7967		// If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
7968		// Use an explicit zero to avoid NaN (gh-3964)
7969		) ) || 0;
7970	}
7971
7972	return delta + marginDelta;
7973}
7974
7975function getWidthOrHeight( elem, dimension, extra ) {
7976
7977	// Start with computed style
7978	var styles = getStyles( elem ),
7979
7980		// To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
7981		// Fake content-box until we know it's needed to know the true value.
7982		boxSizingNeeded = !support.boxSizingReliable() || extra,
7983		isBorderBox = boxSizingNeeded &&
7984			jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
7985		valueIsBorderBox = isBorderBox,
7986
7987		val = curCSS( elem, dimension, styles ),
7988		offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
7989
7990	// Support: Firefox <=54
7991	// Return a confounding non-pixel value or feign ignorance, as appropriate.
7992	if ( rnumnonpx.test( val ) ) {
7993		if ( !extra ) {
7994			return val;
7995		}
7996		val = "auto";
7997	}
7998
7999
8000	// Support: IE 9 - 11 only
8001	// Use offsetWidth/offsetHeight for when box sizing is unreliable.
8002	// In those cases, the computed value can be trusted to be border-box.
8003	if ( ( !support.boxSizingReliable() && isBorderBox ||
8004
8005		// Support: IE 10 - 11+, Edge 15 - 18+
8006		// IE/Edge misreport `getComputedStyle` of table rows with width/height
8007		// set in CSS while `offset*` properties report correct values.
8008		// Interestingly, in some cases IE 9 doesn't suffer from this issue.
8009		!support.reliableTrDimensions() && nodeName( elem, "tr" ) ||
8010
8011		// Fall back to offsetWidth/offsetHeight when value is "auto"
8012		// This happens for inline elements with no explicit setting (gh-3571)
8013		val === "auto" ||
8014
8015		// Support: Android <=4.1 - 4.3 only
8016		// Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
8017		!parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
8018
8019		// Make sure the element is visible & connected
8020		elem.getClientRects().length ) {
8021
8022		isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
8023
8024		// Where available, offsetWidth/offsetHeight approximate border box dimensions.
8025		// Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
8026		// retrieved value as a content box dimension.
8027		valueIsBorderBox = offsetProp in elem;
8028		if ( valueIsBorderBox ) {
8029			val = elem[ offsetProp ];
8030		}
8031	}
8032
8033	// Normalize "" and auto
8034	val = parseFloat( val ) || 0;
8035
8036	// Adjust for the element's box model
8037	return ( val +
8038		boxModelAdjustment(
8039			elem,
8040			dimension,
8041			extra || ( isBorderBox ? "border" : "content" ),
8042			valueIsBorderBox,
8043			styles,
8044
8045			// Provide the current computed size to request scroll gutter calculation (gh-3589)
8046			val
8047		)
8048	) + "px";
8049}
8050
8051jQuery.extend( {
8052
8053	// Add in style property hooks for overriding the default
8054	// behavior of getting and setting a style property
8055	cssHooks: {
8056		opacity: {
8057			get: function( elem, computed ) {
8058				if ( computed ) {
8059
8060					// We should always get a number back from opacity
8061					var ret = curCSS( elem, "opacity" );
8062					return ret === "" ? "1" : ret;
8063				}
8064			}
8065		}
8066	},
8067
8068	// Don't automatically add "px" to these possibly-unitless properties
8069	cssNumber: {
8070		animationIterationCount: true,
8071		aspectRatio: true,
8072		borderImageSlice: true,
8073		columnCount: true,
8074		flexGrow: true,
8075		flexShrink: true,
8076		fontWeight: true,
8077		gridArea: true,
8078		gridColumn: true,
8079		gridColumnEnd: true,
8080		gridColumnStart: true,
8081		gridRow: true,
8082		gridRowEnd: true,
8083		gridRowStart: true,
8084		lineHeight: true,
8085		opacity: true,
8086		order: true,
8087		orphans: true,
8088		scale: true,
8089		widows: true,
8090		zIndex: true,
8091		zoom: true,
8092
8093		// SVG-related
8094		fillOpacity: true,
8095		floodOpacity: true,
8096		stopOpacity: true,
8097		strokeMiterlimit: true,
8098		strokeOpacity: true
8099	},
8100
8101	// Add in properties whose names you wish to fix before
8102	// setting or getting the value
8103	cssProps: {},
8104
8105	// Get and set the style property on a DOM Node
8106	style: function( elem, name, value, extra ) {
8107
8108		// Don't set styles on text and comment nodes
8109		if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
8110			return;
8111		}
8112
8113		// Make sure that we're working with the right name
8114		var ret, type, hooks,
8115			origName = camelCase( name ),
8116			isCustomProp = rcustomProp.test( name ),
8117			style = elem.style;
8118
8119		// Make sure that we're working with the right name. We don't
8120		// want to query the value if it is a CSS custom property
8121		// since they are user-defined.
8122		if ( !isCustomProp ) {
8123			name = finalPropName( origName );
8124		}
8125
8126		// Gets hook for the prefixed version, then unprefixed version
8127		hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
8128
8129		// Check if we're setting a value
8130		if ( value !== undefined ) {
8131			type = typeof value;
8132
8133			// Convert "+=" or "-=" to relative numbers (trac-7345)
8134			if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
8135				value = adjustCSS( elem, name, ret );
8136
8137				// Fixes bug trac-9237
8138				type = "number";
8139			}
8140
8141			// Make sure that null and NaN values aren't set (trac-7116)
8142			if ( value == null || value !== value ) {
8143				return;
8144			}
8145
8146			// If a number was passed in, add the unit (except for certain CSS properties)
8147			// The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
8148			// "px" to a few hardcoded values.
8149			if ( type === "number" && !isCustomProp ) {
8150				value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
8151			}
8152
8153			// background-* props affect original clone's values
8154			if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
8155				style[ name ] = "inherit";
8156			}
8157
8158			// If a hook was provided, use that value, otherwise just set the specified value
vendor: 16,052 bytes, lines 8159-8763
8159			if ( !hooks || !( "set" in hooks ) ||
8160				( value = hooks.set( elem, value, extra ) ) !== undefined ) {
8161
8162				if ( isCustomProp ) {
8163					style.setProperty( name, value );
8164				} else {
8165					style[ name ] = value;
8166				}
8167			}
8168
8169		} else {
8170
8171			// If a hook was provided get the non-computed value from there
8172			if ( hooks && "get" in hooks &&
8173				( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
8174
8175				return ret;
8176			}
8177
8178			// Otherwise just get the value from the style object
8179			return style[ name ];
8180		}
8181	},
8182
8183	css: function( elem, name, extra, styles ) {
8184		var val, num, hooks,
8185			origName = camelCase( name ),
8186			isCustomProp = rcustomProp.test( name );
8187
8188		// Make sure that we're working with the right name. We don't
8189		// want to modify the value if it is a CSS custom property
8190		// since they are user-defined.
8191		if ( !isCustomProp ) {
8192			name = finalPropName( origName );
8193		}
8194
8195		// Try prefixed name followed by the unprefixed name
8196		hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
8197
8198		// If a hook was provided get the computed value from there
8199		if ( hooks && "get" in hooks ) {
8200			val = hooks.get( elem, true, extra );
8201		}
8202
8203		// Otherwise, if a way to get the computed value exists, use that
8204		if ( val === undefined ) {
8205			val = curCSS( elem, name, styles );
8206		}
8207
8208		// Convert "normal" to computed value
8209		if ( val === "normal" && name in cssNormalTransform ) {
8210			val = cssNormalTransform[ name ];
8211		}
8212
8213		// Make numeric if forced or a qualifier was provided and val looks numeric
8214		if ( extra === "" || extra ) {
8215			num = parseFloat( val );
8216			return extra === true || isFinite( num ) ? num || 0 : val;
8217		}
8218
8219		return val;
8220	}
8221} );
8222
8223jQuery.each( [ "height", "width" ], function( _i, dimension ) {
8224	jQuery.cssHooks[ dimension ] = {
8225		get: function( elem, computed, extra ) {
8226			if ( computed ) {
8227
8228				// Certain elements can have dimension info if we invisibly show them
8229				// but it must have a current display style that would benefit
8230				return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
8231
8232					// Support: Safari 8+
8233					// Table columns in Safari have non-zero offsetWidth & zero
8234					// getBoundingClientRect().width unless display is changed.
8235					// Support: IE <=11 only
8236					// Running getBoundingClientRect on a disconnected node
8237					// in IE throws an error.
8238					( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
8239					swap( elem, cssShow, function() {
8240						return getWidthOrHeight( elem, dimension, extra );
8241					} ) :
8242					getWidthOrHeight( elem, dimension, extra );
8243			}
8244		},
8245
8246		set: function( elem, value, extra ) {
8247			var matches,
8248				styles = getStyles( elem ),
8249
8250				// Only read styles.position if the test has a chance to fail
8251				// to avoid forcing a reflow.
8252				scrollboxSizeBuggy = !support.scrollboxSize() &&
8253					styles.position === "absolute",
8254
8255				// To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
8256				boxSizingNeeded = scrollboxSizeBuggy || extra,
8257				isBorderBox = boxSizingNeeded &&
8258					jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
8259				subtract = extra ?
8260					boxModelAdjustment(
8261						elem,
8262						dimension,
8263						extra,
8264						isBorderBox,
8265						styles
8266					) :
8267					0;
8268
8269			// Account for unreliable border-box dimensions by comparing offset* to computed and
8270			// faking a content-box to get border and padding (gh-3699)
8271			if ( isBorderBox && scrollboxSizeBuggy ) {
8272				subtract -= Math.ceil(
8273					elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
8274					parseFloat( styles[ dimension ] ) -
8275					boxModelAdjustment( elem, dimension, "border", false, styles ) -
8276					0.5
8277				);
8278			}
8279
8280			// Convert to pixels if value adjustment is needed
8281			if ( subtract && ( matches = rcssNum.exec( value ) ) &&
8282				( matches[ 3 ] || "px" ) !== "px" ) {
8283
8284				elem.style[ dimension ] = value;
8285				value = jQuery.css( elem, dimension );
8286			}
8287
8288			return setPositiveNumber( elem, value, subtract );
8289		}
8290	};
8291} );
8292
8293jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
8294	function( elem, computed ) {
8295		if ( computed ) {
8296			return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
8297				elem.getBoundingClientRect().left -
8298					swap( elem, { marginLeft: 0 }, function() {
8299						return elem.getBoundingClientRect().left;
8300					} )
8301			) + "px";
8302		}
8303	}
8304);
8305
8306// These hooks are used by animate to expand properties
8307jQuery.each( {
8308	margin: "",
8309	padding: "",
8310	border: "Width"
8311}, function( prefix, suffix ) {
8312	jQuery.cssHooks[ prefix + suffix ] = {
8313		expand: function( value ) {
8314			var i = 0,
8315				expanded = {},
8316
8317				// Assumes a single number if not a string
8318				parts = typeof value === "string" ? value.split( " " ) : [ value ];
8319
8320			for ( ; i < 4; i++ ) {
8321				expanded[ prefix + cssExpand[ i ] + suffix ] =
8322					parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
8323			}
8324
8325			return expanded;
8326		}
8327	};
8328
8329	if ( prefix !== "margin" ) {
8330		jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
8331	}
8332} );
8333
8334jQuery.fn.extend( {
8335	css: function( name, value ) {
8336		return access( this, function( elem, name, value ) {
8337			var styles, len,
8338				map = {},
8339				i = 0;
8340
8341			if ( Array.isArray( name ) ) {
8342				styles = getStyles( elem );
8343				len = name.length;
8344
8345				for ( ; i < len; i++ ) {
8346					map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
8347				}
8348
8349				return map;
8350			}
8351
8352			return value !== undefined ?
8353				jQuery.style( elem, name, value ) :
8354				jQuery.css( elem, name );
8355		}, name, value, arguments.length > 1 );
8356	}
8357} );
8358
8359
8360function Tween( elem, options, prop, end, easing ) {
8361	return new Tween.prototype.init( elem, options, prop, end, easing );
8362}
8363jQuery.Tween = Tween;
8364
8365Tween.prototype = {
8366	constructor: Tween,
8367	init: function( elem, options, prop, end, easing, unit ) {
8368		this.elem = elem;
8369		this.prop = prop;
8370		this.easing = easing || jQuery.easing._default;
8371		this.options = options;
8372		this.start = this.now = this.cur();
8373		this.end = end;
8374		this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
8375	},
8376	cur: function() {
8377		var hooks = Tween.propHooks[ this.prop ];
8378
8379		return hooks && hooks.get ?
8380			hooks.get( this ) :
8381			Tween.propHooks._default.get( this );
8382	},
8383	run: function( percent ) {
8384		var eased,
8385			hooks = Tween.propHooks[ this.prop ];
8386
8387		if ( this.options.duration ) {
8388			this.pos = eased = jQuery.easing[ this.easing ](
8389				percent, this.options.duration * percent, 0, 1, this.options.duration
8390			);
8391		} else {
8392			this.pos = eased = percent;
8393		}
8394		this.now = ( this.end - this.start ) * eased + this.start;
8395
8396		if ( this.options.step ) {
8397			this.options.step.call( this.elem, this.now, this );
8398		}
8399
8400		if ( hooks && hooks.set ) {
8401			hooks.set( this );
8402		} else {
8403			Tween.propHooks._default.set( this );
8404		}
8405		return this;
8406	}
8407};
8408
8409Tween.prototype.init.prototype = Tween.prototype;
8410
8411Tween.propHooks = {
8412	_default: {
8413		get: function( tween ) {
8414			var result;
8415
8416			// Use a property on the element directly when it is not a DOM element,
8417			// or when there is no matching style property that exists.
8418			if ( tween.elem.nodeType !== 1 ||
8419				tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
8420				return tween.elem[ tween.prop ];
8421			}
8422
8423			// Passing an empty string as a 3rd parameter to .css will automatically
8424			// attempt a parseFloat and fallback to a string if the parse fails.
8425			// Simple values such as "10px" are parsed to Float;
8426			// complex values such as "rotate(1rad)" are returned as-is.
8427			result = jQuery.css( tween.elem, tween.prop, "" );
8428
8429			// Empty strings, null, undefined and "auto" are converted to 0.
8430			return !result || result === "auto" ? 0 : result;
8431		},
8432		set: function( tween ) {
8433
8434			// Use step hook for back compat.
8435			// Use cssHook if its there.
8436			// Use .style if available and use plain properties where available.
8437			if ( jQuery.fx.step[ tween.prop ] ) {
8438				jQuery.fx.step[ tween.prop ]( tween );
8439			} else if ( tween.elem.nodeType === 1 && (
8440				jQuery.cssHooks[ tween.prop ] ||
8441					tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
8442				jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
8443			} else {
8444				tween.elem[ tween.prop ] = tween.now;
8445			}
8446		}
8447	}
8448};
8449
8450// Support: IE <=9 only
8451// Panic based approach to setting things on disconnected nodes
8452Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
8453	set: function( tween ) {
8454		if ( tween.elem.nodeType && tween.elem.parentNode ) {
8455			tween.elem[ tween.prop ] = tween.now;
8456		}
8457	}
8458};
8459
8460jQuery.easing = {
8461	linear: function( p ) {
8462		return p;
8463	},
8464	swing: function( p ) {
8465		return 0.5 - Math.cos( p * Math.PI ) / 2;
8466	},
8467	_default: "swing"
8468};
8469
8470jQuery.fx = Tween.prototype.init;
8471
8472// Back compat <1.8 extension point
8473jQuery.fx.step = {};
8474
8475
8476
8477
8478var
8479	fxNow, inProgress,
8480	rfxtypes = /^(?:toggle|show|hide)$/,
8481	rrun = /queueHooks$/;
8482
8483function schedule() {
8484	if ( inProgress ) {
8485		if ( document.hidden === false && window.requestAnimationFrame ) {
8486			window.requestAnimationFrame( schedule );
8487		} else {
8488			window.setTimeout( schedule, jQuery.fx.interval );
8489		}
8490
8491		jQuery.fx.tick();
8492	}
8493}
8494
8495// Animations created synchronously will run synchronously
8496function createFxNow() {
8497	window.setTimeout( function() {
8498		fxNow = undefined;
8499	} );
8500	return ( fxNow = Date.now() );
8501}
8502
8503// Generate parameters to create a standard animation
8504function genFx( type, includeWidth ) {
8505	var which,
8506		i = 0,
8507		attrs = { height: type };
8508
8509	// If we include width, step value is 1 to do all cssExpand values,
8510	// otherwise step value is 2 to skip over Left and Right
8511	includeWidth = includeWidth ? 1 : 0;
8512	for ( ; i < 4; i += 2 - includeWidth ) {
8513		which = cssExpand[ i ];
8514		attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
8515	}
8516
8517	if ( includeWidth ) {
8518		attrs.opacity = attrs.width = type;
8519	}
8520
8521	return attrs;
8522}
8523
8524function createTween( value, prop, animation ) {
8525	var tween,
8526		collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
8527		index = 0,
8528		length = collection.length;
8529	for ( ; index < length; index++ ) {
8530		if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
8531
8532			// We're done with this property
8533			return tween;
8534		}
8535	}
8536}
8537
8538function defaultPrefilter( elem, props, opts ) {
8539	var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
8540		isBox = "width" in props || "height" in props,
8541		anim = this,
8542		orig = {},
8543		style = elem.style,
8544		hidden = elem.nodeType && isHiddenWithinTree( elem ),
8545		dataShow = dataPriv.get( elem, "fxshow" );
8546
8547	// Queue-skipping animations hijack the fx hooks
8548	if ( !opts.queue ) {
8549		hooks = jQuery._queueHooks( elem, "fx" );
8550		if ( hooks.unqueued == null ) {
8551			hooks.unqueued = 0;
8552			oldfire = hooks.empty.fire;
8553			hooks.empty.fire = function() {
8554				if ( !hooks.unqueued ) {
8555					oldfire();
8556				}
8557			};
8558		}
8559		hooks.unqueued++;
8560
8561		anim.always( function() {
8562
8563			// Ensure the complete handler is called before this completes
8564			anim.always( function() {
8565				hooks.unqueued--;
8566				if ( !jQuery.queue( elem, "fx" ).length ) {
8567					hooks.empty.fire();
8568				}
8569			} );
8570		} );
8571	}
8572
8573	// Detect show/hide animations
8574	for ( prop in props ) {
8575		value = props[ prop ];
8576		if ( rfxtypes.test( value ) ) {
8577			delete props[ prop ];
8578			toggle = toggle || value === "toggle";
8579			if ( value === ( hidden ? "hide" : "show" ) ) {
8580
8581				// Pretend to be hidden if this is a "show" and
8582				// there is still data from a stopped show/hide
8583				if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
8584					hidden = true;
8585
8586				// Ignore all other no-op show/hide data
8587				} else {
8588					continue;
8589				}
8590			}
8591			orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
8592		}
8593	}
8594
8595	// Bail out if this is a no-op like .hide().hide()
8596	propTween = !jQuery.isEmptyObject( props );
8597	if ( !propTween && jQuery.isEmptyObject( orig ) ) {
8598		return;
8599	}
8600
8601	// Restrict "overflow" and "display" styles during box animations
8602	if ( isBox && elem.nodeType === 1 ) {
8603
8604		// Support: IE <=9 - 11, Edge 12 - 15
8605		// Record all 3 overflow attributes because IE does not infer the shorthand
8606		// from identically-valued overflowX and overflowY and Edge just mirrors
8607		// the overflowX value there.
8608		opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
8609
8610		// Identify a display type, preferring old show/hide data over the CSS cascade
8611		restoreDisplay = dataShow && dataShow.display;
8612		if ( restoreDisplay == null ) {
8613			restoreDisplay = dataPriv.get( elem, "display" );
8614		}
8615		display = jQuery.css( elem, "display" );
8616		if ( display === "none" ) {
8617			if ( restoreDisplay ) {
8618				display = restoreDisplay;
8619			} else {
8620
8621				// Get nonempty value(s) by temporarily forcing visibility
8622				showHide( [ elem ], true );
8623				restoreDisplay = elem.style.display || restoreDisplay;
8624				display = jQuery.css( elem, "display" );
8625				showHide( [ elem ] );
8626			}
8627		}
8628
8629		// Animate inline elements as inline-block
8630		if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
8631			if ( jQuery.css( elem, "float" ) === "none" ) {
8632
8633				// Restore the original display value at the end of pure show/hide animations
8634				if ( !propTween ) {
8635					anim.done( function() {
8636						style.display = restoreDisplay;
8637					} );
8638					if ( restoreDisplay == null ) {
8639						display = style.display;
8640						restoreDisplay = display === "none" ? "" : display;
8641					}
8642				}
8643				style.display = "inline-block";
8644			}
8645		}
8646	}
8647
8648	if ( opts.overflow ) {
8649		style.overflow = "hidden";
8650		anim.always( function() {
8651			style.overflow = opts.overflow[ 0 ];
8652			style.overflowX = opts.overflow[ 1 ];
8653			style.overflowY = opts.overflow[ 2 ];
8654		} );
8655	}
8656
8657	// Implement show/hide animations
8658	propTween = false;
8659	for ( prop in orig ) {
8660
8661		// General show/hide setup for this element animation
8662		if ( !propTween ) {
8663			if ( dataShow ) {
8664				if ( "hidden" in dataShow ) {
8665					hidden = dataShow.hidden;
8666				}
8667			} else {
8668				dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
8669			}
8670
8671			// Store hidden/visible for toggle so `.stop().toggle()` "reverses"
8672			if ( toggle ) {
8673				dataShow.hidden = !hidden;
8674			}
8675
8676			// Show elements before animating them
8677			if ( hidden ) {
8678				showHide( [ elem ], true );
8679			}
8680
8681			/* eslint-disable no-loop-func */
8682
8683			anim.done( function() {
8684
8685				/* eslint-enable no-loop-func */
8686
8687				// The final step of a "hide" animation is actually hiding the element
8688				if ( !hidden ) {
8689					showHide( [ elem ] );
8690				}
8691				dataPriv.remove( elem, "fxshow" );
8692				for ( prop in orig ) {
8693					jQuery.style( elem, prop, orig[ prop ] );
8694				}
8695			} );
8696		}
8697
8698		// Per-property setup
8699		propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
8700		if ( !( prop in dataShow ) ) {
8701			dataShow[ prop ] = propTween.start;
8702			if ( hidden ) {
8703				propTween.end = propTween.start;
8704				propTween.start = 0;
8705			}
8706		}
8707	}
8708}
8709
8710function propFilter( props, specialEasing ) {
8711	var index, name, easing, value, hooks;
8712
8713	// camelCase, specialEasing and expand cssHook pass
8714	for ( index in props ) {
8715		name = camelCase( index );
8716		easing = specialEasing[ name ];
8717		value = props[ index ];
8718		if ( Array.isArray( value ) ) {
8719			easing = value[ 1 ];
8720			value = props[ index ] = value[ 0 ];
8721		}
8722
8723		if ( index !== name ) {
8724			props[ name ] = value;
8725			delete props[ index ];
8726		}
8727
8728		hooks = jQuery.cssHooks[ name ];
8729		if ( hooks && "expand" in hooks ) {
8730			value = hooks.expand( value );
8731			delete props[ name ];
8732
8733			// Not quite $.extend, this won't overwrite existing keys.
8734			// Reusing 'index' because we have the correct "name"
8735			for ( index in value ) {
8736				if ( !( index in props ) ) {
8737					props[ index ] = value[ index ];
8738					specialEasing[ index ] = easing;
8739				}
8740			}
8741		} else {
8742			specialEasing[ name ] = easing;
8743		}
8744	}
8745}
8746
8747function Animation( elem, properties, options ) {
8748	var result,
8749		stopped,
8750		index = 0,
8751		length = Animation.prefilters.length,
8752		deferred = jQuery.Deferred().always( function() {
8753
8754			// Don't match elem in the :animated selector
8755			delete tick.elem;
8756		} ),
8757		tick = function() {
8758			if ( stopped ) {
8759				return false;
8760			}
8761			var currentTime = fxNow || createFxNow(),
8762				remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
8763
vendor: 9,542 bytes, lines 8764-9154
8764				// Support: Android 2.3 only
8765				// Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (trac-12497)
8766				temp = remaining / animation.duration || 0,
8767				percent = 1 - temp,
8768				index = 0,
8769				length = animation.tweens.length;
8770
8771			for ( ; index < length; index++ ) {
8772				animation.tweens[ index ].run( percent );
8773			}
8774
8775			deferred.notifyWith( elem, [ animation, percent, remaining ] );
8776
8777			// If there's more to do, yield
8778			if ( percent < 1 && length ) {
8779				return remaining;
8780			}
8781
8782			// If this was an empty animation, synthesize a final progress notification
8783			if ( !length ) {
8784				deferred.notifyWith( elem, [ animation, 1, 0 ] );
8785			}
8786
8787			// Resolve the animation and report its conclusion
8788			deferred.resolveWith( elem, [ animation ] );
8789			return false;
8790		},
8791		animation = deferred.promise( {
8792			elem: elem,
8793			props: jQuery.extend( {}, properties ),
8794			opts: jQuery.extend( true, {
8795				specialEasing: {},
8796				easing: jQuery.easing._default
8797			}, options ),
8798			originalProperties: properties,
8799			originalOptions: options,
8800			startTime: fxNow || createFxNow(),
8801			duration: options.duration,
8802			tweens: [],
8803			createTween: function( prop, end ) {
8804				var tween = jQuery.Tween( elem, animation.opts, prop, end,
8805					animation.opts.specialEasing[ prop ] || animation.opts.easing );
8806				animation.tweens.push( tween );
8807				return tween;
8808			},
8809			stop: function( gotoEnd ) {
8810				var index = 0,
8811
8812					// If we are going to the end, we want to run all the tweens
8813					// otherwise we skip this part
8814					length = gotoEnd ? animation.tweens.length : 0;
8815				if ( stopped ) {
8816					return this;
8817				}
8818				stopped = true;
8819				for ( ; index < length; index++ ) {
8820					animation.tweens[ index ].run( 1 );
8821				}
8822
8823				// Resolve when we played the last frame; otherwise, reject
8824				if ( gotoEnd ) {
8825					deferred.notifyWith( elem, [ animation, 1, 0 ] );
8826					deferred.resolveWith( elem, [ animation, gotoEnd ] );
8827				} else {
8828					deferred.rejectWith( elem, [ animation, gotoEnd ] );
8829				}
8830				return this;
8831			}
8832		} ),
8833		props = animation.props;
8834
8835	propFilter( props, animation.opts.specialEasing );
8836
8837	for ( ; index < length; index++ ) {
8838		result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
8839		if ( result ) {
8840			if ( isFunction( result.stop ) ) {
8841				jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
8842					result.stop.bind( result );
8843			}
8844			return result;
8845		}
8846	}
8847
8848	jQuery.map( props, createTween, animation );
8849
8850	if ( isFunction( animation.opts.start ) ) {
8851		animation.opts.start.call( elem, animation );
8852	}
8853
8854	// Attach callbacks from options
8855	animation
8856		.progress( animation.opts.progress )
8857		.done( animation.opts.done, animation.opts.complete )
8858		.fail( animation.opts.fail )
8859		.always( animation.opts.always );
8860
8861	jQuery.fx.timer(
8862		jQuery.extend( tick, {
8863			elem: elem,
8864			anim: animation,
8865			queue: animation.opts.queue
8866		} )
8867	);
8868
8869	return animation;
8870}
8871
8872jQuery.Animation = jQuery.extend( Animation, {
8873
8874	tweeners: {
8875		"*": [ function( prop, value ) {
8876			var tween = this.createTween( prop, value );
8877			adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
8878			return tween;
8879		} ]
8880	},
8881
8882	tweener: function( props, callback ) {
8883		if ( isFunction( props ) ) {
8884			callback = props;
8885			props = [ "*" ];
8886		} else {
8887			props = props.match( rnothtmlwhite );
8888		}
8889
8890		var prop,
8891			index = 0,
8892			length = props.length;
8893
8894		for ( ; index < length; index++ ) {
8895			prop = props[ index ];
8896			Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
8897			Animation.tweeners[ prop ].unshift( callback );
8898		}
8899	},
8900
8901	prefilters: [ defaultPrefilter ],
8902
8903	prefilter: function( callback, prepend ) {
8904		if ( prepend ) {
8905			Animation.prefilters.unshift( callback );
8906		} else {
8907			Animation.prefilters.push( callback );
8908		}
8909	}
8910} );
8911
8912jQuery.speed = function( speed, easing, fn ) {
8913	var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
8914		complete: fn || !fn && easing ||
8915			isFunction( speed ) && speed,
8916		duration: speed,
8917		easing: fn && easing || easing && !isFunction( easing ) && easing
8918	};
8919
8920	// Go to the end state if fx are off
8921	if ( jQuery.fx.off ) {
8922		opt.duration = 0;
8923
8924	} else {
8925		if ( typeof opt.duration !== "number" ) {
8926			if ( opt.duration in jQuery.fx.speeds ) {
8927				opt.duration = jQuery.fx.speeds[ opt.duration ];
8928
8929			} else {
8930				opt.duration = jQuery.fx.speeds._default;
8931			}
8932		}
8933	}
8934
8935	// Normalize opt.queue - true/undefined/null -> "fx"
8936	if ( opt.queue == null || opt.queue === true ) {
8937		opt.queue = "fx";
8938	}
8939
8940	// Queueing
8941	opt.old = opt.complete;
8942
8943	opt.complete = function() {
8944		if ( isFunction( opt.old ) ) {
8945			opt.old.call( this );
8946		}
8947
8948		if ( opt.queue ) {
8949			jQuery.dequeue( this, opt.queue );
8950		}
8951	};
8952
8953	return opt;
8954};
8955
8956jQuery.fn.extend( {
8957	fadeTo: function( speed, to, easing, callback ) {
8958
8959		// Show any hidden elements after setting opacity to 0
8960		return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
8961
8962			// Animate to the value specified
8963			.end().animate( { opacity: to }, speed, easing, callback );
8964	},
8965	animate: function( prop, speed, easing, callback ) {
8966		var empty = jQuery.isEmptyObject( prop ),
8967			optall = jQuery.speed( speed, easing, callback ),
8968			doAnimation = function() {
8969
8970				// Operate on a copy of prop so per-property easing won't be lost
8971				var anim = Animation( this, jQuery.extend( {}, prop ), optall );
8972
8973				// Empty animations, or finishing resolves immediately
8974				if ( empty || dataPriv.get( this, "finish" ) ) {
8975					anim.stop( true );
8976				}
8977			};
8978
8979		doAnimation.finish = doAnimation;
8980
8981		return empty || optall.queue === false ?
8982			this.each( doAnimation ) :
8983			this.queue( optall.queue, doAnimation );
8984	},
8985	stop: function( type, clearQueue, gotoEnd ) {
8986		var stopQueue = function( hooks ) {
8987			var stop = hooks.stop;
8988			delete hooks.stop;
8989			stop( gotoEnd );
8990		};
8991
8992		if ( typeof type !== "string" ) {
8993			gotoEnd = clearQueue;
8994			clearQueue = type;
8995			type = undefined;
8996		}
8997		if ( clearQueue ) {
8998			this.queue( type || "fx", [] );
8999		}
9000
9001		return this.each( function() {
9002			var dequeue = true,
9003				index = type != null && type + "queueHooks",
9004				timers = jQuery.timers,
9005				data = dataPriv.get( this );
9006
9007			if ( index ) {
9008				if ( data[ index ] && data[ index ].stop ) {
9009					stopQueue( data[ index ] );
9010				}
9011			} else {
9012				for ( index in data ) {
9013					if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
9014						stopQueue( data[ index ] );
9015					}
9016				}
9017			}
9018
9019			for ( index = timers.length; index--; ) {
9020				if ( timers[ index ].elem === this &&
9021					( type == null || timers[ index ].queue === type ) ) {
9022
9023					timers[ index ].anim.stop( gotoEnd );
9024					dequeue = false;
9025					timers.splice( index, 1 );
9026				}
9027			}
9028
9029			// Start the next in the queue if the last step wasn't forced.
9030			// Timers currently will call their complete callbacks, which
9031			// will dequeue but only if they were gotoEnd.
9032			if ( dequeue || !gotoEnd ) {
9033				jQuery.dequeue( this, type );
9034			}
9035		} );
9036	},
9037	finish: function( type ) {
9038		if ( type !== false ) {
9039			type = type || "fx";
9040		}
9041		return this.each( function() {
9042			var index,
9043				data = dataPriv.get( this ),
9044				queue = data[ type + "queue" ],
9045				hooks = data[ type + "queueHooks" ],
9046				timers = jQuery.timers,
9047				length = queue ? queue.length : 0;
9048
9049			// Enable finishing flag on private data
9050			data.finish = true;
9051
9052			// Empty the queue first
9053			jQuery.queue( this, type, [] );
9054
9055			if ( hooks && hooks.stop ) {
9056				hooks.stop.call( this, true );
9057			}
9058
9059			// Look for any active animations, and finish them
9060			for ( index = timers.length; index--; ) {
9061				if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
9062					timers[ index ].anim.stop( true );
9063					timers.splice( index, 1 );
9064				}
9065			}
9066
9067			// Look for any animations in the old queue and finish them
9068			for ( index = 0; index < length; index++ ) {
9069				if ( queue[ index ] && queue[ index ].finish ) {
9070					queue[ index ].finish.call( this );
9071				}
9072			}
9073
9074			// Turn off finishing flag
9075			delete data.finish;
9076		} );
9077	}
9078} );
9079
9080jQuery.each( [ "toggle", "show", "hide" ], function( _i, name ) {
9081	var cssFn = jQuery.fn[ name ];
9082	jQuery.fn[ name ] = function( speed, easing, callback ) {
9083		return speed == null || typeof speed === "boolean" ?
9084			cssFn.apply( this, arguments ) :
9085			this.animate( genFx( name, true ), speed, easing, callback );
9086	};
9087} );
9088
9089// Generate shortcuts for custom animations
9090jQuery.each( {
9091	slideDown: genFx( "show" ),
9092	slideUp: genFx( "hide" ),
9093	slideToggle: genFx( "toggle" ),
9094	fadeIn: { opacity: "show" },
9095	fadeOut: { opacity: "hide" },
9096	fadeToggle: { opacity: "toggle" }
9097}, function( name, props ) {
9098	jQuery.fn[ name ] = function( speed, easing, callback ) {
9099		return this.animate( props, speed, easing, callback );
9100	};
9101} );
9102
9103jQuery.timers = [];
9104jQuery.fx.tick = function() {
9105	var timer,
9106		i = 0,
9107		timers = jQuery.timers;
9108
9109	fxNow = Date.now();
9110
9111	for ( ; i < timers.length; i++ ) {
9112		timer = timers[ i ];
9113
9114		// Run the timer and safely remove it when done (allowing for external removal)
9115		if ( !timer() && timers[ i ] === timer ) {
9116			timers.splice( i--, 1 );
9117		}
9118	}
9119
9120	if ( !timers.length ) {
9121		jQuery.fx.stop();
9122	}
9123	fxNow = undefined;
9124};
9125
9126jQuery.fx.timer = function( timer ) {
9127	jQuery.timers.push( timer );
9128	jQuery.fx.start();
9129};
9130
9131jQuery.fx.interval = 13;
9132jQuery.fx.start = function() {
9133	if ( inProgress ) {
9134		return;
9135	}
9136
9137	inProgress = true;
9138	schedule();
9139};
9140
9141jQuery.fx.stop = function() {
9142	inProgress = null;
9143};
9144
9145jQuery.fx.speeds = {
9146	slow: 600,
9147	fast: 200,
9148
9149	// Default speed
9150	_default: 400
9151};
9152
9153
9154// Based off of the plugin by Clint Helfers, with permission.
vendor: 5,177 bytes, lines 9155-9375
9155jQuery.fn.delay = function( time, type ) {
9156	time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
9157	type = type || "fx";
9158
9159	return this.queue( type, function( next, hooks ) {
9160		var timeout = window.setTimeout( next, time );
9161		hooks.stop = function() {
9162			window.clearTimeout( timeout );
9163		};
9164	} );
9165};
9166
9167
9168( function() {
9169	var input = document.createElement( "input" ),
9170		select = document.createElement( "select" ),
9171		opt = select.appendChild( document.createElement( "option" ) );
9172
9173	input.type = "checkbox";
9174
9175	// Support: Android <=4.3 only
9176	// Default value for a checkbox should be "on"
9177	support.checkOn = input.value !== "";
9178
9179	// Support: IE <=11 only
9180	// Must access selectedIndex to make default options select
9181	support.optSelected = opt.selected;
9182
9183	// Support: IE <=11 only
9184	// An input loses its value after becoming a radio
9185	input = document.createElement( "input" );
9186	input.value = "t";
9187	input.type = "radio";
9188	support.radioValue = input.value === "t";
9189} )();
9190
9191
9192var boolHook,
9193	attrHandle = jQuery.expr.attrHandle;
9194
9195jQuery.fn.extend( {
9196	attr: function( name, value ) {
9197		return access( this, jQuery.attr, name, value, arguments.length > 1 );
9198	},
9199
9200	removeAttr: function( name ) {
9201		return this.each( function() {
9202			jQuery.removeAttr( this, name );
9203		} );
9204	}
9205} );
9206
9207jQuery.extend( {
9208	attr: function( elem, name, value ) {
9209		var ret, hooks,
9210			nType = elem.nodeType;
9211
9212		// Don't get/set attributes on text, comment and attribute nodes
9213		if ( nType === 3 || nType === 8 || nType === 2 ) {
9214			return;
9215		}
9216
9217		// Fallback to prop when attributes are not supported
9218		if ( typeof elem.getAttribute === "undefined" ) {
9219			return jQuery.prop( elem, name, value );
9220		}
9221
9222		// Attribute hooks are determined by the lowercase version
9223		// Grab necessary hook if one is defined
9224		if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
9225			hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
9226				( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
9227		}
9228
9229		if ( value !== undefined ) {
9230			if ( value === null ) {
9231				jQuery.removeAttr( elem, name );
9232				return;
9233			}
9234
9235			if ( hooks && "set" in hooks &&
9236				( ret = hooks.set( elem, value, name ) ) !== undefined ) {
9237				return ret;
9238			}
9239
9240			elem.setAttribute( name, value + "" );
9241			return value;
9242		}
9243
9244		if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
9245			return ret;
9246		}
9247
9248		ret = jQuery.find.attr( elem, name );
9249
9250		// Non-existent attributes return null, we normalize to undefined
9251		return ret == null ? undefined : ret;
9252	},
9253
9254	attrHooks: {
9255		type: {
9256			set: function( elem, value ) {
9257				if ( !support.radioValue && value === "radio" &&
9258					nodeName( elem, "input" ) ) {
9259					var val = elem.value;
9260					elem.setAttribute( "type", value );
9261					if ( val ) {
9262						elem.value = val;
9263					}
9264					return value;
9265				}
9266			}
9267		}
9268	},
9269
9270	removeAttr: function( elem, value ) {
9271		var name,
9272			i = 0,
9273
9274			// Attribute names can contain non-HTML whitespace characters
9275			// https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
9276			attrNames = value && value.match( rnothtmlwhite );
9277
9278		if ( attrNames && elem.nodeType === 1 ) {
9279			while ( ( name = attrNames[ i++ ] ) ) {
9280				elem.removeAttribute( name );
9281			}
9282		}
9283	}
9284} );
9285
9286// Hooks for boolean attributes
9287boolHook = {
9288	set: function( elem, value, name ) {
9289		if ( value === false ) {
9290
9291			// Remove boolean attributes when set to false
9292			jQuery.removeAttr( elem, name );
9293		} else {
9294			elem.setAttribute( name, name );
9295		}
9296		return name;
9297	}
9298};
9299
9300jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( _i, name ) {
9301	var getter = attrHandle[ name ] || jQuery.find.attr;
9302
9303	attrHandle[ name ] = function( elem, name, isXML ) {
9304		var ret, handle,
9305			lowercaseName = name.toLowerCase();
9306
9307		if ( !isXML ) {
9308
9309			// Avoid an infinite loop by temporarily removing this function from the getter
9310			handle = attrHandle[ lowercaseName ];
9311			attrHandle[ lowercaseName ] = ret;
9312			ret = getter( elem, name, isXML ) != null ?
9313				lowercaseName :
9314				null;
9315			attrHandle[ lowercaseName ] = handle;
9316		}
9317		return ret;
9318	};
9319} );
9320
9321
9322
9323
9324var rfocusable = /^(?:input|select|textarea|button)$/i,
9325	rclickable = /^(?:a|area)$/i;
9326
9327jQuery.fn.extend( {
9328	prop: function( name, value ) {
9329		return access( this, jQuery.prop, name, value, arguments.length > 1 );
9330	},
9331
9332	removeProp: function( name ) {
9333		return this.each( function() {
9334			delete this[ jQuery.propFix[ name ] || name ];
9335		} );
9336	}
9337} );
9338
9339jQuery.extend( {
9340	prop: function( elem, name, value ) {
9341		var ret, hooks,
9342			nType = elem.nodeType;
9343
9344		// Don't get/set properties on text, comment and attribute nodes
9345		if ( nType === 3 || nType === 8 || nType === 2 ) {
9346			return;
9347		}
9348
9349		if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
9350
9351			// Fix name and attach hooks
9352			name = jQuery.propFix[ name ] || name;
9353			hooks = jQuery.propHooks[ name ];
9354		}
9355
9356		if ( value !== undefined ) {
9357			if ( hooks && "set" in hooks &&
9358				( ret = hooks.set( elem, value, name ) ) !== undefined ) {
9359				return ret;
9360			}
9361
9362			return ( elem[ name ] = value );
9363		}
9364
9365		if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
9366			return ret;
9367		}
9368
9369		return elem[ name ];
9370	},
9371
9372	propHooks: {
9373		tabIndex: {
9374			get: function( elem ) {
9375
vendor: 6,126 bytes, lines 9376-9635
9376				// Support: IE <=9 - 11 only
9377				// elem.tabIndex doesn't always return the
9378				// correct value when it hasn't been explicitly set
9379				// Use proper attribute retrieval (trac-12072)
9380				var tabindex = jQuery.find.attr( elem, "tabindex" );
9381
9382				if ( tabindex ) {
9383					return parseInt( tabindex, 10 );
9384				}
9385
9386				if (
9387					rfocusable.test( elem.nodeName ) ||
9388					rclickable.test( elem.nodeName ) &&
9389					elem.href
9390				) {
9391					return 0;
9392				}
9393
9394				return -1;
9395			}
9396		}
9397	},
9398
9399	propFix: {
9400		"for": "htmlFor",
9401		"class": "className"
9402	}
9403} );
9404
9405// Support: IE <=11 only
9406// Accessing the selectedIndex property
9407// forces the browser to respect setting selected
9408// on the option
9409// The getter ensures a default option is selected
9410// when in an optgroup
9411// eslint rule "no-unused-expressions" is disabled for this code
9412// since it considers such accessions noop
9413if ( !support.optSelected ) {
9414	jQuery.propHooks.selected = {
9415		get: function( elem ) {
9416
9417			/* eslint no-unused-expressions: "off" */
9418
9419			var parent = elem.parentNode;
9420			if ( parent && parent.parentNode ) {
9421				parent.parentNode.selectedIndex;
9422			}
9423			return null;
9424		},
9425		set: function( elem ) {
9426
9427			/* eslint no-unused-expressions: "off" */
9428
9429			var parent = elem.parentNode;
9430			if ( parent ) {
9431				parent.selectedIndex;
9432
9433				if ( parent.parentNode ) {
9434					parent.parentNode.selectedIndex;
9435				}
9436			}
9437		}
9438	};
9439}
9440
9441jQuery.each( [
9442	"tabIndex",
9443	"readOnly",
9444	"maxLength",
9445	"cellSpacing",
9446	"cellPadding",
9447	"rowSpan",
9448	"colSpan",
9449	"useMap",
9450	"frameBorder",
9451	"contentEditable"
9452], function() {
9453	jQuery.propFix[ this.toLowerCase() ] = this;
9454} );
9455
9456
9457
9458
9459	// Strip and collapse whitespace according to HTML spec
9460	// https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
9461	function stripAndCollapse( value ) {
9462		var tokens = value.match( rnothtmlwhite ) || [];
9463		return tokens.join( " " );
9464	}
9465
9466
9467function getClass( elem ) {
9468	return elem.getAttribute && elem.getAttribute( "class" ) || "";
9469}
9470
9471function classesToArray( value ) {
9472	if ( Array.isArray( value ) ) {
9473		return value;
9474	}
9475	if ( typeof value === "string" ) {
9476		return value.match( rnothtmlwhite ) || [];
9477	}
9478	return [];
9479}
9480
9481jQuery.fn.extend( {
9482	addClass: function( value ) {
9483		var classNames, cur, curValue, className, i, finalValue;
9484
9485		if ( isFunction( value ) ) {
9486			return this.each( function( j ) {
9487				jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
9488			} );
9489		}
9490
9491		classNames = classesToArray( value );
9492
9493		if ( classNames.length ) {
9494			return this.each( function() {
9495				curValue = getClass( this );
9496				cur = this.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
9497
9498				if ( cur ) {
9499					for ( i = 0; i < classNames.length; i++ ) {
9500						className = classNames[ i ];
9501						if ( cur.indexOf( " " + className + " " ) < 0 ) {
9502							cur += className + " ";
9503						}
9504					}
9505
9506					// Only assign if different to avoid unneeded rendering.
9507					finalValue = stripAndCollapse( cur );
9508					if ( curValue !== finalValue ) {
9509						this.setAttribute( "class", finalValue );
9510					}
9511				}
9512			} );
9513		}
9514
9515		return this;
9516	},
9517
9518	removeClass: function( value ) {
9519		var classNames, cur, curValue, className, i, finalValue;
9520
9521		if ( isFunction( value ) ) {
9522			return this.each( function( j ) {
9523				jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
9524			} );
9525		}
9526
9527		if ( !arguments.length ) {
9528			return this.attr( "class", "" );
9529		}
9530
9531		classNames = classesToArray( value );
9532
9533		if ( classNames.length ) {
9534			return this.each( function() {
9535				curValue = getClass( this );
9536
9537				// This expression is here for better compressibility (see addClass)
9538				cur = this.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
9539
9540				if ( cur ) {
9541					for ( i = 0; i < classNames.length; i++ ) {
9542						className = classNames[ i ];
9543
9544						// Remove *all* instances
9545						while ( cur.indexOf( " " + className + " " ) > -1 ) {
9546							cur = cur.replace( " " + className + " ", " " );
9547						}
9548					}
9549
9550					// Only assign if different to avoid unneeded rendering.
9551					finalValue = stripAndCollapse( cur );
9552					if ( curValue !== finalValue ) {
9553						this.setAttribute( "class", finalValue );
9554					}
9555				}
9556			} );
9557		}
9558
9559		return this;
9560	},
9561
9562	toggleClass: function( value, stateVal ) {
9563		var classNames, className, i, self,
9564			type = typeof value,
9565			isValidValue = type === "string" || Array.isArray( value );
9566
9567		if ( isFunction( value ) ) {
9568			return this.each( function( i ) {
9569				jQuery( this ).toggleClass(
9570					value.call( this, i, getClass( this ), stateVal ),
9571					stateVal
9572				);
9573			} );
9574		}
9575
9576		if ( typeof stateVal === "boolean" && isValidValue ) {
9577			return stateVal ? this.addClass( value ) : this.removeClass( value );
9578		}
9579
9580		classNames = classesToArray( value );
9581
9582		return this.each( function() {
9583			if ( isValidValue ) {
9584
9585				// Toggle individual class names
9586				self = jQuery( this );
9587
9588				for ( i = 0; i < classNames.length; i++ ) {
9589					className = classNames[ i ];
9590
9591					// Check each className given, space separated list
9592					if ( self.hasClass( className ) ) {
9593						self.removeClass( className );
9594					} else {
9595						self.addClass( className );
9596					}
9597				}
9598
9599			// Toggle whole class name
9600			} else if ( value === undefined || type === "boolean" ) {
9601				className = getClass( this );
9602				if ( className ) {
9603
9604					// Store className if set
9605					dataPriv.set( this, "__className__", className );
9606				}
9607
9608				// If the element has a class name or if we're passed `false`,
9609				// then remove the whole classname (if there was one, the above saved it).
9610				// Otherwise bring back whatever was previously saved (if anything),
9611				// falling back to the empty string if nothing was stored.
9612				if ( this.setAttribute ) {
9613					this.setAttribute( "class",
9614						className || value === false ?
9615							"" :
9616							dataPriv.get( this, "__className__" ) || ""
9617					);
9618				}
9619			}
9620		} );
9621	},
9622
9623	hasClass: function( selector ) {
9624		var className, elem,
9625			i = 0;
9626
9627		className = " " + selector + " ";
9628		while ( ( elem = this[ i++ ] ) ) {
9629			if ( elem.nodeType === 1 &&
9630				( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
9631				return true;
9632			}
9633		}
9634
9635		return false;
vendor: 1,385 bytes, lines 9636-9705
9636	}
9637} );
9638
9639
9640
9641
9642var rreturn = /\r/g;
9643
9644jQuery.fn.extend( {
9645	val: function( value ) {
9646		var hooks, ret, valueIsFunction,
9647			elem = this[ 0 ];
9648
9649		if ( !arguments.length ) {
9650			if ( elem ) {
9651				hooks = jQuery.valHooks[ elem.type ] ||
9652					jQuery.valHooks[ elem.nodeName.toLowerCase() ];
9653
9654				if ( hooks &&
9655					"get" in hooks &&
9656					( ret = hooks.get( elem, "value" ) ) !== undefined
9657				) {
9658					return ret;
9659				}
9660
9661				ret = elem.value;
9662
9663				// Handle most common string cases
9664				if ( typeof ret === "string" ) {
9665					return ret.replace( rreturn, "" );
9666				}
9667
9668				// Handle cases where value is null/undef or number
9669				return ret == null ? "" : ret;
9670			}
9671
9672			return;
9673		}
9674
9675		valueIsFunction = isFunction( value );
9676
9677		return this.each( function( i ) {
9678			var val;
9679
9680			if ( this.nodeType !== 1 ) {
9681				return;
9682			}
9683
9684			if ( valueIsFunction ) {
9685				val = value.call( this, i, jQuery( this ).val() );
9686			} else {
9687				val = value;
9688			}
9689
9690			// Treat null/undefined as ""; convert numbers to string
9691			if ( val == null ) {
9692				val = "";
9693
9694			} else if ( typeof val === "number" ) {
9695				val += "";
9696
9697			} else if ( Array.isArray( val ) ) {
9698				val = jQuery.map( val, function( value ) {
9699					return value == null ? "" : value + "";
9700				} );
9701			}
9702
9703			hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
9704
9705			// If set returns undefined, fall back to normal setting
vendor: 4,458 bytes, lines 9706-9891
9706			if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
9707				this.value = val;
9708			}
9709		} );
9710	}
9711} );
9712
9713jQuery.extend( {
9714	valHooks: {
9715		option: {
9716			get: function( elem ) {
9717
9718				var val = jQuery.find.attr( elem, "value" );
9719				return val != null ?
9720					val :
9721
9722					// Support: IE <=10 - 11 only
9723					// option.text throws exceptions (trac-14686, trac-14858)
9724					// Strip and collapse whitespace
9725					// https://html.spec.whatwg.org/#strip-and-collapse-whitespace
9726					stripAndCollapse( jQuery.text( elem ) );
9727			}
9728		},
9729		select: {
9730			get: function( elem ) {
9731				var value, option, i,
9732					options = elem.options,
9733					index = elem.selectedIndex,
9734					one = elem.type === "select-one",
9735					values = one ? null : [],
9736					max = one ? index + 1 : options.length;
9737
9738				if ( index < 0 ) {
9739					i = max;
9740
9741				} else {
9742					i = one ? index : 0;
9743				}
9744
9745				// Loop through all the selected options
9746				for ( ; i < max; i++ ) {
9747					option = options[ i ];
9748
9749					// Support: IE <=9 only
9750					// IE8-9 doesn't update selected after form reset (trac-2551)
9751					if ( ( option.selected || i === index ) &&
9752
9753							// Don't return options that are disabled or in a disabled optgroup
9754							!option.disabled &&
9755							( !option.parentNode.disabled ||
9756								!nodeName( option.parentNode, "optgroup" ) ) ) {
9757
9758						// Get the specific value for the option
9759						value = jQuery( option ).val();
9760
9761						// We don't need an array for one selects
9762						if ( one ) {
9763							return value;
9764						}
9765
9766						// Multi-Selects return an array
9767						values.push( value );
9768					}
9769				}
9770
9771				return values;
9772			},
9773
9774			set: function( elem, value ) {
9775				var optionSet, option,
9776					options = elem.options,
9777					values = jQuery.makeArray( value ),
9778					i = options.length;
9779
9780				while ( i-- ) {
9781					option = options[ i ];
9782
9783					/* eslint-disable no-cond-assign */
9784
9785					if ( option.selected =
9786						jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
9787					) {
9788						optionSet = true;
9789					}
9790
9791					/* eslint-enable no-cond-assign */
9792				}
9793
9794				// Force browsers to behave consistently when non-matching value is set
9795				if ( !optionSet ) {
9796					elem.selectedIndex = -1;
9797				}
9798				return values;
9799			}
9800		}
9801	}
9802} );
9803
9804// Radios and checkboxes getter/setter
9805jQuery.each( [ "radio", "checkbox" ], function() {
9806	jQuery.valHooks[ this ] = {
9807		set: function( elem, value ) {
9808			if ( Array.isArray( value ) ) {
9809				return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
9810			}
9811		}
9812	};
9813	if ( !support.checkOn ) {
9814		jQuery.valHooks[ this ].get = function( elem ) {
9815			return elem.getAttribute( "value" ) === null ? "on" : elem.value;
9816		};
9817	}
9818} );
9819
9820
9821
9822
9823// Return jQuery for attributes-only inclusion
9824var location = window.location;
9825
9826var nonce = { guid: Date.now() };
9827
9828var rquery = ( /\?/ );
9829
9830
9831
9832// Cross-browser xml parsing
9833jQuery.parseXML = function( data ) {
9834	var xml, parserErrorElem;
9835	if ( !data || typeof data !== "string" ) {
9836		return null;
9837	}
9838
9839	// Support: IE 9 - 11 only
9840	// IE throws on parseFromString with invalid input.
9841	try {
9842		xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
9843	} catch ( e ) {}
9844
9845	parserErrorElem = xml && xml.getElementsByTagName( "parsererror" )[ 0 ];
9846	if ( !xml || parserErrorElem ) {
9847		jQuery.error( "Invalid XML: " + (
9848			parserErrorElem ?
9849				jQuery.map( parserErrorElem.childNodes, function( el ) {
9850					return el.textContent;
9851				} ).join( "\n" ) :
9852				data
9853		) );
9854	}
9855	return xml;
9856};
9857
9858
9859var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
9860	stopPropagationCallback = function( e ) {
9861		e.stopPropagation();
9862	};
9863
9864jQuery.extend( jQuery.event, {
9865
9866	trigger: function( event, data, elem, onlyHandlers ) {
9867
9868		var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
9869			eventPath = [ elem || document ],
9870			type = hasOwn.call( event, "type" ) ? event.type : event,
9871			namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
9872
9873		cur = lastElement = tmp = elem = elem || document;
9874
9875		// Don't do events on text and comment nodes
9876		if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
9877			return;
9878		}
9879
9880		// focus/blur morphs to focusin/out; ensure we're not firing them right now
9881		if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
9882			return;
9883		}
9884
9885		if ( type.indexOf( "." ) > -1 ) {
9886
9887			// Namespaced trigger; create a regexp to match event type in handle()
9888			namespaces = type.split( "." );
9889			type = namespaces.shift();
9890			namespaces.sort();
9891		}
vendor: 6,524 bytes, lines 9892-10141
9892		ontype = type.indexOf( ":" ) < 0 && "on" + type;
9893
9894		// Caller can pass in a jQuery.Event object, Object, or just an event type string
9895		event = event[ jQuery.expando ] ?
9896			event :
9897			new jQuery.Event( type, typeof event === "object" && event );
9898
9899		// Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
9900		event.isTrigger = onlyHandlers ? 2 : 3;
9901		event.namespace = namespaces.join( "." );
9902		event.rnamespace = event.namespace ?
9903			new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
9904			null;
9905
9906		// Clean up the event in case it is being reused
9907		event.result = undefined;
9908		if ( !event.target ) {
9909			event.target = elem;
9910		}
9911
9912		// Clone any incoming data and prepend the event, creating the handler arg list
9913		data = data == null ?
9914			[ event ] :
9915			jQuery.makeArray( data, [ event ] );
9916
9917		// Allow special events to draw outside the lines
9918		special = jQuery.event.special[ type ] || {};
9919		if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
9920			return;
9921		}
9922
9923		// Determine event propagation path in advance, per W3C events spec (trac-9951)
9924		// Bubble up to document, then to window; watch for a global ownerDocument var (trac-9724)
9925		if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
9926
9927			bubbleType = special.delegateType || type;
9928			if ( !rfocusMorph.test( bubbleType + type ) ) {
9929				cur = cur.parentNode;
9930			}
9931			for ( ; cur; cur = cur.parentNode ) {
9932				eventPath.push( cur );
9933				tmp = cur;
9934			}
9935
9936			// Only add window if we got to document (e.g., not plain obj or detached DOM)
9937			if ( tmp === ( elem.ownerDocument || document ) ) {
9938				eventPath.push( tmp.defaultView || tmp.parentWindow || window );
9939			}
9940		}
9941
9942		// Fire handlers on the event path
9943		i = 0;
9944		while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
9945			lastElement = cur;
9946			event.type = i > 1 ?
9947				bubbleType :
9948				special.bindType || type;
9949
9950			// jQuery handler
9951			handle = ( dataPriv.get( cur, "events" ) || Object.create( null ) )[ event.type ] &&
9952				dataPriv.get( cur, "handle" );
9953			if ( handle ) {
9954				handle.apply( cur, data );
9955			}
9956
9957			// Native handler
9958			handle = ontype && cur[ ontype ];
9959			if ( handle && handle.apply && acceptData( cur ) ) {
9960				event.result = handle.apply( cur, data );
9961				if ( event.result === false ) {
9962					event.preventDefault();
9963				}
9964			}
9965		}
9966		event.type = type;
9967
9968		// If nobody prevented the default action, do it now
9969		if ( !onlyHandlers && !event.isDefaultPrevented() ) {
9970
9971			if ( ( !special._default ||
9972				special._default.apply( eventPath.pop(), data ) === false ) &&
9973				acceptData( elem ) ) {
9974
9975				// Call a native DOM method on the target with the same name as the event.
9976				// Don't do default actions on window, that's where global variables be (trac-6170)
9977				if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
9978
9979					// Don't re-trigger an onFOO event when we call its FOO() method
9980					tmp = elem[ ontype ];
9981
9982					if ( tmp ) {
9983						elem[ ontype ] = null;
9984					}
9985
9986					// Prevent re-triggering of the same event, since we already bubbled it above
9987					jQuery.event.triggered = type;
9988
9989					if ( event.isPropagationStopped() ) {
9990						lastElement.addEventListener( type, stopPropagationCallback );
9991					}
9992
9993					elem[ type ]();
9994
9995					if ( event.isPropagationStopped() ) {
9996						lastElement.removeEventListener( type, stopPropagationCallback );
9997					}
9998
9999					jQuery.event.triggered = undefined;
10000
10001					if ( tmp ) {
10002						elem[ ontype ] = tmp;
10003					}
10004				}
10005			}
10006		}
10007
10008		return event.result;
10009	},
10010
10011	// Piggyback on a donor event to simulate a different one
10012	// Used only for `focus(in | out)` events
10013	simulate: function( type, elem, event ) {
10014		var e = jQuery.extend(
10015			new jQuery.Event(),
10016			event,
10017			{
10018				type: type,
10019				isSimulated: true
10020			}
10021		);
10022
10023		jQuery.event.trigger( e, null, elem );
10024	}
10025
10026} );
10027
10028jQuery.fn.extend( {
10029
10030	trigger: function( type, data ) {
10031		return this.each( function() {
10032			jQuery.event.trigger( type, data, this );
10033		} );
10034	},
10035	triggerHandler: function( type, data ) {
10036		var elem = this[ 0 ];
10037		if ( elem ) {
10038			return jQuery.event.trigger( type, data, elem, true );
10039		}
10040	}
10041} );
10042
10043
10044var
10045	rbracket = /\[\]$/,
10046	rCRLF = /\r?\n/g,
10047	rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
10048	rsubmittable = /^(?:input|select|textarea|keygen)/i;
10049
10050function buildParams( prefix, obj, traditional, add ) {
10051	var name;
10052
10053	if ( Array.isArray( obj ) ) {
10054
10055		// Serialize array item.
10056		jQuery.each( obj, function( i, v ) {
10057			if ( traditional || rbracket.test( prefix ) ) {
10058
10059				// Treat each array item as a scalar.
10060				add( prefix, v );
10061
10062			} else {
10063
10064				// Item is non-scalar (array or object), encode its numeric index.
10065				buildParams(
10066					prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
10067					v,
10068					traditional,
10069					add
10070				);
10071			}
10072		} );
10073
10074	} else if ( !traditional && toType( obj ) === "object" ) {
10075
10076		// Serialize object item.
10077		for ( name in obj ) {
10078			buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
10079		}
10080
10081	} else {
10082
10083		// Serialize scalar item.
10084		add( prefix, obj );
10085	}
10086}
10087
10088// Serialize an array of form elements or a set of
10089// key/values into a query string
10090jQuery.param = function( a, traditional ) {
10091	var prefix,
10092		s = [],
10093		add = function( key, valueOrFunction ) {
10094
10095			// If value is a function, invoke it and use its return value
10096			var value = isFunction( valueOrFunction ) ?
10097				valueOrFunction() :
10098				valueOrFunction;
10099
10100			s[ s.length ] = encodeURIComponent( key ) + "=" +
10101				encodeURIComponent( value == null ? "" : value );
10102		};
10103
10104	if ( a == null ) {
10105		return "";
10106	}
10107
10108	// If an array was passed in, assume that it is an array of form elements.
10109	if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
10110
10111		// Serialize the form elements
10112		jQuery.each( a, function() {
10113			add( this.name, this.value );
10114		} );
10115
10116	} else {
10117
10118		// If traditional, encode the "old" way (the way 1.3.2 or older
10119		// did it), otherwise encode params recursively.
10120		for ( prefix in a ) {
10121			buildParams( prefix, a[ prefix ], traditional, add );
10122		}
10123	}
10124
10125	// Return the resulting serialization
10126	return s.join( "&" );
10127};
10128
10129jQuery.fn.extend( {
10130	serialize: function() {
10131		return jQuery.param( this.serializeArray() );
10132	},
10133	serializeArray: function() {
10134		return this.map( function() {
10135
10136			// Can add propHook for "elements" to filter or add form elements
10137			var elements = jQuery.prop( this, "elements" );
10138			return elements ? jQuery.makeArray( elements ) : this;
10139		} ).filter( function() {
10140			var type = this.type;
10141
vendor: 32,437 bytes, lines 10142-11395
10142			// Use .is( ":disabled" ) so that fieldset[disabled] works
10143			return this.name && !jQuery( this ).is( ":disabled" ) &&
10144				rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
10145				( this.checked || !rcheckableType.test( type ) );
10146		} ).map( function( _i, elem ) {
10147			var val = jQuery( this ).val();
10148
10149			if ( val == null ) {
10150				return null;
10151			}
10152
10153			if ( Array.isArray( val ) ) {
10154				return jQuery.map( val, function( val ) {
10155					return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
10156				} );
10157			}
10158
10159			return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
10160		} ).get();
10161	}
10162} );
10163
10164
10165var
10166	r20 = /%20/g,
10167	rhash = /#.*$/,
10168	rantiCache = /([?&])_=[^&]*/,
10169	rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
10170
10171	// trac-7653, trac-8125, trac-8152: local protocol detection
10172	rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
10173	rnoContent = /^(?:GET|HEAD)$/,
10174	rprotocol = /^\/\//,
10175
10176	/* Prefilters
10177	 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
10178	 * 2) These are called:
10179	 *    - BEFORE asking for a transport
10180	 *    - AFTER param serialization (s.data is a string if s.processData is true)
10181	 * 3) key is the dataType
10182	 * 4) the catchall symbol "*" can be used
10183	 * 5) execution will start with transport dataType and THEN continue down to "*" if needed
10184	 */
10185	prefilters = {},
10186
10187	/* Transports bindings
10188	 * 1) key is the dataType
10189	 * 2) the catchall symbol "*" can be used
10190	 * 3) selection will start with transport dataType and THEN go to "*" if needed
10191	 */
10192	transports = {},
10193
10194	// Avoid comment-prolog char sequence (trac-10098); must appease lint and evade compression
10195	allTypes = "*/".concat( "*" ),
10196
10197	// Anchor tag for parsing the document origin
10198	originAnchor = document.createElement( "a" );
10199
10200originAnchor.href = location.href;
10201
10202// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
10203function addToPrefiltersOrTransports( structure ) {
10204
10205	// dataTypeExpression is optional and defaults to "*"
10206	return function( dataTypeExpression, func ) {
10207
10208		if ( typeof dataTypeExpression !== "string" ) {
10209			func = dataTypeExpression;
10210			dataTypeExpression = "*";
10211		}
10212
10213		var dataType,
10214			i = 0,
10215			dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
10216
10217		if ( isFunction( func ) ) {
10218
10219			// For each dataType in the dataTypeExpression
10220			while ( ( dataType = dataTypes[ i++ ] ) ) {
10221
10222				// Prepend if requested
10223				if ( dataType[ 0 ] === "+" ) {
10224					dataType = dataType.slice( 1 ) || "*";
10225					( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
10226
10227				// Otherwise append
10228				} else {
10229					( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
10230				}
10231			}
10232		}
10233	};
10234}
10235
10236// Base inspection function for prefilters and transports
10237function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
10238
10239	var inspected = {},
10240		seekingTransport = ( structure === transports );
10241
10242	function inspect( dataType ) {
10243		var selected;
10244		inspected[ dataType ] = true;
10245		jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
10246			var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
10247			if ( typeof dataTypeOrTransport === "string" &&
10248				!seekingTransport && !inspected[ dataTypeOrTransport ] ) {
10249
10250				options.dataTypes.unshift( dataTypeOrTransport );
10251				inspect( dataTypeOrTransport );
10252				return false;
10253			} else if ( seekingTransport ) {
10254				return !( selected = dataTypeOrTransport );
10255			}
10256		} );
10257		return selected;
10258	}
10259
10260	return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
10261}
10262
10263// A special extend for ajax options
10264// that takes "flat" options (not to be deep extended)
10265// Fixes trac-9887
10266function ajaxExtend( target, src ) {
10267	var key, deep,
10268		flatOptions = jQuery.ajaxSettings.flatOptions || {};
10269
10270	for ( key in src ) {
10271		if ( src[ key ] !== undefined ) {
10272			( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
10273		}
10274	}
10275	if ( deep ) {
10276		jQuery.extend( true, target, deep );
10277	}
10278
10279	return target;
10280}
10281
10282/* Handles responses to an ajax request:
10283 * - finds the right dataType (mediates between content-type and expected dataType)
10284 * - returns the corresponding response
10285 */
10286function ajaxHandleResponses( s, jqXHR, responses ) {
10287
10288	var ct, type, finalDataType, firstDataType,
10289		contents = s.contents,
10290		dataTypes = s.dataTypes;
10291
10292	// Remove auto dataType and get content-type in the process
10293	while ( dataTypes[ 0 ] === "*" ) {
10294		dataTypes.shift();
10295		if ( ct === undefined ) {
10296			ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
10297		}
10298	}
10299
10300	// Check if we're dealing with a known content-type
10301	if ( ct ) {
10302		for ( type in contents ) {
10303			if ( contents[ type ] && contents[ type ].test( ct ) ) {
10304				dataTypes.unshift( type );
10305				break;
10306			}
10307		}
10308	}
10309
10310	// Check to see if we have a response for the expected dataType
10311	if ( dataTypes[ 0 ] in responses ) {
10312		finalDataType = dataTypes[ 0 ];
10313	} else {
10314
10315		// Try convertible dataTypes
10316		for ( type in responses ) {
10317			if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
10318				finalDataType = type;
10319				break;
10320			}
10321			if ( !firstDataType ) {
10322				firstDataType = type;
10323			}
10324		}
10325
10326		// Or just use first one
10327		finalDataType = finalDataType || firstDataType;
10328	}
10329
10330	// If we found a dataType
10331	// We add the dataType to the list if needed
10332	// and return the corresponding response
10333	if ( finalDataType ) {
10334		if ( finalDataType !== dataTypes[ 0 ] ) {
10335			dataTypes.unshift( finalDataType );
10336		}
10337		return responses[ finalDataType ];
10338	}
10339}
10340
10341/* Chain conversions given the request and the original response
10342 * Also sets the responseXXX fields on the jqXHR instance
10343 */
10344function ajaxConvert( s, response, jqXHR, isSuccess ) {
10345	var conv2, current, conv, tmp, prev,
10346		converters = {},
10347
10348		// Work with a copy of dataTypes in case we need to modify it for conversion
10349		dataTypes = s.dataTypes.slice();
10350
10351	// Create converters map with lowercased keys
10352	if ( dataTypes[ 1 ] ) {
10353		for ( conv in s.converters ) {
10354			converters[ conv.toLowerCase() ] = s.converters[ conv ];
10355		}
10356	}
10357
10358	current = dataTypes.shift();
10359
10360	// Convert to each sequential dataType
10361	while ( current ) {
10362
10363		if ( s.responseFields[ current ] ) {
10364			jqXHR[ s.responseFields[ current ] ] = response;
10365		}
10366
10367		// Apply the dataFilter if provided
10368		if ( !prev && isSuccess && s.dataFilter ) {
10369			response = s.dataFilter( response, s.dataType );
10370		}
10371
10372		prev = current;
10373		current = dataTypes.shift();
10374
10375		if ( current ) {
10376
10377			// There's only work to do if current dataType is non-auto
10378			if ( current === "*" ) {
10379
10380				current = prev;
10381
10382			// Convert response if prev dataType is non-auto and differs from current
10383			} else if ( prev !== "*" && prev !== current ) {
10384
10385				// Seek a direct converter
10386				conv = converters[ prev + " " + current ] || converters[ "* " + current ];
10387
10388				// If none found, seek a pair
10389				if ( !conv ) {
10390					for ( conv2 in converters ) {
10391
10392						// If conv2 outputs current
10393						tmp = conv2.split( " " );
10394						if ( tmp[ 1 ] === current ) {
10395
10396							// If prev can be converted to accepted input
10397							conv = converters[ prev + " " + tmp[ 0 ] ] ||
10398								converters[ "* " + tmp[ 0 ] ];
10399							if ( conv ) {
10400
10401								// Condense equivalence converters
10402								if ( conv === true ) {
10403									conv = converters[ conv2 ];
10404
10405								// Otherwise, insert the intermediate dataType
10406								} else if ( converters[ conv2 ] !== true ) {
10407									current = tmp[ 0 ];
10408									dataTypes.unshift( tmp[ 1 ] );
10409								}
10410								break;
10411							}
10412						}
10413					}
10414				}
10415
10416				// Apply converter (if not an equivalence)
10417				if ( conv !== true ) {
10418
10419					// Unless errors are allowed to bubble, catch and return them
10420					if ( conv && s.throws ) {
10421						response = conv( response );
10422					} else {
10423						try {
10424							response = conv( response );
10425						} catch ( e ) {
10426							return {
10427								state: "parsererror",
10428								error: conv ? e : "No conversion from " + prev + " to " + current
10429							};
10430						}
10431					}
10432				}
10433			}
10434		}
10435	}
10436
10437	return { state: "success", data: response };
10438}
10439
10440jQuery.extend( {
10441
10442	// Counter for holding the number of active queries
10443	active: 0,
10444
10445	// Last-Modified header cache for next request
10446	lastModified: {},
10447	etag: {},
10448
10449	ajaxSettings: {
10450		url: location.href,
10451		type: "GET",
10452		isLocal: rlocalProtocol.test( location.protocol ),
10453		global: true,
10454		processData: true,
10455		async: true,
10456		contentType: "application/x-www-form-urlencoded; charset=UTF-8",
10457
10458		/*
10459		timeout: 0,
10460		data: null,
10461		dataType: null,
10462		username: null,
10463		password: null,
10464		cache: null,
10465		throws: false,
10466		traditional: false,
10467		headers: {},
10468		*/
10469
10470		accepts: {
10471			"*": allTypes,
10472			text: "text/plain",
10473			html: "text/html",
10474			xml: "application/xml, text/xml",
10475			json: "application/json, text/javascript"
10476		},
10477
10478		contents: {
10479			xml: /\bxml\b/,
10480			html: /\bhtml/,
10481			json: /\bjson\b/
10482		},
10483
10484		responseFields: {
10485			xml: "responseXML",
10486			text: "responseText",
10487			json: "responseJSON"
10488		},
10489
10490		// Data converters
10491		// Keys separate source (or catchall "*") and destination types with a single space
10492		converters: {
10493
10494			// Convert anything to text
10495			"* text": String,
10496
10497			// Text to html (true = no transformation)
10498			"text html": true,
10499
10500			// Evaluate text as a json expression
10501			"text json": JSON.parse,
10502
10503			// Parse text as xml
10504			"text xml": jQuery.parseXML
10505		},
10506
10507		// For options that shouldn't be deep extended:
10508		// you can add your own custom options here if
10509		// and when you create one that shouldn't be
10510		// deep extended (see ajaxExtend)
10511		flatOptions: {
10512			url: true,
10513			context: true
10514		}
10515	},
10516
10517	// Creates a full fledged settings object into target
10518	// with both ajaxSettings and settings fields.
10519	// If target is omitted, writes into ajaxSettings.
10520	ajaxSetup: function( target, settings ) {
10521		return settings ?
10522
10523			// Building a settings object
10524			ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
10525
10526			// Extending ajaxSettings
10527			ajaxExtend( jQuery.ajaxSettings, target );
10528	},
10529
10530	ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
10531	ajaxTransport: addToPrefiltersOrTransports( transports ),
10532
10533	// Main method
10534	ajax: function( url, options ) {
10535
10536		// If url is an object, simulate pre-1.5 signature
10537		if ( typeof url === "object" ) {
10538			options = url;
10539			url = undefined;
10540		}
10541
10542		// Force options to be an object
10543		options = options || {};
10544
10545		var transport,
10546
10547			// URL without anti-cache param
10548			cacheURL,
10549
10550			// Response headers
10551			responseHeadersString,
10552			responseHeaders,
10553
10554			// timeout handle
10555			timeoutTimer,
10556
10557			// Url cleanup var
10558			urlAnchor,
10559
10560			// Request state (becomes false upon send and true upon completion)
10561			completed,
10562
10563			// To know if global events are to be dispatched
10564			fireGlobals,
10565
10566			// Loop variable
10567			i,
10568
10569			// uncached part of the url
10570			uncached,
10571
10572			// Create the final options object
10573			s = jQuery.ajaxSetup( {}, options ),
10574
10575			// Callbacks context
10576			callbackContext = s.context || s,
10577
10578			// Context for global events is callbackContext if it is a DOM node or jQuery collection
10579			globalEventContext = s.context &&
10580				( callbackContext.nodeType || callbackContext.jquery ) ?
10581				jQuery( callbackContext ) :
10582				jQuery.event,
10583
10584			// Deferreds
10585			deferred = jQuery.Deferred(),
10586			completeDeferred = jQuery.Callbacks( "once memory" ),
10587
10588			// Status-dependent callbacks
10589			statusCode = s.statusCode || {},
10590
10591			// Headers (they are sent all at once)
10592			requestHeaders = {},
10593			requestHeadersNames = {},
10594
10595			// Default abort message
10596			strAbort = "canceled",
10597
10598			// Fake xhr
10599			jqXHR = {
10600				readyState: 0,
10601
10602				// Builds headers hashtable if needed
10603				getResponseHeader: function( key ) {
10604					var match;
10605					if ( completed ) {
10606						if ( !responseHeaders ) {
10607							responseHeaders = {};
10608							while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
10609								responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
10610									( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
10611										.concat( match[ 2 ] );
10612							}
10613						}
10614						match = responseHeaders[ key.toLowerCase() + " " ];
10615					}
10616					return match == null ? null : match.join( ", " );
10617				},
10618
10619				// Raw string
10620				getAllResponseHeaders: function() {
10621					return completed ? responseHeadersString : null;
10622				},
10623
10624				// Caches the header
10625				setRequestHeader: function( name, value ) {
10626					if ( completed == null ) {
10627						name = requestHeadersNames[ name.toLowerCase() ] =
10628							requestHeadersNames[ name.toLowerCase() ] || name;
10629						requestHeaders[ name ] = value;
10630					}
10631					return this;
10632				},
10633
10634				// Overrides response content-type header
10635				overrideMimeType: function( type ) {
10636					if ( completed == null ) {
10637						s.mimeType = type;
10638					}
10639					return this;
10640				},
10641
10642				// Status-dependent callbacks
10643				statusCode: function( map ) {
10644					var code;
10645					if ( map ) {
10646						if ( completed ) {
10647
10648							// Execute the appropriate callbacks
10649							jqXHR.always( map[ jqXHR.status ] );
10650						} else {
10651
10652							// Lazy-add the new callbacks in a way that preserves old ones
10653							for ( code in map ) {
10654								statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
10655							}
10656						}
10657					}
10658					return this;
10659				},
10660
10661				// Cancel the request
10662				abort: function( statusText ) {
10663					var finalText = statusText || strAbort;
10664					if ( transport ) {
10665						transport.abort( finalText );
10666					}
10667					done( 0, finalText );
10668					return this;
10669				}
10670			};
10671
10672		// Attach deferreds
10673		deferred.promise( jqXHR );
10674
10675		// Add protocol if not provided (prefilters might expect it)
10676		// Handle falsy url in the settings object (trac-10093: consistency with old signature)
10677		// We also use the url parameter if available
10678		s.url = ( ( url || s.url || location.href ) + "" )
10679			.replace( rprotocol, location.protocol + "//" );
10680
10681		// Alias method option to type as per ticket trac-12004
10682		s.type = options.method || options.type || s.method || s.type;
10683
10684		// Extract dataTypes list
10685		s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
10686
10687		// A cross-domain request is in order when the origin doesn't match the current origin.
10688		if ( s.crossDomain == null ) {
10689			urlAnchor = document.createElement( "a" );
10690
10691			// Support: IE <=8 - 11, Edge 12 - 15
10692			// IE throws exception on accessing the href property if url is malformed,
10693			// e.g. http://example.com:80x/
10694			try {
10695				urlAnchor.href = s.url;
10696
10697				// Support: IE <=8 - 11 only
10698				// Anchor's host property isn't correctly set when s.url is relative
10699				urlAnchor.href = urlAnchor.href;
10700				s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
10701					urlAnchor.protocol + "//" + urlAnchor.host;
10702			} catch ( e ) {
10703
10704				// If there is an error parsing the URL, assume it is crossDomain,
10705				// it can be rejected by the transport if it is invalid
10706				s.crossDomain = true;
10707			}
10708		}
10709
10710		// Convert data if not already a string
10711		if ( s.data && s.processData && typeof s.data !== "string" ) {
10712			s.data = jQuery.param( s.data, s.traditional );
10713		}
10714
10715		// Apply prefilters
10716		inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
10717
10718		// If request was aborted inside a prefilter, stop there
10719		if ( completed ) {
10720			return jqXHR;
10721		}
10722
10723		// We can fire global events as of now if asked to
10724		// Don't fire events if jQuery.event is undefined in an AMD-usage scenario (trac-15118)
10725		fireGlobals = jQuery.event && s.global;
10726
10727		// Watch for a new set of requests
10728		if ( fireGlobals && jQuery.active++ === 0 ) {
10729			jQuery.event.trigger( "ajaxStart" );
10730		}
10731
10732		// Uppercase the type
10733		s.type = s.type.toUpperCase();
10734
10735		// Determine if request has content
10736		s.hasContent = !rnoContent.test( s.type );
10737
10738		// Save the URL in case we're toying with the If-Modified-Since
10739		// and/or If-None-Match header later on
10740		// Remove hash to simplify url manipulation
10741		cacheURL = s.url.replace( rhash, "" );
10742
10743		// More options handling for requests with no content
10744		if ( !s.hasContent ) {
10745
10746			// Remember the hash so we can put it back
10747			uncached = s.url.slice( cacheURL.length );
10748
10749			// If data is available and should be processed, append data to url
10750			if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
10751				cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
10752
10753				// trac-9682: remove data so that it's not used in an eventual retry
10754				delete s.data;
10755			}
10756
10757			// Add or update anti-cache param if needed
10758			if ( s.cache === false ) {
10759				cacheURL = cacheURL.replace( rantiCache, "$1" );
10760				uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce.guid++ ) +
10761					uncached;
10762			}
10763
10764			// Put hash and anti-cache on the URL that will be requested (gh-1732)
10765			s.url = cacheURL + uncached;
10766
10767		// Change '%20' to '+' if this is encoded form body content (gh-2658)
10768		} else if ( s.data && s.processData &&
10769			( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
10770			s.data = s.data.replace( r20, "+" );
10771		}
10772
10773		// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
10774		if ( s.ifModified ) {
10775			if ( jQuery.lastModified[ cacheURL ] ) {
10776				jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
10777			}
10778			if ( jQuery.etag[ cacheURL ] ) {
10779				jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
10780			}
10781		}
10782
10783		// Set the correct header, if data is being sent
10784		if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
10785			jqXHR.setRequestHeader( "Content-Type", s.contentType );
10786		}
10787
10788		// Set the Accepts header for the server, depending on the dataType
10789		jqXHR.setRequestHeader(
10790			"Accept",
10791			s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
10792				s.accepts[ s.dataTypes[ 0 ] ] +
10793					( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
10794				s.accepts[ "*" ]
10795		);
10796
10797		// Check for headers option
10798		for ( i in s.headers ) {
10799			jqXHR.setRequestHeader( i, s.headers[ i ] );
10800		}
10801
10802		// Allow custom headers/mimetypes and early abort
10803		if ( s.beforeSend &&
10804			( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
10805
10806			// Abort if not done already and return
10807			return jqXHR.abort();
10808		}
10809
10810		// Aborting is no longer a cancellation
10811		strAbort = "abort";
10812
10813		// Install callbacks on deferreds
10814		completeDeferred.add( s.complete );
10815		jqXHR.done( s.success );
10816		jqXHR.fail( s.error );
10817
10818		// Get transport
10819		transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
10820
10821		// If no transport, we auto-abort
10822		if ( !transport ) {
10823			done( -1, "No Transport" );
10824		} else {
10825			jqXHR.readyState = 1;
10826
10827			// Send global event
10828			if ( fireGlobals ) {
10829				globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
10830			}
10831
10832			// If request was aborted inside ajaxSend, stop there
10833			if ( completed ) {
10834				return jqXHR;
10835			}
10836
10837			// Timeout
10838			if ( s.async && s.timeout > 0 ) {
10839				timeoutTimer = window.setTimeout( function() {
10840					jqXHR.abort( "timeout" );
10841				}, s.timeout );
10842			}
10843
10844			try {
10845				completed = false;
10846				transport.send( requestHeaders, done );
10847			} catch ( e ) {
10848
10849				// Rethrow post-completion exceptions
10850				if ( completed ) {
10851					throw e;
10852				}
10853
10854				// Propagate others as results
10855				done( -1, e );
10856			}
10857		}
10858
10859		// Callback for when everything is done
10860		function done( status, nativeStatusText, responses, headers ) {
10861			var isSuccess, success, error, response, modified,
10862				statusText = nativeStatusText;
10863
10864			// Ignore repeat invocations
10865			if ( completed ) {
10866				return;
10867			}
10868
10869			completed = true;
10870
10871			// Clear timeout if it exists
10872			if ( timeoutTimer ) {
10873				window.clearTimeout( timeoutTimer );
10874			}
10875
10876			// Dereference transport for early garbage collection
10877			// (no matter how long the jqXHR object will be used)
10878			transport = undefined;
10879
10880			// Cache response headers
10881			responseHeadersString = headers || "";
10882
10883			// Set readyState
10884			jqXHR.readyState = status > 0 ? 4 : 0;
10885
10886			// Determine if successful
10887			isSuccess = status >= 200 && status < 300 || status === 304;
10888
10889			// Get response data
10890			if ( responses ) {
10891				response = ajaxHandleResponses( s, jqXHR, responses );
10892			}
10893
10894			// Use a noop converter for missing script but not if jsonp
10895			if ( !isSuccess &&
10896				jQuery.inArray( "script", s.dataTypes ) > -1 &&
10897				jQuery.inArray( "json", s.dataTypes ) < 0 ) {
10898				s.converters[ "text script" ] = function() {};
10899			}
10900
10901			// Convert no matter what (that way responseXXX fields are always set)
10902			response = ajaxConvert( s, response, jqXHR, isSuccess );
10903
10904			// If successful, handle type chaining
10905			if ( isSuccess ) {
10906
10907				// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
10908				if ( s.ifModified ) {
10909					modified = jqXHR.getResponseHeader( "Last-Modified" );
10910					if ( modified ) {
10911						jQuery.lastModified[ cacheURL ] = modified;
10912					}
10913					modified = jqXHR.getResponseHeader( "etag" );
10914					if ( modified ) {
10915						jQuery.etag[ cacheURL ] = modified;
10916					}
10917				}
10918
10919				// if no content
10920				if ( status === 204 || s.type === "HEAD" ) {
10921					statusText = "nocontent";
10922
10923				// if not modified
10924				} else if ( status === 304 ) {
10925					statusText = "notmodified";
10926
10927				// If we have data, let's convert it
10928				} else {
10929					statusText = response.state;
10930					success = response.data;
10931					error = response.error;
10932					isSuccess = !error;
10933				}
10934			} else {
10935
10936				// Extract error from statusText and normalize for non-aborts
10937				error = statusText;
10938				if ( status || !statusText ) {
10939					statusText = "error";
10940					if ( status < 0 ) {
10941						status = 0;
10942					}
10943				}
10944			}
10945
10946			// Set data for the fake xhr object
10947			jqXHR.status = status;
10948			jqXHR.statusText = ( nativeStatusText || statusText ) + "";
10949
10950			// Success/Error
10951			if ( isSuccess ) {
10952				deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
10953			} else {
10954				deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
10955			}
10956
10957			// Status-dependent callbacks
10958			jqXHR.statusCode( statusCode );
10959			statusCode = undefined;
10960
10961			if ( fireGlobals ) {
10962				globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
10963					[ jqXHR, s, isSuccess ? success : error ] );
10964			}
10965
10966			// Complete
10967			completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
10968
10969			if ( fireGlobals ) {
10970				globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
10971
10972				// Handle the global AJAX counter
10973				if ( !( --jQuery.active ) ) {
10974					jQuery.event.trigger( "ajaxStop" );
10975				}
10976			}
10977		}
10978
10979		return jqXHR;
10980	},
10981
10982	getJSON: function( url, data, callback ) {
10983		return jQuery.get( url, data, callback, "json" );
10984	},
10985
10986	getScript: function( url, callback ) {
10987		return jQuery.get( url, undefined, callback, "script" );
10988	}
10989} );
10990
10991jQuery.each( [ "get", "post" ], function( _i, method ) {
10992	jQuery[ method ] = function( url, data, callback, type ) {
10993
10994		// Shift arguments if data argument was omitted
10995		if ( isFunction( data ) ) {
10996			type = type || callback;
10997			callback = data;
10998			data = undefined;
10999		}
11000
11001		// The url can be an options object (which then must have .url)
11002		return jQuery.ajax( jQuery.extend( {
11003			url: url,
11004			type: method,
11005			dataType: type,
11006			data: data,
11007			success: callback
11008		}, jQuery.isPlainObject( url ) && url ) );
11009	};
11010} );
11011
11012jQuery.ajaxPrefilter( function( s ) {
11013	var i;
11014	for ( i in s.headers ) {
11015		if ( i.toLowerCase() === "content-type" ) {
11016			s.contentType = s.headers[ i ] || "";
11017		}
11018	}
11019} );
11020
11021
11022jQuery._evalUrl = function( url, options, doc ) {
11023	return jQuery.ajax( {
11024		url: url,
11025
11026		// Make this explicit, since user can override this through ajaxSetup (trac-11264)
11027		type: "GET",
11028		dataType: "script",
11029		cache: true,
11030		async: false,
11031		global: false,
11032
11033		// Only evaluate the response if it is successful (gh-4126)
11034		// dataFilter is not invoked for failure responses, so using it instead
11035		// of the default converter is kludgy but it works.
11036		converters: {
11037			"text script": function() {}
11038		},
11039		dataFilter: function( response ) {
11040			jQuery.globalEval( response, options, doc );
11041		}
11042	} );
11043};
11044
11045
11046jQuery.fn.extend( {
11047	wrapAll: function( html ) {
11048		var wrap;
11049
11050		if ( this[ 0 ] ) {
11051			if ( isFunction( html ) ) {
11052				html = html.call( this[ 0 ] );
11053			}
11054
11055			// The elements to wrap the target around
11056			wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
11057
11058			if ( this[ 0 ].parentNode ) {
11059				wrap.insertBefore( this[ 0 ] );
11060			}
11061
11062			wrap.map( function() {
11063				var elem = this;
11064
11065				while ( elem.firstElementChild ) {
11066					elem = elem.firstElementChild;
11067				}
11068
11069				return elem;
11070			} ).append( this );
11071		}
11072
11073		return this;
11074	},
11075
11076	wrapInner: function( html ) {
11077		if ( isFunction( html ) ) {
11078			return this.each( function( i ) {
11079				jQuery( this ).wrapInner( html.call( this, i ) );
11080			} );
11081		}
11082
11083		return this.each( function() {
11084			var self = jQuery( this ),
11085				contents = self.contents();
11086
11087			if ( contents.length ) {
11088				contents.wrapAll( html );
11089
11090			} else {
11091				self.append( html );
11092			}
11093		} );
11094	},
11095
11096	wrap: function( html ) {
11097		var htmlIsFunction = isFunction( html );
11098
11099		return this.each( function( i ) {
11100			jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
11101		} );
11102	},
11103
11104	unwrap: function( selector ) {
11105		this.parent( selector ).not( "body" ).each( function() {
11106			jQuery( this ).replaceWith( this.childNodes );
11107		} );
11108		return this;
11109	}
11110} );
11111
11112
11113jQuery.expr.pseudos.hidden = function( elem ) {
11114	return !jQuery.expr.pseudos.visible( elem );
11115};
11116jQuery.expr.pseudos.visible = function( elem ) {
11117	return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
11118};
11119
11120
11121
11122
11123jQuery.ajaxSettings.xhr = function() {
11124	try {
11125		return new window.XMLHttpRequest();
11126	} catch ( e ) {}
11127};
11128
11129var xhrSuccessStatus = {
11130
11131		// File protocol always yields status code 0, assume 200
11132		0: 200,
11133
11134		// Support: IE <=9 only
11135		// trac-1450: sometimes IE returns 1223 when it should be 204
11136		1223: 204
11137	},
11138	xhrSupported = jQuery.ajaxSettings.xhr();
11139
11140support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
11141support.ajax = xhrSupported = !!xhrSupported;
11142
11143jQuery.ajaxTransport( function( options ) {
11144	var callback, errorCallback;
11145
11146	// Cross domain only allowed if supported through XMLHttpRequest
11147	if ( support.cors || xhrSupported && !options.crossDomain ) {
11148		return {
11149			send: function( headers, complete ) {
11150				var i,
11151					xhr = options.xhr();
11152
11153				xhr.open(
11154					options.type,
11155					options.url,
11156					options.async,
11157					options.username,
11158					options.password
11159				);
11160
11161				// Apply custom fields if provided
11162				if ( options.xhrFields ) {
11163					for ( i in options.xhrFields ) {
11164						xhr[ i ] = options.xhrFields[ i ];
11165					}
11166				}
11167
11168				// Override mime type if needed
11169				if ( options.mimeType && xhr.overrideMimeType ) {
11170					xhr.overrideMimeType( options.mimeType );
11171				}
11172
11173				// X-Requested-With header
11174				// For cross-domain requests, seeing as conditions for a preflight are
11175				// akin to a jigsaw puzzle, we simply never set it to be sure.
11176				// (it can always be set on a per-request basis or even using ajaxSetup)
11177				// For same-domain requests, won't change header if already provided.
11178				if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
11179					headers[ "X-Requested-With" ] = "XMLHttpRequest";
11180				}
11181
11182				// Set headers
11183				for ( i in headers ) {
11184					xhr.setRequestHeader( i, headers[ i ] );
11185				}
11186
11187				// Callback
11188				callback = function( type ) {
11189					return function() {
11190						if ( callback ) {
11191							callback = errorCallback = xhr.onload =
11192								xhr.onerror = xhr.onabort = xhr.ontimeout =
11193									xhr.onreadystatechange = null;
11194
11195							if ( type === "abort" ) {
11196								xhr.abort();
11197							} else if ( type === "error" ) {
11198
11199								// Support: IE <=9 only
11200								// On a manual native abort, IE9 throws
11201								// errors on any property access that is not readyState
11202								if ( typeof xhr.status !== "number" ) {
11203									complete( 0, "error" );
11204								} else {
11205									complete(
11206
11207										// File: protocol always yields status 0; see trac-8605, trac-14207
11208										xhr.status,
11209										xhr.statusText
11210									);
11211								}
11212							} else {
11213								complete(
11214									xhrSuccessStatus[ xhr.status ] || xhr.status,
11215									xhr.statusText,
11216
11217									// Support: IE <=9 only
11218									// IE9 has no XHR2 but throws on binary (trac-11426)
11219									// For XHR2 non-text, let the caller handle it (gh-2498)
11220									( xhr.responseType || "text" ) !== "text"  ||
11221									typeof xhr.responseText !== "string" ?
11222										{ binary: xhr.response } :
11223										{ text: xhr.responseText },
11224									xhr.getAllResponseHeaders()
11225								);
11226							}
11227						}
11228					};
11229				};
11230
11231				// Listen to events
11232				xhr.onload = callback();
11233				errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
11234
11235				// Support: IE 9 only
11236				// Use onreadystatechange to replace onabort
11237				// to handle uncaught aborts
11238				if ( xhr.onabort !== undefined ) {
11239					xhr.onabort = errorCallback;
11240				} else {
11241					xhr.onreadystatechange = function() {
11242
11243						// Check readyState before timeout as it changes
11244						if ( xhr.readyState === 4 ) {
11245
11246							// Allow onerror to be called first,
11247							// but that will not handle a native abort
11248							// Also, save errorCallback to a variable
11249							// as xhr.onerror cannot be accessed
11250							window.setTimeout( function() {
11251								if ( callback ) {
11252									errorCallback();
11253								}
11254							} );
11255						}
11256					};
11257				}
11258
11259				// Create the abort callback
11260				callback = callback( "abort" );
11261
11262				try {
11263
11264					// Do send the request (this may raise an exception)
11265					xhr.send( options.hasContent && options.data || null );
11266				} catch ( e ) {
11267
11268					// trac-14683: Only rethrow if this hasn't been notified as an error yet
11269					if ( callback ) {
11270						throw e;
11271					}
11272				}
11273			},
11274
11275			abort: function() {
11276				if ( callback ) {
11277					callback();
11278				}
11279			}
11280		};
11281	}
11282} );
11283
11284
11285
11286
11287// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
11288jQuery.ajaxPrefilter( function( s ) {
11289	if ( s.crossDomain ) {
11290		s.contents.script = false;
11291	}
11292} );
11293
11294// Install script dataType
11295jQuery.ajaxSetup( {
11296	accepts: {
11297		script: "text/javascript, application/javascript, " +
11298			"application/ecmascript, application/x-ecmascript"
11299	},
11300	contents: {
11301		script: /\b(?:java|ecma)script\b/
11302	},
11303	converters: {
11304		"text script": function( text ) {
11305			jQuery.globalEval( text );
11306			return text;
11307		}
11308	}
11309} );
11310
11311// Handle cache's special case and crossDomain
11312jQuery.ajaxPrefilter( "script", function( s ) {
11313	if ( s.cache === undefined ) {
11314		s.cache = false;
11315	}
11316	if ( s.crossDomain ) {
11317		s.type = "GET";
11318	}
11319} );
11320
11321// Bind script tag hack transport
11322jQuery.ajaxTransport( "script", function( s ) {
11323
11324	// This transport only deals with cross domain or forced-by-attrs requests
11325	if ( s.crossDomain || s.scriptAttrs ) {
11326		var script, callback;
11327		return {
11328			send: function( _, complete ) {
11329				script = jQuery( "<script>" )
11330					.attr( s.scriptAttrs || {} )
11331					.prop( { charset: s.scriptCharset, src: s.url } )
11332					.on( "load error", callback = function( evt ) {
11333						script.remove();
11334						callback = null;
11335						if ( evt ) {
11336							complete( evt.type === "error" ? 404 : 200, evt.type );
11337						}
11338					} );
11339
11340				// Use native DOM manipulation to avoid our domManip AJAX trickery
11341				document.head.appendChild( script[ 0 ] );
11342			},
11343			abort: function() {
11344				if ( callback ) {
11345					callback();
11346				}
11347			}
11348		};
11349	}
11350} );
11351
11352
11353
11354
11355var oldCallbacks = [],
11356	rjsonp = /(=)\?(?=&|$)|\?\?/;
11357
11358// Default jsonp settings
11359jQuery.ajaxSetup( {
11360	jsonp: "callback",
11361	jsonpCallback: function() {
11362		var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce.guid++ ) );
11363		this[ callback ] = true;
11364		return callback;
11365	}
11366} );
11367
11368// Detect, normalize options and install callbacks for jsonp requests
11369jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
11370
11371	var callbackName, overwritten, responseContainer,
11372		jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
11373			"url" :
11374			typeof s.data === "string" &&
11375				( s.contentType || "" )
11376					.indexOf( "application/x-www-form-urlencoded" ) === 0 &&
11377				rjsonp.test( s.data ) && "data"
11378		);
11379
11380	// Handle iff the expected data type is "jsonp" or we have a parameter to set
11381	if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
11382
11383		// Get callback name, remembering preexisting value associated with it
11384		callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
11385			s.jsonpCallback() :
11386			s.jsonpCallback;
11387
11388		// Insert callback into url or form data
11389		if ( jsonProp ) {
11390			s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
11391		} else if ( s.jsonp !== false ) {
11392			s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
11393		}
11394
11395		// Use data converter to retrieve json after script execution
vendor: 8,362 bytes, lines 11396-11707
11396		s.converters[ "script json" ] = function() {
11397			if ( !responseContainer ) {
11398				jQuery.error( callbackName + " was not called" );
11399			}
11400			return responseContainer[ 0 ];
11401		};
11402
11403		// Force json dataType
11404		s.dataTypes[ 0 ] = "json";
11405
11406		// Install callback
11407		overwritten = window[ callbackName ];
11408		window[ callbackName ] = function() {
11409			responseContainer = arguments;
11410		};
11411
11412		// Clean-up function (fires after converters)
11413		jqXHR.always( function() {
11414
11415			// If previous value didn't exist - remove it
11416			if ( overwritten === undefined ) {
11417				jQuery( window ).removeProp( callbackName );
11418
11419			// Otherwise restore preexisting value
11420			} else {
11421				window[ callbackName ] = overwritten;
11422			}
11423
11424			// Save back as free
11425			if ( s[ callbackName ] ) {
11426
11427				// Make sure that re-using the options doesn't screw things around
11428				s.jsonpCallback = originalSettings.jsonpCallback;
11429
11430				// Save the callback name for future use
11431				oldCallbacks.push( callbackName );
11432			}
11433
11434			// Call if it was a function and we have a response
11435			if ( responseContainer && isFunction( overwritten ) ) {
11436				overwritten( responseContainer[ 0 ] );
11437			}
11438
11439			responseContainer = overwritten = undefined;
11440		} );
11441
11442		// Delegate to script
11443		return "script";
11444	}
11445} );
11446
11447
11448
11449
11450// Support: Safari 8 only
11451// In Safari 8 documents created via document.implementation.createHTMLDocument
11452// collapse sibling forms: the second one becomes a child of the first one.
11453// Because of that, this security measure has to be disabled in Safari 8.
11454// https://bugs.webkit.org/show_bug.cgi?id=137337
11455support.createHTMLDocument = ( function() {
11456	var body = document.implementation.createHTMLDocument( "" ).body;
11457	body.innerHTML = "<form></form><form></form>";
11458	return body.childNodes.length === 2;
11459} )();
11460
11461
11462// Argument "data" should be string of html
11463// context (optional): If specified, the fragment will be created in this context,
11464// defaults to document
11465// keepScripts (optional): If true, will include scripts passed in the html string
11466jQuery.parseHTML = function( data, context, keepScripts ) {
11467	if ( typeof data !== "string" ) {
11468		return [];
11469	}
11470	if ( typeof context === "boolean" ) {
11471		keepScripts = context;
11472		context = false;
11473	}
11474
11475	var base, parsed, scripts;
11476
11477	if ( !context ) {
11478
11479		// Stop scripts or inline event handlers from being executed immediately
11480		// by using document.implementation
11481		if ( support.createHTMLDocument ) {
11482			context = document.implementation.createHTMLDocument( "" );
11483
11484			// Set the base href for the created document
11485			// so any parsed elements with URLs
11486			// are based on the document's URL (gh-2965)
11487			base = context.createElement( "base" );
11488			base.href = document.location.href;
11489			context.head.appendChild( base );
11490		} else {
11491			context = document;
11492		}
11493	}
11494
11495	parsed = rsingleTag.exec( data );
11496	scripts = !keepScripts && [];
11497
11498	// Single tag
11499	if ( parsed ) {
11500		return [ context.createElement( parsed[ 1 ] ) ];
11501	}
11502
11503	parsed = buildFragment( [ data ], context, scripts );
11504
11505	if ( scripts && scripts.length ) {
11506		jQuery( scripts ).remove();
11507	}
11508
11509	return jQuery.merge( [], parsed.childNodes );
11510};
11511
11512
11513/**
11514 * Load a url into a page
11515 */
11516jQuery.fn.load = function( url, params, callback ) {
11517	var selector, type, response,
11518		self = this,
11519		off = url.indexOf( " " );
11520
11521	if ( off > -1 ) {
11522		selector = stripAndCollapse( url.slice( off ) );
11523		url = url.slice( 0, off );
11524	}
11525
11526	// If it's a function
11527	if ( isFunction( params ) ) {
11528
11529		// We assume that it's the callback
11530		callback = params;
11531		params = undefined;
11532
11533	// Otherwise, build a param string
11534	} else if ( params && typeof params === "object" ) {
11535		type = "POST";
11536	}
11537
11538	// If we have elements to modify, make the request
11539	if ( self.length > 0 ) {
11540		jQuery.ajax( {
11541			url: url,
11542
11543			// If "type" variable is undefined, then "GET" method will be used.
11544			// Make value of this field explicit since
11545			// user can override it through ajaxSetup method
11546			type: type || "GET",
11547			dataType: "html",
11548			data: params
11549		} ).done( function( responseText ) {
11550
11551			// Save response for use in complete callback
11552			response = arguments;
11553
11554			self.html( selector ?
11555
11556				// If a selector was specified, locate the right elements in a dummy div
11557				// Exclude scripts to avoid IE 'Permission Denied' errors
11558				jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
11559
11560				// Otherwise use the full result
11561				responseText );
11562
11563		// If the request succeeds, this function gets "data", "status", "jqXHR"
11564		// but they are ignored because response was set above.
11565		// If it fails, this function gets "jqXHR", "status", "error"
11566		} ).always( callback && function( jqXHR, status ) {
11567			self.each( function() {
11568				callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
11569			} );
11570		} );
11571	}
11572
11573	return this;
11574};
11575
11576
11577
11578
11579jQuery.expr.pseudos.animated = function( elem ) {
11580	return jQuery.grep( jQuery.timers, function( fn ) {
11581		return elem === fn.elem;
11582	} ).length;
11583};
11584
11585
11586
11587
11588jQuery.offset = {
11589	setOffset: function( elem, options, i ) {
11590		var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
11591			position = jQuery.css( elem, "position" ),
11592			curElem = jQuery( elem ),
11593			props = {};
11594
11595		// Set position first, in-case top/left are set even on static elem
11596		if ( position === "static" ) {
11597			elem.style.position = "relative";
11598		}
11599
11600		curOffset = curElem.offset();
11601		curCSSTop = jQuery.css( elem, "top" );
11602		curCSSLeft = jQuery.css( elem, "left" );
11603		calculatePosition = ( position === "absolute" || position === "fixed" ) &&
11604			( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
11605
11606		// Need to be able to calculate position if either
11607		// top or left is auto and position is either absolute or fixed
11608		if ( calculatePosition ) {
11609			curPosition = curElem.position();
11610			curTop = curPosition.top;
11611			curLeft = curPosition.left;
11612
11613		} else {
11614			curTop = parseFloat( curCSSTop ) || 0;
11615			curLeft = parseFloat( curCSSLeft ) || 0;
11616		}
11617
11618		if ( isFunction( options ) ) {
11619
11620			// Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
11621			options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
11622		}
11623
11624		if ( options.top != null ) {
11625			props.top = ( options.top - curOffset.top ) + curTop;
11626		}
11627		if ( options.left != null ) {
11628			props.left = ( options.left - curOffset.left ) + curLeft;
11629		}
11630
11631		if ( "using" in options ) {
11632			options.using.call( elem, props );
11633
11634		} else {
11635			curElem.css( props );
11636		}
11637	}
11638};
11639
11640jQuery.fn.extend( {
11641
11642	// offset() relates an element's border box to the document origin
11643	offset: function( options ) {
11644
11645		// Preserve chaining for setter
11646		if ( arguments.length ) {
11647			return options === undefined ?
11648				this :
11649				this.each( function( i ) {
11650					jQuery.offset.setOffset( this, options, i );
11651				} );
11652		}
11653
11654		var rect, win,
11655			elem = this[ 0 ];
11656
11657		if ( !elem ) {
11658			return;
11659		}
11660
11661		// Return zeros for disconnected and hidden (display: none) elements (gh-2310)
11662		// Support: IE <=11 only
11663		// Running getBoundingClientRect on a
11664		// disconnected node in IE throws an error
11665		if ( !elem.getClientRects().length ) {
11666			return { top: 0, left: 0 };
11667		}
11668
11669		// Get document-relative position by adding viewport scroll to viewport-relative gBCR
11670		rect = elem.getBoundingClientRect();
11671		win = elem.ownerDocument.defaultView;
11672		return {
11673			top: rect.top + win.pageYOffset,
11674			left: rect.left + win.pageXOffset
11675		};
11676	},
11677
11678	// position() relates an element's margin box to its offset parent's padding box
11679	// This corresponds to the behavior of CSS absolute positioning
11680	position: function() {
11681		if ( !this[ 0 ] ) {
11682			return;
11683		}
11684
11685		var offsetParent, offset, doc,
11686			elem = this[ 0 ],
11687			parentOffset = { top: 0, left: 0 };
11688
11689		// position:fixed elements are offset from the viewport, which itself always has zero offset
11690		if ( jQuery.css( elem, "position" ) === "fixed" ) {
11691
11692			// Assume position:fixed implies availability of getBoundingClientRect
11693			offset = elem.getBoundingClientRect();
11694
11695		} else {
11696			offset = this.offset();
11697
11698			// Account for the *real* offset parent, which can be the document or its root element
11699			// when a statically positioned element is identified
11700			doc = elem.ownerDocument;
11701			offsetParent = elem.offsetParent || doc.documentElement;
11702			while ( offsetParent &&
11703				( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
11704				jQuery.css( offsetParent, "position" ) === "static" ) {
11705
11706				offsetParent = offsetParent.parentNode;
11707			}
vendor: 9,677 bytes, lines 11708-12045
11708			if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
11709
11710				// Incorporate borders into its offset, since they are outside its content origin
11711				parentOffset = jQuery( offsetParent ).offset();
11712				parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
11713				parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
11714			}
11715		}
11716
11717		// Subtract parent offsets and element margins
11718		return {
11719			top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
11720			left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
11721		};
11722	},
11723
11724	// This method will return documentElement in the following cases:
11725	// 1) For the element inside the iframe without offsetParent, this method will return
11726	//    documentElement of the parent window
11727	// 2) For the hidden or detached element
11728	// 3) For body or html element, i.e. in case of the html node - it will return itself
11729	//
11730	// but those exceptions were never presented as a real life use-cases
11731	// and might be considered as more preferable results.
11732	//
11733	// This logic, however, is not guaranteed and can change at any point in the future
11734	offsetParent: function() {
11735		return this.map( function() {
11736			var offsetParent = this.offsetParent;
11737
11738			while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
11739				offsetParent = offsetParent.offsetParent;
11740			}
11741
11742			return offsetParent || documentElement;
11743		} );
11744	}
11745} );
11746
11747// Create scrollLeft and scrollTop methods
11748jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
11749	var top = "pageYOffset" === prop;
11750
11751	jQuery.fn[ method ] = function( val ) {
11752		return access( this, function( elem, method, val ) {
11753
11754			// Coalesce documents and windows
11755			var win;
11756			if ( isWindow( elem ) ) {
11757				win = elem;
11758			} else if ( elem.nodeType === 9 ) {
11759				win = elem.defaultView;
11760			}
11761
11762			if ( val === undefined ) {
11763				return win ? win[ prop ] : elem[ method ];
11764			}
11765
11766			if ( win ) {
11767				win.scrollTo(
11768					!top ? val : win.pageXOffset,
11769					top ? val : win.pageYOffset
11770				);
11771
11772			} else {
11773				elem[ method ] = val;
11774			}
11775		}, method, val, arguments.length );
11776	};
11777} );
11778
11779// Support: Safari <=7 - 9.1, Chrome <=37 - 49
11780// Add the top/left cssHooks using jQuery.fn.position
11781// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
11782// Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
11783// getComputedStyle returns percent when specified for top/left/bottom/right;
11784// rather than make the css module depend on the offset module, just check for it here
11785jQuery.each( [ "top", "left" ], function( _i, prop ) {
11786	jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
11787		function( elem, computed ) {
11788			if ( computed ) {
11789				computed = curCSS( elem, prop );
11790
11791				// If curCSS returns percentage, fallback to offset
11792				return rnumnonpx.test( computed ) ?
11793					jQuery( elem ).position()[ prop ] + "px" :
11794					computed;
11795			}
11796		}
11797	);
11798} );
11799
11800
11801// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
11802jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
11803	jQuery.each( {
11804		padding: "inner" + name,
11805		content: type,
11806		"": "outer" + name
11807	}, function( defaultExtra, funcName ) {
11808
11809		// Margin is only for outerHeight, outerWidth
11810		jQuery.fn[ funcName ] = function( margin, value ) {
11811			var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
11812				extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
11813
11814			return access( this, function( elem, type, value ) {
11815				var doc;
11816
11817				if ( isWindow( elem ) ) {
11818
11819					// $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
11820					return funcName.indexOf( "outer" ) === 0 ?
11821						elem[ "inner" + name ] :
11822						elem.document.documentElement[ "client" + name ];
11823				}
11824
11825				// Get document width or height
11826				if ( elem.nodeType === 9 ) {
11827					doc = elem.documentElement;
11828
11829					// Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
11830					// whichever is greatest
11831					return Math.max(
11832						elem.body[ "scroll" + name ], doc[ "scroll" + name ],
11833						elem.body[ "offset" + name ], doc[ "offset" + name ],
11834						doc[ "client" + name ]
11835					);
11836				}
11837
11838				return value === undefined ?
11839
11840					// Get width or height on the element, requesting but not forcing parseFloat
11841					jQuery.css( elem, type, extra ) :
11842
11843					// Set width or height on the element
11844					jQuery.style( elem, type, value, extra );
11845			}, type, chainable ? margin : undefined, chainable );
11846		};
11847	} );
11848} );
11849
11850
11851jQuery.each( [
11852	"ajaxStart",
11853	"ajaxStop",
11854	"ajaxComplete",
11855	"ajaxError",
11856	"ajaxSuccess",
11857	"ajaxSend"
11858], function( _i, type ) {
11859	jQuery.fn[ type ] = function( fn ) {
11860		return this.on( type, fn );
11861	};
11862} );
11863
11864
11865
11866
11867jQuery.fn.extend( {
11868
11869	bind: function( types, data, fn ) {
11870		return this.on( types, null, data, fn );
11871	},
11872	unbind: function( types, fn ) {
11873		return this.off( types, null, fn );
11874	},
11875
11876	delegate: function( selector, types, data, fn ) {
11877		return this.on( types, selector, data, fn );
11878	},
11879	undelegate: function( selector, types, fn ) {
11880
11881		// ( namespace ) or ( selector, types [, fn] )
11882		return arguments.length === 1 ?
11883			this.off( selector, "**" ) :
11884			this.off( types, selector || "**", fn );
11885	},
11886
11887	hover: function( fnOver, fnOut ) {
11888		return this
11889			.on( "mouseenter", fnOver )
11890			.on( "mouseleave", fnOut || fnOver );
11891	}
11892} );
11893
11894jQuery.each(
11895	( "blur focus focusin focusout resize scroll click dblclick " +
11896	"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
11897	"change select submit keydown keypress keyup contextmenu" ).split( " " ),
11898	function( _i, name ) {
11899
11900		// Handle event binding
11901		jQuery.fn[ name ] = function( data, fn ) {
11902			return arguments.length > 0 ?
11903				this.on( name, null, data, fn ) :
11904				this.trigger( name );
11905		};
11906	}
11907);
11908
11909
11910
11911
11912// Support: Android <=4.0 only
11913// Make sure we trim BOM and NBSP
11914// Require that the "whitespace run" starts from a non-whitespace
11915// to avoid O(N^2) behavior when the engine would try matching "\s+$" at each space position.
11916var rtrim = /^[\s\uFEFF\xA0]+|([^\s\uFEFF\xA0])[\s\uFEFF\xA0]+$/g;
11917
11918// Bind a function to a context, optionally partially applying any
11919// arguments.
11920// jQuery.proxy is deprecated to promote standards (specifically Function#bind)
11921// However, it is not slated for removal any time soon
11922jQuery.proxy = function( fn, context ) {
11923	var tmp, args, proxy;
11924
11925	if ( typeof context === "string" ) {
11926		tmp = fn[ context ];
11927		context = fn;
11928		fn = tmp;
11929	}
11930
11931	// Quick check to determine if target is callable, in the spec
11932	// this throws a TypeError, but we will just return undefined.
11933	if ( !isFunction( fn ) ) {
11934		return undefined;
11935	}
11936
11937	// Simulated bind
11938	args = slice.call( arguments, 2 );
11939	proxy = function() {
11940		return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
11941	};
11942
11943	// Set the guid of unique handler to the same of original handler, so it can be removed
11944	proxy.guid = fn.guid = fn.guid || jQuery.guid++;
11945
11946	return proxy;
11947};
11948
11949jQuery.holdReady = function( hold ) {
11950	if ( hold ) {
11951		jQuery.readyWait++;
11952	} else {
11953		jQuery.ready( true );
11954	}
11955};
11956jQuery.isArray = Array.isArray;
11957jQuery.parseJSON = JSON.parse;
11958jQuery.nodeName = nodeName;
11959jQuery.isFunction = isFunction;
11960jQuery.isWindow = isWindow;
11961jQuery.camelCase = camelCase;
11962jQuery.type = toType;
11963
11964jQuery.now = Date.now;
11965
11966jQuery.isNumeric = function( obj ) {
11967
11968	// As of jQuery 3.0, isNumeric is limited to
11969	// strings and numbers (primitives or objects)
11970	// that can be coerced to finite numbers (gh-2662)
11971	var type = jQuery.type( obj );
11972	return ( type === "number" || type === "string" ) &&
11973
11974		// parseFloat NaNs numeric-cast false positives ("")
11975		// ...but misinterprets leading-number strings, particularly hex literals ("0x...")
11976		// subtraction forces infinities to NaN
11977		!isNaN( obj - parseFloat( obj ) );
11978};
11979
11980jQuery.trim = function( text ) {
11981	return text == null ?
11982		"" :
11983		( text + "" ).replace( rtrim, "$1" );
11984};
11985
11986
11987
11988// Register as a named AMD module, since jQuery can be concatenated with other
11989// files that may use define, but not via a proper concatenation script that
11990// understands anonymous AMD modules. A named AMD is safest and most robust
11991// way to register. Lowercase jquery is used because AMD module names are
11992// derived from file names, and jQuery is normally delivered in a lowercase
11993// file name. Do this after creating the global so that if an AMD module wants
11994// to call noConflict to hide this version of jQuery, it will work.
11995
11996// Note that for maximum portability, libraries that are not jQuery should
11997// declare themselves as anonymous modules, and avoid setting a global if an
11998// AMD loader is present. jQuery is a special case. For more information, see
11999// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
12000
12001if ( true ) {
12002	!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
12003		return jQuery;
12004	}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
12005		__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
12006}
12007
12008
12009
12010
12011var
12012
12013	// Map over jQuery in case of overwrite
12014	_jQuery = window.jQuery,
12015
12016	// Map over the $ in case of overwrite
12017	_$ = window.$;
12018
12019jQuery.noConflict = function( deep ) {
12020	if ( window.$ === jQuery ) {
12021		window.$ = _$;
12022	}
12023
12024	if ( deep && window.jQuery === jQuery ) {
12025		window.jQuery = _jQuery;
12026	}
12027
12028	return jQuery;
12029};
12030
12031// Expose jQuery and $ identifiers, even in AMD
12032// (trac-7102#comment:10, https://github.com/jquery/jquery/pull/557)
12033// and CommonJS for browser emulators (trac-13566)
12034if ( typeof noGlobal === "undefined" ) {
12035	window.jQuery = window.$ = jQuery;
12036}
12037
12038
12039
12040
12041return jQuery;
12042} );
12043
12044
12045/***/ }
12045,
12046
12047/***/ "./node_modules/once/once.js"
12048/*!***********************************!*\
12049  !*** ./node_modules/once/once.js ***!
12050  \***********************************/
12051(module, __unused_webpack_exports, __webpack_require__) {
12052
12053var wrappy = __webpack_require__(/*! wrappy */ "./node_modules/wrappy/wrappy.js")
12054module.exports = wrappy(once)
12055module.exports.strict = wrappy(onceStrict)
12056
12057once.proto = once(function () {
12058  Object.defineProperty(Function.prototype, 'once', {
12059    value: function () {
12060      return once(this)
12061    },
12062    configurable: true
12063  })
12064
12065  Object.defineProperty(Function.prototype, 'onceStrict', {
12066    value: function () {
12067      return onceStrict(this)
12068    },
12069    configurable: true
12070  })
12071})
12072
12073function once (fn) {
12074  var f = function () {
12075    if (f.called) return f.value
12076    f.called = true
12077    return f.value = fn.apply(this, arguments)
12078  }
12079  f.called = false
12080  return f
12081}
12082
12083function onceStrict (fn) {
12084  var f = function () {
12085    if (f.called)
12086      throw new Error(f.onceError)
12087    f.called = true
12088    return f.value = fn.apply(this, arguments)
12089  }
12090  var name = fn.name || 'Function wrapped with `once`'
12091  f.onceError = name + " shouldn't be called more than once"
12092  f.called = false
12093  return f
12094}
12095
12096
12097/***/ },
12098
12099/***/ "./node_modules/pdfjs-dist/build/pdf.js"
12100/*!**********************************************!*\
12101  !*** ./node_modules/pdfjs-dist/build/pdf.js ***!
12102  \**********************************************/
12103(module, __unused_webpack_exports, __webpack_require__) {
12104
12105/**
12106 * @licstart The following is the entire license notice for the
12107 * JavaScript code in this page
12108 *
12109 * Copyright 2023 Mozilla Foundation
12110 *
12111 * Licensed under the Apache License, Version 2.0 (the "License");
12112 * you may not use this file except in compliance with the License.
12113 * You may obtain a copy of the License at
12114 *
12115 *     http://www.apache.org/licenses/LICENSE-2.0
12116 *
12117 * Unless required by applicable law or agreed to in writing, software
12118 * distributed under the License is distributed on an "AS IS" BASIS,
12119 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12120 * See the License for the specific language governing permissions and
12121 * limitations under the License.
12122 *
12123 * @licend The above is the entire license notice for the
12124 * JavaScript code in this page
12125 */
12126
12127(function webpackUniversalModuleDefinition(root, factory) {
12128	if(true)
12129		module.exports = root.pdfjsLib = factory();
12130	else // removed by dead control flow
12131{}
12132})(globalThis, () => {
12133return /******/ (() => { // webpackBootstrap
12134/******/ 	"use strict";
12135/******/ 	var __webpack_modules__ = ([
12136/* 0 */,
12137/* 1 */
12138/***/ ((__unused_webpack_module, exports) => {
12139
12140
12141
12142Object.defineProperty(exports, "__esModule", ({
12143  value: true
12144}));
12145exports.VerbosityLevel = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.TextRenderingMode = exports.RenderingIntentFlag = exports.PromiseCapability = exports.PermissionFlag = exports.PasswordResponses = exports.PasswordException = exports.PageActionEventType = exports.OPS = exports.MissingPDFException = exports.MAX_IMAGE_SIZE_TO_CACHE = exports.LINE_FACTOR = exports.LINE_DESCENT_FACTOR = exports.InvalidPDFException = exports.ImageKind = exports.IDENTITY_MATRIX = exports.FormatError = exports.FeatureTest = exports.FONT_IDENTITY_MATRIX = exports.DocumentActionEventType = exports.CMapCompressionType = exports.BaseException = exports.BASELINE_FACTOR = exports.AnnotationType = exports.AnnotationReplyType = exports.AnnotationPrefix = exports.AnnotationMode = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationEditorType = exports.AnnotationEditorPrefix = exports.AnnotationEditorParamsType = exports.AnnotationBorderStyleType = exports.AnnotationActionEventType = exports.AbortException = void 0;
12146exports.assert = assert;
12147exports.bytesToString = bytesToString;
12148exports.createValidAbsoluteUrl = createValidAbsoluteUrl;
12149exports.getModificationDate = getModificationDate;
12150exports.getUuid = getUuid;
12151exports.getVerbosityLevel = getVerbosityLevel;
12152exports.info = info;
12153exports.isArrayBuffer = isArrayBuffer;
12154exports.isArrayEqual = isArrayEqual;
12155exports.isNodeJS = void 0;
12156exports.normalizeUnicode = normalizeUnicode;
12157exports.objectFromMap = objectFromMap;
12158exports.objectSize = objectSize;
12159exports.setVerbosityLevel = setVerbosityLevel;
12160exports.shadow = shadow;
12161exports.string32 = string32;
12162exports.stringToBytes = stringToBytes;
12163exports.stringToPDFString = stringToPDFString;
12164exports.stringToUTF8String = stringToUTF8String;
12165exports.unreachable = unreachable;
12166exports.utf8StringToString = utf8StringToString;
12167exports.warn = warn;
12168const isNodeJS = typeof process === "object" && process + "" === "[object process]" && !process.versions.nw && !(process.versions.electron && process.type && process.type !== "browser");
vendor: 18,729 bytes, lines 12169-12856
12169exports.isNodeJS = isNodeJS;
12170const IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
12171exports.IDENTITY_MATRIX = IDENTITY_MATRIX;
12172const FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];
12173exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX;
12174const MAX_IMAGE_SIZE_TO_CACHE = 10e6;
12175exports.MAX_IMAGE_SIZE_TO_CACHE = MAX_IMAGE_SIZE_TO_CACHE;
12176const LINE_FACTOR = 1.35;
12177exports.LINE_FACTOR = LINE_FACTOR;
12178const LINE_DESCENT_FACTOR = 0.35;
12179exports.LINE_DESCENT_FACTOR = LINE_DESCENT_FACTOR;
12180const BASELINE_FACTOR = LINE_DESCENT_FACTOR / LINE_FACTOR;
12181exports.BASELINE_FACTOR = BASELINE_FACTOR;
12182const RenderingIntentFlag = {
12183  ANY: 0x01,
12184  DISPLAY: 0x02,
12185  PRINT: 0x04,
12186  SAVE: 0x08,
12187  ANNOTATIONS_FORMS: 0x10,
12188  ANNOTATIONS_STORAGE: 0x20,
12189  ANNOTATIONS_DISABLE: 0x40,
12190  OPLIST: 0x100
12191};
12192exports.RenderingIntentFlag = RenderingIntentFlag;
12193const AnnotationMode = {
12194  DISABLE: 0,
12195  ENABLE: 1,
12196  ENABLE_FORMS: 2,
12197  ENABLE_STORAGE: 3
12198};
12199exports.AnnotationMode = AnnotationMode;
12200const AnnotationEditorPrefix = "pdfjs_internal_editor_";
12201exports.AnnotationEditorPrefix = AnnotationEditorPrefix;
12202const AnnotationEditorType = {
12203  DISABLE: -1,
12204  NONE: 0,
12205  FREETEXT: 3,
12206  STAMP: 13,
12207  INK: 15
12208};
12209exports.AnnotationEditorType = AnnotationEditorType;
12210const AnnotationEditorParamsType = {
12211  RESIZE: 1,
12212  CREATE: 2,
12213  FREETEXT_SIZE: 11,
12214  FREETEXT_COLOR: 12,
12215  FREETEXT_OPACITY: 13,
12216  INK_COLOR: 21,
12217  INK_THICKNESS: 22,
12218  INK_OPACITY: 23
12219};
12220exports.AnnotationEditorParamsType = AnnotationEditorParamsType;
12221const PermissionFlag = {
12222  PRINT: 0x04,
12223  MODIFY_CONTENTS: 0x08,
12224  COPY: 0x10,
12225  MODIFY_ANNOTATIONS: 0x20,
12226  FILL_INTERACTIVE_FORMS: 0x100,
12227  COPY_FOR_ACCESSIBILITY: 0x200,
12228  ASSEMBLE: 0x400,
12229  PRINT_HIGH_QUALITY: 0x800
12230};
12231exports.PermissionFlag = PermissionFlag;
12232const TextRenderingMode = {
12233  FILL: 0,
12234  STROKE: 1,
12235  FILL_STROKE: 2,
12236  INVISIBLE: 3,
12237  FILL_ADD_TO_PATH: 4,
12238  STROKE_ADD_TO_PATH: 5,
12239  FILL_STROKE_ADD_TO_PATH: 6,
12240  ADD_TO_PATH: 7,
12241  FILL_STROKE_MASK: 3,
12242  ADD_TO_PATH_FLAG: 4
12243};
12244exports.TextRenderingMode = TextRenderingMode;
12245const ImageKind = {
12246  GRAYSCALE_1BPP: 1,
12247  RGB_24BPP: 2,
12248  RGBA_32BPP: 3
12249};
12250exports.ImageKind = ImageKind;
12251const AnnotationType = {
12252  TEXT: 1,
12253  LINK: 2,
12254  FREETEXT: 3,
12255  LINE: 4,
12256  SQUARE: 5,
12257  CIRCLE: 6,
12258  POLYGON: 7,
12259  POLYLINE: 8,
12260  HIGHLIGHT: 9,
12261  UNDERLINE: 10,
12262  SQUIGGLY: 11,
12263  STRIKEOUT: 12,
12264  STAMP: 13,
12265  CARET: 14,
12266  INK: 15,
12267  POPUP: 16,
12268  FILEATTACHMENT: 17,
12269  SOUND: 18,
12270  MOVIE: 19,
12271  WIDGET: 20,
12272  SCREEN: 21,
12273  PRINTERMARK: 22,
12274  TRAPNET: 23,
12275  WATERMARK: 24,
12276  THREED: 25,
12277  REDACT: 26
12278};
12279exports.AnnotationType = AnnotationType;
12280const AnnotationReplyType = {
12281  GROUP: "Group",
12282  REPLY: "R"
12283};
12284exports.AnnotationReplyType = AnnotationReplyType;
12285const AnnotationFlag = {
12286  INVISIBLE: 0x01,
12287  HIDDEN: 0x02,
12288  PRINT: 0x04,
12289  NOZOOM: 0x08,
12290  NOROTATE: 0x10,
12291  NOVIEW: 0x20,
12292  READONLY: 0x40,
12293  LOCKED: 0x80,
12294  TOGGLENOVIEW: 0x100,
12295  LOCKEDCONTENTS: 0x200
12296};
12297exports.AnnotationFlag = AnnotationFlag;
12298const AnnotationFieldFlag = {
12299  READONLY: 0x0000001,
12300  REQUIRED: 0x0000002,
12301  NOEXPORT: 0x0000004,
12302  MULTILINE: 0x0001000,
12303  PASSWORD: 0x0002000,
12304  NOTOGGLETOOFF: 0x0004000,
12305  RADIO: 0x0008000,
12306  PUSHBUTTON: 0x0010000,
12307  COMBO: 0x0020000,
12308  EDIT: 0x0040000,
12309  SORT: 0x0080000,
12310  FILESELECT: 0x0100000,
12311  MULTISELECT: 0x0200000,
12312  DONOTSPELLCHECK: 0x0400000,
12313  DONOTSCROLL: 0x0800000,
12314  COMB: 0x1000000,
12315  RICHTEXT: 0x2000000,
12316  RADIOSINUNISON: 0x2000000,
12317  COMMITONSELCHANGE: 0x4000000
12318};
12319exports.AnnotationFieldFlag = AnnotationFieldFlag;
12320const AnnotationBorderStyleType = {
12321  SOLID: 1,
12322  DASHED: 2,
12323  BEVELED: 3,
12324  INSET: 4,
12325  UNDERLINE: 5
12326};
12327exports.AnnotationBorderStyleType = AnnotationBorderStyleType;
12328const AnnotationActionEventType = {
12329  E: "Mouse Enter",
12330  X: "Mouse Exit",
12331  D: "Mouse Down",
12332  U: "Mouse Up",
12333  Fo: "Focus",
12334  Bl: "Blur",
12335  PO: "PageOpen",
12336  PC: "PageClose",
12337  PV: "PageVisible",
12338  PI: "PageInvisible",
12339  K: "Keystroke",
12340  F: "Format",
12341  V: "Validate",
12342  C: "Calculate"
12343};
12344exports.AnnotationActionEventType = AnnotationActionEventType;
12345const DocumentActionEventType = {
12346  WC: "WillClose",
12347  WS: "WillSave",
12348  DS: "DidSave",
12349  WP: "WillPrint",
12350  DP: "DidPrint"
12351};
12352exports.DocumentActionEventType = DocumentActionEventType;
12353const PageActionEventType = {
12354  O: "PageOpen",
12355  C: "PageClose"
12356};
12357exports.PageActionEventType = PageActionEventType;
12358const VerbosityLevel = {
12359  ERRORS: 0,
12360  WARNINGS: 1,
12361  INFOS: 5
12362};
12363exports.VerbosityLevel = VerbosityLevel;
12364const CMapCompressionType = {
12365  NONE: 0,
12366  BINARY: 1
12367};
12368exports.CMapCompressionType = CMapCompressionType;
12369const OPS = {
12370  dependency: 1,
12371  setLineWidth: 2,
12372  setLineCap: 3,
12373  setLineJoin: 4,
12374  setMiterLimit: 5,
12375  setDash: 6,
12376  setRenderingIntent: 7,
12377  setFlatness: 8,
12378  setGState: 9,
12379  save: 10,
12380  restore: 11,
12381  transform: 12,
12382  moveTo: 13,
12383  lineTo: 14,
12384  curveTo: 15,
12385  curveTo2: 16,
12386  curveTo3: 17,
12387  closePath: 18,
12388  rectangle: 19,
12389  stroke: 20,
12390  closeStroke: 21,
12391  fill: 22,
12392  eoFill: 23,
12393  fillStroke: 24,
12394  eoFillStroke: 25,
12395  closeFillStroke: 26,
12396  closeEOFillStroke: 27,
12397  endPath: 28,
12398  clip: 29,
12399  eoClip: 30,
12400  beginText: 31,
12401  endText: 32,
12402  setCharSpacing: 33,
12403  setWordSpacing: 34,
12404  setHScale: 35,
12405  setLeading: 36,
12406  setFont: 37,
12407  setTextRenderingMode: 38,
12408  setTextRise: 39,
12409  moveText: 40,
12410  setLeadingMoveText: 41,
12411  setTextMatrix: 42,
12412  nextLine: 43,
12413  showText: 44,
12414  showSpacedText: 45,
12415  nextLineShowText: 46,
12416  nextLineSetSpacingShowText: 47,
12417  setCharWidth: 48,
12418  setCharWidthAndBounds: 49,
12419  setStrokeColorSpace: 50,
12420  setFillColorSpace: 51,
12421  setStrokeColor: 52,
12422  setStrokeColorN: 53,
12423  setFillColor: 54,
12424  setFillColorN: 55,
12425  setStrokeGray: 56,
12426  setFillGray: 57,
12427  setStrokeRGBColor: 58,
12428  setFillRGBColor: 59,
12429  setStrokeCMYKColor: 60,
12430  setFillCMYKColor: 61,
12431  shadingFill: 62,
12432  beginInlineImage: 63,
12433  beginImageData: 64,
12434  endInlineImage: 65,
12435  paintXObject: 66,
12436  markPoint: 67,
12437  markPointProps: 68,
12438  beginMarkedContent: 69,
12439  beginMarkedContentProps: 70,
12440  endMarkedContent: 71,
12441  beginCompat: 72,
12442  endCompat: 73,
12443  paintFormXObjectBegin: 74,
12444  paintFormXObjectEnd: 75,
12445  beginGroup: 76,
12446  endGroup: 77,
12447  beginAnnotation: 80,
12448  endAnnotation: 81,
12449  paintImageMaskXObject: 83,
12450  paintImageMaskXObjectGroup: 84,
12451  paintImageXObject: 85,
12452  paintInlineImageXObject: 86,
12453  paintInlineImageXObjectGroup: 87,
12454  paintImageXObjectRepeat: 88,
12455  paintImageMaskXObjectRepeat: 89,
12456  paintSolidColorImageMask: 90,
12457  constructPath: 91
12458};
12459exports.OPS = OPS;
12460const PasswordResponses = {
12461  NEED_PASSWORD: 1,
12462  INCORRECT_PASSWORD: 2
12463};
12464exports.PasswordResponses = PasswordResponses;
12465let verbosity = VerbosityLevel.WARNINGS;
12466function setVerbosityLevel(level) {
12467  if (Number.isInteger(level)) {
12468    verbosity = level;
12469  }
12470}
12471function getVerbosityLevel() {
12472  return verbosity;
12473}
12474function info(msg) {
12475  if (verbosity >= VerbosityLevel.INFOS) {
12476    console.log(`Info: ${msg}`);
12477  }
12478}
12479function warn(msg) {
12480  if (verbosity >= VerbosityLevel.WARNINGS) {
12481    console.log(`Warning: ${msg}`);
12482  }
12483}
12484function unreachable(msg) {
12485  throw new Error(msg);
12486}
12487function assert(cond, msg) {
12488  if (!cond) {
12489    unreachable(msg);
12490  }
12491}
12492function _isValidProtocol(url) {
12493  switch (url?.protocol) {
12494    case "http:":
12495    case "https:":
12496    case "ftp:":
12497    case "mailto:":
12498    case "tel:":
12499      return true;
12500    default:
12501      return false;
12502  }
12503}
12504function createValidAbsoluteUrl(url, baseUrl = null, options = null) {
12505  if (!url) {
12506    return null;
12507  }
12508  try {
12509    if (options && typeof url === "string") {
12510      if (options.addDefaultProtocol && url.startsWith("www.")) {
12511        const dots = url.match(/\./g);
12512        if (dots?.length >= 2) {
12513          url = `http://${url}`;
12514        }
12515      }
12516      if (options.tryConvertEncoding) {
12517        try {
12518          url = stringToUTF8String(url);
12519        } catch {}
12520      }
12521    }
12522    const absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);
12523    if (_isValidProtocol(absoluteUrl)) {
12524      return absoluteUrl;
12525    }
12526  } catch {}
12527  return null;
12528}
12529function shadow(obj, prop, value, nonSerializable = false) {
12530  Object.defineProperty(obj, prop, {
12531    value,
12532    enumerable: !nonSerializable,
12533    configurable: true,
12534    writable: false
12535  });
12536  return value;
12537}
12538const BaseException = function BaseExceptionClosure() {
12539  function BaseException(message, name) {
12540    if (this.constructor === BaseException) {
12541      unreachable("Cannot initialize BaseException.");
12542    }
12543    this.message = message;
12544    this.name = name;
12545  }
12546  BaseException.prototype = new Error();
12547  BaseException.constructor = BaseException;
12548  return BaseException;
12549}();
12550exports.BaseException = BaseException;
12551class PasswordException extends BaseException {
12552  constructor(msg, code) {
12553    super(msg, "PasswordException");
12554    this.code = code;
12555  }
12556}
12557exports.PasswordException = PasswordException;
12558class UnknownErrorException extends BaseException {
12559  constructor(msg, details) {
12560    super(msg, "UnknownErrorException");
12561    this.details = details;
12562  }
12563}
12564exports.UnknownErrorException = UnknownErrorException;
12565class InvalidPDFException extends BaseException {
12566  constructor(msg) {
12567    super(msg, "InvalidPDFException");
12568  }
12569}
12570exports.InvalidPDFException = InvalidPDFException;
12571class MissingPDFException extends BaseException {
12572  constructor(msg) {
12573    super(msg, "MissingPDFException");
12574  }
12575}
12576exports.MissingPDFException = MissingPDFException;
12577class UnexpectedResponseException extends BaseException {
12578  constructor(msg, status) {
12579    super(msg, "UnexpectedResponseException");
12580    this.status = status;
12581  }
12582}
12583exports.UnexpectedResponseException = UnexpectedResponseException;
12584class FormatError extends BaseException {
12585  constructor(msg) {
12586    super(msg, "FormatError");
12587  }
12588}
12589exports.FormatError = FormatError;
12590class AbortException extends BaseException {
12591  constructor(msg) {
12592    super(msg, "AbortException");
12593  }
12594}
12595exports.AbortException = AbortException;
12596function bytesToString(bytes) {
12597  if (typeof bytes !== "object" || bytes?.length === undefined) {
12598    unreachable("Invalid argument for bytesToString");
12599  }
12600  const length = bytes.length;
12601  const MAX_ARGUMENT_COUNT = 8192;
12602  if (length < MAX_ARGUMENT_COUNT) {
12603    return String.fromCharCode.apply(null, bytes);
12604  }
12605  const strBuf = [];
12606  for (let i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
12607    const chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
12608    const chunk = bytes.subarray(i, chunkEnd);
12609    strBuf.push(String.fromCharCode.apply(null, chunk));
12610  }
12611  return strBuf.join("");
12612}
12613function stringToBytes(str) {
12614  if (typeof str !== "string") {
12615    unreachable("Invalid argument for stringToBytes");
12616  }
12617  const length = str.length;
12618  const bytes = new Uint8Array(length);
12619  for (let i = 0; i < length; ++i) {
12620    bytes[i] = str.charCodeAt(i) & 0xff;
12621  }
12622  return bytes;
12623}
12624function string32(value) {
12625  return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
12626}
12627function objectSize(obj) {
12628  return Object.keys(obj).length;
12629}
12630function objectFromMap(map) {
12631  const obj = Object.create(null);
12632  for (const [key, value] of map) {
12633    obj[key] = value;
12634  }
12635  return obj;
12636}
12637function isLittleEndian() {
12638  const buffer8 = new Uint8Array(4);
12639  buffer8[0] = 1;
12640  const view32 = new Uint32Array(buffer8.buffer, 0, 1);
12641  return view32[0] === 1;
12642}
12643function isEvalSupported() {
12644  try {
12645    new Function("");
12646    return true;
12647  } catch {
12648    return false;
12649  }
12650}
12651class FeatureTest {
12652  static get isLittleEndian() {
12653    return shadow(this, "isLittleEndian", isLittleEndian());
12654  }
12655  static get isEvalSupported() {
12656    return shadow(this, "isEvalSupported", isEvalSupported());
12657  }
12658  static get isOffscreenCanvasSupported() {
12659    return shadow(this, "isOffscreenCanvasSupported", typeof OffscreenCanvas !== "undefined");
12660  }
12661  static get platform() {
12662    if (typeof navigator === "undefined") {
12663      return shadow(this, "platform", {
12664        isWin: false,
12665        isMac: false
12666      });
12667    }
12668    return shadow(this, "platform", {
12669      isWin: navigator.platform.includes("Win"),
12670      isMac: navigator.platform.includes("Mac")
12671    });
12672  }
12673  static get isCSSRoundSupported() {
12674    return shadow(this, "isCSSRoundSupported", globalThis.CSS?.supports?.("width: round(1.5px, 1px)"));
12675  }
12676}
12677exports.FeatureTest = FeatureTest;
12678const hexNumbers = [...Array(256).keys()].map(n => n.toString(16).padStart(2, "0"));
12679class Util {
12680  static makeHexColor(r, g, b) {
12681    return `#${hexNumbers[r]}${hexNumbers[g]}${hexNumbers[b]}`;
12682  }
12683  static scaleMinMax(transform, minMax) {
12684    let temp;
12685    if (transform[0]) {
12686      if (transform[0] < 0) {
12687        temp = minMax[0];
12688        minMax[0] = minMax[1];
12689        minMax[1] = temp;
12690      }
12691      minMax[0] *= transform[0];
12692      minMax[1] *= transform[0];
12693      if (transform[3] < 0) {
12694        temp = minMax[2];
12695        minMax[2] = minMax[3];
12696        minMax[3] = temp;
12697      }
12698      minMax[2] *= transform[3];
12699      minMax[3] *= transform[3];
12700    } else {
12701      temp = minMax[0];
12702      minMax[0] = minMax[2];
12703      minMax[2] = temp;
12704      temp = minMax[1];
12705      minMax[1] = minMax[3];
12706      minMax[3] = temp;
12707      if (transform[1] < 0) {
12708        temp = minMax[2];
12709        minMax[2] = minMax[3];
12710        minMax[3] = temp;
12711      }
12712      minMax[2] *= transform[1];
12713      minMax[3] *= transform[1];
12714      if (transform[2] < 0) {
12715        temp = minMax[0];
12716        minMax[0] = minMax[1];
12717        minMax[1] = temp;
12718      }
12719      minMax[0] *= transform[2];
12720      minMax[1] *= transform[2];
12721    }
12722    minMax[0] += transform[4];
12723    minMax[1] += transform[4];
12724    minMax[2] += transform[5];
12725    minMax[3] += transform[5];
12726  }
12727  static transform(m1, m2) {
12728    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]];
12729  }
12730  static applyTransform(p, m) {
12731    const xt = p[0] * m[0] + p[1] * m[2] + m[4];
12732    const yt = p[0] * m[1] + p[1] * m[3] + m[5];
12733    return [xt, yt];
12734  }
12735  static applyInverseTransform(p, m) {
12736    const d = m[0] * m[3] - m[1] * m[2];
12737    const xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
12738    const yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
12739    return [xt, yt];
12740  }
12741  static getAxialAlignedBoundingBox(r, m) {
12742    const p1 = this.applyTransform(r, m);
12743    const p2 = this.applyTransform(r.slice(2, 4), m);
12744    const p3 = this.applyTransform([r[0], r[3]], m);
12745    const p4 = this.applyTransform([r[2], r[1]], m);
12746    return [Math.min(p1[0], p2[0], p3[0], p4[0]), Math.min(p1[1], p2[1], p3[1], p4[1]), Math.max(p1[0], p2[0], p3[0], p4[0]), Math.max(p1[1], p2[1], p3[1], p4[1])];
12747  }
12748  static inverseTransform(m) {
12749    const d = m[0] * m[3] - m[1] * m[2];
12750    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];
12751  }
12752  static singularValueDecompose2dScale(m) {
12753    const transpose = [m[0], m[2], m[1], m[3]];
12754    const a = m[0] * transpose[0] + m[1] * transpose[2];
12755    const b = m[0] * transpose[1] + m[1] * transpose[3];
12756    const c = m[2] * transpose[0] + m[3] * transpose[2];
12757    const d = m[2] * transpose[1] + m[3] * transpose[3];
12758    const first = (a + d) / 2;
12759    const second = Math.sqrt((a + d) ** 2 - 4 * (a * d - c * b)) / 2;
12760    const sx = first + second || 1;
12761    const sy = first - second || 1;
12762    return [Math.sqrt(sx), Math.sqrt(sy)];
12763  }
12764  static normalizeRect(rect) {
12765    const r = rect.slice(0);
12766    if (rect[0] > rect[2]) {
12767      r[0] = rect[2];
12768      r[2] = rect[0];
12769    }
12770    if (rect[1] > rect[3]) {
12771      r[1] = rect[3];
12772      r[3] = rect[1];
12773    }
12774    return r;
12775  }
12776  static intersect(rect1, rect2) {
12777    const xLow = Math.max(Math.min(rect1[0], rect1[2]), Math.min(rect2[0], rect2[2]));
12778    const xHigh = Math.min(Math.max(rect1[0], rect1[2]), Math.max(rect2[0], rect2[2]));
12779    if (xLow > xHigh) {
12780      return null;
12781    }
12782    const yLow = Math.max(Math.min(rect1[1], rect1[3]), Math.min(rect2[1], rect2[3]));
12783    const yHigh = Math.min(Math.max(rect1[1], rect1[3]), Math.max(rect2[1], rect2[3]));
12784    if (yLow > yHigh) {
12785      return null;
12786    }
12787    return [xLow, yLow, xHigh, yHigh];
12788  }
12789  static bezierBoundingBox(x0, y0, x1, y1, x2, y2, x3, y3) {
12790    const tvalues = [],
12791      bounds = [[], []];
12792    let a, b, c, t, t1, t2, b2ac, sqrtb2ac;
12793    for (let i = 0; i < 2; ++i) {
12794      if (i === 0) {
12795        b = 6 * x0 - 12 * x1 + 6 * x2;
12796        a = -3 * x0 + 9 * x1 - 9 * x2 + 3 * x3;
12797        c = 3 * x1 - 3 * x0;
12798      } else {
12799        b = 6 * y0 - 12 * y1 + 6 * y2;
12800        a = -3 * y0 + 9 * y1 - 9 * y2 + 3 * y3;
12801        c = 3 * y1 - 3 * y0;
12802      }
12803      if (Math.abs(a) < 1e-12) {
12804        if (Math.abs(b) < 1e-12) {
12805          continue;
12806        }
12807        t = -c / b;
12808        if (0 < t && t < 1) {
12809          tvalues.push(t);
12810        }
12811        continue;
12812      }
12813      b2ac = b * b - 4 * c * a;
12814      sqrtb2ac = Math.sqrt(b2ac);
12815      if (b2ac < 0) {
12816        continue;
12817      }
12818      t1 = (-b + sqrtb2ac) / (2 * a);
12819      if (0 < t1 && t1 < 1) {
12820        tvalues.push(t1);
12821      }
12822      t2 = (-b - sqrtb2ac) / (2 * a);
12823      if (0 < t2 && t2 < 1) {
12824        tvalues.push(t2);
12825      }
12826    }
12827    let j = tvalues.length,
12828      mt;
12829    const jlen = j;
12830    while (j--) {
12831      t = tvalues[j];
12832      mt = 1 - t;
12833      bounds[0][j] = mt * mt * mt * x0 + 3 * mt * mt * t * x1 + 3 * mt * t * t * x2 + t * t * t * x3;
12834      bounds[1][j] = mt * mt * mt * y0 + 3 * mt * mt * t * y1 + 3 * mt * t * t * y2 + t * t * t * y3;
12835    }
12836    bounds[0][jlen] = x0;
12837    bounds[1][jlen] = y0;
12838    bounds[0][jlen + 1] = x3;
12839    bounds[1][jlen + 1] = y3;
12840    bounds[0].length = bounds[1].length = jlen + 2;
12841    return [Math.min(...bounds[0]), Math.min(...bounds[1]), Math.max(...bounds[0]), Math.max(...bounds[1])];
12842  }
12843}
12844exports.Util = Util;
12845const 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];
12846function stringToPDFString(str) {
12847  if (str[0] >= "\xEF") {
12848    let encoding;
12849    if (str[0] === "\xFE" && str[1] === "\xFF") {
12850      encoding = "utf-16be";
12851    } else if (str[0] === "\xFF" && str[1] === "\xFE") {
12852      encoding = "utf-16le";
12853    } else if (str[0] === "\xEF" && str[1] === "\xBB" && str[2] === "\xBF") {
12854      encoding = "utf-8";
12855    }
12856    if (encoding) {
12857      try {
12858        const decoder = new TextDecoder(encoding, {
12859          fatal: true
12860        });
12861        const buffer = stringToBytes(str);
12862        return decoder.decode(buffer);
12863      } catch (ex) {
12864        warn(`stringToPDFString: "${ex}".`);
12865      }
12866    }
12867  }
12868  const strBuf = [];
12869  for (let i = 0, ii = str.length; i < ii; i++) {
12870    const code = PDFStringTranslateTable[str.charCodeAt(i)];
12871    strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));
12872  }
12873  return strBuf.join("");
12874}
12875function stringToUTF8String(str) {
12876  return decodeURIComponent(escape(str));
12877}
12878function utf8StringToString(str) {
12879  return unescape(encodeURIComponent(str));
12880}
12881function isArrayBuffer(v) {
12882  return typeof v === "object" && v?.byteLength !== undefined;
12883}
12884function isArrayEqual(arr1, arr2) {
12885  if (arr1.length !== arr2.length) {
12886    return false;
12887  }
12888  for (let i = 0, ii = arr1.length; i < ii; i++) {
12889    if (arr1[i] !== arr2[i]) {
12890      return false;
12891    }
12892  }
12893  return true;
12894}
12895function getModificationDate(date = new Date()) {
12896  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")];
12897  return buffer.join("");
12898}
12899class PromiseCapability {
12900  #settled = false;
12901  constructor() {
12902    this.promise = new Promise((resolve, reject) => {
12903      this.resolve = data => {
12904        this.#settled = true;
12905        resolve(data);
12906      };
12907      this.reject = reason => {
12908        this.#settled = true;
12909        reject(reason);
12910      };
12911    });
12912  }
12913  get settled() {
12914    return this.#settled;
12915  }
12916}
12917exports.PromiseCapability = PromiseCapability;
12918let NormalizeRegex = null;
12919let NormalizationMap = null;
12920function normalizeUnicode(str) {
12921  if (!NormalizeRegex) {
12922    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;
12923    NormalizationMap = new Map([["ſt", "ſt"]]);
12924  }
12925  return str.replaceAll(NormalizeRegex, (_, p1, p2) => {
12926    return p1 ? p1.normalize("NFKC") : NormalizationMap.get(p2);
12927  });
12928}
12929function getUuid() {
12930  if (typeof crypto !== "undefined" && typeof crypto?.randomUUID === "function") {
12931    return crypto.randomUUID();
12932  }
12933  const buf = new Uint8Array(32);
12934  if (typeof crypto !== "undefined" && typeof crypto?.getRandomValues === "function") {
12935    crypto.getRandomValues(buf);
12936  } else {
12937    for (let i = 0; i < 32; i++) {
12938      buf[i] = Math.floor(Math.random() * 255);
12939    }
12940  }
12941  return bytesToString(buf);
12942}
12943const AnnotationPrefix = "pdfjs_internal_id_";
12944exports.AnnotationPrefix = AnnotationPrefix;
12945
12946/***/ }),
12947/* 2 */
12948/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
12949
12950
12951
12952Object.defineProperty(exports, "__esModule", ({
12953  value: true
12954}));
12955exports.RenderTask = exports.PDFWorkerUtil = exports.PDFWorker = exports.PDFPageProxy = exports.PDFDocumentProxy = exports.PDFDocumentLoadingTask = exports.PDFDataRangeTransport = exports.LoopbackPort = exports.DefaultStandardFontDataFactory = exports.DefaultFilterFactory = exports.DefaultCanvasFactory = exports.DefaultCMapReaderFactory = void 0;
12956Object.defineProperty(exports, "SVGGraphics", ({
12957  enumerable: true,
12958  get: function () {
12959    return _displaySvg.SVGGraphics;
12960  }
12961}));
12962exports.build = void 0;
12963exports.getDocument = getDocument;
12964exports.version = void 0;
12965var _util = __w_pdfjs_require__(1);
12966var _annotation_storage = __w_pdfjs_require__(3);
12967var _display_utils = __w_pdfjs_require__(6);
12968var _font_loader = __w_pdfjs_require__(9);
12969var _displayNode_utils = __w_pdfjs_require__(10);
12970var _canvas = __w_pdfjs_require__(11);
12971var _worker_options = __w_pdfjs_require__(14);
12972var _message_handler = __w_pdfjs_require__(15);
12973var _metadata = __w_pdfjs_require__(16);
12974var _optional_content_config = __w_pdfjs_require__(17);
12975var _transport_stream = __w_pdfjs_require__(18);
12976var _displayFetch_stream = __w_pdfjs_require__(19);
12977var _displayNetwork = __w_pdfjs_require__(22);
12978var _displayNode_stream = __w_pdfjs_require__(23);
12979var _displaySvg = __w_pdfjs_require__(24);
12980var _xfa_text = __w_pdfjs_require__(25);
12981const DEFAULT_RANGE_CHUNK_SIZE = 65536;
12982const RENDERING_CANCELLED_TIMEOUT = 100;
12983const DELAYED_CLEANUP_TIMEOUT = 5000;
12984const DefaultCanvasFactory = _util.isNodeJS ? _displayNode_utils.NodeCanvasFactory : _display_utils.DOMCanvasFactory;
12985exports.DefaultCanvasFactory = DefaultCanvasFactory;
12986const DefaultCMapReaderFactory = _util.isNodeJS ? _displayNode_utils.NodeCMapReaderFactory : _display_utils.DOMCMapReaderFactory;
12987exports.DefaultCMapReaderFactory = DefaultCMapReaderFactory;
12988const DefaultFilterFactory = _util.isNodeJS ? _displayNode_utils.NodeFilterFactory : _display_utils.DOMFilterFactory;
12989exports.DefaultFilterFactory = DefaultFilterFactory;
12990const DefaultStandardFontDataFactory = _util.isNodeJS ? _displayNode_utils.NodeStandardFontDataFactory : _display_utils.DOMStandardFontDataFactory;
12991exports.DefaultStandardFontDataFactory = DefaultStandardFontDataFactory;
12992function getDocument(src) {
12993  if (typeof src === "string" || src instanceof URL) {
12994    src = {
12995      url: src
12996    };
12997  } else if ((0, _util.isArrayBuffer)(src)) {
12998    src = {
12999      data: src
13000    };
13001  }
13002  if (typeof src !== "object") {
13003    throw new Error("Invalid parameter in getDocument, need parameter object.");
13004  }
13005  if (!src.url && !src.data && !src.range) {
13006    throw new Error("Invalid parameter object: need either .data, .range or .url");
13007  }
13008  const task = new PDFDocumentLoadingTask();
13009  const {
13010    docId
13011  } = task;
13012  const url = src.url ? getUrlProp(src.url) : null;
13013  const data = src.data ? getDataProp(src.data) : null;
13014  const httpHeaders = src.httpHeaders || null;
13015  const withCredentials = src.withCredentials === true;
13016  const password = src.password ?? null;
13017  const rangeTransport = src.range instanceof PDFDataRangeTransport ? src.range : null;
13018  const rangeChunkSize = Number.isInteger(src.rangeChunkSize) && src.rangeChunkSize > 0 ? src.rangeChunkSize : DEFAULT_RANGE_CHUNK_SIZE;
13019  let worker = src.worker instanceof PDFWorker ? src.worker : null;
13020  const verbosity = src.verbosity;
13021  const docBaseUrl = typeof src.docBaseUrl === "string" && !(0, _display_utils.isDataScheme)(src.docBaseUrl) ? src.docBaseUrl : null;
13022  const cMapUrl = typeof src.cMapUrl === "string" ? src.cMapUrl : null;
13023  const cMapPacked = src.cMapPacked !== false;
13024  const CMapReaderFactory = src.CMapReaderFactory || DefaultCMapReaderFactory;
13025  const standardFontDataUrl = typeof src.standardFontDataUrl === "string" ? src.standardFontDataUrl : null;
13026  const StandardFontDataFactory = src.StandardFontDataFactory || DefaultStandardFontDataFactory;
13027  const ignoreErrors = src.stopAtErrors !== true;
13028  const maxImageSize = Number.isInteger(src.maxImageSize) && src.maxImageSize > -1 ? src.maxImageSize : -1;
13029  const isEvalSupported = src.isEvalSupported !== false;
13030  const isOffscreenCanvasSupported = typeof src.isOffscreenCanvasSupported === "boolean" ? src.isOffscreenCanvasSupported : !_util.isNodeJS;
13031  const canvasMaxAreaInBytes = Number.isInteger(src.canvasMaxAreaInBytes) ? src.canvasMaxAreaInBytes : 
13031-1;
13032  const disableFontFace = typeof src.disableFontFace === "boolean" ? src.disableFontFace : _util.isNodeJS;
13033  const fontExtraProperties = src.fontExtraProperties === true;
13034  const enableXfa = src.enableXfa === true;
13035  const ownerDocument = src.ownerDocument || globalThis.document;
13036  const disableRange = src.disableRange === true;
13037  const disableStream = src.disableStream === true;
13038  const disableAutoFetch = src.disableAutoFetch === true;
13039  const pdfBug = src.pdfBug === true;
13040  const length = rangeTransport ? rangeTransport.length : src.length ?? NaN;
13041  const useSystemFonts = typeof src.useSystemFonts === "boolean" ? src.useSystemFonts : !_util.isNodeJS && !disableFontFace;
13042  const useWorkerFetch = typeof src.useWorkerFetch === "boolean" ? src.useWorkerFetch : CMapReaderFactory === _display_utils.DOMCMapReaderFactory && StandardFontDataFactory === _display_utils.DOMStandardFontDataFactory && cMapUrl && standardFontDataUrl && (0, _display_utils.isValidFetchUrl)(cMapUrl, document.baseURI) && (0, _display_utils.isValidFetchUrl)(standardFontDataUrl, document.baseURI);
13043  const canvasFactory = src.canvasFactory || new DefaultCanvasFactory({
13044    ownerDocument
13045  });
13046  const filterFactory = src.filterFactory || new DefaultFilterFactory({
13047    docId,
13048    ownerDocument
13049  });
13050  const styleElement = null;
13051  (0, _util.setVerbosityLevel)(verbosity);
13052  const transportFactory = {
13053    canvasFactory,
13054    filterFactory
13055  };
13056  if (!useWorkerFetch) {
13057    transportFactory.cMapReaderFactory = new CMapReaderFactory({
13058      baseUrl: cMapUrl,
13059      isCompressed: cMapPacked
13060    });
13061    transportFactory.standardFontDataFactory = new StandardFontDataFactory({
13062      baseUrl: standardFontDataUrl
13063    });
13064  }
13065  if (!worker) {
13066    const workerParams = {
13067      verbosity,
13068      port: _worker_options.GlobalWorkerOptions.workerPort
13069    };
13070    worker = workerParams.port ? PDFWorker.fromPort(workerParams) : new PDFWorker(workerParams);
13071    task._worker = worker;
13072  }
13073  const fetchDocParams = {
13074    docId,
13075    apiVersion: '3.11.174',
13076    data,
13077    password,
13078    disableAutoFetch,
13079    rangeChunkSize,
13080    length,
13081    docBaseUrl,
13082    enableXfa,
13083    evaluatorOptions: {
13084      maxImageSize,
13085      disableFontFace,
13086      ignoreErrors,
13087      isEvalSupported,
13088      isOffscreenCanvasSupported,
13089      canvasMaxAreaInBytes,
13090      fontExtraProperties,
13091      useSystemFonts,
13092      cMapUrl: useWorkerFetch ? cMapUrl : null,
13093      standardFontDataUrl: useWorkerFetch ? standardFontDataUrl : null
13094    }
13095  };
13096  const transportParams = {
13097    ignoreErrors,
13098    isEvalSupported,
13099    disableFontFace,
13100    fontExtraProperties,
13101    enableXfa,
13102    ownerDocument,
13103    disableAutoFetch,
13104    pdfBug,
13105    styleElement
13106  };
13107  worker.promise.then(function () {
13108    if (task.destroyed) {
13109      throw new Error("Loading aborted");
13110    }
13111    const workerIdPromise = _fetchDocument(worker, fetchDocParams);
13112    const networkStreamPromise = new Promise(function (resolve) {
13113      let networkStream;
13114      if (rangeTransport) {
13115        networkStream = new _transport_stream.PDFDataTransportStream({
13116          length,
13117          initialData: rangeTransport.initialData,
13118          progressiveDone: rangeTransport.progressiveDone,
13119          contentDispositionFilename: rangeTransport.contentDispositionFilename,
13120          disableRange,
13121          disableStream
13122        }, rangeTransport);
13123      } else if (!data) {
13124        const createPDFNetworkStream = params => {
13125          if (_util.isNodeJS) {
13126            return new _displayNode_stream.PDFNodeStream(params);
13127          }
13128          return (0, _display_utils.isValidFetchUrl)(params.url) ? new _displayFetch_stream.PDFFetchStream(params) : new _displayNetwork.PDFNetworkStream(params);
13129        };
13130        networkStream = createPDFNetworkStream({
13131          url,
13132          length,
13133          httpHeaders,
13134          withCredentials,
13135          rangeChunkSize,
13136          disableRange,
13137          disableStream
13138        });
13139      }
13140      resolve(networkStream);
13141    });
13142    return Promise.all([workerIdPromise, networkStreamPromise]).then(function ([workerId, networkStream]) {
13143      if (task.destroyed) {
13144        throw new Error("Loading aborted");
13145      }
13146      const messageHandler = new _message_handler.MessageHandler(docId, workerId, worker.port);
13147      const transport = new WorkerTransport(messageHandler, task, networkStream, transportParams, transportFactory);
13148      task._transport = transport;
13149      messageHandler.send("Ready", null);
13150    });
13151  }).catch(task._capability.reject);
13152  return task;
13153}
13154async function _fetchDocument(worker, source) {
13155  if (worker.destroyed) {
13156    throw new Error("Worker was destroyed");
13157  }
13158  const workerId = await worker.messageHandler.sendWithPromise("GetDocRequest", source, source.data ? [source.data.buffer] : null);
13159  if (worker.destroyed) {
13160    throw new Error("Worker was destroyed");
13161  }
13162  return workerId;
13163}
13164function getUrlProp(val) {
13165  if (val instanceof URL) {
13166    return val.href;
13167  }
13168  try {
13169    return new URL(val, window.location).href;
13170  } catch {
13171    if (_util.isNodeJS && typeof val === "string") {
13172      return val;
13173    }
13174  }
13175  throw new Error("Invalid PDF url data: " + "either string or URL-object is expected in the url property.");
13176}
13177function getDataProp(val) {
13178  if (_util.isNodeJS && typeof Buffer !== "undefined" && val instanceof Buffer) {
13179    throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");
13180  }
13181  if (val instanceof Uint8Array && val.byteLength === val.buffer.byteLength) {
13182    return val;
13183  }
13184  if (typeof val === "string") {
13185    return (0, _util.stringToBytes)(val);
13186  }
13187  if (typeof val === "object" && !isNaN(val?.length) || (0, _util.isArrayBuffer)(val)) {
13188    return new Uint8Array(val);
13189  }
13190  throw new Error("Invalid PDF binary data: either TypedArray, " + "string, or array-like object is expected in the data property.");
13191}
13192class PDFDocumentLoadingTask {
13193  static #docId = 0;
13194  constructor() {
13195    this._capability = new _util.PromiseCapability();
13196    this._transport = null;
13197    this._worker = null;
13198    this.docId = `d${PDFDocumentLoadingTask.#docId++}`;
13199    this.destroyed = false;
13200    this.onPassword = null;
13201    this.onProgress = null;
13202  }
13203  get promise() {
13204    return this._capability.promise;
13205  }
13206  async destroy() {
13207    this.destroyed = true;
13208    try {
13209      if (this._worker?.port) {
13210        this._worker._pendingDestroy = true;
13211      }
13212      await this._transport?.destroy();
13213    } catch (ex) {
13214      if (this._worker?.port) {
13215        delete this._worker._pendingDestroy;
13216      }
13217      throw ex;
13218    }
13219    this._transport = null;
13220    if (this._worker) {
13221      this._worker.destroy();
13222      this._worker = null;
13223    }
13224  }
13225}
13226exports.PDFDocumentLoadingTask = PDFDocumentLoadingTask;
13227class PDFDataRangeTransport {
13228  constructor(length, initialData, progressiveDone = false, contentDispositionFilename = null) {
13229    this.length = length;
13230    this.initialData = initialData;
13231    this.progressiveDone = progressiveDone;
13232    this.contentDispositionFilename = contentDispositionFilename;
13233    this._rangeListeners = [];
13234    this._progressListeners = [];
13235    this._progressiveReadListeners = [];
13236    this._progressiveDoneListeners = [];
13237    this._readyCapability = new _util.PromiseCapability();
13238  }
13239  addRangeListener(listener) {
13240    this._rangeListeners.push(listener);
13241  }
13242  addProgressListener(listener) {
13243    this._progressListeners.push(listener);
13244  }
13245  addProgressiveReadListener(listener) {
13246    this._progressiveReadListeners.push(listener);
13247  }
13248  addProgressiveDoneListener(listener) {
13249    this._progressiveDoneListeners.push(listener);
13250  }
13251  onDataRange(begin, chunk) {
13252    for (const listener of this._rangeListeners) {
13253      listener(begin, chunk);
13254    }
13255  }
13256  onDataProgress(loaded, total) {
13257    this._readyCapability.promise.then(() => {
13258      for (const listener of this._progressListeners) {
13259        listener(loaded, total);
13260      }
13261    });
13262  }
13263  onDataProgressiveRead(chunk) {
13264    this._readyCapability.promise.then(() => {
13265      for (const listener of this._progressiveReadListeners) {
13266        listener(chunk);
13267      }
13268    });
13269  }
13270  onDataProgressiveDone() {
13271    this._readyCapability.promise.then(() => {
13272      for (const listener of this._progressiveDoneListeners) {
13273        listener();
13274      }
13275    });
13276  }
13277  transportReady() {
13278    this._readyCapability.resolve();
13279  }
13280  requestDataRange(begin, end) {
13281    (0, _util.unreachable)("Abstract method PDFDataRangeTransport.requestDataRange");
13282  }
13283  abort() {}
13284}
13285exports.PDFDataRangeTransport = PDFDataRangeTransport;
13286class PDFDocumentProxy {
13287  constructor(pdfInfo, transport) {
13288    this._pdfInfo = pdfInfo;
13289    this._transport = transport;
13290    Object.defineProperty(this, "getJavaScript", {
13291      value: () => {
13292        (0, _display_utils.deprecated)("`PDFDocumentProxy.getJavaScript`, " + "please use `PDFDocumentProxy.getJSActions` instead.");
13293        return this.getJSActions().then(js => {
13294          if (!js) {
13295            return js;
13296          }
13297          const jsArr = [];
13298          for (const name in js) {
13299            jsArr.push(...js[name]);
13300          }
13301          return jsArr;
13302        });
13303      }
13304    });
13305  }
13306  get annotationStorage() {
13307    return this._transport.annotationStorage;
13308  }
13309  get filterFactory() {
13310    return this._transport.filterFactory;
13311  }
13312  get numPages() {
13313    return this._pdfInfo.numPages;
13314  }
13315  get fingerprints() {
13316    return this._pdfInfo.fingerprints;
13317  }
13318  get isPureXfa() {
13319    return (0, _util.shadow)(this, "isPureXfa", !!this._transport._htmlForXfa);
13320  }
13321  get allXfaHtml() {
13322    return this._transport._htmlForXfa;
13323  }
13324  getPage(pageNumber) {
13325    return this._transport.getPage(pageNumber);
13326  }
13327  getPageIndex(ref) {
13328    return this._transport.getPageIndex(ref);
13329  }
13330  getDestinations() {
13331    return this._transport.getDestinations();
13332  }
13333  getDestination(id) {
13334    return this._transport.getDestination(id);
13335  }
13336  getPageLabels() {
13337    return this._transport.getPageLabels();
13338  }
13339  getPageLayout() {
13340    return this._transport.getPageLayout();
13341  }
13342  getPageMode() {
13343    return this._transport.getPageMode();
13344  }
13345  getViewerPreferences() {
13346    return this._transport.getViewerPreferences();
13347  }
13348  getOpenAction() {
13349    return this._transport.getOpenAction();
13350  }
13351  getAttachments() {
13352    return this._transport.getAttachments();
13353  }
13354  getJSActions() {
13355    return this._transport.getDocJSActions();
13356  }
13357  getOutline() {
13358    return this._transport.getOutline();
13359  }
13360  getOptionalContentConfig() {
13361    return this._transport.getOptionalContentConfig();
13362  }
13363  getPermissions() {
13364    return this._transport.getPermissions();
13365  }
13366  getMetadata() {
13367    return this._transport.getMetadata();
13368  }
13369  getMarkInfo() {
13370    return this._transport.getMarkInfo();
13371  }
13372  getData() {
13373    return this._transport.getData();
13374  }
13375  saveDocument() {
13376    return this._transport.saveDocument();
13377  }
13378  getDownloadInfo() {
13379    return this._transport.downloadInfoCapability.promise;
13380  }
13381  cleanup(keepLoadedFonts = false) {
13382    return this._transport.startCleanup(keepLoadedFonts || this.isPureXfa);
13383  }
13384  destroy() {
13385    return this.loadingTask.destroy();
13386  }
13387  get loadingParams() {
13388    return this._transport.loadingParams;
13389  }
13390  get loadingTask() {
13391    return this._transport.loadingTask;
13392  }
13393  getFieldObjects() {
13394    return this._transport.getFieldObjects();
13395  }
13396  hasJSActions() {
13397    return this._transport.hasJSActions();
13398  }
13399  getCalculationOrderIds() {
13400    return this._transport.getCalculationOrderIds();
13401  }
13402}
13403exports.PDFDocumentProxy = PDFDocumentProxy;
13404class PDFPageProxy {
13405  #delayedCleanupTimeout = null;
13406  #pendingCleanup = false;
13407  constructor(pageIndex, pageInfo, transport, pdfBug = false) {
13408    this._pageIndex = pageIndex;
13409    this._pageInfo = pageInfo;
13410    this._transport = transport;
13411    this._stats = pdfBug ? new _display_utils.StatTimer() : null;
13412    this._pdfBug = pdfBug;
13413    this.commonObjs = transport.commonObjs;
13414    this.objs = new PDFObjects();
13415    this._maybeCleanupAfterRender = false;
13416    this._intentStates = new Map();
13417    this.destroyed = false;
13418  }
13419  get pageNumber() {
13420    return this._pageIndex + 1;
13421  }
13422  get rotate() {
13423    return this._pageInfo.rotate;
13424  }
13425  get ref() {
13426    return this._pageInfo.ref;
13427  }
13428  get userUnit() {
13429    return this._pageInfo.userUnit;
13430  }
13431  get view() {
13432    return this._pageInfo.view;
13433  }
13434  getViewport({
13435    scale,
13436    rotation = this.rotate,
13437    offsetX = 0,
13438    offsetY = 0,
13439    dontFlip = false
13440  } = {}) {
13441    return new _display_utils.PageViewport({
13442      viewBox: this.view,
13443      scale,
13444      rotation,
13445      offsetX,
13446      offsetY,
13447      dontFlip
13448    });
13449  }
13450  getAnnotations({
13451    intent = "display"
13452  } = {}) {
13453    const intentArgs = this._transport.getRenderingIntent(intent);
13454    return this._transport.getAnnotations(this._pageIndex, intentArgs.renderingIntent);
13455  }
13456  getJSActions() {
13457    return this._transport.getPageJSActions(this._pageIndex);
13458  }
13459  get filterFactory() {
13460    return this._transport.filterFactory;
13461  }
13462  get isPureXfa() {
13463    return (0, _util.shadow)(this, "isPureXfa", !!this._transport._htmlForXfa);
13464  }
13465  async getXfa() {
13466    return this._transport._htmlForXfa?.children[this._pageIndex] || null;
13467  }
13468  render({
13469    canvasContext,
13470    viewport,
13471    intent = "display",
13472    annotationMode = _util.AnnotationMode.ENABLE,
13473    transform = null,
13474    background = null,
13475    optionalContentConfigPromise = null,
13476    annotationCanvasMap = null,
13477    pageColors = null,
13478    printAnnotationStorage = null
13479  }) {
13480    this._stats?.time("Overall");
13481    const intentArgs = this._transport.getRenderingIntent(intent, annotationMode, printAnnotationStorage);
13482    this.#pendingCleanup = false;
13483    this.#abortDelayedCleanup();
13484    if (!optionalContentConfigPromise) {
13485      optionalContentConfigPromise = this._transport.getOptionalContentConfig();
13486    }
13487    let intentState = this._intentStates.get(intentArgs.cacheKey);
13488    if (!intentState) {
13489      intentState = Object.create(null);
13490      this._intentStates.set(intentArgs.cacheKey, intentState);
13491    }
13492    if (intentState.streamReaderCancelTimeout) {
13493      clearTimeout(intentState.streamReaderCancelTimeout);
13494      intentState.streamReaderCancelTimeout = null;
13495    }
13496    const intentPrint = !!(intentArgs.renderingIntent & _util.RenderingIntentFlag.PRINT);
13497    if (!intentState.displayReadyCapability) {
13498      intentState.displayReadyCapability = new _util.PromiseCapability();
13499      intentState.operatorList = {
13500        fnArray: [],
13501        argsArray: [],
13502        lastChunk: false,
13503        separateAnnots: null
13504      };
13505      this._stats?.time("Page Request");
13506      this._pumpOperatorList(intentArgs);
13507    }
13508    const complete = error => {
13509      intentState.renderTasks.delete(internalRenderTask);
13510      if (this._maybeCleanupAfterRender || intentPrint) {
13511        this.#pendingCleanup = true;
13512      }
13513      this.#tryCleanup(!intentPrint);
13514      if (error) {
13515        internalRenderTask.capability.reject(error);
13516        this._abortOperatorList({
13517          intentState,
13518          reason: error instanceof Error ? error : new Error(error)
13519        });
13520      } else {
13521        internalRenderTask.capability.resolve();
13522      }
13523      this._stats?.timeEnd("Rendering");
13524      this._stats?.timeEnd("Overall");
13525    };
13526    const internalRenderTask = new InternalRenderTask({
13527      callback: complete,
13528      params: {
13529        canvasContext,
13530        viewport,
13531        transform,
13532        background
13533      },
13534      objs: this.objs,
13535      commonObjs: this.commonObjs,
13536      annotationCanvasMap,
13537      operatorList: intentState.operatorList,
13538      pageIndex: this._pageIndex,
13539      canvasFactory: this._transport.canvasFactory,
13540      filterFactory: this._transport.filterFactory,
13541      useRequestAnimationFrame: !intentPrint,
13542      pdfBug: this._pdfBug,
13543      pageColors
13544    });
13545    (intentState.renderTasks ||= new Set()).add(internalRenderTask);
13546    const renderTask = internalRenderTask.task;
13547    Promise.all([intentState.displayReadyCapability.promise, optionalContentConfigPromise]).then(([transparency, optionalContentConfig]) => {
13548      if (this.destroyed) {
13549        complete();
13550        return;
13551      }
13552      this._stats?.time("Rendering");
13553      internalRenderTask.initializeGraphics({
13554        transparency,
13555        optionalContentConfig
13556      });
13557      internalRenderTask.operatorListChanged();
13558    }).catch(complete);
13559    return renderTask;
13560  }
13561  getOperatorList({
13562    intent = "display",
13563    annotationMode = _util.AnnotationMode.ENABLE,
13564    printAnnotationStorage = null
13565  } = {}) {
13566    function operatorListChanged() {
13567      if (intentState.operatorList.lastChunk) {
13568        intentState.opListReadCapability.resolve(intentState.operatorList);
13569        intentState.renderTasks.delete(opListTask);
13570      }
13571    }
13572    const intentArgs = this._transport.getRenderingIntent(intent, annotationMode, printAnnotationStorage, true);
13573    let intentState = this._intentStates.get(intentArgs.cacheKey);
13574    if (!intentState) {
13575      intentState = Object.create(null);
13576      this._intentStates.set(intentArgs.cacheKey, intentState);
13577    }
13578    let opListTask;
13579    if (!intentState.opListReadCapability) {
13580      opListTask = Object.create(null);
13581      opListTask.operatorListChanged = operatorListChanged;
13582      intentState.opListReadCapability = new _util.PromiseCapability();
13583      (intentState.renderTasks ||= new Set()).add(opListTask);
13584      intentState.operatorList = {
13585        fnArray: [],
13586        argsArray: [],
13587        lastChunk: false,
13588        separateAnnots: null
13589      };
13590      this._stats?.time("Page Request");
13591      this._pumpOperatorList(intentArgs);
13592    }
13593    return intentState.opListReadCapability.promise;
13594  }
13595  streamTextContent({
13596    includeMarkedContent = false,
13597    disableNormalization = false
13598  } = {}) {
13599    const TEXT_CONTENT_CHUNK_SIZE = 100;
13600    return this._transport.messageHandler.sendWithStream("GetTextContent", {
13601      pageIndex: this._pageIndex,
13602      includeMarkedContent: includeMarkedContent === true,
13603      disableNormalization: disableNormalization === true
13604    }, {
13605      highWaterMark: TEXT_CONTENT_CHUNK_SIZE,
13606      size(textContent) {
13607        return textContent.items.length;
13608      }
13609    });
13610  }
13611  getTextContent(params = {}) {
13612    if (this._transport._htmlForXfa) {
13613      return this.getXfa().then(xfa => {
13614        return _xfa_text.XfaText.textContent(xfa);
13615      });
13616    }
13617    const readableStream = this.streamTextContent(params);
13618    return new Promise(function (resolve, reject) {
13619      function pump() {
13620        reader.read().then(function ({
13621          value,
13622          done
13623        }) {
13624          if (done) {
13625            resolve(textContent);
13626            return;
13627          }
13628          Object.assign(textContent.styles, value.styles);
13629          textContent.items.push(...value.items);
13630          pump();
13631        }, reject);
13632      }
13633      const reader = readableStream.getReader();
13634      const textContent = {
13635        items: [],
13636        styles: Object.create(null)
13637      };
13638      pump();
13639    });
13640  }
13641  getStructTree() {
13642    return this._transport.getStructTree(this._pageIndex);
13643  }
13644  _destroy() {
13645    this.destroyed = true;
13646    const waitOn = [];
13647    for (const intentState of this._intentStates.values()) {
13648      this._abortOperatorList({
13649        intentState,
13650        reason: new Error("Page was destroyed."),
13651        force: true
13652      });
13653      if (intentState.opListReadCapability) {
13654        continue;
13655      }
13656      for (const internalRenderTask of intentState.renderTasks) {
13657        waitOn.push(internalRenderTask.completed);
13658        internalRenderTask.cancel();
13659      }
13660    }
13661    this.objs.clear();
13662    this.#pendingCleanup = false;
13663    this.#abortDelayedCleanup();
13664    return Promise.all(waitOn);
13665  }
13666  cleanup(resetStats = false) {
13667    this.#pendingCleanup = true;
13668    const success = this.#tryCleanup(false);
13669    if (resetStats && success) {
13670      this._stats &&= new _display_utils.StatTimer();
13671    }
13672    return success;
13673  }
13674  #tryCleanup(delayed = false) {
13675    this.#abortDelayedCleanup();
13676    if (!this.#pendingCleanup || this.destroyed) {
13677      return false;
13678    }
13679    if (delayed) {
13680      this.#delayedCleanupTimeout = setTimeout(() => {
13681        this.#delayedCleanupTimeout = null;
13682        this.#tryCleanup(false);
13683      }, DELAYED_CLEANUP_TIMEOUT);
13684      return false;
13685    }
13686    for (const {
13687      renderTasks,
13688      operatorList
13689    } of this._intentStates.values()) {
13690      if (renderTasks.size > 0 || !operatorList.lastChunk) {
13691        return false;
13692      }
13693    }
13694    this._intentStates.clear();
13695    this.objs.clear();
13696    this.#pendingCleanup = false;
13697    return true;
13698  }
13699  #abortDelayedCleanup() {
13700    if (this.#delayedCleanupTimeout) {
13701      clearTimeout(this.#delayedCleanupTimeout);
13702      this.#delayedCleanupTimeout = null;
13703    }
13704  }
13705  _startRenderPage(transparency, cacheKey) {
13706    const intentState = this._intentStates.get(cacheKey);
13707    if (!intentState) {
13708      return;
13709    }
13710    this._stats?.timeEnd("Page Request");
13711    intentState.displayReadyCapability?.resolve(transparency);
13712  }
13713  _renderPageChunk(operatorListChunk, intentState) {
13714    for (let i = 0, ii = operatorListChunk.length; i < ii; i++) {
13715      intentState.operatorList.fnArray.push(operatorListChunk.fnArray[i]);
13716      intentState.operatorList.argsArray.push(operatorListChunk.argsArray[i]);
13717    }
13718    intentState.operatorList.lastChunk = operatorListChunk.lastChunk;
13719    intentState.operatorList.separateAnnots = operatorListChunk.separateAnnots;
13720    for (const internalRenderTask of intentState.renderTasks) {
13721      internalRenderTask.operatorListChanged();
13722    }
13723    if (operatorListChunk.lastChunk) {
13724      this.#tryCleanup(true);
13725    }
13726  }
13727  _pumpOperatorList({
13728    renderingIntent,
13729    cacheKey,
13730    annotationStorageSerializable
13731  }) {
13732    const {
13733      map,
13734      transfers
13735    } = annotationStorageSerializable;
13736    const readableStream = this._transport.messageHandler.sendWithStream("GetOperatorList", {
13737      pageIndex: this._pageIndex,
13738      intent: renderingIntent,
13739      cacheKey,
13740      annotationStorage: map
13741    }, transfers);
13742    const reader = readableStream.getReader();
13743    const intentState = this._intentStates.get(cacheKey);
13744    intentState.streamReader = reader;
13745    const pump = () => {
13746      reader.read().then(({
13747        value,
13748        done
13749      }) => {
13750        if (done) {
13751          intentState.streamReader = null;
13752          return;
13753        }
13754        if (this._transport.destroyed) {
13755          return;
13756        }
13757        this._renderPageChunk(value, intentState);
13758        pump();
13759      }, reason => {
13760        intentState.streamReader = null;
13761        if (this._transport.destroyed) {
13762          return;
13763        }
13764        if (intentState.operatorList) {
13765          intentState.operatorList.lastChunk = true;
13766          for (const internalRenderTask of intentState.renderTasks) {
13767            internalRenderTask.operatorListChanged();
13768          }
13769          this.#tryCleanup(true);
13770        }
13771        if (intentState.displayReadyCapability) {
13772          intentState.displayReadyCapability.reject(reason);
13773        } else if (intentState.opListReadCapability) {
13774          intentState.opListReadCapability.reject(reason);
13775        } else {
13776          throw reason;
13777        }
13778      });
13779    };
13780    pump();
13781  }
13782  _abortOperatorList({
13783    intentState,
13784    reason,
13785    force = false
13786  }) {
13787    if (!intentState.streamReader) {
13788      return;
13789    }
13790    if (intentState.streamReaderCancelTimeout) {
13791      clearTimeout(intentState.streamReaderCancelTimeout);
13792      intentState.streamReaderCancelTimeout = null;
13793    }
13794    if (!force) {
13795      if (intentState.renderTasks.size > 0) {
13796        return;
13797      }
13798      if (reason instanceof _display_utils.RenderingCancelledException) {
13799        let delay = RENDERING_CANCELLED_TIMEOUT;
13800        if (reason.extraDelay > 0 && reason.extraDelay < 1000) {
13801          delay += reason.extraDelay;
13802        }
13803        intentState.streamReaderCancelTimeout = setTimeout(() => {
13804          intentState.streamReaderCancelTimeout = null;
13805          this._abortOperatorList({
13806            intentState,
13807            reason,
13808            force: true
13809          });
13810        }, delay);
13811        return;
13812      }
13813    }
13814    intentState.streamReader.cancel(new _util.AbortException(reason.message)).catch(() => {});
13815    intentState.streamReader = null;
13816    if (this._transport.destroyed) {
13817      return;
13818    }
13819    for (const [curCacheKey, curIntentState] of this._intentStates) {
13820      if (curIntentState === intentState) {
13821        this._intentStates.delete(curCacheKey);
13822        break;
13823      }
13824    }
13825    this.cleanup();
13826  }
13827  get stats() {
13828    return this._stats;
13829  }
13830}
13831exports.PDFPageProxy = PDFPageProxy;
13832class LoopbackPort {
13833  #listeners = new Set();
13834  #deferred = Promise.resolve();
13835  postMessage(obj, transfer) {
13836    const event = {
13837      data: structuredClone(obj, transfer ? {
13838        transfer
13839      } : null)
13840    };
13841    this.#deferred.then(() => {
13842      for (const listener of this.#listeners) {
13843        listener.call(this, event);
13844      }
13845    });
13846  }
13847  addEventListener(name, listener) {
13848    this.#listeners.add(listener);
13849  }
13850  removeEventListener(name, listener) {
13851    this.#listeners.delete(listener);
13852  }
13853  terminate() {
13854    this.#listeners.clear();
13855  }
13856}
13857exports.LoopbackPort = LoopbackPort;
13858const PDFWorkerUtil = {
13859  isWorkerDisabled: false,
13860  fallbackWorkerSrc: null,
13861  fakeWorkerId: 0
13862};
13863exports.PDFWorkerUtil = PDFWorkerUtil;
13864{
13865  if (_util.isNodeJS && "function" === "function") {
13866    PDFWorkerUtil.isWorkerDisabled = true;
13867    PDFWorkerUtil.fallbackWorkerSrc = "./pdf.worker.js";
13868  } else if (typeof document === "object") {
13869    const pdfjsFilePath = document?.currentScript?.src;
13870    if (pdfjsFilePath) {
13871      PDFWorkerUtil.fallbackWorkerSrc = pdfjsFilePath.replace(/(\.(?:min\.)?js)(\?.*)?$/i, ".w
13871orker$1$2");
13872    }
13873  }
13874  PDFWorkerUtil.isSameOrigin = function (baseUrl, otherUrl) {
13875    let base;
13876    try {
13877      base = new URL(baseUrl);
13878      if (!base.origin || base.origin === "null") {
13879        return false;
13880      }
13881    } catch {
13882      return false;
13883    }
13884    const other = new URL(otherUrl, base);
13885    return base.origin === other.origin;
13886  };
13887  PDFWorkerUtil.createCDNWrapper = function (url) {
13888    const wrapper = `importScripts("${url}");`;
13889    return URL.createObjectURL(new Blob([wrapper]));
13890  };
13891}
13892class PDFWorker {
13893  static #workerPorts;
13894  constructor({
13895    name = null,
13896    port = null,
13897    verbosity = (0, _util.getVerbosityLevel)()
13898  } = {}) {
13899    this.name = name;
13900    this.destroyed = false;
13901    this.verbosity = verbosity;
13902    this._readyCapability = new _util.PromiseCapability();
13903    this._port = null;
13904    this._webWorker = null;
13905    this._messageHandler = null;
13906    if (port) {
13907      if (PDFWorker.#workerPorts?.has(port)) {
13908        throw new Error("Cannot use more than one PDFWorker per port.");
13909      }
13910      (PDFWorker.#workerPorts ||= new WeakMap()).set(port, this);
13911      this._initializeFromPort(port);
13912      return;
13913    }
13914    this._initialize();
13915  }
13916  get promise() {
13917    return this._readyCapability.promise;
13918  }
13919  get port() {
13920    return this._port;
13921  }
13922  get messageHandler() {
13923    return this._messageHandler;
13924  }
13925  _initializeFromPort(port) {
13926    this._port = port;
13927    this._messageHandler = new _message_handler.MessageHandler("main", "worker", port);
13928    this._messageHandler.on("ready", function () {});
13929    this._readyCapability.resolve();
13930    this._messageHandler.send("configure", {
13931      verbosity: this.verbosity
13932    });
13933  }
13934  _initialize() {
13935    if (!PDFWorkerUtil.isWorkerDisabled && !PDFWorker._mainThreadWorkerMessageHandler) {
13936      let {
13937        workerSrc
13938      } = PDFWorker;
13939      try {
13940        if (!PDFWorkerUtil.isSameOrigin(window.location.href, workerSrc)) {
13941          workerSrc = PDFWorkerUtil.createCDNWrapper(new URL(workerSrc, window.location).href);
13942        }
13943        const worker = new Worker(workerSrc);
13944        const messageHandler = new _message_handler.MessageHandler("main", "worker", worker);
13945        const terminateEarly = () => {
13946          worker.removeEventListener("error", onWorkerError);
13947          messageHandler.destroy();
13948          worker.terminate();
13949          if (this.destroyed) {
13950            this._readyCapability.reject(new Error("Worker was destroyed"));
13951          } else {
13952            this._setupFakeWorker();
13953          }
13954        };
13955        const onWorkerError = () => {
13956          if (!this._webWorker) {
13957            terminateEarly();
13958          }
13959        };
13960        worker.addEventListener("error", onWorkerError);
13961        messageHandler.on("test", data => {
13962          worker.removeEventListener("error", onWorkerError);
13963          if (this.destroyed) {
13964            terminateEarly();
13965            return;
13966          }
13967          if (data) {
13968            this._messageHandler = messageHandler;
13969            this._port = worker;
13970            this._webWorker = worker;
13971            this._readyCapability.resolve();
13972            messageHandler.send("configure", {
13973              verbosity: this.verbosity
13974            });
13975          } else {
13976            this._setupFakeWorker();
13977            messageHandler.destroy();
13978            worker.terminate();
13979          }
13980        });
13981        messageHandler.on("ready", data => {
13982          worker.removeEventListener("error", onWorkerError);
13983          if (this.destroyed) {
13984            terminateEarly();
13985            return;
13986          }
13987          try {
13988            sendTest();
13989          } catch {
13990            this._setupFakeWorker();
13991          }
13992        });
13993        const sendTest = () => {
13994          const testObj = new Uint8Array();
13995          messageHandler.send("test", testObj, [testObj.buffer]);
13996        };
13997        sendTest();
13998        return;
13999      } catch {
14000        (0, _util.info)("The worker has been disabled.");
14001      }
14002    }
14003    this._setupFakeWorker();
14004  }
14005  _setupFakeWorker() {
14006    if (!PDFWorkerUtil.isWorkerDisabled) {
14007      (0, _util.warn)("Setting up fake worker.");
14008      PDFWorkerUtil.isWorkerDisabled = true;
14009    }
14010    PDFWorker._setupFakeWorkerGlobal.then(WorkerMessageHandler => {
14011      if (this.destroyed) {
14012        this._readyCapability.reject(new Error("Worker was destroyed"));
14013        return;
14014      }
14015      const port = new LoopbackPort();
14016      this._port = port;
14017      const id = `fake${PDFWorkerUtil.fakeWorkerId++}`;
14018      const workerHandler = new _message_handler.MessageHandler(id + "_worker", id, port);
14019      WorkerMessageHandler.setup(workerHandler, port);
14020      const messageHandler = new _message_handler.MessageHandler(id, id + "_worker", port);
14021      this._messageHandler = messageHandler;
14022      this._readyCapability.resolve();
14023      messageHandler.send("configure", {
14024        verbosity: this.verbosity
14025      });
14026    }).catch(reason => {
14027      this._readyCapability.reject(new Error(`Setting up fake worker failed: "${reason.message}".`));
14028    });
14029  }
14030  destroy() {
14031    this.destroyed = true;
14032    if (this._webWorker) {
14033      this._webWorker.terminate();
14034      this._webWorker = null;
14035    }
14036    PDFWorker.#workerPorts?.delete(this._port);
14037    this._port = null;
14038    if (this._messageHandler) {
14039      this._messageHandler.destroy();
14040      this._messageHandler = null;
14041    }
14042  }
14043  static fromPort(params) {
14044    if (!params?.port) {
14045      throw new Error("PDFWorker.fromPort - invalid method signature.");
14046    }
14047    const cachedPort = this.#workerPorts?.get(params.port);
14048    if (cachedPort) {
14049      if (cachedPort._pendingDestroy) {
14050        throw new Error("PDFWorker.fromPort - the worker is being destroyed.\n" + "Please remember to await `PDFDocumentLoadingTask.destroy()`-calls.");
14051      }
14052      return cachedPort;
14053    }
14054    return new PDFWorker(params);
14055  }
14056  static get workerSrc() {
14057    if (_worker_options.GlobalWorkerOptions.workerSrc) {
14058      return _worker_options.GlobalWorkerOptions.workerSrc;
14059    }
14060    if (PDFWorkerUtil.fallbackWorkerSrc !== null) {
14061      if (!_util.isNodeJS) {
14062        (0, _display_utils.deprecated)('No "GlobalWorkerOptions.workerSrc" specified.');
14063      }
14064      return PDFWorkerUtil.fallbackWorkerSrc;
14065    }
14066    throw new Error('No "GlobalWorkerOptions.workerSrc" specified.');
14067  }
14068  static get _mainThreadWorkerMessageHandler() {
14069    try {
14070      return globalThis.pdfjsWorker?.WorkerMessageHandler || null;
14071    } catch {
14072      return null;
14073    }
14074  }
14075  static get _setupFakeWorkerGlobal() {
14076    const loader = async () => {
14077      const mainWorkerMessageHandler = this._mainThreadWorkerMessageHandler;
14078      if (mainWorkerMessageHandler) {
14079        return mainWorkerMessageHandler;
14080      }
14081      if (_util.isNodeJS && "function" === "function") {
14082        const worker = eval("require")(this.workerSrc);
14083        return worker.WorkerMessageHandler;
14084      }
14085      await (0, _display_utils.loadScript)(this.workerSrc);
14086      return window.pdfjsWorker.WorkerMessageHandler;
14087    };
14088    return (0, _util.shadow)(this, "_setupFakeWorkerGlobal", loader());
14089  }
14090}
14091exports.PDFWorker = PDFWorker;
14092class WorkerTransport {
14093  #methodPromises = new Map();
14094  #pageCache = new Map();
14095  #pagePromises = new Map();
14096  #passwordCapability = null;
14097  constructor(messageHandler, loadingTask, networkStream, params, factory) {
14098    this.messageHandler = messageHandler;
14099    this.loadingTask = loadingTask;
14100    this.commonObjs = new PDFObjects();
14101    this.fontLoader = new _font_loader.FontLoader({
14102      ownerDocument: params.ownerDocument,
14103      styleElement: params.styleElement
14104    });
14105    this._params = params;
14106    this.canvasFactory = factory.canvasFactory;
14107    this.filterFactory = factory.filterFactory;
14108    this.cMapReaderFactory = factory.cMapReaderFactory;
14109    this.standardFontDataFactory = factory.standardFontDataFactory;
14110    this.destroyed = false;
14111    this.destroyCapability = null;
14112    this._networkStream = networkStream;
14113    this._fullReader = null;
14114    this._lastProgress = null;
14115    this.downloadInfoCapability = new _util.PromiseCapability();
14116    this.setupMessageHandler();
14117  }
14118  #cacheSimpleMethod(name, data = null) {
14119    const cachedPromise = this.#methodPromises.get(name);
14120    if (cachedPromise) {
14121      return cachedPromise;
14122    }
14123    const promise = this.messageHandler.sendWithPromise(name, data);
14124    this.#methodPromises.set(name, promise);
14125    return promise;
14126  }
14127  get annotationStorage() {
14128    return (0, _util.shadow)(this, "annotationStorage", new _annotation_storage.AnnotationStorage());
14129  }
14130  getRenderingIntent(intent, annotationMode = _util.AnnotationMode.ENABLE, printAnnotationStorage = null, isOpList = false) {
14131    let renderingIntent = _util.RenderingIntentFlag.DISPLAY;
14132    let annotationStorageSerializable = _annotation_storage.SerializableEmpty;
14133    switch (intent) {
14134      case "any":
14135        renderingIntent = _util.RenderingIntentFlag.ANY;
14136        break;
14137      case "display":
14138        break;
14139      case "print":
14140        renderingIntent = _util.RenderingIntentFlag.PRINT;
14141        break;
14142      default:
14143        (0, _util.warn)(`getRenderingIntent - invalid intent: ${intent}`);
14144    }
14145    switch (annotationMode) {
14146      case _util.AnnotationMode.DISABLE:
14147        renderingIntent += _util.RenderingIntentFlag.ANNOTATIONS_DISABLE;
14148        break;
14149      case _util.AnnotationMode.ENABLE:
14150        break;
14151      case _util.AnnotationMode.ENABLE_FORMS:
14152        renderingIntent += _util.RenderingIntentFlag.ANNOTATIONS_FORMS;
14153        break;
14154      case _util.AnnotationMode.ENABLE_STORAGE:
14155        renderingIntent += _util.RenderingIntentFlag.ANNOTATIONS_STORAGE;
14156        const annotationStorage = renderingIntent & _util.RenderingIntentFlag.PRINT && printAnnotationStorage instanceof _annotation_storage.PrintAnnotationStorage ? printAnnotationStorage : this.annotationStorage;
14157        annotationStorageSerializable = annotationStorage.serializable;
14158        break;
14159      default:
14160        (0, _util.warn)(`getRenderingIntent - invalid annotationMode: ${annotationMode}`);
14161    }
14162    if (isOpList) {
14163      renderingIntent += _util.RenderingIntentFlag.OPLIST;
14164    }
14165    return {
14166      renderingIntent,
14167      cacheKey: `${renderingIntent}_${annotationStorageSerializable.hash}`,
14168      annotationStorageSerializable
14169    };
14170  }
14171  destroy() {
14172    if (this.destroyCapability) {
14173      return this.destroyCapability.promise;
14174    }
14175    this.destroyed = true;
14176    this.destroyCapability = new _util.PromiseCapability();
14177    this.#passwordCapability?.reject(new Error("Worker was destroyed during onPassword callback"));
14178    const waitOn = [];
14179    for (const page of this.#pageCache.values()) {
14180      waitOn.push(page._destroy());
14181    }
14182    this.#pageCache.clear();
14183    this.#pagePromises.clear();
14184    if (this.hasOwnProperty("annotationStorage")) {
14185      this.annotationStorage.resetModified();
14186    }
14187    const terminated = this.messageHandler.sendWithPromise("Terminate", null);
14188    waitOn.push(terminated);
14189    Promise.all(waitOn).then(() => {
14190      this.commonObjs.clear();
14191      this.fontLoader.clear();
14192      this.#methodPromises.clear();
14193      this.filterFactory.destroy();
14194      this._networkStream?.cancelAllRequests(new _util.AbortException("Worker was terminated."));
14195      if (this.messageHandler) {
14196        this.messageHandler.destroy();
14197        this.messageHandler = null;
14198      }
14199      this.destroyCapability.resolve();
14200    }, this.destroyCapability.reject);
14201    return this.destroyCapability.promise;
14202  }
14203  setupMessageHandler() {
14204    const {
14205      messageHandler,
14206      loadingTask
14207    } = this;
14208    messageHandler.on("GetReader", (data, sink) => {
14209      (0, _util.assert)(this._networkStream, "GetReader - no `IPDFStream` instance available.");
14210      this._fullReader = this._networkStream.getFullReader();
14211      this._fullReader.onProgress = evt => {
14212        this._lastProgress = {
14213          loaded: evt.loaded,
14214          total: evt.total
14215        };
14216      };
14217      sink.onPull = () => {
14218        this._fullReader.read().then(function ({
14219          value,
14220          done
14221        }) {
14222          if (done) {
14223            sink.close();
14224            return;
14225          }
14226          (0, _util.assert)(value instanceof ArrayBuffer, "GetReader - expected an ArrayBuffer.");
14227          sink.enqueue(new Uint8Array(value), 1, [value]);
14228        }).catch(reason => {
14229          sink.error(reason);
14230        });
14231      };
14232      sink.onCancel = reason => {
14233        this._fullReader.cancel(reason);
14234        sink.ready.catch(readyReason => {
14235          if (this.destroyed) {
14236            return;
14237          }
14238          throw readyReason;
14239        });
14240      };
14241    });
14242    messageHandler.on("ReaderHeadersReady", data => {
14243      const headersCapability = new _util.PromiseCapability();
14244      const fullReader = this._fullReader;
14245      fullReader.headersReady.then(() => {
14246        if (!fullReader.isStreamingSupported || !fullReader.isRangeSupported) {
14247          if (this._lastProgress) {
14248            loadingTask.onProgress?.(this._lastProgress);
14249          }
14250          fullReader.onProgress = evt => {
14251            loadingTask.onProgress?.({
14252              loaded: evt.loaded,
14253              total: evt.total
14254            });
14255          };
14256        }
14257        headersCapability.resolve({
14258          isStreamingSupported: fullReader.isStreamingSupported,
14259          isRangeSupported: fullReader.isRangeSupported,
14260          contentLength: fullReader.contentLength
14261        });
14262      }, headersCapability.reject);
14263      return headersCapability.promise;
14264    });
14265    messageHandler.on("GetRangeReader", (data, sink) => {
14266      (0, _util.assert)(this._networkStream, "GetRangeReader - no `IPDFStream` instance available.");
14267      const rangeReader = this._networkStream.getRangeReader(data.begin, data.end);
14268      if (!rangeReader) {
14269        sink.close();
14270        return;
14271      }
14272      sink.onPull = () => {
14273        rangeReader.read().then(function ({
14274          value,
14275          done
14276        }) {
14277          if (done) {
14278            sink.close();
14279            return;
14280          }
14281          (0, _util.assert)(value instanceof ArrayBuffer, "GetRangeReader - expected an ArrayBuffer.");
14282          sink.enqueue(new Uint8Array(value), 1, [value]);
14283        }).catch(reason => {
14284          sink.error(reason);
14285        });
14286      };
14287      sink.onCancel = reason => {
14288        rangeReader.cancel(reason);
14289        sink.ready.catch(readyReason => {
14290          if (this.destroyed) {
14291            return;
14292          }
14293          throw readyReason;
14294        });
14295      };
14296    });
14297    messageHandler.on("GetDoc", ({
14298      pdfInfo
14299    }) => {
14300      this._numPages = pdfInfo.numPages;
14301      this._htmlForXfa = pdfInfo.htmlForXfa;
14302      delete pdfInfo.htmlForXfa;
14303      loadingTask._capability.resolve(new PDFDocumentProxy(pdfInfo, this));
14304    });
14305    messageHandler.on("DocException", function (ex) {
14306      let reason;
14307      switch (ex.name) {
14308        case "PasswordException":
14309          reason = new _util.PasswordException(ex.message, ex.code);
14310          break;
14311        case "InvalidPDFException":
14312          reason = new _util.InvalidPDFException(ex.message);
14313          break;
14314        case "MissingPDFException":
14315          reason = new _util.MissingPDFException(ex.message);
14316          break;
14317        case "UnexpectedResponseException":
14318          reason = new _util.UnexpectedResponseException(ex.message, ex.status);
14319          break;
14320        case "UnknownErrorException":
14321          reason = new _util.UnknownErrorException(ex.message, ex.details);
14322          break;
14323        default:
14324          (0, _util.unreachable)("DocException - expected a valid Error.");
14325      }
14326      loadingTask._capability.reject(reason);
14327    });
14328    messageHandler.on("PasswordRequest", exception => {
14329      this.#passwordCapability = new _util.PromiseCapability();
14330      if (loadingTask.onPassword) {
14331        const updatePassword = password => {
14332          if (password instanceof Error) {
14333            this.#passwordCapability.reject(password);
14334          } else {
14335            this.#passwordCapability.resolve({
14336              password
14337            });
14338          }
14339        };
14340        try {
14341          loadingTask.onPassword(updatePassword, exception.code);
14342        } catch (ex) {
14343          this.#passwordCapability.reject(ex);
14344        }
14345      } else {
14346        this.#passwordCapability.reject(new _util.PasswordException(exception.message, exception.code));
14347      }
14348      return this.#passwordCapability.promise;
14349    });
14350    messageHandler.on("DataLoaded", data => {
14351      loadingTask.onProgress?.({
14352        loaded: data.length,
14353        total: data.length
14354      });
14355      this.downloadInfoCapability.resolve(data);
14356    });
14357    messageHandler.on("StartRenderPage", data => {
14358      if (this.destroyed) {
14359        return;
14360      }
14361      const page = this.#pageCache.get(data.pageIndex);
14362      page._startRenderPage(data.transparency, data.cacheKey);
14363    });
14364    messageHandler.on("commonobj", ([id, type, exportedData]) => {
14365      if (this.destroyed) {
14366        return;
14367      }
14368      if (this.commonObjs.has(id)) {
14369        return;
14370      }
14371      switch (type) {
14372        case "Font":
14373          const params = this._params;
14374          if ("error" in exportedData) {
14375            const exportedError = exportedData.error;
14376            (0, _util.warn)(`Error during font loading: ${exportedError}`);
14377            this.commonObjs.resolve(id, exportedError);
14378            break;
14379          }
14380          const inspectFont = params.pdfBug && globalThis.FontInspector?.enabled ? (font, url) => globalThis.FontInspector.fontAdded(font, url) : null;
14381          const font = new _font_loader.FontFaceObject(exportedData, {
14382            isEvalSupported: params.isEvalSupported,
14383            disableFontFace: params.disableFontFace,
14384            ignoreErrors: params.ignoreErrors,
14385            inspectFont
14386          });
14387          this.fontLoader.bind(font).catch(reason => {
14388            return messageHandler.sendWithPromise("FontFallback", {
14389              id
14390            });
14391          }).finally(() => {
14392            if (!params.fontExtraProperties && font.data) {
14393              font.data = null;
14394            }
14395            this.commonObjs.resolve(id, font);
14396          });
14397          break;
14398        case "FontPath":
14399        case "Image":
14400        case "Pattern":
14401          this.commonObjs.resolve(id, exportedData);
14402          break;
14403        default:
14404          throw new Error(`Got unknown common object type ${type}`);
14405      }
14406    });
14407    messageHandler.on("obj", ([id, pageIndex, type, imageData]) => {
14408      if (this.destroyed) {
14409        return;
14410      }
14411      const pageProxy = this.#pageCache.get(pageIndex);
14412      if (pageProxy.objs.has(id)) {
14413        return;
14414      }
14415      switch (type) {
14416        case "Image":
14417          pageProxy.objs.resolve(id, imageData);
14418          if (imageData) {
14419            let length;
14420            if (imageData.bitmap) {
14421              const {
14422                width,
14423                height
14424              } = imageData;
14425              length = width * height * 4;
14426            } else {
14427              length = imageData.data?.length || 0;
14428            }
14429            if (length > _util.MAX_IMAGE_SIZE_TO_CACHE) {
14430              pageProxy._maybeCleanupAfterRender = true;
14431            }
14432          }
14433          break;
14434        case "Pattern":
14435          pageProxy.objs.resolve(id, imageData);
14436          break;
14437        default:
14438          throw new Error(`Got unknown object type ${type}`);
14439      }
14440    });
14441    messageHandler.on("DocProgress", data => {
14442      if (this.destroyed) {
14443        return;
14444      }
14445      loadingTask.onProgress?.({
14446        loaded: data.loaded,
14447        total: data.total
14448      });
14449    });
14450    messageHandler.on("FetchBuiltInCMap", data => {
14451      if (this.destroyed) {
14452        return Promise.reject(new Error("Worker was destroyed."));
14453      }
14454      if (!this.cMapReaderFactory) {
14455        return Promise.reject(new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter."));
14456      }
14457      return this.cMapReaderFactory.fetch(data);
14458    });
14459    messageHandler.on("FetchStandardFontData", data => {
14460      if (this.destroyed) {
14461        return Promise.reject(new Error("Worker was destroyed."));
14462      }
14463      if (!this.standardFontDataFactory) {
14464        return Promise.reject(new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter."));
14465      }
14466      return this.standardFontDataFactory.fetch(data);
14467    });
14468  }
14469  getData() {
14470    return this.messageHandler.sendWithPromise("GetData", null);
14471  }
14472  saveDocument() {
14473    if (this.annotationStorage.size <= 0) {
14474      (0, _util.warn)("saveDocument called while `annotationStorage` is empty, " + "please use the getData-method instead.");
14475    }
14476    const {
14477      map,
14478      transfers
14479    } = this.annotationStorage.serializable;
14480    return this.messageHandler.sendWithPromise("SaveDocument", {
14481      isPureXfa: !!this._htmlForXfa,
14482      numPages: this._numPages,
14483      annotationStorage: map,
14484      filename: this._fullReader?.filename ?? null
14485    }, transfers).finally(() => {
14486      this.annotationStorage.resetModified();
14487    });
14488  }
14489  getPage(pageNumber) {
14490    if (!Number.isInteger(pageNumber) || pageNumber <= 0 || pageNumber > this._numPages) {
14491      return Promise.reject(new Error("Invalid page request."));
14492    }
14493    const pageIndex = pageNumber - 1,
14494      cachedPromise = this.#pagePromises.get(pageIndex);
14495    if (cachedPromise) {
14496      return cachedPromise;
14497    }
14498    const promise = this.messageHandler.sendWithPromise("GetPage", {
14499      pageIndex
14500    }).then(pageInfo => {
14501      if (this.destroyed) {
14502        throw new Error("Transport destroyed");
14503      }
14504      const page = new PDFPageProxy(pageIndex, pageInfo, this, this._params.pdfBug);
14505      this.#pageCache.set(pageIndex, page);
14506      return page;
14507    });
14508    this.#pagePromises.set(pageIndex, promise);
14509    return promise;
14510  }
14511  getPageIndex(ref) {
14512    if (typeof ref !== "object" || ref === null || !Number.isInteger(ref.num) || ref.num < 0 || !Number.isInteger(ref.gen) || ref.gen < 0) {
14513      return Promise.reject(new Error("Invalid pageIndex request."));
14514    }
14515    return this.messageHandler.sendWithPromise("GetPageIndex", {
14516      num: ref.num,
14517      gen: ref.gen
14518    });
14519  }
14520  getAnnotations(pageIndex, intent) {
14521    return this.messageHandler.sendWithPromise("GetAnnotations", {
14522      pageIndex,
14523      intent
14524    });
14525  }
14526  getFieldObjects() {
14527    return this.#cacheSimpleMethod("GetFieldObjects");
14528  }
14529  hasJSActions() {
14530    return this.#cacheSimpleMethod("HasJSActions");
14531  }
14532  getCalculationOrderIds() {
14533    return this.messageHandler.sendWithPromise("GetCalculationOrderIds", null);
14534  }
14535  getDestinations() {
14536    return this.messageHandler.sendWithPromise("GetDestinations", null);
14537  }
14538  getDestination(id) {
14539    if (typeof id !== "string") {
14540      return Promise.reject(new Error("Invalid destination request."));
14541    }
14542    return this.messageHandler.sendWithPromise("GetDestination", {
14543      id
14544    });
14545  }
14546  getPageLabels() {
14547    return this.messageHandler.sendWithPromise("GetPageLabels", null);
14548  }
14549  getPageLayout() {
14550    return this.messageHandler.sendWithPromise("GetPageLayout", null);
14551  }
14552  getPageMode() {
14553    return this.messageHandler.sendWithPromise("GetPageMode", null);
14554  }
14555  getViewerPreferences() {
14556    return this.messageHandler.sendWithPromise("GetViewerPreferences", null);
14557  }
14558  getOpenAction() {
14559    return this.messageHandler.sendWithPromise("GetOpenAction", null);
14560  }
14561  getAttachments() {
14562    return this.messageHandler.sendWithPromise("GetAttachments", null);
14563  }
14564  getDocJSActions() {
14565    return this.#cacheSimpleMethod("GetDocJSActions");
14566  }
14567  getPageJSActions(pageIndex) {
14568    return this.messageHandler.sendWithPromise("GetPageJSActions", {
14569      pageIndex
14570    });
14571  }
14572  getStructTree(pageIndex) {
14573    return this.messageHandler.sendWithPromise("GetStructTree", {
14574      pageIndex
14575    });
14576  }
14577  getOutline() {
14578    return this.messageHandler.sendWithPromise("GetOutline", null);
14579  }
14580  getOptionalContentConfig() {
14581    return this.messageHandler.sendWithPromise("GetOptionalContentConfig", null).then(results => {
14582      return new _optional_content_config.OptionalContentConfig(results);
14583    });
14584  }
14585  getPermissions() {
14586    return this.messageHandler.sendWithPromise("GetPermissions", null);
14587  }
14588  getMetadata() {
14589    const name = "GetMetadata",
14590      cachedPromise = this.#methodPromises.get(name);
14591    if (cachedPromise) {
14592      return cachedPromise;
14593    }
14594    const promise = this.messageHandler.sendWithPromise(name, null).then(results => {
14595      return {
14596        info: results[0],
14597        metadata: results[1] ? new _metadata.Metadata(results[1]) : null,
14598        contentDispositionFilename: this._fullReader?.filename ?? null,
14599        contentLength: this._fullReader?.contentLength ?? null
14600      };
14601    });
14602    this.#methodPromises.set(name, promise);
14603    return promise;
14604  }
14605  getMarkInfo() {
14606    return this.messageHandler.sendWithPromise("GetMarkInfo", null);
14607  }
14608  async startCleanup(keepLoadedFonts = false) {
14609    if (this.destroyed) {
14610      return;
14611    }
14612    await this.messageHandler.sendWithPromise("Cleanup", null);
14613    for (const page of this.#pageCache.values()) {
14614      const cleanupSuccessful = page.cleanup();
14615      if (!cleanupSuccessful) {
14616        throw new Error(`startCleanup: Page ${page.pageNumber} is currently rendering.`);
14617      }
14618    }
14619    this.commonObjs.clear();
14620    if (!keepLoadedFonts) {
14621      this.fontLoader.clear();
14622    }
14623    this.#methodPromises.clear();
14624    this.filterFactory.destroy(true);
14625  }
14626  get loadingParams() {
14627    const {
14628      disableAutoFetch,
14629      enableXfa
14630    } = this._params;
14631    return (0, _util.shadow)(this, "loadingParams", {
14632      disableAutoFetch,
14633      enableXfa
14634    });
14635  }
14636}
14637class PDFObjects {
14638  #objs = Object.create(null);
14639  #ensureObj(objId) {
14640    return this.#objs[objId] ||= {
14641      capability: new _util.PromiseCapability(),
14642      data: null
14643    };
14644  }
14645  get(objId, callback = null) {
14646    if (callback) {
14647      const obj = this.#ensureObj(objId);
14648      obj.capability.promise.then(() => callback(obj.data));
14649      return null;
14650    }
14651    const obj = this.#objs[objId];
14652    if (!obj?.capability.settled) {
14653      throw new Error(`Requesting object that isn't resolved yet ${objId}.`);
14654    }
14655    return obj.data;
14656  }
14657  has(objId) {
14658    const obj = this.#objs[objId];
14659    return obj?.capability.settled || false;
14660  }
14661  resolve(objId, data = null) {
14662    const obj = this.#ensureObj(objId);
14663    obj.data = data;
14664    obj.capability.resolve();
14665  }
14666  clear() {
14667    for (const objId in this.#objs) {
14668      const {
14669        data
14670      } = this.#objs[objId];
14671      data?.bitmap?.close();
14672    }
14673    this.#objs = Object.create(null);
14674  }
14675}
14676class RenderTask {
14677  #internalRenderTask = null;
14678  constructor(internalRenderTask) {
14679    this.#internalRenderTask = internalRenderTask;
14680    this.onContinue = null;
14681  }
14682  get promise() {
14683    return this.#internalRenderTask.capability.promise;
14684  }
14685  cancel(extraDelay = 0) {
14686    this.#internalRenderTask.cancel(null, extraDelay);
14687  }
14688  get separateAnnots() {
14689    const {
14690      separateAnnots
14691    } = this.#internalRenderTask.operatorList;
14692    if (!separateAnnots) {
14693      return false;
14694    }
14695    const {
14696      annotationCanvasMap
14697    } = this.#internalRenderTask;
14698    return separateAnnots.form || separateAnnots.canvas && annotationCanvasMap?.size > 0;
14699  }
14700}
14701exports.RenderTask = RenderTask;
14702class InternalRenderTask {
14703  static #canvasInUse = new WeakSet();
14704  constructor({
14705    callback,
14706    params,
14707    objs,
14708    commonObjs,
14709    annotationCanvasMap,
14710    operatorList,
14711    pageIndex,
14712    canvasFactory,
14713    filterFactory,
14714    useRequestAnimationFrame = false,
14715    pdfBug = false,
14716    pageColors = null
14717  }) {
14718    this.callback = callback;
14719    this.params = params;
14720    this.objs = objs;
14721    this.commonObjs = commonObjs;
14722    this.annotationCanvasMap = annotationCanvasMap;
14723    this.operatorListIdx = null;
14724    this.operatorList = operatorList;
14725    this._pageIndex = pageIndex;
14726    this.canvasFactory = canvasFactory;
14727    this.filterFactory = filterFactory;
14728    this._pdfBug = pdfBug;
14729    this.pageColors = pageColors;
14730    this.running = false;
14731    this.graphicsReadyCallback = null;
14732    this.graphicsReady = false;
14733    this._useRequestAnimationFrame = useRequestAnimationFrame === true && typeof window !== "undefined";
14734    this.cancelled = false;
14735    this.capability = new _util.PromiseCapability();
14736    this.task = new RenderTask(this);
14737    this._cancelBound = this.cancel.bind(this);
14738    this._continueBound = this._continue.bind(this);
14739    this._scheduleNextBound = this._scheduleNext.bind(this);
14740    this._nextBound = this._next.bind(this);
14741    this._canvas = params.canvasContext.canvas;
14742  }
14743  get completed() {
14744    return this.capability.promise.catch(function () {});
14745  }
14746  initializeGraphics({
14747    transparency = false,
14748    optionalContentConfig
14749  }) {
14750    if (this.cancelled) {
14751      return;
14752    }
14753    if (this._canvas) {
14754      if (InternalRenderTask.#canvasInUse.has(this._canvas)) {
14755        throw new Error("Cannot use the same canvas during multiple render() operations. " + "Use different canvas or ensure previous operations were " + "cancelled or completed.");
14756      }
14757      InternalRenderTask.#canvasInUse.add(this._canvas);
14758    }
14759    if (this._pdfBug && globalThis.StepperManager?.enabled) {
14760      this.stepper = globalThis.StepperManager.create(this._pageIndex);
14761      this.stepper.init(this.operatorList);
14762      this.stepper.nextBreakPoint = this.stepper.getNextBreakPoint();
14763    }
14764    const {
14765      canvasContext,
14766      viewport,
14767      transform,
14768      background
14769    } = this.params;
14770    this.gfx = new _canvas.CanvasGraphics(canvasContext, this.commonObjs, this.objs, this.canvasFactory, this.filterFactory, {
14771      optionalContentConfig
14772    }, this.annotationCanvasMap, this.pageColors);
14773    this.gfx.beginDrawing({
14774      transform,
14775      viewport,
14776      transparency,
14777      background
14778    });
14779    this.operatorListIdx = 0;
14780    this.graphicsReady = true;
14781    this.graphicsReadyCallback?.();
14782  }
14783  cancel(error = null, extraDelay = 0) {
14784    this.running = false;
14785    this.cancelled = true;
14786    this.gfx?.endDrawing();
14787    InternalRenderTask.#canvasInUse.delete(this._canvas);
14788    this.callback(error || new _display_utils.RenderingCancelledException(`Rendering cancelled, page ${this._pageIndex + 1}`, extraDelay));
14789  }
14790  operatorListChanged() {
14791    if (!this.graphicsReady) {
14792      this.graphicsReadyCallback ||= this._continueBound;
14793      return;
14794    }
14795    this.stepper?.updateOperatorList(this.operatorList);
14796    if (this.running) {
14797      return;
14798    }
14799    this._continue();
14800  }
14801  _continue() {
14802    this.running = true;
14803    if (this.cancelled) {
14804      return;
14805    }
14806    if (this.task.onContinue) {
14807      this.task.onContinue(this._scheduleNextBound);
14808    } else {
14809      this._scheduleNext();
14810    }
14811  }
14812  _scheduleNext() {
14813    if (this._useRequestAnimationFrame) {
14814      window.requestAnimationFrame(() => {
14815        this._nextBound().catch(this._cancelBound);
14816      });
14817    } else {
14818      Promise.resolve().then(this._nextBound).catch(this._cancelBound);
14819    }
14820  }
14821  async _next() {
14822    if (this.cancelled) {
14823      return;
14824    }
14825    this.operatorListIdx = this.gfx.executeOperatorList(this.operatorList, this.operatorListIdx, this._continueBound, this.stepper);
14826    if (this.operatorListIdx === this.operatorList.argsArray.length) {
14827      this.running = false;
14828      if (this.operatorList.lastChunk) {
14829        this.gfx.endDrawing();
14830        InternalRenderTask.#canvasInUse.delete(this._canvas);
14831        this.callback();
14832      }
14833    }
14834  }
14835}
14836const version = '3.11.174';
14837exports.version = version;
14838const build = 'ce8716743';
14839exports.build = build;
14840
14841/***/ }),
14842/* 3 */
14843/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
14844
14845
14846
14847Object.defineProperty(exports, "__esModule", ({
14848  value: true
14849}));
14850exports.SerializableEmpty = exports.PrintAnnotationStorage = exports.AnnotationStorage = void 0;
14851var _util = __w_pdfjs_require__(1);
14852var _editor = __w_pdfjs_require__(4);
14853var _murmurhash = __w_pdfjs_require__(8);
14854const SerializableEmpty = Object.freeze({
14855  map: null,
14856  hash: "",
14857  transfers: undefined
14858});
14859exports.SerializableEmpty = SerializableEmpty;
14860class AnnotationStorage {
14861  #modified = false;
14862  #storage = new Map();
14863  constructor() {
14864    this.onSetModified = null;
14865    this.onResetModified = null;
14866    this.onAnnotationEditor = null;
14867  }
14868  getValue(key, defaultValue) {
14869    const value = this.#storage.get(key);
14870    if (value === undefined) {
14871      return defaultValue;
14872    }
14873    return Object.assign(defaultValue, value);
14874  }
14875  getRawValue(key) {
14876    return this.#storage.get(key);
14877  }
14878  remove(key) {
14879    this.#storage.delete(key);
14880    if (this.#storage.size === 0) {
14881      this.resetModified();
14882    }
14883    if (typeof this.onAnnotationEditor === "function") {
14884      for (const value of this.#storage.values()) {
14885        if (value instanceof _editor.AnnotationEditor) {
14886          return;
14887        }
14888      }
14889      this.onAnnotationEditor(null);
14890    }
14891  }
14892  setValue(key, value) {
14893    const obj = this.#storage.get(key);
14894    let modified = false;
14895    if (obj !== undefined) {
14896      for (const [entry, val] of Object.entries(value)) {
14897        if (obj[entry] !== val) {
14898          modified = true;
14899          obj[entry] = val;
14900        }
14901      }
14902    } else {
14903      modified = true;
14904      this.#storage.set(key, value);
14905    }
14906    if (modified) {
14907      this.#setModified();
14908    }
14909    if (value instanceof _editor.AnnotationEditor && typeof this.onAnnotationEditor === "function") {
14910      this.onAnnotationEditor(value.constructor._type);
14911    }
14912  }
14913  has(key) {
14914    return this.#storage.has(key);
14915  }
14916  getAll() {
14917    return this.#storage.size > 0 ? (0, _util.objectFromMap)(this.#storage) : null;
14918  }
14919  setAll(obj) {
14920    for (const [key, val] of Object.entries(obj)) {
14921      this.setValue(key, val);
14922    }
14923  }
14924  get size() {
14925    return this.#storage.size;
14926  }
14927  #setModified() {
14928    if (!this.#modified) {
14929      this.#modified = true;
14930      if (typeof this.onSetModified === "function") {
14931        this.onSetModified();
14932      }
14933    }
14934  }
14935  resetModified() {
14936    if (this.#modified) {
14937      this.#modified = false;
14938      if (typeof this.onResetModified === "function") {
14939        this.onResetModified();
14940      }
14941    }
14942  }
14943  get print() {
14944    return new PrintAnnotationStorage(this);
14945  }
14946  get serializable() {
14947    if (this.#storage.size === 0) {
14948      return SerializableEmpty;
14949    }
14950    const map = new Map(),
14951      hash = new _murmurhash.MurmurHash3_64(),
14952      transfers = [];
14953    const context = Object.create(null);
14954    let hasBitmap = false;
14955    for (const [key, val] of this.#storage) {
14956      const serialized = val instanceof _editor.AnnotationEditor ? val.serialize(false, context) : val;
14957      if (serialized) {
14958        map.set(key, serialized);
14959        hash.update(`${key}:${JSON.stringify(serialized)}`);
14960        hasBitmap ||= !!serialized.bitmap;
14961      }
14962    }
14963    if (hasBitmap) {
14964      for (const value of map.values()) {
14965        if (value.bitmap) {
14966          transfers.push(value.bitmap);
14967        }
14968      }
14969    }
14970    return map.size > 0 ? {
14971      map,
14972      hash: hash.hexdigest(),
14973      transfers
14974    } : SerializableEmpty;
14975  }
14976}
14977exports.AnnotationStorage = AnnotationStorage;
14978class PrintAnnotationStorage extends AnnotationStorage {
14979  #serializable;
14980  constructor(parent) {
14981    super();
14982    const {
14983      map,
14984      hash,
14985      transfers
14986    } = parent.serializable;
14987    const clone = structuredClone(map, transfers ? {
14988      transfer: transfers
14989    } : null);
14990    this.#serializable = {
14991      map: clone,
14992      hash,
14993      transfers
14994    };
14995  }
14996  get print() {
14997    (0, _util.unreachable)("Should not call PrintAnnotationStorage.print");
14998  }
14999  get serializable() {
15000    return this.#serializable;
15001  }
15002}
15003exports.PrintAnnotationStorage = PrintAnnotationStorage;
15004
15005/***/ }),
15006/* 4 */
15007/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
15008
15009
15010
15011Object.defineProperty(exports, "__esModule", ({
15012  value: true
15013}));
15014exports.AnnotationEditor = void 0;
15015var _tools = __w_pdfjs_require__(5);
15016var _util = __w_pdfjs_require__(1);
15017var _display_utils = __w_pdfjs_require__(6);
15018class AnnotationEditor {
15019  #altText = "";
15020  #altTextDecorative = false;
15021  #altTextButton = null;
15022  #altTextTooltip = null;
15023  #altTextTooltipTimeout = null;
15024  #keepAspectRatio = false;
15025  #resizersDiv = null;
15026  #boundFocusin = this.focusin.bind(this);
15027  #boundFocusout = this.focusout.bind(this);
15028  #hasBeenClicked = false;
15029  #isEditing = false;
15030  #isInEditMode = false;
15031  _initialOptions = Object.create(null);
15032  _uiManager = null;
15033  _focusEventsAllowed = true;
15034  _l10nPromise = null;
15035  #isDraggable = false;
15036  #zIndex = AnnotationEditor._zIndex++;
15037  static _borderLineWidth = -1;
15038  static _colorManager = new _tools.ColorManager();
15039  static _zIndex = 1;
15040  static SMALL_EDITOR_SIZE = 0;
15041  constructor(parameters) {
15042    if (this.constructor === AnnotationEditor) {
15043      (0, _util.unreachable)("Cannot initialize AnnotationEditor.");
15044    }
15045    this.parent = parameters.parent;
15046    this.id = parameters.id;
15047    this.width = this.height = null;
15048    this.pageIndex = parameters.parent.pageIndex;
15049    this.name = parameters.name;
15050    this.div = null;
15051    this._uiManager = parameters.uiManager;
15052    this.annotationElementId = null;
15053    this._willKeepAspectRatio = false;
15054    this._initialOptions.isCentered = parameters.isCentered;
15055    this._structTreeParentId = null;
15056    const {
15057      rotation,
15058      rawDims: {
15059        pageWidth,
15060        pageHeight,
15061        pageX,
15062        pageY
15063      }
15064    } = this.parent.viewport;
15065    this.rotation = rotation;
15066    this.pageRotation = (360 + rotation - this._uiManager.viewParameters.rotation) % 360;
15067    this.pageDimensions = [pageWidth, pageHeight];
15068    this.pageTranslation = [pageX, pageY];
15069    const [width, height] = this.parentDimensions;
15070    this.x = parameters.x / width;
15071    this.y = parameters.y / height;
15072    this.isAttachedToDOM = false;
15073    this.deleted = false;
15074  }
15075  get editorType() {
15076    return Object.getPrototypeOf(this).constructor._type;
15077  }
15078  static get _defaultLineColor() {
15079    return (0, _util.shadow)(this, "_defaultLineColor", this._colorManager.getHexCode("CanvasText"));
15080  }
15081  static deleteAnnotationElement(editor) {
15082    const fakeEditor = new FakeEditor({
15083      id: editor.parent.getNextId(),
15084      parent: editor.parent,
15085      uiManager: editor._uiManager
15086    });
15087    fakeEditor.annotationElementId = editor.annotationElementId;
15088    fakeEditor.deleted = true;
15089    fakeEditor._uiManager.addToAnnotationStorage(fakeEditor);
15090  }
15091  static initialize(l10n, options = null) {
15092    AnnotationEditor._l10nPromise ||= new Map(["editor_alt_text_button_label", "editor_alt_text_edit_button_label", "editor_alt_text_decorative_tooltip"].map(str => [str, l10n.get(str)]));
15093    if (options?.strings) {
15094      for (const str of options.strings) {
15095        AnnotationEditor._l10nPromise.set(str, l10n.get(str));
15096      }
15097    }
15098    if (AnnotationEditor._borderLineWidth !== -1) {
15099      return;
15100    }
15101    const style = getComputedStyle(document.documentElement);
15102    AnnotationEditor._borderLineWidth = parseFloat(style.getPropertyValue("--outline-width")) || 0;
15103  }
15104  static updateDefaultParams(_type, _value) {}
15105  static get defaultPropertiesToUpdate() {
15106    return [];
15107  }
15108  static isHandlingMimeForPasting(mime) {
15109    return false;
15110  }
15111  static paste(item, parent) {
15112    (0, _util.unreachable)("Not implemented");
15113  }
15114  get propertiesToUpdate() {
15115    return [];
15116  }
15117  get _isDraggable() {
15118    return this.#isDraggable;
15119  }
15120  set _isDraggable(value) {
15121    this.#isDraggable = value;
15122    this.div?.classList.toggle("draggable", value);
15123  }
15124  center() {
15125    const [pageWidth, pageHeight] = this.pageDimensions;
15126    switch (this.parentRotation) {
15127      case 90:
15128        this.x -= this.height * pageHeight / (pageWidth * 2);
15129        this.y += this.width * pageWidth / (pageHeight * 2);
15130        break;
15131      case 180:
15132        this.x += this.width / 2;
15133        this.y += this.height / 2;
15134        break;
15135      case 270:
15136        this.x += this.height * pageHeight / (pageWidth * 2);
15137        this.y -= this.width * pageWidth / (pageHeight * 2);
15138        break;
15139      default:
15140        this.x -= this.width / 2;
15141        this.y -= this.height / 2;
15142        break;
15143    }
15144    this.fixAndSetPosition();
15145  }
15146  addCommands(params) {
15147    this._uiManager.addCommands(params);
15148  }
15149  get currentLayer() {
15150    return this._uiManager.currentLayer;
15151  }
15152  setInBackground() {
15153    this.div.style.zIndex = 0;
15154  }
15155  setInForeground() {
15156    this.div.style.zIndex = this.#zIndex;
15157  }
15158  setParent(parent) {
15159    if (parent !== null) {
15160      this.pageIndex = parent.pageIndex;
15161      this.pageDimensions = parent.pageDimensions;
15162    }
15163    this.parent = parent;
15164  }
15165  focusin(event) {
15166    if (!this._focusEventsAllowed) {
15167      return;
15168    }
15169    if (!this.#hasBeenClicked) {
15170      this.parent.setSelected(this);
15171    } else {
15172      this.#hasBeenClicked = false;
15173    }
15174  }
15175  focusout(event) {
15176    if (!this._focusEventsAllowed) {
15177      return;
15178    }
15179    if (!this.isAttachedToDOM) {
15180      return;
15181    }
15182    const target = event.relatedTarget;
15183    if (target?.closest(`#${this.id}`)) {
15184      return;
15185    }
15186    event.preventDefault();
15187    if (!this.parent?.isMultipleSelection) {
15188      this.commitOrRemove();
15189    }
15190  }
15191  commitOrRemove() {
15192    if (this.isEmpty()) {
15193      this.remove();
15194    } else {
15195      this.commit();
15196    }
15197  }
15198  commit() {
15199    this.addToAnnotationStorage();
15200  }
15201  addToAnnotationStorage() {
15202    this._uiManager.addToAnnotationStorage(this);
15203  }
15204  setAt(x, y, tx, ty) {
15205    const [width, height] = this.parentDimensions;
15206    [tx, ty] = this.screenToPageTranslation(tx, ty);
15207    this.x = (x + tx) / width;
15208    this.y = (y + ty) / height;
15209    this.fixAndSetPosition();
15210  }
15211  #translate([width, height], x, y) {
15212    [x, y] = this.screenToPageTranslation(x, y);
15213    this.x += x / width;
15214    this.y += y / height;
15215    this.fixAndSetPosition();
15216  }
15217  translate(x, y) {
15218    this.#translate(this.parentDimensions, x, y);
15219  }
15220  translateInPage(x, y) {
15221    this.#translate(this.pageDimensions, x, y);
15222    this.div.scrollIntoView({
15223      block: "nearest"
15224    });
15225  }
15226  drag(tx, ty) {
15227    const [parentWidth, parentHeight] = this.parentDimensions;
15228    this.x += tx / parentWidth;
15229    this.y += ty / parentHeight;
15230    if (this.parent && (this.x < 0 || this.x > 1 || this.y < 0 || this.y > 1)) {
15231      const {
15232        x,
15233        y
15234      } = this.div.getBoundingClientRect();
15235      if (this.parent.findNewParent(this, x, y)) {
15236        this.x -= Math.floor(this.x);
15237        this.y -= Math.floor(this.y);
15238      }
15239    }
15240    let {
15241      x,
15242      y
15243    } = this;
15244    const [bx, by] = this.#getBaseTranslation();
15245    x += bx;
15246    y += by;
15247    this.div.style.left = `${(100 * x).toFixed(2)}%`;
15248    this.div.style.top = `${(100 * y).toFixed(2)}%`;
15249    this.div.scrollIntoView({
15250      block: "nearest"
15251    });
15252  }
15253  #getBaseTranslation() {
15254    const [parentWidth, parentHeight] = this.parentDimensions;
15255    const {
15256      _borderLineWidth
15257    } = AnnotationEditor;
15258    const x = _borderLineWidth / parentWidth;
15259    const y = _borderLineWidth / parentHeight;
15260    switch (this.rotation) {
15261      case 90:
15262        return [-x, y];
15263      case 180:
15264        return [x, y];
15265      case 270:
15266        return [x, -y];
15267      default:
15268        return [-x, -y];
15269    }
15270  }
15271  fixAndSetPosition() {
15272    const [pageWidth, pageHeight] = this.pageDimensions;
15273    let {
15274      x,
15275      y,
15276      width,
15277      height
15278    } = this;
15279    width *= pageWidth;
15280    height *= pageHeight;
15281    x *= pageWidth;
15282    y *= pageHeight;
15283    switch (this.rotation) {
15284      case 0:
15285        x = Math.max(0, Math.min(pageWidth - width, x));
15286        y = Math.max(0, Math.min(pageHeight - height, y));
15287        break;
15288      case 90:
15289        x = Math.max(0, Math.min(pageWidth - height, x));
15290        y = Math.min(pageHeight, Math.max(width, y));
15291        break;
15292      case 180:
15293        x = Math.min(pageWidth, Math.max(width, x));
15294        y = Math.min(pageHeight, Math.max(height, y));
15295        break;
15296      case 270:
15297        x = Math.min(pageWidth, Math.max(height, x));
15298        y = Math.max(0, Math.min(pageHeight - width, y));
15299        break;
15300    }
15301    this.x = x /= pageWidth;
15302    this.y = y /= pageHeight;
15303    const [bx, by] = this.#getBaseTranslation();
15304    x += bx;
15305    y += by;
15306    const {
15307      style
15308    } = this.div;
15309    style.left = `${(100 * x).toFixed(2)}%`;
15310    style.top = `${(100 * y).toFixed(2)}%`;
15311    this.moveInDOM();
15312  }
15313  static #rotatePoint(x, y, angle) {
15314    switch (angle) {
15315      case 90:
15316        return [y, -x];
15317      case 180:
15318        return [-x, -y];
15319      case 270:
15320        return [-y, x];
15321      default:
15322        return [x, y];
15323    }
15324  }
15325  screenToPageTranslation(x, y) {
15326    return AnnotationEditor.#rotatePoint(x, y, this.parentRotation);
15327  }
15328  pageTranslationToScreen(x, y) {
15329    return AnnotationEditor.#rotatePoint(x, y, 360 - this.parentRotation);
15330  }
15331  #getRotationMatrix(rotation) {
15332    switch (rotation) {
15333      case 90:
15334        {
15335          const [pageWidth, pageHeight] = this.pageDimensions;
15336          return [0, -pageWidth / pageHeight, pageHeight / pageWidth, 0];
15337        }
15338      case 180:
15339        return [-1, 0, 0, -1];
15340      case 270:
15341        {
15342          const [pageWidth, pageHeight] = this.pageDimensions;
15343          return [0, pageWidth / pageHeight, -pageHeight / pageWidth, 0];
15344        }
15345      default:
15346        return [1, 0, 0, 1];
15347    }
15348  }
15349  get parentScale() {
15350    return this._uiManager.viewParameters.realScale;
15351  }
15352  get parentRotation() {
15353    return (this._uiManager.viewParameters.rotation + this.pageRotation) % 360;
15354  }
15355  get parentDimensions() {
15356    const {
15357      parentScale,
15358      pageDimensions: [pageWidth, pageHeight]
15359    } = this;
15360    const scaledWidth = pageWidth * parentScale;
15361    const scaledHeight = pageHeight * parentScale;
15362    return _util.FeatureTest.isCSSRoundSupported ? [Math.round(scaledWidth), Math.round(scaledHeight)] : [scaledWidth, scaledHeight];
15363  }
15364  setDims(width, height) {
15365    const [parentWidth, parentHeight] = this.parentDimensions;
15366    this.div.style.width = `${(100 * width / parentWidth).toFixed(2)}%`;
15367    if (!this.#keepAspectRatio) {
15368      this.div.style.height = `${(100 * height / parentHeight).toFixed(2)}%`;
15369    }
15370    this.#altTextButton?.classList.toggle("small", width < AnnotationEditor.SMALL_EDITOR_SIZE || height < AnnotationEditor.SMALL_EDITOR_SIZE);
15371  }
15372  fixDims() {
15373    const {
15374      style
15375    } = this.div;
15376    const {
15377      height,
15378      width
15379    } = style;
15380    const widthPercent = width.endsWith("%");
15381    const heightPercent = !this.#keepAspectRatio && height.endsWith("%");
15382    if (widthPercent && heightPercent) {
15383      return;
15384    }
15385    const [parentWidth, parentHeight] = this.parentDimensions;
15386    if (!widthPercent) {
15387      style.width = `${(100 * parseFloat(width) / parentWidth).toFixed(2)}%`;
15388    }
15389    if (!this.#keepAspectRatio && !heightPercent) {
15390      style.height = `${(100 * parseFloat(height) / parentHeight).toFixed(2)}%`;
15391    }
15392  }
15393  getInitialTranslation() {
15394    return [0, 0];
15395  }
15396  #createResizers() {
15397    if (this.#resizersDiv) {
15398      return;
15399    }
15400    this.#resizersDiv = document.createElement("div");
15401    this.#resizersDiv.classList.add("resizers");
15402    const classes = ["topLeft", "topRight", "bottomRight", "bottomLeft"];
15403    if (!this._willKeepAspectRatio) {
15404      classes.push("topMiddle", "middleRight", "bottomMiddle", "middleLeft");
15405    }
15406    for (const name of classes) {
15407      const div = document.createElement("div");
15408      this.#resizersDiv.append(div);
15409      div.classList.add("resizer", name);
15410      div.addEventListener("pointerdown", this.#resizerPointerdown.bind(this, name));
15411      div.addEventListener("contextmenu", _display_utils.noContextMenu);
15412    }
15413    this.div.prepend(this.#resizersDiv);
15414  }
15415  #resizerPointerdown(name, event) {
15416    event.preventDefault();
15417    const {
15418      isMac
15419    } = _util.FeatureTest.platform;
15420    if (event.button !== 0 || event.ctrlKey && isMac) {
15421      return;
15422    }
15423    const boundResizerPointermove = this.#resizerPointermove.bind(this, name);
15424    const savedDraggable = this._isDraggable;
15425    this._isDraggable = false;
15426    const pointerMoveOptions = {
15427      passive: true,
15428      capture: true
15429    };
15430    window.addEventListener("pointermove", boundResizerPointermove, pointerMoveOptions);
15431    const savedX = this.x;
15432    const savedY = this.y;
15433    const savedWidth = this.width;
15434    const savedHeight = this.height;
15435    const savedParentCursor = this.parent.div.style.cursor;
15436    const savedCursor = this.div.style.cursor;
15437    this.div.style.cursor = this.parent.div.style.cursor = window.getComputedStyle(event.target).cursor;
15438    const pointerUpCallback = () => {
15439      this._isDraggable = savedDraggable;
15440      window.removeEventListener("pointerup", pointerUpCallback);
15441      window.removeEventListener("blur", pointerUpCallback);
15442      window.removeEventListener("pointermove", boundResizerPointermove, pointerMoveOptions);
15443      this.parent.div.style.cursor = savedParentCursor;
15444      this.div.style.cursor = savedCursor;
15445      const newX = this.x;
15446      const newY = this.y;
15447      const newWidth = this.width;
15448      const newHeight = this.height;
15449      if (newX === savedX && newY === savedY && newWidth === savedWidth && newHeight === savedHeight) {
15450        return;
15451      }
15452      this.addCommands({
15453        cmd: () => {
15454          this.width = newWidth;
15455          this.height = newHeight;
15456          this.x = newX;
15457          this.y = newY;
15458          const [parentWidth, parentHeight] = this.parentDimensions;
15459          this.setDims(parentWidth * newWidth, parentHeight * newHeight);
15460          this.fixAndSetPosition();
15461        },
15462        undo: () => {
15463          this.width = savedWidth;
15464          this.height = savedHeight;
15465          this.x = savedX;
15466          this.y = savedY;
15467          const [parentWidth, parentHeight] = this.parentDimensions;
15468          this.setDims(parentWidth * savedWidth, parentHeight * savedHeight);
15469          this.fixAndSetPosition();
15470        },
15471        mustExec: true
15472      });
15473    };
15474    window.addEventListener("pointerup", pointerUpCallback);
15475    window.addEventListener("blur", pointerUpCallback);
15476  }
15477  #resizerPointermove(name, event) {
15478    const [parentWidth, parentHeight] = this.parentDimensions;
15479    const savedX = this.x;
15480    const savedY = this.y;
15481    const savedWidth = this.width;
15482    const savedHeight = this.height;
15483    const minWidth = AnnotationEditor.MIN_SIZE / parentWidth;
15484    const minHeight = AnnotationEditor.MIN_SIZE / parentHeight;
15485    const round = x => Math.round(x * 10000) / 10000;
15486    const rotationMatrix = this.#getRotationMatrix(this.rotation);
15487    const transf = (x, y) => [rotationMatrix[0] * x + rotationMatrix[2] * y, rotationMatrix[1] * x + rotationMatrix[3] * y];
15488    const invRotationMatrix = this.#getRotationMatrix(360 - this.rotation);
15489    const invTransf = (x, y) => [invRotationMatrix[0] * x + invRotationMatrix[2] * y, invRotationMatrix[1] * x + invRotationMatrix[3] * y];
15490    let getPoint;
15491    let getOpposite;
15492    let isDiagonal = false;
15493    let isHorizontal = false;
15494    switch (name) {
15495      case "topLeft":
15496        isDiagonal = true;
15497        getPoint = (w, h) => [0, 0];
15498        getOpposite = (w, h) => [w, h];
15499        break;
15500      case "topMiddle":
15501        getPoint = (w, h) => [w / 2, 0];
15502        getOpposite = (w, h) => [w / 2, h];
15503        break;
15504      case "topRight":
15505        isDiagonal = true;
15506        getPoint = (w, h) => [w, 0];
15507        getOpposite = (w, h) => [0, h];
15508        break;
15509      case "middleRight":
15510        isHorizontal = true;
15511        getPoint = (w, h) => [w, h / 2];
15512        getOpposite = (w, h) => [0, h / 2];
15513        break;
15514      case "bottomRight":
15515        isDiagonal = true;
15516        getPoint = (w, h) => [w, h];
15517        getOpposite = (w, h) => [0, 0];
15518        break;
15519      case "bottomMiddle":
15520        getPoint = (w, h) => [w / 2, h];
15521        getOpposite = (w, h) => [w / 2, 0];
15522        break;
15523      case "bottomLeft":
15524        isDiagonal = true;
15525        getPoint = (w, h) => [0, h];
15526        getOpposite = (w, h) => [w, 0];
15527        break;
15528      case "middleLeft":
15529        isHorizontal = true;
15530        getPoint = (w, h) => [0, h / 2];
15531        getOpposite = (w, h) => [w, h / 2];
15532        break;
15533    }
15534    const point = getPoint(savedWidth, savedHeight);
15535    const oppositePoint = getOpposite(savedWidth, savedHeight);
15536    let transfOppositePoint = transf(...oppositePoint);
15537    const oppositeX = round(savedX + transfOppositePoint[0]);
15538    const oppositeY = round(savedY + transfOppositePoint[1]);
15539    let ratioX = 1;
15540    let ratioY = 1;
15541    let [deltaX, deltaY] = this.screenToPageTranslation(event.movementX, event.movementY);
15542    [deltaX, deltaY] = invTransf(deltaX / parentWidth, deltaY / parentHeight);
15543    if (isDiagonal) {
15544      const oldDiag = Math.hypot(savedWidth, savedHeight);
15545      ratioX = ratioY = Math.max(Math.min(Math.hypot(oppositePoint[0] - point[0] - deltaX, oppositePoint[1] - point[1] - deltaY) / oldDiag, 1 / savedWidth, 1 / savedHeight), minWidth / savedWidth, minHeight / savedHeight);
15546    } else if (isHorizontal) {
15547      ratioX = Math.max(minWidth, Math.min(1, Math.abs(oppositePoint[0] - point[0] - deltaX))) / savedWidth;
15548    } else {
15549      ratioY = Math.max(minHeight, Math.min(1, Math.abs(oppositePoint[1] - point[1] - deltaY))) / savedHeight;
15550    }
15551    const newWidth = round(savedWidth * ratioX);
15552    const newHeight = round(savedHeight * ratioY);
15553    transfOppositePoint = transf(...getOpposite(newWidth, newHeight));
15554    const newX = oppositeX - transfOppositePoint[0];
15555    const newY = oppositeY - transfOppositePoint[1];
15556    this.width = newWidth;
15557    this.height = newHeight;
15558    this.x = newX;
15559    this.y = newY;
15560    this.setDims(parentWidth * newWidth, parentHeight * newHeight);
15561    this.fixAndSetPosition();
15562  }
15563  async addAltTextButton() {
15564    if (this.#altTextButton) {
15565      return;
15566    }
15567    const altText = this.#altTextButton = document.createElement("button");
15568    altText.className = "altText";
15569    const msg = await AnnotationEditor._l10nPromise.get("editor_alt_text_button_label");
15570    altText.textContent = msg;
15571    altText.setAttribute("aria-label", msg);
15572    altText.tabIndex = "0";
15573    altText.addEventListener("contextmenu", _display_utils.noContextMenu);
15574    altText.addEventListener("pointerdown", event => event.stopPropagation());
15575    altText.addEventListener("click", event => {
15576      event.preventDefault();
15577      this._uiManager.editAltText(this);
15578    }, {
15579      capture: true
15580    });
15581    altText.addEventListener("keydown", event => {
15582      if (event.target === altText && event.key === "Enter") {
15583        event.preventDefault();
15584        this._uiManager.editAltText(this);
15585      }
15586    });
15587    this.#setAltTextButtonState();
15588    this.div.append(altText);
15589    if (!AnnotationEditor.SMALL_EDITOR_SIZE) {
15590      const PERCENT = 40;
15591      AnnotationEditor.SMALL_EDITOR_SIZE = Math.min(128, Math.round(altText.getBoundingClientRect().width * (1 + PERCENT / 100)));
15592    }
15593  }
15594  async #setAltTextButtonState() {
15595    const button = this.#altTextButton;
15596    if (!button) {
15597      return;
15598    }
15599    if (!this.#altText && !this.#altTextDecorative) {
15600      button.classList.remove("done");
15601      this.#altTextTooltip?.remove();
15602      return;
15603    }
15604    AnnotationEditor._l10nPromise.get("editor_alt_text_edit_button_label").then(msg => {
15605      button.setAttribute("aria-label", msg);
15606    });
15607    let tooltip = this.#altTextTooltip;
15608    if (!tooltip) {
15609      this.#altTextTooltip = tooltip = document.createElement("span");
15610      tooltip.className = "tooltip";
15611      tooltip.setAttribute("role", "tooltip");
15612      const id = tooltip.id = `alt-text-tooltip-${this.id}`;
15613      button.setAttribute("aria-describedby", id);
15614      const DELAY_TO_SHOW_TOOLTIP = 100;
15615      button.addEventListener("mouseenter", () => {
15616        this.#altTextTooltipTimeout = setTimeout(() => {
15617          this.#altTextTooltipTimeout = null;
15618          this.#altTextTooltip.classList.add("show");
15619          this._uiManager._eventBus.dispatch("reporttelemetry", {
15620            source: this,
15621            details: {
15622              type: "editing",
15623              subtype: this.editorType,
15624              data: {
15625                action: "alt_text_tooltip"
15626              }
15627            }
15628          });
15629        }, DELAY_TO_SHOW_TOOLTIP);
15630      });
15631      button.addEventListener("mouseleave", () => {
15632        clearTimeout(this.#altTextTooltipTimeout);
15633        this.#altTextTooltipTimeout = null;
15634        this.#altTextTooltip?.classList.remove("show");
15635      });
15636    }
15637    button.classList.add("done");
15638    tooltip.innerText = this.#altTextDecorative ? await AnnotationEditor._l10nPromise.get("editor_alt_text_decorative_tooltip") : this.#altText;
15639    if (!tooltip.parentNode) {
15640      button.append(tooltip);
15641    }
15642  }
15643  getClientDimensions() {
15644    return this.div.getBoundingClientRect();
15645  }
15646  get altTextData() {
15647    return {
15648      altText: this.#altText,
15649      decorative: this.#altTextDecorative
15650    };
15651  }
15652  set altTextData({
15653    altText,
15654    decorative
15655  }) {
15656    if (this.#altText === altText && this.#altTextDecorative === decorative) {
15657      return;
15658    }
15659    this.#altText = altText;
15660    this.#altTextDecorative = decorative;
15661    this.#setAltTextButtonState();
15662  }
15663  render() {
15664    this.div = document.createElement("div");
15665    this.div.setAttribute("data-editor-rotation", (360 - this.rotation) % 360);
15666    this.div.className = this.name;
15667    this.div.setAttribute("id", this.id);
15668    this.div.setAttribute("tabIndex", 0);
15669    this.setInForeground();
15670    this.div.addEventListener("focusin", this.#boundFocusin);
15671    this.div.addEventListener("focusout", this.#boundFocusout);
15672    const [parentWidth, parentHeight] = this.parentDimensions;
15673    if (this.parentRotation % 180 !== 0) {
15674      this.div.style.maxWidth = `${(100 * parentHeight / parentWidth).toFixed(2)}%`;
15675      this.div.style.maxHeight = `${(100 * parentWidth / parentHeight).toFixed(2)}%`;
15676    }
15677    const [tx, ty] = this.getInitialTranslation();
15678    this.translate(tx, ty);
15679    (0, _tools.bindEvents)(this, this.div, ["pointerdown"]);
15680    return this.div;
15681  }
15682  pointerdown(event) {
15683    const {
15684      isMac
15685    } = _util.FeatureTest.platform;
15686    if (event.button !== 0 || event.ctrlKey && isMac) {
15687      event.preventDefault();
15688      return;
15689    }
15690    this.#hasBeenClicked = true;
15691    this.#setUpDragSession(event);
15692  }
15693  #setUpDragSession(event) {
15694    if (!this._isDraggable) {
15695      return;
15696    }
15697    const isSelected = this._uiManager.isSelected(this);
15698    this._uiManager.setUpDragSession();
15699    let pointerMoveOptions, pointerMoveCallback;
15700    if (isSelected) {
15701      pointerMoveOptions = {
15702        passive: true,
15703        capture: true
15704      };
15705      pointerMoveCallback = e => {
15706        const [tx, ty] = this.screenToPageTranslation(e.movementX, e.movementY);
15707        this._uiManager.dragSelectedEditors(tx, ty);
15708      };
15709      window.addEventListener("pointermove", pointerMoveCallback, pointerMoveOptions);
15710    }
15711    const pointerUpCallback = () => {
15712      window.removeEventListener("pointerup", pointerUpCallback);
15713      window.removeEventListener("blur", pointerUpCallback);
15714      if (isSelected) {
15715        window.removeEventListener("pointermove", pointerMoveCallback, pointerMoveOptions);
15716      }
15717      this.#hasBeenClicked = false;
15718      if (!this._uiManager.endDragSession()) {
15719        const {
15720          isMac
15721        } = _util.FeatureTest.platform;
15722        if (event.ctrlKey && !isMac || event.shiftKey || event.metaKey && isMac) {
15723          this.parent.toggleSelected(this);
15724        } else {
15725          this.parent.setSelected(this);
15726        }
15727      }
15728    };
15729    window.addEventListener("pointerup", pointerUpCallback);
15730    window.addEventListener("blur", pointerUpCallback);
15731  }
15732  moveInDOM() {
15733    this.parent?.moveEditorInDOM(this);
15734  }
15735  _setParentAndPosition(parent, x, y) {
15736    parent.changeParent(this);
15737    this.x = x;
15738    this.y = y;
15739    this.fixAndSetPosition();
15740  }
15741  getRect(tx, ty) {
15742    const scale = this.parentScale;
15743    const [pageWidth, pageHeight] = this.pageDimensions;
15744    const [pageX, pageY] = this.pageTranslation;
15745    const shiftX = tx / scale;
15746    const shiftY = ty / scale;
15747    const x = this.x * pageWidth;
15748    const y = this.y * pageHeight;
15749    const width = this.width * pageWidth;
15750    const height = this.height * pageHeight;
15751    switch (this.rotation) {
15752      case 0:
15753        return [x + shiftX + pageX, pageHeight - y - shiftY - height + pageY, x + shiftX + width + pageX, pageHeight - y - shiftY + pageY];
15754      case 90:
15755        return [x + shiftY + pageX, pageHeight - y + shiftX + pageY, x + shiftY + height + pageX, pageHeight - y + shiftX + width + pageY];
15756      case 180:
15757        return [x - shiftX - width + pageX, pageHeight - y + shiftY + pageY, x - shiftX + pageX, pageHeight - y + shiftY + height + pageY];
15758      case 270:
15759        return [x - shiftY - height + pageX, pageHeight - y - shiftX - width + pageY, x - shiftY + pageX, pageHeight - y - shiftX + pageY];
15760      default:
15761        throw new Error("Invalid rotation");
15762    }
15763  }
15764  getRectInCurrentCoords(rect, pageHeight) {
15765    const [x1, y1, x2, y2] = rect;
15766    const width = x2 - x1;
15767    const height = y2 - y1;
15768    switch (this.rotation) {
15769      case 0:
15770        return [x1, pageHeight - y2, width, height];
15771      case 90:
15772        return [x1, pageHeight - y1, height, width];
15773      case 180:
15774        return [x2, pageHeight - y1, width, height];
15775      case 270:
15776        return [x2, pageHeight - y2, height, width];
15777      default:
15778        throw new Error("Invalid rotation");
15779    }
15780  }
15781  onceAdded() {}
15782  isEmpty() {
15783    return false;
15784  }
15785  enableEditMode() {
15786    this.#isInEditMode = true;
15787  }
15788  disableEditMode() {
15789    this.#isInEditMode = false;
15790  }
15791  isInEditMode() {
15792    return this.#isInEditMode;
15793  }
15794  shouldGetKeyboardEvents() {
15795    return false;
15796  }
15797  needsToBeRebuilt() {
15798    return this.div && !this.isAttachedToDOM;
15799  }
15800  rebuild() {
15801    this.div?.addEventListener("focusin", this.#boundFocusin);
15802    this.div?.addEventListener("focusout", this.#boundFocusout);
15803  }
15804  serialize(isForCopying = false, context = null) {
15805    (0, _util.unreachable)("An editor must be serializable");
15806  }
15807  static deserialize(data, parent, uiManager) {
15808    const editor = new this.prototype.constructor({
15809      parent,
15810      id: parent.getNextId(),
15811      uiManager
15812    });
15813    editor.rotation = data.rotation;
15814    const [pageWidth, pageHeight] = editor.pageDimensions;
15815    const [x, y, width, height] = editor.getRectInCurrentCoords(data.rect, pageHeight);
15816    editor.x = x / pageWidth;
15817    editor.y = y / pageHeight;
15818    editor.width = width / pageWidth;
15819    editor.height = height / pageHeight;
15820    return editor;
15821  }
15822  remove() {
15823    this.div.removeEventListener("focusin", this.#boundFocusin);
15824    this.div.removeEventListener("focusout", this.#boundFocusout);
15825    if (!this.isEmpty()) {
15826      this.commit();
15827    }
15828    if (this.parent) {
15829      this.parent.remove(this);
15830    } else {
15831      this._uiManager.removeEditor(this);
15832    }
15833    this.#altTextButton?.remove();
15834    this.#altTextButton = null;
15835    this.#altTextTooltip = null;
15836  }
15837  get isResizable() {
15838    return false;
15839  }
15840  makeResizable() {
15841    if (this.isResizable) {
15842      this.#createResizers();
15843      this.#resizersDiv.classList.remove("hidden");
15844    }
15845  }
15846  select() {
15847    this.makeResizable();
15848    this.div?.classList.add("selectedEditor");
15849  }
15850  unselect() {
15851    this.#resizersDiv?.classList.add("hidden");
15852    this.div?.classList.remove("selectedEditor");
15853    if (this.div?.contains(document.activeElement)) {
15854      this._uiManager.currentLayer.div.focus();
15855    }
15856  }
15857  updateParams(type, value) {}
15858  disableEditing() {
15859    if (this.#altTextButton) {
15860      this.#altTextButton.hidden = true;
15861    }
15862  }
15863  enableEditing() {
15864    if (this.#altTextButton) {
15865      this.#altTextButton.hidden = false;
15866    }
15867  }
15868  enterInEditMode() {}
15869  get contentDiv() {
15870    return this.div;
15871  }
15872  get isEditing() {
15873    return this.#isEditing;
15874  }
15875  set isEditing(value) {
15876    this.#isEditing = value;
15877    if (!this.parent) {
15878      return;
15879    }
15880    if (value) {
15881      this.parent.setSelected(this);
15882      this.parent.setActiveEditor(this);
15883    } else {
15884      this.parent.setActiveEditor(null);
15885    }
15886  }
15887  setAspectRatio(width, height) {
15888    this.#keepAspectRatio = true;
15889    const aspectRatio = width / height;
15890    const {
15891      style
15892    } = this.div;
15893    style.aspectRatio = aspectRatio;
15894    style.height = "auto";
15895  }
15896  static get MIN_SIZE() {
15897    return 16;
15898  }
15899}
15900exports.AnnotationEditor = AnnotationEditor;
15901class FakeEditor extends AnnotationEditor {
15902  constructor(params) {
15903    super(params);
15904    this.annotationElementId = params.annotationElementId;
15905    this.deleted = true;
15906  }
15907  serialize() {
15908    return {
15909      id: this.annotationElementId,
15910      deleted: true,
15911      pageIndex: this.pageIndex
15912    };
15913  }
15914}
15915
15916/***/ }),
15917/* 5 */
15918/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
15919
15920
15921
15922Object.defineProperty(exports, "__esModule", ({
15923  value: true
15924}));
15925exports.KeyboardManager = exports.CommandManager = exports.ColorManager = exports.AnnotationEditorUIManager = void 0;
15926exports.bindEvents = bindEvents;
15927exports.opacityToHex = opacityToHex;
15928var _util = __w_pdfjs_require__(1);
15929var _display_utils = __w_pdfjs_require__(6);
15930function bindEvents(obj, element, names) {
15931  for (const name of names) {
15932    element.addEventListener(name, obj[name].bind(obj));
15933  }
15934}
15935function opacityToHex(opacity) {
15936  return Math.round(Math.min(255, Math.max(1, 255 * opacity))).toString(16).padStart(2, "0");
15937}
15938class IdManager {
15939  #id = 0;
15940  getId() {
15941    return `${_util.AnnotationEditorPrefix}${this.#id++}`;
15942  }
15943}
15944class ImageManager {
15945  #baseId = (0, _util.getUuid)();
15946  #id = 0;
15947  #cache = null;
15948  static get _isSVGFittingCanvas() {
15949    const svg = `data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" style="fill:red;"/></svg>`;
15950    const canvas = new OffscreenCanvas(1, 3);
15951    const ctx = canvas.getContext("2d");
15952    const image = new Image();
15953    image.src = svg;
15954    const promise = image.decode().then(() => {
15955      ctx.drawImage(image, 0, 0, 1, 1, 0, 0, 1, 3);
15956      return new Uint32Array(ctx.getImageData(0, 0, 1, 1).data.buffer)[0] === 0;
15957    });
15958    return (0, _util.shadow)(this, "_isSVGFittingCanvas", promise);
15959  }
15960  async #get(key, rawData) {
15961    this.#cache ||= new Map();
15962    let data = this.#cache.get(key);
15963    if (data === null) {
15964      return null;
15965    }
15966    if (data?.bitmap) {
15967      data.refCounter += 1;
15968      return data;
15969    }
15970    try {
15971      data ||= {
15972        bitmap: null,
15973        id: `image_${this.#baseId}_${this.#id++}`,
15974        refCounter: 0,
15975        isSvg: false
15976      };
15977      let image;
15978      if (typeof rawData === "string") {
15979        data.url = rawData;
15980        const response = await fetch(rawData);
15981        if (!response.ok) {
15982          throw new Error(response.statusText);
15983        }
15984        image = await response.blob();
15985      } else {
15986        image = data.file = rawData;
15987      }
15988      if (image.type === "image/svg+xml") {
15989        const mustRemoveAspectRatioPromise = ImageManager._isSVGFittingCanvas;
15990        const fileReader = new FileReader();
15991        const imageElement = new Image();
15992        const imagePromise = new Promise((resolve, reject) => {
15993          imageElement.onload = () => {
15994            data.bitmap = imageElement;
15995            data.isSvg = true;
15996            resolve();
15997          };
15998          fileReader.onload = async () => {
15999            const url = data.svgUrl = fileReader.result;
16000            imageElement.src = (await mustRemoveAspectRatioPromise) ? `${url}#svgView(preserveAspectRatio(none))` : url;
16001          };
16002          imageElement.onerror = fileReader.onerror = reject;
16003        });
16004        fileReader.readAsDataURL(image);
16005        await imagePromise;
16006      } else {
16007        data.bitmap = await createImageBitmap(image);
16008      }
16009      data.refCounter = 1;
16010    } catch (e) {
16011      console.error(e);
16012      data = null;
16013    }
16014    this.#cache.set(key, data);
16015    if (data) {
16016      this.#cache.set(data.id, data);
16017    }
16018    return data;
16019  }
16020  async getFromFile(file) {
16021    const {
16022      lastModified,
16023      name,
16024      size,
16025      type
16026    } = file;
16027    return this.#get(`${lastModified}_${name}_${size}_${type}`, file);
16028  }
16029  async getFromUrl(url) {
16030    return this.#get(url, url);
16031  }
16032  async getFromId(id) {
16033    this.#cache ||= new Map();
16034    const data = this.#cache.get(id);
16035    if (!data) {
16036      return null;
16037    }
16038    if (data.bitmap) {
16039      data.refCounter += 1;
16040      return data;
16041    }
16042    if (data.file) {
16043      return this.getFromFile(data.file);
16044    }
16045    return this.getFromUrl(data.url);
16046  }
16047  getSvgUrl(id) {
16048    const data = this.#cache.get(id);
16049    if (!data?.isSvg) {
16050      return null;
16051    }
16052    return data.svgUrl;
16053  }
16054  deleteId(id) {
16055    this.#cache ||= new Map();
16056    const data = this.#cache.get(id);
16057    if (!data) {
16058      return;
16059    }
16060    data.refCounter -= 1;
16061    if (data.refCounter !== 0) {
16062      return;
16063    }
16064    data.bitmap = null;
16065  }
16066  isValidId(id) {
16067    return id.startsWith(`image_${this.#baseId}_`);
16068  }
16069}
16070class CommandManager {
16071  #commands = [];
16072  #locked = false;
16073  #maxSize;
16074  #position = -1;
16075  constructor(maxSize = 128) {
16076    this.#maxSize = maxSize;
16077  }
16078  add({
16079    cmd,
16080    undo,
16081    mustExec,
16082    type = NaN,
16083    overwriteIfSameType = false,
16084    keepUndo = false
16085  }) {
16086    if (mustExec) {
16087      cmd();
16088    }
16089    if (this.#locked) {
16090      return;
16091    }
16092    const save = {
16093      cmd,
16094      undo,
16095      type
16096    };
16097    if (this.#position === -1) {
16098      if (this.#commands.length > 0) {
16099        this.#commands.length = 0;
16100      }
16101      this.#position = 0;
16102      this.#commands.push(save);
16103      return;
16104    }
16105    if (overwriteIfSameType && this.#commands[this.#position].type === type) {
16106      if (keepUndo) {
16107        save.undo = this.#commands[this.#position].undo;
16108      }
16109      this.#commands[this.#position] = save;
16110      return;
16111    }
16112    const next = this.#position + 1;
16113    if (next === this.#maxSize) {
16114      this.#commands.splice(0, 1);
16115    } else {
16116      this.#position = next;
16117      if (next < this.#commands.length) {
16118        this.#commands.splice(next);
16119      }
16120    }
16121    this.#commands.push(save);
16122  }
16123  undo() {
16124    if (this.#position === -1) {
16125      return;
16126    }
16127    this.#locked = true;
16128    this.#commands[this.#position].undo();
16129    this.#locked = false;
16130    this.#position -= 1;
16131  }
16132  redo() {
16133    if (this.#position < this.#commands.length - 1) {
16134      this.#position += 1;
16135      this.#locked = true;
16136      this.#commands[this.#position].cmd();
16137      this.#locked = false;
16138    }
16139  }
16140  hasSomethingToUndo() {
16141    return this.#position !== -1;
16142  }
16143  hasSomethingToRedo() {
16144    return this.#position < this.#commands.length - 1;
16145  }
16146  destroy() {
16147    this.#commands = null;
16148  }
16149}
16150exports.CommandManager = CommandManager;
16151class KeyboardManager {
16152  constructor(callbacks) {
16153    this.buffer = [];
16154    this.callbacks = new Map();
16155    this.allKeys = new Set();
16156    const {
16157      isMac
16158    } = _util.FeatureTest.platform;
16159    for (const [keys, callback, options = {}] of callbacks) {
16160      for (const key of keys) {
16161        const isMacKey = key.startsWith("mac+");
16162        if (isMac && isMacKey) {
16163          this.callbacks.set(key.slice(4), {
16164            callback,
16165            options
16166          });
16167          this.allKeys.add(key.split("+").at(-1));
16168        } else if (!isMac && !isMacKey) {
16169          this.callbacks.set(key, {
16170            callback,
16171            options
16172          });
16173          this.allKeys.add(key.split("+").at(-1));
16174        }
16175      }
16176    }
16177  }
16178  #serialize(event) {
16179    if (event.altKey) {
16180      this.buffer.push("alt");
16181    }
16182    if (event.ctrlKey) {
16183      this.buffer.push("ctrl");
16184    }
16185    if (event.metaKey) {
16186      this.buffer.push("meta");
16187    }
16188    if (event.shiftKey) {
16189      this.buffer.push("shift");
16190    }
16191    this.buffer.push(event.key);
16192    const str = this.buffer.join("+");
16193    this.buffer.length = 0;
16194    return str;
16195  }
16196  exec(self, event) {
16197    if (!this.allKeys.has(event.key)) {
16198      return;
16199    }
16200    const info = this.callbacks.get(this.#serialize(event));
16201    if (!info) {
16202      return;
16203    }
16204    const {
16205      callback,
16206      options: {
16207        bubbles = false,
16208        args = [],
16209        checker = null
16210      }
16211    } = info;
16212    if (checker && !checker(self, event)) {
16213      return;
16214    }
16215    callback.bind(self, ...args)();
16216    if (!bubbles) {
16217      event.stopPropagation();
16218      event.preventDefault();
16219    }
16220  }
16221}
16222exports.KeyboardManager = KeyboardManager;
16223class ColorManager {
16224  static _colorsMapping = new Map([["CanvasText", [0, 0, 0]], ["Canvas", [255, 255, 255]]]);
16225  get _colors() {
16226    const colors = new Map([["CanvasText", null], ["Canvas", null]]);
16227    (0, _display_utils.getColorValues)(colors);
16228    return (0, _util.shadow)(this, "_colors", colors);
16229  }
16230  convert(color) {
16231    const rgb = (0, _display_utils.getRGB)(color);
16232    if (!window.matchMedia("(forced-colors: active)").matches) {
16233      return rgb;
16234    }
16235    for (const [name, RGB] of this._colors) {
16236      if (RGB.every((x, i) => x === rgb[i])) {
16237        return ColorManager._colorsMapping.get(name);
16238      }
16239    }
16240    return rgb;
16241  }
16242  getHexCode(name) {
16243    const rgb = this._colors.get(name);
16244    if (!rgb) {
16245      return name;
16246    }
16247    return _util.Util.makeHexColor(...rgb);
16248  }
16249}
16250exports.ColorManager = ColorManager;
16251class AnnotationEditorUIManager {
16252  #activeEditor = null;
16253  #allEditors = new Map();
16254  #allLayers = new Map();
16255  #altTextManager = null;
16256  #annotationStorage = null;
16257  #commandManager = new CommandManager();
16258  #currentPageIndex = 0;
16259  #deletedAnnotationsElementIds = new Set();
16260  #draggingEditors = null;
16261  #editorTypes = null;
16262  #editorsToRescale = new Set();
16263  #filterFactory = null;
16264  #idManager = new IdManager();
16265  #isEnabled = false;
16266  #isWaiting = false;
16267  #lastActiveElement = null;
16268  #mode = _util.AnnotationEditorType.NONE;
16269  #selectedEditors = new Set();
16270  #pageColors = null;
16271  #boundBlur = this.blur.bind(this);
16272  #boundFocus = this.focus.bind(this);
16273  #boundCopy = this.copy.bind(this);
16274  #boundCut = this.cut.bind(this);
16275  #boundPaste = this.paste.bind(this);
16276  #boundKeydown = this.keydown.bind(this);
16277  #boundOnEditingAction = this.onEditingAction.bind(this);
16278  #boundOnPageChanging = this.onPageChanging.bind(this);
16279  #boundOnScaleChanging = this.onScaleChanging.bind(this);
16280  #boundOnRotationChanging = this.onRotationChanging.bind(this);
16281  #previousStates = {
16282    isEditing: false,
16283    isEmpty: true,
16284    hasSomethingToUndo: false,
16285    hasSomethingToRedo: false,
16286    hasSelectedEditor: false
16287  };
16288  #translation = [0, 0];
16289  #translationTimeoutId = null;
16290  #container = null;
16291  #viewer = null;
16292  static TRANSLATE_SMALL = 1;
16293  static TRANSLATE_BIG = 10;
16294  static get _keyboardManager() {
16295    const proto = AnnotationEditorUIManager.prototype;
16296    const arrowChecker = self => {
16297      const {
16298        activeElement
16299      } = document;
16300      return activeElement && self.#container.contains(activeElement) && self.hasSomethingToControl();
16301    };
16302    const small = this.TRANSLATE_SMALL;
16303    const big = this.TRANSLATE_BIG;
16304    return (0, _util.shadow)(this, "_keyboardManager", new KeyboardManager([[["ctrl+a", "mac+meta+a"], proto.selectAll], [["ctrl+z", "mac+meta+z"], proto.undo], [["ctrl+y", "ctrl+shift+z", "mac+meta+shift+z", "ctrl+shift+Z", "mac+meta+shift+Z"], proto.redo], [["Backspace", "alt+Backspace", "ctrl+Backspace", "shift+Backspace", "mac+Backspace", "mac+alt+Backspace", "mac+ctrl+Backspace", "Delete", "ctrl+Delete", "shift+Delete", "mac+Delete"], proto.delete], [["Escape", "mac+Escape"], proto.unselectAll], [["ArrowLeft", "mac+ArrowLeft"], proto.translateSelectedEditors, {
16305      args: [-small, 0],
16306      checker: arrowChecker
16307    }], [["ctrl+ArrowLeft", "mac+shift+ArrowLeft"], proto.translateSelectedEditors, {
16308      args: [-big, 0],
16309      checker: arrowChecker
16310    }], [["ArrowRight", "mac+ArrowRight"], proto.translateSelectedEditors, {
16311      args: [small, 0],
16312      checker: arrowChecker
16313    }], [["ctrl+ArrowRight", "mac+shift+ArrowRight"], proto.translateSelectedEditors, {
16314      args: [big, 0],
16315      checker: arrowChecker
16316    }], [["ArrowUp", "mac+ArrowUp"], proto.translateSelectedEditors, {
16317      args: [0, -small],
16318      checker: arrowChecker
16319    }], [["ctrl+ArrowUp", "mac+shift+ArrowUp"], proto.translateSelectedEditors, {
16320      args: [0, -big],
16321      checker: arrowChecker
16322    }], [["ArrowDown", "mac+ArrowDown"], proto.translateSelectedEditors, {
16323      args: [0, small],
16324      checker: arrowChecker
16325    }], [["ctrl+ArrowDown", "mac+shift+ArrowDown"], proto.translateSelectedEditors, {
16326      args: [0, big],
16327      checker: arrowChecker
16328    }]]));
16329  }
16330  constructor(container, viewer, altTextManager, eventBus, pdfDocument, pageColors) {
16331    this.#container = container;
16332    this.#viewer = viewer;
16333    this.#altTextManager = altTextManager;
16334    this._eventBus = eventBus;
16335    this._eventBus._on("editingaction", this.#boundOnEditingAction);
16336    this._eventBus._on("pagechanging", this.#boundOnPageChanging);
16337    this._eventBus._on("scalechanging", this.#boundOnScaleChanging);
16338    this._eventBus._on("rotationchanging", this.#boundOnRotationChanging);
16339    this.#annotationStorage = pdfDocument.annotationStorage;
16340    this.#filterFactory = pdfDocument.filterFactory;
16341    this.#pageColors = pageColors;
16342    this.viewParameters = {
16343      realScale: _display_utils.PixelsPerInch.PDF_TO_CSS_UNITS,
16344      rotation: 0
16345    };
16346  }
16347  destroy() {
16348    this.#removeKeyboardManager();
16349    this.#removeFocusManager();
16350    this._eventBus._off("editingaction", this.#boundOnEditingAction);
16351    this._eventBus._off("pagechanging", this.#boundOnPageChanging);
16352    this._eventBus._off("scalechanging", this.#boundOnScaleChanging);
16353    this._eventBus._off("rotationchanging", this.#boundOnRotationChanging);
16354    for (const layer of this.#allLayers.values()) {
16355      layer.destroy();
16356    }
16357    this.#allLayers.clear();
16358    this.#allEditors.clear();
16359    this.#editorsToRescale.clear();
16360    this.#activeEditor = null;
16361    this.#selectedEditors.clear();
16362    this.#commandManager.destroy();
16363    this.#altTextManager.destroy();
16364  }
16365  get hcmFilter() {
16366    return (0, _util.shadow)(this, "hcmFilter", this.#pageColors ? this.#filterFactory.addHCMFilter(this.#pageColors.foreground, this.#pageColors.background) : "none");
16367  }
16368  get direction() {
16369    return (0, _util.shadow)(this, "direction", getComputedStyle(this.#container).direction);
16370  }
16371  editAltText(editor) {
16372    this.#altTextManager?.editAltText(this, editor);
16373  }
16374  onPageChanging({
16375    pageNumber
16376  }) {
16377    this.#currentPageIndex = pageNumber - 1;
16378  }
16379  focusMainContainer() {
16380    this.#container.focus();
16381  }
16382  findParent(x, y) {
16383    for (const layer of this.#allLayers.values()) {
16384      const {
16385        x: layerX,
16386        y: layerY,
16387        width,
16388        height
16389      } = layer.div.getBoundingClientRect();
16390      if (x >= layerX && x <= layerX + width && y >
vendor: 4,849 bytes, lines 16390-16573
16390= layerY && y <= layerY + height) {
16391        return layer;
16392      }
16393    }
16394    return null;
16395  }
16396  disableUserSelect(value = false) {
16397    this.#viewer.classList.toggle("noUserSelect", value);
16398  }
16399  addShouldRescale(editor) {
16400    this.#editorsToRescale.add(editor);
16401  }
16402  removeShouldRescale(editor) {
16403    this.#editorsToRescale.delete(editor);
16404  }
16405  onScaleChanging({
16406    scale
16407  }) {
16408    this.commitOrRemove();
16409    this.viewParameters.realScale = scale * _display_utils.PixelsPerInch.PDF_TO_CSS_UNITS;
16410    for (const editor of this.#editorsToRescale) {
16411      editor.onScaleChanging();
16412    }
16413  }
16414  onRotationChanging({
16415    pagesRotation
16416  }) {
16417    this.commitOrRemove();
16418    this.viewParameters.rotation = pagesRotation;
16419  }
16420  addToAnnotationStorage(editor) {
16421    if (!editor.isEmpty() && this.#annotationStorage && !this.#annotationStorage.has(editor.id)) {
16422      this.#annotationStorage.setValue(editor.id, editor);
16423    }
16424  }
16425  #addFocusManager() {
16426    window.addEventListener("focus", this.#boundFocus);
16427    window.addEventListener("blur", this.#boundBlur);
16428  }
16429  #removeFocusManager() {
16430    window.removeEventListener("focus", this.#boundFocus);
16431    window.removeEventListener("blur", this.#boundBlur);
16432  }
16433  blur() {
16434    if (!this.hasSelection) {
16435      return;
16436    }
16437    const {
16438      activeElement
16439    } = document;
16440    for (const editor of this.#selectedEditors) {
16441      if (editor.div.contains(activeElement)) {
16442        this.#lastActiveElement = [editor, activeElement];
16443        editor._focusEventsAllowed = false;
16444        break;
16445      }
16446    }
16447  }
16448  focus() {
16449    if (!this.#lastActiveElement) {
16450      return;
16451    }
16452    const [lastEditor, lastActiveElement] = this.#lastActiveElement;
16453    this.#lastActiveElement = null;
16454    lastActiveElement.addEventListener("focusin", () => {
16455      lastEditor._focusEventsAllowed = true;
16456    }, {
16457      once: true
16458    });
16459    lastActiveElement.focus();
16460  }
16461  #addKeyboardManager() {
16462    window.addEventListener("keydown", this.#boundKeydown, {
16463      capture: true
16464    });
16465  }
16466  #removeKeyboardManager() {
16467    window.removeEventListener("keydown", this.#boundKeydown, {
16468      capture: true
16469    });
16470  }
16471  #addCopyPasteListeners() {
16472    document.addEventListener("copy", this.#boundCopy);
16473    document.addEventListener("cut", this.#boundCut);
16474    document.addEventListener("paste", this.#boundPaste);
16475  }
16476  #removeCopyPasteListeners() {
16477    document.removeEventListener("copy", this.#boundCopy);
16478    document.removeEventListener("cut", this.#boundCut);
16479    document.removeEventListener("paste", this.#boundPaste);
16480  }
16481  addEditListeners() {
16482    this.#addKeyboardManager();
16483    this.#addCopyPasteListeners();
16484  }
16485  removeEditListeners() {
16486    this.#removeKeyboardManager();
16487    this.#removeCopyPasteListeners();
16488  }
16489  copy(event) {
16490    event.preventDefault();
16491    this.#activeEditor?.commitOrRemove();
16492    if (!this.hasSelection) {
16493      return;
16494    }
16495    const editors = [];
16496    for (const editor of this.#selectedEditors) {
16497      const serialized = editor.serialize(true);
16498      if (serialized) {
16499        editors.push(serialized);
16500      }
16501    }
16502    if (editors.length === 0) {
16503      return;
16504    }
16505    event.clipboardData.setData("application/pdfjs", JSON.stringify(editors));
16506  }
16507  cut(event) {
16508    this.copy(event);
16509    this.delete();
16510  }
16511  paste(event) {
16512    event.preventDefault();
16513    const {
16514      clipboardData
16515    } = event;
16516    for (const item of clipboardData.items) {
16517      for (const editorType of this.#editorTypes) {
16518        if (editorType.isHandlingMimeForPasting(item.type)) {
16519          editorType.paste(item, this.currentLayer);
16520          return;
16521        }
16522      }
16523    }
16524    let data = clipboardData.getData("application/pdfjs");
16525    if (!data) {
16526      return;
16527    }
16528    try {
16529      data = JSON.parse(data);
16530    } catch (ex) {
16531      (0, _util.warn)(`paste: "${ex.message}".`);
16532      return;
16533    }
16534    if (!Array.isArray(data)) {
16535      return;
16536    }
16537    this.unselectAll();
16538    const layer = this.currentLayer;
16539    try {
16540      const newEditors = [];
16541      for (const editor of data) {
16542        const deserializedEditor = layer.deserialize(editor);
16543        if (!deserializedEditor) {
16544          return;
16545        }
16546        newEditors.push(deserializedEditor);
16547      }
16548      const cmd = () => {
16549        for (const editor of newEditors) {
16550          this.#addEditorToLayer(editor);
16551        }
16552        this.#selectEditors(newEditors);
16553      };
16554      const undo = () => {
16555        for (const editor of newEditors) {
16556          editor.remove();
16557        }
16558      };
16559      this.addCommands({
16560        cmd,
16561        undo,
16562        mustExec: true
16563      });
16564    } catch (ex) {
16565      (0, _util.warn)(`paste: "${ex.message}".`);
16566    }
16567  }
16568  keydown(event) {
16569    if (!this.getActive()?.shouldGetKeyboardEvents()) {
16570      AnnotationEditorUIManager._keyboardManager.exec(this, event);
16571    }
16572  }
16573  onEditingAction(details) {
16574    if (["undo", "redo", "delete", "selectAll"].includes(details.name)) {
16575      this[details.name]();
16576    }
16577  }
16578  #dispatchUpdateStates(details) {
16579    const hasChanged = Object.entries(details).some(([key, value]) => this.#previousStates[key] !== value);
16580    if (hasChanged) {
16581      this._eventBus.dispatch("annotationeditorstateschanged", {
16582        source: this,
16583        details: Object.assign(this.#previousStates, details)
16584      });
16585    }
16586  }
16587  #dispatchUpdateUI(details) {
16588    this._eventBus.dispatch("annotationeditorparamschanged", {
16589      source: this,
16590      details
16591    });
16592  }
16593  setEditingState(isEditing) {
16594    if (isEditing) {
16595      this.#addFocusManager();
16596      this.#addKeyboardManager();
16597      this.#addCopyPasteListeners();
16598      this.#dispatchUpdateStates({
16599        isEditing: this.#mode !== _util.AnnotationEditorType.NONE,
16600        isEmpty: this.#isEmpty(),
16601        hasSomethingToUndo: this.#commandManager.hasSomethingToUndo(),
16602        hasSomethingToRedo: this.#commandManager.hasSomethingToRedo(),
16603        hasSelectedEditor: false
16604      });
16605    } else {
16606      this.#removeFocusManager();
16607      this.#removeKeyboardManager();
16608      this.#removeCopyPasteListeners();
16609      this.#dispatchUpdateStates({
16610        isEditing: false
16611      });
16612      this.disableUserSelect(false);
16613    }
16614  }
16615  registerEditorTypes(types) {
16616    if (this.#editorTypes) {
16617      return;
16618    }
16619    this.#editorTypes = types;
16620    for (const editorType of this.#editorTypes) {
16621      this.#dispatchUpdateUI(editorType.defaultPropertiesToUpdate);
16622    }
16623  }
16624  getId() {
16625    return this.#idManager.getId();
16626  }
16627  get currentLayer() {
16628    return this.#allLayers.get(this.#currentPageIndex);
16629  }
16630  getLayer(pageIndex) {
16631    return this.#allLayers.get(pageIndex);
16632  }
16633  get currentPageIndex() {
16634    return this.#currentPageIndex;
16635  }
16636  addLayer(layer) {
16637    this.#allLayers.set(layer.pageIndex, layer);
16638    if (this.#isEnabled) {
16639      layer.enable();
16640    } else {
16641      layer.disable();
16642    }
16643  }
16644  removeLayer(layer) {
16645    this.#allLayers.delete(layer.pageIndex);
16646  }
16647  updateMode(mode, editId = null) {
16648    if (this.#mode === mode) {
16649      return;
16650    }
16651    this.#mode = mode;
16652    if (mode === _util.AnnotationEditorType.NONE) {
16653      this.setEditingState(false);
16654      this.#disableAll();
16655      return;
16656    }
16657    this.setEditingState(true);
16658    this.#enableAll();
16659    this.unselectAll();
16660    for (const layer of this.#allLayers.values()) {
16661      layer.updateMode(mode);
16662    }
16663    if (!editId) {
16664      return;
16665    }
16666    for (const editor of this.#allEditors.values()) {
16667      if (editor.annotationElementId === editId) {
16668        this.setSelected(editor);
16669        editor.enterInEditMode();
16670        break;
16671      }
16672    }
16673  }
16674  updateToolbar(mode) {
16675    if (mode === this.#mode) {
16676      return;
16677    }
16678    this._eventBus.dispatch("switchannotationeditormode", {
16679      source: this,
16680      mode
16681    });
16682  }
16683  updateParams(type, value) {
16684    if (!this.#editorTypes) {
16685      return;
16686    }
16687    if (type === _util.AnnotationEditorParamsType.CREATE) {
16688      this.currentLayer.addNewEditor(type);
16689      return;
16690    }
16691    for (const editor of this.#selectedEditors) {
16692      editor.updateParams(type, value);
16693    }
16694    for (const editorType of this.#editorTypes) {
16695      editorType.updateDefaultParams(type, value);
16696    }
16697  }
16698  enableWaiting(mustWait = false) {
16699    if (this.#isWaiting === mustWait) {
16700      return;
16701    }
16702    this.#isWaiting = mustWait;
16703    for (const layer of this.#allLayers.values()) {
16704      if (mustWait) {
16705        layer.disableClick();
16706      } else {
16707        layer.enableClick();
16708      }
16709      layer.div.classList.toggle("waiting", mustWait);
16710    }
16711  }
16712  #enableAll() {
16713    if (!this.#isEnabled) {
16714      this.#isEnabled = true;
16715      for (const layer of this.#allLayers.values()) {
16716        layer.enable();
16717      }
16718    }
16719  }
16720  #disableAll() {
16721    this.unselectAll();
16722    if (this.#isEnabled) {
16723      this.#isEnabled = false;
16724      for (const layer of this.#allLayers.values()) {
16725        layer.disable();
16726      }
16727    }
16728  }
16729  getEditors(pageIndex) {
16730    const editors = [];
16731    for (const editor of this.#allEditors.values()) {
16732      if (editor.pageIndex === pageIndex) {
16733        editors.push(editor);
16734      }
16735    }
16736    return editors;
16737  }
16738  getEditor(id) {
16739    return this.#allEditors.get(id);
16740  }
16741  addEditor(editor) {
16742    this.#allEditors.set(editor.id, editor);
16743  }
16744  removeEditor(editor) {
16745    this.#allEditors.delete(editor.id);
16746    this.unselect(editor);
16747    if (!editor.annotationElementId || !this.#deletedAnnotationsElementIds.has(editor.annotationElementId)) {
16748      this.#annotationStorage?.remove(editor.id);
16749    }
16750  }
16751  addDeletedAnnotationElement(editor) {
16752    this.#deletedAnnotationsElementIds.add(editor.annotationElementId);
16753    editor.deleted = true;
16754  }
16755  isDeletedAnnotationElement(annotationElementId) {
16756    return this.#deletedAnnotationsElementIds.has(annotationElementId);
16757  }
16758  removeDeletedAnnotationElement(editor) {
16759    this.#deletedAnnotationsElementIds.delete(editor.annotationElementId);
16760    editor.deleted = false;
vendor: 5,451 bytes, lines 16761-16979
16761  }
16762  #addEditorToLayer(editor) {
16763    const layer = this.#allLayers.get(editor.pageIndex);
16764    if (layer) {
16765      layer.addOrRebuild(editor);
16766    } else {
16767      this.addEditor(editor);
16768    }
16769  }
16770  setActiveEditor(editor) {
16771    if (this.#activeEditor === editor) {
16772      return;
16773    }
16774    this.#activeEditor = editor;
16775    if (editor) {
16776      this.#dispatchUpdateUI(editor.propertiesToUpdate);
16777    }
16778  }
16779  toggleSelected(editor) {
16780    if (this.#selectedEditors.has(editor)) {
16781      this.#selectedEditors.delete(editor);
16782      editor.unselect();
16783      this.#dispatchUpdateStates({
16784        hasSelectedEditor: this.hasSelection
16785      });
16786      return;
16787    }
16788    this.#selectedEditors.add(editor);
16789    editor.select();
16790    this.#dispatchUpdateUI(editor.propertiesToUpdate);
16791    this.#dispatchUpdateStates({
16792      hasSelectedEditor: true
16793    });
16794  }
16795  setSelected(editor) {
16796    for (const ed of this.#selectedEditors) {
16797      if (ed !== editor) {
16798        ed.unselect();
16799      }
16800    }
16801    this.#selectedEditors.clear();
16802    this.#selectedEditors.add(editor);
16803    editor.select();
16804    this.#dispatchUpdateUI(editor.propertiesToUpdate);
16805    this.#dispatchUpdateStates({
16806      hasSelectedEditor: true
16807    });
16808  }
16809  isSelected(editor) {
16810    return this.#selectedEditors.has(editor);
16811  }
16812  unselect(editor) {
16813    editor.unselect();
16814    this.#selectedEditors.delete(editor);
16815    this.#dispatchUpdateStates({
16816      hasSelectedEditor: this.hasSelection
16817    });
16818  }
16819  get hasSelection() {
16820    return this.#selectedEditors.size !== 0;
16821  }
16822  undo() {
16823    this.#commandManager.undo();
16824    this.#dispatchUpdateStates({
16825      hasSomethingToUndo: this.#commandManager.hasSomethingToUndo(),
16826      hasSomethingToRedo: true,
16827      isEmpty: this.#isEmpty()
16828    });
16829  }
16830  redo() {
16831    this.#commandManager.redo();
16832    this.#dispatchUpdateStates({
16833      hasSomethingToUndo: true,
16834      hasSomethingToRedo: this.#commandManager.hasSomethingToRedo(),
16835      isEmpty: this.#isEmpty()
16836    });
16837  }
16838  addCommands(params) {
16839    this.#commandManager.add(params);
16840    this.#dispatchUpdateStates({
16841      hasSomethingToUndo: true,
16842      hasSomethingToRedo: false,
16843      isEmpty: this.#isEmpty()
16844    });
16845  }
16846  #isEmpty() {
16847    if (this.#allEditors.size === 0) {
16848      return true;
16849    }
16850    if (this.#allEditors.size === 1) {
16851      for (const editor of this.#allEditors.values()) {
16852        return editor.isEmpty();
16853      }
16854    }
16855    return false;
16856  }
16857  delete() {
16858    this.commitOrRemove();
16859    if (!this.hasSelection) {
16860      return;
16861    }
16862    const editors = [...this.#selectedEditors];
16863    const cmd = () => {
16864      for (const editor of editors) {
16865        editor.remove();
16866      }
16867    };
16868    const undo = () => {
16869      for (const editor of editors) {
16870        this.#addEditorToLayer(editor);
16871      }
16872    };
16873    this.addCommands({
16874      cmd,
16875      undo,
16876      mustExec: true
16877    });
16878  }
16879  commitOrRemove() {
16880    this.#activeEditor?.commitOrRemove();
16881  }
16882  hasSomethingToControl() {
16883    return this.#activeEditor || this.hasSelection;
16884  }
16885  #selectEditors(editors) {
16886    this.#selectedEditors.clear();
16887    for (const editor of editors) {
16888      if (editor.isEmpty()) {
16889        continue;
16890      }
16891      this.#selectedEditors.add(editor);
16892      editor.select();
16893    }
16894    this.#dispatchUpdateStates({
16895      hasSelectedEditor: true
16896    });
16897  }
16898  selectAll() {
16899    for (const editor of this.#selectedEditors) {
16900      editor.commit();
16901    }
16902    this.#selectEditors(this.#allEditors.values());
16903  }
16904  unselectAll() {
16905    if (this.#activeEditor) {
16906      this.#activeEditor.commitOrRemove();
16907      return;
16908    }
16909    if (!this.hasSelection) {
16910      return;
16911    }
16912    for (const editor of this.#selectedEditors) {
16913      editor.unselect();
16914    }
16915    this.#selectedEditors.clear();
16916    this.#dispatchUpdateStates({
16917      hasSelectedEditor: false
16918    });
16919  }
16920  translateSelectedEditors(x, y, noCommit = false) {
16921    if (!noCommit) {
16922      this.commitOrRemove();
16923    }
16924    if (!this.hasSelection) {
16925      return;
16926    }
16927    this.#translation[0] += x;
16928    this.#translation[1] += y;
16929    const [totalX, totalY] = this.#translation;
16930    const editors = [...this.#selectedEditors];
16931    const TIME_TO_WAIT = 1000;
16932    if (this.#translationTimeoutId) {
16933      clearTimeout(this.#translationTimeoutId);
16934    }
16935    this.#translationTimeoutId = setTimeout(() => {
16936      this.#translationTimeoutId = null;
16937      this.#translation[0] = this.#translation[1] = 0;
16938      this.addCommands({
16939        cmd: () => {
16940          for (const editor of editors) {
16941            if (this.#allEditors.has(editor.id)) {
16942              editor.translateInPage(totalX, totalY);
16943            }
16944          }
16945        },
16946        undo: () => {
16947          for (const editor of editors) {
16948            if (this.#allEditors.has(editor.id)) {
16949              editor.translateInPage(-totalX, -totalY);
16950            }
16951          }
16952        },
16953        mustExec: false
16954      });
16955    }, TIME_TO_WAIT);
16956    for (const editor of editors) {
16957      editor.translateInPage(x, y);
16958    }
16959  }
16960  setUpDragSession() {
16961    if (!this.hasSelection) {
16962      return;
16963    }
16964    this.disableUserSelect(true);
16965    this.#draggingEditors = new Map();
16966    for (const editor of this.#selectedEditors) {
16967      this.#draggingEditors.set(editor, {
16968        savedX: editor.x,
16969        savedY: editor.y,
16970        savedPageIndex: editor.pageIndex,
16971        newX: 0,
16972        newY: 0,
16973        newPageIndex: -1
16974      });
16975    }
16976  }
16977  endDragSession() {
16978    if (!this.#draggingEditors) {
16979      return false;
16980    }
16981    this.disableUserSelect(false);
16982    const map = this.#draggingEditors;
16983    this.#draggingEditors = null;
16984    let mustBeAddedInUndoStack = false;
16985    for (const [{
16986      x,
16987      y,
16988      pageIndex
16989    }, value] of map) {
16990      value.newX = x;
16991      value.newY = y;
16992      value.newPageIndex = pageIndex;
16993      mustBeAddedInUndoStack ||= x !== value.savedX || y !== value.savedY || pageIndex !== value.savedPageIndex;
16994    }
16995    if (!mustBeAddedInUndoStack) {
16996      return false;
16997    }
16998    const move = (editor, x, y, pageIndex) => {
16999      if (this.#allEditors.has(editor.id)) {
17000        const parent = this.#allLayers.get(pageIndex);
17001        if (parent) {
17002          editor._setParentAndPosition(parent, x, y);
17003        } else {
17004          editor.pageIndex = pageIndex;
17005          editor.x = x;
17006          editor.y = y;
17007        }
17008      }
17009    };
17010    this.addCommands({
17011      cmd: () => {
17012        for (const [editor, {
17013          newX,
17014          newY,
17015          newPageIndex
17016        }] of map) {
17017          move(editor, newX, newY, newPageIndex);
17018        }
17019      },
17020      undo: () => {
17021        for (const [editor, {
17022          savedX,
17023          savedY,
17024          savedPageIndex
17025        }] of map) {
17026          move(editor, savedX, savedY, savedPageIndex);
17027        }
17028      },
17029      mustExec: true
17030    });
17031    return true;
17032  }
17033  dragSelectedEditors(tx, ty) {
17034    if (!this.#draggingEditors) {
17035      return;
17036    }
17037    for (const editor of this.#draggingEditors.keys()) {
17038      editor.drag(tx, ty);
17039    }
17040  }
17041  rebuild(editor) {
17042    if (editor.parent === null) {
17043      const parent = this.getLayer(editor.pageIndex);
17044      if (parent) {
17045        parent.changeParent(editor);
17046        parent.addOrRebuild(editor);
17047      } else {
17048        this.addEditor(editor);
17049        this.addToAnnotationStorage(editor);
17050        editor.rebuild();
17051      }
17052    } else {
17053      editor.parent.addOrRebuild(editor);
17054    }
17055  }
17056  isActive(editor) {
17057    return this.#activeEditor === editor;
17058  }
17059  getActive() {
17060    return this.#activeEditor;
17061  }
17062  getMode() {
17063    return this.#mode;
17064  }
17065  get imageManager() {
17066    return (0, _util.shadow)(this, "imageManager", new ImageManager());
17067  }
17068}
17069exports.AnnotationEditorUIManager = AnnotationEditorUIManager;
17070
17071/***/ }),
17072/* 6 */
17073/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
17074
17075
17076
17077Object.defineProperty(exports, "__esModule", ({
17078  value: true
17079}));
17080exports.StatTimer = exports.RenderingCancelledException = exports.PixelsPerInch = exports.PageViewport = exports.PDFDateString = exports.DOMStandardFontDataFactory = exports.DOMSVGFactory = exports.DOMFilterFactory = exports.DOMCanvasFactory = exports.DOMCMapReaderFactory = void 0;
17081exports.deprecated = deprecated;
17082exports.getColorValues = getColorValues;
17083exports.getCurrentTransform = getCurrentTransform;
17084exports.getCurrentTransformInverse = getCurrentTransformInverse;
17085exports.getFilenameFromUrl = getFilenameFromUrl;
17086exports.getPdfFilenameFromUrl = getPdfFilenameFromUrl;
17087exports.getRGB = getRGB;
17088exports.getXfaPageViewport = getXfaPageViewport;
17089exports.isDataScheme = isDataScheme;
17090exports.isPdfFile = isPdfFile;
17091exports.isValidFetchUrl = isValidFetchUrl;
17092exports.loadScript = loadScript;
17093exports.noContextMenu = noContextMenu;
17094exports.setLayerDimensions = setLayerDimensions;
17095var _base_factory = __w_pdfjs_require__(7);
17096var _util = __w_pdfjs_require__(1);
17097const SVG_NS = "http://www.w3.org/2000/svg";
17098class PixelsPerInch {
17099  static CSS = 96.0;
17100  static PDF = 72.0;
17101  static PDF_TO_CSS_UNITS = this.CSS / this.PDF;
17102}
17103exports.PixelsPerInch = PixelsPerInch;
17104class DOMFilterFactory extends _base_factory.BaseFilterFactory {
17105  #_cache;
17106  #_defs;
17107  #docId;
17108  #document;
17109  #hcmFilter;
17110  #hcmKey;
17111  #hcmUrl;
17112  #hcmHighlightFilter;
17113  #hcmHighlightKey;
17114  #hcmHighlightUrl;
17115  #id = 0;
17116  constructor({
17117    docId,
17118    ownerDocument = globalThis.document
17119  } = {}) {
17120    super();
17121    this.#docId = docId;
17122    this.#document = ownerDocument;
17123  }
17124  get #cache() {
17125    return this.#_cache ||= new Map();
17126  }
17127  get #defs() {
17128    if (!this.#_defs) {
17129      const div = this.#document.createElement("div");
17130      const {
17131        style
17132      } = div;
17133      style.visibility = "hidden";
17134      style.contain = "strict";
17135      style.width = style.height = 0;
17136      style.position = "absolute";
17137      style.top = style.left = 0;
17138      style.zIndex = -1;
17139      const svg = this.#document.createElementNS(SVG_NS, "svg");
17140      svg.setAttribute("width", 0);
17141      svg.setAttribute("height", 0);
17142      this.#_defs = this.#document.createElementNS(SVG_NS, "defs");
17143      div.append(svg);
17144      svg.append(this.#_defs);
17145      this.#document.body.append(div);
17146    }
17147    return this.#_defs;
17148  }
17149  addFilter(maps) {
17150    if (!maps) {
17151      return "none";
17152    }
17153    let value = this.#cache.get(maps);
17154    if (value) {
17155      return value;
17156    }
17157    let tableR, tableG, tableB, key;
17158    if (maps.length === 1) {
17159      const mapR = maps[0];
17160      const buffer = new Array(256);
17161      for (let i = 0; i < 256; i++) {
17162        buffer[i] = mapR[i] / 255;
17163      }
17164      key = tableR = tableG = tableB = buffer.join(",");
17165    } else {
17166      const [mapR, mapG, mapB] = maps;
17167      const bufferR = new Array(256);
17168      const bufferG = new Array(256);
17169      const bufferB = new Array(256);
17170      for (let i = 0; i < 256; i++) {
17171        bufferR[i] = mapR[i] / 255;
17172        bufferG[i] = mapG[i] / 255;
17173        bufferB[i] = mapB[i] / 255;
17174      }
17175      tableR = bufferR.join(",");
17176      tableG = bufferG.join(",");
17177      tableB = bufferB.join(",");
17178      key = `${tableR}${tableG}${tableB}`;
17179    }
17180    value = this.#cache.get(key);
17181    if (value) {
17182      this.#cache.set(maps, value);
17183      return value;
17184    }
17185    const id = `g_${this.#docId}_transfer_map_${this.#id++}`;
17186    const url = `url(#${id})`;
17187    this.#cache.set(maps, url);
17188    this.#cache.set(key, url);
17189    const filter = this.#createFilter(id);
17190    this.#addTransferMapConversion(tableR, tableG, tableB, filter);
17191    return url;
17192  }
17193  addHCMFilter(fgColor, bgColor) {
17194    const key = `${fgColor}-${bgColor}`;
17195    if (this.#hcmKey === key) {
17196      return this.#hcmUrl;
17197    }
17198    this.#hcmKey = key;
17199    this.#hcmUrl = "none";
17200    this.#hcmFilter?.remove();
17201    if (!fgColor || !bgColor) {
17202      return this.#hcmUrl;
17203    }
17204    const fgRGB = this.#getRGB(fgColor);
17205    fgColor = _util.Util.makeHexColor(...fgRGB);
17206    const bgRGB = this.#getRGB(bgColor);
17207    bgColor = _util.Util.makeHexColor(...bgRGB);
17208    this.#defs.style.color = "";
17209    if (fgColor === "#000000" && bgColor === "#ffffff" || fgColor === bgColor) {
17210      return this.#hcmUrl;
17211    }
17212    const map = new Array(256);
17213    for (let i = 0; i <= 255; i++) {
17214      const x = i / 255;
17215      map[i] = x <= 0.03928 ? x / 12.92 : ((x + 0.055) / 1.055) ** 2.4;
17216    }
17217    const table = map.join(",");
17218    const id = `g_${this.#docId}_hcm_filter`;
17219    const filter = this.#hcmHighlightFilter = this.#createFilter(id);
17220    this.#addTransferMapConversion(table, table, table, filter);
17221    this.#addGrayConversion(filter);
17222    const getSteps = (c, n) => {
17223      const start = fgRGB[c] / 255;
17224      const end = bgRGB[c] / 255;
17225      const arr = new Array(n + 1);
17226      for (let i = 0; i <= n; i++) {
17227        arr[i] = start + i / n * (end - start);
17228      }
17229      return arr.join(",");
17230    };
17231    this.#addTransferMapConversion(getSteps(0, 5), getSteps(1, 5), getSteps(2, 5), filter);
17232    this.#hcmUrl = `url(#${id})`;
17233    return this.#hcmUrl;
17234  }
17235  addHighlightHCMFilter(fgColor, bgColor, newFgColor, newBgColor) {
17236    const key = `${fgColor}-${bgColor}-${newFgColor}-${newBgColor}`;
17237    if (this.#hcmHighlightKey === key) {
17238      return this.#hcmHighlightUrl;
17239    }
17240    this.#hcmHighlightKey = key;
17241    this.#hcmHighlightUrl = "none";
17242    this.#hcmHighlightFilter?.remove();
17243    if (!fgColor || !bgColor) {
17244      return this.#hcmHighlightUrl;
17245    }
17246    const [fgRGB, bgRGB] = [fgColor, bgColor].map(this.#getRGB.bind(this));
17247    let fgGray = Math.round(0.2126 * fgRGB[0] + 0.7152 * fgRGB[1] + 0.0722 * fgRGB[2]);
17248    let bgGray = Math.round(0.2126 * bgRGB[0] + 0.7152 * bgRGB[1] + 0.0722 * bgRGB[2]);
17249    let [newFgRGB, newBgRGB] = [newFgColor, newBgColor].map(this.#getRGB.bind(this));
17250    if (bgGray < fgGray) {
17251      [fgGray, bgGray, newFgRGB, newBgRGB] = [bgGray, fgGray, newBgRGB, newFgRGB];
17252    }
17253    this.#defs.style.color = "";
17254    const getSteps = (fg, bg, n) => {
17255      const arr = new Array(256);
17256      const step = (bgGray - fgGray) / n;
17257      const newStart = fg / 255;
17258      const newStep = (bg - fg) / (255 * n);
17259      let prev = 0;
17260      for (let i = 0; i <= n; i++) {
17261        const k = Math.round(fgGray + i * step);
17262        const value = newStart + i * newStep;
17263        for (let j = prev; j <= k; j++) {
17264          arr[j] = value;
17265        }
17266        prev = k + 1;
17267      }
17268      for (let i = prev; i < 256; i++) {
17269        arr[i] = arr[prev - 1];
17270      }
17271      return arr.join(",");
17272    };
17273    const id = `g_${this.#docId}_hcm_highlight_filter`;
17274    const filter = this.#hcmHighlightFilter = this.#createFilter(id);
17275    this.#addGrayConversion(filter);
17276    this.#addTransferMapConversion(getSteps(newFgRGB[0], newBgRGB[0], 5), getSteps(newFgRGB[1], newBgRGB[1], 5), getSteps(newFgRGB[2], newBgRGB[2], 5), filter);
17277    this.#hcmHighlightUrl = `url(#${id})`;
17278    return this.#hcmHighlightUrl;
17279  }
17280  destroy(keepHCM = false) {
17281    if (keepHCM && (this.#hcmUrl || this.#hcmHighlightUrl)) {
17282      return;
17283    }
17284    if (this.#_defs) {
17285      this.#_defs.parentNode.parentNode.remove();
17286      this.#_defs = null;
17287    }
17288    if (this.#_cache) {
17289      this.#_cache.clear();
17290      this.#_cache = null;
17291    }
17292    this.#id = 0;
17293  }
17294  #addGrayConversion(filter) {
17295    const feColorMatrix = this.#document.createElementNS(SVG_NS, "feColorMatrix");
17296    feColorMatrix.setAttribute("type", "matrix");
17297    feColorMatrix.setAttribute("values", "0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0");
17298    filter.append(feColorMatrix);
17299  }
17300  #createFilter(id) {
17301    const filter = this.#document.createElementNS(SVG_NS, "filter");
17302    filter.setAttribute("color-interpolation-filters", "sRGB");
17303    filter.setAttribute("id", id);
17304    this.#defs.append(filter);
17305    return filter;
17306  }
17307  #appendFeFunc(feComponentTransfer, func, table) {
17308    const feFunc = this.#document.createElementNS(SVG_NS, func);
17309    feFunc.setAttribute("type", "discrete");
17310    feFunc.setAttribute("tableValues", table);
17311    feComponentTransfer.append(feFunc);
17312  }
17313  #addTransferMapConversion(rTable, gTable, bTable, filter) {
17314    const feComponentTransfer = this.#document.createElementNS(SVG_NS, "feComponentTransfer");
17315    filter.append(feComponentTransfer);
17316    this.#appendFeFunc(feComponentTransfer, "feFuncR", rTable);
17317    this.#appendFeFunc(feComponentTransfer, "feFuncG", gTable);
17318    this.#appendFeFunc(feComponentTransfer, "feFuncB", bTable);
17319  }
17320  #getRGB(color) {
17321    this.#defs.style.color = color;
17322    return getRGB(getComputedStyle(this.#defs).getPropertyValue("color"));
17323  }
17324}
17325exports.DOMFilterFactory = DOMFilterFactory;
17326class DOMCanvasFactory extends _base_factory.BaseCanvasFactory {
17327  constructor({
17328    ownerDocument = globalThis.document
17329  } = {}) {
17330    super();
17331    this._document = ownerDocument;
17332  }
17333  _createCanvas(width, height) {
17334    const canvas = this._document.createElement("canvas");
17335    canvas.width = width;
17336    canvas.height = height;
17337    return canvas;
17338  }
17339}
17340exports.DOMCanvasFactory = DOMCanvasFactory;
17341async function fetchData(url, asTypedArray = false) {
17342  if (isValidFetchUrl(url, document.baseURI)) {
17343    const response = await fetch(url);
17344    if (!response.ok) {
17345      throw new Error(response.statusText);
17346    }
17347    return asTypedArray ? new Uint8Array(await response.arrayBuffer()) : (0, _util.stringToBytes)(await response.text());
17348  }
17349  return new Promise((resolve, reject) => {
17350    const request = new XMLHttpRequest();
17351    request.open("GET", url, true);
17352    if (asTypedArray) {
17353      request.responseType = "arraybuffer";
17354    }
17355    request.onreadystatechange = () => {
17356      if (request.readyState !== XMLHttpRequest.DONE) {
17357        return;
17358      }
17359      if (request.status === 200 || request.status === 0) {
17360        let data;
17361        if (asTypedArray && request.response) {
17362          data = new Uint8Array(request.response);
17363        } else if (!asTypedArray && request.responseText) {
17364          data = (0, _util.stringToBytes)(request.responseText);
17365        }
17366        if (data) {
17367          resolve(data);
17368          return;
17369        }
17370      }
17371      reject(new Error(request.statusText));
17372    };
17373    request.send(null);
17374  });
17375}
17376class DOMCMapReaderFactory extends _base_factory.BaseCMapReaderFactory {
17377  _fetchData(url, compressionType) {
17378    return fetchData(url, this.isCompressed).then(data => {
17379      return {
17380        cMapData: data,
17381        compressionType
17382      };
17383    });
17384  }
17385}
17386exports.DOMCMapReaderFactory = DOMCMapReaderFactory;
17387class DOMStandardFontDataFactory extends _base_factory.BaseStandardFontDataFactory {
17388  _fetchData(url) {
17389    return fetchData(url, true);
17390  }
17391}
17392exports.DOMStandardFontDataFactory = DOMStandardFontDataFactory;
17393class DOMSVGFactory extends _base_factory.BaseSVGFactory {
17394  _createSVG(type) {
17395    return document.createElementNS(SVG_NS, type);
17396  }
17397}
17398exports.DOMSVGFactory = DOMSVGFactory;
17399class PageViewport {
17400  constructor({
17401    viewBox,
17402    scale,
17403    rotation,
17404    offsetX = 0,
17405    offsetY = 0,
17406    dontFlip = false
17407  }) {
17408    this.viewBox = viewBox;
17409    this.scale = scale;
17410    this.rotation = rotation;
17411    this.offsetX = offsetX;
17412    this.offsetY = offsetY;
17413    const centerX = (viewBox[2] + viewBox[0]) / 2;
17414    const centerY = (viewBox[3] + viewBox[1]) / 2;
17415    let rotateA, rotateB, rotateC, rotateD;
17416    rotation %= 360;
17417    if (rotation < 0) {
17418      rotation += 360;
17419    }
17420    switch (rotation) {
17421      case 180:
17422        rotateA = -1;
17423        rotateB = 0;
17424        rotateC = 0;
17425        rotateD = 1;
17426        break;
17427      case 90:
17428        rotateA = 0;
17429        rotateB = 1;
17430        rotateC = 1;
17431        rotateD = 0;
17432        break;
17433      case 270:
17434        rotateA = 0;
17435        rotateB = -1;
17436        rotateC = -1;
17437        rotateD = 0;
17438        break;
17439      case 0:
17440        rotateA = 1;
17441        rotateB = 0;
17442        rotateC = 0;
17443        rotateD = -1;
17444        break;
17445      default:
17446        throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.");
17447    }
17448    if (dontFlip) {
17449      rotateC = -rotateC;
17450      rotateD = -rotateD;
17451    }
17452    let offsetCanvasX, offsetCanvasY;
17453    let width, height;
17454    if (rotateA === 0) {
17455      offsetCanvasX = Math.abs(centerY - viewBox[1]) * scale + offsetX;
17456      offsetCanvasY = Math.abs(centerX - viewBox[0]) * scale + offsetY;
17457      width = (viewBox[3] - viewBox[1]) * scale;
17458      height = (viewBox[2] - viewBox[0]) * scale;
17459    } else {
17460      offsetCanvasX = Math.abs(centerX - viewBox[0]) * scale + offsetX;
17461      offsetCanvasY = Math.abs(centerY - viewBox[1]) * scale + offsetY;
17462      width = (viewBox[2] - viewBox[0]) * scale;
17463      height = (viewBox[3] - viewBox[1]) * scale;
17464    }
17465    this.transform = [rotateA * scale, rotateB * scale, rotateC * scale, rotateD * scale, offsetCanvasX - rotateA * scale * centerX - rotateC * scale * centerY, offsetCanvasY - rotateB * scale * centerX - rotateD * scale * centerY];
17466    this.width = width;
17467    this.height = height;
17468  }
17469  get rawDims() {
17470    const {
17471      viewBox
17472    } = this;
17473    return (0, _util.shadow)(this, "rawDims", {
17474      pageWidth: viewBox[2] - viewBox[0],
17475      pageHeight: viewBox[3] - viewBox[1],
17476      pageX: viewBox[0],
17477      pageY: viewBox[1]
17478    });
17479  }
17480  clone({
17481    scale = this.scale,
17482    rotation = this.rotation,
17483    offsetX = this.offsetX,
17484    offsetY = this.offsetY,
17485    dontFlip = false
17486  } = {}) {
17487    return new PageViewport({
17488      viewBox: this.viewBox.slice(),
17489      scale,
17490      rotation,
17491      offsetX,
17492      offsetY,
17493      dontFlip
17494    });
17495  }
17496  convertToViewportPoint(x, y) {
17497    return _util.Util.applyTransform([x, y], this.transform);
17498  }
17499  convertToViewportRectangle(rect) {
17500    const topLeft = _util.Util.applyTransform([rect[0], rect[1]], this.transform);
17501    const bottomRight = _util.Util.applyTransform([rect[2], rect[3]], this.transform);
17502    return [topLeft[0], topLeft[1], bottomRight[0], bottomRight[1]];
17503  }
17504  convertToPdfPoint(x, y) {
17505    return _util.Util.applyInverseTransform([x, y], this.transform);
17506  }
17507}
17508exports.PageViewport = PageViewport;
17509class RenderingCancelledException extends _util.BaseException {
17510  constructor(msg, extraDelay = 0) {
17511    super(msg, "RenderingCancelledException");
17512    this.extraDelay = extraDelay;
17513  }
17514}
17515exports.RenderingCancelledException = RenderingCancelledException;
17516function isDataScheme(url) {
17517  const ii = url.length;
17518  let i = 0;
17519  while (i < ii && url[i].trim() === "") {
17520    i++;
17521  }
17522  return url.substring(i, i + 5).toLowerCase() === "data:";
17523}
17524function isPdfFile(filename) {
17525  return typeof filename === "string" && /\.pdf$/i.test(filename);
17526}
17527function getFilenameFromUrl(url, onlyStripPath = false) {
17528  if (!onlyStripPath) {
17529    [url] = url.split(/[#?]/, 1);
17530  }
17531  return url.substring(url.lastIndexOf("/") + 1);
17532}
17533function getPdfFilenameFromUrl(url, defaultFilename = "document.pdf") {
17534  if (typeof url !== "string") {
17535    return defaultFilename;
17536  }
17537  if (isDataScheme(url)) {
17538    (0, _util.warn)('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.');
17539    return defaultFilename;
17540  }
17541  const reURI = /^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/;
17542  const reFilename = /[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i;
17543  const splitURI = reURI.exec(url);
17544  let suggestedFilename = reFilename.exec(splitURI[1]) || reFilename.exec(splitURI[2]) || reFilename.exec(splitURI[3]);
17545  if (suggestedFilename) {
17546    suggestedFilename = suggestedFilename[0];
17547    if (suggestedFilename.includes("%")) {
17548      try {
17549        suggestedFilename = reFilename.exec(decodeURIComponent(suggestedFilename))[0];
17550      } catch {}
17551    }
17552  }
17553  return suggestedFilename || defaultFilename;
17554}
17555class StatTimer {
17556  started = Object.create(null);
17557  times = [];
17558  time(name) {
17559    if (name in this.started) {
17560      (0, _util.warn)(`Timer is already running for ${name}`);
17561    }
17562    this.started[name] = Date.now();
17563  }
17564  timeEnd(name) {
17565    if (!(name in this.started)) {
17566      (0, _util.warn)(`Timer has not been started for ${name}`);
17567    }
17568    this.times.push({
17569      name,
17570      start: this.started[name],
17571      end: Date.now()
17572    });
17573    delete this.started[name];
17574  }
17575  toString() {
17576    const outBuf = [];
17577    let longest = 0;
17578    for (const {
17579      name
17580    } of this.times) {
17581      longest = Math.max(name.length, longest);
17582    }
17583    for (const {
17584      name,
17585      start,
17586      end
17587    } of this.times) {
17588      outBuf.push(`${name.padEnd(longest)} ${end - start}
17588ms\n`);
17589    }
17590    return outBuf.join("");
17591  }
17592}
17593exports.StatTimer = StatTimer;
17594function isValidFetchUrl(url, baseUrl) {
17595  try {
17596    const {
17597      protocol
17598    } = baseUrl ? new URL(url, baseUrl) : new URL(url);
17599    return protocol === "http:" || protocol === "https:";
17600  } catch {
17601    return false;
17602  }
17603}
17604function noContextMenu(e) {
17605  e.preventDefault();
17606}
17607function loadScript(src, removeScriptElement = false) {
17608  return new Promise((resolve, reject) => {
17609    const script = document.createElement("script");
17610    script.src = src;
17611    script.onload = function (evt) {
17612      if (removeScriptElement) {
17613        script.remove();
17614      }
17615      resolve(evt);
17616    };
17617    script.onerror = function () {
17618      reject(new Error(`Cannot load script at: ${script.src}`));
17619    };
17620    (document.head || document.documentElement).append(script);
17621  });
17622}
17623function deprecated(details) {
17624  console.log("Deprecated API usage: " + details);
17625}
17626let pdfDateStringRegex;
17627class PDFDateString {
17628  static toDateObject(input) {
17629    if (!input || typeof input !== "string") {
17630      return null;
17631    }
17632    pdfDateStringRegex ||= new RegExp("^D:" + "(\\d{4})" + "(\\d{2})?" + "(\\d{2})?" + "(\\d{2})?" + "(\\d{2})?" + "(\\d{2})?" + "([Z|+|-])?" + "(\\d{2})?" + "'?" + "(\\d{2})?" + "'?");
17633    const matches = pdfDateStringRegex.exec(input);
17634    if (!matches) {
17635      return null;
17636    }
17637    const year = parseInt(matches[1], 10);
17638    let month = parseInt(matches[2], 10);
17639    month = month >= 1 && month <= 12 ? month - 1 : 0;
17640    let day = parseInt(matches[3], 10);
17641    day = day >= 1 && day <= 31 ? day : 1;
17642    let hour = parseInt(matches[4], 10);
17643    hour = hour >= 0 && hour <= 23 ? hour : 0;
17644    let minute = parseInt(matches[5], 10);
17645    minute = minute >= 0 && minute <= 59 ? minute : 0;
17646    let second = parseInt(matches[6], 10);
17647    second = second >= 0 && second <= 59 ? second : 0;
17648    const universalTimeRelation = matches[7] || "Z";
17649    let offsetHour = parseInt(matches[8], 10);
17650    offsetHour = offsetHour >= 0 && offsetHour <= 23 ? offsetHour : 0;
17651    let offsetMinute = parseInt(matches[9], 10) || 0;
17652    offsetMinute = offsetMinute >= 0 && offsetMinute <= 59 ? offsetMinute : 0;
17653    if (universalTimeRelation === "-") {
17654      hour += offsetHour;
17655      minute += offsetMinute;
17656    } else if (universalTimeRelation === "+") {
17657      hour -= offsetHour;
17658      minute -= offsetMinute;
17659    }
17660    return new Date(Date.UTC(year, month, day, hour, minute, second));
17661  }
17662}
17663exports.PDFDateString = PDFDateString;
17664function getXfaPageViewport(xfaPage, {
17665  scale = 1,
17666  rotation = 0
17667}) {
17668  const {
17669    width,
17670    height
17671  } = xfaPage.attributes.style;
17672  const viewBox = [0, 0, parseInt(width), parseInt(height)];
17673  return new PageViewport({
17674    viewBox,
17675    scale,
17676    rotation
17677  });
17678}
17679function getRGB(color) {
17680  if (color.startsWith("#")) {
17681    const colorRGB = parseInt(color.slice(1), 16);
17682    return [(colorRGB & 0xff0000) >> 16, (colorRGB & 0x00ff00) >> 8, colorRGB & 0x0000ff];
17683  }
17684  if (color.startsWith("rgb(")) {
17685    return color.slice(4, -1).split(",").map(x => parseInt(x));
17686  }
17687  if (color.startsWith("rgba(")) {
17688    return color.slice(5, -1).split(",").map(x => parseInt(x)).slice(0, 3);
17689  }
17690  (0, _util.warn)(`Not a valid color format: "${color}"`);
17691  return [0, 0, 0];
17692}
17693function getColorValues(colors) {
17694  const span = document.createElement("span");
17695  span.style.visibility = "hidden";
17696  document.body.append(span);
17697  for (const name of colors.keys()) {
17698    span.style.color = name;
17699    const computedColor = window.getComputedStyle(span).color;
17700    colors.set(name, getRGB(computedColor));
17701  }
17702  span.remove();
17703}
17704function getCurrentTransform(ctx) {
17705  const {
17706    a,
17707    b,
17708    c,
17709    d,
17710    e,
17711    f
17712  } = ctx.getTransform();
17713  return [a, b, c, d, e, f];
17714}
17715function getCurrentTransformInverse(ctx) {
17716  const {
17717    a,
17718    b,
17719    c,
17720    d,
17721    e,
17722    f
17723  } = ctx.getTransform().invertSelf();
17724  return [a, b, c, d, e, f];
17725}
17726function setLayerDimensions(div, viewport, mustFlip = false, mustRotate = true) {
17727  if (viewport instanceof PageViewport) {
17728    const {
17729      pageWidth,
17730      pageHeight
17731    } = viewport.rawDims;
17732    const {
17733      style
17734    } = div;
17735    const useRound = _util.FeatureTest.isCSSRoundSupported;
17736    const w = `var(--scale-factor) * ${pageWidth}px`,
17737      h = `var(--scale-factor) * ${pageHeight}px`;
17738    const widthStr = useRound ? `round(${w}, 1px)` : `calc(${w})`,
17739      heightStr = useRound ? `round(${h}, 1px)` : `calc(${h})`;
17740    if (!mustFlip || viewport.rotation % 180 === 0) {
17741      style.width = widthStr;
17742      style.height = heightStr;
17743    } else {
17744      style.width = heightStr;
17745      style.height = widthStr;
17746    }
17747  }
17748  if (mustRotate) {
17749    div.setAttribute("data-main-rotation", viewport.rotation);
17750  }
17751}
17752
17753/***/ }),
17754/* 7 */
17755/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
17756
17757
17758
17759Object.defineProperty(exports, "__esModule", ({
17760  value: true
17761}));
17762exports.BaseStandardFontDataFactory = exports.BaseSVGFactory = exports.BaseFilterFactory = exports.BaseCanvasFactory = exports.BaseCMapReaderFactory = void 0;
17763var _util = __w_pdfjs_require__(1);
17764class BaseFilterFactory {
17765  constructor() {
17766    if (this.constructor === BaseFilterFactory) {
17767      (0, _util.unreachable)("Cannot initialize BaseFilterFactory.");
17768    }
17769  }
17770  addFilter(maps) {
17771    return "none";
17772  }
17773  addHCMFilter(fgColor, bgColor) {
17774    return "none";
17775  }
17776  addHighlightHCMFilter(fgColor, bgColor, newFgColor, newBgColor) {
17777    return "none";
17778  }
17779  destroy(keepHCM = false) {}
17780}
17781exports.BaseFilterFactory = BaseFilterFactory;
17782class BaseCanvasFactory {
17783  constructor() {
17784    if (this.constructor === BaseCanvasFactory) {
17785      (0, _util.unreachable)("Cannot initialize BaseCanvasFactory.");
17786    }
17787  }
17788  create(width, height) {
17789    if (width <= 0 || height <= 0) {
17790      throw new Error("Invalid canvas size");
17791    }
17792    const canvas = this._createCanvas(width, height);
17793    return {
17794      canvas,
17795      context: canvas.getContext("2d")
17796    };
17797  }
17798  reset(canvasAndContext, width, height) {
17799    if (!canvasAndContext.canvas) {
17800      throw new Error("Canvas is not specified");
17801    }
17802    if (width <= 0 || height <= 0) {
17803      throw new Error("Invalid canvas size");
17804    }
17805    canvasAndContext.canvas.width = width;
17806    canvasAndContext.canvas.height = height;
17807  }
17808  destroy(canvasAndContext) {
17809    if (!canvasAndContext.canvas) {
17810      throw new Error("Canvas is not specified");
17811    }
17812    canvasAndContext.canvas.width = 0;
17813    canvasAndContext.canvas.height = 0;
17814    canvasAndContext.canvas = null;
17815    canvasAndContext.context = null;
17816  }
17817  _createCanvas(width, height) {
17818    (0, _util.unreachable)("Abstract method `_createCanvas` called.");
17819  }
17820}
17821exports.BaseCanvasFactory = BaseCanvasFactory;
17822class BaseCMapReaderFactory {
17823  constructor({
17824    baseUrl = null,
17825    isCompressed = true
17826  }) {
17827    if (this.constructor === BaseCMapReaderFactory) {
17828      (0, _util.unreachable)("Cannot initialize BaseCMapReaderFactory.");
17829    }
17830    this.baseUrl = baseUrl;
17831    this.isCompressed = isCompressed;
17832  }
17833  async fetch({
17834    name
17835  }) {
17836    if (!this.baseUrl) {
17837      throw new Error('The CMap "baseUrl" parameter must be specified, ensure that ' + 'the "cMapUrl" and "cMapPacked" API parameters are provided.');
17838    }
17839    if (!name) {
17840      throw new Error("CMap name must be specified.");
17841    }
17842    const url = this.baseUrl + name + (this.isCompressed ? ".bcmap" : "");
17843    const compressionType = this.isCompressed ? _util.CMapCompressionType.BINARY : _util.CMapCompressionType.NONE;
17844    return this._fetchData(url, compressionType).catch(reason => {
17845      throw new Error(`Unable to load ${this.isCompressed ? "binary " : ""}CMap at: ${url}`);
17846    });
17847  }
17848  _fetchData(url, compressionType) {
17849    (0, _util.unreachable)("Abstract method `_fetchData` called.");
17850  }
17851}
17852exports.BaseCMapReaderFactory = BaseCMapReaderFactory;
17853class BaseStandardFontDataFactory {
17854  constructor({
17855    baseUrl = null
17856  }) {
17857    if (this.constructor === BaseStandardFontDataFactory) {
17858      (0, _util.unreachable)("Cannot initialize BaseStandardFontDataFactory.");
17859    }
17860    this.baseUrl = baseUrl;
17861  }
17862  async fetch({
17863    filename
17864  }) {
17865    if (!this.baseUrl) {
17866      throw new Error('The standard font "baseUrl" parameter must be specified, ensure that ' + 'the "standardFontDataUrl" API parameter is provided.');
17867    }
17868    if (!filename) {
17869      throw new Error("Font filename must be specified.");
17870    }
17871    const url = `${this.baseUrl}${filename}`;
17872    return this._fetchData(url).catch(reason => {
17873      throw new Error(`Unable to load font data at: ${url}`);
17874    });
17875  }
17876  _fetchData(url) {
17877    (0, _util.unreachable)("Abstract method `_fetchData` called.");
17878  }
17879}
17880exports.BaseStandardFontDataFactory = BaseStandardFontDataFactory;
17881class BaseSVGFactory {
17882  constructor() {
17883    if (this.constructor === BaseSVGFactory) {
17884      (0, _util.unreachable)("Cannot initialize BaseSVGFactory.");
17885    }
17886  }
17887  create(width, height, skipDimensions = false) {
17888    if (width <= 0 || height <= 0) {
17889      throw new Error("Invalid SVG dimensions");
17890    }
17891    const svg = this._createSVG("svg:svg");
17892    svg.setAttribute("version", "1.1");
17893    if (!skipDimensions) {
17894      svg.setAttribute("width", `${width}px`);
17895      svg.setAttribute("height", `${height}px`);
17896    }
17897    svg.setAttribute("preserveAspectRatio", "none");
17898    svg.setAttribute("viewBox", `0 0 ${width} ${height}`);
17899    return svg;
17900  }
17901  createElement(type) {
17902    if (typeof type !== "string") {
17903      throw new Error("Invalid SVG element type");
17904    }
17905    return this._createSVG(type);
17906  }
17907  _createSVG(type) {
17908    (0, _util.unreachable)("Abstract method `_createSVG` called.");
17909  }
17910}
17911exports.BaseSVGFactory = BaseSVGFactory;
17912
17913/***/ }),
17914/* 8 */
17915/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
17916
17917
17918
17919Object.defineProperty(exports, "__esModule", ({
17920  value: true
17921}));
17922exports.MurmurHash3_64 = void 0;
17923var _util = __w_pdfjs_require__(1);
17924const SEED = 0xc3d2e1f0;
17925const MASK_HIGH = 0xffff0000;
17926const MASK_LOW = 0xffff;
17927class MurmurHash3_64 {
17928  constructor(seed) {
17929    this.h1 = seed ? seed & 0xffffffff : SEED;
17930    this.h2 = seed ? seed & 0xffffffff : SEED;
17931  }
17932  update(input) {
17933    let data, length;
17934    if (typeof input === "string") {
17935      data = new Uint8Array(input.length * 2);
17936      length = 0;
17937      for (let i = 0, ii = input.length; i < ii; i++) {
17938        const code = input.charCodeAt(i);
17939        if (code <= 0xff) {
17940          data[length++] = code;
17941        } else {
17942          data[length++] = code >>> 8;
17943          data[length++] = code & 0xff;
17944        }
17945      }
17946    } else if ((0, _util.isArrayBuffer)(input)) {
17947      data = input.slice();
17948      length = data.byteLength;
17949    } else {
17950      throw new Error("Wrong data format in MurmurHash3_64_update. " + "Input must be a string or array.");
17951    }
17952    const blockCounts = length >> 2;
17953    const tailLength = length - blockCounts * 4;
17954    const dataUint32 = new Uint32Array(data.buffer, 0, blockCounts);
17955    let k1 = 0,
17956      k2 = 0;
17957    let h1 = this.h1,
17958      h2 = this.h2;
17959    const C1 = 0xcc9e2d51,
17960      C2 = 0x1b873593;
17961    const C1_LOW = C1 & MASK_LOW,
17962      C2_LOW = C2 & MASK_LOW;
17963    for (let i = 0; i < blockCounts; i++) {
17964      if (i & 1) {
17965        k1 = dataUint32[i];
17966        k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
17967        k1 = k1 << 15 | k1 >>> 17;
17968        k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
17969        h1 ^= k1;
17970        h1 = h1 << 13 | h1 >>> 19;
17971        h1 = h1 * 5 + 0xe6546b64;
17972      } else {
17973        k2 = dataUint32[i];
17974        k2 = k2 * C1 & MASK_HIGH | k2 * C1_LOW & MASK_LOW;
17975        k2 = k2 << 15 | k2 >>> 17;
17976        k2 = k2 * C2 & MASK_HIGH | k2 * C2_LOW & MASK_LOW;
17977        h2 ^= k2;
17978        h2 = h2 << 13 | h2 >>> 19;
17979        h2 = h2 * 5 + 0xe6546b64;
17980      }
17981    }
17982    k1 = 0;
17983    switch (tailLength) {
17984      case 3:
17985        k1 ^= data[blockCounts * 4 + 2] << 16;
17986      case 2:
17987        k1 ^= data[blockCounts * 4 + 1] << 8;
17988      case 1:
17989        k1 ^= data[blockCounts * 4];
17990        k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
17991        k1 = k1 << 15 | k1 >>> 17;
17992        k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
17993        if (blockCounts & 1) {
17994          h1 ^= k1;
17995        } else {
17996          h2 ^= k1;
17997        }
17998    }
17999    this.h1 = h1;
18000    this.h2 = h2;
18001  }
18002  hexdigest() {
18003    let h1 = this.h1,
18004      h2 = this.h2;
18005    h1 ^= h2 >>> 1;
18006    h1 = h1 * 0xed558ccd & MASK_HIGH | h1 * 0x8ccd & MASK_LOW;
18007    h2 = h2 * 0xff51afd7 & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xafd7ed55 & MASK_HIGH) >>> 16;
18008    h1 ^= h2 >>> 1;
18009    h1 = h1 * 0x1a85ec53 & MASK_HIGH | h1 * 0xec53 & MASK_LOW;
18010    h2 = h2 * 0xc4ceb9fe & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xb9fe1a85 & MASK_HIGH) >>> 16;
18011    h1 ^= h2 >>> 1;
18012    return (h1 >>> 0).toString(16).padStart(8, "0") + (h2 >>> 0).toString(16).padStart(8, "0");
18013  }
18014}
18015exports.MurmurHash3_64 = MurmurHash3_64;
18016
18017/***/ }),
18018/* 9 */
18019/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
18020
18021
18022
18023Object.defineProperty(exports, "__esModule", ({
18024  value: true
18025}));
18026exports.FontLoader = exports.FontFaceObject = void 0;
18027var _util = __w_pdfjs_require__(1);
18028class FontLoader {
18029  #systemFonts = new Set();
18030  constructor({
18031    ownerDocument = globalThis.document,
18032    styleElement = null
18033  }) {
18034    this._document = ownerDocument;
18035    this.nativeFontFaces = new Set();
18036    this.styleElement = null;
18037    this.loadingRequests = [];
18038    this.loadTestFontId = 0;
18039  }
18040  addNativeFontFace(nativeFontFace) {
18041    this.nativeFontFaces.add(nativeFontFace);
18042    this._document.fonts.add(nativeFontFace);
18043  }
18044  removeNativeFontFace(nativeFontFace) {
18045    this.nativeFontFaces.delete(nativeFontFace);
18046    this._document.fonts.delete(nativeFontFace);
18047  }
18048  insertRule(rule) {
18049    if (!this.styleElement) {
18050      this.styleElement = this._document.createElement("style");
18051      this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement);
18052    }
18053    const styleSheet = this.styleElement.sheet;
18054    styleSheet.insertRule(rule, styleSheet.cssRules.length);
18055  }
18056  clear() {
18057    for (const nativeFontFace of this.nativeFontFaces) {
18058      this._document.fonts.delete(nativeFontFace);
18059    }
18060    this.nativeFontFaces.clear();
18061    this.#systemFonts.clear();
18062    if (this.styleElement) {
18063      this.styleElement.remove();
18064      this.styleElement = null;
18065    }
18066  }
18067  async loadSystemFont(info) {
18068    if (!info || this.#systemFonts.has(info.loadedName)) {
18069      return;
18070    }
18071    (0, _util.assert)(!this.disableFontFace, "loadSystemFont shouldn't be called when `disableFontFace` is set.");
18072    if (this.isFontLoadingAPISupported) {
18073      const {
18074        loadedName,
18075        src,
18076        style
18077      } = info;
18078      const fontFace = new FontFace(loadedName, src, style);
18079      this.addNativeFontFace(fontFace);
18080      try {
18081        await fontFace.load();
18082        this.#systemFonts.add(loadedName);
18083      } catch {
18084        (0, _util.warn)(`Cannot load system font: ${info.baseFontName}, installing it could help to improve PDF rendering.`);
18085        this.removeNativeFontFace(fontFace);
18086      }
18087      return;
18088    }
18089    (0, _util.unreachable)("Not implemented: loadSystemFont without the Font Loading API.");
18090  }
18091  async bind(font) {
18092    if (font.attached || font.missingFile && !font.systemFontInfo) {
18093      return;
18094    }
18095    font.attached = true;
18096    if (font.systemFontInfo) {
18097      await this.loadSystemFont(font.systemFontInfo);
18098      return;
18099    }
18100    if (this.isFontLoadingAPISupported) {
18101      const nativeFontFace = font.createNativeFontFace();
18102      if (nativeFontFace) {
18103        this.addNativeFontFace(nativeFontFace);
18104        try {
18105          await nativeFontFace.loaded;
18106        } catch (ex) {
18107          (0, _util.warn)(`Failed to load font '${nativeFontFace.family}': '${ex}'.`);
18108          font.disableFontFace = true;
18109          throw ex;
18110        }
18111      }
18112      return;
18113    }
18114    const rule = font.createFontFaceRule();
18115    if (rule) {
18116      this.insertRule(rule);
18117      if (this.isSyncFontLoadingSupported) {
18118        return;
18119      }
18120      await new Promise(resolve => {
18121        const request = this._queueLoadingCallback(resolve);
18122        this._prepareFontLoadEvent(font, request);
18123      });
18124    }
18125  }
18126  get isFontLoadingAPISupported() {
18127    const hasFonts = !!this._document?.fonts;
18128    return (0, _util.shadow)(this, "isFontLoadingAPISupported", hasFonts);
18129  }
18130  get isSyncFontLoadingSupported() {
18131    let supported = false;
18132    if (_util.isNodeJS) {
18133      supported = true;
18134    } else if (typeof navigator !== "undefined" && /Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent)) {
18135      supported = true;
18136    }
18137    return (0, _util.shadow)(this, "isSyncFontLoadingSupported", supported);
18138  }
18139  _queueLoadingCallback(callback) {
18140    function completeRequest() {
18141      (0, _util.assert)(!request.done, "completeRequest() cannot be called twice.");
18142      request.done = true;
18143      while (loadingRequests.length > 0 && loadingRequests[0].done) {
18144        const otherRequest = loadingRequests.shift();
18145        setTimeout(otherRequest.callback, 0);
18146      }
18147    }
18148    const {
18149      loadingRequests
18150    } = this;
18151    const request = {
18152      done: false,
18153      complete: completeRequest,
18154      callback
18155    };
18156    loadingRequests.push(request);
18157    return request;
18158  }
18159  get _loadTestFont() {
18160    const testFont = atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQA" + "FQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAA" + "ALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgA" + "AAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1" + "AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD" + "6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACM" + "AooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4D" + "IP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAA" + "AAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUA" + "AQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgAB" + "AAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABY" + "AAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAA" + "AC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + "AAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAA" + "AAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQAC" + "AQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3" + "Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTj" + "FQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");
18161    return (0, _util.shadow)(this, "_loadTestFont", testFont);
18162  }
18163  _prepareFontLoadEvent(font, request) {
18164    function int32(data, offset) {
18165      return data.charCodeAt(offset) << 24 | data.charCodeAt(offset + 1) << 16 | data.charCodeAt(offset + 2) << 8 | data.charCodeAt(offset + 3) & 0xff;
18166    }
18167    function spliceString(s, offset, remove, insert) {
18168      const chunk1 = s.substring(0, offset);
18169      const chunk2 = s.substring(offset + remove);
18170      return chunk1 + insert + chunk2;
18171    }
18172    let i, ii;
18173    const canvas = this._document.createElement("canvas");
18174    canvas.width = 1;
18175    canvas.height = 1;
18176    const ctx = canvas.getContext("2d");
18177    let called = 0;
18178    function isFontReady(name, callback) {
18179      if (++called > 30) {
18180        (0, _util.warn)("Load test font never loaded.");
18181        callback();
18182        return;
18183      }
18184      ctx.font = "30px " + name;
18185      ctx.fillText(".", 0, 20);
18186      const imageData = ctx.getImageData(0, 0, 1, 1);
18187      if (imageData.data[3] > 0) {
18188        callback();
18189        return;
18190      }
18191      setTimeout(isFontReady.bind(null, name, callback));
18192    }
18193    const loadTestFontId = `lt${Date.now()}${this.loadTestFontId++}`;
18194    let data = this._loadTestFont;
18195    const COMMENT_OFFSET = 976;
18196    data = spliceString(data, COMMENT_OFFSET, loadTestFontId.length, loadTestFontId);
18197    const CFF_CHECKSUM_OFFSET = 16;
18198    const XXXX_VALUE = 0x58585858;
18199    let checksum = int32(data, CFF_CHECKSUM_OFFSET);
18200    for (i = 0, ii = loadTestFontId.length - 3; i < ii; i += 4) {
18201      checksum = checksum - XXXX_VALUE + int32(loadTestFontId, i) | 0;
18202    }
18203    if (i < loadTestFontId.length) {
18204      checksum = checksum - XXXX_VALUE + int32(loadTestFontId + "XXX", i) | 0;
18205    }
18206    data = spliceString(data, CFF_CHECKSUM_OFFSET, 4, (0, _util.string32)(checksum));
18207    const url = `url(data:font/opentype;base64,${btoa(data)});`;
18208    const rule = `@font-face {font-family:"${loadTestFontId}";src:${url}}`;
18209    this.insertRule(rule);
18210    const div = this._document.createElement("div");
18211    div.style.visibility = "hidden";
18212    div.style.width = div.style.height = "10px";
18213    div.style.position = "absolute";
18214    div.style.top = div.style.left = "0px";
18215    for (const name of [font.loadedName, loadTestFontId]) {
18216      const span = this._document.createElement("span");
18217      span.textContent = "Hi";
18218      span.style.fontFamily = name;
18219      div.append(span);
18220    }
18221    this._document.body.append(div);
18222    isFontReady(loadTestFontId, () => {
18223      div.remove();
18224      request.complete();
18225    });
18226  }
18227}
18228exports.FontLoader = FontLoader;
18229class FontFaceObject {
18230  constructor(translatedData, {
18231    isEvalSupported = true,
18232    disableFontFace = false,
18233    ignoreErrors = false,
18234    inspectFont = null
18235  }) {
18236    this.compiledGlyphs = Object.create(null);
18237    for (const i in translatedData) {
18238      this[i] = translatedData[i];
18239    }
18240    this.isEvalSupported = isEvalSupported !== false;
18241    this.disableFontFace = disableFontFace === true;
18242    this.ignoreErrors = ignoreErrors === true;
18243    this._inspectFont = inspectFont;
18244  }
18245  createNativeFontFace() {
18246    if (!this.data || this.disableFontFace) {
18247      return null;
18248    }
18249    let nativeFontFace;
18250    if (!this.cssFontInfo) {
18251      nativeFontFace = new FontFace(this.loadedName, this.data, {});
18252    } else {
18253      const css = {
18254        weight: this.cssFontInfo.fontWeight
18255      };
18256      if (this.cssFontInfo.italicAngle) {
18257        css.style = `oblique ${this.cssFontInfo.italicAngle}deg`;
18258      }
18259      nativeFontFace = new FontFace(this.cssFontInfo.fontFamily, this.data, css);
18260    }
18261    this._inspectFont?.(this);
18262    return nativeFontFace;
18263  }
18264  createFontFaceRule() {
18265    if (!this.data || this.disableFontFace) {
18266      return null;
18267    }
18268    const data = (0, _util.bytesToString)(this.data);
18269    const url = `url(data:${this.mimetype};base64,${btoa(data)});`;
18270    let rule;
18271    if (!this.cssFontInfo) {
18272      rule = `@font-face {font-family:"${this.loadedName}";src:${url}}`;
18273    } else {
18274      let css = `font-weight: ${this.cssFontInfo.fontWeight};`;
18275      if (this.cssFontInfo.italicAngle) {
18276        css += `font-style: oblique ${this.cssFontInfo.italicAngle}deg;`;
18277      }
18278      rule = `@font-face {font-family:"${this.cssFontInfo.fontFamily}";${css}src:${url}}`;
18279    }
18280    this._inspectFont?.(this, url);
18281    return rule;
18282  }
18283  getPathGenerator(objs, character) {
18284    if (this.compiledGlyphs[character] !== undefined) {
18285      return this.compiledGlyphs[character];
18286    }
18287    let cmds;
18288    try {
18289      cmds = objs.get(this.loadedName + "_path_" + character);
18290    } catch (ex) {
18291      if (!this.ignoreErrors) {
18292        throw ex;
18293      }
18294      (0, _util.warn)(`getPathGenerator - ignoring character: "${ex}".`);
18295      return this.compiledGlyphs[character] = function (c, size) {};
18296    }
18297    if (this.isEvalSupported && _util.FeatureTest.isEvalSupported) {
18298      const jsBuf = [];
18299      for (const current of cmds) {
18300        const args = current.args !== undefined ? current.args.join(",") : "";
18301        jsBuf.push("c.", current.cmd, "(", args, ");\n");
18302      }
18303      return this.compiledGlyphs[character] = new Function("c", "size", jsBuf.join(""));
18304    }
18305    return this.compiledGlyphs[character] = function (c, size) {
18306      for (const current of cmds) {
18307        if (current.cmd === "scale") {
18308          current.args = [size, -size];
18309        }
18310        c[current.cmd].apply(c, current.args);
18311      }
18312    };
18313  }
18314}
18315exports.FontFaceObject = FontFaceObject;
18316
18317/***/ }),
18318/* 10 */
18319/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
18320
18321
18322
18323Object.defineProperty(exports, "__esModule", ({
18324  value: true
18325}));
18326exports.NodeStandardFontDataFactory = exports.NodeFilterFactory = exports.NodeCanvasFactory = exports.NodeCMapReaderFactory = void 0;
18327var _base_factory = __w_pdfjs_require__(7);
18328var _util = __w_pdfjs_require__(1);
18329;
18330;
18331const fetchData = function (url) {
18332  return new Promise((resolve, reject) => {
18333    const fs = __webpack_require__(/*! fs */ "fs");
18334    fs.readFile(url, (error, data) => {
18335      if (error || !data) {
18336        reject(new Error(error));
18337        return;
18338      }
18339      resolve(new Uint8Array(data));
18340    });
18341  });
18342};
18343class NodeFilterFactory extends _base_factory.BaseFilterFactory {}
18344exports.NodeFilterFactory = NodeFilterFactory;
18345class NodeCanvasFactory extends _base_factory.BaseCanvasFactory {
18346  _createCanvas(width, height) {
18347    const Canvas = __webpack_require__(/*! canvas */ "./node_modules/canvas/index.js");
18348    return Canvas.createCanvas(width, height);
18349  }
18350}
18351exports.NodeCanvasFactory = NodeCanvasFactory;
18352class NodeCMapReaderFactory extends _base_factory.BaseCMapReaderFactory {
18353  _fetchData(url, compressionType) {
18354    return fetchData(url).then(data => {
18355      return {
18356        cMapData: data,
18357        compressionType
18358      };
18359    });
18360  }
18361}
18362exports.NodeCMapReaderFactory = NodeCMapReaderFactory;
18363class NodeStandardFontDataFactory extends _base_factory.BaseStandardFontDataFactory {
18364  _fetchData(url) {
18365    return fetchData(url);
18366  }
18367}
18368exports.NodeStandardFontDataFactory = NodeStandardFontDataFactory;
18369
18370/***/ }),
18371/* 11 */
18372/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
18373
18374
18375
18376Object.defineProperty(exports, "__esModule", ({
18377  value: true
18378}));
18379exports.CanvasGraphics = void 0;
18380var _util = __w_pdfjs_require__(1);
18381var _display_utils = __w_pdfjs_require__(6);
18382var _pattern_helper = __w_pdfjs_require__(12);
18383var _image_utils = __w_pdfjs_require__(13);
18384const MIN_FONT_SIZE = 16;
18385const MAX_FONT_SIZE = 100;
18386const MAX_GROUP_SIZE = 4096;
18387const EXECUTION_TIME = 15;
18388const EXECUTION_STEPS = 10;
18389const MAX_SIZE_TO_COMPILE = 1000;
18390const FULL_CHUNK_HEIGHT = 16;
18391function mirrorContextOperations(ctx, destCtx) {
18392  if (ctx._removeMirroring) {
18393    throw new Error("Context is already forwarding operations.");
18394  }
18395  ctx.__originalSave = ctx.save;
18396  ctx.__originalRestore = ctx.restore;
18397  ctx.__originalRotate = ctx.rotate;
18398  ctx.__originalScale = ctx.scale;
18399  ctx.__originalTranslate = ctx.translate;
18400  ctx.__originalTransform = ctx.transform;
18401  ctx.__originalSetTransform = ctx.setTransform;
18402  ctx.__originalResetTransform = ctx.resetTransform;
18403  ctx.__originalClip = ctx.clip;
18404  ctx.__originalMoveTo = ctx.moveTo;
18405  ctx.__originalLineTo = ctx.lineTo;
18406  ctx.__originalBezierCurveTo = ctx.bezierCurveTo;
18407  ctx.__originalRect = ctx.rect;
18408  ctx.__originalClosePath = ctx.closePath;
18409  ctx.__originalBeginPath = ctx.beginPath;
18410  ctx._removeMirroring = () => {
18411    ctx.save = ctx.__originalSave;
18412    ctx.restore = ctx.__originalRestore;
18413    ctx.rotate = ctx.__originalRotate;
18414    ctx.scale = ctx.__originalScale;
18415    ctx.translate = ctx.__originalTranslate;
18416    ctx.transform = ctx.__originalTransform;
18417    ctx.setTransform = ctx.__originalSetTransform;
18418    ctx.resetTransform = ctx.__originalResetTransform;
18419    ctx.clip = ctx.__originalClip;
18420    ctx.moveTo = ctx.__originalMoveTo;
18421    ctx.lineTo = ctx.__originalLineTo;
18422    ctx.bezierCurveTo = ctx.__originalBezierCurveTo;
18423    ctx.rect = ctx.__originalRect;
18424    ctx.closePath = ctx.__originalClosePath;
18425    ctx.beginPath = ctx.__originalBeginPath;
18426    delete ctx._removeMirroring;
18427  };
18428  ctx.save = function ctxSave() {
18429    destCtx.save();
18430    this.__originalSave();
18431  };
18432  ctx.restore = function ctxRestore() {
18433    destCtx.restore();
18434    this.__originalRestore();
18435  };
18436  ctx.translate = function ctxTranslate(x, y) {
18437    destCtx.translate(x, y);
18438    this.__originalTranslate(x, y);
18439  };
18440  ctx.scale = function ctxScale(x, y) {
18441    destCtx.scale(x, y);
18442    this.__originalScale(x, y);
18443  };
18444  ctx.transform = function ctxTransform(a, b, c, d, e, f) {
18445    destCtx.transform(a, b, c, d, e, f);
18446    this.__originalTransform(a, b, c, d, e, f);
18447  };
18448  ctx.setTransform = function ctxSetTransform(a, b, c, d, e, f) {
18449    destCtx.setTransform(a, b, c, d, e, f);
18450    this.__originalSetTransform(a, b, c, d, e, f);
18451  };
18452  ctx.resetTransform = function ctxResetTransform() {
18453    destCtx.resetTransform();
18454    this.__originalResetTransform();
18455  };
18456  ctx.rotate = function ctxRotate(angle) {
18457    destCtx.rotate(angle);
18458    this.__originalRotate(angle);
18459  };
18460  ctx.clip = function ctxRotate(rule) {
18461    destCtx.clip(rule);
18462    this.__originalClip(rule);
18463  };
18464  ctx.moveTo = function (x, y) {
18465    destCtx.moveTo(x, y);
18466    this.__originalMoveTo(x, y);
18467  };
18468  ctx.lineTo = function (x, y) {
18469    destCtx.lineTo(x, y);
18470    this.__originalLineTo(x, y);
18471  };
18472  ctx.bezierCurveTo = function (cp1x, cp1y, cp2x, cp2y, x, y) {
18473    destCtx.bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y);
18474    this.__originalBezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y);
18475  };
18476  ctx.rect = function (x, y, width, height) {
18477    destCtx.rect(x, y, width, height);
18478    this.__originalRect(x, y, width, height);
18479  };
18480  ctx.closePath = function () {
18481    destCtx.closePath();
18482    this.__originalClosePath();
18483  };
18484  ctx.beginPath = function () {
18485    destCtx.beginPath();
18486    this.__originalBeginPath();
18487  };
18488}
18489class CachedCanvases {
18490  constructor(canvasFactory) {
18491    this.canvasFactory = canvasFactory;
18492    this.cache = Object.create(null);
18493  }
18494  getCanvas(id, width, height) {
18495    let canvasEntry;
18496    if (this.cache[id] !== undefined) {
18497      canvasEntry = this.cache[id];
18498      this.canvasFactory.reset(canvasEntry, width, height);
18499    } else {
18500      canvasEntry = this.canvasFactory.create(width, height);
18501      this.cache[id] = canvasEntry;
18502    }
18503    return canvasEntry;
18504  }
18505  delete(id) {
18506    delete this.cache[id];
18507  }
18508  clear() {
18509    for (const id in this.cache) {
18510      const canvasEntry = this.cache[id];
18511      this.canvasFactory.destroy(canvasEntry);
18512      delete this.cache[id];
18513    }
18514  }
18515}
18516function drawImageAtIntegerCoords(ctx, srcImg, srcX, srcY, srcW, srcH, destX, destY, destW, destH) {
18517  const [a, b, c, d, tx, ty] = (0, _display_utils.getCurrentTransform)(ctx);
18518  if (b === 0 && c === 0) {
18519    const tlX = destX * a + tx;
18520    const rTlX = Math.round(tlX);
18521    const tlY = destY * d + ty;
18522    const rTlY = Math.round(tlY);
18523    const brX = (destX + destW) * a + tx;
18524    const rWidth = Math.abs(Math.round(brX) - rTlX) || 1;
18525    const brY = (destY + destH) * d + ty;
18526    const rHeight = Math.abs(Math.round(brY) - rTlY) || 1;
18527    ctx.setTransform(Math.sign(a), 0, 0, Math.sign(d), rTlX, rTlY);
18528    ctx.drawImage(srcImg, srcX, srcY, srcW, srcH, 0, 0, rWidth, rHeight);
18529    ctx.setTransform(a, b, c, d, tx, ty);
18530    return [rWidth, rHeight];
18531  }
18532  if (a === 0 && d === 0) {
18533    const tlX = destY * c + tx;
18534    const rTlX = Math.round(tlX);
18535    const tlY = destX * b + ty;
18536    const rTlY = Math.round(tlY);
18537    const brX = (destY + destH) * c + tx;
18538    const rWidth = Math.abs(Math.round(brX) - rTlX) || 1;
18539    const brY = (destX + destW) * b + ty;
18540    const rHeight = Math.abs(Math.round(brY) - rTlY) || 1;
18541    ctx.setTransform(0, Math.sign(b), Math.sign(c), 0, rTlX, rTlY);
18542    ctx.drawImage(srcImg, srcX, srcY, srcW, srcH, 0, 0, rHeight, rWidth);
18543    ctx.setTransform(a, b, c, d, tx, ty);
18544    return [rHeight, rWidth];
18545  }
18546  ctx.drawImage(srcImg, srcX, srcY, srcW, srcH, destX, destY, destW, destH);
18547  const scaleX = Math.hypot(a, b);
18548  const scaleY = Math.hypot(c, d);
18549  return [scaleX * destW, scaleY * destH];
18550}
18551function compileType3Glyph(imgData) {
18552  const {
18553    width,
18554    height
18555  } = imgData;
18556  if (width > MAX_SIZE_TO_COMPILE || height > MAX_SIZE_TO_COMPILE) {
18557    return null;
18558  }
18559  const POINT_TO_PROCESS_LIMIT = 1000;
18560  const POINT_TYPES = new Uint8Array([0, 2, 4, 0, 1, 0, 5, 4, 8, 10, 0, 8, 0, 2, 1, 0]);
18561  const width1 = width + 1;
18562  let points = new Uint8Array(width1 * (height + 1));
18563  let i, j, j0;
18564  const lineSize = width + 7 & ~7;
18565  let data = new Uint8Array(lineSize * height),
18566    pos = 0;
18567  for (const elem of imgData.data) {
18568    let mask = 128;
18569    while (mask > 0) {
18570      data[pos++] = elem & mask ? 0 : 255;
18571      mask >>= 1;
18572    }
18573  }
18574  let count = 0;
18575  pos = 0;
18576  if (data[pos] !== 0) {
18577    points[0] = 1;
18578    ++count;
18579  }
18580  for (j = 1; j < width; j++) {
18581    if (data[pos] !== data[pos + 1]) {
18582      points[j] = data[pos] ? 2 : 1;
18583      ++count;
18584    }
18585    pos++;
18586  }
18587  if (data[pos] !== 0) {
18588    points[j] = 2;
18589    ++count;
18590  }
18591  for (i = 1; i < height; i++) {
18592    pos = i * lineSize;
18593    j0 = i * width1;
18594    if (data[pos - lineSize] !== data[pos]) {
18595      points[j0] = data[pos] ? 1 : 8;
18596      ++count;
18597    }
18598    let sum = (data[pos] ? 4 : 0) + (data[pos - lineSize] ? 8 : 0);
18599    for (j = 1; j < width; j++) {
18600      sum = (sum >> 2) + (data[pos + 1] ? 4 : 0) + (data[pos - lineSize + 1] ? 8 : 0);
18601      if (POINT_TYPES[sum]) {
18602        points[j0 + j] = POINT_TYPES[sum];
18603        ++count;
18604      }
18605      pos++;
18606    }
18607    if (data[pos - lineSize] !== data[pos]) {
18608      points[j0 + j] = data[pos] ? 2 : 4;
18609      ++count;
18610    }
18611    if (count > POINT_TO_PROCESS_LIMIT) {
18612      return null;
18613    }
18614  }
18615  pos = lineSize * (height - 1);
18616  j0 = i * width1;
18617  if (data[pos] !== 0) {
18618    points[j0] = 8;
18619    ++count;
18620  }
18621  for (j = 1; j < width; j++) {
18622    if (data[pos] !== data[pos + 1]) {
18623      points[j0 + j] = data[pos] ? 4 : 8;
18624      ++count;
18625    }
18626    pos++;
18627  }
18628  if (data[pos] !== 0) {
18629    points[j0 + j] = 4;
18630    ++count;
18631  }
18632  if (count > POINT_TO_PROCESS_LIMIT) {
18633    return null;
18634  }
18635  const steps = new Int32Array([0, width1, -1, 0, -width1, 0, 0, 0, 1]);
18636  const path = new Path2D();
18637  for (i = 0; count && i <= height; i++) {
18638    let p = i * width1;
18639    const end = p + width;
18640    while (p < end && !points[p]) {
18641      p++;
18642    }
18643    if (p === end) {
18644      continue;
18645    }
18646    path.moveTo(p % width1, i);
18647    const p0 = p;
18648    let type = points[p];
18649    do {
18650      const step = steps[type];
18651      do {
18652        p += step;
18653      } while (!points[p]);
18654      const pp = points[p];
18655      if (pp !== 5 && pp !== 10) {
18656        type = pp;
18657        points[p] = 0;
18658      } else {
18659        type = pp & 0x33 * type >> 4;
18660        points[p] &= type >> 2 | type << 2;
18661      }
18662      path.lineTo(p % width1, p / width1 | 0);
18663      if (!points[p]) {
18664        --count;
18665      }
18666    } while (p0 !== p);
18667    --i;
18668  }
18669  data = null;
18670  points = null;
18671  const drawOutline = function (c) {
18672    c.save();
18673    c.scale(1 / width, -1 / height);
18674    c.translate(0, -height);
18675    c.fill(path);
18676    c.beginPath();
18677    c.restore();
18678  };
18679  return drawOutline;
18680}
18681class CanvasExtraState {
18682  constructor(width, height) {
18683    this.alphaIsShape = false;
18684    this.fontSize = 0;
18685    this.fontSizeScale = 1;
18686    this.textMatrix = _util.IDENTITY_MATRIX;
18687    this.textMatrixScale = 1;
18688    this.fontMatrix = _util.FONT_IDENTITY_MATRIX;
18689    this.leading = 0;
18690    this.x = 0;
18691    this.y = 0;
18692    this.lineX = 0;
18693    this.lineY = 0;
18694    this.charSpacing = 0;
18695    this.wordSpacing = 0;
18696    this.textHScale = 1;
18697    this.textRenderingMode = _util.TextRenderingMode.FILL;
18698    this.textRise = 0;
18699    this.fillColor = "#000000";
18700    this.strokeColor = "#000000";
18701    this.patternFill = false;
18702    this.fillAlpha = 1;
18703    this.strokeAlpha = 1;
18704    this.lineWidth = 1;
18705    this.activeSMask = null;
18706    this.transferMaps = "none";
18707    this.startNewPathAndClipBox([0, 0, width, height]);
18708  }
18709  clone() {
18710    const clone = Object.create(this);
18711    clone.clipBox = this.clipBox.slice();
18712    return clone;
18713  }
18714  setCurrentPoint(x, y) {
18715    this.x = x;
18716    this.y = y;
18717  }
18718  updatePathMinMax(transform, x, y) {
18719    [x, y] = _util.Util.applyTransform([x, y], transform);
18720    this.minX = Math.min(this.minX, x);
18721    this.minY = Math.min(this.minY, y);
18722    this.maxX = Math.max(this.maxX, x);
18723    this.maxY = Math.max(this.maxY, y);
18724  }
18725  updateRectMinMax(transform, rect) {
18726    const p1 = _util.Util.applyTransform(rect, transform);
18727    const p2 = _util.Util.applyTransform(rect.slice(2), transform);
18728    this.minX = Math.min(this.minX, p1[0], p2[0]);
18729    this.minY = Math.min(this.minY, p1[1], p2[1]);
18730    this.maxX = Math.max(this.maxX, p1[0], p2[0]);
18731    this.maxY = Math.max(this.maxY, p1[1], p2[1]);
18732  }
18733  updateScalingPathMinMax(transform, minMax) {
18734    _util.Util.scaleMinMax(transform, minMax);
18735    this.minX = Math.min(this.minX, minMax[0]);
18736    this.maxX = Math.max(this.maxX, minMax[1]);
18737    this.minY = Math.min(this.minY, minMax[2]);
18738    this.maxY = Math.max(this.maxY, minMax[3]);
18739  }
18740  updateCurvePathMinMax(transform, x0, y0, x1, y1, x2, y2, x3, y3, minMax) {
18741    const box = _util.Util.bezierBoundingBox(x0, y0, x1, y1, x2, y2, x3, y3);
18742    if (minMax) {
18743      minMax[0] = Math.min(minMax[0], box[0], box[2]);
18744      minMax[1] = Math.max(minMax[1], box[0], box[2]);
18745      minMax[2] = Math.min(minMax[2], box[1], box[3]);
18746      minMax[3] = Math.max(minMax[3], box[1], box[3]);
18747      return;
18748    }
18749    this.updateRectMinMax(transform, box);
18750  }
18751  getPathBoundingBox(pathType = _pattern_helper.PathType.FILL, transform = null) {
18752    const box = [this.minX, this.minY, this.maxX, this.maxY];
18753    if (pathType === _pattern_helper.PathType.STROKE) {
18754      if (!transform) {
18755        (0, _util.unreachable)("Stroke bounding box must include transform.");
18756      }
18757      const scale = _util.Util.singularValueDecompose2dScale(transform);
18758      const xStrokePad = scale[0] * this.lineWidth / 2;
18759      const yStrokePad = scale[1] * this.lineWidth / 2;
18760      box[0] -= xStrokePad;
18761      box[1] -= yStrokePad;
18762      box[2] += xStrokePad;
18763      box[3] += yStrokePad;
18764    }
18765    return box;
18766  }
18767  updateClipFromPath() {
18768    const intersect = _util.Util.intersect(this.clipBox, this.getPathBoundingBox());
18769    this.startNewPathAndClipBox(intersect || [0, 0, 0, 0]);
18770  }
18771  isEmptyClip() {
18772    return this.minX === Infinity;
18773  }
18774  startNewPathAndClipBox(box) {
18775    this.clipBox = box;
18776    this.minX = Infinity;
18777    this.minY = Infinity;
18778    this.maxX = 0;
18779    this.maxY = 0;
18780  }
18781  getClippedPathBoundingBox(pathType = _pattern_helper.PathType.FILL, transform = null) {
18782    return _util.Util.intersect(this.clipBox, this.getPathBoundingBox(pathType, transform));
18783  }
18784}
18785function putBinaryImageData(ctx, imgData) {
18786  if (typeof ImageData !== "undefined" && imgData instanceof ImageData) {
18787    ctx.putImageData(imgData, 0, 0);
18788    return;
18789  }
18790  const height = imgData.height,
18791    width = imgData.width;
18792  const partialChunkHeight = height % FULL_CHUNK_HEIGHT;
18793  const fullChunks = (height - partialChunkHeight) / FULL_CHUNK_HEIGHT;
18794  const totalChunks = partialChunkHeight === 0 ? fullChunks : fullChunks + 1;
18795  const chunkImgData = ctx.createImageData(width, FULL_CHUNK_HEIGHT);
18796  let srcPos = 0,
18797    destPos;
18798  const src = imgData.data;
18799  const dest = chunkImgData.data;
18800  let i, j, thisChunkHeight, elemsInThisChunk;
18801  if (imgData.kind === _util.ImageKind.GRAYSCALE_1BPP) {
18802    const srcLength = src.byteLength;
18803    const dest32 = new Uint32Array(dest.buffer, 0, dest.byteLength >> 2);
18804    const dest32DataLength = dest32.length;
18805    const fullSrcDiff = width + 7 >> 3;
18806    const white = 0xffffffff;
18807    const black = _util.FeatureTest.isLittleEndian ? 0xff000000 : 0x000000ff;
18808    for (i = 0; i < totalChunks; i++) {
18809      thisChunkHeight = i < fullChunks ? FULL_CHUNK_HEIGHT : partialChunkHeight;
18810      destPos = 0;
18811      for (j = 0; j < thisChunkHeight; j++) {
18812        const srcDiff = srcLength - srcPos;
18813        let k = 0;
18814        const kEnd = srcDiff > fullSrcDiff ? width : srcDiff * 8 - 7;
18815        const kEndUnrolled = kEnd & ~7;
18816        let mask = 0;
18817        let srcByte = 0;
18818        for (; k < kEndUnrolled; k += 8) {
18819          srcByte = src[srcPos++];
18820          dest32[destPos++] = srcByte & 128 ? white : black;
18821          dest32[destPos++] = srcByte & 64 ? white : black;
18822          dest32[destPos++] = srcByte & 32 ? white : black;
18823          dest32[destPos++] = srcByte & 16 ? white : black;
18824          dest32[destPos++] = srcByte & 8 ? white : black;
18825          dest32[destPos++] = srcByte & 4 ? white : black;
18826          dest32[destPos++] = srcByte & 2 ? white : black;
18827          dest32[destPos++] = srcByte & 1 ? white : black;
18828        }
18829        for (; k < kEnd; k++) {
18830          if (mask === 0) {
18831            srcByte = src[srcPos++];
18832            mask = 128;
18833          }
18834          dest32[destPos++] = srcByte & mask ? white : black;
18835          mask >>= 1;
18836        }
18837      }
18838      while (destPos < dest32DataLength) {
18839        dest32[destPos++] = 0;
18840      }
18841      ctx.putImageData(chunkImgData, 0, i * FULL_CHUNK_HEIGHT);
18842    }
18843  } else if (imgData.kind === _util.ImageKind.RGBA_32BPP) {
18844    j = 0;
18845    elemsInThisChunk = width * FULL_CHUNK_HEIGHT * 4;
18846    for (i = 0; i < fullChunks; i++) {
18847      dest.set(src.subarray(srcPos, srcPos + elemsInThisChunk));
18848      srcPos += elemsInThisChunk;
18849      ctx.putImageData(chunkImgData, 0, j);
18850      j += FULL_CHUNK_HEIGHT;
18851    }
18852    if (i < totalChunks) {
18853      elemsInThisChunk = width * partialChunkHeight * 4;
18854      dest.set(src.subarray(srcPos, srcPos + elemsInThisChunk));
18855      ctx.putImageData(chunkImgData, 0, j);
18856    }
18857  } else if (imgData.kind === _util.ImageKind.RGB_24BPP) {
18858    thisChunkHeight = FULL_CHUNK_HEIGHT;
18859    elemsInThisChunk = width * thisChunkHeight;
18860    for (i = 0; i < totalChunks; i++) {
18861      if (i >= fullChunks) {
18862        thisChunkHeight = partialChunkHeight;
18863        elemsInThisChunk = width * thisChunkHeight;
18864      }
18865      destPos = 0;
18866      for (j = elemsInThisChunk; j--;) {
18867        dest[destPos++] = src[srcPos++];
18868        dest[destPos++] = src[srcPos++];
18869        dest[destPos++] = src[srcPos++];
18870        dest[destPos++] = 255;
18871      }
18872      ctx.putImageData(chunkImgData, 0, i * FULL_CHUNK_HEIGHT);
18873    }
18874  } else {
18875    throw new Error(`bad image kind: ${imgData.kind}`);
18876  }
18877}
18878function putBinaryImageMask(ctx, imgData) {
18879  if (imgData.bitmap) {
18880    ctx.drawImage(imgData.bitmap, 0, 0);
18881    return;
18882  }
18883  const height = imgData.height,
18884    width = imgData.width;
18885  const partialChunkHeight = height % FULL_CHUNK_HEIGHT;
18886  const fullChunks = (height - partialChunkHeight) / FULL_CHUNK_HEIGHT;
18887  const totalChunks = partialChunkHeight === 0 ? fullChunks : fullChunks + 1;
18888  const chunkImgData = ctx.createImageData(width, FULL_CHUNK_HEIGHT);
18889  let srcPos = 0;
18890  const src = imgData.data;
18891  const dest = chunkImgData.data;
18892  for (let i = 0; i < totalChunks; i++) {
18893    const thisChunkHeight = i < fullChunks ? FULL_CHUNK_HEIGHT : partialChunkHeight;
18894    ({
18895      srcPos
18896    } = (0, _image_utils.convertBlackAndWhiteToRGBA)({
18897      src,
18898      srcPos,
18899      dest,
18900      width,
18901      height: thisChunkHeight,
18902      nonBlackColor: 0
18903    }));
18904    ctx.putImageData(chunkImgData, 0, i * FULL_CHUNK_HEIGHT);
18905  }
18906}
18907function copyCtxState(sourceCtx, destCtx) {
18908  const properties = ["strokeStyle", "fillStyle", "fillRule", "globalAlpha", "lineWidth", "lineCap", "lineJoin", "miterLimit", "globalCompositeOperation", "font", "filter"];
18909  for (const property of properties) {
18910    if (sourceCtx[property] !== undefined) {
18911      destCtx[property] = sourceCtx[property];
18912    }
18913  }
18914  if (sourceCtx.setLineDash !== undefined) {
18915    destCtx.setLineDash(sourceCtx.getLineDash());
18916    destCtx.lineDashOffset = sourceCtx.lineDashOffset;
18917  }
18918}
18919function resetCtxToDefault(ctx) {
18920  ctx.strokeStyle = ctx.fillStyle = "#000000";
18921  ctx.fillRule = "nonzero";
18922  ctx.globalAlpha = 1;
18923  ctx.lineWidth = 1;
18924  ctx.lineCap = "butt";
18925  ctx.lineJoin = "miter";
18926  ctx.miterLimit = 10;
18927  ctx.globalCompositeOperation = "source-over";
18928  ctx.font = "10px sans-serif";
18929  if (ctx.setLineDash !== undefined) {
18930    ctx.setLineDash([]);
18931    ctx.lineDashOffset = 0;
18932  }
18933  if (!_util.isNodeJS) {
18934    const {
18935      filter
18936    } = ctx;
18937    if (filter !== "none" && filter !== "") {
18938      ctx.filter = "none";
18939    }
18940  }
18941}
18942function composeSMaskBackdrop(bytes, r0, g0, b0) {
18943  const length = bytes.length;
18944  for (let i = 3; i < length; i += 4) {
18945    const alpha = bytes[i];
18946    if (alpha === 0) {
18947      bytes[i - 3] = r0;
18948      bytes[i - 2] = g0;
18949      bytes[i - 1] = b0;
18950    } else if (alpha < 255) {
18951      const alpha_ = 255 - alpha;
18952      bytes[i - 3] = bytes[i - 3] * alpha + r0 * alpha_ >> 8;
18953      bytes[i - 2] = bytes[i - 2] * alpha + g0 * alpha_ >> 8;
18954      bytes[i - 1] = bytes[i - 1] * alpha + b0 * alpha_ >> 8;
18955    }
18956  }
18957}
18958function composeSMaskAlpha(maskData, layerData, transferMap) {
18959  const length = maskData.length;
18960  const scale = 1 / 255;
18961  for (let i = 3; i < length; i += 4) {
18962    const alpha = transferMap ? transferMap[maskData[i]] : maskData[i];
18963    layerData[i] = layerData[i] * alpha * scale | 0;
18964  }
18965}
18966function composeSMaskLuminosity(maskData, layerData, transferMap) {
18967  const length = maskData.length;
18968  for (let i = 3; i < length; i += 4) {
18969    const y = maskData[i - 3] * 77 + maskData[i - 2] * 152 + maskData[i - 1] * 28;
18970    layerData[i] = transferMap ? layerData[i] * transferMap[y >> 8] >> 8 : layerData[i] * y >> 16;
18971  }
18972}
18973function genericComposeSMask(maskCtx, layerCtx, width, height, subtype, backdrop, transferMap, layerOffsetX, layerOffsetY, maskOffsetX, maskOffsetY) {
18974  const hasBackdrop = !!backdrop;
18975  const r0 = hasBackdrop ? backdrop[0] : 0;
18976  const g0 = hasBackdrop ? backdrop[1] : 0;
18977  const b0 = hasBackdrop ? backdrop[2] : 0;
18978  const composeFn = subtype === "Luminosity" ? composeSMaskLuminosity : composeSMaskAlpha;
18979  const PIXELS_TO_PROCESS = 1048576;
18980  const chunkSize = Math.min(height, Math.ceil(PIXELS_TO_PROCESS / width));
18981  for (let row = 0; row < height; row += chunkSize) {
18982    const chunkHeight = Math.min(chunkSize, height - row);
18983    const maskData = maskCtx.getImageData(layerOffsetX - maskOffsetX, row + (layerOffsetY - maskOffsetY), width, chunkHeight);
18984    const layerData = layerCtx.getImageData(layerOffsetX, row + layerOffsetY, width, chunkHeight);
18985    if (hasBackdrop) {
18986      composeSMaskBackdrop(maskData.data, r0, g0, b0);
18987    }
18988    composeFn(maskData.data, layerData.data, transferMap);
18989    layerCtx.putImageData(layerData, layerOffsetX, row + layerOffsetY);
18990  }
18991}
18992function composeSMask(ctx, smask, layerCtx, layerBox) {
18993  const layerOffsetX = layerBox[0];
18994  const layerOffsetY = layerBox[1];
18995  const layerWidth = layerBox[2] - layerOffsetX;
18996  const layerHeight = layerBox[3] - layerOffsetY;
18997  if (layerWidth === 0 || layerHeight === 0) {
18998    return;
18999  }
19000  genericComposeSMask(smask.context, layerCtx, layerWidth, layerHeight, smask.subtype, smask.backdrop, smask.transferMap, layerOffsetX, layerOffsetY, smask.offsetX, smask.offsetY);
19001  ctx.save();
19002  ctx.globalAlpha = 1;
19003  ctx.globalCompositeOperation = "source-over";
19004  ctx.setTransform(1, 0, 0, 1, 0, 0);
19005  ctx.drawImage(layerCtx.canvas, 0, 0);
19006  ctx.restore();
19007}
19008function getImageSmoothingEnabled(transform, interpolate) {
19009  const scale = _util.Util.singularValueDecompose2dScale(transform);
19010  scale[0] = Math.fround(scale[0]);
19011  scale[1] = Math.fround(scale[1]);
19012  const actualScale = Math.fround((globalThis.devicePixelRatio || 1) * _display_utils.PixelsPerInch.PDF_TO_CSS_UNITS);
19013  if (interpolate !== undefined) {
19014    return interpolate;
19015  } else if (scale[0] <= actualScale || scale[1] <= actualScale) {
19016    return true;
19017  }
19018  return false;
19019}
19020const LINE_CAP_STYLES = ["butt", "round", "square"];
19021const LINE_JOIN_STYLES = ["miter", "round", "bevel"];
19022const NORMAL_CLIP = {};
19023const EO_CLIP = {};
19024class CanvasGraphics {
19025  constructor(canvasCtx, commonObjs, objs, canvasFactory, filterFactory, {
19026    optionalContentConfig,
19027    markedContentStack = null
19028  }, annotationCanvasMap, pageColors) {
19029    this.ctx = canvasCtx;
19030    this.current = new CanvasExtraState(this.ctx.canvas.width, this.ctx.canvas.height);
19031    this.stateStack = [];
19032    this.pendingClip = null;
19033    this.pendingEOFill = false;
19034    this.res = null;
19035    this.xobjs = null;
19036    this.commonObjs = commonObjs;
19037    this.objs = objs;
19038    this.canvasFactory = canvasFactory;
19039    this.filterFactory = filterFactory;
19040    this.groupStack = [];
19041    this.processingType3 = null;
19042    this.baseTransform = null;
19043    this.baseTransformStack = [];
19044    this.groupLevel = 0;
19045    this.smaskStack = [];
19046    this.smaskCounter = 0;
19047    this.tempSMask = null;
19048    this.suspendedCtx = null;
19049    this.contentVisible = true;
19050    this.markedContentStack = markedContentStack || [];
19051    this.optionalContentConfig = optionalContentConfig;
19052    this.cachedCanvases = new CachedCanvases(this.canvasFactory);
19053    this.cachedPatterns = new Map();
19054    this.annotationCanvasMap = annotationCanvasMap;
19055    this.viewportScale = 1;
19056    this.outputScaleX = 1;
19057    this.outputScaleY = 1;
19058    this.pageColors = pageColors;
19059    this._cachedScaleForStroking = [-1, 0];
19060    this._cachedGetSinglePixelWidth = null;
19061    this._cachedBitmapsMap = new Map();
19062  }
19063  getObject(data, fallback = null) {
19064    if (typeof data === "string") {
19065      return data.startsWith("g_") ? this.commonObjs.get(data) : this.objs.get(data);
19066    }
19067    return fallback;
19068  }
19069  beginDrawing({
19070    transform,
19071    viewport,
19072    transparency = false,
19073    background = null
19074  }) {
19075    const width = this.ctx.canvas.width;
19076    const height = this.ctx.canvas.height;
19077    const savedFillStyle = this.ctx.fillStyle;
19078    this.ctx.fillStyle = background || "#ffffff";
19079    this.ctx.fillRect(0, 0, width, height);
19080    this.ctx.fillStyle = savedFillStyle;
19081    if (transparency) {
19082      const transparentCanvas = this.cachedCanvases.getCanvas("transparent", width, height);
19083      this.compositeCtx = this.ctx;
19084      this.transparentCanvas = transparentCanvas.canvas;
19085      this.ctx = transparentCanvas.context;
19086      this.ctx.save();
19087      this.ctx.transform(...(0, _display_utils.getCurrentTransform)(this.compositeCtx));
19088    }
19089    this.ctx.save();
19090    resetCtxToDefault(this.ctx);
19091    if (transform) {
19092      this.ctx.transform(...transform);
19093      this.outputScaleX = transform[0];
19094      this.outputScaleY = transform[0];
19095    }
19096    this.ctx.transform(...viewport.transform);
19097    this.viewportScale = viewport.scale;
19098    this.baseTransform = (0, _display_utils.getCurrentTransform)(this.ctx);
19099  }
19100  executeOperatorList(operatorList, executionStartIdx, continueCallback, stepper) {
19101    const argsArray = operatorList.argsArray;
19102    const fnArray = operatorList.fnArray;
19103    let i = executionStartIdx || 0;
19104    const argsArrayLen = argsArray.length;
19105    if (argsArrayLen === i) {
19106      return i;
19107    }
19108    const chunkOperations = argsArrayLen - i > EXECUTION_STEPS && typeof continueCallback === "function";
19109    const endTime = chunkOperations ? Date.now() + EXECUTION_TIME : 0;
19110    let steps = 0;
19111    const commonObjs = this.commonObjs;
19112    const objs = this.objs;
19113    let fnId;
19114    while (true) {
19115      if (stepper !== undefined && i === stepper.nextBreakPoint) {
19116        stepper.breakIt(i, continueCallback);
19117        return i;
19118      }
19119      fnId = fnArray[i];
19120      if (fnId !== _util.OPS.dependency) {
19121        this[fnId].apply(this, argsArray[i]);
19122      } else {
19123        for (const depObjId of argsArray[i]) {
19124          const objsPool = depObjId.startsWith("g_") ? commonObjs : objs;
19125          if (!objsPool.has(depObjId)) {
19126            objsPool.get(depObjId, continueCallback);
19127            return i;
19128          }
19129        }
19130      }
19131      i++;
19132      if (i === argsArrayLen) {
19133        return i;
19134      }
19135      if (chunkOperations && ++steps > EXECUTION_STEPS) {
19136        if (Date.now() > endTime) {
19137          continueCallback();
19138          return i;
19139        }
19140        steps = 0;
19141      }
19142    }
19143  }
19144  #restoreInitialState() {
19145    while (this.stateStack.length || this.inSMaskMode) {
19146      this.restore();
19147    }
19148    this.ctx.restore();
19149    if (this.transparentCanvas) {
19150      this.ctx = this.compositeCtx;
19151      this.ctx.save();
19152      this.ctx.setTransform(1, 0, 0, 1, 0, 0);
19153      this.ctx.drawImage(this.transparentCanvas, 0, 0);
19154      this.ctx.restore();
19155      this.transparentCanvas = null;
19156    }
19157  }
19158  endDrawing() {
19159    this.#restoreInitialState();
19160    this.cachedCanvases.clear();
19161    this.cachedPatterns.clear();
19162    for (const cache of this._cachedBitmapsMap.values()) {
19163      for (const canvas of cache.values()) {
19164        if (typeof HTMLCanvasElement !== "undefined" && canvas instanceof HTMLCanvasElement) {
19165          canvas.width = canvas.height = 0;
19166        }
19167      }
19168      cache.clear();
19169    }
19170    this._cachedBitmapsMap.clear();
19171    this.#drawFilter();
19172  }
19173  #drawFilter() {
19174    if (this.pageColors) {
19175      const hcmFilterId = this.filterFactory.addHCMFilter(this.pageColors.foreground, this.pageColors.background);
19176      if (hcmFilterId !== "none") {
19177        const savedFilter = this.ctx.filter;
19178        this.ctx.filter = hcmFilterId;
19179        this.ctx.drawImage(this.ctx.canvas, 0, 0);
19180        this.ctx.filter = savedFilter;
19181      }
19182    }
19183  }
19184  _scaleImage(img, inverseTransform) {
19185    const width = img.width;
19186    const height = img.height;
19187    let widthScale = Math.max(Math.hypot(inverseTransform[0], inverseTransform[1]), 1);
19188    let heightScale = Math.max(Math.hypot(inverseTransform[2], inverseTransform[3]), 1);
19189    let paintWidth = width,
19190      paintHeight = height;
19191    let tmpCanvasId = "prescale1";
19192    let tmpCanvas, tmpCtx;
19193    while (widthScale > 2 && paintWidth > 1 || heightScale > 2 && paintHeight > 1) {
19194      let newWidth = paintWidth,
19195        newHeight = paintHeight;
19196      if (widthScale > 2 && paintWidth > 1) {
19197        newWidth = paintWidth >= 16384 ? Math.floor(paintWidth / 2) - 1 || 1 : Math.ceil(paintWidth / 2);
19198        widthScale /= paintWidth / newWidth;
19199      }
19200      if (heightScale > 2 && paintHeight > 1) {
19201        newHeight = paintHeight >= 16384 ? Math.floor(paintHeight / 2) - 1 || 1 : Math.ceil(paintHeight) / 2;
19202        heightScale /= paintHeight / newHeight;
19203      }
19204      tmpCanvas = this.cachedCanvases.getCanvas(tmpCanvasId, newWidth, newHeight);
19205      tmpCtx = tmpCanvas.context;
19206      tmpCtx.clearRect(0, 0, newWidth, newHeight);
19207      tmpCtx.drawImage(img, 0, 0, paintWidth, paintHeight, 0, 0, newWidth, newHeight);
19208      img = tmpCanvas.canvas;
19209      paintWidth = newWidth;
19210      paintHeight = newHeight;
19211      tmpCanvasId = tmpCanvasId === "prescale1" ? "prescale2" : "prescale1";
19212    }
19213    return {
19214      img,
19215      paintWidth,
19216      paintHeight
19217    };
19218  }
19219  _createMaskCanvas(img) {
19220    const ctx = this.ctx;
19221    const {
19222      width,
19223      height
19224    } = img;
19225    const fillColor = this.current.fillColor;
19226    const isPatternFill = this.current.patternFill;
19227    const currentTransform = (0, _display_utils.getCurrentTransform)(ctx);
19228    let cache, cacheKey, scaled, maskCanvas;
19229    if ((img.bitmap || img.data) && img.count > 1) {
19230      const mainKey = img.bitmap || img.data.buffer;
19231      cacheKey = JSON.stringify(isPatternFill ? currentTransform : [currentTransform.slice(0, 4), fillColor]);
19232      cache = this._cachedBitmapsMap.get(mainKey);
19233      if (!cache) {
19234        cache = new Map();
19235        this._cachedBitmapsMap.set(mainKey, cache);
19236      }
19237      const cachedImage = cache.get(cacheKey);
19238      if (cachedImage && !isPatternFill) {
19239        const offsetX = Math.round(Math.min(currentTransform[0], currentTransform[2]) + currentTransform[4]);
19240        const offsetY = Math.round(Math.min(currentTransform[1], currentTransform[3]) + currentTransform[5]);
19241        return {
19242          canvas: cachedImage,
19243          offsetX,
19244          offsetY
19245        };
19246      }
19247      scaled = cachedImage;
19248    }
19249    if (!scaled) {
19250      maskCanvas = this.cachedCanvases.getCanvas("maskCanvas", width, height);
19251      putBinaryImageMask(maskCanvas.context, img);
19252    }
19253    let maskToCanvas = _util.Util.transform(currentTransform, [1 / width, 0, 0, -1 / height, 0, 0]);
19254    maskToCanvas = _util.Util.transform(maskToCanvas, [1, 0, 0, 1, 0, -height]);
19255    const cord1 = _util.Util.applyTransform([0, 0], maskToCanvas);
19256    const cord2 = _util.Util.applyTransform([width, height], maskToCanvas);
19257    const rect = _util.Util.normalizeRect([cord1[0], cord1[1], cord2[0], cord2[1]]);
19258    const drawnWidth = Math.round(rect[2] - rect[0]) || 1;
19259    const drawnHeight = Math.round(rect[3] - rect[1]) || 1;
19260    const fillCanvas = this.cachedCanvases.getCanvas("fillCanvas", drawnWidth, drawnHeight);
19261    const fillCtx = fillCanvas.context;
19262    const offsetX = Math.min(cord1[0], cord2[0]);
19263    const offsetY = Math.min(cord1[1], cord2[1]);
19264    fillCtx.translate(-offsetX, -offsetY);
19265    fillCtx.transform(...maskToCanvas);
19266    if (!scaled) {
19267      scaled = this._scaleImage(maskCanvas.canvas, (0, _display_utils.getCurrentTransformInverse)(fillCtx));
19268      scaled = scaled.img;
19269      if (cache && isPatternFill) {
19270        cache.set(cacheKey, scaled);
19271      }
19272    }
19273    fillCtx.imageSmoothingEnabled = getImageSmoothingEnabled((0, _display_utils.getCurrentTransform)(fillCtx), img.interpolate);
19274    drawImageAtIntegerCoords(fillCtx, scaled, 0, 0, scaled.width, scaled.height, 0, 0, width, height);
19275    fillCtx.globalCompositeOperation = "source-in";
19276    const inverse = _util.Util.transform((0, _display_utils.getCurrentTransformInverse)(fillCtx), [1, 0, 0, 1, -offsetX, -offsetY]);
19277    fillCtx.fillStyle = isPatternFill ? fillColor.getPattern(ctx, this, inverse, _pattern_helper.PathType.FILL) : fillColor;
19278    fillCtx.fillRect(0, 0, width, height);
19279    if (cache && !isPatternFill) {
19280      this.cachedCanvases.delete("fillCanvas");
19281      cache.set(cacheKey, fillCanvas.canvas);
19282    }
19283    return {
19284      canvas: fillCanvas.canvas,
19285      offsetX: Math.round(offsetX),
19286      offsetY: Math.round(offsetY)
19287    };
19288  }
19289  setLineWidth(width) {
19290    if (width !== this.current.lineWidth) {
19291      this._cachedScaleForStroking[0] = -1;
19292    }
19293    this.current.lineWidth = width;
19294    this.ctx.lineWidth = width;
19295  }
19296  setLineCap(style) {
19297    this.ctx.lineCap = LINE_CAP_STYLES[style];
19298  }
19299  setLineJoin(style) {
19300    this.ctx.lineJoin = LINE_JOIN_STYLES[style];
19301  }
19302  setMiterLimit(limit) {
19303    this.ctx.miterLimit = limit;
19304  }
19305  setDash(dashArray, dashPhase) {
19306    const ctx = this.ctx;
19307    if (ctx.setLineDash !== undefined) {
19308      ctx.setLineDash(dashArray);
19309      ctx.lineDashOffset = dashPhase;
19310    }
19311  }
19312  setRenderingIntent(intent) {}
19313  setFlatness(flatness) {}
19314  setGState(states) {
19315    for (const [key, value] of states) {
19316      switch (key) {
19317        case "LW":
19318          this.setLineWidth(value);
19319          break;
19320        case "LC":
19321          this.setLineCap(value);
19322          break;
19323        case "LJ":
19324          this.setLineJoin(value);
19325          break;
19326        case "ML":
19327          this.setMiterLimit(value);
19328          break;
19329        case "D":
19330          this.setDash(value[0], value[1]);
19331          break;
19332        case "RI":
19333          this.setRenderingIntent(value);
19334          break;
19335        case "FL":
19336          this.setFlatness(value);
19337          break;
19338        case "Font":
19339          this.setFont(value[0], value[1]);
19340          break;
19341        case "CA":
19342          this.current.strokeAlpha = value;
19343          break;
19344        case "ca":
19345          this.current.fillAlpha = value;
19346          this.ctx.globalAlpha = value;
19347          break;
19348        case "BM":
19349          this.ctx.globalCompositeOperation = value;
19350          break;
19351        case "SMask":
19352          this.current.activeSMask = value ? this.tempSMask : null;
19353          this.tempSMask = null;
19354          this.checkSMaskState();
19355          break;
19356        case "TR":
19357          this.ctx.filter = this.current.transferMaps = this.filterFactory.addFilter(value);
19358          break;
19359      }
19360    }
19361  }
19362  get inSMaskMode() {
19363    return !!this.suspendedCtx;
19364  }
19365  checkSMaskState() {
19366    const inSMaskMode = this.inSMaskMode;
19367    if (this.current.activeSMask && !inSMaskMode) {
19368      this.beginSMaskMode();
19369    } else if (!this.current.activeSMask && inSMaskMode) {
19370      this.endSMaskMode();
19371    }
19372  }
19373  beginSMaskMode() {
19374    if (this.inSMaskMode) {
19375      throw new Error("beginSMaskMode called while already in smask mode");
19376    }
19377    const drawnWidth = this.ctx.canvas.width;
19378    const drawnHeight = this.ctx.canvas.height;
19379    const cacheId = "smaskGroupAt" + this.groupLevel;
19380    const scratchCanvas = this.cachedCanvases.getCanvas(cacheId, drawnWidth, drawnHeight);
19381    this.suspendedCtx = this.ctx;
19382    this.ctx = scratchCanvas.context;
19383    const ctx = this.ctx;
19384    ctx.setTransform(...(0, _display_utils.getCurrentTransform)(this.suspendedCtx));
19385    copyCtxState(this.suspendedCtx, ctx);
19386    mirrorContextOperations(ctx, this.suspendedCtx);
19387    this.setGState([["BM", "source-over"], ["ca", 1], ["CA", 1]]);
19388  }
19389  endSMaskMode() {
19390    if (!this.inSMaskMode) {
19391      throw new Error("endSMaskMode called while not in smask mode");
19392    }
19393    this.ctx._removeMirroring();
19394    copyCtxState(this.ctx, this.suspendedCtx);
19395    this.ctx = this.suspendedCtx;
19396    this.suspendedCtx = null;
19397  }
19398  compose(dirtyBox) {
19399    if (!this.current.activeSMask) {
19400      return;
19401    }
19402    if (!dirtyBox) {
19403      dirtyBox = [0, 0, this.ctx.canvas.width, this.ctx.canvas.height];
19404    } else {
19405      dirtyBox[0] = Math.floor(dirtyBox[0]);
19406      dirtyBox[1] = Math.floor(dirtyBox[1]);
19407      dirtyBox[2] = Math.ceil(dirtyBox[2]);
19408      dirtyBox[3] = Math.ceil(dirtyBox[3]);
19409    }
19410    const smask = this.current.activeSMask;
19411    const suspendedCtx = this.suspendedCtx;
19412    composeSMask(suspendedCtx, smask, this.ctx, dirtyBox);
19413    this.ctx.save();
19414    this.ctx.setTransform(1, 0, 0, 1, 0, 0);
19415    this.ctx.clearRect(0, 0, this.ctx.canvas.width, this.ctx.canvas.height);
19416    this.ctx.restore();
19417  }
19418  save() {
19419    if (this.inSMaskMode) {
19420      copyCtxState(this.ctx, this.suspendedCtx);
19421      this.suspendedCtx.save();
19422    } else {
19423      this.ctx.save();
19424    }
19425    const old = this.current;
19426    this.stateStack.push(old);
19427    this.current = old.clone();
19428  }
19429  restore() {
19430    if (this.stateStack.length === 0 && this.inSMaskMode) {
19431      this.endSMaskMode();
19432    }
19433    if (this.stateStack.length !== 0) {
19434      this.current = this.stateStack.pop();
19435      if (this.inSMaskMode) {
19436        this.suspendedCtx.restore();
19437        copyCtxState(this.suspendedCtx, this.ctx);
19438      } else {
19439        this.ctx.restore();
19440      }
19441      this.checkSMaskState();
19442      this.pendingClip = null;
19443      this._cachedScaleForStroking[0] = -1;
19444      this._cachedGetSinglePixelWidth = null;
19445    }
19446  }
19447  transform(a, b, c, d, e, f) {
19448    this.ctx.transform(a, b, c, d, e, f);
19449    this._cachedScaleForStroking[0] = -1;
19450    this._cachedGetSinglePixelWidth = null;
19451  }
19452  constructPath(ops, args, minMax) {
19453    const ctx = this.ctx;
19454    const current = this.current;
19455    let x = current.x,
19456      y = current.y;
19457    let startX, startY;
19458    const currentTransform = (0, _display_utils.getCurrentTransform)(ctx);
19459    const isScalingMatrix = currentTransform[0] === 0 && currentTransform[3] === 0 || currentTransform[1] === 0 && currentTransform[2] === 0;
19460    const minMaxForBezier = isScalingMatrix ? minMax.slice(0) : null;
19461    for (let i = 0, j = 0, ii = ops.length; i < ii; i++) {
19462      switch (ops[i] | 0) {
19463        case _util.OPS.rectangle:
19464          x = args[j++];
19465          y = args[j++];
19466          const width = args[j++];
19467          const height = args[j++];
19468          const xw = x + width;
19469          const yh = y + height;
19470          ctx.moveTo(x, y);
19471          if (width === 0 || height === 0) {
19472            ctx.lineTo(xw, yh);
19473          } else {
19474            ctx.lineTo(xw, y);
19475            ctx.lineTo(xw, yh);
19476            ctx.lineTo(x, yh);
19477          }
19478          if (!isScalingMatrix) {
19479            current.updateRectMinMax(currentTransform, [x, y, xw, yh]);
19480          }
19481          ctx.closePath();
19482          break;
19483        case _util.OPS.moveTo:
19484          x = args[j++];
19485          y = args[j++];
19486          ctx.moveTo(x, y);
19487          if (!isScalingMatrix) {
19488            current.updatePathMinMax(currentTransform, x, y);
19489          }
19490          break;
19491        case _util.OPS.lineTo:
19492          x = args[j++];
19493          y = args[j++];
19494          ctx.lineTo(x, y);
19495          if (!isScalingMatrix) {
19496            current.updatePathMinMax(currentTransform, x, y);
19497          }
19498          break;
19499        case _util.OPS.curveTo:
19500          startX = x;
19501          startY = y;
19502          x = args[j + 4];
19503          y = args[j + 5];
19504          ctx.bezierCurveTo(args[j], args[j + 1], args[j + 2], args[j + 3], x, y);
19505          current.updateCurvePathMinMax(currentTransform, startX, startY, args[j], args[j + 1], args[j + 2], args[j + 3], x, y, minMaxForBezier);
19506          j += 6;
19507          break;
19508        case _util.OPS.curveTo2:
19509          startX = x;
19510          startY = y;
19511          ctx.bezierCurveTo(x, y, args[j], args[j + 1], args[j + 2], args[j + 3]);
19512          current.updateCurvePathMinMax(currentTransform, startX, startY, x, y, args[j], args[j + 1], args[j + 2], args[j + 3], minMaxForBezier);
19513          x = args[j + 2];
19514          y = args[j + 3];
19515          j += 4;
19516          break;
19517        case _util.OPS.curveTo3:
19518          startX = x;
19519          startY = y;
19520          x = args[j + 2];
19521          y = args[j + 3];
19522          ctx.bezierCurveTo(args[j], args[j + 1], x, y, x, y);
19523          current.updateCurvePathMinMax(currentTransform, startX, startY, args[j], args[j + 1], x, y, x, y, minMaxForBezier);
19524          j += 4;
19525          break;
19526        case _util.OPS.closePath:
19527          ctx.closePath();
19528          break;
19529      }
19530    }
19531    if (isScalingMatrix) {
19532      current.updateScalingPathMinMax(currentTransform, minMaxForBezier);
19533    }
19534    current.setCurrentPoint(x, y);
19535  }
19536  closePath() {
19537    this.ctx.closePath();
19538  }
19539  stroke(consumePath = true) {
19540    const ctx = this.ctx;
19541    const strokeColor = this.current.strokeColor;
19542    ctx.globalAlpha = this.current.strokeAlpha;
19543    if (this.contentVisible) {
19544      if (typeof strokeColor === "object" && strokeColor?.getPattern) {
19545        ctx.save();
19546        ctx.strokeStyle = strokeColor.getPattern(ctx, this, (0, _display_utils.getCurrentTransformInverse)(ctx), _pattern_helper.PathType.STROKE);
19547        this.rescaleAndStroke(false);
19548        ctx.restore();
19549      } else {
19550        this.rescaleAndStroke(true);
19551      }
19552    }
19553    if (consumePath) {
19554      this.consumePath(this.current.getClippedPathBoundingBox());
19555    }
19556    ctx.globalAlpha = this.current.fillAlpha;
19557  }
19558  closeStroke() {
19559    this.closePath();
19560    this.stroke();
19561  }
19562  fill(consumePath = true) {
19563    const ctx = this.ctx;
19564    const fillColor = this.current.fillColor;
19565    const isPatternFill = this.current.patternFill;
19566    let needRestore = false;
19567    if (isPatternFill) {
19568      ctx.save();
19569      ctx.fillStyle = fillColor.getPattern(ctx, this, (0, _display_utils.getCurrentTransformInverse)(ctx), _pattern_helper.PathType.FILL);
19570      needRestore = true;
19571    }
19572    const intersect = this.current.getClippedPathBoundingBox();
19573    if (this.contentVisible && intersect !== null) {
19574      if (this.pendingEOFill) {
19575        ctx.fill("evenodd");
19576        this.pendingEOFill = false;
19577      } else {
19578        ctx.fill();
19579      }
19580    }
19581    if (needRestore) {
19582      ctx.restore();
19583    }
19584    if (consumePath) {
19585      this.consumePath(intersect);
19586    }
19587  }
19588  eoFill() {
19589    this.pendingEOFill = true;
19590    this.fill();
19591  }
19592  fillStroke() {
19593    this.fill(false);
19594    this.stroke(false);
19595    this.consumePath();
19596  }
19597  eoFillStroke() {
19598    this.pendingEOFill = true;
19599    this.fillStroke();
19600  }
19601  closeFillStroke() {
19602    this.closePath();
19603    this.fillStroke();
19604  }
19605  closeEOFillStroke() {
19606    this.pendingEOFill = true;
19607    this.closePath();
19608    this.fillStroke();
19609  }
19610  endPath() {
19611    this.consumePath();
19612  }
19613  clip() {
19614    this.pendingClip = NORMAL_CLIP;
19615  }
19616  eoClip() {
19617    this.pendingClip = EO_CLIP;
19618  }
19619  beginText() {
19620    this.current.textMatrix = _util.IDENTITY_MATRIX;
19621    this.current.textMatrixScale = 1;
19622    this.current.x = this.current.lineX = 0;
19623    this.current.y = this.current.lineY = 0;
19624  }
19625  endText() {
19626    const paths = this.pendingTextPaths;
19627    const ctx = this.ctx;
19628    if (paths === undefined) {
19629      ctx.beginPath();
19630      return;
19631    }
19632    ctx.save();
19633    ctx.beginPath();
19634    for (const path of paths) {
19635      ctx.setTransform(...path.transform);
19636      ctx.translate(path.x, path.y);
19637      path.addToPath(ctx, path.fontSize);
19638    }
19639    ctx.restore();
19640    ctx.clip();
19641    ctx.beginPath();
19642    delete this.pendingTextPaths;
19643  }
19644  setCharSpacing(spacing) {
19645    this.current.charSpacing = spacing;
19646  }
19647  setWordSpacing(spacing) {
19648    this.current.wordSpacing = spacing;
19649  }
19650  setHScale(scale) {
19651    this.current.textHScale = scale / 100;
19652  }
19653  setLeading(leading) {
19654    this.current.leading = -leading;
19655  }
19656  setFont(fontRefName, size) {
19657    const fontObj = this.commonObjs.get(fontRefName);
19658    const current = this.current;
19659    if (!fontObj) {
19660      throw new Error(`Can't find font for ${fontRefName}`);
19661    }
19662    current.fontMatrix = fontObj.fontMatrix || _util.FONT_IDENTITY_MATRIX;
19663    if (current.fontMatrix[0] === 0 || current.fontMatrix[3] === 0) {
19664      (0, _util.warn)("Invalid font matrix for font " + fontRefName);
19665    }
19666    if (size < 0) {
19667      size = -size;
19668      current.fontDirection = -1;
19669    } else {
19670      current.fontDirection = 1;
19671    }
19672    this.current.font = fontObj;
19673    this.current.fontSize = size;
19674    if (fontObj.isType3Font) {
19675      return;
19676    }
19677    const name = fontObj.loadedName || "sans-serif";
19678    const typeface = fontObj.systemFontInfo?.css || `"${name}", ${fontObj.fallbackName}`;
19679    let bold = "normal";
19680    if (fontObj.black) {
19681      bold = "900";
19682    } else if (fontObj.bold) {
19683      bold = "bold";
19684    }
19685    const italic = fontObj.italic ? "italic" : "normal";
19686    let browserFontSize = size;
19687    if (size < MIN_FONT_SIZE) {
19688      browserFontSize = MIN_FONT_SIZE;
19689    } else if (size > MAX_FONT_SIZE) {
19690      browserFontSize = MAX_FONT_SIZE;
19691    }
19692    this.current.fontSizeScale = size / browserFontSize;
19693    this.ctx.font = `${italic} ${bold} ${browserFontSize}px ${typeface}`;
19694  }
19695  setTextRenderingMode(mode) {
19696    this.current.textRenderingMode = mode;
19697  }
19698  setTextRise(rise) {
19699    this.current.textRise = rise;
19700  }
19701  moveText(x, y) {
19702    this.current.x = this.current.lineX += x;
19703    this.current.y = this.current.lineY += y;
19704  }
19705  setLeadingMoveText(x, y) {
19706    this.setLeading(-y);
19707    this.moveText(x, y);
19708  }
19709  setTextMatrix(a, b, c, d, e, f) {
19710    this.current.textMatrix = [a, b, c, d, e, f];
19711    this.current.textMatrixScale = Math.hypot(a, b);
19712    this.current.x = this.current.lineX = 0;
19713    this.current.y = this.current.lineY = 0;
19714  }
19715  nextLine() {
19716    this.moveText(0, this.current.leading);
19717  }
19718  paintChar(character, x, y, patternTransform) {
19719    const ctx = this.ctx;
19720    const current = this.current;
19721    const font = current.font;
19722    const textRenderingMode = current.textRenderingMode;
19723    const fontSize = current.fontSize / current.fontSizeScale;
19724    const fillStrokeMode = textRenderingMode & _util.TextRenderingMode.FILL_STROKE_MASK;
19725    const isAddToPathSet = !!(textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG);
19726    const patternFill = current.patternFill && !font.missingFile;
19727    let addToPath;
19728    if (font.disableFontFace || isAddToPathSet || patternFill) {
19729      addToPath = font.getPathGenerator(this.commonObjs, character);
19730    }
19731    if (font.disableFontFace || patternFill) {
19732      ctx.save();
19733      ctx.translate(x, y);
19734      ctx.beginPath();
19735      addToPath(ctx, fontSize);
19736      if (patternTransform) {
19737        ctx.setTransform(...patternTransform);
19738      }
19739      if (fillStrokeMode === _util.TextRenderingMode.FILL || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) {
19740        ctx.fill();
19741      }
19742      if (fillStrokeMode === _util.TextRenderingMode.STROKE || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) {
19743        ctx.stroke();
19744      }
19745      ctx.restore();
19746    } else {
19747      if (fillStrokeMode === _util.TextRenderingMode.FILL || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) {
19748        ctx.fillText(character, x, y);
19749      }
19750      if (fillStrokeMode === _util.TextRenderingMode.STROKE || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) {
19751        ctx.strokeText(character, x, y);
19752      }
19753    }
19754    if (isAddToPathSet) {
19755      const paths = this.pendingTextPaths ||= [];
19756      paths.push({
19757        transform: (0, _display_utils.getCurrentTransform)(ctx),
19758        x,
19759        y,
19760        fontSize,
19761        addToPath
19762      });
19763    }
19764  }
19765  get isFontSubpixelAAEnabled() {
19766    const {
19767      context: ctx
19768    } = this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled", 10, 10);
19769    ctx.scale(1.5, 1);
19770    ctx.fillText("I", 0, 10);
19771    const data = ctx.getImageData(0, 0, 10, 10).data;
19772    let enabled = false;
19773    for (let i = 3; i < data.length; i += 4) {
19774      if (data[i] > 0 && data[i] < 255) {
19775        enabled = true;
19776        break;
19777      }
19778    }
19779    return (0, _util.shadow)(this, "isFontSubpixelAAEnabled", enabled);
19780  }
19781  showText(glyphs) {
19782    const current = this.current;
19783    const font = current.font;
19784    if (font.isType3Font) {
19785      return this.showType3Text(glyphs);
19786    }
19787    const fontSize = current.fontSize;
19788    if (fontSize === 0) {
19789      return undefined;
19790    }
19791    const ctx = this.ctx;
19792    const fontSizeScale = current.fontSizeScale;
19793    const charSpacing = current.charSpacing;
19794    const wordSpacing = current.wordSpacing;
19795    const fontDirection = current.fontDirection;
19796    const textHScale = current.textHScale * fontDirection;
19797    const glyphsLength = glyphs.length;
19798    const vertical = font.vertical;
19799    const spacingDir = vertical ? 1 : -1;
19800    const defaultVMetrics = font.defaultVMetrics;
19801    const widthAdvanceScale = fontSize * current.fontMatrix[0];
19802    const simpleFillText = current.textRenderingMode === _util.TextRenderingMode.FILL && !font.disableFontFace && !current.patternFill;
19803    ctx.save();
19804    ctx.transform(...current.textMatrix);
19805    ctx.translate(current.x, current.y + current.textRise);
19806    if (fontDirection > 0) {
19807      ctx.scale(textHScale, -1);
19808    } else {
19809      ctx.scale(textHScale, 1);
19810    }
19811    let patternTransform;
19812    if (current.patternFill) {
19813      ctx.save();
19814      const pattern = current.fillColor.getPattern(ctx, this, (0, _display_utils.getCurrentTransformInverse)(ctx), _pattern_helper.PathType.FILL);
19815      patternTransform = (0, _display_utils.getCurrentTransform)(ctx);
19816      ctx.restore();
19817      ctx.fillStyle = pattern;
19818    }
19819    let lineWidth = current.lineWidth;
19820    const scale = current.textMatrixScale;
19821    if (scale === 0 || lineWidth === 0) {
19822      const fillStrokeMode = current.textRenderingMode & _util.TextRenderingMode.FILL_STROKE_MASK;
19823      if (fillStrokeMode === _util.TextRenderingMode.STROKE || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) {
19824        lineWidth = this.getSinglePixelWidth();
19825      }
19826    } else {
19827      lineWidth /= scale;
19828    }
19829    if (fontSizeScale !== 1.0) {
19830      ctx.scale(fontSizeScale, fontSizeScale);
19831      lineWidth /= fontSizeScale;
19832    }
19833    ctx.lineWidth = lineWidth;
19834    if (font.isInvalidPDFjsFont) {
19835      const chars = [];
19836      let width = 0;
19837      for (const glyph of glyphs) {
19838        chars.push(glyph.unicode);
19839        width += glyph.width;
19840      }
19841      ctx.fillText(chars.join(""), 0, 0);
19842      current.x += width * widthAdvanceScale * textHScale;
19843      ctx.restore();
19844      this.compose();
19845      return undefined;
19846    }
19847    let x = 0,
19848      i;
19849    for (i = 0; i < glyphsLength; ++i) {
19850      const glyph = glyphs[i];
vendor: 3,295 bytes, lines 19851-19935
19851      if (typeof glyph === "number") {
19852        x += spacingDir * glyph * fontSize / 1000;
19853        continue;
19854      }
19855      let restoreNeeded = false;
19856      const spacing = (glyph.isSpace ? wordSpacing : 0) + charSpacing;
19857      const character = glyph.fontChar;
19858      const accent = glyph.accent;
19859      let scaledX, scaledY;
19860      let width = glyph.width;
19861      if (vertical) {
19862        const vmetric = glyph.vmetric || defaultVMetrics;
19863        const vx = -(glyph.vmetric ? vmetric[1] : width * 0.5) * widthAdvanceScale;
19864        const vy = vmetric[2] * widthAdvanceScale;
19865        width = vmetric ? -vmetric[0] : width;
19866        scaledX = vx / fontSizeScale;
19867        scaledY = (x + vy) / fontSizeScale;
19868      } else {
19869        scaledX = x / fontSizeScale;
19870        scaledY = 0;
19871      }
19872      if (font.remeasure && width > 0) {
19873        const measuredWidth = ctx.measureText(character).width * 1000 / fontSize * fontSizeScale;
19874        if (width < measuredWidth && this.isFontSubpixelAAEnabled) {
19875          const characterScaleX = width / measuredWidth;
19876          restoreNeeded = true;
19877          ctx.save();
19878          ctx.scale(characterScaleX, 1);
19879          scaledX /= characterScaleX;
19880        } else if (width !== measuredWidth) {
19881          scaledX += (width - measuredWidth) / 2000 * fontSize / fontSizeScale;
19882        }
19883      }
19884      if (this.contentVisible && (glyph.isInFont || font.missingFile)) {
19885        if (simpleFillText && !accent) {
19886          ctx.fillText(character, scaledX, scaledY);
19887        } else {
19888          this.paintChar(character, scaledX, scaledY, patternTransform);
19889          if (accent) {
19890            const scaledAccentX = scaledX + fontSize * accent.offset.x / fontSizeScale;
19891            const scaledAccentY = scaledY - fontSize * accent.offset.y / fontSizeScale;
19892            this.paintChar(accent.fontChar, scaledAccentX, scaledAccentY, patternTransform);
19893          }
19894        }
19895      }
19896      const charWidth = vertical ? width * widthAdvanceScale - spacing * fontDirection : width * widthAdvanceScale + spacing * fontDirection;
19897      x += charWidth;
19898      if (restoreNeeded) {
19899        ctx.restore();
19900      }
19901    }
19902    if (vertical) {
19903      current.y -= x;
19904    } else {
19905      current.x += x * textHScale;
19906    }
19907    ctx.restore();
19908    this.compose();
19909    return undefined;
19910  }
19911  showType3Text(glyphs) {
19912    const ctx = this.ctx;
19913    const current = this.current;
19914    const font = current.font;
19915    const fontSize = current.fontSize;
19916    const fontDirection = current.fontDirection;
19917    const spacingDir = font.vertical ? 1 : -1;
19918    const charSpacing = current.charSpacing;
19919    const wordSpacing = current.wordSpacing;
19920    const textHScale = current.textHScale * fontDirection;
19921    const fontMatrix = current.fontMatrix || _util.FONT_IDENTITY_MATRIX;
19922    const glyphsLength = glyphs.length;
19923    const isTextInvisible = current.textRenderingMode === _util.TextRenderingMode.INVISIBLE;
19924    let i, glyph, width, spacingLength;
19925    if (isTextInvisible || fontSize === 0) {
19926      return;
19927    }
19928    this._cachedScaleForStroking[0] = -1;
19929    this._cachedGetSinglePixelWidth = null;
19930    ctx.save();
19931    ctx.transform(...current.textMatrix);
19932    ctx.translate(current.x, current.y);
19933    ctx.scale(textHScale, fontDirection);
19934    for (i = 0; i < glyphsLength; ++i) {
19935      glyph = glyphs[i];
19936      if (typeof glyph === "number") {
19937        spacingLength = spacingDir * glyph * fontSize / 1000;
19938        this.ctx.translate(spacingLength, 0);
19939        current.x += spacingLength * textHScale;
19940        continue;
19941      }
19942      const spacing = (glyph.isSpace ? wordSpacing : 0) + charSpacing;
19943      const operatorList = font.charProcOperatorList[glyph.operatorListId];
19944      if (!operatorList) {
19945        (0, _util.warn)(`Type3 character "${glyph.operatorListId}" is not available.`);
19946        continue;
19947      }
19948      if (this.contentVisible) {
19949        this.processingType3 = glyph;
19950        this.save();
19951        ctx.scale(fontSize, fontSize);
19952        ctx.transform(...fontMatrix);
19953        this.executeOperatorList(operatorList);
19954        this.restore();
19955      }
19956      const transformed = _util.Util.applyTransform([glyph.width, 0], fontMatrix);
19957      width = transformed[0] * fontSize + spacing;
19958      ctx.translate(width, 0);
19959      current.x += width * textHScale;
19960    }
19961    ctx.restore();
19962    this.processingType3 = null;
19963  }
19964  setCharWidth(xWidth, yWidth) {}
19965  setCharWidthAndBounds(xWidth, yWidth, llx, lly, urx, ury) {
19966    this.ctx.rect(llx, lly, urx - llx, ury - lly);
19967    this.ctx.clip();
19968    this.endPath();
19969  }
19970  getColorN_Pattern(IR) {
19971    let pattern;
19972    if (IR[0] === "TilingPattern") {
19973      const color = IR[1];
19974      const baseTransform = this.baseTransform || (0, _display_utils.getCurrentTransform)(this.ctx);
19975      const canvasGraphicsFactory = {
19976        createCanvasGraphics: ctx => {
19977          return new CanvasGraphics(ctx, this.commonObjs, this.objs, this.canvasFactory, this.filterFactory, {
19978            optionalContentConfig: this.optionalContentConfig,
19979            markedContentStack: this.markedContentStack
19980          });
19981        }
19982      };
19983      pattern = new _pattern_helper.TilingPattern(IR, color, this.ctx, canvasGraphicsFactory, baseTransform);
19984    } else {
19985      pattern = this._getPattern(IR[1], IR[2]);
19986    }
19987    return pattern;
19988  }
19989  setStrokeColorN() {
19990    this.current.strokeColor = this.getColorN_Pattern(arguments);
19991  }
19992  setFillColorN() {
19993    this.current.fillColor = this.getColorN_Pattern(arguments);
19994    this.current.patternFill = true;
19995  }
19996  setStrokeRGBColor(r, g, b) {
19997    const color = _util.Util.makeHexColor(r, g, b);
19998    this.ctx.strokeStyle = color;
19999    this.current.strokeColor = color;
20000  }
20001  setFillRGBColor(r, g, b) {
20002    const color = _util.Util.makeHexColor(r, g, b);
20003    this.ctx.fillStyle = color;
20004    this.current.fillColor = color;
20005    this.current.patternFill = false;
20006  }
20007  _getPattern(objId, matrix = null) {
20008    let pattern;
20009    if (this.cachedPatterns.has(objId)) {
20010      pattern = this.cachedPatterns.get(objId);
20011    } else {
20012      pattern = (0, _pattern_helper.getShadingPattern)(this.getObject(objId));
20013      this.cachedPatterns.set(objId, pattern);
20014    }
20015    if (matrix) {
20016      pattern.matrix = matrix;
20017    }
20018    return pattern;
20019  }
20020  shadingFill(objId) {
20021    if (!this.contentVisible) {
20022      return;
20023    }
20024    const ctx = this.ctx;
20025    this.save();
20026    const pattern = this._getPattern(objId);
20027    ctx.fillStyle = pattern.getPattern(ctx, this, (0, _display_utils.getCurrentTransformInverse)(ctx), _pattern_helper.PathType.SHADING);
20028    const inv = (0, _display_utils.getCurrentTransformInverse)(ctx);
20029    if (inv) {
20030      const {
20031        width,
20032        height
20033      } = ctx.canvas;
20034      const [x0, y0, x1, y1] = _util.Util.getAxialAlignedBoundingBox([0, 0, width, height], inv);
20035      this.ctx.fillRect(x0, y0, x1 - x0, y1 - y0);
20036    } else {
20037      this.ctx.fillRect(-1e10, -1e10, 2e10, 2e10);
20038    }
20039    this.compose(this.current.getClippedPathBoundingBox());
20040    this.restore();
20041  }
20042  beginInlineImage() {
20043    (0, _util.unreachable)("Should not call beginInlineImage");
20044  }
20045  beginImageData() {
20046    (0, _util.unreachable)("Should not call beginImageData");
20047  }
20048  paintFormXObjectBegin(matrix, bbox) {
20049    if (!this.contentVisible) {
20050      return;
20051    }
20052    this.save();
20053    this.baseTransformStack.push(this.baseTransform);
20054    if (Array.isArray(matrix) && matrix.length === 6) {
20055      this.transform(...matrix);
20056    }
20057    this.baseTransform = (0, _display_utils.getCurrentTransform)(this.ctx);
20058    if (bbox) {
20059      const width = bbox[2] - bbox[0];
20060      const height = bbox[3] - bbox[1];
20061      this.ctx.rect(bbox[0], bbox[1], width, height);
20062      this.current.updateRectMinMax((0, _display_utils.getCurrentTransform)(this.ctx), bbox);
20063      this.clip();
20064      this.endPath();
20065    }
20066  }
20067  paintFormXObjectEnd() {
20068    if (!this.contentVisible) {
20069      return;
20070    }
20071    this.restore();
20072    this.baseTransform = this.baseTransformStack.pop();
20073  }
20074  beginGroup(group) {
20075    if (!this.contentVisible) {
20076      return;
20077    }
20078    this.save();
20079    if (this.inSMaskMode) {
20080      this.endSMaskMode();
20081      this.current.activeSMask = null;
20082    }
20083    const currentCtx = this.ctx;
20084    if (!group.isolated) {
20085      (0, _util.info)("TODO: Support non-isolated groups.");
20086    }
20087    if (group.knockout) {
20088      (0, _util.warn)("Knockout groups not supported.");
20089    }
20090    const currentTransform = (0, _display_utils.getCurrentTransform)(currentCtx);
20091    if (group.matrix) {
20092      currentCtx.transform(...group.matrix);
20093    }
20094    if (!group.bbox) {
20095      throw new Error("Bounding box is required.");
20096    }
20097    let bounds = _util.Util.getAxialAlignedBoundingBox(group.bbox, (0, _display_utils.getCurrentTransform)(currentCtx));
20098    const canvasBounds = [0, 0, currentCtx.canvas.width, currentCtx.canvas.height];
20099    bounds = _util.Util.intersect(bounds, canvasBounds) || [0, 0, 0, 0];
20100    const offsetX = Math.floor(bounds[0]);
20101    const offsetY = Math.floor(bounds[1]);
20102    let drawnWidth = Math.max(Math.ceil(bounds[2]) - offsetX, 1);
20103    let drawnHeight = Math.max(Math.ceil(bounds[3]) - offsetY, 1);
20104    let scaleX = 1,
20105      scaleY = 1;
20106    if (drawnWidth > MAX_GROUP_SIZE) {
20107      scaleX = drawnWidth / MAX_GROUP_SIZE;
20108      drawnWidth = MAX_GROUP_SIZE;
20109    }
20110    if (drawnHeight > MAX_GROUP_SIZE) {
20111      scaleY = drawnHeight / MAX_GROUP_SIZE;
20112      drawnHeight = MAX_GROUP_SIZE;
20113    }
20114    this.current.startNewPathAndClipBox([0, 0, drawnWidth, drawnHeight]);
20115    let cacheId = "groupAt" + this.groupLevel;
20116    if (group.smask) {
20117      cacheId += "_smask_" + this.smaskCounter++ % 2;
20118    }
20119    const scratchCanvas = this.cachedCanvases.getCanvas(cacheId, drawnWidth, drawnHeight);
20120    const groupCtx = scratchCanvas.context;
20121    groupCtx.scale(1 / scaleX, 1 / scaleY);
20122    groupCtx.translate(-offsetX, -offsetY);
20123    groupCtx.transform(...currentTransform);
20124    if (group.smask) {
20125      this.smaskStack.push({
20126        canvas: scratchCanvas.canvas,
20127        context: groupCtx,
20128        offsetX,
20129        offsetY,
20130        scaleX,
20131        scaleY,
20132        subtype: group.smask.subtype,
20133        backdrop: group.smask.backdrop,
20134        transferMap: group.smask.transferMap || null,
20135        startTransformInverse: null
20136      });
20137    } else {
20138      currentCtx.setTransform(1, 0, 0, 1, 0, 0);
20139      currentCtx.translate(offsetX, offsetY);
20140      currentCtx.scale(scaleX, scaleY);
20141      currentCtx.save();
20142    }
20143    copyCtxState(currentCtx, groupCtx);
20144    this.ctx = groupCtx;
20145    this.setGState([["BM", "source-over"], ["ca", 1], ["CA", 1]]);
20146    this.groupStack.push(currentCtx);
20147    this.groupLevel++;
20148  }
20149  endGroup(group) {
20150    if (!this.contentVisible) {
20151      return;
20152    }
20153    this.groupLevel--;
20154    const groupCtx = this.ctx;
20155    const ctx = this.groupStack.pop();
20156    this.ctx = ctx;
20157    this.ctx.imageSmoothingEnabled = false;
20158    if (group.smask) {
20159      this.tempSMask = this.smaskStack.pop();
20160      this.restore();
20161    } else {
20162      this.ctx.restore();
20163      const currentMtx = (0, _display_utils.getCurrentTransform)(this.ctx);
20164      this.restore();
20165      this.ctx.save();
20166      this.ctx.setTransform(...currentMtx);
20167      const dirtyBox = _util.Util.getAxialAlignedBoundingBox([0, 0, groupCtx.canvas.width, groupCtx.canvas.height], currentMtx);
20168      this.ctx.drawImage(groupCtx.canvas, 0, 0);
20169      this.ctx.restore();
20170      this.compose(dirtyBox);
20171    }
20172  }
20173  beginAnnotation(id, rect, transform, matrix, hasOwnCanvas) {
20174    this.#restoreInitialState();
20175    resetCtxToDefault(this.ctx);
20176    this.ctx.save();
20177    this.save();
20178    if (this.baseTransform) {
20179      this.ctx.setTransform(...this.baseTransform);
20180    }
20181    if (Array.isArray(rect) && rect.length === 4) {
20182      const width = rect[2] - rect[0];
20183      const height = rect[3] - rect[1];
20184      if (hasOwnCanvas && this.annotationCanvasMap) {
20185        transform = transform.slice();
20186        transform[4] -= rect[0];
20187        transform[5] -= rect[1];
20188        rect = rect.slice();
20189        rect[0] = rect[1] = 0;
20190        rect[2] = width;
20191        rect[3] = height;
20192        const [scaleX, scaleY] = _util.Util.singularValueDecompose2dScale((0, _display_utils.getCurrentTransform)(this.ctx));
20193        const {
20194          viewportScale
20195        } = this;
20196        const canvasWidth = Math.ceil(width * this.outputScaleX * viewportScale);
20197        const canvasHeight = Math.ceil(height * this.outputScaleY * viewportScale);
20198        this.annotationCanvas = this.canvasFactory.create(canvasWidth, canvasHeight);
20199        const {
20200          canvas,
20201          context
20202        } = this.annotationCanvas;
20203        this.annotationCanvasMap.set(id, canvas);
20204        this.annotationCanvas.savedCtx = this.ctx;
20205        this.ctx = context;
20206        this.ctx.save();
20207        this.ctx.setTransform(scaleX, 0, 0, -scaleY, 0, height * scaleY);
20208        resetCtxToDefault(this.ctx);
20209      } else {
20210        resetCtxToDefault(this.ctx);
20211        this.ctx.rect(rect[0], rect[1], width, height);
20212        this.ctx.clip();
20213        this.endPath();
20214      }
20215    }
20216    this.current = new CanvasExtraState(this.ctx.canvas.width, this.ctx.canvas.height);
20217    this.transform(...transform);
20218    this.transform(...matrix);
20219  }
20220  endAnnotation() {
20221    if (this.annotationCanvas) {
20222      this.ctx.restore();
20223      this.#drawFilter();
20224      this.ctx = this.annotationCanvas.savedCtx;
20225      delete this.annotationCanvas.savedCtx;
20226      delete this.annotationCanvas;
20227    }
20228  }
20229  paintImageMaskXObject(img) {
20230    if (!this.contentVisible) {
20231      return;
20232    }
20233    const count = img.count;
20234    img = this.getObject(img.data, img);
20235    img.count = count;
20236    const ctx = this.ctx;
20237    const glyph = this.processingType3;
20238    if (glyph) {
20239      if (glyph.compiled === undefined) {
20240        glyph.compiled = compileType3Glyph(img);
20241      }
20242      if (glyph.compiled) {
20243        glyph.compiled(ctx);
20244        return;
20245      }
20246    }
20247    const mask = this._createMaskCanvas(img);
20248    const maskCanvas = mask.canvas;
20249    ctx.save();
20250    ctx.setTransform(1, 0, 0, 1, 0, 0);
20251    ctx.drawImage(maskCanvas, mask.offsetX, mask.offsetY);
20252    ctx.restore();
20253    this.compose();
20254  }
20255  paintImageMaskXObjectRepeat(img, scaleX, skewX = 0, skewY = 0, scaleY, positions) {
20256    if (!this.contentVisible) {
20257      return;
20258    }
20259    img = this.getObject(img.data, img);
20260    const ctx = this.ctx;
20261    ctx.save();
20262    const currentTransform = (0, _display_utils.getCurrentTransform)(ctx);
20263    ctx.transform(scaleX, skewX, skewY, scaleY, 0, 0);
20264    const mask = this._createMaskCanvas(img);
20265    ctx.setTransform(1, 0, 0, 1, mask.offsetX - currentTransform[4], mask.offsetY - currentTransform[5]);
20266    for (let i = 0, ii = positions.length; i < ii; i += 2) {
20267      const trans = _util.Util.transform(currentTransform, [scaleX, skewX, skewY, scaleY, positions[i], positions[i + 1]]);
20268      const [x, y] = _util.Util.applyTransform([0, 0], trans);
20269      ctx.drawImage(mask.canvas, x, y);
20270    }
20271    ctx.restore();
20272    this.compose();
20273  }
20274  paintImageMaskXObjectGroup(images) {
20275    if (!this.contentVisible) {
20276      return;
20277    }
20278    const ctx = this.ctx;
20279    const fillColor = this.current.fillColor;
20280    const isPatternFill = this.current.patternFill;
20281    for (const image of images) {
20282      const {
20283        data,
20284        width,
20285        height,
20286        transform
20287      } = image;
20288      const maskCanvas = this.cachedCanvases.getCanvas("maskCanvas", width, height);
20289      const maskCtx = maskCanvas.context;
20290      maskCtx.save();
20291      const img = this.getObject(data, image);
20292      putBinaryImageMask(maskCtx, img);
20293      maskCtx.globalCompositeOperation = "source-in";
20294      maskCtx.fillStyle = isPatternFill ? fillColor.getPattern(maskCtx, this, (0, _display_utils.getCurrentTransformInverse)(ctx), _pattern_helper.PathType.FILL) : fillColor;
20295      maskCtx.fillRect(0, 0, width, height);
20296      maskCtx.restore();
20297      ctx.save();
20298      ctx.transform(...transform);
20299      ctx.scale(1, -1);
20300      drawImageAtIntegerCoords(ctx, maskCanvas.canvas, 0, 0, width, height, 0, -1, 1, 1);
20301      ctx.restore();
20302    }
20303    this.compose();
20304  }
20305  paintImageXObject(objId) {
20306    if (!this.contentVisible) {
20307      return;
20308    }
20309    const imgData = this.getObject(objId);
20310    if (!imgData) {
20311      (0, _util.warn)("Dependent image isn't ready yet");
20312      return;
20313    }
20314    this.paintInlineImageXObject(imgData);
20315  }
20316  paintImageXObjectRepeat(objId, scaleX, scaleY, positions) {
20317    if (!this.contentVisible) {
20318      return;
20319    }
20320    const imgData = this.getObject(objId);
20321    if (!imgData) {
20322      (0, _util.warn)("Dependent image isn't ready yet");
20323      return;
20324    }
20325    const width = imgData.width;
20326    const height = imgData.height;
20327    const map = [];
20328    for (let i = 0, ii = positions.length; i < ii; i += 2) {
20329      map.push({
20330        transform: [scaleX, 0, 0, scaleY, positions[i], positions[i + 1]],
20331        x: 0,
20332        y: 0,
20333        w: width,
20334        h: height
20335      });
20336    }
20337    this.paintInlineImageXObjectGroup(imgData, map);
20338  }
20339  applyTransferMapsToCanvas(ctx) {
20340    if (this.current.transferMaps !== "none") {
20341      ctx.filter = this.current.transferMaps;
20342      ctx.drawImage(ctx.canvas, 0, 0);
20343      ctx.filter = "none";
20344    }
20345    return ctx.canvas;
20346  }
20347  applyTransferMapsToBitmap(imgData) {
20348    if (this.current.transferMaps === "none") {
20349      return imgData.bitmap;
20350    }
20351    const {
20352      bitmap,
20353      width,
20354      height
20355    } = imgData;
20356    const tmpCanvas = this.cachedCanvases.getCanvas("inlineImage", width, height);
20357    const tmpCtx = tmpCanvas.context;
20358    tmpCtx.filter = this.current.transferMaps;
20359    tmpCtx.drawImage(bitmap, 0, 0);
20360    tmpCtx.filter = "none";
20361    return tmpCanvas.canvas;
20362  }
20363  paintInlineImageXObject(imgData) {
20364    if (!this.contentVisible) {
20365      return;
20366    }
20367    const width = imgData.width;
20368    const height = imgData.height;
20369    const ctx = this.ctx;
20370    this.save();
20371    if (!_util.isNodeJS) {
20372      const {
20373        filter
20374      } = ctx;
20375      if (filter !== "none" && filter !== "") {
20376        ctx.filter = "none";
20377      }
20378    }
20379    ctx.scale(1 / width, -1 / height);
20380    let imgToPaint;
20381    if (imgData.bitmap) {
20382      imgToPaint = this.applyTransferMapsToBitmap(imgData);
20383    } else if (typeof HTMLElement === "function" && imgData instanceof HTMLElement || !imgData.data) {
20384      imgToPaint = imgData;
20385    } else {
20386      const tmpCanvas = this.cachedCanvases.getCanvas("inlineImage", width, height);
20387      const tmpCtx = tmpCanvas.context;
20388      putBinaryImageData(tmpCtx, imgData);
20389      imgToPaint = this.applyTransferMapsToCanvas(tmpCtx);
20390    }
20391    const scaled = this._scaleImage(imgToPaint, (0, _display_utils.getCurrentTransformInverse)(ctx));
20392    ctx.imageSmoothingEnabled = getImageSmoothingEnabled((0, _display_utils.getCurrentTransform)(ctx), imgData.interpolate);
20393    drawImageAtIntegerCoords(ctx, scaled.img, 0, 0, scaled.paintWidth, scaled.paintHeight, 0, -height, width, height);
20394    this.compose();
vendor: 4,375 bytes, lines 20395-20545
20395    this.restore();
20396  }
20397  paintInlineImageXObjectGroup(imgData, map) {
20398    if (!this.contentVisible) {
20399      return;
20400    }
20401    const ctx = this.ctx;
20402    let imgToPaint;
20403    if (imgData.bitmap) {
20404      imgToPaint = imgData.bitmap;
20405    } else {
20406      const w = imgData.width;
20407      const h = imgData.height;
20408      const tmpCanvas = this.cachedCanvases.getCanvas("inlineImage", w, h);
20409      const tmpCtx = tmpCanvas.context;
20410      putBinaryImageData(tmpCtx, imgData);
20411      imgToPaint = this.applyTransferMapsToCanvas(tmpCtx);
20412    }
20413    for (const entry of map) {
20414      ctx.save();
20415      ctx.transform(...entry.transform);
20416      ctx.scale(1, -1);
20417      drawImageAtIntegerCoords(ctx, imgToPaint, entry.x, entry.y, entry.w, entry.h, 0, -1, 1, 1);
20418      ctx.restore();
20419    }
20420    this.compose();
20421  }
20422  paintSolidColorImageMask() {
20423    if (!this.contentVisible) {
20424      return;
20425    }
20426    this.ctx.fillRect(0, 0, 1, 1);
20427    this.compose();
20428  }
20429  markPoint(tag) {}
20430  markPointProps(tag, properties) {}
20431  beginMarkedContent(tag) {
20432    this.markedContentStack.push({
20433      visible: true
20434    });
20435  }
20436  beginMarkedContentProps(tag, properties) {
20437    if (tag === "OC") {
20438      this.markedContentStack.push({
20439        visible: this.optionalContentConfig.isVisible(properties)
20440      });
20441    } else {
20442      this.markedContentStack.push({
20443        visible: true
20444      });
20445    }
20446    this.contentVisible = this.isContentVisible();
20447  }
20448  endMarkedContent() {
20449    this.markedContentStack.pop();
20450    this.contentVisible = this.isContentVisible();
20451  }
20452  beginCompat() {}
20453  endCompat() {}
20454  consumePath(clipBox) {
20455    const isEmpty = this.current.isEmptyClip();
20456    if (this.pendingClip) {
20457      this.current.updateClipFromPath();
20458    }
20459    if (!this.pendingClip) {
20460      this.compose(clipBox);
20461    }
20462    const ctx = this.ctx;
20463    if (this.pendingClip) {
20464      if (!isEmpty) {
20465        if (this.pendingClip === EO_CLIP) {
20466          ctx.clip("evenodd");
20467        } else {
20468          ctx.clip();
20469        }
20470      }
20471      this.pendingClip = null;
20472    }
20473    this.current.startNewPathAndClipBox(this.current.clipBox);
20474    ctx.beginPath();
20475  }
20476  getSinglePixelWidth() {
20477    if (!this._cachedGetSinglePixelWidth) {
20478      const m = (0, _display_utils.getCurrentTransform)(this.ctx);
20479      if (m[1] === 0 && m[2] === 0) {
20480        this._cachedGetSinglePixelWidth = 1 / Math.min(Math.abs(m[0]), Math.abs(m[3]));
20481      } else {
20482        const absDet = Math.abs(m[0] * m[3] - m[2] * m[1]);
20483        const normX = Math.hypot(m[0], m[2]);
20484        const normY = Math.hypot(m[1], m[3]);
20485        this._cachedGetSinglePixelWidth = Math.max(normX, normY) / absDet;
20486      }
20487    }
20488    return this._cachedGetSinglePixelWidth;
20489  }
20490  getScaleForStroking() {
20491    if (this._cachedScaleForStroking[0] === -1) {
20492      const {
20493        lineWidth
20494      } = this.current;
20495      const {
20496        a,
20497        b,
20498        c,
20499        d
20500      } = this.ctx.getTransform();
20501      let scaleX, scaleY;
20502      if (b === 0 && c === 0) {
20503        const normX = Math.abs(a);
20504        const normY = Math.abs(d);
20505        if (normX === normY) {
20506          if (lineWidth === 0) {
20507            scaleX = scaleY = 1 / normX;
20508          } else {
20509            const scaledLineWidth = normX * lineWidth;
20510            scaleX = scaleY = scaledLineWidth < 1 ? 1 / scaledLineWidth : 1;
20511          }
20512        } else if (lineWidth === 0) {
20513          scaleX = 1 / normX;
20514          scaleY = 1 / normY;
20515        } else {
20516          const scaledXLineWidth = normX * lineWidth;
20517          const scaledYLineWidth = normY * lineWidth;
20518          scaleX = scaledXLineWidth < 1 ? 1 / scaledXLineWidth : 1;
20519          scaleY = scaledYLineWidth < 1 ? 1 / scaledYLineWidth : 1;
20520        }
20521      } else {
20522        const absDet = Math.abs(a * d - b * c);
20523        const normX = Math.hypot(a, b);
20524        const normY = Math.hypot(c, d);
20525        if (lineWidth === 0) {
20526          scaleX = normY / absDet;
20527          scaleY = normX / absDet;
20528        } else {
20529          const baseArea = lineWidth * absDet;
20530          scaleX = normY > baseArea ? normY / baseArea : 1;
20531          scaleY = normX > baseArea ? normX / baseArea : 1;
20532        }
20533      }
20534      this._cachedScaleForStroking[0] = scaleX;
20535      this._cachedScaleForStroking[1] = scaleY;
20536    }
20537    return this._cachedScaleForStroking;
20538  }
20539  rescaleAndStroke(saveRestore) {
20540    const {
20541      ctx
20542    } = this;
20543    const {
20544      lineWidth
20545    } = this.current;
20546    const [scaleX, scaleY] = this.getScaleForStroking();
20547    ctx.lineWidth = lineWidth || 1;
20548    if (scaleX === 1 && scaleY === 1) {
20549      ctx.stroke();
20550      return;
20551    }
20552    const dashes = ctx.getLineDash();
20553    if (saveRestore) {
20554      ctx.save();
20555    }
20556    ctx.scale(scaleX, scaleY);
20557    if (dashes.length > 0) {
20558      const scale = Math.max(scaleX, scaleY);
20559      ctx.setLineDash(dashes.map(x => x / scale));
20560      ctx.lineDashOffset /= scale;
20561    }
20562    ctx.stroke();
20563    if (saveRestore) {
20564      ctx.restore();
20565    }
20566  }
20567  isContentVisible() {
20568    for (let i = this.markedContentStack.length - 1; i >= 0; i--) {
20569      if (!this.markedContentStack[i].visible) {
20570        return false;
20571      }
20572    }
20573    return true;
20574  }
20575}
20576exports.CanvasGraphics = CanvasGraphics;
20577for (const op in _util.OPS) {
20578  if (CanvasGraphics.prototype[op] !== undefined) {
20579    CanvasGraphics.prototype[_util.OPS[op]] = CanvasGraphics.prototype[op];
20580  }
20581}
20582
20583/***/ }),
20584/* 12 */
20585/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
20586
20587
20588
20589Object.defineProperty(exports, "__esModule", ({
20590  value: true
20591}));
20592exports.TilingPattern = exports.PathType = void 0;
20593exports.getShadingPattern = getShadingPattern;
20594var _util = __w_pdfjs_require__(1);
20595var _display_utils = __w_pdfjs_require__(6);
20596const PathType = {
20597  FILL: "Fill",
20598  STROKE: "Stroke",
20599  SHADING: "Shading"
20600};
20601exports.PathType = PathType;
20602function applyBoundingBox(ctx, bbox) {
20603  if (!bbox) {
20604    return;
20605  }
20606  const width = bbox[2] - bbox[0];
20607  const height = bbox[3] - bbox[1];
20608  const region = new Path2D();
20609  region.rect(bbox[0], bbox[1], width, height);
20610  ctx.clip(region);
20611}
20612class BaseShadingPattern {
20613  constructor() {
20614    if (this.constructor === BaseShadingPattern) {
20615      (0, _util.unreachable)("Cannot initialize BaseShadingPattern.");
20616    }
20617  }
20618  getPattern() {
20619    (0, _util.unreachable)("Abstract method `getPattern` called.");
20620  }
20621}
20622class RadialAxialShadingPattern extends BaseShadingPattern {
20623  constructor(IR) {
20624    super();
20625    this._type = IR[1];
20626    this._bbox = IR[2];
20627    this._colorStops = IR[3];
20628    this._p0 = IR[4];
20629    this._p1 = IR[5];
20630    this._r0 = IR[6];
20631    this._r1 = IR[7];
20632    this.matrix = null;
20633  }
20634  _createGradient(ctx) {
20635    let grad;
20636    if (this._type === "axial") {
20637      grad = ctx.createLinearGradient(this._p0[0], this._p0[1], this._p1[0], this._p1[1]);
20638    } else if (this._type === "radial") {
20639      grad = ctx.createRadialGradient(this._p0[0], this._p0[1], this._r0, this._p1[0], this._p1[1], this._r1);
20640    }
20641    for (const colorStop of this._colorStops) {
20642      grad.addColorStop(colorStop[0], colorStop[1]);
20643    }
20644    return grad;
20645  }
20646  getPattern(ctx, owner, inverse, pathType) {
20647    let pattern;
20648    if (pathType === PathType.STROKE || pathType === PathType.FILL) {
20649      const ownerBBox = owner.current.getClippedPathBoundingBox(pathType, (0, _display_utils.getCurrentTransform)(ctx)) || [0, 0, 0, 0];
20650      const width = Math.ceil(ownerBBox[2] - ownerBBox[0]) || 1;
20651      const height = Math.ceil(ownerBBox[3] - ownerBBox[1]) || 1;
20652      const tmpCanvas = owner.cachedCanvases.getCanvas("pattern", width, height, true);
20653      const tmpCtx = tmpCanvas.context;
20654      tmpCtx.clearRect(0, 0, tmpCtx.canvas.width, tmpCtx.canvas.height);
20655      tmpCtx.beginPath();
20656      tmpCtx.rect(0, 0, tmpCtx.canvas.width, tmpCtx.canvas.height);
20657      tmpCtx.translate(-ownerBBox[0], -ownerBBox[1]);
20658      inverse = _util.Util.transform(inverse, [1, 0, 0, 1, ownerBBox[0], ownerBBox[1]]);
20659      tmpCtx.transform(...owner.baseTransform);
20660      if (this.matrix) {
20661        tmpCtx.transform(...this.matrix);
20662      }
20663      applyBoundingBox(tmpCtx, this._bbox);
20664      tmpCtx.fillStyle = this._createGradient(tmpCtx);
20665      tmpCtx.fill();
20666      pattern = ctx.createPattern(tmpCanvas.canvas, "no-repeat");
20667      const domMatrix = new DOMMatrix(inverse);
20668      pattern.setTransform(domMatrix);
20669    } else {
20670      applyBoundingBox(ctx, this._bbox);
20671      pattern = this._createGradient(ctx);
20672    }
20673    return pattern;
20674  }
20675}
20676function drawTriangle(data, context, p1, p2, p3, c1, c2, c3) {
20677  const coords = context.coords,
20678    colors = context.colors;
20679  const bytes = data.data,
20680    rowSize = data.width * 4;
20681  let tmp;
20682  if (coords[p1 + 1] > coords[p2 + 1]) {
20683    tmp = p1;
20684    p1 = p2;
20685    p2 = tmp;
20686    tmp = c1;
20687    c1 = c2;
20688    c2 = tmp;
20689  }
20690  if (coords[p2 + 1] > coords[p3 + 1]) {
20691    tmp = p2;
20692    p2 = p3;
20693    p3 = tmp;
20694    tmp = c2;
20695    c2 = c3;
20696    c3 = tmp;
20697  }
20698  if (coords[p1 + 1] > coords[p2 + 1]) {
20699    tmp = p1;
20700    p1 = p2;
20701    p2 = tmp;
20702    tmp = c1;
20703    c1 = c2;
20704    c2 = tmp;
20705  }
20706  const x1 = (coords[p1] + context.offsetX) * context.scaleX;
20707  const y1 = (coords[p1 + 1] + context.offsetY) * context.scaleY;
20708  const x2 = (coords[p2] + context.offsetX) * context.scaleX;
20709  const y2 = (coords[p2 + 1] + context.offsetY) * context.scaleY;
20710  const x3 = (coords[p3] + context.offsetX) * context.scaleX;
20711  const y3 = (coords[p3 + 1] + context.offsetY) * context.scaleY;
20712  if (y1 >= y3) {
20713    return;
20714  }
20715  const c1r = colors[c1],
20716    c1g = colors[c1 + 1],
20717    c1b = colors[c1 + 2];
20718  const c2r = colors[c2],
20719    c2g = colors[c2 + 1],
20720    c2b = colors[c2 + 2];
20721  const c3r = colors[c3],
20722    c3g = colors[c3 + 1],
20723    c3b = colors[c3 + 2];
20724  const minY = Math.round(y1),
20725    maxY = Math.round(y3);
20726  let xa, car, cag, cab;
20727  let xb, cbr, cbg, cbb;
20728  for (let y = minY; y <= maxY; y++) {
20729    if (y < y2) {
vendor: 4,267 bytes, lines 20730-20859
20730      const k = y < y1 ? 0 : (y1 - y) / (y1 - y2);
20731      xa = x1 - (x1 - x2) * k;
20732      car = c1r - (c1r - c2r) * k;
20733      cag = c1g - (c1g - c2g) * k;
20734      cab = c1b - (c1b - c2b) * k;
20735    } else {
20736      let k;
20737      if (y > y3) {
20738        k = 1;
20739      } else if (y2 === y3) {
20740        k = 0;
20741      } else {
20742        k = (y2 - y) / (y2 - y3);
20743      }
20744      xa = x2 - (x2 - x3) * k;
20745      car = c2r - (c2r - c3r) * k;
20746      cag = c2g - (c2g - c3g) * k;
20747      cab = c2b - (c2b - c3b) * k;
20748    }
20749    let k;
20750    if (y < y1) {
20751      k = 0;
20752    } else if (y > y3) {
20753      k = 1;
20754    } else {
20755      k = (y1 - y) / (y1 - y3);
20756    }
20757    xb = x1 - (x1 - x3) * k;
20758    cbr = c1r - (c1r - c3r) * k;
20759    cbg = c1g - (c1g - c3g) * k;
20760    cbb = c1b - (c1b - c3b) * k;
20761    const x1_ = Math.round(Math.min(xa, xb));
20762    const x2_ = Math.round(Math.max(xa, xb));
20763    let j = rowSize * y + x1_ * 4;
20764    for (let x = x1_; x <= x2_; x++) {
20765      k = (xa - x) / (xa - xb);
20766      if (k < 0) {
20767        k = 0;
20768      } else if (k > 1) {
20769        k = 1;
20770      }
20771      bytes[j++] = car - (car - cbr) * k | 0;
20772      bytes[j++] = cag - (cag - cbg) * k | 0;
20773      bytes[j++] = cab - (cab - cbb) * k | 0;
20774      bytes[j++] = 255;
20775    }
20776  }
20777}
20778function drawFigure(data, figure, context) {
20779  const ps = figure.coords;
20780  const cs = figure.colors;
20781  let i, ii;
20782  switch (figure.type) {
20783    case "lattice":
20784      const verticesPerRow = figure.verticesPerRow;
20785      const rows = Math.floor(ps.length / verticesPerRow) - 1;
20786      const cols = verticesPerRow - 1;
20787      for (i = 0; i < rows; i++) {
20788        let q = i * verticesPerRow;
20789        for (let j = 0; j < cols; j++, q++) {
20790          drawTriangle(data, context, ps[q], ps[q + 1], ps[q + verticesPerRow], cs[q], cs[q + 1], cs[q + verticesPerRow]);
20791          drawTriangle(data, context, ps[q + verticesPerRow + 1], ps[q + 1], ps[q + verticesPerRow], cs[q + verticesPerRow + 1], cs[q + 1], cs[q + verticesPerRow]);
20792        }
20793      }
20794      break;
20795    case "triangles":
20796      for (i = 0, ii = ps.length; i < ii; i += 3) {
20797        drawTriangle(data, context, ps[i], ps[i + 1], ps[i + 2], cs[i], cs[i + 1], cs[i + 2]);
20798      }
20799      break;
20800    default:
20801      throw new Error("illegal figure");
20802  }
20803}
20804class MeshShadingPattern extends BaseShadingPattern {
20805  constructor(IR) {
20806    super();
20807    this._coords = IR[2];
20808    this._colors = IR[3];
20809    this._figures = IR[4];
20810    this._bounds = IR[5];
20811    this._bbox = IR[7];
20812    this._background = IR[8];
20813    this.matrix = null;
20814  }
20815  _createMeshCanvas(combinedScale, backgroundColor, cachedCanvases) {
20816    const EXPECTED_SCALE = 1.1;
20817    const MAX_PATTERN_SIZE = 3000;
20818    const BORDER_SIZE = 2;
20819    const offsetX = Math.floor(this._bounds[0]);
20820    const offsetY = Math.floor(this._bounds[1]);
20821    const boundsWidth = Math.ceil(this._bounds[2]) - offsetX;
20822    const boundsHeight = Math.ceil(this._bounds[3]) - offsetY;
20823    const width = Math.min(Math.ceil(Math.abs(boundsWidth * combinedScale[0] * EXPECTED_SCALE)), MAX_PATTERN_SIZE);
20824    const height = Math.min(Math.ceil(Math.abs(boundsHeight * combinedScale[1] * EXPECTED_SCALE)), MAX_PATTERN_SIZE);
20825    const scaleX = boundsWidth / width;
20826    const scaleY = boundsHeight / height;
20827    const context = {
20828      coords: this._coords,
20829      colors: this._colors,
20830      offsetX: -offsetX,
20831      offsetY: -offsetY,
20832      scaleX: 1 / scaleX,
20833      scaleY: 1 / scaleY
20834    };
20835    const paddedWidth = width + BORDER_SIZE * 2;
20836    const paddedHeight = height + BORDER_SIZE * 2;
20837    const tmpCanvas = cachedCanvases.getCanvas("mesh", paddedWidth, paddedHeight, false);
20838    const tmpCtx = tmpCanvas.context;
20839    const data = tmpCtx.createImageData(width, height);
20840    if (backgroundColor) {
20841      const bytes = data.data;
20842      for (let i = 0, ii = bytes.length; i < ii; i += 4) {
20843        bytes[i] = backgroundColor[0];
20844        bytes[i + 1] = backgroundColor[1];
20845        bytes[i + 2] = backgroundColor[2];
20846        bytes[i + 3] = 255;
20847      }
20848    }
20849    for (const figure of this._figures) {
20850      drawFigure(data, figure, context);
20851    }
20852    tmpCtx.putImageData(data, BORDER_SIZE, BORDER_SIZE);
20853    const canvas = tmpCanvas.canvas;
20854    return {
20855      canvas,
20856      offsetX: offsetX - BORDER_SIZE * scaleX,
20857      offsetY: offsetY - BORDER_SIZE * scaleY,
20858      scaleX,
20859      scaleY
20860    };
20861  }
20862  getPattern(ctx, owner, inverse, pathType) {
20863    applyBoundingBox(ctx, this._bbox);
20864    let scale;
20865    if (pathType === PathType.SHADING) {
20866      scale = _util.Util.singularValueDecompose2dScale((0, _display_utils.getCurrentTransform)(ctx));
20867    } else {
20868      scale = _util.Util.singularValueDecompose2dScale(owner.baseTransform);
20869      if (this.matrix) {
20870        const matrixScale = _util.Util.singularValueDecompose2dScale(this.matrix);
20871        scale = [scale[0] * matrixScale[0], scale[1] * matrixScale[1]];
20872      }
20873    }
20874    const temporaryPatternCanvas = this._createMeshCanvas(scale, pathType === PathType.SHADING ? null : this._background, owner.cachedCanvases);
20875    if (pathType !== PathType.SHADING) {
20876      ctx.setTransform(...owner.baseTransform);
20877      if (this.matrix) {
20878        ctx.transform(...this.matrix);
20879      }
20880    }
20881    ctx.translate(temporaryPatternCanvas.offsetX, temporaryPatternCanvas.offsetY);
20882    ctx.scale(temporaryPatternCanvas.scaleX, temporaryPatternCanvas.scaleY);
20883    return ctx.createPattern(temporaryPatternCanvas.canvas, "no-repeat");
20884  }
20885}
20886class DummyShadingPattern extends BaseShadingPattern {
20887  getPattern() {
20888    return "hotpink";
20889  }
20890}
20891function getShadingPattern(IR) {
20892  switch (IR[0]) {
20893    case "RadialAxial":
20894      return new RadialAxialShadingPattern(IR);
20895    case "Mesh":
20896      return new MeshShadingPattern(IR);
20897    case "Dummy":
20898      return new DummyShadingPattern();
20899  }
20900  throw new Error(`Unknown IR type: ${IR[0]}`);
20901}
20902const PaintType = {
20903  COLORED: 1,
20904  UNCOLORED: 2
20905};
20906class TilingPattern {
20907  static MAX_PATTERN_SIZE = 3000;
20908  constructor(IR, color, ctx, canvasGraphicsFactory, baseTransform) {
20909    this.operatorList = IR[2];
20910    this.matrix = IR[3] || [1, 0, 0, 1, 0, 0];
20911    this.bbox = IR[4];
20912    this.xstep = IR[5];
20913    this.ystep = IR[6];
20914    this.paintType = IR[7];
20915    this.tilingType = IR[8];
20916    this.color = color;
20917    this.ctx = ctx;
20918    this.canvasGraphicsFactory = canvasGraphicsFactory;
20919    this.baseTransform = baseTransform;
20920  }
20921  createPatternCanvas(owner) {
20922    const operatorList = this.operatorList;
20923    const bbox = this.bbox;
20924    const xstep = this.xstep;
20925    const ystep = this.ystep;
20926    const paintType = this.paintType;
20927    const tilingType = this.tilingType;
20928    const color = this.color;
20929    const canvasGraphicsFactory = this.canvasGraphicsFactory;
20930    (0, _util.info)("TilingType: " + tilingType);
20931    const x0 = bbox[0],
20932      y0 = bbox[1],
20933      x1 = bbox[2],
20934      y1 = bbox[3];
20935    const matrixScale = _util.Util.singularValueDecompose2dScale(this.matrix);
20936    const curMatrixScale = _util.Util.singularValueDecompose2dScale(this.baseTransform);
20937    const combinedScale = [matrixScale[0] * curMatrixScale[0], matrixScale[1] * curMatrixScale[1]];
20938    const dimx = this.getSizeAndScale(xstep, this.ctx.canvas.width, combinedScale[0]);
20939    const dimy = this.getSizeAndScale(ystep, this.ctx.canvas.height, combinedScale[1]);
20940    const tmpCanvas = owner.cachedCanvases.getCanvas("pattern", dimx.size, dimy.size, true);
20941    const tmpCtx = tmpCanvas.context;
20942    const graphics = canvasGraphicsFactory.createCanvasGraphics(tmpCtx);
20943    graphics.groupLevel = owner.groupLevel;
20944    this.setFillAndStrokeStyleToContext(graphics, paintType, color);
20945    let adjustedX0 = x0;
20946    let adjustedY0 = y0;
20947    let adjustedX1 = x1;
20948    let adjustedY1 = y1;
20949    if (x0 < 0) {
20950      adjustedX0 = 0;
20951      adjustedX1 += Math.abs(x0);
20952    }
20953    if (y0 < 0) {
20954      adjustedY0 = 0;
20955      adjustedY1 += Math.abs(y0);
20956    }
20957    tmpCtx.translate(-(dimx.scale * adjustedX0), -(dimy.scale * adjustedY0));
20958    graphics.transform(dimx.scale, 0, 0, dimy.scale, 0, 0);
20959    tmpCtx.save();
20960    this.clipBbox(graphics, adjustedX0, adjustedY0, adjustedX1, adjustedY1);
20961    graphics.baseTransform = (0, _display_utils.getCurrentTransform)(graphics.ctx);
20962    graphics.executeOperatorList(operatorList);
20963    graphics.endDrawing();
20964    return {
20965      canvas: tmpCanvas.canvas,
20966      scaleX: dimx.scale,
20967      scaleY: dimy.scale,
20968      offsetX: adjustedX0,
20969      offsetY: adjustedY0
20970    };
20971  }
20972  getSizeAndScale(step, realOutputSize, scale) {
20973    step = Math.abs(step);
20974    const maxSize = Math.max(TilingPattern.MAX_PATTERN_SIZE, realOutputSize);
20975    let size = Math.ceil(step * scale);
20976    if (size >= maxSize) {
20977      size = maxSize;
20978    } else {
20979      scale = size / step;
20980    }
20981    return {
20982      scale,
20983      size
20984    };
20985  }
20986  clipBbox(graphics, x0, y0, x1, y1) {
20987    const bboxWidth = x1 - x0;
20988    const bboxHeight = y1 - y0;
20989    graphics.ctx.rect(x0, y0, bboxWidth, bboxHeight);
20990    graphics.current.updateRectMinMax((0, _display_utils.getCurrentTransform)(graphics.ctx), [x0, y0, x1, y1]);
20991    graphics.clip();
20992    graphics.endPath();
20993  }
20994  setFillAndStrokeStyleToContext(graphics, paintType, color) {
20995    const context = graphics.ctx,
20996      current = graphics.current;
20997    switch (paintType) {
20998      case PaintType.COLORED:
20999        const ctx = this.ctx;
21000        context.fillStyle = ctx.fillStyle;
21001        context.strokeStyle = ctx.strokeStyle;
21002        current.fillColor = ctx.fillStyle;
21003        current.strokeColor = ctx.strokeStyle;
21004        break;
21005      case PaintType.UNCOLORED:
21006        const cssColor = _util.Util.makeHexColor(color[0], color[1], color[2]);
21007        context.fillStyle = cssColor;
21008        context.strokeStyle = cssColor;
21009        current.fillColor = cssColor;
21010        current.strokeColor = cssColor;
21011        break;
21012      default:
21013        throw new _util.FormatError(`Unsupported paint type: ${paintType}`);
21014    }
21015  }
21016  getPattern(ctx, owner, inverse, pathType) {
21017    let matrix = inverse;
21018    if (pathType !== PathType.SHADING) {
21019      matrix = _util.Util.transform(matrix, owner.baseTransform);
21020      if (this.matrix) {
21021        matrix = _util.Util.transform(matrix, this.matrix);
21022      }
21023    }
21024    const temporaryPatternCanvas = this.createPatternCanvas(owner);
21025    let domMatrix = new DOMMatrix(matrix);
21026    domMatrix = domMatrix.translate(temporaryPatternCanvas.offsetX, temporaryPatternCanvas.offsetY);
21027    domMatrix = domMatrix.scale(1 / temporaryPatternCanvas.scaleX, 1 / temporaryPatternCanvas.scaleY);
21028    const pattern = ctx.createPattern(temporaryPatternCanvas.canvas, "repeat");
21029    pattern.setTransform(domMatrix);
21030    return pattern;
21031  }
21032}
21033exports.TilingPattern = TilingPattern;
21034
21035/***/ }),
21036/* 13 */
21037/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
21038
21039
21040
21041Object.defineProperty(exports, "__esModule", ({
21042  value: true
21043}));
21044exports.convertBlackAndWhiteToRGBA = convertBlackAndWhiteToRGBA;
21045exports.convertToRGBA = convertToRGBA;
21046exports.grayToRGBA = grayToRGBA;
21047var _util = __w_pdfjs_require__(1);
21048function convertToRGBA(params) {
21049  switch (params.kind) {
21050    case _util.ImageKind.GRAYSCALE_1BPP:
21051      return convertBlackAndWhiteToRGBA(params);
21052    case _util.ImageKind.RGB_24BPP:
21053      return convertRGBToRGBA(params);
21054  }
21055  return null;
21056}
21057function convertBlackAndWhiteToRGBA({
21058  src,
21059  srcPos = 0,
21060  dest,
21061  width,
21062  height,
21063  nonBlackColor = 0xffffffff,
21064  inverseDecode = false
21065}) {
21066  const black = _util.FeatureTest.isLittleEndian ? 0xff000000 : 0x000000ff;
21067  const [zeroMapping, oneMapping] = inverseDecode ? [nonBlackColor, black] : [black, nonBlackColor];
21068  const widthInSource = width >> 3;
21069  const widthRemainder = width & 7;
21070  const srcLength = src.length;
21071  dest = new Uint32Array(dest.buffer);
21072  let destPos = 0;
21073  for (let i = 0; i < height; i++) {
21074    for (const max = srcPos + widthInSource; srcPos < max; srcPos++) {
21075      const elem = srcPos < srcLength ? src[srcPos] : 255;
21076      dest[destPos++] = elem & 0b10000000 ? oneMapping : zeroMapping;
21077      dest[destPos++] = elem & 0b1000000 ? oneMapping : zeroMapping;
21078      dest[destPos++] = elem & 0b100000 ? oneMapping : zeroMapping;
21079      dest[destPos++] = elem & 0b10000 ? oneMapping : zeroMapping;
21080      dest[destPos++] = elem & 0b1000 ? oneMapping : zeroMapping;
21081      dest[destPos++] = elem & 0b100 ? oneMapping : zeroMapping;
21082      dest[destPos++] = elem & 0b10 ? oneMapping : zeroMapping;
21083      dest[destPos++] = elem & 0b1 ? oneMapping : zeroMapping;
21084    }
21085    if (widthRemainder === 0) {
21086      continue;
21087    }
21088    const elem = srcPos < srcLength ? src[srcPos++] : 255;
21089    for (let j = 0; j < widthRemainder; j++) {
21090      dest[destPos++] = elem & 1 << 7 - j ? oneMapping : zeroMapping;
21091    }
21092  }
21093  return {
21094    srcPos,
21095    destPos
21096  };
21097}
21098function convertRGBToRGBA({
21099  src,
21100  srcPos = 0,
21101  dest,
21102  destPos = 0,
21103  width,
21104  height
21105}) {
21106  let i = 0;
21107  const len32 = src.length >> 2;
21108  const src32 = new Uint32Array(src.buffer, srcPos, len32);
21109  if (_util.FeatureTest.isLittleEndian) {
21110    for (; i < len32 - 2; i += 3, destPos += 4) {
21111      const s1 = src32[i];
21112      const s2 = src32[i + 1];
21113      const s3 = src32[i + 2];
21114      dest[destPos] = s1 | 0xff000000;
21115      dest[destPos + 1] = s1 >>> 24 | s2 << 8 | 0xff000000;
21116      dest[destPos + 2] = s2 >>> 16 | s3 << 16 | 0xff000000;
21117      dest[destPos + 3] = s3 >>> 8 | 0xff000000;
21118    }
21119    for (let j = i * 4, jj = src.length; j < jj; j += 3) {
21120      dest[destPos++] = src[j] | src[j + 1] << 8 | src[j + 2] << 16 | 0xff000000;
21121    }
21122  } else {
21123    for (; i < len32 - 2; i += 3, destPos += 4) {
21124      const s1 = src32[i];
21125      const s2 = src32[i + 1];
21126      const s3 = src32[i + 2];
21127      dest[destPos] = s1 | 0xff;
21128      dest[destPos + 1] = s1 << 24 | s2 >>> 8 | 0xff;
21129      dest[destPos + 2] = s2 << 16 | s3 >>> 16 | 0xff;
21130      dest[destPos + 3] = s3 << 8 | 0xff;
21131    }
21132    for (let j = i * 4, jj = src.length; j < jj; j += 3) {
21133      dest[destPos++] = src[j] << 24 | src[j + 1] << 16 | src[j + 2] << 8 | 0xff;
21134    }
21135  }
21136  return {
21137    srcPos,
21138    destPos
21139  };
21140}
21141function grayToRGBA(src, dest) {
21142  if (_util.FeatureTest.isLittleEndian) {
21143    for (let i = 0, ii = src.length; i < ii; i++) {
21144      dest[i] = src[i] * 0x10101 | 0xff000000;
21145    }
21146  } else {
21147    for (let i = 0, ii = src.length; i < ii; i++) {
21148      dest[i] = src[i] * 0x1010100 | 0x000000ff;
21149    }
21150  }
21151}
21152
21153/***/ }),
21154/* 14 */
21155/***/ ((__unused_webpack_module, exports) => {
21156
21157
21158
21159Object.defineProperty(exports, "__esModule", ({
21160  value: true
21161}));
21162exports.GlobalWorkerOptions = void 0;
21163const GlobalWorkerOptions = Object.create(null);
21164exports.GlobalWorkerOptions = GlobalWorkerOptions;
21165GlobalWorkerOptions.workerPort = null;
21166GlobalWorkerOptions.workerSrc = "";
21167
21168/***/ }),
21169/* 15 */
21170/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
21171
21172
21173
21174Object.defineProperty(exports, "__esModule", ({
21175  value: true
21176}));
21177exports.MessageHandler = void 0;
21178var _util = __w_pdfjs_require__(1);
21179const CallbackKind = {
21180  UNKNOWN: 0,
21181  DATA: 1,
21182  ERROR: 2
21183};
21184const StreamKind = {
21185  UNKNOWN: 0,
21186  CANCEL: 1,
21187  CANCEL_COMPLETE: 2,
21188  CLOSE: 3,
21189  ENQUEUE: 4,
21190  ERROR: 5,
21191  PULL: 6,
21192  PULL_COMPLETE: 7,
21193  START_COMPLETE: 8
21194};
21195function wrapReason(reason) {
21196  if (!(reason instanceof Error || typeof reason === "object" && reason !== null)) {
21197    (0, _util.unreachable)('wrapReason: Expected "reason" to be a (possibly cloned) Error.');
21198  }
21199  switch (reason.name) {
21200    case "AbortException":
21201      return new _util.AbortException(reason.message);
21202    case "MissingPDFException":
21203      return new _util.MissingPDFException(reason.message);
21204    case "PasswordException":
21205      return new _util.PasswordException(reason.message, reason.code);
21206    case "UnexpectedResponseException":
21207      return new _util.UnexpectedResponseException(reason.message, reason.status);
21208    case "UnknownErrorException":
21209      return new _util.UnknownErrorException(reason.message, reason.details);
21210    default:
21211      return new _util.UnknownErrorException(reason.message, reason.toString());
21212  }
21213}
21214class MessageHandler {
21215  constructor(sourceName, targetName, comObj) {
21216    this.sourceName = sourceName;
21217    this.targetName = targetName;
21218    this.comObj = comObj;
21219    this.callbackId = 1;
21220    this.streamId = 1;
21221    this.streamSinks = Object.create(null);
21222    this.streamControllers = Object.create(null);
21223    this.callbackCapabilities = Object.create(null);
21224    this.actionHandler = Object.create(null);
21225    this._onComObjOnMessage = event => {
21226      const data = event.data;
21227      if (data.targetName !== this.sourceName) {
21228        return;
21229      }
21230      if (data.stream) {
21231        this.#processStreamMessage(data);
21232        return;
21233      }
21234      if (data.callback) {
21235        const callbackId = data.callbackId;
21236        const capability = this.callbackCapabilities[callbackId];
21237        if (!capability) {
21238          throw new Error(`Cannot resolve callback ${callbackId}`);
21239        }
21240        delete this.callbackCapabilities[callbackId];
21241        if (data.callback === CallbackKind.DATA) {
21242          capability.resolve(data.data);
21243        } else if (data.callback === CallbackKind.ERROR) {
21244          capability.reject(wrapReason(data.reason));
21245        } else {
21246          throw new Error("Unexpected callback case");
21247        }
21248        return;
21249      }
21250      const action = this.actionHandler[data.action];
21251      if (!action) {
21252        throw new Error(`Unknown action from worker: ${data.action}`);
21253      }
21254      if (data.callbackId) {
21255        const cbSourceName = this.sourceName;
21256        const cbTargetName = data.sourceName;
21257        new Promise(function (resolve) {
21258          resolve(action(data.data));
21259        }).then(function (result) {
21260          comObj.postMessage({
21261            sourceName: cbSourceName,
21262            targetName: cbTargetName,
21263            callback: CallbackKind.DATA,
21264            callbackId: data.callbackId,
21265            data: result
21266          });
21267        }, function (reason) {
21268          comObj.postMessage({
21269            sourceName: cbSourceName,
21270            targetName: cbTargetName,
21271            callback: CallbackKind.ERROR,
21272            callbackId: data.callbackId,
21273            reason: wrapReason(reason)
21274          });
21275        });
21276        return;
21277      }
21278      if (data.streamId) {
21279        this.#createStreamSink(data);
21280        return;
21281      }
21282      action(data.data);
21283    };
21284    comObj.addEventListener("message", this._onComObjOnMessage);
21285  }
21286  on(actionName, handler) {
21287    const ah = this.actionHandler;
21288    if (ah[actionName]) {
21289      throw new Error(`There is already an actionName called "${actionName}"`);
21290    }
21291    ah[actionName] = handler;
21292  }
21293  send(actionName, data, transfers) {
21294    this.comObj.postMessage({
21295      sourceName: this.sourceName,
21296      targetName: this.targetName,
21297      action: actionName,
21298      data
21299    }, transfers);
21300  }
21301  sendWithPromise(actionName, data, transfers) {
21302    const callbackId = this.callbackId++;
21303    const capability = new _util.PromiseCapability();
21304    this.callbackCapabilities[callbackId] = capability;
21305    try {
21306      this.comObj.postMessage({
21307        sourceName: this.sourceName,
21308        targetName: this.targetName,
21309        action: actionName,
21310        callbackId,
21311        data
21312      }, transfers);
21313    } catch (ex) {
21314      capability.reject(ex);
21315    }
21316    return capability.promise;
21317  }
21318  sendWithStream(actionName, data, queueingStrategy, transfers) {
21319    const streamId = this.streamId++,
21320      sourceName = this.sourceName,
21321      targetName = this.targetName,
21322      comObj = this.comObj;
21323    return new ReadableStream({
21324      start: controller => {
21325        const startCapability = new _util.PromiseCapability();
21326        this.streamControllers[streamId] = {
21327          controller,
21328          startCall: startCapability,
21329          pullCall: null,
21330          cancelCall: null,
21331          isClosed: false
21332        };
21333        comObj.postMessage({
21334          sourceName,
21335          targetName,
21336          action: actionName,
21337          streamId,
21338          data,
21339          desiredSize: controller.desiredSize
21340        }, transfers);
21341        return startCapability.promise;
21342      },
21343      pull: controller => {
21344        const pullCapability = new _util.PromiseCapability();
21345        this.streamControllers[streamId].pullCall = pullCapability;
21346        comObj.postMessage({
21347          sourceName,
21348          targetName,
21349          stream: StreamKind.PULL,
21350          streamId,
21351          desiredSize: controller.desiredSize
21352        });
21353        return pullCapability.promise;
21354      },
21355      cancel: reason => {
21356        (0, _util.assert)(reason instanceof Error, "cancel must have a valid reason");
21357        const cancelCapability = new _util.PromiseCapability();
21358        this.streamControllers[streamId].cancelCall = cancelCapability;
21359        this.streamControllers[streamId].isClosed = true;
21360        comObj.postMessage({
21361          sourceName,
21362          targetName,
21363          stream: StreamKind.CANCEL,
21364          streamId,
21365          reason: wrapReason(reason)
21366        });
21367        return cancelCapability.promise;
21368      }
21369    }, queueingStrategy);
21370  }
21371  #createStreamSink(data) {
21372    const streamId = data.streamId,
21373      sourceName = this.sourceName,
21374      targetName = data.sourceName,
21375      comObj = this.comObj;
21376    const self = this,
21377      action = this.actionHandler[data.action];
21378    const streamSink = {
21379      enqueue(chunk, size = 1, transfers) {
21380        if (this.isCancelled) {
21381          return;
21382        }
21383        const lastDesiredSize = this.desiredSize;
21384        this.desiredSize -= size;
21385        if (lastDesiredSize > 0 && this.desiredSize <= 0) {
21386          this.sinkCapability = new _util.PromiseCapability();
21387          this.ready = this.sinkCapability.promise;
21388        }
21389        comObj.postMessage({
21390          sourceName,
21391          targetName,
21392          stream: StreamKind.ENQUEUE,
21393          streamId,
21394          chunk
21395        }, transfers);
21396      },
21397      close() {
21398        if (this.isCancelled) {
21399          return;
21400        }
21401        this.isCancelled = true;
21402        comObj.postMessage({
21403          sourceName,
21404          targetName,
21405          stream: StreamKind.CLOSE,
21406          streamId
21407        });
21408        delete self.streamSinks[streamId];
21409      },
21410      error(reason) {
21411        (0, _util.assert)(reason instanceof Error, "error must have a valid reason");
21412        if (this.isCancelled) {
21413          return;
21414        }
21415        this.isCancelled = true;
21416        comObj.postMessage({
21417          sourceName,
21418          targetName,
21419          stream: StreamKind.ERROR,
21420          streamId,
21421          reason: wrapReason(reason)
21422        });
21423      },
21424      sinkCapability: new _util.PromiseCapability(),
21425      onPull: null,
21426      onCancel: null,
21427      isCancelled: false,
21428      desiredSize: data.desiredSize,
21429      ready: null
21430    };
21431    streamSink.sinkCapability.resolve();
21432    streamSink.ready = streamSink.sinkCapability.promise;
21433    this.streamSinks[streamId] = streamSink;
21434    new Promise(function (resolve) {
21435      resolve(action(data.data, streamSink));
21436    }).then(function () {
21437      comObj.postMessage({
21438        sourceName,
21439        targetName,
21440        stream: StreamKind.START_COMPLETE,
21441        streamId,
21442        success: true
21443      });
21444    }, function (reason) {
21445      comObj.postMessage({
21446        sourceName,
21447        targetName,
21448        stream: StreamKind.START_COMPLETE,
21449        streamId,
21450        reason: wrapReason(reason)
21451      });
21452    });
21453  }
21454  #processStreamMessage(data) {
21455    const streamId = data.streamId,
21456      sourceName = this.sourceName,
21457      targetName = data.sourceName,
21458      comObj = this.comObj;
21459    const streamController = this.streamControllers[streamId],
21460      streamSink = this.streamSinks[streamId];
21461    switch (data.stream) {
21462      case StreamKind.START_COMPLETE:
21463        if (data.success) {
21464          streamController.startCall.resolve();
21465        } else {
21466          streamController.startCall.reject(wrapReason(data.reason));
21467        }
21468        break;
21469      case StreamKind.PULL_COMPLETE:
21470        if (data.success) {
21471          streamController.pullCall.resolve();
21472        } else {
21473          streamController.pullCall.reject(wrapReason(data.reason));
21474        }
21475        break;
21476      case StreamKind.PULL:
21477        if (!streamSink) {
21478          comObj.postMessage({
21479            sourceName,
21480            targetName,
21481            stream: StreamKind.PULL_COMPLETE,
21482            streamId,
21483            success: true
21484          });
21485          break;
21486        }
21487        if (streamSink.desiredSize <= 0 && data.desiredSize > 0) {
21488          streamSink.sinkCapability.resolve();
21489        }
21490        streamSink.desiredSize = data.desiredSize;
21491        new Promise(function (resolve) {
21492          resolve(streamSink.onPull?.());
21493        }).then(function () {
21494          comObj.postMessage({
21495            sourceName,
21496            targetName,
21497            stream: StreamKind.PULL_COMPLETE,
21498            streamId,
21499            success: true
21500          });
21501        }, function (reason) {
21502          comObj.postMessage({
21503            sourceName,
21504            targetName,
21505            stream: StreamKind.PULL_COMPLETE,
21506            streamId,
21507            reason: wrapReason(reason)
21508          });
21509        });
21510        break;
21511      case StreamKind.ENQUEUE:
21512        (0, _util.assert)(streamController, "enqueue should have stream controller");
21513        if (streamController.isClosed) {
21514          break;
21515        }
21516        streamController.controller.enqueue(data.chunk);
21517        break;
21518      case StreamKind.CLOSE:
21519        (0, _util.assert)(streamController, "close should have stream controller");
21520        if (streamController.isClosed) {
21521          break;
21522        }
21523        streamController.isClosed = true;
21524        streamController.controller.close();
21525        this.#deleteStreamController(streamController, streamId);
21526        break;
21527      case StreamKind.ERROR:
21528        (0, _util.assert)(streamController, "error should have stream controller");
21529        streamController.controller.error(wrapReason(data.reason));
21530        this.#deleteStreamController(streamController, streamId);
21531        break;
21532      case StreamKind.CANCEL_COMPLETE:
21533        if (data.success) {
21534          streamController.cancelCall.resolve();
21535        } else {
21536          streamController.cancelCall.reject(wrapReason(data.reason));
21537        }
21538        this.#deleteStreamController(streamController, streamId);
21539        break;
21540      case StreamKind.CANCEL:
21541        if (!streamSink) {
21542          break;
21543        }
21544        new Promise(function (resolve) {
21545          resolve(streamSink.onCancel?.(wrapReason(data.reason)));
21546        }).then(function () {
21547          comObj.postMessage({
21548            sourceName,
21549            targetName,
21550            stream: StreamKind.CANCEL_COMPLETE,
21551            streamId,
21552            success: true
21553          });
21554        }, function (reason) {
21555          comObj.postMessage({
21556            sourceName,
21557            targetName,
21558            stream: StreamKind.CANCEL_COMPLETE,
21559            streamId,
21560            reason: wrapReason(reason)
21561          });
21562        });
21563        streamSink.sinkCapability.reject(wrapReason(data.reason));
21564        streamSink.isCancelled = true;
21565        delete this.streamSinks[streamId];
21566        break;
21567      default:
21568        throw new Error("Unexpected stream case");
21569    }
21570  }
21571  async #deleteStreamController(streamController, streamId) {
21572    await Promise.allSettled([streamController.startCall?.promise, streamController.pullCall?.promise, streamController.cancelCall?.promise]);
21573    delete this.streamControllers[streamId];
21574  }
21575  destroy() {
21576    this.comObj.removeEventListener("message", this._onComObjOnMessage);
21577  }
21578}
21579exports.MessageHandler = MessageHandler;
21580
21581/***/ }),
21582/* 16 */
21583/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
21584
21585
21586
21587Object.defineProperty(exports, "__esModule", ({
21588  value: true
21589}));
21590exports.Metadata = void 0;
21591var _util = __w_pdfjs_require__(1);
21592class Metadata {
21593  #metadataMap;
21594  #data;
21595  constructor({
21596    parsedData,
21597    rawData
21598  }) {
21599    this.#metadataMap = parsedData;
21600    this.#data = rawData;
21601  }
21602  getRaw() {
21603    return this.#data;
21604  }
21605  get(name) {
21606    return this.#metadataMap.get(name) ?? null;
21607  }
21608  getAll() {
21609    return (0, _util.objectFromMap)(this.#metadataMap);
21610  }
21611  has(name) {
21612    return this.#metadataMap.has(name);
21613  }
21614}
21615exports.Metadata = Metadata;
21616
21617/***/ }),
21618/* 17 */
21619/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
21620
21621
21622
21623Object.defineProperty(exports, "__esModule", ({
21624  value: true
21625}));
21626exports.OptionalContentConfig = void 0;
21627var _util = __w_pdfjs_require__(1);
21628var _murmurhash = __w_pdfjs_require__(8);
21629const INTERNAL = Symbol("INTERNAL");
21630class OptionalContentGroup {
21631  #visible = true;
21632  constructor(name, intent) {
21633    this.name = name;
21634    this.intent = intent;
21635  }
21636  get visible() {
21637    return this.#visible;
21638  }
21639  _setVisible(internal, visible) {
21640    if (internal !== INTERNAL) {
21641      (0, _util.unreachable)("Internal method `_setVisible` called.");
21642    }
21643    this.#visible = visible;
21644  }
21645}
21646class OptionalContentConfig {
21647  #cachedGetHash = null;
21648  #groups = new Map();
21649  #initialHash = null;
21650  #order = null;
21651  constructor(data) {
21652    this.name = null;
21653    this.creator = null;
21654    if (data === null) {
21655      return;
21656    }
21657    this.name = data.name;
21658    this.creator = data.creator;
21659    this.#order = data.order;
21660    for (const group of data.groups) {
21661      this.#groups.set(group.id, new OptionalContentGroup(group.name, group.intent));
21662    }
21663    if (data.baseState === "OFF") {
21664      for (const group of this.#groups.values()) {
21665        group._setVisible(INTERNAL, false);
21666      }
21667    }
21668    for (const on of data.on) {
21669      this.#groups.get(on)._setVisible(INTERNAL, true);
21670    }
21671    for (const off of data.off) {
21672      this.#groups.get(off)._setVisible(INTERNAL, false);
21673    }
21674    this.#initialHash = this.getHash();
21675  }
21676  #evaluateVisibilityExpression(array) {
21677    const length = array.length;
21678    if (length < 2) {
21679      return true;
21680    }
21681    const operator = array[0];
21682    for (let i = 1; i < length; i++) {
21683      const element = array[i];
21684      let state;
21685      if (Array.isArray(element)) {
21686        state = this.#evaluateVisibilityExpression(element);
21687      } else if (this.#groups.has(element)) {
21688        state = this.#groups.get(element).visible;
21689      } else {
21690        (0, _util.warn)(`Optional content group not found: ${element}`);
21691        return true;
21692      }
21693      switch (operator) {
21694        case "And":
21695          if (!state) {
21696            return false;
21697          }
21698          break;
21699        case "Or":
21700          if (state) {
21701            return true;
21702          }
21703          break;
21704        case "Not":
21705          return !state;
21706        default:
21707          return true;
21708      }
21709    }
21710    return operator === "And";
21711  }
21712  isVisible(group) {
21713    if (this.#groups.size === 0) {
21714      return true;
21715    }
21716    if (!group) {
21717      (0, _util.warn)("Optional content group not defined.");
21718      return true;
21719    }
21720    if (group.type === "OCG") {
21721      if (!this.#groups.has(group.id)) {
21722        (0, _util.warn)(`Optional content group not found: ${group.id}`);
21723        return true;
21724      }
21725      return this.#groups.get(group.id).visible;
21726    } else if (group.type === "OCMD") {
21727      if (group.expression) {
21728        return this.#evaluateVisibilityExpression(group.expression);
21729      }
21730      if (!group.policy || group.policy === "AnyOn") {
21731        for (const id of group.ids) {
21732          if (!this.#groups.has(id)) {
21733            (0, _util.warn)(`Optional content group not found: ${id}`);
21734            return true;
21735          }
21736          if (this.#groups.get(id).visible) {
21737            return true;
21738          }
21739        }
21740        return false;
21741      } else if (group.policy === "AllOn") {
21742        for (const id of group.ids) {
21743          if (!this.#groups.has(id)) {
21744            (0, _util.warn)(`Optional content group not found: ${id}`);
21745            return true;
21746          }
21747          if (!this.#groups.get(id).visible) {
21748            return false;
21749          }
21750        }
21751        return true;
21752      } else if (group.policy === "AnyOff") {
21753        for (const id of group.ids) {
21754          if (!this.#groups.has(id)) {
21755            (0, _util.warn)(`Optional content group not found: ${id}`);
21756            return true;
21757          }
21758          if (!this.#groups.get(id).visible) {
21759            return true;
21760          }
21761        }
21762        return false;
21763      } else if (group.policy === "AllOff") {
21764        for (const id of group.ids) {
21765          if (!this.#groups.has(id)) {
21766            (0, _util.warn)(`Optional content group not found: ${id}`);
21767            return true;
21768          }
21769          if (this.#groups.get(id).visible) {
21770            return false;
21771          }
21772        }
21773        return true;
21774      }
21775      (0, _util.warn)(`Unknown optional content policy ${group.policy}.`);
21776      return true;
21777    }
21778    (0, _util.warn)(`Unknown group type ${group.type}.`);
21779    return true;
21780  }
21781  setVisibility(id, visible = true) {
21782    if (!this.#groups.has(id)) {
21783      (0, _util.warn)(`Optional content group not found: ${id}`);
21784      return;
21785    }
21786    this.#groups.get(id)._setVisible(INTERNAL, !!visible);
21787    this.#cachedGetHash = null;
21788  }
21789  get hasInitialVisibility() {
21790    return this.#initialHash === null || this.getHash() === this.#initialHash;
21791  }
21792  getOrder() {
21793    if (!this.#groups.size) {
21794      return null;
21795    }
21796    if (this.#order) {
21797      return this.#order.slice();
21798    }
21799    return [...this.#groups.keys()];
21800  }
21801  getGroups() {
21802    return this.#groups.size > 0 ? (0, _util.objectFromMap)(this.#groups) : null;
21803  }
21804  getGroup(id) {
21805    return this.#groups.get(id) || null;
21806  }
21807  getHash() {
21808    if (this.#cachedGetHash !== null) {
21809      return this.#cachedGetHash;
21810    }
21811    const hash = new _murmurhash.MurmurHash3_64();
21812    for (const [id, group] of this.#groups) {
21813      hash.update(`${id}:${group.visible}`);
21814    }
21815    return this.#cachedGetHash = hash.hexdigest();
21816  }
21817}
21818exports.OptionalContentConfig = OptionalContentConfig;
21819
21820/***/ }),
21821/* 18 */
21822/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
21823
21824
21825
21826Object.defineProperty(exports, "__esModule", ({
21827  value: true
21828}));
21829exports.PDFDataTransportStream = void 0;
21830var _util = __w_pdfjs_require__(1);
21831var _display_utils = __w_pdfjs_require__(6);
21832class PDFDataTransportStream {
21833  constructor({
21834    length,
21835    initialData,
21836    progressiveDone = false,
21837    contentDispositionFilename = null,
21838    disableRange = false,
21839    disableStream = false
21840  }, pdfDataRangeTransport) {
21841    (0, _util.assert)(pdfDataRangeTransport, 'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');
21842    this._queuedChunks = [];
21843    this._progressiveDone = progressiveDone;
21844    this._contentDispositionFilename = contentDispositionFilename;
21845    if (initialData?.length > 0) {
21846      const buffer = initialData instanceof Uint8Array && initialData.byteLength === initialData.buffer.byteLength ? initialData.buffer : new Uint8Array(initialData).buffer;
21847      this._queuedChunks.push(buffer);
21848    }
21849    this._pdfDataRangeTransport = pdfDataRangeTransport;
21850    this._isStreamingSupported = !disableStream;
21851    this._isRangeSupported = !disableRange;
21852    this._contentLength = length;
21853    this._fullRequestReader = null;
21854    this._rangeReaders = [];
21855    this._pdfDataRangeTransport.addRangeListener((begin, chunk) => {
21856      this._onReceiveData({
21857        begin,
21858        chunk
21859      });
21860    });
21861    this._pdfDataRangeTransport.addProgressListener((loaded, total) => {
21862      this._onProgress({
21863        loaded,
21864        total
21865      });
21866    });
21867    this._pdfDataRangeTransport.addProgressiveReadListener(chunk => {
21868      this._onReceiveData({
21869        chunk
21870      });
21871    });
21872    this._pdfDataRangeTransport.addProgressiveDoneListener(() => {
21873      this._onProgressiveDone();
21874    });
21875    this._pdfDataRangeTransport.transportReady();
21876  }
21877  _onReceiveData({
21878    begin,
21879    chunk
21880  }) {
21881    const buffer = chunk instanceof Uint8Array && chunk.byteLength === chunk.buffer.byteLength ? chunk.buffer : new Uint8Array(chunk).buffer;
21882    if (begin === undefined) {
21883      if (this._fullRequestReader) {
21884        this._fullRequestReader._enqueue(buffer);
21885      } else {
21886        this._queuedChunks.push(buffer);
21887      }
21888    } else {
21889      const found = this._rangeReaders.some(function (rangeReader) {
21890        if (rangeReader._begin !== begin) {
21891          return false;
21892        }
21893        rangeReader._enqueue(buffer);
21894        return true;
21895      });
21896      (0, _util.assert)(found, "_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.");
21897    }
21898  }
21899  get _progressiveDataLength() {
21900    return this._fullRequestReader?._loaded ?? 0;
21901  }
21902  _onProgress(evt) {
21903    if (evt.total === undefined) {
21904      this._rangeReaders[0]?.onProgress?.({
21905        loaded: evt.loaded
21906      });
21907    } else {
21908      this._fullRequestReader?.onProgress?.({
21909        loaded: evt.loaded,
21910        total: evt.total
21911      });
21912    }
21913  }
21914  _onProgressiveDone() {
21915    this._fullRequestReader?.progressiveDone();
21916    this._progressiveDone = true;
21917  }
21918  _removeRangeReader(reader) {
21919    const i = this._rangeReaders.indexOf(reader);
21920    if (i >= 0) {
21921      this._rangeReaders.splice(i, 1);
21922    }
21923  }
21924  getFullReader() {
21925    (0, _util.assert)(!this._fullRequestReader, "PDFDataTransportStream.getFullReader can only be called once.");
21926    const queuedChunks = this._queuedChunks;
21927    this._queuedChunks = null;
21928    return new PDFDataTransportStreamReader(this, queuedChunks, this._progressiveDone, this._contentDispositionFilename);
21929  }
21930  getRangeReader(begin, end) {
21931    if (end <= this._progressiveDataLength) {
21932      return null;
21933    }
21934    const reader = new PDFDataTransportStreamRangeReader(this, begin, end);
21935    this._pdfDataRangeTransport.requestDataRange(begin, end);
21936    this._rangeReaders.push(reader);
21937    return reader;
21938  }
21939  cancelAllRequests(reason) {
21940    this._fullRequestReader?.cancel(reason);
21941    for (const reader of this._rangeReaders.slice(0)) {
21942      reader.cancel(reason);
21943    }
21944    this._pdfDataRangeTransport.abort();
21945  }
21946}
21947exports.PDFDataTransportStream = PDFDataTransportStream;
21948class PDFDataTransportStreamReader {
21949  constructor(stream, queuedChunks, progressiveDone = false, contentDispositionFilename = null) {
21950    this._stream = stream;
21951    this._done = progressiveDone || false;
21952    this._filename = (0, _display_utils.isPdfFile)(contentDispositionFilename) ? contentDispositionFilename : null;
21953    this._queuedChunks = queuedChunks || [];
21954    this._loaded = 0;
21955    for (const chunk of this._queuedChunks) {
21956      this._loaded += chunk.byteLength;
21957    }
21958    this._requests = [];
21959    this._headersReady = Promise.resolve();
21960    stream._fullRequestReader = this;
21961    this.onProgress = null;
21962  }
21963  _enqueue(chunk) {
21964    if (this._done) {
21965      return;
21966    }
21967    if (this._requests.length > 0) {
21968      const requestCapability = this._requests.shift();
21969      requestCapability.resolve({
21970        value: chunk,
21971        done: false
21972      });
21973    } else {
21974      this._queuedChunks.push(chunk);
21975    }
21976    this._loaded += chunk.byteLength;
21977  }
21978  get headersReady() {
21979    return this._headersReady;
21980  }
21981  get filename() {
21982    return this._filename;
21983  }
21984  get isRangeSupported() {
21985    return this._stream._isRangeSupported;
21986  }
21987  get isStreamingSupported() {
21988    return this._stream._isStreamingSupported;
21989  }
21990  get contentLength() {
21991    return this._stream._contentLength;
21992  }
21993  async read() {
21994    if (this._queuedChunks.length > 0) {
21995      const chunk = this._queuedChunks.shift();
21996      return {
21997        value: chunk,
21998        done: false
21999      };
22000    }
22001    if (this._done) {
22002      return {
22003        value: undefined,
22004        done: true
22005      };
22006    }
22007    const requestCapability = new _util.PromiseCapability();
22008    this._requests.push(requestCapability);
22009    return requestCapability.promise;
22010  }
22011  cancel(reason) {
22012    this._done = true;
22013    for (const requestCapability of this._requests) {
22014      requestCapability.resolve({
22015        value: undefined,
22016        done: true
22017      });
22018    }
22019    this._requests.length = 0;
22020  }
22021  progressiveDone() {
22022    if (this._done) {
22023      return;
22024    }
22025    this._done = true;
22026  }
22027}
22028class PDFDataTransportStreamRangeReader {
22029  constructor(stream, begin, end) {
22030    this._stream = stream;
22031    this._begin = begin;
22032    this._end = end;
22033    this._queuedChunk = null;
22034    this._requests = [];
22035    this._done = false;
22036    this.onProgress = null;
22037  }
22038  _enqueue(chunk) {
22039    if (this._done) {
22040      return;
22041    }
22042    if (this._requests.length === 0) {
22043      this._queuedChunk = chunk;
22044    } else {
22045      const requestsCapability = this._requests.shift();
22046      requestsCapability.resolve({
22047        value: chunk,
22048        done: false
22049      });
22050      for (const requestCapability of this._requests) {
22051        requestCapability.resolve({
22052          value: undefined,
22053          done: true
22054        });
22055      }
22056      this._requests.length = 0;
22057    }
22058    this._done = true;
22059    this._stream._removeRangeReader(this);
22060  }
22061  get isStreamingSupported() {
22062    return false;
22063  }
22064  async read() {
22065    if (this._queuedChunk) {
22066      const chunk = this._queuedChunk;
22067      this._queuedChunk = null;
22068      return {
22069        value: chunk,
22070        done: false
22071      };
22072    }
22073    if (this._done) {
22074      return {
22075        value: undefined,
22076        done: true
22077      };
22078    }
22079    const requestCapability = new _util.PromiseCapability();
22080    this._requests.push(requestCapability);
22081    return requestCapability.promise;
22082  }
22083  cancel(reason) {
22084    this._done = true;
22085    for (const requestCapability of this._requests) {
22086      requestCapability.resolve({
22087        value: undefined,
22088        done: true
22089      });
22090    }
22091    this._requests.length = 0;
22092    this._stream._removeRangeReader(this);
22093  }
22094}
22095
22096/***/ }),
22097/* 19 */
22098/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
22099
22100
22101
22102Object.defineProperty(exports, "__esModule", ({
22103  value: true
22104}));
22105exports.PDFFetchStream = void 0;
22106var _util = __w_pdfjs_require__(1);
22107var _network_utils = __w_pdfjs_require__(20);
22108;
22109function createFetchOptions(headers, withCredentials, abortController) {
22110  return {
22111    method: "GET",
22112    headers,
22113    signal: abortController.signal,
22114    mode: "cors",
22115    credentials: withCredentials ? "include" : "same-origin",
22116    redirect: "follow"
22117  };
22118}
22119function createHeaders(httpHeaders) {
22120  const headers = new Headers();
22121  for (const property in httpHeaders) {
22122    const value = httpHeaders[property];
22123    if (value === undefined) {
22124      continue;
22125    }
22126    headers.append(property, value);
22127  }
22128  return headers;
22129}
22130function getArrayBuffer(val) {
22131  if (val instanceof Uint8Array) {
22132    return val.buffer;
22133  }
22134  if (val instanceof ArrayBuffer) {
22135    return val;
22136  }
22137  (0, _util.warn)(`getArrayBuffer - unexpected data format: ${val}`);
22138  return new Uint8Array(val).buffer;
22139}
22140class PDFFetchStream {
22141  constructor(source) {
22142    this.source = source;
22143    this.isHttp = /^https?:/i.test(source.url);
22144    this.httpHeaders = this.isHttp && source.httpHeaders || {};
22145    this._fullRequestReader = null;
22146    this._rangeRequestReaders = [];
22147  }
22148  get _progressiveDataLength() {
22149    return this._fullRequestReader?._loaded ?? 0;
22150  }
22151  getFullReader() {
22152    (0, _util.assert)(!this._fullRequestReader, "PDFFetchStream.getFullReader can only be called once.");
22153    this._fullRequestReader = new PDFFetchStreamReader(this);
22154    return this._fullRequestReader;
22155  }
22156  getRangeReader(begin, end) {
22157    if (end <= this._progressiveDataLength) {
22158      return null;
22159    }
22160    const reader = new PDFFetchStreamRangeReader(this, begin, end);
22161    this._rangeRequestReaders.push(reader);
22162    return reader;
22163  }
22164  cancelAllRequests(reason) {
22165    this._fullRequestReader?.cancel(reason);
22166    for (const reader of this._rangeRequestReaders.slice(0)) {
22167      reader.cancel(reason);
22168    }
22169  }
22170}
22171exports.PDFFetchStream = PDFFetchStream;
22172class PDFFetchStreamReader {
22173  constructor(stream) {
22174    this._stream = stream;
22175    this._reader = null;
22176    this._loaded = 0;
22177    this._filename = null;
22178    const source = stream.source;
22179    this._withCredentials = source.withCredentials || false;
22180    this._contentLength = source.length;
22181    this._headersCapability = new _util.PromiseCapability();
22182    this._disableRange = source.disableRange || false;
22183    this._rangeChunkSize = source.rangeChunkSize;
22184    if (!this._rangeChunkSize && !this._disableRange) {
22185      this._disableRange = true;
22186    }
22187    this._abortController = new AbortController();
22188    this._isStreamingSupported = !source.disableStream;
22189    this._isRangeSupported = !source.disableRange;
22190    this._headers = createHeaders(this._stream.httpHeaders);
22191    const url = source.url;
22192    fetch(url, createFetchOptions(this._headers, this._withCredentials, this._abortController)).then(response => {
22193      if (!(0, _network_utils.validateResponseStatus)(response.status)) {
22194        throw (0, _network_utils.createResponseStatusError)(response.status, url);
22195      }
22196      this._reader = response.body.getReader();
22197      this._headersCapability.resolve();
22198      const getResponseHeader = name => {
22199        return response.headers.get(name);
22200      };
22201      const {
22202        allowRangeRequests,
22203        suggestedLength
22204      } = (0, _network_utils.validateRangeRequestCapabilities)({
22205        getResponseHeader,
22206        isHttp: this._stream.isHttp,
22207        rangeChunkSize: this._rangeChunkSize,
22208        disableRange: this._disableRange
22209      });
22210      this._isRangeSupported = allowRangeRequests;
22211      this._contentLength = suggestedLength || this._contentLength;
22212      this._filename = (0, _network_utils.extractFilenameFromHeader)(getResponseHeader);
22213      if (!this._isStreamingSupported && this._isRangeSupported) {
22214        this.cancel(new _util.AbortException("Streaming is disabled."));
22215      }
22216    }).catch(this._headersCapability.reject);
22217    this.onProgress = null;
22218  }
22219  get headersReady() {
22220    return this._headersCapability.promise;
22221  }
22222  get filename() {
22223    return this._filename;
22224  }
22225  get contentLength() {
22226    return this._contentLength;
22227  }
22228  get isRangeSupported() {
22229    return this._isRangeSupported;
22230  }
22231  get isStreamingSupported() {
22232    return this._isStreamingSupported;
22233  }
22234  async read() {
22235    await this._headersCapability.promise;
22236    const {
22237      value,
22238      done
22239    } = await this._reader.read();
22240    if (done) {
22241      return {
22242        value,
22243        done
22244      };
22245    }
22246    this._loaded += value.byteLength;
22247    this.onProgress?.({
22248      loaded: this._loaded,
22249      total: this._contentLength
22250    });
22251    return {
22252      value: getArrayBuffer(value),
22253      done: false
22254    };
22255  }
22256  cancel(reason) {
22257    this._reader?.cancel(reason);
22258    this._abortController.abort();
22259  }
22260}
22261class PDFFetchStreamRangeReader {
22262  constructor(stream, begin, end) {
22263    this._stream = stream;
22264    this._reader = null;
22265    this._loaded = 0;
22266    const source = stream.source;
22267    this._withCredentials = source.withCredentials || false;
22268    this._readCapability = new _util.PromiseCapability();
22269    this._isStreamingSupported = !source.disableStream;
22270    this._abortController = new AbortController();
22271    this._headers = createHeaders(this._stream.httpHeaders);
22272    this._headers.append("Range", `bytes=${begin}
22272-${end - 1}`);
22273    const url = source.url;
22274    fetch(url, createFetchOptions(this._headers, this._withCredentials, this._abortController)).then(response => {
22275      if (!(0, _network_utils.validateResponseStatus)(response.status)) {
22276        throw (0, _network_utils.createResponseStatusError)(response.status, url);
22277      }
22278      this._readCapability.resolve();
22279      this._reader = response.body.getReader();
22280    }).catch(this._readCapability.reject);
22281    this.onProgress = null;
22282  }
22283  get isStreamingSupported() {
22284    return this._isStreamingSupported;
22285  }
22286  async read() {
22287    await this._readCapability.promise;
22288    const {
22289      value,
22290      done
22291    } = await this._reader.read();
22292    if (done) {
22293      return {
22294        value,
22295        done
22296      };
22297    }
22298    this._loaded += value.byteLength;
22299    this.onProgress?.({
22300      loaded: this._loaded
22301    });
22302    return {
22303      value: getArrayBuffer(value),
22304      done: false
22305    };
22306  }
22307  cancel(reason) {
22308    this._reader?.cancel(reason);
22309    this._abortController.abort();
22310  }
22311}
22312
22313/***/ }),
22314/* 20 */
22315/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
22316
22317
22318
22319Object.defineProperty(exports, "__esModule", ({
22320  value: true
22321}));
22322exports.createResponseStatusError = createResponseStatusError;
22323exports.extractFilenameFromHeader = extractFilenameFromHeader;
22324exports.validateRangeRequestCapabilities = validateRangeRequestCapabilities;
22325exports.validateResponseStatus = validateResponseStatus;
22326var _util = __w_pdfjs_require__(1);
22327var _content_disposition = __w_pdfjs_require__(21);
22328var _display_utils = __w_pdfjs_require__(6);
22329function validateRangeRequestCapabilities({
22330  getResponseHeader,
22331  isHttp,
22332  rangeChunkSize,
22333  disableRange
22334}) {
22335  const returnValues = {
22336    allowRangeRequests: false,
22337    suggestedLength: undefined
22338  };
22339  const length = parseInt(getResponseHeader("Content-Length"), 10);
22340  if (!Number.isInteger(length)) {
22341    return returnValues;
22342  }
22343  returnValues.suggestedLength = length;
22344  if (length <= 2 * rangeChunkSize) {
22345    return returnValues;
22346  }
22347  if (disableRange || !isHttp) {
22348    return returnValues;
22349  }
22350  if (getResponseHeader("Accept-Ranges") !== "bytes") {
22351    return returnValues;
22352  }
22353  const contentEncoding = getResponseHeader("Content-Encoding") || "identity";
22354  if (contentEncoding !== "identity") {
22355    return returnValues;
22356  }
22357  returnValues.allowRangeRequests = true;
22358  return returnValues;
22359}
22360function extractFilenameFromHeader(getResponseHeader) {
22361  const contentDisposition = getResponseHeader("Content-Disposition");
22362  if (contentDisposition) {
22363    let filename = (0, _content_disposition.getFilenameFromContentDispositionHeader)(contentDisposition);
22364    if (filename.includes("%")) {
22365      try {
22366        filename = decodeURIComponent(filename);
22367      } catch {}
22368    }
22369    if ((0, _display_utils.isPdfFile)(filename)) {
22370      return filename;
22371    }
22372  }
22373  return null;
22374}
22375function createResponseStatusError(status, url) {
22376  if (status === 404 || status === 0 && url.startsWith("file:")) {
22377    return new _util.MissingPDFException('Missing PDF "' + url + '".');
22378  }
22379  return new _util.UnexpectedResponseException(`Unexpected server response (${status}) while retrieving PDF "${url}".`, status);
22380}
22381function validateResponseStatus(status) {
22382  return status === 200 || status === 206;
22383}
22384
22385/***/ }),
22386/* 21 */
22387/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
22388
22389
22390
22391Object.defineProperty(exports, "__esModule", ({
22392  value: true
22393}));
22394exports.getFilenameFromContentDispositionHeader = getFilenameFromContentDispositionHeader;
22395var _util = __w_pdfjs_require__(1);
22396function getFilenameFromContentDispositionHeader(contentDisposition) {
22397  let needsEncodingFixup = true;
22398  let tmp = toParamRegExp("filename\\*", "i").exec(contentDisposition);
22399  if (tmp) {
22400    tmp = tmp[1];
22401    let filename = rfc2616unquote(tmp);
22402    filename = unescape(filename);
22403    filename = rfc5987decode(filename);
22404    filename = rfc2047decode(filename);
22405    return fixupEncoding(filename);
22406  }
22407  tmp = rfc2231getparam(contentDisposition);
22408  if (tmp) {
22409    const filename = rfc2047decode(tmp);
22410    return fixupEncoding(filename);
22411  }
22412  tmp = toParamRegExp("filename", "i").exec(contentDisposition);
22413  if (tmp) {
22414    tmp = tmp[1];
22415    let filename = rfc2616unquote(tmp);
22416    filename = rfc2047decode(filename);
22417    return fixupEncoding(filename);
22418  }
22419  function toParamRegExp(attributePattern, flags) {
22420    return new RegExp("(?:^|;)\\s*" + attributePattern + "\\s*=\\s*" + "(" + '[^";\\s][^;\\s]*' + "|" + '"(?:[^"\\\\]|\\\\"?)+"?' + ")", flags);
22421  }
22422  function textdecode(encoding, value) {
22423    if (encoding) {
22424      if (!/^[\x00-\xFF]+$/.test(value)) {
22425        return value;
22426      }
22427      try {
22428        const decoder = new TextDecoder(encoding, {
22429          fatal: true
22430        });
22431        const buffer = (0, _util.stringToBytes)(value);
22432        value = decoder.decode(buffer);
22433        needsEncodingFixup = false;
22434      } catch {}
22435    }
22436    return value;
22437  }
22438  function fixupEncoding(value) {
22439    if (needsEncodingFixup && /[\x80-\xff]/.test(value)) {
22440      value = textdecode("utf-8", value);
22441      if (needsEncodingFixup) {
22442        value = textdecode("iso-8859-1", value);
22443      }
22444    }
22445    return value;
22446  }
22447  function rfc2231getparam(contentDispositionStr) {
22448    const matches = [];
22449    let match;
22450    const iter = toParamRegExp("filename\\*((?!0\\d)\\d+)(\\*?)", "ig");
22451    while ((match = iter.exec(contentDispositionStr)) !== null) {
22452      let [, n, quot, part] = match;
22453      n = parseInt(n, 10);
22454      if (n in matches) {
22455        if (n === 0) {
22456          break;
22457        }
22458        continue;
22459      }
22460      matches[n] = [quot, part];
22461    }
22462    const parts = [];
22463    for (let n = 0; n < matches.length; ++n) {
22464      if (!(n in matches)) {
22465        break;
22466      }
22467      let [quot, part] = matches[n];
22468      part = rfc2616unquote(part);
22469      if (quot) {
22470        part = unescape(part);
22471        if (n === 0) {
22472          part = rfc5987decode(part);
22473        }
22474      }
22475      parts.push(part);
22476    }
22477    return parts.join("");
22478  }
22479  function rfc2616unquote(value) {
22480    if (value.startsWith('"')) {
22481      const parts = value.slice(1).split('\\"');
22482      for (let i = 0; i < parts.length; ++i) {
22483        const quotindex = parts[i].indexOf('"');
22484        if (quotindex !== -1) {
22485          parts[i] = parts[i].slice(0, quotindex);
22486          parts.length = i + 1;
22487        }
22488        parts[i] = parts[i].replaceAll(/\\(.)/g, "$1");
22489      }
22490      value = parts.join('"');
22491    }
22492    return value;
22493  }
22494  function rfc5987decode(extvalue) {
22495    const encodingend = extvalue.indexOf("'");
22496    if (encodingend === -1) {
22497      return extvalue;
22498    }
22499    const encoding = extvalue.slice(0, encodingend);
22500    const langvalue = extvalue.slice(encodingend + 1);
22501    const value = langvalue.replace(/^[^']*'/, "");
22502    return textdecode(encoding, value);
22503  }
22504  function rfc2047decode(value) {
22505    if (!value.startsWith("=?") || /[\x00-\x19\x80-\xff]/.test(value)) {
22506      return value;
22507    }
22508    return value.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g, function (matches, charset, encoding, text) {
22509      if (encoding === "q" || encoding === "Q") {
22510        text = text.replaceAll("_", " ");
22511        text = text.replaceAll(/=([0-9a-fA-F]{2})/g, function (match, hex) {
22512          return String.fromCharCode(parseInt(hex, 16));
22513        });
22514        return textdecode(charset, text);
22515      }
22516      try {
22517        text = atob(text);
22518      } catch {}
22519      return textdecode(charset, text);
22520    });
22521  }
22522  return "";
22523}
22524
22525/***/ }),
22526/* 22 */
22527/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
22528
22529
22530
22531Object.defineProperty(exports, "__esModule", ({
22532  value: true
22533}));
22534exports.PDFNetworkStream = void 0;
22535var _util = __w_pdfjs_require__(1);
22536var _network_utils = __w_pdfjs_require__(20);
22537;
22538const OK_RESPONSE = 200;
22539const PARTIAL_CONTENT_RESPONSE = 206;
22540function getArrayBuffer(xhr) {
22541  const data = xhr.response;
22542  if (typeof data !== "string") {
22543    return data;
22544  }
22545  return (0, _util.stringToBytes)(data).buffer;
22546}
22547class NetworkManager {
22548  constructor(url, args = {}) {
22549    this.url = url;
22550    this.isHttp = /^https?:/i.test(url);
22551    this.httpHeaders = this.isHttp && args.httpHeaders || Object.create(null);
22552    this.withCredentials = args.withCredentials || false;
22553    this.currXhrId = 0;
22554    this.pendingRequests = Object.create(null);
22555  }
22556  requestRange(begin, end, listeners) {
22557    const args = {
22558      begin,
22559      end
22560    };
22561    for (const prop in listeners) {
22562      args[prop] = listeners[prop];
22563    }
22564    return this.request(args);
22565  }
22566  requestFull(listeners) {
22567    return this.request(listeners);
22568  }
22569  request(args) {
22570    const xhr = new XMLHttpRequest();
22571    const xhrId = this.currXhrId++;
22572    const pendingRequest = this.pendingRequests[xhrId] = {
22573      xhr
22574    };
22575    xhr.open("GET", this.url);
22576    xhr.withCredentials = this.withCredentials;
22577    for (const property in this.httpHeaders) {
22578      const value = this.httpHeaders[property];
22579      if (value === undefined) {
22580        continue;
22581      }
22582      xhr.setRequestHeader(property, value);
22583    }
22584    if (this.isHttp && "begin" in args && "end" in args) {
22585      xhr.setRequestHeader("Range", `bytes=${args.begin}-${args.end - 1}`);
22586      pendingRequest.expectedStatus = PARTIAL_CONTENT_RESPONSE;
22587    } else {
22588      pendingRequest.expectedStatus = OK_RESPONSE;
22589    }
22590    xhr.responseType = "arraybuffer";
22591    if (args.onError) {
22592      xhr.onerror = function (evt) {
22593        args.onError(xhr.status);
22594      };
22595    }
22596    xhr.onreadystatechange = this.onStateChange.bind(this, xhrId);
22597    xhr.onprogress = this.onProgress.bind(this, xhrId);
22598    pendingRequest.onHeadersReceived = args.onHeadersReceived;
22599    pendingRequest.onDone = args.onDone;
22600    pendingRequest.onError = args.onError;
22601    pendingRequest.onProgress = args.onProgress;
22602    xhr.send(null);
22603    return xhrId;
22604  }
22605  onProgress(xhrId, evt) {
22606    const pendingRequest = this.pendingRequests[xhrId];
22607    if (!pendingRequest) {
22608      return;
22609    }
22610    pendingRequest.onProgress?.(evt);
22611  }
22612  onStateChange(xhrId, evt) {
22613    const pendingRequest = this.pendingRequests[xhrId];
22614    if (!pendingRequest) {
22615      return;
22616    }
22617    const xhr = pendingRequest.xhr;
22618    if (xhr.readyState >= 2 && pendingRequest.onHeadersReceived) {
22619      pendingRequest.onHeadersReceived();
22620      delete pendingRequest.onHeadersReceived;
22621    }
22622    if (xhr.readyState !== 4) {
22623      return;
22624    }
22625    if (!(xhrId in this.pendingRequests)) {
22626      return;
22627    }
22628    delete this.pendingRequests[xhrId];
22629    if (xhr.status === 0 && this.isHttp) {
22630      pendingRequest.onError?.(xhr.status);
22631      return;
22632    }
22633    const xhrStatus = xhr.status || OK_RESPONSE;
22634    const ok_response_on_range_request = xhrStatus === OK_RESPONSE && pendingRequest.expectedStatus === PARTIAL_CONTENT_RESPONSE;
22635    if (!ok_response_on_range_request && xhrStatus !== pendingRequest.expectedStatus) {
22636      pendingRequest.onError?.(xhr.status);
22637      return;
22638    }
22639    const chunk = getArrayBuffer(xhr);
22640    if (xhrStatus === PARTIAL_CONTENT_RESPONSE) {
22641      const rangeHeader = xhr.getResponseHeader("Content-Range");
22642      const matches = /bytes (\d+)-(\d+)\/(\d+)/.exec(rangeHeader);
22643      pendingRequest.onDone({
22644        begin: parseInt(matches[1], 10),
22645        chunk
22646      });
22647    } else if (chunk) {
22648      pendingRequest.onDone({
22649        begin: 0,
22650        chunk
22651      });
22652    } else {
22653      pendingRequest.onError?.(xhr.status);
22654    }
22655  }
22656  getRequestXhr(xhrId) {
22657    return this.pendingRequests[xhrId].xhr;
22658  }
22659  isPendingRequest(xhrId) {
22660    return xhrId in this.pendingRequests;
22661  }
22662  abortRequest(xhrId) {
22663    const xhr = this.pendingRequests[xhrId].xhr;
22664    delete this.pendingRequests[xhrId];
22665    xhr.abort();
22666  }
22667}
22668class PDFNetworkStream {
22669  constructor(source) {
22670    this._source = source;
22671    this._manager = new NetworkManager(source.url, {
22672      httpHeaders: source.httpHeaders,
22673      withCredentials: source.withCredentials
22674    });
22675    this._rangeChunkSize = source.rangeChunkSize;
22676    this._fullRequestReader = null;
22677    this._rangeRequestReaders = [];
22678  }
22679  _onRangeRequestReaderClosed(reader) {
22680    const i = this._rangeRequestReaders.indexOf(reader);
22681    if (i >= 0) {
22682      this._rangeRequestReaders.splice(i, 1);
22683    }
22684  }
22685  getFullReader() {
22686    (0, _util.assert)(!this._fullRequestReader, "PDFNetworkStream.getFullReader can only be called once.");
22687    this._fullRequestReader = new PDFNetworkStreamFullRequestReader(this._manager, this._source);
22688    return this._fullRequestReader;
22689  }
22690  getRangeReader(begin, end) {
22691    const reader = new PDFNetworkStreamRangeRequestReader(this._manager, begin, end);
22692    reader.onClosed = this._onRangeRequestReaderClosed.bind(this);
22693    this._rangeRequestReaders.push(reader);
22694    return reader;
22695  }
22696  cancelAllRequests(reason) {
22697    this._fullRequestReader?.cancel(reason);
22698    for (const reader of this._rangeRequestReaders.slice(0)) {
22699      reader.cancel(reason);
22700    }
22701  }
22702}
22703exports.PDFNetworkStream = PDFNetworkStream;
22704class PDFNetworkStreamFullRequestReader {
22705  constructor(manager, source) {
22706    this._manager = manager;
22707    const args = {
22708      onHeadersReceived: this._onHeadersReceived.bind(this),
22709      onDone: this._onDone.bind(this),
22710      onError: this._onError.bind(this),
22711      onProgress: this._onProgress.bind(this)
22712    };
22713    this._url = source.url;
22714    this._fullRequestId = manager.requestFull(args);
22715    this._headersReceivedCapability = new _util.PromiseCapability();
22716    this._disableRange = source.disableRange || false;
22717    this._contentLength = source.length;
22718    this._rangeChunkSize = source.rangeChunkSize;
22719    if (!this._rangeChunkSize && !this._disableRange) {
22720      this._disableRange = true;
22721    }
22722    this._isStreamingSupported = false;
22723    this._isRangeSupported = false;
22724    this._cachedChunks = [];
22725    this._requests = [];
22726    this._done = false;
22727    this._storedError = undefined;
22728    this._filename = null;
22729    this.onProgress = null;
22730  }
22731  _onHeadersReceived() {
22732    const fullRequestXhrId = this._fullRequestId;
22733    const fullRequestXhr = this._manager.getRequestXhr(fullRequestXhrId);
22734    const getResponseHeader = name => {
22735      return fullRequestXhr.getResponseHeader(name);
22736    };
22737    const {
22738      allowRangeRequests,
22739      suggestedLength
22740    } = (0, _network_utils.validateRangeRequestCapabilities)({
22741      getResponseHeader,
22742      isHttp: this._manager.isHttp,
22743      rangeChunkSize: this._rangeChunkSize,
22744      disableRange: this._disableRange
22745    });
22746    if (allowRangeRequests) {
22747      this._isRangeSupported = true;
22748    }
22749    this._contentLength = suggestedLength || this._contentLength;
22750    this._filename = (0, _network_utils.extractFilenameFromHeader)(getResponseHeader);
22751    if (this._isRangeSupported) {
22752      this._manager.abortRequest(fullRequestXhrId);
22753    }
22754    this._headersReceivedCapability.resolve();
22755  }
22756  _onDone(data) {
22757    if (data) {
22758      if (this._requests.length > 0) {
22759        const requestCapability = this._requests.shift();
22760        requestCapability.resolve({
22761          value: data.chunk,
22762          done: false
22763        });
22764      } else {
22765        this._cachedChunks.push(data.chunk);
22766      }
22767    }
22768    this._done = true;
22769    if (this._cachedChunks.length > 0) {
22770      return;
22771    }
22772    for (const requestCapability of this._requests) {
22773      requestCapability.resolve({
22774        value: undefined,
22775        done: true
22776      });
22777    }
22778    this._requests.length = 0;
22779  }
22780  _onError(status) {
22781    this._storedError = (0, _network_utils.createResponseStatusError)(status, this._url);
22782    this._headersReceivedCapability.reject(this._storedError);
22783    for (const requestCapability of this._requests) {
22784      requestCapability.reject(this._storedError);
22785    }
22786    this._requests.length = 0;
22787    this._cachedChunks.length = 0;
22788  }
22789  _onProgress(evt) {
22790    this.onProgress?.({
22791      loaded: evt.loaded,
22792      total: evt.lengthComputable ? evt.total : this._contentLength
22793    });
22794  }
22795  get filename() {
22796    return this._filename;
22797  }
22798  get isRangeSupported() {
22799    return this._isRangeSupported;
22800  }
22801  get isStreamingSupported() {
22802    return this._isStreamingSupported;
22803  }
22804  get contentLength() {
22805    return this._contentLength;
22806  }
22807  get headersReady() {
22808    return this._headersReceivedCapability.promise;
22809  }
22810  async read() {
22811    if (this._storedError) {
22812      throw this._storedError;
22813    }
22814    if (this._cachedChunks.length > 0) {
22815      const chunk = this._cachedChunks.shift();
22816      return {
22817        value: chunk,
22818        done: false
22819      };
22820    }
22821    if (this._done) {
22822      return {
22823        value: undefined,
22824        done: true
22825      };
22826    }
22827    const requestCapability = new _util.PromiseCapability();
22828    this._requests.push(requestCapability);
22829    return requestCapability.promise;
22830  }
22831  cancel(reason) {
22832    this._done = true;
22833    this._headersReceivedCapability.reject(reason);
22834    for (const requestCapability of this._requests) {
22835      requestCapability.resolve({
22836        value: undefined,
22837        done: true
22838      });
22839    }
22840    this._requests.length = 0;
22841    if (this._manager.isPendingRequest(this._fullRequestId)) {
22842      this._manager.abortRequest(this._fullRequestId);
22843    }
22844    this._fullRequestReader = null;
22845  }
22846}
22847class PDFNetworkStreamRangeRequestReader {
22848  constructor(manager, begin, end) {
22849    this._manager = manager;
22850    const args = {
22851      onDone: this._onDone.bind(this),
22852      onError: this._onError.bind(this),
22853      onProgress: this._onProgress.bind(this)
22854    };
22855    this._url = manager.url;
22856    this._requestId = manager.requestRange(begin, end, args);
22857    this._requests = [];
22858    this._queuedChunk = null;
22859    this._done = false;
22860    this._storedError = undefined;
22861    this.onProgress = null;
22862    this.onClosed = null;
22863  }
22864  _close() {
22865    this.onClosed?.(this);
22866  }
22867  _onDone(data) {
22868    const chunk = data.chunk;
22869    if (this._requests.length > 0) {
22870      const requestCapability = this._requests.shift();
22871      requestCapability.resolve({
22872        value: chunk,
22873        done: false
22874      });
22875    } else {
22876      this._queuedChunk = chunk;
22877    }
22878    this._done = true;
22879    for (const requestCapability of this._requests) {
22880      requestCapability.resolve({
22881        value: undefined,
22882        done: true
22883      });
22884    }
22885    this._requests.length = 0;
22886    this._close();
22887  }
22888  _onError(status) {
22889    this._storedError = (0, _network_utils.createResponseStatusError)(status, this._url);
22890    for (const requestCapability of this._requests) {
22891      requestCapability.reject(this._storedError);
22892    }
22893    this._requests.length = 0;
22894    this._queuedChunk = null;
22895  }
22896  _onProgress(evt) {
22897    if (!this.isStreamingSupported) {
22898      this.onProgress?.({
22899        loaded: evt.loaded
22900      });
22901    }
22902  }
22903  get isStreamingSupported() {
22904    return false;
22905  }
22906  async read() {
22907    if (this._storedError) {
22908      throw this._storedError;
22909    }
22910    if (this._queuedChunk !== null) {
22911      const chunk = this._queuedChunk;
22912      this._queuedChunk = null;
22913      return {
22914        value: chunk,
22915        done: false
22916      };
22917    }
22918    if (this._done) {
22919      return {
22920        value: undefined,
22921        done: true
22922      };
22923    }
22924    const requestCapability = new _util.PromiseCapability();
22925    this._requests.push(requestCapability);
22926    return requestCapability.promise;
22927  }
22928  cancel(reason) {
22929    this._done = true;
22930    for (const requestCapability of this._requests) {
22931      requestCapability.resolve({
22932        value: undefined,
22933        done: true
22934      });
22935    }
22936    this._requests.length = 0;
22937    if (this._manager.isPendingRequest(this._requestId)) {
22938      this._manager.abortRequest(this._requestId);
22939    }
22940    this._close();
22941  }
22942}
22943
22944/***/ }),
22945/* 23 */
22946/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
22947
22948
22949
22950Object.defineProperty(exports, "__esModule", ({
22951  value: true
22952}));
22953exports.PDFNodeStream = void 0;
22954var _util = __w_pdfjs_require__(1);
22955var _network_utils = __w_pdfjs_require__(20);
22956;
22957const fileUriRegex = /^file:\/\/\/[a-zA-Z]:\//;
22958function parseUrl(sourceUrl) {
22959  const url = __webpack_require__(/*! url */ "url");
22960  const parsedUrl = url.parse(sourceUrl);
22961  if (parsedUrl.protocol === "file:" || parsedUrl.host) {
22962    return parsedUrl;
22963  }
22964  if (/^[a-z]:[/\\]/i.test(sourceUrl)) {
22965    return url.parse(`file:///${sourceUrl}`);
22966  }
22967  if (!parsedUrl.host) {
22968    parsedUrl.protocol = "file:";
22969  }
22970  return parsedUrl;
22971}
22972class PDFNodeStream {
22973  constructor(source) {
22974    this.source = source;
22975    this.url = parseUrl(source.url);
22976    this.isHttp = this.url.protocol === "http:" || this.url.protocol === "https:";
22977    this.isFsUrl = this.url.protocol === "file:";
22978    this.httpHeaders = this.isHttp && source.httpHeaders || {};
22979    this._fullRequestReader = null;
22980    this._rangeRequestReaders = [];
22981  }
22982  get _progressiveDataLength() {
22983    return this._fullRequestReader?._loaded ?? 0;
22984  }
22985  getFullReader() {
22986    (0, _util.assert)(!this._fullRequestReader, "PDFNodeStream.getFullReader can only be called once.");
22987    this._fullRequestReader = this.isFsUrl ? new PDFNodeStreamFsFullReader(this) : new PDFNodeStreamFullReader(this);
22988    return this._fullRequestReader;
22989  }
22990  getRangeReader(start, end) {
22991    if (end <= this._progressiveDataLength) {
22992      return null;
22993    }
22994    const rangeReader = this.isFsUrl ? new PDFNodeStreamFsRangeReader(this, start, end) : new PDFNodeStreamRangeReader(this, start, end);
22995    this._rangeRequestReaders.push(rangeReader);
22996    return rangeReader;
22997  }
22998  cancelAllRequests(reason) {
22999    this._fullRequestReader?.cancel(reason);
23000    for (const reader of this._rangeRequestReaders.slice(0)) {
23001      reader.cancel(reason);
23002    }
23003  }
23004}
23005exports.PDFNodeStream = PDFNodeStream;
23006class BaseFullReader {
23007  constructor(stream) {
23008    this._url = stream.url;
23009    this._done = false;
23010    this._storedError = null;
23011    this.onProgress = null;
23012    const source = stream.source;
23013    this._contentLength = source.length;
23014    this._loaded = 0;
23015    this._filename = null;
23016    this._disableRange = source.disableRange || false;
23017    this._rangeChunkSize = source.rangeChunkSize;
23018    if (!this._rangeChunkSize && !this._disableRange) {
23019      this._disableRange = true;
23020    }
23021    this._isStreamingSupported = !source.disableStream;
23022    this._isRangeSupported = !source.disableRange;
23023    this._readableStream = null;
23024    this._readCapability = new _util.PromiseCapability();
23025    this._headersCapability = new _util.PromiseCapability();
23026  }
23027  get headersReady() {
23028    return this._headersCapability.promise;
23029  }
23030  get filename() {
23031    return this._filename;
23032  }
23033  get contentLength() {
23034    return this._contentLength;
23035  }
23036  get isRangeSupported() {
23037    return this._isRangeSupported;
23038  }
23039  get isStreamingSupported() {
23040    return this._isStreamingSupported;
23041  }
23042  async read() {
23043    await this._readCapability.promise;
23044    if (this._done) {
23045      return {
23046        value: undefined,
23047        done: true
23048      };
23049    }
23050    if (this._storedError) {
23051      throw this._storedError;
23052    }
23053    const chunk = this._readableStream.read();
23054    if (chunk === null) {
23055      this._readCapability = new _util.PromiseCapability();
23056      return this.read();
23057    }
23058    this._loaded += chunk.length;
23059    this.onProgress?.({
23060      loaded: this._loaded,
23061      total: this._contentLength
23062    });
23063    const buffer = new Uint8Array(chunk).buffer;
23064    return {
23065      value: buffer,
23066      done: false
23067    };
23068  }
23069  cancel(reason) {
23070    if (!this._readableStream) {
23071      this._error(reason);
23072      return;
23073    }
23074    this._readableStream.destroy(reason);
23075  }
23076  _error(reason) {
23077    this._storedError = reason;
23078    this._readCapability.resolve();
23079  }
23080  _setReadableStream(readableStream) {
23081    this._readableStream = readableStream;
23082    readableStream.on("readable", () => {
23083      this._readCapability.resolve();
23084    });
23085    readableStream.on("end", () => {
23086      readableStream.destroy();
23087      this._done = true;
23088      this._readCapability.resolve();
23089    });
23090    readableStream.on("error", reason => {
23091      this._error(reason);
23092    });
23093    if (!this._isStreamingSupported && this._isRangeSupported) {
23094      this._error(new _util.AbortException("streaming is disabled"));
23095    }
23096    if (this._storedError) {
23097      this._readableStream.destroy(this._storedError);
23098    }
23099  }
23100}
23101class BaseRangeReader {
23102  constructor(stream) {
23103    this._url = stream.url;
23104    this._done = false;
23105    this._storedError = null;
23106    this.onProgress = null;
23107    this._loaded = 0;
23108    this._readableStream = null;
23109    this._readCapability = new _util.PromiseCapability();
23110    const source = stream.source;
23111    this._isStreamingSupported = !source.disableStream;
23112  }
23113  get isStreamingSupported() {
23114    return this._isStreamingSupported;
23115  }
23116  async read() {
23117    await this._readCapability.promise;
23118    if (this._done) {
23119      return {
23120        value: undefined,
23121        done: true
23122      };
23123    }
23124    if (this._storedError) {
23125      throw this._storedError;
23126    }
23127    const chunk = this._readableStream.read();
23128    if (chunk === null) {
23129      this._readCapability = new _util.PromiseCapability();
23130      return this.read();
23131    }
23132    this._loaded += chunk.length;
23133    this.onProgress?.({
23134      loaded: this._loaded
23135    });
23136    const buffer = new Uint8Array(chunk).buffer;
23137    return {
23138      value: buffer,
23139      done: false
23140    };
23141  }
23142  cancel(reason) {
23143    if (!this._readableStream) {
23144      this._error(reason);
23145      return;
23146    }
23147    this._readableStream.destroy(reason);
23148  }
23149  _error(reason) {
23150    this._storedError = reason;
23151    this._readCapability.resolve();
23152  }
23153  _setReadableStream(readableStream) {
23154    this._readableStream = readableStream;
23155    readableStream.on("readable", () => {
23156      this._readCapability.resolve();
23157    });
23158    readableStream.on("end", () => {
23159      readableStream.destroy();
23160      this._done = true;
23161      this._readCapability.resolve();
23162    });
23163    readableStream.on("error", reason => {
23164      this._error(reason);
23165    });
23166    if (this._storedError) {
23167      this._readableStream.destroy(this._storedError);
23168    }
23169  }
23170}
23171function createRequestOptions(parsedUrl, headers) {
23172  return {
23173    protocol: parsedUrl.protocol,
23174    auth: parsedUrl.auth,
23175    host: parsedUrl.hostname,
23176    port: parsedUrl.port,
23177    path: parsedUrl.path,
23178    method: "GET",
23179    headers
23180  };
23181}
23182class PDFNodeStreamFullReader extends BaseFullReader {
23183  constructor(stream) {
23184    super(stream);
23185    const handleResponse = response => {
23186      if (response.statusCode === 404) {
23187        const error = new _util.MissingPDFException(`Missing PDF "${this._url}".`);
23188        this._storedError = error;
23189        this._headersCapability.reject(error);
23190        return;
23191      }
23192      this._headersCapability.resolve();
23193      this._setReadableStream(response);
23194      const getResponseHeader = name => {
23195        return this._readableStream.headers[name.toLowerCase()];
23196      };
23197      const {
23198        allowRangeRequests,
23199        suggestedLength
23200      } = (0, _network_utils.validateRangeRequestCapabilities)({
23201        getResponseHeader,
23202        isHttp: stream.isHttp,
23203        rangeChunkSize: this._rangeChunkSize,
23204        disableRange: this._disableRange
23205      });
23206      this._isRangeSupported = allowRangeRequests;
23207      this._contentLength = suggestedLength || this._contentLength;
23208      this._filename = (0, _network_utils.extractFilenameFromHeader)(getResponseHeader);
23209    };
23210    this._request = null;
23211    if (this._url.protocol === "http:") {
23212      const http = __webpack_require__(/*! http */ "http");
23213      this._request = http.request(createRequestOptions(this._url, stream.httpHeaders), handleResponse);
23214    } else {
23215      const https = __webpack_require__(/*! https */ "https");
23216      this._request = https.request(createRequestOptions(this._url, stream.httpHeaders), handleResponse);
23217    }
23218    this._request.on("error", reason => {
23219      this._storedError = reason;
23220      this._headersCapability.reject(reason);
23221    });
23222    this._request.end();
23223  }
23224}
23225class PDFNodeStreamRangeReader extends BaseRangeReader {
23226  constructor(stream, start, end) {
23227    super(stream);
23228    this._httpHeaders = {};
23229    for (const property in stream.httpHeaders) {
23230      const value = stream.httpHeaders[property];
23231      if (value === undefined) {
23232        continue;
23233      }
23234      this._httpHeaders[property] = value;
23235    }
23236    this._httpHeaders.Range = `bytes=${start}-${end - 1}`;
23237    const handleResponse = response => {
23238      if (response.statusCode === 404) {
23239        const error = new _util.MissingPDFException(`Missing PDF "${this._url}".`);
23240        this._storedError = error;
23241        return;
23242      }
23243      this._setReadableStream(response);
23244    };
23245    this._request = null;
23246    if (this._url.protocol === "http:") {
23247      const http = __webpack_require__(/*! http */ "http");
23248      this._request = http.request(createRequestOptions(this._url, this._httpHeaders), handleResponse);
23249    } else {
23250      const https = __webpack_require__(/*! https */ "https");
23251      this._request = https.request(createRequestOptions(this._url, this._httpHeaders), handleResponse);
23252    }
23253    this._request.on("error", reason => {
23254      this._storedError = reason;
23255    });
23256    this._request.end();
23257  }
23258}
23259class PDFNodeStreamFsFullReader extends BaseFullReader {
23260  constructor(stream) {
23261    super(stream);
23262    let path = decodeURIComponent(this._url.path);
23263    if (fileUriRegex.test(this._url.href)) {
23264      path = path.replace(/^\//, "");
23265    }
23266    const fs = __webpack_require__(/*! fs */ "fs");
23267    fs.lstat(path, (error, stat) => {
23268      if (error) {
23269        if (error.code === "ENOENT") {
23270          error = new _util.MissingPDFException(`Missing PDF "${path}".`);
23271        }
23272        this._storedError = error;
23273        this._headersCapability.reject(error);
23274        return;
23275      }
23276      this._contentLength = stat.size;
23277      this._setReadableStream(fs.createReadStream(path));
23278      this._headersCapability.resolve();
23279    });
23280  }
23281}
23282class PDFNodeStreamFsRangeReader extends BaseRangeReader {
23283  constructor(stream, start, end) {
23284    super(stream);
23285    let path = decodeURIComponent(this._url.path);
23286    if (fileUriRegex.test(this._url.href)) {
23287      path = path.replace(/^\//, "");
23288    }
23289    const fs = __webpack_require__(/*! fs */ "fs");
23290    this._setReadableStream(fs.createReadStream(path, {
23291      start,
23292      end: end - 1
23293    }));
23294  }
23295}
23296
23297/***/ }),
23298/* 24 */
23299/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
23300
23301
23302
23303Object.defineProperty(exports, "__esModule", ({
23304  value: true
23305}));
23306exports.SVGGraphics = void 0;
23307var _display_utils = __w_pdfjs_require__(6);
23308var _util = __w_pdfjs_require__(1);
23309;
23310const SVG_DEFAULTS = {
23311  fontStyle: "normal",
23312  fontWeight: "normal",
23313  fillColor: "#000000"
23314};
23315const XML_NS = "http://www.w3.org/XML/1998/namespace";
23316const XLINK_NS = "http://www.w3.org/1999/xlink";
23317const LINE_CAP_STYLES = ["butt", "round", "square"];
23318const LINE_JOIN_STYLES = ["miter", "round", "bevel"];
23319const createObjectURL = function (data, contentType = "", forceDataSchema = false) {
23320  if (URL.createObjectURL && typeof Blob !== "undefined" && !forceDataSchema) {
23321    return URL.createObjectURL(new Blob([data], {
23322      type: contentType
23323    }));
23324  }
23325  const digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
23325+/=";
23326  let buffer = `data:${contentType};base64,`;
23327  for (let i = 0, ii = data.length; i < ii; i += 3) {
23328    const b1 = data[i] & 0xff;
23329    const b2 = data[i + 1] & 0xff;
23330    const b3 = data[i + 2] & 0xff;
23331    const d1 = b1 >> 2,
23332      d2 = (b1 & 3) << 4 | b2 >> 4;
23333    const d3 = i + 1 < ii ? (b2 & 0xf) << 2 | b3 >> 6 : 64;
23334    const d4 = i + 2 < ii ? b3 & 0x3f : 64;
23335    buffer += digits[d1] + digits[d2] + digits[d3] + digits[d4];
23336  }
23337  return buffer;
23338};
23339const convertImgDataToPng = function () {
23340  const PNG_HEADER = new Uint8Array([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]);
23341  const CHUNK_WRAPPER_SIZE = 12;
23342  const crcTable = new Int32Array(256);
23343  for (let i = 0; i < 256; i++) {
23344    let c = i;
23345    for (let h = 0; h < 8; h++) {
23346      c = c & 1 ? 0xedb88320 ^ c >> 1 & 0x7fffffff : c >> 1 & 0x7fffffff;
23347    }
23348    crcTable[i] = c;
23349  }
23350  function crc32(data, start, end) {
23351    let crc = -1;
23352    for (let i = start; i < end; i++) {
23353      const a = (crc ^ data[i]) & 0xff;
23354      const b = crcTable[a];
23355      crc = crc >>> 8 ^ b;
23356    }
23357    return crc ^ -1;
23358  }
23359  function writePngChunk(type, body, data, offset) {
23360    let p = offset;
23361    const len = body.length;
23362    data[p] = len >> 24 & 0xff;
23363    data[p + 1] = len >> 16 & 0xff;
23364    data[p + 2] = len >> 8 & 0xff;
23365    data[p + 3] = len & 0xff;
23366    p += 4;
23367    data[p] = type.charCodeAt(0) & 0xff;
23368    data[p + 1] = type.charCodeAt(1) & 0xff;
23369    data[p + 2] = type.charCodeAt(2) & 0xff;
23370    data[p + 3] = type.charCodeAt(3) & 0xff;
23371    p += 4;
23372    data.set(body, p);
23373    p += body.length;
23374    const crc = crc32(data, offset + 4, p);
23375    data[p] = crc >> 24 & 0xff;
23376    data[p + 1] = crc >> 16 & 0xff;
23377    data[p + 2] = crc >> 8 & 0xff;
23378    data[p + 3] = crc & 0xff;
23379  }
23380  function adler32(data, start, end) {
23381    let a = 1;
23382    let b = 0;
23383    for (let i = start; i < end; ++i) {
23384      a = (a + (data[i] & 0xff)) % 65521;
23385      b = (b + a) % 65521;
23386    }
23387    return b << 16 | a;
23388  }
23389  function deflateSync(literals) {
23390    if (!_util.isNodeJS) {
23391      return deflateSyncUncompressed(literals);
23392    }
23393    try {
23394      const input = parseInt(process.versions.node) >= 8 ? literals : Buffer.from(literals);
23395      const output = (__webpack_require__(/*! zlib */ "zlib").deflateSync)(input, {
23396        level: 9
23397      });
23398      return output instanceof Uint8Array ? output : new Uint8Array(output);
23399    } catch (e) {
23400      (0, _util.warn)("Not compressing PNG because zlib.deflateSync is unavailable: " + e);
23401    }
23402    return deflateSyncUncompressed(literals);
23403  }
23404  function deflateSyncUncompressed(literals) {
23405    let len = literals.length;
23406    const maxBlockLength = 0xffff;
23407    const deflateBlocks = Math.ceil(len / maxBlockLength);
23408    const idat = new Uint8Array(2 + len + deflateBlocks * 5 + 4);
23409    let pi = 0;
23410    idat[pi++] = 0x78;
23411    idat[pi++] = 0x9c;
23412    let pos = 0;
23413    while (len > maxBlockLength) {
23414      idat[pi++] = 0x00;
23415      idat[pi++] = 0xff;
23416      idat[pi++] = 0xff;
23417      idat[pi++] = 0x00;
23418      idat[pi++] = 0x00;
23419      idat.set(literals.subarray(pos, pos + maxBlockLength), pi);
23420      pi += maxBlockLength;
23421      pos += maxBlockLength;
23422      len -= maxBlockLength;
23423    }
23424    idat[pi++] = 0x01;
23425    idat[pi++] = len & 0xff;
23426    idat[pi++] = len >> 8 & 0xff;
23427    idat[pi++] = ~len & 0xffff & 0xff;
23428    idat[pi++] = (~len & 0xffff) >> 8 & 0xff;
23429    idat.set(literals.subarray(pos), pi);
23430    pi += literals.length - pos;
23431    const adler = adler32(literals, 0, literals.length);
23432    idat[pi++] = adler >> 24 & 0xff;
23433    idat[pi++] = adler >> 16 & 0xff;
23434    idat[pi++] = adler >> 8 & 0xff;
23435    idat[pi++] = adler & 0xff;
23436    return idat;
23437  }
23438  function encode(imgData, kind, forceDataSchema, isMask) {
23439    const width = imgData.width;
23440    const height = imgData.height;
23441    let bitDepth, colorType, lineSize;
23442    const bytes = imgData.data;
23443    switch (kind) {
23444      case _util.ImageKind.GRAYSCALE_1BPP:
23445        colorType = 0;
23446        bitDepth = 1;
23447        lineSize = width + 7 >> 3;
23448        break;
23449      case _util.ImageKind.RGB_24BPP:
23450        colorType = 2;
23451        bitDepth = 8;
23452        lineSize = width * 3;
23453        break;
23454      case _util.ImageKind.RGBA_32BPP:
23455        colorType = 6;
23456        bitDepth = 8;
23457        lineSize = width * 4;
23458        break;
23459      default:
23460        throw new Error("invalid format");
23461    }
23462    const literals = new Uint8Array((1 + lineSize) * height);
23463    let offsetLiterals = 0,
23464      offsetBytes = 0;
23465    for (let y = 0; y < height; ++y) {
23466      literals[offsetLiterals++] = 0;
23467      literals.set(bytes.subarray(offsetBytes, offsetBytes + lineSize), offsetLiterals);
23468      offsetBytes += lineSize;
23469      offsetLiterals += lineSize;
23470    }
23471    if (kind === _util.ImageKind.GRAYSCALE_1BPP && isMask) {
23472      offsetLiterals = 0;
23473      for (let y = 0; y < height; y++) {
23474        offsetLiterals++;
23475        for (let i = 0; i < lineSize; i++) {
23476          literals[offsetLiterals++] ^= 0xff;
23477        }
23478      }
23479    }
23480    const ihdr = new Uint8Array([width >> 24 & 0xff, width >> 16 & 0xff, width >> 8 & 0xff, width & 0xff, height >> 24 & 0xff, height >> 16 & 0xff, height >> 8 & 0xff, height & 0xff, bitDepth, colorType, 0x00, 0x00, 0x00]);
23481    const idat = deflateSync(literals);
23482    const pngLength = PNG_HEADER.length + CHUNK_WRAPPER_SIZE * 3 + ihdr.length + idat.length;
23483    const data = new Uint8Array(pngLength);
23484    let offset = 0;
23485    data.set(PNG_HEADER, offset);
23486    offset += PNG_HEADER.length;
23487    writePngChunk("IHDR", ihdr, data, offset);
23488    offset += CHUNK_WRAPPER_SIZE + ihdr.length;
23489    writePngChunk("IDATA", idat, data, offset);
23490    offset += CHUNK_WRAPPER_SIZE + idat.length;
23491    writePngChunk("IEND", new Uint8Array(0), data, offset);
23492    return createObjectURL(data, "image/png", forceDataSchema);
23493  }
23494  return function convertImgDataToPng(imgData, forceDataSchema, isMask) {
23495    const kind = imgData.kind === undefined ? _util.ImageKind.GRAYSCALE_1BPP : imgData.kind;
23496    return encode(imgData, kind, forceDataSchema, isMask);
23497  };
23498}();
23499class SVGExtraState {
23500  constructor() {
23501    this.fontSizeScale = 1;
23502    this.fontWeight = SVG_DEFAULTS.fontWeight;
23503    this.fontSize = 0;
23504    this.textMatrix = _util.IDENTITY_MATRIX;
23505    this.fontMatrix = _util.FONT_IDENTITY_MATRIX;
23506    this.leading = 0;
23507    this.textRenderingMode = _util.TextRenderingMode.FILL;
23508    this.textMatrixScale = 1;
23509    this.x = 0;
23510    this.y = 0;
23511    this.lineX = 0;
23512    this.lineY = 0;
23513    this.charSpacing = 0;
23514    this.wordSpacing = 0;
23515    this.textHScale = 1;
23516    this.textRise = 0;
23517    this.fillColor = SVG_DEFAULTS.fillColor;
23518    this.strokeColor = "#000000";
23519    this.fillAlpha = 1;
23520    this.strokeAlpha = 1;
23521    this.lineWidth = 1;
23522    this.lineJoin = "";
23523    this.lineCap = "";
23524    this.miterLimit = 0;
23525    this.dashArray = [];
23526    this.dashPhase = 0;
23527    this.dependencies = [];
23528    this.activeClipUrl = null;
23529    this.clipGroup = null;
23530    this.maskId = "";
23531  }
23532  clone() {
23533    return Object.create(this);
23534  }
23535  setCurrentPoint(x, y) {
23536    this.x = x;
23537    this.y = y;
23538  }
23539}
23540function opListToTree(opList) {
23541  let opTree = [];
23542  const tmp = [];
23543  for (const opListElement of opList) {
23544    if (opListElement.fn === "save") {
23545      opTree.push({
23546        fnId: 92,
23547        fn: "group",
23548        items: []
23549      });
23550      tmp.push(opTree);
23551      opTree = opTree.at(-1).items;
23552      continue;
23553    }
23554    if (opListElement.fn === "restore") {
23555      opTree = tmp.pop();
23556    } else {
23557      opTree.push(opListElement);
23558    }
23559  }
23560  return opTree;
23561}
23562function pf(value) {
23563  if (Number.isInteger(value)) {
23564    return value.toString();
23565  }
23566  const s = value.toFixed(10);
23567  let i = s.length - 1;
23568  if (s[i] !== "0") {
23569    return s;
23570  }
23571  do {
23572    i--;
23573  } while (s[i] === "0");
23574  return s.substring(0, s[i] === "." ? i : i + 1);
23575}
23576function pm(m) {
23577  if (m[4] === 0 && m[5] === 0) {
23578    if (m[1] === 0 && m[2] === 0) {
23579      if (m[0] === 1 && m[3] === 1) {
23580        return "";
23581      }
23582      return `scale(${pf(m[0])} ${pf(m[3])})`;
23583    }
23584    if (m[0] === m[3] && m[1] === -m[2]) {
23585      const a = Math.acos(m[0]) * 180 / Math.PI;
23586      return `rotate(${pf(a)})`;
23587    }
23588  } else if (m[0] === 1 && m[1] === 0 && m[2] === 0 && m[3] === 1) {
23589    return `translate(${pf(m[4])} ${pf(m[5])})`;
23590  }
23591  return `matrix(${pf(m[0])} ${pf(m[1])} ${pf(m[2])} ${pf(m[3])} ${pf(m[4])} ` + `${pf(m[5])})`;
23592}
23593let clipCount = 0;
23594let maskCount = 0;
23595let shadingCount = 0;
23596class SVGGraphics {
23597  constructor(commonObjs, objs, forceDataSchema = false) {
23598    (0, _display_utils.deprecated)("The SVG back-end is no longer maintained and *may* be removed in the future.");
23599    this.svgFactory = new _display_utils.DOMSVGFactory();
23600    this.current = new SVGExtraState();
23601    this.transformMatrix = _util.IDENTITY_MATRIX;
23602    this.transformStack = [];
23603    this.extraStack = [];
23604    this.commonObjs = commonObjs;
23605    this.objs = objs;
23606    this.pendingClip = null;
23607    this.pendingEOFill = false;
23608    this.embedFonts = false;
23609    this.embeddedFonts = Object.create(null);
23610    this.cssStyle = null;
23611    this.forceDataSchema = !!forceDataSchema;
23612    this._operatorIdMapping = [];
23613    for (const op in _util.OPS) {
23614      this._operatorIdMapping[_util.OPS[op]] = op;
23615    }
23616  }
23617  getObject(data, fallback = null) {
23618    if (typeof data === "string") {
23619      return data.startsWith("g_") ? this.commonObjs.get(data) : this.objs.get(data);
23620    }
23621    return fallback;
23622  }
23623  save() {
23624    this.transformStack.push(this.transformMatrix);
23625    const old = this.current;
23626    this.extraStack.push(old);
23627    this.current = old.clone();
23628  }
23629  restore() {
23630    this.transformMatrix = this.transformStack.pop();
23631    this.current = this.extraStack.pop();
23632    this.pendingClip = null;
23633    this.tgrp = null;
23634  }
23635  group(items) {
23636    this.save();
23637    this.executeOpTree(items);
23638    this.restore();
23639  }
23640  loadDependencies(operatorList) {
23641    const fnArray = operatorList.fnArray;
23642    const argsArray = operatorList.argsArray;
23643    for (let i = 0, ii = fnArray.length; i < ii; i++) {
23644      if (fnArray[i] !== _util.OPS.dependency) {
23645        continue;
23646      }
23647      for (const obj of argsArray[i]) {
23648        const objsPool = obj.startsWith("g_") ? this.commonObjs : this.objs;
23649        const promise = new Promise(resolve => {
23650          objsPool.get(obj, resolve);
23651        });
23652        this.current.dependencies.push(promise);
23653      }
23654    }
23655    return Promise.all(this.current.dependencies);
23656  }
23657  transform(a, b, c, d, e, f) {
23658    const transformMatrix = [a, b, c, d, e, f];
23659    this.transformMatrix = _util.Util.transform(this.transformMatrix, transformMatrix);
23660    this.tgrp = null;
23661  }
23662  getSVG(operatorList, viewport) {
23663    this.viewport = viewport;
23664    const svgElement = this._initialize(viewport);
23665    return this.loadDependencies(operatorList).then(() => {
23666      this.transformMatrix = _util.IDENTITY_MATRIX;
23667      this.executeOpTree(this.convertOpList(operatorList));
23668      return svgElement;
23669    });
23670  }
23671  convertOpList(operatorList) {
23672    const operatorIdMapping = this._operatorIdMapping;
23673    const argsArray = operatorList.argsArray;
23674    const fnArray = operatorList.fnArray;
23675    const opList = [];
23676    for (let i = 0, ii = fnArray.length; i < ii; i++) {
23677      const fnId = fnArray[i];
23678      opList.push({
23679        fnId,
23680        fn: operatorIdMapping[fnId],
23681        args: argsArray[i]
23682      });
23683    }
23684    return opListToTree(opList);
23685  }
23686  executeOpTree(opTree) {
23687    for (const opTreeElement of opTree) {
23688      const fn = opTreeElement.fn;
23689      const fnId = opTreeElement.fnId;
23690      const args = opTreeElement.args;
23691      switch (fnId | 0) {
23692        case _util.OPS.beginText:
23693          this.beginText();
23694          break;
23695        case _util.OPS.dependency:
23696          break;
23697        case _util.OPS.setLeading:
23698          this.setLeading(args);
23699          break;
23700        case _util.OPS.setLeadingMoveText:
23701          this.setLeadingMoveText(args[0], args[1]);
23702          break;
23703        case _util.OPS.setFont:
23704          this.setFont(args);
23705          break;
23706        case _util.OPS.showText:
23707          this.showText(args[0]);
23708          break;
23709        case _util.OPS.showSpacedText:
23710          this.showText(args[0]);
23711          break;
23712        case _util.OPS.endText:
23713          this.endText();
23714          break;
23715        case _util.OPS.moveText:
23716          this.moveText(args[0], args[1]);
23717          break;
23718        case _util.OPS.setCharSpacing:
23719          this.setCharSpacing(args[0]);
23720          break;
23721        case _util.OPS.setWordSpacing:
23722          this.setWordSpacing(args[0]);
23723          break;
23724        case _util.OPS.setHScale:
23725          this.setHScale(args[0]);
23726          break;
23727        case _util.OPS.setTextMatrix:
23728          this.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
23729          break;
23730        case _util.OPS.setTextRise:
23731          this.setTextRise(args[0]);
23732          break;
23733        case _util.OPS.setTextRenderingMode:
23734          this.setTextRenderingMode(args[0]);
23735          break;
23736        case _util.OPS.setLineWidth:
23737          this.setLineWidth(args[0]);
23738          break;
23739        case _util.OPS.setLineJoin:
23740          this.setLineJoin(args[0]);
23741          break;
23742        case _util.OPS.setLineCap:
23743          this.setLineCap(args[0]);
23744          break;
23745        case _util.OPS.setMiterLimit:
23746          this.setMiterLimit(args[0]);
23747          break;
23748        case _util.OPS.setFillRGBColor:
23749          this.setFillRGBColor(args[0], args[1], args[2]);
23750          break;
23751        case _util.OPS.setStrokeRGBColor:
23752          this.setStrokeRGBColor(args[0], args[1], args[2]);
23753          break;
23754        case _util.OPS.setStrokeColorN:
23755          this.setStrokeColorN(args);
23756          break;
23757        case _util.OPS.setFillColorN:
23758          this.setFillColorN(args);
23759          break;
23760        case _util.OPS.shadingFill:
23761          this.shadingFill(args[0]);
23762          break;
23763        case _util.OPS.setDash:
23764          this.setDash(args[0], args[1]);
23765          break;
23766        case _util.OPS.setRenderingIntent:
23767          this.setRenderingIntent(args[0]);
23768          break;
23769        case _util.OPS.setFlatness:
23770          this.setFlatness(args[0]);
23771          break;
23772        case _util.OPS.setGState:
23773          this.setGState(args[0]);
23774          break;
23775        case _util.OPS.fill:
23776          this.fill();
23777          break;
23778        case _util.OPS.eoFill:
23779          this.eoFill();
23780          break;
23781        case _util.OPS.stroke:
23782          this.stroke();
23783          break;
23784        case _util.OPS.fillStroke:
23785          this.fillStroke();
23786          break;
23787        case _util.OPS.eoFillStroke:
23788          this.eoFillStroke();
23789          break;
23790        case _util.OPS.clip:
23791          this.clip("nonzero");
23792          break;
23793        case _util.OPS.eoClip:
23794          this.clip("evenodd");
23795          break;
23796        case _util.OPS.paintSolidColorImageMask:
23797          this.paintSolidColorImageMask();
23798          break;
23799        case _util.OPS.paintImageXObject:
23800          this.paintImageXObject(args[0]);
23801          break;
23802        case _util.OPS.paintInlineImageXObject:
23803          this.paintInlineImageXObject(args[0]);
23804          break;
23805        case _util.OPS.paintImageMaskXObject:
23806          this.paintImageMaskXObject(args[0]);
23807          break;
23808        case _util.OPS.paintFormXObjectBegin:
23809          this.paintFormXObjectBegin(args[0], args[1]);
23810          break;
23811        case _util.OPS.paintFormXObjectEnd:
23812          this.paintFormXObjectEnd();
23813          break;
23814        case _util.OPS.closePath:
23815          this.closePath();
23816          break;
23817        case _util.OPS.closeStroke:
23818          this.closeStroke();
23819          break;
23820        case _util.OPS.closeFillStroke:
23821          this.closeFillStroke();
23822          break;
23823        case _util.OPS.closeEOFillStroke:
23824          this.closeEOFillStroke();
23825          break;
23826        case _util.OPS.nextLine:
23827          this.nextLine();
23828          break;
23829        case _util.OPS.transform:
23830          this.transform(args[0], args[1], args[2], args[3], args[4], args[5]);
23831          break;
23832        case _util.OPS.constructPath:
23833          this.constructPath(args[0], args[1]);
23834          break;
23835        case _util.OPS.endPath:
23836          this.endPath();
23837          break;
23838        case 92:
23839          this.group(opTreeElement.items);
23840          break;
23841        default:
23842          (0, _util.warn)(`Unimplemented operator ${fn}`);
23843          break;
23844      }
23845    }
23846  }
23847  setWordSpacing(wordSpacing) {
23848    this.current.wordSpacing = wordSpacing;
23849  }
23850  setCharSpacing(charSpacing) {
23851    this.current.charSpacing = charSpacing;
23852  }
23853  nextLine() {
23854    this.moveText(0, this.current.leading);
23855  }
23856  setTextMatrix(a, b, c, d, e, f) {
23857    const current = this.current;
23858    current.textMatrix = current.lineMatrix = [a, b, c, d, e, f];
23859    current.textMatrixScale = Math.hypot(a, b);
23860    current.x = current.lineX = 0;
23861    current.y = current.lineY = 0;
23862    current.xcoords = [];
23863    current.ycoords = [];
23864    current.tspan = this.svgFactory.createElement("svg:tspan");
23865    current.tspan.setAttributeNS(null, "font-family", current.fontFamily);
23866    current.tspan.setAttributeNS(null, "font-size", `${pf(current.fontSize)}px`);
23867    current.tspan.setAttributeNS(null, "y", pf(-current.y));
23868    current.txtElement = this.svgFactory.createElement("svg:text");
23869    current.txtElement.append(current.tspan);
23870  }
23871  beginText() {
23872    const current = this.current;
23873    current.x = current.lineX = 0;
23874    current.y = current.lineY = 0;
23875    current.textMatrix = _util.IDENTITY_MATRIX;
23876    current.lineMatrix = _util.IDENTITY_MATRIX;
23877    current.textMatrixScale = 1;
23878    current.tspan = this.svgFactory.createElement("svg:tspan");
23879    current.txtElement = this.svgFactory.createElement("svg:text");
23880    current.txtgrp = this.svgFactory.createElement("svg:g");
23881    current.xcoords = [];
23882    current.ycoords = [];
23883  }
23884  moveText(x, y) {
23885    const current = this.current;
23886    current.x = current.lineX += x;
23887    current.y = current.lineY += y;
23888    current.xcoords = [];
23889    current.ycoords = [];
23890    current.tspan = this.svgFactory.createElement("svg:tspan");
23891    current.tspan.setAttributeNS(null, "font-family", current.fontFamily);
23892    current.tspan.setAttributeNS(null, "font-size", `${pf(current.fontSize)}px`);
23893    current.tspan.setAttributeNS(null, "y", pf(-current.y));
23894  }
23895  showText(glyphs) {
23896    const current = this.current;
23897    const font = current.font;
23898    const fontSize = current.fontSize;
23899    if (fontSize === 0) {
23900      return;
23901    }
23902    const fontSizeScale = current.fontSizeScale;
23903    const charSpacing = current.charSpacing;
23904    const wordSpacing = current.wordSpacing;
23905    const fontDirection = current.fontDirection;
23906    const textHScale = current.textHScale * fontDirection;
23907    const vertical = font.vertical;
23908    const spacingDir = vertical ? 1 : -1;
23909    const defaultVMetrics = font.defaultVMetrics;
23910    const widthAdvanceScale = fontSize * current.fontMatrix[0];
23911    let x = 0;
23912    for (const glyph of glyphs) {
23913      if (glyph === null) {
23914        x += fontDirection * wordSpacing;
23915        continue;
23916      }
23916 else if (typeof glyph === "number") {
23917        x += spacingDir * glyph * fontSize / 1000;
23918        continue;
23919      }
23920      const spacing = (glyph.isSpace ? wordSpacing : 0) + charSpacing;
23921      const character = glyph.fontChar;
23922      let scaledX, scaledY;
23923      let width = glyph.width;
23924      if (vertical) {
23925        let vx;
23926        const vmetric = glyph.vmetric || defaultVMetrics;
23927        vx = glyph.vmetric ? vmetric[1] : width * 0.5;
23928        vx = -vx * widthAdvanceScale;
23929        const vy = vmetric[2] * widthAdvanceScale;
23930        width = vmetric ? -vmetric[0] : width;
23931        scaledX = vx / fontSizeScale;
23932        scaledY = (x + vy) / fontSizeScale;
23933      } else {
23934        scaledX = x / fontSizeScale;
23935        scaledY = 0;
23936      }
23937      if (glyph.isInFont || font.missingFile) {
23938        current.xcoords.push(current.x + scaledX);
23939        if (vertical) {
23940          current.ycoords.push(-current.y + scaledY);
23941        }
23942        current.tspan.textContent += character;
23943      } else {}
23944      const charWidth = vertical ? width * widthAdvanceScale - spacing * fontDirection : width * widthAdvanceScale + spacing * fontDirection;
23945      x += charWidth;
23946    }
23947    current.tspan.setAttributeNS(null, "x", current.xcoords.map(pf).join(" "));
23948    if (vertical) {
23949      current.tspan.setAttributeNS(null, "y", current.ycoords.map(pf).join(" "));
23950    } else {
23951      current.tspan.setAttributeNS(null, "y", pf(-current.y));
23952    }
23953    if (vertical) {
23954      current.y -= x;
23955    } else {
23956      current.x += x * textHScale;
23957    }
23958    current.tspan.setAttributeNS(null, "font-family", current.fontFamily);
23959    current.tspan.setAttributeNS(null, "font-size", `${pf(current.fontSize)}px`);
23960    if (current.fontStyle !== SVG_DEFAULTS.fontStyle) {
23961      current.tspan.setAttributeNS(null, "font-style", current.fontStyle);
23962    }
23963    if (current.fontWeight !== SVG_DEFAULTS.fontWeight) {
23964      current.tspan.setAttributeNS(null, "font-weight", current.fontWeight);
23965    }
23966    const fillStrokeMode = current.textRenderingMode & _util.TextRenderingMode.FILL_STROKE_MASK;
23967    if (fillStrokeMode === _util.TextRenderingMode.FILL || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) {
23968      if (current.fillColor !== SVG_DEFAULTS.fillColor) {
23969        current.tspan.setAttributeNS(null, "fill", current.fillColor);
23970      }
23971      if (current.fillAlpha < 1) {
23972        current.tspan.setAttributeNS(null, "fill-opacity", current.fillAlpha);
23973      }
23974    } else if (current.textRenderingMode === _util.TextRenderingMode.ADD_TO_PATH) {
23975      current.tspan.setAttributeNS(null, "fill", "transparent");
23976    } else {
23977      current.tspan.setAttributeNS(null, "fill", "none");
23978    }
23979    if (fillStrokeMode === _util.TextRenderingMode.STROKE || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) {
23980      const lineWidthScale = 1 / (current.textMatrixScale || 1);
23981      this._setStrokeAttributes(current.tspan, lineWidthScale);
23982    }
23983    let textMatrix = current.textMatrix;
23984    if (current.textRise !== 0) {
23985      textMatrix = textMatrix.slice();
23986      textMatrix[5] += current.textRise;
23987    }
23988    current.txtElement.setAttributeNS(null, "transform", `${pm(textMatrix)} scale(${pf(textHScale)}, -1)`);
23989    current.txtElement.setAttributeNS(XML_NS, "xml:space", "preserve");
23990    current.txtElement.append(current.tspan);
23991    current.txtgrp.append(current.txtElement);
23992    this._ensureTransformGroup().append(current.txtElement);
23993  }
23994  setLeadingMoveText(x, y) {
23995    this.setLeading(-y);
23996    this.moveText(x, y);
23997  }
23998  addFontStyle(fontObj) {
23999    if (!fontObj.data) {
24000      throw new Error("addFontStyle: No font data available, " + 'ensure that the "fontExtraProperties" API parameter is set.');
24001    }
24002    if (!this.cssStyle) {
24003      this.cssStyle = this.svgFactory.createElement("svg:style");
24004      this.cssStyle.setAttributeNS(null, "type", "text/css");
24005      this.defs.append(this.cssStyle);
24006    }
24007    const url = createObjectURL(fontObj.data, fontObj.mimetype, this.forceDataSchema);
24008    this.cssStyle.textContent += `@font-face { font-family: "${fontObj.loadedName}";` + ` src: url(${url}); }\n`;
24009  }
24010  setFont(details) {
24011    const current = this.current;
24012    const fontObj = this.commonObjs.get(details[0]);
24013    let size = details[1];
24014    current.font = fontObj;
24015    if (this.embedFonts && !fontObj.missingFile && !this.embeddedFonts[fontObj.loadedName]) {
24016      this.addFontStyle(fontObj);
24017      this.embeddedFonts[fontObj.loadedName] = fontObj;
24018    }
24019    current.fontMatrix = fontObj.fontMatrix || _util.FONT_IDENTITY_MATRIX;
24020    let bold = "normal";
24021    if (fontObj.black) {
24022      bold = "900";
24023    } else if (fontObj.bold) {
24024      bold = "bold";
24025    }
24026    const italic = fontObj.italic ? "italic" : "normal";
24027    if (size < 0) {
24028      size = -size;
24029      current.fontDirection = -1;
24030    } else {
24031      current.fontDirection = 1;
24032    }
24033    current.fontSize = size;
24034    current.fontFamily = fontObj.loadedName;
24035    current.fontWeight = bold;
24036    current.fontStyle = italic;
24037    current.tspan = this.svgFactory.createElement("svg:tspan");
24038    current.tspan.setAttributeNS(null, "y", pf(-current.y));
24039    current.xcoords = [];
24040    current.ycoords = [];
24041  }
24042  endText() {
24043    const current = this.current;
24044    if (current.textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG && current.txtElement?.hasChildNodes()) {
24045      current.element = current.txtElement;
24046      this.clip("nonzero");
24047      this.endPath();
24048    }
24049  }
24050  setLineWidth(width) {
24051    if (width > 0) {
24052      this.current.lineWidth = width;
24053    }
24054  }
24055  setLineCap(style) {
24056    this.current.lineCap = LINE_CAP_STYLES[style];
24057  }
24058  setLineJoin(style) {
24059    this.current.lineJoin = LINE_JOIN_STYLES[style];
24060  }
24061  setMiterLimit(limit) {
24062    this.current.miterLimit = limit;
24063  }
24064  setStrokeAlpha(strokeAlpha) {
24065    this.current.strokeAlpha = strokeAlpha;
24066  }
24067  setStrokeRGBColor(r, g, b) {
24068    this.current.strokeColor = _util.Util.makeHexColor(r, g, b);
24069  }
24070  setFillAlpha(fillAlpha) {
24071    this.current.fillAlpha = fillAlpha;
24072  }
24073  setFillRGBColor(r, g, b) {
24074    this.current.fillColor = _util.Util.makeHexColor(r, g, b);
24075    this.current.tspan = this.svgFactory.createElement("svg:tspan");
24076    this.current.xcoords = [];
24077    this.current.ycoords = [];
24078  }
24079  setStrokeColorN(args) {
24080    this.current.strokeColor = this._makeColorN_Pattern(args);
24081  }
24082  setFillColorN(args) {
24083    this.current.fillColor = this._makeColorN_Pattern(args);
24084  }
24085  shadingFill(args) {
24086    const {
24087      width,
24088      height
24089    } = this.viewport;
24090    const inv = _util.Util.inverseTransform(this.transformMatrix);
24091    const [x0, y0, x1, y1] = _util.Util.getAxialAlignedBoundingBox([0, 0, width, height], inv);
24092    const rect = this.svgFactory.createElement("svg:rect");
24093    rect.setAttributeNS(null, "x", x0);
24094    rect.setAttributeNS(null, "y", y0);
24095    rect.setAttributeNS(null, "width", x1 - x0);
24096    rect.setAttributeNS(null, "height", y1 - y0);
24097    rect.setAttributeNS(null, "fill", this._makeShadingPattern(args));
24098    if (this.current.fillAlpha < 1) {
24099      rect.setAttributeNS(null, "fill-opacity", this.current.fillAlpha);
24100    }
24101    this._ensureTransformGroup().append(rect);
24102  }
24103  _makeColorN_Pattern(args) {
24104    if (args[0] === "TilingPattern") {
24105      return this._makeTilingPattern(args);
24106    }
24107    return this._makeShadingPattern(args);
24108  }
24109  _makeTilingPattern(args) {
24110    const color = args[1];
24111    const operatorList = args[2];
24112    const matrix = args[3] || _util.IDENTITY_MATRIX;
24113    const [x0, y0, x1, y1] = args[4];
24114    const xstep = args[5];
24115    const ystep = args[6];
24116    const paintType = args[7];
24117    const tilingId = `shading${shadingCount++}`;
24118    const [tx0, ty0, tx1, ty1] = _util.Util.normalizeRect([..._util.Util.applyTransform([x0, y0
24118], matrix), ..._util.Util.applyTransform([x1, y1], matrix)]);
24119    const [xscale, yscale] = _util.Util.singularValueDecompose2dScale(matrix);
24120    const txstep = xstep * xscale;
24121    const tystep = ystep * yscale;
24122    const tiling = this.svgFactory.createElement("svg:pattern");
24123    tiling.setAttributeNS(null, "id", tilingId);
24124    tiling.setAttributeNS(null, "patternUnits", "userSpaceOnUse");
24125    tiling.setAttributeNS(null, "width", txstep);
24126    tiling.setAttributeNS(null, "height", tystep);
24127    tiling.setAttributeNS(null, "x", `${tx0}`);
24128    tiling.setAttributeNS(null, "y", `${ty0}`);
24129    const svg = this.svg;
24130    const transformMatrix = this.transformMatrix;
24131    const fillColor = this.current.fillColor;
24132    const strokeColor = this.current.strokeColor;
24133    const bbox = this.svgFactory.create(tx1 - tx0, ty1 - ty0);
24134    this.svg = bbox;
24135    this.transformMatrix = matrix;
24136    if (paintType === 2) {
24137      const cssColor = _util.Util.makeHexColor(...color);
24138      this.current.fillColor = cssColor;
24139      this.current.strokeColor = cssColor;
24140    }
24141    this.executeOpTree(this.convertOpList(operatorList));
24142    this.svg = svg;
24143    this.transformMatrix = transformMatrix;
24144    this.current.fillColor = fillColor;
24145    this.current.strokeColor = strokeColor;
24146    tiling.append(bbox.childNodes[0]);
24147    this.defs.append(tiling);
24148    return `url(#${tilingId})`;
24149  }
24150  _makeShadingPattern(args) {
24151    if (typeof args === "string") {
24152      args = this.objs.get(args);
24153    }
24154    switch (args[0]) {
24155      case "RadialAxial":
24156        const shadingId = `shading${shadingCount++}`;
24157        const colorStops = args[3];
24158        let gradient;
24159        switch (args[1]) {
24160          case "axial":
24161            const point0 = args[4];
24162            const point1 = args[5];
24163            gradient = this.svgFactory.createElement("svg:linearGradient");
24164            gradient.setAttributeNS(null, "id", shadingId);
24165            gradient.setAttributeNS(null, "gradientUnits", "userSpaceOnUse");
24166            gradient.setAttributeNS(null, "x1", point0[0]);
24167            gradient.setAttributeNS(null, "y1", point0[1]);
24168            gradient.setAttributeNS(null, "x2", point1[0]);
24169            gradient.setAttributeNS(null, "y2", point1[1]);
24170            break;
24171          case "radial":
24172            const focalPoint = args[4];
24173            const circlePoint = args[5];
24174            const focalRadius = args[6];
24175            const circleRadius = args[7];
24176            gradient = this.svgFactory.createElement("svg:radialGradient");
24177            gradient.setAttributeNS(null, "id", shadingId);
24178            gradient.setAttributeNS(null, "gradientUnits", "userSpaceOnUse");
24179            gradient.setAttributeNS(null, "cx", circlePoint[0]);
24180            gradient.setAttributeNS(null, "cy", circlePoint[1]);
24181            gradient.setAttributeNS(null, "r", circleRadius);
24182            gradient.setAttributeNS(null, "fx", focalPoint[0]);
24183            gradient.setAttributeNS(null, "fy", focalPoint[1]);
24184            gradient.setAttributeNS(null, "fr", focalRadius);
24185            break;
24186          default:
24187            throw new Error(`Unknown RadialAxial type: ${args[1]}`);
24188        }
24189        for (const colorStop of colorStops) {
24190          const stop = this.svgFactory.createElement("svg:stop");
24191          stop.setAttributeNS(null, "offset", colorStop[0]);
24192          stop.setAttributeNS(null, "stop-color", colorStop[1]);
24193          gradient.append(stop);
24194        }
24195        this.defs.append(gradient);
24196        return `url(#${shadingId})`;
24197      case "Mesh":
24198        (0, _util.warn)("Unimplemented pattern Mesh");
24199        return null;
24200      case "Dummy":
24201        return "hotpink";
24202      default:
24203        throw new Error(`Unknown IR type: ${args[0]}`);
24204    }
24205  }
24206  setDash(dashArray, dashPhase) {
24207    this.current.dashArray = dashArray;
24208    this.current.dashPhase = dashPhase;
24209  }
24210  constructPath(ops, args) {
24211    const current = this.current;
24212    let x = current.x,
24213      y = current.y;
24214    let d = [];
24215    let j = 0;
24216    for (const op of ops) {
24217      switch (op | 0) {
24218        case _util.OPS.rectangle:
24219          x = args[j++];
24220          y = args[j++];
24221          const width = args[j++];
24222          const height = args[j++];
24223          const xw = x + width;
24224          const yh = y + height;
24225          d.push("M", pf(x), pf(y), "L", pf(xw), pf(y), "L", pf(xw), pf(yh), "L", pf(x), pf(yh), "Z");
24226          break;
24227        case _util.OPS.moveTo:
24228          x = args[j++];
24229          y = args[j++];
24230          d.push("M", pf(x), pf(y));
24231          break;
24232        case _util.OPS.lineTo:
24233          x = args[j++];
24234          y = args[j++];
24235          d.push("L", pf(x), pf(y));
24236          break;
24237        case _util.OPS.curveTo:
24238          x = args[j + 4];
24239          y = args[j + 5];
24240          d.push("C", pf(args[j]), pf(args[j + 1]), pf(args[j + 2]), pf(args[j + 3]), pf(x), pf(y));
24241          j += 6;
24242          break;
24243        case _util.OPS.curveTo2:
24244          d.push("C", pf(x), pf(y), pf(args[j]), pf(args[j + 1]), pf(args[j + 2]), pf(args[j + 3]));
24245          x = args[j + 2];
24246          y = args[j + 3];
24247          j += 4;
24248          break;
24249        case _util.OPS.curveTo3:
24250          x = args[j + 2];
24251          y = args[j + 3];
24252          d.push("C", pf(args[j]), pf(args[j + 1]), pf(x), pf(y), pf(x), pf(y));
24253          j += 4;
24254          break;
24255        case _util.OPS.closePath:
24256          d.push("Z");
24257          break;
24258      }
24259    }
24260    d = d.join(" ");
24261    if (current.path && ops.length > 0 && ops[0] !== _util.OPS.rectangle && ops[0] !== _util.OPS.moveTo) {
24262      d = current.path.getAttributeNS(null, "d") + d;
24263    } else {
24264      current.path = this.svgFactory.createElement("svg:path");
24265      this._ensureTransformGroup().append(current.path);
24266    }
24267    current.path.setAttributeNS(null, "d", d);
24268    current.path.setAttributeNS(null, "fill", "none");
24269    current.element = current.path;
24270    current.setCurrentPoint(x, y);
24271  }
24272  endPath() {
24273    const current = this.current;
24274    current.path = null;
24275    if (!this.pendingClip) {
24276      return;
24277    }
24278    if (!current.element) {
24279      this.pendingClip = null;
24280      return;
24281    }
24282    const clipId = `clippath${clipCount++}`;
24283    const clipPath = this.svgFactory.createElement("svg:clipPath");
24284    clipPath.setAttributeNS(null, "id", clipId);
24285    clipPath.setAttributeNS(null, "transform", pm(this.transformMatrix));
24286    const clipElement = current.element.cloneNode(true);
24287    if (this.pendingClip === "evenodd") {
24288      clipElement.setAttributeNS(null, "clip-rule", "evenodd");
24289    } else {
24290      clipElement.setAttributeNS(null, "clip-rule", "nonzero");
24291    }
24292    this.pendingClip = null;
24293    clipPath.append(clipElement);
24294    this.defs.append(clipPath);
24295    if (current.activeClipUrl) {
24296      current.clipGroup = null;
24297      for (const prev of this.extraStack) {
24298        prev.clipGroup = null;
24299      }
24300      clipPath.setAttributeNS(null, "clip-path", current.activeClipUrl);
24301    }
24302    current.activeClipUrl = `url(#${clipId})`;
24303    this.tgrp = null;
24304  }
24305  clip(type) {
24306    this.pendingClip = type;
24307  }
24308  closePath() {
24309    const current = this.current;
24310    if (current.path) {
24311      const d = `${current.path.getAttributeNS(null, "d")}Z`;
24312      current.path.setAttributeNS(null, "d", d);
24313    }
24314  }
24315  setLeading(leading) {
24316    this.current.leading = -leading;
24317  }
24318  setTextRise(textRise) {
24319    this.current.textRise = textRise;
24320  }
24321  setTextRenderingMode(textRenderingMode) {
24322    this.current.textRenderingMode = textRenderingMode;
24323  }
24324  setHScale(scale) {
24325    this.current.textHScale = scale / 100;
24326  }
24327  setRenderingIntent(intent) {}
24328  setFlatness(flatness) {}
24329  setGState(states) {
24330    for (const [key, value] of states) {
24331      switch (key) {
24332        case "LW":
24333          this.setLineWidth(value);
24334          break;
24335        case "LC":
24336          this.setLineCap(value);
24337          break;
24338        case "LJ":
24339          this.setLineJoin(value);
24340          break;
24341        case "ML":
24342          this.setMiterLimit(value);
24343          break;
24344        case "D":
24345          this.setDash(value[0], value[1]);
24346          break;
24347        case "RI":
24348          this.setRenderingIntent(value);
24349          break;
24350        case "FL":
24351          this.setFlatness(value);
24352          break;
24353        case "Font":
24354          this.setFont(value);
24355          break;
24356        case "CA":
24357          this.setStrokeAlpha(value);
24358          break;
24359        case "ca":
24360          this.setFillAlpha(value);
24361          break;
24362        default:
24363          (0, _util.warn)(`Unimplemented graphic state operator ${key}`);
24364          break;
24365      }
24366    }
24367  }
24368  fill() {
24369    const current = this.current;
24370    if (current.element) {
24371      current.element.setAttributeNS(null, "fill", current.fillColor);
24372      current.element.setAttributeNS(null, "fill-opacity", current.fillAlpha);
24373      this.endPath();
24374    }
24375  }
24376  stroke() {
24377    const current = this.current;
24378    if (current.element) {
24379      this._setStrokeAttributes(current.element);
24380      current.element.setAttributeNS(null, "fill", "none");
24381      this.endPath();
24382    }
24383  }
24384  _setStrokeAttributes(element, lineWidthScale = 1) {
24385    const current = this.current;
24386    let dashArray = current.dashArray;
24387    if (lineWidthScale !== 1 && dashArray.length > 0) {
24388      dashArray = dashArray.map(function (value) {
24389        return lineWidthScale * value;
24390      });
24391    }
24392    element.setAttributeNS(null, "stroke", current.strokeColor);
24393    element.setAttributeNS(null, "stroke-opacity", current.strokeAlpha);
24394    element.setAttributeNS(null, "stroke-miterlimit", pf(current.miterLimit));
24395    element.setAttributeNS(null, "stroke-linecap", current.lineCap);
24396    element.setAttributeNS(null, "stroke-linejoin", current.lineJoin);
24397    element.setAttributeNS(null, "stroke-width", pf(lineWidthScale * current.lineWidth) + "px");
24398    element.setAttributeNS(null, "stroke-dasharray", dashArray.map(pf).join(" "));
24399    element.setAttributeNS(null, "stroke-dashoffset", pf(lineWidthScale * current.dashPhase) + "px");
24400  }
24401  eoFill() {
24402    this.current.element?.setAttributeNS(null, "fill-rule", "evenodd");
24403    this.fill();
24404  }
24405  fillStroke() {
24406    this.stroke();
24407    this.fill();
24408  }
24409  eoFillStroke() {
24410    this.current.element?.setAttributeNS(null, "fill-rule", "evenodd");
24411    this.fillStroke();
24412  }
24413  closeStroke() {
24414    this.closePath();
24415    this.stroke();
24416  }
24417  closeFillStroke() {
24418    this.closePath();
24419    this.fillStroke();
24420  }
24421  closeEOFillStroke() {
24422    this.closePath();
24423    this.eoFillStroke();
24424  }
24425  paintSolidColorImageMask() {
24426    const rect = this.svgFactory.createElement("svg:rect");
24427    rect.setAttributeNS(null, "x", "0");
24428    rect.setAttributeNS(null, "y", "0");
24429    rect.setAttributeNS(null, "width", "1px");
24430    rect.setAttributeNS(null, "height", "1px");
24431    rect.setAttributeNS(null, "fill", this.current.fillColor);
24432    this._ensureTransformGroup().append(rect);
24433  }
24434  paintImageXObject(objId) {
24435    const imgData = this.getObject(objId);
24436    if (!imgData) {
24437      (0, _util.warn)(`Dependent image with object ID ${objId} is not ready yet`);
24438      return;
24439    }
24440    this.paintInlineImageXObject(imgData);
24441  }
24442  paintInlineImageXObject(imgData, mask) {
24443    const width = imgData.width;
24444    const height = imgData.height;
24445    const imgSrc = convertImgDataToPng(imgData, this.forceDataSchema, !!mask);
24446    const cliprect = this.svgFactory.createElement("svg:rect");
24447    cliprect.setAttributeNS(null, "x", "0");
24448    cliprect.setAttributeNS(null, "y", "0");
24449    cliprect.setAttributeNS(null, "width", pf(width));
24450    cliprect.setAttributeNS(null, "height", pf(height));
24451    this.current.element = cliprect;
24452    this.clip("nonzero");
24453    const imgEl = this.svgFactory.createElement("svg:image");
24454    imgEl.setAttributeNS(XLINK_NS, "xlink:href", imgSrc);
24455    imgEl.setAttributeNS(null, "x", "0");
24456    imgEl.setAttributeNS(null, "y", pf(-height));
24457    imgEl.setAttributeNS(null, "width", pf(width) + "px");
24458    imgEl.setAttributeNS(null, "height", pf(height) + "px");
24459    imgEl.setAttributeNS(null, "transform", `scale(${pf(1 / width)} ${pf(-1 / height)})`);
24460    if (mask) {
24461      mask.append(imgEl);
24462    } else {
24463      this._ensureTransformGroup().append(imgEl);
24464    }
24465  }
24466  paintImageMaskXObject(img) {
24467    const imgData = this.getObject(img.data, img);
24468    if (imgData.bitmap) {
24469      (0, _util.warn)("paintImageMaskXObject: ImageBitmap support is not implemented, " + "ensure that the `isOffscreenCanvasSupported` API parameter is disabled.");
24470      return;
24471    }
24472    const current = this.current;
24473    const width = imgData.width;
24474    const height = imgData.height;
24475    const fillColor = current.fillColor;
24476    current.maskId = `mask${maskCount++}`;
24477    const mask = this.svgFactory.createElement("svg:mask");
24478    mask.setAttributeNS(null, "id", current.maskId);
24479    const rect = this.svgFactory.createElement("svg:rect");
24480    rect.setAttributeNS(null, "x", "0");
24481    rect.setAttributeNS(null, "y", "0");
24482    rect.setAttributeNS(null, "width", pf(width));
24483    rect.setAttributeNS(null, "height", pf(height));
24484    rect.setAttributeNS(null, "fill", fillColor);
24485    rect.setAttributeNS(null, "mask", `url(#${current.maskId})`);
24486    this.defs.append(mask);
24487    this._ensureTransformGroup().append(rect);
24488    this.paintInlineImageXObject(imgData, mask);
24489  }
24490  paintFormXObjectBegin(matrix, bbox) {
24491    if (Array.isArray(matrix) && matrix.length === 6) {
24492      this.transform(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]);
24493    }
24494    if (bbox) {
24495      const width = bbox[2] - bbox[0];
24496      const height = bbox[3] - bbox[1];
24497      const cliprect = this.svgFactory.createElement("svg:rect");
24498      cliprect.setAttributeNS(null, "x", bbox[0]);
24499      cliprect.setAttributeNS(null, "y", bbox[1]);
24500      cliprect.setAttributeNS(null, "width", pf(width));
24501      cliprect.setAttributeNS(null, "height", pf(height));
24502      this.current.element = cliprect;
24503      this.clip("nonzero");
24504      this.endPath();
24505    }
24506  }
24507  paintFormXObjectEnd() {}
24508  _initialize(viewport) {
24509    const svg = this.svgFactory.create(viewport.width, viewport.height);
24510    const definitions = this.svgFactory.createElement("svg:defs");
24511    svg.append(definitions);
24512    this.defs = definitions;
24513    const rootGroup = this.svgFactory.createElement("svg:g");
24514    rootGroup.setAttributeNS(null, "transform", pm(viewport.transform));
24515    svg.append(rootGroup);
24516    this.svg = rootGroup;
24517    return svg;
24518  }
24519  _ensureClipGroup() {
24520    if (!this.current.clipGroup) {
24521      const clipGroup = this.svgFactory.createElement("svg:g");
24522      clipGroup.setAttributeNS(null, "clip-path", this.current.activeClipUrl);
24523      this.svg.append(clipGroup);
24524      this.current.clipGroup = clipGroup;
24525    }
24526    return this.current.clipGroup;
24527  }
24528  _ensureTransformGroup() {
24529    if (!this.tgrp) {
24530      this.tgrp = this.svgFactory.createElement("svg:g");
24531      this.tgrp.setAttributeNS(null, "transform", pm(this.transformMatrix));
24532      if (this.current.activeClipUrl) {
24533        this._ensureClipGroup().append(this.tgrp);
24534      } else {
24535        this.svg.append(this.tgrp);
24536      }
24537    }
24538    return this.tgrp;
24539  }
24540}
24541exports.SVGGraphics = SVGGraphics;
24542
24543/***/ }),
24544/* 25 */
24545/***/ ((__unused_webpack_module, exports) => {
24546
24547
24548
24549Object.defineProperty(exports, "__esModule", ({
24550  value: true
24551}));
24552exports.XfaText = void 0;
24553class XfaText {
24554  static textContent(xfa) {
24555    const items = [];
24556    const output = {
24557      items,
24558      styles: Object.create(null)
24559    };
24560    function walk(node) {
24561      if (!node) {
24562        return;
24563      }
24564      let str = null;
24565      const name = node.name;
24566      if (name === "#text") {
24567        str = node.value;
24568      } else if (!XfaText.shouldBuildText(name)) {
24569        return;
24570      } else if (node?.attributes?.textContent) {
24571        str = node.attributes.textContent;
24572      } else if (node.value) {
24573        str = node.value;
24574      }
24575      if (str !== null) {
24576        items.push({
24577          str
24578        });
24579      }
24580      if (!node.children) {
24581        return;
24582      }
24583      for (const child of node.children) {
24584        walk(child);
24585      }
24586    }
24587    walk(xfa);
24588    return output;
24589  }
24590  static shouldBuildText(name) {
24591    return !(name === "textarea" || name === "input" || name === "option" || name === "select");
24592  }
24593}
24594exports.XfaText = XfaText;
24595
24596/***/ }),
24597/* 26 */
24598/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
24599
24600
24601
24602Object.defineProperty(exports, "__esModule", ({
24603  value: true
24604}));
24605exports.TextLayerRenderTask = void 0;
24606exports.renderTextLayer = renderTextLayer;
24607exports.updateTextLayer = updateTextLayer;
24608var _util = __w_pdfjs_require__(1);
24609var _display_utils = __w_pdfjs_require__(6);
24610const MAX_TEXT_DIVS_TO_RENDER = 100000;
24611const DEFAULT_FONT_SIZE = 30;
24612const DEFAULT_FONT_ASCENT = 0.8;
24613const ascentCache = new Map();
24614function getCtx(size, isOffscreenCanvasSupported) {
24615  let ctx;
24616  if (isOffscreenCanvasSupported && _util.FeatureTest.isOffscreenCanvasSupported) {
24617    ctx = new OffscreenCanvas(size, size).getContext("2d", {
24618      alpha: false
24619    });
24620  } else {
24621    const canvas = document.createElement("canvas");
24622    canvas.width = canvas.height = size;
24623    ctx = canvas.getContext("2d", {
24624      alpha: false
24625    });
24626  }
24627  return ctx;
24628}
24629function getAscent(fontFamily, isOffscreenCanvasSupported) {
24630  const cachedAscent = ascentCache.get(fontFamily);
24631  if (cachedAscent) {
24632    return cachedAscent;
24633  }
24634  const ctx = getCtx(DEFAULT_FONT_SIZE, isOffscreenCanvasSupported);
24635  ctx.font = `${DEFAULT_FONT_SIZE}px ${fontFamily}`;
24636  const metrics = ctx.measureText("");
24637  let ascent = metrics.fontBoundingBoxAscent;
24638  let descent = Math.abs(metrics.fontBoundingBoxDescent);
24639  if (ascent) {
24640    const ratio = ascent / (ascent + descent);
24641    ascentCache.set(fontFamily, ratio);
24642    ctx.canvas.width = ctx.canvas.height = 0;
24643    return ratio;
24644  }
24645  ctx.strokeStyle = "red";
24646  ctx.clearRect(0, 0, DEFAULT_FONT_SIZE, DEFAULT_FONT_SIZE);
24647  ctx.strokeText("g", 0, 0);
24648  let pixels = ctx.getImageData(0, 0, DEFAULT_FONT_SIZE, DEFAULT_FONT_SIZE).data;
24649  descent = 0;
24650  for (let i = pixels.length - 1 - 3; i >= 0; i -= 4) {
24651    if (pixels[i] > 0) {
24652      descent = Math.ceil(i / 4 / DEFAULT_FONT_SIZE);
24653      break;
24654    }
24655  }
24656  ctx.clearRect(0, 0, DEFAULT_FONT_SIZE, DEFAULT_FONT_SIZE);
24657  ctx.strokeText("A", 0, DEFAULT_FONT_SIZE);
24658  pixels = ctx.getImageData(0, 0, DEFAULT_FONT_SIZE, DEFAULT_FONT_SIZE).data;
24659  ascent = 0;
24660  for (let i = 0, ii = pixels.length; i < ii; i += 4) {
24661    if (pixels[i] > 0) {
24662      ascent = DEFAULT_FONT_SIZE - Math.floor(i / 4 / DEFAULT_FONT_SIZE);
24663      break;
24664    }
24665  }
24666  ctx.canvas.width = ctx.canvas.height = 0;
24667  if (ascent) {
24668    const ratio = ascent / (ascent + descent);
24669    ascentCache.set(fontFamily, ratio);
24670    return ratio;
24671  }
24672  ascentCache.set(fontFamily, DEFAULT_FONT_ASCENT);
24673  return DEFAULT_FONT_ASCENT;
24674}
24675function appendText(task, geom, styles) {
24676  const textDiv = document.createElement("span");
24677  const textDivProperties = {
24678    angle: 0,
24679    canvasWidth: 0,
24680    hasText: geom.str !== "",
24681    hasEOL: geom.hasEOL,
24682    fontSize: 0
24683  };
24684  task._textDivs.push(textDiv);
24685  const tx = _util.Util.transform(task._transform, geom.transform);
24686  let angle = Math.atan2(tx[1], tx[0]);
24687  const style = styles[geom.fontName];
24688  if (style.vertical) {
24689    angle += Math.PI / 2;
24690  }
24691  const fontHeight = Math.hypot(tx[2], tx[3]);
24692  const fontAscent = fontHeight * getAscent(style.fontFamily, task._isOffscreenCanvasSupported);
24693  let left, top;
24694  if (angle === 0) {
24695    left = tx[4];
24696    top = tx[5] - fontAscent;
24697  } else {
24698    left = tx[4] + fontAscent * Math.sin(angle);
24699    top = tx[5] - fontAscent * Math.cos(angle);
24700  }
24701  const scaleFactorStr = "calc(var(--scale-factor)*";
24702  const divStyle = textDiv.style;
24703  if (task._container === task._rootContainer) {
24704    divStyle.left = `${(100 * left / task._pageWidth).toFixed(2)}%`;
24705    divStyle.top = `${(100 * top / task._pageHeight).toFixed(2)}%`;
24706  } else {
24707    divStyle.left = `${scaleFactorStr}${left.toFixed(2)}px)`;
24708    divStyle.top = `${scaleFactorStr}${top.toFixed(2)}px)`;
24709  }
24710  divStyle.fontSize = `${scaleFactorStr}${fontHeight.toFixed(2)}px)`;
24711  divStyle.fontFamily = style.fontFamily;
24712  textDivProperties.fontSize = fontHeight;
24713  textDiv.setAttribute("role", "presentation");
24714  textDiv.textContent = geom.str;
24715  textDiv.dir = geom.dir;
24716  if (task._fontInspectorEnabled) {
24717    textDiv.dataset.fontName = geom.fontName;
24718  }
24719  if (angle !== 0) {
24720    textDivProperties.angle = angle * (180 / Math.PI);
24721  }
24722  let shouldScaleText = false;
24723  if (geom.str.length > 1) {
24724    shouldScaleText = true;
24725  } else if (geom.str !== " " && geom.transform[0] !== geom.transform[3]) {
24726    const absScaleX = Math.abs(geom.transform[0]),
24727      absScaleY = Math.abs(geom.transform[3]);
24728    if (absScaleX !== absScaleY && Math.max(absScaleX, absScaleY) / Math.min(absScaleX, absScaleY) > 1.5) {
24729      shouldScaleText = true;
24730    }
24731  }
24732  if (shouldScaleText) {
24733    textDivProperties.canvasWidth = style.vertical ? geom.height : geom.width;
24734  }
24735  task._textDivProperties.set(textDiv, textDivProperties);
24736  if (task._isReadableStream) {
24737    task._layoutText(textDiv);
24738  }
24739}
24740function layout(params) {
24741  const {
24742    div,
24743    scale,
24744    properties,
24745    ctx,
24746    prevFontSize,
24747    prevFontFamily
24748  } = params;
24749  const {
24750    style
24751  } = div;
24752  let transform = "";
24753  if (properties.canvasWidth !== 0 && properties.hasText) {
24754    const {
24755      fontFamily
24756    } = style;
24757    const {
24758      canvasWidth,
24759      fontSize
24760    } = properties;
24761    if (prevFontSize !== fontSize || prevFontFamily !== fontFamily) {
24762      ctx.font = `${fontSize * scale}px ${fontFamily}`;
24763      params.prevFontSize = fontSize;
24764      params.prevFontFamily = fontFamily;
24765    }
24766    const {
24767      width
24768    } = ctx.measureText(div.textContent);
24769    if (width > 0) {
24770      transform = `scaleX(${canvasWidth * scale / width})`;
24771    }
24772  }
24773  if (properties.angle !== 0) {
24774    transform = `rotate(${properties.angle}deg) ${transform}`;
24775  }
24776  if (transform.length > 0) {
24777    style.transform = transform;
24778  }
24779}
24780function render(task) {
24781  if (task._canceled) {
24782    return;
24783  }
24784  const textDivs = task._textDivs;
24785  const capability = task._capability;
24786  const textDivsLength = textDivs.length;
24787  if (textDivsLength > MAX_TEXT_DIVS_TO_RENDER) {
24788    capability.resolve();
24789    return;
24790  }
24791  if (!task._isReadableStream) {
24792    for (const textDiv of textDivs) {
24793      task._layoutText(textDiv);
24794    }
24795  }
24796  capability.resolve();
24797}
24798class TextLayerRenderTask {
24799  constructor({
24800    textContentSource,
24801    container,
24802    viewport,
24803    textDivs,
24804    textDivProperties,
24805    textContentItemsStr,
24806    isOffscreenCanvasSupported
24807  }) {
24808    this._textContentSource = textContentSource;
24809    this._isReadableStream = textContentSource instanceof ReadableStream;
24810    this._container = this._rootContainer = container;
24811    this._textDivs = textDivs || [];
24812    this._textContentItemsStr = textContentItemsStr || [];
24813    this._isOffscreenCanvasSupported = isOffscreenCanvasSupported;
24814    this._fontInspectorEnabled = !!globalThis.FontInspector?.enabled;
24815    this._reader = null;
24816    this._textDivProperties = textDivProperties || new WeakMap();
24817    this._canceled = false;
24818    this._capability = new _util.PromiseCapability();
24819    this._layoutTextParams = {
24820      prevFontSize: null,
24821      prevFontFamily: null,
24822      div: null,
24823      scale: viewport.scale * (globalThis.devicePixelRatio || 1),
24824      properties: null,
24825      ctx: getCtx(0, isOffscreenCanvasSupported)
24826    };
24827    const {
24828      pageWidth,
24829      pageHeight,
24830      pageX,
24831      pageY
24832    } = viewport.rawDims;
24833    this._transform = [1, 0, 0, -1, -pageX, pageY + pageHeight];
24834    this._pageWidth = pageWidth;
24835    this._pageHeight = pageHeight;
24836    (0, _display_utils.setLayerDimensions)(container, viewport);
24837    this._capability.promise.finally(() => {
24838      this._layoutTextParams = null;
24839    }).catch(() => {});
24840  }
24841  get promise() {
24842    return this._capability.promise;
24843  }
24844  cancel() {
24845    this._canceled = true;
24846    if (this._reader) {
24847      this._reader.cancel(new _util.AbortException("TextLayer task cancelled.")).catch(() => {});
24848      this._reader = null;
24849    }
24850    this._capability.reject(new _util.AbortException("TextLayer task cancelled."));
24851  }
24852  _processItems(items, styleCache) {
24853    for (const item of items) {
24854      if (item.str === undefined) {
24855        if (item.type === "beginMarkedContentProps" || item.type === "beginMarkedContent") {
24856          const parent = this._container;
24857          this._container = document.createElement("span");
24858          this._container.classList.add("markedContent");
24859          if (item.id !== null) {
24860            this._container.setAttribute("id", `${item.id}`);
24861          }
24862          parent.append(this._container);
24863        } else if (item.type === "endMarkedContent") {
24864          this._container = this._container.parentNode;
24865        }
24866        continue;
24867      }
24868      this._textContentItemsStr.push(item.str);
24869      appendText(this, item, styleCache);
24870    }
24871  }
24872  _layoutText(textDiv) {
24873    const textDivProperties = this._layoutTextParams.properties = this._textDivProperties.get(textDiv);
24874    this._layoutTextParams.div = textDiv;
24875    layout(this._layoutTextParams);
24876    if (textDivProperties.hasText) {
24877      this._container.append(textDiv);
24878    }
24879    if (textDivProperties.hasEOL) {
24880      const br = document.createElement("br");
24881      br.setAttribute("role", "presentation");
24882      this._container.append(br);
24883    }
24884  }
24885  _render() {
24886    const capability = new _util.PromiseCapability();
24887    let styleCache = Object.create(null);
24888    if (this._isReadableStream) {
24889      const pump = () => {
24890        this._reader.read().then(({
24891          value,
24892          done
24893        }) => {
24894          if (done) {
24895            capability.resolve();
24896            return;
24897          }
24898          Object.assign(styleCache, value.styles);
24899          this._processItems(value.items, styleCache);
24900          pump();
24901        }, capability.reject);
24902      };
24903      this._reader = this._textContentSource.getReader();
24904      pump();
24905    } else if (this._textContentSource) {
24906      const {
24907        items,
24908        styles
24909      } = this._textContentSource;
24910      this._processItems(items, styles);
24911      capability.resolve();
24912    } else {
24913      throw new Error('No "textContentSource" parameter specified.');
24914    }
24915    capability.promise.then(() => {
24916      styleCache = null;
24917      render(this);
24918    }, this._capability.reject);
24919  }
24920}
24921exports.TextLayerRenderTask = TextLayerRenderTask;
24922function renderTextLayer(params) {
24923  if (!params.textContentSource && (params.textContent || params.textContentStream)) {
24924    (0, _display_utils.deprecated)("The TextLayerRender `textContent`/`textContentStream` parameters " + "will be removed in the future, please use `textContentSource` instead.");
24925    params.textContentSource = params.textContent || params.textContentStream;
24926  }
24927  const {
24928    container,
24929    viewport
24930  }
24930 = params;
24931  const style = getComputedStyle(container);
24932  const visibility = style.getPropertyValue("visibility");
24933  const scaleFactor = parseFloat(style.getPropertyValue("--scale-factor"));
24934  if (visibility === "visible" && (!scaleFactor || Math.abs(scaleFactor - viewport.scale) > 1e-5)) {
24935    console.error("The `--scale-factor` CSS-variable must be set, " + "to the same value as `viewport.scale`, " + "either on the `container`-element itself or higher up in the DOM.");
24936  }
24937  const task = new TextLayerRenderTask(params);
24938  task._render();
24939  return task;
24940}
24941function updateTextLayer({
24942  container,
24943  viewport,
24944  textDivs,
24945  textDivProperties,
24946  isOffscreenCanvasSupported,
24947  mustRotate = true,
24948  mustRescale = true
24949}) {
24950  if (mustRotate) {
24951    (0, _display_utils.setLayerDimensions)(container, {
24952      rotation: viewport.rotation
24953    });
24954  }
24955  if (mustRescale) {
24956    const ctx = getCtx(0, isOffscreenCanvasSupported);
24957    const scale = viewport.scale * (globalThis.devicePixelRatio || 1);
24958    const params = {
24959      prevFontSize: null,
24960      prevFontFamily: null,
24961      div: null,
24962      scale,
24963      properties: null,
24964      ctx
24965    };
24966    for (const div of textDivs) {
24967      params.properties = textDivProperties.get(div);
24968      params.div = div;
24969      layout(params);
24970    }
24971  }
24972}
24973
24974/***/ }),
24975/* 27 */
24976/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
24977
24978
24979
24980Object.defineProperty(exports, "__esModule", ({
24981  value: true
24982}));
24983exports.AnnotationEditorLayer = void 0;
24984var _util = __w_pdfjs_require__(1);
24985var _editor = __w_pdfjs_require__(4);
24986var _freetext = __w_pdfjs_require__(28);
24987var _ink = __w_pdfjs_require__(33);
24988var _display_utils = __w_pdfjs_require__(6);
24989var _stamp = __w_pdfjs_require__(34);
24990class AnnotationEditorLayer {
24991  #accessibilityManager;
24992  #allowClick = false;
24993  #annotationLayer = null;
24994  #boundPointerup = this.pointerup.bind(this);
24995  #boundPointerdown = this.pointerdown.bind(this);
24996  #editors = new Map();
24997  #hadPointerDown = false;
24998  #isCleaningUp = false;
24999  #isDisabling = false;
25000  #uiManager;
25001  static _initialized = false;
25002  constructor({
25003    uiManager,
25004    pageIndex,
25005    div,
25006    accessibilityManager,
25007    annotationLayer,
25008    viewport,
25009    l10n
25010  }) {
25011    const editorTypes = [_freetext.FreeTextEditor, _ink.InkEditor, _stamp.StampEditor];
25012    if (!AnnotationEditorLayer._initialized) {
25013      AnnotationEditorLayer._initialized = true;
25014      for (const editorType of editorTypes) {
25015        editorType.initialize(l10n);
25016      }
25017    }
25018    uiManager.registerEditorTypes(editorTypes);
25019    this.#uiManager = uiManager;
25020    this.pageIndex = pageIndex;
25021    this.div = div;
25022    this.#accessibilityManager = accessibilityManager;
25023    this.#annotationLayer = annotationLayer;
25024    this.viewport = viewport;
25025    this.#uiManager.addLayer(this);
25026  }
25027  get isEmpty() {
25028    return this.#editors.size === 0;
25029  }
25030  updateToolbar(mode) {
25031    this.#uiManager.updateToolbar(mode);
25032  }
25033  updateMode(mode = this.#uiManager.getMode()) {
25034    this.#cleanup();
25035    if (mode === _util.AnnotationEditorType.INK) {
25036      this.addInkEditorIfNeeded(false);
25037      this.disableClick();
25038    } else {
25039      this.enableClick();
25040    }
25041    if (mode !== _util.AnnotationEditorType.NONE) {
25042      this.div.classList.toggle("freeTextEditing", mode === _util.AnnotationEditorType.FREETEXT);
25043      this.div.classList.toggle("inkEditing", mode === _util.AnnotationEditorType.INK);
25044      this.div.classList.toggle("stampEditing", mode === _util.AnnotationEditorType.STAMP);
25045      this.div.hidden = false;
25046    }
25047  }
25048  addInkEditorIfNeeded(isCommitting) {
25049    if (!isCommitting && this.#uiManager.getMode() !== _util.AnnotationEditorType.INK) {
25050      return;
25051    }
25052    if (!isCommitting) {
25053      for (const editor of this.#editors.values()) {
25054        if (editor.isEmpty()) {
25055          editor.setInBackground();
25056          return;
25057        }
25058      }
25059    }
25060    const editor = this.#createAndAddNewEditor({
25061      offsetX: 0,
25062      offsetY: 0
25063    }, false);
25064    editor.setInBackground();
25065  }
25066  setEditingState(isEditing) {
25067    this.#uiManager.setEditingState(isEditing);
25068  }
25069  addCommands(params) {
25070    this.#uiManager.addCommands(params);
25071  }
25072  enable() {
25073    this.div.style.pointerEvents = "auto";
25074    const annotationElementIds = new Set();
25075    for (const editor of this.#editors.values()) {
25076      editor.enableEditing();
25077      if (editor.annotationElementId) {
25078        annotationElementIds.add(editor.annotationElementId);
25079      }
25080    }
25081    if (!this.#annotationLayer) {
25082      return;
25083    }
25084    const editables = this.#annotationLayer.getEditableAnnotations();
25085    for (const editable of editables) {
25086      editable.hide();
25087      if (this.#uiManager.isDeletedAnnotationElement(editable.data.id)) {
25088        continue;
25089      }
25090      if (annotationElementIds.has(editable.data.id)) {
25091        continue;
25092      }
25093      const editor = this.deserialize(editable);
25094      if (!editor) {
25095        continue;
25096      }
25097      this.addOrRebuild(editor);
25098      editor.enableEditing();
25099    }
25100  }
25101  disable() {
25102    this.#isDisabling = true;
25103    this.div.style.pointerEvents = "none";
25104    const hiddenAnnotationIds = new Set();
25105    for (const editor of this.#editors.values()) {
25106      editor.disableEditing();
25107      if (!editor.annotationElementId || editor.serialize() !== null) {
25108        hiddenAnnotationIds.add(editor.annotationElementId);
25109        continue;
25110      }
25111      this.getEditableAnnotation(editor.annotationElementId)?.show();
25112      editor.remove();
25113    }
25114    if (this.#annotationLayer) {
25115      const editables = this.#annotationLayer.getEditableAnnotations();
25116      for (const editable of editables) {
25117        const {
25118          id
25119        } = editable.data;
25120        if (hiddenAnnotationIds.has(id) || this.#uiManager.isDeletedAnnotationElement(id)) {
25121          continue;
25122        }
25123        editable.show();
25124      }
25125    }
25126    this.#cleanup();
25127    if (this.isEmpty) {
25128      this.div.hidden = true;
25129    }
25130    this.#isDisabling = false;
25131  }
25132  getEditableAnnotation(id) {
25133    return this.#annotationLayer?.getEditableAnnotation(id) || null;
25134  }
25135  setActiveEditor(editor) {
25136    const currentActive = this.#uiManager.getActive();
25137    if (currentActive === editor) {
25138      return;
25139    }
25140    this.#uiManager.setActiveEditor(editor);
25141  }
25142  enableClick() {
25143    this.div.addEventListener("pointerdown", this.#boundPointerdown);
25144    this.div.addEventListener("pointerup", this.#boundPointerup);
25145  }
25146  disableClick() {
25147    this.div.removeEventListener("pointerdown", this.#boundPointerdown);
25148    this.div.removeEventListener("pointerup", this.#boundPointerup);
25149  }
25150  attach(editor) {
25151    this.#editors.set(editor.id, editor);
25152    const {
25153      annotationElementId
25154    } = editor;
25155    if (annotationElementId && this.#uiManager.isDeletedAnnotationElement(annotationElementId)) {
25156      this.#uiManager.removeDeletedAnnotationElement(editor);
25157    }
25158  }
25159  detach(editor) {
25160    this.#editors.delete(editor.id);
25161    this.#accessibilityManager?.removePointerInTextLayer(editor.contentDiv);
25162    if (!this.#isDisabling && editor.annotationElementId) {
25163      this.#uiManager.addDeletedAnnotationElement(editor);
25164    }
25165  }
25166  remove(editor) {
25167    this.detach(editor);
25168    this.#uiManager.removeEditor(editor);
25169    if (editor.div.contains(document.activeElement)) {
25170      setTimeout(() => {
25171        this.#uiManager.focusMainContainer();
25172      }, 0);
25173    }
25174    editor.div.remove();
25175    editor.isAttachedToDOM = false;
25176    if (!this.#isCleaningUp) {
25177      this.addInkEditorIfNeeded(false);
25178    }
25179  }
25180  changeParent(editor) {
25181    if (editor.parent === this) {
25182      return;
25183    }
25184    if (editor.annotationElementId) {
25185      this.#uiManager.addDeletedAnnotationElement(editor.annotationElementId);
25186      _editor.AnnotationEditor.deleteAnnotationElement(editor);
25187      editor.annotationElementId = null;
25188    }
25189    this.attach(editor);
25190    editor.parent?.detach(editor);
25191    editor.setParent(this);
25192    if (editor.div && editor.isAttachedToDOM) {
25193      editor.div.remove();
25194      this.div.append(editor.div);
25195    }
25196  }
25197  add(editor) {
25198    this.changeParent(editor);
25199    this.#uiManager.addEditor(editor);
25200    this.attach(editor);
25201    if (!editor.isAttachedToDOM) {
25202      const div = editor.render();
25203      this.div.append(div);
25204      editor.isAttachedToDOM = true;
25205    }
25206    editor.fixAndSetPosition();
25207    editor.onceAdded();
25208    this.#uiManager.addToAnnotationStorage(editor);
25209  }
25210  moveEditorInDOM(editor) {
25211    if (!editor.isAttachedToDOM) {
25212      return;
25213    }
25214    const {
25215      activeElement
25216    } = document;
25217    if (editor.div.contains(activeElement)) {
25218      editor._focusEventsAllowed = false;
25219      setTimeout(() => {
25220        if (!editor.div.contains(document.activeElement)) {
25221          editor.div.addEventListener("focusin", () => {
25222            editor._focusEventsAllowed = true;
25223          }, {
25224            once: true
25225          });
25226          activeElement.focus();
25227        } else {
25228          editor._focusEventsAllowed = true;
25229        }
25230      }, 0);
25231    }
25232    editor._structTreeParentId = this.#accessibilityManager?.moveElementInDOM(this.div, editor.div, editor.contentDiv, true);
25233  }
25234  addOrRebuild(editor) {
25235    if (editor.needsToBeRebuilt()) {
25236      editor.rebuild();
25237    } else {
25238      this.add(editor);
25239    }
25240  }
25241  addUndoableEditor(editor) {
25242    const cmd = () => editor._uiManager.rebuild(editor);
25243    const undo = () => {
25244      editor.remove();
25245    };
25246    this.addCommands({
25247      cmd,
25248      undo,
25249      mustExec: false
25250    });
25251  }
25252  getNextId() {
25253    return this.#uiManager.getId();
25254  }
25255  #createNewEditor(params) {
25256    switch (this.#uiManager.getMode()) {
25257      case _util.AnnotationEditorType.FREETEXT:
25258        return new _freetext.FreeTextEditor(params);
25259      case _util.AnnotationEditorType.INK:
25260        return new _ink.InkEditor(params);
25261      case _util.AnnotationEditorType.STAMP:
25262        return new _stamp.StampEditor(params);
25263    }
25264    return null;
25265  }
25266  pasteEditor(mode, params) {
25267    this.#uiManager.updateToolbar(mode);
25268    this.#uiManager.updateMode(mode);
25269    const {
25270      offsetX,
25271      offsetY
25272    } = this.#getCenterPoint();
25273    const id = this.getNextId();
25274    const editor = this.#createNewEditor({
25275      parent: this,
25276      id,
25277      x: offsetX,
25278      y: offsetY,
25279      uiManager: this.#uiManager,
25280      isCentered: true,
25281      ...params
25282    });
25283    if (editor) {
25284      this.add(editor);
25285    }
25286  }
25287  deserialize(data) {
25288    switch (data.annotationType ?? data.annotationEditorType) {
25289      case _util.AnnotationEditorType.FREETEXT:
25290        return _freetext.FreeTextEditor.deserialize(data, this, this.#uiManager);
25291      case _util.AnnotationEditorType.INK:
25292        return _ink.InkEditor.deserialize(data, this, this.#uiManager);
25293      case _util.AnnotationEditorType.STAMP:
25294        return _stamp.StampEditor.deserialize(data, this, this.#uiManager);
25295    }
25296    return null;
25297  }
25298  #createAndAddNewEditor(event, isCentered) {
25299    const id = this.getNextId();
25300    const editor = this.#createNewEditor({
25301      parent: this,
25302      id,
25303      x: event.offsetX,
25304      y: event.offsetY,
25305      uiManager: this.#uiManager,
25306      isCentered
25307    });
25308    if (editor) {
25309      this.add(editor);
25310    }
25311    return editor;
25312  }
25313  #getCenterPoint() {
25314    const {
25315      x,
25316      y,
25317      width,
25318      height
25319    } = this.div.getBoundingClientRect();
25320    const tlX = Math.max(0, x);
25321    const tlY = Math.max(0, y);
25322    const brX = Math.min(window.innerWidth, x + width);
25323    const brY = Math.min(window.innerHeight, y + height);
25324    const centerX = (tlX + brX) / 2 - x;
25325    const centerY = (tlY + brY) / 2 - y;
25326    const [offsetX, offsetY] = this.viewport.rotation % 180 === 0 ? [centerX, centerY] : [centerY, centerX];
25327    return {
25328      offsetX,
25329      offsetY
25330    };
25331  }
25332  addNewEditor() {
25333    this.#createAndAddNewEditor(this.#getCenterPoint(), true);
25334  }
25335  setSelected(editor) {
25336    this.#uiManager.setSelected(editor);
25337  }
25338  toggleSelected(editor) {
25339    this.#uiManager.toggleSelected(editor);
25340  }
25341  isSelected(editor) {
25342    return this.#uiManager.isSelected(editor);
25343  }
25344  unselect(editor) {
25345    this.#uiManager.unselect(editor);
25346  }
25347  pointerup(event) {
25348    const {
25349      isMac
25350    } = _util.FeatureTest.platform;
25351    if (event.button !== 0 || event.ctrlKey && isMac) {
25352      return;
25353    }
25354    if (event.target !== this.div) {
25355      return;
25356    }
25357    if (!this.#hadPointerDown) {
25358      return;
25359    }
25360    this.#hadPointerDown = false;
25361    if (!this.#allowClick) {
25362      this.#allowClick = true;
25363      return;
25364    }
25365    if (this.#uiManager.getMode() === _util.AnnotationEditorType.STAMP) {
25366      this.#uiManager.unselectAll();
25367      return;
25368    }
25369    this.#createAndAddNewEditor(event, false);
25370  }
25371  pointerdown(event) {
25372    if (this.#hadPointerDown) {
25373      this.#hadPointerDown = false;
25374      return;
25375    }
25376    const {
25377      isMac
25378    } = _util.FeatureTest.platform;
25379    if (event.button !== 0 || event.ctrlKey && isMac) {
25380      return;
25381    }
25382    if (event.target !== this.div) {
25383      return;
25384    }
25385    this.#hadPointerDown = true;
25386    const editor = this.#uiManager.getActive();
25387    this.#allowClick = !editor || editor.isEmpty();
25388  }
25389  findNewParent(editor, x, y) {
25390    const layer = this.#uiManager.findParent(x, y);
25391    if (layer === null || layer === this) {
25392      return false;
25393    }
25394    layer.changeParent(editor);
25395    return true;
25396  }
25397  destroy() {
25398    if (this.#uiManager.getActive()?.parent === this) {
25399      this.#uiManager.commitOrRemove();
25400      this.#uiManager.setActiveEditor(null);
25401    }
25402    for (const editor of this.#editors.values()) {
25403      this.#accessibilityManager?.removePointerInTextLayer(editor.contentDiv);
25404      editor.setParent(null);
25405      editor.isAttachedToDOM = false;
25406      editor.div.remove();
25407    }
25408    this.div = null;
25409    this.#editors.clear();
25410    this.#uiManager.removeLayer(this);
25411  }
25412  #cleanup() {
25413    this.#isCleaningUp = true;
25414    for (const editor of this.#editors.values()) {
25415      if (editor.isEmpty()) {
25416        editor.remove();
25417      }
25418    }
25419    this.#isCleaningUp = false;
25420  }
25421  render({
25422    viewport
25423  }) {
25424    this.viewport = viewport;
25425    (0, _display_utils.setLayerDimensions)(this.div, viewport);
25426    for (const editor of this.#uiManager.getEditors(this.pageIndex)) {
25427      this.add(editor);
25428    }
25429    this.updateMode();
25430  }
25431  update({
25432    viewport
25433  }) {
25434    this.#uiManager.commitOrRemove();
25435    this.viewport = viewport;
25436    (0, _display_utils.setLayerDimensions)(this.div, {
25437      rotation: viewport.rotation
25438    });
25439    this.updateMode();
25440  }
25441  get pageDimensions() {
25442    const {
25443      pageWidth,
25444      pageHeight
25445    } = this.viewport.rawDims;
25446    return [pageWidth, pageHeight];
25447  }
25448}
25449exports.AnnotationEditorLayer = AnnotationEditorLayer;
25450
25451/***/ }),
25452/* 28 */
25453/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
25454
25455
25456
25457Object.defineProperty(exports, "__esModule", ({
25458  value: true
25459}));
25460exports.FreeTextEditor = void 0;
25461var _util = __w_pdfjs_require__(1);
25462var _tools = __w_pdfjs_require__(5);
25463var _editor = __w_pdfjs_require__(4);
25464var _annotation_layer = __w_pdfjs_require__(29);
25465class FreeTextEditor extends _editor.AnnotationEditor {
25466  #boundEditorDivBlur = this.editorDivBlur.bind(this);
25467  #boundEditorDivFocus = this.editorDivFocus.bind(this);
25468  #boundEditorDivInput = this.editorDivInput.bind(this);
25469  #boundEditorDivKeydown = this.editorDivKeydown.bind(this);
25470  #color;
25471  #content = "";
25472  #editorDivId = `${this.id}-editor`;
25473  #fontSize;
25474  #initialData = null;
25475  static _freeTextDefaultContent = "";
25476  static _internalPadding = 0;
25477  static _defaultColor = null;
25478  static _defaultFontSize = 10;
25479  static get _keyboardManager() {
25480    const proto = FreeTextEditor.prototype;
25481    const arrowChecker = self => self.isEmpty();
25482    const small = _tools.AnnotationEditorUIManager.TRANSLATE_SMALL;
25483    const big = _tools.AnnotationEditorUIManager.TRANSLATE_BIG;
25484    return (0, _util.shadow)(this, "_keyboardManager", new _tools.KeyboardManager([[["ctrl+s", "mac+meta+s", "ctrl+p", "mac+meta+p"], proto.commitOrRemove, {
25485      bubbles: true
25486    }], [["ctrl+Enter", "mac+meta+Enter", "Escape", "mac+Escape"], proto.commitOrRemove], [["ArrowLeft", "mac+ArrowLeft"], proto._translateEmpty, {
25487      args: [-small, 0],
25488      checker: arrowChecker
25489    }], [["ctrl+ArrowLeft", "mac+shift+ArrowLeft"], proto._translateEmpty, {
25490      args: [-big, 0],
25491      checker: arrowChecker
25492    }], [["ArrowRight", "mac+ArrowRight"], proto._translateEmpty, {
25493      args: [small, 0],
25494      checker: arrowChecker
25495    }], [["ctrl+ArrowRight", "mac+shift+ArrowRight"], proto._translateEmpty, {
25496      args: [big, 0],
25497      checker: arrowChecker
25498    }], [["ArrowUp", "mac+ArrowUp"], proto._translateEmpty, {
25499      args: [0, -small],
25500      checker: arrowChecker
25501    }], [["ctrl+ArrowUp", "mac+shift+ArrowUp"], proto._translateEmpty, {
25502      args: [0, -big],
25503      checker: arrowChecker
25504    }], [["ArrowDown", "mac+ArrowDown"], proto._translateEmpty, {
25505      args: [0, small],
25506      checker: arrowChecker
25507    }], [["ctrl+ArrowDown", "mac+shift+ArrowDown"], proto._translateEmpty, {
25508      args: [0, big],
25509      checker: arrowChecker
25510    }]]));
25511  }
25512  static _type = "freetext";
25513  constructor(params) {
25514    super({
25515      ...params,
25516      name: "freeTextEditor"
25517    });
25518    this.#color = params.color || FreeTextEditor._defaultColor || _editor.AnnotationEditor._defaultLineColor;
25519    this.#fontSize = params.fontSize || FreeTextEditor._defaultFontSize;
25520  }
25521  static initialize(l10n) {
25522    _editor.AnnotationEditor.initialize(l10n, {
25523      strings: ["free_text2_default_content", "editor_free_text2_aria_label"]
25524    });
25525    const style = getComputedStyle(document.documentElement);
25526    this._internalPadding = parseFloat(style.getPropertyValue("--freetext-padding"));
25527  }
25528  static updateDefaultParams(type, value) {
25529    switch (type) {
25530      case _util.AnnotationEditorParamsType.FREETEXT_SIZE:
25531        FreeTextEditor._defaultFontSize = value;
25532        break;
25533      case _util.AnnotationEditorParamsType.FREETEXT_COLOR:
25534        FreeTextEditor._defaultColor = value;
25535        break;
25536    }
25537  }
25538  updateParams(type, value) {
25539    switch (type) {
25540      case _util.AnnotationEditorParamsType.FREETEXT_SIZE:
25541        this.#updateFontSize(value);
25542        break;
25543      case _util.AnnotationEditorParamsType.FREETEXT_COLOR:
25544        this.#updateColor(value);
25545        break;
25546    }
25547  }
25548  static get defaultPropertiesToUpdate() {
25549    return [[_util.AnnotationEditorParamsType.FREETEXT_SIZE, FreeTextEditor._defaultFontSize], [_util.AnnotationEditorParamsType.FREETEXT_COLOR, FreeTextEditor._defaultColor || _editor.AnnotationEditor._defaultLineColor]];
25550  }
25551  get propertiesToUpdate() {
25552    return [[_util.AnnotationEditorParamsType.FREETEXT_SIZE, this.#fontSize], [_util.AnnotationEditorParamsType.FREETEXT_COLOR, this.#color]];
25553  }
25554  #updateFontSize(fontSize) {
25555    const setFontsize = size => {
25556      this.editorDiv.style.fontSize = `calc(${size}px * var(--scale-factor))`;
25557      this.translate(0, -(size - this.#fontSize) * this.parentScale);
25558      this.#fontSize = size;
25559      this.#setEditorDimensions();
25560    };
25561    const savedFontsize = this.#fontSize;
25562    this.addCommands({
25563      cmd: () => {
25564        setFontsize(fontSize);
25565      },
25566      undo: () => {
25567        setFontsize(savedFontsize);
25568      },
25569      mustExec: true,
25570      type: _util.AnnotationEditorParamsType.FREETEXT_SIZE,
25571      overwriteIfSameType: true,
25572      keepUndo: true
25573    });
25574  }
25575  #updateColor(color) {
25576    const savedColor = this.#color;
25577    this.addCommands({
25578      cmd: () => {
25579        this.#color = this.editorDiv.style.color = color;
25580      },
25581      undo: () => {
25582        this.#color = this.editorDiv.style.color = savedColor;
25583      },
25584      mustExec: true,
25585      type: _util.AnnotationEditorParamsType.FREETEXT_COLOR,
25586      overwriteIfSameType: true,
25587      keepUndo: true
25588    });
25589  }
25590  _translateEmpty(x, y) {
25591    this._uiManager.translateSelectedEditors(x, y, true);
25592  }
25593  getInitialTranslation() {
25594    const scale = this.parentScale;
25595    return [-FreeTextEditor._internalPadding * scale, -(FreeTextEditor._internalPadding + this.#fontSize) * scale];
25596  }
25597  rebuild() {
25598    if (!this.parent) {
25599      return;
25600    }
25601    super.rebuild();
25602    if (this.div === null) {
25603      return;
25604    }
25605    if (!this.isAttachedToDOM) {
25606      this.parent.add(this);
25607    }
25608  }
25609  enableEditMode() {
25610    if (this.isInEditMode()) {
25611      return;
25612    }
25613    this.parent.setEditingState(false);
25614    this.parent.updateToolbar(_util.AnnotationEditorType.FREETEXT);
25615    super.enableEditMode();
25616    this.overlayDiv.classList.remove("enabled");
25617    this.editorDiv.contentEditable = true;
25618    this._isDraggable = false;
25619    this.div.removeAttribute("aria-activedescendant");
25620    this.editorDiv.addEventListener("keydown", this.#boundEditorDivKeydown);
25621    this.editorDiv.addEventListener("focus", this.#boundEditorDivFocus);
25622    this.editorDiv.addEventListener("blur", this.#boundEditorDivBlur);
25623    this.editorDiv.addEventListener("input", this.#boundEditorDivInput);
25624  }
25625  disableEditMode() {
25626    if (!this.isInEditMode()) {
25627      return;
25628    }
25629    this.parent.setEditingState(true);
25630    super.disableEditMode();
25631    this.overlayDiv.classList.add("enabled");
25632    this.editorDiv.contentEditable = false;
25633    this.div.setAttribute("aria-activedescendant", this.#editorDivId);
25634    this._isDraggable = true;
25635    this.editorDiv.removeEventListener("keydown", this.#boundEditorDivKeydown);
25636    this.editorDiv.removeEventListener("focus", this.#boundEditorDivFocus);
25637    this.editorDiv.removeEventListener("blur", this.#boundEditorDivBlur);
25638    this.editorDiv.removeEventListener("input", this.#boundEditorDivInput);
25639    this.div.focus({
25640      preventScroll: true
25641    });
25642    this.isEditing = false;
25643    this.parent.div.classList.add("freeTextEditing");
25644  }
25645  focusin(event) {
25646    if (!this._focusEventsAllowed) {
25647      return;
25648    }
25649    super.focusin(event);
25650    if (event.target !== this.editorDiv) {
25651      this.editorDiv.focus();
25652    }
25653  }
25654  onceAdded() {
25655    if (this.width) {
25656      this.#cheatInitialRect();
25657      return;
25658    }
25659    this.enableEditMode();
25660    this.editorDiv.focus();
25661    if (this._initialOptions?.isCentered) {
25662      this.center();
25663    }
25664    this._initialOptions = null;
25665  }
25666  isEmpty() {
25667    return !this.editorDiv || this.editorDiv.innerText.trim() === "";
25668  }
25669  remove() {
25670    this.isEditing = false;
25671    if (this.parent) {
25672      this.parent.setEditingState(true);
25673      this.parent.div.classList.add("freeTextEditing");
25674    }
25675    super.remove();
25676  }
25677  #extractText() {
25678    const divs = this.editorDiv.getElementsByTagName("div");
25679    if (divs.length === 0) {
25680      return this.editorDiv.innerText;
25681    }
25682    const buffer = [];
25683    for (const div of divs) {
25684      buffer.push(div.innerText.replace(/\r\n?|\n/, ""));
25685    }
25686    return buffer.join("\n");
25687  }
25688  #setEditorDimensions() {
25689    const [parentWidth, parentHeight] = this.parentDimensions;
25690    let rect;
25691    if (this.isAttachedToDOM) {
25692      rect = this.div.getBoundingClientRect();
25693    } else {
25694      const {
25695        currentLayer,
25696        div
25697      } = this;
25698      const savedDisplay = div.style.display;
25699      div.style.display = "hidden";
25700      currentLayer.div.append(this.div);
25701      rect = div.getBoundingClientRect();
25702      div.remove();
25703      div.style.display = savedDisplay;
25704    }
25705    if (this.rotation % 180 === this.parentRotation % 180) {
25706      this.width = rect.width / parentWidth;
25707      this.height = rect.height / parentHeight;
25708    } else {
25709      this.width = rect.height / parentWidth;
25710      this.height = rect.width / parentHeight;
25711    }
25712    this.fixAndSetPosition();
25713  }
25714  commit() {
25715    if (!this.isInEditMode()) {
25716      return;
25717    }
25718    super.commit();
25719    this.disableEditMode();
25720    const savedText = this.#content;
25721    const newText = this.#content = this.#extractText().trimEnd();
25722    if (savedText === newText) {
25723      return;
25724    }
25725    const setText = text => {
25726      this.#content = text;
25727      if (!text) {
25728        this.remove();
25729        return;
25730      }
25731      this.#setContent();
25732      this._uiManager.rebuild(this);
25733      this.#setEditorDimensions();
25734    };
25735    this.addCommands({
25736      cmd: () => {
25737        setText(newText);
25738      },
25739      undo: () => {
25740        setText(savedText);
25741      },
25742      mustExec: false
25743    });
25744    this.#setEditorDimensions();
25745  }
25746  shouldGetKeyboardEvents() {
25747    return this.isInEditMode();
25748  }
25749  enterInEditMode() {
25750    this.enableEditMode();
25751    this.editorDiv.focus();
25752  }
25753  dblclick(event) {
25754    this.enterInEditMode();
25755  }
25756  keydown(event) {
25757    if (event.target === this.div && event.key === "Enter") {
25758      this.enterInEditMode();
25759      event.preventDefault();
25760    }
25761  }
25762  editorDivKeydown(event) {
25763    FreeTextEditor._keyboardManager.exec(this, event);
25764  }
25765  editorDivFocus(event) {
25766    this.isEditing = true;
25767  }
25768  editorDivBlur(event) {
25769    this.isEditing = false;
25770  }
25771  editorDivInput(event) {
25772    this.parent.div.classList.toggle("freeTextEditing", this.isEmpty());
25773  }
25774  disableEditing() {
25775    this.editorDiv.setAttribute("role", "comment");
25776    this.editorDiv.removeAttribute("aria-multiline");
25777  }
25778  enableEditing() {
25779    this.editorDiv.setAttribute("role", "textbox");
25780    this.editorDiv.setAttribute("aria-multiline", true);
25781  }
25782  render() {
25783    if (this.div) {
25784      return this.div;
25785    }
25786    let baseX, baseY;
25787    if (this.width) {
25788      baseX = this.x;
25789      baseY = this.y;
25790    }
25791    super.render();
25792    this.editorDiv = document.createElement("div");
25793    this.editorDiv.className = "internal";
25794    this.editorDiv.setAttribute("id", this.#editorDivId);
25795    this.enableEditing();
25796    _editor.AnnotationEditor._l10nPromise.get("editor_free_text2_aria_label").then(msg => this.editorDiv?.setAttribute("aria-label", msg));
25797    _editor.AnnotationEditor._l10nPromise.get("free_text2_default_content").then(msg => this.editorDiv?.setAttribute("default-content", msg));
25798    this.editorDiv.contentEditable = true;
25799    const {
25800      style
25801    } = this.editorDiv;
25802    style.fontSize = `calc(${this.#fontSize}px * var(--scale-factor))`;
25803    style.color = this.#color;
25804    this.div.append(this.editorDiv);
25805    this.overlayDiv = document.createElement("div");
25806    this.overlayDiv.classList.add("overlay", "enabled");
25807    this.div.append(this.overlayDiv);
25808    (0, _tools.bindEvents)(this, this.div, ["dblclick", "keydown"]);
25809    if (this.width) {
25810      const [parentWidth, parentHeight] = this.parentDimensions;
25811      if (this.annotationElementId) {
25812        const {
25813          position
25814        } = this.#initialData;
25815        let [tx, ty] = this.getInitialTranslation();
25816        [tx, ty] = this.pageTranslationToScreen(tx, ty);
25817        const [pageWidth, pageHeight] = this.pageDimensions;
25818        const [pageX, pageY] = this.pageTranslation;
25819        let posX, posY;
25820        switch (this.rotation) {
25821          case 0:
25822            posX = baseX + (position[0] - pageX) / pageWidth;
25823            posY = baseY + this.height - (position[1] - pageY) / pageHeight;
25824            break;
25825          case 90:
25826            posX = baseX + (position[0] - pageX) / pageWidth;
25827            posY = baseY - (position[1] - pageY) / pageHeight;
25828            [tx, ty] = [ty, -tx];
25829            break;
25830          case 180:
25831            posX = baseX - this.width + (position[0] - pageX) / pageWidth;
25832            posY = baseY - (position[1] - pageY) / pageHeight;
25833            [tx, ty] = [-tx, -ty];
25834            break;
25835          case 270:
25836            posX = baseX + (position[0] - pageX - this.height * pageHeight) / pageWidth;
25837            posY = baseY + (position[1] - pageY - this.width * pageWidth) / pageHeight;
25838            [tx, ty] = [-ty, tx];
25839            break;
25840        }
25841        this.setAt(posX * parentWidth, posY * parentHeight, tx, ty);
25842      } else {
25843        this.setAt(baseX * parentWidth, baseY * parentHeight, this.width * parentWidth, this.height * parentHeight);
25844      }
25845      this.#setContent();
25846      this._isDraggable = true;
25847      this.editorDiv.contentEditable = false;
25848    } else {
25849      this._isDraggable = false;
25850      this.editorDiv.contentEditable = true;
25851    }
25852    return this.div;
25853  }
25854  #setContent() {
25855    this.editorDiv.replaceChildren();
25856    if (!this.#content) {
25857      return;
25858    }
25859    for (const line of this.#content.split("\n")) {
25860      const div = document.createElement("div");
25861      div.append(line ? document.createTextNode(line) : document.createElement("br"));
25862      this.editorDiv.append(div);
25863    }
25864  }
25865  get contentDiv() {
25866    return this.editorDiv;
25867  }
25868  static deserialize(data, parent, uiManager) {
25869    let initialData = null;
25870    if (data instanceof _annotation_layer.FreeTextAnnotationElement) {
25871      const {
25872        data: {
25873          defaultAppearanceData: {
25874            fontSize,
25875            fontColor
25876          },
25877          rect,
25878          rotation,
25879          id
25880        },
25881        textContent,
25882        textPosition,
25883        parent: {
25884          page: {
25885            pageNumber
25886          }
25887        }
25888      } = data;
25889      if (!textContent || textContent.length === 0) {
25890        return null;
25891      }
25892      initialData = data = {
25893        annotationType: _util.AnnotationEditorType.FREETEXT,
25894        color: Array.from(fontColor),
25895        fontSize,
25896        value: textContent.join("\n"),
25897        position: textPosition,
25898        pageIndex: pageNumber - 1,
25899        rect,
25900        rotation,
25901        id,
25902        deleted: false
25903      };
25904    }
25905    const editor = super.deserialize(data, parent, uiManager);
25906    editor.#fontSize = data.fontSize;
25907    editor.#color = _util.Util.makeHexColor(...data.color);
25908    editor.#content = data.value;
25909    editor.annotationElementId = data.id || null;
25910    editor.#initialData = initialData;
25911    return editor;
25912  }
25913  serialize(isForCopying = false) {
25914    if (this.isEmpty()) {
25915      return null;
25916    }
25917    if (this.deleted) {
25918      return {
25919        pageIndex: this.pageIndex,
25920        id: this.annotationElementId,
25921        deleted: true
25922      };
25923    }
25924    const padding = FreeTextEditor._internalPadding * this.parentScale;
25925    const rect = this.getRect(padding, padding);
25926    const color = _editor.AnnotationEditor._colorManager.convert(this.isAttachedToDOM ? getComputedStyle(this.editorDiv).color : this.#color);
25927    const serialized = {
25928      annotationType: _util.AnnotationEditorType.FREETEXT,
25929      color,
25930      fontSize: this.#fontSize,
25931      value: this.#content,
25932      pageIndex: this.pageIndex,
25933      rect,
25934      rotation: this.rotation,
25935      structTreeParentId: this._structTreeParentId
25936    };
25937    if (isForCopying) {
25938      return serialized;
25939    }
25940    if (this.annotationElementId && !this.#hasElementChanged(serialized)) {
25941      return null;
25942    }
25943    serialized.id = this.annotationElementId;
25944    return serialized;
25945  }
25946  #hasElementChanged(serialized) {
25947    const {
25948      value,
25949      fontSize,
25950      color,
25951      rect,
25952      pageIndex
25953    } = this.#initialData;
25954    return serialized.value !== value || serialized.fontSize !== fontSize || serialized.rect.some((x, i) => Math.abs(x - rect[i]) >= 1) || serialized.color.some((c, i) => c !== color[i]) || serialized.pageIndex !== pageIndex;
25955  }
25956  #cheatInitialRect(delayed = false) {
25957    if (!this.annotationElementId) {
25958      return;
25959    }
25960    this.#setEditorDimensions();
25961    if (!delayed && (this.width === 0 || this.height === 0)) {
25962      setTimeout(() => this.#cheatInitialRect(true), 0);
25963      return;
25964    }
25965    const padding = FreeTextEditor._internalPadding * this.parentScale;
25966    this.#initialData.rect = this.getRect(padding, padding);
25967  }
25968}
25969exports.FreeTextEditor = FreeTextEditor;
25970
25971/***/ }),
25972/* 29 */
25973/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
25974
25975
25976
25977Object.defineProperty(exports, "__esModule", ({
25978  value: true
25979}));
25980exports.StampAnnotationElement = exports.InkAnnotationElement = exports.FreeTextAnnotationElement = exports.AnnotationLayer = void 0;
25981var _util = __w_pdfjs_require__(1);
25982var _display_utils = __w_pdfjs_require__(6);
25983var _annotation_storage = __w_pdfjs_require__(3);
25984var _scripting_utils = __w_pdfjs_require__(30);
25985var _displayL10n_utils = __w_pdfjs_require__(31);
25986var _xfa_layer = __w_pdfjs_require__(32);
25987const DEFAULT_TAB_INDEX = 1000;
25988const DEFAULT_FONT_SIZE = 9;
25989const GetElementsByNameSet = new WeakSet();
25990function getRectDims(rect) {
25991  return {
25992    width: rect[2] - rect[0],
25993    height: rect[3] - rect[1]
25994  };
25995}
25996class AnnotationElementFactory {
25997  static create(parameters) {
25998    const subtype = parameters.data.annotationType;
25999    switch (subtype) {
26000      case _util.AnnotationType.LINK:
26001        return new LinkAnnotationElement(parameters);
26002      case _util.AnnotationType.TEXT:
26003        return new TextAnnotationElement(parameters);
26004      case _util.AnnotationType.WIDGET:
26005        const fieldType = parameters.data.fieldType;
26006        switch (fieldType) {
26007          case "Tx":
26008            return new TextWidgetAnnotationElement(parameters);
26009          case "Btn":
26010            if (parameters.data.radioButton) {
26011              return new RadioButtonWidgetAnnotationElement(parameters);
26012            } else if (parameters.data.checkBox) {
26013              return new CheckboxWidgetAnnotationElement(parameters);
26014            }
26015            return new PushButtonWidgetAnnotationElement(parameters);
26016          case "Ch":
26017            return new ChoiceWidgetAnnotationElement(parameters);
26018          case "Sig":
26019            return new SignatureWidgetAnnotationElement(parameters);
26020        }
26021        return new WidgetAnnotationElement(parameters);
26022      case _util.AnnotationType.POPUP:
26023        return new PopupAnnotationElement(parameters);
26024      case _util.AnnotationType.FREETEXT:
26025        return new FreeTextAnnotationElement(parameters);
26026      case _util.AnnotationType.LINE:
26027        return new LineAnnotationElement(parameters);
26028      case _util.AnnotationType.SQUARE:
26029        return new SquareAnnotationElement(parameters);
26030      case _util.AnnotationType.CIRCLE:
26031        return new CircleAnnotationElement(parameters);
26032      case _util.AnnotationType.POLYLINE:
26033        return new PolylineAnnotationElement(parameters);
26034      case _util.AnnotationType.CARET:
26035        return new CaretAnnotationElement(parameters);
26036      case _util.AnnotationType.INK:
26037        return new InkAnnotationElement(parameters);
26038      case _util.AnnotationType.POLYGON:
26039        return new PolygonAnnotationElement(parameters);
26040      case _util.AnnotationType.HIGHLIGHT:
26041        return new HighlightAnnotationElement(parameters);
26042      case _util.AnnotationType.UNDERLINE:
26043        return new UnderlineAnnotationElement(parameters);
26044      case _util.AnnotationType.SQUIGGLY:
26045        return new SquigglyAnnotationElement(parameters);
26046      case _util.AnnotationType.STRIKEOUT:
26047        return new StrikeOutAnnotationElement(parameters);
26048      case _util.AnnotationType.STAMP:
26049        return new StampAnnotationElement(parameters);
26050      case _util.AnnotationType.FILEATTACHMENT:
26051        return new FileAttachmentAnnotationElement(parameters);
26052      default:
26053        return new AnnotationElement(parameters);
26054    }
26055  }
26056}
26057class AnnotationElement {
26058  #hasBorder = false;
26059  constructor(parameters, {
26060    isRenderable = false,
26061    ignoreBorder = false,
26062    createQuadrilaterals = false
26063  } = {}) {
26064    this.isRenderable = isRenderable;
26065    this.data = parameters.data;
26066    this.layer = parameters.layer;
26067    this.linkService = parameters.linkService;
26068    this.downloadManager = parameters.downloadManager;
26069    this.imageResourcesPath = parameters.imageResourcesPath;
26070    this.renderForms = parameters.renderForms;
26071    this.svgFactory = parameters.svgFactory;
26072    this.annotationStorage = parameters.annotationStorage;
26073    this.enableScripting = parameters.enableScripting;
26074    this.hasJSActions = parameters.hasJSActions;
26075    this._fieldObjects = parameters.fieldObjects;
26076    this.parent = parameters.parent;
26077    if (isRenderable) {
26078      this.container = this._createContainer(ignoreBorder);
26079    }
26080    if (createQuadrilaterals) {
26081      this._createQuadrilaterals();
26082    }
26083  }
26084  static _hasPopupData({
26085    titleObj,
26086    contentsObj,
26087    richText
26088  }) {
26089    return !!(titleObj?.str || contentsObj?.str || richText?.str);
26090  }
26091  get hasPopupData() {
26092    return AnnotationElement._hasPopupData(this.data);
26093  }
26094  _createContainer(ignoreBorder) {
26095    const {
26096      data,
26097      parent: {
26098        page,
26099        viewport
26100      }
26101    } = this;
26102    const container = document.createElement("section");
26103    container.setAttribute("data-annotation-id", data.id);
26104    if (!(this instanceof WidgetAnnotationElement)) {
26105      container.tabIndex = DEFAULT_TAB_INDEX;
26106    }
26107    container.style.zIndex = this.parent.zIndex++;
26108    if (this.data.popupRef) {
26109      container.setAttribute("aria-haspopup", "dialog");
26110    }
26111    if (data.noRotate) {
26112      container.classList.add("norotate");
26113    }
26114    const {
26115      pageWidth,
26116      pageHeight,
26117      pageX,
26118      pageY
26119    } = viewport.rawDims;
26120    if (!data.rect || this instanceof PopupAnnotationElement) {
26121      const {
26122        rotation
26123      } = data;
26124      if (!data.hasOwnCanvas && rotation !== 0) {
26125        this.setRotation(rotation, container);
26126      }
26127      return container;
26128    }
26129    const {
26130      width,
26131      height
26132    } = getRectDims(data.rect);
26133    const rect = _util.Util.normalizeRect([data.rect[0], page.view[3] - data.rect[1] + page.view[1], data.rect[2], page.view[3] - data.rect[3] + page.view[1]]);
26134    if (!ignoreBorder && data.borderStyle.width > 0) {
26135      container.style.borderWidth = `${data.borderStyle.width}px`;
26136      const horizontalRadius = data.borderStyle.horizontalCornerRadius;
26137      const verticalRadius = data.borderStyle.verticalCornerRadius;
26138      if (horizontalRadius > 0 || verticalRadius > 0) {
26139        const radius = `calc(${horizontalRadius}px * var(--scale-factor)) / calc(${verticalRadius}px * var(--scale-factor))`;
26140        container.style.borderRadius = radius;
26141      } else if (this instanceof RadioButtonWidgetAnnotationElement) {
26142        const radius = `calc(${width}px * var(--scale-factor)) / calc(${height}px * var(--scale-factor))`;
26143        container.style.borderRadius = radius;
26144      }
26145      switch (data.borderStyle.style) {
26146        case _util.AnnotationBorderStyleType.SOLID:
26147          container.style.borderStyle = "solid";
26148          break;
26149        case _util.AnnotationBorderStyleType.DASHED:
26150          container.style.borderStyle = "dashed";
26151          break;
26152        case _util.AnnotationBorderStyleType.BEVELED:
26153          (0, _util.warn)("Unimplemented border style: beveled");
26154          break;
26155        case _util.AnnotationBorderStyleType.INSET:
26156          (0, _util.warn)("Unimplemented border style: inset");
26157          break;
26158        case _util.AnnotationBorderStyleType.UNDERLINE:
26159          container.style.borderBottomStyle = "solid";
26160          break;
26161        default:
26162          break;
26163      }
26164      const borderColor = data.borderColor || null;
26165      if (borderColor) {
26166        this.#hasBorder = true;
26167        container.style.borderColor = _util.Util.makeHexColor(borderColor[0] | 0, borderColor[1] | 0, borderColor[2] | 0);
26168      } else {
26169        container.style.borderWidth = 0;
26170      }
26171    }
26172    container.style.left = `${100 * (rect[0] - pageX) / pageWidth}%`;
26173    container.style.top = `${100 * (rect[1] - pageY) / pageHeight}%`;
26174    const {
26175      rotation
26176    } = data;
26177    if (data.hasOwnCanvas || rotation === 0) {
26178      container.style.width = `${100 * width / pageWidth}%`;
26179      container.style.height = `${100 * height / pageHeight}%`;
26180    } else {
26181      this.setRotation(rotation, container);
26182    }
26183    return container;
26184  }
26185  setRotation(angle, container = this.container) {
26186    if (!this.data.rect) {
26187      return;
26188    }
26189    const {
26190      pageWidth,
26191      pageHeight
26192    } = this.parent.viewport.rawDims;
26193    const {
26194      width,
26195      height
26196    } = getRectDims(this.data.rect);
26197    let elementWidth, elementHeight;
26198    if (angle % 180 === 0) {
26199      elementWidth = 100 * width / pageWidth;
26200      elementHeight = 100 * height / pageHeight;
26201    } else {
26202      elementWidth = 100 * height / pageWidth;
26203      elementHeight = 100 * width / pageHeight;
26204    }
26205    container.style.width = `${elementWidth}%`;
26206    container.style.height = `${elementHeight}%`;
26207    container.setAttribute("data-main-rotation", (360 - angle) % 360);
26208  }
26209  get _commonActions() {
26210    const setColor = (jsName, styleName, event) => {
26211      const color = event.detail[jsName];
26212      const colorType = color[0];
26213      const colorArray = color.slice(1);
26214      event.target.style[styleName] = _scripting_utils.ColorConverters[`${colorType}_HTML`](colorArray);
26215      this.annotationStorage.setValue(this.data.id, {
26216        [styleName]: _scripting_utils.ColorConverters[`${colorType}_rgb`](colorArray)
26217      });
26218    };
26219    return (0, _util.shadow)(this, "_commonActions", {
26220      display: event => {
26221        const {
26222          display
26223        } = event.detail;
26224        const hidden = display % 2 === 1;
26225        this.container.style.visibility = hidden ? "hidden" : "visible";
26226        this.annotationStorage.setValue(this.data.id, {
26227          noView: hidden,
26228          noPrint: display === 1 || display === 2
26229        });
26230      },
26231      print: event => {
26232        this.annotationStorage.setValue(this.data.id, {
26233          noPrint: !event.detail.print
26234        });
26235      },
26236      hidden: event => {
26237        const {
26238          hidden
26239        } = event.detail;
26240        this.container.style.visibility = hidden ? "hidden" : "visible";
26241        this.annotationStorage.setValue(this.data.id, {
26242          noPrint: hidden,
26243          noView: hidden
26244        });
26245      },
26246      focus: event => {
26247        setTimeout(() =>
26247 event.target.focus({
26248          preventScroll: false
26249        }), 0);
26250      },
26251      userName: event => {
26252        event.target.title = event.detail.userName;
26253      },
26254      readonly: event => {
26255        event.target.disabled = event.detail.readonly;
26256      },
26257      required: event => {
26258        this._setRequired(event.target, event.detail.required);
26259      },
26260      bgColor: event => {
26261        setColor("bgColor", "backgroundColor", event);
26262      },
26263      fillColor: event => {
26264        setColor("fillColor", "backgroundColor", event);
26265      },
26266      fgColor: event => {
26267        setColor("fgColor", "color", event);
26268      },
26269      textColor: event => {
26270        setColor("textColor", "color", event);
26271      },
26272      borderColor: event => {
26273        setColor("borderColor", "borderColor", event);
26274      },
26275      strokeColor: event => {
26276        setColor("strokeColor", "borderColor", event);
26277      },
26278      rotation: event => {
26279        const angle = event.detail.rotation;
26280        this.setRotation(angle);
26281        this.annotationStorage.setValue(this.data.id, {
26282          rotation: angle
26283        });
26284      }
26285    });
26286  }
26287  _dispatchEventFromSandbox(actions, jsEvent) {
26288    const commonActions = this._commonActions;
26289    for (const name of Object.keys(jsEvent.detail)) {
26290      const action = actions[name] || commonActions[name];
26291      action?.(jsEvent);
26292    }
26293  }
26294  _setDefaultPropertiesFromJS(element) {
26295    if (!this.enableScripting) {
26296      return;
26297    }
26298    const storedData = this.annotationStorage.getRawValue(this.data.id);
26299    if (!storedData) {
26300      return;
26301    }
26302    const commonActions = this._commonActions;
26303    for (const [actionName, detail] of Object.entries(storedData)) {
26304      const action = commonActions[actionName];
26305      if (action) {
26306        const eventProxy = {
26307          detail: {
26308            [actionName]: detail
26309          },
26310          target: element
26311        };
26312        action(eventProxy);
26313        delete storedData[actionName];
26314      }
26315    }
26316  }
26317  _createQuadrilaterals() {
26318    if (!this.container) {
26319      return;
26320    }
26321    const {
26322      quadPoints
26323    } = this.data;
26324    if (!quadPoints) {
26325      return;
26326    }
26327    const [rectBlX, rectBlY, rectTrX, rectTrY] = this.data.rect;
26328    if (quadPoints.length === 1) {
26329      const [, {
26330        x: trX,
26331        y: trY
26332      }, {
26333        x: blX,
26334        y: blY
26335      }] = quadPoints[0];
26336      if (rectTrX === trX && rectTrY === trY && rectBlX === blX && rectBlY === blY) {
26337        return;
26338      }
26339    }
26340    const {
26341      style
26342    } = this.container;
26343    let svgBuffer;
26344    if (this.#hasBorder) {
26345      const {
26346        borderColor,
26347        borderWidth
26348      } = style;
26349      style.borderWidth = 0;
26350      svgBuffer = ["url('data:image/svg+xml;utf8,", `<svg xmlns="http://www.w3.org/2000/svg"`, ` preserveAspectRatio="none" viewBox="0 0 1 1">`, `<g fill="transparent" stroke="${borderColor}" stroke-width="${borderWidth}">`];
26351      this.container.classList.add("hasBorder");
26352    }
26353    const width = rectTrX - rectBlX;
26354    const height = rectTrY - rectBlY;
26355    const {
26356      svgFactory
26357    } = this;
26358    const svg = svgFactory.createElement("svg");
26359    svg.classList.add("quadrilateralsContainer");
26360    svg.setAttribute("width", 0);
26361    svg.setAttribute("height", 0);
26362    const defs = svgFactory.createElement("defs");
26363    svg.append(defs);
26364    const clipPath = svgFactory.createElement("clipPath");
26365    const id = `clippath_${this.data.id}`;
26366    clipPath.setAttribute("id", id);
26367    clipPath.setAttribute("clipPathUnits", "objectBoundingBox");
26368    defs.append(clipPath);
26369    for (const [, {
26370      x: trX,
26371      y: trY
26372    }, {
26373      x: blX,
26374      y: blY
26375    }] of quadPoints) {
26376      const rect = svgFactory.createElement("rect");
26377      const x = (blX - rectBlX) / width;
26378      const y = (rectTrY - trY) / height;
26379      const rectWidth = (trX - blX) / width;
26380      const rectHeight = (trY - blY) / height;
26381      rect.setAttribute("x", x);
26382      rect.setAttribute("y", y);
26383      rect.setAttribute("width", rectWidth);
26384      rect.setAttribute("height", rectHeight);
26385      clipPath.append(rect);
26386      svgBuffer?.push(`<rect vector-effect="non-scaling-stroke" x="${x}" y="${y}" width="${rectWidth}" height="${rectHeight}"/>`);
26387    }
26388    if (this.#hasBorder) {
26389      svgBuffer.push(`</g></svg>')`);
26390      style.backgroundImage = svgBuffer.join("");
26391    }
26392    this.container.append(svg);
26393    this.container.style.clipPath = `url(#${id})`;
26394  }
26395  _createPopup() {
26396    const {
26397      container,
26398      data
26399    } = this;
26400    container.setAttribute("aria-haspopup", "dialog");
26401    const popup = new PopupAnnotationElement({
26402      data: {
26403        color: data.color,
26404        titleObj: data.titleObj,
26405        modificationDate: data.modificationDate,
26406        contentsObj: data.contentsObj,
26407        richText: data.richText,
26408        parentRect: data.rect,
26409        borderStyle: 0,
26410        id: `popup_${data.id}`,
26411        rotation: data.rotation
26412      },
26413      parent: this.parent,
26414      elements: [this]
26415    });
26416    this.parent.div.append(popup.render());
26417  }
26418  render() {
26419    (0, _util.unreachable)("Abstract method `AnnotationElement.render` called");
26420  }
26421  _getElementsByName(name, skipId = null) {
26422    const fields = [];
26423    if (this._fieldObjects) {
26424      const fieldObj = this._fieldObjects[name];
26425      if (fieldObj) {
26426        for (const {
26427          page,
26428          id,
26429          exportValues
26430        } of fieldObj) {
26431          if (page === -1) {
26432            continue;
26433          }
26434          if (id === skipId) {
26435            continue;
26436          }
26437          const exportValue = typeof exportValues === "string" ? exportValues : null;
26438          const domElement = document.querySelector(`[data-element-id="${id}"]`);
26439          if (domElement && !GetElementsByNameSet.has(domElement)) {
26440            (0, _util.warn)(`_getElementsByName - element not allowed: ${id}`);
26441            continue;
26442          }
26443          fields.push({
26444            id,
26445            exportValue,
26446            domElement
26447          });
26448        }
26449      }
26450      return fields;
26451    }
26452    for (const domElement of document.getElementsByName(name)) {
26453      const {
26454        exportValue
26455      } = domElement;
26456      const id = domElement.getAttribute("data-element-id");
26457      if (id === skipId) {
26458        continue;
26459      }
26460      if (!GetElementsByNameSet.has(domElement)) {
26461        continue;
26462      }
26463      fields.push({
26464        id,
26465        exportValue,
26466        domElement
26467      });
26468    }
26469    return fields;
26470  }
26471  show() {
26472    if (this.container) {
26473      this.container.hidden = false;
vendor: 8,347 bytes, lines 26474-26763
26474    }
26475    this.popup?.maybeShow();
26476  }
26477  hide() {
26478    if (this.container) {
26479      this.container.hidden = true;
26480    }
26481    this.popup?.forceHide();
26482  }
26483  getElementsToTriggerPopup() {
26484    return this.container;
26485  }
26486  addHighlightArea() {
26487    const triggers = this.getElementsToTriggerPopup();
26488    if (Array.isArray(triggers)) {
26489      for (const element of triggers) {
26490        element.classList.add("highlightArea");
26491      }
26492    } else {
26493      triggers.classList.add("highlightArea");
26494    }
26495  }
26496  _editOnDoubleClick() {
26497    const {
26498      annotationEditorType: mode,
26499      data: {
26500        id: editId
26501      }
26502    } = this;
26503    this.container.addEventListener("dblclick", () => {
26504      this.linkService.eventBus?.dispatch("switchannotationeditormode", {
26505        source: this,
26506        mode,
26507        editId
26508      });
26509    });
26510  }
26511}
26512class LinkAnnotationElement extends AnnotationElement {
26513  constructor(parameters, options = null) {
26514    super(parameters, {
26515      isRenderable: true,
26516      ignoreBorder: !!options?.ignoreBorder,
26517      createQuadrilaterals: true
26518    });
26519    this.isTooltipOnly = parameters.data.isTooltipOnly;
26520  }
26521  render() {
26522    const {
26523      data,
26524      linkService
26525    } = this;
26526    const link = document.createElement("a");
26527    link.setAttribute("data-element-id", data.id);
26528    let isBound = false;
26529    if (data.url) {
26530      linkService.addLinkAttributes(link, data.url, data.newWindow);
26531      isBound = true;
26532    } else if (data.action) {
26533      this._bindNamedAction(link, data.action);
26534      isBound = true;
26535    } else if (data.attachment) {
26536      this._bindAttachment(link, data.attachment);
26537      isBound = true;
26538    } else if (data.setOCGState) {
26539      this.#bindSetOCGState(link, data.setOCGState);
26540      isBound = true;
26541    } else if (data.dest) {
26542      this._bindLink(link, data.dest);
26543      isBound = true;
26544    } else {
26545      if (data.actions && (data.actions.Action || data.actions["Mouse Up"] || data.actions["Mouse Down"]) && this.enableScripting && this.hasJSActions) {
26546        this._bindJSAction(link, data);
26547        isBound = true;
26548      }
26549      if (data.resetForm) {
26550        this._bindResetFormAction(link, data.resetForm);
26551        isBound = true;
26552      } else if (this.isTooltipOnly && !isBound) {
26553        this._bindLink(link, "");
26554        isBound = true;
26555      }
26556    }
26557    this.container.classList.add("linkAnnotation");
26558    if (isBound) {
26559      this.container.append(link);
26560    }
26561    return this.container;
26562  }
26563  #setInternalLink() {
26564    this.container.setAttribute("data-internal-link", "");
26565  }
26566  _bindLink(link, destination) {
26567    link.href = this.linkService.getDestinationHash(destination);
26568    link.onclick = () => {
26569      if (destination) {
26570        this.linkService.goToDestination(destination);
26571      }
26572      return false;
26573    };
26574    if (destination || destination === "") {
26575      this.#setInternalLink();
26576    }
26577  }
26578  _bindNamedAction(link, action) {
26579    link.href = this.linkService.getAnchorUrl("");
26580    link.onclick = () => {
26581      this.linkService.executeNamedAction(action);
26582      return false;
26583    };
26584    this.#setInternalLink();
26585  }
26586  _bindAttachment(link, attachment) {
26587    link.href = this.linkService.getAnchorUrl("");
26588    link.onclick = () => {
26589      this.downloadManager?.openOrDownloadData(this.container, attachment.content, attachment.filename);
26590      return false;
26591    };
26592    this.#setInternalLink();
26593  }
26594  #bindSetOCGState(link, action) {
26595    link.href = this.linkService.getAnchorUrl("");
26596    link.onclick = () => {
26597      this.linkService.executeSetOCGState(action);
26598      return false;
26599    };
26600    this.#setInternalLink();
26601  }
26602  _bindJSAction(link, data) {
26603    link.href = this.linkService.getAnchorUrl("");
26604    const map = new Map([["Action", "onclick"], ["Mouse Up", "onmouseup"], ["Mouse Down", "onmousedown"]]);
26605    for (const name of Object.keys(data.actions)) {
26606      const jsName = map.get(name);
26607      if (!jsName) {
26608        continue;
26609      }
26610      link[jsName] = () => {
26611        this.linkService.eventBus?.dispatch("dispatcheventinsandbox", {
26612          source: this,
26613          detail: {
26614            id: data.id,
26615            name
26616          }
26617        });
26618        return false;
26619      };
26620    }
26621    if (!link.onclick) {
26622      link.onclick = () => false;
26623    }
26624    this.#setInternalLink();
26625  }
26626  _bindResetFormAction(link, resetForm) {
26627    const otherClickAction = link.onclick;
26628    if (!otherClickAction) {
26629      link.href = this.linkService.getAnchorUrl("");
26630    }
26631    this.#setInternalLink();
26632    if (!this._fieldObjects) {
26633      (0, _util.warn)(`_bindResetFormAction - "resetForm" action not supported, ` + "ensure that the `fieldObjects` parameter is provided.");
26634      if (!otherClickAction) {
26635        link.onclick = () => false;
26636      }
26637      return;
26638    }
26639    link.onclick = () => {
26640      otherClickAction?.();
26641      const {
26642        fields: resetFormFields,
26643        refs: resetFormRefs,
26644        include
26645      } = resetForm;
26646      const allFields = [];
26647      if (resetFormFields.length !== 0 || resetFormRefs.length !== 0) {
26648        const fieldIds = new Set(resetFormRefs);
26649        for (const fieldName of resetFormFields) {
26650          const fields = this._fieldObjects[fieldName] || [];
26651          for (const {
26652            id
26653          } of fields) {
26654            fieldIds.add(id);
26655          }
26656        }
26657        for (const fields of Object.values(this._fieldObjects)) {
26658          for (const field of fields) {
26659            if (fieldIds.has(field.id) === include) {
26660              allFields.push(field);
26661            }
26662          }
26663        }
26664      } else {
26665        for (const fields of Object.values(this._fieldObjects)) {
26666          allFields.push(...fields);
26667        }
26668      }
26669      const storage = this.annotationStorage;
26670      const allIds = [];
26671      for (const field of allFields) {
26672        const {
26673          id
26674        } = field;
26675        allIds.push(id);
26676        switch (field.type) {
26677          case "text":
26678            {
26679              const value = field.defaultValue || "";
26680              storage.setValue(id, {
26681                value
26682              });
26683              break;
26684            }
26685          case "checkbox":
26686          case "radiobutton":
26687            {
26688              const value = field.defaultValue === field.exportValues;
26689              storage.setValue(id, {
26690                value
26691              });
26692              break;
26693            }
26694          case "combobox":
26695          case "listbox":
26696            {
26697              const value = field.defaultValue || "";
26698              storage.setValue(id, {
26699                value
26700              });
26701              break;
26702            }
26703          default:
26704            continue;
26705        }
26706        const domElement = document.querySelector(`[data-element-id="${id}"]`);
26707        if (!domElement) {
26708          continue;
26709        } else if (!GetElementsByNameSet.has(domElement)) {
26710          (0, _util.warn)(`_bindResetFormAction - element not allowed: ${id}`);
26711          continue;
26712        }
26713        domElement.dispatchEvent(new Event("resetform"));
26714      }
26715      if (this.enableScripting) {
26716        this.linkService.eventBus?.dispatch("dispatcheventinsandbox", {
26717          source: this,
26718          detail: {
26719            id: "app",
26720            ids: allIds,
26721            name: "ResetForm"
26722          }
26723        });
26724      }
26725      return false;
26726    };
26727  }
26728}
26729class TextAnnotationElement extends AnnotationElement {
26730  constructor(parameters) {
26731    super(parameters, {
26732      isRenderable: true
26733    });
26734  }
26735  render() {
26736    this.container.classList.add("textAnnotation");
26737    const image = document.createElement("img");
26738    image.src = this.imageResourcesPath + "annotation-" + this.data.name.toLowerCase() + ".svg";
26739    image.alt = "[{{type}} Annotation]";
26740    image.dataset.l10nId = "text_annotation_type";
26741    image.dataset.l10nArgs = JSON.stringify({
26742      type: this.data.name
26743    });
26744    if (!this.data.popupRef && this.hasPopupData) {
26745      this._createPopup();
26746    }
26747    this.container.append(image);
26748    return this.container;
26749  }
26750}
26751class WidgetAnnotationElement extends AnnotationElement {
26752  render() {
26753    if (this.data.alternativeText) {
26754      this.container.title = this.data.alternativeText;
26755    }
26756    return this.container;
26757  }
26758  showElementAndHideCanvas(element) {
26759    if (this.data.hasOwnCanvas) {
26760      if (element.previousSibling?.nodeName === "CANVAS") {
26761        element.previousSibling.hidden = true;
26762      }
26763      element.hidden = false;
26764    }
26765  }
26766  _getKeyModifier(event) {
26767    const {
26768      isWin,
26769      isMac
26770    } = _util.FeatureTest.platform;
26771    return isWin && event.ctrlKey || isMac && event.metaKey;
26772  }
26773  _setEventListener(element, elementData, baseName, eventName, valueGetter) {
26774    if (baseName.includes("mouse")) {
26775      element.addEventListener(baseName, event => {
26776        this.linkService.eventBus?.dispatch("dispatcheventinsandbox", {
26777          source: this,
26778          detail: {
26779            id: this.data.id,
26780            name: eventName,
26781            value: valueGetter(event),
26782            shift: event.shiftKey,
26783            modifier: this._getKeyModifier(event)
26784          }
26785        });
26786      });
26787    } else {
26788      element.addEventListener(baseName, event => {
26789        if (baseName === "blur") {
26790          if (!elementData.focused || !event.relatedTarget) {
26791            return;
26792          }
26793          elementData.focused = false;
26794        } else if (baseName === "focus") {
26795          if (elementData.focused) {
26796            return;
26797          }
26798          elementData.focused = true;
26799        }
26800        if (!valueGetter) {
26801          return;
26802        }
26803        this.linkService.eventBus?.dispatch("dispatcheventinsandbox", {
26804          source: this,
26805          detail: {
26806            id: this.data.id,
26807            name: eventName,
26808            value: valueGetter(event)
26809          }
26810        });
26811      });
26812    }
26813  }
26814  _setEventListeners(element, elementData, names, getter) {
26815    for (const [baseName, eventName] of names) {
26816      if (eventName === "Action" || this.data.actions?.[eventName]) {
26817        if (eventName === "Focus" || eventName === "Blur") {
26818          elementData ||= {
26819            focused: false
26820          };
26821        }
26822        this._setEventListener(element, elementData, baseName, eventName, getter);
26823        if (eventName === "Focus" && !this.data.actions?.Blur) {
26824          this._setEventListener(element, elementData, "blur", "Blur", null);
26825        } else if (eventName === "Blur" && !this.data.actions?.Focus) {
26826          this._setEventListener(element, elementData, "focus", "Focus", null);
26827        }
26828      }
26829    }
26830  }
26831  _setBackgroundColor(element) {
26832    const color = this.data.backgroundColor || null;
26833    element.style.backgroundColor = color === null ? "transparent" : _util.Util.makeHexColor(color[0], color[1], color[2]);
26834  }
26835  _setTextStyle(element) {
26836    const TEXT_ALIGNMENT = ["left", "center", "right"];
26837    const {
26838      fontColor
26839    } = this.data.defaultAppearanceData;
26840    const fontSize = this.data.defaultAppearanceData.fontSize || DEFAULT_FONT_SIZE;
26841    const style = element.style;
vendor: 26,111 bytes, lines 26842-27574
26842    let computedFontSize;
26843    const BORDER_SIZE = 2;
26844    const roundToOneDecimal = x => Math.round(10 * x) / 10;
26845    if (this.data.multiLine) {
26846      const height = Math.abs(this.data.rect[3] - this.data.rect[1] - BORDER_SIZE);
26847      const numberOfLines = Math.round(height / (_util.LINE_FACTOR * fontSize)) || 1;
26848      const lineHeight = height / numberOfLines;
26849      computedFontSize = Math.min(fontSize, roundToOneDecimal(lineHeight / _util.LINE_FACTOR));
26850    } else {
26851      const height = Math.abs(this.data.rect[3] - this.data.rect[1] - BORDER_SIZE);
26852      computedFontSize = Math.min(fontSize, roundToOneDecimal(height / _util.LINE_FACTOR));
26853    }
26854    style.fontSize = `calc(${computedFontSize}px * var(--scale-factor))`;
26855    style.color = _util.Util.makeHexColor(fontColor[0], fontColor[1], fontColor[2]);
26856    if (this.data.textAlignment !== null) {
26857      style.textAlign = TEXT_ALIGNMENT[this.data.textAlignment];
26858    }
26859  }
26860  _setRequired(element, isRequired) {
26861    if (isRequired) {
26862      element.setAttribute("required", true);
26863    } else {
26864      element.removeAttribute("required");
26865    }
26866    element.setAttribute("aria-required", isRequired);
26867  }
26868}
26869class TextWidgetAnnotationElement extends WidgetAnnotationElement {
26870  constructor(parameters) {
26871    const isRenderable = parameters.renderForms || !parameters.data.hasAppearance && !!parameters.data.fieldValue;
26872    super(parameters, {
26873      isRenderable
26874    });
26875  }
26876  setPropertyOnSiblings(base, key, value, keyInStorage) {
26877    const storage = this.annotationStorage;
26878    for (const element of this._getElementsByName(base.name, base.id)) {
26879      if (element.domElement) {
26880        element.domElement[key] = value;
26881      }
26882      storage.setValue(element.id, {
26883        [keyInStorage]: value
26884      });
26885    }
26886  }
26887  render() {
26888    const storage = this.annotationStorage;
26889    const id = this.data.id;
26890    this.container.classList.add("textWidgetAnnotation");
26891    let element = null;
26892    if (this.renderForms) {
26893      const storedData = storage.getValue(id, {
26894        value: this.data.fieldValue
26895      });
26896      let textContent = storedData.value || "";
26897      const maxLen = storage.getValue(id, {
26898        charLimit: this.data.maxLen
26899      }).charLimit;
26900      if (maxLen && textContent.length > maxLen) {
26901        textContent = textContent.slice(0, maxLen);
26902      }
26903      let fieldFormattedValues = storedData.formattedValue || this.data.textContent?.join("\n") || null;
26904      if (fieldFormattedValues && this.data.comb) {
26905        fieldFormattedValues = fieldFormattedValues.replaceAll(/\s+/g, "");
26906      }
26907      const elementData = {
26908        userValue: textContent,
26909        formattedValue: fieldFormattedValues,
26910        lastCommittedValue: null,
26911        commitKey: 1,
26912        focused: false
26913      };
26914      if (this.data.multiLine) {
26915        element = document.createElement("textarea");
26916        element.textContent = fieldFormattedValues ?? textContent;
26917        if (this.data.doNotScroll) {
26918          element.style.overflowY = "hidden";
26919        }
26920      } else {
26921        element = document.createElement("input");
26922        element.type = "text";
26923        element.setAttribute("value", fieldFormattedValues ?? textContent);
26924        if (this.data.doNotScroll) {
26925          element.style.overflowX = "hidden";
26926        }
26927      }
26928      if (this.data.hasOwnCanvas) {
26929        element.hidden = true;
26930      }
26931      GetElementsByNameSet.add(element);
26932      element.setAttribute("data-element-id", id);
26933      element.disabled = this.data.readOnly;
26934      element.name = this.data.fieldName;
26935      element.tabIndex = DEFAULT_TAB_INDEX;
26936      this._setRequired(element, this.data.required);
26937      if (maxLen) {
26938        element.maxLength = maxLen;
26939      }
26940      element.addEventListener("input", event => {
26941        storage.setValue(id, {
26942          value: event.target.value
26943        });
26944        this.setPropertyOnSiblings(element, "value", event.target.value, "value");
26945        elementData.formattedValue = null;
26946      });
26947      element.addEventListener("resetform", event => {
26948        const defaultValue = this.data.defaultFieldValue ?? "";
26949        element.value = elementData.userValue = defaultValue;
26950        elementData.formattedValue = null;
26951      });
26952      let blurListener = event => {
26953        const {
26954          formattedValue
26955        } = elementData;
26956        if (formattedValue !== null && formattedValue !== undefined) {
26957          event.target.value = formattedValue;
26958        }
26959        event.target.scrollLeft = 0;
26960      };
26961      if (this.enableScripting && this.hasJSActions) {
26962        element.addEventListener("focus", event => {
26963          if (elementData.focused) {
26964            return;
26965          }
26966          const {
26967            target
26968          } = event;
26969          if (elementData.userValue) {
26970            target.value = elementData.userValue;
26971          }
26972          elementData.lastCommittedValue = target.value;
26973          elementData.commitKey = 1;
26974          elementData.focused = true;
26975        });
26976        element.addEventListener("updatefromsandbox", jsEvent => {
26977          this.showElementAndHideCanvas(jsEvent.target);
26978          const actions = {
26979            value(event) {
26980              elementData.userValue = event.detail.value ?? "";
26981              storage.setValue(id, {
26982                value: elementData.userValue.toString()
26983              });
26984              event.target.value = elementData.userValue;
26985            },
26986            formattedValue(event) {
26987              const {
26988                formattedValue
26989              } = event.detail;
26990              elementData.formattedValue = formattedValue;
26991              if (formattedValue !== null && formattedValue !== undefined && event.target !== document.activeElement) {
26992                event.target.value = formattedValue;
26993              }
26994              storage.setValue(id, {
26995                formattedValue
26996              });
26997            },
26998            selRange(event) {
26999              event.target.setSelectionRange(...event.detail.selRange);
27000            },
27001            charLimit: event => {
27002              const {
27003                charLimit
27004              } = event.detail;
27005              const {
27006                target
27007              } = event;
27008              if (charLimit === 0) {
27009                target.removeAttribute("maxLength");
27010                return;
27011              }
27012              target.setAttribute("maxLength", charLimit);
27013              let value = elementData.userValue;
27014              if (!value || value.length <= charLimit) {
27015                return;
27016              }
27017              value = value.slice(0, charLimit);
27018              target.value = elementData.userValue = value;
27019              storage.setValue(id, {
27020                value
27021              });
27022              this.linkService.eventBus?.dispatch("dispatcheventinsandbox", {
27023                source: this,
27024                detail: {
27025                  id,
27026                  name: "Keystroke",
27027                  value,
27028                  willCommit: true,
27029                  commitKey: 1,
27030                  selStart: target.selectionStart,
27031                  selEnd: target.selectionEnd
27032                }
27033              });
27034            }
27035          };
27036          this._dispatchEventFromSandbox(actions, jsEvent);
27037        });
27038        element.addEventListener("keydown", event => {
27039          elementData.commitKey = 1;
27040          let commitKey = -1;
27041          if (event.key === "Escape") {
27042            commitKey = 0;
27043          } else if (event.key === "Enter" && !this.data.multiLine) {
27044            commitKey = 2;
27045          } else if (event.key === "Tab") {
27046            elementData.commitKey = 3;
27047          }
27048          if (commitKey === -1) {
27049            return;
27050          }
27051          const {
27052            value
27053          } = event.target;
27054          if (elementData.lastCommittedValue === value) {
27055            return;
27056          }
27057          elementData.lastCommittedValue = value;
27058          elementData.userValue = value;
27059          this.linkService.eventBus?.dispatch("dispatcheventinsandbox", {
27060            source: this,
27061            detail: {
27062              id,
27063              name: "Keystroke",
27064              value,
27065              willCommit: true,
27066              commitKey,
27067              selStart: event.target.selectionStart,
27068              selEnd: event.target.selectionEnd
27069            }
27070          });
27071        });
27072        const _blurListener = blurListener;
27073        blurListener = null;
27074        element.addEventListener("blur", event => {
27075          if (!elementData.focused || !event.relatedTarget) {
27076            return;
27077          }
27078          elementData.focused = false;
27079          const {
27080            value
27081          } = event.target;
27082          elementData.userValue = value;
27083          if (elementData.lastCommittedValue !== value) {
27084            this.linkService.eventBus?.dispatch("dispatcheventinsandbox", {
27085              source: this,
27086              detail: {
27087                id,
27088                name: "Keystroke",
27089                value,
27090                willCommit: true,
27091                commitKey: elementData.commitKey,
27092                selStart: event.target.selectionStart,
27093                selEnd: event.target.selectionEnd
27094              }
27095            });
27096          }
27097          _blurListener(event);
27098        });
27099        if (this.data.actions?.Keystroke) {
27100          element.addEventListener("beforeinput", event => {
27101            elementData.lastCommittedValue = null;
27102            const {
27103              data,
27104              target
27105            } = event;
27106            const {
27107              value,
27108              selectionStart,
27109              selectionEnd
27110            } = target;
27111            let selStart = selectionStart,
27112              selEnd = selectionEnd;
27113            switch (event.inputType) {
27114              case "deleteWordBackward":
27115                {
27116                  const match = value.substring(0, selectionStart).match(/\w*[^\w]*$/);
27117                  if (match) {
27118                    selStart -= match[0].length;
27119                  }
27120                  break;
27121                }
27122              case "deleteWordForward":
27123                {
27124                  const match = value.substring(selectionStart).match(/^[^\w]*\w*/);
27125                  if (match) {
27126                    selEnd += match[0].length;
27127                  }
27128                  break;
27129                }
27130              case "deleteContentBackward":
27131                if (selectionStart === selectionEnd) {
27132                  selStart -= 1;
27133                }
27134                break;
27135              case "deleteContentForward":
27136                if (selectionStart === selectionEnd) {
27137                  selEnd += 1;
27138                }
27139                break;
27140            }
27141            event.preventDefault();
27142            this.linkService.eventBus?.dispatch("dispatcheventinsandbox", {
27143              source: this,
27144              detail: {
27145                id,
27146                name: "Keystroke",
27147                value,
27148                change: data || "",
27149                willCommit: false,
27150                selStart,
27151                selEnd
27152              }
27153            });
27154          });
27155        }
27156        this._setEventListeners(element, elementData, [["focus", "Focus"], ["blur", "Blur"], ["mousedown", "Mouse Down"], ["mouseenter", "Mouse Enter"], ["mouseleave", "Mouse Exit"], ["mouseup", "Mouse Up"]], event => event.target.value);
27157      }
27158      if (blurListener) {
27159        element.addEventListener("blur", blurListener);
27160      }
27161      if (this.data.comb) {
27162        const fieldWidth = this.data.rect[2] - this.data.rect[0];
27163        const combWidth = fieldWidth / maxLen;
27164        element.classList.add("comb");
27165        element.style.letterSpacing = `calc(${combWidth}px * var(--scale-factor) - 1ch)`;
27166      }
27167    } else {
27168      element = document.createElement("div");
27169      element.textContent = this.data.fieldValue;
27170      element.style.verticalAlign = "middle";
27171      element.style.display = "table-cell";
27172    }
27173    this._setTextStyle(element);
27174    this._setBackgroundColor(element);
27175    this._setDefaultPropertiesFromJS(element);
27176    this.container.append(element);
27177    return this.container;
27178  }
27179}
27180class SignatureWidgetAnnotationElement extends WidgetAnnotationElement {
27181  constructor(parameters) {
27182    super(parameters, {
27183      isRenderable: !!parameters.data.hasOwnCanvas
27184    });
27185  }
27186}
27187class CheckboxWidgetAnnotationElement extends WidgetAnnotationElement {
27188  constructor(parameters) {
27189    super(parameters, {
27190      isRenderable: parameters.renderForms
27191    });
27192  }
27193  render() {
27194    const storage = this.annotationStorage;
27195    const data = this.data;
27196    const id = data.id;
27197    let value = storage.getValue(id, {
27198      value: data.exportValue === data.fieldValue
27199    }).value;
27200    if (typeof value === "string") {
27201      value = value !== "Off";
27202      storage.setValue(id, {
27203        value
27204      });
27205    }
27206    this.container.classList.add("buttonWidgetAnnotation", "checkBox");
27207    const element = document.createElement("input");
27208    GetElementsByNameSet.add(element);
27209    element.setAttribute("data-element-id", id);
27210    element.disabled = data.readOnly;
27211    this._setRequired(element, this.data.required);
27212    element.type = "checkbox";
27213    element.name = data.fieldName;
27214    if (value) {
27215      element.setAttribute("checked", true);
27216    }
27217    element.setAttribute("exportValue", data.exportValue);
27218    element.tabIndex = DEFAULT_TAB_INDEX;
27219    element.addEventListener("change", event => {
27220      const {
27221        name,
27222        checked
27223      } = event.target;
27224      for (const checkbox of this._getElementsByName(name, id)) {
27225        const curChecked = checked && checkbox.exportValue === data.exportValue;
27226        if (checkbox.domElement) {
27227          checkbox.domElement.checked = curChecked;
27228        }
27229        storage.setValue(checkbox.id, {
27230          value: curChecked
27231        });
27232      }
27233      storage.setValue(id, {
27234        value: checked
27235      });
27236    });
27237    element.addEventListener("resetform", event => {
27238      const defaultValue = data.defaultFieldValue || "Off";
27239      event.target.checked = defaultValue === data.exportValue;
27240    });
27241    if (this.enableScripting && this.hasJSActions) {
27242      element.addEventListener("updatefromsandbox", jsEvent => {
27243        const actions = {
27244          value(event) {
27245            event.target.checked = event.detail.value !== "Off";
27246            storage.setValue(id, {
27247              value: event.target.checked
27248            });
27249          }
27250        };
27251        this._dispatchEventFromSandbox(actions, jsEvent);
27252      });
27253      this._setEventListeners(element, null, [["change", "Validate"], ["change", "Action"], ["focus", "Focus"], ["blur", "Blur"], ["mousedown", "Mouse Down"], ["mouseenter", "Mouse Enter"], ["mouseleave", "Mouse Exit"], ["mouseup", "Mouse Up"]], event => event.target.checked);
27254    }
27255    this._setBackgroundColor(element);
27256    this._setDefaultPropertiesFromJS(element);
27257    this.container.append(element);
27258    return this.container;
27259  }
27260}
27261class RadioButtonWidgetAnnotationElement extends WidgetAnnotationElement {
27262  constructor(parameters) {
27263    super(parameters, {
27264      isRenderable: parameters.renderForms
27265    });
27266  }
27267  render() {
27268    this.container.classList.add("buttonWidgetAnnotation", "radioButton");
27269    const storage = this.annotationStorage;
27270    const data = this.data;
27271    const id = data.id;
27272    let value = storage.getValue(id, {
27273      value: data.fieldValue === data.buttonValue
27274    }).value;
27275    if (typeof value === "string") {
27276      value = value !== data.buttonValue;
27277      storage.setValue(id, {
27278        value
27279      });
27280    }
27281    const element = document.createElement("input");
27282    GetElementsByNameSet.add(element);
27283    element.setAttribute("data-element-id", id);
27284    element.disabled = data.readOnly;
27285    this._setRequired(element, this.data.required);
27286    element.type = "radio";
27287    element.name = data.fieldName;
27288    if (value) {
27289      element.setAttribute("checked", true);
27290    }
27291    element.tabIndex = DEFAULT_TAB_INDEX;
27292    element.addEventListener("change", event => {
27293      const {
27294        name,
27295        checked
27296      } = event.target;
27297      for (const radio of this._getElementsByName(name, id)) {
27298        storage.setValue(radio.id, {
27299          value: false
27300        });
27301      }
27302      storage.setValue(id, {
27303        value: checked
27304      });
27305    });
27306    element.addEventListener("resetform", event => {
27307      const defaultValue = data.defaultFieldValue;
27308      event.target.checked = defaultValue !== null && defaultValue !== undefined && defaultValue === data.buttonValue;
27309    });
27310    if (this.enableScripting && this.hasJSActions) {
27311      const pdfButtonValue = data.buttonValue;
27312      element.addEventListener("updatefromsandbox", jsEvent => {
27313        const actions = {
27314          value: event => {
27315            const checked = pdfButtonValue === event.detail.value;
27316            for (const radio of this._getElementsByName(event.target.name)) {
27317              const curChecked = checked && radio.id === id;
27318              if (radio.domElement) {
27319                radio.domElement.checked = curChecked;
27320              }
27321              storage.setValue(radio.id, {
27322                value: curChecked
27323              });
27324            }
27325          }
27326        };
27327        this._dispatchEventFromSandbox(actions, jsEvent);
27328      });
27329      this._setEventListeners(element, null, [["change", "Validate"], ["change", "Action"], ["focus", "Focus"], ["blur", "Blur"], ["mousedown", "Mouse Down"], ["mouseenter", "Mouse Enter"], ["mouseleave", "Mouse Exit"], ["mouseup", "Mouse Up"]], event => event.target.checked);
27330    }
27331    this._setBackgroundColor(element);
27332    this._setDefaultPropertiesFromJS(element);
27333    this.container.append(element);
27334    return this.container;
27335  }
27336}
27337class PushButtonWidgetAnnotationElement extends LinkAnnotationElement {
27338  constructor(parameters) {
27339    super(parameters, {
27340      ignoreBorder: parameters.data.hasAppearance
27341    });
27342  }
27343  render() {
27344    const container = super.render();
27345    container.classList.add("buttonWidgetAnnotation", "pushButton");
27346    if (this.data.alternativeText) {
27347      container.title = this.data.alternativeText;
27348    }
27349    const linkElement = container.lastChild;
27350    if (this.enableScripting && this.hasJSActions && linkElement) {
27351      this._setDefaultPropertiesFromJS(linkElement);
27352      linkElement.addEventListener("updatefromsandbox", jsEvent => {
27353        this._dispatchEventFromSandbox({}, jsEvent);
27354      });
27355    }
27356    return container;
27357  }
27358}
27359class ChoiceWidgetAnnotationElement extends WidgetAnnotationElement {
27360  constructor(parameters) {
27361    super(parameters, {
27362      isRenderable: parameters.renderForms
27363    });
27364  }
27365  render() {
27366    this.container.classList.add("choiceWidgetAnnotation");
27367    const storage = this.annotationStorage;
27368    const id = this.data.id;
27369    const storedData = storage.getValue(id, {
27370      value: this.data.fieldValue
27371    });
27372    const selectElement = document.createElement("select");
27373    GetElementsByNameSet.add(selectElement);
27374    selectElement.setAttribute("data-element-id", id);
27375    selectElement.disabled = this.data.readOnly;
27376    this._setRequired(selectElement, this.data.required);
27377    selectElement.name = this.data.fieldName;
27378    selectElement.tabIndex = DEFAULT_TAB_INDEX;
27379    let addAnEmptyEntry = this.data.combo && this.data.options.length > 0;
27380    if (!this.data.combo) {
27381      selectElement.size = this.data.options.length;
27382      if (this.data.multiSelect) {
27383        selectElement.multiple = true;
27384      }
27385    }
27386    selectElement.addEventListener("resetform", event => {
27387      const defaultValue = this.data.defaultFieldValue;
27388      for (const option of selectElement.options) {
27389        option.selected = option.value === defaultValue;
27390      }
27391    });
27392    for (const option of this.data.options) {
27393      const optionElement = document.createElement("option");
27394      optionElement.textContent = option.displayValue;
27395      optionElement.value = option.exportValue;
27396      if (storedData.value.includes(option.exportValue)) {
27397        optionElement.setAttribute("selected", true);
27398        addAnEmptyEntry = false;
27399      }
27400      selectElement.append(optionElement);
27401    }
27402    let removeEmptyEntry = null;
27403    if (addAnEmptyEntry) {
27404      const noneOptionElement = document.createElement("option");
27405      noneOptionElement.value = " ";
27406      noneOptionElement.setAttribute("hidden", true);
27407      noneOptionElement.setAttribute("selected", true);
27408      selectElement.prepend(noneOptionElement);
27409      removeEmptyEntry = () => {
27410        noneOptionElement.remove();
27411        selectElement.removeEventListener("input", removeEmptyEntry);
27412        removeEmptyEntry = null;
27413      };
27414      selectElement.addEventListener("input", removeEmptyEntry);
27415    }
27416    const getValue = isExport => {
27417      const name = isExport ? "value" : "textContent";
27418      const {
27419        options,
27420        multiple
27421      } = selectElement;
27422      if (!multiple) {
27423        return options.selectedIndex === -1 ? null : options[options.selectedIndex][name];
27424      }
27425      return Array.prototype.filter.call(options, option => option.selected).map(option => option[name]);
27426    };
27427    let selectedValues = getValue(false);
27428    const getItems = event => {
27429      const options = event.target.options;
27430      return Array.prototype.map.call(options, option => {
27431        return {
27432          displayValue: option.textContent,
27433          exportValue: option.value
27434        };
27435      });
27436    };
27437    if (this.enableScripting && this.hasJSActions) {
27438      selectElement.addEventListener("updatefromsandbox", jsEvent => {
27439        const actions = {
27440          value(event) {
27441            removeEmptyEntry?.();
27442            const value = event.detail.value;
27443            const values = new Set(Array.isArray(value) ? value : [value]);
27444            for (const option of selectElement.options) {
27445              option.selected = values.has(option.value);
27446            }
27447            storage.setValue(id, {
27448              value: getValue(true)
27449            });
27450            selectedValues = getValue(false);
27451          },
27452          multipleSelection(event) {
27453            selectElement.multiple = true;
27454          },
27455          remove(event) {
27456            const options = selectElement.options;
27457            const index = event.detail.remove;
27458            options[index].selected = false;
27459            selectElement.remove(index);
27460            if (options.length > 0) {
27461              const i = Array.prototype.findIndex.call(options, option => option.selected);
27462              if (i === -1) {
27463                options[0].selected = true;
27464              }
27465            }
27466            storage.setValue(id, {
27467              value: getValue(true),
27468              items: getItems(event)
27469            });
27470            selectedValues = getValue(false);
27471          },
27472          clear(event) {
27473            while (selectElement.length !== 0) {
27474              selectElement.remove(0);
27475            }
27476            storage.setValue(id, {
27477              value: null,
27478              items: []
27479            });
27480            selectedValues = getValue(false);
27481          },
27482          insert(event) {
27483            const {
27484              index,
27485              displayValue,
27486              exportValue
27487            } = event.detail.insert;
27488            const selectChild = selectElement.children[index];
27489            const optionElement = document.createElement("option");
27490            optionElement.textContent = displayValue;
27491            optionElement.value = exportValue;
27492            if (selectChild) {
27493              selectChild.before(optionElement);
27494            } else {
27495              selectElement.append(optionElement);
27496            }
27497            storage.setValue(id, {
27498              value: getValue(true),
27499              items: getItems(event)
27500            });
27501            selectedValues = getValue(false);
27502          },
27503          items(event) {
27504            const {
27505              items
27506            } = event.detail;
27507            while (selectElement.length !== 0) {
27508              selectElement.remove(0);
27509            }
27510            for (const item of items) {
27511              const {
27512                displayValue,
27513                exportValue
27514              } = item;
27515              const optionElement = document.createElement("option");
27516              optionElement.textContent = displayValue;
27517              optionElement.value = exportValue;
27518              selectElement.append(optionElement);
27519            }
27520            if (selectElement.options.length > 0) {
27521              selectElement.options[0].selected = true;
27522            }
27523            storage.setValue(id, {
27524              value: getValue(true),
27525              items: getItems(event)
27526            });
27527            selectedValues = getValue(false);
27528          },
27529          indices(event) {
27530            const indices = new Set(event.detail.indices);
27531            for (const option of event.target.options) {
27532              option.selected = indices.has(option.index);
27533            }
27534            storage.setValue(id, {
27535              value: getValue(true)
27536            });
27537            selectedValues = getValue(false);
27538          },
27539          editable(event) {
27540            event.target.disabled = !event.detail.editable;
27541          }
27542        };
27543        this._dispatchEventFromSandbox(actions, jsEvent);
27544      });
27545      selectElement.addEventListener("input", event => {
27546        const exportValue = getValue(true);
27547        storage.setValue(id, {
27548          value: exportValue
27549        });
27550        event.preventDefault();
27551        this.linkService.eventBus?.dispatch("dispatcheventinsandbox", {
27552          source: this,
27553          detail: {
27554            id,
27555            name: "Keystroke",
27556            value: selectedValues,
27557            changeEx: exportValue,
27558            willCommit: false,
27559            commitKey: 1,
27560            keyDown: false
27561          }
27562        });
27563      });
27564      this._setEventListeners(selectElement, null, [["focus", "Focus"], ["blur", "Blur"], ["mousedown", "Mouse Down"], ["mouseenter", "Mouse Enter"], ["mouseleave", "Mouse Exit"], ["mouseup", "Mouse Up"], ["input", "Action"], ["input", "Validate"]], event => event.target.value);
27565    } else {
27566      selectElement.addEventListener("input", function (event) {
27567        storage.setValue(id, {
27568          value: getValue(true)
27569        });
27570      });
27571    }
27572    if (this.data.combo) {
27573      this._setTextStyle(selectElement);
27574    } else {}
27575    this._setBackgroundColor(selectElement);
27576    this._setDefaultPropertiesFromJS(selectElement);
27577    this.container.append(selectElement);
27578    return this.container;
27579  }
27580}
27581class PopupAnnotationElement extends AnnotationElement {
27582  constructor(parameters) {
27583    const {
27584      data,
27585      elements
27586    } = parameters;
27587    super(parameters, {
27588      isRenderable: AnnotationElement._hasPopupData(data)
27589    });
27590    this.elements = elements;
27591  }
27592  render() {
27593    this.container.classList.add("popupAnnotation");
27594    const popup = new PopupElement({
27595      container: this.container,
27596      color: this.data.color,
27597      titleObj: this.data.titleObj,
27598      modificationDate: this.data.modificationDate,
27599      contentsObj: this.data.contentsObj,
27600      richText: this.data.richText,
27601      rect: this.data.rect,
27602      parentRect: this.data.parentRect || null,
27603      parent: this.parent,
27604      elements: this.elements,
27605      open: this.data.open
27606    });
27607    const elementIds = [];
27608    for (const element of this.elements) {
27609      element.popup = popup;
27610      elementIds.push(element.data.id);
27611      element.addHighlightArea();
27612    }
27613    this.container.setAttribute("aria-controls", elementIds.map(id => `${_util.AnnotationPrefix}${id}`).join(","));
27614    return this.container;
27615  }
27616}
27617class PopupElement {
27618  #dateTimePromise = null;
27619  #boundKeyDown = this.#keyDown.bind(this);
27620  #boundHide = this.#hide.bind(this);
27621  #boundShow = this.#show.bind(this);
27622  #boundToggle = this.#toggle.bind(this);
27623  #color = null;
27624  #container = null;
27625  #contentsObj = null;
27626  #elements = null;
27627  #parent = null;
27628  #parentRect = null;
27629  #pinned = false;
27630  #popup = null;
27631  #rect = null;
27632  #richText = null;
27633  #titleObj = null;
27634  #wasVisible = false;
27635  constructor({
27636    container,
27637    color,
27638    elements,
27639    titleObj,
27640    modificationDate,
27641    contentsObj,
27642    richText,
27643    parent,
27644    rect,
27645    parentRect,
27646    open
27647  }) {
27648    this.#container = container;
27649    this.#titleObj = titleObj;
27650    this.#contentsObj = contentsObj;
27651    this.#richText = richText;
27652    this.#parent = parent;
27653    this.#color = color;
27654    this.#rect = rect;
27655    this.#parentRect = parentRect;
27656    this.#elements = elements;
27657    const dateObject = _display_utils.PDFDateString.toDateObject(modificationDate);
27658    if (dateObject) {
27659      this.#dateTimePromise = parent.l10n.get("annotation_date_string", {
27660        date: dateObject.toLocaleDateString(),
27661        time: dateObject.toLocaleTimeString()
27662      });
27663    }
27664    this.trigger = elements.flatMap(e => e.getElementsToTriggerPopup());
27665    for (const element of this.trigger) {
27666      element.addEventListener("click", this.#boundToggle);
27667      element.addEventListener("mouseenter", this.#boundShow);
27668      element.addEventListener("mouseleave", this.#boundHide);
27669      element.classList.add("popupTriggerArea");
27670    }
27671    for (const element of elements) {
27672      element.container?.addEventListener("keydown", this.#boundKeyDown);
27673    }
27674    this.#container.hidden = true;
27675    if (open) {
27676      this.#toggle();
27677    }
27678  }
27679  render() {
27680    if (this.#popup) {
27681      return;
27682    }
27683    const {
27684      page: {
27685        view
27686      },
27687      viewport: {
27688        rawDims: {
27689          pageWidth,
27690          pageHeight,
27691          pageX,
27692          pageY
27693        }
27694      }
27695    } = this.#parent;
27696    const popup = this.#popup = document.createElement("div");
27697    popup.className = "popup";
27698    if (this.#color) {
27699      const baseColor = popup.style.outlineColor = _util.Util.makeHexColor(...this.#color);
27700      if (CSS.supports("background-color", "color-mix(in srgb, red 30%, white)")) {
27701        popup.style.backgroundColor = `color-mix(in srgb, ${baseColor} 30%, white)`;
27702      } else {
27703        const BACKGROUND_ENLIGHT = 0.7;
27704        popup.style.backgroundColor = _util.Util.makeHexColor(...this.#color.map(c => Math.floor(BACKGROUND_ENLIGHT * (255 - c) + c)));
27705      }
27706    }
27707    const header = document.createElement("span");
27708    header.className = "header";
27709    const title = document.createElement("h1");
27710    header.append(title);
27711    ({
27712      dir: title.dir,
27713      str: title.textContent
27714    } = this.#titleObj);
27715    popup.append(header);
27716    if (this.#dateTimePromise) {
27717      const modificationDate = document.createElement("span");
27718      modificationDate.classList.add("popupDate");
27719      this.#dateTimePromise.then(localized => {
27720        modificationDate.textContent = localized;
27721      });
27722      header.append(modificationDate);
27723    }
27724    const contentsObj = this.#contentsObj;
27725    const richText = this.#richText;
27726    if (richText?.str && (!contentsObj?.str || contentsObj.str === richText.str)) {
27727      _xfa_layer.XfaLayer.render({
27728        xfaHtml: richText.html,
27729        intent: "richText",
27730        div: popup
27731      });
27732      popup.lastChild.classList.add("richText", "popupContent");
27733    } else {
27734      const contents = this._formatContents(contentsObj);
27735      popup.append(contents);
27736    }
27737    let useParentRect = !!this.#parentRect;
27738    let rect = useParentRect ? this.#parentRect : this.#rect;
27739    for (const element of this.#elements) {
27740      if (!rect || _util.Util.intersect(element.data.rect, rect) !== null) {
27741        rect = element.data.rect;
27742        useParentRect = true;
27743        break;
27744      }
27745    }
27746    const normalizedRect = _util.Util.normalizeRect([rect[0], view[3] - rect[1] + view[
vendor: 7,780 bytes, lines 27746-27999
277461], rect[2], view[3] - rect[3] + view[1]]);
27747    const HORIZONTAL_SPACE_AFTER_ANNOTATION = 5;
27748    const parentWidth = useParentRect ? rect[2] - rect[0] + HORIZONTAL_SPACE_AFTER_ANNOTATION : 0;
27749    const popupLeft = normalizedRect[0] + parentWidth;
27750    const popupTop = normalizedRect[1];
27751    const {
27752      style
27753    } = this.#container;
27754    style.left = `${100 * (popupLeft - pageX) / pageWidth}%`;
27755    style.top = `${100 * (popupTop - pageY) / pageHeight}%`;
27756    this.#container.append(popup);
27757  }
27758  _formatContents({
27759    str,
27760    dir
27761  }) {
27762    const p = document.createElement("p");
27763    p.classList.add("popupContent");
27764    p.dir = dir;
27765    const lines = str.split(/(?:\r\n?|\n)/);
27766    for (let i = 0, ii = lines.length; i < ii; ++i) {
27767      const line = lines[i];
27768      p.append(document.createTextNode(line));
27769      if (i < ii - 1) {
27770        p.append(document.createElement("br"));
27771      }
27772    }
27773    return p;
27774  }
27775  #keyDown(event) {
27776    if (event.altKey || event.shiftKey || event.ctrlKey || event.metaKey) {
27777      return;
27778    }
27779    if (event.key === "Enter" || event.key === "Escape" && this.#pinned) {
27780      this.#toggle();
27781    }
27782  }
27783  #toggle() {
27784    this.#pinned = !this.#pinned;
27785    if (this.#pinned) {
27786      this.#show();
27787      this.#container.addEventListener("click", this.#boundToggle);
27788      this.#container.addEventListener("keydown", this.#boundKeyDown);
27789    } else {
27790      this.#hide();
27791      this.#container.removeEventListener("click", this.#boundToggle);
27792      this.#container.removeEventListener("keydown", this.#boundKeyDown);
27793    }
27794  }
27795  #show() {
27796    if (!this.#popup) {
27797      this.render();
27798    }
27799    if (!this.isVisible) {
27800      this.#container.hidden = false;
27801      this.#container.style.zIndex = parseInt(this.#container.style.zIndex) + 1000;
27802    } else if (this.#pinned) {
27803      this.#container.classList.add("focused");
27804    }
27805  }
27806  #hide() {
27807    this.#container.classList.remove("focused");
27808    if (this.#pinned || !this.isVisible) {
27809      return;
27810    }
27811    this.#container.hidden = true;
27812    this.#container.style.zIndex = parseInt(this.#container.style.zIndex) - 1000;
27813  }
27814  forceHide() {
27815    this.#wasVisible = this.isVisible;
27816    if (!this.#wasVisible) {
27817      return;
27818    }
27819    this.#container.hidden = true;
27820  }
27821  maybeShow() {
27822    if (!this.#wasVisible) {
27823      return;
27824    }
27825    this.#wasVisible = false;
27826    this.#container.hidden = false;
27827  }
27828  get isVisible() {
27829    return this.#container.hidden === false;
27830  }
27831}
27832class FreeTextAnnotationElement extends AnnotationElement {
27833  constructor(parameters) {
27834    super(parameters, {
27835      isRenderable: true,
27836      ignoreBorder: true
27837    });
27838    this.textContent = parameters.data.textContent;
27839    this.textPosition = parameters.data.textPosition;
27840    this.annotationEditorType = _util.AnnotationEditorType.FREETEXT;
27841  }
27842  render() {
27843    this.container.classList.add("freeTextAnnotation");
27844    if (this.textContent) {
27845      const content = document.createElement("div");
27846      content.classList.add("annotationTextContent");
27847      content.setAttribute("role", "comment");
27848      for (const line of this.textContent) {
27849        const lineSpan = document.createElement("span");
27850        lineSpan.textContent = line;
27851        content.append(lineSpan);
27852      }
27853      this.container.append(content);
27854    }
27855    if (!this.data.popupRef && this.hasPopupData) {
27856      this._createPopup();
27857    }
27858    this._editOnDoubleClick();
27859    return this.container;
27860  }
27861}
27862exports.FreeTextAnnotationElement = FreeTextAnnotationElement;
27863class LineAnnotationElement extends AnnotationElement {
27864  #line = null;
27865  constructor(parameters) {
27866    super(parameters, {
27867      isRenderable: true,
27868      ignoreBorder: true
27869    });
27870  }
27871  render() {
27872    this.container.classList.add("lineAnnotation");
27873    const data = this.data;
27874    const {
27875      width,
27876      height
27877    } = getRectDims(data.rect);
27878    const svg = this.svgFactory.create(width, height, true);
27879    const line = this.#line = this.svgFactory.createElement("svg:line");
27880    line.setAttribute("x1", data.rect[2] - data.lineCoordinates[0]);
27881    line.setAttribute("y1", data.rect[3] - data.lineCoordinates[1]);
27882    line.setAttribute("x2", data.rect[2] - data.lineCoordinates[2]);
27883    line.setAttribute("y2", data.rect[3] - data.lineCoordinates[3]);
27884    line.setAttribute("stroke-width", data.borderStyle.width || 1);
27885    line.setAttribute("stroke", "transparent");
27886    line.setAttribute("fill", "transparent");
27887    svg.append(line);
27888    this.container.append(svg);
27889    if (!data.popupRef && this.hasPopupData) {
27890      this._createPopup();
27891    }
27892    return this.container;
27893  }
27894  getElementsToTriggerPopup() {
27895    return this.#line;
27896  }
27897  addHighlightArea() {
27898    this.container.classList.add("highlightArea");
27899  }
27900}
27901class SquareAnnotationElement extends AnnotationElement {
27902  #square = null;
27903  constructor(parameters) {
27904    super(parameters, {
27905      isRenderable: true,
27906      ignoreBorder: true
27907    });
27908  }
27909  render() {
27910    this.container.classList.add("squareAnnotation");
27911    const data = this.data;
27912    const {
27913      width,
27914      height
27915    } = getRectDims(data.rect);
27916    const svg = this.svgFactory.create(width, height, true);
27917    const borderWidth = data.borderStyle.width;
27918    const square = this.#square = this.svgFactory.createElement("svg:rect");
27919    square.setAttribute("x", borderWidth / 2);
27920    square.setAttribute("y", borderWidth / 2);
27921    square.setAttribute("width", width - borderWidth);
27922    square.setAttribute("height", height - borderWidth);
27923    square.setAttribute("stroke-width", borderWidth || 1);
27924    square.setAttribute("stroke", "transparent");
27925    square.setAttribute("fill", "transparent");
27926    svg.append(square);
27927    this.container.append(svg);
27928    if (!data.popupRef && this.hasPopupData) {
27929      this._createPopup();
27930    }
27931    return this.container;
27932  }
27933  getElementsToTriggerPopup() {
27934    return this.#square;
27935  }
27936  addHighlightArea() {
27937    this.container.classList.add("highlightArea");
27938  }
27939}
27940class CircleAnnotationElement extends AnnotationElement {
27941  #circle = null;
27942  constructor(parameters) {
27943    super(parameters, {
27944      isRenderable: true,
27945      ignoreBorder: true
27946    });
27947  }
27948  render() {
27949    this.container.classList.add("circleAnnotation");
27950    const data = this.data;
27951    const {
27952      width,
27953      height
27954    } = getRectDims(data.rect);
27955    const svg = this.svgFactory.create(width, height, true);
27956    const borderWidth = data.borderStyle.width;
27957    const circle = this.#circle = this.svgFactory.createElement("svg:ellipse");
27958    circle.setAttribute("cx", width / 2);
27959    circle.setAttribute("cy", height / 2);
27960    circle.setAttribute("rx", width / 2 - borderWidth / 2);
27961    circle.setAttribute("ry", height / 2 - borderWidth / 2);
27962    circle.setAttribute("stroke-width", borderWidth || 1);
27963    circle.setAttribute("stroke", "transparent");
27964    circle.setAttribute("fill", "transparent");
27965    svg.append(circle);
27966    this.container.append(svg);
27967    if (!data.popupRef && this.hasPopupData) {
27968      this._createPopup();
27969    }
27970    return this.container;
27971  }
27972  getElementsToTriggerPopup() {
27973    return this.#circle;
27974  }
27975  addHighlightArea() {
27976    this.container.classList.add("highlightArea");
27977  }
27978}
27979class PolylineAnnotationElement extends AnnotationElement {
27980  #polyline = null;
27981  constructor(parameters) {
27982    super(parameters, {
27983      isRenderable: true,
27984      ignoreBorder: true
27985    });
27986    this.containerClassName = "polylineAnnotation";
27987    this.svgElementName = "svg:polyline";
27988  }
27989  render() {
27990    this.container.classList.add(this.containerClassName);
27991    const data = this.data;
27992    const {
27993      width,
27994      height
27995    } = getRectDims(data.rect);
27996    const svg = this.svgFactory.create(width, height, true);
27997    let points = [];
27998    for (const coordinate of data.vertices) {
27999      const x = coordinate.x - data.rect[0];
28000      const y = data.rect[3] - coordinate.y;
28001      points.push(x + "," + y);
28002    }
28003    points = points.join(" ");
28004    const polyline = this.#polyline = this.svgFactory.createElement(this.svgElementName);
28005    polyline.setAttribute("points", points);
28006    polyline.setAttribute("stroke-width", data.borderStyle.width || 1);
28007    polyline.setAttribute("stroke", "transparent");
28008    polyline.setAttribute("fill", "transparent");
28009    svg.append(polyline);
28010    this.container.append(svg);
28011    if (!data.popupRef && this.hasPopupData) {
28012      this._createPopup();
28013    }
28014    return this.container;
28015  }
28016  getElementsToTriggerPopup() {
28017    return this.#polyline;
28018  }
28019  addHighlightArea() {
28020    this.container.classList.add("highlightArea");
28021  }
28022}
28023class PolygonAnnotationElement extends PolylineAnnotationElement {
28024  constructor(parameters) {
28025    super(parameters);
28026    this.containerClassName = "polygonAnnotation";
28027    this.svgElementName = "svg:polygon";
28028  }
28029}
28030class CaretAnnotationElement extends AnnotationElement {
28031  constructor(parameters) {
28032    super(parameters, {
28033      isRenderable: true,
28034      ignoreBorder: true
28035    });
28036  }
28037  render() {
28038    this.container.classList.add("caretAnnotation");
28039    if (!this.data.popupRef && this.hasPopupData) {
28040      this._createPopup();
28041    }
28042    return this.container;
28043  }
28044}
28045class InkAnnotationElement extends AnnotationElement {
28046  #polylines = [];
28047  constructor(parameters) {
28048    super(parameters, {
28049      isRenderable: true,
28050      ignoreBorder: true
28051    });
28052    this.containerClassName = "inkAnnotation";
28053    this.svgElementName = "svg:polyline";
28054    this.annotationEditorType = _util.AnnotationEditorType.INK;
28055  }
28056  render() {
28057    this.container.classList.add(this.containerClassName);
28058    const data = this.data;
28059    const {
28060      width,
28061      height
28062    } = getRectDims(data.rect);
28063    const svg = this.svgFactory.create(width, height, true);
28064    for (const inkList of data.inkLists) {
28065      let points = [];
28066      for (const coordinate of inkList) {
28067        const x = coordinate.x - data.rect[0];
28068        const y = data.rect[3] - coordinate.y;
28069        points.push(`${x},${y}`);
28070      }
28071      points = points.join(" ");
28072      const polyline = this.svgFactory.createElement(this.svgElementName);
28073      this.#polylines.push(polyline);
28074      polyline.setAttribute("points", points);
28075      polyline.setAttribute("stroke-width", data.borderStyle.width || 1);
28076      polyline.setAttribute("stroke", "transparent");
28077      polyline.setAttribute("fill", "transparent");
28078      if (!data.popupRef && this.hasPopupData) {
28079        this._createPopup();
28080      }
28081      svg.append(polyline);
28082    }
28083    this.container.append(svg);
28084    return this.container;
28085  }
28086  getElementsToTriggerPopup() {
28087    return this.#polylines;
28088  }
28089  addHighlightArea() {
28090    this.container.classList.add("highlightArea");
28091  }
28092}
28093exports.InkAnnotationElement = InkAnnotationElement;
28094class HighlightAnnotationElement extends AnnotationElement {
28095  constructor(parameters) {
28096    super(parameters, {
28097      isRenderable: true,
28098      ignoreBorder: true,
28099      createQuadrilaterals: true
28100    });
28101  }
28102  render() {
28103    if (!this.data.popupRef && this.hasPopupData) {
28104      this._createPopup();
28105    }
28106    this.container.classList.add("highlightAnnotation");
28107    return this.container;
28108  }
28109}
28110class UnderlineAnnotationElement extends AnnotationElement {
28111  constructor(parameters) {
28112    super(parameters, {
28113      isRenderable: true,
28114      ignoreBorder: true,
28115      createQuadrilaterals: true
28116    });
28117  }
28118  render() {
28119    if (!this.data.popupRef && this.hasPopupData) {
28120      this._createPopup();
28121    }
28122    this.container.classList.add("underlineAnnotation");
28123    return this.container;
28124  }
28125}
28126class SquigglyAnnotationElement extends AnnotationElement {
28127  constructor(parameters) {
28128    super(parameters, {
28129      isRenderable: true,
28130      ignoreBorder: true,
28131      createQuadrilaterals: true
28132    });
28133  }
28134  render() {
28135    if (!this.data.popupRef && this.hasPopupData) {
28136      this._createPopup();
28137    }
28138    this.container.classList.add("squigglyAnnotation");
28139    return this.container;
28140  }
28141}
28142class StrikeOutAnnotationElement extends AnnotationElement {
28143  constructor(parameters) {
28144    super(parameters, {
28145      isRenderable: true,
28146      ignoreBorder: true,
28147      createQuadrilaterals: true
28148    });
28149  }
28150  render() {
28151    if (!this.data.popupRef && this.hasPopupData) {
28152      this._createPopup();
28153    }
28154    this.container.classList.add("strikeoutAnnotation");
28155    return this.container;
28156  }
28157}
28158class StampAnnotationElement extends AnnotationElement {
28159  constructor(parameters) {
28160    super(parameters, {
28161      isRenderable: true,
28162      ignoreBorder: true
28163    });
28164  }
28165  render() {
28166    this.container.classList.add("stampAnnotation");
28167    if (!this.data.popupRef && this.hasPopupData) {
28168      this._createPopup();
28169    }
28170    return this.container;
28171  }
28172}
28173exports.StampAnnotationElement = StampAnnotationElement;
28174class FileAttachmentAnnotationElement extends AnnotationElement {
28175  #trigger = null;
28176  constructor(parameters) {
28177    super(parameters, {
28178      isRenderable: true
28179    });
28180    const {
28181      filename,
28182      content
28183    } = this.data.file;
28184    this.filename = (0, _display_utils.getFilenameFromUrl)(filename, true);
28185    this.content = content;
28186    this.linkService.eventBus?.dispatch("fileattachmentannotation", {
28187      source: this,
28188      filename,
28189      content
28190    });
28191  }
28192  render() {
28193    this.container.classList.add("fileAttachmentAnnotation");
28194    const {
28195      container,
28196      data
28197    } = this;
28198    let trigger;
28199    if (data.hasAppearance || data.fillAlpha === 0) {
28200      trigger = document.createElement("div");
28201    } else {
28202      trigger = document.createElement("img");
28203      trigger.src = `${this.imageResourcesPath}annotation-${/paperclip/i.test(data.name) ? "paperclip" : "pushpin"}.svg`;
28204      if (data.fillAlpha && data.fillAlpha < 1) {
28205        trigger.style = `filter: opacity(${Math.round(data.fillAlpha * 100)}%);`;
28206      }
28207    }
28208    trigger.addEventListener("dblclick", this.#download.bind(this));
28209    this.#trigger = trigger;
28210    const {
28211      isMac
28212    } = _util.FeatureTest.platform;
28213    container.addEventListener("keydown", evt => {
28214      if (evt.key === "Enter" && (isMac ? evt.metaKey : evt.ctrlKey)) {
28215        this.#download();
28216      }
28217    });
28218    if (!data.popupRef && this.hasPopupData) {
28219      this._createPopup();
28220    } else {
28221      trigger.classList.add("popupTriggerArea");
28222    }
28223    container.append(trigger);
28224    return container;
28225  }
28226  getElementsToTriggerPopup() {
28227    return this.#trigger;
28228  }
28229  addHighlightArea() {
28230    this.container.classList.add("highlightArea");
28231  }
28232  #download() {
28233    this.downloadManager?.openOrDownloadData(this.container, this.content, this.filename);
28234  }
28235}
28236class AnnotationLayer {
28237  #accessibilityManager = null;
28238  #annotationCanvasMap = null;
28239  #editableAnnotations = new Map();
28240  constructor({
28241    div,
28242    accessibilityManager,
28243    annotationCanvasMap,
28244    l10n,
28245    page,
28246    viewport
28247  }) {
28248    this.div = div;
28249    this.#accessibilityManager = accessibilityManager;
28250    this.#annotationCanvasMap = annotationCanvasMap;
28251    this.l10n = l10n;
28252    this.page = page;
28253    this.viewport = viewport;
28254    this.zIndex = 0;
28255    this.l10n ||= _displayL10n_utils.NullL10n;
28256  }
28257  #appendElement(element, id) {
28258    const contentElement = element.firstChild || element;
28259    contentElement.id = `${_util.AnnotationPrefix}${id}`;
28260    this.div.append(element);
28261    this.#accessibilityManager?.moveElementInDOM(this.div, element, contentElement, false);
28262  }
28263  async render(params) {
28264    const {
28265      annotations
28266    } = params;
28267    const layer = this.div;
28268    (0, _display_utils.setLayerDimensions)(layer, this.viewport);
28269    const popupToElements = new Map();
28270    const elementParams = {
28271      data: null,
28272      layer,
28273      linkService: params.linkService,
28274      downloadManager: params.downloadManager,
28275      imageResourcesPath: params.imageResourcesPath || "",
28276      renderForms: params.renderForms !== false,
28277      svgFactory: new _display_utils.DOMSVGFactory(),
28278      annotationStorage: params.annotationStorage || new _annotation_storage.AnnotationStorage(),
28279      enableScripting: params.enableScripting === true,
28280      hasJSActions: params.hasJSActions,
28281      fieldObjects: params.fieldObjects,
28282      parent: this,
28283      elements: null
28284    };
28285    for (const data of annotations) {
28286      if (data.noHTML) {
28287        continue;
28288      }
28289      const isPopupAnnotation = data.annotationType === _util.AnnotationType.POPUP;
28290      if (!isPopupAnnotation) {
28291        const {
28292          width,
28293          height
28294        } = getRectDims(data.rect);
28295        if (width <= 0 || height <= 0) {
28296          continue;
28297        }
28298      } else {
28299        const elements = popupToElements.get(data.id);
28300        if (!elements) {
28301          continue;
28302        }
vendor: 6,252 bytes, lines 28303-28495
28303        elementParams.elements = elements;
28304      }
28305      elementParams.data = data;
28306      const element = AnnotationElementFactory.create(elementParams);
28307      if (!element.isRenderable) {
28308        continue;
28309      }
28310      if (!isPopupAnnotation && data.popupRef) {
28311        const elements = popupToElements.get(data.popupRef);
28312        if (!elements) {
28313          popupToElements.set(data.popupRef, [element]);
28314        } else {
28315          elements.push(element);
28316        }
28317      }
28318      if (element.annotationEditorType > 0) {
28319        this.#editableAnnotations.set(element.data.id, element);
28320      }
28321      const rendered = element.render();
28322      if (data.hidden) {
28323        rendered.style.visibility = "hidden";
28324      }
28325      this.#appendElement(rendered, data.id);
28326    }
28327    this.#setAnnotationCanvasMap();
28328    await this.l10n.translate(layer);
28329  }
28330  update({
28331    viewport
28332  }) {
28333    const layer = this.div;
28334    this.viewport = viewport;
28335    (0, _display_utils.setLayerDimensions)(layer, {
28336      rotation: viewport.rotation
28337    });
28338    this.#setAnnotationCanvasMap();
28339    layer.hidden = false;
28340  }
28341  #setAnnotationCanvasMap() {
28342    if (!this.#annotationCanvasMap) {
28343      return;
28344    }
28345    const layer = this.div;
28346    for (const [id, canvas] of this.#annotationCanvasMap) {
28347      const element = layer.querySelector(`[data-annotation-id="${id}"]`);
28348      if (!element) {
28349        continue;
28350      }
28351      const {
28352        firstChild
28353      } = element;
28354      if (!firstChild) {
28355        element.append(canvas);
28356      } else if (firstChild.nodeName === "CANVAS") {
28357        firstChild.replaceWith(canvas);
28358      } else {
28359        firstChild.before(canvas);
28360      }
28361    }
28362    this.#annotationCanvasMap.clear();
28363  }
28364  getEditableAnnotations() {
28365    return Array.from(this.#editableAnnotations.values());
28366  }
28367  getEditableAnnotation(id) {
28368    return this.#editableAnnotations.get(id);
28369  }
28370}
28371exports.AnnotationLayer = AnnotationLayer;
28372
28373/***/ }),
28374/* 30 */
28375/***/ ((__unused_webpack_module, exports) => {
28376
28377
28378
28379Object.defineProperty(exports, "__esModule", ({
28380  value: true
28381}));
28382exports.ColorConverters = void 0;
28383function makeColorComp(n) {
28384  return Math.floor(Math.max(0, Math.min(1, n)) * 255).toString(16).padStart(2, "0");
28385}
28386function scaleAndClamp(x) {
28387  return Math.max(0, Math.min(255, 255 * x));
28388}
28389class ColorConverters {
28390  static CMYK_G([c, y, m, k]) {
28391    return ["G", 1 - Math.min(1, 0.3 * c + 0.59 * m + 0.11 * y + k)];
28392  }
28393  static G_CMYK([g]) {
28394    return ["CMYK", 0, 0, 0, 1 - g];
28395  }
28396  static G_RGB([g]) {
28397    return ["RGB", g, g, g];
28398  }
28399  static G_rgb([g]) {
28400    g = scaleAndClamp(g);
28401    return [g, g, g];
28402  }
28403  static G_HTML([g]) {
28404    const G = makeColorComp(g);
28405    return `#${G}${G}${G}`;
28406  }
28407  static RGB_G([r, g, b]) {
28408    return ["G", 0.3 * r + 0.59 * g + 0.11 * b];
28409  }
28410  static RGB_rgb(color) {
28411    return color.map(scaleAndClamp);
28412  }
28413  static RGB_HTML(color) {
28414    return `#${color.map(makeColorComp).join("")}`;
28415  }
28416  static T_HTML() {
28417    return "#00000000";
28418  }
28419  static T_rgb() {
28420    return [null];
28421  }
28422  static CMYK_RGB([c, y, m, k]) {
28423    return ["RGB", 1 - Math.min(1, c + k), 1 - Math.min(1, m + k), 1 - Math.min(1, y + k)];
28424  }
28425  static CMYK_rgb([c, y, m, k]) {
28426    return [scaleAndClamp(1 - Math.min(1, c + k)), scaleAndClamp(1 - Math.min(1, m + k)), scaleAndClamp(1 - Math.min(1, y + k))];
28427  }
28428  static CMYK_HTML(components) {
28429    const rgb = this.CMYK_RGB(components).slice(1);
28430    return this.RGB_HTML(rgb);
28431  }
28432  static RGB_CMYK([r, g, b]) {
28433    const c = 1 - r;
28434    const m = 1 - g;
28435    const y = 1 - b;
28436    const k = Math.min(c, m, y);
28437    return ["CMYK", c, m, y, k];
28438  }
28439}
28440exports.ColorConverters = ColorConverters;
28441
28442/***/ }),
28443/* 31 */
28444/***/ ((__unused_webpack_module, exports) => {
28445
28446
28447
28448Object.defineProperty(exports, "__esModule", ({
28449  value: true
28450}));
28451exports.NullL10n = void 0;
28452exports.getL10nFallback = getL10nFallback;
28453const DEFAULT_L10N_STRINGS = {
28454  of_pages: "of {{pagesCount}}",
28455  page_of_pages: "({{pageNumber}} of {{pagesCount}})",
28456  document_properties_kb: "{{size_kb}} KB ({{size_b}} bytes)",
28457  document_properties_mb: "{{size_mb}} MB ({{size_b}} bytes)",
28458  document_properties_date_string: "{{date}}, {{time}}",
28459  document_properties_page_size_unit_inches: "in",
28460  document_properties_page_size_unit_millimeters: "mm",
28461  document_properties_page_size_orientation_portrait: "portrait",
28462  document_properties_page_size_orientation_landscape: "landscape",
28463  document_properties_page_size_name_a3: "A3",
28464  document_properties_page_size_name_a4: "A4",
28465  document_properties_page_size_name_letter: "Letter",
28466  document_properties_page_size_name_legal: "Legal",
28467  document_properties_page_size_dimension_string: "{{width}} × {{height}} {{unit}} ({{orientation}})",
28468  document_properties_page_size_dimension_name_string: "{{width}} × {{height}} {{unit}} ({{name}}, {{orientation}})",
28469  document_properties_linearized_yes: "Yes",
28470  document_properties_linearized_no: "No",
28471  additional_layers: "Additional Layers",
28472  page_landmark: "Page {{page}}",
28473  thumb_page_title: "Page {{page}}",
28474  thumb_page_canvas: "Thumbnail of Page {{page}}",
28475  find_reached_top: "Reached top of document, continued from bottom",
28476  find_reached_bottom: "Reached end of document, continued from top",
28477  "find_match_count[one]": "{{current}} of {{total}} match",
28478  "find_match_count[other]": "{{current}} of {{total}} matches",
28479  "find_match_count_limit[one]": "More than {{limit}} match",
28480  "find_match_count_limit[other]": "More than {{limit}} matches",
28481  find_not_found: "Phrase not found",
28482  page_scale_width: "Page Width",
28483  page_scale_fit: "Page Fit",
28484  page_scale_auto: "Automatic Zoom",
28485  page_scale_actual: "Actual Size",
28486  page_scale_percent: "{{scale}}%",
28487  loading_error: "An error occurred while loading the PDF.",
28488  invalid_file_error: "Invalid or corrupted PDF file.",
28489  missing_file_error: "Missing PDF file.",
28490  unexpected_response_error: "Unexpected server response.",
28491  rendering_error: "An error occurred while rendering the page.",
28492  annotation_date_string: "{{date}}, {{time}}",
28493  printing_not_supported: "Warning: Printing is not fully supported by this browser.",
28494  printing_not_ready: "Warning: The PDF is not fully loaded for printing.",
28495  web_fonts_disabled: "Web fonts are disabled: unable to use embedded PDF fonts.",
28496  free_text2_default_content: "Start typing…",
28497  editor_free_text2_aria_label: "Text Editor",
28498  editor_ink2_aria_label: "Draw Editor",
28499  editor_ink_canvas_aria_label: "User-created image",
28500  editor_alt_text_button_label: "Alt text",
28501  editor_alt_text_edit_button_label: "Edit alt text",
28502  editor_alt_text_decorative_tooltip: "Marked as decorative"
28503};
28504{
28505  DEFAULT_L10N_STRINGS.print_progress_percent = "{{progress}}%";
28506}
28507function getL10nFallback(key, args) {
28508  switch (key) {
28509    case "find_match_count":
28510      key = `find_match_count[${args.total === 1 ? "one" : "other"}]`;
28511      break;
28512    case "find_match_count_limit":
28513      key = `find_match_count_limit[${args.limit === 1 ? "one" : "other"}]`;
28514      break;
28515  }
28516  return DEFAULT_L10N_STRINGS[key] || "";
28517}
28518function formatL10nValue(text, args) {
28519  if (!args) {
28520    return text;
28521  }
28522  return text.replaceAll(/\{\{\s*(\w+)\s*\}\}/g, (all, name) => {
28523    return name in args ? args[name] : "{{" + name + "}}";
28524  });
28525}
28526const NullL10n = {
28527  async getLanguage() {
28528    return "en-us";
28529  },
28530  async getDirection() {
28531    return "ltr";
28532  },
28533  async get(key, args = null, fallback = getL10nFallback(key, args)) {
28534    return formatL10nValue(fallback, args);
28535  },
28536  async translate(element) {}
28537};
28538exports.NullL10n = NullL10n;
28539
28540/***/ }),
28541/* 32 */
28542/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
28543
28544
28545
28546Object.defineProperty(exports, "__esModule", ({
28547  value: true
28548}));
28549exports.XfaLayer = void 0;
28550var _xfa_text = __w_pdfjs_require__(25);
28551class XfaLayer {
28552  static setupStorage(html, id, element, storage, intent) {
28553    const storedData = storage.getValue(id, {
28554      value: null
28555    });
28556    switch (element.name) {
28557      case "textarea":
28558        if (storedData.value !== null) {
28559          html.textContent = storedData.value;
28560        }
28561        if (intent === "print") {
28562          break;
28563        }
28564        html.addEventListener("input", event => {
28565          storage.setValue(id, {
28566            value: event.target.value
28567          });
28568        });
28569        break;
28570      case "input":
28571        if (element.attributes.type === "radio" || element.attributes.type === "checkbox") {
28572          if (storedData.value === element.attributes.xfaOn) {
28573            html.setAttribute("checked", true);
28574          } else if (storedData.value === element.attributes.xfaOff) {
28575            html.removeAttribute("checked");
28576          }
28577          if (intent === "print") {
28578            break;
28579          }
28580          html.addEventListener("change", event => {
28581            storage.setValue(id, {
28582              value: event.target.checked ? event.target.getAttribute("xfaOn") : event.target.getAttribute("xfaOff")
28583            });
28584          });
28585        } else {
28586          if (storedData.value !== null) {
28587            html.setAttribute("value", storedData.value);
28588          }
28589          if (intent === "print") {
28590            break;
28591          }
28592          html.addEventListener("input", event => {
28593            storage.setValue(id, {
28594              value: event.target.value
28595            });
28596          });
28597        }
28598        break;
28599      case "select":
28600        if (storedData.value !== null) {
28601          html.setAttribute("value", storedData.value);
28602          for (const option of element.children) {
28603            if (option.attributes.value === storedData.value) {
28604              option.attributes.selected = true;
28605            } else if (option.attributes.hasOwnProperty("selected")) {
28606              delete option.attributes.selected;
28607            }
28608          }
28609        }
28610        html.addEventListener("input", event => {
28611          const options = event.target.options;
28612          const value = options.selectedIndex === -1 ? "" : options[options.selectedIndex].value;
28613          storage.setValue(id, {
28614            value
28615          });
28616        });
28617        break;
28618    }
28619  }
28620  static setAttributes({
28621    html,
28622    element,
28623    storage = null,
28624    intent,
28625    linkService
28626  }) {
28627    const {
28628      attributes
28629    } = element;
28630    const isHTMLAnchorElement = html instanceof HTMLAnchorElement;
28631    if (attributes.type === "radio") {
28632      attributes.name = `${attributes.name}-${intent}`;
28633    }
28634    for (const [key, value] of Object.entries(attributes)) {
28635      if (value === null || value === undefined) {
28636        continue;
28637      }
28638      switch (key) {
28639        case "class":
28640          if (value.length) {
28641            html.setAttribute(key, value.join(" "));
28642          }
28643          break;
28644        case "dataId":
28645          break;
28646        case "id":
28647          html.setAttribute("data-element-id", value);
28648          break;
28649        case "style":
28650          Object.assign(html.style, value);
28651          break;
28652        case "textContent":
28653          html.textContent = value;
28654          break;
28655        default:
28656          if (!isHTMLAnchorElement || key !== "href" && key !== "newWindow") {
28657            html.setAttribute(key, value);
28658          }
28659      }
28660    }
28661    if (isHTMLAnchorElement) {
28662      linkService.addLinkAttributes(html, attributes.href, attributes.newWindow);
28663    }
28664    if (storage && attributes.dataId) {
28665      this.setupStorage(html, attributes.dataId, element, storage);
28666    }
28667  }
28668  static render(parameters) {
28669    const storage = parameters.annotationStorage;
28670    const linkService = parameters.linkService;
28671    const root = parameters.xfaHtml;
28672    const intent = parameters.intent || "display";
28673    const rootHtml = document.createElement(root.name);
28674    if (root.attributes) {
28675      this.setAttributes({
28676        html: rootHtml,
28677        element: root,
28678        intent,
28679        linkService
28680      });
28681    }
28682    const stack = [[root, -1, rootHtml]];
28683    const rootDiv = parameters.div;
28684    rootDiv.append(rootHtml);
28685    if (parameters.viewport) {
28686      const transform = `matrix(${parameters.viewport.transform.join(",")})`;
28687      rootDiv.style.transform = transform;
28688    }
28689    if (intent !== "richText") {
28690      rootDiv.setAttribute("class", "xfaLayer xfaFont");
28691    }
28692    const textDivs = [];
28693    while (stack.length > 0) {
28694      const [parent, i, html] = stack.at(-1);
28695      if (i + 1 === parent.children.length) {
28696        stack.pop();
28697        continue;
28698      }
28699      const child = parent.children[++stack.at(-1)[1]];
28700      if (child === null) {
28701        continue;
28702      }
28703      const {
28704        name
28705      } = child;
28706      if (name === "#text") {
28707        const node = document.createTextNode(child.value);
28708        textDivs.push(node);
28709        html.append(node);
28710        continue;
28711      }
28712      const childHtml = child?.attributes?.xmlns ? document.createElementNS(child.attributes.xmlns, name) : document.createElement(name);
28713      html.append(childHtml);
28714      if (child.attributes) {
28715        this.setAttributes({
28716          html: childHtml,
28717          element: child,
28718          storage,
28719          intent,
28720          linkService
28721        });
28722      }
28723      if (child.children && child.children.length > 0) {
28724        stack.push([child, -1, childHtml]);
28725      } else if (child.value) {
28726        const node = document.createTextNode(child.value);
28727        if (_xfa_text.XfaText.shouldBuildText(name)) {
28728          textDivs.push(node);
28729        }
28730        childHtml.append(node);
28731      }
28732    }
28733    for (const el of rootDiv.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea")) {
28734      el.setAttribute("readOnly", true);
28735    }
28736    return {
28737      textDivs
28738    };
28739  }
28740  static update(parameters) {
28741    const transform = `matrix(${parameters.viewport.transform.join(",")})`;
28742    parameters.div.style.transform = transform;
28743    parameters.div.hidden = false;
28744  }
28745}
28746exports.XfaLayer = XfaLayer;
28747
28748/***/ }),
28749/* 33 */
28750/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
28751
28752
28753
28754Object.defineProperty(exports, "__esModule", ({
28755  value: true
28756}));
28757exports.InkEditor = void 0;
28758var _util = __w_pdfjs_require__(1);
28759var _editor = __w_pdfjs_require__(4);
28760var _annotation_layer = __w_pdfjs_require__(29);
28761var _display_utils = __w_pdfjs_require__(6);
28762var _tools = __w_pdfjs_require__(5);
28763class InkEditor extends _editor.AnnotationEditor {
28764  #baseHeight = 0;
28765  #baseWidth = 0;
28766  #boundCanvasPointermove = this.canvasPointermove.bind(this);
28767  #boundCanvasPointerleave = this.canvasPointerleave.bind(this);
28768  #boundCanvasPointerup = this.canvasPointerup.bind(this);
28769  #boundCanvasPointerdown = this.canvasPointerdown.bind(this);
28770  #currentPath2D = new Path2D();
28771  #disableEditing = false;
28772  #hasSomethingToDraw = false;
28773  #isCanvasInitialized = false;
28774  #observer = null;
28775  #realWidth = 0;
28776  #realHeight = 0;
28777  #requestFrameCallback = null;
28778  static _defaultColor = null;
28779  static _defaultOpacity = 1;
28780  static _defaultThickness = 1;
28781  static _type = "ink";
28782  constructor(params) {
28783    super({
28784      ...params,
28785      name: "inkEditor"
28786    });
28787    this.color = params.color || null;
28788    this.thickness = params.thickness || null;
28789    this.opacity = params.opacity || null;
28790    this.paths = [];
28791    this.bezierPath2D = [];
28792    this.allRawPaths = [];
28793    this.currentPath = [];
28794    this.scaleFactor = 1;
28795    this.translationX = this.translationY = 0;
28796    this.x = 0;
28797    this.y = 0;
28798    this._willKeepAspectRatio = true;
28799  }
28800  static initialize(l10n) {
28801    _editor.AnnotationEditor.initialize(l10n, {
28802      strings: ["editor_ink_canvas_aria_label", "editor_ink2_aria_label"]
28803    });
28804  }
28805  static updateDefaultParams(type, value) {
28806    switch (type) {
28807      case _util.AnnotationEditorParamsType.INK_THICKNESS:
28808        InkEditor._defaultThickness = value;
28809        break;
28810      case _util.AnnotationEditorParamsType.INK_COLOR:
28811        InkEditor._defaultColor = value;
28812        break;
28813      case _util.AnnotationEditorParamsType.INK_OPACITY:
28814        InkEditor._defaultOpacity = value / 100;
28815        break;
28816    }
28817  }
28818  updateParams(type, value) {
28819    switch (type) {
28820      case _util.AnnotationEditorParamsType.INK_THICKNESS:
28821        this.#updateThickness(value);
28822        break;
28823      case _util.AnnotationEditorParamsType.INK_COLOR:
28824        this.#updateColor(value);
28825        break;
28826      case _util.AnnotationEditorParamsType.INK_OPACITY:
28827        this.#updateOpacity(value);
28828        break;
28829    }
28830  }
28831  static get defaultPropertiesToUpdate() {
28832    return [[_util.AnnotationEditorParamsType.INK_THICKNESS, InkEditor._defaultThickness], [_util.AnnotationEditorParamsType.INK_COLOR, InkEditor._defaultColor || _editor.AnnotationEditor._defaultLineColor], [_util.AnnotationEditorParamsType.INK_OPACITY, Math.round(InkEditor._defaultOpacity * 100)]];
28833  }
28834  get propertiesToUpdate() {
28835    return [[_util.AnnotationEditorParamsType.INK_THICKNESS, this.thickness || InkEditor._defaultThickness], [_util.AnnotationEditorParamsType.INK_COLOR, this.color || InkEditor._defaultColor || _editor.AnnotationEditor._defaultLineColor], [_util.AnnotationEditorParamsType.INK_OPACITY, Math.round(100 * (this.opacity ?? InkEditor._defaultOpacity))]];
28836  }
28837  #updateThickness(thickness) {
28838    const savedThickness = this.thickness;
28839    this.addCommands({
28840      cmd: () => {
28841        this.thickness = thickness;
28842        this.#fitToContent();
28843      },
28844      undo: () => {
28845        this.thickness = savedThickness;
28846        this.#fitToContent();
28847      },
28848      mustExec: true,
28849      type: _util.AnnotationEditorParamsType.INK_THICKNESS,
28850      overwriteIfSameType: true,
28851      keepUndo: true
28852    });
28853  }
28854  #updateColor(color) {
28855    const savedColor = this.color;
28856    this.addCommands({
28857      cmd: () => {
28858        this.color = color;
28859        this.#redraw();
28860      },
28861      undo: () => {
28862        this.color = savedColor;
28863        this.#redraw();
28864      },
28865      mustExec: true,
28866      type: _util.AnnotationEditorParamsType.INK_COLOR,
28867      overwriteIfSameType: true,
28868      keepUndo: true
28869    });
28870  }
28871  #updateOpacity(opacity) {
28872    opacity /= 100;
28873    const savedOpacity = this.opacity;
28874    this.addCommands({
28875      cmd: () => {
28876        this.opacity = opacity;
28877        this.#redraw();
28878      },
28879      undo: () => {
28880        this.opacity = savedOpacity;
28881        this.#redraw();
28882      },
28883      mustExec: true,
28884      type: _util.AnnotationEditorParamsType.INK_OPACITY,
28885      overwriteIfSameType: true,
28886      keepUndo: true
28887    });
28888  }
28889  rebuild() {
28890    if (!this.parent) {
28891      return;
28892    }
28893    super.rebuild();
28894    if (this.div === null) {
28895      return;
28896    }
28897    if (!this.canvas) {
28898      this.#createCanvas();
28899      this.#createObserver();
28900    }
28901    if (!this.isAttachedToDOM) {
28902      this.parent.add(this);
28903      this.#setCanvasDims();
28904    }
28905    this.#fitToContent();
28906  }
28907  remove() {
28908    if (this.canvas === null) {
28909      return;
28910    }
28911    if (!this.isEmpty()) {
28912      this.commit();
28913    }
28914    this.canvas.width = this.canvas.height = 0;
28915    this.canvas.remove();
28916    this.canvas = null;
28917    this.#observer.disconnect();
28918    this.#observer = null;
28919    super.remove();
28920  }
28921  setParent(parent) {
28922    if (!this.parent && parent) {
28923      this._uiManager.removeShouldRescale(this);
28924    } else if (this.parent && parent === null) {
28925      this._uiManager.addShouldRescale(this);
28926    }
28927    super.setParent(parent);
28928  }
28929  onScaleChanging() {
28930    const [parentWidth, parentHeight] = this.parentDimensions;
28931    const width = this.width * parentWidth;
28932    const height = this.height * parentHeight;
28933    this.setDimensions(width, height);
28934  }
28935  enableEditMode() {
28936    if (this.#disableEditing || this.canvas === null) {
28937      return;
28938    }
28939    super.enableEditMode();
28940    this._isDraggable = false;
28941    this.canvas.addEventListener("pointerdown", this.#boundCanvasPointerdown);
28942  }
28943  disableEditMode() {
28944    if (!this.isInEditMode() || this.canvas === null) {
28945      return;
28946    }
28947    super.disableEditMode();
28948    this._isDraggable = !this.isEmpty();
28949    this.div.classList.remove("editing");
28950    this.canvas.removeEventListener("pointerdown", this.#boundCanvasPointerdown);
28951  }
28952  onceAdded() {
28953    this._isDraggable = !this.isEmpty();
28954  }
28955  isEmpty() {
28956    return this.paths.length === 0 || this.paths.length === 1 && this.paths[0].length === 0;
28957  }
28958  #getInitialBBox() {
28959    const {
28960      parentRotation,
28961      parentDimensions: [width, height]
28962    } = this;
28963    switch (parentRotation) {
28964      case 90:
28965        return [0, height, height, width];
28966      case 180:
28967        return [width, height, width, height];
28968      case 270:
28969        return [width, 0, height, width];
28970      default:
28971        return [0, 0, width, height];
28972    }
28973  }
28974  #setStroke() {
28975    const {
28976      ctx,
28977      color,
28978      opacity,
28979      thickness,
28980      parentScale,
28981      scaleFactor
28982    } = this;
28983    ctx.lineWidth = thickness * parentScale / scaleFactor;
28984    ctx.lineCap = "round";
28985    ctx.lineJoin = "round";
28986    ctx.miterLimit = 10;
28987    ctx.strokeStyle = `${color}${(0, _tools.opacityToHex)(opacity)}`;
28988  }
28989  #startDrawing(x, y) {
28990    this.canvas.addEventListener("contextmenu", _display_utils.noContextMenu);
28991    this.canvas.addEventListener("pointerleave", this.#boundCanvasPointerleave);
28992    this.canvas.addEventListener("pointermove", this.#boundCanvasPointermove);
28993    this.canvas.addEventListener("pointerup", this.#boundCanvasPointerup);
28994    this.canvas.removeEventListener("pointerdown", this.#boundCanvasPointerdown);
28995    this.isEditing = true;
28996    if (!this.#isCanvasInitialized) {
28997      this.#isCanvasInitialized = true;
28998      this.#setCanvasDims();
28999      this.thickness ||= InkEditor._defaultThickness;
29000      this.color ||= InkEditor._defaultColor || _editor.AnnotationEditor._defaultLineColor;
29001      this.opacity ??= InkEditor._defaultOpacity;
29002    }
29003    this.currentPath.push([x, y]);
29004    this.#hasSomethingToDraw = false;
29005    this.#setStroke();
29006    this.#requestFrameCallback = () => {
29007      this.#drawPoints();
29008      if (this.#requestFrameCallback) {
29009        window.requestAnimationFrame(this.#requestFrameCallback);
29010      }
29011    };
29012    window.requestAnimationFrame(this.#requestFrameCallback);
29013  }
29014  #draw(x, y) {
29015    const [lastX, lastY] = this.currentPath.at(-1);
29016    if (this.currentPath.length > 1 && x === lastX && y === lastY) {
29017      return;
29018    }
29019    const currentPath = this.currentPath;
29020    let path2D = this.#currentPath2D;
29021    currentPath.push([x, y]);
29022    this.#hasSomethingToDraw = true;
29023    if (currentPath.length <= 2) {
29024      path2D.moveTo(...currentPath[0]);
29025      path2D.lineTo(x, y);
29026      return;
29027    }
29028    if (currentPath.length === 3) {
29029      this.#currentPath2D = path2D = new Path2D();
29030      path2D.moveTo(...currentPath[0]);
29031    }
29032    this.#makeBezierCurve(path2D, ...currentPath.at(-3), ...currentPath.at(-2), x, y);
29033  }
29034  #endPath() {
29035    if (this.currentPath.length === 0) {
29036      return;
29037    }
29038    const lastPoint = this.currentPath.at(-1);
29039    this.#currentPath2D.lineTo(...lastPoint);
29040  }
29041  #stopDrawing(x, y) {
29042    this.#requestFrameCallback = null;
29043    x = Math.min(Math.max(x, 0), this.canvas.width);
29044    y = Math.min(Math.max(y, 0), this.canvas.height);
29045    this.#draw(x, y);
29046    this.#endPath();
29047    let bezier;
29048    if (this.currentPath.length !== 1) {
29049      bezier = this.#generateBezierPoints();
29050    } else {
29051      const xy = [x, y];
29052      bezier = [[xy, xy.slice(), xy.slice(), xy]];
29053    }
29054    const path2D = this.#currentPath2D;
29055    const currentPath = this.currentPath;
29056    this.currentPath = [];
29057    this.#currentPath2D = new Path2D();
29058    const cmd = () => {
29059      this.allRawPaths.push(currentPath);
29060      this.paths.push(bezier);
29061      this.bezierPath2D.push(path2D);
29062      this.rebuild();
29063    };
29064    const undo = () => {
29065      this.allRawPaths.pop();
29066      this.paths.pop();
29067      this.bezierPath2D.pop();
29068      if (this.paths.length === 0) {
29069        this.remove();
29070      } else {
29071        if (!this.canvas) {
29072          this.#createCanvas();
29073          this.#createObserver();
29074        }
29075        this.#fitToContent();
29076      }
29077    };
29078    this.addCommands({
29079      cmd,
29080      undo,
29081      mustExec: true
29082    });
29083  }
29084  #drawPoints() {
29085    if (!this.#hasSomethingToDraw) {
29086      return;
29087    }
29088    this.#hasSomethingToDraw = false;
29089    const thickness = Math.ceil(this.thickness * this.parentScale);
29090    const lastPoints = this.currentPath.slice(-3);
29091    const x = lastPoints.map(xy => xy[0]);
29092    const y = lastPoints.map(xy => xy[1]);
29093    const xMin = Math.min(...x) - thickness;
29094    const xMax = Math.max(...x) + thickness;
29095    const yMin = Math.min(...y) - thickness;
29096    const yMax = Math.max(...y) + thickness;
29097    const {
29098      ctx
29099    } = this;
29100    ctx.save();
29101    ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
29102    for (const path of this.bezierPath2D) {
29103      ctx.stroke(path);
29104    }
29105    ctx.stroke(this.#currentPath2D);
29106    ctx.restore();
29107  }
29108  #makeBezierCurve(path2D, x0, y0, x1, y1, x2, y2) {
29109    const prevX = (x0 + x1) / 2;
29110    const prevY = (y0 + y1) / 2;
29111    const x3 = (x1 + x2) / 2;
29112    const y3 = (y1 + y2) / 2;
29113    path2D.bezierCurveTo(prevX + 2 * (x1 - prevX) / 3, prevY + 2 * (y1 - prevY) / 3, x3 + 2 * (x1 - x3) / 3, y3 + 2 * (y1 - y3) / 3, x3, y3);
29114  }
29115  #generateBezierPoints() {
29116    const path = this.currentPath;
29117    if (path.length <= 2) {
29118      return [[path[0], path[0], path.at(-1), path.at(-1)]];
29119    }
29120    const bezierPoints = [];
29121    let i;
29122    let [x0, y0] = path[0];
29123    for (i = 1; i < path.length - 2; i++) {
29124      const [x1, y1] = path[i];
29125      const [x2, y2] = path[i + 1];
29126      const x3 = (x1 + x2) / 2;
29127      const y3 = (y1 + y2) / 2;
29128      const control1 = [x0 + 2 * (x1 - x0) / 3, y0 + 2 * (y1 - y0) / 3];
29129      const control2 = [x3 + 2 * (x1 - x3) / 3, y3 + 2 * (y1 - y3) / 3];
29130      bezierPoints.push([[x0, y0], control1, control2, [x3, y3]]);
29131      [x0, y0] = [x3, y3];
29132    }
29133    const [x1, y1] = path[i];
29134    const [x2, y2] = path[i + 1];
29135    const control1 = [x0 + 2 * (x1 - x0) / 3, y0 + 2 * (y1 - y0) / 3];
29136    const control2 = [x2 + 2 * (x1 - x2) / 3, y2 + 2 * (y1 - y2) / 3];
29137    bezierPoints.push([[x0, y0], control1, control2, [x2, y2]]);
29138    return bezierPoints;
29139  }
29140  #redraw() {
29141    if (this.isEmpty()) {
29142      this.#updateTransform();
29143      return;
29144    }
29145    this.#setStroke();
29146    const {
29147      canvas,
29148      ctx
29149    } = this;
29150    ctx.setTransform(1, 0, 0, 1, 0, 0);
29151    ctx.clearRect(0, 0, canvas.width, canvas.height);
29152    this.#updateTransform();
29153    for (const path of this.bezierPath2D) {
29154      ctx.stroke(path);
29155    }
29156  }
29157  commit() {
29158    if (this.#disableEditing) {
29159      return;
29160    }
29161    super.commit();
29162    this.isEditing = false;
29163    this.disableEditMode();
29164    this.setInForeground();
29165    this.#disableEditing = true;
29166    this.div.classList.add("disabled");
29167    this.#fitToContent(true);
29168    this.makeResizable();
29169    this.parent.addInkEditorIfNeeded(true);
29170    this.moveInDOM();
29171    this.div.focus({
29172      preventScroll: true
29173    });
29174  }
29175  focusin(event) {
29176    if (!this._focusEventsAllowed) {
29177      return;
29178    }
29179    super.focusin(event);
29180    this.enableEditMode();
29181  }
29182  canvasPointerdown(event) {
29183    if (event.button !== 0 || !this.isInEditMode() || this.#disableEditing) {
29184      return;
29185    }
29186    this.setInForeground();
29187    event.preventDefault();
29188    if (event.type !== "mouse") {
29189      this.div.focus();
29190    }
29191    this.#startDrawing(event.offsetX, event.offsetY);
29192  }
29193  canvasPointermove(event) {
29194    event.preventDefault();
29195    this.#draw(event.offsetX, event.offsetY);
29196  }
29197  canvasPointerup(event) {
29198    event.preventDefault();
29199    this.#endDrawing(event);
29200  }
29201  canvasPointerleave(event) {
29202    this.#endDrawing(event);
29203  }
29204  #endDrawing(event) {
29205    this.canvas.removeEventListener("pointerleave", this.#boundCanvasPointerleave);
29206    this.canvas.removeEventListener("pointermove", this.#boundCanvasPointermove);
29207    this.canvas.removeEventListener("pointerup", this.#boundCanvasPointerup);
29208    this.canvas.addEventListener("pointerdown", this.#boundCanvasPointerdown);
29209    setTimeout(() => {
29210      this.canvas.removeEventListener("contextmenu", _display_utils.noContextMenu);
29211    }, 10);
29212    this.#stopDrawing(event.offsetX, event.offsetY);
29213    this.addToAnnotationStorage();
29214    this.setInBackground();
29215  }
29216  #createCanvas() {
29217    this.canvas = document.createElement("canvas");
29218    this.canvas.width = this.canvas.height = 0;
29219    this.canvas.className = "inkEditorCanvas";
29220    _editor.AnnotationEditor._l10nPromise.get("editor_ink_canvas_aria_label").then(msg => this.canvas?.setAttribute("aria-label", msg));
29221    this.div.append(this.canvas);
29222    this.ctx = this.canvas.getContext("2d");
29223  }
29224  #createObserver() {
29225    this.#observer = new ResizeObserver(entries => {
29226      const rect = entries[0].contentRect;
29227      if (rect.width && rect.height) {
29228        this.setDimensions(rect.width, rect.height);
29229      }
29230    });
29231    this.#observer.observe(this.div);
29232  }
29233  get isResizable() {
29234    return !this.isEmpty() && this.#disableEditing;
29235  }
29236  render() {
29237    if (this.div) {
29238      return this.div;
29239    }
29240    let baseX, baseY;
29241    if (this.width) {
29242      baseX = this.x;
29243      baseY = this.y;
29244    }
29245    super.render();
29246    _editor.AnnotationEditor._l10nPromise.get("editor_ink2_aria_label").then(msg => this.div?.setAttribute("aria-label", msg));
29247    const [x, y, w, h] = this.#getInitialBBox();
29248    this.setAt(x, y, 0, 0);
29249    this.setDims(w, h);
29250    this.#createCanvas();
29251    if (this.width) {
29252      const [parentWidth, parentHeight] = this.parentDimensions;
29253      this.setAspectRatio(this.width * parentWidth, this.height * parentHeight);
29254      this.setAt(baseX * parentWidth, baseY * parentHeight, this.width * parentWidth, this.height * parentHeight);
29255      this.#isCanvasInitialized = true;
29256      this.#setCanvasDims();
29257      this.setDims(this.width * parentWidth, this.height * parentHeight);
29258      this.#redraw();
29259      this.div.classList.add("disabled");
29260    } else {
29261      this.div.classList.add("editing");
29262      this.enableEditMode();
29263    }
29264    this.#createObserver();
29265    return this.div;
29266  }
29267  #setCanvasDims() {
29268    if (!this.#isCanvasInitialized) {
29269      return;
29270    }
29271    const [parentWidth, parentHeight] = this.parentDimensions;
29272    this.canvas.width = Math.ceil(this.width * parentWidth);
29273    this.canvas.height = Math.ceil(this.height * parentHeight);
29274    this.#updateTransform();
29275  }
29276  setDimensions(width, height) {
29277    const roundedWidth = Math.round(width);
29278    const roundedHeight = Math.round(height);
29279    if (this.#realWidth === roundedWidth && this.#realHeight === roundedHeight) {
29280      return;
29281    }
29282    this.#realWidth = roundedWidth;
29283    this.#realHeight = roundedHeight;
29284    this.canvas.style.visibility = "hidden";
29285    const [parentWidth, parentHeight] = this.parentDimensions;
29286    this.width = width / parentWidth;
29287    this.height = height / parentHeight;
29288    this.fixAndSetPosition();
29289    if (this.#disableEditing) {
29290      this.#setScaleFactor(width, height);
29291    }
29292    this.#setCanvasDims();
29293    this.#redraw();
29294    this.canvas.style.visibility = "visible";
29295    this.fixDims();
29296  }
29297  #setScaleFactor(width, height) {
29298    const padding = this.#getPadding();
29299    const scaleFactorW = (width - padding) / this.#baseWidth;
29300    const scaleFactorH = (height - padding) / this.#baseHeight;
29301    this.scaleFactor = Math.min(scaleFactorW, scaleFactorH);
29302  }
29303  #updateTransform() {
29304    const padding = this.#getPadding() / 2;
29305    this.ctx.setTransform(this.scaleFactor, 0, 0, this.scaleFactor, this.translationX * this.scaleFactor + padding, this.translationY * this.scaleFactor + padding);
29306  }
29307  static #buildPath2D(bezier) {
29308    const path2D = new Path2D();
29309    for (let i = 0, ii = bezier.length; i < ii; i++) {
29310      const [first, control1, control2, second] = bezier[i];
29311      if (i === 0) {
29312        path2D.moveTo(...first);
29313      }
29314      path2D.bezierCurveTo(control1[0], control1[1], control2[0], control2[1], second[0], second[1]);
29315    }
29316    return path2D;
29317  }
29318  static #toPDFCoordinates(points, rect, rotation) {
29319    const [blX, blY, trX, trY] = rect;
29320    switch (rotation) {
29321      case 0:
29322        for (let i = 0, ii = points.length; i < ii; i += 2) {
29323          points[i] += blX;
29324          points[i + 1] = trY - points[i + 1];
29325        }
29326        break;
29327      case 90:
29328        for (let i = 0, ii = points.length; i < ii; i += 2) {
29329          const x = points[i];
29330          points[i] = points[i + 1] + blX;
29331          points[i + 1] = x + blY;
29332        }
29333        break;
29334      case 180:
29335        for (let i = 0, ii = points.length; i < ii; i += 2) {
29336          points[i] = trX - points[i];
29337          points[i + 1] += blY;
29338        }
29339        break;
29340      case 270:
29341        for (let i = 0, ii = points.length; i < ii; i += 2) {
29342          const x = points[i];
29343          points[i] = trX - points[i + 1];
29344          points[i + 1] = trY - x;
29345        }
29346        break;
29347      default:
29348        throw new Error("Invalid rotation");
29349    }
29350    return points;
29351  }
29352  static #fromPDFCoordinates(points, rect, rotation) {
29353    const [blX, blY, trX, trY] = rect;
29354    switch (rotation) {
29355      case 0:
29356        for (let i = 0, ii = points.length; i < ii; i += 2) {
29357          points[i] -= blX;
29358          points[i + 1] = trY - points[i + 1];
29359        }
29360        break;
29361      case 90:
29362        for (let i = 0, ii = points.length; i < ii; i += 2) {
29363          const x = points[i];
29364          points[i] = points[i + 1] - blY;
29365          points[i + 1] = x - blX;
29366        }
29367        break;
29368      case 180:
29369        for (let i = 0, ii = points.length; i < ii; i += 2) {
29370          points[i] = trX - points[i];
29371          points[i + 1] -= blY;
29372        }
29373        break;
29374      case 270:
29375        for (let i = 0, ii = points.length; i < ii; i += 2) {
29376          const x = points[i];
29377          points[i] = trY - points[i + 1];
29378          points[i + 1] = trX - x;
29379        }
29380        break;
29381      default:
29382        throw new Error("Invalid rotation");
29383    }
29384    return points;
29385  }
29386  #serializePaths(s, tx, ty, rect) {
29387    const paths = [];
29388    const padding = this.thickness / 2;
29389    const shiftX = s * tx + padding;
29390    const shiftY = s * ty + padding;
29391    for (const bezier of this.paths) {
29392      const buffer = [];
29393      const points = [];
29394      for (let j = 0, jj = bezier.length; j < jj; j++) {
29395        const [first, control1, control2, second] = bezier[j];
29396        const p10 = s * first[0] + shiftX;
29397        const p11 = s * first[1] + shiftY;
29398        const p20 = s * control1[0] + shiftX;
29399        const p21 = s * control1[1] + shiftY;
29400        const p30 = s * control2[0] + shiftX;
29401        const p31 = s * control2[1] + shiftY;
29402        const p40 = s * second[0] + shiftX;
29403        const p41 = s * second[1] + shiftY;
29404        if (j === 0) {
29405          buffer.push(p10, p11);
29406          points.push(p10, p11);
29407        }
29408        buffer.push(p20, p21, p30, p31, p40, p41);
29409        points.push(p20, p21);
29410        if (j === jj - 1) {
29411          points.push(p40, p41);
29412        }
29413      }
29414      paths.push({
29415        bezier: InkEditor.#toPDFCoordinates(buffer, rect, this.rotation),
29416        points: InkEditor.#toPDFCoordinates(points, rect, this.rotation)
29417      });
29418    }
29419    return paths;
29420  }
29421  #getBbox() {
29422    let xMin = Infinity;
29423    let xMax = -Infinity;
29424    let yMin = Infinity;
29425    let yMax = -Infinity;
29426    for (const path of this.paths) {
29427      for (const [first, control1, control2, second] of path) {
29428        const bbox = _util.Util.bezierBoundingBox(...first, ...control1, ...control2, ...second);
29429        xMin = Math.min(xMin, bbox[0]);
29430        yMin = Math.min(yMin, bbox[1]);
29431        xMax = Math.max(xMax, bbox[2]);
29432        yMax = Math.max(yMax, bbox[3]);
29433      }
29434    }
29435    return [xMin, yMin, xMax, yMax];
29436  }
29437  #getPadding() {
29438    return this.#disableEditing ? Math.ceil(this.thickness * this.parentScale) : 0;
29439  }
29440  #fitToContent(firstTime = false) {
29441    if (this.isEmpty()) {
29442      return;
29443    }
29444    if (!this.#disableEditing) {
29445      this.#redraw();
29446      return;
29447    }
29448    const bbox = this.#getBbox();
29449    const padding = this.#getPadding();
29450    this.#baseWidth = Math.max(_editor.AnnotationEditor.MIN_SIZE, bbox[2] - bbox[0]);
29451    this.#baseHeight = Math.max(_editor.AnnotationEditor.MIN_SIZE, bbox[3] - bbox[1]);
29452    const width = Math.ceil(padding + this.#baseWidth * this.scaleFactor);
29453    const height = Math.ceil(padding + this.#baseHeight * this.scaleFactor);
29454    const [parentWidth, parentHeight] = this.parentDimensions;
29455    this.width = width / parentWidth;
29456    this.height = height / parentHeight;
29457    this.setAspectRatio(width, height);
29458    const prevTranslationX = this.translationX;
29459    const prevTranslationY = this.translationY;
29460    this.translationX = -bbox[0];
29461    this.translationY = -bbox[1];
29462    this.#setCanvasDims();
29463    this.#redraw();
29464    this.#realWidth = width;
29465    this.#realHeight = height;
29466    this.setDims(width, height);
29467    const unscaledPadding = firstTime ? padding / this.scaleFactor / 2 : 0;
29468    this.translate(prevTranslationX - this.translationX - unscaledPadding, prevTranslationY - this.translationY - unscaledPadding);
29469  }
29470  static deserialize(data, parent, uiManager) {
29471    if (data instanceof _annotation_layer.InkAnnotationElement) {
29472      return null;
29473    }
29474    const editor = super.deserialize(data, parent, uiManager);
29475    editor.thickness = data.thickness;
29476    editor.color = _util.Util.makeHexColor(...data.color);
29477    editor.opacity = data.opacity;
29478    const [pageWidth, pageHeight] = editor.pageDimensions;
29479    const width = editor.width * pageWidth;
29480    const height = editor.height * pageHeight;
29481    const scaleFactor = editor.parentScale;
29482    const padding = data.thickness / 2;
29483    editor.#disableEditing = true;
29484    editor.#realWidth = Math.round(width);
29485    editor.#realHeight = Math.round(height);
29486    const {
29487      paths,
29488      rect,
29489      rotation
29490    } = data;
29491    for (let {
29492      bezier
29493    } of paths) {
29494      bezier = InkEditor.#fromPDFCoordinates(bezier, rect, rotation);
29495      const path = [];
29496      editor.paths.push(path);
29497      let p0 = scaleFactor * (bezier[0] - padding);
29498      let p1 = scaleFactor * (bezier[1] - padding);
29499      for (let i = 2, ii = bezier.length; i < ii; i += 6) {
29500        const p10 = scaleFactor * (bezier[i] - padding);
29501        const p11 = scaleFactor * (bezier[i + 1] - padding);
29502        const p20 = scaleFactor * (bezier[i + 2] - padding);
29503        const p21 = scaleFactor * (bezier[i + 3] - padding);
29504        const p30 = scaleFactor * (bezier[i + 4] - padding);
29505        const p31 = scaleFactor * (bezier[i + 5] - padding);
29506        path.push([[p0, p1], [p10, p11], [p20, p21], [p30, p31]]);
29507        p0 = p30;
29508        p1 = p31;
29509      }
29510      const path2D = this.#buildPath2D(path);
29511      editor.bezierPath2D.push(path2D);
29512    }
29513    const bbox = editor.#getBbox();
29514    editor.#baseWidth = Math.max(_editor.AnnotationEditor.MIN_SIZE, bbox[2] - bbox[0]);
29515    editor.#baseHeight = Math.max(_editor.AnnotationEditor.MIN_SIZE, bbox[3] - bbox[1]);
29516    editor.#setScaleFactor(width, height);
29517    return editor;
29518  }
29519  serialize() {
29520    if (this.isEmpty()) {
29521      return null;
29522    }
29523    const rect = this.getRect(0, 0);
29524    const color = _editor.AnnotationEditor._colorManager.convert(this.ctx.strokeStyle);
29525    return {
29526      annotationType: _util.AnnotationEditorType.INK,
29527      color,
29528      thickness: this.thickness,
29529      opacity: this.opacity,
29530      paths: this.#serializePaths(this.scaleFactor / this.parentScale, this.translationX, this.translationY, rect),
29531      pageIndex: this.pageIndex,
29532      rect,
29533      rotation: this.rotation,
29534      structTreeParentId: this._structTreeParentId
29535    };
29536  }
29537}
29538exports.InkEditor = InkEditor;
29539
29540/***/ }),
29541/* 34 */
29542/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
29543
29544
29545
29546Object.defineProperty(exports, "__esModule", ({
29547  value: true
29548}));
29549exports.StampEditor = void 0;
29550var _util = __w_pdfjs_require__(1);
29551var _editor = __w_pdfjs_require__(4);
29552var _display_utils = __w_pdfjs_require__(6);
29553var _annotation_layer = __w_pdfjs_require__(29);
29554class StampEditor extends _editor.AnnotationEditor {
29555  #bitmap = null;
29556  #bitmapId = null;
29557  #bitmapPromise = null;
29558  #bitmapUrl = null;
29559  #bitmapFile = null;
29560  #canvas = null;
29561  #observer = null;
29562  #resizeTimeoutId = null;
29563  #isSvg = false;
29564  #hasBeenAddedInUndoStack = false;
29565  static _type = "stamp";
29566  constructor(params) {
29567    super({
29568      ...params,
29569      name: "stampEditor"
29570    });
29571    this.#bitmapUrl = params.bitmapUrl;
29572    this.#bitmapFile = params.bitmapFile;
29573  }
29574  static initialize(l10n) {
29575    _editor.AnnotationEditor.initialize(l10n);
29576  }
29577  static get supportedTypes() {
29578    const types = ["apng", "avif", "bmp", "gif", "jpeg", "png", "svg+xml", "webp", "x-icon"];
29579    return (0, _util.shadow)(this, "supportedTypes", types.map(type => `image/${type}`));
29580  }
29581  static get supportedTypesStr() {
29582    return (0, _util.shadow)(this, "supportedTypesStr", this.supportedTypes.join(","));
29583  }
29584  static isHandlingMimeForPasting(mime) {
29585    return this.supportedTypes.includes(mime);
29586  }
29587  static paste(item, parent) {
29588    parent.pasteEditor(_util.AnnotationEditorType.STAMP, {
29589      bitmapFile: item.getAsFile()
29590    });
29591  }
29592  #getBitmapFetched(data, fromId = false) {
29593    if (!data) {
29594      this.remove();
29595      return;
29596    }
29597    this.#bitmap = data.bitmap;
29598    if (!fromId) {
29599      this.#bitmapId = data.id;
29600      this.#isSvg = data.isSvg;
29601    }
29602    this.#createCanvas();
29603  }
29604  #getBitmapDone() {
29605    this.#bitmapPromise = null;
29606    this._uiManager.enableWaiting(false);
29607    if (this.#canvas) {
29608      this.div.focus();
29609    }
29610  }
29611  #getBitmap() {
29612    if (this.#bitmapId) {
29613      this._uiManager.enableWaiting(true);
29614      this._uiManager.imageManager.getFromId(this.#bitmapId).then(data => this.#getBitmapFetched(data, true)).finally(() => this.#getBitmapDone());
29615      return;
29616    }
29617    if (this.#bitmapUrl) {
29618      const url = this.#bitmapUrl;
29619      this.#bitmapUrl = null;
29620      this._uiManager.enableWaiting(true);
29621      this.#bitmapPromise = this._uiManager.imageManager.getFromUrl(url).then(data => this.#getBitmapFetched(data)).finally(() => this.#getBitmapDone());
29622      return;
29623    }
29624    if (this.#bitmapFile) {
29625      const file = this.#bitmapFile;
29626      this.#bitmapFile = null;
29627      this._uiManager.enableWaiting(true);
29628      this.#bitmapPromise = this._uiManager.imageManager.getFromFile(file).then(data => this.#getBitmapFetched(data)).finally(() => this.#getBitmapDone());
29629      return;
29630    }
29631    const input = document.createElement("input");
29632    input.type = "file";
29633    input.accept = StampEditor.supportedTypesStr;
29634    this.#bitmapPromise = new Promise(resolve => {
29635      input.addEventListener("change", async () => {
29636        if (!input.files || input.files.length === 0) {
29637          this.remove();
29638        } else {
29639          this._uiManager.enableWaiting(true);
29640          const data = await this._uiManager.imageManager.getFromFile(input.files[0]);
29641          this.#getBitmapFetched(data);
29642        }
29643        resolve();
29644      });
29645      input.addEventListener("cancel", () => {
29646        this.remove();
29647        resolve();
29648      });
29649    }).finally(() => this.#getBitmapDone());
29650    input.click();
29651  }
29652  remove() {
29653    if (this.#bitmapId) {
29654      this.#bitmap = null;
29655      this._uiManager.imageManager.deleteId(this.#bitmapId);
29656      this.#canvas?.remove();
29657      this.#canvas = null;
29658      this.#observer?.disconnect();
29659      this.#observer = null;
29660    }
29661    super.remove();
29662  }
29663  rebuild() {
29664    if (!this.parent) {
29665      if (this.#bitmapId) {
29666        this.#getBitmap();
29667      }
29668      return;
29669    }
29670    super.rebuild();
29671    if (this.div === null) {
29672      return;
29673    }
29674    if (this.#bitmapId) {
29675      this.#getBitmap();
29676    }
29677    if (!this.isAttachedToDOM) {
29678      this.parent.add(this);
29679    }
29680  }
29681  onceAdded() {
29682    this._isDraggable = true;
29683    this.div.focus();
29684  }
29685  isEmpty() {
29686    return !(this.#bitmapPromise || this.#bitmap || this.#bitmapUrl || this.#bitmapFile);
29687  }
29688  get isResizable() {
29689    return true;
29690  }
29691  render() {
29692    if (this.div) {
29693      return this.div;
29694    }
29695    let baseX, baseY;
29696    if (this.width) {
29697      baseX = this.x;
29698      baseY = this.y;
29699    }
29700    super.render();
29701    this.div.hidden = true;
29702    if (this.#bitmap) {
29703      this.#createCanvas();
29704    } else {
29705      this.#getBitmap();
29706    }
29707    if (this.width) {
29708      const [parentWidth, parentHeight] = this.parentDimensions;
29709      this.setAt(baseX * parentWidth, baseY * parentHeight, this.width * parentWidth, this.height * parentHeight);
29710    }
29711    return this.div;
29712  }
29713  #createCanvas() {
29714    const {
29715      div
29716    } = this;
29717    let {
29718      width,
29719      height
29720    } = this.#bitmap;
29721    const [pageWidth, pageHeight] = this.pageDimensions;
29722    const MAX_RATIO = 0.75;
29723    if (this.width) {
29724      width = this.width * pageWidth;
29725      height = this.height * pageHeight;
29726    } else if (width > MAX_RATIO * pageWidth || height > MAX_RATIO * pageHeight) {
29727      const factor = Math.min(MAX_RATIO * pageWidth / width, MAX_RATIO * pageHeight / height);
29728      width *= factor;
29729      height *= factor;
29730    }
29731    const [parentWidth, parentHeight] = this.parentDimensions;
29732    this.setDims(width * parentWidth / pageWidth, height * parentHeight / pageHeight);
29733    this._uiManager.enableWaiting(false);
29734    const canvas = this.#canvas = document.createElement("canvas");
29735    div.append(canvas);
29736    div.hidden = false;
29737    this.#drawBitmap(width, height);
29738    this.#createObserver();
29739    if (!this.#hasBeenAddedInUndoStack) {
29740      this.parent.addUndoableEditor(this);
29741      this.#hasBeenAddedInUndoStack = true;
29742    }
29743    this._uiManager._eventBus.dispatch("reporttelemetry", {
29744      source: this,
29745      details: {
29746        type: "editing",
29747        subtype: this.editorType,
29748        data: {
29749          action: "inserted_image"
29750        }
29751      }
29752    });
29753    this.addAltTextButton();
29754  }
29755  #setDimensions(width, height) {
29756    const [parentWidth, parentHeight] = this.parentDimensions;
29757    this.width = width / parentWidth;
29758    this.height = height / parentHeight;
29759    this.setDims(width, height);
29760    if (this._initialOptions?.isCentered) {
29761      this.center();
29762    } else {
29763      this.fixAndSetPosition();
29764    }
29765    this._initialOptions = null;
29766    if (this.#resizeTimeoutId !== null) {
29767      clearTimeout(this.#resizeTimeoutId);
29768    }
29769    const TIME_TO_WAIT = 200;
29770    this.#resizeTimeoutId = setTimeout(() => {
29771      this.#resizeTimeoutId = null;
29772      this.#drawBitmap(width, height);
29773    }, TIME_TO_WAIT);
29774  }
29775  #scaleBitmap(width, height) {
29776    const {
29777      width: bitmapWidth,
29778      height: bitmapHeight
29779    } = this.#bitmap;
29780    let newWidth = bitmapWidth;
29781    let newHeight = bitmapHeight;
29782    let bitmap = this.#bitmap;
29783    while (newWidth > 2 * width || newHeight > 2 * height) {
29784      const prevWidth = newWidth;
29785      const prevHeight = newHeight;
29786      if (newWidth > 2 * width) {
29787        newWidth = newWidth >= 16384 ? Math.floor(newWidth / 2) - 1 : Math.ceil(newWidth / 2);
29788      }
29789      if (newHeight > 2 * height) {
29790        newHeight = newHeight >= 16384 ? Math.floor(newHeight / 2) - 1 : Math.ceil(newHeight / 2);
29791      }
29792      const offscreen = new OffscreenCanvas(newWidth, newHeight);
29793      const ctx = offscreen.getContext("2d");
29794      ctx.drawImage(bitmap, 0, 0, prevWidth, prevHeight, 0, 0, newWidth, newHeight);
29795      bitmap = offscreen.transferToImageBitmap();
29796    }
29797    return bitmap;
29798  }
29799  #drawBitmap(width, height) {
29800    width = Math.ceil(width);
29801    height = Math.ceil(height);
29802    const canvas = this.#canvas;
29803    if (!canvas || canvas.width === width && canvas.height === height) {
29804      return;
29805    }
29806    canvas.width = width;
29807    canvas.height = height;
29808    const bitmap = this.#isSvg ? this.#bitmap : this.#scaleBitmap(width, height);
29809    const ctx = canvas.getContext("2d");
29810    ctx.filter = this._uiManager.hcmFilter;
29811    ctx.drawImage(bitmap, 0, 0, bitmap.width, bitmap.height, 0, 0, width, height);
29812  }
29813  #serializeBitmap(toUrl) {
29814    if (toUrl) {
29815      if (this.#isSvg) {
29816        const url = this._uiManager.imageManager.getSvgUrl(this.#bitmapId);
29817        if (url) {
29818          return url;
29819        }
29820      }
29821      const canvas = document.createElement("canvas");
29822      ({
29823        width: canvas.width,
29824        height: canvas.height
29825      } = this.#bitmap);
29826      const ctx = canvas.getContext("2d");
29827      ctx.drawImage(this.#bitmap, 0, 0);
29828      return canvas.toDataURL();
29829    }
29830    if (this.#isSvg) {
29831      const [pageWidth, pageHeight] = this.pageDimensions;
29832      const width = Math.round(this.width * pageWidth * _display_utils.PixelsPerInch.PDF_TO_CSS_UNITS);
29833      const height = Math.round(this.height * pageHeight * _display_utils.PixelsPerInch.PDF_TO_CSS_UNITS);
29834      const offscreen = new OffscreenCanvas(width, height);
29835      const ctx = offscreen.getContext("2d");
29836      ctx.drawImage(this.#bitmap, 0, 0, this.#bitmap.width, this.#bitmap.height, 0, 0, width, height);
29837      return offscreen.transferToImageBitmap();
29838    }
29839    return structuredClone(this.#bitmap);
29840  }
29841  #createObserver() {
29842    this.#observer = new ResizeObserver(entries => {
29843      const rect = entries[0].contentRect;
29844      if (rect.width && rect.height) {
29845        this.#setDimensions(rect.width, rect.height);
29846      }
29847    });
29848    this.#observer.observe(this.div);
29849  }
29850  static deserialize(data, parent, uiManager) {
29851    if (data instanceof _annotation_layer.StampAnnotationElement) {
29852      return null;
29853    }
29854    const editor = super.deserialize(data, parent, uiManager);
29855    const {
29856      rect,
29857      bitmapUrl,
29858      bitmapId,
29859      isSvg,
29860      accessibilityData
29861    } = data;
29862    if (bitmapId && uiManager.imageManager.isValidId(bitmapId)) {
29863      editor.#bitmapId = bitmapId;
29864    } else {
29865      editor.#bitmapUrl = bitmapUrl;
29866    }
29867    editor.#isSvg = isSvg;
29868    const [parentWidth, parentHeight] = editor.pageDimensions;
29869    editor.width = (rect[2] - rect[0]) / parentWidth;
29870    editor.height = (rect[3] - rect[1]) / parentHeight;
29871    if (accessibilityData) {
29872      editor.altTextData = accessibilityData;
29873    }
29874    return editor;
29875  }
29876  serialize(isForCopying = false, context = null) {
29877    if (this.isEmpty()) {
29878      return null;
29879    }
29880    const serialized = {
29881      annotationType: _util.AnnotationEditorType.STAMP,
29882      bitmapId: this.#bitmapId,
29883      pageIndex: this.pageIndex,
29884      rect: this.getRect(0, 0),
29885      rotation: this.rotation,
29886      isSvg: this.#isSvg,
29887      structTreeParentId: this._structTreeParentId
29888    };
29889    if (isForCopying) {
29890      serialized.bitmapUrl = this.#serializeBitmap(true);
29891      serialized.accessibilityData = this.altTextData;
29892      return serialized;
29893    }
29894    const {
29895      decorative,
29896      altText
29897    } = this.altTextData;
29898    if (!decorative && altText) {
29899      serialized.accessibilityData = {
29900        type: "Figure",
29901        alt: altText
29902      };
29903    }
29904    if (context === null) {
29905      return serialized;
29906    }
29907    context.stamps ||= new Map();
29908    const area = this.#isSvg ? (serialized.rect[2] - serialized.rect[0]) * (serialized.rect[3] - serialized.rect[1]) : null;
29909    if (!context.stamps.has(this.#bitmapId)) {
29910      context.stamps.set(this.#bitmapId, {
29911        area,
29912        serialized
29913      });
29914      serialized.bitmap = this.#serializeBitmap(false);
29915    } else if (this.#isSvg) {
29916      const prevData = context.stamps.get(this.#bitmapId);
29917      if (area > prevData.area) {
29918        prevData.area = area;
29919        prevData.serialized.bitmap.close();
29920        prevData.serialized.bitmap = this.#serializeBitmap(false);
29921      }
29922    }
29923    return serialized;
29924  }
29925}
29926exports.StampEditor = StampEditor;
29927
29928/***/ })
29929/******/ 	]);
29930/************************************************************************/
29931/******/ 	// The module cache
29932/******/ 	var __webpack_module_cache__ = {};
29933/******/ 	
29934/******/ 	// The require function
29935/******/ 	function __w_pdfjs_require__(moduleId) {
29936/******/ 		// Check if module is in cache
29937/******/ 		var cachedModule = __webpack_module_cache__[moduleId];
29938/******/ 		if (cachedModule !== undefined) {
29939/******/ 			return cachedModule.exports;
29940/******/ 		}
29941/******/ 		// Create a new module (and put it into the cache)
29942/******/ 		var module = __webpack_module_cache__[moduleId] = {
29943/******/ 			// no module.id needed
29944/******/ 			// no module.loaded needed
29945/******/ 			exports: {}
29946/******/ 		};
29947/******/ 	
29948/******/ 		// Execute the module function
29949/******/ 		__webpack_modules__[moduleId](module, module.exports, __w_pdfjs_require__);
29950/******/ 	
29951/******/ 		// Return the exports of the module
29952/******/ 		return module.exports;
29953/******/ 	}
29954/******/ 	
29955/************************************************************************/
29956var __nested_webpack_exports__ = {};
29957// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
29958(() => {
29959var exports = __nested_webpack_exports__;
29960
29961
29962Object.defineProperty(exports, "__esModule", ({
29963  value: true
29964}));
29965Object.defineProperty(exports, "AbortException", ({
29966  enumerable: true,
29967  get: function () {
29968    return _util.AbortException;
29969  }
29970}));
29971Object.defineProperty(exports, "AnnotationEditorLayer", ({
29972  enumerable: true,
29973  get: function () {
29974    return _annotation_editor_layer.AnnotationEditorLayer;
29975  }
29976}));
29977Object.defineProperty(exports, "AnnotationEditorParamsType", ({
29978  enumerable: true,
29979  get: function () {
29980    return _util.AnnotationEditorParamsType;
29981  }
29982}));
29983Object.defineProperty(exports, "AnnotationEditorType", ({
29984  enumerable: true,
29985  get: function () {
29986    return _util.AnnotationEditorType;
29987  }
29988}));
29989Object.defineProperty(exports, "AnnotationEditorUIManager", ({
29990  enumerable: true,
29991  get: function () {
29992    return _tools.AnnotationEditorUIManager;
29993  }
29994}));
29995Object.defineProperty(exports, "AnnotationLayer", ({
29996  enumerable: true,
29997  get: function () {
29998    return _annotation_layer.AnnotationLayer;
29999  }
30000}));
30001Object.defineProperty(exports, "AnnotationMode", ({
30002  enumerable: true,
30003  get: function () {
30004    return _util.AnnotationMode;
30005  }
30006}));
30007Object.defineProperty(exports, "CMapCompressionType", ({
30008  enumerable: true,
30009  get: function () {
30010    return _util.CMapCompressionType;
30011  }
30012}));
30013Object.defineProperty(exports, "DOMSVGFactory", ({
30014  enumerable: true,
30015  get: function () {
30016    return _display_utils.DOMSVGFactory;
30017  }
30018}));
30019Object.defineProperty(exports, "FeatureTest", ({
30020  enumerable: true,
30021  get: function () {
30022    return _util.FeatureTest;
30023  }
30024}));
30025Object.defineProperty(exports, "GlobalWorkerOptions", ({
30026  enumerable: true,
30027  get: function () {
30028    return _worker_options.GlobalWorkerOptions;
30029  }
30030}));
30031Object.defineProperty(exports, "ImageKind", ({
30032  enumerable: true,
30033  get: function () {
30034    return _util.ImageKind;
30035  }
30036}));
30037Object.defineProperty(exports, "InvalidPDFException", ({
30038  enumerable: true,
30039  get: function () {
30040    return _util.InvalidPDFException;
30041  }
30042}));
30043Object.defineProperty(exports, "MissingPDFException", ({
30044  enumerable: true,
30045  get: function () {
30046    return _util.MissingPDFException;
30047  }
30048}));
30049Object.defineProperty(exports, "OPS", ({
30050  enumerable: true,
30051  get: function () {
30052    return _util.OPS;
30053  }
30054}));
30055Object.defineProperty(exports, "PDFDataRangeTransport", ({
30056  enumerable: true,
30057  get: function () {
30058    return _api.PDFDataRangeTransport;
30059  }
30060}));
30061Object.defineProperty(exports, "PDFDateString", ({
30062  enumerable: true,
30063  get: function () {
30064    return _display_utils.PDFDateString;
30065  }
30066}));
30067Object.defineProperty(exports, "PDFWorker", ({
30068  enumerable: true,
30069  get: function () {
30070    return _api.PDFWorker;
30071  }
30072}));
30073Object.defineProperty(exports, "PasswordResponses", ({
30074  enumerable: true,
30075  get: function () {
30076    return _util.PasswordResponses;
30077  }
30078}));
30079Object.defineProperty(exports, "PermissionFlag", ({
30080  enumerable: true,
30081  get: function () {
30082    return _util.PermissionFlag;
30083  }
30084}));
30085Object.defineProperty(exports, "PixelsPerInch", ({
30086  enumerable: true,
30087  get: function () {
30088    return _display_utils.PixelsPerInch;
30089  }
30090}));
30091Object.defineProperty(exports, "PromiseCapability", ({
30092  enumerable: true,
30093  get: function () {
30094    return _util.PromiseCapability;
30095  }
30096}));
30097Object.defineProperty(exports, "RenderingCancelledException", ({
30098  enumerable: true,
30099  get: function () {
30100    return _display_utils.RenderingCancelledException;
30101  }
30102}));
30103Object.defineProperty(exports, "SVGGraphics", ({
30104  enumerable: true,
30105  get: function () {
30106    return _api.SVGGraphics;
30107  }
30108}));
30109Object.defineProperty(exports, "UnexpectedResponseException", ({
30110  enumerable: true,
30111  get: function () {
30112    return _util.UnexpectedResponseException;
30113  }
30114}));
30115Object.defineProperty(exports, "Util", ({
30116  enumerable: true,
30117  get: function () {
30118    return _util.Util;
30119  }
30120}));
30121Object.defineProperty(exports, "VerbosityLevel", ({
30122  enumerable: true,
30123  get: function () {
30124    return _util.VerbosityLevel;
30125  }
30126}));
30127Object.defineProperty(exports, "XfaLayer", ({
30128  enumerable: true,
30129  get: function () {
30130    return _xfa_layer.XfaLayer;
30131  }
30132}));
30133Object.defineProperty(exports, "build", ({
30134  enumerable: true,
30135  get: function () {
30136    return _api.build;
30137  }
30138}));
30139Object.defineProperty(exports, "createValidAbsoluteUrl", ({
30140  enumerable: true,
30141  get: function () {
30142    return _util.createValidAbsoluteUrl;
30143  }
30144}));
30145Object.defineProperty(exports, "getDocument", ({
30146  enumerable: true,
30147  get: function () {
30148    return _api.getDocument;
30149  }
30150}));
30151Object.defineProperty(exports, "getFilenameFromUrl", ({
30152  enumerable: true,
30153  get: function () {
30154    return _display_utils.getFilenameFromUrl;
30155  }
30156}));
30157Object.defineProperty(exports, "getPdfFilenameFromUrl", ({
30158  enumerable: true,
30159  get: function () {
30160    return _display_utils.getPdfFilenameFromUrl;
30161  }
30162}));
30163Object.defineProperty(exports, "getXfaPageViewport", ({
30164  enumerable: true,
30165  get: function () {
30166    return _display_utils.getXfaPageViewport;
30167  }
30168}));
30169Object.defineProperty(exports, "isDataScheme", ({
30170  enumerable: true,
30171  get: function () {
30172    return _display_utils.isDataScheme;
30173  }
30174}));
30175Object.defineProperty(exports, "isPdfFile", ({
30176  enumerable: true,
30177  get: function () {
30178    return _display_utils.isPdfFile;
30179  }
30180}));
30181Object.defineProperty(exports, "loadScript", ({
30182  enumerable: true,
30183  get: function () {
30184    return _display_utils.loadScript;
30185  }
30186}));
30187Object.defineProperty(exports, "noContextMenu", ({
30188  enumerable: true,
30189  get: function () {
30190    return _display_utils.noContextMenu;
30191  }
30192}));
30193Object.defineProperty(exports, "normalizeUnicode", ({
30194  enumerable: true,
30195  get: function () {
30196    return _util.normalizeUnicode;
30197  }
30198}));
30199Object.defineProperty(exports, "renderTextLayer", ({
30200  enumerable: true,
30201  get: function () {
30202    return _text_layer.renderTextLayer;
30203  }
30204}));
30205Object.defineProperty(exports, "setLayerDimensions", ({
30206  enumerable: true,
30207  get: function () {
30208    return _display_utils.setLayerDimensions;
30209  }
30210}));
30211Object.defineProperty(exports, "shadow", ({
30212  enumerable: true,
30213  get: function () {
30214    return _util.shadow;
30215  }
30216}));
30217Object.defineProperty(exports, "updateTextLayer", ({
30218  enumerable: true,
30219  get: function () {
30220    return _text_layer.updateTextLayer;
30221  }
30222}));
30223Object.defineProperty(exports, "version", ({
30224  enumerable: true,
30225  get: function () {
30226    return _api.version;
30227  }
30228}));
30229var _util = __w_pdfjs_require__(1);
30230var _api = __w_pdfjs_require__(2);
30231var _display_utils = __w_pdfjs_require__(6);
30232var _text_layer = __w_pdfjs_require__(26);
30233var _annotation_editor_layer = __w_pdfjs_require__(27);
30234var _tools = __w_pdfjs_require__(5);
30235var _annotation_layer = __w_pdfjs_require__(29);
30236var _worker_options = __w_pdfjs_require__(14);
30237var _xfa_layer = __w_pdfjs_require__(32);
30238const pdfjsVersion = '3.11.174';
30239const pdfjsBuild = 'ce8716743';
30240})();
30241
30242/******/ 	return __nested_webpack_exports__;
30243/******/ })()
30244;
30245});
30246//# sourceMappingURL=pdf.js.map
30247
30248/***/ },
30249
30250/***/ "./node_modules/pdfjs-dist/build/pdf.worker.js"
30251/*!*****************************************************!*\
30252  !*** ./node_modules/pdfjs-dist/build/pdf.worker.js ***!
30253  \*****************************************************/
30254(module) {
30255
30256/**
30257 * @licstart The following is the entire license notice for the
30258 * JavaScript code in this page
30259 *
30260 * Copyright 2023 Mozilla Foundation
30261 *
30262 * Licensed under the Apache License, Version 2.0 (the "License");
30263 * you may not use this file except in compliance with the License.
30264 * You may obtain a copy of the License at
30265 *
30266 *     http://www.apache.org/licenses/LICENSE-2.0
30267 *
30268 * Unless required by applicable law or agreed to in writing, software
30269 * distributed under the License is distributed on an "AS IS" BASIS,
30270 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30271 * See the License for the specific language governing permissions and
30272 * limitations under the License.
30273 *
30274 * @licend The above is the entire license notice for the
30275 * JavaScript code in this page
30276 */
30277
30278(function webpackUniversalModuleDefinition(root, factory) {
30279	if(true)
30280		module.exports = root.pdfjsWorker = factory();
30281	else // removed by dead control flow
30282{}
30283})(globalThis, () => {
30284return /******/ (() => { // webpackBootstrap
30285/******/ 	"use strict";
30286/******/ 	var __webpack_modules__ = ([
30287/* 0 */,
30288/* 1 */
30289/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
30290
30291
30292
30293Object.defineProperty(exports, "__esModule", ({
30294  value: true
30295}));
30296exports.WorkerTask = exports.WorkerMessageHandler = void 0;
30297var _util = __w_pdfjs_require__(2);
30298var _core_utils = __w_pdfjs_require__(3);
30299var _primitives = __w_pdfjs_require__(4);
30300var _pdf_manager = __w_pdfjs_require__(6);
30301var _annotation = __w_pdfjs_require__(10);
30302var _cleanup_helper = __w_pdfjs_require__(68);
30303var _writer = __w_pdfjs_require__(73);
30304var _message_handler = __w_pdfjs_require__(104);
30305var _worker_stream = __w_pdfjs_require__(105);
30306var _struct_tree = __w_pdfjs_require__(72);
30307class WorkerTask {
30308  constructor(name) {
30309    this.name = name;
30310    this.terminated = false;
vendor: 8,301 bytes, lines 30311-30555
30311    this._capability = new _util.PromiseCapability();
30312  }
30313  get finished() {
30314    return this._capability.promise;
30315  }
30316  finish() {
30317    this._capability.resolve();
30318  }
30319  terminate() {
30320    this.terminated = true;
30321  }
30322  ensureNotTerminated() {
30323    if (this.terminated) {
30324      throw new Error("Worker task was terminated");
30325    }
30326  }
30327}
30328exports.WorkerTask = WorkerTask;
30329class WorkerMessageHandler {
30330  static setup(handler, port) {
30331    let testMessageProcessed = false;
30332    handler.on("test", function (data) {
30333      if (testMessageProcessed) {
30334        return;
30335      }
30336      testMessageProcessed = true;
30337      handler.send("test", data instanceof Uint8Array);
30338    });
30339    handler.on("configure", function (data) {
30340      (0, _util.setVerbosityLevel)(data.verbosity);
30341    });
30342    handler.on("GetDocRequest", function (data) {
30343      return WorkerMessageHandler.createDocumentHandler(data, port);
30344    });
30345  }
30346  static createDocumentHandler(docParams, port) {
30347    let pdfManager;
30348    let terminated = false;
30349    let cancelXHRs = null;
30350    const WorkerTasks = new Set();
30351    const verbosity = (0, _util.getVerbosityLevel)();
30352    const {
30353      docId,
30354      apiVersion
30355    } = docParams;
30356    const workerVersion = '3.11.174';
30357    if (apiVersion !== workerVersion) {
30358      throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`);
30359    }
30360    const enumerableProperties = [];
30361    for (const property in []) {
30362      enumerableProperties.push(property);
30363    }
30364    if (enumerableProperties.length) {
30365      throw new Error("The `Array.prototype` contains unexpected enumerable properties: " + enumerableProperties.join(", ") + "; thus breaking e.g. `for...in` iteration of `Array`s.");
30366    }
30367    const workerHandlerName = docId + "_worker";
30368    let handler = new _message_handler.MessageHandler(workerHandlerName, docId, port);
30369    function ensureNotTerminated() {
30370      if (terminated) {
30371        throw new Error("Worker was terminated");
30372      }
30373    }
30374    function startWorkerTask(task) {
30375      WorkerTasks.add(task);
30376    }
30377    function finishWorkerTask(task) {
30378      task.finish();
30379      WorkerTasks.delete(task);
30380    }
30381    async function loadDocument(recoveryMode) {
30382      await pdfManager.ensureDoc("checkHeader");
30383      await pdfManager.ensureDoc("parseStartXRef");
30384      await pdfManager.ensureDoc("parse", [recoveryMode]);
30385      await pdfManager.ensureDoc("checkFirstPage", [recoveryMode]);
30386      await pdfManager.ensureDoc("checkLastPage", [recoveryMode]);
30387      const isPureXfa = await pdfManager.ensureDoc("isPureXfa");
30388      if (isPureXfa) {
30389        const task = new WorkerTask("loadXfaFonts");
30390        startWorkerTask(task);
30391        await Promise.all([pdfManager.loadXfaFonts(handler, task).catch(reason => {}).then(() => finishWorkerTask(task)), pdfManager.loadXfaImages()]);
30392      }
30393      const [numPages, fingerprints] = await Promise.all([pdfManager.ensureDoc("numPages"), pdfManager.ensureDoc("fingerprints")]);
30394      const htmlForXfa = isPureXfa ? await pdfManager.ensureDoc("htmlForXfa") : null;
30395      return {
30396        numPages,
30397        fingerprints,
30398        htmlForXfa
30399      };
30400    }
30401    function getPdfManager({
30402      data,
30403      password,
30404      disableAutoFetch,
30405      rangeChunkSize,
30406      length,
30407      docBaseUrl,
30408      enableXfa,
30409      evaluatorOptions
30410    }) {
30411      const pdfManagerArgs = {
30412        source: null,
30413        disableAutoFetch,
30414        docBaseUrl,
30415        docId,
30416        enableXfa,
30417        evaluatorOptions,
30418        handler,
30419        length,
30420        password,
30421        rangeChunkSize
30422      };
30423      const pdfManagerCapability = new _util.PromiseCapability();
30424      let newPdfManager;
30425      if (data) {
30426        try {
30427          pdfManagerArgs.source = data;
30428          newPdfManager = new _pdf_manager.LocalPdfManager(pdfManagerArgs);
30429          pdfManagerCapability.resolve(newPdfManager);
30430        } catch (ex) {
30431          pdfManagerCapability.reject(ex);
30432        }
30433        return pdfManagerCapability.promise;
30434      }
30435      let pdfStream,
30436        cachedChunks = [];
30437      try {
30438        pdfStream = new _worker_stream.PDFWorkerStream(handler);
30439      } catch (ex) {
30440        pdfManagerCapability.reject(ex);
30441        return pdfManagerCapability.promise;
30442      }
30443      const fullRequest = pdfStream.getFullReader();
30444      fullRequest.headersReady.then(function () {
30445        if (!fullRequest.isRangeSupported) {
30446          return;
30447        }
30448        pdfManagerArgs.source = pdfStream;
30449        pdfManagerArgs.length = fullRequest.contentLength;
30450        pdfManagerArgs.disableAutoFetch ||= fullRequest.isStreamingSupported;
30451        newPdfManager = new _pdf_manager.NetworkPdfManager(pdfManagerArgs);
30452        for (const chunk of cachedChunks) {
30453          newPdfManager.sendProgressiveData(chunk);
30454        }
30455        cachedChunks = [];
30456        pdfManagerCapability.resolve(newPdfManager);
30457        cancelXHRs = null;
30458      }).catch(function (reason) {
30459        pdfManagerCapability.reject(reason);
30460        cancelXHRs = null;
30461      });
30462      let loaded = 0;
30463      const flushChunks = function () {
30464        const pdfFile = (0, _core_utils.arrayBuffersToBytes)(cachedChunks);
30465        if (length && pdfFile.length !== length) {
30466          (0, _util.warn)("reported HTTP length is different from actual");
30467        }
30468        try {
30469          pdfManagerArgs.source = pdfFile;
30470          newPdfManager = new _pdf_manager.LocalPdfManager(pdfManagerArgs);
30471          pdfManagerCapability.resolve(newPdfManager);
30472        } catch (ex) {
30473          pdfManagerCapability.reject(ex);
30474        }
30475        cachedChunks = [];
30476      };
30477      new Promise(function (resolve, reject) {
30478        const readChunk = function ({
30479          value,
30480          done
30481        }) {
30482          try {
30483            ensureNotTerminated();
30484            if (done) {
30485              if (!newPdfManager) {
30486                flushChunks();
30487              }
30488              cancelXHRs = null;
30489              return;
30490            }
30491            loaded += value.byteLength;
30492            if (!fullRequest.isStreamingSupported) {
30493              handler.send("DocProgress", {
30494                loaded,
30495                total: Math.max(loaded, fullRequest.contentLength || 0)
30496              });
30497            }
30498            if (newPdfManager) {
30499              newPdfManager.sendProgressiveData(value);
30500            } else {
30501              cachedChunks.push(value);
30502            }
30503            fullRequest.read().then(readChunk, reject);
30504          } catch (e) {
30505            reject(e);
30506          }
30507        };
30508        fullRequest.read().then(readChunk, reject);
30509      }).catch(function (e) {
30510        pdfManagerCapability.reject(e);
30511        cancelXHRs = null;
30512      });
30513      cancelXHRs = function (reason) {
30514        pdfStream.cancelAllRequests(reason);
30515      };
30516      return pdfManagerCapability.promise;
30517    }
30518    function setupDoc(data) {
30519      function onSuccess(doc) {
30520        ensureNotTerminated();
30521        handler.send("GetDoc", {
30522          pdfInfo: doc
30523        });
30524      }
30525      function onFailure(ex) {
30526        ensureNotTerminated();
30527        if (ex instanceof _util.PasswordException) {
30528          const task = new WorkerTask(`PasswordException: response ${ex.code}`);
30529          startWorkerTask(task);
30530          handler.sendWithPromise("PasswordRequest", ex).then(function ({
30531            password
30532          }) {
30533            finishWorkerTask(task);
30534            pdfManager.updatePassword(password);
30535            pdfManagerReady();
30536          }).catch(function () {
30537            finishWorkerTask(task);
30538            handler.send("DocException", ex);
30539          });
30540        } else if (ex instanceof _util.InvalidPDFException || ex instanceof _util.MissingPDFException || ex instanceof _util.UnexpectedResponseException || ex instanceof _util.UnknownErrorException) {
30541          handler.send("DocException", ex);
30542        } else {
30543          handler.send("DocException", new _util.UnknownErrorException(ex.message, ex.toString()));
30544        }
30545      }
30546      function pdfManagerReady() {
30547        ensureNotTerminated();
30548        loadDocument(false).then(onSuccess, function (reason) {
30549          ensureNotTerminated();
30550          if (!(reason instanceof _core_utils.XRefParseException)) {
30551            onFailure(reason);
30552            return;
30553          }
30554          pdfManager.requestLoadedStream().then(function () {
30555            ensureNotTerminated();
vendor: 6,091 bytes, lines 30556-30706
30556            loadDocument(true).then(onSuccess, onFailure);
30557          });
30558        });
30559      }
30560      ensureNotTerminated();
30561      getPdfManager(data).then(function (newPdfManager) {
30562        if (terminated) {
30563          newPdfManager.terminate(new _util.AbortException("Worker was terminated."));
30564          throw new Error("Worker was terminated");
30565        }
30566        pdfManager = newPdfManager;
30567        pdfManager.requestLoadedStream(true).then(stream => {
30568          handler.send("DataLoaded", {
30569            length: stream.bytes.byteLength
30570          });
30571        });
30572      }).then(pdfManagerReady, onFailure);
30573    }
30574    handler.on("GetPage", function (data) {
30575      return pdfManager.getPage(data.pageIndex).then(function (page) {
30576        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]) {
30577          return {
30578            rotate,
30579            ref,
30580            userUnit,
30581            view
30582          };
30583        });
30584      });
30585    });
30586    handler.on("GetPageIndex", function (data) {
30587      const pageRef = _primitives.Ref.get(data.num, data.gen);
30588      return pdfManager.ensureCatalog("getPageIndex", [pageRef]);
30589    });
30590    handler.on("GetDestinations", function (data) {
30591      return pdfManager.ensureCatalog("destinations");
30592    });
30593    handler.on("GetDestination", function (data) {
30594      return pdfManager.ensureCatalog("getDestination", [data.id]);
30595    });
30596    handler.on("GetPageLabels", function (data) {
30597      return pdfManager.ensureCatalog("pageLabels");
30598    });
30599    handler.on("GetPageLayout", function (data) {
30600      return pdfManager.ensureCatalog("pageLayout");
30601    });
30602    handler.on("GetPageMode", function (data) {
30603      return pdfManager.ensureCatalog("pageMode");
30604    });
30605    handler.on("GetViewerPreferences", function (data) {
30606      return pdfManager.ensureCatalog("viewerPreferences");
30607    });
30608    handler.on("GetOpenAction", function (data) {
30609      return pdfManager.ensureCatalog("openAction");
30610    });
30611    handler.on("GetAttachments", function (data) {
30612      return pdfManager.ensureCatalog("attachments");
30613    });
30614    handler.on("GetDocJSActions", function (data) {
30615      return pdfManager.ensureCatalog("jsActions");
30616    });
30617    handler.on("GetPageJSActions", function ({
30618      pageIndex
30619    }) {
30620      return pdfManager.getPage(pageIndex).then(function (page) {
30621        return pdfManager.ensure(page, "jsActions");
30622      });
30623    });
30624    handler.on("GetOutline", function (data) {
30625      return pdfManager.ensureCatalog("documentOutline");
30626    });
30627    handler.on("GetOptionalContentConfig", function (data) {
30628      return pdfManager.ensureCatalog("optionalContentConfig");
30629    });
30630    handler.on("GetPermissions", function (data) {
30631      return pdfManager.ensureCatalog("permissions");
30632    });
30633    handler.on("GetMetadata", function (data) {
30634      return Promise.all([pdfManager.ensureDoc("documentInfo"), pdfManager.ensureCatalog("metadata")]);
30635    });
30636    handler.on("GetMarkInfo", function (data) {
30637      return pdfManager.ensureCatalog("markInfo");
30638    });
30639    handler.on("GetData", function (data) {
30640      return pdfManager.requestLoadedStream().then(function (stream) {
30641        return stream.bytes;
30642      });
30643    });
30644    handler.on("GetAnnotations", function ({
30645      pageIndex,
30646      intent
30647    }) {
30648      return pdfManager.getPage(pageIndex).then(function (page) {
30649        const task = new WorkerTask(`GetAnnotations: page ${pageIndex}`);
30650        startWorkerTask(task);
30651        return page.getAnnotationsData(handler, task, intent).then(data => {
30652          finishWorkerTask(task);
30653          return data;
30654        }, reason => {
30655          finishWorkerTask(task);
30656          throw reason;
30657        });
30658      });
30659    });
30660    handler.on("GetFieldObjects", function (data) {
30661      return pdfManager.ensureDoc("fieldObjects");
30662    });
30663    handler.on("HasJSActions", function (data) {
30664      return pdfManager.ensureDoc("hasJSActions");
30665    });
30666    handler.on("GetCalculationOrderIds", function (data) {
30667      return pdfManager.ensureDoc("calculationOrderIds");
30668    });
30669    handler.on("SaveDocument", async function ({
30670      isPureXfa,
30671      numPages,
30672      annotationStorage,
30673      filename
30674    }) {
30675      const globalPromises = [pdfManager.requestLoadedStream(), pdfManager.ensureCatalog("acroForm"), pdfManager.ensureCatalog("acroFormRef"), pdfManager.ensureDoc("startXRef"), pdfManager.ensureDoc("xref"), pdfManager.ensureDoc("linearization"), pdfManager.ensureCatalog("structTreeRoot")];
30676      const promises = [];
30677      const newAnnotationsByPage = !isPureXfa ? (0, _core_utils.getNewAnnotationsMap)(annotationStorage) : null;
30678      const [stream, acroForm, acroFormRef, startXRef, xref, linearization, _structTreeRoot] = await Promise.all(globalPromises);
30679      const catalogRef = xref.trailer.getRaw("Root") || null;
30680      let structTreeRoot;
30681      if (newAnnotationsByPage) {
30682        if (!_structTreeRoot) {
30683          if (await _struct_tree.StructTreeRoot.canCreateStructureTree({
30684            catalogRef,
30685            pdfManager,
30686            newAnnotationsByPage
30687          })) {
30688            structTreeRoot = null;
30689          }
30690        } else if (await _structTreeRoot.canUpdateStructTree({
30691          pdfManager,
30692          newAnnotationsByPage
30693        })) {
30694          structTreeRoot = _structTreeRoot;
30695        }
30696        const imagePromises = _annotation.AnnotationFactory.generateImages(annotationStorage.values(), xref, pdfManager.evaluatorOptions.isOffscreenCanvasSupported);
30697        const newAnnotationPromises = structTreeRoot === undefined ? promises : [];
30698        for (const [pageIndex, annotations] of newAnnotationsByPage) {
30699          newAnnotationPromises.push(pdfManager.getPage(pageIndex).then(page => {
30700            const task = new WorkerTask(`Save (editor): page ${pageIndex}`);
30701            return page.saveNewAnnotations(handler, task, annotations, imagePromises).finally(function () {
30702              finishWorkerTask(task);
30703            });
30704          }));
30705        }
30706        if (structTreeRoot === null) {
30707          promises.push(Promise.all(newAnnotationPromises).then(async newRefs => {
30708            await _struct_tree.StructTreeRoot.createStructureTree({
30709              newAnnotationsByPage,
30710              xref,
30711              catalogRef,
30712              pdfManager,
30713              newRefs
30714            });
30715            return newRefs;
30716          }));
30717        } else if (structTreeRoot) {
30718          promises.push(Promise.all(newAnnotationPromises).then(async newRefs => {
30719            await structTreeRoot.updateStructureTree({
30720              newAnnotationsByPage,
30721              pdfManager,
30722              newRefs
30723            });
30724            return newRefs;
30725          }));
30726        }
30727      }
30728      if (isPureXfa) {
30729        promises.push(pdfManager.serializeXfaData(annotationStorage));
30730      } else {
30731        for (let pageIndex = 0; pageIndex < numPages; pageIndex++) {
30732          promises.push(pdfManager.getPage(pageIndex).then(function (page) {
30733            const task = new WorkerTask(`Save: page ${pageIndex}`);
30734            return page.save(handler, task, annotationStorage).finally(function () {
30735              finishWorkerTask(task);
30736            });
30737          }));
30738        }
30739      }
30740      const refs = await Promise.all(promises);
30741      let newRefs = [];
30742      let xfaData = null;
30743      if (isPureXfa) {
30744        xfaData = refs[0];
30745        if (!xfaData) {
30746          return stream.bytes;
30747        }
30748      } else {
30749        newRefs = refs.flat(2);
30750        if (newRefs.length === 0) {
30751          return stream.bytes;
30752        }
30753      }
30754      const needAppearances = acroFormRef && acroForm instanceof _primitives.Dict && newRefs.some(ref => ref.needAppearances);
30755      const xfa = acroForm instanceof _primitives.Dict && acroForm.get("XFA") || null;
30756      let xfaDatasetsRef = null;
30757      let hasXfaDatasetsEntry = false;
30758      if (Array.isArray(xfa)) {
30759        for (let i = 0, ii = xfa.length; i < ii; i += 2) {
30760          if (xfa[i] === "datasets") {
30761            xfaDatasetsRef = xfa[i + 1];
30762            hasXfaDatasetsEntry = true;
30763          }
30764        }
30765        if (xfaDatasetsRef === null) {
30766          xfaDatasetsRef = xref.getNewTemporaryRef();
30767        }
30768      } else if (xfa) {
30769        (0, _util.warn)("Unsupported XFA type.");
30770      }
30771      let newXrefInfo = Object.create(null);
30772      if (xref.trailer) {
30773        const infoObj = Object.create(null);
30774        const xrefInfo = xref.trailer.get("Info") || null;
30775        if (xrefInfo instanceof _primitives.Dict) {
30776          xrefInfo.forEach((key, value) => {
30777            if (typeof value === "string") {
30778              infoObj[key] = (0, _util.stringToPDFString)(value);
30779            }
30780          });
30781        }
30782        newXrefInfo = {
30783          rootRef: catalogRef,
30784          encryptRef: xref.trailer.getRaw("Encrypt") || null,
30785          newRef: xref.getNewTemporaryRef(),
30786          infoRef: xref.trailer.getRaw("Info") || null,
30787          info: infoObj,
30788          fileIds: xref.trailer.get("ID") || null,
30789          startXRef: linearization ? startXRef : xref.lastXRefStreamPos ?? startXRef,
30790          filename
30791        };
30792      }
30793      return (0, _writer.incrementalUpdate)({
30794        originalData: stream.bytes,
30795        xrefInfo: newXrefInfo,
30796        newRefs,
30797        xref,
30798        hasXfa: !!xfa,
30799        xfaDatasetsRef,
30800        hasXfaDatasetsEntry,
30801        needAppearances,
30802        acroFormRef,
30803        acroForm,
30804        xfaData
30805      }).finally(() => {
30806        xref.resetNewTemporaryRef();
30807      });
30808    });
30809    handler.on("GetOperatorList", function (data, sink) {
30810      const pageIndex = data.pageIndex;
30811      pdfManager.getPage(pageIndex).then(function (page) {
30812        const task = new WorkerTask(`GetOperatorList: page ${pageIndex}`);
30813        startWorkerTask(task);
30814        const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0;
30815        page.getOperatorList({
30816          handler,
30817          sink,
30818          task,
30819          intent: data.intent,
30820          cacheKey: data.cacheKey,
30821          annotationStorage: data.annotationStorage
30822        }).then(function (operatorListInfo) {
30823          finishWorkerTask(task);
30824          if (start) {
30825            (0, _util.info)(`page=${pageIndex + 1} - getOperatorList: time=` + `${Date.now() - start}
30825ms, len=${operatorListInfo.length}`);
30826          }
30827          sink.close();
30828        }, function (reason) {
30829          finishWorkerTask(task);
30830          if (task.terminated) {
30831            return;
30832          }
30833          sink.error(reason);
30834        });
30835      });
30836    });
30837    handler.on("GetTextContent", function (data, sink) {
30838      const {
30839        pageIndex,
30840        includeMarkedContent,
30841        disableNormalization
30842      } = data;
30843      pdfManager.getPage(pageIndex).then(function (page) {
30844        const task = new WorkerTask("GetTextContent: page " + pageIndex);
30845        startWorkerTask(task);
30846        const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0;
30847        page.extractTextContent({
30848          handler,
30849          task,
30850          sink,
30851          includeMarkedContent,
30852          disableNormalization
30853        }).then(function () {
30854          finishWorkerTask(task);
30855          if (start) {
30856            (0, _util.info)(`page=${pageIndex + 1} - getTextContent: time=` + `${Date.now() - start}ms`);
30857          }
30858          sink.close();
30859        }, function (reason) {
30860          finishWorkerTask(task);
30861          if (task.terminated) {
30862            return;
30863          }
30864          sink.error(reason);
30865        });
30866      });
30867    });
30868    handler.on("GetStructTree", function (data) {
30869      return pdfManager.getPage(data.pageIndex).then(function (page) {
30870        return pdfManager.ensure(page, "getStructTree");
30871      });
30872    });
30873    handler.on("FontFallback", function (data) {
30874      return pdfManager.fontFallback(data.id, handler);
30875    });
30876    handler.on("Cleanup", function (data) {
30877      return pdfManager.cleanup(true);
30878    });
30879    handler.on("Terminate", function (data) {
30880      terminated = true;
30881      const waitOn = [];
30882      if (pdfManager) {
30883        pdfManager.terminate(new _util.AbortException("Worker was terminated."));
30884        const cleanupPromise = pdfManager.cleanup();
30885        waitOn.push(cleanupPromise);
30886        pdfManager = null;
30887      } else {
30888        (0, _cleanup_helper.clearGlobalCaches)();
30889      }
30890      if (cancelXHRs) {
30891        cancelXHRs(new _util.AbortException("Worker was terminated."));
30892      }
30893      for (const task of WorkerTasks) {
30894        waitOn.push(task.finished);
30895        task.terminate();
30896      }
30897      return Promise.all(waitOn).then(function () {
30898        handler.destroy();
30899        handler = null;
30900      });
30901    });
30902    handler.on("Ready", function (data) {
30903      setupDoc(docParams);
30904      docParams = null;
30905    });
30906    return workerHandlerName;
30907  }
30908  static initializeFromPort(port) {
30909    const handler = new _message_handler.MessageHandler("worker", "main", port);
30910    WorkerMessageHandler.setup(handler, port);
30911    handler.send("ready", null);
30912  }
30913}
30914exports.WorkerMessageHandler = WorkerMessageHandler;
30915function isMessagePort(maybePort) {
30916  return typeof maybePort.postMessage === "function" && "onmessage" in maybePort;
30917}
30918if (typeof window === "undefined" && !_util.isNodeJS && typeof self !== "undefined" && isMessagePort(self)) {
30919  WorkerMessageHandler.initializeFromPort(self);
30920}
30921
30922/***/ }),
30923/* 2 */
30924/***/ ((__unused_webpack_module, exports) => {
30925
30926
30927
30928Object.defineProperty(exports, "__esModule", ({
30929  value: true
30930}));
30931exports.VerbosityLevel = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.TextRenderingMode = exports.RenderingIntentFlag = exports.PromiseCapability = exp
30931orts.PermissionFlag = exports.PasswordResponses = exports.PasswordException = exports.PageActionEventType = exports.OPS = exports.MissingPDFException = exports.MAX_IMAGE_SIZE_TO_CACHE = exports.LINE_FACTOR = exports.LINE_DESCENT_FACTOR = exports.InvalidPDFException = exports.ImageKind = exports.IDENTITY_MATRIX = exports.FormatError = exports.FeatureTest = exports.FONT_IDENTITY_MATRIX = exports.DocumentActionEventType = exports.CMapCompressionType = exports.BaseException = exports.BASELINE_FACTOR = exports.AnnotationType = exports.AnnotationReplyType = exports.AnnotationPrefix = exports.AnnotationMode = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationEditorType = exports.AnnotationEditorPrefix = exports.AnnotationEditorParamsType = exports.AnnotationBorderStyleType = exports.AnnotationActionEventType = exports.AbortException = void 0;
30932exports.assert = assert;
30933exports.bytesToString = bytesToString;
30934exports.createValidAbsoluteUrl = createValidAbsoluteUrl;
30935exports.getModificationDate = getModificationDate;
30936exports.getUuid = getUuid;
30937exports.getVerbosityLevel = getVerbosityLevel;
30938exports.info = info;
30939exports.isArrayBuffer = isArrayBuffer;
30940exports.isArrayEqual = isArrayEqual;
30941exports.isNodeJS = void 0;
30942exports.normalizeUnicode = normalizeUnicode;
30943exports.objectFromMap = objectFromMap;
30944exports.objectSize = objectSize;
30945exports.setVerbosityLevel = setVerbosityLevel;
30946exports.shadow = shadow;
30947exports.string32 = string32;
30948exports.stringToBytes = stringToBytes;
30949exports.stringToPDFString = stringToPDFString;
30950exports.stringToUTF8String = stringToUTF8String;
30951exports.unreachable = unreachable;
30952exports.utf8StringToString = utf8StringToString;
30953exports.warn = warn;
30954const isNodeJS = typeof process === "object" && process + "" === "[object process]" && !process.versions.nw && !(process.versions.electron && process.type && process.type !== "browser");
vendor: 18,729 bytes, lines 30955-31642
30955exports.isNodeJS = isNodeJS;
30956const IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
30957exports.IDENTITY_MATRIX = IDENTITY_MATRIX;
30958const FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];
30959exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX;
30960const MAX_IMAGE_SIZE_TO_CACHE = 10e6;
30961exports.MAX_IMAGE_SIZE_TO_CACHE = MAX_IMAGE_SIZE_TO_CACHE;
30962const LINE_FACTOR = 1.35;
30963exports.LINE_FACTOR = LINE_FACTOR;
30964const LINE_DESCENT_FACTOR = 0.35;
30965exports.LINE_DESCENT_FACTOR = LINE_DESCENT_FACTOR;
30966const BASELINE_FACTOR = LINE_DESCENT_FACTOR / LINE_FACTOR;
30967exports.BASELINE_FACTOR = BASELINE_FACTOR;
30968const RenderingIntentFlag = {
30969  ANY: 0x01,
30970  DISPLAY: 0x02,
30971  PRINT: 0x04,
30972  SAVE: 0x08,
30973  ANNOTATIONS_FORMS: 0x10,
30974  ANNOTATIONS_STORAGE: 0x20,
30975  ANNOTATIONS_DISABLE: 0x40,
30976  OPLIST: 0x100
30977};
30978exports.RenderingIntentFlag = RenderingIntentFlag;
30979const AnnotationMode = {
30980  DISABLE: 0,
30981  ENABLE: 1,
30982  ENABLE_FORMS: 2,
30983  ENABLE_STORAGE: 3
30984};
30985exports.AnnotationMode = AnnotationMode;
30986const AnnotationEditorPrefix = "pdfjs_internal_editor_";
30987exports.AnnotationEditorPrefix = AnnotationEditorPrefix;
30988const AnnotationEditorType = {
30989  DISABLE: -1,
30990  NONE: 0,
30991  FREETEXT: 3,
30992  STAMP: 13,
30993  INK: 15
30994};
30995exports.AnnotationEditorType = AnnotationEditorType;
30996const AnnotationEditorParamsType = {
30997  RESIZE: 1,
30998  CREATE: 2,
30999  FREETEXT_SIZE: 11,
31000  FREETEXT_COLOR: 12,
31001  FREETEXT_OPACITY: 13,
31002  INK_COLOR: 21,
31003  INK_THICKNESS: 22,
31004  INK_OPACITY: 23
31005};
31006exports.AnnotationEditorParamsType = AnnotationEditorParamsType;
31007const PermissionFlag = {
31008  PRINT: 0x04,
31009  MODIFY_CONTENTS: 0x08,
31010  COPY: 0x10,
31011  MODIFY_ANNOTATIONS: 0x20,
31012  FILL_INTERACTIVE_FORMS: 0x100,
31013  COPY_FOR_ACCESSIBILITY: 0x200,
31014  ASSEMBLE: 0x400,
31015  PRINT_HIGH_QUALITY: 0x800
31016};
31017exports.PermissionFlag = PermissionFlag;
31018const TextRenderingMode = {
31019  FILL: 0,
31020  STROKE: 1,
31021  FILL_STROKE: 2,
31022  INVISIBLE: 3,
31023  FILL_ADD_TO_PATH: 4,
31024  STROKE_ADD_TO_PATH: 5,
31025  FILL_STROKE_ADD_TO_PATH: 6,
31026  ADD_TO_PATH: 7,
31027  FILL_STROKE_MASK: 3,
31028  ADD_TO_PATH_FLAG: 4
31029};
31030exports.TextRenderingMode = TextRenderingMode;
31031const ImageKind = {
31032  GRAYSCALE_1BPP: 1,
31033  RGB_24BPP: 2,
31034  RGBA_32BPP: 3
31035};
31036exports.ImageKind = ImageKind;
31037const AnnotationType = {
31038  TEXT: 1,
31039  LINK: 2,
31040  FREETEXT: 3,
31041  LINE: 4,
31042  SQUARE: 5,
31043  CIRCLE: 6,
31044  POLYGON: 7,
31045  POLYLINE: 8,
31046  HIGHLIGHT: 9,
31047  UNDERLINE: 10,
31048  SQUIGGLY: 11,
31049  STRIKEOUT: 12,
31050  STAMP: 13,
31051  CARET: 14,
31052  INK: 15,
31053  POPUP: 16,
31054  FILEATTACHMENT: 17,
31055  SOUND: 18,
31056  MOVIE: 19,
31057  WIDGET: 20,
31058  SCREEN: 21,
31059  PRINTERMARK: 22,
31060  TRAPNET: 23,
31061  WATERMARK: 24,
31062  THREED: 25,
31063  REDACT: 26
31064};
31065exports.AnnotationType = AnnotationType;
31066const AnnotationReplyType = {
31067  GROUP: "Group",
31068  REPLY: "R"
31069};
31070exports.AnnotationReplyType = AnnotationReplyType;
31071const AnnotationFlag = {
31072  INVISIBLE: 0x01,
31073  HIDDEN: 0x02,
31074  PRINT: 0x04,
31075  NOZOOM: 0x08,
31076  NOROTATE: 0x10,
31077  NOVIEW: 0x20,
31078  READONLY: 0x40,
31079  LOCKED: 0x80,
31080  TOGGLENOVIEW: 0x100,
31081  LOCKEDCONTENTS: 0x200
31082};
31083exports.AnnotationFlag = AnnotationFlag;
31084const AnnotationFieldFlag = {
31085  READONLY: 0x0000001,
31086  REQUIRED: 0x0000002,
31087  NOEXPORT: 0x0000004,
31088  MULTILINE: 0x0001000,
31089  PASSWORD: 0x0002000,
31090  NOTOGGLETOOFF: 0x0004000,
31091  RADIO: 0x0008000,
31092  PUSHBUTTON: 0x0010000,
31093  COMBO: 0x0020000,
31094  EDIT: 0x0040000,
31095  SORT: 0x0080000,
31096  FILESELECT: 0x0100000,
31097  MULTISELECT: 0x0200000,
31098  DONOTSPELLCHECK: 0x0400000,
31099  DONOTSCROLL: 0x0800000,
31100  COMB: 0x1000000,
31101  RICHTEXT: 0x2000000,
31102  RADIOSINUNISON: 0x2000000,
31103  COMMITONSELCHANGE: 0x4000000
31104};
31105exports.AnnotationFieldFlag = AnnotationFieldFlag;
31106const AnnotationBorderStyleType = {
31107  SOLID: 1,
31108  DASHED: 2,
31109  BEVELED: 3,
31110  INSET: 4,
31111  UNDERLINE: 5
31112};
31113exports.AnnotationBorderStyleType = AnnotationBorderStyleType;
31114const AnnotationActionEventType = {
31115  E: "Mouse Enter",
31116  X: "Mouse Exit",
31117  D: "Mouse Down",
31118  U: "Mouse Up",
31119  Fo: "Focus",
31120  Bl: "Blur",
31121  PO: "PageOpen",
31122  PC: "PageClose",
31123  PV: "PageVisible",
31124  PI: "PageInvisible",
31125  K: "Keystroke",
31126  F: "Format",
31127  V: "Validate",
31128  C: "Calculate"
31129};
31130exports.AnnotationActionEventType = AnnotationActionEventType;
31131const DocumentActionEventType = {
31132  WC: "WillClose",
31133  WS: "WillSave",
31134  DS: "DidSave",
31135  WP: "WillPrint",
31136  DP: "DidPrint"
31137};
31138exports.DocumentActionEventType = DocumentActionEventType;
31139const PageActionEventType = {
31140  O: "PageOpen",
31141  C: "PageClose"
31142};
31143exports.PageActionEventType = PageActionEventType;
31144const VerbosityLevel = {
31145  ERRORS: 0,
31146  WARNINGS: 1,
31147  INFOS: 5
31148};
31149exports.VerbosityLevel = VerbosityLevel;
31150const CMapCompressionType = {
31151  NONE: 0,
31152  BINARY: 1
31153};
31154exports.CMapCompressionType = CMapCompressionType;
31155const OPS = {
31156  dependency: 1,
31157  setLineWidth: 2,
31158  setLineCap: 3,
31159  setLineJoin: 4,
31160  setMiterLimit: 5,
31161  setDash: 6,
31162  setRenderingIntent: 7,
31163  setFlatness: 8,
31164  setGState: 9,
31165  save: 10,
31166  restore: 11,
31167  transform: 12,
31168  moveTo: 13,
31169  lineTo: 14,
31170  curveTo: 15,
31171  curveTo2: 16,
31172  curveTo3: 17,
31173  closePath: 18,
31174  rectangle: 19,
31175  stroke: 20,
31176  closeStroke: 21,
31177  fill: 22,
31178  eoFill: 23,
31179  fillStroke: 24,
31180  eoFillStroke: 25,
31181  closeFillStroke: 26,
31182  closeEOFillStroke: 27,
31183  endPath: 28,
31184  clip: 29,
31185  eoClip: 30,
31186  beginText: 31,
31187  endText: 32,
31188  setCharSpacing: 33,
31189  setWordSpacing: 34,
31190  setHScale: 35,
31191  setLeading: 36,
31192  setFont: 37,
31193  setTextRenderingMode: 38,
31194  setTextRise: 39,
31195  moveText: 40,
31196  setLeadingMoveText: 41,
31197  setTextMatrix: 42,
31198  nextLine: 43,
31199  showText: 44,
31200  showSpacedText: 45,
31201  nextLineShowText: 46,
31202  nextLineSetSpacingShowText: 47,
31203  setCharWidth: 48,
31204  setCharWidthAndBounds: 49,
31205  setStrokeColorSpace: 50,
31206  setFillColorSpace: 51,
31207  setStrokeColor: 52,
31208  setStrokeColorN: 53,
31209  setFillColor: 54,
31210  setFillColorN: 55,
31211  setStrokeGray: 56,
31212  setFillGray: 57,
31213  setStrokeRGBColor: 58,
31214  setFillRGBColor: 59,
31215  setStrokeCMYKColor: 60,
31216  setFillCMYKColor: 61,
31217  shadingFill: 62,
31218  beginInlineImage: 63,
31219  beginImageData: 64,
31220  endInlineImage: 65,
31221  paintXObject: 66,
31222  markPoint: 67,
31223  markPointProps: 68,
31224  beginMarkedContent: 69,
31225  beginMarkedContentProps: 70,
31226  endMarkedContent: 71,
31227  beginCompat: 72,
31228  endCompat: 73,
31229  paintFormXObjectBegin: 74,
31230  paintFormXObjectEnd: 75,
31231  beginGroup: 76,
31232  endGroup: 77,
31233  beginAnnotation: 80,
31234  endAnnotation: 81,
31235  paintImageMaskXObject: 83,
31236  paintImageMaskXObjectGroup: 84,
31237  paintImageXObject: 85,
31238  paintInlineImageXObject: 86,
31239  paintInlineImageXObjectGroup: 87,
31240  paintImageXObjectRepeat: 88,
31241  paintImageMaskXObjectRepeat: 89,
31242  paintSolidColorImageMask: 90,
31243  constructPath: 91
31244};
31245exports.OPS = OPS;
31246const PasswordResponses = {
31247  NEED_PASSWORD: 1,
31248  INCORRECT_PASSWORD: 2
31249};
31250exports.PasswordResponses = PasswordResponses;
31251let verbosity = VerbosityLevel.WARNINGS;
31252function setVerbosityLevel(level) {
31253  if (Number.isInteger(level)) {
31254    verbosity = level;
31255  }
31256}
31257function getVerbosityLevel() {
31258  return verbosity;
31259}
31260function info(msg) {
31261  if (verbosity >= VerbosityLevel.INFOS) {
31262    console.log(`Info: ${msg}`);
31263  }
31264}
31265function warn(msg) {
31266  if (verbosity >= VerbosityLevel.WARNINGS) {
31267    console.log(`Warning: ${msg}`);
31268  }
31269}
31270function unreachable(msg) {
31271  throw new Error(msg);
31272}
31273function assert(cond, msg) {
31274  if (!cond) {
31275    unreachable(msg);
31276  }
31277}
31278function _isValidProtocol(url) {
31279  switch (url?.protocol) {
31280    case "http:":
31281    case "https:":
31282    case "ftp:":
31283    case "mailto:":
31284    case "tel:":
31285      return true;
31286    default:
31287      return false;
31288  }
31289}
31290function createValidAbsoluteUrl(url, baseUrl = null, options = null) {
31291  if (!url) {
31292    return null;
31293  }
31294  try {
31295    if (options && typeof url === "string") {
31296      if (options.addDefaultProtocol && url.startsWith("www.")) {
31297        const dots = url.match(/\./g);
31298        if (dots?.length >= 2) {
31299          url = `http://${url}`;
31300        }
31301      }
31302      if (options.tryConvertEncoding) {
31303        try {
31304          url = stringToUTF8String(url);
31305        } catch {}
31306      }
31307    }
31308    const absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);
31309    if (_isValidProtocol(absoluteUrl)) {
31310      return absoluteUrl;
31311    }
31312  } catch {}
31313  return null;
31314}
31315function shadow(obj, prop, value, nonSerializable = false) {
31316  Object.defineProperty(obj, prop, {
31317    value,
31318    enumerable: !nonSerializable,
31319    configurable: true,
31320    writable: false
31321  });
31322  return value;
31323}
31324const BaseException = function BaseExceptionClosure() {
31325  function BaseException(message, name) {
31326    if (this.constructor === BaseException) {
31327      unreachable("Cannot initialize BaseException.");
31328    }
31329    this.message = message;
31330    this.name = name;
31331  }
31332  BaseException.prototype = new Error();
31333  BaseException.constructor = BaseException;
31334  return BaseException;
31335}();
31336exports.BaseException = BaseException;
31337class PasswordException extends BaseException {
31338  constructor(msg, code) {
31339    super(msg, "PasswordException");
31340    this.code = code;
31341  }
31342}
31343exports.PasswordException = PasswordException;
31344class UnknownErrorException extends BaseException {
31345  constructor(msg, details) {
31346    super(msg, "UnknownErrorException");
31347    this.details = details;
31348  }
31349}
31350exports.UnknownErrorException = UnknownErrorException;
31351class InvalidPDFException extends BaseException {
31352  constructor(msg) {
31353    super(msg, "InvalidPDFException");
31354  }
31355}
31356exports.InvalidPDFException = InvalidPDFException;
31357class MissingPDFException extends BaseException {
31358  constructor(msg) {
31359    super(msg, "MissingPDFException");
31360  }
31361}
31362exports.MissingPDFException = MissingPDFException;
31363class UnexpectedResponseException extends BaseException {
31364  constructor(msg, status) {
31365    super(msg, "UnexpectedResponseException");
31366    this.status = status;
31367  }
31368}
31369exports.UnexpectedResponseException = UnexpectedResponseException;
31370class FormatError extends BaseException {
31371  constructor(msg) {
31372    super(msg, "FormatError");
31373  }
31374}
31375exports.FormatError = FormatError;
31376class AbortException extends BaseException {
31377  constructor(msg) {
31378    super(msg, "AbortException");
31379  }
31380}
31381exports.AbortException = AbortException;
31382function bytesToString(bytes) {
31383  if (typeof bytes !== "object" || bytes?.length === undefined) {
31384    unreachable("Invalid argument for bytesToString");
31385  }
31386  const length = bytes.length;
31387  const MAX_ARGUMENT_COUNT = 8192;
31388  if (length < MAX_ARGUMENT_COUNT) {
31389    return String.fromCharCode.apply(null, bytes);
31390  }
31391  const strBuf = [];
31392  for (let i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
31393    const chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
31394    const chunk = bytes.subarray(i, chunkEnd);
31395    strBuf.push(String.fromCharCode.apply(null, chunk));
31396  }
31397  return strBuf.join("");
31398}
31399function stringToBytes(str) {
31400  if (typeof str !== "string") {
31401    unreachable("Invalid argument for stringToBytes");
31402  }
31403  const length = str.length;
31404  const bytes = new Uint8Array(length);
31405  for (let i = 0; i < length; ++i) {
31406    bytes[i] = str.charCodeAt(i) & 0xff;
31407  }
31408  return bytes;
31409}
31410function string32(value) {
31411  return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
31412}
31413function objectSize(obj) {
31414  return Object.keys(obj).length;
31415}
31416function objectFromMap(map) {
31417  const obj = Object.create(null);
31418  for (const [key, value] of map) {
31419    obj[key] = value;
31420  }
31421  return obj;
31422}
31423function isLittleEndian() {
31424  const buffer8 = new Uint8Array(4);
31425  buffer8[0] = 1;
31426  const view32 = new Uint32Array(buffer8.buffer, 0, 1);
31427  return view32[0] === 1;
31428}
31429function isEvalSupported() {
31430  try {
31431    new Function("");
31432    return true;
31433  } catch {
31434    return false;
31435  }
31436}
31437class FeatureTest {
31438  static get isLittleEndian() {
31439    return shadow(this, "isLittleEndian", isLittleEndian());
31440  }
31441  static get isEvalSupported() {
31442    return shadow(this, "isEvalSupported", isEvalSupported());
31443  }
31444  static get isOffscreenCanvasSupported() {
31445    return shadow(this, "isOffscreenCanvasSupported", typeof OffscreenCanvas !== "undefined");
31446  }
31447  static get platform() {
31448    if (typeof navigator === "undefined") {
31449      return shadow(this, "platform", {
31450        isWin: false,
31451        isMac: false
31452      });
31453    }
31454    return shadow(this, "platform", {
31455      isWin: navigator.platform.includes("Win"),
31456      isMac: navigator.platform.includes("Mac")
31457    });
31458  }
31459  static get isCSSRoundSupported() {
31460    return shadow(this, "isCSSRoundSupported", globalThis.CSS?.supports?.("width: round(1.5px, 1px)"));
31461  }
31462}
31463exports.FeatureTest = FeatureTest;
31464const hexNumbers = [...Array(256).keys()].map(n => n.toString(16).padStart(2, "0"));
31465class Util {
31466  static makeHexColor(r, g, b) {
31467    return `#${hexNumbers[r]}${hexNumbers[g]}${hexNumbers[b]}`;
31468  }
31469  static scaleMinMax(transform, minMax) {
31470    let temp;
31471    if (transform[0]) {
31472      if (transform[0] < 0) {
31473        temp = minMax[0];
31474        minMax[0] = minMax[1];
31475        minMax[1] = temp;
31476      }
31477      minMax[0] *= transform[0];
31478      minMax[1] *= transform[0];
31479      if (transform[3] < 0) {
31480        temp = minMax[2];
31481        minMax[2] = minMax[3];
31482        minMax[3] = temp;
31483      }
31484      minMax[2] *= transform[3];
31485      minMax[3] *= transform[3];
31486    } else {
31487      temp = minMax[0];
31488      minMax[0] = minMax[2];
31489      minMax[2] = temp;
31490      temp = minMax[1];
31491      minMax[1] = minMax[3];
31492      minMax[3] = temp;
31493      if (transform[1] < 0) {
31494        temp = minMax[2];
31495        minMax[2] = minMax[3];
31496        minMax[3] = temp;
31497      }
31498      minMax[2] *= transform[1];
31499      minMax[3] *= transform[1];
31500      if (transform[2] < 0) {
31501        temp = minMax[0];
31502        minMax[0] = minMax[1];
31503        minMax[1] = temp;
31504      }
31505      minMax[0] *= transform[2];
31506      minMax[1] *= transform[2];
31507    }
31508    minMax[0] += transform[4];
31509    minMax[1] += transform[4];
31510    minMax[2] += transform[5];
31511    minMax[3] += transform[5];
31512  }
31513  static transform(m1, m2) {
31514    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]];
31515  }
31516  static applyTransform(p, m) {
31517    const xt = p[0] * m[0] + p[1] * m[2] + m[4];
31518    const yt = p[0] * m[1] + p[1] * m[3] + m[5];
31519    return [xt, yt];
31520  }
31521  static applyInverseTransform(p, m) {
31522    const d = m[0] * m[3] - m[1] * m[2];
31523    const xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
31524    const yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
31525    return [xt, yt];
31526  }
31527  static getAxialAlignedBoundingBox(r, m) {
31528    const p1 = this.applyTransform(r, m);
31529    const p2 = this.applyTransform(r.slice(2, 4), m);
31530    const p3 = this.applyTransform([r[0], r[3]], m);
31531    const p4 = this.applyTransform([r[2], r[1]], m);
31532    return [Math.min(p1[0], p2[0], p3[0], p4[0]), Math.min(p1[1], p2[1], p3[1], p4[1]), Math.max(p1[0], p2[0], p3[0], p4[0]), Math.max(p1[1], p2[1], p3[1], p4[1])];
31533  }
31534  static inverseTransform(m) {
31535    const d = m[0] * m[3] - m[1] * m[2];
31536    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];
31537  }
31538  static singularValueDecompose2dScale(m) {
31539    const transpose = [m[0], m[2], m[1], m[3]];
31540    const a = m[0] * transpose[0] + m[1] * transpose[2];
31541    const b = m[0] * transpose[1] + m[1] * transpose[3];
31542    const c = m[2] * transpose[0] + m[3] * transpose[2];
31543    const d = m[2] * transpose[1] + m[3] * transpose[3];
31544    const first = (a + d) / 2;
31545    const second = Math.sqrt((a + d) ** 2 - 4 * (a * d - c * b)) / 2;
31546    const sx = first + second || 1;
31547    const sy = first - second || 1;
31548    return [Math.sqrt(sx), Math.sqrt(sy)];
31549  }
31550  static normalizeRect(rect) {
31551    const r = rect.slice(0);
31552    if (rect[0] > rect[2]) {
31553      r[0] = rect[2];
31554      r[2] = rect[0];
31555    }
31556    if (rect[1] > rect[3]) {
31557      r[1] = rect[3];
31558      r[3] = rect[1];
31559    }
31560    return r;
31561  }
31562  static intersect(rect1, rect2) {
31563    const xLow = Math.max(Math.min(rect1[0], rect1[2]), Math.min(rect2[0], rect2[2]));
31564    const xHigh = Math.min(Math.max(rect1[0], rect1[2]), Math.max(rect2[0], rect2[2]));
31565    if (xLow > xHigh) {
31566      return null;
31567    }
31568    const yLow = Math.max(Math.min(rect1[1], rect1[3]), Math.min(rect2[1], rect2[3]));
31569    const yHigh = Math.min(Math.max(rect1[1], rect1[3]), Math.max(rect2[1], rect2[3]));
31570    if (yLow > yHigh) {
31571      return null;
31572    }
31573    return [xLow, yLow, xHigh, yHigh];
31574  }
31575  static bezierBoundingBox(x0, y0, x1, y1, x2, y2, x3, y3) {
31576    const tvalues = [],
31577      bounds = [[], []];
31578    let a, b, c, t, t1, t2, b2ac, sqrtb2ac;
31579    for (let i = 0; i < 2; ++i) {
31580      if (i === 0) {
31581        b = 6 * x0 - 12 * x1 + 6 * x2;
31582        a = -3 * x0 + 9 * x1 - 9 * x2 + 3 * x3;
31583        c = 3 * x1 - 3 * x0;
31584      } else {
31585        b = 6 * y0 - 12 * y1 + 6 * y2;
31586        a = -3 * y0 + 9 * y1 - 9 * y2 + 3 * y3;
31587        c = 3 * y1 - 3 * y0;
31588      }
31589      if (Math.abs(a) < 1e-12) {
31590        if (Math.abs(b) < 1e-12) {
31591          continue;
31592        }
31593        t = -c / b;
31594        if (0 < t && t < 1) {
31595          tvalues.push(t);
31596        }
31597        continue;
31598      }
31599      b2ac = b * b - 4 * c * a;
31600      sqrtb2ac = Math.sqrt(b2ac);
31601      if (b2ac < 0) {
31602        continue;
31603      }
31604      t1 = (-b + sqrtb2ac) / (2 * a);
31605      if (0 < t1 && t1 < 1) {
31606        tvalues.push(t1);
31607      }
31608      t2 = (-b - sqrtb2ac) / (2 * a);
31609      if (0 < t2 && t2 < 1) {
31610        tvalues.push(t2);
31611      }
31612    }
31613    let j = tvalues.length,
31614      mt;
31615    const jlen = j;
31616    while (j--) {
31617      t = tvalues[j];
31618      mt = 1 - t;
31619      bounds[0][j] = mt * mt * mt * x0 + 3 * mt * mt * t * x1 + 3 * mt * t * t * x2 + t * t * t * x3;
31620      bounds[1][j] = mt * mt * mt * y0 + 3 * mt * mt * t * y1 + 3 * mt * t * t * y2 + t * t * t * y3;
31621    }
31622    bounds[0][jlen] = x0;
31623    bounds[1][jlen] = y0;
31624    bounds[0][jlen + 1] = x3;
31625    bounds[1][jlen + 1] = y3;
31626    bounds[0].length = bounds[1].length = jlen + 2;
31627    return [Math.min(...bounds[0]), Math.min(...bounds[1]), Math.max(...bounds[0]), Math.max(...bounds[1])];
31628  }
31629}
31630exports.Util = Util;
31631const 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];
31632function stringToPDFString(str) {
31633  if (str[0] >= "\xEF") {
31634    let encoding;
31635    if (str[0] === "\xFE" && str[1] === "\xFF") {
31636      encoding = "utf-16be";
31637    } else if (str[0] === "\xFF" && str[1] === "\xFE") {
31638      encoding = "utf-16le";
31639    } else if (str[0] === "\xEF" && str[1] === "\xBB" && str[2] === "\xBF") {
31640      encoding = "utf-8";
31641    }
31642    if (encoding) {
31643      try {
31644        const decoder = new TextDecoder(encoding, {
31645          fatal: true
31646        });
31647        const buffer = stringToBytes(str);
31648        return decoder.decode(buffer);
31649      } catch (ex) {
31650        warn(`stringToPDFString: "${ex}".`);
31651      }
31652    }
31653  }
31654  const strBuf = [];
31655  for (let i = 0, ii = str.length; i < ii; i++) {
31656    const code = PDFStringTranslateTable[str.charCodeAt(i)];
31657    strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));
31658  }
31659  return strBuf.join("");
31660}
31661function stringToUTF8String(str) {
31662  return decodeURIComponent(escape(str));
31663}
31664function utf8StringToString(str) {
31665  return unescape(encodeURIComponent(str));
31666}
31667function isArrayBuffer(v) {
31668  return typeof v === "object" && v?.byteLength !== undefined;
31669}
31670function isArrayEqual(arr1, arr2) {
31671  if (arr1.length !== arr2.length) {
31672    return false;
31673  }
31674  for (let i = 0, ii = arr1.length; i < ii; i++) {
31675    if (arr1[i] !== arr2[i]) {
31676      return false;
31677    }
31678  }
31679  return true;
31680}
31681function getModificationDate(date = new Date()) {
31682  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")];
31683  return buffer.join("");
31684}
31685class PromiseCapability {
31686  #settled = false;
31687  constructor() {
31688    this.promise = new Promise((resolve, reject) => {
31689      this.resolve = data => {
31690        this.#settled = true;
31691        resolve(data);
31692      };
31693      this.reject = reason => {
31694        this.#settled = true;
31695        reject(reason);
31696      };
31697    });
31698  }
31699  get settled() {
31700    return this.#settled;
31701  }
31702}
31703exports.PromiseCapability = PromiseCapability;
31704let NormalizeRegex = null;
31705let NormalizationMap = null;
31706function normalizeUnicode(str) {
31707  if (!NormalizeRegex) {
31708    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;
31709    NormalizationMap = new Map([["ſt", "ſt"]]);
31710  }
31711  return str.replaceAll(NormalizeRegex, (_, p1, p2) => {
31712    return p1 ? p1.normalize("NFKC") : NormalizationMap.get(p2);
31713  });
31714}
31715function getUuid() {
31716  if (typeof crypto !== "undefined" && typeof crypto?.randomUUID === "function") {
31717    return crypto.randomUUID();
31718  }
31719  const buf = new Uint8Array(32);
31720  if (typeof crypto !== "undefined" && typeof crypto?.getRandomValues === "function") {
31721    crypto.getRandomValues(buf);
31722  } else {
31723    for (let i = 0; i < 32; i++) {
31724      buf[i] = Math.floor(Math.random() * 255);
31725    }
31726  }
31727  return bytesToString(buf);
31728}
31729const AnnotationPrefix = "pdfjs_internal_id_";
31730exports.AnnotationPrefix = AnnotationPrefix;
31731
31732/***/ }),
31733/* 3 */
31734/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
31735
31736
31737
31738Object.defineProperty(exports, "__esModule", ({
31739  value: true
31740}));
31741exports.XRefParseException = exports.XRefEntryException = exports.ParserEOFException = exports.PDF_VERSION_REGEXP = exports.MissingDataException = void 0;
31742exports.arrayBuffersToBytes = arrayBuffersToBytes;
31743exports.collectActions = collectActions;
31744exports.encodeToXmlString = encodeToXmlString;
31745exports.escapePDFName = escapePDFName;
31746exports.escapeString = escapeString;
31747exports.getInheritableProperty = getInheritableProperty;
31748exports.getLookupTableFactory = getLookupTableFactory;
31749exports.getNewAnnotationsMap = getNewAnnotationsMap;
31750exports.getRotationMatrix = getRotationMatrix;
31751exports.isAscii = isAscii;
31752exports.isWhiteSpace = isWhiteSpace;
31753exports.log2 = log2;
31754exports.numberToString = numberToString;
31755exports.parseXFAPath = parseXFAPath;
31756exports.readInt8 = readInt8;
31757exports.readUint16 = readUint16;
31758exports.readUint32 = readUint32;
31759exports.recoverJsURL = recoverJsURL;
31760exports.stringToUTF16HexString = stringToUTF16HexString;
31761exports.stringToUTF16String = stringToUTF16String;
31762exports.toRomanNumerals = toRomanNumerals;
31763exports.validateCSSFont = validateCSSFont;
31764exports.validateFontName = validateFontName;
31765var _util = __w_pdfjs_require__(2);
31766var _primitives = __w_pdfjs_require__(4);
31767var _base_stream = __w_pdfjs_require__(5);
31768const PDF_VERSION_REGEXP = /^[1-9]\.\d$/;
31769exports.PDF_VERSION_REGEXP = PDF_VERSION_REGEXP;
31770function getLookupTableFactory(initializer) {
31771  let lookup;
31772  return function () {
31773    if (initializer) {
31774      lookup = Object.create(null);
31775      initializer(lookup);
31776      initializer = null;
31777    }
31778    return lookup;
31779  };
31780}
31781class MissingDataException extends _util.BaseException {
31782  constructor(begin, end) {
31783    super(`Missing data [${begin}, ${end})`, "MissingDataException");
31784    this.begin = begin;
31785    this.end = end;
31786  }
31787}
31788exports.MissingDataException = MissingDataException;
31789class ParserEOFException extends _util.BaseException {
31790  constructor(msg) {
31791    super(msg, "ParserEOFException");
31792  }
31793}
31794exports.ParserEOFException = ParserEOFException;
31795class XRefEntryException extends _util.BaseException {
31796  constructor(msg) {
vendor: 29,220 bytes, lines 31797-32861
31797    super(msg, "XRefEntryException");
31798  }
31799}
31800exports.XRefEntryException = XRefEntryException;
31801class XRefParseException extends _util.BaseException {
31802  constructor(msg) {
31803    super(msg, "XRefParseException");
31804  }
31805}
31806exports.XRefParseException = XRefParseException;
31807function arrayBuffersToBytes(arr) {
31808  const length = arr.length;
31809  if (length === 0) {
31810    return new Uint8Array(0);
31811  }
31812  if (length === 1) {
31813    return new Uint8Array(arr[0]);
31814  }
31815  let dataLength = 0;
31816  for (let i = 0; i < length; i++) {
31817    dataLength += arr[i].byteLength;
31818  }
31819  const data = new Uint8Array(dataLength);
31820  let pos = 0;
31821  for (let i = 0; i < length; i++) {
31822    const item = new Uint8Array(arr[i]);
31823    data.set(item, pos);
31824    pos += item.byteLength;
31825  }
31826  return data;
31827}
31828function getInheritableProperty({
31829  dict,
31830  key,
31831  getArray = false,
31832  stopWhenFound = true
31833}) {
31834  let values;
31835  const visited = new _primitives.RefSet();
31836  while (dict instanceof _primitives.Dict && !(dict.objId && visited.has(dict.objId))) {
31837    if (dict.objId) {
31838      visited.put(dict.objId);
31839    }
31840    const value = getArray ? dict.getArray(key) : dict.get(key);
31841    if (value !== undefined) {
31842      if (stopWhenFound) {
31843        return value;
31844      }
31845      (values ||= []).push(value);
31846    }
31847    dict = dict.get("Parent");
31848  }
31849  return values;
31850}
31851const 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"];
31852function toRomanNumerals(number, lowerCase = false) {
31853  (0, _util.assert)(Number.isInteger(number) && number > 0, "The number should be a positive integer.");
31854  const romanBuf = [];
31855  let pos;
31856  while (number >= 1000) {
31857    number -= 1000;
31858    romanBuf.push("M");
31859  }
31860  pos = number / 100 | 0;
31861  number %= 100;
31862  romanBuf.push(ROMAN_NUMBER_MAP[pos]);
31863  pos = number / 10 | 0;
31864  number %= 10;
31865  romanBuf.push(ROMAN_NUMBER_MAP[10 + pos]);
31866  romanBuf.push(ROMAN_NUMBER_MAP[20 + number]);
31867  const romanStr = romanBuf.join("");
31868  return lowerCase ? romanStr.toLowerCase() : romanStr;
31869}
31870function log2(x) {
31871  if (x <= 0) {
31872    return 0;
31873  }
31874  return Math.ceil(Math.log2(x));
31875}
31876function readInt8(data, offset) {
31877  return data[offset] << 24 >> 24;
31878}
31879function readUint16(data, offset) {
31880  return data[offset] << 8 | data[offset + 1];
31881}
31882function readUint32(data, offset) {
31883  return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
31884}
31885function isWhiteSpace(ch) {
31886  return ch === 0x20 || ch === 0x09 || ch === 0x0d || ch === 0x0a;
31887}
31888function parseXFAPath(path) {
31889  const positionPattern = /(.+)\[(\d+)\]$/;
31890  return path.split(".").map(component => {
31891    const m = component.match(positionPattern);
31892    if (m) {
31893      return {
31894        name: m[1],
31895        pos: parseInt(m[2], 10)
31896      };
31897    }
31898    return {
31899      name: component,
31900      pos: 0
31901    };
31902  });
31903}
31904function escapePDFName(str) {
31905  const buffer = [];
31906  let start = 0;
31907  for (let i = 0, ii = str.length; i < ii; i++) {
31908    const char = str.charCodeAt(i);
31909    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) {
31910      if (start < i) {
31911        buffer.push(str.substring(start, i));
31912      }
31913      buffer.push(`#${char.toString(16)}`);
31914      start = i + 1;
31915    }
31916  }
31917  if (buffer.length === 0) {
31918    return str;
31919  }
31920  if (start < str.length) {
31921    buffer.push(str.substring(start, str.length));
31922  }
31923  return buffer.join("");
31924}
31925function escapeString(str) {
31926  return str.replaceAll(/([()\\\n\r])/g, match => {
31927    if (match === "\n") {
31928      return "\\n";
31929    } else if (match === "\r") {
31930      return "\\r";
31931    }
31932    return `\\${match}`;
31933  });
31934}
31935function _collectJS(entry, xref, list, parents) {
31936  if (!entry) {
31937    return;
31938  }
31939  let parent = null;
31940  if (entry instanceof _primitives.Ref) {
31941    if (parents.has(entry)) {
31942      return;
31943    }
31944    parent = entry;
31945    parents.put(parent);
31946    entry = xref.fetch(entry);
31947  }
31948  if (Array.isArray(entry)) {
31949    for (const element of entry) {
31950      _collectJS(element, xref, list, parents);
31951    }
31952  } else if (entry instanceof _primitives.Dict) {
31953    if ((0, _primitives.isName)(entry.get("S"), "JavaScript")) {
31954      const js = entry.get("JS");
31955      let code;
31956      if (js instanceof _base_stream.BaseStream) {
31957        code = js.getString();
31958      } else if (typeof js === "string") {
31959        code = js;
31960      }
31961      code &&= (0, _util.stringToPDFString)(code).replaceAll("\x00", "");
31962      if (code) {
31963        list.push(code);
31964      }
31965    }
31966    _collectJS(entry.getRaw("Next"), xref, list, parents);
31967  }
31968  if (parent) {
31969    parents.remove(parent);
31970  }
31971}
31972function collectActions(xref, dict, eventType) {
31973  const actions = Object.create(null);
31974  const additionalActionsDicts = getInheritableProperty({
31975    dict,
31976    key: "AA",
31977    stopWhenFound: false
31978  });
31979  if (additionalActionsDicts) {
31980    for (let i = additionalActionsDicts.length - 1; i >= 0; i--) {
31981      const additionalActions = additionalActionsDicts[i];
31982      if (!(additionalActions instanceof _primitives.Dict)) {
31983        continue;
31984      }
31985      for (const key of additionalActions.getKeys()) {
31986        const action = eventType[key];
31987        if (!action) {
31988          continue;
31989        }
31990        const actionDict = additionalActions.getRaw(key);
31991        const parents = new _primitives.RefSet();
31992        const list = [];
31993        _collectJS(actionDict, xref, list, parents);
31994        if (list.length > 0) {
31995          actions[action] = list;
31996        }
31997      }
31998    }
31999  }
32000  if (dict.has("A")) {
32001    const actionDict = dict.get("A");
32002    const parents = new _primitives.RefSet();
32003    const list = [];
32004    _collectJS(actionDict, xref, list, parents);
32005    if (list.length > 0) {
32006      actions.Action = list;
32007    }
32008  }
32009  return (0, _util.objectSize)(actions) > 0 ? actions : null;
32010}
32011const XMLEntities = {
32012  0x3c: "&lt;",
32013  0x3e: "&gt;",
32014  0x26: "&amp;",
32015  0x22: "&quot;",
32016  0x27: "&apos;"
32017};
32018function encodeToXmlString(str) {
32019  const buffer = [];
32020  let start = 0;
32021  for (let i = 0, ii = str.length; i < ii; i++) {
32022    const char = str.codePointAt(i);
32023    if (0x20 <= char && char <= 0x7e) {
32024      const entity = XMLEntities[char];
32025      if (entity) {
32026        if (start < i) {
32027          buffer.push(str.substring(start, i));
32028        }
32029        buffer.push(entity);
32030        start = i + 1;
32031      }
32032    } else {
32033      if (start < i) {
32034        buffer.push(str.substring(start, i));
32035      }
32036      buffer.push(`&#x${char.toString(16).toUpperCase()};`);
32037      if (char > 0xd7ff && (char < 0xe000 || char > 0xfffd)) {
32038        i++;
32039      }
32040      start = i + 1;
32041    }
32042  }
32043  if (buffer.length === 0) {
32044    return str;
32045  }
32046  if (start < str.length) {
32047    buffer.push(str.substring(start, str.length));
32048  }
32049  return buffer.join("");
32050}
32051function validateFontName(fontFamily, mustWarn = false) {
32052  const m = /^("|').*("|')$/.exec(fontFamily);
32053  if (m && m[1] === m[2]) {
32054    const re = new RegExp(`[^\\\\]${m[1]}`);
32055    if (re.test(fontFamily.slice(1, -1))) {
32056      if (mustWarn) {
32057        (0, _util.warn)(`FontFamily contains unescaped ${m[1]}: ${fontFamily}.`);
32058      }
32059      return false;
32060    }
32061  } else {
32062    for (const ident of fontFamily.split(/[ \t]+/)) {
32063      if (/^(\d|(-(\d|-)))/.test(ident) || !/^[\w-\\]+$/.test(ident)) {
32064        if (mustWarn) {
32065          (0, _util.warn)(`FontFamily contains invalid <custom-ident>: ${fontFamily}.`);
32066        }
32067        return false;
32068      }
32069    }
32070  }
32071  return true;
32072}
32073function validateCSSFont(cssFontInfo) {
32074  const DEFAULT_CSS_FONT_OBLIQUE = "14";
32075  const DEFAULT_CSS_FONT_WEIGHT = "400";
32076  const CSS_FONT_WEIGHT_VALUES = new Set(["100", "200", "300", "400", "500", "600", "700", "800", "900", "1000", "normal", "bold", "bolder", "lighter"]);
32077  const {
32078    fontFamily,
32079    fontWeight,
32080    italicAngle
32081  } = cssFontInfo;
32082  if (!validateFontName(fontFamily, true)) {
32083    return false;
32084  }
32085  const weight = fontWeight ? fontWeight.toString() : "";
32086  cssFontInfo.fontWeight = CSS_FONT_WEIGHT_VALUES.has(weight) ? weight : DEFAULT_CSS_FONT_WEIGHT;
32087  const angle = parseFloat(italicAngle);
32088  cssFontInfo.italicAngle = isNaN(angle) || angle < -90 || angle > 90 ? DEFAULT_CSS_FONT_OBLIQUE : italicAngle.toString();
32089  return true;
32090}
32091function recoverJsURL(str) {
32092  const URL_OPEN_METHODS = ["app.launchURL", "window.open", "xfa.host.gotoURL"];
32093  const regex = new RegExp("^\\s*(" + URL_OPEN_METHODS.join("|").replaceAll(".", "\\.") + ")\\((?:'|\")([^'\"]*)(?:'|\")(?:,\\s*(\\w+)\\)|\\))", "i");
32094  const jsUrl = regex.exec(str);
32095  if (jsUrl?.[2]) {
32096    const url = jsUrl[2];
32097    let newWindow = false;
32098    if (jsUrl[3] === "true" && jsUrl[1] === "app.launchURL") {
32099      newWindow = true;
32100    }
32101    return {
32102      url,
32103      newWindow
32104    };
32105  }
32106  return null;
32107}
32108function numberToString(value) {
32109  if (Number.isInteger(value)) {
32110    return value.toString();
32111  }
32112  const roundedValue = Math.round(value * 100);
32113  if (roundedValue % 100 === 0) {
32114    return (roundedValue / 100).toString();
32115  }
32116  if (roundedValue % 10 === 0) {
32117    return value.toFixed(1);
32118  }
32119  return value.toFixed(2);
32120}
32121function getNewAnnotationsMap(annotationStorage) {
32122  if (!annotationStorage) {
32123    return null;
32124  }
32125  const newAnnotationsByPage = new Map();
32126  for (const [key, value] of annotationStorage) {
32127    if (!key.startsWith(_util.AnnotationEditorPrefix)) {
32128      continue;
32129    }
32130    let annotations = newAnnotationsByPage.get(value.pageIndex);
32131    if (!annotations) {
32132      annotations = [];
32133      newAnnotationsByPage.set(value.pageIndex, annotations);
32134    }
32135    annotations.push(value);
32136  }
32137  return newAnnotationsByPage.size > 0 ? newAnnotationsByPage : null;
32138}
32139function isAscii(str) {
32140  return /^[\x00-\x7F]*$/.test(str);
32141}
32142function stringToUTF16HexString(str) {
32143  const buf = [];
32144  for (let i = 0, ii = str.length; i < ii; i++) {
32145    const char = str.charCodeAt(i);
32146    buf.push((char >> 8 & 0xff).toString(16).padStart(2, "0"), (char & 0xff).toString(16).padStart(2, "0"));
32147  }
32148  return buf.join("");
32149}
32150function stringToUTF16String(str, bigEndian = false) {
32151  const buf = [];
32152  if (bigEndian) {
32153    buf.push("\xFE\xFF");
32154  }
32155  for (let i = 0, ii = str.length; i < ii; i++) {
32156    const char = str.charCodeAt(i);
32157    buf.push(String.fromCharCode(char >> 8 & 0xff), String.fromCharCode(char & 0xff));
32158  }
32159  return buf.join("");
32160}
32161function getRotationMatrix(rotation, width, height) {
32162  switch (rotation) {
32163    case 90:
32164      return [0, 1, -1, 0, width, 0];
32165    case 180:
32166      return [-1, 0, 0, -1, width, height];
32167    case 270:
32168      return [0, -1, 1, 0, 0, height];
32169    default:
32170      throw new Error("Invalid rotation");
32171  }
32172}
32173
32174/***/ }),
32175/* 4 */
32176/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
32177
32178
32179
32180Object.defineProperty(exports, "__esModule", ({
32181  value: true
32182}));
32183exports.RefSetCache = exports.RefSet = exports.Ref = exports.Name = exports.EOF = exports.Dict = exports.Cmd = exports.CIRCULAR_REF = void 0;
32184exports.clearPrimitiveCaches = clearPrimitiveCaches;
32185exports.isCmd = isCmd;
32186exports.isDict = isDict;
32187exports.isName = isName;
32188exports.isRefsEqual = isRefsEqual;
32189var _util = __w_pdfjs_require__(2);
32190const CIRCULAR_REF = Symbol("CIRCULAR_REF");
32191exports.CIRCULAR_REF = CIRCULAR_REF;
32192const EOF = Symbol("EOF");
32193exports.EOF = EOF;
32194let CmdCache = Object.create(null);
32195let NameCache = Object.create(null);
32196let RefCache = Object.create(null);
32197function clearPrimitiveCaches() {
32198  CmdCache = Object.create(null);
32199  NameCache = Object.create(null);
32200  RefCache = Object.create(null);
32201}
32202class Name {
32203  constructor(name) {
32204    this.name = name;
32205  }
32206  static get(name) {
32207    return NameCache[name] ||= new Name(name);
32208  }
32209}
32210exports.Name = Name;
32211class Cmd {
32212  constructor(cmd) {
32213    this.cmd = cmd;
32214  }
32215  static get(cmd) {
32216    return CmdCache[cmd] ||= new Cmd(cmd);
32217  }
32218}
32219exports.Cmd = Cmd;
32220const nonSerializable = function nonSerializableClosure() {
32221  return nonSerializable;
32222};
32223class Dict {
32224  constructor(xref = null) {
32225    this._map = Object.create(null);
32226    this.xref = xref;
32227    this.objId = null;
32228    this.suppressEncryption = false;
32229    this.__nonSerializable__ = nonSerializable;
32230  }
32231  assignXref(newXref) {
32232    this.xref = newXref;
32233  }
32234  get size() {
32235    return Object.keys(this._map).length;
32236  }
32237  get(key1, key2, key3) {
32238    let value = this._map[key1];
32239    if (value === undefined && key2 !== undefined) {
32240      value = this._map[key2];
32241      if (value === undefined && key3 !== undefined) {
32242        value = this._map[key3];
32243      }
32244    }
32245    if (value instanceof Ref && this.xref) {
32246      return this.xref.fetch(value, this.suppressEncryption);
32247    }
32248    return value;
32249  }
32250  async getAsync(key1, key2, key3) {
32251    let value = this._map[key1];
32252    if (value === undefined && key2 !== undefined) {
32253      value = this._map[key2];
32254      if (value === undefined && key3 !== undefined) {
32255        value = this._map[key3];
32256      }
32257    }
32258    if (value instanceof Ref && this.xref) {
32259      return this.xref.fetchAsync(value, this.suppressEncryption);
32260    }
32261    return value;
32262  }
32263  getArray(key1, key2, key3) {
32264    let value = this._map[key1];
32265    if (value === undefined && key2 !== undefined) {
32266      value = this._map[key2];
32267      if (value === undefined && key3 !== undefined) {
32268        value = this._map[key3];
32269      }
32270    }
32271    if (value instanceof Ref && this.xref) {
32272      value = this.xref.fetch(value, this.suppressEncryption);
32273    }
32274    if (Array.isArray(value)) {
32275      value = value.slice();
32276      for (let i = 0, ii = value.length; i < ii; i++) {
32277        if (value[i] instanceof Ref && this.xref) {
32278          value[i] = this.xref.fetch(value[i], this.suppressEncryption);
32279        }
32280      }
32281    }
32282    return value;
32283  }
32284  getRaw(key) {
32285    return this._map[key];
32286  }
32287  getKeys() {
32288    return Object.keys(this._map);
32289  }
32290  getRawValues() {
32291    return Object.values(this._map);
32292  }
32293  set(key, value) {
32294    this._map[key] = value;
32295  }
32296  has(key) {
32297    return this._map[key] !== undefined;
32298  }
32299  forEach(callback) {
32300    for (const key in this._map) {
32301      callback(key, this.get(key));
32302    }
32303  }
32304  static get empty() {
32305    const emptyDict = new Dict(null);
32306    emptyDict.set = (key, value) => {
32307      (0, _util.unreachable)("Should not call `set` on the empty dictionary.");
32308    };
32309    return (0, _util.shadow)(this, "empty", emptyDict);
32310  }
32311  static merge({
32312    xref,
32313    dictArray,
32314    mergeSubDicts = false
32315  }) {
32316    const mergedDict = new Dict(xref),
32317      properties = new Map();
32318    for (const dict of dictArray) {
32319      if (!(dict instanceof Dict)) {
32320        continue;
32321      }
32322      for (const [key, value] of Object.entries(dict._map)) {
32323        let property = properties.get(key);
32324        if (property === undefined) {
32325          property = [];
32326          properties.set(key, property);
32327        } else if (!mergeSubDicts || !(value instanceof Dict)) {
32328          continue;
32329        }
32330        property.push(value);
32331      }
32332    }
32333    for (const [name, values] of properties) {
32334      if (values.length === 1 || !(values[0] instanceof Dict)) {
32335        mergedDict._map[name] = values[0];
32336        continue;
32337      }
32338      const subDict = new Dict(xref);
32339      for (const dict of values) {
32340        for (const [key, value] of Object.entries(dict._map)) {
32341          if (subDict._map[key] === undefined) {
32342            subDict._map[key] = value;
32343          }
32344        }
32345      }
32346      if (subDict.size > 0) {
32347        mergedDict._map[name] = subDict;
32348      }
32349    }
32350    properties.clear();
32351    return mergedDict.size > 0 ? mergedDict : Dict.empty;
32352  }
32353  clone() {
32354    const dict = new Dict(this.xref);
32355    for (const key of this.getKeys()) {
32356      dict.set(key, this.getRaw(key));
32357    }
32358    return dict;
32359  }
32360}
32361exports.Dict = Dict;
32362class Ref {
32363  constructor(num, gen) {
32364    this.num = num;
32365    this.gen = gen;
32366  }
32367  toString() {
32368    if (this.gen === 0) {
32369      return `${this.num}R`;
32370    }
32371    return `${this.num}R${this.gen}`;
32372  }
32373  static fromString(str) {
32374    const ref = RefCache[str];
32375    if (ref) {
32376      return ref;
32377    }
32378    const m = /^(\d+)R(\d*)$/.exec(str);
32379    if (!m || m[1] === "0") {
32380      return null;
32381    }
32382    return RefCache[str] = new Ref(parseInt(m[1]), !m[2] ? 0 : parseInt(m[2]));
32383  }
32384  static get(num, gen) {
32385    const key = gen === 0 ? `${num}R` : `${num}R${gen}`;
32386    return RefCache[key] ||= new Ref(num, gen);
32387  }
32388}
32389exports.Ref = Ref;
32390class RefSet {
32391  constructor(parent = null) {
32392    this._set = new Set(parent?._set);
32393  }
32394  has(ref) {
32395    return this._set.has(ref.toString());
32396  }
32397  put(ref) {
32398    this._set.add(ref.toString());
32399  }
32400  remove(ref) {
32401    this._set.delete(ref.toString());
32402  }
32403  [Symbol.iterator]() {
32404    return this._set.values();
32405  }
32406  clear() {
32407    this._set.clear();
32408  }
32409}
32410exports.RefSet = RefSet;
32411class RefSetCache {
32412  constructor() {
32413    this._map = new Map();
32414  }
32415  get size() {
32416    return this._map.size;
32417  }
32418  get(ref) {
32419    return this._map.get(ref.toString());
32420  }
32421  has(ref) {
32422    return this._map.has(ref.toString());
32423  }
32424  put(ref, obj) {
32425    this._map.set(ref.toString(), obj);
32426  }
32427  putAlias(ref, aliasRef) {
32428    this._map.set(ref.toString(), this.get(aliasRef));
32429  }
32430  [Symbol.iterator]() {
32431    return this._map.values();
32432  }
32433  clear() {
32434    this._map.clear();
32435  }
32436}
32437exports.RefSetCache = RefSetCache;
32438function isName(v, name) {
32439  return v instanceof Name && (name === undefined || v.name === name);
32440}
32441function isCmd(v, cmd) {
32442  return v instanceof Cmd && (cmd === undefined || v.cmd === cmd);
32443}
32444function isDict(v, type) {
32445  return v instanceof Dict && (type === undefined || isName(v.get("Type"), type));
32446}
32447function isRefsEqual(v1, v2) {
32448  return v1.num === v2.num && v1.gen === v2.gen;
32449}
32450
32451/***/ }),
32452/* 5 */
32453/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
32454
32455
32456
32457Object.defineProperty(exports, "__esModule", ({
32458  value: true
32459}));
32460exports.BaseStream = void 0;
32461var _util = __w_pdfjs_require__(2);
32462class BaseStream {
32463  constructor() {
32464    if (this.constructor === BaseStream) {
32465      (0, _util.unreachable)("Cannot initialize BaseStream.");
32466    }
32467  }
32468  get length() {
32469    (0, _util.unreachable)("Abstract getter `length` accessed");
32470  }
32471  get isEmpty() {
32472    (0, _util.unreachable)("Abstract getter `isEmpty` accessed");
32473  }
32474  get isDataLoaded() {
32475    return (0, _util.shadow)(this, "isDataLoaded", true);
32476  }
32477  getByte() {
32478    (0, _util.unreachable)("Abstract method `getByte` called");
32479  }
32480  getBytes(length) {
32481    (0, _util.unreachable)("Abstract method `getBytes` called");
32482  }
32483  peekByte() {
32484    const peekedByte = this.getByte();
32485    if (peekedByte !== -1) {
32486      this.pos--;
32487    }
32488    return peekedByte;
32489  }
32490  peekBytes(length) {
32491    const bytes = this.getBytes(length);
32492    this.pos -= bytes.length;
32493    return bytes;
32494  }
32495  getUint16() {
32496    const b0 = this.getByte();
32497    const b1 = this.getByte();
32498    if (b0 === -1 || b1 === -1) {
32499      return -1;
32500    }
32501    return (b0 << 8) + b1;
32502  }
32503  getInt32() {
32504    const b0 = this.getByte();
32505    const b1 = this.getByte();
32506    const b2 = this.getByte();
32507    const b3 = this.getByte();
32508    return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
32509  }
32510  getByteRange(begin, end) {
32511    (0, _util.unreachable)("Abstract method `getByteRange` called");
32512  }
32513  getString(length) {
32514    return (0, _util.bytesToString)(this.getBytes(length));
32515  }
32516  skip(n) {
32517    this.pos += n || 1;
32518  }
32519  reset() {
32520    (0, _util.unreachable)("Abstract method `reset` called");
32521  }
32522  moveStart() {
32523    (0, _util.unreachable)("Abstract method `moveStart` called");
32524  }
32525  makeSubStream(start, length, dict = null) {
32526    (0, _util.unreachable)("Abstract method `makeSubStream` called");
32527  }
32528  getBaseStreams() {
32529    return null;
32530  }
32531}
32532exports.BaseStream = BaseStream;
32533
32534/***/ }),
32535/* 6 */
32536/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
32537
32538
32539
32540Object.defineProperty(exports, "__esModule", ({
32541  value: true
32542}));
32543exports.NetworkPdfManager = exports.LocalPdfManager = void 0;
32544var _util = __w_pdfjs_require__(2);
32545var _chunked_stream = __w_pdfjs_require__(7);
32546var _core_utils = __w_pdfjs_require__(3);
32547var _document = __w_pdfjs_require__(9);
32548var _stream = __w_pdfjs_require__(8);
32549function parseDocBaseUrl(url) {
32550  if (url) {
32551    const absoluteUrl = (0, _util.createValidAbsoluteUrl)(url);
32552    if (absoluteUrl) {
32553      return absoluteUrl.href;
32554    }
32555    (0, _util.warn)(`Invalid absolute docBaseUrl: "${url}".`);
32556  }
32557  return null;
32558}
32559class BasePdfManager {
32560  constructor(args) {
32561    if (this.constructor === BasePdfManager) {
32562      (0, _util.unreachable)("Cannot initialize BasePdfManager.");
32563    }
32564    this._docBaseUrl = parseDocBaseUrl(args.docBaseUrl);
32565    this._docId = args.docId;
32566    this._password = args.password;
32567    this.enableXfa = args.enableXfa;
32568    args.evaluatorOptions.isOffscreenCanvasSupported &&= _util.FeatureTest.isOffscreenCanvasSupported;
32569    this.evaluatorOptions = args.evaluatorOptions;
32570  }
32571  get docId() {
32572    return this._docId;
32573  }
32574  get password() {
32575    return this._password;
32576  }
32577  get docBaseUrl() {
32578    return this._docBaseUrl;
32579  }
32580  get catalog() {
32581    return this.pdfDocument.catalog;
32582  }
32583  ensureDoc(prop, args) {
32584    return this.ensure(this.pdfDocument, prop, args);
32585  }
32586  ensureXRef(prop, args) {
32587    return this.ensure(this.pdfDocument.xref, prop, args);
32588  }
32589  ensureCatalog(prop, args) {
32590    return this.ensure(this.pdfDocument.catalog, prop, args);
32591  }
32592  getPage(pageIndex) {
32593    return this.pdfDocument.getPage(pageIndex);
32594  }
32595  fontFallback(id, handler) {
32596    return this.pdfDocument.fontFallback(id, handler);
32597  }
32598  loadXfaFonts(handler, task) {
32599    return this.pdfDocument.loadXfaFonts(handler, task);
32600  }
32601  loadXfaImages() {
32602    return this.pdfDocument.loadXfaImages();
32603  }
32604  serializeXfaData(annotationStorage) {
32605    return this.pdfDocument.serializeXfaData(annotationStorage);
32606  }
32607  cleanup(manuallyTriggered = false) {
32608    return this.pdfDocument.cleanup(manuallyTriggered);
32609  }
32610  async ensure(obj, prop, args) {
32611    (0, _util.unreachable)("Abstract method `ensure` called");
32612  }
32613  requestRange(begin, end) {
32614    (0, _util.unreachable)("Abstract method `requestRange` called");
32615  }
32616  requestLoadedStream(noFetch = false) {
32617    (0, _util.unreachable)("Abstract method `requestLoadedStream` called");
32618  }
32619  sendProgressiveData(chunk) {
32620    (0, _util.unreachable)("Abstract method `sendProgressiveData` called");
32621  }
32622  updatePassword(password) {
32623    this._password = password;
32624  }
32625  terminate(reason) {
32626    (0, _util.unreachable)("Abstract method `terminate` called");
32627  }
32628}
32629class LocalPdfManager extends BasePdfManager {
32630  constructor(args) {
32631    super(args);
32632    const stream = new _stream.Stream(args.source);
32633    this.pdfDocument = new _document.PDFDocument(this, stream);
32634    this._loadedStreamPromise = Promise.resolve(stream);
32635  }
32636  async ensure(obj, prop, args) {
32637    const value = obj[prop];
32638    if (typeof value === "function") {
32639      return value.apply(obj, args);
32640    }
32641    return value;
32642  }
32643  requestRange(begin, end) {
32644    return Promise.resolve();
32645  }
32646  requestLoadedStream(noFetch = false) {
32647    return this._loadedStreamPromise;
32648  }
32649  terminate(reason) {}
32650}
32651exports.LocalPdfManager = LocalPdfManager;
32652class NetworkPdfManager extends BasePdfManager {
32653  constructor(args) {
32654    super(args);
32655    this.streamManager = new _chunked_stream.ChunkedStreamManager(args.source, {
32656      msgHandler: args.handler,
32657      length: args.length,
32658      disableAutoFetch: args.disableAutoFetch,
32659      rangeChunkSize: args.rangeChunkSize
32660    });
32661    this.pdfDocument = new _document.PDFDocument(this, this.streamManager.getStream());
32662  }
32663  async ensure(obj, prop, args) {
32664    try {
32665      const value = obj[prop];
32666      if (typeof value === "function") {
32667        return value.apply(obj, args);
32668      }
32669      return value;
32670    } catch (ex) {
32671      if (!(ex instanceof _core_utils.MissingDataException)) {
32672        throw ex;
32673      }
32674      await this.requestRange(ex.begin, ex.end);
32675      return this.ensure(obj, prop, args);
32676    }
32677  }
32678  requestRange(begin, end) {
32679    return this.streamManager.requestRange(begin, end);
32680  }
32681  requestLoadedStream(noFetch = false) {
32682    return this.streamManager.requestAllChunks(noFetch);
32683  }
32684  sendProgressiveData(chunk) {
32685    this.streamManager.onReceiveData({
32686      chunk
32687    });
32688  }
32689  terminate(reason) {
32690    this.streamManager.abort(reason);
32691  }
32692}
32693exports.NetworkPdfManager = NetworkPdfManager;
32694
32695/***/ }),
32696/* 7 */
32697/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
32698
32699
32700
32701Object.defineProperty(exports, "__esModule", ({
32702  value: true
32703}));
32704exports.ChunkedStreamManager = exports.ChunkedStream = void 0;
32705var _core_utils = __w_pdfjs_require__(3);
32706var _util = __w_pdfjs_require__(2);
32707var _stream = __w_pdfjs_require__(8);
32708class ChunkedStream extends _stream.Stream {
32709  constructor(length, chunkSize, manager) {
32710    super(new Uint8Array(length), 0, length, null);
32711    this.chunkSize = chunkSize;
32712    this._loadedChunks = new Set();
32713    this.numChunks = Math.ceil(length / chunkSize);
32714    this.manager = manager;
32715    this.progressiveDataLength = 0;
32716    this.lastSuccessfulEnsureByteChunk = -1;
32717  }
32718  getMissingChunks() {
32719    const chunks = [];
32720    for (let chunk = 0, n = this.numChunks; chunk < n; ++chunk) {
32721      if (!this._loadedChunks.has(chunk)) {
32722        chunks.push(chunk);
32723      }
32724    }
32725    return chunks;
32726  }
32727  get numChunksLoaded() {
32728    return this._loadedChunks.size;
32729  }
32730  get isDataLoaded() {
32731    return this.numChunksLoaded === this.numChunks;
32732  }
32733  onReceiveData(begin, chunk) {
32734    const chunkSize = this.chunkSize;
32735    if (begin % chunkSize !== 0) {
32736      throw new Error(`Bad begin offset: ${begin}`);
32737    }
32738    const end = begin + chunk.byteLength;
32739    if (end % chunkSize !== 0 && end !== this.bytes.length) {
32740      throw new Error(`Bad end offset: ${end}`);
32741    }
32742    this.bytes.set(new Uint8Array(chunk), begin);
32743    const beginChunk = Math.floor(begin / chunkSize);
32744    const endChunk = Math.floor((end - 1) / chunkSize) + 1;
32745    for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
32746      this._loadedChunks.add(curChunk);
32747    }
32748  }
32749  onReceiveProgressiveData(data) {
32750    let position = this.progressiveDataLength;
32751    const beginChunk = Math.floor(position / this.chunkSize);
32752    this.bytes.set(new Uint8Array(data), position);
32753    position += data.byteLength;
32754    this.progressiveDataLength = position;
32755    const endChunk = position >= this.end ? this.numChunks : Math.floor(position / this.chunkSize);
32756    for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
32757      this._loadedChunks.add(curChunk);
32758    }
32759  }
32760  ensureByte(pos) {
32761    if (pos < this.progressiveDataLength) {
32762      return;
32763    }
32764    const chunk = Math.floor(pos / this.chunkSize);
32765    if (chunk > this.numChunks) {
32766      return;
32767    }
32768    if (chunk === this.lastSuccessfulEnsureByteChunk) {
32769      return;
32770    }
32771    if (!this._loadedChunks.has(chunk)) {
32772      throw new _core_utils.MissingDataException(pos, pos + 1);
32773    }
32774    this.lastSuccessfulEnsureByteChunk = chunk;
32775  }
32776  ensureRange(begin, end) {
32777    if (begin >= end) {
32778      return;
32779    }
32780    if (end <= this.progressiveDataLength) {
32781      return;
32782    }
32783    const beginChunk = Math.floor(begin / this.chunkSize);
32784    if (beginChunk > this.numChunks) {
32785      return;
32786    }
32787    const endChunk = Math.min(Math.floor((end - 1) / this.chunkSize) + 1, this.numChunks);
32788    for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
32789      if (!this._loadedChunks.has(chunk)) {
32790        throw new _core_utils.MissingDataException(begin, end);
32791      }
32792    }
32793  }
32794  nextEmptyChunk(beginChunk) {
32795    const numChunks = this.numChunks;
32796    for (let i = 0; i < numChunks; ++i) {
32797      const chunk = (beginChunk + i) % numChunks;
32798      if (!this._loadedChunks.has(chunk)) {
32799        return chunk;
32800      }
32801    }
32802    return null;
32803  }
32804  hasChunk(chunk) {
32805    return this._loadedChunks.has(chunk);
32806  }
32807  getByte() {
32808    const pos = this.pos;
32809    if (pos >= this.end) {
32810      return -1;
32811    }
32812    if (pos >= this.progressiveDataLength) {
32813      this.ensureByte(pos);
32814    }
32815    return this.bytes[this.pos++];
32816  }
32817  getBytes(length) {
32818    const bytes = this.bytes;
32819    const pos = this.pos;
32820    const strEnd = this.end;
32821    if (!length) {
32822      if (strEnd > this.progressiveDataLength) {
32823        this.ensureRange(pos, strEnd);
32824      }
32825      return bytes.subarray(pos, strEnd);
32826    }
32827    let end = pos + length;
32828    if (end > strEnd) {
32829      end = strEnd;
32830    }
32831    if (end > this.progressiveDataLength) {
32832      this.ensureRange(pos, end);
32833    }
32834    this.pos = end;
32835    return bytes.subarray(pos, end);
32836  }
32837  getByteRange(begin, end) {
32838    if (begin < 0) {
32839      begin = 0;
32840    }
32841    if (end > this.end) {
32842      end = this.end;
32843    }
32844    if (end > this.progressiveDataLength) {
32845      this.ensureRange(begin, end);
32846    }
32847    return this.bytes.subarray(begin, end);
32848  }
32849  makeSubStream(start, length, dict = null) {
32850    if (length) {
32851      if (start + length > this.progressiveDataLength) {
32852        this.ensureRange(start, start + length);
32853      }
32854    } else if (start >= this.progressiveDataLength) {
32855      this.ensureByte(start);
32856    }
32857    function ChunkedStreamSubstream() {}
32858    ChunkedStreamSubstream.prototype = Object.create(this);
32859    ChunkedStreamSubstream.prototype.getMissingChunks = function () {
32860      const chunkSize = this.chunkSize;
32861      const beginChunk = Math.floor(this.start / chunkSize);
vendor: 4,276 bytes, lines 32862-33000
32862      const endChunk = Math.floor((this.end - 1) / chunkSize) + 1;
32863      const missingChunks = [];
32864      for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
32865        if (!this._loadedChunks.has(chunk)) {
32866          missingChunks.push(chunk);
32867        }
32868      }
32869      return missingChunks;
32870    };
32871    Object.defineProperty(ChunkedStreamSubstream.prototype, "isDataLoaded", {
32872      get() {
32873        if (this.numChunksLoaded === this.numChunks) {
32874          return true;
32875        }
32876        return this.getMissingChunks().length === 0;
32877      },
32878      configurable: true
32879    });
32880    const subStream = new ChunkedStreamSubstream();
32881    subStream.pos = subStream.start = start;
32882    subStream.end = start + length || this.end;
32883    subStream.dict = dict;
32884    return subStream;
32885  }
32886  getBaseStreams() {
32887    return [this];
32888  }
32889}
32890exports.ChunkedStream = ChunkedStream;
32891class ChunkedStreamManager {
32892  constructor(pdfNetworkStream, args) {
32893    this.length = args.length;
32894    this.chunkSize = args.rangeChunkSize;
32895    this.stream = new ChunkedStream(this.length, this.chunkSize, this);
32896    this.pdfNetworkStream = pdfNetworkStream;
32897    this.disableAutoFetch = args.disableAutoFetch;
32898    this.msgHandler = args.msgHandler;
32899    this.currRequestId = 0;
32900    this._chunksNeededByRequest = new Map();
32901    this._requestsByChunk = new Map();
32902    this._promisesByRequest = new Map();
32903    this.progressiveDataLength = 0;
32904    this.aborted = false;
32905    this._loadedStreamCapability = new _util.PromiseCapability();
32906  }
32907  sendRequest(begin, end) {
32908    const rangeReader = this.pdfNetworkStream.getRangeReader(begin, end);
32909    if (!rangeReader.isStreamingSupported) {
32910      rangeReader.onProgress = this.onProgress.bind(this);
32911    }
32912    let chunks = [],
32913      loaded = 0;
32914    return new Promise((resolve, reject) => {
32915      const readChunk = ({
32916        value,
32917        done
32918      }) => {
32919        try {
32920          if (done) {
32921            const chunkData = (0, _core_utils.arrayBuffersToBytes)(chunks);
32922            chunks = null;
32923            resolve(chunkData);
32924            return;
32925          }
32926          loaded += value.byteLength;
32927          if (rangeReader.isStreamingSupported) {
32928            this.onProgress({
32929              loaded
32930            });
32931          }
32932          chunks.push(value);
32933          rangeReader.read().then(readChunk, reject);
32934        } catch (e) {
32935          reject(e);
32936        }
32937      };
32938      rangeReader.read().then(readChunk, reject);
32939    }).then(data => {
32940      if (this.aborted) {
32941        return;
32942      }
32943      this.onReceiveData({
32944        chunk: data,
32945        begin
32946      });
32947    });
32948  }
32949  requestAllChunks(noFetch = false) {
32950    if (!noFetch) {
32951      const missingChunks = this.stream.getMissingChunks();
32952      this._requestChunks(missingChunks);
32953    }
32954    return this._loadedStreamCapability.promise;
32955  }
32956  _requestChunks(chunks) {
32957    const requestId = this.currRequestId++;
32958    const chunksNeeded = new Set();
32959    this._chunksNeededByRequest.set(requestId, chunksNeeded);
32960    for (const chunk of chunks) {
32961      if (!this.stream.hasChunk(chunk)) {
32962        chunksNeeded.add(chunk);
32963      }
32964    }
32965    if (chunksNeeded.size === 0) {
32966      return Promise.resolve();
32967    }
32968    const capability = new _util.PromiseCapability();
32969    this._promisesByRequest.set(requestId, capability);
32970    const chunksToRequest = [];
32971    for (const chunk of chunksNeeded) {
32972      let requestIds = this._requestsByChunk.get(chunk);
32973      if (!requestIds) {
32974        requestIds = [];
32975        this._requestsByChunk.set(chunk, requestIds);
32976        chunksToRequest.push(chunk);
32977      }
32978      requestIds.push(requestId);
32979    }
32980    if (chunksToRequest.length > 0) {
32981      const groupedChunksToRequest = this.groupChunks(chunksToRequest);
32982      for (const groupedChunk of groupedChunksToRequest) {
32983        const begin = groupedChunk.beginChunk * this.chunkSize;
32984        const end = Math.min(groupedChunk.endChunk * this.chunkSize, this.length);
32985        this.sendRequest(begin, end).catch(capability.reject);
32986      }
32987    }
32988    return capability.promise.catch(reason => {
32989      if (this.aborted) {
32990        return;
32991      }
32992      throw reason;
32993    });
32994  }
32995  getStream() {
32996    return this.stream;
32997  }
32998  requestRange(begin, end) {
32999    end = Math.min(end, this.length);
33000    const beginChunk = this.getBeginChunk(begin);
vendor: 10,351 bytes, lines 33001-33357
33001    const endChunk = this.getEndChunk(end);
33002    const chunks = [];
33003    for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
33004      chunks.push(chunk);
33005    }
33006    return this._requestChunks(chunks);
33007  }
33008  requestRanges(ranges = []) {
33009    const chunksToRequest = [];
33010    for (const range of ranges) {
33011      const beginChunk = this.getBeginChunk(range.begin);
33012      const endChunk = this.getEndChunk(range.end);
33013      for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
33014        if (!chunksToRequest.includes(chunk)) {
33015          chunksToRequest.push(chunk);
33016        }
33017      }
33018    }
33019    chunksToRequest.sort(function (a, b) {
33020      return a - b;
33021    });
33022    return this._requestChunks(chunksToRequest);
33023  }
33024  groupChunks(chunks) {
33025    const groupedChunks = [];
33026    let beginChunk = -1;
33027    let prevChunk = -1;
33028    for (let i = 0, ii = chunks.length; i < ii; ++i) {
33029      const chunk = chunks[i];
33030      if (beginChunk < 0) {
33031        beginChunk = chunk;
33032      }
33033      if (prevChunk >= 0 && prevChunk + 1 !== chunk) {
33034        groupedChunks.push({
33035          beginChunk,
33036          endChunk: prevChunk + 1
33037        });
33038        beginChunk = chunk;
33039      }
33040      if (i + 1 === chunks.length) {
33041        groupedChunks.push({
33042          beginChunk,
33043          endChunk: chunk + 1
33044        });
33045      }
33046      prevChunk = chunk;
33047    }
33048    return groupedChunks;
33049  }
33050  onProgress(args) {
33051    this.msgHandler.send("DocProgress", {
33052      loaded: this.stream.numChunksLoaded * this.chunkSize + args.loaded,
33053      total: this.length
33054    });
33055  }
33056  onReceiveData(args) {
33057    const chunk = args.chunk;
33058    const isProgressive = args.begin === undefined;
33059    const begin = isProgressive ? this.progressiveDataLength : args.begin;
33060    const end = begin + chunk.byteLength;
33061    const beginChunk = Math.floor(begin / this.chunkSize);
33062    const endChunk = end < this.length ? Math.floor(end / this.chunkSize) : Math.ceil(end / this.chunkSize);
33063    if (isProgressive) {
33064      this.stream.onReceiveProgressiveData(chunk);
33065      this.progressiveDataLength = end;
33066    } else {
33067      this.stream.onReceiveData(begin, chunk);
33068    }
33069    if (this.stream.isDataLoaded) {
33070      this._loadedStreamCapability.resolve(this.stream);
33071    }
33072    const loadedRequests = [];
33073    for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
33074      const requestIds = this._requestsByChunk.get(curChunk);
33075      if (!requestIds) {
33076        continue;
33077      }
33078      this._requestsByChunk.delete(curChunk);
33079      for (const requestId of requestIds) {
33080        const chunksNeeded = this._chunksNeededByRequest.get(requestId);
33081        if (chunksNeeded.has(curChunk)) {
33082          chunksNeeded.delete(curChunk);
33083        }
33084        if (chunksNeeded.size > 0) {
33085          continue;
33086        }
33087        loadedRequests.push(requestId);
33088      }
33089    }
33090    if (!this.disableAutoFetch && this._requestsByChunk.size === 0) {
33091      let nextEmptyChunk;
33092      if (this.stream.numChunksLoaded === 1) {
33093        const lastChunk = this.stream.numChunks - 1;
33094        if (!this.stream.hasChunk(lastChunk)) {
33095          nextEmptyChunk = lastChunk;
33096        }
33097      } else {
33098        nextEmptyChunk = this.stream.nextEmptyChunk(endChunk);
33099      }
33100      if (Number.isInteger(nextEmptyChunk)) {
33101        this._requestChunks([nextEmptyChunk]);
33102      }
33103    }
33104    for (const requestId of loadedRequests) {
33105      const capability = this._promisesByRequest.get(requestId);
33106      this._promisesByRequest.delete(requestId);
33107      capability.resolve();
33108    }
33109    this.msgHandler.send("DocProgress", {
33110      loaded: this.stream.numChunksLoaded * this.chunkSize,
33111      total: this.length
33112    });
33113  }
33114  onError(err) {
33115    this._loadedStreamCapability.reject(err);
33116  }
33117  getBeginChunk(begin) {
33118    return Math.floor(begin / this.chunkSize);
33119  }
33120  getEndChunk(end) {
33121    return Math.floor((end - 1) / this.chunkSize) + 1;
33122  }
33123  abort(reason) {
33124    this.aborted = true;
33125    this.pdfNetworkStream?.cancelAllRequests(reason);
33126    for (const capability of this._promisesByRequest.values()) {
33127      capability.reject(reason);
33128    }
33129  }
33130}
33131exports.ChunkedStreamManager = ChunkedStreamManager;
33132
33133/***/ }),
33134/* 8 */
33135/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
33136
33137
33138
33139Object.defineProperty(exports, "__esModule", ({
33140  value: true
33141}));
33142exports.StringStream = exports.Stream = exports.NullStream = void 0;
33143var _base_stream = __w_pdfjs_require__(5);
33144var _util = __w_pdfjs_require__(2);
33145class Stream extends _base_stream.BaseStream {
33146  constructor(arrayBuffer, start, length, dict) {
33147    super();
33148    this.bytes = arrayBuffer instanceof Uint8Array ? arrayBuffer : new Uint8Array(arrayBuffer);
33149    this.start = start || 0;
33150    this.pos = this.start;
33151    this.end = start + length || this.bytes.length;
33152    this.dict = dict;
33153  }
33154  get length() {
33155    return this.end - this.start;
33156  }
33157  get isEmpty() {
33158    return this.length === 0;
33159  }
33160  getByte() {
33161    if (this.pos >= this.end) {
33162      return -1;
33163    }
33164    return this.bytes[this.pos++];
33165  }
33166  getBytes(length) {
33167    const bytes = this.bytes;
33168    const pos = this.pos;
33169    const strEnd = this.end;
33170    if (!length) {
33171      return bytes.subarray(pos, strEnd);
33172    }
33173    let end = pos + length;
33174    if (end > strEnd) {
33175      end = strEnd;
33176    }
33177    this.pos = end;
33178    return bytes.subarray(pos, end);
33179  }
33180  getByteRange(begin, end) {
33181    if (begin < 0) {
33182      begin = 0;
33183    }
33184    if (end > this.end) {
33185      end = this.end;
33186    }
33187    return this.bytes.subarray(begin, end);
33188  }
33189  reset() {
33190    this.pos = this.start;
33191  }
33192  moveStart() {
33193    this.start = this.pos;
33194  }
33195  makeSubStream(start, length, dict = null) {
33196    return new Stream(this.bytes.buffer, start, length, dict);
33197  }
33198}
33199exports.Stream = Stream;
33200class StringStream extends Stream {
33201  constructor(str) {
33202    super((0, _util.stringToBytes)(str));
33203  }
33204}
33205exports.StringStream = StringStream;
33206class NullStream extends Stream {
33207  constructor() {
33208    super(new Uint8Array(0));
33209  }
33210}
33211exports.NullStream = NullStream;
33212
33213/***/ }),
33214/* 9 */
33215/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
33216
33217
33218
33219Object.defineProperty(exports, "__esModule", ({
33220  value: true
33221}));
33222exports.Page = exports.PDFDocument = void 0;
33223var _util = __w_pdfjs_require__(2);
33224var _annotation = __w_pdfjs_require__(10);
33225var _core_utils = __w_pdfjs_require__(3);
33226var _primitives = __w_pdfjs_require__(4);
33227var _xfa_fonts = __w_pdfjs_require__(51);
33228var _base_stream = __w_pdfjs_require__(5);
33229var _crypto = __w_pdfjs_require__(74);
33230var _catalog = __w_pdfjs_require__(66);
33231var _cleanup_helper = __w_pdfjs_require__(68);
33232var _dataset_reader = __w_pdfjs_require__(102);
33233var _parser = __w_pdfjs_require__(16);
33234var _stream = __w_pdfjs_require__(8);
33235var _object_loader = __w_pdfjs_require__(76);
33236var _operator_list = __w_pdfjs_require__(64);
33237var _evaluator = __w_pdfjs_require__(13);
33238var _decode_stream = __w_pdfjs_require__(18);
33239var _struct_tree = __w_pdfjs_require__(72);
33240var _writer = __w_pdfjs_require__(73);
33241var _factory = __w_pdfjs_require__(77);
33242var _xref = __w_pdfjs_require__(103);
33243const DEFAULT_USER_UNIT = 1.0;
33244const LETTER_SIZE_MEDIABOX = [0, 0, 612, 792];
33245class Page {
33246  constructor({
33247    pdfManager,
33248    xref,
33249    pageIndex,
33250    pageDict,
33251    ref,
33252    globalIdFactory,
33253    fontCache,
33254    builtInCMapCache,
33255    standardFontDataCache,
33256    globalImageCache,
33257    systemFontCache,
33258    nonBlendModesSet,
33259    xfaFactory
33260  }) {
33261    this.pdfManager = pdfManager;
33262    this.pageIndex = pageIndex;
33263    this.pageDict = pageDict;
33264    this.xref = xref;
33265    this.ref = ref;
33266    this.fontCache = fontCache;
33267    this.builtInCMapCache = builtInCMapCache;
33268    this.standardFontDataCache = standardFontDataCache;
33269    this.globalImageCache = globalImageCache;
33270    this.systemFontCache = systemFontCache;
33271    this.nonBlendModesSet = nonBlendModesSet;
33272    this.evaluatorOptions = pdfManager.evaluatorOptions;
33273    this.resourcesPromise = null;
33274    this.xfaFactory = xfaFactory;
33275    const idCounters = {
33276      obj: 0
33277    };
33278    this._localIdFactory = class extends globalIdFactory {
33279      static createObjId() {
33280        return `p${pageIndex}_${++idCounters.obj}`;
33281      }
33282      static getPageObjId() {
33283        return `p${ref.toString()}`;
33284      }
33285    };
33286  }
33287  _getInheritableProperty(key, getArray = false) {
33288    const value = (0, _core_utils.getInheritableProperty)({
33289      dict: this.pageDict,
33290      key,
33291      getArray,
33292      stopWhenFound: false
33293    });
33294    if (!Array.isArray(value)) {
33295      return value;
33296    }
33297    if (value.length === 1 || !(value[0] instanceof _primitives.Dict)) {
33298      return value[0];
33299    }
33300    return _primitives.Dict.merge({
33301      xref: this.xref,
33302      dictArray: value
33303    });
33304  }
33305  get content() {
33306    return this.pageDict.getArray("Contents");
33307  }
33308  get resources() {
33309    const resources = this._getInheritableProperty("Resources");
33310    return (0, _util.shadow)(this, "resources", resources instanceof _primitives.Dict ? resources : _primitives.Dict.empty);
33311  }
33312  _getBoundingBox(name) {
33313    if (this.xfaData) {
33314      return this.xfaData.bbox;
33315    }
33316    let box = this._getInheritableProperty(name, true);
33317    if (Array.isArray(box) && box.length === 4) {
33318      box = _util.Util.normalizeRect(box);
33319      if (box[2] - box[0] > 0 && box[3] - box[1] > 0) {
33320        return box;
33321      }
33322      (0, _util.warn)(`Empty, or invalid, /${name} entry.`);
33323    }
33324    return null;
33325  }
33326  get mediaBox() {
33327    return (0, _util.shadow)(this, "mediaBox", this._getBoundingBox("MediaBox") || LETTER_SIZE_MEDIABOX);
33328  }
33329  get cropBox() {
33330    return (0, _util.shadow)(this, "cropBox", this._getBoundingBox("CropBox") || this.mediaBox);
33331  }
33332  get userUnit() {
33333    let obj = this.pageDict.get("UserUnit");
33334    if (typeof obj !== "number" || obj <= 0) {
33335      obj = DEFAULT_USER_UNIT;
33336    }
33337    return (0, _util.shadow)(this, "userUnit", obj);
33338  }
33339  get view() {
33340    const {
33341      cropBox,
33342      mediaBox
33343    } = this;
33344    if (cropBox !== mediaBox && !(0, _util.isArrayEqual)(cropBox, mediaBox)) {
33345      const box = _util.Util.intersect(cropBox, mediaBox);
33346      if (box && box[2] - box[0] > 0 && box[3] - box[1] > 0) {
33347        return (0, _util.shadow)(this, "view", box);
33348      }
33349      (0, _util.warn)("Empty /CropBox and /MediaBox intersection.");
33350    }
33351    return (0, _util.shadow)(this, "view", mediaBox);
33352  }
33353  get rotate() {
33354    let rotate = this._getInheritableProperty("Rotate") || 0;
33355    if (rotate % 90 !== 0) {
33356      rotate = 0;
33357    } else if (rotate >= 360) {
33358      rotate %= 360;
33359    } else if (rotate < 0) {
33360      rotate = (rotate % 360 + 360) % 360;
33361    }
33362    return (0, _util.shadow)(this, "rotate", rotate);
33363  }
33364  _onSubStreamError(reason, objId) {
33365    if (this.evaluatorOptions.ignoreErrors) {
33366      (0, _util.warn)(`getContentStream - ignoring sub-stream (${objId}): "${reason}".`);
33367      return;
33368    }
33369    throw reason;
33370  }
33371  getContentStream() {
33372    return this.pdfManager.ensure(this, "content").then(content => {
33373      if (content instanceof _base_stream.BaseStream) {
33374        return content;
33375      }
33376      if (Array.isArray(content)) {
33377        return new _decode_stream.StreamsSequenceStream(content, this._onSubStreamError.bind(this));
33378      }
33379      return new _stream.NullStream();
33380    });
33381  }
33382  get xfaData() {
33383    return (0, _util.shadow)(this, "xfaData", this.xfaFactory ? {
33384      bbox: this.xfaFactory.getBoundingBox(this.pageIndex)
33385    } : null);
33386  }
33387  #replaceIdByRef(annotations, deletedAnnotations, existingAnnotations) {
33388    for (const annotation of annotations) {
33389      if (annotation.id) {
33390        const ref = _primitives.Ref.fromString(annotation.id);
33391        if (!ref) {
33392          (0, _util.warn)(`A non-linked annotation cannot be modified: ${annotation.id}`);
33393          continue;
33394        }
33395        if (annotation.deleted) {
33396          deletedAnnotations.put(ref);
33397          continue;
33398        }
33399        existingAnnotations?.put(ref);
33400        annotation.ref = ref;
33401        delete annotation.id;
33402      }
33403    }
33404  }
33405  async saveNewAnnotations(handler, task, annotations, imagePromises) {
33406    if (this.xfaFactory) {
33407      throw new Error("XFA: Cannot save new annotations.");
33408    }
33409    const partialEvaluator = new _evaluator.PartialEvaluator({
33410      xref: this.xref,
33411      handler,
33412      pageIndex: this.pageIndex,
33413      idFactory: this._localIdFactory,
33414      fontCache: this.fontCache,
33415      builtInCMapCache: this.builtInCMapCache,
33416      standardFontDataCache: this.standardFontDataCache,
33417      globalImageCache: this.globalImageCache,
33418      systemFontCache: this.systemFontCache,
33419      options: this.evaluatorOptions
33420    });
33421    const deletedAnnotations = new _primitives.RefSet();
33422    const existingAnnotations = new _primitives.RefSet();
33423    this.#replaceIdByRef(annotations, deletedAnnotations, existingAnnotations);
33424    const pageDict = this.pageDict;
33425    const annotationsArray = this.annotations.filter(a => !(a instanceof _primitives.Ref && deletedAnnotations.has(a)));
33426    const newData = await _annotation.AnnotationFactory.saveNewAnnotations(partialEvaluator, task, annotations, imagePromises);
33427    for (const {
33428      ref
33429    } of newData.annotations) {
33430      if (ref instanceof _primitives.Ref && !existingAnnotations.has(ref)) {
33431        annotationsArray.push(ref);
33432      }
33433    }
33434    const savedDict = pageDict.get("Annots");
33435    pageDict.set("Annots", annotationsArray);
33436    const buffer = [];
33437    await (0, _writer.writeObject)(this.ref, pageDict, buffer, this.xref);
33438    if (savedDict) {
33439      pageDict.set("Annots", savedDict);
33440    }
33441    const objects = newData.dependencies;
33442    objects.push({
33443      ref: this.ref,
33444      data: buffer.join("")
33445    }, ...newData.annotations);
33446    return objects;
33447  }
33448  save(handler, task, annotationStorage) {
33449    const partialEvaluator = new _evaluator.PartialEvaluator({
33450      xref: this.xref,
33451      handler,
33452      pageIndex: this.pageIndex,
33453      idFactory: this._localIdFactory,
33454      fontCache: this.fontCache,
33455      builtInCMapCache: this.builtInCMapCache,
33456      standardFontDataCache: this.standardFontDataCache,
33457      globalImageCache: this.globalImageCache,
33458      systemFontCache: this.systemFontCache,
33459      options: this.evaluatorOptions
33460    });
33461    return this._parsedAnnotations.then(function (annotations) {
33462      const newRefsPromises = [];
33463      for (const annotation of annotations) {
33464        if (!annotation.mustBePrinted(annotationStorage)) {
33465          continue;
33466        }
33467        newRefsPromises.push(annotation.save(partialEvaluator, task, annotationStorage).catch(function (reason) {
33468          (0, _util.warn)("save - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
33469          return null;
33470        }));
33471      }
33472      return Promise.all(newRefsPromises).then(function (newRefs) {
33473        return newRefs.filter(newRef =>
33473 !!newRef);
33474      });
33475    });
33476  }
33477  loadResources(keys) {
33478    if (!this.resourcesPromise) {
33479      this.resourcesPromise = this.pdfManager.ensure(this, "resources");
33480    }
33481    return this.resourcesPromise.then(() => {
33482      const objectLoader = new _object_loader.ObjectLoader(this.resources, keys, this.xref);
33483      return objectLoader.load();
33484    });
33485  }
33486  getOperatorList({
33487    handler,
33488    sink,
33489    task,
33490    intent,
33491    cacheKey,
33492    annotationStorage = null
33493  }) {
33494    const contentStreamPromise = this.getContentStream();
33495    const resourcesPromise = this.loadResources(["ColorSpace", "ExtGState", "Font", "Pattern", "Properties", "Shading", "XObject"]);
33496    const partialEvaluator = new _evaluator.PartialEvaluator({
33497      xref: this.xref,
33498      handler,
33499      pageIndex: this.pageIndex,
33500      idFactory: this._localIdFactory,
33501      fontCache: this.fontCache,
33502      builtInCMapCache: this.builtInCMapCache,
33503      standardFontDataCache: this.standardFontDataCache,
33504      globalImageCache: this.globalImageCache,
33505      systemFontCache: this.systemFontCache,
33506      options: this.evaluatorOptions
33507    });
33508    const newAnnotationsByPage = !this.xfaFactory ? (0, _core_utils.getNewAnnotationsMap)(annotationStorage) : null;
33509    let deletedAnnotations = null;
33510    let newAnnotationsPromise = Promise.resolve(null);
33511    if (newAnnotationsByPage) {
33512      const newAnnotations = newAnnotationsByPage.get(this.pageIndex);
33513      if (newAnnotations) {
33514        const annotationGlobalsPromise = this.pdfManager.ensureDoc("annotationGlobals");
33515        let imagePromises;
33516        const missingBitmaps = new Set();
33517        for (const {
33518          bitmapId,
33519          bitmap
33520        } of newAnnotations) {
33521          if (bitmapId && !bitmap && !missingBitmaps.has(bitmapId)) {
33522            missingBitmaps.add(bitmapId);
33523          }
33524        }
33525        const {
33526          isOffscreenCanvasSupported
33527        } = this.evaluatorOptions;
33528        if (missingBitmaps.size > 0) {
33529          const annotationWithBitmaps = newAnnotations.slice();
33530          for (const [key, annotation] of annotationStorage) {
33531            if (!key.startsWith(_util.AnnotationEditorPrefix)) {
33532              continue;
33533            }
33534            if (annotation.bitmap && missingBitmaps.has(annotation.bitmapId)) {
33535              annotationWithBitmaps.push(annotation);
33536            }
33537          }
33538          imagePromises = _annotation.AnnotationFactory.generateImages(annotationWithBitmaps, this.xref, isOffscreenCanvasSupported);
33539        } else {
33540          imagePromises = _annotation.AnnotationFactory.generateImages(newAnnotations, this.xref, isOffscreenCanvasSupported);
33541        }
33542        deletedAnnotations = new _primitives.RefSet();
33543        this.#replaceIdByRef(newAnnotations, deletedAnnotations, null);
33544        newAnnotationsPromise = annotationGlobalsPromise.then(annotationGlobals => {
33545          if (!annotationGlobals) {
33546            return null;
33547          }
33548          return _annotation.AnnotationFactory.printNewAnnotations(annotationGlobals, partialEvaluator, task, newAnnotations, imagePromises);
33549        });
33550      }
33551    }
33552    const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
33553    const pageListPromise = dataPromises.then(([contentStream]) => {
33554      const opList = new _operator_list.OperatorList(intent, sink);
33555      handler.send("StartRenderPage", {
33556        transparency: partialEvaluator.hasBlendModes(this.resources, this.nonBlendModesSet),
33557        pageIndex: this.pageIndex,
33558        cacheKey
33559      });
33560      return partialEvaluator.getOperatorList({
33561        stream: contentStream,
33562        task,
33563        resources: this.resources,
33564        operatorList: opList
33565      }).then(function () {
33566        return opList;
33567      });
33568    });
33569    return Promise.all([pageListPromise, this._parsedAnnotations, newAnnotationsPromise]).then(function ([pageOpList, annotations, newAnnotations]) {
33570      if (newAnnotations) {
33571        annotations = annotations.filter(a => !(a.ref && deletedAnnotations.has(a.ref)));
33572        for (let i = 0, ii = newAnnotations.length; i < ii; i++) {
33573          const newAnnotation = newAnnotations[i];
33574          if (newAnnotation.refToReplace) {
33575            const j = annotations.findIndex(a => a.ref && (0, _primitives.isRefsEqual)(a.ref, newAnnotation.refToReplace));
33576            if (j >= 0) {
33577              annotations.splice(j, 1, newAnnotation);
33578              newAnnotations.splice(i--, 1);
33579              ii--;
33580            }
33581          }
33582        }
33583        annotations = annotations.concat(newAnnotations);
33584      }
33585      if (annotations.length === 0 || intent & _util.RenderingIntentFlag.ANNOTATIONS_DISABLE) {
33586        pageOpList.flush(true);
33587        return {
33588          length: pageOpList.totalLength
33589        };
33590      }
33591      const renderForms = !!(intent & _util.RenderingIntentFlag.ANNOTATIONS_FORMS),
33592        intentAny = !!(intent & _util.RenderingIntentFlag.ANY),
33593        intentDisplay = !!(intent & _util.RenderingIntentFlag.DISPLAY),
33594        intentPrint = !!(intent & _util.RenderingIntentFlag.PRINT);
33595      const opListPromises = [];
33596      for (const annotation of annotations) {
33597        if (intentAny || intentDisplay && annotation.mustBeViewed(annotationStorage, renderForms) || intentPrint && annotation.mustBePrinted(annotationStorage)) {
33598          opListPromises.push(annotation.getOperatorList(partialEvaluator, task, intent, renderForms, annotationStorage).catch(function (reason) {
33599            (0, _util.warn)("getOperatorList - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
33600            return {
33601              opList: null,
33602              separateForm: false,
33603              separateCanvas: false
33604            };
33605          }));
33606        }
33607      }
33608      return Promise.all(opListPromises).then(function (opLists) {
33609        let form = false,
33610          canvas = false;
33611        for (const {
33612          opList,
33613          separateForm,
33614          separateCanvas
33615        } of opLists) {
33616          pageOpList.addOpList(opList);
33617          form ||= separateForm;
33618          canvas ||= separateCanvas;
33619        }
33620        pageOpList.flush(true, {
33621          form,
33622          canvas
33623        });
33624        return {
33625          length: pageOpList.totalLength
33626        };
33627      });
33628    });
33629  }
33630  extractTextContent({
33631    handler,
33632    task,
33633    includeMarkedContent,
33634    disableNormalization,
33635    sink
33636  }) {
33637    const contentStreamPromise = this.getContentStream();
33638    const resourcesPromise = this.loadResources(["ExtGState", "Font", "Properties", "XObject"]);
33639    const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
33640    return dataPromises.then(([contentStream]) => {
33641      const partialEvaluator = new _evaluator.PartialEvaluator({
33642        xref: this.xref,
33643        handler,
33644        pageIndex: this.pageIndex,
33645        idFactory: this._localIdFactory,
33646        fontCache: this.fontCache,
33647        builtInCMapCache: this.builtInCMapCache,
33648        standardFontDataCache: this.standardFontDataCache,
33649        globalImageCache: this.globalImageCache,
33650        systemFontCache: this.systemFontCache,
33651        options: this.evaluatorOptions
33652      });
33653      return partialEvaluator.getTextContent({
33654        stream: contentStream,
33655        task,
33656        resources: this.resources,
33657        includeMarkedContent,
33658        disableNormalization,
33659        sink,
33660        viewBox: this.view
33661      });
33662    });
33663  }
33664  async getStructTree() {
33665    const structTreeRoot = await this.pdfManager.ensureCatalog("structTreeRoot");
33666    if (!structTreeRoot) {
33667      return null;
33668    }
33669    await this._parsedAnnotations;
33670    const structTree = await this.pdfManager.ensure(this, "_parseStructTree", [structTreeRoot]);
33671    return structTree.serializable;
33672  }
33673  _parseStructTree(structTreeRoot) {
33674    const tree = new _struct_tree.StructTreePage(structTreeRoot, this.pageDict);
33675    tree.parse(this.ref);
33676    return tree;
33677  }
33678  async getAnnotationsData(handler, task, intent) {
33679    const annotations = await this._parsedAnnotations;
33680    if (annotations.length === 0) {
33681      return annotations;
33682    }
33683    const annotationsData = [],
33684      textContentPromises = [];
33685    let partialEvaluator;
33686    const intentAny = !!(intent & _util.RenderingIntentFlag.ANY),
33687      intentDisplay = !!(intent & _util.RenderingIntentFlag.DISPLAY),
33688      intentPrint = !!(intent & _util.RenderingIntentFlag.PRINT);
33689    for (const annotation of annotations) {
33690      const isVisible = intentAny || intentDisplay && annotation.viewable;
33691      if (isVisible || intentPrint && annotation.printable) {
33692        annotationsData.push(annotation.data);
33693      }
33694      if (annotation.hasTextContent && isVisible) {
33695        partialEvaluator ||= new _evaluator.PartialEvaluator({
33696          xref: this.xref,
33697          handler,
33698          pageIndex: this.pageIndex,
33699          idFactory: this._localIdFactory,
33700          fontCache: this.fontCache,
33701          builtInCMapCache: this.builtInCMapCache,
33702          standardFontDataCache: this.standardFontDataCache,
33703          globalImageCache: this.globalImageCache,
33704          systemFontCache: this.systemFontCache,
33705          options: this.evaluatorOptions
33706        });
33707        textContentPromises.push(annotation.extractTextContent(partialEvaluator, task, [-Infinity, -Infinity, Infinity, Infinity]).catch(function (reason) {
33708          (0, _util.warn)(`getAnnotationsData - ignoring textContent during "${task.name}" task: "${reason}".`);
33709        }));
33710      }
33711    }
33712    await Promise.all(textContentPromises);
33713    return annotationsData;
33714  }
33715  get annotations() {
33716    const annots = this._getInheritableProperty("Annots");
33717    return (0, _util.shadow)(this, "annotations", Array.isArray(annots) ? annots : []);
33718  }
33719  get _parsedAnnotations() {
33720    const promise = this.pdfManager.ensure(this, "annotations").then(async annots => {
33721      if (annots.length === 0) {
33722        return annots;
33723      }
33724      const annotationGlobals = await this.pdfManager.ensureDoc("annotationGlobals");
33725      if (!annotationGlobals) {
33726        return [];
33727      }
33728      const annotationPromises = [];
33729      for (const annotationRef of annots) {
33730        annotationPromises.push(_annotation.AnnotationFactory.create(this.xref, annotationRef, annotationGlobals, this._localIdFactory, false, this.ref).catch(function (reason) {
33731          (0, _util.warn)(`_parsedAnnotations: "${reason}".`);
33732          return null;
33733        }));
33734      }
33735      const sortedAnnotations = [];
33736      let popupAnnotations;
33737      for (const annotation of await Promise.all(annotationPromises)) {
33738        if (!annotation) {
33739          continue;
33740        }
33741        if (annotation instanceof _annotation.PopupAnnotation) {
33742          (popupAnnotations ||= []).push(annotation);
33743          continue;
33744        }
33745        sortedAnnotations.push(annotation);
33746      }
33747      if (popupAnnotations) {
33748        sortedAnnotations.push(...popupAnnotations);
33749      }
33750      return sortedAnnotations;
33751    });
33752    return (0, _util.shadow)(this, "_parsedAnnotations", promise
vendor: 7,375 bytes, lines 33752-34003
33752);
33753  }
33754  get jsActions() {
33755    const actions = (0, _core_utils.collectActions)(this.xref, this.pageDict, _util.PageActionEventType);
33756    return (0, _util.shadow)(this, "jsActions", actions);
33757  }
33758}
33759exports.Page = Page;
33760const PDF_HEADER_SIGNATURE = new Uint8Array([0x25, 0x50, 0x44, 0x46, 0x2d]);
33761const STARTXREF_SIGNATURE = new Uint8Array([0x73, 0x74, 0x61, 0x72, 0x74, 0x78, 0x72, 0x65, 0x66]);
33762const ENDOBJ_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64, 0x6f, 0x62, 0x6a]);
33763const FINGERPRINT_FIRST_BYTES = 1024;
33764const EMPTY_FINGERPRINT = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
33765function find(stream, signature, limit = 1024, backwards = false) {
33766  const signatureLength = signature.length;
33767  const scanBytes = stream.peekBytes(limit);
33768  const scanLength = scanBytes.length - signatureLength;
33769  if (scanLength <= 0) {
33770    return false;
33771  }
33772  if (backwards) {
33773    const signatureEnd = signatureLength - 1;
33774    let pos = scanBytes.length - 1;
33775    while (pos >= signatureEnd) {
33776      let j = 0;
33777      while (j < signatureLength && scanBytes[pos - j] === signature[signatureEnd - j]) {
33778        j++;
33779      }
33780      if (j >= signatureLength) {
33781        stream.pos += pos - signatureEnd;
33782        return true;
33783      }
33784      pos--;
33785    }
33786  } else {
33787    let pos = 0;
33788    while (pos <= scanLength) {
33789      let j = 0;
33790      while (j < signatureLength && scanBytes[pos + j] === signature[j]) {
33791        j++;
33792      }
33793      if (j >= signatureLength) {
33794        stream.pos += pos;
33795        return true;
33796      }
33797      pos++;
33798    }
33799  }
33800  return false;
33801}
33802class PDFDocument {
33803  constructor(pdfManager, stream) {
33804    if (stream.length <= 0) {
33805      throw new _util.InvalidPDFException("The PDF file is empty, i.e. its size is zero bytes.");
33806    }
33807    this.pdfManager = pdfManager;
33808    this.stream = stream;
33809    this.xref = new _xref.XRef(stream, pdfManager);
33810    this._pagePromises = new Map();
33811    this._version = null;
33812    const idCounters = {
33813      font: 0
33814    };
33815    this._globalIdFactory = class {
33816      static getDocId() {
33817        return `g_${pdfManager.docId}`;
33818      }
33819      static createFontId() {
33820        return `f${++idCounters.font}`;
33821      }
33822      static createObjId() {
33823        (0, _util.unreachable)("Abstract method `createObjId` called.");
33824      }
33825      static getPageObjId() {
33826        (0, _util.unreachable)("Abstract method `getPageObjId` called.");
33827      }
33828    };
33829  }
33830  parse(recoveryMode) {
33831    this.xref.parse(recoveryMode);
33832    this.catalog = new _catalog.Catalog(this.pdfManager, this.xref);
33833  }
33834  get linearization() {
33835    let linearization = null;
33836    try {
33837      linearization = _parser.Linearization.create(this.stream);
33838    } catch (err) {
33839      if (err instanceof _core_utils.MissingDataException) {
33840        throw err;
33841      }
33842      (0, _util.info)(err);
33843    }
33844    return (0, _util.shadow)(this, "linearization", linearization);
33845  }
33846  get startXRef() {
33847    const stream = this.stream;
33848    let startXRef = 0;
33849    if (this.linearization) {
33850      stream.reset();
33851      if (find(stream, ENDOBJ_SIGNATURE)) {
33852        startXRef = stream.pos + 6 - stream.start;
33853      }
33854    } else {
33855      const step = 1024;
33856      const startXRefLength = STARTXREF_SIGNATURE.length;
33857      let found = false,
33858        pos = stream.end;
33859      while (!found && pos > 0) {
33860        pos -= step - startXRefLength;
33861        if (pos < 0) {
33862          pos = 0;
33863        }
33864        stream.pos = pos;
33865        found = find(stream, STARTXREF_SIGNATURE, step, true);
33866      }
33867      if (found) {
33868        stream.skip(9);
33869        let ch;
33870        do {
33871          ch = stream.getByte();
33872        } while ((0, _core_utils.isWhiteSpace)(ch));
33873        let str = "";
33874        while (ch >= 0x20 && ch <= 0x39) {
33875          str += String.fromCharCode(ch);
33876          ch = stream.getByte();
33877        }
33878        startXRef = parseInt(str, 10);
33879        if (isNaN(startXRef)) {
33880          startXRef = 0;
33881        }
33882      }
33883    }
33884    return (0, _util.shadow)(this, "startXRef", startXRef);
33885  }
33886  checkHeader() {
33887    const stream = this.stream;
33888    stream.reset();
33889    if (!find(stream, PDF_HEADER_SIGNATURE)) {
33890      return;
33891    }
33892    stream.moveStart();
33893    stream.skip(PDF_HEADER_SIGNATURE.length);
33894    let version = "",
33895      ch;
33896    while ((ch = stream.getByte()) > 0x20 && version.length < 7) {
33897      version += String.fromCharCode(ch);
33898    }
33899    if (_core_utils.PDF_VERSION_REGEXP.test(version)) {
33900      this._version = version;
33901    } else {
33902      (0, _util.warn)(`Invalid PDF header version: ${version}`);
33903    }
33904  }
33905  parseStartXRef() {
33906    this.xref.setStartXRef(this.startXRef);
33907  }
33908  get numPages() {
33909    let num = 0;
33910    if (this.catalog.hasActualNumPages) {
33911      num = this.catalog.numPages;
33912    } else if (this.xfaFactory) {
33913      num = this.xfaFactory.getNumPages();
33914    } else if (this.linearization) {
33915      num = this.linearization.numPages;
33916    } else {
33917      num = this.catalog.numPages;
33918    }
33919    return (0, _util.shadow)(this, "numPages", num);
33920  }
33921  _hasOnlyDocumentSignatures(fields, recursionDepth = 0) {
33922    const RECURSION_LIMIT = 10;
33923    if (!Array.isArray(fields)) {
33924      return false;
33925    }
33926    return fields.every(field => {
33927      field = this.xref.fetchIfRef(field);
33928      if (!(field instanceof _primitives.Dict)) {
33929        return false;
33930      }
33931      if (field.has("Kids")) {
33932        if (++recursionDepth > RECURSION_LIMIT) {
33933          (0, _util.warn)("_hasOnlyDocumentSignatures: maximum recursion depth reached");
33934          return false;
33935        }
33936        return this._hasOnlyDocumentSignatures(field.get("Kids"), recursionDepth);
33937      }
33938      const isSignature = (0, _primitives.isName)(field.get("FT"), "Sig");
33939      const rectangle = field.get("Rect");
33940      const isInvisible = Array.isArray(rectangle) && rectangle.every(value => value === 0);
33941      return isSignature && isInvisible;
33942    });
33943  }
33944  get _xfaStreams() {
33945    const acroForm = this.catalog.acroForm;
33946    if (!acroForm) {
33947      return null;
33948    }
33949    const xfa = acroForm.get("XFA");
33950    const entries = {
33951      "xdp:xdp": "",
33952      template: "",
33953      datasets: "",
33954      config: "",
33955      connectionSet: "",
33956      localeSet: "",
33957      stylesheet: "",
33958      "/xdp:xdp": ""
33959    };
33960    if (xfa instanceof _base_stream.BaseStream && !xfa.isEmpty) {
33961      entries["xdp:xdp"] = xfa;
33962      return entries;
33963    }
33964    if (!Array.isArray(xfa) || xfa.length === 0) {
33965      return null;
33966    }
33967    for (let i = 0, ii = xfa.length; i < ii; i += 2) {
33968      let name;
33969      if (i === 0) {
33970        name = "xdp:xdp";
33971      } else if (i === ii - 2) {
33972        name = "/xdp:xdp";
33973      } else {
33974        name = xfa[i];
33975      }
33976      if (!entries.hasOwnProperty(name)) {
33977        continue;
33978      }
33979      const data = this.xref.fetchIfRef(xfa[i + 1]);
33980      if (!(data instanceof _base_stream.BaseStream) || data.isEmpty) {
33981        continue;
33982      }
33983      entries[name] = data;
33984    }
33985    return entries;
33986  }
33987  get xfaDatasets() {
33988    const streams = this._xfaStreams;
33989    if (!streams) {
33990      return (0, _util.shadow)(this, "xfaDatasets", null);
33991    }
33992    for (const key of ["datasets", "xdp:xdp"]) {
33993      const stream = streams[key];
33994      if (!stream) {
33995        continue;
33996      }
33997      try {
33998        const str = (0, _util.stringToUTF8String)(stream.getString());
33999        const data = {
34000          [key]: str
34001        };
34002        return (0, _util.shadow)(this, "xfaDatasets", new _dataset_reader.DatasetReader(data));
34003      } catch 
vendor: 3,323 bytes, lines 34003-34110
34003{
34004        (0, _util.warn)("XFA - Invalid utf-8 string.");
34005        break;
34006      }
34007    }
34008    return (0, _util.shadow)(this, "xfaDatasets", null);
34009  }
34010  get xfaData() {
34011    const streams = this._xfaStreams;
34012    if (!streams) {
34013      return null;
34014    }
34015    const data = Object.create(null);
34016    for (const [key, stream] of Object.entries(streams)) {
34017      if (!stream) {
34018        continue;
34019      }
34020      try {
34021        data[key] = (0, _util.stringToUTF8String)(stream.getString());
34022      } catch {
34023        (0, _util.warn)("XFA - Invalid utf-8 string.");
34024        return null;
34025      }
34026    }
34027    return data;
34028  }
34029  get xfaFactory() {
34030    let data;
34031    if (this.pdfManager.enableXfa && this.catalog.needsRendering && this.formInfo.hasXfa && !this.formInfo.hasAcroForm) {
34032      data = this.xfaData;
34033    }
34034    return (0, _util.shadow)(this, "xfaFactory", data ? new _factory.XFAFactory(data) : null);
34035  }
34036  get isPureXfa() {
34037    return this.xfaFactory ? this.xfaFactory.isValid() : false;
34038  }
34039  get htmlForXfa() {
34040    return this.xfaFactory ? this.xfaFactory.getPages() : null;
34041  }
34042  async loadXfaImages() {
34043    const xfaImagesDict = await this.pdfManager.ensureCatalog("xfaImages");
34044    if (!xfaImagesDict) {
34045      return;
34046    }
34047    const keys = xfaImagesDict.getKeys();
34048    const objectLoader = new _object_loader.ObjectLoader(xfaImagesDict, keys, this.xref);
34049    await objectLoader.load();
34050    const xfaImages = new Map();
34051    for (const key of keys) {
34052      const stream = xfaImagesDict.get(key);
34053      if (stream instanceof _base_stream.BaseStream) {
34054        xfaImages.set(key, stream.getBytes());
34055      }
34056    }
34057    this.xfaFactory.setImages(xfaImages);
34058  }
34059  async loadXfaFonts(handler, task) {
34060    const acroForm = await this.pdfManager.ensureCatalog("acroForm");
34061    if (!acroForm) {
34062      return;
34063    }
34064    const resources = await acroForm.getAsync("DR");
34065    if (!(resources instanceof _primitives.Dict)) {
34066      return;
34067    }
34068    const objectLoader = new _object_loader.ObjectLoader(resources, ["Font"], this.xref);
34069    await objectLoader.load();
34070    const fontRes = resources.get("Font");
34071    if (!(fontRes instanceof _primitives.Dict)) {
34072      return;
34073    }
34074    const options = Object.assign(Object.create(null), this.pdfManager.evaluatorOptions);
34075    options.useSystemFonts = false;
34076    const partialEvaluator = new _evaluator.PartialEvaluator({
34077      xref: this.xref,
34078      handler,
34079      pageIndex: -1,
34080      idFactory: this._globalIdFactory,
34081      fontCache: this.catalog.fontCache,
34082      builtInCMapCache: this.catalog.builtInCMapCache,
34083      standardFontDataCache: this.catalog.standardFontDataCache,
34084      options
34085    });
34086    const operatorList = new _operator_list.OperatorList();
34087    const pdfFonts = [];
34088    const initialState = {
34089      get font() {
34090        return pdfFonts.at(-1);
34091      },
34092      set font(font) {
34093        pdfFonts.push(font);
34094      },
34095      clone() {
34096        return this;
34097      }
34098    };
34099    const fonts = new Map();
34100    fontRes.forEach((fontName, font) => {
34101      fonts.set(fontName, font);
34102    });
34103    const promises = [];
34104    for (const [fontName, font] of fonts) {
34105      const descriptor = font.get("FontDescriptor");
34106      if (!(descriptor instanceof _primitives.Dict)) {
34107        continue;
34108      }
34109      let fontFamily = descriptor.get("FontFamily");
34110      fontFamily = fontFamily.replaceAll
vendor: 8,333 bytes, lines 34110-34357
34110(/[ ]+(\d)/g, "$1");
34111      const fontWeight = descriptor.get("FontWeight");
34112      const italicAngle = -descriptor.get("ItalicAngle");
34113      const cssFontInfo = {
34114        fontFamily,
34115        fontWeight,
34116        italicAngle
34117      };
34118      if (!(0, _core_utils.validateCSSFont)(cssFontInfo)) {
34119        continue;
34120      }
34121      promises.push(partialEvaluator.handleSetFont(resources, [_primitives.Name.get(fontName), 1], null, operatorList, task, initialState, null, cssFontInfo).catch(function (reason) {
34122        (0, _util.warn)(`loadXfaFonts: "${reason}".`);
34123        return null;
34124      }));
34125    }
34126    await Promise.all(promises);
34127    const missingFonts = this.xfaFactory.setFonts(pdfFonts);
34128    if (!missingFonts) {
34129      return;
34130    }
34131    options.ignoreErrors = true;
34132    promises.length = 0;
34133    pdfFonts.length = 0;
34134    const reallyMissingFonts = new Set();
34135    for (const missing of missingFonts) {
34136      if (!(0, _xfa_fonts.getXfaFontName)(`${missing}-Regular`)) {
34137        reallyMissingFonts.add(missing);
34138      }
34139    }
34140    if (reallyMissingFonts.size) {
34141      missingFonts.push("PdfJS-Fallback");
34142    }
34143    for (const missing of missingFonts) {
34144      if (reallyMissingFonts.has(missing)) {
34145        continue;
34146      }
34147      for (const fontInfo of [{
34148        name: "Regular",
34149        fontWeight: 400,
34150        italicAngle: 0
34151      }, {
34152        name: "Bold",
34153        fontWeight: 700,
34154        italicAngle: 0
34155      }, {
34156        name: "Italic",
34157        fontWeight: 400,
34158        italicAngle: 12
34159      }, {
34160        name: "BoldItalic",
34161        fontWeight: 700,
34162        italicAngle: 12
34163      }]) {
34164        const name = `${missing}-${fontInfo.name}`;
34165        const dict = (0, _xfa_fonts.getXfaFontDict)(name);
34166        promises.push(partialEvaluator.handleSetFont(resources, [_primitives.Name.get(name), 1], null, operatorList, task, initialState, dict, {
34167          fontFamily: missing,
34168          fontWeight: fontInfo.fontWeight,
34169          italicAngle: fontInfo.italicAngle
34170        }).catch(function (reason) {
34171          (0, _util.warn)(`loadXfaFonts: "${reason}".`);
34172          return null;
34173        }));
34174      }
34175    }
34176    await Promise.all(promises);
34177    this.xfaFactory.appendFonts(pdfFonts, reallyMissingFonts);
34178  }
34179  async serializeXfaData(annotationStorage) {
34180    return this.xfaFactory ? this.xfaFactory.serializeData(annotationStorage) : null;
34181  }
34182  get version() {
34183    return this.catalog.version || this._version;
34184  }
34185  get formInfo() {
34186    const formInfo = {
34187      hasFields: false,
34188      hasAcroForm: false,
34189      hasXfa: false,
34190      hasSignatures: false
34191    };
34192    const acroForm = this.catalog.acroForm;
34193    if (!acroForm) {
34194      return (0, _util.shadow)(this, "formInfo", formInfo);
34195    }
34196    try {
34197      const fields = acroForm.get("Fields");
34198      const hasFields = Array.isArray(fields) && fields.length > 0;
34199      formInfo.hasFields = hasFields;
34200      const xfa = acroForm.get("XFA");
34201      formInfo.hasXfa = Array.isArray(xfa) && xfa.length > 0 || xfa instanceof _base_stream.BaseStream && !xfa.isEmpty;
34202      const sigFlags = acroForm.get("SigFlags");
34203      const hasSignatures = !!(sigFlags & 0x1);
34204      const hasOnlyDocumentSignatures = hasSignatures && this._hasOnlyDocumentSignatures(fields);
34205      formInfo.hasAcroForm = hasFields && !hasOnlyDocumentSignatures;
34206      formInfo.hasSignatures = hasSignatures;
34207    } catch (ex) {
34208      if (ex instanceof _core_utils.MissingDataException) {
34209        throw ex;
34210      }
34211      (0, _util.warn)(`Cannot fetch form information: "${ex}".`);
34212    }
34213    return (0, _util.shadow)(this, "formInfo", formInfo);
34214  }
34215  get documentInfo() {
34216    const docInfo = {
34217      PDFFormatVersion: this.version,
34218      Language: this.catalog.lang,
34219      EncryptFilterName: this.xref.encrypt ? this.xref.encrypt.filterName : null,
34220      IsLinearized: !!this.linearization,
34221      IsAcroFormPresent: this.formInfo.hasAcroForm,
34222      IsXFAPresent: this.formInfo.hasXfa,
34223      IsCollectionPresent: !!this.catalog.collection,
34224      IsSignaturesPresent: this.formInfo.hasSignatures
34225    };
34226    let infoDict;
34227    try {
34228      infoDict = this.xref.trailer.get("Info");
34229    } catch (err) {
34230      if (err instanceof _core_utils.MissingDataException) {
34231        throw err;
34232      }
34233      (0, _util.info)("The document information dictionary is invalid.");
34234    }
34235    if (!(infoDict instanceof _primitives.Dict)) {
34236      return (0, _util.shadow)(this, "documentInfo", docInfo);
34237    }
34238    for (const key of infoDict.getKeys()) {
34239      const value = infoDict.get(key);
34240      switch (key) {
34241        case "Title":
34242        case "Author":
34243        case "Subject":
34244        case "Keywords":
34245        case "Creator":
34246        case "Producer":
34247        case "CreationDate":
34248        case "ModDate":
34249          if (typeof value === "string") {
34250            docInfo[key] = (0, _util.stringToPDFString)(value);
34251            continue;
34252          }
34253          break;
34254        case "Trapped":
34255          if (value instanceof _primitives.Name) {
34256            docInfo[key] = value;
34257            continue;
34258          }
34259          break;
34260        default:
34261          let customValue;
34262          switch (typeof value) {
34263            case "string":
34264              customValue = (0, _util.stringToPDFString)(value);
34265              break;
34266            case "number":
34267            case "boolean":
34268              customValue = value;
34269              break;
34270            default:
34271              if (value instanceof _primitives.Name) {
34272                customValue = value;
34273              }
34274              break;
34275          }
34276          if (customValue === undefined) {
34277            (0, _util.warn)(`Bad value, for custom key "${key}", in Info: ${value}.`);
34278            continue;
34279          }
34280          if (!docInfo.Custom) {
34281            docInfo.Custom = Object.create(null);
34282          }
34283          docInfo.Custom[key] = customValue;
34284          continue;
34285      }
34286      (0, _util.warn)(`Bad value, for key "${key}", in Info: ${value}.`);
34287    }
34288    return (0, _util.shadow)(this, "documentInfo", docInfo);
34289  }
34290  get fingerprints() {
34291    function validate(data) {
34292      return typeof data === "string" && data.length > 0 && data !== EMPTY_FINGERPRINT;
34293    }
34294    function hexString(hash) {
34295      const buf = [];
34296      for (const num of hash) {
34297        const hex = num.toString(16);
34298        buf.push(hex.padStart(2, "0"));
34299      }
34300      return buf.join("");
34301    }
34302    const idArray = this.xref.trailer.get("ID");
34303    let hashOriginal, hashModified;
34304    if (Array.isArray(idArray) && validate(idArray[0])) {
34305      hashOriginal = (0, _util.stringToBytes)(idArray[0]);
34306      if (idArray[1] !== idArray[0] && validate(idArray[1])) {
34307        hashModified = (0, _util.stringToBytes)(idArray[1]);
34308      }
34309    } else {
34310      hashOriginal = (0, _crypto.calculateMD5)(this.stream.getByteRange(0, FINGERPRINT_FIRST_BYTES), 0, FINGERPRINT_FIRST_BYTES);
34311    }
34312    return (0, _util.shadow)(this, "fingerprints", [hexString(hashOriginal), hashModified ? hexString(hashModified) : null]);
34313  }
34314  async _getLinearizationPage(pageIndex) {
34315    const {
34316      catalog,
34317      linearization,
34318      xref
34319    } = this;
34320    const ref = _primitives.Ref.get(linearization.objectNumberFirst, 0);
34321    try {
34322      const obj = await xref.fetchAsync(ref);
34323      if (obj instanceof _primitives.Dict) {
34324        let type = obj.getRaw("Type");
34325        if (type instanceof _primitives.Ref) {
34326          type = await xref.fetchAsync(type);
34327        }
34328        if ((0, _primitives.isName)(type, "Page") || !obj.has("Type") && !obj.has("Kids")) {
34329          if (!catalog.pageKidsCountCache.has(ref)) {
34330            catalog.pageKidsCountCache.put(ref, 1);
34331          }
34332          if (!catalog.pageIndexCache.has(ref)) {
34333            catalog.pageIndexCache.put(ref, 0);
34334          }
34335          return [obj, ref];
34336        }
34337      }
34338      throw new _util.FormatError("The Linearization dictionary doesn't point to a valid Page dictionary.");
34339    } catch (reason) {
34340      (0, _util.warn)(`_getLinearizationPage: "${reason.message}".`);
34341      return catalog.getPageDict(pageIndex);
34342    }
34343  }
34344  getPage(pageIndex) {
34345    const cachedPromise = this._pagePromises.get(pageIndex);
34346    if (cachedPromise) {
34347      return cachedPromise;
34348    }
34349    const {
34350      catalog,
34351      linearization,
34352      xfaFactory
34353    } = this;
34354    let promise;
34355    if (xfaFactory) {
34356      promise = Promise.resolve([_primitives.Dict.empty, null]);
34357    } else if (linearization
vendor: 2,200 bytes, lines 34357-34425
34357?.pageFirst === pageIndex) {
34358      promise = this._getLinearizationPage(pageIndex);
34359    } else {
34360      promise = catalog.getPageDict(pageIndex);
34361    }
34362    promise = promise.then(([pageDict, ref]) => {
34363      return new Page({
34364        pdfManager: this.pdfManager,
34365        xref: this.xref,
34366        pageIndex,
34367        pageDict,
34368        ref,
34369        globalIdFactory: this._globalIdFactory,
34370        fontCache: catalog.fontCache,
34371        builtInCMapCache: catalog.builtInCMapCache,
34372        standardFontDataCache: catalog.standardFontDataCache,
34373        globalImageCache: catalog.globalImageCache,
34374        systemFontCache: catalog.systemFontCache,
34375        nonBlendModesSet: catalog.nonBlendModesSet,
34376        xfaFactory
34377      });
34378    });
34379    this._pagePromises.set(pageIndex, promise);
34380    return promise;
34381  }
34382  async checkFirstPage(recoveryMode = false) {
34383    if (recoveryMode) {
34384      return;
34385    }
34386    try {
34387      await this.getPage(0);
34388    } catch (reason) {
34389      if (reason instanceof _core_utils.XRefEntryException) {
34390        this._pagePromises.delete(0);
34391        await this.cleanup();
34392        throw new _core_utils.XRefParseException();
34393      }
34394    }
34395  }
34396  async checkLastPage(recoveryMode = false) {
34397    const {
34398      catalog,
34399      pdfManager
34400    } = this;
34401    catalog.setActualNumPages();
34402    let numPages;
34403    try {
34404      await Promise.all([pdfManager.ensureDoc("xfaFactory"), pdfManager.ensureDoc("linearization"), pdfManager.ensureCatalog("numPages")]);
34405      if (this.xfaFactory) {
34406        return;
34407      } else if (this.linearization) {
34408        numPages = this.linearization.numPages;
34409      } else {
34410        numPages = catalog.numPages;
34411      }
34412      if (!Number.isInteger(numPages)) {
34413        throw new _util.FormatError("Page count is not an integer.");
34414      } else if (numPages <= 1) {
34415        return;
34416      }
34417      await this.getPage(numPages - 1);
34418    } catch (reason) {
34419      this._pagePromises.delete(numPages - 1);
34420      await this.cleanup();
34421      if (reason instanceof _core_utils.XRefEntryException && !recoveryMode) {
34422        throw new _core_utils.XRefParseException();
34423      }
34424      (0, _util.warn)(`checkLastPage - invalid /Pages tree /Count: ${numPages}.`);
34425      let pagesTree;
34426      try {
34427        pagesTree = await catalog.getAllPageDicts(recoveryMode);
34428      } catch (reasonAll) {
34429        if (reasonAll instanceof _core_utils.XRefEntryException && !recoveryMode) {
34430          throw new _core_utils.XRefParseException();
34431        }
34432        catalog.setActualNumPages(1);
34433        return;
34434      }
34435      for (const [pageIndex, [pageDict, ref]] of pagesTree) {
34436        let promise;
34437        if (pageDict instanceof Error) {
34438          promise = Promise.reject(pageDict);
34439          promise.catch(() => {});
34440        } else {
34441          promise = Promise.resolve(new Page({
34442            pdfManager,
34443            xref: this.xref,
34444            pageIndex,
34445            pageDict,
34446            ref,
34447            globalIdFactory: this._globalIdFactory,
34448            fontCache: catalog.fontCache,
34449            builtInCMapCache: catalog.builtInCMapCache,
34450            standardFontDataCache: catalog.standardFontDataCache,
34451            globalImageCache: catalog.globalImageCache,
34452            systemFontCache: catalog.systemFontCache,
34453            nonBlendModesSet: catalog.nonBlendModesSet,
34454            xfaFactory: null
34455          }));
34456        }
34457        this._pagePromises.set(pageIndex, promise);
34458      }
34459      catalog.setActualNumPages(pagesTree.size);
34460    }
34461  }
34462  fontFallback(id, handler) {
34463    return this.catalog.fontFallback(id, handler);
34464  }
34465  async cleanup(manuallyTriggered = false) {
34466    return this.catalog ? this.catalog.cleanup(manuallyTriggered) : (0, _cleanup_helper.clearGlobalCaches)();
34467  }
34468  #collectFieldObjects(name, fieldRef, promises, annotationGlobals) {
34469    const field = this.xref.fetchIfRef(fieldRef);
34470    if (field.has("T")) {
34471      const partName = (0, _util.stringToPDFString)(field.get("T"));
34472      name = name === "" ? partName : `${name}.${partName}`;
34473    }
34474    if (!promises.has(name)) {
34475      promises.set(name, []);
34476    }
34477    promises.get(name).push(_annotation.AnnotationFactory.create(this.xref, fieldRef, annotationGlobals, this._localIdFactory, true, null).then(annotation => annotation?.getFieldObject()).catch(function (reason) {
34478      (0, _util.warn)(`#collectFieldObjects: "${reason}".`);
34479      return null;
34480    }));
34481    if (field.has("Kids")) {
34482      for (const kid of field.get("Kids")) {
34483        this.#collectFieldObjects(name, kid, promises, annotationGlobals);
34484      }
34485    }
34486  }
34487  get fieldObjects() {
34488    if (!this.formInfo.hasFields) {
34489      return (0, _util.shadow)(this, "fieldObjects", Promise.resolve(null));
34490    }
34491    const promise = this.pdfManager.ensureDoc("annotationGlobals").then(async annotationGlobals => {
34492      if (!annotationGlobals) {
34493        return null;
34494      }
34495      const allFields = Object.create(null);
34496      const fieldPromises = new Map();
34497      for (const fieldRef of this.catalog.acroForm.get("Fields")) {
34498        this.#collectFieldObjects("", fieldRef, fieldPromises, annotationGlobals);
34499      }
34500      const allPromises = [];
34501      for (const [name, promises] of fieldPromises) {
34502        allPromises.push(Promise.all(promises).then(fields => {
34503          fields = fields.filter(field => !!field);
34504          if (fields.length > 0) {
34505            allFields[name] = fields;
34506          }
34507        }));
34508      }
34509      await Promise.all(allPromises);
34510      return allFields;
34511    });
34512    return (0, _util.shadow)(this, "fieldObjects", promise);
34513  }
34514  get hasJSActions() {
34515    const promise = this.pdfManager.ensureDoc("_parseHasJSActions");
34516    return (0, _util.shadow)(this, "hasJSActions", promise);
34517  }
34518  async _parseHasJSActions() {
34519    const [catalogJsActions, fieldObjects] = await Promise.all([this.pdfManager.ensureCatalog("jsActions"), this.pdfManager.ensureDoc("fieldObjects")]);
34520    if (catalogJsActions) {
34521      return true;
34522    }
34523    if (fieldObjects) {
34524      return Object.values(fieldObjects).some(fieldObject => fieldObject.some(object => object.actions !== null));
34525    }
34526    return false;
34527  }
34528  get calculationOrderIds() {
34529    const acroForm = this.catalog.acroForm;
34530    if (!acroForm?.has("CO")) {
34531      return (0, _util.shadow)(this, "calculationOrderIds", null);
34532    }
34533    const calculationOrder = acroForm.get("CO");
34534    if (!Array.isArray(calculationOrder) || calculationOrder.length === 0) {
34535      return (0, _util.shadow)(this, "calculationOrderIds", null);
34536    }
34537    const ids = [];
34538    for (const id of calculationOrder) {
34539      if (id instanceof _primitives.Ref) {
34540        ids.push(id.toString());
34541      }
34542    }
34543    if (ids.length === 0) {
34544      return (0, _util.shadow)(this, "calculationOrderIds", null);
34545    }
34546    return (0, _util.shadow)(this, "calculationOrderIds", ids);
34547  }
34548  get annotationGlobals() {
34549    return (0, _util.shadow)(this, "annotationGlobals", _annotation.AnnotationFactory.createGlobals(this.pdfManager));
34550  }
34551}
34552exports.PDFDocument = PDFDocument;
34553
34554/***/ }),
34555/* 10 */
34556/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
34557
34558
34559
34560Object.defineProperty(exports, "__esModule", ({
34561  value: true
34562}));
34563exports.PopupAnnotation = exports.MarkupAnnotation = exports.AnnotationFactory = exp
34563orts.AnnotationBorderStyle = exports.Annotation = void 0;
34564exports.getQuadPoints = getQuadPoints;
34565var _util = __w_pdfjs_require__(2);
34566var _core_utils = __w_pdfjs_require__(3);
34567var _default_appearance = __w_pdfjs_require__(11);
34568var _primitives = __w_pdfjs_require__(4);
34569var _stream = __w_pdfjs_require__(8);
34570var _base_stream = __w_pdfjs_require__(5);
34571var _bidi = __w_pdfjs_require__(60);
34572var _catalog = __w_pdfjs_require__(66);
34573var _colorspace = __w_pdfjs_require__(12);
34574var _file_spec = __w_pdfjs_require__(69);
34575var _jpeg_stream = __w_pdfjs_require__(26);
34576var _object_loader = __w_pdfjs_require__(76);
34577var _operator_list = __w_pdfjs_require__(64);
34578var _writer = __w_pdfjs_require__(73);
34579var _factory = __w_pdfjs_require__(77);
34580class AnnotationFactory {
34581  static createGlobals(pdfManager) {
34582    return Promise.all([pdfManager.ensureCatalog("acroForm"), pdfManager.ensureDoc("xfaDatasets"), pdfManager.ensureCatalog("structTreeRoot"), pdfManager.ensureCatalog("baseUrl"), pdfManager.ensureCatalog("attachments")]).then(([acroForm, xfaDatasets, structTreeRoot, baseUrl, attachments]) => {
34583      return {
34584        pdfManager,
34585        acroForm: acroForm instanceof _primitives.Dict ? acroForm : _primitives.Dict.empty,
34586        xfaDatasets,
34587        structTreeRoot,
34588        baseUrl,
34589        attachments
34590      };
34591    }, reason => {
34592      (0, _util.warn)(`createGlobals: "${reason}".`);
34593      return null;
34594    });
34595  }
34596  static async create(xref, ref, annotationGlobals, idFactory, collectFields, pageRef) {
34597    const pageIndex = collectFields ? await this._getPageIndex(xref, ref, annotationGlobals.pdfManager) : null;
34598    return annotationGlobals.pdfManager.ensure(this, "_create", [xref, ref, annotationGlobals, idFactory, collectFields, pageIndex, pageRef]);
34599  }
34600  static _create(xref, ref, annotationGlobals, idFactory, collectFields = false, pageIndex = null, pageRef = null) {
34601    const dict = xref.fetchIfRef(ref);
34602    if (!(dict instanceof _primitives.Dict)) {
34603      return undefined;
34604    }
34605    const {
34606      acroForm,
34607      pdfManager
34608    } = annotationGlobals;
34609    const id = ref instanceof _primitives.Ref ? ref.toString() : `annot_${idFactory.createObjId()}`;
34610    let subtype = dict.get("Subtype");
34611    subtype = subtype instanceof _primitives.Name ? subtype.name : null;
34612    const parameters = {
34613      xref,
34614      ref,
34615      dict,
34616      subtype,
34617      id,
34618      annotationGlobals,
34619      collectFields,
34620      needAppearances: !collectFields && acroForm.get("NeedAppearances") === true,
34621      pageIndex,
34622      evaluatorOptions: pdfManager.evaluatorOptions,
34623      pageRef
34624    };
34625    switch (subtype) {
34626      case "Link":
34627        return new LinkAnnotation(parameters);
34628      case "Text":
34629        return new TextAnnotation(parameters);
34630      case "Widget":
34631        let fieldType = (0, _core_utils.getInheritableProperty)({
34632          dict,
34633          key: "FT"
34634        });
34635        fieldType = fieldType instanceof _primitives.Name ? fieldType.name : null;
34636        switch (fieldType) {
34637          case "Tx":
34638            return new TextWidgetAnnotation(parameters);
34639          case "Btn":
34640            return new ButtonWidgetAnnotation(parameters);
34641          case "Ch":
34642            return new ChoiceWidgetAnnotation(parameters);
34643          case "Sig":
34644            return new SignatureWidgetAnnotation(parameters);
34645        }
34646        (0, _util.warn)(`Unimplemented widget field type "${fieldType}", ` + "falling back to base field type.");
34647        return new WidgetAnnotation(parameters);
34648      case "Popup":
34649        return new PopupAnnotation(parameters);
34650      case "FreeText":
34651        return new FreeTextAnnotation(parameters);
34652      case "Line":
34653        return new LineAnnotation(parameters);
34654      case "Square":
34655        return new SquareAnnotation(parameters);
34656      case "Circle":
34657        return new CircleAnnotation(parameters);
34658      case "PolyLine":
34659        return new PolylineAnnotation(parameters);
34660      case "Polygon":
34661        return new PolygonAnnotation(parameters);
34662      case "Caret":
34663        return new CaretAnnotation(parameters);
34664      case "Ink":
34665        return new InkAnnotation(parameters);
34666      case "Highlight":
34667        return new HighlightAnnotation(parameters);
34668      case "Underline":
34669        return new UnderlineAnnotation(parameters);
34670      case "Squiggly":
34671        return new SquigglyAnnotation(parameters);
34672      case "StrikeOut":
34673        return new StrikeOutAnnotation(parameters);
34674      case "Stamp":
34675        return new StampAnnotation(parameters);
34676      case "FileAttachment":
34677        return new FileAttachmentAnnotation(parameters);
34678      default:
34679        if (!collectFields) {
34680          if (!subtype) {
34681            (0, _util.warn)("Annotation is missing the required /Subtype.");
34682          } else {
34683            (0, _util.warn)(`Unimplemented annotation type "${subtype}", ` + "falling back to base annotation.");
34684          }
34685        }
34686        return new Annotation(parameters);
34687    }
34688  }
34689  static async _getPageIndex(xref, ref, pdfManager) {
34690    try {
34691      const annotDict = await xref.fetchIfRefAsync(ref);
34692      if (!(annotDict instanceof _primitives.Dict)) {
34693        return -1;
34694      }
34695      const pageRef = annotDict.getRaw("P");
34696      if (pageRef instanceof _primitives.Ref) {
34697        try {
34698          const pageIndex = await pdfManager.ensureCatalog("getPageIndex", [pageRef]);
34699          return pageIndex;
34700        } catch (ex) {
34701          (0, _util.info)(`_getPageIndex -- not a valid page reference: "${ex}".`);
34702        }
34703      }
34704      if (annotDict.has("Kids")) {
34705        return -1;
34706      }
34707      const numPages = await pdfManager.ensureDoc("numPages");
34708      for (let pageIndex = 0; pageIndex < numPages; pageIndex++) {
34709        const page = await pdfManager.getPage(pageIndex);
34710        const annotations = await pdfManager.ensure(page, "annotations");
34711        for (const annotRef of annotations) {
34712          if (annotRef instanceof _primitives.Ref && (0, _primitives.isRefsEqual)(annotRef, ref)) {
34713            return pageIndex;
34714          }
34715        }
34716      }
34717    } catch (ex) {
34718      (0, _util.warn)(`_getPageIndex: "${ex}".`);
34719    }
34720    return -1;
34721  }
34722  static generateImages(annotations, xref, isOffscreenCanvasSupported) {
34723    if (!isOffscreenCanvasSupported) {
34724      (0, _util.warn)("generateImages: OffscreenCanvas is not supported, cannot save or print some annotations with images.");
34725      return null;
34726    }
34727    let imagePromises;
34728    for (const {
34729      bitmapId,
34730      bitmap
34731    } of annotations) {
34732      if (!bitmap) {
34733        continue;
34734      }
34735      imagePromises ||= new Map();
34736      imagePromises.set(bitmapId, StampAnnotation.createImage(bitmap, xref));
34737    }
34738    return imagePromises;
34739  }
34740  static async saveNewAnnotations(evaluator, task, annotations, imagePromises) {
34741    const xref = evaluator.xref;
34742    let baseFontRef;
34743    const dependencies = [];
34744    const promises = [];
34745    const {
34746      isOffscreenCanvasSupported
34747    } = evaluator.options;
34748    for (const annotation of annotations) {
34749      if (annotation.deleted) {
34750        continue;
34751      }
34752      switch (annotation.annotationType) {
34753        case _util.AnnotationEditorType.FREETEXT:
34754          if (!baseFontRef) {
34755            const baseFont = new _primitives.Dict(xref);
34756            baseFont.set("BaseFont", _primitives.Name.get("Helvetica"));
34757            baseFont.set("Type", _primitives.Name.get("Font"));
34758            baseFont.set("Subtype", _primitives.Name.get("Type1"));
34759            baseFont.set("Encoding", _primitives.Name.get("WinAnsiEncoding"));
34760            const buffer = [];
34761            baseFontRef = xref.getNewTemporaryRef();
34762            await (0, _writer.writeObject)(baseFontRef, baseFont, buffer, xref);
34763            dependencies.push({
34764              ref: baseFontRef,
34765              data: buffer.join("")
34766            });
34767          }
34768          promises.push(FreeTextAnnotation.createNewAnnotation(xref, annotation, dependencies, {
34769            evaluator,
34770            task,
34771            baseFontRef
34772          }));
34773          break;
34774        case _util.AnnotationEditorType.INK:
34775          promises.push(InkAnnotation.createNewAnnotation(xref, annotation, dependencies));
34776          break;
34777        case _util.AnnotationEditorType.STAMP:
34778          if (!isOffscreenCanvasSupported) {
34779            break;
34780          }
34781          const image = await imagePromises.get(annotation.bitmapId);
34782          if (image.imageStream) {
34783            const {
34784              imageStream,
34785              smaskStream
34786            } = image;
34787            const buffer = [];
34788            if (smaskStream) {
34789              const smaskRef = xref.getNewTemporaryRef();
34790              await (0, _writer.writeObject)(smaskRef, smaskStream, buffer, xref);
34791              dependencies.push({
34792                ref: smaskRef,
34793                data: buffer.join("")
34794              });
34795              imageStream.dict.set("SMask", smaskRef);
34796              buffer.length = 0;
34797            }
34798            const imageRef = image.imageRef = xref.getNewTemporaryRef();
34799            await (0, _writer.writeObject)(imageRef, imageStream, buffer, xref);
34800            dependencies.push({
34801              ref: imageRef,
34802              data: buffer.join("")
34803            });
34804            image.imageStream = image.smaskStream = null;
34805          }
34806          promises.push(StampAnnotation.createNewAnnotation(xref, annotation, dependencies, {
34807            image
34808          }));
34809          break;
34810      }
34811    }
34812    return {
34813      annotations: await Promise.all(promises),
34814      dependencies
34815    };
34816  }
34817  static async printNewAnnotations(annotationGlobals, evaluator, task, annotations, imagePromises) {
34818    if (!annotations) {
34819      return null;
34820    }
34821    const {
34822      options,
34823      xref
34824    } = evaluator;
34825    const promises = [];
34826    for (const annotation of annotations) {
34827      if (annotation.deleted) {
34828        continue;
34829      }
34830      switch (annotation.annotationType) {
34831        case _util.AnnotationEditorType.FREETEXT:
34832          promises.push(FreeTextAnnotation.createNewPrintAnnotation(annotationGlobals, xref, annotation, {
34833            evaluator,
34834            task,
34835            evaluatorOptions: options
34836          }));
34837          break;
34838        case _util.AnnotationEditorType.INK:
34839          promises.push(InkAnnotation.createNewPrintAnnotation(annotationGlobals, xref, annotation, {
34840            evaluatorOptions: options
34841          }));
34842          break;
34843        case _util.AnnotationEditorType.STAMP:
34844          if (!options.isOffscreenCanvasSupported) {
34845            break;
34846          }
34847          const image = await imagePromises.get(annotation.bitmapId);
34848          if (image.imageStream) {
34849            const {
34850              imageStream,
34851              smaskStream
34852            } = image;
34853            if (smaskStream) {
34854              imageStream.dict.set("SMask", smaskStream);
34855            }
34856            image.imageRef = new _jpeg_stream.JpegStream(imageStream, imageStream.length);
34857            image.imageStream = image.smaskStream = null;
34858          }
34859          promises.push(StampAnnotation.createNewPrintAnnotation(annotationGlobals, xref, annotation, {
34860            image,
34861            evaluatorOptions: options
34862          }));
34863          break;
34864      }
34865    }
34866    return Promise.all(promises);
34867  }
34868}
34869exports.AnnotationFactory = AnnotationFactory;
34870function getRgbColor(color, defaultColor = new Uint8ClampedArray(3)) {
34871  if (!Array.isArray(color)) {
34872    return defaultColor;
34873  }
34874  const rgbColor = defaultColor || new Uint8ClampedArray(3);
34875  switch (color.length) {
34876    case 0:
34877      return null;
34878    case 1:
34879      _colorspace.ColorSpace.singletons.gray.getRgbItem(color, 0, rgbColor, 0);
34880      return rgbColor;
34881    case 3:
34882      _colorspace.ColorSpace.singletons.rgb.getRgbItem(color, 0, rgbColor, 0);
34883      return rgbColor;
34884    case 4:
34885      _colorspace.ColorSpace.singletons.cmyk.getRgbItem(color, 0, rgbColor, 0);
34886      return rgbColor;
34887    default:
34888      return defaultColor;
34889  }
34890}
34891function getPdfColorArray(color) {
34892  return Array.from(color, c => c / 255);
34893}
34894function getQuadPoints(dict, rect) {
34895  const quadPoints = dict.getArray("QuadPoints");
34896  if (!Array.isArray(quadPoints) || quadPoints.length === 0 || quadPoints.length % 8 > 0) {
34897    return null;
34898  }
34899  const quadPointsLists = [];
34900  for (let i = 0, ii = quadPoints.length / 8; i < ii; i++) {
34901    let minX = Infinity,
34902      maxX = -Infinity,
34903      minY = Infinity,
34904      maxY = -Infinity;
34905    for (let j = i * 8, jj = i * 8 + 8; j < jj; j += 2) {
34906      const x = quadPoints[j];
34907      const y = quadPoints[j + 1];
34908      minX = Math.min(x, minX);
34909      maxX = Math.max(x, maxX);
34910      minY = Math.min(y, minY);
34911      maxY = Math.max(y, maxY);
34912    }
34913    if (rect !== null && (minX < rect[0] || maxX > rect[2] || minY < rect[1] || maxY > rect[3])) {
34914      return null;
34915    }
34916    quadPointsLists.push([{
34917      x: minX,
34918      y: maxY
34919    }, {
34920      x: maxX,
34921      y: maxY
34922    }, {
34923      x: minX,
34924      y: minY
34925    }, {
34926      x: maxX,
34927      y: minY
34928    }]);
34929  }
34930  return quadPointsLists;
34931}
34932function getTransformMatrix(rect, bbox, matrix) {
34933  const [minX, minY, maxX, maxY] = _util.Util.getAxialAlignedBoundingBox(bbox, matrix);
34934  if (minX === maxX || minY === maxY) {
34935    return [1, 0, 0, 1, rect[0], rect[1]];
34936  }
34937  const xRatio = (rect[2] - rect[0]) / (maxX - minX);
34938  const yRatio = (rect[3] - rect[1]) / (maxY - minY);
34939  return [xRatio, 0, 0, yRatio, rect[0] - minX * xRatio, rect[1] - minY * yRatio];
34940}
34941class Annotation {
34942  constructor(params) {
34943    const {
34944      dict,
34945      xref,
34946      annotationGlobals
34947    } = params;
34948    this.setTitle(dict.get("T"));
34949    this.setContents(dict.get("Contents"));
34950    this.setModificationDate(dict.get("M"));
34951    this.setFlags(dict.get("F"));
34952    this.setRectangle(dict.getArray("Rect"));
34953    this.setColor(dict.getArray("C"));
34954    this.setBorderStyle(dict);
34955    this.setAppearance(dict);
34956    this.setOptionalContent(dict);
34957    const MK = dict.get("MK");
34958    this.setBorderAndBackgroundColors(MK);
34959    this.setRotation(MK, dict);
34960    this.ref = params.ref instanceof _primitives.Ref ? params.ref : null;
34961    this._streams = [];
34962    if (this.appearance) {
34963      this._streams.push(this.appearance);
34964    }
34965    const isLocked = !!(this.flags & _util.AnnotationFlag.LOCKED);
34966    const isContentLocked = !!(this.flags & _util.AnnotationFlag.LOCKEDCONTENTS);
34967    if (annotationGlobals.structTreeRoot) {
34968      let structParent = dict.get("StructParent");
34969      structParent = Number.isInteger(structParent) && structParent >= 0 ? structParent : -1;
34970      annotationGlobals.structTreeRoot.addAnnotationIdToPage(params.pageRef, structParent);
34971    }
34972    this.data = {
34973      annotationFlags: this.flags,
34974      borderStyle: this.borderStyle,
34975      color: this.color,
34976      backgroundColor: this.backgroundColor,
34977      borderColor: this.borderColor,
34978      rotation: this.rotation,
34979      contentsObj: this._contents,
34980      hasAppearance: !!this.appearance,
34981      id: params.id,
34982      modificationDate: this.modificationDate,
34983      rect: this.rectangle,
34984      subtype: params.subtype,
34985      hasOwnCanvas: false,
34986      noRotate: !!(this.flags & _util.AnnotationFlag.NOROTATE),
34987      noHTML: isLocked && isContentLocked
34988    };
34989    if (params.collectFields) {
34990      const kids = dict.get("Kids");
34991      if (Array.isArray(kids)) {
34992        const kidIds = [];
34993        for (const kid of kids) {
34994          if (kid instanceof _primitives.Ref) {
34995            kidIds.push(kid.toString());
34996          }
34997        }
34998        if (kidIds.length !== 0) {
34999          this.data.kidIds = kidIds;
35000        }
35001      }
35002      this.data.actions = (0, _core_utils.collectActions)(xref, dict, _util.AnnotationActionEventType);
35003      this.data.fieldName = this._constructFieldName(dict);
35004      this.data.pageIndex = params.pageIndex;
35005    }
35006    this._isOffscreenCanvasSupported = params.evaluatorOptions.isOffscreenCanvasSupported;
35007    this._fallbackFontDict = null;
35008    this._needAppearances = false;
35009  }
35010  _hasFlag(flags, flag) {
35011    return !!(flags & flag);
35012  }
35013  _isViewable(flags) {
35014    return !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, _util.AnnotationFlag.NOVIEW);
35015  }
35016  _isPrintable(flags) {
35017    return this._hasFlag(flags, _util.AnnotationFlag.PRINT) && !this._hasFlag(flags, _util.AnnotationFlag.HIDDEN) && !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE);
35018  }
35019  mustBeViewed(annotationStorage, _renderForms) {
35020    const noView = annotationStorage?.get(this.data.id)?.noView;
35021    if (noView !== undefined) {
35022      return !noView;
35023    }
35024    return this.viewable && !this._hasFlag(this.flags, _util.AnnotationFlag.HIDDEN);
35025  }
35026  mustBePrinted(annotationStorage) {
35027    const noPrint = annotationStorage?.get(this.data.id)?.noPrint;
35028    if (noPrint !== undefined) {
35029      return !noPrint;
35030    }
35031    return this.printable;
35032  }
35033  get viewable() {
35034    if (this.data.quadPoints === null) {
35035      return false;
35036    }
35037    if (this.flags === 0) {
35038      return true;
35039    }
35040    return this._isViewable(this.flags);
35041  }
35042  get printable() {
35043    if (this.data.quadPoints === null) {
35044      return false;
vendor: 20,358 bytes, lines 35045-35677
35045    }
35046    if (this.flags === 0) {
35047      return false;
35048    }
35049    return this._isPrintable(this.flags);
35050  }
35051  _parseStringHelper(data) {
35052    const str = typeof data === "string" ? (0, _util.stringToPDFString)(data) : "";
35053    const dir = str && (0, _bidi.bidi)(str).dir === "rtl" ? "rtl" : "ltr";
35054    return {
35055      str,
35056      dir
35057    };
35058  }
35059  setDefaultAppearance(params) {
35060    const {
35061      dict,
35062      annotationGlobals
35063    } = params;
35064    const defaultAppearance = (0, _core_utils.getInheritableProperty)({
35065      dict,
35066      key: "DA"
35067    }) || annotationGlobals.acroForm.get("DA");
35068    this._defaultAppearance = typeof defaultAppearance === "string" ? defaultAppearance : "";
35069    this.data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance);
35070  }
35071  setTitle(title) {
35072    this._title = this._parseStringHelper(title);
35073  }
35074  setContents(contents) {
35075    this._contents = this._parseStringHelper(contents);
35076  }
35077  setModificationDate(modificationDate) {
35078    this.modificationDate = typeof modificationDate === "string" ? modificationDate : null;
35079  }
35080  setFlags(flags) {
35081    this.flags = Number.isInteger(flags) && flags > 0 ? flags : 0;
35082  }
35083  hasFlag(flag) {
35084    return this._hasFlag(this.flags, flag);
35085  }
35086  setRectangle(rectangle) {
35087    this.rectangle = Array.isArray(rectangle) && rectangle.length === 4 ? _util.Util.normalizeRect(rectangle) : [0, 0, 0, 0];
35088  }
35089  setColor(color) {
35090    this.color = getRgbColor(color);
35091  }
35092  setLineEndings(lineEndings) {
35093    this.lineEndings = ["None", "None"];
35094    if (Array.isArray(lineEndings) && lineEndings.length === 2) {
35095      for (let i = 0; i < 2; i++) {
35096        const obj = lineEndings[i];
35097        if (obj instanceof _primitives.Name) {
35098          switch (obj.name) {
35099            case "None":
35100              continue;
35101            case "Square":
35102            case "Circle":
35103            case "Diamond":
35104            case "OpenArrow":
35105            case "ClosedArrow":
35106            case "Butt":
35107            case "ROpenArrow":
35108            case "RClosedArrow":
35109            case "Slash":
35110              this.lineEndings[i] = obj.name;
35111              continue;
35112          }
35113        }
35114        (0, _util.warn)(`Ignoring invalid lineEnding: ${obj}`);
35115      }
35116    }
35117  }
35118  setRotation(mk, dict) {
35119    this.rotation = 0;
35120    let angle = mk instanceof _primitives.Dict ? mk.get("R") || 0 : dict.get("Rotate") || 0;
35121    if (Number.isInteger(angle) && angle !== 0) {
35122      angle %= 360;
35123      if (angle < 0) {
35124        angle += 360;
35125      }
35126      if (angle % 90 === 0) {
35127        this.rotation = angle;
35128      }
35129    }
35130  }
35131  setBorderAndBackgroundColors(mk) {
35132    if (mk instanceof _primitives.Dict) {
35133      this.borderColor = getRgbColor(mk.getArray("BC"), null);
35134      this.backgroundColor = getRgbColor(mk.getArray("BG"), null);
35135    } else {
35136      this.borderColor = this.backgroundColor = null;
35137    }
35138  }
35139  setBorderStyle(borderStyle) {
35140    this.borderStyle = new AnnotationBorderStyle();
35141    if (!(borderStyle instanceof _primitives.Dict)) {
35142      return;
35143    }
35144    if (borderStyle.has("BS")) {
35145      const dict = borderStyle.get("BS");
35146      const dictType = dict.get("Type");
35147      if (!dictType || (0, _primitives.isName)(dictType, "Border")) {
35148        this.borderStyle.setWidth(dict.get("W"), this.rectangle);
35149        this.borderStyle.setStyle(dict.get("S"));
35150        this.borderStyle.setDashArray(dict.getArray("D"));
35151      }
35152    } else if (borderStyle.has("Border")) {
35153      const array = borderStyle.getArray("Border");
35154      if (Array.isArray(array) && array.length >= 3) {
35155        this.borderStyle.setHorizontalCornerRadius(array[0]);
35156        this.borderStyle.setVerticalCornerRadius(array[1]);
35157        this.borderStyle.setWidth(array[2], this.rectangle);
35158        if (array.length === 4) {
35159          this.borderStyle.setDashArray(array[3], true);
35160        }
35161      }
35162    } else {
35163      this.borderStyle.setWidth(0);
35164    }
35165  }
35166  setAppearance(dict) {
35167    this.appearance = null;
35168    const appearanceStates = dict.get("AP");
35169    if (!(appearanceStates instanceof _primitives.Dict)) {
35170      return;
35171    }
35172    const normalAppearanceState = appearanceStates.get("N");
35173    if (normalAppearanceState instanceof _base_stream.BaseStream) {
35174      this.appearance = normalAppearanceState;
35175      return;
35176    }
35177    if (!(normalAppearanceState instanceof _primitives.Dict)) {
35178      return;
35179    }
35180    const as = dict.get("AS");
35181    if (!(as instanceof _primitives.Name) || !normalAppearanceState.has(as.name)) {
35182      return;
35183    }
35184    const appearance = normalAppearanceState.get(as.name);
35185    if (appearance instanceof _base_stream.BaseStream) {
35186      this.appearance = appearance;
35187    }
35188  }
35189  setOptionalContent(dict) {
35190    this.oc = null;
35191    const oc = dict.get("OC");
35192    if (oc instanceof _primitives.Name) {
35193      (0, _util.warn)("setOptionalContent: Support for /Name-entry is not implemented.");
35194    } else if (oc instanceof _primitives.Dict) {
35195      this.oc = oc;
35196    }
35197  }
35198  loadResources(keys, appearance) {
35199    return appearance.dict.getAsync("Resources").then(resources => {
35200      if (!resources) {
35201        return undefined;
35202      }
35203      const objectLoader = new _object_loader.ObjectLoader(resources, keys, resources.xref);
35204      return objectLoader.load().then(function () {
35205        return resources;
35206      });
35207    });
35208  }
35209  async getOperatorList(evaluator, task, intent, renderForms, annotationStorage) {
35210    const data = this.data;
35211    let appearance = this.appearance;
35212    const isUsingOwnCanvas = !!(this.data.hasOwnCanvas && intent & _util.RenderingIntentFlag.DISPLAY);
35213    if (!appearance) {
35214      if (!isUsingOwnCanvas) {
35215        return {
35216          opList: new _operator_list.OperatorList(),
35217          separateForm: false,
35218          separateCanvas: false
35219        };
35220      }
35221      appearance = new _stream.StringStream("");
35222      appearance.dict = new _primitives.Dict();
35223    }
35224    const appearanceDict = appearance.dict;
35225    const resources = await this.loadResources(["ExtGState", "ColorSpace", "Pattern", "Shading", "XObject", "Font"], appearance);
35226    const bbox = appearanceDict.getArray("BBox") || [0, 0, 1, 1];
35227    const matrix = appearanceDict.getArray("Matrix") || [1, 0, 0, 1, 0, 0];
35228    const transform = getTransformMatrix(data.rect, bbox, matrix);
35229    const opList = new _operator_list.OperatorList();
35230    let optionalContent;
35231    if (this.oc) {
35232      optionalContent = await evaluator.parseMarkedContentProps(this.oc, null);
35233    }
35234    if (optionalContent !== undefined) {
35235      opList.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
35236    }
35237    opList.addOp(_util.OPS.beginAnnotation, [data.id, data.rect, transform, matrix, isUsingOwnCanvas]);
35238    await evaluator.getOperatorList({
35239      stream: appearance,
35240      task,
35241      resources,
35242      operatorList: opList,
35243      fallbackFontDict: this._fallbackFontDict
35244    });
35245    opList.addOp(_util.OPS.endAnnotation, []);
35246    if (optionalContent !== undefined) {
35247      opList.addOp(_util.OPS.endMarkedContent, []);
35248    }
35249    this.reset();
35250    return {
35251      opList,
35252      separateForm: false,
35253      separateCanvas: isUsingOwnCanvas
35254    };
35255  }
35256  async save(evaluator, task, annotationStorage) {
35257    return null;
35258  }
35259  get hasTextContent() {
35260    return false;
35261  }
35262  async extractTextContent(evaluator, task, viewBox) {
35263    if (!this.appearance) {
35264      return;
35265    }
35266    const resources = await this.loadResources(["ExtGState", "Font", "Properties", "XObject"], this.appearance);
35267    const text = [];
35268    const buffer = [];
35269    let firstPosition = null;
35270    const sink = {
35271      desiredSize: Math.Infinity,
35272      ready: true,
35273      enqueue(chunk, size) {
35274        for (const item of chunk.items) {
35275          if (item.str === undefined) {
35276            continue;
35277          }
35278          firstPosition ||= item.transform.slice(-2);
35279          buffer.push(item.str);
35280          if (item.hasEOL) {
35281            text.push(buffer.join(""));
35282            buffer.length = 0;
35283          }
35284        }
35285      }
35286    };
35287    await evaluator.getTextContent({
35288      stream: this.appearance,
35289      task,
35290      resources,
35291      includeMarkedContent: true,
35292      sink,
35293      viewBox
35294    });
35295    this.reset();
35296    if (buffer.length) {
35297      text.push(buffer.join(""));
35298    }
35299    if (text.length > 1 || text[0]) {
35300      const appearanceDict = this.appearance.dict;
35301      const bbox = appearanceDict.getArray("BBox") || [0, 0, 1, 1];
35302      const matrix = appearanceDict.getArray("Matrix") || [1, 0, 0, 1, 0, 0];
35303      const rect = this.data.rect;
35304      const transform = getTransformMatrix(rect, bbox, matrix);
35305      transform[4] -= rect[0];
35306      transform[5] -= rect[1];
35307      firstPosition = _util.Util.applyTransform(firstPosition, transform);
35308      firstPosition = _util.Util.applyTransform(firstPosition, matrix);
35309      this.data.textPosition = firstPosition;
35310      this.data.textContent = text;
35311    }
35312  }
35313  getFieldObject() {
35314    if (this.data.kidIds) {
35315      return {
35316        id: this.data.id,
35317        actions: this.data.actions,
35318        name: this.data.fieldName,
35319        strokeColor: this.data.borderColor,
35320        fillColor: this.data.backgroundColor,
35321        type: "",
35322        kidIds: this.data.kidIds,
35323        page: this.data.pageIndex,
35324        rotation: this.rotation
35325      };
35326    }
35327    return null;
35328  }
35329  reset() {
35330    for (const stream of this._streams) {
35331      stream.reset();
35332    }
35333  }
35334  _constructFieldName(dict) {
35335    if (!dict.has("T") && !dict.has("Parent")) {
35336      (0, _util.warn)("Unknown field name, falling back to empty field name.");
35337      return "";
35338    }
35339    if (!dict.has("Parent")) {
35340      return (0, _util.stringToPDFString)(dict.get("T"));
35341    }
35342    const fieldName = [];
35343    if (dict.has("T")) {
35344      fieldName.unshift((0, _util.stringToPDFString)(dict.get("T")));
35345    }
35346    let loopDict = dict;
35347    const visited = new _primitives.RefSet();
35348    if (dict.objId) {
35349      visited.put(dict.objId);
35350    }
35351    while (loopDict.has("Parent")) {
35352      loopDict = loopDict.get("Parent");
35353      if (!(loopDict instanceof _primitives.Dict) || loopDict.objId && visited.has(loopDict.objId)) {
35354        break;
35355      }
35356      if (loopDict.objId) {
35357        visited.put(loopDict.objId);
35358      }
35359      if (loopDict.has("T")) {
35360        fieldName.unshift((0, _util.stringToPDFString)(loopDict.get("T")));
35361      }
35362    }
35363    return fieldName.join(".");
35364  }
35365}
35366exports.Annotation = Annotation;
35367class AnnotationBorderStyle {
35368  constructor() {
35369    this.width = 1;
35370    this.style = _util.AnnotationBorderStyleType.SOLID;
35371    this.dashArray = [3];
35372    this.horizontalCornerRadius = 0;
35373    this.verticalCornerRadius = 0;
35374  }
35375  setWidth(width, rect = [0, 0, 0, 0]) {
35376    if (width instanceof _primitives.Name) {
35377      this.width = 0;
35378      return;
35379    }
35380    if (typeof width === "number") {
35381      if (width > 0) {
35382        const maxWidth = (rect[2] - rect[0]) / 2;
35383        const maxHeight = (rect[3] - rect[1]) / 2;
35384        if (maxWidth > 0 && maxHeight > 0 && (width > maxWidth || width > maxHeight)) {
35385          (0, _util.warn)(`AnnotationBorderStyle.setWidth - ignoring width: ${width}`);
35386          width = 1;
35387        }
35388      }
35389      this.width = width;
35390    }
35391  }
35392  setStyle(style) {
35393    if (!(style instanceof _primitives.Name)) {
35394      return;
35395    }
35396    switch (style.name) {
35397      case "S":
35398        this.style = _util.AnnotationBorderStyleType.SOLID;
35399        break;
35400      case "D":
35401        this.style = _util.AnnotationBorderStyleType.DASHED;
35402        break;
35403      case "B":
35404        this.style = _util.AnnotationBorderStyleType.BEVELED;
35405        break;
35406      case "I":
35407        this.style = _util.AnnotationBorderStyleType.INSET;
35408        break;
35409      case "U":
35410        this.style = _util.AnnotationBorderStyleType.UNDERLINE;
35411        break;
35412      default:
35413        break;
35414    }
35415  }
35416  setDashArray(dashArray, forceStyle = false) {
35417    if (Array.isArray(dashArray) && dashArray.length > 0) {
35418      let isValid = true;
35419      let allZeros = true;
35420      for (const element of dashArray) {
35421        const validNumber = +element >= 0;
35422        if (!validNumber) {
35423          isValid = false;
35424          break;
35425        } else if (element > 0) {
35426          allZeros = false;
35427        }
35428      }
35429      if (isValid && !allZeros) {
35430        this.dashArray = dashArray;
35431        if (forceStyle) {
35432          this.setStyle(_primitives.Name.get("D"));
35433        }
35434      } else {
35435        this.width = 0;
35436      }
35437    } else if (dashArray) {
35438      this.width = 0;
35439    }
35440  }
35441  setHorizontalCornerRadius(radius) {
35442    if (Number.isInteger(radius)) {
35443      this.horizontalCornerRadius = radius;
35444    }
35445  }
35446  setVerticalCornerRadius(radius) {
35447    if (Number.isInteger(radius)) {
35448      this.verticalCornerRadius = radius;
35449    }
35450  }
35451}
35452exports.AnnotationBorderStyle = AnnotationBorderStyle;
35453class MarkupAnnotation extends Annotation {
35454  constructor(params) {
35455    super(params);
35456    const {
35457      dict
35458    } = params;
35459    if (dict.has("IRT")) {
35460      const rawIRT = dict.getRaw("IRT");
35461      this.data.inReplyTo = rawIRT instanceof _primitives.Ref ? rawIRT.toString() : null;
35462      const rt = dict.get("RT");
35463      this.data.replyType = rt instanceof _primitives.Name ? rt.name : _util.AnnotationReplyType.REPLY;
35464    }
35465    let popupRef = null;
35466    if (this.data.replyType === _util.AnnotationReplyType.GROUP) {
35467      const parent = dict.get("IRT");
35468      this.setTitle(parent.get("T"));
35469      this.data.titleObj = this._title;
35470      this.setContents(parent.get("Contents"));
35471      this.data.contentsObj = this._contents;
35472      if (!parent.has("CreationDate")) {
35473        this.data.creationDate = null;
35474      } else {
35475        this.setCreationDate(parent.get("CreationDate"));
35476        this.data.creationDate = this.creationDate;
35477      }
35478      if (!parent.has("M")) {
35479        this.data.modificationDate = null;
35480      } else {
35481        this.setModificationDate(parent.get("M"));
35482        this.data.modificationDate = this.modificationDate;
35483      }
35484      popupRef = parent.getRaw("Popup");
35485      if (!parent.has("C")) {
35486        this.data.color = null;
35487      } else {
35488        this.setColor(parent.getArray("C"));
35489        this.data.color = this.color;
35490      }
35491    } else {
35492      this.data.titleObj = this._title;
35493      this.setCreationDate(dict.get("CreationDate"));
35494      this.data.creationDate = this.creationDate;
35495      popupRef = dict.getRaw("Popup");
35496      if (!dict.has("C")) {
35497        this.data.color = null;
35498      }
35499    }
35500    this.data.popupRef = popupRef instanceof _primitives.Ref ? popupRef.toString() : null;
35501    if (dict.has("RC")) {
35502      this.data.richText = _factory.XFAFactory.getRichTextAsHtml(dict.get("RC"));
35503    }
35504  }
35505  setCreationDate(creationDate) {
35506    this.creationDate = typeof creationDate === "string" ? creationDate : null;
35507  }
35508  _setDefaultAppearance({
35509    xref,
35510    extra,
35511    strokeColor,
35512    fillColor,
35513    blendMode,
35514    strokeAlpha,
35515    fillAlpha,
35516    pointsCallback
35517  }) {
35518    let minX = Number.MAX_VALUE;
35519    let minY = Number.MAX_VALUE;
35520    let maxX = Number.MIN_VALUE;
35521    let maxY = Number.MIN_VALUE;
35522    const buffer = ["q"];
35523    if (extra) {
35524      buffer.push(extra);
35525    }
35526    if (strokeColor) {
35527      buffer.push(`${strokeColor[0]} ${strokeColor[1]} ${strokeColor[2]} RG`);
35528    }
35529    if (fillColor) {
35530      buffer.push(`${fillColor[0]} ${fillColor[1]} ${fillColor[2]} rg`);
35531    }
35532    let pointsArray = this.data.quadPoints;
35533    if (!pointsArray) {
35534      pointsArray = [[{
35535        x: this.rectangle[0],
35536        y: this.rectangle[3]
35537      }, {
35538        x: this.rectangle[2],
35539        y: this.rectangle[3]
35540      }, {
35541        x: this.rectangle[0],
35542        y: this.rectangle[1]
35543      }, {
35544        x: this.rectangle[2],
35545        y: this.rectangle[1]
35546      }]];
35547    }
35548    for (const points of pointsArray) {
35549      const [mX, MX, mY, MY] = pointsCallback(buffer, points);
35550      minX = Math.min(minX, mX);
35551      maxX = Math.max(maxX, MX);
35552      minY = Math.min(minY, mY);
35553      maxY = Math.max(maxY, MY);
35554    }
35555    buffer.push("Q");
35556    const formDict = new _primitives.Dict(xref);
35557    const appearanceStreamDict = new _primitives.Dict(xref);
35558    appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
35559    const appearanceStream = new _stream.StringStream(buffer.join(" "));
35560    appearanceStream.dict = appearanceStreamDict;
35561    formDict.set("Fm0", appearanceStream);
35562    const gsDict = new _primitives.Dict(xref);
35563    if (blendMode) {
35564      gsDict.set("BM", _primitives.Name.get(blendMode));
35565    }
35566    if (typeof strokeAlpha === "number") {
35567      gsDict.set("CA", strokeAlpha);
35568    }
35569    if (typeof fillAlpha === "number") {
35570      gsDict.set("ca", fillAlpha);
35571    }
35572    const stateDict = new _primitives.Dict(xref);
35573    stateDict.set("GS0", gsDict);
35574    const resources = new _primitives.Dict(xref);
35575    resources.set("ExtGState", stateDict);
35576    resources.set("XObject", formDict);
35577    const appearanceDict = new _primitives.Dict(xref);
35578    appearanceDict.set("Resources", resources);
35579    const bbox = this.data.rect = [minX, minY, maxX, maxY];
35580    appearanceDict.set("BBox", bbox);
35581    this.appearance = new _stream.StringStream("/GS0 gs /Fm0 Do");
35582    this.appearance.dict = appearanceDict;
35583    this._streams.push(this.appearance, appearanceStream);
35584  }
35585  static async createNewAnnotation(xref, annotation, dependencies, params) {
35586    const annotationRef = annotation.ref ||= xref.getNewTemporaryRef();
35587    const ap = await this.createNewAppearanceStream(annotation, xref, params);
35588    const buffer = [];
35589    let annotationDict;
35590    if (ap) {
35591      const apRef = xref.getNewTemporaryRef();
35592      annotationDict = this.createNewDict(annotation, xref, {
35593        apRef
35594      });
35595      await (0, _writer.writeObject)(apRef, ap, buffer, xref);
35596      dependencies.push({
35597        ref: apRef,
35598        data: buffer.join("")
35599      });
35600    } else {
35601      annotationDict = this.createNewDict(annotation, xref, {});
35602    }
35603    if (Number.isInteger(annotation.parentTreeId)) {
35604      annotationDict.set("StructParent", annotation.parentTreeId);
35605    }
35606    buffer.length = 0;
35607    await (0, _writer.writeObject)(annotationRef, annotationDict, buffer, xref);
35608    return {
35609      ref: annotationRef,
35610      data: buffer.join("")
35611    };
35612  }
35613  static async createNewPrintAnnotation(annotationGlobals, xref, annotation, params) {
35614    const ap = await this.createNewAppearanceStream(annotation, xref, params);
35615    const annotationDict = this.createNewDict(annotation, xref, {
35616      ap
35617    });
35618    const newAnnotation = new this.prototype.constructor({
35619      dict: annotationDict,
35620      xref,
35621      annotationGlobals,
35622      evaluatorOptions: params.evaluatorOptions
35623    });
35624    if (annotation.ref) {
35625      newAnnotation.ref = newAnnotation.refToReplace = annotation.ref;
35626    }
35627    return newAnnotation;
35628  }
35629}
35630exports.MarkupAnnotation = MarkupAnnotation;
35631class WidgetAnnotation extends Annotation {
35632  constructor(params) {
35633    super(params);
35634    const {
35635      dict,
35636      xref,
35637      annotationGlobals
35638    } = params;
35639    const data = this.data;
35640    this._needAppearances = params.needAppearances;
35641    data.annotationType = _util.AnnotationType.WIDGET;
35642    if (data.fieldName === undefined) {
35643      data.fieldName = this._constructFieldName(dict);
35644    }
35645    if (data.actions === undefined) {
35646      data.actions = (0, _core_utils.collectActions)(xref, dict, _util.AnnotationActionEventType);
35647    }
35648    let fieldValue = (0, _core_utils.getInheritableProperty)({
35649      dict,
35650      key: "V",
35651      getArray: true
35652    });
35653    data.fieldValue = this._decodeFormValue(fieldValue);
35654    const defaultFieldValue = (0, _core_utils.getInheritableProperty)({
35655      dict,
35656      key: "DV",
35657      getArray: true
35658    });
35659    data.defaultFieldValue = this._decodeFormValue(defaultFieldValue);
35660    if (fieldValue === undefined && annotationGlobals.xfaDatasets) {
35661      const path = this._title.str;
35662      if (path) {
35663        this._hasValueFromXFA = true;
35664        data.fieldValue = fieldValue = annotationGlobals.xfaDatasets.getValue(path);
35665      }
35666    }
35667    if (fieldValue === undefined && data.defaultFieldValue !== null) {
35668      data.fieldValue = data.defaultFieldValue;
35669    }
35670    data.alternativeText = (0, _util.stringToPDFString)(dict.get("TU") || "");
35671    this.setDefaultAppearance(params);
35672    data.hasAppearance ||= this._needAppearances && data.fieldValue !== undefined && data.fieldValue !== null;
35673    const fieldType = (0, _core_utils.getInheritableProperty)({
35674      dict,
35675      key: "FT"
35676    });
35677    data.fieldType = fieldType instanceof _primitives.Name ? fieldType.n
35677ame : null;
35678    const localResources = (0, _core_utils.getInheritableProperty)({
35679      dict,
35680      key: "DR"
35681    });
35682    const acroFormResources = annotationGlobals.acroForm.get("DR");
35683    const appearanceResources = this.appearance?.dict.get("Resources");
35684    this._fieldResources = {
35685      localResources,
35686      acroFormResources,
35687      appearanceResources,
35688      mergedResources: _primitives.Dict.merge({
35689        xref,
35690        dictArray: [localResources, appearanceResources, acroFormResources],
35691        mergeSubDicts: true
35692      })
35693    };
35694    data.fieldFlags = (0, _core_utils.getInheritableProperty)({
35695      dict,
35696      key: "Ff"
35697    });
35698    if (!Number.isInteger(data.fieldFlags) || data.fieldFlags < 0) {
35699      data.fieldFlags = 0;
35700    }
35701    data.readOnly = this.hasFieldFlag(_util.AnnotationFieldFlag.READONLY);
35702    data.required = this.hasFieldFlag(_util.AnnotationFieldFlag.REQUIRED);
35703    data.hidden = this._hasFlag(data.annotationFlags, _util.AnnotationFlag.HIDDEN) || this._hasFlag(data.annotationFlags, _util.AnnotationFlag.NOVIEW);
35704  }
35705  _decodeFormValue(formValue) {
35706    if (Array.isArray(formValue)) {
35707      return formValue.filter(item => typeof item === "string").map(item => (0, _util.stringToPDFString)(item));
35708    } else if (formValue instanceof _primitives.Name) {
35709      return (0, _util.stringToPDFString)(formValue.name);
35710    } else if (typeof formValue === "string") {
35711      return (0, _util.stringToPDFString)(formValue);
35712    }
35713    return null;
35714  }
35715  hasFieldFlag(flag) {
35716    return !!(this.data.fieldFlags & flag);
35717  }
35718  _isViewable(flags) {
35719    return !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE);
35720  }
35721  mustBeViewed(annotationStorage, renderForms) {
35722    if (renderForms) {
35723      return this.viewable;
35724    }
35725    return super.mustBeViewed(annotationStorage, renderForms) && !this._hasFlag(this.flags, _util.AnnotationFlag.NOVIEW);
35726  }
35727  getRotationMatrix(annotationStorage) {
35728    let rotation = annotationStorage?.get(this.data.id)?.rotation;
35729    if (rotation === undefined) {
35730      rotation = this.rotation;
35731    }
35732    if (rotation === 0) {
35733      return _util.IDENTITY_MATRIX;
35734    }
35735    const width = this.data.rect[2] - this.data.rect[0];
35736    const height = this.data.rect[3] - this.data.rect[1];
35737    return (0, _core_utils.getRotationMatrix)(rotation, width, height);
35738  }
35739  getBorderAndBackgroundAppearances(annotationStorage) {
35740    let rotation = annotationStorage?.get(this.data.id)?.rotation;
35741    if (rotation === undefined) {
35742      rotation = this.rotation;
35743    }
35744    if (!this.backgroundColor && !this.borderColor) {
35745      return "";
35746    }
35747    const width = this.data.rect[2] - this.data.rect[0];
35748    const height = this.data.rect[3] - this.data.rect[1];
35749    const rect = rotation === 0 || rotation === 180 ? `0 0 ${width} ${height} re` : `0 0 ${height} ${width} re`;
35750    let str = "";
35751    if (this.backgroundColor) {
35752      str = `${(0, _default_appearance.getPdfColor)(this.backgroundColor, true)} ${rect} f `;
35753    }
35754    if (this.borderColor) {
35755      const borderWidth = this.borderStyle.width || 1;
35756      str += `${borderWidth} w ${(0, _default_appearance.getPdfColor)(this.borderColor, false)} ${rect} S `;
35757    }
35758    return str;
35759  }
35760  async getOperatorList(evaluator, task, intent, renderForms, annotationStorage) {
35761    if (renderForms && !(this instanceof SignatureWidgetAnnotation) && !this.data.noHTML && !this.data.hasOwnCanvas) {
35762      return {
35763        opList: new _operator_list.OperatorList(),
35764        separateForm: true,
35765        separateCanvas: false
35766      };
35767    }
35768    if (!this._hasText) {
35769      return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
35770    }
35771    const content = await this._getAppearance(evaluator, task, intent, annotationStorage);
35772    if (this.appearance && content === null) {
35773      return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
35774    }
35775    const opList = new _operator_list.OperatorList();
35776    if (!this._defaultAppearance || content === null) {
35777      return {
35778        opList,
35779        separateForm: false,
35780        separateCanvas: false
35781      };
35782    }
35783    const isUsingOwnCanvas = !!(this.data.hasOwnCanvas && intent & _util.RenderingIntentFlag.DISPLAY);
35784    const matrix = [1, 0, 0, 1, 0, 0];
35785    const bbox = [0, 0, this.data.rect[2] - this.data.rect[0], this.data.rect[3] - this.data.rect[1]];
35786    const transform = getTransformMatrix(this.data.rect, bbox, matrix);
35787    let optionalContent;
35788    if (this.oc) {
35789      optionalContent = await evaluator.parseMarkedContentProps(this.oc, null);
35790    }
35791    if (optionalContent !== undefined) {
35792      opList.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
35793    }
35794    opList.addOp(_util.OPS.beginAnnotation, [this.data.id, this.data.rect, transform, this.getRotationMatrix(annotationStorage), isUsingOwnCanvas]);
35795    const stream = new _stream.StringStream(content);
35796    await evaluator.getOperatorList({
35797      stream,
35798      task,
35799      resources: this._fieldResources.mergedResources,
35800      operatorList: opList
35801    });
35802    opList.addOp(_util.OPS.endAnnotation, []);
35803    if (optionalContent !== undefined) {
35804      opList.addOp(_util.OPS.endMarkedContent, []);
35805    }
35806    return {
35807      opList,
35808      separateForm: false,
35809      separateCanvas: isUsingOwnCanvas
35810    };
35811  }
35812  _getMKDict(rotation) {
35813    const mk = new _primitives.Dict(null);
35814    if (rotation) {
35815      mk.set("R", rotation);
35816    }
35817    if (this.borderColor) {
35818      mk.set("BC", getPdfColorArray(this.borderColor));
35819    }
35820    if (this.backgroundColor) {
35821      mk.set("BG", getPdfColorArray(this.backgroundColor));
35822    }
35823    return mk.size > 0 ? mk : null;
35824  }
35825  amendSavedDict(annotationStorage, dict) {}
35826  async save(evaluator, task, annotationStorage) {
35827    const storageEntry = annotationStorage?.get(this.data.id);
35828    let value = storageEntry?.value,
35829      rotation = storageEntry?.rotation;
35830    if (value === this.data.fieldValue || value === undefined) {
35831      if (!this._hasValueFromXFA && rotation === undefined) {
35832        return null;
35833      }
35834      value ||= this.data.fieldValue;
35835    }
35836    if (rotation === undefined && !this._hasValueFromXFA && Array.isArray(value) && Array.isArray(this.data.fieldValue) && value.length === this.data.fieldValue.length && value.every((x, i) => x === this.data.fieldValue[i])) {
35837      return null;
35838    }
35839    if (rotation === undefined) {
35840      rotation = this.rotation;
35841    }
35842    let appearance = null;
35843    if (!this._needAppearances) {
35844      appearance = await this._getAppearance(evaluator, task, _util.RenderingIntentFlag.SAVE, annotationStorage);
35845      if (appearance === null) {
35846        return null;
35847      }
35848    } else {}
35849    let needAppearances = false;
vendor: 18,910 bytes, lines 35850-36321
35850    if (appearance?.needAppearances) {
35851      needAppearances = true;
35852      appearance = null;
35853    }
35854    const {
35855      xref
35856    } = evaluator;
35857    const originalDict = xref.fetchIfRef(this.ref);
35858    if (!(originalDict instanceof _primitives.Dict)) {
35859      return null;
35860    }
35861    const dict = new _primitives.Dict(xref);
35862    for (const key of originalDict.getKeys()) {
35863      if (key !== "AP") {
35864        dict.set(key, originalDict.getRaw(key));
35865      }
35866    }
35867    const xfa = {
35868      path: this.data.fieldName,
35869      value
35870    };
35871    const encoder = val => {
35872      return (0, _core_utils.isAscii)(val) ? val : (0, _core_utils.stringToUTF16String)(val, true);
35873    };
35874    dict.set("V", Array.isArray(value) ? value.map(encoder) : encoder(value));
35875    this.amendSavedDict(annotationStorage, dict);
35876    const maybeMK = this._getMKDict(rotation);
35877    if (maybeMK) {
35878      dict.set("MK", maybeMK);
35879    }
35880    const buffer = [];
35881    const changes = [{
35882      ref: this.ref,
35883      data: "",
35884      xfa,
35885      needAppearances
35886    }];
35887    if (appearance !== null) {
35888      const newRef = xref.getNewTemporaryRef();
35889      const AP = new _primitives.Dict(xref);
35890      dict.set("AP", AP);
35891      AP.set("N", newRef);
35892      const resources = this._getSaveFieldResources(xref);
35893      const appearanceStream = new _stream.StringStream(appearance);
35894      const appearanceDict = appearanceStream.dict = new _primitives.Dict(xref);
35895      appearanceDict.set("Subtype", _primitives.Name.get("Form"));
35896      appearanceDict.set("Resources", resources);
35897      appearanceDict.set("BBox", [0, 0, this.data.rect[2] - this.data.rect[0], this.data.rect[3] - this.data.rect[1]]);
35898      const rotationMatrix = this.getRotationMatrix(annotationStorage);
35899      if (rotationMatrix !== _util.IDENTITY_MATRIX) {
35900        appearanceDict.set("Matrix", rotationMatrix);
35901      }
35902      await (0, _writer.writeObject)(newRef, appearanceStream, buffer, xref);
35903      changes.push({
35904        ref: newRef,
35905        data: buffer.join(""),
35906        xfa: null,
35907        needAppearances: false
35908      });
35909      buffer.length = 0;
35910    }
35911    dict.set("M", `D:${(0, _util.getModificationDate)()}`);
35912    await (0, _writer.writeObject)(this.ref, dict, buffer, xref);
35913    changes[0].data = buffer.join("");
35914    return changes;
35915  }
35916  async _getAppearance(evaluator, task, intent, annotationStorage) {
35917    const isPassword = this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD);
35918    if (isPassword) {
35919      return null;
35920    }
35921    const storageEntry = annotationStorage?.get(this.data.id);
35922    let value, rotation;
35923    if (storageEntry) {
35924      value = storageEntry.formattedValue || storageEntry.value;
35925      rotation = storageEntry.rotation;
35926    }
35927    if (rotation === undefined && value === undefined && !this._needAppearances) {
35928      if (!this._hasValueFromXFA || this.appearance) {
35929        return null;
35930      }
35931    }
35932    const colors = this.getBorderAndBackgroundAppearances(annotationStorage);
35933    if (value === undefined) {
35934      value = this.data.fieldValue;
35935      if (!value) {
35936        return `/Tx BMC q ${colors}Q EMC`;
35937      }
35938    }
35939    if (Array.isArray(value) && value.length === 1) {
35940      value = value[0];
35941    }
35942    (0, _util.assert)(typeof value === "string", "Expected `value` to be a string.");
35943    value = value.trim();
35944    if (this.data.combo) {
35945      const option = this.data.options.find(({
35946        exportValue
35947      }) => value === exportValue);
35948      value = option?.displayValue || value;
35949    }
35950    if (value === "") {
35951      return `/Tx BMC q ${colors}Q EMC`;
35952    }
35953    if (rotation === undefined) {
35954      rotation = this.rotation;
35955    }
35956    let lineCount = -1;
35957    let lines;
35958    if (this.data.multiLine) {
35959      lines = value.split(/\r\n?|\n/).map(line => line.normalize("NFC"));
35960      lineCount = lines.length;
35961    } else {
35962      lines = [value.replace(/\r\n?|\n/, "").normalize("NFC")];
35963    }
35964    const defaultPadding = 1;
35965    const defaultHPadding = 2;
35966    let totalHeight = this.data.rect[3] - this.data.rect[1];
35967    let totalWidth = this.data.rect[2] - this.data.rect[0];
35968    if (rotation === 90 || rotation === 270) {
35969      [totalWidth, totalHeight] = [totalHeight, totalWidth];
35970    }
35971    if (!this._defaultAppearance) {
35972      this.data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance = "/Helvetica 0 Tf 0 g");
35973    }
35974    let font = await WidgetAnnotation._getFontData(evaluator, task, this.data.defaultAppearanceData, this._fieldResources.mergedResources);
35975    let defaultAppearance, fontSize, lineHeight;
35976    const encodedLines = [];
35977    let encodingError = false;
35978    for (const line of lines) {
35979      const encodedString = font.encodeString(line);
35980      if (encodedString.length > 1) {
35981        encodingError = true;
35982      }
35983      encodedLines.push(encodedString.join(""));
35984    }
35985    if (encodingError && intent & _util.RenderingIntentFlag.SAVE) {
35986      return {
35987        needAppearances: true
35988      };
35989    }
35990    if (encodingError && this._isOffscreenCanvasSupported) {
35991      const fontFamily = this.data.comb ? "monospace" : "sans-serif";
35992      const fakeUnicodeFont = new _default_appearance.FakeUnicodeFont(evaluator.xref, fontFamily);
35993      const resources = fakeUnicodeFont.createFontResources(lines.join(""));
35994      const newFont = resources.getRaw("Font");
35995      if (this._fieldResources.mergedResources.has("Font")) {
35996        const oldFont = this._fieldResources.mergedResources.get("Font");
35997        for (const key of newFont.getKeys()) {
35998          oldFont.set(key, newFont.getRaw(key));
35999        }
36000      } else {
36001        this._fieldResources.mergedResources.set("Font", newFont);
36002      }
36003      const fontName = fakeUnicodeFont.fontName.name;
36004      font = await WidgetAnnotation._getFontData(evaluator, task, {
36005        fontName,
36006        fontSize: 0
36007      }, resources);
36008      for (let i = 0, ii = encodedLines.length; i < ii; i++) {
36009        encodedLines[i] = (0, _core_utils.stringToUTF16String)(lines[i]);
36010      }
36011      const savedDefaultAppearance = Object.assign(Object.create(null), this.data.defaultAppearanceData);
36012      this.data.defaultAppearanceData.fontSize = 0;
36013      this.data.defaultAppearanceData.fontName = fontName;
36014      [defaultAppearance, fontSize, lineHeight] = this._computeFontSize(totalHeight - 2 * defaultPadding, totalWidth - 2 * defaultHPadding, value, font, lineCount);
36015      this.data.defaultAppearanceData = savedDefaultAppearance;
36016    } else {
36017      if (!this._isOffscreenCanvasSupported) {
36018        (0, _util.warn)("_getAppearance: OffscreenCanvas is not supported, annotation may not render correctly.");
36019      }
36020      [defaultAppearance, fontSize, lineHeight] = this._computeFontSize(totalHeight - 2 * defaultPadding, totalWidth - 2 * defaultHPadding, value, font, lineCount);
36021    }
36022    let descent = font.descent;
36023    if (isNaN(descent)) {
36024      descent = _util.BASELINE_FACTOR * lineHeight;
36025    } else {
36026      descent = Math.max(_util.BASELINE_FACTOR * lineHeight, Math.abs(descent) * fontSize);
36027    }
36028    const defaultVPadding = Math.min(Math.floor((totalHeight - fontSize) / 2), defaultPadding);
36029    const alignment = this.data.textAlignment;
36030    if (this.data.multiLine) {
36031      return this._getMultilineAppearance(defaultAppearance, encodedLines, font, fontSize, totalWidth, totalHeight, alignment, defaultHPadding, defaultVPadding, descent, lineHeight, annotationStorage);
36032    }
36033    if (this.data.comb) {
36034      return this._getCombAppearance(defaultAppearance, font, encodedLines[0], fontSize, totalWidth, totalHeight, defaultHPadding, defaultVPadding, descent, lineHeight, annotationStorage);
36035    }
36036    const bottomPadding = defaultVPadding + descent;
36037    if (alignment === 0 || alignment > 2) {
36038      return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 ${(0, _core_utils.numberToString)(defaultHPadding)} ${(0, _core_utils.numberToString)(bottomPadding)} Tm (${(0, _core_utils.escapeString)(encodedLines[0])}) Tj` + " ET Q EMC";
36039    }
36040    const prevInfo = {
36041      shift: 0
36042    };
36043    const renderedText = this._renderText(encodedLines[0], font, fontSize, totalWidth, alignment, prevInfo, defaultHPadding, bottomPadding);
36044    return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 0 0 Tm ${renderedText}` + " ET Q EMC";
36045  }
36046  static async _getFontData(evaluator, task, appearanceData, resources) {
36047    const operatorList = new _operator_list.OperatorList();
36048    const initialState = {
36049      font: null,
36050      clone() {
36051        return this;
36052      }
36053    };
36054    const {
36055      fontName,
36056      fontSize
36057    } = appearanceData;
36058    await evaluator.handleSetFont(resources, [fontName && _primitives.Name.get(fontName), fontSize], null, operatorList, task, initialState, null);
36059    return initialState.font;
36060  }
36061  _getTextWidth(text, font) {
36062    return font.charsToGlyphs(text).reduce((width, glyph) => width + glyph.width, 0) / 1000;
36063  }
36064  _computeFontSize(height, width, text, font, lineCount) {
36065    let {
36066      fontSize
36067    } = this.data.defaultAppearanceData;
36068    let lineHeight = (fontSize || 12) * _util.LINE_FACTOR,
36069      numberOfLines = Math.round(height / lineHeight);
36070    if (!fontSize) {
36071      const roundWithTwoDigits = x => Math.floor(x * 100) / 100;
36072      if (lineCount === -1) {
36073        const textWidth = this._getTextWidth(text, font);
36074        fontSize = roundWithTwoDigits(Math.min(height / _util.LINE_FACTOR, textWidth > width ? width / textWidth : Infinity));
36075        numberOfLines = 1;
36076      } else {
36077        const lines = text.split(/\r\n?|\n/);
36078        const cachedLines = [];
36079        for (const line of lines) {
36080          const encoded = font.encodeString(line).join("");
36081          const glyphs = font.charsToGlyphs(encoded);
36082          const positions = font.getCharPositions(encoded);
36083          cachedLines.push({
36084            line: encoded,
36085            glyphs,
36086            positions
36087          });
36088        }
36089        const isTooBig = fsize => {
36090          let totalHeight = 0;
36091          for (const cache of cachedLines) {
36092            const chunks = this._splitLine(null, font, fsize, width, cache);
36093            totalHeight += chunks.length * fsize;
36094            if (totalHeight > height) {
36095              return true;
36096            }
36097          }
36098          return false;
36099        };
36100        numberOfLines = Math.max(numberOfLines, lineCount);
36101        while (true) {
36102          lineHeight = height / numberOfLines;
36103          fontSize = roundWithTwoDigits(lineHeight / _util.LINE_FACTOR);
36104          if (isTooBig(fontSize)) {
36105            numberOfLines++;
36106            continue;
36107          }
36108          break;
36109        }
36110      }
36111      const {
36112        fontName,
36113        fontColor
36114      } = this.data.defaultAppearanceData;
36115      this._defaultAppearance = (0, _default_appearance.createDefaultAppearance)({
36116        fontSize,
36117        fontName,
36118        fontColor
36119      });
36120    }
36121    return [this._defaultAppearance, fontSize, height / numberOfLines];
36122  }
36123  _renderText(text, font, fontSize, totalWidth, alignment, prevInfo, hPadding, vPadding) {
36124    let shift;
36125    if (alignment === 1) {
36126      const width = this._getTextWidth(text, font) * fontSize;
36127      shift = (totalWidth - width) / 2;
36128    } else if (alignment === 2) {
36129      const width = this._getTextWidth(text, font) * fontSize;
36130      shift = totalWidth - width - hPadding;
36131    } else {
36132      shift = hPadding;
36133    }
36134    const shiftStr = (0, _core_utils.numberToString)(shift - prevInfo.shift);
36135    prevInfo.shift = shift;
36136    vPadding = (0, _core_utils.numberToString)(vPadding);
36137    return `${shiftStr} ${vPadding} Td (${(0, _core_utils.escapeString)(text)}) Tj`;
36138  }
36139  _getSaveFieldResources(xref) {
36140    const {
36141      localResources,
36142      appearanceResources,
36143      acroFormResources
36144    } = this._fieldResources;
36145    const fontName = this.data.defaultAppearanceData?.fontName;
36146    if (!fontName) {
36147      return localResources || _primitives.Dict.empty;
36148    }
36149    for (const resources of [localResources, appearanceResources]) {
36150      if (resources instanceof _primitives.Dict) {
36151        const localFont = resources.get("Font");
36152        if (localFont instanceof _primitives.Dict && localFont.has(fontName)) {
36153          return resources;
36154        }
36155      }
36156    }
36157    if (acroFormResources instanceof _primitives.Dict) {
36158      const acroFormFont = acroFormResources.get("Font");
36159      if (acroFormFont instanceof _primitives.Dict && acroFormFont.has(fontName)) {
36160        const subFontDict = new _primitives.Dict(xref);
36161        subFontDict.set(fontName, acroFormFont.getRaw(fontName));
36162        const subResourcesDict = new _primitives.Dict(xref);
36163        subResourcesDict.set("Font", subFontDict);
36164        return _primitives.Dict.merge({
36165          xref,
36166          dictArray: [subResourcesDict, localResources],
36167          mergeSubDicts: true
36168        });
36169      }
36170    }
36171    return localResources || _primitives.Dict.empty;
36172  }
36173  getFieldObject() {
36174    return null;
36175  }
36176}
36177class TextWidgetAnnotation extends WidgetAnnotation {
36178  constructor(params) {
36179    super(params);
36180    this.data.hasOwnCanvas = this.data.readOnly && !this.data.noHTML;
36181    this._hasText = true;
36182    const dict = params.dict;
36183    if (typeof this.data.fieldValue !== "string") {
36184      this.data.fieldValue = "";
36185    }
36186    let alignment = (0, _core_utils.getInheritableProperty)({
36187      dict,
36188      key: "Q"
36189    });
36190    if (!Number.isInteger(alignment) || alignment < 0 || alignment > 2) {
36191      alignment = null;
36192    }
36193    this.data.textAlignment = alignment;
36194    let maximumLength = (0, _core_utils.getInheritableProperty)({
36195      dict,
36196      key: "MaxLen"
36197    });
36198    if (!Number.isInteger(maximumLength) || maximumLength < 0) {
36199      maximumLength = 0;
36200    }
36201    this.data.maxLen = maximumLength;
36202    this.data.multiLine = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE);
36203    this.data.comb = this.hasFieldFlag(_util.AnnotationFieldFlag.COMB) && !this.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD) && !this.hasFieldFlag(_util.AnnotationFieldFlag.FILESELECT) && this.data.maxLen !== 0;
36204    this.data.doNotScroll = this.hasFieldFlag(_util.AnnotationFieldFlag.DONOTSCROLL);
36205  }
36206  get hasTextContent() {
36207    return !!this.appearance && !this._needAppearances;
36208  }
36209  _getCombAppearance(defaultAppearance, font, text, fontSize, width, height, hPadding, vPadding, descent, lineHeight, annotationStorage) {
36210    const combWidth = width / this.data.maxLen;
36211    const colors = this.getBorderAndBackgroundAppearances(annotationStorage);
36212    const buf = [];
36213    const positions = font.getCharPositions(text);
36214    for (const [start, end] of positions) {
36215      buf.push(`(${(0, _core_utils.escapeString)(text.substring(start, end))}) Tj`);
36216    }
36217    const renderedComb = buf.join(` ${(0, _core_utils.numberToString)(combWidth)} 0 Td `);
36218    return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 ${(0, _core_utils.numberToString)(hPadding)} ${(0, _core_utils.numberToString)(vPadding + descent)} Tm ${renderedComb}` + " ET Q EMC";
36219  }
36220  _getMultilineAppearance(defaultAppearance, lines, font, fontSize, width, height, alignment, hPadding, vPadding, descent, lineHeight, annotationStorage) {
36221    const buf = [];
36222    const totalWidth = width - 2 * hPadding;
36223    const prevInfo = {
36224      shift: 0
36225    };
36226    for (let i = 0, ii = lines.length; i < ii; i++) {
36227      const line = lines[i];
36228      const chunks = this._splitLine(line, font, fontSize, totalWidth);
36229      for (let j = 0, jj = chunks.length; j < jj; j++) {
36230        const chunk = chunks[j];
36231        const vShift = i === 0 && j === 0 ? -vPadding - (lineHeight - descent) : -lineHeight;
36232        buf.push(this._renderText(chunk, font, fontSize, width, alignment, prevInfo, hPadding, vShift));
36233      }
36234    }
36235    const colors = this.getBorderAndBackgroundAppearances(annotationStorage);
36236    const renderedText = buf.join("\n");
36237    return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 0 ${(0, _core_utils.numberToString)(height)} Tm ${renderedText}` + " ET Q EMC";
36238  }
36239  _splitLine(line, font, fontSize, width, cache = {}) {
36240    line = cache.line || line;
36241    const glyphs = cache.glyphs || font.charsToGlyphs(line);
36242    if (glyphs.length <= 1) {
36243      return [line];
36244    }
36245    const positions = cache.positions || font.getCharPositions(line);
36246    const scale = fontSize / 1000;
36247    const chunks = [];
36248    let lastSpacePosInStringStart = -1,
36249      lastSpacePosInStringEnd = -1,
36250      lastSpacePos = -1,
36251      startChunk = 0,
36252      currentWidth = 0;
36253    for (let i = 0, ii = glyphs.length; i < ii; i++) {
36254      const [start, end] = positions[i];
36255      const glyph = glyphs[i];
36256      const glyphWidth = glyph.width * scale;
36257      if (glyph.unicode === " ") {
36258        if (currentWidth + glyphWidth > width) {
36259          chunks.push(line.substring(startChunk, start));
36260          startChunk = start;
36261          currentWidth = glyphWidth;
36262          lastSpacePosInStringStart = -1;
36263          lastSpacePos = -1;
36264        } else {
36265          currentWidth += glyphWidth;
36266          lastSpacePosInStringStart = start;
36267          lastSpacePosInStringEnd = end;
36268          lastSpacePos = i;
36269        }
36270      } else if (currentWidth + glyphWidth > width) {
36271        if (lastSpacePosInStringStart !== -1) {
36272          chunks.push(line.substring(startChunk, lastSpacePosInStringEnd));
36273          startChunk = lastSpacePosInStringEnd;
36274          i = lastSpacePos + 1;
36275          lastSpacePosInStringStart = -1;
36276          currentWidth = 0;
36277        } else {
36278          chunks.push(line.substring(startChunk, start));
36279          startChunk = start;
36280          currentWidth = glyphWidth;
36281        }
36282      } else {
36283        currentWidth += glyphWidth;
36284      }
36285    }
36286    if (startChunk < line.length) {
36287      chunks.push(line.substring(startChunk, line.length));
36288    }
36289    return chunks;
36290  }
36291  getFieldObject() {
36292    return {
36293      id: this.data.id,
36294      value: this.data.fieldValue,
36295      defaultValue: this.data.defaultFieldValue || "",
36296      multiline: this.data.multiLine,
36297      password: this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD),
36298      charLimit: this.data.maxLen,
36299      comb: this.data.comb,
36300      editable: !this.data.readOnly,
36301      hidden: this.data.hidden,
36302      name: this.data.fieldName,
36303      rect: this.data.rect,
36304      actions: this.data.actions,
36305      page: this.data.pageIndex,
36306      strokeColor: this.data.borderColor,
36307      fillColor: this.data.backgroundColor,
36308      rotation: this.rotation,
36309      type: "text"
36310    };
36311  }
36312}
36313class ButtonWidgetAnnotation extends WidgetAnnotation {
36314  constructor(params) {
36315    super(params);
36316    this.checkedAppearance = null;
36317    this.uncheckedAppearance = null;
36318    this.data.checkBox = !this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
36319    this.data.radioButton = this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
36320    this.data.pushButton = this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
36321    this.data.isTooltipOnly = false;
36322    if (this.data.checkBox) {
36323      this._processCheckBox(params);
36324    } else if (this.data.radioButton) {
36325      this._processRadioButton(params);
36326    } else if (this.data.pushButton) {
36327      this.data.hasOwnCanvas = true;
36328      this._processPushButton(params);
36329    } else {
36330      (0, _util.warn)("Invalid field flags for button widget annotation");
36331    }
36332  }
36333  async getOperatorList(evaluator, task, intent, renderForms, annotationStorage) {
36334    if (this.data.pushButton) {
36335      return super.getOperatorList(evaluator, task, intent, false, annotationStorage);
36336    }
36337    let value = null;
36338    let rotation = null;
36339    if (annotationStorage) {
36340      const storageEntry = annotationStorage.get(this.data.id);
36341      value = storageEntry ? storageEntry.value : null;
36342      rotation = storageEntry ? storageEntry.rotation : null;
36343    }
36344    if (value === null && this.appearance) {
36345      return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
36346    }
36347    if (value === null || value === undefined) {
36348      value = this.data.checkBox ? this.data.fieldValue === this.data.exportValue : this.data.fieldValue === this.data.buttonValue;
36349    }
36350    const appearance = value ? this.checkedAppearance : this.uncheckedAppearance;
36351    if (appearance) {
36352      const savedAppearance = this.appearance;
36353      const savedMatrix = appearance.dict.getArray("Matrix") || _util.IDENTITY_MATRIX;
36354      if (rotation) {
36355        appearance.dict.set("Matrix", this.getRotationMatrix(annotationStorage));
36356      }
36357      this.appearance = appearance;
36358      const operatorList = super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
36359      this.appearance = savedAppearance;
36360      appearance.dict.set("Matrix", savedMatrix);
36361      return operatorList;
36362    }
36363    return {
36364      opList: new _operator_list.OperatorList(),
36365      separateForm: false,
36366      separateCanvas: false
36367    };
36368  }
36369  async save(evaluator, task, annotationStorage) {
36370    if (this.data.checkBox) {
36371      return this._saveCheckbox(evaluator, task, annotationStorage);
36372    }
36373    if (this.data.radioButton) {
36374      return this._saveRadioButton(evaluator, task, annotationStorage);
36375    }
36376    return null;
36377  }
36378  async _saveCheckbox(evaluator, task, annotationStorage) {
36379    if (!annotationStorage) {
36380      return null;
36381    }
36382    const storageEntry = annotationStorage.get(this.data.id);
36383    let rotation = storageEntry?.rotation,
36384      value = storageEntry?.value;
36385    if (rotation === undefined) {
36386      if (value === undefined) {
36387        return null;
36388      }
36389      const defaultValue = this.data.fieldValue === this.data.exportValue;
36390      if (defaultValue === value) {
36391        return null;
36392      }
36393    }
36394    const dict = evaluator.xref.fetchIfRef(this.ref);
36395    if (!(dict instanceof _primitives.Dict)) {
36396      return null;
36397    }
36398    if (rotation === undefined) {
36399      rotation = this.rotation;
36400    }
36401    if (value === undefined) {
36402      value = this.data.fieldValue === this.data.exportValue;
36403    }
36404    const xfa = {
36405      path: this.data.fieldName,
36406      value: value ? this.data.exportValue : ""
36407    };
36408    const name = _primitives.Name.get(value ? this.data.exportValue : "Off");
36409    dict.set("V", name);
36410    dict.set("AS", name);
36411    dict.set("M", `D:${(0, _util.getModificationDate)()}`);
36412    const maybeMK = this._getMKDict(rotation);
36413    if (maybeMK) {
36414      dict.set("MK", maybeMK);
36415    }
36416    const buffer = [];
36417    await (0, _writer.writeObject)(this.ref, dict, buffer, evaluator.xref);
36418    return [{
36419      ref: this.ref,
36420      data: buffer.join(""),
36421      xfa
36422    }];
36423  }
36424  async _saveRadioButton(evaluator, task, annotationStorage) {
36425    if (!annotationStorage) {
36426      return null;
36427    }
36428    const storageEntry = annotationStorage.get(this.data.id);
36429    let rotation = storageEntry?.rotation,
36430      value = storageEntry?.value;
36431    if (rotation === undefined) {
36432      if (value === undefined) {
36433        return null;
36434      }
36435      const defaultValue = this.data.fieldValue === this.data.buttonValue;
36436      if (defaultValue === value) {
36437        return null;
36438      }
36439    }
36440    const dict = evaluator.xref.fetchIfRef(this.ref);
36441    if (!(dict instanceof _primitives.Dict)) {
36442      return null;
36443    }
36444    if (value === undefined) {
36445      value = this.data.fieldValue === this.data.buttonValue;
36446    }
36447    if (rotation === undefined) {
36448      rotation = this.rotation;
36449    }
36450    const xfa = {
36451      path: this.data.fieldName,
36452      value: value ? this.data.buttonValue : ""
36453    };
36454    const name = _primitives.Name.get(value ? this.data.buttonValue : "Off");
36455    const buffer = [];
36456    let parentData = null;
36457    if (value) {
36458      if (this.parent instanceof _primitives.Ref) {
36459        const parent = evaluator.xref.fetch(this.parent);
36460        parent.set("V", name);
36461        await (0, _writer.writeObject)(this.parent, parent, buffer, evaluator.xref);
36462        parentData = buffer.join("");
36463        buffer.length = 0;
36464      } else if (this.parent instanceof _primitives.Dict) {
36465        this.parent.set("V", name);
36466      }
36467    }
36468    dict.set("AS", name);
36469    dict.set("M", `D:${(0, _util.getModificationDate)()}`);
36470    const maybeMK = this._getMKDict(rotation);
36471    if (maybeMK) {
36472      dict.set("MK", maybeMK);
36473    }
36474    await (0, _writer.writeObject)(this.ref, dict, buffer, evaluator.xref);
36475    const newRefs = [{
36476      ref: this.ref,
36477      data: buffer.join(""),
36478      xfa
36479    }];
36480    if (parentData) {
36481      newRefs.push({
36482        ref: this.parent,
36483        data: parentData,
36484        xfa: null
36485      });
36486    }
36487    return newRefs;
36488  }
36489  _getDefaultCheckedAppearance(params, type) {
36490    const width = this.data.rect[2] - this.data.rect[0];
36491    const height = this.data.rect[3] - this.data.rect[1];
36492    const bbox = [0, 0, width, height];
36493    const FONT_RATIO = 0.8;
36494    const fontSize = Math.min(width, height) * FONT_RATIO;
36495    let metrics, char;
36496    if (type === "check") {
36497      metrics = {
36498        width: 0.755 * fontSize,
36499        height: 0.705 * fontSize
36500      };
36501      char = "\x33";
vendor: 13,875 bytes, lines 36502-36885
36502    } else if (type === "disc") {
36503      metrics = {
36504        width: 0.791 * fontSize,
36505        height: 0.705 * fontSize
36506      };
36507      char = "\x6C";
36508    } else {
36509      (0, _util.unreachable)(`_getDefaultCheckedAppearance - unsupported type: ${type}`);
36510    }
36511    const xShift = (0, _core_utils.numberToString)((width - metrics.width) / 2);
36512    const yShift = (0, _core_utils.numberToString)((height - metrics.height) / 2);
36513    const appearance = `q BT /PdfJsZaDb ${fontSize} Tf 0 g ${xShift} ${yShift} Td (${char}) Tj ET Q`;
36514    const appearanceStreamDict = new _primitives.Dict(params.xref);
36515    appearanceStreamDict.set("FormType", 1);
36516    appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
36517    appearanceStreamDict.set("Type", _primitives.Name.get("XObject"));
36518    appearanceStreamDict.set("BBox", bbox);
36519    appearanceStreamDict.set("Matrix", [1, 0, 0, 1, 0, 0]);
36520    appearanceStreamDict.set("Length", appearance.length);
36521    const resources = new _primitives.Dict(params.xref);
36522    const font = new _primitives.Dict(params.xref);
36523    font.set("PdfJsZaDb", this.fallbackFontDict);
36524    resources.set("Font", font);
36525    appearanceStreamDict.set("Resources", resources);
36526    this.checkedAppearance = new _stream.StringStream(appearance);
36527    this.checkedAppearance.dict = appearanceStreamDict;
36528    this._streams.push(this.checkedAppearance);
36529  }
36530  _processCheckBox(params) {
36531    const customAppearance = params.dict.get("AP");
36532    if (!(customAppearance instanceof _primitives.Dict)) {
36533      return;
36534    }
36535    const normalAppearance = customAppearance.get("N");
36536    if (!(normalAppearance instanceof _primitives.Dict)) {
36537      return;
36538    }
36539    const asValue = this._decodeFormValue(params.dict.get("AS"));
36540    if (typeof asValue === "string") {
36541      this.data.fieldValue = asValue;
36542    }
36543    const yes = this.data.fieldValue !== null && this.data.fieldValue !== "Off" ? this.data.fieldValue : "Yes";
36544    const exportValues = normalAppearance.getKeys();
36545    if (exportValues.length === 0) {
36546      exportValues.push("Off", yes);
36547    } else if (exportValues.length === 1) {
36548      if (exportValues[0] === "Off") {
36549        exportValues.push(yes);
36550      } else {
36551        exportValues.unshift("Off");
36552      }
36553    } else if (exportValues.includes(yes)) {
36554      exportValues.length = 0;
36555      exportValues.push("Off", yes);
36556    } else {
36557      const otherYes = exportValues.find(v => v !== "Off");
36558      exportValues.length = 0;
36559      exportValues.push("Off", otherYes);
36560    }
36561    if (!exportValues.includes(this.data.fieldValue)) {
36562      this.data.fieldValue = "Off";
36563    }
36564    this.data.exportValue = exportValues[1];
36565    const checkedAppearance = normalAppearance.get(this.data.exportValue);
36566    this.checkedAppearance = checkedAppearance instanceof _base_stream.BaseStream ? checkedAppearance : null;
36567    const uncheckedAppearance = normalAppearance.get("Off");
36568    this.uncheckedAppearance = uncheckedAppearance instanceof _base_stream.BaseStream ? uncheckedAppearance : null;
36569    if (this.checkedAppearance) {
36570      this._streams.push(this.checkedAppearance);
36571    } else {
36572      this._getDefaultCheckedAppearance(params, "check");
36573    }
36574    if (this.uncheckedAppearance) {
36575      this._streams.push(this.uncheckedAppearance);
36576    }
36577    this._fallbackFontDict = this.fallbackFontDict;
36578    if (this.data.defaultFieldValue === null) {
36579      this.data.defaultFieldValue = "Off";
36580    }
36581  }
36582  _processRadioButton(params) {
36583    this.data.fieldValue = this.data.buttonValue = null;
36584    const fieldParent = params.dict.get("Parent");
36585    if (fieldParent instanceof _primitives.Dict) {
36586      this.parent = params.dict.getRaw("Parent");
36587      const fieldParentValue = fieldParent.get("V");
36588      if (fieldParentValue instanceof _primitives.Name) {
36589        this.data.fieldValue = this._decodeFormValue(fieldParentValue);
36590      }
36591    }
36592    const appearanceStates = params.dict.get("AP");
36593    if (!(appearanceStates instanceof _primitives.Dict)) {
36594      return;
36595    }
36596    const normalAppearance = appearanceStates.get("N");
36597    if (!(normalAppearance instanceof _primitives.Dict)) {
36598      return;
36599    }
36600    for (const key of normalAppearance.getKeys()) {
36601      if (key !== "Off") {
36602        this.data.buttonValue = this._decodeFormValue(key);
36603        break;
36604      }
36605    }
36606    const checkedAppearance = normalAppearance.get(this.data.buttonValue);
36607    this.checkedAppearance = checkedAppearance instanceof _base_stream.BaseStream ? checkedAppearance : null;
36608    const uncheckedAppearance = normalAppearance.get("Off");
36609    this.uncheckedAppearance = uncheckedAppearance instanceof _base_stream.BaseStream ? uncheckedAppearance : null;
36610    if (this.checkedAppearance) {
36611      this._streams.push(this.checkedAppearance);
36612    } else {
36613      this._getDefaultCheckedAppearance(params, "disc");
36614    }
36615    if (this.uncheckedAppearance) {
36616      this._streams.push(this.uncheckedAppearance);
36617    }
36618    this._fallbackFontDict = this.fallbackFontDict;
36619    if (this.data.defaultFieldValue === null) {
36620      this.data.defaultFieldValue = "Off";
36621    }
36622  }
36623  _processPushButton(params) {
36624    const {
36625      dict,
36626      annotationGlobals
36627    } = params;
36628    if (!dict.has("A") && !dict.has("AA") && !this.data.alternativeText) {
36629      (0, _util.warn)("Push buttons without action dictionaries are not supported");
36630      return;
36631    }
36632    this.data.isTooltipOnly = !dict.has("A") && !dict.has("AA");
36633    _catalog.Catalog.parseDestDictionary({
36634      destDict: dict,
36635      resultObj: this.data,
36636      docBaseUrl: annotationGlobals.baseUrl,
36637      docAttachments: annotationGlobals.attachments
36638    });
36639  }
36640  getFieldObject() {
36641    let type = "button";
36642    let exportValues;
36643    if (this.data.checkBox) {
36644      type = "checkbox";
36645      exportValues = this.data.exportValue;
36646    } else if (this.data.radioButton) {
36647      type = "radiobutton";
36648      exportValues = this.data.buttonValue;
36649    }
36650    return {
36651      id: this.data.id,
36652      value: this.data.fieldValue || "Off",
36653      defaultValue: this.data.defaultFieldValue,
36654      exportValues,
36655      editable: !this.data.readOnly,
36656      name: this.data.fieldName,
36657      rect: this.data.rect,
36658      hidden: this.data.hidden,
36659      actions: this.data.actions,
36660      page: this.data.pageIndex,
36661      strokeColor: this.data.borderColor,
36662      fillColor: this.data.backgroundColor,
36663      rotation: this.rotation,
36664      type
36665    };
36666  }
36667  get fallbackFontDict() {
36668    const dict = new _primitives.Dict();
36669    dict.set("BaseFont", _primitives.Name.get("ZapfDingbats"));
36670    dict.set("Type", _primitives.Name.get("FallbackType"));
36671    dict.set("Subtype", _primitives.Name.get("FallbackType"));
36672    dict.set("Encoding", _primitives.Name.get("ZapfDingbatsEncoding"));
36673    return (0, _util.shadow)(this, "fallbackFontDict", dict);
36674  }
36675}
36676class ChoiceWidgetAnnotation extends WidgetAnnotation {
36677  constructor(params) {
36678    super(params);
36679    const {
36680      dict,
36681      xref
36682    } = params;
36683    this.indices = dict.getArray("I");
36684    this.hasIndices = Array.isArray(this.indices) && this.indices.length > 0;
36685    this.data.options = [];
36686    const options = (0, _core_utils.getInheritableProperty)({
36687      dict,
36688      key: "Opt"
36689    });
36690    if (Array.isArray(options)) {
36691      for (let i = 0, ii = options.length; i < ii; i++) {
36692        const option = xref.fetchIfRef(options[i]);
36693        const isOptionArray = Array.isArray(option);
36694        this.data.options[i] = {
36695          exportValue: this._decodeFormValue(isOptionArray ? xref.fetchIfRef(option[0]) : option),
36696          displayValue: this._decodeFormValue(isOptionArray ? xref.fetchIfRef(option[1]) : option)
36697        };
36698      }
36699    }
36700    if (!this.hasIndices) {
36701      if (typeof this.data.fieldValue === "string") {
36702        this.data.fieldValue = [this.data.fieldValue];
36703      } else if (!this.data.fieldValue) {
36704        this.data.fieldValue = [];
36705      }
36706    } else {
36707      this.data.fieldValue = [];
36708      const ii = this.data.options.length;
36709      for (const i of this.indices) {
36710        if (Number.isInteger(i) && i >= 0 && i < ii) {
36711          this.data.fieldValue.push(this.data.options[i].exportValue);
36712        }
36713      }
36714    }
36715    this.data.combo = this.hasFieldFlag(_util.AnnotationFieldFlag.COMBO);
36716    this.data.multiSelect = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTISELECT);
36717    this._hasText = true;
36718  }
36719  getFieldObject() {
36720    const type = this.data.combo ? "combobox" : "listbox";
36721    const value = this.data.fieldValue.length > 0 ? this.data.fieldValue[0] : null;
36722    return {
36723      id: this.data.id,
36724      value,
36725      defaultValue: this.data.defaultFieldValue,
36726      editable: !this.data.readOnly,
36727      name: this.data.fieldName,
36728      rect: this.data.rect,
36729      numItems: this.data.fieldValue.length,
36730      multipleSelection: this.data.multiSelect,
36731      hidden: this.data.hidden,
36732      actions: this.data.actions,
36733      items: this.data.options,
36734      page: this.data.pageIndex,
36735      strokeColor: this.data.borderColor,
36736      fillColor: this.data.backgroundColor,
36737      rotation: this.rotation,
36738      type
36739    };
36740  }
36741  amendSavedDict(annotationStorage, dict) {
36742    if (!this.hasIndices) {
36743      return;
36744    }
36745    let values = annotationStorage?.get(this.data.id)?.value;
36746    if (!Array.isArray(values)) {
36747      values = [values];
36748    }
36749    const indices = [];
36750    const {
36751      options
36752    } = this.data;
36753    for (let i = 0, j = 0, ii = options.length; i < ii; i++) {
36754      if (options[i].exportValue === values[j]) {
36755        indices.push(i);
36756        j += 1;
36757      }
36758    }
36759    dict.set("I", indices);
36760  }
36761  async _getAppearance(evaluator, task, intent, annotationStorage) {
36762    if (this.data.combo) {
36763      return super._getAppearance(evaluator, task, intent, annotationStorage);
36764    }
36765    let exportedValue, rotation;
36766    const storageEntry = annotationStorage?.get(this.data.id);
36767    if (storageEntry) {
36768      rotation = storageEntry.rotation;
36769      exportedValue = storageEntry.value;
36770    }
36771    if (rotation === undefined && exportedValue === undefined && !this._needAppearances) {
36772      return null;
36773    }
36774    if (exportedValue === undefined) {
36775      exportedValue = this.data.fieldValue;
36776    } else if (!Array.isArray(exportedValue)) {
36777      exportedValue = [exportedValue];
36778    }
36779    const defaultPadding = 1;
36780    const defaultHPadding = 2;
36781    let totalHeight = this.data.rect[3] - this.data.rect[1];
36782    let totalWidth = this.data.rect[2] - this.data.rect[0];
36783    if (rotation === 90 || rotation === 270) {
36784      [totalWidth, totalHeight] = [totalHeight, totalWidth];
36785    }
36786    const lineCount = this.data.options.length;
36787    const valueIndices = [];
36788    for (let i = 0; i < lineCount; i++) {
36789      const {
36790        exportValue
36791      } = this.data.options[i];
36792      if (exportedValue.includes(exportValue)) {
36793        valueIndices.push(i);
36794      }
36795    }
36796    if (!this._defaultAppearance) {
36797      this.data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance = "/Helvetica 0 Tf 0 g");
36798    }
36799    const font = await WidgetAnnotation._getFontData(evaluator, task, this.data.defaultAppearanceData, this._fieldResources.mergedResources);
36800    let defaultAppearance;
36801    let {
36802      fontSize
36803    } = this.data.defaultAppearanceData;
36804    if (!fontSize) {
36805      const lineHeight = (totalHeight - defaultPadding) / lineCount;
36806      let lineWidth = -1;
36807      let value;
36808      for (const {
36809        displayValue
36810      } of this.data.options) {
36811        const width = this._getTextWidth(displayValue, font);
36812        if (width > lineWidth) {
36813          lineWidth = width;
36814          value = displayValue;
36815        }
36816      }
36817      [defaultAppearance, fontSize] = this._computeFontSize(lineHeight, totalWidth - 2 * defaultHPadding, value, font, -1);
36818    } else {
36819      defaultAppearance = this._defaultAppearance;
36820    }
36821    const lineHeight = fontSize * _util.LINE_FACTOR;
36822    const vPadding = (lineHeight - fontSize) / 2;
36823    const numberOfVisibleLines = Math.floor(totalHeight / lineHeight);
36824    let firstIndex = 0;
36825    if (valueIndices.length > 0) {
36826      const minIndex = Math.min(...valueIndices);
36827      const maxIndex = Math.max(...valueIndices);
36828      firstIndex = Math.max(0, maxIndex - numberOfVisibleLines + 1);
36829      if (firstIndex > minIndex) {
36830        firstIndex = minIndex;
36831      }
36832    }
36833    const end = Math.min(firstIndex + numberOfVisibleLines + 1, lineCount);
36834    const buf = ["/Tx BMC q", `1 1 ${totalWidth} ${totalHeight} re W n`];
36835    if (valueIndices.length) {
36836      buf.push("0.600006 0.756866 0.854904 rg");
36837      for (const index of valueIndices) {
36838        if (firstIndex <= index && index < end) {
36839          buf.push(`1 ${totalHeight - (index - firstIndex + 1) * lineHeight} ${totalWidth} ${lineHeight} re f`);
36840        }
36841      }
36842    }
36843    buf.push("BT", defaultAppearance, `1 0 0 1 0 ${totalHeight} Tm`);
36844    const prevInfo = {
36845      shift: 0
36846    };
36847    for (let i = firstIndex; i < end; i++) {
36848      const {
36849        displayValue
36850      } = this.data.options[i];
36851      const vpadding = i === firstIndex ? vPadding : 0;
36852      buf.push(this._renderText(displayValue, font, fontSize, totalWidth, 0, prevInfo, defaultHPadding, -lineHeight + vpadding));
36853    }
36854    buf.push("ET Q EMC");
36855    return buf.join("\n");
36856  }
36857}
36858class SignatureWidgetAnnotation extends WidgetAnnotation {
36859  constructor(params) {
36860    super(params);
36861    this.data.fieldValue = null;
36862    this.data.hasOwnCanvas = this.data.noRotate;
36863  }
36864  getFieldObject() {
36865    return {
36866      id: this.data.id,
36867      value: null,
36868      page: this.data.pageIndex,
36869      type: "signature"
36870    };
36871  }
36872}
36873class TextAnnotation extends MarkupAnnotation {
36874  constructor(params) {
36875    const DEFAULT_ICON_SIZE = 22;
36876    super(params);
36877    this.data.noRotate = true;
36878    this.data.hasOwnCanvas = this.data.noRotate;
36879    const {
36880      dict
36881    } = params;
36882    this.data.annotationType = _util.AnnotationType.TEXT;
36883    if (this.data.hasAppearance) {
36884      this.data.name = "NoIcon";
36885    } else {
36886      this.data.rect[1] = this.data.rect[3] - DEFAULT_ICON_SIZE;
36887      this.data.rect[2] = this.data.rect[0] + DEFAULT_ICON_SIZE;
36888      this.data.name = dict.has("Name") ? dict.get("Name").name : "Note";
36889    }
36890    if (dict.has("State")) {
36891      this.data.state = dict.get("State") || null;
36892      this.data.stateModel = dict.get("StateModel") || null;
36893    } else {
36894      this.data.state = null;
36895      this.data.stateModel = null;
36896    }
36897  }
36898}
36899class LinkAnnotation extends Annotation {
36900  constructor(params) {
36901    super(params);
36902    const {
36903      dict,
36904      annotationGlobals
36905    } = params;
36906    this.data.annotationType = _util.AnnotationType.LINK;
36907    const quadPoints = getQuadPoints(dict, this.rectangle);
36908    if (quadPoints) {
36909      this.data.quadPoints = quadPoints;
36910    }
36911    this.data.borderColor ||= this.data.color;
36912    _catalog.Catalog.parseDestDictionary({
36913      destDict: dict,
36914      resultObj: this.data,
36915      docBaseUrl: annotationGlobals.baseUrl,
36916      docAttachments: annotationGlobals.attachments
36917    });
36918  }
36919}
36920class PopupAnnotation extends Annotation {
36921  constructor(params) {
36922    super(params);
36923    const {
36924      dict
36925    } = params;
36926    this.data.annotationType = _util.AnnotationType.POPUP;
36927    if (this.data.rect[0] === this.data.rect[2] || this.data.rect[1] === this.data.rect[3]) {
36928      this.data.rect = null;
36929    }
36930    let parentItem = dict.get("Parent");
36931    if (!parentItem) {
36932      (0, _util.warn)("Popup annotation has a missing or invalid parent annotation.");
36933      return;
36934    }
36935    const parentRect = parentItem.getArray("Rect");
36936    this.data.parentRect = Array.isArray(parentRect) && parentRect.length === 4 ? _util.Util.normalizeRect(parentRect) : null;
36937    const rt = parentItem.get("RT");
36938    if ((0, _primitives.isName)(rt, _util.AnnotationReplyType.GROUP)) {
36939      parentItem = parentItem.get("IRT");
36940    }
36941    if (!parentItem.has("M")) {
36942      this.data.modificationDate = null;
36943    } else {
36944      this.setModificationDate(parentItem.get("M"));
36945      this.data.modificationDate = this.modificationDate;
36946    }
36947    if (!parentItem.has("C")) {
36948      this.data.color = null;
36949    } else {
36950      this.setColor(parentItem.getArray("C"));
36951      this.data.color = this.color;
36952    }
36953    if (!this.viewable) {
36954      const parentFlags = parentItem.get("F");
36955      if (this._isViewable(parentFlags)) {
36956        this.setFlags(parentFlags);
36957      }
36958    }
36959    this.setTitle(parentItem.get("T"));
36960    this.data.titleObj = this._title;
36961    this.setContents(parentItem.get("Contents"));
36962    this.data.contentsObj = this._contents;
36963    if (parentItem.has("RC")) {
36964      this.data.richText = _factory.XFAFactory.getRichTextAsHtml(parentItem.get("RC"));
36965    }
36966    this.data.open = !!dict.get("Open");
36967  }
36968}
36969exports.PopupAnnotation = PopupAnnotation;
36970class FreeTextAnnotation extends MarkupAnnotation {
36971  constructor(params) {
36972    super(params);
36973    this.data.hasOwnCanvas = true;
36974    const {
36975      evaluatorOptions,
36976      xref
36977    } = params;
36978    this.data.annotationType = _util.AnnotationType.FREETEXT;
36979    this.setDefaultAppearance(params);
36980    if (this.appearance) {
36981      const {
36982        fontColor,
36983        fontSize
36984      } = (0, _default_appearance.parseAppearanceStream)(this.appearance, evaluatorOptions, xref);
36985      this.data.defaultAppearanceData.fontColor = fontColor;
36986      this.data.defaultAppearanceData.fontSize = fontSize || 10;
36987    } else if (this._isOffscreenCanvasSupported) {
36988      const strokeAlpha = params.dict.get("CA");
36989      const fakeUnicodeFont = new _default_appearance.FakeUnicodeFont(xref, "sans-serif");
36990      this.data.defaultAppearanceData.fontSize ||= 10;
36991      const {
36992        fontColor,
36993        fontSize
36994      } = this.data.defaultAppearanceData;
36995      this.appearance = fakeUnicodeFont.createAppearance(this._contents.str, this.rectangle, this.rotation, fontSize, fontColor, strokeAlpha);
36996      this._streams.push(this.appearance, _default_appearance.FakeUnicodeFont.toUnicodeStream);
36997    } else {
36998      (0, _util.warn)("FreeTextAnnotation: OffscreenCanvas is not supported, annotation may not render correctly.");
36999    }
37000  }
37001  get hasTextContent() {
37002    return !!this.appearance;
37003  }
37004  static createNewDict(annotation, xref, {
37005    apRef,
37006    ap
37007  }) {
37008    const {
37009      color,
37010      fontSize,
37011      rect,
37012      rotation,
37013      user,
37014      value
37015    } = annotation;
37016    const freetext = new _primitives.Dict(xref);
37017    freetext.set("Type", _primitives.Name.get("Annot"));
37018    freetext.set("Subtype", _primitives.Name.get("FreeText"));
37019    freetext.set("CreationDate", `D:${(0, _util.getModificationDate)()}`);
37020    freetext.set("Rect", rect);
37021    const da = `/Helv ${fontSize} Tf ${(0, _default_appearance.getPdfColor)(color, true)}`;
37022    freetext.set("DA", da);
37023    freetext.set("Contents", (0, _core_utils.isAscii)(value) ? value : (0, _core_utils.stringToUTF16String)(value, true));
37024    freetext.set("F", 4);
37025    freetext.set("Border", [0, 0, 0]);
37026    freetext.set("Rotate", rotation);
37027    if (user) {
37028      freetext.set("T", (0, _core_utils.isAscii)(user) ? user : (0, _core_utils.stringToUTF16String)(user, true));
37029    }
37030    if (apRef || ap) {
37031      const n = new _primitives.Dict(xref);
37032      freetext.set("AP", n);
37033      if (apRef) {
37034        n.set("N", apRef);
37035      } else {
37036        n.set("N", ap);
37037      }
37038    }
37039    return freetext;
37040  }
37041  static async createNewAppearanceStream(annotation, xref, params) {
37042    const {
37043      baseFontRef,
37044      evaluator,
37045      task
37046    } = params;
37047    const {
37048      color,
37049      fontSize,
37050      rect,
37051      rotation,
37052      value
37053    } = annotation;
37054    const resources = new _primitives.Dict(xref);
37055    const font = new _primitives.Dict(xref);
37056    if (baseFontRef) {
37057      font.set("Helv", baseFontRef);
37058    } else {
37059      const baseFont = new _primitives.Dict(xref);
37060      baseFont.set("BaseFont", _primitives.Name.get("Helvetica"));
37061      baseFont.set("Type", _primitives.Name.get("Font"));
37062      baseFont.set("Subtype", _primitives.Name.get("Type1"));
37063      baseFont.set("Encoding", _primitives.Name.get("WinAnsiEncoding"));
37064      font.set("Helv", baseFont);
37065    }
37066    resources.set("Font", font);
37067    const helv = await WidgetAnnotation._getFontData(evaluator, task, {
37068      fontName: "Helv",
37069      fontSize
37070    }, resources);
37071    const [x1, y1, x2, y2] = rect;
37072    let w = x2 - x1;
37073    let h = y2 - y1;
37074    if (rotation % 180 !== 0) {
37075      [w, h] = [h, w];
37076    }
37077    const lines = value.split("\n");
37078    const scale = fontSize / 1000;
37079    let totalWidth = -Infinity;
37080    const encodedLines = [];
37081    for (let line of lines) {
37082      const encoded = helv.encodeString(line);
37083      if (encoded.length > 1) {
37084        return null;
37085      }
37086      line = encoded.join("");
37087      encodedLines.push(line);
37088      let lineWidth = 0;
37089      const glyphs = helv.charsToGlyphs(line);
37090      for (const glyph of glyphs) {
37091        lineWidth += glyph.width * scale;
37092      }
37093      totalWidth = Math.max(totalWidth, lineWidth);
37094    }
37095    let hscale = 1;
37096    if (totalWidth > w) {
37097      hscale = w / totalWidth;
37098    }
37099    let vscale = 1;
37100    const lineHeight = _util.LINE_FACTOR * fontSize;
37101    const lineAscent = (_util.LINE_FACTOR - _util.LINE_DESCENT_FACTOR) * fontSize;
37102    const totalHeight = lineHeight * lines.length;
37103    if (totalHeight > h) {
37104      vscale = h / totalHeight;
37105    }
37106    const fscale = Math.min(hscale, vscale);
37107    const newFontSize = fontSize * fscale;
37108    let firstPoint, clipBox, matrix;
37109    switch (rotation) {
37110      case 0:
37111        matrix = [1, 0, 0, 1];
37112        clipBox = [rect[0], rect[1], w, h];
37113        firstPoint = [rect[0], rect[3] - lineAscent];
37114        break;
37115      case 90:
37116        matrix = [0, 1, -1, 0];
37117        clipBox = [rect[1], -rect[2], w, h];
37118        firstPoint = [rect[1], -rect[0] - lineAscent];
37119        break;
37120      case 180:
37121        matrix = [-1, 0, 0, -1];
37122        clipBox = [-rect[2], -rect[3], w, h];
37123        firstPoint = [-rect[2], -rect[1] - lineAscent];
37124        break;
37125      case 270:
37126        matrix = [0, -1, 1, 0];
37127        clipBox = [-rect[3], rect[0], w, h];
37128        firstPoint = [-rect[3], rect[2] - lineAscent];
37129        break;
37130    }
37131    const buffer = ["q", `${matrix.join(" ")} 0 0 cm`, `${clipBox.join(" ")} re W n`, `BT`, `${(0, _default_appearance.getPdfColor)(color, true)}`, `0 Tc /Helv ${(0, _core_utils.numberToString)(newFontSize)} Tf`];
37132    buffer.push(`${firstPoint.join(" ")} Td (${(0, _core_utils.escapeString)(encodedLines[0])}) Tj`);
37133    const vShift = (0, _core_utils.numberToString)(lineHeight);
37134    for (let i = 1, ii = encodedLines.length; i < ii; i++) {
37135      const line = encodedLines[i];
37136      buffer.push(`0 -${vShift} Td (${(0, _core_utils.escapeString)(line)}) Tj`);
37137    }
37138    buffer.push("ET", "Q");
37139    const appearance = buffer.join("\n");
37140    const appearanceStreamDict = new _primitives.Dict(xref);
37141    appearanceStreamDict.set("FormType", 1);
37142    appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
37143    appearanceStreamDict.set("Type", _primitives.Name.get("XObject"));
37144    appearanceStreamDict.set("BBox", rect);
37145    appearanceStreamDict.set("Resources", resources);
37146    appearanceStreamDict.set("Matrix", [1, 0, 0, 1, -rect[0], -rect[1]]);
37147    const ap = new _stream.StringStream(appearance);
37148    ap.dict = appearanceStreamDict;
37149    return ap;
37150  }
37151}
37152class LineAnnotation extends MarkupAnnotation {
37153  constructor(params) {
37154    super(params);
37155    const {
37156      dict,
37157      xref
37158    } = params;
37159    this.data.annotationType = _util.AnnotationType.LINE;
37160    this.data.hasOwnCanvas = this.data.noRotate;
37161    const lineCoordinates = dict.getArray("L");
37162    this.data.lineCoordinates = _util.Util.normalizeRect(lineCoordinates);
37163    this.setLineEndings(dict.getArray("LE"));
37164    this.data.lineEndings = this.lineEndings;
37165    if (!this.appearance) {
37166      const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
37167      const strokeAlpha = dict.get("CA");
vendor: 11,078 bytes, lines 37168-37475
37168      const interiorColor = getRgbColor(dict.getArray("IC"), null);
37169      const fillColor = interiorColor ? getPdfColorArray(interiorColor) : null;
37170      const fillAlpha = fillColor ? strokeAlpha : null;
37171      const borderWidth = this.borderStyle.width || 1,
37172        borderAdjust = 2 * borderWidth;
37173      const bbox = [this.data.lineCoordinates[0] - borderAdjust, this.data.lineCoordinates[1] - borderAdjust, this.data.lineCoordinates[2] + borderAdjust, this.data.lineCoordinates[3] + borderAdjust];
37174      if (!_util.Util.intersect(this.rectangle, bbox)) {
37175        this.rectangle = bbox;
37176      }
37177      this._setDefaultAppearance({
37178        xref,
37179        extra: `${borderWidth} w`,
37180        strokeColor,
37181        fillColor,
37182        strokeAlpha,
37183        fillAlpha,
37184        pointsCallback: (buffer, points) => {
37185          buffer.push(`${lineCoordinates[0]} ${lineCoordinates[1]} m`, `${lineCoordinates[2]} ${lineCoordinates[3]} l`, "S");
37186          return [points[0].x - borderWidth, points[1].x + borderWidth, points[3].y - borderWidth, points[1].y + borderWidth];
37187        }
37188      });
37189    }
37190  }
37191}
37192class SquareAnnotation extends MarkupAnnotation {
37193  constructor(params) {
37194    super(params);
37195    const {
37196      dict,
37197      xref
37198    } = params;
37199    this.data.annotationType = _util.AnnotationType.SQUARE;
37200    this.data.hasOwnCanvas = this.data.noRotate;
37201    if (!this.appearance) {
37202      const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
37203      const strokeAlpha = dict.get("CA");
37204      const interiorColor = getRgbColor(dict.getArray("IC"), null);
37205      const fillColor = interiorColor ? getPdfColorArray(interiorColor) : null;
37206      const fillAlpha = fillColor ? strokeAlpha : null;
37207      if (this.borderStyle.width === 0 && !fillColor) {
37208        return;
37209      }
37210      this._setDefaultAppearance({
37211        xref,
37212        extra: `${this.borderStyle.width} w`,
37213        strokeColor,
37214        fillColor,
37215        strokeAlpha,
37216        fillAlpha,
37217        pointsCallback: (buffer, points) => {
37218          const x = points[2].x + this.borderStyle.width / 2;
37219          const y = points[2].y + this.borderStyle.width / 2;
37220          const width = points[3].x - points[2].x - this.borderStyle.width;
37221          const height = points[1].y - points[3].y - this.borderStyle.width;
37222          buffer.push(`${x} ${y} ${width} ${height} re`);
37223          if (fillColor) {
37224            buffer.push("B");
37225          } else {
37226            buffer.push("S");
37227          }
37228          return [points[0].x, points[1].x, points[3].y, points[1].y];
37229        }
37230      });
37231    }
37232  }
37233}
37234class CircleAnnotation extends MarkupAnnotation {
37235  constructor(params) {
37236    super(params);
37237    const {
37238      dict,
37239      xref
37240    } = params;
37241    this.data.annotationType = _util.AnnotationType.CIRCLE;
37242    if (!this.appearance) {
37243      const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
37244      const strokeAlpha = dict.get("CA");
37245      const interiorColor = getRgbColor(dict.getArray("IC"), null);
37246      const fillColor = interiorColor ? getPdfColorArray(interiorColor) : null;
37247      const fillAlpha = fillColor ? strokeAlpha : null;
37248      if (this.borderStyle.width === 0 && !fillColor) {
37249        return;
37250      }
37251      const controlPointsDistance = 4 / 3 * Math.tan(Math.PI / (2 * 4));
37252      this._setDefaultAppearance({
37253        xref,
37254        extra: `${this.borderStyle.width} w`,
37255        strokeColor,
37256        fillColor,
37257        strokeAlpha,
37258        fillAlpha,
37259        pointsCallback: (buffer, points) => {
37260          const x0 = points[0].x + this.borderStyle.width / 2;
37261          const y0 = points[0].y - this.borderStyle.width / 2;
37262          const x1 = points[3].x - this.borderStyle.width / 2;
37263          const y1 = points[3].y + this.borderStyle.width / 2;
37264          const xMid = x0 + (x1 - x0) / 2;
37265          const yMid = y0 + (y1 - y0) / 2;
37266          const xOffset = (x1 - x0) / 2 * controlPointsDistance;
37267          const yOffset = (y1 - y0) / 2 * controlPointsDistance;
37268          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");
37269          if (fillColor) {
37270            buffer.push("B");
37271          } else {
37272            buffer.push("S");
37273          }
37274          return [points[0].x, points[1].x, points[3].y, points[1].y];
37275        }
37276      });
37277    }
37278  }
37279}
37280class PolylineAnnotation extends MarkupAnnotation {
37281  constructor(params) {
37282    super(params);
37283    const {
37284      dict,
37285      xref
37286    } = params;
37287    this.data.annotationType = _util.AnnotationType.POLYLINE;
37288    this.data.hasOwnCanvas = this.data.noRotate;
37289    this.data.vertices = [];
37290    if (!(this instanceof PolygonAnnotation)) {
37291      this.setLineEndings(dict.getArray("LE"));
37292      this.data.lineEndings = this.lineEndings;
37293    }
37294    const rawVertices = dict.getArray("Vertices");
37295    if (!Array.isArray(rawVertices)) {
37296      return;
37297    }
37298    for (let i = 0, ii = rawVertices.length; i < ii; i += 2) {
37299      this.data.vertices.push({
37300        x: rawVertices[i],
37301        y: rawVertices[i + 1]
37302      });
37303    }
37304    if (!this.appearance) {
37305      const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
37306      const strokeAlpha = dict.get("CA");
37307      const borderWidth = this.borderStyle.width || 1,
37308        borderAdjust = 2 * borderWidth;
37309      const bbox = [Infinity, Infinity, -Infinity, -Infinity];
37310      for (const vertex of this.data.vertices) {
37311        bbox[0] = Math.min(bbox[0], vertex.x - borderAdjust);
37312        bbox[1] = Math.min(bbox[1], vertex.y - borderAdjust);
37313        bbox[2] = Math.max(bbox[2], vertex.x + borderAdjust);
37314        bbox[3] = Math.max(bbox[3], vertex.y + borderAdjust);
37315      }
37316      if (!_util.Util.intersect(this.rectangle, bbox)) {
37317        this.rectangle = bbox;
37318      }
37319      this._setDefaultAppearance({
37320        xref,
37321        extra: `${borderWidth} w`,
37322        strokeColor,
37323        strokeAlpha,
37324        pointsCallback: (buffer, points) => {
37325          const vertices = this.data.vertices;
37326          for (let i = 0, ii = vertices.length; i < ii; i++) {
37327            buffer.push(`${vertices[i].x} ${vertices[i].y} ${i === 0 ? "m" : "l"}`);
37328          }
37329          buffer.push("S");
37330          return [points[0].x, points[1].x, points[3].y, points[1].y];
37331        }
37332      });
37333    }
37334  }
37335}
37336class PolygonAnnotation extends PolylineAnnotation {
37337  constructor(params) {
37338    super(params);
37339    this.data.annotationType = _util.AnnotationType.POLYGON;
37340  }
37341}
37342class CaretAnnotation extends MarkupAnnotation {
37343  constructor(params) {
37344    super(params);
37345    this.data.annotationType = _util.AnnotationType.CARET;
37346  }
37347}
37348class InkAnnotation extends MarkupAnnotation {
37349  constructor(params) {
37350    super(params);
37351    this.data.hasOwnCanvas = this.data.noRotate;
37352    const {
37353      dict,
37354      xref
37355    } = params;
37356    this.data.annotationType = _util.AnnotationType.INK;
37357    this.data.inkLists = [];
37358    const rawInkLists = dict.getArray("InkList");
37359    if (!Array.isArray(rawInkLists)) {
37360      return;
37361    }
37362    for (let i = 0, ii = rawInkLists.length; i < ii; ++i) {
37363      this.data.inkLists.push([]);
37364      for (let j = 0, jj = rawInkLists[i].length; j < jj; j += 2) {
37365        this.data.inkLists[i].push({
37366          x: xref.fetchIfRef(rawInkLists[i][j]),
37367          y: xref.fetchIfRef(rawInkLists[i][j + 1])
37368        });
37369      }
37370    }
37371    if (!this.appearance) {
37372      const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
37373      const strokeAlpha = dict.get("CA");
37374      const borderWidth = this.borderStyle.width || 1,
37375        borderAdjust = 2 * borderWidth;
37376      const bbox = [Infinity, Infinity, -Infinity, -Infinity];
37377      for (const inkLists of this.data.inkLists) {
37378        for (const vertex of inkLists) {
37379          bbox[0] = Math.min(bbox[0], vertex.x - borderAdjust);
37380          bbox[1] = Math.min(bbox[1], vertex.y - borderAdjust);
37381          bbox[2] = Math.max(bbox[2], vertex.x + borderAdjust);
37382          bbox[3] = Math.max(bbox[3], vertex.y + borderAdjust);
37383        }
37384      }
37385      if (!_util.Util.intersect(this.rectangle, bbox)) {
37386        this.rectangle = bbox;
37387      }
37388      this._setDefaultAppearance({
37389        xref,
37390        extra: `${borderWidth} w`,
37391        strokeColor,
37392        strokeAlpha,
37393        pointsCallback: (buffer, points) => {
37394          for (const inkList of this.data.inkLists) {
37395            for (let i = 0, ii = inkList.length; i < ii; i++) {
37396              buffer.push(`${inkList[i].x} ${inkList[i].y} ${i === 0 ? "m" : "l"}`);
37397            }
37398            buffer.push("S");
37399          }
37400          return [points[0].x, points[1].x, points[3].y, points[1].y];
37401        }
37402      });
37403    }
37404  }
37405  static createNewDict(annotation, xref, {
37406    apRef,
37407    ap
37408  }) {
37409    const {
37410      color,
37411      opacity,
37412      paths,
37413      rect,
37414      rotation,
37415      thickness
37416    } = annotation;
37417    const ink = new _primitives.Dict(xref);
37418    ink.set("Type", _primitives.Name.get("Annot"));
37419    ink.set("Subtype", _primitives.Name.get("Ink"));
37420    ink.set("CreationDate", `D:${(0, _util.getModificationDate)()}`);
37421    ink.set("Rect", rect);
37422    ink.set("InkList", paths.map(p => p.points));
37423    ink.set("F", 4);
37424    ink.set("Rotate", rotation);
37425    const bs = new _primitives.Dict(xref);
37426    ink.set("BS", bs);
37427    bs.set("W", thickness);
37428    ink.set("C", Array.from(color, c => c / 255));
37429    ink.set("CA", opacity);
37430    const n = new _primitives.Dict(xref);
37431    ink.set("AP", n);
37432    if (apRef) {
37433      n.set("N", apRef);
37434    } else {
37435      n.set("N", ap);
37436    }
37437    return ink;
37438  }
37439  static async createNewAppearanceStream(annotation, xref, params) {
37440    const {
37441      color,
37442      rect,
37443      paths,
37444      thickness,
37445      opacity
37446    } = annotation;
37447    const appearanceBuffer = [`${thickness} w 1 J 1 j`, `${(0, _default_appearance.getPdfColor)(color, false)}`];
37448    if (opacity !== 1) {
37449      appearanceBuffer.push("/R0 gs");
37450    }
37451    const buffer = [];
37452    for (const {
37453      bezier
37454    } of paths) {
37455      buffer.length = 0;
37456      buffer.push(`${(0, _core_utils.numberToString)(bezier[0])} ${(0, _core_utils.numberToString)(bezier[1])} m`);
37457      for (let i = 2, ii = bezier.length; i < ii; i += 6) {
37458        const curve = bezier.slice(i, i + 6).map(_core_utils.numberToString).join(" ");
37459        buffer.push(`${curve} c`);
37460      }
37461      buffer.push("S");
37462      appearanceBuffer.push(buffer.join("\n"));
37463    }
37464    const appearance = appearanceBuffer.join("\n");
37465    const appearanceStreamDict = new _primitives.Dict(xref);
37466    appearanceStreamDict.set("FormType", 1);
37467    appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
37468    appearanceStreamDict.set("Type", _primitives.Name.get("XObject"));
37469    appearanceStreamDict.set("BBox", rect);
37470    appearanceStreamDict.set("Length", appearance.length);
37471    if (opacity !== 1) {
37472      const resources = new _primitives.Dict(xref);
37473      const extGState = new _primitives.Dict(xref);
37474      const r0 = new _primitives.Dict(xref);
37475      r0.set("CA", opacity);
37476      r0.set("Type", _primitives.Name.get("ExtGState"));
37477      extGState.set("R0", r0);
37478      resources.set("ExtGState", extGState);
37479      appearanceStreamDict.set("Resources", resources);
37480    }
37481    const ap = new _stream.StringStream(appearance);
37482    ap.dict = appearanceStreamDict;
37483    return ap;
37484  }
37485}
37486class HighlightAnnotation extends MarkupAnnotation {
37487  constructor(params) {
37488    super(params);
37489    const {
37490      dict,
37491      xref
37492    } = params;
37493    this.data.annotationType = _util.AnnotationType.HIGHLIGHT;
37494    const quadPoints = this.data.quadPoints = getQuadPoints(dict, null);
37495    if (quadPoints) {
37496      const resources = this.appearance?.dict.get("Resources");
37497      if (!this.appearance || !resources?.has("ExtGState")) {
37498        if (this.appearance) {
37499          (0, _util.warn)("HighlightAnnotation - ignoring built-in appearance stream.");
37500        }
37501        const fillColor = this.color ? getPdfColorArray(this.color) : [1, 1, 0];
37502        const fillAlpha = dict.get("CA");
37503        this._setDefaultAppearance({
37504          xref,
37505          fillColor,
37506          blendMode: "Multiply",
37507          fillAlpha,
37508          pointsCallback: (buffer, points) => {
37509            buffer.push(`${points[0].x} ${points[0].y} m`, `${points[1].x} ${points[1].y} l`, `${points[3].x} ${points[3].y} l`, `${points[2].x} ${points[2].y} l`, "f");
37510            return [points[0].x, points[1].x, points[3].y, points[1].y];
37511          }
37512        });
37513      }
37514    } else {
37515      this.data.popupRef = null;
37516    }
37517  }
37518}
37519class UnderlineAnnotation extends MarkupAnnotation {
37520  constructor(params) {
37521    super(params);
37522    const {
37523      dict,
37524      xref
37525    } = params;
37526    this.data.annotationType = _util.AnnotationType.UNDERLINE;
37527    const quadPoints = this.data.quadPoints = getQuadPoints(dict, null);
37528    if (quadPoints) {
37529      if (!this.appearance) {
37530        const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
37531        const strokeAlpha = dict.get("CA");
37532        this._setDefaultAppearance({
37533          xref,
37534          extra: "[] 0 d 0.571 w",
37535          strokeColor,
37536          strokeAlpha,
37537          pointsCallback: (buffer, points) => {
37538            buffer.push(`${points[2].x} ${points[2].y + 1.3} m`, `${points[3].x} ${points[3].y + 1.3} l`, "S");
37539            return [points[0].x, points[1].x, points[3].y, points[1].y];
37540          }
37541        });
37542      }
37543    } else {
37544      this.data.popupRef = null;
37545    }
37546  }
37547}
37548class SquigglyAnnotation extends MarkupAnnotation {
37549  constructor(params) {
37550    super(params);
37551    const {
37552      dict,
37553      xref
37554    } = params;
37555    this.data.annotationType = _util.AnnotationType.SQUIGGLY;
37556    const quadPoints = this.data.quadPoints = getQuadPoints(dict, null);
37557    if (quadPoints) {
37558      if (!this.appearance) {
37559        const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
37560        const strokeAlpha = dict.get("CA");
37561        this._setDefaultAppearance({
37562          xref,
37563          extra: "[] 0 d 1 w",
37564          strokeColor,
37565          strokeAlpha,
37566          pointsCallback: (buffer, points) => {
37567            const dy = (points[0].y - points[2].y) / 6;
37568            let shift = dy;
37569            let x = points[2].x;
37570            const y = points[2].y;
37571            const xEnd = points[3].x;
37572            buffer.push(`${x} ${y + shift} m`);
37573            do {
37574              x += 2;
37575              shift = shift === 0 ? dy : 0;
37576              buffer.push(`${x} ${y + shift} l`);
37577            } while (x < xEnd);
37578            buffer.push("S");
37579            return [points[2].x, xEnd, y - 2 * dy, y + 2 * dy];
37580          }
37581        });
37582      }
37583    } else {
37584      this.data.popupRef = null;
37585    }
37586  }
37587}
37588class StrikeOutAnnotation extends MarkupAnnotation {
37589  constructor(params) {
37590    super(params);
37591    const {
37592      dict,
37593      xref
37594    } = params;
37595    this.data.annotationType = _util.AnnotationType.STRIKEOUT;
37596    const quadPoints = this.data.quadPoints = getQuadPoints(dict, null);
37597    if (quadPoints) {
37598      if (!this.appearance) {
37599        const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
37600        const strokeAlpha = dict.get("CA");
37601        this._setDefaultAppearance({
37602          xref,
37603          extra: "[] 0 d 1 w",
37604          strokeColor,
37605          strokeAlpha,
37606          pointsCallback: (buffer, points) => {
37607            buffer.push(`${(points[0].x + points[2].x) / 2} ` + `${(points[0].y + points[2].y) / 2} m`, `${(points[1].x + points[3].x) / 2} ` + `${(points[1].y + points[3].y) / 2} l`, "S");
37608            return [points[0].x, points[1].x, points[3].y, points[1].y];
37609          }
37610        });
37611      }
37612    } else {
37613      this.data.popupRef = null;
37614    }
37615  }
37616}
37617class StampAnnotation extends MarkupAnnotation {
37618  constructor(params) {
37619    super(params);
37620    this.data.annotationType = _util.AnnotationType.STAMP;
37621    this.data.hasOwnCanvas = this.data.noRotate;
37622  }
37623  static async createImage(bitmap, xref) {
37624    const {
37625      width,
37626      height
37627    } = bitmap;
37628    const canvas = new OffscreenCanvas(width, height);
37629    const ctx = canvas.getContext("2d", {
37630      alpha: true
37631    });
37632    ctx.drawImage(bitmap, 0, 0);
37633    const data = ctx.getImageData(0, 0, width, height).data;
37634    const buf32 = new Uint32Array(data.buffer);
37635    const hasAlpha = buf32.some(_util.FeatureTest.isLittleEndian ? x => x >>> 24 !== 0xff : x => (x & 0xff) !== 0xff);
37636    if (hasAlpha) {
37637      ctx.fillStyle = "white";
37638      ctx.fillRect(0, 0, width, height);
37639      ctx.drawImage(bitmap, 0, 0);
37640    }
37641    const jpegBufferPromise = canvas.convertToBlob({
37642      type: "image/jpeg",
37643      quality: 1
37644    }).then(blob => {
37645      return blob.arrayBuffer();
37646    });
37647    const xobjectName = _primitives.Name.get("XObject");
37648    const imageName = _primitives.Name.get("Image");
37649    const image = new _primitives.Dict(xref);
37650    image.set("Type", xobjectName);
37651    image.set("Subtype", imageName);
37652    image.set("BitsPerComponent", 8);
37653    image.set("ColorSpace", _primitives.Name.get("DeviceRGB"));
37654    image.set("Filter", _primitives.Name.get("DCTDecode"));
37655    image.set("BBox", [0, 0, width, height]);
37656    image.set("Width", width);
37657    image.set("Height", height);
37658    let smaskStream = null;
37659    if (hasAlpha) {
37660      const alphaBuffer = new Uint8Array(buf32.length);
37661      if (_util.FeatureTest.isLittleEndian) {
37662        for (let i = 0, ii = buf32.length; i < ii; i++) {
37663          alphaBuffer[i] = buf32[i] >>> 24;
37664        }
37665      } else {
37666        for (let i = 0, ii = buf32.length; i < ii; i++) {
37667          alphaBuffer[i] = buf32[i] & 0xff;
37668        }
37669      }
37670      const smask = new _primitives.Dict(xref);
37671      smask.set("Type", xobjectName);
37672      smask.set("Subtype", imageName);
37673      smask.set("BitsPerComponent", 8);
37674      smask.set("ColorSpace", _primitives.Name.get("DeviceGray"));
37675      smask.set("Width", width);
37676      smask.set("Height", height);
37677      smaskStream = new _stream.Stream(alphaBuffer, 0, 0, smask);
37678    }
37679    const imageStream = new _stream.Stream(await jpegBufferPromise, 0, 0, image);
37680    return {
37681      imageStream,
37682      smaskStream,
37683      width,
37684      height
37685    };
37686  }
37687  static createNewDict(annotation, xref, {
37688    apRef,
37689    ap
37690  }) {
37691    const {
37692      rect,
37693      rotation,
37694      user
37695    } = annotation;
37696    const stamp = new _primitives.Dict(xref);
37697    stamp.set("Type", _primitives.Name.get("Annot"));
37698    stamp.set("Subtype", _primitives.Name.get("Stamp"));
37699    stamp.set("CreationDate", `D:${(0, _util.getModificationDate)()}`);
37700    stamp.set("Rect", rect);
37701    stamp.set("F", 4);
37702    stamp.set("Border", [0, 0, 0]);
37703    stamp.set("Rotate", rotation);
37704    if (user) {
37705      stamp.set("T", (0, _core_utils.isAscii)(user) ? user : (0, _core_utils.stringToUTF16String)(user, true));
37706    }
37707    if (apRef || ap) {
37708      const n = new _primitives.Dict(xref);
37709      stamp.set("AP", n);
37710      if (apRef) {
37711        n.set("N", apRef);
37712      } else {
37713        n.set("N", ap);
37714      }
37715    }
37716    return stamp;
37717  }
37718  static async createNewAppearanceStream(annotation, xref, params) {
37719    const {
37720      rotation
37721    } = annotation;
37722    const {
37723      imageRef,
37724      width,
37725      height
37726    } = params.image;
37727    const resources = new _primitives.Dict(xref);
37728    const xobject = new _primitives.Dict(xref);
37729    resources.set("XObject", xobject);
37730    xobject.set("Im0", imageRef);
37731    const appearance = `q ${width} 0 0 ${height} 0 0 cm /Im0 Do Q`;
37732    const appearanceStreamDict = new _primitives.Dict(xref);
37733    appearanceStreamDict.set("FormType", 1);
37734    appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
37735    appearanceStreamDict.set("Type", _primitives.Name.get("XObject"));
37736    appearanceStreamDict.set("BBox", [0, 0, width, height]);
37737    appearanceStreamDict.set("Resources", resources);
37738    if (rotation) {
37739      const matrix = (0, _core_utils.getRotationMatrix)(rotation, width, height);
37740      appearanceStreamDict.set("Matrix", matrix);
37741    }
37742    const ap = new _stream.StringStream(appearance);
37743    ap.dict = appearanceStreamDict;
37744    return ap;
37745  }
37746}
37747class FileAttachmentAnnotation extends MarkupAnnotation {
37748  constructor(params) {
37749    super(params);
37750    const {
37751      dict,
37752      xref
37753    } = params;
37754    const file = new _file_spec.FileSpec(dict.get("FS"), xref);
37755    this.data.annotationType = _util.AnnotationType.FILEATTACHMENT;
37756    this.data.hasOwnCanvas = this.data.noRotate;
37757    this.data.file = file.serializable;
37758    const name = dict.get("Name");
37759    this.data.name = name instanceof _primitives.Name ? (0, _util.stringToPDFString)(name.name) : "PushPin";
37760    const fillAlpha = dict.get("ca");
37761    this.data.fillAlpha = typeof fillAlpha === "number" && fillAlpha >= 0 && fillAlpha <= 1 ? fillAlpha : null;
37762  }
37763}
37764
37765/***/ }),
37766/* 11 */
37767/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
37768
37769
37770
37771Object.defineProperty(exports, "__esModule", ({
37772  value: true
37773}));
37774exports.FakeUnicodeFont = void 0;
37775exports.createDefaultAppearance = createDefaultAppearance;
37776exports.getPdfColor = getPdfColor;
37777exports.parseAppearanceStream = parseAppearanceStream;
37778exports.parseDefaultAppearance = parseDefaultAppearance;
37779var _primitives = __w_pdfjs_require__(4);
37780var _core_utils = __w_pdfjs_require__(3);
37781var _util = __w_pdfjs_require__(2);
37782var _colorspace = __w_pdfjs_require__(12);
37783var _evaluator = __w_pdfjs_require__(13);
37784var _image_utils = __w_pdfjs_require__(59);
37785var _function = __w_pdfjs_require__(57);
37786var _stream = __w_pdfjs_require__(8);
37787class DefaultAppearanceEvaluator extends _evaluator.EvaluatorPreprocessor {
37788  constructor(str) {
37789    super(new _stream.StringStream(str));
37790  }
37791  parse() {
37792    const operation = {
37793      fn: 0,
37794      args: []
37795    };
37796    const result = {
37797      fontSize: 0,
37798      fontName: "",
37799      fontColor: new Uint8ClampedArray(3)
37800    };
37801    try {
37802      while (true) {
37803        operation.args.length = 0;
37804        if (!this.read(operation)) {
37805          break;
37806        }
37807        if (this.savedStatesDepth !== 0) {
37808          continue;
37809        }
37810        const {
37811          fn,
37812          args
37813        } = operation;
37814        switch (fn | 0) {
37815          case _util.OPS.setFont:
37816            const [fontName, fontSize] = args;
37817            if (fontName instanceof _primitives.Name) {
37818              result.fontName = fontName.name;
37819            }
37820            if (typeof fontSize === "number" && fontSize > 0) {
37821              result.fontSize = fontSize;
37822            }
37823            break;
37824          case _util.OPS.setFillRGBColor:
37825            _colorspace.ColorSpace.singletons.rgb.getRgbItem(args, 0, result.fontColor, 0);
37826            break;
37827          case _util.OPS.setFillGray:
37828            _colorspace.ColorSpace.singletons.gray.getRgbItem(args, 0, result.fontColor, 0);
37829            break;
37830          case _util.OPS.setFillCMYKColor:
37831            _colorspace.ColorSpace.singletons.cmyk.getRgbItem(args, 0, result.fontColor, 0);
37832            break;
37833        }
37834      }
37835    } catch (reason) {
37836      (0, _util.warn)(`parseDefaultAppearance - ignoring errors: "${reason}".`);
37837    }
37838    return result;
37839  }
37840}
37841function parseDefaultAppearance(str) {
37842  return new DefaultAppearanceEvaluator(str).parse();
37843}
37844class AppearanceStreamEvaluator extends _evaluator.EvaluatorPreprocessor {
37845  constructor(stream, evaluatorOptions, xref) {
37846    super(stream);
37847    this.stream = stream;
37848    this.evaluatorOptions = evaluatorOptions;
37849    this.xref = xref;
37850    this.resources = stream.dict?.get("Resources");
37851  }
37852  parse() {
37853    const operation = {
37854      fn: 0,
37855      args: []
37856    };
37857    let result = {
37858      scaleFactor: 1,
37859      fontSize: 0,
37860      fontName: "",
37861      fontColor: new Uint8ClampedArray(3),
37862      fillColorSpace: _colorspace.ColorSpace.singletons.gray
37863    };
37864    let breakLoop = false;
37865    const stack = [];
37866    try {
37867      while (true) {
37868        operation.args.length = 0;
37869        if (breakLoop || !this.read(operation)) {
37870          break;
37871        }
37872        const {
37873          fn,
37874          args
37875        } = operation;
37876        switch (fn | 0) {
37877          case _util.OPS.save:
37878            stack.push({
37879              scaleFactor: result.scaleFactor,
37880              fontSize: result.fontSize,
37881              fontName: result.fontName,
37882              fontColor: result.fontColor.slice(),
37883              fillColorSpace: result.fillColorSpace
37884            });
37885            break;
37886          case _util.OPS.restore:
37887            result = stack.pop() || result;
37888            break;
37889          case _util.OPS.setTextMatrix:
37890            result.scaleFactor *= Math.hypot(args[0], args[1]);
37891            break;
37892          case _util.OPS.setFont:
37893            const [fontName, fontSize] = args;
37894            if (fontName instanceof _primitives.Name) {
37895              result.fontName = fontName.name;
37896            }
37897            if (typeof fontSize === "number" && fontSize > 0) {
37898              result.fontSize = fontSize * result.scaleFactor;
37899            }
37900            break;
37901          case _util.OPS.setFillColorSpace:
37902            result.fillColorSpace = _colorspace.ColorSpace.parse({
37903              cs: args[0],
37904              xref: this.xref,
37905              resources: this.resources,
37906              pdfFunctionFactory: this._pdfFunctionFactory,
37907              localColorSpaceCache: this._localColorSpaceCache
37908            });
37909            break;
37910          case _util.OPS.setFillColor:
37911            const cs = result.fillColorSpace;
37912            cs.getRgbItem(args, 0, result.fontColor, 0);
37913            break;
37914          case _util.OPS.setFillRGBColor:
37915            _colorspace.ColorSpace.singletons.rgb.getRgbItem(args, 0, result.fontColor, 0);
37916            break;
37917          case _util.OPS.setFillGray:
37918            _colorspace.ColorSpace.singletons.gray.getRgbItem(args, 0, result.fontColor, 0);
37919            break;
37920          case _util.OPS.setFillCMYKColor:
37921            _colorspace.ColorSpace.singletons.cmyk.getRgbItem(args, 0, result.fontColor, 0);
37922            break;
37923          case _util.OPS.showText:
37924          case _util.OPS.showSpacedText:
37925          case _util.OPS.nextLineShowText:
37926          case _util.OPS.nextLineSetSpacingShowText:
37927            breakLoop = true;
37928            break;
37929        }
37930      }
37931    } catch (reason) {
37932      (0, _util.warn)(`parseAppearanceStream - ignoring errors: "${reason}".`);
37933    }
37934    this.stream.reset();
37935    delete result.scaleFactor;
37936    delete result.fillColorSpace;
37937    return result;
37938  }
37939  get _localColorSpaceCache() {
37940    return (0, _util.shadow)(this, "_localColorSpaceCache", new _image_utils.LocalColorSpaceCache());
37941  }
37942  get _pdfFunctionFactory() {
37943    const pdfFunctionFactory = new _function.PDFFunctionFactory({
37944      xref: this.xref,
37945      isEvalSupported: this.evaluatorOptions.isEvalSupported
37946    });
37947    return (0, _util.shadow)(this, "_pdfFunctionFactory", pdfFunctionFactory);
37948  }
37949}
37950function parseAppearanceStream(stream, evaluatorOptions, xref) {
37951  return new AppearanceStreamEvaluator(stream, evaluatorOptions, xref).parse();
37952}
37953function getPdfColor(color, isFill) {
37954  if (color[0] === color[1] && color[1] === color[2]) {
37955    const gray = color[0] / 255;
37956    return `${(0, _core_utils.numberToString)(gray)} ${isFill ? "g" : "G"}`;
37957  }
37958  return Array.from(color, c => (0, _core_utils.numberToString)(c / 255)).join(" ") + ` ${isFill ? "rg" : "RG"}`;
37959}
37960function createDefaultAppearance({
37961  fontSize,
37962  fontName,
37963  fontColor
37964}) {
37965  return `/${(0, _core_utils.escapePDFName)(fontName)} ${fontSize} Tf ${getPdfColor(fontColor, true)}`;
37966}
37967class FakeUnicodeFont {
37968  constructor(xref, fontFamily) {
37969    this.xref = xref;
37970    this.widths = null;
37971    this.firstChar = Infinity;
37972    this.lastChar = -Infinity;
37973    this.fontFamily = fontFamily;
37974    const canvas = new OffscreenCanvas(1, 1);
37975    this.ctxMeasure = canvas.getContext("2d");
37976    if (!FakeUnicodeFont._fontNameId) {
37977      FakeUnicodeFont._fontNameId = 1;
37978    }
37979    this.fontName = _primitives.Name.get(`InvalidPDFjsFont_${fontFamily}_${FakeUnicodeFont._fontNameId++}`);
37980  }
37981  get toUnicodeRef() {
37982    if (!FakeUnicodeFont._toUnicodeRef) {
37983      const toUnicode = `/CIDInit /ProcSet findresource begin
3798412 dict begin
37985begincmap
37986/CIDSystemInfo
37987<< /Registry (Adobe)
37988/Ordering (UCS) /Supplement 0 >> def
37989/CMapName /Adobe-Identity-UCS def
37990/CMapType 2 def
379911 begincodespacerange
37992<0000> <FFFF>
37993endcodespacerange
379941 beginbfrange
37995<0000> <FFFF> <0000>
37996endbfrange
37997endcmap CMapName currentdict /CMap defineresource pop end end`;
37998      const toUnicodeStream = FakeUnicodeFont.toUnicodeStream = new _stream.StringStream(toUnicode);
37999      const toUnicodeDict = new _primitives.Dict(this.xref);
38000      toUnicodeStream.dict = toUnicodeDict;
38001      toUnicodeDict.set("Length", toUnicode.length);
38002      FakeUnicodeFont._toUnicodeRef = this.xref.getNewPersistentRef(toUnicodeStream);
38003    }
38004    return FakeUnicodeFont._toUnicodeRef;
38005  }
38006  get fontDescriptorRef() {
38007    if (!FakeUnicodeFont._fontDescriptorRef) {
38008      const fontDescriptor = new _primitives.Dict(this.xref);
38009      fontDescriptor.set("Type", _primitives.Name.get("FontDescriptor"));
38010      fontDescriptor.set("FontName", this.fontName);
38011      fontDescriptor.set("FontFamily", "MyriadPro Regular");
38012      fontDescriptor.set("FontBBox", [0, 0, 0, 0]);
38013      fontDescriptor.set("FontStretch", _primitives.Name.get("Normal"));
38014      fontDescriptor.set("FontWeight", 400);
38015      fontDescriptor.set("ItalicAngle", 0);
38016      FakeUnicodeFont._fontDescriptorRef = this.xref.getNewPersistentRef(fontDescriptor);
38017    }
38018    return FakeUnicodeFont._fontDescriptorRef;
38019  }
38020  get descendantFontRef() {
38021    const descendantFont = new _primitives.Dict(this.xref);
38022    descendantFont.set("BaseFont", this.fontName);
38023    descendantFont.set("Type", _primitives.Name.get("Font"));
38024    descendantFont.set("Subtype", _primitives.Name.get("CIDFontType0"));
38025    descendantFont.set("CIDToGIDMap", _primitives.Name.get("Identity"));
38026    descendantFont.set("FirstChar", this.firstChar);
38027    descendantFont.set("LastChar", this.lastChar);
38028    descendantFont.set("FontDescriptor", this.fontDescriptorRef);
38029    descendantFont.set("DW", 1000);
38030    const widths = [];
38031    const chars = [...this.widths.entries()].sort();
vendor: 8,589 bytes, lines 38032-38267
38032    let currentChar = null;
38033    let currentWidths = null;
38034    for (const [char, width] of chars) {
38035      if (!currentChar) {
38036        currentChar = char;
38037        currentWidths = [width];
38038        continue;
38039      }
38040      if (char === currentChar + currentWidths.length) {
38041        currentWidths.push(width);
38042      } else {
38043        widths.push(currentChar, currentWidths);
38044        currentChar = char;
38045        currentWidths = [width];
38046      }
38047    }
38048    if (currentChar) {
38049      widths.push(currentChar, currentWidths);
38050    }
38051    descendantFont.set("W", widths);
38052    const cidSystemInfo = new _primitives.Dict(this.xref);
38053    cidSystemInfo.set("Ordering", "Identity");
38054    cidSystemInfo.set("Registry", "Adobe");
38055    cidSystemInfo.set("Supplement", 0);
38056    descendantFont.set("CIDSystemInfo", cidSystemInfo);
38057    return this.xref.getNewPersistentRef(descendantFont);
38058  }
38059  get baseFontRef() {
38060    const baseFont = new _primitives.Dict(this.xref);
38061    baseFont.set("BaseFont", this.fontName);
38062    baseFont.set("Type", _primitives.Name.get("Font"));
38063    baseFont.set("Subtype", _primitives.Name.get("Type0"));
38064    baseFont.set("Encoding", _primitives.Name.get("Identity-H"));
38065    baseFont.set("DescendantFonts", [this.descendantFontRef]);
38066    baseFont.set("ToUnicode", this.toUnicodeRef);
38067    return this.xref.getNewPersistentRef(baseFont);
38068  }
38069  get resources() {
38070    const resources = new _primitives.Dict(this.xref);
38071    const font = new _primitives.Dict(this.xref);
38072    font.set(this.fontName.name, this.baseFontRef);
38073    resources.set("Font", font);
38074    return resources;
38075  }
38076  _createContext() {
38077    this.widths = new Map();
38078    this.ctxMeasure.font = `1000px ${this.fontFamily}`;
38079    return this.ctxMeasure;
38080  }
38081  createFontResources(text) {
38082    const ctx = this._createContext();
38083    for (const line of text.split(/\r\n?|\n/)) {
38084      for (const char of line.split("")) {
38085        const code = char.charCodeAt(0);
38086        if (this.widths.has(code)) {
38087          continue;
38088        }
38089        const metrics = ctx.measureText(char);
38090        const width = Math.ceil(metrics.width);
38091        this.widths.set(code, width);
38092        this.firstChar = Math.min(code, this.firstChar);
38093        this.lastChar = Math.max(code, this.lastChar);
38094      }
38095    }
38096    return this.resources;
38097  }
38098  createAppearance(text, rect, rotation, fontSize, bgColor, strokeAlpha) {
38099    const ctx = this._createContext();
38100    const lines = [];
38101    let maxWidth = -Infinity;
38102    for (const line of text.split(/\r\n?|\n/)) {
38103      lines.push(line);
38104      const lineWidth = ctx.measureText(line).width;
38105      maxWidth = Math.max(maxWidth, lineWidth);
38106      for (const char of line.split("")) {
38107        const code = char.charCodeAt(0);
38108        let width = this.widths.get(code);
38109        if (width === undefined) {
38110          const metrics = ctx.measureText(char);
38111          width = Math.ceil(metrics.width);
38112          this.widths.set(code, width);
38113          this.firstChar = Math.min(code, this.firstChar);
38114          this.lastChar = Math.max(code, this.lastChar);
38115        }
38116      }
38117    }
38118    maxWidth *= fontSize / 1000;
38119    const [x1, y1, x2, y2] = rect;
38120    let w = x2 - x1;
38121    let h = y2 - y1;
38122    if (rotation % 180 !== 0) {
38123      [w, h] = [h, w];
38124    }
38125    let hscale = 1;
38126    if (maxWidth > w) {
38127      hscale = w / maxWidth;
38128    }
38129    let vscale = 1;
38130    const lineHeight = _util.LINE_FACTOR * fontSize;
38131    const lineDescent = _util.LINE_DESCENT_FACTOR * fontSize;
38132    const maxHeight = lineHeight * lines.length;
38133    if (maxHeight > h) {
38134      vscale = h / maxHeight;
38135    }
38136    const fscale = Math.min(hscale, vscale);
38137    const newFontSize = fontSize * fscale;
38138    const buffer = ["q", `0 0 ${(0, _core_utils.numberToString)(w)} ${(0, _core_utils.numberToString)(h)} re W n`, `BT`, `1 0 0 1 0 ${(0, _core_utils.numberToString)(h + lineDescent)} Tm 0 Tc ${getPdfColor(bgColor, true)}`, `/${this.fontName.name} ${(0, _core_utils.numberToString)(newFontSize)} Tf`];
38139    const {
38140      resources
38141    } = this;
38142    strokeAlpha = typeof strokeAlpha === "number" && strokeAlpha >= 0 && strokeAlpha <= 1 ? strokeAlpha : 1;
38143    if (strokeAlpha !== 1) {
38144      buffer.push("/R0 gs");
38145      const extGState = new _primitives.Dict(this.xref);
38146      const r0 = new _primitives.Dict(this.xref);
38147      r0.set("ca", strokeAlpha);
38148      r0.set("CA", strokeAlpha);
38149      r0.set("Type", _primitives.Name.get("ExtGState"));
38150      extGState.set("R0", r0);
38151      resources.set("ExtGState", extGState);
38152    }
38153    const vShift = (0, _core_utils.numberToString)(lineHeight);
38154    for (const line of lines) {
38155      buffer.push(`0 -${vShift} Td <${(0, _core_utils.stringToUTF16HexString)(line)}> Tj`);
38156    }
38157    buffer.push("ET", "Q");
38158    const appearance = buffer.join("\n");
38159    const appearanceStreamDict = new _primitives.Dict(this.xref);
38160    appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
38161    appearanceStreamDict.set("Type", _primitives.Name.get("XObject"));
38162    appearanceStreamDict.set("BBox", [0, 0, w, h]);
38163    appearanceStreamDict.set("Length", appearance.length);
38164    appearanceStreamDict.set("Resources", resources);
38165    if (rotation) {
38166      const matrix = (0, _core_utils.getRotationMatrix)(rotation, w, h);
38167      appearanceStreamDict.set("Matrix", matrix);
38168    }
38169    const ap = new _stream.StringStream(appearance);
38170    ap.dict = appearanceStreamDict;
38171    return ap;
38172  }
38173}
38174exports.FakeUnicodeFont = FakeUnicodeFont;
38175
38176/***/ }),
38177/* 12 */
38178/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
38179
38180
38181
38182Object.defineProperty(exports, "__esModule", ({
38183  value: true
38184}));
38185exports.ColorSpace = void 0;
38186var _util = __w_pdfjs_require__(2);
38187var _primitives = __w_pdfjs_require__(4);
38188var _base_stream = __w_pdfjs_require__(5);
38189var _core_utils = __w_pdfjs_require__(3);
38190function resizeRgbImage(src, dest, w1, h1, w2, h2, alpha01) {
38191  const COMPONENTS = 3;
38192  alpha01 = alpha01 !== 1 ? 0 : alpha01;
38193  const xRatio = w1 / w2;
38194  const yRatio = h1 / h2;
38195  let newIndex = 0,
38196    oldIndex;
38197  const xScaled = new Uint16Array(w2);
38198  const w1Scanline = w1 * COMPONENTS;
38199  for (let i = 0; i < w2; i++) {
38200    xScaled[i] = Math.floor(i * xRatio) * COMPONENTS;
38201  }
38202  for (let i = 0; i < h2; i++) {
38203    const py = Math.floor(i * yRatio) * w1Scanline;
38204    for (let j = 0; j < w2; j++) {
38205      oldIndex = py + xScaled[j];
38206      dest[newIndex++] = src[oldIndex++];
38207      dest[newIndex++] = src[oldIndex++];
38208      dest[newIndex++] = src[oldIndex++];
38209      newIndex += alpha01;
38210    }
38211  }
38212}
38213class ColorSpace {
38214  constructor(name, numComps) {
38215    if (this.constructor === ColorSpace) {
38216      (0, _util.unreachable)("Cannot initialize ColorSpace.");
38217    }
38218    this.name = name;
38219    this.numComps = numComps;
38220  }
38221  getRgb(src, srcOffset) {
38222    const rgb = new Uint8ClampedArray(3);
38223    this.getRgbItem(src, srcOffset, rgb, 0);
38224    return rgb;
38225  }
38226  getRgbItem(src, srcOffset, dest, destOffset) {
38227    (0, _util.unreachable)("Should not call ColorSpace.getRgbItem");
38228  }
38229  getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
38230    (0, _util.unreachable)("Should not call ColorSpace.getRgbBuffer");
38231  }
38232  getOutputLength(inputLength, alpha01) {
38233    (0, _util.unreachable)("Should not call ColorSpace.getOutputLength");
38234  }
38235  isPassthrough(bits) {
38236    return false;
38237  }
38238  isDefaultDecode(decodeMap, bpc) {
38239    return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
38240  }
38241  fillRgb(dest, originalWidth, originalHeight, width, height, actualHeight, bpc, comps, alpha01) {
38242    const count = originalWidth * originalHeight;
38243    let rgbBuf = null;
38244    const numComponentColors = 1 << bpc;
38245    const needsResizing = originalHeight !== height || originalWidth !== width;
38246    if (this.isPassthrough(bpc)) {
38247      rgbBuf = comps;
38248    } else if (this.numComps === 1 && count > numComponentColors && this.name !== "DeviceGray" && this.name !== "DeviceRGB") {
38249      const allColors = bpc <= 8 ? new Uint8Array(numComponentColors) : new Uint16Array(numComponentColors);
38250      for (let i = 0; i < numComponentColors; i++) {
38251        allColors[i] = i;
38252      }
38253      const colorMap = new Uint8ClampedArray(numComponentColors * 3);
38254      this.getRgbBuffer(allColors, 0, numComponentColors, colorMap, 0, bpc, 0);
38255      if (!needsResizing) {
38256        let destPos = 0;
38257        for (let i = 0; i < count; ++i) {
38258          const key = comps[i] * 3;
38259          dest[destPos++] = colorMap[key];
38260          dest[destPos++] = colorMap[key + 1];
38261          dest[destPos++] = colorMap[key + 2];
38262          destPos += alpha01;
38263        }
38264      } else {
38265        rgbBuf = new Uint8Array(count * 3);
38266        let rgbPos = 0;
38267        for (let i = 0; i < count; ++i) {
38268          const key = comps[i] * 3;
38269          rgbBuf[rgbPos++] = colorMap[key];
38270          rgbBuf[rgbPos++] = colorMap[key + 1];
38271          rgbBuf[rgbPos++] = colorMap[key + 2];
38272        }
38273      }
38274    } else if (!needsResizing) {
38275      this.getRgbBuffer(comps, 0, width * actualHeight, dest, 0, bpc, alpha01);
38276    } else {
38277      rgbBuf = new Uint8ClampedArray(count * 3);
38278      this.getRgbBuffer(comps, 0, count, rgbBuf, 0, bpc, 0);
vendor: 13,105 bytes, lines 38278-38670
38278
38279    }
38280    if (rgbBuf) {
38281      if (needsResizing) {
38282        resizeRgbImage(rgbBuf, dest, originalWidth, originalHeight, width, height, alpha01);
38283      } else {
38284        let destPos = 0,
38285          rgbPos = 0;
38286        for (let i = 0, ii = width * actualHeight; i < ii; i++) {
38287          dest[destPos++] = rgbBuf[rgbPos++];
38288          dest[destPos++] = rgbBuf[rgbPos++];
38289          dest[destPos++] = rgbBuf[rgbPos++];
38290          destPos += alpha01;
38291        }
38292      }
38293    }
38294  }
38295  get usesZeroToOneRange() {
38296    return (0, _util.shadow)(this, "usesZeroToOneRange", true);
38297  }
38298  static _cache(cacheKey, xref, localColorSpaceCache, parsedColorSpace) {
38299    if (!localColorSpaceCache) {
38300      throw new Error('ColorSpace._cache - expected "localColorSpaceCache" argument.');
38301    }
38302    if (!parsedColorSpace) {
38303      throw new Error('ColorSpace._cache - expected "parsedColorSpace" argument.');
38304    }
38305    let csName, csRef;
38306    if (cacheKey instanceof _primitives.Ref) {
38307      csRef = cacheKey;
38308      cacheKey = xref.fetch(cacheKey);
38309    }
38310    if (cacheKey instanceof _primitives.Name) {
38311      csName = cacheKey.name;
38312    }
38313    if (csName || csRef) {
38314      localColorSpaceCache.set(csName, csRef, parsedColorSpace);
38315    }
38316  }
38317  static getCached(cacheKey, xref, localColorSpaceCache) {
38318    if (!localColorSpaceCache) {
38319      throw new Error('ColorSpace.getCached - expected "localColorSpaceCache" argument.');
38320    }
38321    if (cacheKey instanceof _primitives.Ref) {
38322      const localColorSpace = localColorSpaceCache.getByRef(cacheKey);
38323      if (localColorSpace) {
38324        return localColorSpace;
38325      }
38326      try {
38327        cacheKey = xref.fetch(cacheKey);
38328      } catch (ex) {
38329        if (ex instanceof _core_utils.MissingDataException) {
38330          throw ex;
38331        }
38332      }
38333    }
38334    if (cacheKey instanceof _primitives.Name) {
38335      const localColorSpace = localColorSpaceCache.getByName(cacheKey.name);
38336      if (localColorSpace) {
38337        return localColorSpace;
38338      }
38339    }
38340    return null;
38341  }
38342  static async parseAsync({
38343    cs,
38344    xref,
38345    resources = null,
38346    pdfFunctionFactory,
38347    localColorSpaceCache
38348  }) {
38349    const parsedColorSpace = this._parse(cs, xref, resources, pdfFunctionFactory);
38350    this._cache(cs, xref, localColorSpaceCache, parsedColorSpace);
38351    return parsedColorSpace;
38352  }
38353  static parse({
38354    cs,
38355    xref,
38356    resources = null,
38357    pdfFunctionFactory,
38358    localColorSpaceCache
38359  }) {
38360    const cachedColorSpace = this.getCached(cs, xref, localColorSpaceCache);
38361    if (cachedColorSpace) {
38362      return cachedColorSpace;
38363    }
38364    const parsedColorSpace = this._parse(cs, xref, resources, pdfFunctionFactory);
38365    this._cache(cs, xref, localColorSpaceCache, parsedColorSpace);
38366    return parsedColorSpace;
38367  }
38368  static _parse(cs, xref, resources = null, pdfFunctionFactory) {
38369    cs = xref.fetchIfRef(cs);
38370    if (cs instanceof _primitives.Name) {
38371      switch (cs.name) {
38372        case "G":
38373        case "DeviceGray":
38374          return this.singletons.gray;
38375        case "RGB":
38376        case "DeviceRGB":
38377          return this.singletons.rgb;
38378        case "CMYK":
38379        case "DeviceCMYK":
38380          return this.singletons.cmyk;
38381        case "Pattern":
38382          return new PatternCS(null);
38383        default:
38384          if (resources instanceof _primitives.Dict) {
38385            const colorSpaces = resources.get("ColorSpace");
38386            if (colorSpaces instanceof _primitives.Dict) {
38387              const resourcesCS = colorSpaces.get(cs.name);
38388              if (resourcesCS) {
38389                if (resourcesCS instanceof _primitives.Name) {
38390                  return this._parse(resourcesCS, xref, resources, pdfFunctionFactory);
38391                }
38392                cs = resourcesCS;
38393                break;
38394              }
38395            }
38396          }
38397          throw new _util.FormatError(`Unrecognized ColorSpace: ${cs.name}`);
38398      }
38399    }
38400    if (Array.isArray(cs)) {
38401      const mode = xref.fetchIfRef(cs[0]).name;
38402      let params, numComps, baseCS, whitePoint, blackPoint, gamma;
38403      switch (mode) {
38404        case "G":
38405        case "DeviceGray":
38406          return this.singletons.gray;
38407        case "RGB":
38408        case "DeviceRGB":
38409          return this.singletons.rgb;
38410        case "CMYK":
38411        case "DeviceCMYK":
38412          return this.singletons.cmyk;
38413        case "CalGray":
38414          params = xref.fetchIfRef(cs[1]);
38415          whitePoint = params.getArray("WhitePoint");
38416          blackPoint = params.getArray("BlackPoint");
38417          gamma = params.get("Gamma");
38418          return new CalGrayCS(whitePoint, blackPoint, gamma);
38419        case "CalRGB":
38420          params = xref.fetchIfRef(cs[1]);
38421          whitePoint = params.getArray("WhitePoint");
38422          blackPoint = params.getArray("BlackPoint");
38423          gamma = params.getArray("Gamma");
38424          const matrix = params.getArray("Matrix");
38425          return new CalRGBCS(whitePoint, blackPoint, gamma, matrix);
38426        case "ICCBased":
38427          const stream = xref.fetchIfRef(cs[1]);
38428          const dict = stream.dict;
38429          numComps = dict.get("N");
38430          const alt = dict.get("Alternate");
38431          if (alt) {
38432            const altCS = this._parse(alt, xref, resources, pdfFunctionFactory);
38433            if (altCS.numComps === numComps) {
38434              return altCS;
38435            }
38436            (0, _util.warn)("ICCBased color space: Ignoring incorrect /Alternate entry.");
38437          }
38438          if (numComps === 1) {
38439            return this.singletons.gray;
38440          } else if (numComps === 3) {
38441            return this.singletons.rgb;
38442          } else if (numComps === 4) {
38443            return this.singletons.cmyk;
38444          }
38445          break;
38446        case "Pattern":
38447          baseCS = cs[1] || null;
38448          if (baseCS) {
38449            baseCS = this._parse(baseCS, xref, resources, pdfFunctionFactory);
38450          }
38451          return new PatternCS(baseCS);
38452        case "I":
38453        case "Indexed":
38454          baseCS = this._parse(cs[1], xref, resources, pdfFunctionFactory);
38455          const hiVal = xref.fetchIfRef(cs[2]) + 1;
38456          const lookup = xref.fetchIfRef(cs[3]);
38457          return new IndexedCS(baseCS, hiVal, lookup);
38458        case "Separation":
38459        case "DeviceN":
38460          const name = xref.fetchIfRef(cs[1]);
38461          numComps = Array.isArray(name) ? name.length : 1;
38462          baseCS = this._parse(cs[2], xref, resources, pdfFunctionFactory);
38463          const tintFn = pdfFunctionFactory.create(cs[3]);
38464          return new AlternateCS(numComps, baseCS, tintFn);
38465        case "Lab":
38466          params = xref.fetchIfRef(cs[1]);
38467          whitePoint = params.getArray("WhitePoint");
38468          blackPoint = params.getArray("BlackPoint");
38469          const range = params.getArray("Range");
38470          return new LabCS(whitePoint, blackPoint, range);
38471        default:
38472          throw new _util.FormatError(`Unimplemented ColorSpace object: ${mode}`);
38473      }
38474    }
38475    throw new _util.FormatError(`Unrecognized ColorSpace object: ${cs}`);
38476  }
38477  static isDefaultDecode(decode, numComps) {
38478    if (!Array.isArray(decode)) {
38479      return true;
38480    }
38481    if (numComps * 2 !== decode.length) {
38482      (0, _util.warn)("The decode map is not the correct length");
38483      return true;
38484    }
38485    for (let i = 0, ii = decode.length; i < ii; i += 2) {
38486      if (decode[i] !== 0 || decode[i + 1] !== 1) {
38487        return false;
38488      }
38489    }
38490    return true;
38491  }
38492  static get singletons() {
38493    return (0, _util.shadow)(this, "singletons", {
38494      get gray() {
38495        return (0, _util.shadow)(this, "gray", new DeviceGrayCS());
38496      },
38497      get rgb() {
38498        return (0, _util.shadow)(this, "rgb", new DeviceRgbCS());
38499      },
38500      get cmyk() {
38501        return (0, _util.shadow)(this, "cmyk", new DeviceCmykCS());
38502      }
38503    });
38504  }
38505}
38506exports.ColorSpace = ColorSpace;
38507class AlternateCS extends ColorSpace {
38508  constructor(numComps, base, tintFn) {
38509    super("Alternate", numComps);
38510    this.base = base;
38511    this.tintFn = tintFn;
38512    this.tmpBuf = new Float32Array(base.numComps);
38513  }
38514  getRgbItem(src, srcOffset, dest, destOffset) {
38515    const tmpBuf = this.tmpBuf;
38516    this.tintFn(src, srcOffset, tmpBuf, 0);
38517    this.base.getRgbItem(tmpBuf, 0, dest, destOffset);
38518  }
38519  getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
38520    const tintFn = this.tintFn;
38521    const base = this.base;
38522    const scale = 1 / ((1 << bits) - 1);
38523    const baseNumComps = base.numComps;
38524    const usesZeroToOneRange = base.usesZeroToOneRange;
38525    const isPassthrough = (base.isPassthrough(8) || !usesZeroToOneRange) && alpha01 === 0;
38526    let pos = isPassthrough ? destOffset : 0;
38527    const baseBuf = isPassthrough ? dest : new Uint8ClampedArray(baseNumComps * count);
38528    const numComps = this.numComps;
38529    const scaled = new Float32Array(numComps);
38530    const tinted = new Float32Array(baseNumComps);
38531    let i, j;
38532    for (i = 0; i < count; i++) {
38533      for (j = 0; j < numComps; j++) {
38534        scaled[j] = src[srcOffset++] * scale;
38535      }
38536      tintFn(scaled, 0, tinted, 0);
38537      if (usesZeroToOneRange) {
38538        for (j = 0; j < baseNumComps; j++) {
38539          baseBuf[pos++] = tinted[j] * 255;
38540        }
38541      } else {
38542        base.getRgbItem(tinted, 0, baseBuf, pos);
38543        pos += baseNumComps;
38544      }
38545    }
38546    if (!isPassthrough) {
38547      base.getRgbBuffer(baseBuf, 0, count, dest, destOffset, 8, alpha01);
38548    }
38549  }
38550  getOutputLength(inputLength, alpha01) {
38551    return this.base.getOutputLength(inputLength * this.base.numComps / this.numComps, alpha01);
38552  }
38553}
38554class PatternCS extends ColorSpace {
38555  constructor(baseCS) {
38556    super("Pattern", null);
38557    this.base = baseCS;
38558  }
38559  isDefaultDecode(decodeMap, bpc) {
38560    (0, _util.unreachable)("Should not call PatternCS.isDefaultDecode");
38561  }
38562}
38563class IndexedCS extends ColorSpace {
38564  constructor(base, highVal, lookup) {
38565    super("Indexed", 1);
38566    this.base = base;
38567    this.highVal = highVal;
38568    const length = base.numComps * highVal;
38569    this.lookup = new Uint8Array(length);
38570    if (lookup instanceof _base_stream.BaseStream) {
38571      const bytes = lookup.getBytes(length);
38572      this.lookup.set(bytes);
38573    } else if (typeof lookup === "string") {
38574      for (let i = 0; i < length; ++i) {
38575        this.lookup[i] = lookup.charCodeAt(i) & 0xff;
38576      }
38577    } else {
38578      throw new _util.FormatError(`IndexedCS - unrecognized lookup table: ${lookup}`);
38579    }
38580  }
38581  getRgbItem(src, srcOffset, dest, destOffset) {
38582    const numComps = this.base.numComps;
38583    const start = src[srcOffset] * numComps;
38584    this.base.getRgbBuffer(this.lookup, start, 1, dest, destOffset, 8, 0);
38585  }
38586  getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
38587    const base = this.base;
38588    const numComps = base.numComps;
38589    const outputDelta = base.getOutputLength(numComps, alpha01);
38590    const lookup = this.lookup;
38591    for (let i = 0; i < count; ++i) {
38592      const lookupPos = src[srcOffset++] * numComps;
38593      base.getRgbBuffer(lookup, lookupPos, 1, dest, destOffset, 8, alpha01);
38594      destOffset += outputDelta;
38595    }
38596  }
38597  getOutputLength(inputLength, alpha01) {
38598    return this.base.getOutputLength(inputLength * this.base.numComps, alpha01);
38599  }
38600  isDefaultDecode(decodeMap, bpc) {
38601    if (!Array.isArray(decodeMap)) {
38602      return true;
38603    }
38604    if (decodeMap.length !== 2) {
38605      (0, _util.warn)("Decode map length is not correct");
38606      return true;
38607    }
38608    if (!Number.isInteger(bpc) || bpc < 1) {
38609      (0, _util.warn)("Bits per component is not correct");
38610      return true;
38611    }
38612    return decodeMap[0] === 0 && decodeMap[1] === (1 << bpc) - 1;
38613  }
38614}
38615class DeviceGrayCS extends ColorSpace {
38616  constructor() {
38617    super("DeviceGray", 1);
38618  }
38619  getRgbItem(src, srcOffset, dest, destOffset) {
38620    const c = src[srcOffset] * 255;
38621    dest[destOffset] = dest[destOffset + 1] = dest[destOffset + 2] = c;
38622  }
38623  getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
38624    const scale = 255 / ((1 << bits) - 1);
38625    let j = srcOffset,
38626      q = destOffset;
38627    for (let i = 0; i < count; ++i) {
38628      const c = scale * src[j++];
38629      dest[q++] = c;
38630      dest[q++] = c;
38631      dest[q++] = c;
38632      q += alpha01;
38633    }
38634  }
38635  getOutputLength(inputLength, alpha01) {
38636    return inputLength * (3 + alpha01);
38637  }
38638}
38639class DeviceRgbCS extends ColorSpace {
38640  constructor() {
38641    super("DeviceRGB", 3);
38642  }
38643  getRgbItem(src, srcOffset, dest, destOffset) {
38644    dest[destOffset] = src[srcOffset] * 255;
38645    dest[destOffset + 1] = src[srcOffset + 1] * 255;
38646    dest[destOffset + 2] = src[srcOffset + 2] * 255;
38647  }
38648  getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
38649    if (bits === 8 && alpha01 === 0) {
38650      dest.set(src.subarray(srcOffset, srcOffset + count * 3), destOffset);
38651      return;
38652    }
38653    const scale = 255 / ((1 << bits) - 1);
38654    let j = srcOffset,
38655      q = destOffset;
38656    for (let i = 0; i < count; ++i) {
38657      dest[q++] = scale * src[j++];
38658      dest[q++] = scale * src[j++];
38659      dest[q++] = scale * src[j++];
38660      q += alpha01;
38661    }
38662  }
38663  getOutputLength(inputLength, alpha01) {
38664    return inputLength * (3 + alpha01) / 3 | 0;
38665  }
38666  isPassthrough(bits) {
38667    return bits === 8;
38668  }
38669}
38670c
vendor: 1,821 bytes, lines 38670-38690
38670lass DeviceCmykCS extends ColorSpace {
38671  constructor() {
38672    super("DeviceCMYK", 4);
38673  }
38674  #toRgb(src, srcOffset, srcScale, dest, destOffset) {
38675    const c = src[srcOffset] * srcScale;
38676    const m = src[srcOffset + 1] * srcScale;
38677    const y = src[srcOffset + 2] * srcScale;
38678    const k = src[srcOffset + 3] * srcScale;
38679    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);
38680    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);
38681    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);
38682  }
38683  getRgbItem(src, srcOffset, dest, destOffset) {
38684    this.#toRgb(src, srcOffset, 1, dest, destOffset);
38685  }
38686  getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
38687    const scale = 1 / ((1 << bits) - 1);
38688    for (let i = 0; i < count; i++) {
38689      this.#toRgb(src, srcOffset, scale, dest, destOffset);
38690      srcOffset += 4;
vendor: 9,940 bytes, lines 38691-38929
38691      destOffset += 3 + alpha01;
38692    }
38693  }
38694  getOutputLength(inputLength, alpha01) {
38695    return inputLength / 4 * (3 + alpha01) | 0;
38696  }
38697}
38698class CalGrayCS extends ColorSpace {
38699  constructor(whitePoint, blackPoint, gamma) {
38700    super("CalGray", 1);
38701    if (!whitePoint) {
38702      throw new _util.FormatError("WhitePoint missing - required for color space CalGray");
38703    }
38704    [this.XW, this.YW, this.ZW] = whitePoint;
38705    [this.XB, this.YB, this.ZB] = blackPoint || [0, 0, 0];
38706    this.G = gamma || 1;
38707    if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
38708      throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}, no fallback available`);
38709    }
38710    if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
38711      (0, _util.info)(`Invalid BlackPoint for ${this.name}, falling back to default.`);
38712      this.XB = this.YB = this.ZB = 0;
38713    }
38714    if (this.XB !== 0 || this.YB !== 0 || this.ZB !== 0) {
38715      (0, _util.warn)(`${this.name}, BlackPoint: XB: ${this.XB}, YB: ${this.YB}, ` + `ZB: ${this.ZB}, only default values are supported.`);
38716    }
38717    if (this.G < 1) {
38718      (0, _util.info)(`Invalid Gamma: ${this.G} for ${this.name}, falling back to default.`);
38719      this.G = 1;
38720    }
38721  }
38722  #toRgb(src, srcOffset, dest, destOffset, scale) {
38723    const A = src[srcOffset] * scale;
38724    const AG = A ** this.G;
38725    const L = this.YW * AG;
38726    const val = Math.max(295.8 * L ** 0.3333333333333333 - 40.8, 0);
38727    dest[destOffset] = val;
38728    dest[destOffset + 1] = val;
38729    dest[destOffset + 2] = val;
38730  }
38731  getRgbItem(src, srcOffset, dest, destOffset) {
38732    this.#toRgb(src, srcOffset, dest, destOffset, 1);
38733  }
38734  getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
38735    const scale = 1 / ((1 << bits) - 1);
38736    for (let i = 0; i < count; ++i) {
38737      this.#toRgb(src, srcOffset, dest, destOffset, scale);
38738      srcOffset += 1;
38739      destOffset += 3 + alpha01;
38740    }
38741  }
38742  getOutputLength(inputLength, alpha01) {
38743    return inputLength * (3 + alpha01);
38744  }
38745}
38746class CalRGBCS extends ColorSpace {
38747  static #BRADFORD_SCALE_MATRIX = new Float32Array([0.8951, 0.2664, -0.1614, -0.7502, 1.7135, 0.0367, 0.0389, -0.0685, 1.0296]);
38748  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]);
38749  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]);
38750  static #FLAT_WHITEPOINT_MATRIX = new Float32Array([1, 1, 1]);
38751  static #tempNormalizeMatrix = new Float32Array(3);
38752  static #tempConvertMatrix1 = new Float32Array(3);
38753  static #tempConvertMatrix2 = new Float32Array(3);
38754  static #DECODE_L_CONSTANT = ((8 + 16) / 116) ** 3 / 8.0;
38755  constructor(whitePoint, blackPoint, gamma, matrix) {
38756    super("CalRGB", 3);
38757    if (!whitePoint) {
38758      throw new _util.FormatError("WhitePoint missing - required for color space CalRGB");
38759    }
38760    const [XW, YW, ZW] = this.whitePoint = whitePoint;
38761    const [XB, YB, ZB] = this.blackPoint = blackPoint || new Float32Array(3);
38762    [this.GR, this.GG, this.GB] = gamma || new Float32Array([1, 1, 1]);
38763    [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]);
38764    if (XW < 0 || ZW < 0 || YW !== 1) {
38765      throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}, no fallback available`);
38766    }
38767    if (XB < 0 || YB < 0 || ZB < 0) {
38768      (0, _util.info)(`Invalid BlackPoint for ${this.name} [${XB}, ${YB}, ${ZB}], ` + "falling back to default.");
38769      this.blackPoint = new Float32Array(3);
38770    }
38771    if (this.GR < 0 || this.GG < 0 || this.GB < 0) {
38772      (0, _util.info)(`Invalid Gamma [${this.GR}, ${this.GG}, ${this.GB}] for ` + `${this.name}, falling back to default.`);
38773      this.GR = this.GG = this.GB = 1;
38774    }
38775  }
38776  #matrixProduct(a, b, result) {
38777    result[0] = a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
38778    result[1] = a[3] * b[0] + a[4] * b[1] + a[5] * b[2];
38779    result[2] = a[6] * b[0] + a[7] * b[1] + a[8] * b[2];
38780  }
38781  #toFlat(sourceWhitePoint, LMS, result) {
38782    result[0] = LMS[0] * 1 / sourceWhitePoint[0];
38783    result[1] = LMS[1] * 1 / sourceWhitePoint[1];
38784    result[2] = LMS[2] * 1 / sourceWhitePoint[2];
38785  }
38786  #toD65(sourceWhitePoint, LMS, result) {
38787    const D65X = 0.95047;
38788    const D65Y = 1;
38789    const D65Z = 1.08883;
38790    result[0] = LMS[0] * D65X / sourceWhitePoint[0];
38791    result[1] = LMS[1] * D65Y / sourceWhitePoint[1];
38792    result[2] = LMS[2] * D65Z / sourceWhitePoint[2];
38793  }
38794  #sRGBTransferFunction(color) {
38795    if (color <= 0.0031308) {
38796      return this.#adjustToRange(0, 1, 12.92 * color);
38797    }
38798    if (color >= 0.99554525) {
38799      return 1;
38800    }
38801    return this.#adjustToRange(0, 1, (1 + 0.055) * color ** (1 / 2.4) - 0.055);
38802  }
38803  #adjustToRange(min, max, value) {
38804    return Math.max(min, Math.min(max, value));
38805  }
38806  #decodeL(L) {
38807    if (L < 0) {
38808      return -this.#decodeL(-L);
38809    }
38810    if (L > 8.0) {
38811      return ((L + 16) / 116) ** 3;
38812    }
38813    return L * CalRGBCS.#DECODE_L_CONSTANT;
38814  }
38815  #compensateBlackPoint(sourceBlackPoint, XYZ_Flat, result) {
38816    if (sourceBlackPoint[0] === 0 && sourceBlackPoint[1] === 0 && sourceBlackPoint[2] === 0) {
38817      result[0] = XYZ_Flat[0];
38818      result[1] = XYZ_Flat[1];
38819      result[2] = XYZ_Flat[2];
38820      return;
38821    }
38822    const zeroDecodeL = this.#decodeL(0);
38823    const X_DST = zeroDecodeL;
38824    const X_SRC = this.#decodeL(sourceBlackPoint[0]);
38825    const Y_DST = zeroDecodeL;
38826    const Y_SRC = this.#decodeL(sourceBlackPoint[1]);
38827    const Z_DST = zeroDecodeL;
38828    const Z_SRC = this.#decodeL(sourceBlackPoint[2]);
38829    const X_Scale = (1 - X_DST) / (1 - X_SRC);
38830    const X_Offset = 1 - X_Scale;
38831    const Y_Scale = (1 - Y_DST) / (1 - Y_SRC);
38832    const Y_Offset = 1 - Y_Scale;
38833    const Z_Scale = (1 - Z_DST) / (1 - Z_SRC);
38834    const Z_Offset = 1 - Z_Scale;
38835    result[0] = XYZ_Flat[0] * X_Scale + X_Offset;
38836    result[1] = XYZ_Flat[1] * Y_Scale + Y_Offset;
38837    result[2] = XYZ_Flat[2] * Z_Scale + Z_Offset;
38838  }
38839  #normalizeWhitePointToFlat(sourceWhitePoint, XYZ_In, result) {
38840    if (sourceWhitePoint[0] === 1 && sourceWhitePoint[2] === 1) {
38841      result[0] = XYZ_In[0];
38842      result[1] = XYZ_In[1];
38843      result[2] = XYZ_In[2];
38844      return;
38845    }
38846    const LMS = result;
38847    this.#matrixProduct(CalRGBCS.#BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
38848    const LMS_Flat = CalRGBCS.#tempNormalizeMatrix;
38849    this.#toFlat(sourceWhitePoint, LMS, LMS_Flat);
38850    this.#matrixProduct(CalRGBCS.#BRADFORD_SCALE_INVERSE_MATRIX, LMS_Flat, result);
38851  }
38852  #normalizeWhitePointToD65(sourceWhitePoint, XYZ_In, result) {
38853    const LMS = result;
38854    this.#matrixProduct(CalRGBCS.#BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
38855    const LMS_D65 = CalRGBCS.#tempNormalizeMatrix;
38856    this.#toD65(sourceWhitePoint, LMS, LMS_D65);
38857    this.#matrixProduct(CalRGBCS.#BRADFORD_SCALE_INVERSE_MATRIX, LMS_D65, result);
38858  }
38859  #toRgb(src, srcOffset, dest, destOffset, scale) {
38860    const A = this.#adjustToRange(0, 1, src[srcOffset] * scale);
38861    const B = this.#adjustToRange(0, 1, src[srcOffset + 1] * scale);
38862    const C = this.#adjustToRange(0, 1, src[srcOffset + 2] * scale);
38863    const AGR = A === 1 ? 1 : A ** this.GR;
38864    const BGG = B === 1 ? 1 : B ** this.GG;
38865    const CGB = C === 1 ? 1 : C ** this.GB;
38866    const X = this.MXA * AGR + this.MXB * BGG + this.MXC * CGB;
38867    const Y = this.MYA * AGR + this.MYB * BGG + this.MYC * CGB;
38868    const Z = this.MZA * AGR + this.MZB * BGG + this.MZC * CGB;
38869    const XYZ = CalRGBCS.#tempConvertMatrix1;
38870    XYZ[0] = X;
38871    XYZ[1] = Y;
38872    XYZ[2] = Z;
38873    const XYZ_Flat = CalRGBCS.#tempConvertMatrix2;
38874    this.#normalizeWhitePointToFlat(this.whitePoint, XYZ, XYZ_Flat);
38875    const XYZ_Black = CalRGBCS.#tempConvertMatrix1;
38876    this.#compensateBlackPoint(this.blackPoint, XYZ_Flat, XYZ_Black);
38877    const XYZ_D65 = CalRGBCS.#tempConvertMatrix2;
38878    this.#normalizeWhitePointToD65(CalRGBCS.#FLAT_WHITEPOINT_MATRIX, XYZ_Black, XYZ_D65);
38879    const SRGB = CalRGBCS.#tempConvertMatrix1;
38880    this.#matrixProduct(CalRGBCS.#SRGB_D65_XYZ_TO_RGB_MATRIX, XYZ_D65, SRGB);
38881    dest[destOffset] = this.#sRGBTransferFunction(SRGB[0]) * 255;
38882    dest[destOffset + 1] = this.#sRGBTransferFunction(SRGB[1]) * 255;
38883    dest[destOffset + 2] = this.#sRGBTransferFunction(SRGB[2]) * 255;
38884  }
38885  getRgbItem(src, srcOffset, dest, destOffset) {
38886    this.#toRgb(src, srcOffset, dest, destOffset, 1);
38887  }
38888  getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
38889    const scale = 1 / ((1 << bits) - 1);
38890    for (let i = 0; i < count; ++i) {
38891      this.#toRgb(src, srcOffset, dest, destOffset, scale);
38892      srcOffset += 3;
38893      destOffset += 3 + alpha01;
38894    }
38895  }
38896  getOutputLength(inputLength, alpha01) {
38897    return inputLength * (3 + alpha01) / 3 | 0;
38898  }
38899}
38900class LabCS extends ColorSpace {
38901  constructor(whitePoint, blackPoint, range) {
38902    super("Lab", 3);
38903    if (!whitePoint) {
38904      throw new _util.FormatError("WhitePoint missing - required for color space Lab");
38905    }
38906    [this.XW, this.YW, this.ZW] = whitePoint;
38907    [this.amin, this.amax, this.bmin, this.bmax] = range || [-100, 100, -100, 100];
38908    [this.XB, this.YB, this.ZB] = blackPoint || [0, 0, 0];
38909    if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
38910      throw new _util.FormatError("Invalid WhitePoint components, no fallback available");
38911    }
38912    if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
38913      (0, _util.info)("Invalid BlackPoint, falling back to default");
38914      this.XB = this.YB = this.ZB = 0;
38915    }
38916    if (this.amin > this.amax || this.bmin > this.bmax) {
38917      (0, _util.info)("Invalid Range, falling back to defaults");
38918      this.amin = -100;
38919      this.amax = 100;
38920      this.bmin = -100;
38921      this.bmax = 100;
38922    }
38923  }
38924  #fn_g(x) {
38925    return x >= 6 / 29 ? x ** 3 : 108 / 841 * (x - 4 / 29);
38926  }
38927  #decode(value, high1, low2, high2) {
38928    return low2 + value * (high2 - low2) / high1;
38929  }
38930  #toRgb(src, srcOffset, maxVal, dest, destOffset) {
38931    let Ls = src[srcOffset];
38932    let as = src[srcOffset + 1];
38933    let bs = src[srcOffset + 2];
38934    if (maxVal !== false) {
38935      Ls = this.#decode(Ls, maxVal, 0, 100);
38936      as = this.#decode(as, maxVal, this.amin, this.amax);
38937      bs = this.#decode(bs, maxVal, this.bmin, this.bmax);
38938    }
38939    if (as > this.amax) {
38940      as = this.amax;
38941    } else if (as < this.amin) {
38942      as = this.amin;
38943    }
38944    if (bs > this.bmax) {
38945      bs = this.bmax;
38946    } else if (bs < this.bmin) {
38947      bs = this.bmin;
38948    }
38949    const M = (Ls + 16) / 116;
38950    const L = M + as / 500;
38951    const N = M - bs / 200;
38952    const X = this.XW * this.#fn_g(L);
38953    const Y = this.YW * this.#fn_g(M);
38954    const Z = this.ZW * this.#fn_g(N);
38955    let r, g, b;
38956    if (this.ZW < 1) {
38957      r = X * 3.1339 + Y * -1.617 + Z * -0.4906;
38958      g = X * -0.9785 + Y * 1.916 + Z * 0.0333;
38959      b = X * 0.072 + Y * -0.229 + Z * 1.4057;
38960    } else {
38961      r = X * 3.2406 + Y * -1.5372 + Z * -0.4986;
38962      g = X * -0.9689 + Y * 1.8758 + Z * 0.0415;
38963      b = X * 0.0557 + Y * -0.204 + Z * 1.057;
38964    }
38965    dest[destOffset] = Math.sqrt(r) * 255;
38966    dest[destOffset + 1] = Math.sqrt(g) * 255;
38967    dest[destOffset + 2] = Math.sqrt(b) * 255;
38968  }
38969  getRgbItem(src, srcOffset, dest, destOffset) {
38970    this.#toRgb(src, srcOffset, false, dest, destOffset);
38971  }
38972  getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
38973    const maxVal = (1 << bits) - 1;
38974    for (let i = 0; i < count; i++) {
38975      this.#toRgb(src, srcOffset, maxVal, dest, destOffset);
38976      srcOffset += 3;
38977      destOffset += 3 + alpha01;
38978    }
38979  }
38980  getOutputLength(inputLength, alpha01) {
38981    return inputLength * (3 + alpha01) / 3 | 0;
38982  }
38983  isDefaultDecode(decodeMap, bpc) {
38984    return true;
38985  }
38986  get usesZeroToOneRange() {
38987    return (0, _util.shadow)(this, "usesZeroToOneRange", false);
38988  }
38989}
38990
38991/***/ }),
38992/* 13 */
38993/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
38994
38995
38996
38997Object.defineProperty(exports, "__esModule", ({
38998  value: true
38999}));
39000exports.PartialEvaluator = exports.EvaluatorPreprocessor = void 0;
39001var _util = __w_pdfjs_require__(2);
39002var _cmap = __w_pdfjs_require__(14);
39003var _primitives = __w_pdfjs_require__(4);
39004var _fonts = __w_pdfjs_require__(34);
39005var _encodings = __w_pdfjs_require__(37);
39006var _standard_fonts = __w_pdfjs_require__(41);
39007var _pattern = __w_pdfjs_require__(50);
39008var _xfa_fonts = __w_pdfjs_require__(51);
39009var _to_unicode_map = __w_pdfjs_require__(42);
39010var _function = __w_pdfjs_require__(57);
39011var _parser = __w_pdfjs_require__(16);
39012var _image_utils = __w_pdfjs_require__(59);
39013var _stream = __w_pdfjs_require__(8);
39014var _base_stream = __w_pdfjs_require__(5);
39015var _bidi = __w_pdfjs_require__(60);
39016var _colorspace = __w_pdfjs_require__(12);
39017var _decode_stream = __w_pdfjs_require__(18);
39018var _fonts_utils = __w_pdfjs_require__(38);
39019var _font_substitutions = __w_pdfjs_require__(61);
39020var _glyphlist = __w_pdfjs_require__(39);
39021var _metrics = __w_pdfjs_require__(45);
39022var _unicode = __w_pdfjs_require__(40);
39023var _image_resizer = __w_pdfjs_require__(62);
39024var _murmurhash = __w_pdfjs_require__(63);
39025var _operator_list = __w_pdfjs_require__(64);
39026var _image = __w_pdfjs_require__(65);
39027const DefaultPartialEvaluatorOptions = Object.freeze({
39028  maxImageSize: -1,
39029  disableFontFace: false,
39030  ignoreErrors: false,
39031  isEvalSupported: true,
39032  isOffscreenCanvasSupported: false,
39033  canvasMaxAreaInBytes: -1,
39034  fontExtraProperties: false,
39035  useSystemFonts: true,
39036  cMapUrl: null,
39037  standardFontDataUrl: null
39038});
39039const PatternType = {
39040  TILING: 1,
39041  SHADING: 2
39042};
39043const TEXT_CHUNK_BATCH_SIZE = 10;
39044const deferred = Promise.resolve();
39045function normalizeBlendMode(value, parsingArray = false) {
39046  if (Array.isArray(value)) {
39047    for (const val of value) {
39048      const maybeBM = normalizeBlendMode(val, true);
39049      if (maybeBM) {
39050        return maybeBM;
39051      }
39052    }
39053    (0, _util.warn)(`Unsupported blend mode Array: ${value}`);
39054    return "source-over";
39055  }
39056  if (!(value instanceof _primitives.Name)) {
39057    if (parsingArray) {
39058      return null;
39059    }
39060    return "source-over";
39061  }
39062  switch (value.name) {
39063    case "Normal":
39064    case "Compatible":
39065      return "source-over";
39066    case "Multiply":
39067      return "multiply";
39068    case "Screen":
39069      return "screen";
39070    case "Overlay":
39071      return "overlay";
39072    case "Darken":
39073      return "darken";
39074    case "Lighten":
39075      return "lighten";
39076    case "ColorDodge":
39077      return "color-dodge";
39078    case "ColorBurn":
39079      return "color-burn";
39080    case "HardLight":
39081      return "hard-light";
39082    case "SoftLight":
39083      return "soft-light";
39084    case "Difference":
39085      return "difference";
39086    case "Exclusion":
39087      return "exclusion";
39088    case "Hue":
39089      return "hue";
39090    case "Saturation":
39091      return "saturation";
39092    case "Color":
39093      return "color";
39094    case "Luminosity":
39095      return "luminosity";
39096  }
39097  if (parsingArray) {
39098    return null;
39099  }
39100  (0, _util.warn)(`Unsupported blend mode: ${value.name}`);
39101  return "source-over";
39102}
39103function incrementCachedImageMaskCount(data) {
39104  if (data.fn === _util.OPS.paintImageMaskXObject && data.args[0]?.count > 0) {
39105    data.args[0].count++;
39106  }
39107}
39108class TimeSlotManager {
39109  static TIME_SLOT_DURATION_MS = 20;
39110  static CHECK_TIME_EVERY = 100;
39111  constructor() {
39112    this.reset();
39113  }
39114  check() {
39115    if (++this.checked < TimeSlotManager.CHECK_TIME_EVERY) {
39116      return false;
39117    }
39118    this.checked = 0;
39119    return this.endTime <= Date.now();
39120  }
39121  reset() {
39122    this.endTime = Date.now() + TimeSlotManager.TIME_SLOT_DURATION_MS;
39123    this.checked = 0;
39124  }
39125}
39126class PartialEvaluator {
39127  constructor({
39128    xref,
39129    handler,
39130    pageIndex,
39131    idFactory,
39132    fontCache,
39133    builtInCMapCache,
39134    standardFontDataCache,
39135    globalImageCache,
39136    systemFontCache,
39137    options = null
39138  }) {
39139    this.xref = xref;
39140    this.handler = handler;
39141    this.pageIndex = pageIndex;
39142    this.idFactory = idFactory;
39143    this.fontCache = fontCache;
39144    this.builtInCMapCache = builtInCMapCache;
39145    this.standardFontDataCache = standardFontDataCache;
39146    this.globalImageCache = globalImageCache;
39147    this.systemFontCache = systemFontCache;
39148    this.options = options || DefaultPartialEvaluatorOptions;
39149    this.parsingType3Font = false;
39150    this._regionalImageCache = new _image_utils.RegionalImageCache();
39151    this._fetchBuiltInCMapBound = this.fetchBuiltInCMap.bind(this);
39152    _image_resizer.ImageResizer.setMaxArea(this.options.canvasMaxAreaInBytes);
39153  }
39154  get _pdfFunctionFactory() {
39155    const pdfFunctionFactory = new _function.PDFFunctionFactory({
39156      xref: this.xref,
39157      isEvalSupported: this.options.isEvalSupported
39158    });
39159    return (0, _util.shadow)(this, "_pdfFunctionFactory", pdfFunctionFactory);
39160  }
39161  clone(newOptions = null) {
39162    const newEvaluator = Object.create(this);
39163    newEvaluator.options = Object.assign(Object.create(null), this.options, newOptions);
39164    return newEvaluator;
39165  }
39166  hasBlendModes(resources, nonBlendModesSet) {
39167    if (!(resources instanceof _primitives.Dict)) {
39168      return false;
39169    }
39170    if (resources.objId && nonBlendModesSet.has(resources.objId)) {
39171      return false;
39172    }
39173    const processed = new _primitives.RefSet(nonBlendModesSet);
39174    if (resources.objId) {
39175      processed.put(resources.objId);
39176    }
39177    const nodes = [resources],
39178      xref = this.xref;
39179    while (nodes.length) {
39180      const node = nodes.shift();
vendor: 8,523 bytes, lines 39181-39431
39181      const graphicStates = node.get("ExtGState");
39182      if (graphicStates instanceof _primitives.Dict) {
39183        for (let graphicState of graphicStates.getRawValues()) {
39184          if (graphicState instanceof _primitives.Ref) {
39185            if (processed.has(graphicState)) {
39186              continue;
39187            }
39188            try {
39189              graphicState = xref.fetch(graphicState);
39190            } catch (ex) {
39191              processed.put(graphicState);
39192              (0, _util.info)(`hasBlendModes - ignoring ExtGState: "${ex}".`);
39193              continue;
39194            }
39195          }
39196          if (!(graphicState instanceof _primitives.Dict)) {
39197            continue;
39198          }
39199          if (graphicState.objId) {
39200            processed.put(graphicState.objId);
39201          }
39202          const bm = graphicState.get("BM");
39203          if (bm instanceof _primitives.Name) {
39204            if (bm.name !== "Normal") {
39205              return true;
39206            }
39207            continue;
39208          }
39209          if (bm !== undefined && Array.isArray(bm)) {
39210            for (const element of bm) {
39211              if (element instanceof _primitives.Name && element.name !== "Normal") {
39212                return true;
39213              }
39214            }
39215          }
39216        }
39217      }
39218      const xObjects = node.get("XObject");
39219      if (!(xObjects instanceof _primitives.Dict)) {
39220        continue;
39221      }
39222      for (let xObject of xObjects.getRawValues()) {
39223        if (xObject instanceof _primitives.Ref) {
39224          if (processed.has(xObject)) {
39225            continue;
39226          }
39227          try {
39228            xObject = xref.fetch(xObject);
39229          } catch (ex) {
39230            processed.put(xObject);
39231            (0, _util.info)(`hasBlendModes - ignoring XObject: "${ex}".`);
39232            continue;
39233          }
39234        }
39235        if (!(xObject instanceof _base_stream.BaseStream)) {
39236          continue;
39237        }
39238        if (xObject.dict.objId) {
39239          processed.put(xObject.dict.objId);
39240        }
39241        const xResources = xObject.dict.get("Resources");
39242        if (!(xResources instanceof _primitives.Dict)) {
39243          continue;
39244        }
39245        if (xResources.objId && processed.has(xResources.objId)) {
39246          continue;
39247        }
39248        nodes.push(xResources);
39249        if (xResources.objId) {
39250          processed.put(xResources.objId);
39251        }
39252      }
39253    }
39254    for (const ref of processed) {
39255      nonBlendModesSet.put(ref);
39256    }
39257    return false;
39258  }
39259  async fetchBuiltInCMap(name) {
39260    const cachedData = this.builtInCMapCache.get(name);
39261    if (cachedData) {
39262      return cachedData;
39263    }
39264    let data;
39265    if (this.options.cMapUrl !== null) {
39266      const url = `${this.options.cMapUrl}${name}.bcmap`;
39267      const response = await fetch(url);
39268      if (!response.ok) {
39269        throw new Error(`fetchBuiltInCMap: failed to fetch file "${url}" with "${response.statusText}".`);
39270      }
39271      data = {
39272        cMapData: new Uint8Array(await response.arrayBuffer()),
39273        compressionType: _util.CMapCompressionType.BINARY
39274      };
39275    } else {
39276      data = await this.handler.sendWithPromise("FetchBuiltInCMap", {
39277        name
39278      });
39279    }
39280    if (data.compressionType !== _util.CMapCompressionType.NONE) {
39281      this.builtInCMapCache.set(name, data);
39282    }
39283    return data;
39284  }
39285  async fetchStandardFontData(name) {
39286    const cachedData = this.standardFontDataCache.get(name);
39287    if (cachedData) {
39288      return new _stream.Stream(cachedData);
39289    }
39290    if (this.options.useSystemFonts && name !== "Symbol" && name !== "ZapfDingbats") {
39291      return null;
39292    }
39293    const standardFontNameToFileName = (0, _standard_fonts.getFontNameToFileMap)(),
39294      filename = standardFontNameToFileName[name];
39295    let data;
39296    if (this.options.standardFontDataUrl !== null) {
39297      const url = `${this.options.standardFontDataUrl}${filename}`;
39298      const response = await fetch(url);
39299      if (!response.ok) {
39300        (0, _util.warn)(`fetchStandardFontData: failed to fetch file "${url}" with "${response.statusText}".`);
39301      } else {
39302        data = await response.arrayBuffer();
39303      }
39304    } else {
39305      try {
39306        data = await this.handler.sendWithPromise("FetchStandardFontData", {
39307          filename
39308        });
39309      } catch (e) {
39310        (0, _util.warn)(`fetchStandardFontData: failed to fetch file "${filename}" with "${e}".`);
39311      }
39312    }
39313    if (!data) {
39314      return null;
39315    }
39316    this.standardFontDataCache.set(name, data);
39317    return new _stream.Stream(data);
39318  }
39319  async buildFormXObject(resources, xobj, smask, operatorList, task, initialState, localColorSpaceCache) {
39320    const dict = xobj.dict;
39321    const matrix = dict.getArray("Matrix");
39322    let bbox = dict.getArray("BBox");
39323    bbox = Array.isArray(bbox) && bbox.length === 4 ? _util.Util.normalizeRect(bbox) : null;
39324    let optionalContent, groupOptions;
39325    if (dict.has("OC")) {
39326      optionalContent = await this.parseMarkedContentProps(dict.get("OC"), resources);
39327    }
39328    if (optionalContent !== undefined) {
39329      operatorList.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
39330    }
39331    const group = dict.get("Group");
39332    if (group) {
39333      groupOptions = {
39334        matrix,
39335        bbox,
39336        smask,
39337        isolated: false,
39338        knockout: false
39339      };
39340      const groupSubtype = group.get("S");
39341      let colorSpace = null;
39342      if ((0, _primitives.isName)(groupSubtype, "Transparency")) {
39343        groupOptions.isolated = group.get("I") || false;
39344        groupOptions.knockout = group.get("K") || false;
39345        if (group.has("CS")) {
39346          const cs = group.getRaw("CS");
39347          const cachedColorSpace = _colorspace.ColorSpace.getCached(cs, this.xref, localColorSpaceCache);
39348          if (cachedColorSpace) {
39349            colorSpace = cachedColorSpace;
39350          } else {
39351            colorSpace = await this.parseColorSpace({
39352              cs,
39353              resources,
39354              localColorSpaceCache
39355            });
39356          }
39357        }
39358      }
39359      if (smask?.backdrop) {
39360        colorSpace ||= _colorspace.ColorSpace.singletons.rgb;
39361        smask.backdrop = colorSpace.getRgb(smask.backdrop, 0);
39362      }
39363      operatorList.addOp(_util.OPS.beginGroup, [groupOptions]);
39364    }
39365    const args = group ? [matrix, null] : [matrix, bbox];
39366    operatorList.addOp(_util.OPS.paintFormXObjectBegin, args);
39367    return this.getOperatorList({
39368      stream: xobj,
39369      task,
39370      resources: dict.get("Resources") || resources,
39371      operatorList,
39372      initialState
39373    }).then(function () {
39374      operatorList.addOp(_util.OPS.paintFormXObjectEnd, []);
39375      if (group) {
39376        operatorList.addOp(_util.OPS.endGroup, [groupOptions]);
39377      }
39378      if (optionalContent !== undefined) {
39379        operatorList.addOp(_util.OPS.endMarkedContent, []);
39380      }
39381    });
39382  }
39383  _sendImgData(objId, imgData, cacheGlobally = false) {
39384    const transfers = imgData ? [imgData.bitmap || imgData.data.buffer] : null;
39385    if (this.parsingType3Font || cacheGlobally) {
39386      return this.handler.send("commonobj", [objId, "Image", imgData], transfers);
39387    }
39388    return this.handler.send("obj", [objId, this.pageIndex, "Image", imgData], transfers);
39389  }
39390  async buildPaintImageXObject({
39391    resources,
39392    image,
39393    isInline = false,
39394    operatorList,
39395    cacheKey,
39396    localImageCache,
39397    localColorSpaceCache
39398  }) {
39399    const dict = image.dict;
39400    const imageRef = dict.objId;
39401    const w = dict.get("W", "Width");
39402    const h = dict.get("H", "Height");
39403    if (!(w && typeof w === "number") || !(h && typeof h === "number")) {
39404      (0, _util.warn)("Image dimensions are missing, or not numbers.");
39405      return;
39406    }
39407    const maxImageSize = this.options.maxImageSize;
39408    if (maxImageSize !== -1 && w * h > maxImageSize) {
39409      const msg = "Image exceeded maximum allowed size and was removed.";
39410      if (this.options.ignoreErrors) {
39411        (0, _util.warn)(msg);
39412        return;
39413      }
39414      throw new Error(msg);
39415    }
39416    let optionalContent;
39417    if (dict.has("OC")) {
39418      optionalContent = await this.parseMarkedContentProps(dict.get("OC"), resources);
39419    }
39420    const imageMask = dict.get("IM", "ImageMask") || false;
39421    let imgData, args;
39422    if (imageMask) {
39423      const interpolate = dict.get("I", "Interpolate");
39424      const bitStrideLength = w + 7 >> 3;
39425      const imgArray = image.getBytes(bitStrideLength * h);
39426      const decode = dict.getArray("D", "Decode");
39427      if (this.parsingType3Font) {
39428        imgData = _image.PDFImage.createRawMask({
39429          imgArray,
39430          width: w,
39431          height: h,
39432          imageIsFromDecodeStream: image instanceof _decode_stream.DecodeStream,
39433          inverseDecode: decode?.[0] > 0,
39434          interpolate
39435        });
39436        imgData.cached = !!cacheKey;
39437        args = [imgData];
39438        operatorList.addImageOps(_util.OPS.paintImageMaskXObject, args, optionalContent);
39439        if (cacheKey) {
39440          const cacheData = {
39441            fn: _util.OPS.paintImageMaskXObject,
39442            args,
39443            optionalContent
39444          };
39445          localImageCache.set(cacheKey, imageRef, cacheData);
39446          if (imageRef) {
39447            this._regionalImageCache.set(null, imageRef, cacheData);
39448          }
39449        }
39450        return;
39451      }
39452      imgData = await _image.PDFImage.createMask({
39453        imgArray,
39454        width: w,
39455        height: h,
39456        imageIsFromDecodeStream: image instanceof _decode_stream.DecodeStream,
39457        inverseDecode: decode?.[0] > 0,
39458        interpolate,
39459        isOffscreenCanvasSupported: this.options.isOffscreenCanvasSupported
39460      });
39461      if (imgData.isSingleOpaquePixel) {
39462        operatorList.addImageOps(_util.OPS.paintSolidColorImageMask, [], optionalContent);
39463        if (cacheKey) {
39464          const cacheData = {
39465            fn: _util.OPS.paintSolidColorImageMask,
39466            args: [],
39467            optionalContent
39468          };
39469          localImageCache.set(cacheKey, imageRef, cacheData);
39470          if (imageRef) {
39471            this._regionalImageCache.set(null, imageRef, cacheData);
39472          }
39473        }
39474        return;
39475      }
39476      const objId = `mask_${this.idFactory.createObjId()}`;
39477      operatorList.addDependency(objId);
39478      this._sendImgData(objId, imgData);
39479      args = [{
39480        data: objId,
39481        width: imgData.width,
39482        height: imgData.height,
39483        interpolate: imgData.interpolate,
39484        count: 1
39485      }];
39486      operatorList.addImageOps(_util.OPS.paintImageMaskXObject, args, optionalContent);
39487      if (cacheKey) {
39488        const cacheData = {
39489          fn: _util.OPS.paintImageMaskXObject,
39490          args,
39491          optionalContent
39492        };
39493        localImageCache.set(cacheKey, imageRef, cacheData);
39494        if (imageRef) {
39495          this._regionalImageCache.set(null, imageRef, cacheData);
39496        }
39497      }
39498      return;
39499    }
39500    const SMALL_IMAGE_DIMENSIONS = 200;
39501    if (isInline && !dict.has("SMask") && !dict.has("Mask") && w + h < SMALL_IMAGE_DIMENSIONS) {
39502      const imageObj = new _image.PDFImage({
39503        xref: this.xref,
39504        res: resources,
39505        image,
39506        isInline,
39507        pdfFunctionFactory: this._pdfFunctionFactory,
39508        localColorSpaceCache
39509      });
39510      imgData = await imageObj.createImageData(true, false);
39511      operatorList.isOffscreenCanvasSupported = this.options.isOffscreenCanvasSupported;
39512      operatorList.addImageOps(_util.OPS.paintInlineImageXObject, [imgData], optionalContent);
39513      return;
39514    }
39515    let objId = `img_${this.idFactory.createObjId()}`,
39516      cacheGlobally = false;
39517    if (this.parsingType3Font) {
39518      objId = `${this.idFactory.getDocId()}_type3_${objId}`;
39519    } else if (imageRef) {
39520      cacheGlobally = this.globalImageCache.shouldCache(imageRef, this.pageIndex);
39521      if (cacheGlobally) {
39522        objId = `${this.idFactory.getDocId()}_${objId}`;
39523      }
39524    }
39525    operatorList.addDependency(objId);
39526    args = [objId, w, h];
39527    _image.PDFImage.buildImage({
39528      xref: this.xref,
39529      res: resources,
39530      image,
39531      isInline,
39532      pdfFunctionFactory: this._pdfFunctionFactory,
39533      localColorSpaceCache
39534    }).then(async imageObj => {
39535      imgData = await imageObj.createImageData(false, this.options.isOffscreenCanvasSupported);
39536      if (cacheKey && imageRef && cacheGlobally) {
39537        const length = imgData.bitmap ? imgData.width * imgData.height * 4 : imgData.data.length;
39538        this.globalImageCache.addByteSize(imageRef, length);
39539      }
39540      return this._sendImgData(objId, imgData, cacheGlobally);
39541    }).catch(reason => {
39542      (0, _util.warn)(`Unable to decode image "${objId}": "${reason}".`);
39543      return this._sendImgData(objId, null, cacheGlobally);
39544    });
39545    operatorList.addImageOps(_util.OPS.paintImageXObject, args, optionalContent);
39546    if (cacheKey) {
39547      const cacheData = {
39548        fn: _util.OPS.paintImageXObject,
39549        args,
39550        optionalContent
39551      };
39552      localImageCache.set(cacheKey, imageRef, cacheData);
39553      if (imageRef) {
39554        this._regionalImageCache.set(null, imageRef, cacheData);
39555        if (cacheGlobally) {
39556          (0, _util.assert)(!isInline, "Cannot cache an inline image globally.");
39557          this.globalImageCache.setData(imageRef, {
39558            objId,
39559            fn: _util.OPS.paintImageXObject,
39560            args,
39561            optionalContent,
39562            byteSize: 0
39563          });
39564        }
39565      }
39566    }
39567  }
39568  handleSMask(smask, resources, operatorList, task, stateManager, localColorSpaceCache) {
39569    const smaskContent = smask.get("G");
39570    const smaskOptions = {
39571      subtype: smask.get("S").name,
39572      backdrop: smask.get("BC")
39573    };
39574    const transferObj = smask.get("TR");
39575    if ((0, _function.isPDFFunction)(transferObj)) {
39576      const transferFn = this._pdfFunctionFactory.create(transferObj);
39577      const transferMap = new Uint8Array(256);
39578      const tmp = new Float32Array(1);
39579      for (let i = 0; i < 256; i++) {
39580        tmp[0] = i / 255;
39581        transferFn(tmp, 0, tmp, 0);
39582        transferMap[i] = tmp[0] * 255 | 0;
39583      }
39584      smaskOptions.transferMap = transferMap;
39585    }
39586    return this.buildFormXObject(resources, smaskContent, smaskOptions, operatorList, task, stateManager.state.clone(), localColorSpaceCache);
39587  }
39588  handleTransferFunction(tr) {
39589    let transferArray;
39590    if (Array.isArray(tr)) {
39591      transferArray = tr;
39592    } else if ((0, _function.isPDFFunction)(tr)) {
39593      transferArray = [tr];
39594    } else {
39595      return null;
39596    }
39597    const transferMaps = [];
39598    let numFns = 0,
39599      numEffectfulFns = 0;
39600    for (const entry of transferArray) {
39601      const transferObj = this.xref.fetchIfRef(entry);
39602      numFns++;
39603      if ((0, _primitives.isName)(transferObj, "Identity")) {
39604        transferMaps.push(null);
39605        continue;
39606      } else if (!(0, _function.isPDFFunction)(transferObj)) {
39607        return null;
39608      }
39609      const transferFn = this._pdfFunctionFactory.create(transferObj);
39610      const transferMap = new Uint8Array(256),
39611        tmp = new Float32Array(1);
39612      for (let j = 0; j < 256; j++) {
39613        tmp[0] = j / 255;
39614        transferFn(tmp, 0, tmp, 0);
39615        transferMap[j] = tmp[0] * 255 | 0;
39616      }
39617      transferMaps.push(transferMap);
39618      numEffectfulFns++;
39619    }
39620    if (!(numFns === 1 || numFns === 4)) {
39621      return null;
39622    }
39623    if (numEffectfulFns === 0) {
39624      return null;
39625    }
39626    return transferMaps;
39627  }
39628  handleTilingType(fn, color, resources, pattern, patternDict, operatorList, task, localTilingPatternCache) {
39629    const tilingOpList = new _operator_list.OperatorList();
39630    const patternResources = _primitives.Dict.merge({
39631      xref: this.xref,
39632      dictArray: [patternDict.get("Resources"), resources]
39633    });
39634    return this.getOperatorList({
39635      stream: pattern,
39636      task,
vendor: 21,923 bytes, lines 39637-40240
39637      resources: patternResources,
39638      operatorList: tilingOpList
39639    }).then(function () {
39640      const operatorListIR = tilingOpList.getIR();
39641      const tilingPatternIR = (0, _pattern.getTilingPatternIR)(operatorListIR, patternDict, color);
39642      operatorList.addDependencies(tilingOpList.dependencies);
39643      operatorList.addOp(fn, tilingPatternIR);
39644      if (patternDict.objId) {
39645        localTilingPatternCache.set(null, patternDict.objId, {
39646          operatorListIR,
39647          dict: patternDict
39648        });
39649      }
39650    }).catch(reason => {
39651      if (reason instanceof _util.AbortException) {
39652        return;
39653      }
39654      if (this.options.ignoreErrors) {
39655        (0, _util.warn)(`handleTilingType - ignoring pattern: "${reason}".`);
39656        return;
39657      }
39658      throw reason;
39659    });
39660  }
39661  handleSetFont(resources, fontArgs, fontRef, operatorList, task, state, fallbackFontDict = null, cssFontInfo = null) {
39662    const fontName = fontArgs?.[0] instanceof _primitives.Name ? fontArgs[0].name : null;
39663    return this.loadFont(fontName, fontRef, resources, fallbackFontDict, cssFontInfo).then(translated => {
39664      if (!translated.font.isType3Font) {
39665        return translated;
39666      }
39667      return translated.loadType3Data(this, resources, task).then(function () {
39668        operatorList.addDependencies(translated.type3Dependencies);
39669        return translated;
39670      }).catch(reason => {
39671        return new TranslatedFont({
39672          loadedName: "g_font_error",
39673          font: new _fonts.ErrorFont(`Type3 font load error: ${reason}`),
39674          dict: translated.font,
39675          evaluatorOptions: this.options
39676        });
39677      });
39678    }).then(translated => {
39679      state.font = translated.font;
39680      translated.send(this.handler);
39681      return translated.loadedName;
39682    });
39683  }
39684  handleText(chars, state) {
39685    const font = state.font;
39686    const glyphs = font.charsToGlyphs(chars);
39687    if (font.data) {
39688      const isAddToPathSet = !!(state.textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG);
39689      if (isAddToPathSet || state.fillColorSpace.name === "Pattern" || font.disableFontFace || this.options.disableFontFace) {
39690        PartialEvaluator.buildFontPaths(font, glyphs, this.handler, this.options);
39691      }
39692    }
39693    return glyphs;
39694  }
39695  ensureStateFont(state) {
39696    if (state.font) {
39697      return;
39698    }
39699    const reason = new _util.FormatError("Missing setFont (Tf) operator before text rendering operator.");
39700    if (this.options.ignoreErrors) {
39701      (0, _util.warn)(`ensureStateFont: "${reason}".`);
39702      return;
39703    }
39704    throw reason;
39705  }
39706  async setGState({
39707    resources,
39708    gState,
39709    operatorList,
39710    cacheKey,
39711    task,
39712    stateManager,
39713    localGStateCache,
39714    localColorSpaceCache
39715  }) {
39716    const gStateRef = gState.objId;
39717    let isSimpleGState = true;
39718    const gStateObj = [];
39719    let promise = Promise.resolve();
39720    for (const key of gState.getKeys()) {
39721      const value = gState.get(key);
39722      switch (key) {
39723        case "Type":
39724          break;
39725        case "LW":
39726        case "LC":
39727        case "LJ":
39728        case "ML":
39729        case "D":
39730        case "RI":
39731        case "FL":
39732        case "CA":
39733        case "ca":
39734          gStateObj.push([key, value]);
39735          break;
39736        case "Font":
39737          isSimpleGState = false;
39738          promise = promise.then(() => {
39739            return this.handleSetFont(resources, null, value[0], operatorList, task, stateManager.state).then(function (loadedName) {
39740              operatorList.addDependency(loadedName);
39741              gStateObj.push([key, [loadedName, value[1]]]);
39742            });
39743          });
39744          break;
39745        case "BM":
39746          gStateObj.push([key, normalizeBlendMode(value)]);
39747          break;
39748        case "SMask":
39749          if ((0, _primitives.isName)(value, "None")) {
39750            gStateObj.push([key, false]);
39751            break;
39752          }
39753          if (value instanceof _primitives.Dict) {
39754            isSimpleGState = false;
39755            promise = promise.then(() => {
39756              return this.handleSMask(value, resources, operatorList, task, stateManager, localColorSpaceCache);
39757            });
39758            gStateObj.push([key, true]);
39759          } else {
39760            (0, _util.warn)("Unsupported SMask type");
39761          }
39762          break;
39763        case "TR":
39764          const transferMaps = this.handleTransferFunction(value);
39765          gStateObj.push([key, transferMaps]);
39766          break;
39767        case "OP":
39768        case "op":
39769        case "OPM":
39770        case "BG":
39771        case "BG2":
39772        case "UCR":
39773        case "UCR2":
39774        case "TR2":
39775        case "HT":
39776        case "SM":
39777        case "SA":
39778        case "AIS":
39779        case "TK":
39780          (0, _util.info)("graphic state operator " + key);
39781          break;
39782        default:
39783          (0, _util.info)("Unknown graphic state operator " + key);
39784          break;
39785      }
39786    }
39787    return promise.then(function () {
39788      if (gStateObj.length > 0) {
39789        operatorList.addOp(_util.OPS.setGState, [gStateObj]);
39790      }
39791      if (isSimpleGState) {
39792        localGStateCache.set(cacheKey, gStateRef, gStateObj);
39793      }
39794    });
39795  }
39796  loadFont(fontName, font, resources, fallbackFontDict = null, cssFontInfo = null) {
39797    const errorFont = async () => {
39798      return new TranslatedFont({
39799        loadedName: "g_font_error",
39800        font: new _fonts.ErrorFont(`Font "${fontName}" is not available.`),
39801        dict: font,
39802        evaluatorOptions: this.options
39803      });
39804    };
39805    let fontRef;
39806    if (font) {
39807      if (font instanceof _primitives.Ref) {
39808        fontRef = font;
39809      }
39810    } else {
39811      const fontRes = resources.get("Font");
39812      if (fontRes) {
39813        fontRef = fontRes.getRaw(fontName);
39814      }
39815    }
39816    if (fontRef) {
39817      if (this.parsingType3Font && this.type3FontRefs.has(fontRef)) {
39818        return errorFont();
39819      }
39820      if (this.fontCache.has(fontRef)) {
39821        return this.fontCache.get(fontRef);
39822      }
39823      font = this.xref.fetchIfRef(fontRef);
39824    }
39825    if (!(font instanceof _primitives.Dict)) {
39826      if (!this.options.ignoreErrors && !this.parsingType3Font) {
39827        (0, _util.warn)(`Font "${fontName}" is not available.`);
39828        return errorFont();
39829      }
39830      (0, _util.warn)(`Font "${fontName}" is not available -- attempting to fallback to a default font.`);
39831      font = fallbackFontDict || PartialEvaluator.fallbackFontDict;
39832    }
39833    if (font.cacheKey && this.fontCache.has(font.cacheKey)) {
39834      return this.fontCache.get(font.cacheKey);
39835    }
39836    const fontCapability = new _util.PromiseCapability();
39837    let preEvaluatedFont;
39838    try {
39839      preEvaluatedFont = this.preEvaluateFont(font);
39840      preEvaluatedFont.cssFontInfo = cssFontInfo;
39841    } catch (reason) {
39842      (0, _util.warn)(`loadFont - preEvaluateFont failed: "${reason}".`);
39843      return errorFont();
39844    }
39845    const {
39846      descriptor,
39847      hash
39848    } = preEvaluatedFont;
39849    const fontRefIsRef = fontRef instanceof _primitives.Ref;
39850    let fontID;
39851    if (hash && descriptor instanceof _primitives.Dict) {
39852      const fontAliases = descriptor.fontAliases ||= Object.create(null);
39853      if (fontAliases[hash]) {
39854        const aliasFontRef = fontAliases[hash].aliasRef;
39855        if (fontRefIsRef && aliasFontRef && this.fontCache.has(aliasFontRef)) {
39856          this.fontCache.putAlias(fontRef, aliasFontRef);
39857          return this.fontCache.get(fontRef);
39858        }
39859      } else {
39860        fontAliases[hash] = {
39861          fontID: this.idFactory.createFontId()
39862        };
39863      }
39864      if (fontRefIsRef) {
39865        fontAliases[hash].aliasRef = fontRef;
39866      }
39867      fontID = fontAliases[hash].fontID;
39868    } else {
39869      fontID = this.idFactory.createFontId();
39870    }
39871    (0, _util.assert)(fontID?.startsWith("f"), 'The "fontID" must be (correctly) defined.');
39872    if (fontRefIsRef) {
39873      this.fontCache.put(fontRef, fontCapability.promise);
39874    } else {
39875      font.cacheKey = `cacheKey_${fontID}`;
39876      this.fontCache.put(font.cacheKey, fontCapability.promise);
39877    }
39878    font.loadedName = `${this.idFactory.getDocId()}_${fontID}`;
39879    this.translateFont(preEvaluatedFont).then(translatedFont => {
39880      fontCapability.resolve(new TranslatedFont({
39881        loadedName: font.loadedName,
39882        font: translatedFont,
39883        dict: font,
39884        evaluatorOptions: this.options
39885      }));
39886    }).catch(reason => {
39887      (0, _util.warn)(`loadFont - translateFont failed: "${reason}".`);
39888      fontCapability.resolve(new TranslatedFont({
39889        loadedName: font.loadedName,
39890        font: new _fonts.ErrorFont(reason instanceof Error ? reason.message : reason),
39891        dict: font,
39892        evaluatorOptions: this.options
39893      }));
39894    });
39895    return fontCapability.promise;
39896  }
39897  buildPath(operatorList, fn, args, parsingText = false) {
39898    const lastIndex = operatorList.length - 1;
39899    if (!args) {
39900      args = [];
39901    }
39902    if (lastIndex < 0 || operatorList.fnArray[lastIndex] !== _util.OPS.constructPath) {
39903      if (parsingText) {
39904        (0, _util.warn)(`Encountered path operator "${fn}" inside of a text object.`);
39905        operatorList.addOp(_util.OPS.save, null);
39906      }
39907      let minMax;
39908      switch (fn) {
39909        case _util.OPS.rectangle:
39910          const x = args[0] + args[2];
39911          const y = args[1] + args[3];
39912          minMax = [Math.min(args[0], x), Math.max(args[0], x), Math.min(args[1], y), Math.max(args[1], y)];
39913          break;
39914        case _util.OPS.moveTo:
39915        case _util.OPS.lineTo:
39916          minMax = [args[0], args[0], args[1], args[1]];
39917          break;
39918        default:
39919          minMax = [Infinity, -Infinity, Infinity, -Infinity];
39920          break;
39921      }
39922      operatorList.addOp(_util.OPS.constructPath, [[fn], args, minMax]);
39923      if (parsingText) {
39924        operatorList.addOp(_util.OPS.restore, null);
39925      }
39926    } else {
39927      const opArgs = operatorList.argsArray[lastIndex];
39928      opArgs[0].push(fn);
39929      opArgs[1].push(...args);
39930      const minMax = opArgs[2];
39931      switch (fn) {
39932        case _util.OPS.rectangle:
39933          const x = args[0] + args[2];
39934          const y = args[1] + args[3];
39935          minMax[0] = Math.min(minMax[0], args[0], x);
39936          minMax[1] = Math.max(minMax[1], args[0], x);
39937          minMax[2] = Math.min(minMax[2], args[1], y);
39938          minMax[3] = Math.max(minMax[3], args[1], y);
39939          break;
39940        case _util.OPS.moveTo:
39941        case _util.OPS.lineTo:
39942          minMax[0] = Math.min(minMax[0], args[0]);
39943          minMax[1] = Math.max(minMax[1], args[0]);
39944          minMax[2] = Math.min(minMax[2], args[1]);
39945          minMax[3] = Math.max(minMax[3], args[1]);
39946          break;
39947      }
39948    }
39949  }
39950  parseColorSpace({
39951    cs,
39952    resources,
39953    localColorSpaceCache
39954  }) {
39955    return _colorspace.ColorSpace.parseAsync({
39956      cs,
39957      xref: this.xref,
39958      resources,
39959      pdfFunctionFactory: this._pdfFunctionFactory,
39960      localColorSpaceCache
39961    }).catch(reason => {
39962      if (reason instanceof _util.AbortException) {
39963        return null;
39964      }
39965      if (this.options.ignoreErrors) {
39966        (0, _util.warn)(`parseColorSpace - ignoring ColorSpace: "${reason}".`);
39967        return null;
39968      }
39969      throw reason;
39970    });
39971  }
39972  parseShading({
39973    shading,
39974    resources,
39975    localColorSpaceCache,
39976    localShadingPatternCache
39977  }) {
39978    let id = localShadingPatternCache.get(shading);
39979    if (!id) {
39980      var shadingFill = _pattern.Pattern.parseShading(shading, this.xref, resources, this._pdfFunctionFactory, localColorSpaceCache);
39981      const patternIR = shadingFill.getIR();
39982      id = `pattern_${this.idFactory.createObjId()}`;
39983      if (this.parsingType3Font) {
39984        id = `${this.idFactory.getDocId()}_type3_${id}`;
39985      }
39986      localShadingPatternCache.set(shading, id);
39987      if (this.parsingType3Font) {
39988        this.handler.send("commonobj", [id, "Pattern", patternIR]);
39989      } else {
39990        this.handler.send("obj", [id, this.pageIndex, "Pattern", patternIR]);
39991      }
39992    }
39993    return id;
39994  }
39995  handleColorN(operatorList, fn, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache) {
39996    const patternName = args.pop();
39997    if (patternName instanceof _primitives.Name) {
39998      const rawPattern = patterns.getRaw(patternName.name);
39999      const localTilingPattern = rawPattern instanceof _primitives.Ref && localTilingPatternCache.getByRef(rawPattern);
40000      if (localTilingPattern) {
40001        try {
40002          const color = cs.base ? cs.base.getRgb(args, 0) : null;
40003          const tilingPatternIR = (0, _pattern.getTilingPatternIR)(localTilingPattern.operatorListIR, localTilingPattern.dict, color);
40004          operatorList.addOp(fn, tilingPatternIR);
40005          return undefined;
40006        } catch {}
40007      }
40008      const pattern = this.xref.fetchIfRef(rawPattern);
40009      if (pattern) {
40010        const dict = pattern instanceof _base_stream.BaseStream ? pattern.dict : pattern;
40011        const typeNum = dict.get("PatternType");
40012        if (typeNum === PatternType.TILING) {
40013          const color = cs.base ? cs.base.getRgb(args, 0) : null;
40014          return this.handleTilingType(fn, color, resources, pattern, dict, operatorList, task, localTilingPatternCache);
40015        } else if (typeNum === PatternType.SHADING) {
40016          const shading = dict.get("Shading");
40017          const matrix = dict.getArray("Matrix");
40018          const objId = this.parseShading({
40019            shading,
40020            resources,
40021            localColorSpaceCache,
40022            localShadingPatternCache
40023          });
40024          operatorList.addOp(fn, ["Shading", objId, matrix]);
40025          return undefined;
40026        }
40027        throw new _util.FormatError(`Unknown PatternType: ${typeNum}`);
40028      }
40029    }
40030    throw new _util.FormatError(`Unknown PatternName: ${patternName}`);
40031  }
40032  _parseVisibilityExpression(array, nestingCounter, currentResult) {
40033    const MAX_NESTING = 10;
40034    if (++nestingCounter > MAX_NESTING) {
40035      (0, _util.warn)("Visibility expression is too deeply nested");
40036      return;
40037    }
40038    const length = array.length;
40039    const operator = this.xref.fetchIfRef(array[0]);
40040    if (length < 2 || !(operator instanceof _primitives.Name)) {
40041      (0, _util.warn)("Invalid visibility expression");
40042      return;
40043    }
40044    switch (operator.name) {
40045      case "And":
40046      case "Or":
40047      case "Not":
40048        currentResult.push(operator.name);
40049        break;
40050      default:
40051        (0, _util.warn)(`Invalid operator ${operator.name} in visibility expression`);
40052        return;
40053    }
40054    for (let i = 1; i < length; i++) {
40055      const raw = array[i];
40056      const object = this.xref.fetchIfRef(raw);
40057      if (Array.isArray(object)) {
40058        const nestedResult = [];
40059        currentResult.push(nestedResult);
40060        this._parseVisibilityExpression(object, nestingCounter, nestedResult);
40061      } else if (raw instanceof _primitives.Ref) {
40062        currentResult.push(raw.toString());
40063      }
40064    }
40065  }
40066  async parseMarkedContentProps(contentProperties, resources) {
40067    let optionalContent;
40068    if (contentProperties instanceof _primitives.Name) {
40069      const properties = resources.get("Properties");
40070      optionalContent = properties.get(contentProperties.name);
40071    } else if (contentProperties instanceof _primitives.Dict) {
40072      optionalContent = contentProperties;
40073    } else {
40074      throw new _util.FormatError("Optional content properties malformed.");
40075    }
40076    const optionalContentType = optionalContent.get("Type")?.name;
40077    if (optionalContentType === "OCG") {
40078      return {
40079        type: optionalContentType,
40080        id: optionalContent.objId
40081      };
40082    } else if (optionalContentType === "OCMD") {
40083      const expression = optionalContent.get("VE");
40084      if (Array.isArray(expression)) {
40085        const result = [];
40086        this._parseVisibilityExpression(expression, 0, result);
40087        if (result.length > 0) {
40088          return {
40089            type: "OCMD",
40090            expression: result
40091          };
40092        }
40093      }
40094      const optionalContentGroups = optionalContent.get("OCGs");
40095      if (Array.isArray(optionalContentGroups) || optionalContentGroups instanceof _primitives.Dict) {
40096        const groupIds = [];
40097        if (Array.isArray(optionalContentGroups)) {
40098          for (const ocg of optionalContentGroups) {
40099            groupIds.push(ocg.toString());
40100          }
40101        } else {
40102          groupIds.push(optionalContentGroups.objId);
40103        }
40104        return {
40105          type: optionalContentType,
40106          ids: groupIds,
40107          policy: optionalContent.get("P") instanceof _primitives.Name ? optionalContent.get("P").name : null,
40108          expression: null
40109        };
40110      } else if (optionalContentGroups instanceof _primitives.Ref) {
40111        return {
40112          type: optionalContentType,
40113          id: optionalContentGroups.toString()
40114        };
40115      }
40116    }
40117    return null;
40118  }
40119  getOperatorList({
40120    stream,
40121    task,
40122    resources,
40123    operatorList,
40124    initialState = null,
40125    fallbackFontDict = null
40126  }) {
40127    resources ||= _primitives.Dict.empty;
40128    initialState ||= new EvalState();
40129    if (!operatorList) {
40130      throw new Error('getOperatorList: missing "operatorList" parameter');
40131    }
40132    const self = this;
40133    const xref = this.xref;
40134    let parsingText = false;
40135    const localImageCache = new _image_utils.LocalImageCache();
40136    const localColorSpaceCache = new _image_utils.LocalColorSpaceCache();
40137    const localGStateCache = new _image_utils.LocalGStateCache();
40138    const localTilingPatternCache = new _image_utils.LocalTilingPatternCache();
40139    const localShadingPatternCache = new Map();
40140    const xobjs = resources.get("XObject") || _primitives.Dict.empty;
40141    const patterns = resources.get("Pattern") || _primitives.Dict.empty;
40142    const stateManager = new StateManager(initialState);
40143    const preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
40144    const timeSlotManager = new TimeSlotManager();
40145    function closePendingRestoreOPS(argument) {
40146      for (let i = 0, ii = preprocessor.savedStatesDepth; i < ii; i++) {
40147        operatorList.addOp(_util.OPS.restore, []);
40148      }
40149    }
40150    return new Promise(function promiseBody(resolve, reject) {
40151      const next = function (promise) {
40152        Promise.all([promise, operatorList.ready]).then(function () {
40153          try {
40154            promiseBody(resolve, reject);
40155          } catch (ex) {
40156            reject(ex);
40157          }
40158        }, reject);
40159      };
40160      task.ensureNotTerminated();
40161      timeSlotManager.reset();
40162      const operation = {};
40163      let stop, i, ii, cs, name, isValidName;
40164      while (!(stop = timeSlotManager.check())) {
40165        operation.args = null;
40166        if (!preprocessor.read(operation)) {
40167          break;
40168        }
40169        let args = operation.args;
40170        let fn = operation.fn;
40171        switch (fn | 0) {
40172          case _util.OPS.paintXObject:
40173            isValidName = args[0] instanceof _primitives.Name;
40174            name = args[0].name;
40175            if (isValidName) {
40176              const localImage = localImageCache.getByName(name);
40177              if (localImage) {
40178                operatorList.addImageOps(localImage.fn, localImage.args, localImage.optionalContent);
40179                incrementCachedImageMaskCount(localImage);
40180                args = null;
40181                continue;
40182              }
40183            }
40184            next(new Promise(function (resolveXObject, rejectXObject) {
40185              if (!isValidName) {
40186                throw new _util.FormatError("XObject must be referred to by name.");
40187              }
40188              let xobj = xobjs.getRaw(name);
40189              if (xobj instanceof _primitives.Ref) {
40190                const localImage = localImageCache.getByRef(xobj) || self._regionalImageCache.getByRef(xobj);
40191                if (localImage) {
40192                  operatorList.addImageOps(localImage.fn, localImage.args, localImage.optionalContent);
40193                  incrementCachedImageMaskCount(localImage);
40194                  resolveXObject();
40195                  return;
40196                }
40197                const globalImage = self.globalImageCache.getData(xobj, self.pageIndex);
40198                if (globalImage) {
40199                  operatorList.addDependency(globalImage.objId);
40200                  operatorList.addImageOps(globalImage.fn, globalImage.args, globalImage.optionalContent);
40201                  resolveXObject();
40202                  return;
40203                }
40204                xobj = xref.fetch(xobj);
40205              }
40206              if (!(xobj instanceof _base_stream.BaseStream)) {
40207                throw new _util.FormatError("XObject should be a stream");
40208              }
40209              const type = xobj.dict.get("Subtype");
40210              if (!(type instanceof _primitives.Name)) {
40211                throw new _util.FormatError("XObject should have a Name subtype");
40212              }
40213              if (type.name === "Form") {
40214                stateManager.save();
40215                self.buildFormXObject(resources, xobj, null, operatorList, task, stateManager.state.clone(), localColorSpaceCache).then(function () {
40216                  stateManager.restore();
40217                  resolveXObject();
40218                }, rejectXObject);
40219                return;
40220              } else if (type.name === "Image") {
40221                self.buildPaintImageXObject({
40222                  resources,
40223                  image: xobj,
40224                  operatorList,
40225                  cacheKey: name,
40226                  localImageCache,
40227                  localColorSpaceCache
40228                }).then(resolveXObject, rejectXObject);
40229                return;
40230              } else if (type.name === "PS") {
40231                (0, _util.info)("Ignored XObject subtype PS");
40232              } else {
40233                throw new _util.FormatError(`Unhandled XObject subtype ${type.name}`);
40234              }
40235              resolveXObject();
40236            }).catch(function (reason) {
40237              if (reason instanceof _util.AbortException) {
40238                return;
40239              }
40240              if (self.options.ignoreErrors) {
vendor: 9,910 bytes, lines 40240-40478
40240
40241                (0, _util.warn)(`getOperatorList - ignoring XObject: "${reason}".`);
40242                return;
40243              }
40244              throw reason;
40245            }));
40246            return;
40247          case _util.OPS.setFont:
40248            var fontSize = args[1];
40249            next(self.handleSetFont(resources, args, null, operatorList, task, stateManager.state, fallbackFontDict).then(function (loadedName) {
40250              operatorList.addDependency(loadedName);
40251              operatorList.addOp(_util.OPS.setFont, [loadedName, fontSize]);
40252            }));
40253            return;
40254          case _util.OPS.beginText:
40255            parsingText = true;
40256            break;
40257          case _util.OPS.endText:
40258            parsingText = false;
40259            break;
40260          case _util.OPS.endInlineImage:
40261            var cacheKey = args[0].cacheKey;
40262            if (cacheKey) {
40263              const localImage = localImageCache.getByName(cacheKey);
40264              if (localImage) {
40265                operatorList.addImageOps(localImage.fn, localImage.args, localImage.optionalContent);
40266                incrementCachedImageMaskCount(localImage);
40267                args = null;
40268                continue;
40269              }
40270            }
40271            next(self.buildPaintImageXObject({
40272              resources,
40273              image: args[0],
40274              isInline: true,
40275              operatorList,
40276              cacheKey,
40277              localImageCache,
40278              localColorSpaceCache
40279            }));
40280            return;
40281          case _util.OPS.showText:
40282            if (!stateManager.state.font) {
40283              self.ensureStateFont(stateManager.state);
40284              continue;
40285            }
40286            args[0] = self.handleText(args[0], stateManager.state);
40287            break;
40288          case _util.OPS.showSpacedText:
40289            if (!stateManager.state.font) {
40290              self.ensureStateFont(stateManager.state);
40291              continue;
40292            }
40293            var combinedGlyphs = [];
40294            var state = stateManager.state;
40295            for (const arrItem of args[0]) {
40296              if (typeof arrItem === "string") {
40297                combinedGlyphs.push(...self.handleText(arrItem, state));
40298              } else if (typeof arrItem === "number") {
40299                combinedGlyphs.push(arrItem);
40300              }
40301            }
40302            args[0] = combinedGlyphs;
40303            fn = _util.OPS.showText;
40304            break;
40305          case _util.OPS.nextLineShowText:
40306            if (!stateManager.state.font) {
40307              self.ensureStateFont(stateManager.state);
40308              continue;
40309            }
40310            operatorList.addOp(_util.OPS.nextLine);
40311            args[0] = self.handleText(args[0], stateManager.state);
40312            fn = _util.OPS.showText;
40313            break;
40314          case _util.OPS.nextLineSetSpacingShowText:
40315            if (!stateManager.state.font) {
40316              self.ensureStateFont(stateManager.state);
40317              continue;
40318            }
40319            operatorList.addOp(_util.OPS.nextLine);
40320            operatorList.addOp(_util.OPS.setWordSpacing, [args.shift()]);
40321            operatorList.addOp(_util.OPS.setCharSpacing, [args.shift()]);
40322            args[0] = self.handleText(args[0], stateManager.state);
40323            fn = _util.OPS.showText;
40324            break;
40325          case _util.OPS.setTextRenderingMode:
40326            stateManager.state.textRenderingMode = args[0];
40327            break;
40328          case _util.OPS.setFillColorSpace:
40329            {
40330              const cachedColorSpace = _colorspace.ColorSpace.getCached(args[0], xref, localColorSpaceCache);
40331              if (cachedColorSpace) {
40332                stateManager.state.fillColorSpace = cachedColorSpace;
40333                continue;
40334              }
40335              next(self.parseColorSpace({
40336                cs: args[0],
40337                resources,
40338                localColorSpaceCache
40339              }).then(function (colorSpace) {
40340                if (colorSpace) {
40341                  stateManager.state.fillColorSpace = colorSpace;
40342                }
40343              }));
40344              return;
40345            }
40346          case _util.OPS.setStrokeColorSpace:
40347            {
40348              const cachedColorSpace = _colorspace.ColorSpace.getCached(args[0], xref, localColorSpaceCache);
40349              if (cachedColorSpace) {
40350                stateManager.state.strokeColorSpace = cachedColorSpace;
40351                continue;
40352              }
40353              next(self.parseColorSpace({
40354                cs: args[0],
40355                resources,
40356                localColorSpaceCache
40357              }).then(function (colorSpace) {
40358                if (colorSpace) {
40359                  stateManager.state.strokeColorSpace = colorSpace;
40360                }
40361              }));
40362              return;
40363            }
40364          case _util.OPS.setFillColor:
40365            cs = stateManager.state.fillColorSpace;
40366            args = cs.getRgb(args, 0);
40367            fn = _util.OPS.setFillRGBColor;
40368            break;
40369          case _util.OPS.setStrokeColor:
40370            cs = stateManager.state.strokeColorSpace;
40371            args = cs.getRgb(args, 0);
40372            fn = _util.OPS.setStrokeRGBColor;
40373            break;
40374          case _util.OPS.setFillGray:
40375            stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.gray;
40376            args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0);
40377            fn = _util.OPS.setFillRGBColor;
40378            break;
40379          case _util.OPS.setStrokeGray:
40380            stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.gray;
40381            args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0);
40382            fn = _util.OPS.setStrokeRGBColor;
40383            break;
40384          case _util.OPS.setFillCMYKColor:
40385            stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.cmyk;
40386            args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0);
40387            fn = _util.OPS.setFillRGBColor;
40388            break;
40389          case _util.OPS.setStrokeCMYKColor:
40390            stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.cmyk;
40391            args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0);
40392            fn = _util.OPS.setStrokeRGBColor;
40393            break;
40394          case _util.OPS.setFillRGBColor:
40395            stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.rgb;
40396            args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0);
40397            break;
40398          case _util.OPS.setStrokeRGBColor:
40399            stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.rgb;
40400            args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0);
40401            break;
40402          case _util.OPS.setFillColorN:
40403            cs = stateManager.state.fillColorSpace;
40404            if (cs.name === "Pattern") {
40405              next(self.handleColorN(operatorList, _util.OPS.setFillColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache));
40406              return;
40407            }
40408            args = cs.getRgb(args, 0);
40409            fn = _util.OPS.setFillRGBColor;
40410            break;
40411          case _util.OPS.setStrokeColorN:
40412            cs = stateManager.state.strokeColorSpace;
40413            if (cs.name === "Pattern") {
40414              next(self.handleColorN(operatorList, _util.OPS.setStrokeColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache));
40415              return;
40416            }
40417            args = cs.getRgb(args, 0);
40418            fn = _util.OPS.setStrokeRGBColor;
40419            break;
40420          case _util.OPS.shadingFill:
40421            var shadingRes = resources.get("Shading");
40422            if (!shadingRes) {
40423              throw new _util.FormatError("No shading resource found");
40424            }
40425            var shading = shadingRes.get(args[0].name);
40426            if (!shading) {
40427              throw new _util.FormatError("No shading object found");
40428            }
40429            const patternId = self.parseShading({
40430              shading,
40431              resources,
40432              localColorSpaceCache,
40433              localShadingPatternCache
40434            });
40435            args = [patternId];
40436            fn = _util.OPS.shadingFill;
40437            break;
40438          case _util.OPS.setGState:
40439            isValidName = args[0] instanceof _primitives.Name;
40440            name = args[0].name;
40441            if (isValidName) {
40442              const localGStateObj = localGStateCache.getByName(name);
40443              if (localGStateObj) {
40444                if (localGStateObj.length > 0) {
40445                  operatorList.addOp(_util.OPS.setGState, [localGStateObj]);
40446                }
40447                args = null;
40448                continue;
40449              }
40450            }
40451            next(new Promise(function (resolveGState, rejectGState) {
40452              if (!isValidName) {
40453                throw new _util.FormatError("GState must be referred to by name.");
40454              }
40455              const extGState = resources.get("ExtGState");
40456              if (!(extGState instanceof _primitives.Dict)) {
40457                throw new _util.FormatError("ExtGState should be a dictionary.");
40458              }
40459              const gState = extGState.get(name);
40460              if (!(gState instanceof _primitives.Dict)) {
40461                throw new _util.FormatError("GState should be a dictionary.");
40462              }
40463              self.setGState({
40464                resources,
40465                gState,
40466                operatorList,
40467                cacheKey: name,
40468                task,
40469                stateManager,
40470                localGStateCache,
40471                localColorSpaceCache
40472              }).then(resolveGState, rejectGState);
40473            }).catch(function (reason) {
40474              if (reason instanceof _util.AbortException) {
40475                return;
40476              }
40477              if (self.options.ignoreErrors) {
40478                
vendor: 3,476 bytes, lines 40478-40590
40478(0, _util.warn)(`getOperatorList - ignoring ExtGState: "${reason}".`);
40479                return;
40480              }
40481              throw reason;
40482            }));
40483            return;
40484          case _util.OPS.moveTo:
40485          case _util.OPS.lineTo:
40486          case _util.OPS.curveTo:
40487          case _util.OPS.curveTo2:
40488          case _util.OPS.curveTo3:
40489          case _util.OPS.closePath:
40490          case _util.OPS.rectangle:
40491            self.buildPath(operatorList, fn, args, parsingText);
40492            continue;
40493          case _util.OPS.markPoint:
40494          case _util.OPS.markPointProps:
40495          case _util.OPS.beginCompat:
40496          case _util.OPS.endCompat:
40497            continue;
40498          case _util.OPS.beginMarkedContentProps:
40499            if (!(args[0] instanceof _primitives.Name)) {
40500              (0, _util.warn)(`Expected name for beginMarkedContentProps arg0=${args[0]}`);
40501              continue;
40502            }
40503            if (args[0].name === "OC") {
40504              next(self.parseMarkedContentProps(args[1], resources).then(data => {
40505                operatorList.addOp(_util.OPS.beginMarkedContentProps, ["OC", data]);
40506              }).catch(reason => {
40507                if (reason instanceof _util.AbortException) {
40508                  return;
40509                }
40510                if (self.options.ignoreErrors) {
40511                  (0, _util.warn)(`getOperatorList - ignoring beginMarkedContentProps: "${reason}".`);
40512                  return;
40513                }
40514                throw reason;
40515              }));
40516              return;
40517            }
40518            args = [args[0].name, args[1] instanceof _primitives.Dict ? args[1].get("MCID") : null];
40519            break;
40520          case _util.OPS.beginMarkedContent:
40521          case _util.OPS.endMarkedContent:
40522          default:
40523            if (args !== null) {
40524              for (i = 0, ii = args.length; i < ii; i++) {
40525                if (args[i] instanceof _primitives.Dict) {
40526                  break;
40527                }
40528              }
40529              if (i < ii) {
40530                (0, _util.warn)("getOperatorList - ignoring operator: " + fn);
40531                continue;
40532              }
40533            }
40534        }
40535        operatorList.addOp(fn, args);
40536      }
40537      if (stop) {
40538        next(deferred);
40539        return;
40540      }
40541      closePendingRestoreOPS();
40542      resolve();
40543    }).catch(reason => {
40544      if (reason instanceof _util.AbortException) {
40545        return;
40546      }
40547      if (this.options.ignoreErrors) {
40548        (0, _util.warn)(`getOperatorList - ignoring errors during "${task.name}" ` + `task: "${reason}".`);
40549        closePendingRestoreOPS();
40550        return;
40551      }
40552      throw reason;
40553    });
40554  }
40555  getTextContent({
40556    stream,
40557    task,
40558    resources,
40559    stateManager = null,
40560    includeMarkedContent = false,
40561    sink,
40562    seenStyles = new Set(),
40563    viewBox,
40564    markedContentData = null,
40565    disableNormalization = false
40566  }) {
40567    resources ||= _primitives.Dict.empty;
40568    stateManager ||= new StateManager(new TextState());
40569    if (includeMarkedContent) {
40570      markedContentData ||= {
40571        level: 0
40572      };
40573    }
40574    const textContent = {
40575      items: [],
40576      styles: Object.create(null)
40577    };
40578    const textContentItem = {
40579      initialized: false,
40580      str: [],
40581      totalWidth: 0,
40582      totalHeight: 0,
40583      width: 0,
40584      height: 0,
40585      vertical: false,
40586      prevTransform: null,
40587      textAdvanceScale: 0,
40588      spaceInFlowMin: 0,
40589      spaceInFlowMax: 0,
40590      trackingSpaceMin: Infinity,
40591      negativeSpaceMax: -Infinity,
40592      notASpace: -Infinity,
40593      transform: null,
40594      fontName: null,
40595      hasEOL: false
40596    };
40597    const twoLastChars = [" ", " "];
40598    let twoLastCharsPos = 0;
40599    function saveLastChar(char) {
40600      const nextPos = (twoLastCharsPos + 1) % 2;
40601      const ret = twoLastChars[twoLastCharsPos] !== " " && twoLastChars[nextPos] === " ";
40602      twoLastChars[twoLastCharsPos] = char;
40603      twoLastCharsPos = nextPos;
40604      return ret;
40605    }
40606    function shouldAddWhitepsace() {
40607      return twoLastChars[twoLastCharsPos] !== " " && twoLastChars[(twoLastCharsPos + 1) % 2] === " ";
40608    }
40609    function resetLastChars() {
40610      twoLastChars[0] = twoLastChars[1] = " ";
40611      twoLastCharsPos = 0;
40612    }
40613    const TRACKING_SPACE_FACTOR = 0.102;
40614    const NOT_A_SPACE_FACTOR = 0.03;
40615    const NEGATIVE_SPACE_FACTOR = -0.2;
40616    const SPACE_IN_FLOW_MIN_FACTOR = 0.102;
40617    const SPACE_IN_FLOW_MAX_FACTOR = 0.6;
40618    const VERTICAL_SHIFT_RATIO = 0.25;
40619    const self = this;
40620    const xref = this.xref;
40621    const showSpacedTextBuffer = [];
40622    let xobjs = null;
40623    const emptyXObjectCache = new _image_utils.LocalImageCache();
40624    const emptyGStateCache = new _image_utils.LocalGStateCache();
40625    const preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
40626    let textState;
40627    function pushWhitespace({
40628      width = 0,
40629      height = 0,
40630      transform = textContentItem.prevTransform,
40631      fontName = textContentItem.fontName
40632    }) {
40633      textContent.items.push({
40634        str: " ",
40635        dir: "ltr",
40636        width,
40637        height,
40638        transform,
40639        fontName,
40640        hasEOL: false
40641      });
40642    }
40643    function getCurrentTextTransform() {
40644      const font = textState.font;
40645      const tsm = [textState.fontSize * textState.textHScale, 0, 0, textState.fontSize, 0, textState.textRise];
40646      if (font.isType3Font && (textState.fontSize <= 1 || font.isCharBBox) && !(0, _util.isArrayEqual)(textState.fontMatrix, _util.FONT_IDENTITY_MATRIX)) {
40647        const glyphHeight = font.bbox[3] - font.bbox[1];
40648        if (glyphHeight > 0) {
40649          tsm[3] *= glyphHeight * textState.fontMatrix[3];
40650        }
40651      }
40652      return _util.Util.transform(textState.ctm, _util.Util.transform(textState.textMatrix, tsm));
40653    }
40654    function ensureTextContentItem() {
40655      if (textContentItem.initialized) {
40656        return textContentItem;
40657      }
40658      const {
40659        font,
40660        loadedName
40661      } = textState;
40662      if (!seenStyles.has(loadedName)) {
40663        seenStyles.add(loadedName);
40664        textContent.styles[loadedName] = {
40665          fontFamily: font.fallbackName,
40666          ascent: font.ascent,
40667          descent: font.descent,
40668          vertical: font.vertical
40669        };
40670      }
40671      textContentItem.fontName = loadedName;
40672      const trm = textContentItem.transform = getCurrentTextTransform();
40673      if (!font.vertical) {
40674        textContentItem.width = textContentItem.totalWidth = 0;
40675        textContentItem.height = textContentItem.totalHeight = Math.hypot(trm[2], trm[3]);
40676        textContentItem.vertical = false;
vendor: 1,088 bytes, lines 40677-40700
40677      } else {
40678        textContentItem.width = textContentItem.totalWidth = Math.hypot(trm[0], trm[1]);
40679        textContentItem.height = textContentItem.totalHeight = 0;
40680        textContentItem.vertical = true;
40681      }
40682      const scaleLineX = Math.hypot(textState.textLineMatrix[0], textState.textLineMatrix[1]);
40683      const scaleCtmX = Math.hypot(textState.ctm[0], textState.ctm[1]);
40684      textContentItem.textAdvanceScale = scaleCtmX * scaleLineX;
40685      const {
40686        fontSize
40687      } = textState;
40688      textContentItem.trackingSpaceMin = fontSize * TRACKING_SPACE_FACTOR;
40689      textContentItem.notASpace = fontSize * NOT_A_SPACE_FACTOR;
40690      textContentItem.negativeSpaceMax = fontSize * NEGATIVE_SPACE_FACTOR;
40691      textContentItem.spaceInFlowMin = fontSize * SPACE_IN_FLOW_MIN_FACTOR;
40692      textContentItem.spaceInFlowMax = fontSize * SPACE_IN_FLOW_MAX_FACTOR;
40693      textContentItem.hasEOL = false;
40694      textContentItem.initialized = true;
40695      return textContentItem;
40696    }
40697    function updateAdvanceScale() {
40698      if (!textContentItem.initialized) {
40699        return;
40700      }
vendor: 4,101 bytes, lines 40701-40797
40701      const scaleLineX = Math.hypot(textState.textLineMatrix[0], textState.textLineMatrix[1]);
40702      const scaleCtmX = Math.hypot(textState.ctm[0], textState.ctm[1]);
40703      const scaleFactor = scaleCtmX * scaleLineX;
40704      if (scaleFactor === textContentItem.textAdvanceScale) {
40705        return;
40706      }
40707      if (!textContentItem.vertical) {
40708        textContentItem.totalWidth += textContentItem.width * textContentItem.textAdvanceScale;
40709        textContentItem.width = 0;
40710      } else {
40711        textContentItem.totalHeight += textContentItem.height * textContentItem.textAdvanceScale;
40712        textContentItem.height = 0;
40713      }
40714      textContentItem.textAdvanceScale = scaleFactor;
40715    }
40716    function runBidiTransform(textChunk) {
40717      let text = textChunk.str.join("");
40718      if (!disableNormalization) {
40719        text = (0, _util.normalizeUnicode)(text);
40720      }
40721      const bidiResult = (0, _bidi.bidi)(text, -1, textChunk.vertical);
40722      return {
40723        str: bidiResult.str,
40724        dir: bidiResult.dir,
40725        width: Math.abs(textChunk.totalWidth),
40726        height: Math.abs(textChunk.totalHeight),
40727        transform: textChunk.transform,
40728        fontName: textChunk.fontName,
40729        hasEOL: textChunk.hasEOL
40730      };
40731    }
40732    function handleSetFont(fontName, fontRef) {
40733      return self.loadFont(fontName, fontRef, resources).then(function (translated) {
40734        if (!translated.font.isType3Font) {
40735          return translated;
40736        }
40737        return translated.loadType3Data(self, resources, task).catch(function () {}).then(function () {
40738          return translated;
40739        });
40740      }).then(function (translated) {
40741        textState.loadedName = translated.loadedName;
40742        textState.font = translated.font;
40743        textState.fontMatrix = translated.font.fontMatrix || _util.FONT_IDENTITY_MATRIX;
40744      });
40745    }
40746    function applyInverseRotation(x, y, matrix) {
40747      const scale = Math.hypot(matrix[0], matrix[1]);
40748      return [(matrix[0] * x + matrix[1] * y) / scale, (matrix[2] * x + matrix[3] * y) / scale];
40749    }
40750    function compareWithLastPosition(glyphWidth) {
40751      const currentTransform = getCurrentTextTransform();
40752      let posX = currentTransform[4];
40753      let posY = currentTransform[5];
40754      if (textState.font?.vertical) {
40755        if (posX < viewBox[0] || posX > viewBox[2] || posY + glyphWidth < viewBox[1] || posY > viewBox[3]) {
40756          return false;
40757        }
40758      } else if (posX + glyphWidth < viewBox[0] || posX > viewBox[2] || posY < viewBox[1] || posY > viewBox[3]) {
40759        return false;
40760      }
40761      if (!textState.font || !textContentItem.prevTransform) {
40762        return true;
40763      }
40764      let lastPosX = textContentItem.prevTransform[4];
40765      let lastPosY = textContentItem.prevTransform[5];
40766      if (lastPosX === posX && lastPosY === posY) {
40767        return true;
40768      }
40769      let rotate = -1;
40770      if (currentTransform[0] && currentTransform[1] === 0 && currentTransform[2] === 0) {
40771        rotate = currentTransform[0] > 0 ? 0 : 180;
40772      } else if (currentTransform[1] && currentTransform[0] === 0 && currentTransform[3] === 0) {
40773        rotate = currentTransform[1] > 0 ? 90 : 270;
40774      }
40775      switch (rotate) {
40776        case 0:
40777          break;
40778        case 90:
40779          [posX, posY] = [posY, posX];
40780          [lastPosX, lastPosY] = [lastPosY, lastPosX];
40781          break;
40782        case 180:
40783          [posX, posY, lastPosX, lastPosY] = [-posX, -posY, -lastPosX, -lastPosY];
40784          break;
40785        case 270:
40786          [posX, posY] = [-posY, -posX];
40787          [lastPosX, lastPosY] = [-lastPosY, -lastPosX];
40788          break;
40789        default:
40790          [posX, posY] = applyInverseRotation(posX, posY, currentTransform);
40791          [lastPosX, lastPosY] = applyInverseRotation(lastPosX, lastPosY, textContentItem.prevTransform);
40792      }
40793      if (textState.font.vertical) {
40794        const advanceY = (lastPosY - posY) / textContentItem.textAdvanceScale;
40795        const advanceX = posX - lastPosX;
40796        const textOrientation = Math.sign(textContentItem.height);
40797        if (advanceY < textOrientation * textContentItem.negativeSpaceMa
vendor: 6,355 bytes, lines 40797-40986
40797x) {
40798          if (Math.abs(advanceX) > 0.5 * textContentItem.width) {
40799            appendEOL();
40800            return true;
40801          }
40802          resetLastChars();
40803          flushTextContentItem();
40804          return true;
40805        }
40806        if (Math.abs(advanceX) > textContentItem.width) {
40807          appendEOL();
40808          return true;
40809        }
40810        if (advanceY <= textOrientation * textContentItem.notASpace) {
40811          resetLastChars();
40812        }
40813        if (advanceY <= textOrientation * textContentItem.trackingSpaceMin) {
40814          if (shouldAddWhitepsace()) {
40815            resetLastChars();
40816            flushTextContentItem();
40817            pushWhitespace({
40818              height: Math.abs(advanceY)
40819            });
40820          } else {
40821            textContentItem.height += advanceY;
40822          }
40823        } else if (!addFakeSpaces(advanceY, textContentItem.prevTransform, textOrientation)) {
40824          if (textContentItem.str.length === 0) {
40825            resetLastChars();
40826            pushWhitespace({
40827              height: Math.abs(advanceY)
40828            });
40829          } else {
40830            textContentItem.height += advanceY;
40831          }
40832        }
40833        if (Math.abs(advanceX) > textContentItem.width * VERTICAL_SHIFT_RATIO) {
40834          flushTextContentItem();
40835        }
40836        return true;
40837      }
40838      const advanceX = (posX - lastPosX) / textContentItem.textAdvanceScale;
40839      const advanceY = posY - lastPosY;
40840      const textOrientation = Math.sign(textContentItem.width);
40841      if (advanceX < textOrientation * textContentItem.negativeSpaceMax) {
40842        if (Math.abs(advanceY) > 0.5 * textContentItem.height) {
40843          appendEOL();
40844          return true;
40845        }
40846        resetLastChars();
40847        flushTextContentItem();
40848        return true;
40849      }
40850      if (Math.abs(advanceY) > textContentItem.height) {
40851        appendEOL();
40852        return true;
40853      }
40854      if (advanceX <= textOrientation * textContentItem.notASpace) {
40855        resetLastChars();
40856      }
40857      if (advanceX <= textOrientation * textContentItem.trackingSpaceMin) {
40858        if (shouldAddWhitepsace()) {
40859          resetLastChars();
40860          flushTextContentItem();
40861          pushWhitespace({
40862            width: Math.abs(advanceX)
40863          });
40864        } else {
40865          textContentItem.width += advanceX;
40866        }
40867      } else if (!addFakeSpaces(advanceX, textContentItem.prevTransform, textOrientation)) {
40868        if (textContentItem.str.length === 0) {
40869          resetLastChars();
40870          pushWhitespace({
40871            width: Math.abs(advanceX)
40872          });
40873        } else {
40874          textContentItem.width += advanceX;
40875        }
40876      }
40877      if (Math.abs(advanceY) > textContentItem.height * VERTICAL_SHIFT_RATIO) {
40878        flushTextContentItem();
40879      }
40880      return true;
40881    }
40882    function buildTextContentItem({
40883      chars,
40884      extraSpacing
40885    }) {
40886      const font = textState.font;
40887      if (!chars) {
40888        const charSpacing = textState.charSpacing + extraSpacing;
40889        if (charSpacing) {
40890          if (!font.vertical) {
40891            textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
40892          } else {
40893            textState.translateTextMatrix(0, -charSpacing);
40894          }
40895        }
40896        return;
40897      }
40898      const glyphs = font.charsToGlyphs(chars);
40899      const scale = textState.fontMatrix[0] * textState.fontSize;
40900      for (let i = 0, ii = glyphs.length; i < ii; i++) {
40901        const glyph = glyphs[i];
40902        const {
40903          category
40904        } = glyph;
40905        if (category.isInvisibleFormatMark) {
40906          continue;
40907        }
40908        let charSpacing = textState.charSpacing + (i + 1 === ii ? extraSpacing : 0);
40909        let glyphWidth = glyph.width;
40910        if (font.vertical) {
40911          glyphWidth = glyph.vmetric ? glyph.vmetric[0] : -glyphWidth;
40912        }
40913        let scaledDim = glyphWidth * scale;
40914        if (category.isWhitespace) {
40915          if (!font.vertical) {
40916            charSpacing += scaledDim + textState.wordSpacing;
40917            textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
40918          } else {
40919            charSpacing += -scaledDim + textState.wordSpacing;
40920            textState.translateTextMatrix(0, -charSpacing);
40921          }
40922          saveLastChar(" ");
40923          continue;
40924        }
40925        if (!category.isZeroWidthDiacritic && !compareWithLastPosition(scaledDim)) {
40926          if (!font.vertical) {
40927            textState.translateTextMatrix(scaledDim * textState.textHScale, 0);
40928          } else {
40929            textState.translateTextMatrix(0, scaledDim);
40930          }
40931          continue;
40932        }
40933        const textChunk = ensureTextContentItem();
40934        if (category.isZeroWidthDiacritic) {
40935          scaledDim = 0;
40936        }
40937        if (!font.vertical) {
40938          scaledDim *= textState.textHScale;
40939          textState.translateTextMatrix(scaledDim, 0);
40940          textChunk.width += scaledDim;
40941        } else {
40942          textState.translateTextMatrix(0, scaledDim);
40943          scaledDim = Math.abs(scaledDim);
40944          textChunk.height += scaledDim;
40945        }
40946        if (scaledDim) {
40947          textChunk.prevTransform = getCurrentTextTransform();
40948        }
40949        const glyphUnicode = glyph.unicode;
40950        if (saveLastChar(glyphUnicode)) {
40951          textChunk.str.push(" ");
40952        }
40953        textChunk.str.push(glyphUnicode);
40954        if (charSpacing) {
40955          if (!font.vertical) {
40956            textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
40957          } else {
40958            textState.translateTextMatrix(0, -charSpacing);
40959          }
40960        }
40961      }
40962    }
40963    function appendEOL() {
40964      resetLastChars();
40965      if (textContentItem.initialized) {
40966        textContentItem.hasEOL = true;
40967        flushTextContentItem();
40968      } else {
40969        textContent.items.push({
40970          str: "",
40971          dir: "ltr",
40972          width: 0,
40973          height: 0,
40974          transform: getCurrentTextTransform(),
40975          fontName: textState.loadedName,
40976          hasEOL: true
40977        });
40978      }
40979    }
40980    function addFakeSpaces(width, transf, textOrientation) {
40981      if (textOrientation * textContentItem.spaceInFlowMin <= width && width <= textOrientation * textContentItem.spaceInFlowMax) {
40982        if (textContentItem.initialized) {
40983          resetLastChars();
40984          textContentItem.str.push(" ");
40985        }
40986        return false;
vendor: 2,035 bytes, lines 40987-41052
40987      }
40988      const fontName = textContentItem.fontName;
40989      let height = 0;
40990      if (textContentItem.vertical) {
40991        height = width;
40992        width = 0;
40993      }
40994      flushTextContentItem();
40995      resetLastChars();
40996      pushWhitespace({
40997        width: Math.abs(width),
40998        height: Math.abs(height),
40999        transform: transf || getCurrentTextTransform(),
41000        fontName
41001      });
41002      return true;
41003    }
41004    function flushTextContentItem() {
41005      if (!textContentItem.initialized || !textContentItem.str) {
41006        return;
41007      }
41008      if (!textContentItem.vertical) {
41009        textContentItem.totalWidth += textContentItem.width * textContentItem.textAdvanceScale;
41010      } else {
41011        textContentItem.totalHeight += textContentItem.height * textContentItem.textAdvanceScale;
41012      }
41013      textContent.items.push(runBidiTransform(textContentItem));
41014      textContentItem.initialized = false;
41015      textContentItem.str.length = 0;
41016    }
41017    function enqueueChunk(batch = false) {
41018      const length = textContent.items.length;
41019      if (length === 0) {
41020        return;
41021      }
41022      if (batch && length < TEXT_CHUNK_BATCH_SIZE) {
41023        return;
41024      }
41025      sink.enqueue(textContent, length);
41026      textContent.items = [];
41027      textContent.styles = Object.create(null);
41028    }
41029    const timeSlotManager = new TimeSlotManager();
41030    return new Promise(function promiseBody(resolve, reject) {
41031      const next = function (promise) {
41032        enqueueChunk(true);
41033        Promise.all([promise, sink.ready]).then(function () {
41034          try {
41035            promiseBody(resolve, reject);
41036          } catch (ex) {
41037            reject(ex);
41038          }
41039        }, reject);
41040      };
41041      task.ensureNotTerminated();
41042      timeSlotManager.reset();
41043      const operation = {};
41044      let stop,
41045        args = [];
41046      while (!(stop = timeSlotManager.check())) {
41047        args.length = 0;
41048        operation.args = args;
41049        if (!preprocessor.read(operation)) {
41050          break;
41051        }
41052        const previousState = textState;
vendor: 2,463 bytes, lines 41052-41111
41052
41053        textState = stateManager.state;
41054        const fn = operation.fn;
41055        args = operation.args;
41056        switch (fn | 0) {
41057          case _util.OPS.setFont:
41058            var fontNameArg = args[0].name,
41059              fontSizeArg = args[1];
41060            if (textState.font && fontNameArg === textState.fontName && fontSizeArg === textState.fontSize) {
41061              break;
41062            }
41063            flushTextContentItem();
41064            textState.fontName = fontNameArg;
41065            textState.fontSize = fontSizeArg;
41066            next(handleSetFont(fontNameArg, null));
41067            return;
41068          case _util.OPS.setTextRise:
41069            textState.textRise = args[0];
41070            break;
41071          case _util.OPS.setHScale:
41072            textState.textHScale = args[0] / 100;
41073            break;
41074          case _util.OPS.setLeading:
41075            textState.leading = args[0];
41076            break;
41077          case _util.OPS.moveText:
41078            textState.translateTextLineMatrix(args[0], args[1]);
41079            textState.textMatrix = textState.textLineMatrix.slice();
41080            break;
41081          case _util.OPS.setLeadingMoveText:
41082            textState.leading = -args[1];
41083            textState.translateTextLineMatrix(args[0], args[1]);
41084            textState.textMatrix = textState.textLineMatrix.slice();
41085            break;
41086          case _util.OPS.nextLine:
41087            textState.carriageReturn();
41088            break;
41089          case _util.OPS.setTextMatrix:
41090            textState.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
41091            textState.setTextLineMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
41092            updateAdvanceScale();
41093            break;
41094          case _util.OPS.setCharSpacing:
41095            textState.charSpacing = args[0];
41096            break;
41097          case _util.OPS.setWordSpacing:
41098            textState.wordSpacing = args[0];
41099            break;
41100          case _util.OPS.beginText:
41101            textState.textMatrix = _util.IDENTITY_MATRIX.slice();
41102            textState.textLineMatrix = _util.IDENTITY_MATRIX.slice();
41103            break;
41104          case _util.OPS.showSpacedText:
41105            if (!stateManager.state.font) {
41106              self.ensureStateFont(stateManager.state);
41107              continue;
41108            }
41109            const spaceFactor = (textState.font.vertical ? 1 : -1) * textState.fontSize / 1000;
41110            const elements = args[0];
41111            for (let i = 0, ii = elements.length; i < ii
vendor: 17,438 bytes, lines 41111-41566
41111; i++) {
41112              const item = elements[i];
41113              if (typeof item === "string") {
41114                showSpacedTextBuffer.push(item);
41115              } else if (typeof item === "number" && item !== 0) {
41116                const str = showSpacedTextBuffer.join("");
41117                showSpacedTextBuffer.length = 0;
41118                buildTextContentItem({
41119                  chars: str,
41120                  extraSpacing: item * spaceFactor
41121                });
41122              }
41123            }
41124            if (showSpacedTextBuffer.length > 0) {
41125              const str = showSpacedTextBuffer.join("");
41126              showSpacedTextBuffer.length = 0;
41127              buildTextContentItem({
41128                chars: str,
41129                extraSpacing: 0
41130              });
41131            }
41132            break;
41133          case _util.OPS.showText:
41134            if (!stateManager.state.font) {
41135              self.ensureStateFont(stateManager.state);
41136              continue;
41137            }
41138            buildTextContentItem({
41139              chars: args[0],
41140              extraSpacing: 0
41141            });
41142            break;
41143          case _util.OPS.nextLineShowText:
41144            if (!stateManager.state.font) {
41145              self.ensureStateFont(stateManager.state);
41146              continue;
41147            }
41148            textState.carriageReturn();
41149            buildTextContentItem({
41150              chars: args[0],
41151              extraSpacing: 0
41152            });
41153            break;
41154          case _util.OPS.nextLineSetSpacingShowText:
41155            if (!stateManager.state.font) {
41156              self.ensureStateFont(stateManager.state);
41157              continue;
41158            }
41159            textState.wordSpacing = args[0];
41160            textState.charSpacing = args[1];
41161            textState.carriageReturn();
41162            buildTextContentItem({
41163              chars: args[2],
41164              extraSpacing: 0
41165            });
41166            break;
41167          case _util.OPS.paintXObject:
41168            flushTextContentItem();
41169            if (!xobjs) {
41170              xobjs = resources.get("XObject") || _primitives.Dict.empty;
41171            }
41172            var isValidName = args[0] instanceof _primitives.Name;
41173            var name = args[0].name;
41174            if (isValidName && emptyXObjectCache.getByName(name)) {
41175              break;
41176            }
41177            next(new Promise(function (resolveXObject, rejectXObject) {
41178              if (!isValidName) {
41179                throw new _util.FormatError("XObject must be referred to by name.");
41180              }
41181              let xobj = xobjs.getRaw(name);
41182              if (xobj instanceof _primitives.Ref) {
41183                if (emptyXObjectCache.getByRef(xobj)) {
41184                  resolveXObject();
41185                  return;
41186                }
41187                const globalImage = self.globalImageCache.getData(xobj, self.pageIndex);
41188                if (globalImage) {
41189                  resolveXObject();
41190                  return;
41191                }
41192                xobj = xref.fetch(xobj);
41193              }
41194              if (!(xobj instanceof _base_stream.BaseStream)) {
41195                throw new _util.FormatError("XObject should be a stream");
41196              }
41197              const type = xobj.dict.get("Subtype");
41198              if (!(type instanceof _primitives.Name)) {
41199                throw new _util.FormatError("XObject should have a Name subtype");
41200              }
41201              if (type.name !== "Form") {
41202                emptyXObjectCache.set(name, xobj.dict.objId, true);
41203                resolveXObject();
41204                return;
41205              }
41206              const currentState = stateManager.state.clone();
41207              const xObjStateManager = new StateManager(currentState);
41208              const matrix = xobj.dict.getArray("Matrix");
41209              if (Array.isArray(matrix) && matrix.length === 6) {
41210                xObjStateManager.transform(matrix);
41211              }
41212              enqueueChunk();
41213              const sinkWrapper = {
41214                enqueueInvoked: false,
41215                enqueue(chunk, size) {
41216                  this.enqueueInvoked = true;
41217                  sink.enqueue(chunk, size);
41218                },
41219                get desiredSize() {
41220                  return sink.desiredSize;
41221                },
41222                get ready() {
41223                  return sink.ready;
41224                }
41225              };
41226              self.getTextContent({
41227                stream: xobj,
41228                task,
41229                resources: xobj.dict.get("Resources") || resources,
41230                stateManager: xObjStateManager,
41231                includeMarkedContent,
41232                sink: sinkWrapper,
41233                seenStyles,
41234                viewBox,
41235                markedContentData,
41236                disableNormalization
41237              }).then(function () {
41238                if (!sinkWrapper.enqueueInvoked) {
41239                  emptyXObjectCache.set(name, xobj.dict.objId, true);
41240                }
41241                resolveXObject();
41242              }, rejectXObject);
41243            }).catch(function (reason) {
41244              if (reason instanceof _util.AbortException) {
41245                return;
41246              }
41247              if (self.options.ignoreErrors) {
41248                (0, _util.warn)(`getTextContent - ignoring XObject: "${reason}".`);
41249                return;
41250              }
41251              throw reason;
41252            }));
41253            return;
41254          case _util.OPS.setGState:
41255            isValidName = args[0] instanceof _primitives.Name;
41256            name = args[0].name;
41257            if (isValidName && emptyGStateCache.getByName(name)) {
41258              break;
41259            }
41260            next(new Promise(function (resolveGState, rejectGState) {
41261              if (!isValidName) {
41262                throw new _util.FormatError("GState must be referred to by name.");
41263              }
41264              const extGState = resources.get("ExtGState");
41265              if (!(extGState instanceof _primitives.Dict)) {
41266                throw new _util.FormatError("ExtGState should be a dictionary.");
41267              }
41268              const gState = extGState.get(name);
41269              if (!(gState instanceof _primitives.Dict)) {
41270                throw new _util.FormatError("GState should be a dictionary.");
41271              }
41272              const gStateFont = gState.get("Font");
41273              if (!gStateFont) {
41274                emptyGStateCache.set(name, gState.objId, true);
41275                resolveGState();
41276                return;
41277              }
41278              flushTextContentItem();
41279              textState.fontName = null;
41280              textState.fontSize = gStateFont[1];
41281              handleSetFont(null, gStateFont[0]).then(resolveGState, rejectGState);
41282            }).catch(function (reason) {
41283              if (reason instanceof _util.AbortException) {
41284                return;
41285              }
41286              if (self.options.ignoreErrors) {
41287                (0, _util.warn)(`getTextContent - ignoring ExtGState: "${reason}".`);
41288                return;
41289              }
41290              throw reason;
41291            }));
41292            return;
41293          case _util.OPS.beginMarkedContent:
41294            flushTextContentItem();
41295            if (includeMarkedContent) {
41296              markedContentData.level++;
41297              textContent.items.push({
41298                type: "beginMarkedContent",
41299                tag: args[0] instanceof _primitives.Name ? args[0].name : null
41300              });
41301            }
41302            break;
41303          case _util.OPS.beginMarkedContentProps:
41304            flushTextContentItem();
41305            if (includeMarkedContent) {
41306              markedContentData.level++;
41307              let mcid = null;
41308              if (args[1] instanceof _primitives.Dict) {
41309                mcid = args[1].get("MCID");
41310              }
41311              textContent.items.push({
41312                type: "beginMarkedContentProps",
41313                id: Number.isInteger(mcid) ? `${self.idFactory.getPageObjId()}_mc${mcid}` : null,
41314                tag: args[0] instanceof _primitives.Name ? args[0].name : null
41315              });
41316            }
41317            break;
41318          case _util.OPS.endMarkedContent:
41319            flushTextContentItem();
41320            if (includeMarkedContent) {
41321              if (markedContentData.level === 0) {
41322                break;
41323              }
41324              markedContentData.level--;
41325              textContent.items.push({
41326                type: "endMarkedContent"
41327              });
41328            }
41329            break;
41330          case _util.OPS.restore:
41331            if (previousState && (previousState.font !== textState.font || previousState.fontSize !== textState.fontSize || previousState.fontName !== textState.fontName)) {
41332              flushTextContentItem();
41333            }
41334            break;
41335        }
41336        if (textContent.items.length >= sink.desiredSize) {
41337          stop = true;
41338          break;
41339        }
41340      }
41341      if (stop) {
41342        next(deferred);
41343        return;
41344      }
41345      flushTextContentItem();
41346      enqueueChunk();
41347      resolve();
41348    }).catch(reason => {
41349      if (reason instanceof _util.AbortException) {
41350        return;
41351      }
41352      if (this.options.ignoreErrors) {
41353        (0, _util.warn)(`getTextContent - ignoring errors during "${task.name}" ` + `task: "${reason}".`);
41354        flushTextContentItem();
41355        enqueueChunk();
41356        return;
41357      }
41358      throw reason;
41359    });
41360  }
41361  extractDataStructures(dict, baseDict, properties) {
41362    const xref = this.xref;
41363    let cidToGidBytes;
41364    const toUnicodePromise = this.readToUnicode(properties.toUnicode || dict.get("ToUnicode") || baseDict.get("ToUnicode"));
41365    if (properties.composite) {
41366      const cidSystemInfo = dict.get("CIDSystemInfo");
41367      if (cidSystemInfo instanceof _primitives.Dict) {
41368        properties.cidSystemInfo = {
41369          registry: (0, _util.stringToPDFString)(cidSystemInfo.get("Registry")),
41370          ordering: (0, _util.stringToPDFString)(cidSystemInfo.get("Ordering")),
41371          supplement: cidSystemInfo.get("Supplement")
41372        };
41373      }
41374      try {
41375        const cidToGidMap = dict.get("CIDToGIDMap");
41376        if (cidToGidMap instanceof _base_stream.BaseStream) {
41377          cidToGidBytes = cidToGidMap.getBytes();
41378        }
41379      } catch (ex) {
41380        if (!this.options.ignoreErrors) {
41381          throw ex;
41382        }
41383        (0, _util.warn)(`extractDataStructures - ignoring CIDToGIDMap data: "${ex}".`);
41384      }
41385    }
41386    const differences = [];
41387    let baseEncodingName = null;
41388    let encoding;
41389    if (dict.has("Encoding")) {
41390      encoding = dict.get("Encoding");
41391      if (encoding instanceof _primitives.Dict) {
41392        baseEncodingName = encoding.get("BaseEncoding");
41393        baseEncodingName = baseEncodingName instanceof _primitives.Name ? baseEncodingName.name : null;
41394        if (encoding.has("Differences")) {
41395          const diffEncoding = encoding.get("Differences");
41396          let index = 0;
41397          for (const entry of diffEncoding) {
41398            const data = xref.fetchIfRef(entry);
41399            if (typeof data === "number") {
41400              index = data;
41401            } else if (data instanceof _primitives.Name) {
41402              differences[index++] = data.name;
41403            } else {
41404              throw new _util.FormatError(`Invalid entry in 'Differences' array: ${data}`);
41405            }
41406          }
41407        }
41408      } else if (encoding instanceof _primitives.Name) {
41409        baseEncodingName = encoding.name;
41410      } else {
41411        const msg = "Encoding is not a Name nor a Dict";
41412        if (!this.options.ignoreErrors) {
41413          throw new _util.FormatError(msg);
41414        }
41415        (0, _util.warn)(msg);
41416      }
41417      if (baseEncodingName !== "MacRomanEncoding" && baseEncodingName !== "MacExpertEncoding" && baseEncodingName !== "WinAnsiEncoding") {
41418        baseEncodingName = null;
41419      }
41420    }
41421    const nonEmbeddedFont = !properties.file || properties.isInternalFont,
41422      isSymbolsFontName = (0, _standard_fonts.getSymbolsFonts)()[properties.name];
41423    if (baseEncodingName && nonEmbeddedFont && isSymbolsFontName) {
41424      baseEncodingName = null;
41425    }
41426    if (baseEncodingName) {
41427      properties.defaultEncoding = (0, _encodings.getEncoding)(baseEncodingName);
41428    } else {
41429      const isSymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Symbolic);
41430      const isNonsymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Nonsymbolic);
41431      encoding = _encodings.StandardEncoding;
41432      if (properties.type === "TrueType" && !isNonsymbolicFont) {
41433        encoding = _encodings.WinAnsiEncoding;
41434      }
41435      if (isSymbolicFont || isSymbolsFontName) {
41436        encoding = _encodings.MacRomanEncoding;
41437        if (nonEmbeddedFont) {
41438          if (/Symbol/i.test(properties.name)) {
41439            encoding = _encodings.SymbolSetEncoding;
41440          } else if (/Dingbats/i.test(properties.name)) {
41441            encoding = _encodings.ZapfDingbatsEncoding;
41442          } else if (/Wingdings/i.test(properties.name)) {
41443            encoding = _encodings.WinAnsiEncoding;
41444          }
41445        }
41446      }
41447      properties.defaultEncoding = encoding;
41448    }
41449    properties.differences = differences;
41450    properties.baseEncodingName = baseEncodingName;
41451    properties.hasEncoding = !!baseEncodingName || differences.length > 0;
41452    properties.dict = dict;
41453    return toUnicodePromise.then(readToUnicode => {
41454      properties.toUnicode = readToUnicode;
41455      return this.buildToUnicode(properties);
41456    }).then(builtToUnicode => {
41457      properties.toUnicode = builtToUnicode;
41458      if (cidToGidBytes) {
41459        properties.cidToGidMap = this.readCidToGidMap(cidToGidBytes, builtToUnicode);
41460      }
41461      return properties;
41462    });
41463  }
41464  _simpleFontToUnicode(properties, forceGlyphs = false) {
41465    (0, _util.assert)(!properties.composite, "Must be a simple font.");
41466    const toUnicode = [];
41467    const encoding = properties.defaultEncoding.slice();
41468    const baseEncodingName = properties.baseEncodingName;
41469    const differences = properties.differences;
41470    for (const charcode in differences) {
41471      const glyphName = differences[charcode];
41472      if (glyphName === ".notdef") {
41473        continue;
41474      }
41475      encoding[charcode] = glyphName;
41476    }
41477    const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
41478    for (const charcode in encoding) {
41479      let glyphName = encoding[charcode];
41480      if (glyphName === "") {
41481        continue;
41482      }
41483      let unicode = glyphsUnicodeMap[glyphName];
41484      if (unicode !== undefined) {
41485        toUnicode[charcode] = String.fromCharCode(unicode);
41486        continue;
41487      }
41488      let code = 0;
41489      switch (glyphName[0]) {
41490        case "G":
41491          if (glyphName.length === 3) {
41492            code = parseInt(glyphName.substring(1), 16);
41493          }
41494          break;
41495        case "g":
41496          if (glyphName.length === 5) {
41497            code = parseInt(glyphName.substring(1), 16);
41498          }
41499          break;
41500        case "C":
41501        case "c":
41502          if (glyphName.length >= 3 && glyphName.length <= 4) {
41503            const codeStr = glyphName.substring(1);
41504            if (forceGlyphs) {
41505              code = parseInt(codeStr, 16);
41506              break;
41507            }
41508            code = +codeStr;
41509            if (Number.isNaN(code) && Number.isInteger(parseInt(codeStr, 16))) {
41510              return this._simpleFontToUnicode(properties, true);
41511            }
41512          }
41513          break;
41514        case "u":
41515          unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
41516          if (unicode !== -1) {
41517            code = unicode;
41518          }
41519          break;
41520        default:
41521          switch (glyphName) {
41522            case "f_h":
41523            case "f_t":
41524            case "T_h":
41525              toUnicode[charcode] = glyphName.replaceAll("_", "");
41526              continue;
41527          }
41528          break;
41529      }
41530      if (code > 0 && code <= 0x10ffff && Number.isInteger(code)) {
41531        if (baseEncodingName && code === +charcode) {
41532          const baseEncoding = (0, _encodings.getEncoding)(baseEncodingName);
41533          if (baseEncoding && (glyphName = baseEncoding[charcode])) {
41534            toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
41535            continue;
41536          }
41537        }
41538        toUnicode[charcode] = String.fromCodePoint(code);
41539      }
41540    }
41541    return toUnicode;
41542  }
41543  async buildToUnicode(properties) {
41544    properties.hasIncludedToUnicodeMap = properties.toUnicode?.length > 0;
41545    if (properties.hasIncludedToUnicodeMap) {
41546      if (!properties.composite && properties.hasEncoding) {
41547        properties.fallbackToUnicode = this._simpleFontToUnicode(properties);
41548      }
41549      return properties.toUnicode;
41550    }
41551    if (!properties.composite) {
41552      return new _to_unicode_map.ToUnicodeMap(this._simpleFontToUnicode(properties));
41553    }
41554    if (properties.composite && (properties.cMap.builtInCMap && !(properties.cMap instanceof _cmap.IdentityCMap) || properties.cidSystemInfo.registry === "Adobe" && (properties.cidSystemInfo.ordering === "GB1" || properties.cidSystemInfo.ordering === "CNS1" || properties.cidSystemInfo.ordering === "Japan1" || properties.cidSystemInfo.ordering === "Korea1"))) {
41555      const {
41556        registry,
41557        ordering
41558      } = properties.cidSystemInfo;
41559      const ucs2CMapName = _primitives.Name.get(`${registry}-${ordering}-UCS2`);
41560      const ucs2CMap = await _cmap.CMapFactory.create({
41561        encoding: ucs2CMapName,
41562        fetchBuiltInCMap: this._fetchBuiltInCMapBound,
41563        useCMap: null
41564      });
41565      const toUnicode = [],
41566        buf = [];
41567      properties.cMap.forEach(function (charcode, cid) {
41568        if (cid > 0xffff) {
41569          throw new _util.FormatError("Max size of CID is 65,535");
41570        }
41571        const ucs2 = ucs2CMap.lookup(cid);
41572        if (ucs2) {
41573          buf.length = 0;
41574          for (let i = 0, ii = ucs2.length; i < ii; i += 2) {
41575            buf.push((ucs2.charCodeAt(i) << 8) + ucs2.charCodeAt(i + 1));
41576          }
41577          toUnicode[charcode] = String.fromCharCode(...buf);
41578        }
41579      });
41580      return new _to_unicode_map.ToUnicodeMap(toUnicode);
41581    }
41582    return new _to_unicode_map.IdentityToUnicodeMap(properties.firstChar, properties.lastChar);
41583  }
41584  readToUnicode(cmapObj) {
41585    if (!cmapObj) {
41586      return Promise.resolve(null);
41587    }
41588    if (cmapObj instanceof _primitives.Name) {
41589      return _cmap.CMapFactory.create({
41590        encoding: cmapObj,
41591        fetchBuiltInCMap: this._fetchBuiltInCMapBound,
41592        useCMap: null
41593      }).then(function (cmap) {
41594        if (cmap instanceof _cmap.IdentityCMap) {
41595          return new _to_unicode_map.IdentityToUnicodeMap(0, 0xffff);
41596        }
41597        return new _to_unicode_map.ToUnicodeMap(cmap.getMap());
41598      });
41599    } else if (cmapObj instanceof _base_stream.BaseStream) {
41600      return _cmap.CMapFactory.create({
41601        encoding: cmapObj,
41602        fetchBuiltInCMap: this._fetchBuiltInCMapBound,
41603        useCMap: null
41604      }).then(function (cmap) {
41605        if (cmap instanceof _cmap.IdentityCMap) {
41606          return new _to_unicode_map.IdentityToUnicodeMap(0, 0xffff);
41607        }
41608        const map = new Array(cmap.length);
41609        cmap.forEach(function (charCode, token) {
41610          if (typeof token === "number") {
41611            map[charCode] = String.fromCodePoint(token);
41612            return;
41613          }
41614          const str = [];
41615          for (let k = 0; k < token.length; k += 2) {
vendor: 18,358 bytes, lines 41616-42107
41616            const w1 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
41617            if ((w1 & 0xf800) !== 0xd800) {
41618              str.push(w1);
41619              continue;
41620            }
41621            k += 2;
41622            const w2 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
41623            str.push(((w1 & 0x3ff) << 10) + (w2 & 0x3ff) + 0x10000);
41624          }
41625          map[charCode] = String.fromCodePoint(...str);
41626        });
41627        return new _to_unicode_map.ToUnicodeMap(map);
41628      }, reason => {
41629        if (reason instanceof _util.AbortException) {
41630          return null;
41631        }
41632        if (this.options.ignoreErrors) {
41633          (0, _util.warn)(`readToUnicode - ignoring ToUnicode data: "${reason}".`);
41634          return null;
41635        }
41636        throw reason;
41637      });
41638    }
41639    return Promise.resolve(null);
41640  }
41641  readCidToGidMap(glyphsData, toUnicode) {
41642    const result = [];
41643    for (let j = 0, jj = glyphsData.length; j < jj; j++) {
41644      const glyphID = glyphsData[j++] << 8 | glyphsData[j];
41645      const code = j >> 1;
41646      if (glyphID === 0 && !toUnicode.has(code)) {
41647        continue;
41648      }
41649      result[code] = glyphID;
41650    }
41651    return result;
41652  }
41653  extractWidths(dict, descriptor, properties) {
41654    const xref = this.xref;
41655    let glyphsWidths = [];
41656    let defaultWidth = 0;
41657    const glyphsVMetrics = [];
41658    let defaultVMetrics;
41659    let i, ii, j, jj, start, code, widths;
41660    if (properties.composite) {
41661      defaultWidth = dict.has("DW") ? dict.get("DW") : 1000;
41662      widths = dict.get("W");
41663      if (widths) {
41664        for (i = 0, ii = widths.length; i < ii; i++) {
41665          start = xref.fetchIfRef(widths[i++]);
41666          code = xref.fetchIfRef(widths[i]);
41667          if (Array.isArray(code)) {
41668            for (j = 0, jj = code.length; j < jj; j++) {
41669              glyphsWidths[start++] = xref.fetchIfRef(code[j]);
41670            }
41671          } else {
41672            const width = xref.fetchIfRef(widths[++i]);
41673            for (j = start; j <= code; j++) {
41674              glyphsWidths[j] = width;
41675            }
41676          }
41677        }
41678      }
41679      if (properties.vertical) {
41680        let vmetrics = dict.getArray("DW2") || [880, -1000];
41681        defaultVMetrics = [vmetrics[1], defaultWidth * 0.5, vmetrics[0]];
41682        vmetrics = dict.get("W2");
41683        if (vmetrics) {
41684          for (i = 0, ii = vmetrics.length; i < ii; i++) {
41685            start = xref.fetchIfRef(vmetrics[i++]);
41686            code = xref.fetchIfRef(vmetrics[i]);
41687            if (Array.isArray(code)) {
41688              for (j = 0, jj = code.length; j < jj; j++) {
41689                glyphsVMetrics[start++] = [xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j])];
41690              }
41691            } else {
41692              const vmetric = [xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i])];
41693              for (j = start; j <= code; j++) {
41694                glyphsVMetrics[j] = vmetric;
41695              }
41696            }
41697          }
41698        }
41699      }
41700    } else {
41701      const firstChar = properties.firstChar;
41702      widths = dict.get("Widths");
41703      if (widths) {
41704        j = firstChar;
41705        for (i = 0, ii = widths.length; i < ii; i++) {
41706          glyphsWidths[j++] = xref.fetchIfRef(widths[i]);
41707        }
41708        defaultWidth = parseFloat(descriptor.get("MissingWidth")) || 0;
41709      } else {
41710        const baseFontName = dict.get("BaseFont");
41711        if (baseFontName instanceof _primitives.Name) {
41712          const metrics = this.getBaseFontMetrics(baseFontName.name);
41713          glyphsWidths = this.buildCharCodeToWidth(metrics.widths, properties);
41714          defaultWidth = metrics.defaultWidth;
41715        }
41716      }
41717    }
41718    let isMonospace = true;
41719    let firstWidth = defaultWidth;
41720    for (const glyph in glyphsWidths) {
41721      const glyphWidth = glyphsWidths[glyph];
41722      if (!glyphWidth) {
41723        continue;
41724      }
41725      if (!firstWidth) {
41726        firstWidth = glyphWidth;
41727        continue;
41728      }
41729      if (firstWidth !== glyphWidth) {
41730        isMonospace = false;
41731        break;
41732      }
41733    }
41734    if (isMonospace) {
41735      properties.flags |= _fonts_utils.FontFlags.FixedPitch;
41736    } else {
41737      properties.flags &= ~_fonts_utils.FontFlags.FixedPitch;
41738    }
41739    properties.defaultWidth = defaultWidth;
41740    properties.widths = glyphsWidths;
41741    properties.defaultVMetrics = defaultVMetrics;
41742    properties.vmetrics = glyphsVMetrics;
41743  }
41744  isSerifFont(baseFontName) {
41745    const fontNameWoStyle = baseFontName.split("-")[0];
41746    return fontNameWoStyle in (0, _standard_fonts.getSerifFonts)() || /serif/gi.test(fontNameWoStyle);
41747  }
41748  getBaseFontMetrics(name) {
41749    let defaultWidth = 0;
41750    let widths = Object.create(null);
41751    let monospace = false;
41752    const stdFontMap = (0, _standard_fonts.getStdFontMap)();
41753    let lookupName = stdFontMap[name] || name;
41754    const Metrics = (0, _metrics.getMetrics)();
41755    if (!(lookupName in Metrics)) {
41756      lookupName = this.isSerifFont(name) ? "Times-Roman" : "Helvetica";
41757    }
41758    const glyphWidths = Metrics[lookupName];
41759    if (typeof glyphWidths === "number") {
41760      defaultWidth = glyphWidths;
41761      monospace = true;
41762    } else {
41763      widths = glyphWidths();
41764    }
41765    return {
41766      defaultWidth,
41767      monospace,
41768      widths
41769    };
41770  }
41771  buildCharCodeToWidth(widthsByGlyphName, properties) {
41772    const widths = Object.create(null);
41773    const differences = properties.differences;
41774    const encoding = properties.defaultEncoding;
41775    for (let charCode = 0; charCode < 256; charCode++) {
41776      if (charCode in differences && widthsByGlyphName[differences[charCode]]) {
41777        widths[charCode] = widthsByGlyphName[differences[charCode]];
41778        continue;
41779      }
41780      if (charCode in encoding && widthsByGlyphName[encoding[charCode]]) {
41781        widths[charCode] = widthsByGlyphName[encoding[charCode]];
41782        continue;
41783      }
41784    }
41785    return widths;
41786  }
41787  preEvaluateFont(dict) {
41788    const baseDict = dict;
41789    let type = dict.get("Subtype");
41790    if (!(type instanceof _primitives.Name)) {
41791      throw new _util.FormatError("invalid font Subtype");
41792    }
41793    let composite = false;
41794    let hash, toUnicode;
41795    if (type.name === "Type0") {
41796      const df = dict.get("DescendantFonts");
41797      if (!df) {
41798        throw new _util.FormatError("Descendant fonts are not specified");
41799      }
41800      dict = Array.isArray(df) ? this.xref.fetchIfRef(df[0]) : df;
41801      if (!(dict instanceof _primitives.Dict)) {
41802        throw new _util.FormatError("Descendant font is not a dictionary.");
41803      }
41804      type = dict.get("Subtype");
41805      if (!(type instanceof _primitives.Name)) {
41806        throw new _util.FormatError("invalid font Subtype");
41807      }
41808      composite = true;
41809    }
41810    const firstChar = dict.get("FirstChar") || 0,
41811      lastChar = dict.get("LastChar") || (composite ? 0xffff : 0xff);
41812    const descriptor = dict.get("FontDescriptor");
41813    if (descriptor) {
41814      hash = new _murmurhash.MurmurHash3_64();
41815      const encoding = baseDict.getRaw("Encoding");
41816      if (encoding instanceof _primitives.Name) {
41817        hash.update(encoding.name);
41818      } else if (encoding instanceof _primitives.Ref) {
41819        hash.update(encoding.toString());
41820      } else if (encoding instanceof _primitives.Dict) {
41821        for (const entry of encoding.getRawValues()) {
41822          if (entry instanceof _primitives.Name) {
41823            hash.update(entry.name);
41824          } else if (entry instanceof _primitives.Ref) {
41825            hash.update(entry.toString());
41826          } else if (Array.isArray(entry)) {
41827            const diffLength = entry.length,
41828              diffBuf = new Array(diffLength);
41829            for (let j = 0; j < diffLength; j++) {
41830              const diffEntry = entry[j];
41831              if (diffEntry instanceof _primitives.Name) {
41832                diffBuf[j] = diffEntry.name;
41833              } else if (typeof diffEntry === "number" || diffEntry instanceof _primitives.Ref) {
41834                diffBuf[j] = diffEntry.toString();
41835              }
41836            }
41837            hash.update(diffBuf.join());
41838          }
41839        }
41840      }
41841      hash.update(`${firstChar}-${lastChar}`);
41842      toUnicode = dict.get("ToUnicode") || baseDict.get("ToUnicode");
41843      if (toUnicode instanceof _base_stream.BaseStream) {
41844        const stream = toUnicode.str || toUnicode;
41845        const uint8array = stream.buffer ? new Uint8Array(stream.buffer.buffer, 0, stream.bufferLength) : new Uint8Array(stream.bytes.buffer, stream.start, stream.end - stream.start);
41846        hash.update(uint8array);
41847      } else if (toUnicode instanceof _primitives.Name) {
41848        hash.update(toUnicode.name);
41849      }
41850      const widths = dict.get("Widths") || baseDict.get("Widths");
41851      if (Array.isArray(widths)) {
41852        const widthsBuf = [];
41853        for (const entry of widths) {
41854          if (typeof entry === "number" || entry instanceof _primitives.Ref) {
41855            widthsBuf.push(entry.toString());
41856          }
41857        }
41858        hash.update(widthsBuf.join());
41859      }
41860      if (composite) {
41861        hash.update("compositeFont");
41862        const compositeWidths = dict.get("W") || baseDict.get("W");
41863        if (Array.isArray(compositeWidths)) {
41864          const widthsBuf = [];
41865          for (const entry of compositeWidths) {
41866            if (typeof entry === "number" || entry instanceof _primitives.Ref) {
41867              widthsBuf.push(entry.toString());
41868            } else if (Array.isArray(entry)) {
41869              const subWidthsBuf = [];
41870              for (const element of entry) {
41871                if (typeof element === "number" || element instanceof _primitives.Ref) {
41872                  subWidthsBuf.push(element.toString());
41873                }
41874              }
41875              widthsBuf.push(`[${subWidthsBuf.join()}]`);
41876            }
41877          }
41878          hash.update(widthsBuf.join());
41879        }
41880        const cidToGidMap = dict.getRaw("CIDToGIDMap") || baseDict.getRaw("CIDToGIDMap");
41881        if (cidToGidMap instanceof _primitives.Name) {
41882          hash.update(cidToGidMap.name);
41883        } else if (cidToGidMap instanceof _primitives.Ref) {
41884          hash.update(cidToGidMap.toString());
41885        } else if (cidToGidMap instanceof _base_stream.BaseStream) {
41886          hash.update(cidToGidMap.peekBytes());
41887        }
41888      }
41889    }
41890    return {
41891      descriptor,
41892      dict,
41893      baseDict,
41894      composite,
41895      type: type.name,
41896      firstChar,
41897      lastChar,
41898      toUnicode,
41899      hash: hash ? hash.hexdigest() : ""
41900    };
41901  }
41902  async translateFont({
41903    descriptor,
41904    dict,
41905    baseDict,
41906    composite,
41907    type,
41908    firstChar,
41909    lastChar,
41910    toUnicode,
41911    cssFontInfo
41912  }) {
41913    const isType3Font = type === "Type3";
41914    let properties;
41915    if (!descriptor) {
41916      if (isType3Font) {
41917        descriptor = new _primitives.Dict(null);
41918        descriptor.set("FontName", _primitives.Name.get(type));
41919        descriptor.set("FontBBox", dict.getArray("FontBBox") || [0, 0, 0, 0]);
41920      } else {
41921        let baseFontName = dict.get("BaseFont");
41922        if (!(baseFontName instanceof _primitives.Name)) {
41923          throw new _util.FormatError("Base font is not specified");
41924        }
41925        baseFontName = baseFontName.name.replaceAll(/[,_]/g, "-");
41926        const metrics = this.getBaseFontMetrics(baseFontName);
41927        const fontNameWoStyle = baseFontName.split("-")[0];
41928        const flags = (this.isSerifFont(fontNameWoStyle) ? _fonts_utils.FontFlags.Serif : 0) | (metrics.monospace ? _fonts_utils.FontFlags.FixedPitch : 0) | ((0, _standard_fonts.getSymbolsFonts)()[fontNameWoStyle] ? _fonts_utils.FontFlags.Symbolic : _fonts_utils.FontFlags.Nonsymbolic);
41929        properties = {
41930          type,
41931          name: baseFontName,
41932          loadedName: baseDict.loadedName,
41933          systemFontInfo: null,
41934          widths: metrics.widths,
41935          defaultWidth: metrics.defaultWidth,
41936          isSimulatedFlags: true,
41937          flags,
41938          firstChar,
41939          lastChar,
41940          toUnicode,
41941          xHeight: 0,
41942          capHeight: 0,
41943          italicAngle: 0,
41944          isType3Font
41945        };
41946        const widths = dict.get("Widths");
41947        const standardFontName = (0, _standard_fonts.getStandardFontName)(baseFontName);
41948        let file = null;
41949        if (standardFontName) {
41950          file = await this.fetchStandardFontData(standardFontName);
41951          properties.isInternalFont = !!file;
41952        }
41953        if (!properties.isInternalFont && this.options.useSystemFonts) {
41954          properties.systemFontInfo = (0, _font_substitutions.getFontSubstitution)(this.systemFontCache, this.idFactory, this.options.standardFontDataUrl, baseFontName, standardFontName);
41955        }
41956        return this.extractDataStructures(dict, dict, properties).then(newProperties => {
41957          if (widths) {
41958            const glyphWidths = [];
41959            let j = firstChar;
41960            for (const width of widths) {
41961              glyphWidths[j++] = this.xref.fetchIfRef(width);
41962            }
41963            newProperties.widths = glyphWidths;
41964          } else {
41965            newProperties.widths = this.buildCharCodeToWidth(metrics.widths, newProperties);
41966          }
41967          return new _fonts.Font(baseFontName, file, newProperties);
41968        });
41969      }
41970    }
41971    let fontName = descriptor.get("FontName");
41972    let baseFont = dict.get("BaseFont");
41973    if (typeof fontName === "string") {
41974      fontName = _primitives.Name.get(fontName);
41975    }
41976    if (typeof baseFont === "string") {
41977      baseFont = _primitives.Name.get(baseFont);
41978    }
41979    const fontNameStr = fontName?.name;
41980    const baseFontStr = baseFont?.name;
41981    if (!isType3Font && fontNameStr !== baseFontStr) {
41982      (0, _util.info)(`The FontDescriptor's FontName is "${fontNameStr}" but ` + `should be the same as the Font's BaseFont "${baseFontStr}".`);
41983      if (fontNameStr && baseFontStr && (baseFontStr.startsWith(fontNameStr) || !(0, _standard_fonts.isKnownFontName)(fontNameStr) && (0, _standard_fonts.isKnownFontName)(baseFontStr))) {
41984        fontName = null;
41985      }
41986    }
41987    fontName ||= baseFont;
41988    if (!(fontName instanceof _primitives.Name)) {
41989      throw new _util.FormatError("invalid font name");
41990    }
41991    let fontFile, subtype, length1, length2, length3;
41992    try {
41993      fontFile = descriptor.get("FontFile", "FontFile2", "FontFile3");
41994    } catch (ex) {
41995      if (!this.options.ignoreErrors) {
41996        throw ex;
41997      }
41998      (0, _util.warn)(`translateFont - fetching "${fontName.name}" font file: "${ex}".`);
41999      fontFile = new _stream.NullStream();
42000    }
42001    let isInternalFont = false;
42002    let glyphScaleFactors = null;
42003    let systemFontInfo = null;
42004    if (fontFile) {
42005      if (fontFile.dict) {
42006        const subtypeEntry = fontFile.dict.get("Subtype");
42007        if (subtypeEntry instanceof _primitives.Name) {
42008          subtype = subtypeEntry.name;
42009        }
42010        length1 = fontFile.dict.get("Length1");
42011        length2 = fontFile.dict.get("Length2");
42012        length3 = fontFile.dict.get("Length3");
42013      }
42014    } else if (cssFontInfo) {
42015      const standardFontName = (0, _xfa_fonts.getXfaFontName)(fontName.name);
42016      if (standardFontName) {
42017        cssFontInfo.fontFamily = `${cssFontInfo.fontFamily}-PdfJS-XFA`;
42018        cssFontInfo.metrics = standardFontName.metrics || null;
42019        glyphScaleFactors = standardFontName.factors || null;
42020        fontFile = await this.fetchStandardFontData(standardFontName.name);
42021        isInternalFont = !!fontFile;
42022        baseDict = dict = (0, _xfa_fonts.getXfaFontDict)(fontName.name);
42023        composite = true;
42024      }
42025    } else if (!isType3Font) {
42026      const standardFontName = (0, _standard_fonts.getStandardFontName)(fontName.name);
42027      if (standardFontName) {
42028        fontFile = await this.fetchStandardFontData(standardFontName);
42029        isInternalFont = !!fontFile;
42030      }
42031      if (!isInternalFont && this.options.useSystemFonts) {
42032        systemFontInfo = (0, _font_substitutions.getFontSubstitution)(this.systemFontCache, this.idFactory, this.options.standardFontDataUrl, fontName.name, standardFontName);
42033      }
42034    }
42035    properties = {
42036      type,
42037      name: fontName.name,
42038      subtype,
42039      file: fontFile,
42040      length1,
42041      length2,
42042      length3,
42043      isInternalFont,
42044      loadedName: baseDict.loadedName,
42045      composite,
42046      fixedPitch: false,
42047      fontMatrix: dict.getArray("FontMatrix") || _util.FONT_IDENTITY_MATRIX,
42048      firstChar,
42049      lastChar,
42050      toUnicode,
42051      bbox: descriptor.getArray("FontBBox") || dict.getArray("FontBBox"),
42052      ascent: descriptor.get("Ascent"),
42053      descent: descriptor.get("Descent"),
42054      xHeight: descriptor.get("XHeight") || 0,
42055      capHeight: descriptor.get("CapHeight") || 0,
42056      flags: descriptor.get("Flags"),
42057      italicAngle: descriptor.get("ItalicAngle") || 0,
42058      isType3Font,
42059      cssFontInfo,
42060      scaleFactors: glyphScaleFactors,
42061      systemFontInfo
42062    };
42063    if (composite) {
42064      const cidEncoding = baseDict.get("Encoding");
42065      if (cidEncoding instanceof _primitives.Name) {
42066        properties.cidEncoding = cidEncoding.name;
42067      }
42068      const cMap = await _cmap.CMapFactory.create({
42069        encoding: cidEncoding,
42070        fetchBuiltInCMap: this._fetchBuiltInCMapBound,
42071        useCMap: null
42072      });
42073      properties.cMap = cMap;
42074      properties.vertical = properties.cMap.vertical;
42075    }
42076    return this.extractDataStructures(dict, baseDict, properties).then(newProperties => {
42077      this.extractWidths(dict, descriptor, newProperties);
42078      return new _fonts.Font(fontName.name, fontFile, newProperties);
42079    });
42080  }
42081  static buildFontPaths(font, glyphs, handler, evaluatorOptions) {
42082    function buildPath(fontChar) {
42083      const glyphName = `${font.loadedName}_path_${fontChar}`;
42084      try {
42085        if (font.renderer.hasBuiltPath(fontChar)) {
42086          return;
42087        }
42088        handler.send("commonobj", [glyphName, "FontPath", font.renderer.getPathJs(fontChar)]);
42089      } catch (reason) {
42090        if (evaluatorOptions.ignoreErrors) {
42091          (0, _util.warn)(`buildFontPaths - ignoring ${glyphName} glyph: "${reason}".`);
42092          return;
42093        }
42094        throw reason;
42095      }
42096    }
42097    for (const glyph of glyphs) {
42098      buildPath(glyph.fontChar);
42099      const accent = glyph.accent;
42100      if (accent?.fontChar) {
42101        buildPath(accent.fontChar);
42102      }
42103    }
42104  }
42105  static get fallbackFontDict() {
42106    const dict = new _primitives.Dict();
42107    dict.set("BaseFont", _primitives.Name.get("Helvetica
vendor: 8,117 bytes, lines 42107-42360
42107"));
42108    dict.set("Type", _primitives.Name.get("FallbackType"));
42109    dict.set("Subtype", _primitives.Name.get("FallbackType"));
42110    dict.set("Encoding", _primitives.Name.get("WinAnsiEncoding"));
42111    return (0, _util.shadow)(this, "fallbackFontDict", dict);
42112  }
42113}
42114exports.PartialEvaluator = PartialEvaluator;
42115class TranslatedFont {
42116  constructor({
42117    loadedName,
42118    font,
42119    dict,
42120    evaluatorOptions
42121  }) {
42122    this.loadedName = loadedName;
42123    this.font = font;
42124    this.dict = dict;
42125    this._evaluatorOptions = evaluatorOptions || DefaultPartialEvaluatorOptions;
42126    this.type3Loaded = null;
42127    this.type3Dependencies = font.isType3Font ? new Set() : null;
42128    this.sent = false;
42129  }
42130  send(handler) {
42131    if (this.sent) {
42132      return;
42133    }
42134    this.sent = true;
42135    handler.send("commonobj", [this.loadedName, "Font", this.font.exportData(this._evaluatorOptions.fontExtraProperties)]);
42136  }
42137  fallback(handler) {
42138    if (!this.font.data) {
42139      return;
42140    }
42141    this.font.disableFontFace = true;
42142    PartialEvaluator.buildFontPaths(this.font, this.font.glyphCacheValues, handler, this._evaluatorOptions);
42143  }
42144  loadType3Data(evaluator, resources, task) {
42145    if (this.type3Loaded) {
42146      return this.type3Loaded;
42147    }
42148    if (!this.font.isType3Font) {
42149      throw new Error("Must be a Type3 font.");
42150    }
42151    const type3Evaluator = evaluator.clone({
42152      ignoreErrors: false
42153    });
42154    type3Evaluator.parsingType3Font = true;
42155    const type3FontRefs = new _primitives.RefSet(evaluator.type3FontRefs);
42156    if (this.dict.objId && !type3FontRefs.has(this.dict.objId)) {
42157      type3FontRefs.put(this.dict.objId);
42158    }
42159    type3Evaluator.type3FontRefs = type3FontRefs;
42160    const translatedFont = this.font,
42161      type3Dependencies = this.type3Dependencies;
42162    let loadCharProcsPromise = Promise.resolve();
42163    const charProcs = this.dict.get("CharProcs");
42164    const fontResources = this.dict.get("Resources") || resources;
42165    const charProcOperatorList = Object.create(null);
42166    const fontBBox = _util.Util.normalizeRect(translatedFont.bbox || [0, 0, 0, 0]),
42167      width = fontBBox[2] - fontBBox[0],
42168      height = fontBBox[3] - fontBBox[1];
42169    const fontBBoxSize = Math.hypot(width, height);
42170    for (const key of charProcs.getKeys()) {
42171      loadCharProcsPromise = loadCharProcsPromise.then(() => {
42172        const glyphStream = charProcs.get(key);
42173        const operatorList = new _operator_list.OperatorList();
42174        return type3Evaluator.getOperatorList({
42175          stream: glyphStream,
42176          task,
42177          resources: fontResources,
42178          operatorList
42179        }).then(() => {
42180          if (operatorList.fnArray[0] === _util.OPS.setCharWidthAndBounds) {
42181            this._removeType3ColorOperators(operatorList, fontBBoxSize);
42182          }
42183          charProcOperatorList[key] = operatorList.getIR();
42184          for (const dependency of operatorList.dependencies) {
42185            type3Dependencies.add(dependency);
42186          }
42187        }).catch(function (reason) {
42188          (0, _util.warn)(`Type3 font resource "${key}" is not available.`);
42189          const dummyOperatorList = new _operator_list.OperatorList();
42190          charProcOperatorList[key] = dummyOperatorList.getIR();
42191        });
42192      });
42193    }
42194    this.type3Loaded = loadCharProcsPromise.then(() => {
42195      translatedFont.charProcOperatorList = charProcOperatorList;
42196      if (this._bbox) {
42197        translatedFont.isCharBBox = true;
42198        translatedFont.bbox = this._bbox;
42199      }
42200    });
42201    return this.type3Loaded;
42202  }
42203  _removeType3ColorOperators(operatorList, fontBBoxSize = NaN) {
42204    const charBBox = _util.Util.normalizeRect(operatorList.argsArray[0].slice(2)),
42205      width = charBBox[2] - charBBox[0],
42206      height = charBBox[3] - charBBox[1];
42207    const charBBoxSize = Math.hypot(width, height);
42208    if (width === 0 || height === 0) {
42209      operatorList.fnArray.splice(0, 1);
42210      operatorList.argsArray.splice(0, 1);
42211    } else if (fontBBoxSize === 0 || Math.round(charBBoxSize / fontBBoxSize) >= 10) {
42212      if (!this._bbox) {
42213        this._bbox = [Infinity, Infinity, -Infinity, -Infinity];
42214      }
42215      this._bbox[0] = Math.min(this._bbox[0], charBBox[0]);
42216      this._bbox[1] = Math.min(this._bbox[1], charBBox[1]);
42217      this._bbox[2] = Math.max(this._bbox[2], charBBox[2]);
42218      this._bbox[3] = Math.max(this._bbox[3], charBBox[3]);
42219    }
42220    let i = 0,
42221      ii = operatorList.length;
42222    while (i < ii) {
42223      switch (operatorList.fnArray[i]) {
42224        case _util.OPS.setCharWidthAndBounds:
42225          break;
42226        case _util.OPS.setStrokeColorSpace:
42227        case _util.OPS.setFillColorSpace:
42228        case _util.OPS.setStrokeColor:
42229        case _util.OPS.setStrokeColorN:
42230        case _util.OPS.setFillColor:
42231        case _util.OPS.setFillColorN:
42232        case _util.OPS.setStrokeGray:
42233        case _util.OPS.setFillGray:
42234        case _util.OPS.setStrokeRGBColor:
42235        case _util.OPS.setFillRGBColor:
42236        case _util.OPS.setStrokeCMYKColor:
42237        case _util.OPS.setFillCMYKColor:
42238        case _util.OPS.shadingFill:
42239        case _util.OPS.setRenderingIntent:
42240          operatorList.fnArray.splice(i, 1);
42241          operatorList.argsArray.splice(i, 1);
42242          ii--;
42243          continue;
42244        case _util.OPS.setGState:
42245          const [gStateObj] = operatorList.argsArray[i];
42246          let j = 0,
42247            jj = gStateObj.length;
42248          while (j < jj) {
42249            const [gStateKey] = gStateObj[j];
42250            switch (gStateKey) {
42251              case "TR":
42252              case "TR2":
42253              case "HT":
42254              case "BG":
42255              case "BG2":
42256              case "UCR":
42257              case "UCR2":
42258                gStateObj.splice(j, 1);
42259                jj--;
42260                continue;
42261            }
42262            j++;
42263          }
42264          break;
42265      }
42266      i++;
42267    }
42268  }
42269}
42270class StateManager {
42271  constructor(initialState = new EvalState()) {
42272    this.state = initialState;
42273    this.stateStack = [];
42274  }
42275  save() {
42276    const old = this.state;
42277    this.stateStack.push(this.state);
42278    this.state = old.clone();
42279  }
42280  restore() {
42281    const prev = this.stateStack.pop();
42282    if (prev) {
42283      this.state = prev;
42284    }
42285  }
42286  transform(args) {
42287    this.state.ctm = _util.Util.transform(this.state.ctm, args);
42288  }
42289}
42290class TextState {
42291  constructor() {
42292    this.ctm = new Float32Array(_util.IDENTITY_MATRIX);
42293    this.fontName = null;
42294    this.fontSize = 0;
42295    this.loadedName = null;
42296    this.font = null;
42297    this.fontMatrix = _util.FONT_IDENTITY_MATRIX;
42298    this.textMatrix = _util.IDENTITY_MATRIX.slice();
42299    this.textLineMatrix = _util.IDENTITY_MATRIX.slice();
42300    this.charSpacing = 0;
42301    this.wordSpacing = 0;
42302    this.leading = 0;
42303    this.textHScale = 1;
42304    this.textRise = 0;
42305  }
42306  setTextMatrix(a, b, c, d, e, f) {
42307    const m = this.textMatrix;
42308    m[0] = a;
42309    m[1] = b;
42310    m[2] = c;
42311    m[3] = d;
42312    m[4] = e;
42313    m[5] = f;
42314  }
42315  setTextLineMatrix(a, b, c, d, e, f) {
42316    const m = this.textLineMatrix;
42317    m[0] = a;
42318    m[1] = b;
42319    m[2] = c;
42320    m[3] = d;
42321    m[4] = e;
42322    m[5] = f;
42323  }
42324  translateTextMatrix(x, y) {
42325    const m = this.textMatrix;
42326    m[4] = m[0] * x + m[2] * y + m[4];
42327    m[5] = m[1] * x + m[3] * y + m[5];
42328  }
42329  translateTextLineMatrix(x, y) {
42330    const m = this.textLineMatrix;
42331    m[4] = m[0] * x + m[2] * y + m[4];
42332    m[5] = m[1] * x + m[3] * y + m[5];
42333  }
42334  carriageReturn() {
42335    this.translateTextLineMatrix(0, -this.leading);
42336    this.textMatrix = this.textLineMatrix.slice();
42337  }
42338  clone() {
42339    const clone = Object.create(this);
42340    clone.textMatrix = this.textMatrix.slice();
42341    clone.textLineMatrix = this.textLineMatrix.slice();
42342    clone.fontMatrix = this.fontMatrix.slice();
42343    return clone;
42344  }
42345}
42346class EvalState {
42347  constructor() {
42348    this.ctm = new Float32Array(_util.IDENTITY_MATRIX);
42349    this.font = null;
42350    this.textRenderingMode = _util.TextRenderingMode.FILL;
42351    this.fillColorSpace = _colorspace.ColorSpace.singletons.gray;
42352    this.strokeColorSpace = _colorspace.ColorSpace.singletons.gray;
42353  }
42354  clone() {
42355    return Object.create(this);
42356  }
42357}
42358class EvaluatorPreprocessor {
42359  static get opMap() {
42360    
42360return (0, _util.shadow)(this, "opMap", {
42361      w: {
42362        id: _util.OPS.setLineWidth,
42363        numArgs: 1,
42364        variableArgs: false
42365      },
42366      J: {
42367        id: _util.OPS.setLineCap,
42368        numArgs: 1,
42369        variableArgs: false
42370      },
42371      j: {
42372        id: _util.OPS.setLineJoin,
42373        numArgs: 1,
42374        variableArgs: false
42375      },
42376      M: {
42377        id: _util.OPS.setMiterLimit,
42378        numArgs: 1,
42379        variableArgs: false
42380      },
42381      d: {
42382        id: _util.OPS.setDash,
42383        numArgs: 2,
42384        variableArgs: false
42385      },
42386      ri: {
42387        id: _util.OPS.setRenderingIntent,
42388        numArgs: 1,
42389        variableArgs: false
42390      },
42391      i: {
42392        id: _util.OPS.setFlatness,
42393        numArgs: 1,
42394        variableArgs: false
42395      },
42396      gs: {
42397        id: _util.OPS.setGState,
42398        numArgs: 1,
42399        variableArgs: false
42400      },
42401      q: {
42402        id: _util.OPS.save,
42403        numArgs: 0,
42404        variableArgs: false
42405      },
42406      Q: {
42407        id: _util.OPS.restore,
42408        numArgs: 0,
42409        variableArgs: false
42410      },
42411      cm: {
42412        id: _util.OPS.transform,
42413        numArgs: 6,
42414        variableArgs: false
42415      },
42416      m: {
42417        id: _util.OPS.moveTo,
42418        numArgs: 2,
42419        variableArgs: false
42420      },
42421      l: {
42422        id: _util.OPS.lineTo,
42423        numArgs: 2,
42424        variableArgs: false
42425      },
42426      c: {
42427        id: _util.OPS.curveTo,
42428        numArgs: 6,
42429        variableArgs: false
42430      },
42431      v: {
42432        id: _util.OPS.curveTo2,
42433        numArgs: 4,
42434        variableArgs: false
42435      },
42436      y: {
42437        id: _util.OPS.curveTo3,
42438        numArgs: 4,
42439        variableArgs: false
42440      },
42441      h: {
42442        id: _util.OPS.closePath,
42443        numArgs: 0,
42444        variableArgs: false
42445      },
42446      re: {
42447        id: _util.OPS.rectangle,
42448        numArgs: 4,
42449        variableArgs: false
42450      },
42451      S: {
42452        id: _util.OPS.stroke,
42453        numArgs: 0,
42454        variableArgs: false
42455      },
42456      s: {
42457        id: _util.OPS.closeStroke,
42458        numArgs: 0,
42459        variableArgs: false
42460      },
42461      f: {
42462        id: _util.OPS.fill,
42463        numArgs: 0,
42464        variableArgs: false
42465      },
42466      F: {
42467        id: _util.OPS.fill,
42468        numArgs: 0,
42469        variableArgs: false
42470      },
42471      "f*": {
42472        id: _util.OPS.eoFill,
42473        numArgs: 0,
42474        variableArgs: false
42475      },
42476      B: {
42477        id: _util.OPS.fillStroke,
42478        numArgs: 0,
42479        variableArgs: false
42480      },
42481      "B*": {
42482        id: _util.OPS.eoFillStroke,
42483        numArgs: 0,
42484        variableArgs: false
42485      },
42486      b: {
42487        id: _util.OPS.closeFillStroke,
42488        numArgs: 0,
42489        variableArgs: false
42490      },
42491      "b*": {
42492        id: _util.OPS.closeEOFillStroke,
42493        numArgs: 0,
42494        variableArgs: false
42495      },
42496      n: {
42497        id: _util.OPS.endPath,
42498        numArgs: 0,
42499        variableArgs: false
42500      },
42501      W: {
42502        id: _util.OPS.clip,
42503        numArgs: 0,
42504        variableArgs: false
42505      },
42506      "W*": {
42507        id: _util.OPS.eoClip,
42508        numArgs: 0,
42509        variableArgs: false
42510      },
42511      BT: {
42512        id: _util.OPS.beginText,
42513        numArgs: 0,
42514        variableArgs: false
42515      },
42516      ET: {
42517        id: _util.OPS.endText,
42518        numArgs: 0,
42519        variableArgs: false
42520      },
42521      Tc: {
42522        id: _util.OPS.setCharSpacing,
42523        numArgs: 1,
42524        variableArgs: false
42525      },
42526      Tw: {
42527        id: _util.OPS.setWordSpacing,
42528        numArgs: 1,
42529        variableArgs: false
42530      },
42531      Tz: {
42532        id: _util.OPS.setHScale,
42533        numArgs: 1,
42534        variableArgs: false
42535      },
42536      TL: {
42537        id: _util.OPS.setLeading,
42538        numArgs: 1,
42539        variableArgs: false
42540      },
42541      Tf: {
42542        id: _util.OPS.setFont,
42543        numArgs: 2,
42544        variableArgs: false
42545      },
42546      Tr: {
42547        id: _util.OPS.setTextRenderingMode,
42548        numArgs: 1,
42549        variableArgs: false
42550      },
42551      Ts: {
42552        id: _util.OPS.setTextRise,
42553        numArgs: 1,
42554        variableArgs: false
42555      },
42556      Td: {
42557        id: _util.OPS.moveText,
42558        numArgs: 2,
42559        variableArgs: false
42560      },
42561      TD: {
42562        id: _util.OPS.setLeadingMoveText,
42563        numArgs: 2,
42564        variableArgs: false
42565      },
42566      Tm: {
42567        id: _util.OPS.setTextMatrix,
42568        numArgs: 6,
42569        variableArgs: false
42570      },
42571      "T*": {
42572        id: _util.OPS.nextLine,
42573        numArgs: 0,
42574        variableArgs: false
42575      },
42576      Tj: {
42577        id: _util.OPS.showText,
42578        numArgs: 1,
42579        variableArgs: false
42580      },
42581      TJ: {
42582        id: _util.OPS.showSpacedText,
42583        numArgs: 1,
42584        variableArgs: false
42585      },
42586      "'": {
42587        id: _util.OPS.nextLineShowText,
42588        numArgs: 1,
42589        variableArgs: false
42590      },
42591      '"': {
42592        id: _util.OPS.nextLineSetSpacingShowText,
42593        numArgs: 3,
42594        variableArgs: false
42595      },
42596      d0: {
42597        id: _util.OPS.setCharWidth,
42598        numArgs: 2,
42599        variableArgs: false
42600      },
42601      d1: {
42602        id: _util.OPS.setCharWidthAndBounds,
42603        numArgs: 6,
42604        variableArgs: false
42605      },
42606      CS: {
42607        id: _util.OPS.setStrokeColorSpace,
42608        numArgs: 1,
42609        variableArgs: false
42610      },
42611      cs: {
42612        id: _util.OPS.setFillColorSpace,
42613        numArgs: 1,
42614        variableArgs: false
42615      },
42616      SC: {
42617        id: _util.OPS.setStrokeColor,
42618        numArgs: 4,
42619        variableArgs: true
42620      },
42621      SCN: {
42622        id: _util.OPS.setStrokeColorN,
42623        numArgs: 33,
42624        variableArgs: true
42625      },
42626      sc: {
42627        id: _util.OPS.setFillColor,
42628        numArgs: 4,
42629        variableArgs: true
42630      },
42631      scn: {
42632        id: _util.OPS.setFillColorN,
42633        numArgs: 33,
42634        variableArgs: true
42635      },
42636      G: {
42637        id: _util.OPS.setStrokeGray,
42638        numArgs: 1,
42639        variableArgs: false
42640      },
42641      g: {
42642        id: _util.OPS.setFillGray,
42643        numArgs: 1,
42644        variableArgs: false
42645      },
42646      RG: {
42647        id: _util.OPS.setStrokeRGBColor,
42648        numArgs: 3,
42649        variableArgs: false
42650      },
42651      rg: {
42652        id: _util.OPS.setFillRGBColor,
42653        numArgs: 3,
42654        variableArgs: false
42655      },
42656      K: {
42657        id: _util.OPS.setStrokeCMYKColor,
42658        numArgs: 4,
42659        variableArgs: false
42660      },
42661      k: {
42662        id: _util.OPS.setFillCMYKColor,
42663        numArgs: 4,
42664        variableArgs: false
42665      },
42666      sh: {
42667        id: _util.OPS.shadingFill,
42668        numArgs: 1,
42669        variableArgs: false
42670      },
42671      BI: {
42672        id: _util.OPS.beginInlineImage,
42673        numArgs: 0,
42674        variableArgs: false
42675      },
42676      ID: {
42677        id: _util.OPS.beginImageData,
42678        numArgs: 0,
42679        variableArgs: false
42680      },
42681      EI: {
42682        id: _util.OPS.endInlineImage,
42683        numArgs: 1,
42684        variableArgs: false
42685      },
42686      Do: {
42687        id: _util.OPS.paintXObject,
42688        numArgs: 1,
42689        variableArgs: false
42690      },
42691      MP: {
42692        id: _util.OPS.markPoint,
42693        numArgs: 1,
42694        variableArgs: false
42695      },
42696      DP: {
42697        id: _util.OPS.markPointProps,
42698        numArgs: 2,
42699        variableArgs: false
42700      },
42701      BMC: {
42702        id: _util.OPS.beginMarkedContent,
42703        numArgs: 1,
42704        variableArgs: false
42705      },
42706      BDC: {
42707        id: _util.OPS.beginMarkedContentProps,
42708        numArgs: 2,
42709        variableArgs: false
42710      },
42711      EMC: {
42712        id: _util.OPS.endMarkedContent,
42713        numArgs: 0,
42714        variableArgs: false
42715      },
42716      BX: {
42717        id: _util.OPS.beginCompat,
42718        numArgs: 0,
42719        variableArgs: false
42720      },
42721      EX: {
42722        id: _util.OPS.endCompat,
42723        numArgs: 0,
42724        variableArgs: false
42725      },
42726      BM: null,
42727      BD: null,
42728      true: null,
42729      fa: null,
42730      fal: null,
42731      fals: null,
42732      false: null,
42733      nu: null,
42734      nul: null,
42735      null: null
42736    });
42737  }
vendor: 3,589 bytes, lines 42738-42850
42738  static MAX_INVALID_PATH_OPS = 10;
42739  constructor(stream, xref, stateManager = new StateManager()) {
42740    this.parser = new _parser.Parser({
42741      lexer: new _parser.Lexer(stream, EvaluatorPreprocessor.opMap),
42742      xref
42743    });
42744    this.stateManager = stateManager;
42745    this.nonProcessedArgs = [];
42746    this._isPathOp = false;
42747    this._numInvalidPathOPS = 0;
42748  }
42749  get savedStatesDepth() {
42750    return this.stateManager.stateStack.length;
42751  }
42752  read(operation) {
42753    let args = operation.args;
42754    while (true) {
42755      const obj = this.parser.getObj();
42756      if (obj instanceof _primitives.Cmd) {
42757        const cmd = obj.cmd;
42758        const opSpec = EvaluatorPreprocessor.opMap[cmd];
42759        if (!opSpec) {
42760          (0, _util.warn)(`Unknown command "${cmd}".`);
42761          continue;
42762        }
42763        const fn = opSpec.id;
42764        const numArgs = opSpec.numArgs;
42765        let argsLength = args !== null ? args.length : 0;
42766        if (!this._isPathOp) {
42767          this._numInvalidPathOPS = 0;
42768        }
42769        this._isPathOp = fn >= _util.OPS.moveTo && fn <= _util.OPS.endPath;
42770        if (!opSpec.variableArgs) {
42771          if (argsLength !== numArgs) {
42772            const nonProcessedArgs = this.nonProcessedArgs;
42773            while (argsLength > numArgs) {
42774              nonProcessedArgs.push(args.shift());
42775              argsLength--;
42776            }
42777            while (argsLength < numArgs && nonProcessedArgs.length !== 0) {
42778              if (args === null) {
42779                args = [];
42780              }
42781              args.unshift(nonProcessedArgs.pop());
42782              argsLength++;
42783            }
42784          }
42785          if (argsLength < numArgs) {
42786            const partialMsg = `command ${cmd}: expected ${numArgs} args, ` + `but received ${argsLength} args.`;
42787            if (this._isPathOp && ++this._numInvalidPathOPS > EvaluatorPreprocessor.MAX_INVALID_PATH_OPS) {
42788              throw new _util.FormatError(`Invalid ${partialMsg}`);
42789            }
42790            (0, _util.warn)(`Skipping ${partialMsg}`);
42791            if (args !== null) {
42792              args.length = 0;
42793            }
42794            continue;
42795          }
42796        } else if (argsLength > numArgs) {
42797          (0, _util.info)(`Command ${cmd}: expected [0, ${numArgs}] args, ` + `but received ${argsLength} args.`);
42798        }
42799        this.preprocessCommand(fn, args);
42800        operation.fn = fn;
42801        operation.args = args;
42802        return true;
42803      }
42804      if (obj === _primitives.EOF) {
42805        return false;
42806      }
42807      if (obj !== null) {
42808        if (args === null) {
42809          args = [];
42810        }
42811        args.push(obj);
42812        if (args.length > 33) {
42813          throw new _util.FormatError("Too many arguments");
42814        }
42815      }
42816    }
42817  }
42818  preprocessCommand(fn, args) {
42819    switch (fn | 0) {
42820      case _util.OPS.save:
42821        this.stateManager.save();
42822        break;
42823      case _util.OPS.restore:
42824        this.stateManager.restore();
42825        break;
42826      case _util.OPS.transform:
42827        this.stateManager.transform(args);
42828        break;
42829    }
42830  }
42831}
42832exports.EvaluatorPreprocessor = EvaluatorPreprocessor;
42833
42834/***/ }),
42835/* 14 */
42836/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
42837
42838
42839
42840Object.defineProperty(exports, "__esModule", ({
42841  value: true
42842}));
42843exports.IdentityCMap = exports.CMapFactory = exports.CMap = void 0;
42844var _util = __w_pdfjs_require__(2);
42845var _primitives = __w_pdfjs_require__(4);
42846var _base_stream = __w_pdfjs_require__(5);
42847var _binary_cmap = __w_pdfjs_require__(15);
42848var _parser = __w_pdfjs_require__(16);
42849var _core_utils = __w_pdfjs_require__(3);
42850var _stream = __w_pdfjs_require__(8);
vendor: 6,255 bytes, lines 42850-42990
42850
42851const 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"];
42852const MAX_MAP_RANGE = 2 ** 24 - 1;
42853class CMap {
42854  constructor(builtInCMap = false) {
42855    this.codespaceRanges = [[], [], [], []];
42856    this.numCodespaceRanges = 0;
42857    this._map = [];
42858    this.name = "";
42859    this.vertical = false;
42860    this.useCMap = null;
42861    this.builtInCMap = builtInCMap;
42862  }
42863  addCodespaceRange(n, low, high) {
42864    this.codespaceRanges[n - 1].push(low, high);
42865    this.numCodespaceRanges++;
42866  }
42867  mapCidRange(low, high, dstLow) {
42868    if (high - low > MAX_MAP_RANGE) {
42869      throw new Error("mapCidRange - ignoring data above MAX_MAP_RANGE.");
42870    }
42871    while (low <= high) {
42872      this._map[low++] = dstLow++;
42873    }
42874  }
42875  mapBfRange(low, high, dstLow) {
42876    if (high - low > MAX_MAP_RANGE) {
42877      throw new Error("mapBfRange - ignoring data above MAX_MAP_RANGE.");
42878    }
42879    const lastByte = dstLow.length - 1;
42880    while (low <= high) {
42881      this._map[low++] = dstLow;
42882      const nextCharCode = dstLow.charCodeAt(lastByte) + 1;
42883      if (nextCharCode > 0xff) {
42884        dstLow = dstLow.substring(0, lastByte - 1) + String.fromCharCode(dstLow.charCodeAt(lastByte - 1) + 1) + "\x00";
42885        continue;
42886      }
42887      dstLow = dstLow.substring(0, lastByte) + String.fromCharCode(nextCharCode);
42888    }
42889  }
42890  mapBfRangeToArray(low, high, array) {
42891    if (high - low > MAX_MAP_RANGE) {
42892      throw new Error("mapBfRangeToArray - ignoring data above MAX_MAP_RANGE.");
42893    }
42894    const ii = array.length;
42895    let i = 0;
42896    while (low <= high && i < ii) {
42897      this._map[low] = array[i++];
42898      ++low;
42899    }
42900  }
42901  mapOne(src, dst) {
42902    this._map[src] = dst;
42903  }
42904  lookup(code) {
42905    return this._map[code];
42906  }
42907  contains(code) {
42908    return this._map[code] !== undefined;
42909  }
42910  forEach(callback) {
42911    const map = this._map;
42912    const length = map.length;
42913    if (length <= 0x10000) {
42914      for (let i = 0; i < length; i++) {
42915        if (map[i] !== undefined) {
42916          callback(i, map[i]);
42917        }
42918      }
42919    } else {
42920      for (const i in map) {
42921        callback(i, map[i]);
42922      }
42923    }
42924  }
42925  charCodeOf(value) {
42926    const map = this._map;
42927    if (map.length <= 0x10000) {
42928      return map.indexOf(value);
42929    }
42930    for (const charCode in map) {
42931      if (map[charCode] === value) {
42932        return charCode | 0;
42933      }
42934    }
42935    return -1;
42936  }
42937  getMap() {
42938    return this._map;
42939  }
42940  readCharCode(str, offset, out) {
42941    let c = 0;
42942    const codespaceRanges = this.codespaceRanges;
42943    for (let n = 0, nn = codespaceRanges.length; n < nn; n++) {
42944      c = (c << 8 | str.charCodeAt(offset + n)) >>> 0;
42945      const codespaceRange = codespaceRanges[n];
42946      for (let k = 0, kk = codespaceRange.length; k < kk;) {
42947        const low = codespaceRange[k++];
42948        const high = codespaceRange[k++];
42949        if (c >= low && c <= high) {
42950          out.charcode = c;
42951          out.length = n + 1;
42952          return;
42953        }
42954      }
42955    }
42956    out.charcode = 0;
42957    out.length = 1;
42958  }
42959  getCharCodeLength(charCode) {
42960    const codespaceRanges = this.codespaceRanges;
42961    for (let n = 0, nn = codespaceRanges.length; n < nn; n++) {
42962      const codespaceRange = codespaceRanges[n];
42963      for (let k = 0, kk = codespaceRange.length; k < kk;) {
42964        const low = codespaceRange[k++];
42965        const high = codespaceRange[k++];
42966        if (charCode >= low && charCode <= high) {
42967          return n + 1;
42968        }
42969      }
42970    }
42971    return 1;
42972  }
42973  get length() {
42974    return this._map.length;
42975  }
42976  get isIdentityCMap() {
42977    if (!(this.name === "Identity-H" || this.name === "Identity-V")) {
42978      return false;
42979    }
42980    if (this._map.length !== 0x10000) {
42981      return false;
42982    }
42983    for (let i = 0; i < 0x10000; i++) {
42984      if (this._map[i] !== i) {
42985        return false;
42986      }
42987    }
42988    return true;
42989  }
42990}
vendor: 21,916 bytes, lines 42991-43750
42991exports.CMap = CMap;
42992class IdentityCMap extends CMap {
42993  constructor(vertical, n) {
42994    super();
42995    this.vertical = vertical;
42996    this.addCodespaceRange(n, 0, 0xffff);
42997  }
42998  mapCidRange(low, high, dstLow) {
42999    (0, _util.unreachable)("should not call mapCidRange");
43000  }
43001  mapBfRange(low, high, dstLow) {
43002    (0, _util.unreachable)("should not call mapBfRange");
43003  }
43004  mapBfRangeToArray(low, high, array) {
43005    (0, _util.unreachable)("should not call mapBfRangeToArray");
43006  }
43007  mapOne(src, dst) {
43008    (0, _util.unreachable)("should not call mapCidOne");
43009  }
43010  lookup(code) {
43011    return Number.isInteger(code) && code <= 0xffff ? code : undefined;
43012  }
43013  contains(code) {
43014    return Number.isInteger(code) && code <= 0xffff;
43015  }
43016  forEach(callback) {
43017    for (let i = 0; i <= 0xffff; i++) {
43018      callback(i, i);
43019    }
43020  }
43021  charCodeOf(value) {
43022    return Number.isInteger(value) && value <= 0xffff ? value : -1;
43023  }
43024  getMap() {
43025    const map = new Array(0x10000);
43026    for (let i = 0; i <= 0xffff; i++) {
43027      map[i] = i;
43028    }
43029    return map;
43030  }
43031  get length() {
43032    return 0x10000;
43033  }
43034  get isIdentityCMap() {
43035    (0, _util.unreachable)("should not access .isIdentityCMap");
43036  }
43037}
43038exports.IdentityCMap = IdentityCMap;
43039function strToInt(str) {
43040  let a = 0;
43041  for (let i = 0; i < str.length; i++) {
43042    a = a << 8 | str.charCodeAt(i);
43043  }
43044  return a >>> 0;
43045}
43046function expectString(obj) {
43047  if (typeof obj !== "string") {
43048    throw new _util.FormatError("Malformed CMap: expected string.");
43049  }
43050}
43051function expectInt(obj) {
43052  if (!Number.isInteger(obj)) {
43053    throw new _util.FormatError("Malformed CMap: expected int.");
43054  }
43055}
43056function parseBfChar(cMap, lexer) {
43057  while (true) {
43058    let obj = lexer.getObj();
43059    if (obj === _primitives.EOF) {
43060      break;
43061    }
43062    if ((0, _primitives.isCmd)(obj, "endbfchar")) {
43063      return;
43064    }
43065    expectString(obj);
43066    const src = strToInt(obj);
43067    obj = lexer.getObj();
43068    expectString(obj);
43069    const dst = obj;
43070    cMap.mapOne(src, dst);
43071  }
43072}
43073function parseBfRange(cMap, lexer) {
43074  while (true) {
43075    let obj = lexer.getObj();
43076    if (obj === _primitives.EOF) {
43077      break;
43078    }
43079    if ((0, _primitives.isCmd)(obj, "endbfrange")) {
43080      return;
43081    }
43082    expectString(obj);
43083    const low = strToInt(obj);
43084    obj = lexer.getObj();
43085    expectString(obj);
43086    const high = strToInt(obj);
43087    obj = lexer.getObj();
43088    if (Number.isInteger(obj) || typeof obj === "string") {
43089      const dstLow = Number.isInteger(obj) ? String.fromCharCode(obj) : obj;
43090      cMap.mapBfRange(low, high, dstLow);
43091    } else if ((0, _primitives.isCmd)(obj, "[")) {
43092      obj = lexer.getObj();
43093      const array = [];
43094      while (!(0, _primitives.isCmd)(obj, "]") && obj !== _primitives.EOF) {
43095        array.push(obj);
43096        obj = lexer.getObj();
43097      }
43098      cMap.mapBfRangeToArray(low, high, array);
43099    } else {
43100      break;
43101    }
43102  }
43103  throw new _util.FormatError("Invalid bf range.");
43104}
43105function parseCidChar(cMap, lexer) {
43106  while (true) {
43107    let obj = lexer.getObj();
43108    if (obj === _primitives.EOF) {
43109      break;
43110    }
43111    if ((0, _primitives.isCmd)(obj, "endcidchar")) {
43112      return;
43113    }
43114    expectString(obj);
43115    const src = strToInt(obj);
43116    obj = lexer.getObj();
43117    expectInt(obj);
43118    const dst = obj;
43119    cMap.mapOne(src, dst);
43120  }
43121}
43122function parseCidRange(cMap, lexer) {
43123  while (true) {
43124    let obj = lexer.getObj();
43125    if (obj === _primitives.EOF) {
43126      break;
43127    }
43128    if ((0, _primitives.isCmd)(obj, "endcidrange")) {
43129      return;
43130    }
43131    expectString(obj);
43132    const low = strToInt(obj);
43133    obj = lexer.getObj();
43134    expectString(obj);
43135    const high = strToInt(obj);
43136    obj = lexer.getObj();
43137    expectInt(obj);
43138    const dstLow = obj;
43139    cMap.mapCidRange(low, high, dstLow);
43140  }
43141}
43142function parseCodespaceRange(cMap, lexer) {
43143  while (true) {
43144    let obj = lexer.getObj();
43145    if (obj === _primitives.EOF) {
43146      break;
43147    }
43148    if ((0, _primitives.isCmd)(obj, "endcodespacerange")) {
43149      return;
43150    }
43151    if (typeof obj !== "string") {
43152      break;
43153    }
43154    const low = strToInt(obj);
43155    obj = lexer.getObj();
43156    if (typeof obj !== "string") {
43157      break;
43158    }
43159    const high = strToInt(obj);
43160    cMap.addCodespaceRange(obj.length, low, high);
43161  }
43162  throw new _util.FormatError("Invalid codespace range.");
43163}
43164function parseWMode(cMap, lexer) {
43165  const obj = lexer.getObj();
43166  if (Number.isInteger(obj)) {
43167    cMap.vertical = !!obj;
43168  }
43169}
43170function parseCMapName(cMap, lexer) {
43171  const obj = lexer.getObj();
43172  if (obj instanceof _primitives.Name) {
43173    cMap.name = obj.name;
43174  }
43175}
43176async function parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap) {
43177  let previous, embeddedUseCMap;
43178  objLoop: while (true) {
43179    try {
43180      const obj = lexer.getObj();
43181      if (obj === _primitives.EOF) {
43182        break;
43183      } else if (obj instanceof _primitives.Name) {
43184        if (obj.name === "WMode") {
43185          parseWMode(cMap, lexer);
43186        } else if (obj.name === "CMapName") {
43187          parseCMapName(cMap, lexer);
43188        }
43189        previous = obj;
43190      } else if (obj instanceof _primitives.Cmd) {
43191        switch (obj.cmd) {
43192          case "endcmap":
43193            break objLoop;
43194          case "usecmap":
43195            if (previous instanceof _primitives.Name) {
43196              embeddedUseCMap = previous.name;
43197            }
43198            break;
43199          case "begincodespacerange":
43200            parseCodespaceRange(cMap, lexer);
43201            break;
43202          case "beginbfchar":
43203            parseBfChar(cMap, lexer);
43204            break;
43205          case "begincidchar":
43206            parseCidChar(cMap, lexer);
43207            break;
43208          case "beginbfrange":
43209            parseBfRange(cMap, lexer);
43210            break;
43211          case "begincidrange":
43212            parseCidRange(cMap, lexer);
43213            break;
43214        }
43215      }
43216    } catch (ex) {
43217      if (ex instanceof _core_utils.MissingDataException) {
43218        throw ex;
43219      }
43220      (0, _util.warn)("Invalid cMap data: " + ex);
43221      continue;
43222    }
43223  }
43224  if (!useCMap && embeddedUseCMap) {
43225    useCMap = embeddedUseCMap;
43226  }
43227  if (useCMap) {
43228    return extendCMap(cMap, fetchBuiltInCMap, useCMap);
43229  }
43230  return cMap;
43231}
43232async function extendCMap(cMap, fetchBuiltInCMap, useCMap) {
43233  cMap.useCMap = await createBuiltInCMap(useCMap, fetchBuiltInCMap);
43234  if (cMap.numCodespaceRanges === 0) {
43235    const useCodespaceRanges = cMap.useCMap.codespaceRanges;
43236    for (let i = 0; i < useCodespaceRanges.length; i++) {
43237      cMap.codespaceRanges[i] = useCodespaceRanges[i].slice();
43238    }
43239    cMap.numCodespaceRanges = cMap.useCMap.numCodespaceRanges;
43240  }
43241  cMap.useCMap.forEach(function (key, value) {
43242    if (!cMap.contains(key)) {
43243      cMap.mapOne(key, cMap.useCMap.lookup(key));
43244    }
43245  });
43246  return cMap;
43247}
43248async function createBuiltInCMap(name, fetchBuiltInCMap) {
43249  if (name === "Identity-H") {
43250    return new IdentityCMap(false, 2);
43251  } else if (name === "Identity-V") {
43252    return new IdentityCMap(true, 2);
43253  }
43254  if (!BUILT_IN_CMAPS.includes(name)) {
43255    throw new Error("Unknown CMap name: " + name);
43256  }
43257  if (!fetchBuiltInCMap) {
43258    throw new Error("Built-in CMap parameters are not provided.");
43259  }
43260  const {
43261    cMapData,
43262    compressionType
43263  } = await fetchBuiltInCMap(name);
43264  const cMap = new CMap(true);
43265  if (compressionType === _util.CMapCompressionType.BINARY) {
43266    return new _binary_cmap.BinaryCMapReader().process(cMapData, cMap, useCMap => {
43267      return extendCMap(cMap, fetchBuiltInCMap, useCMap);
43268    });
43269  }
43270  if (compressionType === _util.CMapCompressionType.NONE) {
43271    const lexer = new _parser.Lexer(new _stream.Stream(cMapData));
43272    return parseCMap(cMap, lexer, fetchBuiltInCMap, null);
43273  }
43274  throw new Error(`Invalid CMap "compressionType" value: ${compressionType}`);
43275}
43276class CMapFactory {
43277  static async create({
43278    encoding,
43279    fetchBuiltInCMap,
43280    useCMap
43281  }) {
43282    if (encoding instanceof _primitives.Name) {
43283      return createBuiltInCMap(encoding.name, fetchBuiltInCMap);
43284    } else if (encoding instanceof _base_stream.BaseStream) {
43285      const parsedCMap = await parseCMap(new CMap(), new _parser.Lexer(encoding), fetchBuiltInCMap, useCMap);
43286      if (parsedCMap.isIdentityCMap) {
43287        return createBuiltInCMap(parsedCMap.name, fetchBuiltInCMap);
43288      }
43289      return parsedCMap;
43290    }
43291    throw new Error("Encoding required.");
43292  }
43293}
43294exports.CMapFactory = CMapFactory;
43295
43296/***/ }),
43297/* 15 */
43298/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
43299
43300
43301
43302Object.defineProperty(exports, "__esModule", ({
43303  value: true
43304}));
43305exports.BinaryCMapReader = void 0;
43306var _util = __w_pdfjs_require__(2);
43307function hexToInt(a, size) {
43308  let n = 0;
43309  for (let i = 0; i <= size; i++) {
43310    n = n << 8 | a[i];
43311  }
43312  return n >>> 0;
43313}
43314function hexToStr(a, size) {
43315  if (size === 1) {
43316    return String.fromCharCode(a[0], a[1]);
43317  }
43318  if (size === 3) {
43319    return String.fromCharCode(a[0], a[1], a[2], a[3]);
43320  }
43321  return String.fromCharCode(...a.subarray(0, size + 1));
43322}
43323function addHex(a, b, size) {
43324  let c = 0;
43325  for (let i = size; i >= 0; i--) {
43326    c += a[i] + b[i];
43327    a[i] = c & 255;
43328    c >>= 8;
43329  }
43330}
43331function incHex(a, size) {
43332  let c = 1;
43333  for (let i = size; i >= 0 && c > 0; i--) {
43334    c += a[i];
43335    a[i] = c & 255;
43336    c >>= 8;
43337  }
43338}
43339const MAX_NUM_SIZE = 16;
43340const MAX_ENCODED_NUM_SIZE = 19;
43341class BinaryCMapStream {
43342  constructor(data) {
43343    this.buffer = data;
43344    this.pos = 0;
43345    this.end = data.length;
43346    this.tmpBuf = new Uint8Array(MAX_ENCODED_NUM_SIZE);
43347  }
43348  readByte() {
43349    if (this.pos >= this.end) {
43350      return -1;
43351    }
43352    return this.buffer[this.pos++];
43353  }
43354  readNumber() {
43355    let n = 0;
43356    let last;
43357    do {
43358      const b = this.readByte();
43359      if (b < 0) {
43360        throw new _util.FormatError("unexpected EOF in bcmap");
43361      }
43362      last = !(b & 0x80);
43363      n = n << 7 | b & 0x7f;
43364    } while (!last);
43365    return n;
43366  }
43367  readSigned() {
43368    const n = this.readNumber();
43369    return n & 1 ? ~(n >>> 1) : n >>> 1;
43370  }
43371  readHex(num, size) {
43372    num.set(this.buffer.subarray(this.pos, this.pos + size + 1));
43373    this.pos += size + 1;
43374  }
43375  readHexNumber(num, size) {
43376    let last;
43377    const stack = this.tmpBuf;
43378    let sp = 0;
43379    do {
43380      const b = this.readByte();
43381      if (b < 0) {
43382        throw new _util.FormatError("unexpected EOF in bcmap");
43383      }
43384      last = !(b & 0x80);
43385      stack[sp++] = b & 0x7f;
43386    } while (!last);
43387    let i = size,
43388      buffer = 0,
43389      bufferSize = 0;
43390    while (i >= 0) {
43391      while (bufferSize < 8 && stack.length > 0) {
43392        buffer |= stack[--sp] << bufferSize;
43393        bufferSize += 7;
43394      }
43395      num[i] = buffer & 255;
43396      i--;
43397      buffer >>= 8;
43398      bufferSize -= 8;
43399    }
43400  }
43401  readHexSigned(num, size) {
43402    this.readHexNumber(num, size);
43403    const sign = num[size] & 1 ? 255 : 0;
43404    let c = 0;
43405    for (let i = 0; i <= size; i++) {
43406      c = (c & 1) << 8 | num[i];
43407      num[i] = c >> 1 ^ sign;
43408    }
43409  }
43410  readString() {
43411    const len = this.readNumber(),
43412      buf = new Array(len);
43413    for (let i = 0; i < len; i++) {
43414      buf[i] = this.readNumber();
43415    }
43416    return String.fromCharCode(...buf);
43417  }
43418}
43419class BinaryCMapReader {
43420  async process(data, cMap, extend) {
43421    const stream = new BinaryCMapStream(data);
43422    const header = stream.readByte();
43423    cMap.vertical = !!(header & 1);
43424    let useCMap = null;
43425    const start = new Uint8Array(MAX_NUM_SIZE);
43426    const end = new Uint8Array(MAX_NUM_SIZE);
43427    const char = new Uint8Array(MAX_NUM_SIZE);
43428    const charCode = new Uint8Array(MAX_NUM_SIZE);
43429    const tmp = new Uint8Array(MAX_NUM_SIZE);
43430    let code;
43431    let b;
43432    while ((b = stream.readByte()) >= 0) {
43433      const type = b >> 5;
43434      if (type === 7) {
43435        switch (b & 0x1f) {
43436          case 0:
43437            stream.readString();
43438            break;
43439          case 1:
43440            useCMap = stream.readString();
43441            break;
43442        }
43443        continue;
43444      }
43445      const sequence = !!(b & 0x10);
43446      const dataSize = b & 15;
43447      if (dataSize + 1 > MAX_NUM_SIZE) {
43448        throw new Error("BinaryCMapReader.process: Invalid dataSize.");
43449      }
43450      const ucs2DataSize = 1;
43451      const subitemsCount = stream.readNumber();
43452      switch (type) {
43453        case 0:
43454          stream.readHex(start, dataSize);
43455          stream.readHexNumber(end, dataSize);
43456          addHex(end, start, dataSize);
43457          cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
43458          for (let i = 1; i < subitemsCount; i++) {
43459            incHex(end, dataSize);
43460            stream.readHexNumber(start, dataSize);
43461            addHex(start, end, dataSize);
43462            stream.readHexNumber(end, dataSize);
43463            addHex(end, start, dataSize);
43464            cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
43465          }
43466          break;
43467        case 1:
43468          stream.readHex(start, dataSize);
43469          stream.readHexNumber(end, dataSize);
43470          addHex(end, start, dataSize);
43471          stream.readNumber();
43472          for (let i = 1; i < subitemsCount; i++) {
43473            incHex(end, dataSize);
43474            stream.readHexNumber(start, dataSize);
43475            addHex(start, end, dataSize);
43476            stream.readHexNumber(end, dataSize);
43477            addHex(end, start, dataSize);
43478            stream.readNumber();
43479          }
43480          break;
43481        case 2:
43482          stream.readHex(char, dataSize);
43483          code = stream.readNumber();
43484          cMap.mapOne(hexToInt(char, dataSize), code);
43485          for (let i = 1; i < subitemsCount; i++) {
43486            incHex(char, dataSize);
43487            if (!sequence) {
43488              stream.readHexNumber(tmp, dataSize);
43489              addHex(char, tmp, dataSize);
43490            }
43491            code = stream.readSigned() + (code + 1);
43492            cMap.mapOne(hexToInt(char, dataSize), code);
43493          }
43494          break;
43495        case 3:
43496          stream.readHex(start, dataSize);
43497          stream.readHexNumber(end, dataSize);
43498          addHex(end, start, dataSize);
43499          code = stream.readNumber();
43500          cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
43501          for (let i = 1; i < subitemsCount; i++) {
43502            incHex(end, dataSize);
43503            if (!sequence) {
43504              stream.readHexNumber(start, dataSize);
43505              addHex(start, end, dataSize);
43506            } else {
43507              start.set(end);
43508            }
43509            stream.readHexNumber(end, dataSize);
43510            addHex(end, start, dataSize);
43511            code = stream.readNumber();
43512            cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
43513          }
43514          break;
43515        case 4:
43516          stream.readHex(char, ucs2DataSize);
43517          stream.readHex(charCode, dataSize);
43518          cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
43519          for (let i = 1; i < subitemsCount; i++) {
43520            incHex(char, ucs2DataSize);
43521            if (!sequence) {
43522              stream.readHexNumber(tmp, ucs2DataSize);
43523              addHex(char, tmp, ucs2DataSize);
43524            }
43525            incHex(charCode, dataSize);
43526            stream.readHexSigned(tmp, dataSize);
43527            addHex(charCode, tmp, dataSize);
43528            cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
43529          }
43530          break;
43531        case 5:
43532          stream.readHex(start, ucs2DataSize);
43533          stream.readHexNumber(end, ucs2DataSize);
43534          addHex(end, start, ucs2DataSize);
43535          stream.readHex(charCode, dataSize);
43536          cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
43537          for (let i = 1; i < subitemsCount; i++) {
43538            incHex(end, ucs2DataSize);
43539            if (!sequence) {
43540              stream.readHexNumber(start, ucs2DataSize);
43541              addHex(start, end, ucs2DataSize);
43542            } else {
43543              start.set(end);
43544            }
43545            stream.readHexNumber(end, ucs2DataSize);
43546            addHex(end, start, ucs2DataSize);
43547            stream.readHex(charCode, dataSize);
43548            cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
43549          }
43550          break;
43551        default:
43552          throw new Error(`BinaryCMapReader.process - unknown type: ${type}`);
43553      }
43554    }
43555    if (useCMap) {
43556      return extend(useCMap);
43557    }
43558    return cMap;
43559  }
43560}
43561exports.BinaryCMapReader = BinaryCMapReader;
43562
43563/***/ }),
43564/* 16 */
43565/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
43566
43567
43568
43569Object.defineProperty(exports, "__esModule", ({
43570  value: true
43571}));
43572exports.Parser = exports.Linearization = exports.Lexer = void 0;
43573var _util = __w_pdfjs_require__(2);
43574var _primitives = __w_pdfjs_require__(4);
43575var _core_utils = __w_pdfjs_require__(3);
43576var _stream = __w_pdfjs_require__(8);
43577var _ascii_85_stream = __w_pdfjs_require__(17);
43578var _ascii_hex_stream = __w_pdfjs_require__(19);
43579var _ccitt_stream = __w_pdfjs_require__(20);
43580var _flate_stream = __w_pdfjs_require__(22);
43581var _jbig2_stream = __w_pdfjs_require__(23);
43582var _jpeg_stream = __w_pdfjs_require__(26);
43583var _jpx_stream = __w_pdfjs_require__(29);
43584var _lzw_stream = __w_pdfjs_require__(31);
43585var _predictor_stream = __w_pdfjs_require__(32);
43586var _run_length_stream = __w_pdfjs_require__(33);
43587const MAX_LENGTH_TO_CACHE = 1000;
43588function getInlineImageCacheKey(bytes) {
43589  const strBuf = [],
43590    ii = bytes.length;
43591  let i = 0;
43592  while (i < ii - 1) {
43593    strBuf.push(bytes[i++] << 8 | bytes[i++]);
43594  }
43595  if (i < ii) {
43596    strBuf.push(bytes[i]);
43597  }
43598  return ii + "_" + String.fromCharCode.apply(null, strBuf);
43599}
43600class Parser {
43601  constructor({
43602    lexer,
43603    xref,
43604    allowStreams = false,
43605    recoveryMode = false
43606  }) {
43607    this.lexer = lexer;
43608    this.xref = xref;
43609    this.allowStreams = allowStreams;
43610    this.recoveryMode = recoveryMode;
43611    this.imageCache = Object.create(null);
43612    this._imageId = 0;
43613    this.refill();
43614  }
43615  refill() {
43616    this.buf1 = this.lexer.getObj();
43617    this.buf2 = this.lexer.getObj();
43618  }
43619  shift() {
43620    if (this.buf2 instanceof _primitives.Cmd && this.buf2.cmd === "ID") {
43621      this.buf1 = this.buf2;
43622      this.buf2 = null;
43623    } else {
43624      this.buf1 = this.buf2;
43625      this.buf2 = this.lexer.getObj();
43626    }
43627  }
43628  tryShift() {
43629    try {
43630      this.shift();
43631      return true;
43632    } catch (e) {
43633      if (e instanceof _core_utils.MissingDataException) {
43634        throw e;
43635      }
43636      return false;
43637    }
43638  }
43639  getObj(cipherTransform = null) {
43640    const buf1 = this.buf1;
43641    this.shift();
43642    if (buf1 instanceof _primitives.Cmd) {
43643      switch (buf1.cmd) {
43644        case "BI":
43645          return this.makeInlineImage(cipherTransform);
43646        case "[":
43647          const array = [];
43648          while (!(0, _primitives.isCmd)(this.buf1, "]") && this.buf1 !== _primitives.EOF) {
43649            array.push(this.getObj(cipherTransform));
43650          }
43651          if (this.buf1 === _primitives.EOF) {
43652            if (this.recoveryMode) {
43653              return array;
43654            }
43655            throw new _core_utils.ParserEOFException("End of file inside array.");
43656          }
43657          this.shift();
43658          return array;
43659        case "<<":
43660          const dict = new _primitives.Dict(this.xref);
43661          while (!(0, _primitives.isCmd)(this.buf1, ">>") && this.buf1 !== _primitives.EOF) {
43662            if (!(this.buf1 instanceof _primitives.Name)) {
43663              (0, _util.info)("Malformed dictionary: key must be a name object");
43664              this.shift();
43665              continue;
43666            }
43667            const key = this.buf1.name;
43668            this.shift();
43669            if (this.buf1 === _primitives.EOF) {
43670              break;
43671            }
43672            dict.set(key, this.getObj(cipherTransform));
43673          }
43674          if (this.buf1 === _primitives.EOF) {
43675            if (this.recoveryMode) {
43676              return dict;
43677            }
43678            throw new _core_utils.ParserEOFException("End of file inside dictionary.");
43679          }
43680          if ((0, _primitives.isCmd)(this.buf2, "stream")) {
43681            return this.allowStreams ? this.makeStream(dict, cipherTransform) : dict;
43682          }
43683          this.shift();
43684          return dict;
43685        default:
43686          return buf1;
43687      }
43688    }
43689    if (Number.isInteger(buf1)) {
43690      if (Number.isInteger(this.buf1) && (0, _primitives.isCmd)(this.buf2, "R")) {
43691        const ref = _primitives.Ref.get(buf1, this.buf1);
43692        this.shift();
43693        this.shift();
43694        return ref;
43695      }
43696      return buf1;
43697    }
43698    if (typeof buf1 === "string") {
43699      if (cipherTransform) {
43700        return cipherTransform.decryptString(buf1);
43701      }
43702      return buf1;
43703    }
43704    return buf1;
43705  }
43706  findDefaultInlineStreamEnd(stream) {
43707    const E = 0x45,
43708      I = 0x49,
43709      SPACE = 0x20,
43710      LF = 0xa,
43711      CR = 0xd,
43712      NUL = 0x0;
43713    const {
43714        knownCommands
43715      } = this.lexer,
43716      startPos = stream.pos,
43717      n = 15;
43718    let state = 0,
43719      ch,
43720      maybeEIPos;
43721    while ((ch = stream.getByte()) !== -1) {
43722      if (state === 0) {
43723        state = ch === E ? 1 : 0;
43724      } else if (state === 1) {
43725        state = ch === I ? 2 : 0;
43726      } else {
43727        if (ch === SPACE || ch === LF || ch === CR) {
43728          maybeEIPos = stream.pos;
43729          const followingBytes = stream.peekBytes(n);
43730          const ii = followingBytes.length;
43731          if (ii === 0) {
43732            break;
43733          }
43734          for (let i = 0; i < ii; i++) {
43735            ch = followingBytes[i];
43736            if (ch === NUL && followingBytes[i + 1] !== NUL) {
43737              continue;
43738            }
43739            if (ch !== LF && ch !== CR && (ch < SPACE || ch > 0x7f)) {
43740              state = 0;
43741              break;
43742            }
43743          }
43744          if (state !== 2) {
43745            continue;
43746          }
43747          if (!knownCommands) {
43748            (0, _util.warn)("findDefaultInlineStreamEnd - `lexer.knownCommands` is undefined.");
43749            continue;
43750          }
43751          const tmpLexer = new Lexer(new _stream.Stream(followingBytes.slice()), knownCommands);
43752          tmpLexer._hexStringWarn = () => {};
43753          let numArgs = 0;
43754          while (true) {
43755            const nextObj = tmpLexer.getObj();
43756            if (nextObj === _primitives.EOF) {
43757              state = 0;
43758              break;
43759            }
43760            if (nextObj instanceof _primitives.Cmd) {
43761              const knownCommand = knownCommands[nextObj.cmd];
43762              if (!knownCommand) {
43763                state = 0;
43764                break;
43765              } else if (knownCommand.variableArgs ? numArgs <= knownCommand.numArgs : numArgs === knownCommand.numArgs) {
43766                break;
43767              }
43768              numArgs = 0;
43769              continue;
43770            }
43771            numArgs++;
43772          }
43773          if (state === 2) {
43774            break;
43775          }
43776        } else {
43777          state = 0;
43778        }
43779      }
43780    }
43781    if (ch === -1) {
43782      (0, _util.warn)("findDefaultInlineStreamEnd: " + "Reached the end of the stream without finding a valid EI marker");
43783      if (maybeEIPos) {
43784        (0, _util.warn)('... trying to recover by using the last "EI" occurrence.');
43785        stream.skip(-(stream.pos - maybeEIPos));
43786      }
43787    }
43788    let endOffset = 4;
43789    stream.skip(-endOffset);
43790    ch = stream.peekByte();
43791    stream.skip(endOffset);
43792    if (!(0, _core_utils.isWhiteSpace)(ch)) {
43793      endOffset--;
43794    }
43795    return stream.pos - endOffset - startPos;
43796  }
43797  findDCTDecodeInlineStreamEnd(stream) {
43798    const startPos = stream.pos;
43799    let foundEOI = false,
43800      b,
43801      markerLength;
43802    while ((b = stream.getByte()) !== -1) {
43803      if (b !== 0xff) {
43804        continue;
43805      }
43806      switch (stream.getByte()) {
43807        case 0x00:
43808          break;
43809        case 0xff:
43810          stream.skip(-1);
43811          break;
43812        case 0xd9:
43813          foundEOI = true;
43814          break;
43815        case 0xc0:
43816        case 0xc1:
43817        case 0xc2:
43818        case 0xc3:
43819        case 0xc5:
43820        case 0xc6:
43821        case 0xc7:
43822        case 0xc9:
43823        case 0xca:
43824        case 0xcb:
43825        case 0xcd:
43826        case 0xce:
43827        case 0xcf:
43828        case 0xc4:
43829        case 0xcc:
43830        case 0xda:
43831        case 0xdb:
43832        case 0xdc:
43833        case 0xdd:
43834        case 0xde:
43835        case 0xdf:
43836        case 0xe0:
43837        case 0xe1:
43838        case 0xe2:
43839        case 0xe3:
43840        case 0xe4:
43841        case 0xe5:
43842        case 0xe6:
43843        case 0xe7:
43844        case 0xe8:
43845        case 0xe9:
43846        case 0xea:
43847        case 0xeb:
43848        case 0xec:
43849        case 0xed:
43850        case 0xee:
43851        case 0xef:
43852        case 0xfe:
43853          markerLength = stream.getUint16();
43854          if (markerLength > 2) {
43855            stream.skip(markerLength - 2);
43856          } else {
43857            stream.skip(-2);
43858          }
43859          break;
43860      }
43861      if (foundEOI) {
43862        break;
43863      }
43864    }
43865    const length = stream.pos - startPos;
43866    if (b === -1) {
43867      (0, _util.warn)("Inline DCTDecode image stream: " + "EOI marker not found, searching for /EI/ instead.");
43868      stream.skip(-length);
43869      return this.findDefaultInlineStreamEnd(stream);
43870    }
43871    this.inlineStreamSkipEI(stream);
43872    return length;
43873  }
43874  findASCII85DecodeInlineStreamEnd(stream) {
43875    const TILDE = 0x7e,
43876      GT = 0x3e;
43877    const startPos = stream.pos;
43878    let ch;
43879    while ((ch = stream.getByte()) !== -1) {
43880      if (ch === TILDE) {
43881        const tildePos = stream.pos;
43882        ch = stream.peekByte();
43883        while ((0, _core_utils.isWhiteSpace)(ch)) {
43884          stream.skip();
43885          ch = stream.peekByte();
43886        }
43887        if (ch === GT) {
43888          stream.skip();
43889          break;
43890        }
43891        if (stream.pos > tildePos) {
43892          const maybeEI = stream.peekBytes(2);
43893          if (maybeEI[0] === 0x45 && maybeEI[1] === 0x49) {
43894            break;
43895          }
43896        }
43897      }
43898    }
43899    const length = stream.pos - startPos;
43900    if (ch === -1) {
43901      (0, _util.warn)("Inline ASCII85Decode image stream: " + "EOD marker not found, searching for /EI/ instead.");
43902      stream.skip(-length);
43903      return this.findDefaultInlineStreamEnd(stream);
43904    }
43905    this.inlineStreamSkipEI(stream);
43906    return length;
43907  }
43908  findASCIIHexDecodeInlineStreamEnd(stream) {
43909    const GT = 0x3e;
43910    const startPos = stream.pos;
vendor: 11,483 bytes, lines 43911-44239
43911    let ch;
43912    while ((ch = stream.getByte()) !== -1) {
43913      if (ch === GT) {
43914        break;
43915      }
43916    }
43917    const length = stream.pos - startPos;
43918    if (ch === -1) {
43919      (0, _util.warn)("Inline ASCIIHexDecode image stream: " + "EOD marker not found, searching for /EI/ instead.");
43920      stream.skip(-length);
43921      return this.findDefaultInlineStreamEnd(stream);
43922    }
43923    this.inlineStreamSkipEI(stream);
43924    return length;
43925  }
43926  inlineStreamSkipEI(stream) {
43927    const E = 0x45,
43928      I = 0x49;
43929    let state = 0,
43930      ch;
43931    while ((ch = stream.getByte()) !== -1) {
43932      if (state === 0) {
43933        state = ch === E ? 1 : 0;
43934      } else if (state === 1) {
43935        state = ch === I ? 2 : 0;
43936      } else if (state === 2) {
43937        break;
43938      }
43939    }
43940  }
43941  makeInlineImage(cipherTransform) {
43942    const lexer = this.lexer;
43943    const stream = lexer.stream;
43944    const dictMap = Object.create(null);
43945    let dictLength;
43946    while (!(0, _primitives.isCmd)(this.buf1, "ID") && this.buf1 !== _primitives.EOF) {
43947      if (!(this.buf1 instanceof _primitives.Name)) {
43948        throw new _util.FormatError("Dictionary key must be a name object");
43949      }
43950      const key = this.buf1.name;
43951      this.shift();
43952      if (this.buf1 === _primitives.EOF) {
43953        break;
43954      }
43955      dictMap[key] = this.getObj(cipherTransform);
43956    }
43957    if (lexer.beginInlineImagePos !== -1) {
43958      dictLength = stream.pos - lexer.beginInlineImagePos;
43959    }
43960    const filter = this.xref.fetchIfRef(dictMap.F || dictMap.Filter);
43961    let filterName;
43962    if (filter instanceof _primitives.Name) {
43963      filterName = filter.name;
43964    } else if (Array.isArray(filter)) {
43965      const filterZero = this.xref.fetchIfRef(filter[0]);
43966      if (filterZero instanceof _primitives.Name) {
43967        filterName = filterZero.name;
43968      }
43969    }
43970    const startPos = stream.pos;
43971    let length;
43972    switch (filterName) {
43973      case "DCT":
43974      case "DCTDecode":
43975        length = this.findDCTDecodeInlineStreamEnd(stream);
43976        break;
43977      case "A85":
43978      case "ASCII85Decode":
43979        length = this.findASCII85DecodeInlineStreamEnd(stream);
43980        break;
43981      case "AHx":
43982      case "ASCIIHexDecode":
43983        length = this.findASCIIHexDecodeInlineStreamEnd(stream);
43984        break;
43985      default:
43986        length = this.findDefaultInlineStreamEnd(stream);
43987    }
43988    let cacheKey;
43989    if (length < MAX_LENGTH_TO_CACHE && dictLength > 0) {
43990      const initialStreamPos = stream.pos;
43991      stream.pos = lexer.beginInlineImagePos;
43992      cacheKey = getInlineImageCacheKey(stream.getBytes(dictLength + length));
43993      stream.pos = initialStreamPos;
43994      const cacheEntry = this.imageCache[cacheKey];
43995      if (cacheEntry !== undefined) {
43996        this.buf2 = _primitives.Cmd.get("EI");
43997        this.shift();
43998        cacheEntry.reset();
43999        return cacheEntry;
44000      }
44001    }
44002    const dict = new _primitives.Dict(this.xref);
44003    for (const key in dictMap) {
44004      dict.set(key, dictMap[key]);
44005    }
44006    let imageStream = stream.makeSubStream(startPos, length, dict);
44007    if (cipherTransform) {
44008      imageStream = cipherTransform.createStream(imageStream, length);
44009    }
44010    imageStream = this.filter(imageStream, dict, length);
44011    imageStream.dict = dict;
44012    if (cacheKey !== undefined) {
44013      imageStream.cacheKey = `inline_img_${++this._imageId}`;
44014      this.imageCache[cacheKey] = imageStream;
44015    }
44016    this.buf2 = _primitives.Cmd.get("EI");
44017    this.shift();
44018    return imageStream;
44019  }
44020  _findStreamLength(startPos, signature) {
44021    const {
44022      stream
44023    } = this.lexer;
44024    stream.pos = startPos;
44025    const SCAN_BLOCK_LENGTH = 2048;
44026    const signatureLength = signature.length;
44027    while (stream.pos < stream.end) {
44028      const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
44029      const scanLength = scanBytes.length - signatureLength;
44030      if (scanLength <= 0) {
44031        break;
44032      }
44033      let pos = 0;
44034      while (pos < scanLength) {
44035        let j = 0;
44036        while (j < signatureLength && scanBytes[pos + j] === signature[j]) {
44037          j++;
44038        }
44039        if (j >= signatureLength) {
44040          stream.pos += pos;
44041          return stream.pos - startPos;
44042        }
44043        pos++;
44044      }
44045      stream.pos += scanLength;
44046    }
44047    return -1;
44048  }
44049  makeStream(dict, cipherTransform) {
44050    const lexer = this.lexer;
44051    let stream = lexer.stream;
44052    lexer.skipToNextLine();
44053    const startPos = stream.pos - 1;
44054    let length = dict.get("Length");
44055    if (!Number.isInteger(length)) {
44056      (0, _util.info)(`Bad length "${length && length.toString()}" in stream.`);
44057      length = 0;
44058    }
44059    stream.pos = startPos + length;
44060    lexer.nextChar();
44061    if (this.tryShift() && (0, _primitives.isCmd)(this.buf2, "endstream")) {
44062      this.shift();
44063    } else {
44064      const ENDSTREAM_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d]);
44065      let actualLength = this._findStreamLength(startPos, ENDSTREAM_SIGNATURE);
44066      if (actualLength < 0) {
44067        const MAX_TRUNCATION = 1;
44068        for (let i = 1; i <= MAX_TRUNCATION; i++) {
44069          const end = ENDSTREAM_SIGNATURE.length - i;
44070          const TRUNCATED_SIGNATURE = ENDSTREAM_SIGNATURE.slice(0, end);
44071          const maybeLength = this._findStreamLength(startPos, TRUNCATED_SIGNATURE);
44072          if (maybeLength >= 0) {
44073            const lastByte = stream.peekBytes(end + 1)[end];
44074            if (!(0, _core_utils.isWhiteSpace)(lastByte)) {
44075              break;
44076            }
44077            (0, _util.info)(`Found "${(0, _util.bytesToString)(TRUNCATED_SIGNATURE)}" when ` + "searching for endstream command.");
44078            actualLength = maybeLength;
44079            break;
44080          }
44081        }
44082        if (actualLength < 0) {
44083          throw new _util.FormatError("Missing endstream command.");
44084        }
44085      }
44086      length = actualLength;
44087      lexer.nextChar();
44088      this.shift();
44089      this.shift();
44090    }
44091    this.shift();
44092    stream = stream.makeSubStream(startPos, length, dict);
44093    if (cipherTransform) {
44094      stream = cipherTransform.createStream(stream, length);
44095    }
44096    stream = this.filter(stream, dict, length);
44097    stream.dict = dict;
44098    return stream;
44099  }
44100  filter(stream, dict, length) {
44101    let filter = dict.get("F", "Filter");
44102    let params = dict.get("DP", "DecodeParms");
44103    if (filter instanceof _primitives.Name) {
44104      if (Array.isArray(params)) {
44105        (0, _util.warn)("/DecodeParms should not be an Array, when /Filter is a Name.");
44106      }
44107      return this.makeFilter(stream, filter.name, length, params);
44108    }
44109    let maybeLength = length;
44110    if (Array.isArray(filter)) {
44111      const filterArray = filter;
44112      const paramsArray = params;
44113      for (let i = 0, ii = filterArray.length; i < ii; ++i) {
44114        filter = this.xref.fetchIfRef(filterArray[i]);
44115        if (!(filter instanceof _primitives.Name)) {
44116          throw new _util.FormatError(`Bad filter name "${filter}"`);
44117        }
44118        params = null;
44119        if (Array.isArray(paramsArray) && i in paramsArray) {
44120          params = this.xref.fetchIfRef(paramsArray[i]);
44121        }
44122        stream = this.makeFilter(stream, filter.name, maybeLength, params);
44123        maybeLength = null;
44124      }
44125    }
44126    return stream;
44127  }
44128  makeFilter(stream, name, maybeLength, params) {
44129    if (maybeLength === 0) {
44130      (0, _util.warn)(`Empty "${name}" stream.`);
44131      return new _stream.NullStream();
44132    }
44133    try {
44134      switch (name) {
44135        case "Fl":
44136        case "FlateDecode":
44137          if (params) {
44138            return new _predictor_stream.PredictorStream(new _flate_stream.FlateStream(stream, maybeLength), maybeLength, params);
44139          }
44140          return new _flate_stream.FlateStream(stream, maybeLength);
44141        case "LZW":
44142        case "LZWDecode":
44143          let earlyChange = 1;
44144          if (params) {
44145            if (params.has("EarlyChange")) {
44146              earlyChange = params.get("EarlyChange");
44147            }
44148            return new _predictor_stream.PredictorStream(new _lzw_stream.LZWStream(stream, maybeLength, earlyChange), maybeLength, params);
44149          }
44150          return new _lzw_stream.LZWStream(stream, maybeLength, earlyChange);
44151        case "DCT":
44152        case "DCTDecode":
44153          return new _jpeg_stream.JpegStream(stream, maybeLength, params);
44154        case "JPX":
44155        case "JPXDecode":
44156          return new _jpx_stream.JpxStream(stream, maybeLength, params);
44157        case "A85":
44158        case "ASCII85Decode":
44159          return new _ascii_85_stream.Ascii85Stream(stream, maybeLength);
44160        case "AHx":
44161        case "ASCIIHexDecode":
44162          return new _ascii_hex_stream.AsciiHexStream(stream, maybeLength);
44163        case "CCF":
44164        case "CCITTFaxDecode":
44165          return new _ccitt_stream.CCITTFaxStream(stream, maybeLength, params);
44166        case "RL":
44167        case "RunLengthDecode":
44168          return new _run_length_stream.RunLengthStream(stream, maybeLength);
44169        case "JBIG2Decode":
44170          return new _jbig2_stream.Jbig2Stream(stream, maybeLength, params);
44171      }
44172      (0, _util.warn)(`Filter "${name}" is not supported.`);
44173      return stream;
44174    } catch (ex) {
44175      if (ex instanceof _core_utils.MissingDataException) {
44176        throw ex;
44177      }
44178      (0, _util.warn)(`Invalid stream: "${ex}"`);
44179      return new _stream.NullStream();
44180    }
44181  }
44182}
44183exports.Parser = Parser;
44184const 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];
44185function toHexDigit(ch) {
44186  if (ch >= 0x30 && ch <= 0x39) {
44187    return ch & 0x0f;
44188  }
44189  if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
44190    return (ch & 0x0f) + 9;
44191  }
44192  return -1;
44193}
44194class Lexer {
44195  constructor(stream, knownCommands = null) {
44196    this.stream = stream;
44197    this.nextChar();
44198    this.strBuf = [];
44199    this.knownCommands = knownCommands;
44200    this._hexStringNumWarn = 0;
44201    this.beginInlineImagePos = -1;
44202  }
44203  nextChar() {
44204    return this.currentChar = this.stream.getByte();
44205  }
44206  peekChar() {
44207    return this.stream.peekByte();
44208  }
44209  getNumber() {
44210    let ch = this.currentChar;
44211    let eNotation = false;
44212    let divideBy = 0;
44213    let sign = 1;
44214    if (ch === 0x2d) {
44215      sign = -1;
44216      ch = this.nextChar();
44217      if (ch === 0x2d) {
44218        ch = this.nextChar();
44219      }
44220    } else if (ch === 0x2b) {
44221      ch = this.nextChar();
44222    }
44223    if (ch === 0x0a || ch === 0x0d) {
44224      do {
44225        ch = this.nextChar();
44226      } while (ch === 0x0a || ch === 0x0d);
44227    }
44228    if (ch === 0x2e) {
44229      divideBy = 10;
44230      ch = this.nextChar();
44231    }
44232    if (ch < 0x30 || ch > 0x39) {
44233      const msg = `Invalid number: ${String.fromCharCode(ch)} (charCode ${ch})`;
44234      if ((0, _core_utils.isWhiteSpace)(ch) || ch === -1) {
44235        (0, _util.info)(`Lexer.getNumber - "${msg}".`);
44236        return 0;
44237      }
44238      throw new _util.FormatError(msg);
44239    }
vendor: 8,423 bytes, lines 44239-44547
44239
44240    let baseValue = ch - 0x30;
44241    let powerValue = 0;
44242    let powerValueSign = 1;
44243    while ((ch = this.nextChar()) >= 0) {
44244      if (ch >= 0x30 && ch <= 0x39) {
44245        const currentDigit = ch - 0x30;
44246        if (eNotation) {
44247          powerValue = powerValue * 10 + currentDigit;
44248        } else {
44249          if (divideBy !== 0) {
44250            divideBy *= 10;
44251          }
44252          baseValue = baseValue * 10 + currentDigit;
44253        }
44254      } else if (ch === 0x2e) {
44255        if (divideBy === 0) {
44256          divideBy = 1;
44257        } else {
44258          break;
44259        }
44260      } else if (ch === 0x2d) {
44261        (0, _util.warn)("Badly formatted number: minus sign in the middle");
44262      } else if (ch === 0x45 || ch === 0x65) {
44263        ch = this.peekChar();
44264        if (ch === 0x2b || ch === 0x2d) {
44265          powerValueSign = ch === 0x2d ? -1 : 1;
44266          this.nextChar();
44267        } else if (ch < 0x30 || ch > 0x39) {
44268          break;
44269        }
44270        eNotation = true;
44271      } else {
44272        break;
44273      }
44274    }
44275    if (divideBy !== 0) {
44276      baseValue /= divideBy;
44277    }
44278    if (eNotation) {
44279      baseValue *= 10 ** (powerValueSign * powerValue);
44280    }
44281    return sign * baseValue;
44282  }
44283  getString() {
44284    let numParen = 1;
44285    let done = false;
44286    const strBuf = this.strBuf;
44287    strBuf.length = 0;
44288    let ch = this.nextChar();
44289    while (true) {
44290      let charBuffered = false;
44291      switch (ch | 0) {
44292        case -1:
44293          (0, _util.warn)("Unterminated string");
44294          done = true;
44295          break;
44296        case 0x28:
44297          ++numParen;
44298          strBuf.push("(");
44299          break;
44300        case 0x29:
44301          if (--numParen === 0) {
44302            this.nextChar();
44303            done = true;
44304          } else {
44305            strBuf.push(")");
44306          }
44307          break;
44308        case 0x5c:
44309          ch = this.nextChar();
44310          switch (ch) {
44311            case -1:
44312              (0, _util.warn)("Unterminated string");
44313              done = true;
44314              break;
44315            case 0x6e:
44316              strBuf.push("\n");
44317              break;
44318            case 0x72:
44319              strBuf.push("\r");
44320              break;
44321            case 0x74:
44322              strBuf.push("\t");
44323              break;
44324            case 0x62:
44325              strBuf.push("\b");
44326              break;
44327            case 0x66:
44328              strBuf.push("\f");
44329              break;
44330            case 0x5c:
44331            case 0x28:
44332            case 0x29:
44333              strBuf.push(String.fromCharCode(ch));
44334              break;
44335            case 0x30:
44336            case 0x31:
44337            case 0x32:
44338            case 0x33:
44339            case 0x34:
44340            case 0x35:
44341            case 0x36:
44342            case 0x37:
44343              let x = ch & 0x0f;
44344              ch = this.nextChar();
44345              charBuffered = true;
44346              if (ch >= 0x30 && ch <= 0x37) {
44347                x = (x << 3) + (ch & 0x0f);
44348                ch = this.nextChar();
44349                if (ch >= 0x30 && ch <= 0x37) {
44350                  charBuffered = false;
44351                  x = (x << 3) + (ch & 0x0f);
44352                }
44353              }
44354              strBuf.push(String.fromCharCode(x));
44355              break;
44356            case 0x0d:
44357              if (this.peekChar() === 0x0a) {
44358                this.nextChar();
44359              }
44360              break;
44361            case 0x0a:
44362              break;
44363            default:
44364              strBuf.push(String.fromCharCode(ch));
44365              break;
44366          }
44367          break;
44368        default:
44369          strBuf.push(String.fromCharCode(ch));
44370          break;
44371      }
44372      if (done) {
44373        break;
44374      }
44375      if (!charBuffered) {
44376        ch = this.nextChar();
44377      }
44378    }
44379    return strBuf.join("");
44380  }
44381  getName() {
44382    let ch, previousCh;
44383    const strBuf = this.strBuf;
44384    strBuf.length = 0;
44385    while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
44386      if (ch === 0x23) {
44387        ch = this.nextChar();
44388        if (specialChars[ch]) {
44389          (0, _util.warn)("Lexer_getName: " + "NUMBER SIGN (#) should be followed by a hexadecimal number.");
44390          strBuf.push("#");
44391          break;
44392        }
44393        const x = toHexDigit(ch);
44394        if (x !== -1) {
44395          previousCh = ch;
44396          ch = this.nextChar();
44397          const x2 = toHexDigit(ch);
44398          if (x2 === -1) {
44399            (0, _util.warn)(`Lexer_getName: Illegal digit (${String.fromCharCode(ch)}) ` + "in hexadecimal number.");
44400            strBuf.push("#", String.fromCharCode(previousCh));
44401            if (specialChars[ch]) {
44402              break;
44403            }
44404            strBuf.push(String.fromCharCode(ch));
44405            continue;
44406          }
44407          strBuf.push(String.fromCharCode(x << 4 | x2));
44408        } else {
44409          strBuf.push("#", String.fromCharCode(ch));
44410        }
44411      } else {
44412        strBuf.push(String.fromCharCode(ch));
44413      }
44414    }
44415    if (strBuf.length > 127) {
44416      (0, _util.warn)(`Name token is longer than allowed by the spec: ${strBuf.length}`);
44417    }
44418    return _primitives.Name.get(strBuf.join(""));
44419  }
44420  _hexStringWarn(ch) {
44421    const MAX_HEX_STRING_NUM_WARN = 5;
44422    if (this._hexStringNumWarn++ === MAX_HEX_STRING_NUM_WARN) {
44423      (0, _util.warn)("getHexString - ignoring additional invalid characters.");
44424      return;
44425    }
44426    if (this._hexStringNumWarn > MAX_HEX_STRING_NUM_WARN) {
44427      return;
44428    }
44429    (0, _util.warn)(`getHexString - ignoring invalid character: ${ch}`);
44430  }
44431  getHexString() {
44432    const strBuf = this.strBuf;
44433    strBuf.length = 0;
44434    let ch = this.currentChar;
44435    let isFirstHex = true;
44436    let firstDigit, secondDigit;
44437    this._hexStringNumWarn = 0;
44438    while (true) {
44439      if (ch < 0) {
44440        (0, _util.warn)("Unterminated hex string");
44441        break;
44442      } else if (ch === 0x3e) {
44443        this.nextChar();
44444        break;
44445      } else if (specialChars[ch] === 1) {
44446        ch = this.nextChar();
44447        continue;
44448      } else {
44449        if (isFirstHex) {
44450          firstDigit = toHexDigit(ch);
44451          if (firstDigit === -1) {
44452            this._hexStringWarn(ch);
44453            ch = this.nextChar();
44454            continue;
44455          }
44456        } else {
44457          secondDigit = toHexDigit(ch);
44458          if (secondDigit === -1) {
44459            this._hexStringWarn(ch);
44460            ch = this.nextChar();
44461            continue;
44462          }
44463          strBuf.push(String.fromCharCode(firstDigit << 4 | secondDigit));
44464        }
44465        isFirstHex = !isFirstHex;
44466        ch = this.nextChar();
44467      }
44468    }
44469    return strBuf.join("");
44470  }
44471  getObj() {
44472    let comment = false;
44473    let ch = this.currentChar;
44474    while (true) {
44475      if (ch < 0) {
44476        return _primitives.EOF;
44477      }
44478      if (comment) {
44479        if (ch === 0x0a || ch === 0x0d) {
44480          comment = false;
44481        }
44482      } else if (ch === 0x25) {
44483        comment = true;
44484      } else if (specialChars[ch] !== 1) {
44485        break;
44486      }
44487      ch = this.nextChar();
44488    }
44489    switch (ch | 0) {
44490      case 0x30:
44491      case 0x31:
44492      case 0x32:
44493      case 0x33:
44494      case 0x34:
44495      case 0x35:
44496      case 0x36:
44497      case 0x37:
44498      case 0x38:
44499      case 0x39:
44500      case 0x2b:
44501      case 0x2d:
44502      case 0x2e:
44503        return this.getNumber();
44504      case 0x28:
44505        return this.getString();
44506      case 0x2f:
44507        return this.getName();
44508      case 0x5b:
44509        this.nextChar();
44510        return _primitives.Cmd.get("[");
44511      case 0x5d:
44512        this.nextChar();
44513        return _primitives.Cmd.get("]");
44514      case 0x3c:
44515        ch = this.nextChar();
44516        if (ch === 0x3c) {
44517          this.nextChar();
44518          return _primitives.Cmd.get("<<");
44519        }
44520        return this.getHexString();
44521      case 0x3e:
44522        ch = this.nextChar();
44523        if (ch === 0x3e) {
44524          this.nextChar();
44525          return _primitives.Cmd.get(">>");
44526        }
44527        return _primitives.Cmd.get(">");
44528      case 0x7b:
44529        this.nextChar();
44530        return _primitives.Cmd.get("{");
44531      case 0x7d:
44532        this.nextChar();
44533        return _primitives.Cmd.get("}");
44534      case 0x29:
44535        this.nextChar();
44536        throw new _util.FormatError(`Illegal character: ${ch}`);
44537    }
44538    let str = String.fromCharCode(ch);
44539    if (ch < 0x20 || ch > 0x7f) {
44540      const nextCh = this.peekChar();
44541      if (nextCh >= 0x20 && nextCh <= 0x7f) {
44542        this.nextChar();
44543        return _primitives.Cmd.get(str);
44544      }
44545    }
44546    const knownCommands = this.knownCommands;
44547    let knownCommandFound = knownCommands
vendor: 734 bytes, lines 44547-44571
44547?.[str] !== undefined;
44548    while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
44549      const possibleCommand = str + String.fromCharCode(ch);
44550      if (knownCommandFound && knownCommands[possibleCommand] === undefined) {
44551        break;
44552      }
44553      if (str.length === 128) {
44554        throw new _util.FormatError(`Command token too long: ${str.length}`);
44555      }
44556      str = possibleCommand;
44557      knownCommandFound = knownCommands?.[str] !== undefined;
44558    }
44559    if (str === "true") {
44560      return true;
44561    }
44562    if (str === "false") {
44563      return false;
44564    }
44565    if (str === "null") {
44566      return null;
44567    }
44568    if (str === "BI") {
44569      this.beginInlineImagePos = this.stream.pos;
44570    }
44571    return _primitives.Cmd.get(str)
vendor: 2,317 bytes, lines 44571-44642
44571;
44572  }
44573  skipToNextLine() {
44574    let ch = this.currentChar;
44575    while (ch >= 0) {
44576      if (ch === 0x0d) {
44577        ch = this.nextChar();
44578        if (ch === 0x0a) {
44579          this.nextChar();
44580        }
44581        break;
44582      } else if (ch === 0x0a) {
44583        this.nextChar();
44584        break;
44585      }
44586      ch = this.nextChar();
44587    }
44588  }
44589}
44590exports.Lexer = Lexer;
44591class Linearization {
44592  static create(stream) {
44593    function getInt(linDict, name, allowZeroValue = false) {
44594      const obj = linDict.get(name);
44595      if (Number.isInteger(obj) && (allowZeroValue ? obj >= 0 : obj > 0)) {
44596        return obj;
44597      }
44598      throw new Error(`The "${name}" parameter in the linearization ` + "dictionary is invalid.");
44599    }
44600    function getHints(linDict) {
44601      const hints = linDict.get("H");
44602      let hintsLength;
44603      if (Array.isArray(hints) && ((hintsLength = hints.length) === 2 || hintsLength === 4)) {
44604        for (let index = 0; index < hintsLength; index++) {
44605          const hint = hints[index];
44606          if (!(Number.isInteger(hint) && hint > 0)) {
44607            throw new Error(`Hint (${index}) in the linearization dictionary is invalid.`);
44608          }
44609        }
44610        return hints;
44611      }
44612      throw new Error("Hint array in the linearization dictionary is invalid.");
44613    }
44614    const parser = new Parser({
44615      lexer: new Lexer(stream),
44616      xref: null
44617    });
44618    const obj1 = parser.getObj();
44619    const obj2 = parser.getObj();
44620    const obj3 = parser.getObj();
44621    const linDict = parser.getObj();
44622    let obj, length;
44623    if (!(Number.isInteger(obj1) && Number.isInteger(obj2) && (0, _primitives.isCmd)(obj3, "obj") && linDict instanceof _primitives.Dict && typeof (obj = linDict.get("Linearized")) === "number" && obj > 0)) {
44624      return null;
44625    } else if ((length = getInt(linDict, "L")) !== stream.length) {
44626      throw new Error('The "L" parameter in the linearization dictionary ' + "does not equal the stream length.");
44627    }
44628    return {
44629      length,
44630      hints: getHints(linDict),
44631      objectNumberFirst: getInt(linDict, "O"),
44632      endFirst: getInt(linDict, "E"),
44633      numPages: getInt(linDict, "N"),
44634      mainXRefEntriesOffset: getInt(linDict, "T"),
44635      pageFirst: linDict.has("P") ? getInt(linDict, "P", true) : 0
44636    };
44637  }
44638}
44639exports.Linearization = Linearization;
44640
44641/***/ }),
44642/* 1
vendor: 8,538 bytes, lines 44642-44976
446427 */
44643/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
44644
44645
44646
44647Object.defineProperty(exports, "__esModule", ({
44648  value: true
44649}));
44650exports.Ascii85Stream = void 0;
44651var _decode_stream = __w_pdfjs_require__(18);
44652var _core_utils = __w_pdfjs_require__(3);
44653class Ascii85Stream extends _decode_stream.DecodeStream {
44654  constructor(str, maybeLength) {
44655    if (maybeLength) {
44656      maybeLength *= 0.8;
44657    }
44658    super(maybeLength);
44659    this.str = str;
44660    this.dict = str.dict;
44661    this.input = new Uint8Array(5);
44662  }
44663  readBlock() {
44664    const TILDA_CHAR = 0x7e;
44665    const Z_LOWER_CHAR = 0x7a;
44666    const EOF = -1;
44667    const str = this.str;
44668    let c = str.getByte();
44669    while ((0, _core_utils.isWhiteSpace)(c)) {
44670      c = str.getByte();
44671    }
44672    if (c === EOF || c === TILDA_CHAR) {
44673      this.eof = true;
44674      return;
44675    }
44676    const bufferLength = this.bufferLength;
44677    let buffer, i;
44678    if (c === Z_LOWER_CHAR) {
44679      buffer = this.ensureBuffer(bufferLength + 4);
44680      for (i = 0; i < 4; ++i) {
44681        buffer[bufferLength + i] = 0;
44682      }
44683      this.bufferLength += 4;
44684    } else {
44685      const input = this.input;
44686      input[0] = c;
44687      for (i = 1; i < 5; ++i) {
44688        c = str.getByte();
44689        while ((0, _core_utils.isWhiteSpace)(c)) {
44690          c = str.getByte();
44691        }
44692        input[i] = c;
44693        if (c === EOF || c === TILDA_CHAR) {
44694          break;
44695        }
44696      }
44697      buffer = this.ensureBuffer(bufferLength + i - 1);
44698      this.bufferLength += i - 1;
44699      if (i < 5) {
44700        for (; i < 5; ++i) {
44701          input[i] = 0x21 + 84;
44702        }
44703        this.eof = true;
44704      }
44705      let t = 0;
44706      for (i = 0; i < 5; ++i) {
44707        t = t * 85 + (input[i] - 0x21);
44708      }
44709      for (i = 3; i >= 0; --i) {
44710        buffer[bufferLength + i] = t & 0xff;
44711        t >>= 8;
44712      }
44713    }
44714  }
44715}
44716exports.Ascii85Stream = Ascii85Stream;
44717
44718/***/ }),
44719/* 18 */
44720/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
44721
44722
44723
44724Object.defineProperty(exports, "__esModule", ({
44725  value: true
44726}));
44727exports.StreamsSequenceStream = exports.DecodeStream = void 0;
44728var _base_stream = __w_pdfjs_require__(5);
44729var _stream = __w_pdfjs_require__(8);
44730const emptyBuffer = new Uint8Array(0);
44731class DecodeStream extends _base_stream.BaseStream {
44732  constructor(maybeMinBufferLength) {
44733    super();
44734    this._rawMinBufferLength = maybeMinBufferLength || 0;
44735    this.pos = 0;
44736    this.bufferLength = 0;
44737    this.eof = false;
44738    this.buffer = emptyBuffer;
44739    this.minBufferLength = 512;
44740    if (maybeMinBufferLength) {
44741      while (this.minBufferLength < maybeMinBufferLength) {
44742        this.minBufferLength *= 2;
44743      }
44744    }
44745  }
44746  get isEmpty() {
44747    while (!this.eof && this.bufferLength === 0) {
44748      this.readBlock();
44749    }
44750    return this.bufferLength === 0;
44751  }
44752  ensureBuffer(requested) {
44753    const buffer = this.buffer;
44754    if (requested <= buffer.byteLength) {
44755      return buffer;
44756    }
44757    let size = this.minBufferLength;
44758    while (size < requested) {
44759      size *= 2;
44760    }
44761    const buffer2 = new Uint8Array(size);
44762    buffer2.set(buffer);
44763    return this.buffer = buffer2;
44764  }
44765  getByte() {
44766    const pos = this.pos;
44767    while (this.bufferLength <= pos) {
44768      if (this.eof) {
44769        return -1;
44770      }
44771      this.readBlock();
44772    }
44773    return this.buffer[this.pos++];
44774  }
44775  getBytes(length) {
44776    const pos = this.pos;
44777    let end;
44778    if (length) {
44779      this.ensureBuffer(pos + length);
44780      end = pos + length;
44781      while (!this.eof && this.bufferLength < end) {
44782        this.readBlock();
44783      }
44784      const bufEnd = this.bufferLength;
44785      if (end > bufEnd) {
44786        end = bufEnd;
44787      }
44788    } else {
44789      while (!this.eof) {
44790        this.readBlock();
44791      }
44792      end = this.bufferLength;
44793    }
44794    this.pos = end;
44795    return this.buffer.subarray(pos, end);
44796  }
44797  reset() {
44798    this.pos = 0;
44799  }
44800  makeSubStream(start, length, dict = null) {
44801    if (length === undefined) {
44802      while (!this.eof) {
44803        this.readBlock();
44804      }
44805    } else {
44806      const end = start + length;
44807      while (this.bufferLength <= end && !this.eof) {
44808        this.readBlock();
44809      }
44810    }
44811    return new _stream.Stream(this.buffer, start, length, dict);
44812  }
44813  getBaseStreams() {
44814    return this.str ? this.str.getBaseStreams() : null;
44815  }
44816}
44817exports.DecodeStream = DecodeStream;
44818class StreamsSequenceStream extends DecodeStream {
44819  constructor(streams, onError = null) {
44820    let maybeLength = 0;
44821    for (const stream of streams) {
44822      maybeLength += stream instanceof DecodeStream ? stream._rawMinBufferLength : stream.length;
44823    }
44824    super(maybeLength);
44825    this.streams = streams;
44826    this._onError = onError;
44827  }
44828  readBlock() {
44829    const streams = this.streams;
44830    if (streams.length === 0) {
44831      this.eof = true;
44832      return;
44833    }
44834    const stream = streams.shift();
44835    let chunk;
44836    try {
44837      chunk = stream.getBytes();
44838    } catch (reason) {
44839      if (this._onError) {
44840        this._onError(reason, stream.dict?.objId);
44841        return;
44842      }
44843      throw reason;
44844    }
44845    const bufferLength = this.bufferLength;
44846    const newLength = bufferLength + chunk.length;
44847    const buffer = this.ensureBuffer(newLength);
44848    buffer.set(chunk, bufferLength);
44849    this.bufferLength = newLength;
44850  }
44851  getBaseStreams() {
44852    const baseStreamsBuf = [];
44853    for (const stream of this.streams) {
44854      const baseStreams = stream.getBaseStreams();
44855      if (baseStreams) {
44856        baseStreamsBuf.push(...baseStreams);
44857      }
44858    }
44859    return baseStreamsBuf.length > 0 ? baseStreamsBuf : null;
44860  }
44861}
44862exports.StreamsSequenceStream = StreamsSequenceStream;
44863
44864/***/ }),
44865/* 19 */
44866/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
44867
44868
44869
44870Object.defineProperty(exports, "__esModule", ({
44871  value: true
44872}));
44873exports.AsciiHexStream = void 0;
44874var _decode_stream = __w_pdfjs_require__(18);
44875class AsciiHexStream extends _decode_stream.DecodeStream {
44876  constructor(str, maybeLength) {
44877    if (maybeLength) {
44878      maybeLength *= 0.5;
44879    }
44880    super(maybeLength);
44881    this.str = str;
44882    this.dict = str.dict;
44883    this.firstDigit = -1;
44884  }
44885  readBlock() {
44886    const UPSTREAM_BLOCK_SIZE = 8000;
44887    const bytes = this.str.getBytes(UPSTREAM_BLOCK_SIZE);
44888    if (!bytes.length) {
44889      this.eof = true;
44890      return;
44891    }
44892    const maxDecodeLength = bytes.length + 1 >> 1;
44893    const buffer = this.ensureBuffer(this.bufferLength + maxDecodeLength);
44894    let bufferLength = this.bufferLength;
44895    let firstDigit = this.firstDigit;
44896    for (const ch of bytes) {
44897      let digit;
44898      if (ch >= 0x30 && ch <= 0x39) {
44899        digit = ch & 0x0f;
44900      } else if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
44901        digit = (ch & 0x0f) + 9;
44902      } else if (ch === 0x3e) {
44903        this.eof = true;
44904        break;
44905      } else {
44906        continue;
44907      }
44908      if (firstDigit < 0) {
44909        firstDigit = digit;
44910      } else {
44911        buffer[bufferLength++] = firstDigit << 4 | digit;
44912        firstDigit = -1;
44913      }
44914    }
44915    if (firstDigit >= 0 && this.eof) {
44916      buffer[bufferLength++] = firstDigit << 4;
44917      firstDigit = -1;
44918    }
44919    this.firstDigit = firstDigit;
44920    this.bufferLength = bufferLength;
44921  }
44922}
44923exports.AsciiHexStream = AsciiHexStream;
44924
44925/***/ }),
44926/* 20 */
44927/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
44928
44929
44930
44931Object.defineProperty(exports, "__esModule", ({
44932  value: true
44933}));
44934exports.CCITTFaxStream = void 0;
44935var _ccitt = __w_pdfjs_require__(21);
44936var _decode_stream = __w_pdfjs_require__(18);
44937var _primitives = __w_pdfjs_require__(4);
44938class CCITTFaxStream extends _decode_stream.DecodeStream {
44939  constructor(str, maybeLength, params) {
44940    super(maybeLength);
44941    this.str = str;
44942    this.dict = str.dict;
44943    if (!(params instanceof _primitives.Dict)) {
44944      params = _primitives.Dict.empty;
44945    }
44946    const source = {
44947      next() {
44948        return str.getByte();
44949      }
44950    };
44951    this.ccittFaxDecoder = new _ccitt.CCITTFaxDecoder(source, {
44952      K: params.get("K"),
44953      EndOfLine: params.get("EndOfLine"),
44954      EncodedByteAlign: params.get("EncodedByteAlign"),
44955      Columns: params.get("Columns"),
44956      Rows: params.get("Rows"),
44957      EndOfBlock: params.get("EndOfBlock"),
44958      BlackIs1: params.get("BlackIs1")
44959    });
44960  }
44961  readBlock() {
44962    while (!this.eof) {
44963      const c = this.ccittFaxDecoder.readNextChar();
44964      if (c === -1) {
44965        this.eof = true;
44966        return;
44967      }
44968      this.ensureBuffer(this.bufferLength + 1);
44969      this.buffer[this.bufferLength++] = c;
44970    }
44971  }
44972}
44973exports.CCITTFaxStream = CCITTFaxStream;
44974
44975/***/ }),
44976/* 21
vendor: 11,897 bytes, lines 44976-45015
44976 */
44977/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
44978
44979
44980
44981Object.defineProperty(exports, "__esModule", ({
44982  value: true
44983}));
44984exports.CCITTFaxDecoder = void 0;
44985var _util = __w_pdfjs_require__(2);
44986const ccittEOL = -2;
44987const ccittEOF = -1;
44988const twoDimPass = 0;
44989const twoDimHoriz = 1;
44990const twoDimVert0 = 2;
44991const twoDimVertR1 = 3;
44992const twoDimVertL1 = 4;
44993const twoDimVertR2 = 5;
44994const twoDimVertL2 = 6;
44995const twoDimVertR3 = 7;
44996const twoDimVertL3 = 8;
44997const twoDimTable = [[-1, -1], [-1, -1], [7, twoDimVertL3], [7, twoDimVertR3], [6, twoDimVertL2], [6, twoDimVertL2], [6, twoDimVertR2], [6, twoDimVertR2], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0]];
44998const whiteTable1 = [[-1, -1], [12, ccittEOL], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [11, 1792], [11, 1792], [12, 1984], [12, 2048], [12, 2112], [12, 2176], [12, 2240], [12, 2304], [11, 1856], [11, 1856], [11, 1920], [11, 1920], [12, 2368], [12, 2432], [12, 2496], [12, 2560]];
44999const whiteTable2 = [[-1, -1], [-1, -1], [-1, -1], [-1, -1], [8, 29], [8, 29], [8, 30], [8, 30], [8, 45], [8, 45], [8, 46], [8, 46], [7, 22], [7, 22], [7, 22], [7, 22], [7, 23], [7, 23], [7, 23], [7, 23], [8, 47], [8, 47], [8, 48], [8, 48], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [7, 20], [7, 20], [7, 20], [7, 20], [8, 33], [8, 33], [8, 34], [8, 34], [8, 35], [8, 35], [8, 36], [8, 36], [8, 37], [8, 37], [8, 38], [8, 38], [7, 19], [7, 19], [7, 19], [7, 19], [8, 31], [8, 31], [8, 32], [8, 32], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [8, 53], [8, 53], [8, 54], [8, 54], [7, 26], [7, 26], [7, 26], [7, 26], [8, 39], [8, 39], [8, 40], [8, 40], [8, 41], [8, 41], [8, 42], [8, 42], [8, 43], [8, 43], [8, 44], [8, 44], [7, 21], [7, 21], [7, 21], [7, 21], [7, 28], [7, 28], [7, 28], [7, 28], [8, 61], [8, 61], [8, 62], [8, 62], [8, 63], [8, 63], [8, 0], [8, 0], [8, 320], [8, 320], [8, 384], [8, 384], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [7, 27], [7, 27], [7, 27], [7, 27], [8, 59], [8, 59], [8, 60], [8, 60], [9, 1472], [9, 1536], [9, 1600], [9, 1728], [7, 18], [7, 18], [7, 18], [7, 18], [7, 24], [7, 24], [7, 24], [7, 24], [8, 49], [8, 49], [8, 50], [8, 50], [8, 51], [8, 51], [8, 52], [8, 52], [7, 25], [7, 25], [7, 25], [7, 25], [8, 55], [8, 55], [8, 56], [8, 56], [8, 57], [8, 57], [8, 58], [8, 58], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [8, 448], [8, 448], [8, 512], [8, 512], [9, 704], [9, 768], [8, 640], [8, 640], [8, 576], [8, 576], [9, 832], [9, 896], [9, 960], [9, 1024], [9, 1088], [9, 1152], [9, 1216], [9, 1280], [9, 1344], [9, 1408], [7, 256], [7, 256], [7, 256], [7, 256], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7]];
45000const blackTable1 = [[-1, -1], [-1, -1], [12, ccittEOL], [12, ccittEOL], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [11, 1792], [11, 1792], [11, 1792], [11, 1792], [12, 1984], [12, 1984], [12, 2048], [12, 2048], [12, 2112], [12, 2112], [12, 2176], [12, 2176], [12, 2240], [12, 2240], [12, 2304], [12, 2304], [11, 1856], [11, 1856], [11, 1856], [11, 1856], [11, 1920], [11, 1920], [11, 1920], [11, 1920], [12, 2368], [12, 2368], [12, 2432], [12, 2432], [12, 2496], [12, 2496], [12, 2560], [12, 2560], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [12, 52], [12, 52], [13, 640], [13, 704], [13, 768], [13, 832], [12, 55], [12, 55], [12, 56], [12, 56], [13, 1280], [13, 1344], [13, 1408], [13, 1472], [12, 59], [12, 59], [12, 60], [12, 60], [13, 1536], [13, 1600], [11, 24], [11, 24], [11, 24], [11, 24], [11, 25], [11, 25], [11, 25], [11, 25], [13, 1664], [13, 1728], [12, 320], [12, 320], [12, 384], [12, 384], [12, 448], [12, 448], [13, 512], [13, 576], [12, 53], [12, 53], [12, 54], [12, 54], [13, 896], [13, 960], [13, 1024], [13, 1088], [13, 1152], [13, 1216], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64]];
45001const blackTable2 = [[8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [11, 23], [11, 23], [12, 50], [12, 51], [12, 44], [12, 45], [12, 46], [12, 47], [12, 57], [12, 58], [12, 61], [12, 256], [10, 16], [10, 16], [10, 16], [10, 16], [10, 17], [10, 17], [10, 17], [10, 17], [12, 48], [12, 49], [12, 62], [12, 63], [12, 30], [12, 31], [12, 32], [12, 33], [12, 40], [12, 41], [11, 22], [11, 22], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [12, 128], [12, 192], [12, 26], [12, 27], [12, 28], [12, 29], [11, 19], [11, 19], [11, 20], [11, 20], [12, 34], [12, 35], [12, 36], [12, 37], [12, 38], [12, 39], [11, 21], [11, 21], [12, 42], [12, 43], [10, 0], [10, 0], [10, 0], [10, 0], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12]];
45002const blackTable3 = [[-1, -1], [-1, -1], [-1, -1], [-1, -1], [6, 9], [6, 8], [5, 7], [5, 7], [4, 6], [4, 6], [4, 6], [4, 6], [4, 5], [4, 5], [4, 5], [4, 5], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2]];
45003class CCITTFaxDecoder {
45004  constructor(source, options = {}) {
45005    if (!source || typeof source.next !== "function") {
45006      throw new Error('CCITTFaxDecoder - invalid "source" parameter.');
45007    }
45008    this.source = source;
45009    this.eof = false;
45010    this.encoding = options.K || 0;
45011    this.eoline = options.EndOfLine || false;
45012    this.byteAlign = options.EncodedByteAlign || false;
45013    this.columns = options.Columns || 1728;
45014    this.rows = options.Rows || 0;
45015    
vendor: 5,987 bytes, lines 45015-45187
45015this.eoblock = options.EndOfBlock ?? true;
45016    this.black = options.BlackIs1 || false;
45017    this.codingLine = new Uint32Array(this.columns + 1);
45018    this.refLine = new Uint32Array(this.columns + 2);
45019    this.codingLine[0] = this.columns;
45020    this.codingPos = 0;
45021    this.row = 0;
45022    this.nextLine2D = this.encoding < 0;
45023    this.inputBits = 0;
45024    this.inputBuf = 0;
45025    this.outputBits = 0;
45026    this.rowsDone = false;
45027    let code1;
45028    while ((code1 = this._lookBits(12)) === 0) {
45029      this._eatBits(1);
45030    }
45031    if (code1 === 1) {
45032      this._eatBits(12);
45033    }
45034    if (this.encoding > 0) {
45035      this.nextLine2D = !this._lookBits(1);
45036      this._eatBits(1);
45037    }
45038  }
45039  readNextChar() {
45040    if (this.eof) {
45041      return -1;
45042    }
45043    const refLine = this.refLine;
45044    const codingLine = this.codingLine;
45045    const columns = this.columns;
45046    let refPos, blackPixels, bits, i;
45047    if (this.outputBits === 0) {
45048      if (this.rowsDone) {
45049        this.eof = true;
45050      }
45051      if (this.eof) {
45052        return -1;
45053      }
45054      this.err = false;
45055      let code1, code2, code3;
45056      if (this.nextLine2D) {
45057        for (i = 0; codingLine[i] < columns; ++i) {
45058          refLine[i] = codingLine[i];
45059        }
45060        refLine[i++] = columns;
45061        refLine[i] = columns;
45062        codingLine[0] = 0;
45063        this.codingPos = 0;
45064        refPos = 0;
45065        blackPixels = 0;
45066        while (codingLine[this.codingPos] < columns) {
45067          code1 = this._getTwoDimCode();
45068          switch (code1) {
45069            case twoDimPass:
45070              this._addPixels(refLine[refPos + 1], blackPixels);
45071              if (refLine[refPos + 1] < columns) {
45072                refPos += 2;
45073              }
45074              break;
45075            case twoDimHoriz:
45076              code1 = code2 = 0;
45077              if (blackPixels) {
45078                do {
45079                  code1 += code3 = this._getBlackCode();
45080                } while (code3 >= 64);
45081                do {
45082                  code2 += code3 = this._getWhiteCode();
45083                } while (code3 >= 64);
45084              } else {
45085                do {
45086                  code1 += code3 = this._getWhiteCode();
45087                } while (code3 >= 64);
45088                do {
45089                  code2 += code3 = this._getBlackCode();
45090                } while (code3 >= 64);
45091              }
45092              this._addPixels(codingLine[this.codingPos] + code1, blackPixels);
45093              if (codingLine[this.codingPos] < columns) {
45094                this._addPixels(codingLine[this.codingPos] + code2, blackPixels ^ 1);
45095              }
45096              while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
45097                refPos += 2;
45098              }
45099              break;
45100            case twoDimVertR3:
45101              this._addPixels(refLine[refPos] + 3, blackPixels);
45102              blackPixels ^= 1;
45103              if (codingLine[this.codingPos] < columns) {
45104                ++refPos;
45105                while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
45106                  refPos += 2;
45107                }
45108              }
45109              break;
45110            case twoDimVertR2:
45111              this._addPixels(refLine[refPos] + 2, blackPixels);
45112              blackPixels ^= 1;
45113              if (codingLine[this.codingPos] < columns) {
45114                ++refPos;
45115                while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
45116                  refPos += 2;
45117                }
45118              }
45119              break;
45120            case twoDimVertR1:
45121              this._addPixels(refLine[refPos] + 1, blackPixels);
45122              blackPixels ^= 1;
45123              if (codingLine[this.codingPos] < columns) {
45124                ++refPos;
45125                while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
45126                  refPos += 2;
45127                }
45128              }
45129              break;
45130            case twoDimVert0:
45131              this._addPixels(refLine[refPos], blackPixels);
45132              blackPixels ^= 1;
45133              if (codingLine[this.codingPos] < columns) {
45134                ++refPos;
45135                while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
45136                  refPos += 2;
45137                }
45138              }
45139              break;
45140            case twoDimVertL3:
45141              this._addPixelsNeg(refLine[refPos] - 3, blackPixels);
45142              blackPixels ^= 1;
45143              if (codingLine[this.codingPos] < columns) {
45144                if (refPos > 0) {
45145                  --refPos;
45146                } else {
45147                  ++refPos;
45148                }
45149                while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
45150                  refPos += 2;
45151                }
45152              }
45153              break;
45154            case twoDimVertL2:
45155              this._addPixelsNeg(refLine[refPos] - 2, blackPixels);
45156              blackPixels ^= 1;
45157              if (codingLine[this.codingPos] < columns) {
45158                if (refPos > 0) {
45159                  --refPos;
45160                } else {
45161                  ++refPos;
45162                }
45163                while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
45164                  refPos += 2;
45165                }
45166              }
45167              break;
45168            case twoDimVertL1:
45169              this._addPixelsNeg(refLine[refPos] - 1, blackPixels);
45170              blackPixels ^= 1;
45171              if (codingLine[this.codingPos] < columns) {
45172                if (refPos > 0) {
45173                  --refPos;
45174                } else {
45175                  ++refPos;
45176                }
45177                while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
45178                  refPos += 2;
45179                }
45180              }
45181              break;
45182            case ccittEOF:
45183              this._addPixels(columns, 0);
45184              this.eof = true;
45185              break;
45186            default:
45187              
vendor: 5,819 bytes, lines 45187-45391
45187(0, _util.info)("bad 2d code");
45188              this._addPixels(columns, 0);
45189              this.err = true;
45190          }
45191        }
45192      } else {
45193        codingLine[0] = 0;
45194        this.codingPos = 0;
45195        blackPixels = 0;
45196        while (codingLine[this.codingPos] < columns) {
45197          code1 = 0;
45198          if (blackPixels) {
45199            do {
45200              code1 += code3 = this._getBlackCode();
45201            } while (code3 >= 64);
45202          } else {
45203            do {
45204              code1 += code3 = this._getWhiteCode();
45205            } while (code3 >= 64);
45206          }
45207          this._addPixels(codingLine[this.codingPos] + code1, blackPixels);
45208          blackPixels ^= 1;
45209        }
45210      }
45211      let gotEOL = false;
45212      if (this.byteAlign) {
45213        this.inputBits &= ~7;
45214      }
45215      if (!this.eoblock && this.row === this.rows - 1) {
45216        this.rowsDone = true;
45217      } else {
45218        code1 = this._lookBits(12);
45219        if (this.eoline) {
45220          while (code1 !== ccittEOF && code1 !== 1) {
45221            this._eatBits(1);
45222            code1 = this._lookBits(12);
45223          }
45224        } else {
45225          while (code1 === 0) {
45226            this._eatBits(1);
45227            code1 = this._lookBits(12);
45228          }
45229        }
45230        if (code1 === 1) {
45231          this._eatBits(12);
45232          gotEOL = true;
45233        } else if (code1 === ccittEOF) {
45234          this.eof = true;
45235        }
45236      }
45237      if (!this.eof && this.encoding > 0 && !this.rowsDone) {
45238        this.nextLine2D = !this._lookBits(1);
45239        this._eatBits(1);
45240      }
45241      if (this.eoblock && gotEOL && this.byteAlign) {
45242        code1 = this._lookBits(12);
45243        if (code1 === 1) {
45244          this._eatBits(12);
45245          if (this.encoding > 0) {
45246            this._lookBits(1);
45247            this._eatBits(1);
45248          }
45249          if (this.encoding >= 0) {
45250            for (i = 0; i < 4; ++i) {
45251              code1 = this._lookBits(12);
45252              if (code1 !== 1) {
45253                (0, _util.info)("bad rtc code: " + code1);
45254              }
45255              this._eatBits(12);
45256              if (this.encoding > 0) {
45257                this._lookBits(1);
45258                this._eatBits(1);
45259              }
45260            }
45261          }
45262          this.eof = true;
45263        }
45264      } else if (this.err && this.eoline) {
45265        while (true) {
45266          code1 = this._lookBits(13);
45267          if (code1 === ccittEOF) {
45268            this.eof = true;
45269            return -1;
45270          }
45271          if (code1 >> 1 === 1) {
45272            break;
45273          }
45274          this._eatBits(1);
45275        }
45276        this._eatBits(12);
45277        if (this.encoding > 0) {
45278          this._eatBits(1);
45279          this.nextLine2D = !(code1 & 1);
45280        }
45281      }
45282      this.outputBits = codingLine[0] > 0 ? codingLine[this.codingPos = 0] : codingLine[this.codingPos = 1];
45283      this.row++;
45284    }
45285    let c;
45286    if (this.outputBits >= 8) {
45287      c = this.codingPos & 1 ? 0 : 0xff;
45288      this.outputBits -= 8;
45289      if (this.outputBits === 0 && codingLine[this.codingPos] < columns) {
45290        this.codingPos++;
45291        this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
45292      }
45293    } else {
45294      bits = 8;
45295      c = 0;
45296      do {
45297        if (typeof this.outputBits !== "number") {
45298          throw new _util.FormatError('Invalid /CCITTFaxDecode data, "outputBits" must be a number.');
45299        }
45300        if (this.outputBits > bits) {
45301          c <<= bits;
45302          if (!(this.codingPos & 1)) {
45303            c |= 0xff >> 8 - bits;
45304          }
45305          this.outputBits -= bits;
45306          bits = 0;
45307        } else {
45308          c <<= this.outputBits;
45309          if (!(this.codingPos & 1)) {
45310            c |= 0xff >> 8 - this.outputBits;
45311          }
45312          bits -= this.outputBits;
45313          this.outputBits = 0;
45314          if (codingLine[this.codingPos] < columns) {
45315            this.codingPos++;
45316            this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
45317          } else if (bits > 0) {
45318            c <<= bits;
45319            bits = 0;
45320          }
45321        }
45322      } while (bits);
45323    }
45324    if (this.black) {
45325      c ^= 0xff;
45326    }
45327    return c;
45328  }
45329  _addPixels(a1, blackPixels) {
45330    const codingLine = this.codingLine;
45331    let codingPos = this.codingPos;
45332    if (a1 > codingLine[codingPos]) {
45333      if (a1 > this.columns) {
45334        (0, _util.info)("row is wrong length");
45335        this.err = true;
45336        a1 = this.columns;
45337      }
45338      if (codingPos & 1 ^ blackPixels) {
45339        ++codingPos;
45340      }
45341      codingLine[codingPos] = a1;
45342    }
45343    this.codingPos = codingPos;
45344  }
45345  _addPixelsNeg(a1, blackPixels) {
45346    const codingLine = this.codingLine;
45347    let codingPos = this.codingPos;
45348    if (a1 > codingLine[codingPos]) {
45349      if (a1 > this.columns) {
45350        (0, _util.info)("row is wrong length");
45351        this.err = true;
45352        a1 = this.columns;
45353      }
45354      if (codingPos & 1 ^ blackPixels) {
45355        ++codingPos;
45356      }
45357      codingLine[codingPos] = a1;
45358    } else if (a1 < codingLine[codingPos]) {
45359      if (a1 < 0) {
45360        (0, _util.info)("invalid code");
45361        this.err = true;
45362        a1 = 0;
45363      }
45364      while (codingPos > 0 && a1 < codingLine[codingPos - 1]) {
45365        --codingPos;
45366      }
45367      codingLine[codingPos] = a1;
45368    }
45369    this.codingPos = codingPos;
45370  }
45371  _findTableCode(start, end, table, limit) {
45372    const limitValue = limit || 0;
45373    for (let i = start; i <= end; ++i) {
45374      let code = this._lookBits(i);
45375      if (code === ccittEOF) {
45376        return [true, 1, false];
45377      }
45378      if (i < end) {
45379        code <<= end - i;
45380      }
45381      if (!limitValue || code >= limitValue) {
45382        const p = table[code - limitValue];
45383        if (p[0] === i) {
45384          this._eatBits(i);
45385          return [true, p[1], true];
45386        }
45387      }
45388    }
45389    return [false, 0, false];
45390  }
45391  _getTwoDimCode() {
vendor: 1,075 bytes, lines 45392-45437
45392    let code = 0;
45393    let p;
45394    if (this.eoblock) {
45395      code = this._lookBits(7);
45396      p = twoDimTable[code];
45397      if (p?.[0] > 0) {
45398        this._eatBits(p[0]);
45399        return p[1];
45400      }
45401    } else {
45402      const result = this._findTableCode(1, 7, twoDimTable);
45403      if (result[0] && result[2]) {
45404        return result[1];
45405      }
45406    }
45407    (0, _util.info)("Bad two dim code");
45408    return ccittEOF;
45409  }
45410  _getWhiteCode() {
45411    let code = 0;
45412    let p;
45413    if (this.eoblock) {
45414      code = this._lookBits(12);
45415      if (code === ccittEOF) {
45416        return 1;
45417      }
45418      p = code >> 5 === 0 ? whiteTable1[code] : whiteTable2[code >> 3];
45419      if (p[0] > 0) {
45420        this._eatBits(p[0]);
45421        return p[1];
45422      }
45423    } else {
45424      let result = this._findTableCode(1, 9, whiteTable2);
45425      if (result[0]) {
45426        return result[1];
45427      }
45428      result = this._findTableCode(11, 12, whiteTable1);
45429      if (result[0]) {
45430        return result[1];
45431      }
45432    }
45433    (0, _util.info)("bad white code");
45434    this._eatBits(1);
45435    return 1;
45436  }
45437  _getBlackCode() {
vendor: 1,646 bytes, lines 45438-45505
45438    let code, p;
45439    if (this.eoblock) {
45440      code = this._lookBits(13);
45441      if (code === ccittEOF) {
45442        return 1;
45443      }
45444      if (code >> 7 === 0) {
45445        p = blackTable1[code];
45446      } else if (code >> 9 === 0 && code >> 7 !== 0) {
45447        p = blackTable2[(code >> 1) - 64];
45448      } else {
45449        p = blackTable3[code >> 7];
45450      }
45451      if (p[0] > 0) {
45452        this._eatBits(p[0]);
45453        return p[1];
45454      }
45455    } else {
45456      let result = this._findTableCode(2, 6, blackTable3);
45457      if (result[0]) {
45458        return result[1];
45459      }
45460      result = this._findTableCode(7, 12, blackTable2, 64);
45461      if (result[0]) {
45462        return result[1];
45463      }
45464      result = this._findTableCode(10, 13, blackTable1);
45465      if (result[0]) {
45466        return result[1];
45467      }
45468    }
45469    (0, _util.info)("bad black code");
45470    this._eatBits(1);
45471    return 1;
45472  }
45473  _lookBits(n) {
45474    let c;
45475    while (this.inputBits < n) {
45476      if ((c = this.source.next()) === -1) {
45477        if (this.inputBits === 0) {
45478          return ccittEOF;
45479        }
45480        return this.inputBuf << n - this.inputBits & 0xffff >> 16 - n;
45481      }
45482      this.inputBuf = this.inputBuf << 8 | c;
45483      this.inputBits += 8;
45484    }
45485    return this.inputBuf >> this.inputBits - n & 0xffff >> 16 - n;
45486  }
45487  _eatBits(n) {
45488    if ((this.inputBits -= n) < 0) {
45489      this.inputBits = 0;
45490    }
45491  }
45492}
45493exports.CCITTFaxDecoder = CCITTFaxDecoder;
45494
45495/***/ }),
45496/* 22 */
45497/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
45498
45499
45500
45501Object.defineProperty(exports, "__esModule", ({
45502  value: true
45503}));
45504exports.FlateStream = void 0;
45505var _decode_stream = __w_pdfjs_require__(18
vendor: 12,712 bytes, lines 45505-45744
45505);
45506var _util = __w_pdfjs_require__(2);
45507const codeLenCodeMap = new Int32Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
45508const 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]);
45509const 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]);
45510const 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];
45511const 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];
45512class FlateStream extends _decode_stream.DecodeStream {
45513  constructor(str, maybeLength) {
45514    super(maybeLength);
45515    this.str = str;
45516    this.dict = str.dict;
45517    const cmf = str.getByte();
45518    const flg = str.getByte();
45519    if (cmf === -1 || flg === -1) {
45520      throw new _util.FormatError(`Invalid header in flate stream: ${cmf}, ${flg}`);
45521    }
45522    if ((cmf & 0x0f) !== 0x08) {
45523      throw new _util.FormatError(`Unknown compression method in flate stream: ${cmf}, ${flg}`);
45524    }
45525    if (((cmf << 8) + flg) % 31 !== 0) {
45526      throw new _util.FormatError(`Bad FCHECK in flate stream: ${cmf}, ${flg}`);
45527    }
45528    if (flg & 0x20) {
45529      throw new _util.FormatError(`FDICT bit set in flate stream: ${cmf}, ${flg}`);
45530    }
45531    this.codeSize = 0;
45532    this.codeBuf = 0;
45533  }
45534  getBits(bits) {
45535    const str = this.str;
45536    let codeSize = this.codeSize;
45537    let codeBuf = this.codeBuf;
45538    let b;
45539    while (codeSize < bits) {
45540      if ((b = str.getByte()) === -1) {
45541        throw new _util.FormatError("Bad encoding in flate stream");
45542      }
45543      codeBuf |= b << codeSize;
45544      codeSize += 8;
45545    }
45546    b = codeBuf & (1 << bits) - 1;
45547    this.codeBuf = codeBuf >> bits;
45548    this.codeSize = codeSize -= bits;
45549    return b;
45550  }
45551  getCode(table) {
45552    const str = this.str;
45553    const codes = table[0];
45554    const maxLen = table[1];
45555    let codeSize = this.codeSize;
45556    let codeBuf = this.codeBuf;
45557    let b;
45558    while (codeSize < maxLen) {
45559      if ((b = str.getByte()) === -1) {
45560        break;
45561      }
45562      codeBuf |= b << codeSize;
45563      codeSize += 8;
45564    }
45565    const code = codes[codeBuf & (1 << maxLen) - 1];
45566    const codeLen = code >> 16;
45567    const codeVal = code & 0xffff;
45568    if (codeLen < 1 || codeSize < codeLen) {
45569      throw new _util.FormatError("Bad encoding in flate stream");
45570    }
45571    this.codeBuf = codeBuf >> codeLen;
45572    this.codeSize = codeSize - codeLen;
45573    return codeVal;
45574  }
45575  generateHuffmanTable(lengths) {
45576    const n = lengths.length;
45577    let maxLen = 0;
45578    let i;
45579    for (i = 0; i < n; ++i) {
45580      if (lengths[i] > maxLen) {
45581        maxLen = lengths[i];
45582      }
45583    }
45584    const size = 1 << maxLen;
45585    const codes = new Int32Array(size);
45586    for (let len = 1, code = 0, skip = 2; len <= maxLen; ++len, code <<= 1, skip <<= 1) {
45587      for (let val = 0; val < n; ++val) {
45588        if (lengths[val] === len) {
45589          let code2 = 0;
45590          let t = code;
45591          for (i = 0; i < len; ++i) {
45592            code2 = code2 << 1 | t & 1;
45593            t >>= 1;
45594          }
45595          for (i = code2; i < size; i += skip) {
45596            codes[i] = len << 16 | val;
45597          }
45598          ++code;
45599        }
45600      }
45601    }
45602    return [codes, maxLen];
45603  }
45604  readBlock() {
45605    let buffer, len;
45606    const str = this.str;
45607    let hdr = this.getBits(3);
45608    if (hdr & 1) {
45609      this.eof = true;
45610    }
45611    hdr >>= 1;
45612    if (hdr === 0) {
45613      let b;
45614      if ((b = str.getByte()) === -1) {
45615        throw new _util.FormatError("Bad block header in flate stream");
45616      }
45617      let blockLen = b;
45618      if ((b = str.getByte()) === -1) {
45619        throw new _util.FormatError("Bad block header in flate stream");
45620      }
45621      blockLen |= b << 8;
45622      if ((b = str.getByte()) === -1) {
45623        throw new _util.FormatError("Bad block header in flate stream");
45624      }
45625      let check = b;
45626      if ((b = str.getByte()) === -1) {
45627        throw new _util.FormatError("Bad block header in flate stream");
45628      }
45629      check |= b << 8;
45630      if (check !== (~blockLen & 0xffff) && (blockLen !== 0 || check !== 0)) {
45631        throw new _util.FormatError("Bad uncompressed block length in flate stream");
45632      }
45633      this.codeBuf = 0;
45634      this.codeSize = 0;
45635      const bufferLength = this.bufferLength,
45636        end = bufferLength + blockLen;
45637      buffer = this.ensureBuffer(end);
45638      this.bufferLength = end;
45639      if (blockLen === 0) {
45640        if (str.peekByte() === -1) {
45641          this.eof = true;
45642        }
45643      } else {
45644        const block = str.getBytes(blockLen);
45645        buffer.set(block, bufferLength);
45646        if (block.length < blockLen) {
45647          this.eof = true;
45648        }
45649      }
45650      return;
45651    }
45652    let litCodeTable;
45653    let distCodeTable;
45654    if (hdr === 1) {
45655      litCodeTable = fixedLitCodeTab;
45656      distCodeTable = fixedDistCodeTab;
45657    } else if (hdr === 2) {
45658      const numLitCodes = this.getBits(5) + 257;
45659      const numDistCodes = this.getBits(5) + 1;
45660      const numCodeLenCodes = this.getBits(4) + 4;
45661      const codeLenCodeLengths = new Uint8Array(codeLenCodeMap.length);
45662      let i;
45663      for (i = 0; i < numCodeLenCodes; ++i) {
45664        codeLenCodeLengths[codeLenCodeMap[i]] = this.getBits(3);
45665      }
45666      const codeLenCodeTab = this.generateHuffmanTable(codeLenCodeLengths);
45667      len = 0;
45668      i = 0;
45669      const codes = numLitCodes + numDistCodes;
45670      const codeLengths = new Uint8Array(codes);
45671      let bitsLength, bitsOffset, what;
45672      while (i < codes) {
45673        const code = this.getCode(codeLenCodeTab);
45674        if (code === 16) {
45675          bitsLength = 2;
45676          bitsOffset = 3;
45677          what = len;
45678        } else if (code === 17) {
45679          bitsLength = 3;
45680          bitsOffset = 3;
45681          what = len = 0;
45682        } else if (code === 18) {
45683          bitsLength = 7;
45684          bitsOffset = 11;
45685          what = len = 0;
45686        } else {
45687          codeLengths[i++] = len = code;
45688          continue;
45689        }
45690        let repeatLength = this.getBits(bitsLength) + bitsOffset;
45691        while (repeatLength-- > 0) {
45692          codeLengths[i++] = what;
45693        }
45694      }
45695      litCodeTable = this.generateHuffmanTable(codeLengths.subarray(0, numLitCodes));
45696      distCodeTable = this.generateHuffmanTable(codeLengths.subarray(numLitCodes, codes));
45697    } else {
45698      throw new _util.FormatError("Unknown block type in flate stream");
45699    }
45700    buffer = this.buffer;
45701    let limit = buffer ? buffer.length : 0;
45702    let pos = this.bufferLength;
45703    while (true) {
45704      let code1 = this.getCode(litCodeTable);
45705      if (code1 < 256) {
45706        if (pos + 1 >= limit) {
45707          buffer = this.ensureBuffer(pos + 1);
45708          limit = buffer.length;
45709        }
45710        buffer[pos++] = code1;
45711        continue;
45712      }
45713      if (code1 === 256) {
45714        this.bufferLength = pos;
45715        return;
45716      }
45717      code1 -= 257;
45718      code1 = lengthDecode[code1];
45719      let code2 = code1 >> 16;
45720      if (code2 > 0) {
45721        code2 = this.getBits(code2);
45722      }
45723      len = (code1 & 0xffff) + code2;
45724      code1 = this.getCode(distCodeTable);
45725      code1 = distDecode[code1];
45726      code2 = code1 >> 16;
45727      if (code2 > 0) {
45728        code2 = this.getBits(code2);
45729      }
45730      const dist = (code1 & 0xffff) + code2;
45731      if (pos + len >= limit) {
45732        buffer = this.ensureBuffer(pos + len);
45733        limit = buffer.length;
45734      }
45735      for (let k = 0; k < len; ++k, ++pos) {
45736        buffer[pos] = buffer[pos - dist];
45737      }
45738    }
45739  }
45740}
45741exports.FlateStream = FlateStream;
45742
45743/***/ }),
45744/* 2
vendor: 3,538 bytes, lines 45744-45869
457443 */
45745/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
45746
45747
45748
45749Object.defineProperty(exports, "__esModule", ({
45750  value: true
45751}));
45752exports.Jbig2Stream = void 0;
45753var _base_stream = __w_pdfjs_require__(5);
45754var _decode_stream = __w_pdfjs_require__(18);
45755var _primitives = __w_pdfjs_require__(4);
45756var _jbig = __w_pdfjs_require__(24);
45757var _util = __w_pdfjs_require__(2);
45758class Jbig2Stream extends _decode_stream.DecodeStream {
45759  constructor(stream, maybeLength, params) {
45760    super(maybeLength);
45761    this.stream = stream;
45762    this.dict = stream.dict;
45763    this.maybeLength = maybeLength;
45764    this.params = params;
45765  }
45766  get bytes() {
45767    return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
45768  }
45769  ensureBuffer(requested) {}
45770  readBlock() {
45771    if (this.eof) {
45772      return;
45773    }
45774    const jbig2Image = new _jbig.Jbig2Image();
45775    const chunks = [];
45776    if (this.params instanceof _primitives.Dict) {
45777      const globalsStream = this.params.get("JBIG2Globals");
45778      if (globalsStream instanceof _base_stream.BaseStream) {
45779        const globals = globalsStream.getBytes();
45780        chunks.push({
45781          data: globals,
45782          start: 0,
45783          end: globals.length
45784        });
45785      }
45786    }
45787    chunks.push({
45788      data: this.bytes,
45789      start: 0,
45790      end: this.bytes.length
45791    });
45792    const data = jbig2Image.parseChunks(chunks);
45793    const dataLength = data.length;
45794    for (let i = 0; i < dataLength; i++) {
45795      data[i] ^= 0xff;
45796    }
45797    this.buffer = data;
45798    this.bufferLength = dataLength;
45799    this.eof = true;
45800  }
45801}
45802exports.Jbig2Stream = Jbig2Stream;
45803
45804/***/ }),
45805/* 24 */
45806/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
45807
45808
45809
45810Object.defineProperty(exports, "__esModule", ({
45811  value: true
45812}));
45813exports.Jbig2Image = void 0;
45814var _util = __w_pdfjs_require__(2);
45815var _core_utils = __w_pdfjs_require__(3);
45816var _arithmetic_decoder = __w_pdfjs_require__(25);
45817var _ccitt = __w_pdfjs_require__(21);
45818class Jbig2Error extends _util.BaseException {
45819  constructor(msg) {
45820    super(`JBIG2 error: ${msg}`, "Jbig2Error");
45821  }
45822}
45823class ContextCache {
45824  getContexts(id) {
45825    if (id in this) {
45826      return this[id];
45827    }
45828    return this[id] = new Int8Array(1 << 16);
45829  }
45830}
45831class DecodingContext {
45832  constructor(data, start, end) {
45833    this.data = data;
45834    this.start = start;
45835    this.end = end;
45836  }
45837  get decoder() {
45838    const decoder = new _arithmetic_decoder.ArithmeticDecoder(this.data, this.start, this.end);
45839    return (0, _util.shadow)(this, "decoder", decoder);
45840  }
45841  get contextCache() {
45842    const cache = new ContextCache();
45843    return (0, _util.shadow)(this, "contextCache", cache);
45844  }
45845}
45846const MAX_INT_32 = 2 ** 31 - 1;
45847const MIN_INT_32 = -(2 ** 31);
45848function decodeInteger(contextCache, procedure, decoder) {
45849  const contexts = contextCache.getContexts(procedure);
45850  let prev = 1;
45851  function readBits(length) {
45852    let v = 0;
45853    for (let i = 0; i < length; i++) {
45854      const bit = decoder.readBit(contexts, prev);
45855      prev = prev < 256 ? prev << 1 | bit : (prev << 1 | bit) & 511 | 256;
45856      v = v << 1 | bit;
45857    }
45858    return v >>> 0;
45859  }
45860  const sign = readBits(1);
45861  const value = readBits(1) ? readBits(1) ? readBits(1) ? readBits(1) ? readBits(1) ? readBits(32) + 4436 : readBits(12) + 340 : readBits(8) + 84 : readBits(6) + 20 : readBits(4) + 4 : readBits(2);
45862  let signedValue;
45863  if (sign === 0) {
45864    signedValue = value;
45865  } else if (value > 0) {
45866    signedValue = -value;
45867  }
45868  if (signedValue >= MIN_INT_32 && signedValue <= MAX_INT_32) {
45869    return signedV
vendor: 47,302 bytes, lines 45869-47261
45869alue;
45870  }
45871  return null;
45872}
45873function decodeIAID(contextCache, decoder, codeLength) {
45874  const contexts = contextCache.getContexts("IAID");
45875  let prev = 1;
45876  for (let i = 0; i < codeLength; i++) {
45877    const bit = decoder.readBit(contexts, prev);
45878    prev = prev << 1 | bit;
45879  }
45880  if (codeLength < 31) {
45881    return prev & (1 << codeLength) - 1;
45882  }
45883  return prev & 0x7fffffff;
45884}
45885const SegmentTypes = ["SymbolDictionary", null, null, null, "IntermediateTextRegion", null, "ImmediateTextRegion", "ImmediateLosslessTextRegion", null, null, null, null, null, null, null, null, "PatternDictionary", null, null, null, "IntermediateHalftoneRegion", null, "ImmediateHalftoneRegion", "ImmediateLosslessHalftoneRegion", null, null, null, null, null, null, null, null, null, null, null, null, "IntermediateGenericRegion", null, "ImmediateGenericRegion", "ImmediateLosslessGenericRegion", "IntermediateGenericRefinementRegion", null, "ImmediateGenericRefinementRegion", "ImmediateLosslessGenericRefinementRegion", null, null, null, null, "PageInformation", "EndOfPage", "EndOfStripe", "EndOfFile", "Profiles", "Tables", null, null, null, null, null, null, null, null, "Extension"];
45886const CodingTemplates = [[{
45887  x: -1,
45888  y: -2
45889}, {
45890  x: 0,
45891  y: -2
45892}, {
45893  x: 1,
45894  y: -2
45895}, {
45896  x: -2,
45897  y: -1
45898}, {
45899  x: -1,
45900  y: -1
45901}, {
45902  x: 0,
45903  y: -1
45904}, {
45905  x: 1,
45906  y: -1
45907}, {
45908  x: 2,
45909  y: -1
45910}, {
45911  x: -4,
45912  y: 0
45913}, {
45914  x: -3,
45915  y: 0
45916}, {
45917  x: -2,
45918  y: 0
45919}, {
45920  x: -1,
45921  y: 0
45922}], [{
45923  x: -1,
45924  y: -2
45925}, {
45926  x: 0,
45927  y: -2
45928}, {
45929  x: 1,
45930  y: -2
45931}, {
45932  x: 2,
45933  y: -2
45934}, {
45935  x: -2,
45936  y: -1
45937}, {
45938  x: -1,
45939  y: -1
45940}, {
45941  x: 0,
45942  y: -1
45943}, {
45944  x: 1,
45945  y: -1
45946}, {
45947  x: 2,
45948  y: -1
45949}, {
45950  x: -3,
45951  y: 0
45952}, {
45953  x: -2,
45954  y: 0
45955}, {
45956  x: -1,
45957  y: 0
45958}], [{
45959  x: -1,
45960  y: -2
45961}, {
45962  x: 0,
45963  y: -2
45964}, {
45965  x: 1,
45966  y: -2
45967}, {
45968  x: -2,
45969  y: -1
45970}, {
45971  x: -1,
45972  y: -1
45973}, {
45974  x: 0,
45975  y: -1
45976}, {
45977  x: 1,
45978  y: -1
45979}, {
45980  x: -2,
45981  y: 0
45982}, {
45983  x: -1,
45984  y: 0
45985}], [{
45986  x: -3,
45987  y: -1
45988}, {
45989  x: -2,
45990  y: -1
45991}, {
45992  x: -1,
45993  y: -1
45994}, {
45995  x: 0,
45996  y: -1
45997}, {
45998  x: 1,
45999  y: -1
46000}, {
46001  x: -4,
46002  y: 0
46003}, {
46004  x: -3,
46005  y: 0
46006}, {
46007  x: -2,
46008  y: 0
46009}, {
46010  x: -1,
46011  y: 0
46012}]];
46013const RefinementTemplates = [{
46014  coding: [{
46015    x: 0,
46016    y: -1
46017  }, {
46018    x: 1,
46019    y: -1
46020  }, {
46021    x: -1,
46022    y: 0
46023  }],
46024  reference: [{
46025    x: 0,
46026    y: -1
46027  }, {
46028    x: 1,
46029    y: -1
46030  }, {
46031    x: -1,
46032    y: 0
46033  }, {
46034    x: 0,
46035    y: 0
46036  }, {
46037    x: 1,
46038    y: 0
46039  }, {
46040    x: -1,
46041    y: 1
46042  }, {
46043    x: 0,
46044    y: 1
46045  }, {
46046    x: 1,
46047    y: 1
46048  }]
46049}, {
46050  coding: [{
46051    x: -1,
46052    y: -1
46053  }, {
46054    x: 0,
46055    y: -1
46056  }, {
46057    x: 1,
46058    y: -1
46059  }, {
46060    x: -1,
46061    y: 0
46062  }],
46063  reference: [{
46064    x: 0,
46065    y: -1
46066  }, {
46067    x: -1,
46068    y: 0
46069  }, {
46070    x: 0,
46071    y: 0
46072  }, {
46073    x: 1,
46074    y: 0
46075  }, {
46076    x: 0,
46077    y: 1
46078  }, {
46079    x: 1,
46080    y: 1
46081  }]
46082}];
46083const ReusedContexts = [0x9b25, 0x0795, 0x00e5, 0x0195];
46084const RefinementReusedContexts = [0x0020, 0x0008];
46085function decodeBitmapTemplate0(width, height, decodingContext) {
46086  const decoder = decodingContext.decoder;
46087  const contexts = decodingContext.contextCache.getContexts("GB");
46088  const bitmap = [];
46089  let contextLabel, i, j, pixel, row, row1, row2;
46090  const OLD_PIXEL_MASK = 0x7bf7;
46091  for (i = 0; i < height; i++) {
46092    row = bitmap[i] = new Uint8Array(width);
46093    row1 = i < 1 ? row : bitmap[i - 1];
46094    row2 = i < 2 ? row : bitmap[i - 2];
46095    contextLabel = row2[0] << 13 | row2[1] << 12 | row2[2] << 11 | row1[0] << 7 | row1[1] << 6 | row1[2] << 5 | row1[3] << 4;
46096    for (j = 0; j < width; j++) {
46097      row[j] = pixel = decoder.readBit(contexts, contextLabel);
46098      contextLabel = (contextLabel & OLD_PIXEL_MASK) << 1 | (j + 3 < width ? row2[j + 3] << 11 : 0) | (j + 4 < width ? row1[j + 4] << 4 : 0) | pixel;
46099    }
46100  }
46101  return bitmap;
46102}
46103function decodeBitmap(mmr, width, height, templateIndex, prediction, skip, at, decodingContext) {
46104  if (mmr) {
46105    const input = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);
46106    return decodeMMRBitmap(input, width, height, false);
46107  }
46108  if (templateIndex === 0 && !skip && !prediction && at.length === 4 && at[0].x === 3 && at[0].y === -1 && at[1].x === -3 && at[1].y === -1 && at[2].x === 2 && at[2].y === -2 && at[3].x === -2 && at[3].y === -2) {
46109    return decodeBitmapTemplate0(width, height, decodingContext);
46110  }
46111  const useskip = !!skip;
46112  const template = CodingTemplates[templateIndex].concat(at);
46113  template.sort(function (a, b) {
46114    return a.y - b.y || a.x - b.x;
46115  });
46116  const templateLength = template.length;
46117  const templateX = new Int8Array(templateLength);
46118  const templateY = new Int8Array(templateLength);
46119  const changingTemplateEntries = [];
46120  let reuseMask = 0,
46121    minX = 0,
46122    maxX = 0,
46123    minY = 0;
46124  let c, k;
46125  for (k = 0; k < templateLength; k++) {
46126    templateX[k] = template[k].x;
46127    templateY[k] = template[k].y;
46128    minX = Math.min(minX, template[k].x);
46129    maxX = Math.max(maxX, template[k].x);
46130    minY = Math.min(minY, template[k].y);
46131    if (k < templateLength - 1 && template[k].y === template[k + 1].y && template[k].x === template[k + 1].x - 1) {
46132      reuseMask |= 1 << templateLength - 1 - k;
46133    } else {
46134      changingTemplateEntries.push(k);
46135    }
46136  }
46137  const changingEntriesLength = changingTemplateEntries.length;
46138  const changingTemplateX = new Int8Array(changingEntriesLength);
46139  const changingTemplateY = new Int8Array(changingEntriesLength);
46140  const changingTemplateBit = new Uint16Array(changingEntriesLength);
46141  for (c = 0; c < changingEntriesLength; c++) {
46142    k = changingTemplateEntries[c];
46143    changingTemplateX[c] = template[k].x;
46144    changingTemplateY[c] = template[k].y;
46145    changingTemplateBit[c] = 1 << templateLength - 1 - k;
46146  }
46147  const sbb_left = -minX;
46148  const sbb_top = -minY;
46149  const sbb_right = width - maxX;
46150  const pseudoPixelContext = ReusedContexts[templateIndex];
46151  let row = new Uint8Array(width);
46152  const bitmap = [];
46153  const decoder = decodingContext.decoder;
46154  const contexts = decodingContext.contextCache.getContexts("GB");
46155  let ltp = 0,
46156    j,
46157    i0,
46158    j0,
46159    contextLabel = 0,
46160    bit,
46161    shift;
46162  for (let i = 0; i < height; i++) {
46163    if (prediction) {
46164      const sltp = decoder.readBit(contexts, pseudoPixelContext);
46165      ltp ^= sltp;
46166      if (ltp) {
46167        bitmap.push(row);
46168        continue;
46169      }
46170    }
46171    row = new Uint8Array(row);
46172    bitmap.push(row);
46173    for (j = 0; j < width; j++) {
46174      if (useskip && skip[i][j]) {
46175        row[j] = 0;
46176        continue;
46177      }
46178      if (j >= sbb_left && j < sbb_right && i >= sbb_top) {
46179        contextLabel = contextLabel << 1 & reuseMask;
46180        for (k = 0; k < changingEntriesLength; k++) {
46181          i0 = i + changingTemplateY[k];
46182          j0 = j + changingTemplateX[k];
46183          bit = bitmap[i0][j0];
46184          if (bit) {
46185            bit = changingTemplateBit[k];
46186            contextLabel |= bit;
46187          }
46188        }
46189      } else {
46190        contextLabel = 0;
46191        shift = templateLength - 1;
46192        for (k = 0; k < templateLength; k++, shift--) {
46193          j0 = j + templateX[k];
46194          if (j0 >= 0 && j0 < width) {
46195            i0 = i + templateY[k];
46196            if (i0 >= 0) {
46197              bit = bitmap[i0][j0];
46198              if (bit) {
46199                contextLabel |= bit << shift;
46200              }
46201            }
46202          }
46203        }
46204      }
46205      const pixel = decoder.readBit(contexts, contextLabel);
46206      row[j] = pixel;
46207    }
46208  }
46209  return bitmap;
46210}
46211function decodeRefinement(width, height, templateIndex, referenceBitmap, offsetX, offsetY, prediction, at, decodingContext) {
46212  let codingTemplate = RefinementTemplates[templateIndex].coding;
46213  if (templateIndex === 0) {
46214    codingTemplate = codingTemplate.concat([at[0]]);
46215  }
46216  const codingTemplateLength = codingTemplate.length;
46217  const codingTemplateX = new Int32Array(codingTemplateLength);
46218  const codingTemplateY = new Int32Array(codingTemplateLength);
46219  let k;
46220  for (k = 0; k < codingTemplateLength; k++) {
46221    codingTemplateX[k] = codingTemplate[k].x;
46222    codingTemplateY[k] = codingTemplate[k].y;
46223  }
46224  let referenceTemplate = RefinementTemplates[templateIndex].reference;
46225  if (templateIndex === 0) {
46226    referenceTemplate = referenceTemplate.concat([at[1]]);
46227  }
46228  const referenceTemplateLength = referenceTemplate.length;
46229  const referenceTemplateX = new Int32Array(referenceTemplateLength);
46230  const referenceTemplateY = new Int32Array(referenceTemplateLength);
46231  for (k = 0; k < referenceTemplateLength; k++) {
46232    referenceTemplateX[k] = referenceTemplate[k].x;
46233    referenceTemplateY[k] = referenceTemplate[k].y;
46234  }
46235  const referenceWidth = referenceBitmap[0].length;
46236  const referenceHeight = referenceBitmap.length;
46237  const pseudoPixelContext = RefinementReusedContexts[templateIndex];
46238  const bitmap = [];
46239  const decoder = decodingContext.decoder;
46240  const contexts = decodingContext.contextCache.getContexts("GR");
46241  let ltp = 0;
46242  for (let i = 0; i < height; i++) {
46243    if (prediction) {
46244      const sltp = decoder.readBit(contexts, pseudoPixelContext);
46245      ltp ^= sltp;
46246      if (ltp) {
46247        throw new Jbig2Error("prediction is not supported");
46248      }
46249    }
46250    const row = new Uint8Array(width);
46251    bitmap.push(row);
46252    for (let j = 0; j < width; j++) {
46253      let i0, j0;
46254      let contextLabel = 0;
46255      for (k = 0; k < codingTemplateLength; k++) {
46256        i0 = i + codingTemplateY[k];
46257        j0 = j + codingTemplateX[k];
46258        if (i0 < 0 || j0 < 0 || j0 >= width) {
46259          contextLabel <<= 1;
46260        } else {
46261          contextLabel = contextLabel << 1 | bitmap[i0][j0];
46262        }
46263      }
46264      for (k = 0; k < referenceTemplateLength; k++) {
46265        i0 = i + referenceTemplateY[k] - offsetY;
46266        j0 = j + referenceTemplateX[k] - offsetX;
46267        if (i0 < 0 || i0 >= referenceHeight || j0 < 0 || j0 >= referenceWidth) {
46268          contextLabel <<= 1;
46269        } else {
46270          contextLabel = contextLabel << 1 | referenceBitmap[i0][j0];
46271        }
46272      }
46273      const pixel = decoder.readBit(contexts, contextLabel);
46274      row[j] = pixel;
46275    }
46276  }
46277  return bitmap;
46278}
46279function decodeSymbolDictionary(huffman, refinement, symbols, numberOfNewSymbols, numberOfExportedSymbols, huffmanTables, templateIndex, at, refinementTemplateIndex, refinementAt, decodingContext, huffmanInput) {
46280  if (huffman && refinement) {
46281    throw new Jbig2Error("symbol refinement with Huffman is not supported");
46282  }
46283  const newSymbols = [];
46284  let currentHeight = 0;
46285  let symbolCodeLength = (0, _core_utils.log2)(symbols.length + numberOfNewSymbols);
46286  const decoder = decodingContext.decoder;
46287  const contextCache = decodingContext.contextCache;
46288  let tableB1, symbolWidths;
46289  if (huffman) {
46290    tableB1 = getStandardTable(1);
46291    symbolWidths = [];
46292    symbolCodeLength = Math.max(symbolCodeLength, 1);
46293  }
46294  while (newSymbols.length < numberOfNewSymbols) {
46295    const deltaHeight = huffman ? huffmanTables.tableDeltaHeight.decode(huffmanInput) : decodeInteger(contextCache, "IADH", decoder);
46296    currentHeight += deltaHeight;
46297    let currentWidth = 0,
46298      totalWidth = 0;
46299    const firstSymbol = huffman ? symbolWidths.length : 0;
46300    while (true) {
46301      const deltaWidth = huffman ? huffmanTables.tableDeltaWidth.decode(huffmanInput) : decodeInteger(contextCache, "IADW", decoder);
46302      if (deltaWidth === null) {
46303        break;
46304      }
46305      currentWidth += deltaWidth;
46306      totalWidth += currentWidth;
46307      let bitmap;
46308      if (refinement) {
46309        const numberOfInstances = decodeInteger(contextCache, "IAAI", decoder);
46310        if (numberOfInstances > 1) {
46311          bitmap = decodeTextRegion(huffman, refinement, currentWidth, currentHeight, 0, numberOfInstances, 1, symbols.concat(newSymbols), symbolCodeLength, 0, 0, 1, 0, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, 0, huffmanInput);
46312        } else {
46313          const symbolId = decodeIAID(contextCache, decoder, symbolCodeLength);
46314          const rdx = decodeInteger(contextCache, "IARDX", decoder);
46315          const rdy = decodeInteger(contextCache, "IARDY", decoder);
46316          const symbol = symbolId < symbols.length ? symbols[symbolId] : newSymbols[symbolId - symbols.length];
46317          bitmap = decodeRefinement(currentWidth, currentHeight, refinementTemplateIndex, symbol, rdx, rdy, false, refinementAt, decodingContext);
46318        }
46319        newSymbols.push(bitmap);
46320      } else if (huffman) {
46321        symbolWidths.push(currentWidth);
46322      } else {
46323        bitmap = decodeBitmap(false, currentWidth, currentHeight, templateIndex, false, null, at, decodingContext);
46324        newSymbols.push(bitmap);
46325      }
46326    }
46327    if (huffman && !refinement) {
46328      const bitmapSize = huffmanTables.tableBitmapSize.decode(huffmanInput);
46329      huffmanInput.byteAlign();
46330      let collectiveBitmap;
46331      if (bitmapSize === 0) {
46332        collectiveBitmap = readUncompressedBitmap(huffmanInput, totalWidth, currentHeight);
46333      } else {
46334        const originalEnd = huffmanInput.end;
46335        const bitmapEnd = huffmanInput.position + bitmapSize;
46336        huffmanInput.end = bitmapEnd;
46337        collectiveBitmap = decodeMMRBitmap(huffmanInput, totalWidth, currentHeight, false);
46338        huffmanInput.end = originalEnd;
46339        huffmanInput.position = bitmapEnd;
46340      }
46341      const numberOfSymbolsDecoded = symbolWidths.length;
46342      if (firstSymbol === numberOfSymbolsDecoded - 1) {
46343        newSymbols.push(collectiveBitmap);
46344      } else {
46345        let i,
46346          y,
46347          xMin = 0,
46348          xMax,
46349          bitmapWidth,
46350          symbolBitmap;
46351        for (i = firstSymbol; i < numberOfSymbolsDecoded; i++) {
46352          bitmapWidth = symbolWidths[i];
46353          xMax = xMin + bitmapWidth;
46354          symbolBitmap = [];
46355          for (y = 0; y < currentHeight; y++) {
46356            symbolBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
46357          }
46358          newSymbols.push(symbolBitmap);
46359          xMin = xMax;
46360        }
46361      }
46362    }
46363  }
46364  const exportedSymbols = [],
46365    flags = [];
46366  let currentFlag = false,
46367    i,
46368    ii;
46369  const totalSymbolsLength = symbols.length + numberOfNewSymbols;
46370  while (flags.length < totalSymbolsLength) {
46371    let runLength = huffman ? tableB1.decode(huffmanInput) : decodeInteger(contextCache, "IAEX", decoder);
46372    while (runLength--) {
46373      flags.push(currentFlag);
46374    }
46375    currentFlag = !currentFlag;
46376  }
46377  for (i = 0, ii = symbols.length; i < ii; i++) {
46378    if (flags[i]) {
46379      exportedSymbols.push(symbols[i]);
46380    }
46381  }
46382  for (let j = 0; j < numberOfNewSymbols; i++, j++) {
46383    if (flags[i]) {
46384      exportedSymbols.push(newSymbols[j]);
46385    }
46386  }
46387  return exportedSymbols;
46388}
46389function decodeTextRegion(huffman, refinement, width, height, defaultPixelValue, numberOfSymbolInstances, stripSize, inputSymbols, symbolCodeLength, transposed, dsOffset, referenceCorner, combinationOperator, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, logStripSize, huffmanInput) {
46390  if (huffman && refinement) {
46391    throw new Jbig2Error("refinement with Huffman is not supported");
46392  }
46393  const bitmap = [];
46394  let i, row;
46395  for (i = 0; i < height; i++) {
46396    row = new Uint8Array(width);
46397    if (defaultPixelValue) {
46398      for (let j = 0; j < width; j++) {
46399        row[j] = defaultPixelValue;
46400      }
46401    }
46402    bitmap.push(row);
46403  }
46404  const decoder = decodingContext.decoder;
46405  const contextCache = decodingContext.contextCache;
46406  let stripT = huffman ? -huffmanTables.tableDeltaT.decode(huffmanInput) : -decodeInteger(contextCache, "IADT", decoder);
46407  let firstS = 0;
46408  i = 0;
46409  while (i < numberOfSymbolInstances) {
46410    const deltaT = huffman ? huffmanTables.tableDeltaT.decode(huffmanInput) : decodeInteger(contextCache, "IADT", decoder);
46411    stripT += deltaT;
46412    const deltaFirstS = huffman ? huffmanTables.tableFirstS.decode(huffmanInput) : decodeInteger(contextCache, "IAFS", decoder);
46413    firstS += deltaFirstS;
46414    let currentS = firstS;
46415    do {
46416      let currentT = 0;
46417      if (stripSize > 1) {
46418        currentT = huffman ? huffmanInput.readBits(logStripSize) : decodeInteger(contextCache, "IAIT", decoder);
46419      }
46420      const t = stripSize * stripT + currentT;
46421      const symbolId = huffman ? huffmanTables.symbolIDTable.decode(huffmanInput) : decodeIAID(contextCache, decoder, symbolCodeLength);
46422      const applyRefinement = refinement && (huffman ? huffmanInput.readBit() : decodeInteger(contextCache, "IARI", decoder));
46423      let symbolBitmap = inputSymbols[symbolId];
46424      let symbolWidth = symbolBitmap[0].length;
46425      let symbolHeight = symbolBitmap.length;
46426      if (applyRefinement) {
46427        const rdw = decodeInteger(contextCache, "IARDW", decoder);
46428        const rdh = decodeInteger(contextCache, "IARDH", decoder);
46429        const rdx = decodeInteger(contextCache, "IARDX", decoder);
46430        const rdy = decodeInteger(contextCache, "IARDY", decoder);
46431        symbolWidth += rdw;
46432        symbolHeight += rdh;
46433        symbolBitmap = decodeRefinement(symbolWidth, symbolHeight, refinementTemplateIndex, symbolBitmap, (rdw >> 1) + rdx, (rdh >> 1) + rdy, false, refinementAt, decodingContext);
46434      }
46435      const offsetT = t - (referenceCorner & 1 ? 0 : symbolHeight - 1);
46436      const offsetS = currentS - (referenceCorner & 2 ? symbolWidth - 1 : 0);
46437      let s2, t2, symbolRow;
46438      if (transposed) {
46439        for (s2 = 0; s2 < symbolHeight; s2++) {
46440          row = bitmap[offsetS + s2];
46441          if (!row) {
46442            continue;
46443          }
46444          symbolRow = symbolBitmap[s2];
46445          const maxWidth = Math.min(width - offsetT, symbolWidth);
46446          switch (combinationOperator) {
46447            case 0:
46448              for (t2 = 0; t2 < maxWidth; t2++) {
46449                row[offsetT + t2] |= symbolRow[t2];
46450              }
46451              break;
46452            case 2:
46453              for (t2 = 0; t2 < maxWidth; t2++) {
46454                row[offsetT + t2] ^= symbolRow[t2];
46455              }
46456              break;
46457            default:
46458              throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
46459          }
46460        }
46461        currentS += symbolHeight - 1;
46462      } else {
46463        for (t2 = 0; t2 < symbolHeight; t2++) {
46464          row = bitmap[offsetT + t2];
46465          if (!row) {
46466            continue;
46467          }
46468          symbolRow = symbolBitmap[t2];
46469          switch (combinationOperator) {
46470            case 0:
46471              for (s2 = 0; s2 < symbolWidth; s2++) {
46472                row[offsetS + s2] |= symbolRow[s2];
46473              }
46474              break;
46475            case 2:
46476              for (s2 = 0; s2 < symbolWidth; s2++) {
46477                row[offsetS + s2] ^= symbolRow[s2];
46478              }
46479              break;
46480            default:
46481              throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
46482          }
46483        }
46484        currentS += symbolWidth - 1;
46485      }
46486      i++;
46487      const deltaS = huffman ? huffmanTables.tableDeltaS.decode(huffmanInput) : decodeInteger(contextCache, "IADS", decoder);
46488      if (deltaS === null) {
46489        break;
46490      }
46491      currentS += deltaS + dsOffset;
46492    } while (true);
46493  }
46494  return bitmap;
46495}
46496function decodePatternDictionary(mmr, patternWidth, patternHeight, maxPatternIndex, template, decodingContext) {
46497  const at = [];
46498  if (!mmr) {
46499    at.push({
46500      x: -patternWidth,
46501      y: 0
46502    });
46503    if (template === 0) {
46504      at.push({
46505        x: -3,
46506        y: -1
46507      }, {
46508        x: 2,
46509        y: -2
46510      }, {
46511        x: -2,
46512        y: -2
46513      });
46514    }
46515  }
46516  const collectiveWidth = (maxPatternIndex + 1) * patternWidth;
46517  const collectiveBitmap = decodeBitmap(mmr, collectiveWidth, patternHeight, template, false, null, at, decodingContext);
46518  const patterns = [];
46519  for (let i = 0; i <= maxPatternIndex; i++) {
46520    const patternBitmap = [];
46521    const xMin = patternWidth * i;
46522    const xMax = xMin + patternWidth;
46523    for (let y = 0; y < patternHeight; y++) {
46524      patternBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
46525    }
46526    patterns.push(patternBitmap);
46527  }
46528  return patterns;
46529}
46530function decodeHalftoneRegion(mmr, patterns, template, regionWidth, regionHeight, defaultPixelValue, enableSkip, combinationOperator, gridWidth, gridHeight, gridOffsetX, gridOffsetY, gridVectorX, gridVectorY, decodingContext) {
46531  const skip = null;
46532  if (enableSkip) {
46533    throw new Jbig2Error("skip is not supported");
46534  }
46535  if (combinationOperator !== 0) {
46536    throw new Jbig2Error(`operator "${combinationOperator}" is not supported in halftone region`);
46537  }
46538  const regionBitmap = [];
46539  let i, j, row;
46540  for (i = 0; i < regionHeight; i++) {
46541    row = new Uint8Array(regionWidth);
46542    if (defaultPixelValue) {
46543      for (j = 0; j < regionWidth; j++) {
46544        row[j] = defaultPixelValue;
46545      }
46546    }
46547    regionBitmap.push(row);
46548  }
46549  const numberOfPatterns = patterns.length;
46550  const pattern0 = patterns[0];
46551  const patternWidth = pattern0[0].length,
46552    patternHeight = pattern0.length;
46553  const bitsPerValue = (0, _core_utils.log2)(numberOfPatterns);
46554  const at = [];
46555  if (!mmr) {
46556    at.push({
46557      x: template <= 1 ? 3 : 2,
46558      y: -1
46559    });
46560    if (template === 0) {
46561      at.push({
46562        x: -3,
46563        y: -1
46564      }, {
46565        x: 2,
46566        y: -2
46567      }, {
46568        x: -2,
46569        y: -2
46570      });
46571    }
46572  }
46573  const grayScaleBitPlanes = [];
46574  let mmrInput, bitmap;
46575  if (mmr) {
46576    mmrInput = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);
46577  }
46578  for (i = bitsPerValue - 1; i >= 0; i--) {
46579    if (mmr) {
46580      bitmap = decodeMMRBitmap(mmrInput, gridWidth, gridHeight, true);
46581    } else {
46582      bitmap = decodeBitmap(false, gridWidth, gridHeight, template, false, skip, at, decodingContext);
46583    }
46584    grayScaleBitPlanes[i] = bitmap;
46585  }
46586  let mg, ng, bit, patternIndex, patternBitmap, x, y, patternRow, regionRow;
46587  for (mg = 0; mg < gridHeight; mg++) {
46588    for (ng = 0; ng < gridWidth; ng++) {
46589      bit = 0;
46590      patternIndex = 0;
46591      for (j = bitsPerValue - 1; j >= 0; j--) {
46592        bit ^= grayScaleBitPlanes[j][mg][ng];
46593        patternIndex |= bit << j;
46594      }
46595      patternBitmap = patterns[patternIndex];
46596      x = gridOffsetX + mg * gridVectorY + ng * gridVectorX >> 8;
46597      y = gridOffsetY + mg * gridVectorX - ng * gridVectorY >> 8;
46598      if (x >= 0 && x + patternWidth <= regionWidth && y >= 0 && y + patternHeight <= regionHeight) {
46599        for (i = 0; i < patternHeight; i++) {
46600          regionRow = regionBitmap[y + i];
46601          patternRow = patternBitmap[i];
46602          for (j = 0; j < patternWidth; j++) {
46603            regionRow[x + j] |= patternRow[j];
46604          }
46605        }
46606      } else {
46607        let regionX, regionY;
46608        for (i = 0; i < patternHeight; i++) {
46609          regionY = y + i;
46610          if (regionY < 0 || regionY >= regionHeight) {
46611            continue;
46612          }
46613          regionRow = regionBitmap[regionY];
46614          patternRow = patternBitmap[i];
46615          for (j = 0; j < patternWidth; j++) {
46616            regionX = x + j;
46617            if (regionX >= 0 && regionX < regionWidth) {
46618              regionRow[regionX] |= patternRow[j];
46619            }
46620          }
46621        }
46622      }
46623    }
46624  }
46625  return regionBitmap;
46626}
46627function readSegmentHeader(data, start) {
46628  const segmentHeader = {};
46629  segmentHeader.number = (0, _core_utils.readUint32)(data, start);
46630  const flags = data[start + 4];
46631  const segmentType = flags & 0x3f;
46632  if (!SegmentTypes[segmentType]) {
46633    throw new Jbig2Error("invalid segment type: " + segmentType);
46634  }
46635  segmentHeader.type = segmentType;
46636  segmentHeader.typeName = SegmentTypes[segmentType];
46637  segmentHeader.deferredNonRetain = !!(flags & 0x80);
46638  const pageAssociationFieldSize = !!(flags & 0x40);
46639  const referredFlags = data[start + 5];
46640  let referredToCount = referredFlags >> 5 & 7;
46641  const retainBits = [referredFlags & 31];
46642  let position = start + 6;
46643  if (referredFlags === 7) {
46644    referredToCount = (0, _core_utils.readUint32)(data, position - 1) & 0x1fffffff;
46645    position += 3;
46646    let bytes = referredToCount + 7 >> 3;
46647    retainBits[0] = data[position++];
46648    while (--bytes > 0) {
46649      retainBits.push(data[position++]);
46650    }
46651  } else if (referredFlags === 5 || referredFlags === 6) {
46652    throw new Jbig2Error("invalid referred-to flags");
46653  }
46654  segmentHeader.retainBits = retainBits;
46655  let referredToSegmentNumberSize = 4;
46656  if (segmentHeader.number <= 256) {
46657    referredToSegmentNumberSize = 1;
46658  } else if (segmentHeader.number <= 65536) {
46659    referredToSegmentNumberSize = 2;
46660  }
46661  const referredTo = [];
46662  let i, ii;
46663  for (i = 0; i < referredToCount; i++) {
46664    let number;
46665    if (referredToSegmentNumberSize === 1) {
46666      number = data[position];
46667    } else if (referredToSegmentNumberSize === 2) {
46668      number = (0, _core_utils.readUint16)(data, position);
46669    } else {
46670      number = (0, _core_utils.readUint32)(data, position);
46671    }
46672    referredTo.push(number);
46673    position += referredToSegmentNumberSize;
46674  }
46675  segmentHeader.referredTo = referredTo;
46676  if (!pageAssociationFieldSize) {
46677    segmentHeader.pageAssociation = data[position++];
46678  } else {
46679    segmentHeader.pageAssociation = (0, _core_utils.readUint32)(data, position);
46680    position += 4;
46681  }
46682  segmentHeader.length = (0, _core_utils.readUint32)(data, position);
46683  position += 4;
46684  if (segmentHeader.length === 0xffffffff) {
46685    if (segmentType === 38) {
46686      const genericRegionInfo = readRegionSegmentInformation(data, position);
46687      const genericRegionSegmentFlags = data[position + RegionSegmentInformationFieldLength];
46688      const genericRegionMmr = !!(genericRegionSegmentFlags & 1);
46689      const searchPatternLength = 6;
46690      const searchPattern = new Uint8Array(searchPatternLength);
46691      if (!genericRegionMmr) {
46692        searchPattern[0] = 0xff;
46693        searchPattern[1] = 0xac;
46694      }
46695      searchPattern[2] = genericRegionInfo.height >>> 24 & 0xff;
46696      searchPattern[3] = genericRegionInfo.height >> 16 & 0xff;
46697      searchPattern[4] = genericRegionInfo.height >> 8 & 0xff;
46698      searchPattern[5] = genericRegionInfo.height & 0xff;
46699      for (i = position, ii = data.length; i < ii; i++) {
46700        let j = 0;
46701        while (j < searchPatternLength && searchPattern[j] === data[i + j]) {
46702          j++;
46703        }
46704        if (j === searchPatternLength) {
46705          segmentHeader.length = i + searchPatternLength;
46706          break;
46707        }
46708      }
46709      if (segmentHeader.length === 0xffffffff) {
46710        throw new Jbig2Error("segment end was not found");
46711      }
46712    } else {
46713      throw new Jbig2Error("invalid unknown segment length");
46714    }
46715  }
46716  segmentHeader.headerEnd = position;
46717  return segmentHeader;
46718}
46719function readSegments(header, data, start, end) {
46720  const segments = [];
46721  let position = start;
46722  while (position < end) {
46723    const segmentHeader = readSegmentHeader(data, position);
46724    position = segmentHeader.headerEnd;
46725    const segment = {
46726      header: segmentHeader,
46727      data
46728    };
46729    if (!header.randomAccess) {
46730      segment.start = position;
46731      position += segmentHeader.length;
46732      segment.end = position;
46733    }
46734    segments.push(segment);
46735    if (segmentHeader.type === 51) {
46736      break;
46737    }
46738  }
46739  if (header.randomAccess) {
46740    for (let i = 0, ii = segments.length; i < ii; i++) {
46741      segments[i].start = position;
46742      position += segments[i].header.length;
46743      segments[i].end = position;
46744    }
46745  }
46746  return segments;
46747}
46748function readRegionSegmentInformation(data, start) {
46749  return {
46750    width: (0, _core_utils.readUint32)(data, start),
46751    height: (0, _core_utils.readUint32)(data, start + 4),
46752    x: (0, _core_utils.readUint32)(data, start + 8),
46753    y: (0, _core_utils.readUint32)(data, start + 12),
46754    combinationOperator: data[start + 16] & 7
46755  };
46756}
46757const RegionSegmentInformationFieldLength = 17;
46758function processSegment(segment, visitor) {
46759  const header = segment.header;
46760  const data = segment.data,
46761    end = segment.end;
46762  let position = segment.start;
46763  let args, at, i, atLength;
46764  switch (header.type) {
46765    case 0:
46766      const dictionary = {};
46767      const dictionaryFlags = (0, _core_utils.readUint16)(data, position);
46768      dictionary.huffman = !!(dictionaryFlags & 1);
46769      dictionary.refinement = !!(dictionaryFlags & 2);
46770      dictionary.huffmanDHSelector = dictionaryFlags >> 2 & 3;
46771      dictionary.huffmanDWSelector = dictionaryFlags >> 4 & 3;
46772      dictionary.bitmapSizeSelector = dictionaryFlags >> 6 & 1;
46773      dictionary.aggregationInstancesSelector = dictionaryFlags >> 7 & 1;
46774      dictionary.bitmapCodingContextUsed = !!(dictionaryFlags & 256);
46775      dictionary.bitmapCodingContextRetained = !!(dictionaryFlags & 512);
46776      dictionary.template = dictionaryFlags >> 10 & 3;
46777      dictionary.refinementTemplate = dictionaryFlags >> 12 & 1;
46778      position += 2;
46779      if (!dictionary.huffman) {
46780        atLength = dictionary.template === 0 ? 4 : 1;
46781        at = [];
46782        for (i = 0; i < atLength; i++) {
46783          at.push({
46784            x: (0, _core_utils.readInt8)(data, position),
46785            y: (0, _core_utils.readInt8)(data, position + 1)
46786          });
46787          position += 2;
46788        }
46789        dictionary.at = at;
46790      }
46791      if (dictionary.refinement && !dictionary.refinementTemplate) {
46792        at = [];
46793        for (i = 0; i < 2; i++) {
46794          at.push({
46795            x: (0, _core_utils.readInt8)(data, position),
46796            y: (0, _core_utils.readInt8)(data, position + 1)
46797          });
46798          position += 2;
46799        }
46800        dictionary.refinementAt = at;
46801      }
46802      dictionary.numberOfExportedSymbols = (0, _core_utils.readUint32)(data, position);
46803      position += 4;
46804      dictionary.numberOfNewSymbols = (0, _core_utils.readUint32)(data, position);
46805      position += 4;
46806      args = [dictionary, header.number, header.referredTo, data, position, end];
46807      break;
46808    case 6:
46809    case 7:
46810      const textRegion = {};
46811      textRegion.info = readRegionSegmentInformation(data, position);
46812      position += RegionSegmentInformationFieldLength;
46813      const textRegionSegmentFlags = (0, _core_utils.readUint16)(data, position);
46814      position += 2;
46815      textRegion.huffman = !!(textRegionSegmentFlags & 1);
46816      textRegion.refinement = !!(textRegionSegmentFlags & 2);
46817      textRegion.logStripSize = textRegionSegmentFlags >> 2 & 3;
46818      textRegion.stripSize = 1 << textRegion.logStripSize;
46819      textRegion.referenceCorner = textRegionSegmentFlags >> 4 & 3;
46820      textRegion.transposed = !!(textRegionSegmentFlags & 64);
46821      textRegion.combinationOperator = textRegionSegmentFlags >> 7 & 3;
46822      textRegion.defaultPixelValue = textRegionSegmentFlags >> 9 & 1;
46823      textRegion.dsOffset = textRegionSegmentFlags << 17 >> 27;
46824      textRegion.refinementTemplate = textRegionSegmentFlags >> 15 & 1;
46825      if (textRegion.huffman) {
46826        const textRegionHuffmanFlags = (0, _core_utils.readUint16)(data, position);
46827        position += 2;
46828        textRegion.huffmanFS = textRegionHuffmanFlags & 3;
46829        textRegion.huffmanDS = textRegionHuffmanFlags >> 2 & 3;
46830        textRegion.huffmanDT = textRegionHuffmanFlags >> 4 & 3;
46831        textRegion.huffmanRefinementDW = textRegionHuffmanFlags >> 6 & 3;
46832        textRegion.huffmanRefinementDH = textRegionHuffmanFlags >> 8 & 3;
46833        textRegion.huffmanRefinementDX = textRegionHuffmanFlags >> 10 & 3;
46834        textRegion.huffmanRefinementDY = textRegionHuffmanFlags >> 12 & 3;
46835        textRegion.huffmanRefinementSizeSelector = !!(textRegionHuffmanFlags & 0x4000);
46836      }
46837      if (textRegion.refinement && !textRegion.refinementTemplate) {
46838        at = [];
46839        for (i = 0; i < 2; i++) {
46840          at.push({
46841            x: (0, _core_utils.readInt8)(data, position),
46842            y: (0, _core_utils.readInt8)(data, position + 1)
46843          });
46844          position += 2;
46845        }
46846        textRegion.refinementAt = at;
46847      }
46848      textRegion.numberOfSymbolInstances = (0, _core_utils.readUint32)(data, position);
46849      position += 4;
46850      args = [textRegion, header.referredTo, data, position, end];
46851      break;
46852    case 16:
46853      const patternDictionary = {};
46854      const patternDictionaryFlags = data[position++];
46855      patternDictionary.mmr = !!(patternDictionaryFlags & 1);
46856      patternDictionary.template = patternDictionaryFlags >> 1 & 3;
46857      patternDictionary.patternWidth = data[position++];
46858      patternDictionary.patternHeight = data[position++];
46859      patternDictionary.maxPatternIndex = (0, _core_utils.readUint32)(data, position);
46860      position += 4;
46861      args = [patternDictionary, header.number, data, position, end];
46862      break;
46863    case 22:
46864    case 23:
46865      const halftoneRegion = {};
46866      halftoneRegion.info = readRegionSegmentInformation(data, position);
46867      position += RegionSegmentInformationFieldLength;
46868      const halftoneRegionFlags = data[position++];
46869      halftoneRegion.mmr = !!(halftoneRegionFlags & 1);
46870      halftoneRegion.template = halftoneRegionFlags >> 1 & 3;
46871      halftoneRegion.enableSkip = !!(halftoneRegionFlags & 8);
46872      halftoneRegion.combinationOperator = halftoneRegionFlags >> 4 & 7;
46873      halftoneRegion.defaultPixelValue = halftoneRegionFlags >> 7 & 1;
46874      halftoneRegion.gridWidth = (0, _core_utils.readUint32)(data, position);
46875      position += 4;
46876      halftoneRegion.gridHeight = (0, _core_utils.readUint32)(data, position);
46877      position += 4;
46878      halftoneRegion.gridOffsetX = (0, _core_utils.readUint32)(data, position) & 0xffffffff;
46879      position += 4;
46880      halftoneRegion.gridOffsetY = (0, _core_utils.readUint32)(data, position) & 0xffffffff;
46881      position += 4;
46882      halftoneRegion.gridVectorX = (0, _core_utils.readUint16)(data, position);
46883      position += 2;
46884      halftoneRegion.gridVectorY = (0, _core_utils.readUint16)(data, position);
46885      position += 2;
46886      args = [halftoneRegion, header.referredTo, data, position, end];
46887      break;
46888    case 38:
46889    case 39:
46890      const genericRegion = {};
46891      genericRegion.info = readRegionSegmentInformation(data, position);
46892      position += RegionSegmentInformationFieldLength;
46893      const genericRegionSegmentFlags = data[position++];
46894      genericRegion.mmr = !!(genericRegionSegmentFlags & 1);
46895      genericRegion.template = genericRegionSegmentFlags >> 1 & 3;
46896      genericRegion.prediction = !!(genericRegionSegmentFlags & 8);
46897      if (!genericRegion.mmr) {
46898        atLength = genericRegion.template === 0 ? 4 : 1;
46899        at = [];
46900        for (i = 0; i < atLength; i++) {
46901          at.push({
46902            x: (0, _core_utils.readInt8)(data, position),
46903            y: (0, _core_utils.readInt8)(data, position + 1)
46904          });
46905          position += 2;
46906        }
46907        genericRegion.at = at;
46908      }
46909      args = [genericRegion, data, position, end];
46910      break;
46911    case 48:
46912      const pageInfo = {
46913        width: (0, _core_utils.readUint32)(data, position),
46914        height: (0, _core_utils.readUint32)(data, position + 4),
46915        resolutionX: (0, _core_utils.readUint32)(data, position + 8),
46916        resolutionY: (0, _core_utils.readUint32)(data, position + 12)
46917      };
46918      if (pageInfo.height === 0xffffffff) {
46919        delete pageInfo.height;
46920      }
46921      const pageSegmentFlags = data[position + 16];
46922      (0, _core_utils.readUint16)(data, position + 17);
46923      pageInfo.lossless = !!(pageSegmentFlags & 1);
46924      pageInfo.refinement = !!(pageSegmentFlags & 2);
46925      pageInfo.defaultPixelValue = pageSegmentFlags >> 2 & 1;
46926      pageInfo.combinationOperator = pageSegmentFlags >> 3 & 3;
46927      pageInfo.requiresBuffer = !!(pageSegmentFlags & 32);
46928      pageInfo.combinationOperatorOverride = !!(pageSegmentFlags & 64);
46929      args = [pageInfo];
46930      break;
46931    case 49:
46932      break;
46933    case 50:
46934      break;
46935    case 51:
46936      break;
46937    case 53:
46938      args = [header.number, data, position, end];
46939      break;
46940    case 62:
46941      break;
46942    default:
46943      throw new Jbig2Error(`segment type ${header.typeName}(${header.type}) is not implemented`);
46944  }
46945  const callbackName = "on" + header.typeName;
46946  if (callbackName in visitor) {
46947    visitor[callbackName].apply(visitor, args);
46948  }
46949}
46950function processSegments(segments, visitor) {
46951  for (let i = 0, ii = segments.length; i < ii; i++) {
46952    processSegment(segments[i], visitor);
46953  }
46954}
46955function parseJbig2Chunks(chunks) {
46956  const visitor = new SimpleSegmentVisitor();
46957  for (let i = 0, ii = chunks.length; i < ii; i++) {
46958    const chunk = chunks[i];
46959    const segments = readSegments({}, chunk.data, chunk.start, chunk.end);
46960    processSegments(segments, visitor);
46961  }
46962  return visitor.buffer;
46963}
46964function parseJbig2(data) {
46965  throw new Error("Not implemented: parseJbig2");
46966}
46967class SimpleSegmentVisitor {
46968  onPageInformation(info) {
46969    this.currentPageInfo = info;
46970    const rowSize = info.width + 7 >> 3;
46971    const buffer = new Uint8ClampedArray(rowSize * info.height);
46972    if (info.defaultPixelValue) {
46973      buffer.fill(0xff);
46974    }
46975    this.buffer = buffer;
46976  }
46977  drawBitmap(regionInfo, bitmap) {
46978    const pageInfo = this.currentPageInfo;
46979    const width = regionInfo.width,
46980      height = regionInfo.height;
46981    const rowSize = pageInfo.width + 7 >> 3;
46982    const combinationOperator = pageInfo.combinationOperatorOverride ? regionInfo.combinationOperator : pageInfo.combinationOperator;
46983    const buffer = this.buffer;
46984    const mask0 = 128 >> (regionInfo.x & 7);
46985    let offset0 = regionInfo.y * rowSize + (regionInfo.x >> 3);
46986    let i, j, mask, offset;
46987    switch (combinationOperator) {
46988      case 0:
46989        for (i = 0; i < height; i++) {
46990          mask = mask0;
46991          offset = offset0;
46992          for (j = 0; j < width; j++) {
46993            if (bitmap[i][j]) {
46994              buffer[offset] |= mask;
46995            }
46996            mask >>= 1;
46997            if (!mask) {
46998              mask = 128;
46999              offset++;
47000            }
47001          }
47002          offset0 += rowSize;
47003        }
47004        break;
47005      case 2:
47006        for (i = 0; i < height; i++) {
47007          mask = mask0;
47008          offset = offset0;
47009          for (j = 0; j < width; j++) {
47010            if (bitmap[i][j]) {
47011              buffer[offset] ^= mask;
47012            }
47013            mask >>= 1;
47014            if (!mask) {
47015              mask = 128;
47016              offset++;
47017            }
47018          }
47019          offset0 += rowSize;
47020        }
47021        break;
47022      default:
47023        throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
47024    }
47025  }
47026  onImmediateGenericRegion(region, data, start, end) {
47027    const regionInfo = region.info;
47028    const decodingContext = new DecodingContext(data, start, end);
47029    const bitmap = decodeBitmap(region.mmr, regionInfo.width, regionInfo.height, region.template, region.prediction, null, region.at, decodingContext);
47030    this.drawBitmap(regionInfo, bitmap);
47031  }
47032  onImmediateLosslessGenericRegion() {
47033    this.onImmediateGenericRegion(...arguments);
47034  }
47035  onSymbolDictionary(dictionary, currentSegment, referredSegments, data, start, end) {
47036    let huffmanTables, huffmanInput;
47037    if (dictionary.huffman) {
47038      huffmanTables = getSymbolDictionaryHuffmanTables(dictionary, referredSegments, this.customTables);
47039      huffmanInput = new Reader(data, start, end);
47040    }
47041    let symbols = this.symbols;
47042    if (!symbols) {
47043      this.symbols = symbols = {};
47044    }
47045    const inputSymbols = [];
47046    for (const referredSegment of referredSegments) {
47047      const referredSymbols = symbols[referredSegment];
47048      if (referredSymbols) {
47049        inputSymbols.push(...referredSymbols);
47050      }
47051    }
47052    const decodingContext = new DecodingContext(data, start, end);
47053    symbols[currentSegment] = decodeSymbolDictionary(dictionary.huffman, dictionary.refinement, inputSymbols, dictionary.numberOfNewSymbols, dictionary.numberOfExportedSymbols, huffmanTables, dictionary.template, dictionary.at, dictionary.refinementTemplate, dictionary.refinementAt, decodingContext, huffmanInput);
47054  }
47055  onImmediateTextRegion(region, referredSegments, data, start, end) {
47056    const regionInfo = region.info;
47057    let huffmanTables, huffmanInput;
47058    const symbols = this.symbols;
47059    const inputSymbols = [];
47060    for (const referredSegment of referredSegments) {
47061      const referredSymbols = symbols[referredSegment];
47062      if (referredSymbols) {
47063        inputSymbols.push(...referredSymbols);
47064      }
47065    }
47066    const symbolCodeLength = (0, _core_utils.log2)(inputSymbols.length);
47067    if (region.huffman) {
47068      huffmanInput = new Reader(data, start, end);
47069      huffmanTables = getTextRegionHuffmanTables(region, referredSegments, this.customTables, inputSymbols.length, huffmanInput);
47070    }
47071    const decodingContext = new DecodingContext(data, start, end);
47072    const bitmap = decodeTextRegion(region.huffman, region.refinement, regionInfo.width, regionInfo.height, region.defaultPixelValue, region.numberOfSymbolInstances, region.stripSize, inputSymbols, symbolCodeLength, region.transposed, region.dsOffset, region.referenceCorner, region.combinationOperator, huffmanTables, region.refinementTemplate, region.refinementAt, decodingContext, region.logStripSize, huffmanInput);
47073    this.drawBitmap(regionInfo, bitmap);
47074  }
47075  onImmediateLosslessTextRegion() {
47076    this.onImmediateTextRegion(...arguments);
47077  }
47078  onPatternDictionary(dictionary, currentSegment, data, start, end) {
47079    let patterns = this.patterns;
47080    if (!patterns) {
47081      this.patterns = patterns = {};
47082    }
47083    const decodingContext = new DecodingContext(data, start, end);
47084    patterns[currentSegment] = decodePatternDictionary(dictionary.mmr, dictionary.patternWidth, dictionary.patternHeight, dictionary.maxPatternIndex, dictionary.template, decodingContext);
47085  }
47086  onImmediateHalftoneRegion(region, referredSegments, data, start, end) {
47087    const patterns = this.patterns[referredSegments[0]];
47088    const regionInfo = region.info;
47089    const decodingContext = new DecodingContext(data, start, end);
47090    const bitmap = decodeHalftoneRegion(region.mmr, patterns, region.template, regionInfo.width, regionInfo.height, region.defaultPixelValue, region.enableSkip, region.combinationOperator, region.gridWidth, region.gridHeight, region.gridOffsetX, region.gridOffsetY, region.gridVectorX, region.gridVectorY, decodingContext);
47091    this.drawBitmap(regionInfo, bitmap);
47092  }
47093  onImmediateLosslessHalftoneRegion() {
47094    this.onImmediateHalftoneRegion(...arguments);
47095  }
47096  onTables(currentSegment, data, start, end) {
47097    let customTables = this.customTables;
47098    if (!customTables) {
47099      this.customTables = customTables = {};
47100    }
47101    customTables[currentSegment] = decodeTablesSegment(data, start, end);
47102  }
47103}
47104class HuffmanLine {
47105  constructor(lineData) {
47106    if (lineData.length === 2) {
47107      this.isOOB = true;
47108      this.rangeLow = 0;
47109      this.prefixLength = lineData[0];
47110      this.rangeLength = 0;
47111      this.prefixCode = lineData[1];
47112      this.isLowerRange = false;
47113    } else {
47114      this.isOOB = false;
47115      this.rangeLow = lineData[0];
47116      this.prefixLength = lineData[1];
47117      this.rangeLength = lineData[2];
47118      this.prefixCode = lineData[3];
47119      this.isLowerRange = lineData[4] === "lower";
47120    }
47121  }
47122}
47123class HuffmanTreeNode {
47124  constructor(line) {
47125    this.children = [];
47126    if (line) {
47127      this.isLeaf = true;
47128      this.rangeLength = line.rangeLength;
47129      this.rangeLow = line.rangeLow;
47130      this.isLowerRange = line.isLowerRange;
47131      this.isOOB = line.isOOB;
47132    } else {
47133      this.isLeaf = false;
47134    }
47135  }
47136  buildTree(line, shift) {
47137    const bit = line.prefixCode >> shift & 1;
47138    if (shift <= 0) {
47139      this.children[bit] = new HuffmanTreeNode(line);
47140    } else {
47141      let node = this.children[bit];
47142      if (!node) {
47143        this.children[bit] = node = new HuffmanTreeNode(null);
47144      }
47145      node.buildTree(line, shift - 1);
47146    }
47147  }
47148  decodeNode(reader) {
47149    if (this.isLeaf) {
47150      if (this.isOOB) {
47151        return null;
47152      }
47153      const htOffset = reader.readBits(this.rangeLength);
47154      return this.rangeLow + (this.isLowerRange ? -htOffset : htOffset);
47155    }
47156    const node = this.children[reader.readBit()];
47157    if (!node) {
47158      throw new Jbig2Error("invalid Huffman data");
47159    }
47160    return node.decodeNode(reader);
47161  }
47162}
47163class HuffmanTable {
47164  constructor(lines, prefixCodesDone) {
47165    if (!prefixCodesDone) {
47166      this.assignPrefixCodes(lines);
47167    }
47168    this.rootNode = new HuffmanTreeNode(null);
47169    for (let i = 0, ii = lines.length; i < ii; i++) {
47170      const line = lines[i];
47171      if (line.prefixLength > 0) {
47172        this.rootNode.buildTree(line, line.prefixLength - 1);
47173      }
47174    }
47175  }
47176  decode(reader) {
47177    return this.rootNode.decodeNode(reader);
47178  }
47179  assignPrefixCodes(lines) {
47180    const linesLength = lines.length;
47181    let prefixLengthMax = 0;
47182    for (let i = 0; i < linesLength; i++) {
47183      prefixLengthMax = Math.max(prefixLengthMax, lines[i].prefixLength);
47184    }
47185    const histogram = new Uint32Array(prefixLengthMax + 1);
47186    for (let i = 0; i < linesLength; i++) {
47187      histogram[lines[i].prefixLength]++;
47188    }
47189    let currentLength = 1,
47190      firstCode = 0,
47191      currentCode,
47192      currentTemp,
47193      line;
47194    histogram[0] = 0;
47195    while (currentLength <= prefixLengthMax) {
47196      firstCode = firstCode + histogram[currentLength - 1] << 1;
47197      currentCode = firstCode;
47198      currentTemp = 0;
47199      while (currentTemp < linesLength) {
47200        line = lines[currentTemp];
47201        if (line.prefixLength === currentLength) {
47202          line.prefixCode = currentCode;
47203          currentCode++;
47204        }
47205        currentTemp++;
47206      }
47207      currentLength++;
47208    }
47209  }
47210}
47211function decodeTablesSegment(data, start, end) {
47212  const flags = data[start];
47213  const lowestValue = (0, _core_utils.readUint32)(data, start + 1) & 0xffffffff;
47214  const highestValue = (0, _core_utils.readUint32)(data, start + 5) & 0xffffffff;
47215  const reader = new Reader(data, start + 9, end);
47216  const prefixSizeBits = (flags >> 1 & 7) + 1;
47217  const rangeSizeBits = (flags >> 4 & 7) + 1;
47218  const lines = [];
47219  let prefixLength,
47220    rangeLength,
47221    currentRangeLow = lowestValue;
47222  do {
47223    prefixLength = reader.readBits(prefixSizeBits);
47224    rangeLength = reader.readBits(rangeSizeBits);
47225    lines.push(new HuffmanLine([currentRangeLow, prefixLength, rangeLength, 0]));
47226    currentRangeLow += 1 << rangeLength;
47227  } while (currentRangeLow < highestValue);
47228  prefixLength = reader.readBits(prefixSizeBits);
47229  lines.push(new HuffmanLine([lowestValue - 1, prefixLength, 32, 0, "lower"]));
47230  prefixLength = reader.readBits(prefixSizeBits);
47231  lines.push(new HuffmanLine([highestValue, prefixLength, 32, 0]));
47232  if (flags & 1) {
47233    prefixLength = reader.readBits(prefixSizeBits);
47234    lines.push(new HuffmanLine([prefixLength, 0]));
47235  }
47236  return new HuffmanTable(lines, false);
47237}
47238const standardTablesCache = {};
47239function getStandardTable(number) {
47240  let table = standardTablesCache[number];
47241  if (table) {
47242    return table;
47243  }
47244  let lines;
47245  switch (number) {
47246    case 1:
47247      lines = [[0, 1, 4, 0x0], [16, 2, 8, 0x2], [272, 3, 16, 0x6], [65808, 3, 32, 0x7]];
47248      break;
47249    case 2:
47250      lines = [[0, 1, 0, 0x0], [1, 2, 0, 0x2], [2, 3, 0, 0x6], [3, 4, 3, 0xe], [11, 5, 6, 0x1e], [75, 6, 32, 0x3e], [6, 0x3f]];
47251      break;
47252    case 3:
47253      lines = [[-256, 8, 8, 0xfe], [0, 1, 0, 0x0], [1, 2, 0, 0x2], [2, 3, 0, 0x6], [3, 4, 3, 0xe], [11, 5, 6, 0x1e], [-257, 8, 32, 0xff, "lower"], [75, 7, 32, 0x7e], [6, 0x3e]];
47254      break;
47255    case 4:
47256      lines = [[1, 1, 0, 0x0], [2, 2, 0, 0x2], [3, 3, 0, 0x6], [4, 4, 3, 0xe], [12, 5, 6, 0x1e], [76, 5, 32, 0x1f]];
47257      break;
47258    case 5:
47259      lines = [[-255, 7, 8, 0x7e], [1, 1, 0, 0x0], [2, 2, 0, 0x2], [3, 3, 0, 0x6], [4, 4, 3, 0xe], [12, 5, 6, 0x1e], [-256, 7, 32, 0x7f, "lower"], [76, 6, 32, 0x3e]];
47260      break;
47261    case 6:
vendor: 9,303 bytes, lines 47262-47514
47262      lines = [[-2048, 5, 10, 0x1c], [-1024, 4, 9, 0x8], [-512, 4, 8, 0x9], [-256, 4, 7, 0xa], [-128, 5, 6, 0x1d], [-64, 5, 5, 0x1e], [-32, 4, 5, 0xb], [0, 2, 7, 0x0], [128, 3, 7, 0x2], [256, 3, 8, 0x3], [512, 4, 9, 0xc], [1024, 4, 10, 0xd], [-2049, 6, 32, 0x3e, "lower"], [2048, 6, 32, 0x3f]];
47263      break;
47264    case 7:
47265      lines = [[-1024, 4, 9, 0x8], [-512, 3, 8, 0x0], [-256, 4, 7, 0x9], [-128, 5, 6, 0x1a], [-64, 5, 5, 0x1b], [-32, 4, 5, 0xa], [0, 4, 5, 0xb], [32, 5, 5, 0x1c], [64, 5, 6, 0x1d], [128, 4, 7, 0xc], [256, 3, 8, 0x1], [512, 3, 9, 0x2], [1024, 3, 10, 0x3], [-1025, 5, 32, 0x1e, "lower"], [2048, 5, 32, 0x1f]];
47266      break;
47267    case 8:
47268      lines = [[-15, 8, 3, 0xfc], [-7, 9, 1, 0x1fc], [-5, 8, 1, 0xfd], [-3, 9, 0, 0x1fd], [-2, 7, 0, 0x7c], [-1, 4, 0, 0xa], [0, 2, 1, 0x0], [2, 5, 0, 0x1a], [3, 6, 0, 0x3a], [4, 3, 4, 0x4], [20, 6, 1, 0x3b], [22, 4, 4, 0xb], [38, 4, 5, 0xc], [70, 5, 6, 0x1b], [134, 5, 7, 0x1c], [262, 6, 7, 0x3c], [390, 7, 8, 0x7d], [646, 6, 10, 0x3d], [-16, 9, 32, 0x1fe, "lower"], [1670, 9, 32, 0x1ff], [2, 0x1]];
47269      break;
47270    case 9:
47271      lines = [[-31, 8, 4, 0xfc], [-15, 9, 2, 0x1fc], [-11, 8, 2, 0xfd], [-7, 9, 1, 0x1fd], [-5, 7, 1, 0x7c], [-3, 4, 1, 0xa], [-1, 3, 1, 0x2], [1, 3, 1, 0x3], [3, 5, 1, 0x1a], [5, 6, 1, 0x3a], [7, 3, 5, 0x4], [39, 6, 2, 0x3b], [43, 4, 5, 0xb], [75, 4, 6, 0xc], [139, 5, 7, 0x1b], [267, 5, 8, 0x1c], [523, 6, 8, 0x3c], [779, 7, 9, 0x7d], [1291, 6, 11, 0x3d], [-32, 9, 32, 0x1fe, "lower"], [3339, 9, 32, 0x1ff], [2, 0x0]];
47272      break;
47273    case 10:
47274      lines = [[-21, 7, 4, 0x7a], [-5, 8, 0, 0xfc], [-4, 7, 0, 0x7b], [-3, 5, 0, 0x18], [-2, 2, 2, 0x0], [2, 5, 0, 0x19], [3, 6, 0, 0x36], [4, 7, 0, 0x7c], [5, 8, 0, 0xfd], [6, 2, 6, 0x1], [70, 5, 5, 0x1a], [102, 6, 5, 0x37], [134, 6, 6, 0x38], [198, 6, 7, 0x39], [326, 6, 8, 0x3a], [582, 6, 9, 0x3b], [1094, 6, 10, 0x3c], [2118, 7, 11, 0x7d], [-22, 8, 32, 0xfe, "lower"], [4166, 8, 32, 0xff], [2, 0x2]];
47275      break;
47276    case 11:
47277      lines = [[1, 1, 0, 0x0], [2, 2, 1, 0x2], [4, 4, 0, 0xc], [5, 4, 1, 0xd], [7, 5, 1, 0x1c], [9, 5, 2, 0x1d], [13, 6, 2, 0x3c], [17, 7, 2, 0x7a], [21, 7, 3, 0x7b], [29, 7, 4, 0x7c], [45, 7, 5, 0x7d], [77, 7, 6, 0x7e], [141, 7, 32, 0x7f]];
47278      break;
47279    case 12:
47280      lines = [[1, 1, 0, 0x0], [2, 2, 0, 0x2], [3, 3, 1, 0x6], [5, 5, 0, 0x1c], [6, 5, 1, 0x1d], [8, 6, 1, 0x3c], [10, 7, 0, 0x7a], [11, 7, 1, 0x7b], [13, 7, 2, 0x7c], [17, 7, 3, 0x7d], [25, 7, 4, 0x7e], [41, 8, 5, 0xfe], [73, 8, 32, 0xff]];
47281      break;
47282    case 13:
47283      lines = [[1, 1, 0, 0x0], [2, 3, 0, 0x4], [3, 4, 0, 0xc], [4, 5, 0, 0x1c], [5, 4, 1, 0xd], [7, 3, 3, 0x5], [15, 6, 1, 0x3a], [17, 6, 2, 0x3b], [21, 6, 3, 0x3c], [29, 6, 4, 0x3d], [45, 6, 5, 0x3e], [77, 7, 6, 0x7e], [141, 7, 32, 0x7f]];
47284      break;
47285    case 14:
47286      lines = [[-2, 3, 0, 0x4], [-1, 3, 0, 0x5], [0, 1, 0, 0x0], [1, 3, 0, 0x6], [2, 3, 0, 0x7]];
47287      break;
47288    case 15:
47289      lines = [[-24, 7, 4, 0x7c], [-8, 6, 2, 0x3c], [-4, 5, 1, 0x1c], [-2, 4, 0, 0xc], [-1, 3, 0, 0x4], [0, 1, 0, 0x0], [1, 3, 0, 0x5], [2, 4, 0, 0xd], [3, 5, 1, 0x1d], [5, 6, 2, 0x3d], [9, 7, 4, 0x7d], [-25, 7, 32, 0x7e, "lower"], [25, 7, 32, 0x7f]];
47290      break;
47291    default:
47292      throw new Jbig2Error(`standard table B.${number} does not exist`);
47293  }
47294  for (let i = 0, ii = lines.length; i < ii; i++) {
47295    lines[i] = new HuffmanLine(lines[i]);
47296  }
47297  table = new HuffmanTable(lines, true);
47298  standardTablesCache[number] = table;
47299  return table;
47300}
47301class Reader {
47302  constructor(data, start, end) {
47303    this.data = data;
47304    this.start = start;
47305    this.end = end;
47306    this.position = start;
47307    this.shift = -1;
47308    this.currentByte = 0;
47309  }
47310  readBit() {
47311    if (this.shift < 0) {
47312      if (this.position >= this.end) {
47313        throw new Jbig2Error("end of data while reading bit");
47314      }
47315      this.currentByte = this.data[this.position++];
47316      this.shift = 7;
47317    }
47318    const bit = this.currentByte >> this.shift & 1;
47319    this.shift--;
47320    return bit;
47321  }
47322  readBits(numBits) {
47323    let result = 0,
47324      i;
47325    for (i = numBits - 1; i >= 0; i--) {
47326      result |= this.readBit() << i;
47327    }
47328    return result;
47329  }
47330  byteAlign() {
47331    this.shift = -1;
47332  }
47333  next() {
47334    if (this.position >= this.end) {
47335      return -1;
47336    }
47337    return this.data[this.position++];
47338  }
47339}
47340function getCustomHuffmanTable(index, referredTo, customTables) {
47341  let currentIndex = 0;
47342  for (let i = 0, ii = referredTo.length; i < ii; i++) {
47343    const table = customTables[referredTo[i]];
47344    if (table) {
47345      if (index === currentIndex) {
47346        return table;
47347      }
47348      currentIndex++;
47349    }
47350  }
47351  throw new Jbig2Error("can't find custom Huffman table");
47352}
47353function getTextRegionHuffmanTables(textRegion, referredTo, customTables, numberOfSymbols, reader) {
47354  const codes = [];
47355  for (let i = 0; i <= 34; i++) {
47356    const codeLength = reader.readBits(4);
47357    codes.push(new HuffmanLine([i, codeLength, 0, 0]));
47358  }
47359  const runCodesTable = new HuffmanTable(codes, false);
47360  codes.length = 0;
47361  for (let i = 0; i < numberOfSymbols;) {
47362    const codeLength = runCodesTable.decode(reader);
47363    if (codeLength >= 32) {
47364      let repeatedLength, numberOfRepeats, j;
47365      switch (codeLength) {
47366        case 32:
47367          if (i === 0) {
47368            throw new Jbig2Error("no previous value in symbol ID table");
47369          }
47370          numberOfRepeats = reader.readBits(2) + 3;
47371          repeatedLength = codes[i - 1].prefixLength;
47372          break;
47373        case 33:
47374          numberOfRepeats = reader.readBits(3) + 3;
47375          repeatedLength = 0;
47376          break;
47377        case 34:
47378          numberOfRepeats = reader.readBits(7) + 11;
47379          repeatedLength = 0;
47380          break;
47381        default:
47382          throw new Jbig2Error("invalid code length in symbol ID table");
47383      }
47384      for (j = 0; j < numberOfRepeats; j++) {
47385        codes.push(new HuffmanLine([i, repeatedLength, 0, 0]));
47386        i++;
47387      }
47388    } else {
47389      codes.push(new HuffmanLine([i, codeLength, 0, 0]));
47390      i++;
47391    }
47392  }
47393  reader.byteAlign();
47394  const symbolIDTable = new HuffmanTable(codes, false);
47395  let customIndex = 0,
47396    tableFirstS,
47397    tableDeltaS,
47398    tableDeltaT;
47399  switch (textRegion.huffmanFS) {
47400    case 0:
47401    case 1:
47402      tableFirstS = getStandardTable(textRegion.huffmanFS + 6);
47403      break;
47404    case 3:
47405      tableFirstS = getCustomHuffmanTable(customIndex, referredTo, customTables);
47406      customIndex++;
47407      break;
47408    default:
47409      throw new Jbig2Error("invalid Huffman FS selector");
47410  }
47411  switch (textRegion.huffmanDS) {
47412    case 0:
47413    case 1:
47414    case 2:
47415      tableDeltaS = getStandardTable(textRegion.huffmanDS + 8);
47416      break;
47417    case 3:
47418      tableDeltaS = getCustomHuffmanTable(customIndex, referredTo, customTables);
47419      customIndex++;
47420      break;
47421    default:
47422      throw new Jbig2Error("invalid Huffman DS selector");
47423  }
47424  switch (textRegion.huffmanDT) {
47425    case 0:
47426    case 1:
47427    case 2:
47428      tableDeltaT = getStandardTable(textRegion.huffmanDT + 11);
47429      break;
47430    case 3:
47431      tableDeltaT = getCustomHuffmanTable(customIndex, referredTo, customTables);
47432      customIndex++;
47433      break;
47434    default:
47435      throw new Jbig2Error("invalid Huffman DT selector");
47436  }
47437  if (textRegion.refinement) {
47438    throw new Jbig2Error("refinement with Huffman is not supported");
47439  }
47440  return {
47441    symbolIDTable,
47442    tableFirstS,
47443    tableDeltaS,
47444    tableDeltaT
47445  };
47446}
47447function getSymbolDictionaryHuffmanTables(dictionary, referredTo, customTables) {
47448  let customIndex = 0,
47449    tableDeltaHeight,
47450    tableDeltaWidth;
47451  switch (dictionary.huffmanDHSelector) {
47452    case 0:
47453    case 1:
47454      tableDeltaHeight = getStandardTable(dictionary.huffmanDHSelector + 4);
47455      break;
47456    case 3:
47457      tableDeltaHeight = getCustomHuffmanTable(customIndex, referredTo, customTables);
47458      customIndex++;
47459      break;
47460    default:
47461      throw new Jbig2Error("invalid Huffman DH selector");
47462  }
47463  switch (dictionary.huffmanDWSelector) {
47464    case 0:
47465    case 1:
47466      tableDeltaWidth = getStandardTable(dictionary.huffmanDWSelector + 2);
47467      break;
47468    case 3:
47469      tableDeltaWidth = getCustomHuffmanTable(customIndex, referredTo, customTables);
47470      customIndex++;
47471      break;
47472    default:
47473      throw new Jbig2Error("invalid Huffman DW selector");
47474  }
47475  let tableBitmapSize, tableAggregateInstances;
47476  if (dictionary.bitmapSizeSelector) {
47477    tableBitmapSize = getCustomHuffmanTable(customIndex, referredTo, customTables);
47478    customIndex++;
47479  } else {
47480    tableBitmapSize = getStandardTable(1);
47481  }
47482  if (dictionary.aggregationInstancesSelector) {
47483    tableAggregateInstances = getCustomHuffmanTable(customIndex, referredTo, customTables);
47484  } else {
47485    tableAggregateInstances = getStandardTable(1);
47486  }
47487  return {
47488    tableDeltaHeight,
47489    tableDeltaWidth,
47490    tableBitmapSize,
47491    tableAggregateInstances
47492  };
47493}
47494function readUncompressedBitmap(reader, width, height) {
47495  const bitmap = [];
47496  for (let y = 0; y < height; y++) {
47497    const row = new Uint8Array(width);
47498    bitmap.push(row);
47499    for (let x = 0; x < width; x++) {
47500      row[x] = reader.readBit();
47501    }
47502    reader.byteAlign();
47503  }
47504  return bitmap;
47505}
47506function decodeMMRBitmap(input, width, height, endOfBlock) {
47507  const params = {
47508    K: -1,
47509    Columns: width,
47510    Rows: height,
47511    BlackIs1: true,
47512    EndOfBlock: endOfBlock
47513  };
47514  const decoder = new 
vendor: 10,746 bytes, lines 47514-48058
47514_ccitt.CCITTFaxDecoder(input, params);
47515  const bitmap = [];
47516  let currentByte,
47517    eof = false;
47518  for (let y = 0; y < height; y++) {
47519    const row = new Uint8Array(width);
47520    bitmap.push(row);
47521    let shift = -1;
47522    for (let x = 0; x < width; x++) {
47523      if (shift < 0) {
47524        currentByte = decoder.readNextChar();
47525        if (currentByte === -1) {
47526          currentByte = 0;
47527          eof = true;
47528        }
47529        shift = 7;
47530      }
47531      row[x] = currentByte >> shift & 1;
47532      shift--;
47533    }
47534  }
47535  if (endOfBlock && !eof) {
47536    const lookForEOFLimit = 5;
47537    for (let i = 0; i < lookForEOFLimit; i++) {
47538      if (decoder.readNextChar() === -1) {
47539        break;
47540      }
47541    }
47542  }
47543  return bitmap;
47544}
47545class Jbig2Image {
47546  parseChunks(chunks) {
47547    return parseJbig2Chunks(chunks);
47548  }
47549  parse(data) {
47550    throw new Error("Not implemented: Jbig2Image.parse");
47551  }
47552}
47553exports.Jbig2Image = Jbig2Image;
47554
47555/***/ }),
47556/* 25 */
47557/***/ ((__unused_webpack_module, exports) => {
47558
47559
47560
47561Object.defineProperty(exports, "__esModule", ({
47562  value: true
47563}));
47564exports.ArithmeticDecoder = void 0;
47565const QeTable = [{
47566  qe: 0x5601,
47567  nmps: 1,
47568  nlps: 1,
47569  switchFlag: 1
47570}, {
47571  qe: 0x3401,
47572  nmps: 2,
47573  nlps: 6,
47574  switchFlag: 0
47575}, {
47576  qe: 0x1801,
47577  nmps: 3,
47578  nlps: 9,
47579  switchFlag: 0
47580}, {
47581  qe: 0x0ac1,
47582  nmps: 4,
47583  nlps: 12,
47584  switchFlag: 0
47585}, {
47586  qe: 0x0521,
47587  nmps: 5,
47588  nlps: 29,
47589  switchFlag: 0
47590}, {
47591  qe: 0x0221,
47592  nmps: 38,
47593  nlps: 33,
47594  switchFlag: 0
47595}, {
47596  qe: 0x5601,
47597  nmps: 7,
47598  nlps: 6,
47599  switchFlag: 1
47600}, {
47601  qe: 0x5401,
47602  nmps: 8,
47603  nlps: 14,
47604  switchFlag: 0
47605}, {
47606  qe: 0x4801,
47607  nmps: 9,
47608  nlps: 14,
47609  switchFlag: 0
47610}, {
47611  qe: 0x3801,
47612  nmps: 10,
47613  nlps: 14,
47614  switchFlag: 0
47615}, {
47616  qe: 0x3001,
47617  nmps: 11,
47618  nlps: 17,
47619  switchFlag: 0
47620}, {
47621  qe: 0x2401,
47622  nmps: 12,
47623  nlps: 18,
47624  switchFlag: 0
47625}, {
47626  qe: 0x1c01,
47627  nmps: 13,
47628  nlps: 20,
47629  switchFlag: 0
47630}, {
47631  qe: 0x1601,
47632  nmps: 29,
47633  nlps: 21,
47634  switchFlag: 0
47635}, {
47636  qe: 0x5601,
47637  nmps: 15,
47638  nlps: 14,
47639  switchFlag: 1
47640}, {
47641  qe: 0x5401,
47642  nmps: 16,
47643  nlps: 14,
47644  switchFlag: 0
47645}, {
47646  qe: 0x5101,
47647  nmps: 17,
47648  nlps: 15,
47649  switchFlag: 0
47650}, {
47651  qe: 0x4801,
47652  nmps: 18,
47653  nlps: 16,
47654  switchFlag: 0
47655}, {
47656  qe: 0x3801,
47657  nmps: 19,
47658  nlps: 17,
47659  switchFlag: 0
47660}, {
47661  qe: 0x3401,
47662  nmps: 20,
47663  nlps: 18,
47664  switchFlag: 0
47665}, {
47666  qe: 0x3001,
47667  nmps: 21,
47668  nlps: 19,
47669  switchFlag: 0
47670}, {
47671  qe: 0x2801,
47672  nmps: 22,
47673  nlps: 19,
47674  switchFlag: 0
47675}, {
47676  qe: 0x2401,
47677  nmps: 23,
47678  nlps: 20,
47679  switchFlag: 0
47680}, {
47681  qe: 0x2201,
47682  nmps: 24,
47683  nlps: 21,
47684  switchFlag: 0
47685}, {
47686  qe: 0x1c01,
47687  nmps: 25,
47688  nlps: 22,
47689  switchFlag: 0
47690}, {
47691  qe: 0x1801,
47692  nmps: 26,
47693  nlps: 23,
47694  switchFlag: 0
47695}, {
47696  qe: 0x1601,
47697  nmps: 27,
47698  nlps: 24,
47699  switchFlag: 0
47700}, {
47701  qe: 0x1401,
47702  nmps: 28,
47703  nlps: 25,
47704  switchFlag: 0
47705}, {
47706  qe: 0x1201,
47707  nmps: 29,
47708  nlps: 26,
47709  switchFlag: 0
47710}, {
47711  qe: 0x1101,
47712  nmps: 30,
47713  nlps: 27,
47714  switchFlag: 0
47715}, {
47716  qe: 0x0ac1,
47717  nmps: 31,
47718  nlps: 28,
47719  switchFlag: 0
47720}, {
47721  qe: 0x09c1,
47722  nmps: 32,
47723  nlps: 29,
47724  switchFlag: 0
47725}, {
47726  qe: 0x08a1,
47727  nmps: 33,
47728  nlps: 30,
47729  switchFlag: 0
47730}, {
47731  qe: 0x0521,
47732  nmps: 34,
47733  nlps: 31,
47734  switchFlag: 0
47735}, {
47736  qe: 0x0441,
47737  nmps: 35,
47738  nlps: 32,
47739  switchFlag: 0
47740}, {
47741  qe: 0x02a1,
47742  nmps: 36,
47743  nlps: 33,
47744  switchFlag: 0
47745}, {
47746  qe: 0x0221,
47747  nmps: 37,
47748  nlps: 34,
47749  switchFlag: 0
47750}, {
47751  qe: 0x0141,
47752  nmps: 38,
47753  nlps: 35,
47754  switchFlag: 0
47755}, {
47756  qe: 0x0111,
47757  nmps: 39,
47758  nlps: 36,
47759  switchFlag: 0
47760}, {
47761  qe: 0x0085,
47762  nmps: 40,
47763  nlps: 37,
47764  switchFlag: 0
47765}, {
47766  qe: 0x0049,
47767  nmps: 41,
47768  nlps: 38,
47769  switchFlag: 0
47770}, {
47771  qe: 0x0025,
47772  nmps: 42,
47773  nlps: 39,
47774  switchFlag: 0
47775}, {
47776  qe: 0x0015,
47777  nmps: 43,
47778  nlps: 40,
47779  switchFlag: 0
47780}, {
47781  qe: 0x0009,
47782  nmps: 44,
47783  nlps: 41,
47784  switchFlag: 0
47785}, {
47786  qe: 0x0005,
47787  nmps: 45,
47788  nlps: 42,
47789  switchFlag: 0
47790}, {
47791  qe: 0x0001,
47792  nmps: 45,
47793  nlps: 43,
47794  switchFlag: 0
47795}, {
47796  qe: 0x5601,
47797  nmps: 46,
47798  nlps: 46,
47799  switchFlag: 0
47800}];
47801class ArithmeticDecoder {
47802  constructor(data, start, end) {
47803    this.data = data;
47804    this.bp = start;
47805    this.dataEnd = end;
47806    this.chigh = data[start];
47807    this.clow = 0;
47808    this.byteIn();
47809    this.chigh = this.chigh << 7 & 0xffff | this.clow >> 9 & 0x7f;
47810    this.clow = this.clow << 7 & 0xffff;
47811    this.ct -= 7;
47812    this.a = 0x8000;
47813  }
47814  byteIn() {
47815    const data = this.data;
47816    let bp = this.bp;
47817    if (data[bp] === 0xff) {
47818      if (data[bp + 1] > 0x8f) {
47819        this.clow += 0xff00;
47820        this.ct = 8;
47821      } else {
47822        bp++;
47823        this.clow += data[bp] << 9;
47824        this.ct = 7;
47825        this.bp = bp;
47826      }
47827    } else {
47828      bp++;
47829      this.clow += bp < this.dataEnd ? data[bp] << 8 : 0xff00;
47830      this.ct = 8;
47831      this.bp = bp;
47832    }
47833    if (this.clow > 0xffff) {
47834      this.chigh += this.clow >> 16;
47835      this.clow &= 0xffff;
47836    }
47837  }
47838  readBit(contexts, pos) {
47839    let cx_index = contexts[pos] >> 1,
47840      cx_mps = contexts[pos] & 1;
47841    const qeTableIcx = QeTable[cx_index];
47842    const qeIcx = qeTableIcx.qe;
47843    let d;
47844    let a = this.a - qeIcx;
47845    if (this.chigh < qeIcx) {
47846      if (a < qeIcx) {
47847        a = qeIcx;
47848        d = cx_mps;
47849        cx_index = qeTableIcx.nmps;
47850      } else {
47851        a = qeIcx;
47852        d = 1 ^ cx_mps;
47853        if (qeTableIcx.switchFlag === 1) {
47854          cx_mps = d;
47855        }
47856        cx_index = qeTableIcx.nlps;
47857      }
47858    } else {
47859      this.chigh -= qeIcx;
47860      if ((a & 0x8000) !== 0) {
47861        this.a = a;
47862        return cx_mps;
47863      }
47864      if (a < qeIcx) {
47865        d = 1 ^ cx_mps;
47866        if (qeTableIcx.switchFlag === 1) {
47867          cx_mps = d;
47868        }
47869        cx_index = qeTableIcx.nlps;
47870      } else {
47871        d = cx_mps;
47872        cx_index = qeTableIcx.nmps;
47873      }
47874    }
47875    do {
47876      if (this.ct === 0) {
47877        this.byteIn();
47878      }
47879      a <<= 1;
47880      this.chigh = this.chigh << 1 & 0xffff | this.clow >> 15 & 1;
47881      this.clow = this.clow << 1 & 0xffff;
47882      this.ct--;
47883    } while ((a & 0x8000) === 0);
47884    this.a = a;
47885    contexts[pos] = cx_index << 1 | cx_mps;
47886    return d;
47887  }
47888}
47889exports.ArithmeticDecoder = ArithmeticDecoder;
47890
47891/***/ }),
47892/* 26 */
47893/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
47894
47895
47896
47897Object.defineProperty(exports, "__esModule", ({
47898  value: true
47899}));
47900exports.JpegStream = void 0;
47901var _decode_stream = __w_pdfjs_require__(18);
47902var _primitives = __w_pdfjs_require__(4);
47903var _jpg = __w_pdfjs_require__(27);
47904var _util = __w_pdfjs_require__(2);
47905class JpegStream extends _decode_stream.DecodeStream {
47906  constructor(stream, maybeLength, params) {
47907    let ch;
47908    while ((ch = stream.getByte()) !== -1) {
47909      if (ch === 0xff) {
47910        stream.skip(-1);
47911        break;
47912      }
47913    }
47914    super(maybeLength);
47915    this.stream = stream;
47916    this.dict = stream.dict;
47917    this.maybeLength = maybeLength;
47918    this.params = params;
47919  }
47920  get bytes() {
47921    return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
47922  }
47923  ensureBuffer(requested) {}
47924  readBlock() {
47925    if (this.eof) {
47926      return;
47927    }
47928    const jpegOptions = {
47929      decodeTransform: undefined,
47930      colorTransform: undefined
47931    };
47932    const decodeArr = this.dict.getArray("D", "Decode");
47933    if ((this.forceRGBA || this.forceRGB) && Array.isArray(decodeArr)) {
47934      const bitsPerComponent = this.dict.get("BPC", "BitsPerComponent") || 8;
47935      const decodeArrLength = decodeArr.length;
47936      const transform = new Int32Array(decodeArrLength);
47937      let transformNeeded = false;
47938      const maxValue = (1 << bitsPerComponent) - 1;
47939      for (let i = 0; i < decodeArrLength; i += 2) {
47940        transform[i] = (decodeArr[i + 1] - decodeArr[i]) * 256 | 0;
47941        transform[i + 1] = decodeArr[i] * maxValue | 0;
47942        if (transform[i] !== 256 || transform[i + 1] !== 0) {
47943          transformNeeded = true;
47944        }
47945      }
47946      if (transformNeeded) {
47947        jpegOptions.decodeTransform = transform;
47948      }
47949    }
47950    if (this.params instanceof _primitives.Dict) {
47951      const colorTransform = this.params.get("ColorTransform");
47952      if (Number.isInteger(colorTransform)) {
47953        jpegOptions.colorTransform = colorTransform;
47954      }
47955    }
47956    const jpegImage = new _jpg.JpegImage(jpegOptions);
47957    jpegImage.parse(this.bytes);
47958    const data = jpegImage.getData({
47959      width: this.drawWidth,
47960      height: this.drawHeight,
47961      forceRGBA: this.forceRGBA,
47962      forceRGB: this.forceRGB,
47963      isSourcePDF: true
47964    });
47965    this.buffer = data;
47966    this.bufferLength = data.length;
47967    this.eof = true;
47968  }
47969}
47970exports.JpegStream = JpegStream;
47971
47972/***/ }),
47973/* 27 */
47974/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
47975
47976
47977
47978Object.defineProperty(exports, "__esModule", ({
47979  value: true
47980}));
47981exports.JpegImage = void 0;
47982var _util = __w_pdfjs_require__(2);
47983var _image_utils = __w_pdfjs_require__(28);
47984var _core_utils = __w_pdfjs_require__(3);
47985class JpegError extends _util.BaseException {
47986  constructor(msg) {
47987    super(`JPEG error: ${msg}`, "JpegError");
47988  }
47989}
47990class DNLMarkerError extends _util.BaseException {
47991  constructor(message, scanLines) {
47992    super(message, "DNLMarkerError");
47993    this.scanLines = scanLines;
47994  }
47995}
47996class EOIMarkerError extends _util.BaseException {
47997  constructor(msg) {
47998    super(msg, "EOIMarkerError");
47999  }
48000}
48001const 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]);
48002const dctCos1 = 4017;
48003const dctSin1 = 799;
48004const dctCos3 = 3406;
48005const dctSin3 = 2276;
48006const dctCos6 = 1567;
48007const dctSin6 = 3784;
48008const dctSqrt2 = 5793;
48009const dctSqrt1d2 = 2896;
48010function buildHuffmanTable(codeLengths, values) {
48011  let k = 0,
48012    i,
48013    j,
48014    length = 16;
48015  while (length > 0 && !codeLengths[length - 1]) {
48016    length--;
48017  }
48018  const code = [{
48019    children: [],
48020    index: 0
48021  }];
48022  let p = code[0],
48023    q;
48024  for (i = 0; i < length; i++) {
48025    for (j = 0; j < codeLengths[i]; j++) {
48026      p = code.pop();
48027      p.children[p.index] = values[k];
48028      while (p.index > 0) {
48029        p = code.pop();
48030      }
48031      p.index++;
48032      code.push(p);
48033      while (code.length <= i) {
48034        code.push(q = {
48035          children: [],
48036          index: 0
48037        });
48038        p.children[p.index] = q.children;
48039        p = q;
48040      }
48041      k++;
48042    }
48043    if (i + 1 < length) {
48044      code.push(q = {
48045        children: [],
48046        index: 0
48047      });
48048      p.children[p.index] = q.children;
48049      p = q;
48050    }
48051  }
48052  return code[0].children;
48053}
48054function getBlockBufferOffset(component, row, col) {
48055  return 64 * ((component.blocksPerLine + 1) * row + col);
48056}
48057function decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successivePrev, successive, parseDNLMarker = false) {
48058  const mcusPerLine = frame.mcusPerLine;
vendor: 7,835 bytes, lines 48059-48314
48059  const progressive = frame.progressive;
48060  const startOffset = offset;
48061  let bitsData = 0,
48062    bitsCount = 0;
48063  function readBit() {
48064    if (bitsCount > 0) {
48065      bitsCount--;
48066      return bitsData >> bitsCount & 1;
48067    }
48068    bitsData = data[offset++];
48069    if (bitsData === 0xff) {
48070      const nextByte = data[offset++];
48071      if (nextByte) {
48072        if (nextByte === 0xdc && parseDNLMarker) {
48073          offset += 2;
48074          const scanLines = (0, _core_utils.readUint16)(data, offset);
48075          offset += 2;
48076          if (scanLines > 0 && scanLines !== frame.scanLines) {
48077            throw new DNLMarkerError("Found DNL marker (0xFFDC) while parsing scan data", scanLines);
48078          }
48079        } else if (nextByte === 0xd9) {
48080          if (parseDNLMarker) {
48081            const maybeScanLines = blockRow * (frame.precision === 8 ? 8 : 0);
48082            if (maybeScanLines > 0 && Math.round(frame.scanLines / maybeScanLines) >= 5) {
48083              throw new DNLMarkerError("Found EOI marker (0xFFD9) while parsing scan data, " + "possibly caused by incorrect `scanLines` parameter", maybeScanLines);
48084            }
48085          }
48086          throw new EOIMarkerError("Found EOI marker (0xFFD9) while parsing scan data");
48087        }
48088        throw new JpegError(`unexpected marker ${(bitsData << 8 | nextByte).toString(16)}`);
48089      }
48090    }
48091    bitsCount = 7;
48092    return bitsData >>> 7;
48093  }
48094  function decodeHuffman(tree) {
48095    let node = tree;
48096    while (true) {
48097      node = node[readBit()];
48098      switch (typeof node) {
48099        case "number":
48100          return node;
48101        case "object":
48102          continue;
48103      }
48104      throw new JpegError("invalid huffman sequence");
48105    }
48106  }
48107  function receive(length) {
48108    let n = 0;
48109    while (length > 0) {
48110      n = n << 1 | readBit();
48111      length--;
48112    }
48113    return n;
48114  }
48115  function receiveAndExtend(length) {
48116    if (length === 1) {
48117      return readBit() === 1 ? 1 : -1;
48118    }
48119    const n = receive(length);
48120    if (n >= 1 << length - 1) {
48121      return n;
48122    }
48123    return n + (-1 << length) + 1;
48124  }
48125  function decodeBaseline(component, blockOffset) {
48126    const t = decodeHuffman(component.huffmanTableDC);
48127    const diff = t === 0 ? 0 : receiveAndExtend(t);
48128    component.blockData[blockOffset] = component.pred += diff;
48129    let k = 1;
48130    while (k < 64) {
48131      const rs = decodeHuffman(component.huffmanTableAC);
48132      const s = rs & 15,
48133        r = rs >> 4;
48134      if (s === 0) {
48135        if (r < 15) {
48136          break;
48137        }
48138        k += 16;
48139        continue;
48140      }
48141      k += r;
48142      const z = dctZigZag[k];
48143      component.blockData[blockOffset + z] = receiveAndExtend(s);
48144      k++;
48145    }
48146  }
48147  function decodeDCFirst(component, blockOffset) {
48148    const t = decodeHuffman(component.huffmanTableDC);
48149    const diff = t === 0 ? 0 : receiveAndExtend(t) << successive;
48150    component.blockData[blockOffset] = component.pred += diff;
48151  }
48152  function decodeDCSuccessive(component, blockOffset) {
48153    component.blockData[blockOffset] |= readBit() << successive;
48154  }
48155  let eobrun = 0;
48156  function decodeACFirst(component, blockOffset) {
48157    if (eobrun > 0) {
48158      eobrun--;
48159      return;
48160    }
48161    let k = spectralStart;
48162    const e = spectralEnd;
48163    while (k <= e) {
48164      const rs = decodeHuffman(component.huffmanTableAC);
48165      const s = rs & 15,
48166        r = rs >> 4;
48167      if (s === 0) {
48168        if (r < 15) {
48169          eobrun = receive(r) + (1 << r) - 1;
48170          break;
48171        }
48172        k += 16;
48173        continue;
48174      }
48175      k += r;
48176      const z = dctZigZag[k];
48177      component.blockData[blockOffset + z] = receiveAndExtend(s) * (1 << successive);
48178      k++;
48179    }
48180  }
48181  let successiveACState = 0,
48182    successiveACNextValue;
48183  function decodeACSuccessive(component, blockOffset) {
48184    let k = spectralStart;
48185    const e = spectralEnd;
48186    let r = 0;
48187    let s;
48188    let rs;
48189    while (k <= e) {
48190      const offsetZ = blockOffset + dctZigZag[k];
48191      const sign = component.blockData[offsetZ] < 0 ? -1 : 1;
48192      switch (successiveACState) {
48193        case 0:
48194          rs = decodeHuffman(component.huffmanTableAC);
48195          s = rs & 15;
48196          r = rs >> 4;
48197          if (s === 0) {
48198            if (r < 15) {
48199              eobrun = receive(r) + (1 << r);
48200              successiveACState = 4;
48201            } else {
48202              r = 16;
48203              successiveACState = 1;
48204            }
48205          } else {
48206            if (s !== 1) {
48207              throw new JpegError("invalid ACn encoding");
48208            }
48209            successiveACNextValue = receiveAndExtend(s);
48210            successiveACState = r ? 2 : 3;
48211          }
48212          continue;
48213        case 1:
48214        case 2:
48215          if (component.blockData[offsetZ]) {
48216            component.blockData[offsetZ] += sign * (readBit() << successive);
48217          } else {
48218            r--;
48219            if (r === 0) {
48220              successiveACState = successiveACState === 2 ? 3 : 0;
48221            }
48222          }
48223          break;
48224        case 3:
48225          if (component.blockData[offsetZ]) {
48226            component.blockData[offsetZ] += sign * (readBit() << successive);
48227          } else {
48228            component.blockData[offsetZ] = successiveACNextValue << successive;
48229            successiveACState = 0;
48230          }
48231          break;
48232        case 4:
48233          if (component.blockData[offsetZ]) {
48234            component.blockData[offsetZ] += sign * (readBit() << successive);
48235          }
48236          break;
48237      }
48238      k++;
48239    }
48240    if (successiveACState === 4) {
48241      eobrun--;
48242      if (eobrun === 0) {
48243        successiveACState = 0;
48244      }
48245    }
48246  }
48247  let blockRow = 0;
48248  function decodeMcu(component, decode, mcu, row, col) {
48249    const mcuRow = mcu / mcusPerLine | 0;
48250    const mcuCol = mcu % mcusPerLine;
48251    blockRow = mcuRow * component.v + row;
48252    const blockCol = mcuCol * component.h + col;
48253    const blockOffset = getBlockBufferOffset(component, blockRow, blockCol);
48254    decode(component, blockOffset);
48255  }
48256  function decodeBlock(component, decode, mcu) {
48257    blockRow = mcu / component.blocksPerLine | 0;
48258    const blockCol = mcu % component.blocksPerLine;
48259    const blockOffset = getBlockBufferOffset(component, blockRow, blockCol);
48260    decode(component, blockOffset);
48261  }
48262  const componentsLength = components.length;
48263  let component, i, j, k, n;
48264  let decodeFn;
48265  if (progressive) {
48266    if (spectralStart === 0) {
48267      decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive;
48268    } else {
48269      decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive;
48270    }
48271  } else {
48272    decodeFn = decodeBaseline;
48273  }
48274  let mcu = 0,
48275    fileMarker;
48276  const mcuExpected = componentsLength === 1 ? components[0].blocksPerLine * components[0].blocksPerColumn : mcusPerLine * frame.mcusPerColumn;
48277  let h, v;
48278  while (mcu <= mcuExpected) {
48279    const mcuToRead = resetInterval ? Math.min(mcuExpected - mcu, resetInterval) : mcuExpected;
48280    if (mcuToRead > 0) {
48281      for (i = 0; i < componentsLength; i++) {
48282        components[i].pred = 0;
48283      }
48284      eobrun = 0;
48285      if (componentsLength === 1) {
48286        component = components[0];
48287        for (n = 0; n < mcuToRead; n++) {
48288          decodeBlock(component, decodeFn, mcu);
48289          mcu++;
48290        }
48291      } else {
48292        for (n = 0; n < mcuToRead; n++) {
48293          for (i = 0; i < componentsLength; i++) {
48294            component = components[i];
48295            h = component.h;
48296            v = component.v;
48297            for (j = 0; j < v; j++) {
48298              for (k = 0; k < h; k++) {
48299                decodeMcu(component, decodeFn, mcu, j, k);
48300              }
48301            }
48302          }
48303          mcu++;
48304        }
48305      }
48306    }
48307    bitsCount = 0;
48308    fileMarker = findNextFileMarker(data, offset);
48309    if (!fileMarker) {
48310      break;
48311    }
48312    if (fileMarker.invalid) {
48313      const partialMsg = mcuToRead > 0 ? "unexpected" : "excessive";
48314      (0, _util.warn)
vendor: 6,321 bytes, lines 48314-48546
48314(`decodeScan - ${partialMsg} MCU data, current marker is: ${fileMarker.invalid}`);
48315      offset = fileMarker.offset;
48316    }
48317    if (fileMarker.marker >= 0xffd0 && fileMarker.marker <= 0xffd7) {
48318      offset += 2;
48319    } else {
48320      break;
48321    }
48322  }
48323  return offset - startOffset;
48324}
48325function quantizeAndInverse(component, blockBufferOffset, p) {
48326  const qt = component.quantizationTable,
48327    blockData = component.blockData;
48328  let v0, v1, v2, v3, v4, v5, v6, v7;
48329  let p0, p1, p2, p3, p4, p5, p6, p7;
48330  let t;
48331  if (!qt) {
48332    throw new JpegError("missing required Quantization Table.");
48333  }
48334  for (let row = 0; row < 64; row += 8) {
48335    p0 = blockData[blockBufferOffset + row];
48336    p1 = blockData[blockBufferOffset + row + 1];
48337    p2 = blockData[blockBufferOffset + row + 2];
48338    p3 = blockData[blockBufferOffset + row + 3];
48339    p4 = blockData[blockBufferOffset + row + 4];
48340    p5 = blockData[blockBufferOffset + row + 5];
48341    p6 = blockData[blockBufferOffset + row + 6];
48342    p7 = blockData[blockBufferOffset + row + 7];
48343    p0 *= qt[row];
48344    if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
48345      t = dctSqrt2 * p0 + 512 >> 10;
48346      p[row] = t;
48347      p[row + 1] = t;
48348      p[row + 2] = t;
48349      p[row + 3] = t;
48350      p[row + 4] = t;
48351      p[row + 5] = t;
48352      p[row + 6] = t;
48353      p[row + 7] = t;
48354      continue;
48355    }
48356    p1 *= qt[row + 1];
48357    p2 *= qt[row + 2];
48358    p3 *= qt[row + 3];
48359    p4 *= qt[row + 4];
48360    p5 *= qt[row + 5];
48361    p6 *= qt[row + 6];
48362    p7 *= qt[row + 7];
48363    v0 = dctSqrt2 * p0 + 128 >> 8;
48364    v1 = dctSqrt2 * p4 + 128 >> 8;
48365    v2 = p2;
48366    v3 = p6;
48367    v4 = dctSqrt1d2 * (p1 - p7) + 128 >> 8;
48368    v7 = dctSqrt1d2 * (p1 + p7) + 128 >> 8;
48369    v5 = p3 << 4;
48370    v6 = p5 << 4;
48371    v0 = v0 + v1 + 1 >> 1;
48372    v1 = v0 - v1;
48373    t = v2 * dctSin6 + v3 * dctCos6 + 128 >> 8;
48374    v2 = v2 * dctCos6 - v3 * dctSin6 + 128 >> 8;
48375    v3 = t;
48376    v4 = v4 + v6 + 1 >> 1;
48377    v6 = v4 - v6;
48378    v7 = v7 + v5 + 1 >> 1;
48379    v5 = v7 - v5;
48380    v0 = v0 + v3 + 1 >> 1;
48381    v3 = v0 - v3;
48382    v1 = v1 + v2 + 1 >> 1;
48383    v2 = v1 - v2;
48384    t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
48385    v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
48386    v7 = t;
48387    t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
48388    v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
48389    v6 = t;
48390    p[row] = v0 + v7;
48391    p[row + 7] = v0 - v7;
48392    p[row + 1] = v1 + v6;
48393    p[row + 6] = v1 - v6;
48394    p[row + 2] = v2 + v5;
48395    p[row + 5] = v2 - v5;
48396    p[row + 3] = v3 + v4;
48397    p[row + 4] = v3 - v4;
48398  }
48399  for (let col = 0; col < 8; ++col) {
48400    p0 = p[col];
48401    p1 = p[col + 8];
48402    p2 = p[col + 16];
48403    p3 = p[col + 24];
48404    p4 = p[col + 32];
48405    p5 = p[col + 40];
48406    p6 = p[col + 48];
48407    p7 = p[col + 56];
48408    if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
48409      t = dctSqrt2 * p0 + 8192 >> 14;
48410      if (t < -2040) {
48411        t = 0;
48412      } else if (t >= 2024) {
48413        t = 255;
48414      } else {
48415        t = t + 2056 >> 4;
48416      }
48417      blockData[blockBufferOffset + col] = t;
48418      blockData[blockBufferOffset + col + 8] = t;
48419      blockData[blockBufferOffset + col + 16] = t;
48420      blockData[blockBufferOffset + col + 24] = t;
48421      blockData[blockBufferOffset + col + 32] = t;
48422      blockData[blockBufferOffset + col + 40] = t;
48423      blockData[blockBufferOffset + col + 48] = t;
48424      blockData[blockBufferOffset + col + 56] = t;
48425      continue;
48426    }
48427    v0 = dctSqrt2 * p0 + 2048 >> 12;
48428    v1 = dctSqrt2 * p4 + 2048 >> 12;
48429    v2 = p2;
48430    v3 = p6;
48431    v4 = dctSqrt1d2 * (p1 - p7) + 2048 >> 12;
48432    v7 = dctSqrt1d2 * (p1 + p7) + 2048 >> 12;
48433    v5 = p3;
48434    v6 = p5;
48435    v0 = (v0 + v1 + 1 >> 1) + 4112;
48436    v1 = v0 - v1;
48437    t = v2 * dctSin6 + v3 * dctCos6 + 2048 >> 12;
48438    v2 = v2 * dctCos6 - v3 * dctSin6 + 2048 >> 12;
48439    v3 = t;
48440    v4 = v4 + v6 + 1 >> 1;
48441    v6 = v4 - v6;
48442    v7 = v7 + v5 + 1 >> 1;
48443    v5 = v7 - v5;
48444    v0 = v0 + v3 + 1 >> 1;
48445    v3 = v0 - v3;
48446    v1 = v1 + v2 + 1 >> 1;
48447    v2 = v1 - v2;
48448    t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
48449    v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
48450    v7 = t;
48451    t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
48452    v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
48453    v6 = t;
48454    p0 = v0 + v7;
48455    p7 = v0 - v7;
48456    p1 = v1 + v6;
48457    p6 = v1 - v6;
48458    p2 = v2 + v5;
48459    p5 = v2 - v5;
48460    p3 = v3 + v4;
48461    p4 = v3 - v4;
48462    if (p0 < 16) {
48463      p0 = 0;
48464    } else if (p0 >= 4080) {
48465      p0 = 255;
48466    } else {
48467      p0 >>= 4;
48468    }
48469    if (p1 < 16) {
48470      p1 = 0;
48471    } else if (p1 >= 4080) {
48472      p1 = 255;
48473    } else {
48474      p1 >>= 4;
48475    }
48476    if (p2 < 16) {
48477      p2 = 0;
48478    } else if (p2 >= 4080) {
48479      p2 = 255;
48480    } else {
48481      p2 >>= 4;
48482    }
48483    if (p3 < 16) {
48484      p3 = 0;
48485    } else if (p3 >= 4080) {
48486      p3 = 255;
48487    } else {
48488      p3 >>= 4;
48489    }
48490    if (p4 < 16) {
48491      p4 = 0;
48492    } else if (p4 >= 4080) {
48493      p4 = 255;
48494    } else {
48495      p4 >>= 4;
48496    }
48497    if (p5 < 16) {
48498      p5 = 0;
48499    } else if (p5 >= 4080) {
48500      p5 = 255;
48501    } else {
48502      p5 >>= 4;
48503    }
48504    if (p6 < 16) {
48505      p6 = 0;
48506    } else if (p6 >= 4080) {
48507      p6 = 255;
48508    } else {
48509      p6 >>= 4;
48510    }
48511    if (p7 < 16) {
48512      p7 = 0;
48513    } else if (p7 >= 4080) {
48514      p7 = 255;
48515    } else {
48516      p7 >>= 4;
48517    }
48518    blockData[blockBufferOffset + col] = p0;
48519    blockData[blockBufferOffset + col + 8] = p1;
48520    blockData[blockBufferOffset + col + 16] = p2;
48521    blockData[blockBufferOffset + col + 24] = p3;
48522    blockData[blockBufferOffset + col + 32] = p4;
48523    blockData[blockBufferOffset + col + 40] = p5;
48524    blockData[blockBufferOffset + col + 48] = p6;
48525    blockData[blockBufferOffset + col + 56] = p7;
48526  }
48527}
48528function buildComponentData(frame, component) {
48529  const blocksPerLine = component.blocksPerLine;
48530  const blocksPerColumn = component.blocksPerColumn;
48531  const computationBuffer = new Int16Array(64);
48532  for (let blockRow = 0; blockRow < blocksPerColumn; blockRow++) {
48533    for (let blockCol = 0; blockCol < blocksPerLine; blockCol++) {
48534      const offset = getBlockBufferOffset(component, blockRow, blockCol);
48535      quantizeAndInverse(component, offset, computationBuffer);
48536    }
48537  }
48538  return component.blockData;
48539}
48540function findNextFileMarker(data, currentPos, startPos = currentPos) {
48541  const maxPos = data.length - 1;
48542  let newPos = startPos < currentPos ? startPos : currentPos;
48543  if (currentPos >= maxPos) {
48544    return null;
48545  }
48546  const currentMarker = 
vendor: 1,034 bytes, lines 48546-48583
48546(0, _core_utils.readUint16)(data, currentPos);
48547  if (currentMarker >= 0xffc0 && currentMarker <= 0xfffe) {
48548    return {
48549      invalid: null,
48550      marker: currentMarker,
48551      offset: currentPos
48552    };
48553  }
48554  let newMarker = (0, _core_utils.readUint16)(data, newPos);
48555  while (!(newMarker >= 0xffc0 && newMarker <= 0xfffe)) {
48556    if (++newPos >= maxPos) {
48557      return null;
48558    }
48559    newMarker = (0, _core_utils.readUint16)(data, newPos);
48560  }
48561  return {
48562    invalid: currentMarker.toString(16),
48563    marker: newMarker,
48564    offset: newPos
48565  };
48566}
48567class JpegImage {
48568  constructor({
48569    decodeTransform = null,
48570    colorTransform = -1
48571  } = {}) {
48572    this._decodeTransform = decodeTransform;
48573    this._colorTransform = colorTransform;
48574  }
48575  parse(data, {
48576    dnlScanLines = null
48577  } = {}) {
48578    function readDataBlock() {
48579      const length = (0, _core_utils.readUint16)(data, offset);
48580      offset += 2;
48581      let endOffset = offset + length - 2;
48582      const fileMarker = findNextFileMarker(data, endOffset, offset);
48583      if (fileMarker?
vendor: 8,681 bytes, lines 48583-48807
48583.invalid) {
48584        (0, _util.warn)("readDataBlock - incorrect length, current marker is: " + fileMarker.invalid);
48585        endOffset = fileMarker.offset;
48586      }
48587      const array = data.subarray(offset, endOffset);
48588      offset += array.length;
48589      return array;
48590    }
48591    function prepareComponents(frame) {
48592      const mcusPerLine = Math.ceil(frame.samplesPerLine / 8 / frame.maxH);
48593      const mcusPerColumn = Math.ceil(frame.scanLines / 8 / frame.maxV);
48594      for (const component of frame.components) {
48595        const blocksPerLine = Math.ceil(Math.ceil(frame.samplesPerLine / 8) * component.h / frame.maxH);
48596        const blocksPerColumn = Math.ceil(Math.ceil(frame.scanLines / 8) * component.v / frame.maxV);
48597        const blocksPerLineForMcu = mcusPerLine * component.h;
48598        const blocksPerColumnForMcu = mcusPerColumn * component.v;
48599        const blocksBufferSize = 64 * blocksPerColumnForMcu * (blocksPerLineForMcu + 1);
48600        component.blockData = new Int16Array(blocksBufferSize);
48601        component.blocksPerLine = blocksPerLine;
48602        component.blocksPerColumn = blocksPerColumn;
48603      }
48604      frame.mcusPerLine = mcusPerLine;
48605      frame.mcusPerColumn = mcusPerColumn;
48606    }
48607    let offset = 0;
48608    let jfif = null;
48609    let adobe = null;
48610    let frame, resetInterval;
48611    let numSOSMarkers = 0;
48612    const quantizationTables = [];
48613    const huffmanTablesAC = [],
48614      huffmanTablesDC = [];
48615    let fileMarker = (0, _core_utils.readUint16)(data, offset);
48616    offset += 2;
48617    if (fileMarker !== 0xffd8) {
48618      throw new JpegError("SOI not found");
48619    }
48620    fileMarker = (0, _core_utils.readUint16)(data, offset);
48621    offset += 2;
48622    markerLoop: while (fileMarker !== 0xffd9) {
48623      let i, j, l;
48624      switch (fileMarker) {
48625        case 0xffe0:
48626        case 0xffe1:
48627        case 0xffe2:
48628        case 0xffe3:
48629        case 0xffe4:
48630        case 0xffe5:
48631        case 0xffe6:
48632        case 0xffe7:
48633        case 0xffe8:
48634        case 0xffe9:
48635        case 0xffea:
48636        case 0xffeb:
48637        case 0xffec:
48638        case 0xffed:
48639        case 0xffee:
48640        case 0xffef:
48641        case 0xfffe:
48642          const appData = readDataBlock();
48643          if (fileMarker === 0xffe0) {
48644            if (appData[0] === 0x4a && appData[1] === 0x46 && appData[2] === 0x49 && appData[3] === 0x46 && appData[4] === 0) {
48645              jfif = {
48646                version: {
48647                  major: appData[5],
48648                  minor: appData[6]
48649                },
48650                densityUnits: appData[7],
48651                xDensity: appData[8] << 8 | appData[9],
48652                yDensity: appData[10] << 8 | appData[11],
48653                thumbWidth: appData[12],
48654                thumbHeight: appData[13],
48655                thumbData: appData.subarray(14, 14 + 3 * appData[12] * appData[13])
48656              };
48657            }
48658          }
48659          if (fileMarker === 0xffee) {
48660            if (appData[0] === 0x41 && appData[1] === 0x64 && appData[2] === 0x6f && appData[3] === 0x62 && appData[4] === 0x65) {
48661              adobe = {
48662                version: appData[5] << 8 | appData[6],
48663                flags0: appData[7] << 8 | appData[8],
48664                flags1: appData[9] << 8 | appData[10],
48665                transformCode: appData[11]
48666              };
48667            }
48668          }
48669          break;
48670        case 0xffdb:
48671          const quantizationTablesLength = (0, _core_utils.readUint16)(data, offset);
48672          offset += 2;
48673          const quantizationTablesEnd = quantizationTablesLength + offset - 2;
48674          let z;
48675          while (offset < quantizationTablesEnd) {
48676            const quantizationTableSpec = data[offset++];
48677            const tableData = new Uint16Array(64);
48678            if (quantizationTableSpec >> 4 === 0) {
48679              for (j = 0; j < 64; j++) {
48680                z = dctZigZag[j];
48681                tableData[z] = data[offset++];
48682              }
48683            } else if (quantizationTableSpec >> 4 === 1) {
48684              for (j = 0; j < 64; j++) {
48685                z = dctZigZag[j];
48686                tableData[z] = (0, _core_utils.readUint16)(data, offset);
48687                offset += 2;
48688              }
48689            } else {
48690              throw new JpegError("DQT - invalid table spec");
48691            }
48692            quantizationTables[quantizationTableSpec & 15] = tableData;
48693          }
48694          break;
48695        case 0xffc0:
48696        case 0xffc1:
48697        case 0xffc2:
48698          if (frame) {
48699            throw new JpegError("Only single frame JPEGs supported");
48700          }
48701          offset += 2;
48702          frame = {};
48703          frame.extended = fileMarker === 0xffc1;
48704          frame.progressive = fileMarker === 0xffc2;
48705          frame.precision = data[offset++];
48706          const sofScanLines = (0, _core_utils.readUint16)(data, offset);
48707          offset += 2;
48708          frame.scanLines = dnlScanLines || sofScanLines;
48709          frame.samplesPerLine = (0, _core_utils.readUint16)(data, offset);
48710          offset += 2;
48711          frame.components = [];
48712          frame.componentIds = {};
48713          const componentsCount = data[offset++];
48714          let maxH = 0,
48715            maxV = 0;
48716          for (i = 0; i < componentsCount; i++) {
48717            const componentId = data[offset];
48718            const h = data[offset + 1] >> 4;
48719            const v = data[offset + 1] & 15;
48720            if (maxH < h) {
48721              maxH = h;
48722            }
48723            if (maxV < v) {
48724              maxV = v;
48725            }
48726            const qId = data[offset + 2];
48727            l = frame.components.push({
48728              h,
48729              v,
48730              quantizationId: qId,
48731              quantizationTable: null
48732            });
48733            frame.componentIds[componentId] = l - 1;
48734            offset += 3;
48735          }
48736          frame.maxH = maxH;
48737          frame.maxV = maxV;
48738          prepareComponents(frame);
48739          break;
48740        case 0xffc4:
48741          const huffmanLength = (0, _core_utils.readUint16)(data, offset);
48742          offset += 2;
48743          for (i = 2; i < huffmanLength;) {
48744            const huffmanTableSpec = data[offset++];
48745            const codeLengths = new Uint8Array(16);
48746            let codeLengthSum = 0;
48747            for (j = 0; j < 16; j++, offset++) {
48748              codeLengthSum += codeLengths[j] = data[offset];
48749            }
48750            const huffmanValues = new Uint8Array(codeLengthSum);
48751            for (j = 0; j < codeLengthSum; j++, offset++) {
48752              huffmanValues[j] = data[offset];
48753            }
48754            i += 17 + codeLengthSum;
48755            (huffmanTableSpec >> 4 === 0 ? huffmanTablesDC : huffmanTablesAC)[huffmanTableSpec & 15] = buildHuffmanTable(codeLengths, huffmanValues);
48756          }
48757          break;
48758        case 0xffdd:
48759          offset += 2;
48760          resetInterval = (0, _core_utils.readUint16)(data, offset);
48761          offset += 2;
48762          break;
48763        case 0xffda:
48764          const parseDNLMarker = ++numSOSMarkers === 1 && !dnlScanLines;
48765          offset += 2;
48766          const selectorsCount = data[offset++],
48767            components = [];
48768          for (i = 0; i < selectorsCount; i++) {
48769            const index = data[offset++];
48770            const componentIndex = frame.componentIds[index];
48771            const component = frame.components[componentIndex];
48772            component.index = index;
48773            const tableSpec = data[offset++];
48774            component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4];
48775            component.huffmanTableAC = huffmanTablesAC[tableSpec & 15];
48776            components.push(component);
48777          }
48778          const spectralStart = data[offset++],
48779            spectralEnd = data[offset++],
48780            successiveApproximation = data[offset++];
48781          try {
48782            const processed = decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successiveApproximation >> 4, successiveApproximation & 15, parseDNLMarker);
48783            offset += processed;
48784          } catch (ex) {
48785            if (ex instanceof DNLMarkerError) {
48786              (0, _util.warn)(`${ex.message} -- attempting to re-parse the JPEG image.`);
48787              return this.parse(data, {
48788                dnlScanLines: ex.scanLines
48789              });
48790            } else if (ex instanceof EOIMarkerError) {
48791              (0, _util.warn)(`${ex.message} -- ignoring the rest of the image data.`);
48792              break markerLoop;
48793            }
48794            throw ex;
48795          }
48796          break;
48797        case 0xffdc:
48798          offset += 4;
48799          break;
48800        case 0xffff:
48801          if (data[offset] !== 0xff) {
48802            offset--;
48803          }
48804          break;
48805        default:
48806          const nextFileMarker = findNextFileMarker(data, offset - 2, offset - 3);
48807          if (nextFileMarker
vendor: 5,135 bytes, lines 48807-48943
48807?.invalid) {
48808            (0, _util.warn)("JpegImage.parse - unexpected data, current marker is: " + nextFileMarker.invalid);
48809            offset = nextFileMarker.offset;
48810            break;
48811          }
48812          if (!nextFileMarker || offset >= data.length - 1) {
48813            (0, _util.warn)("JpegImage.parse - reached the end of the image data " + "without finding an EOI marker (0xFFD9).");
48814            break markerLoop;
48815          }
48816          throw new JpegError("JpegImage.parse - unknown marker: " + fileMarker.toString(16));
48817      }
48818      fileMarker = (0, _core_utils.readUint16)(data, offset);
48819      offset += 2;
48820    }
48821    this.width = frame.samplesPerLine;
48822    this.height = frame.scanLines;
48823    this.jfif = jfif;
48824    this.adobe = adobe;
48825    this.components = [];
48826    for (const component of frame.components) {
48827      const quantizationTable = quantizationTables[component.quantizationId];
48828      if (quantizationTable) {
48829        component.quantizationTable = quantizationTable;
48830      }
48831      this.components.push({
48832        index: component.index,
48833        output: buildComponentData(frame, component),
48834        scaleX: component.h / frame.maxH,
48835        scaleY: component.v / frame.maxV,
48836        blocksPerLine: component.blocksPerLine,
48837        blocksPerColumn: component.blocksPerColumn
48838      });
48839    }
48840    this.numComponents = this.components.length;
48841    return undefined;
48842  }
48843  _getLinearizedBlockData(width, height, isSourcePDF = false) {
48844    const scaleX = this.width / width,
48845      scaleY = this.height / height;
48846    let component, componentScaleX, componentScaleY, blocksPerScanline;
48847    let x, y, i, j, k;
48848    let index;
48849    let offset = 0;
48850    let output;
48851    const numComponents = this.components.length;
48852    const dataLength = width * height * numComponents;
48853    const data = new Uint8ClampedArray(dataLength);
48854    const xScaleBlockOffset = new Uint32Array(width);
48855    const mask3LSB = 0xfffffff8;
48856    let lastComponentScaleX;
48857    for (i = 0; i < numComponents; i++) {
48858      component = this.components[i];
48859      componentScaleX = component.scaleX * scaleX;
48860      componentScaleY = component.scaleY * scaleY;
48861      offset = i;
48862      output = component.output;
48863      blocksPerScanline = component.blocksPerLine + 1 << 3;
48864      if (componentScaleX !== lastComponentScaleX) {
48865        for (x = 0; x < width; x++) {
48866          j = 0 | x * componentScaleX;
48867          xScaleBlockOffset[x] = (j & mask3LSB) << 3 | j & 7;
48868        }
48869        lastComponentScaleX = componentScaleX;
48870      }
48871      for (y = 0; y < height; y++) {
48872        j = 0 | y * componentScaleY;
48873        index = blocksPerScanline * (j & mask3LSB) | (j & 7) << 3;
48874        for (x = 0; x < width; x++) {
48875          data[offset] = output[index + xScaleBlockOffset[x]];
48876          offset += numComponents;
48877        }
48878      }
48879    }
48880    let transform = this._decodeTransform;
48881    if (!isSourcePDF && numComponents === 4 && !transform) {
48882      transform = new Int32Array([-256, 255, -256, 255, -256, 255, -256, 255]);
48883    }
48884    if (transform) {
48885      for (i = 0; i < dataLength;) {
48886        for (j = 0, k = 0; j < numComponents; j++, i++, k += 2) {
48887          data[i] = (data[i] * transform[k] >> 8) + transform[k + 1];
48888        }
48889      }
48890    }
48891    return data;
48892  }
48893  get _isColorConversionNeeded() {
48894    if (this.adobe) {
48895      return !!this.adobe.transformCode;
48896    }
48897    if (this.numComponents === 3) {
48898      if (this._colorTransform === 0) {
48899        return false;
48900      } else if (this.components[0].index === 0x52 && this.components[1].index === 0x47 && this.components[2].index === 0x42) {
48901        return false;
48902      }
48903      return true;
48904    }
48905    if (this._colorTransform === 1) {
48906      return true;
48907    }
48908    return false;
48909  }
48910  _convertYccToRgb(data) {
48911    let Y, Cb, Cr;
48912    for (let i = 0, length = data.length; i < length; i += 3) {
48913      Y = data[i];
48914      Cb = data[i + 1];
48915      Cr = data[i + 2];
48916      data[i] = Y - 179.456 + 1.402 * Cr;
48917      data[i + 1] = Y + 135.459 - 0.344 * Cb - 0.714 * Cr;
48918      data[i + 2] = Y - 226.816 + 1.772 * Cb;
48919    }
48920    return data;
48921  }
48922  _convertYccToRgba(data, out) {
48923    for (let i = 0, j = 0, length = data.length; i < length; i += 3, j += 4) {
48924      const Y = data[i];
48925      const Cb = data[i + 1];
48926      const Cr = data[i + 2];
48927      out[j] = Y - 179.456 + 1.402 * Cr;
48928      out[j + 1] = Y + 135.459 - 0.344 * Cb - 0.714 * Cr;
48929      out[j + 2] = Y - 226.816 + 1.772 * Cb;
48930      out[j + 3] = 255;
48931    }
48932    return out;
48933  }
48934  _convertYcckToRgb(data) {
48935    let Y, Cb, Cr, k;
48936    let offset = 0;
48937    for (let i = 0, length = data.length; i < length; i += 4) {
48938      Y = data[i];
48939      Cb = data[i + 1];
48940      Cr = data[i + 2];
48941      k = data[i + 3];
48942      data[offset++] = -122.67195406894 + Cb * (-6.60635669420364e-5 * Cb + 0.000437130475926232 * Cr - 5.4080610064599e-5 * Y + 0.00048449797120281 * k - 0.154362151871126) + Cr * (-0.000957964378445773 * Cr + 0.000817076911346625 * Y - 0.00477271405408747 * k + 1.53380253221734) + Y * (0.000961250184130688 * Y - 0.00266257332283933 * k + 0.48357088451265) + k * (-0.000336197177618394 * k + 0.484791561490776);
48943      data[offset++] = 107.268039397724 + Cb * (2.19927104525741e
48943-5 * Cb - 0.000640992018297945 * Cr + 0.000659397001245577 * Y + 0.000426105652938837 * k - 0.176491792462875) + Cr * (-0.000778269941513683 * Cr + 0.00130872261408275 * Y + 0.000770482631801132 * k - 0.151051492775562) + Y * (0.00126935368114843 * Y - 0.00265090189010898 * k + 0.25802910206845) + k * (-0.000318913117588328 * k - 0.213742400323665);
48944      data[offset++] = -20.810012546947 + Cb * (-0.000570115196973677 * Cb - 2.63409051004589e-5 * Cr + 0.0020741088115012 * Y - 0.00288260236853442 * k + 0.814272968359295) + Cr * (-1.53496057440975e-5 * Cr - 0.000132689043961446 * Y + 0.000560833691242812 * k - 0.195152027534049) + Y * (0.00174418132927582 * Y - 0.00255243321439347 * k + 0.116935020465145) + k * (-0.000343531996510555 * k + 0.24165260232407);
48945    }
48946    return data.subarray(0, offset);
48947  }
48948  _convertYcckToRgba(data) {
48949    for (let i = 0, length = data.length; i < length; i += 4) {
48950      const Y = data[i];
48951      const Cb = data[i + 1];
48952      const Cr = data[i + 2];
48953      const k = data[i + 3];
48954      data[i] = -122.67195406894 + Cb * (-6.60635669420364e-5 * Cb + 0.000437130475926232 * Cr - 5.4080610064599e-5 * Y + 0.00048449797120281 * k - 0.154362151871126) + Cr * (-0.000957964378445773 * Cr + 0.000817076911346625 * Y - 0.00477271405408747 * k + 1.53380253221734) + Y * (0.000961250184130688 * Y - 0.00266257332283933 * k + 0.48357088451265) + k * (-0.000336197177618394 * k + 0.484791561490776);
48955      data[i + 1] = 107.268039397724 + Cb * (2.19927104525741e-5 * Cb - 0.000640992018297945 * Cr + 0.000659397001245577 * Y + 0.000426105652938837 * k - 0.176491792462875) + Cr * (-0.000778269941513683 * Cr + 0.00130872261408275 * Y + 0.000770482631801132 * k - 0.151051492775562) + Y * (0.00126935368114843 * Y - 0.00265090189010898 * k + 0.25802910206845) + k * (-0.000318913117588328 * k - 0.213742400323665);
48956      data[i + 2] = -20.810012546947 + Cb * (-0.000570115196973677 * Cb - 2.63409051004589e-5 * Cr + 0.0020741088115012 * Y - 0.00288260236853442 * k + 0.814272968359295) + Cr * (-1.53496057440975e-5 * Cr - 0.000132689043961446 * Y + 0.000560833691242812 * k - 0.195152027534049) + Y * (0.00174418132927582 * Y - 0.00255243321439347 * k + 0.116935020465145) + k * (-0.000343531996510555 * k + 0.24165260232407);
48957      data[i + 3] = 255;
48958    }
48959    return data;
48960  }
48961  _convertYcckToCmyk(data) {
48962    let Y, Cb, Cr;
48963    for (let i = 0, length = data.length; i < length; i += 4) {
48964      Y = data[i];
48965      Cb = data[i + 1];
48966      Cr = data[i + 2];
48967      data[i] = 434.456 - Y - 1.402 * Cr;
48968      data[i + 1] = 119.541 - Y + 0.344 * Cb + 0.714 * Cr;
48969      data[i + 2] = 481.816 - Y - 1.772 * Cb;
48970    }
48971    return data;
48972  }
48973  _convertCmykToRgb(data) {
48974    let c, m, y, k;
48975    let offset = 0;
48976    for (let i = 0, length = data.length; i < length; i += 4) {
48977      c = data[i];
48978      m = data[i + 1];
48979      y = data[i + 2];
48980      k = data[i + 3];
48981      data[offset++] = 255 + c * (-0.00006747147073602441 * c + 0.0008379262121013727 * m + 0.0002894718188643294 * y + 0.003264231057537806 * k - 1.1185611867203937) + m * (0.000026374107616089405 * m - 0.00008626949158638572 * y - 0.0002748769067499491 * k - 0.02155688794978967) + y * (-0.00003878099212869363 * y - 0.0003267808279485286 * k + 0.0686742238595345) - k * (0.0003361971776183937 * k + 0.7430659151342254);
48982      data[offset++] = 255 + c * (0.00013596372813588848 * c + 0.000924537132573585 * m + 0.00010567359618683593 * y + 0.0004791864687436512 * k - 0.3109689587515875) + m * (-0.00023545346108370344 * m + 0.0002702845253534714 * y + 0.0020200308977307156 * k - 0.7488052167015494) + y * (0.00006834815998235662 * y + 0.00015168452363460973 * k - 0.09751927774728933) - k * (0.0003189131175883281 * k + 0.7364883807733168);
48983      data[offset++] = 255 + c * (0.000013598650411385307 * c + 0.00012423956175490851 * m + 0.0004751985097583589 * y - 0.0000036729317476630422 * k - 0.05562186980264034) + m * (0.00016141380598724676 * m + 0.0009692239130725186 * y + 0.0007782692450036253 * k - 0.44015232367526463) + y * (5.068882914068769e-7 * y + 0.0017778369011375071 * k - 0.7591454649749609) - k * (0.0003435319965105553 * k + 0.7063770186160144);
48984    }
48985    return data.subarray(0, offset);
48986  }
48987  _convertCmykToRgba(data) {
48988    for (let i = 0, length = data.length; i < length; i += 4) {
48989      const c = data[i];
48990      const m = data[i + 1];
48991      const y = data[i + 2];
48992      const k = data[i + 3];
48993      data[i] = 255 + c * (-0.00006747147073602441 * c + 0.0008379262121013727 * m + 0.0002894718188643294 * y + 0.003264231057537806 * k - 1.1185611867203937) + m * (0.000026374107616089405 * m - 0.00008626949158638572 * y - 0.0002748769067499491 * k - 0.02155688794978967) + y * (-0.00003878099212869363 * y - 0.0003267808279485286 * k + 0.0686742238595345) - k * (0.0003361971776183937 * k + 0.7430659151342254);
48994      data[i + 1] = 255 + c * (0.00013596372813588848 * c + 0.000924537132573585 * m + 0.00010567359618683593 * y + 0.0004791864687436512 * k - 0.3109689587515875) + m * (-0.00023545346108370344 * m + 0.0002702845253534714 * y + 0.0020200308977307156 * k - 0.7488052167015494) + y * (0.00006834815998235662 * y + 0.00015168452363460973 * k - 0.09751927774728933) - k * (0.0003189131175883281 * k + 0.7364883807733168);
48995      data[i + 2] = 255 + c * (0.000013598650411385307 * c + 0.00012423956175490851 * m + 0.0004751985097583589 * y - 0.0000036729317476630422 * k - 0.05562186980264034) + m * (0.00016141380598724676 * m + 0.0009692239130725186 * y + 0.0007782692450036253 * k - 0.44015232367526463) + y * (5.068882914068769e-7 * y + 0.0017778369011375071 * k - 0.7591454649749609) - k * (0.0003435319965105553 * k + 0.7063770186160144);
48996      data[i + 3] = 255;
48997    }
48998    return data;
48999  }
49000  getData({
49001    width,
49002    height,
49003    forceRGBA = false,
49004    forceRGB = false,
49005    isSourcePDF = false
49006  }) {
49007    if (this.numComponents > 4) {
49008      throw new JpegError("Unsupported color mode");
49009    }
49010    const data = this._getLinearizedBlockData(width, height, isSourcePDF);
49011    if (this.numComponents === 1 && (forceRGBA || forceRGB)) {
49012      const len = data.length * (forceRGBA ? 4 : 3);
49013      const rgbaData = new Uint8ClampedArray(len);
49014      let offset = 0;
49015      if (forceRGBA) {
49016        (0, _image_utils.grayToRGBA)(data, new Uint32Array(rgbaData.buffer));
49017      } else {
49018        for (const grayColor of data) {
49019          rgbaData[offset++] = grayColor;
49020          rgbaData[offset++] = grayColor;
49021          rgbaData[offset++] = grayColor;
49022        }
49023      }
49024      return rgbaData;
49025    } else if (this.numComponents === 3 && this._isColorConversionNeeded) {
49026      if (forceRGBA) {
49027        const rgbaData = new Uint8ClampedArray(data.length / 3 * 4);
49028        return this._convertYccToRgba(data, rgbaData);
49029      }
49030      return this._convertYccToRgb(data);
49031    } else if (this.numComponents === 4) {
49032      if (this._isColorConversionNeeded) {
49033        if (forceRGBA) {
49034          return this._convertYcckToRgba(data);
49035        }
49036        if (forceRGB) {
49037          return this._convertYcckToRgb(data);
49038        }
49039        return this._convertYcckToCmyk(data);
49040      } else if (forceRGBA) {
49041        return this._convertCmykToRgba(data);
49042      } else if (forceRGB) {
49043        return this._convertCmykToRgb(data);
49044      }
49045    }
49046    return data;
49047  }
49048}
49049exports.JpegImage = JpegImage;
49050
49051/***/ }),
49052/* 28 */
49053/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
49054
49055
49056
49057Object.defineProperty(exports, "__esModule", ({
49058  value: true
49059}));
49060exports.convertBlackAndWhiteToRGBA = convertBlackAndWhiteToRGBA;
49061exports.convertToRGBA = convertToRGBA;
49062exports.grayToRGBA = grayToRGBA;
49063var _util = __w_pdfjs_require__(2);
49064function convertToRGBA(params) {
49065  switch (params.kind) {
49066    case _util.ImageKind.GRAYSCALE_1BPP:
49067      return convertBlackAndWhiteToRGBA(params);
49068    case _util.ImageKind.RGB_24BPP:
49069      return convertRGBToRGBA(params);
49070  }
49071  return null;
49072}
49073function convertBlackAndWhiteToRGBA({
49074  src,
49075  srcPos = 0,
49076  dest,
49077  width,
49078  height,
49079  nonBlackColor = 0xffffffff,
49080  inverseDecode = false
49081}) {
49082  const black = _util.FeatureTest.isLittleEndian ? 0xff000000 : 0x000000ff;
49083  const [zeroMapping, oneMapping] = inverseDecode ? [nonBlackColor, black] : [black, nonBlackColor];
49084  const widthInSource = width >> 3;
49085  const widthRemainder = width & 7;
49086  const srcLength = src.length;
49087  dest = new Uint32Array(dest.buffer);
49088  let destPos = 0;
49089  for (let i = 0; i < height; i++) {
49090    for (const max = srcPos + widthInSource; srcPos < max; srcPos++) {
49091      const elem = srcPos < srcLength ? src[srcPos] : 255;
49092      dest[destPos++] = elem & 0b10000000 ? oneMapping : zeroMapping;
49093      dest[destPos++] = elem & 0b1000000 ? oneMapping : zeroMapping;
49094      dest[destPos++] = elem & 0b100000 ? oneMapping : zeroMapping;
49095      dest[destPos++] = elem & 0b10000 ? oneMapping : zeroMapping;
49096      dest[destPos++] = elem & 0b1000 ? oneMapping : zeroMapping;
49097      dest[destPos++] = elem & 0b100 ? oneMapping : zeroMapping;
49098      dest[destPos++] = elem & 0b10 ? oneMapping : zeroMapping;
49099      dest[destPos++] = elem & 0b1 ? oneMapping : zeroMapping;
49100    }
49101    if (widthRemainder === 0) {
49102      continue;
49103    }
49104    const elem = srcPos < srcLength ? src[srcPos++] : 255;
49105    for (let j = 0; j < widthRemainder; j++) {
49106      dest[destPos++] = elem & 1 << 7 - j ? oneMapping : zeroMapping;
49107    }
49108  }
49109  return {
49110    srcPos,
49111    destPos
49112  };
49113}
49114function convertRGBToRGBA({
49115  src,
49116  srcPos = 0,
49117  dest,
49118  destPos = 0,
49119  width,
49120  height
49121}) {
49122  let i = 0;
49123  const len32 = src.length >> 2;
49124  const src32 = new Uint32Array(src.buffer, srcPos, len32);
49125  if (_util.FeatureTest.isLittleEndian) {
49126    for (; i < len32 - 2; i += 3, destPos += 4) {
49127      const s1 = src32[i];
49128      const s2 = src32[i + 1];
49129      const s3 = src32[i + 2];
49130      dest[destPos] = s1 | 0xff000000;
49131      dest[destPos + 1] = s1 >>> 24 | s2 << 8 | 0xff000000;
49132      dest[destPos + 2] = s2 >>> 16 | s3 << 16 | 0xff000000;
49133      dest[destPos + 3] = s3 >>> 8 | 0xff000000;
49134    }
49135    for (let j = i * 4, jj = src.length; j < jj; j += 3) {
49136      dest[destPos++] = src[j] | src[j + 1] << 8 | src[j + 2] << 16 | 0xff000000;
49137    }
49138  } else {
49139    for (; i < len32 - 2; i += 3, destPos += 4) {
49140      const s1 = src32[i];
49141      const s2 = src32[i + 1];
49142      const s3 = src32[i + 2];
49143      dest[destPos] = s1 | 0xff;
49144      dest[destPos + 1] = s1 << 24 | s2 >>> 8 | 0xff;
49145      dest[destPos + 2] = s2 << 16 | s3 >>> 16 | 0xff;
49146      dest[destPos + 3] = s3 << 8 | 0xff;
49147    }
49148    for (let j = i * 4, jj = src.length; j < jj; j += 3) {
49149      dest[destPos++] = src[j] << 24 | src[j + 1] << 16 | src[j + 2] << 8 | 0xff;
49150    }
49151  }
49152  return {
49153    srcPos,
49154    destPos
49155  };
49156}
49157function grayToRGBA(src, dest) {
49158  if (_util.FeatureTest.isLittleEndian) {
49159    for (let i = 0, ii = src.length; i < ii; i++) {
49160      dest[i] = src[i] * 0x10101 | 0xff000000;
49161    }
49162  } else {
49163    for (let i = 0, ii = src.length; i < ii; i++) {
49164      dest[i] = src[i] * 0x1010100 | 0x000000ff;
49165    }
49166  }
49167}
49168
49169/***/ }),
49170/* 29 */
49171/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
49172
49173
49174
49175Object.defineProperty(exports, "__esModule", ({
49176  value: true
49177}));
49178exports.JpxStream = void 0;
49179var _decode_stream = __w_pdfjs_require__(18);
49180var _jpx = __w_pdfjs_require__(30);
49181var _util = __w_pdfjs_require__(2);
49182class JpxStream extends _decode_stream.DecodeStream {
49183  constructor(stream, maybeLength, params) {
49184    super(maybeLength);
49185    this.stream = stream;
49186    this.dict = stream.dict;
49187    this.maybeLength = maybeLength;
49188    this.params = params;
49189  }
49190  get bytes() {
49191    return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
49192  }
49193  ensureBuffer(requested) {}
49194  readBlock() {
49195    if (this.eof) {
49196      return;
49197    }
49198    const jpxImage = new _jpx.JpxImage();
49199    jpxImage.parse(this.bytes);
49200    const width = jpxImage.width;
49201    const height = jpxImage.height;
49202    const componentsCount = jpxImage.componentsCount;
49203    const tileCount = jpxImage.tiles.length;
49204    if (tileCount === 1) {
49205      this.buffer = jpxImage.tiles[0].items;
49206    } else {
49207      const data = new Uint8ClampedArray(width * height * componentsCount);
49208      for (let k = 0; k < tileCount; k++) {
49209        const tileComponents = jpxImage.tiles[k];
49210        const tileWidth = tileComponents.width;
49211        const tileHeight = tileComponents.height;
49212        const tileLeft = tileComponents.left;
49213        const tileTop = tileComponents.top;
49214        const src = tileComponents.items;
49215        let srcPosition = 0;
49216        let dataPosition = (width * tileTop + tileLeft) * componentsCount;
49217        const imgRowSize = width * componentsCount;
49218        const tileRowSize = tileWidth * componentsCount;
49219        for (let j = 0; j < tileHeight; j++) {
49220          const rowBytes = src.subarray(srcPosition, srcPosition + tileRowSize);
49221          data.set(rowBytes, dataPosition);
49222          srcPosition += tileRowSize;
49223          dataPosition += imgRowSize;
49224        }
49225      }
49226      this.buffer = data;
49227    }
49228    this.bufferLength = this.buffer.length;
49229    this.eof = true;
49230  }
49231}
49232exports.JpxStream = JpxStream;
49233
49234/***/ }),
49235/* 30 */
49236/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
49237
49238
49239
49240Object.defineProperty(exports, "__esModule", ({
49241  value: true
49242}));
49243exports.JpxImage = void 0;
49244var _util = __w_pdfjs_require__(2);
49245var _core_utils = __w_pdfjs_require__(3);
49246var _arithmetic_decoder = __w_pdfjs_require__(25
vendor: 41,794 bytes, lines 49246-50400
49246);
49247class JpxError extends _util.BaseException {
49248  constructor(msg) {
49249    super(`JPX error: ${msg}`, "JpxError");
49250  }
49251}
49252const SubbandsGainLog2 = {
49253  LL: 0,
49254  LH: 1,
49255  HL: 1,
49256  HH: 2
49257};
49258class JpxImage {
49259  constructor() {
49260    this.failOnCorruptedImage = false;
49261  }
49262  parse(data) {
49263    const head = (0, _core_utils.readUint16)(data, 0);
49264    if (head === 0xff4f) {
49265      this.parseCodestream(data, 0, data.length);
49266      return;
49267    }
49268    const length = data.length;
49269    let position = 0;
49270    while (position < length) {
49271      let headerSize = 8;
49272      let lbox = (0, _core_utils.readUint32)(data, position);
49273      const tbox = (0, _core_utils.readUint32)(data, position + 4);
49274      position += headerSize;
49275      if (lbox === 1) {
49276        lbox = (0, _core_utils.readUint32)(data, position) * 4294967296 + (0, _core_utils.readUint32)(data, position + 4);
49277        position += 8;
49278        headerSize += 8;
49279      }
49280      if (lbox === 0) {
49281        lbox = length - position + headerSize;
49282      }
49283      if (lbox < headerSize) {
49284        throw new JpxError("Invalid box field size");
49285      }
49286      const dataLength = lbox - headerSize;
49287      let jumpDataLength = true;
49288      switch (tbox) {
49289        case 0x6a703268:
49290          jumpDataLength = false;
49291          break;
49292        case 0x636f6c72:
49293          const method = data[position];
49294          if (method === 1) {
49295            const colorspace = (0, _core_utils.readUint32)(data, position + 3);
49296            switch (colorspace) {
49297              case 16:
49298              case 17:
49299              case 18:
49300                break;
49301              default:
49302                (0, _util.warn)("Unknown colorspace " + colorspace);
49303                break;
49304            }
49305          } else if (method === 2) {
49306            (0, _util.info)("ICC profile not supported");
49307          }
49308          break;
49309        case 0x6a703263:
49310          this.parseCodestream(data, position, position + dataLength);
49311          break;
49312        case 0x6a502020:
49313          if ((0, _core_utils.readUint32)(data, position) !== 0x0d0a870a) {
49314            (0, _util.warn)("Invalid JP2 signature");
49315          }
49316          break;
49317        case 0x6a501a1a:
49318        case 0x66747970:
49319        case 0x72726571:
49320        case 0x72657320:
49321        case 0x69686472:
49322          break;
49323        default:
49324          const headerType = String.fromCharCode(tbox >> 24 & 0xff, tbox >> 16 & 0xff, tbox >> 8 & 0xff, tbox & 0xff);
49325          (0, _util.warn)(`Unsupported header type ${tbox} (${headerType}).`);
49326          break;
49327      }
49328      if (jumpDataLength) {
49329        position += dataLength;
49330      }
49331    }
49332  }
49333  parseImageProperties(stream) {
49334    let newByte = stream.getByte();
49335    while (newByte >= 0) {
49336      const oldByte = newByte;
49337      newByte = stream.getByte();
49338      const code = oldByte << 8 | newByte;
49339      if (code === 0xff51) {
49340        stream.skip(4);
49341        const Xsiz = stream.getInt32() >>> 0;
49342        const Ysiz = stream.getInt32() >>> 0;
49343        const XOsiz = stream.getInt32() >>> 0;
49344        const YOsiz = stream.getInt32() >>> 0;
49345        stream.skip(16);
49346        const Csiz = stream.getUint16();
49347        this.width = Xsiz - XOsiz;
49348        this.height = Ysiz - YOsiz;
49349        this.componentsCount = Csiz;
49350        this.bitsPerComponent = 8;
49351        return;
49352      }
49353    }
49354    throw new JpxError("No size marker found in JPX stream");
49355  }
49356  parseCodestream(data, start, end) {
49357    const context = {};
49358    let doNotRecover = false;
49359    try {
49360      let position = start;
49361      while (position + 1 < end) {
49362        const code = (0, _core_utils.readUint16)(data, position);
49363        position += 2;
49364        let length = 0,
49365          j,
49366          sqcd,
49367          spqcds,
49368          spqcdSize,
49369          scalarExpounded,
49370          tile;
49371        switch (code) {
49372          case 0xff4f:
49373            context.mainHeader = true;
49374            break;
49375          case 0xffd9:
49376            break;
49377          case 0xff51:
49378            length = (0, _core_utils.readUint16)(data, position);
49379            const siz = {};
49380            siz.Xsiz = (0, _core_utils.readUint32)(data, position + 4);
49381            siz.Ysiz = (0, _core_utils.readUint32)(data, position + 8);
49382            siz.XOsiz = (0, _core_utils.readUint32)(data, position + 12);
49383            siz.YOsiz = (0, _core_utils.readUint32)(data, position + 16);
49384            siz.XTsiz = (0, _core_utils.readUint32)(data, position + 20);
49385            siz.YTsiz = (0, _core_utils.readUint32)(data, position + 24);
49386            siz.XTOsiz = (0, _core_utils.readUint32)(data, position + 28);
49387            siz.YTOsiz = (0, _core_utils.readUint32)(data, position + 32);
49388            const componentsCount = (0, _core_utils.readUint16)(data, position + 36);
49389            siz.Csiz = componentsCount;
49390            const components = [];
49391            j = position + 38;
49392            for (let i = 0; i < componentsCount; i++) {
49393              const component = {
49394                precision: (data[j] & 0x7f) + 1,
49395                isSigned: !!(data[j] & 0x80),
49396                XRsiz: data[j + 1],
49397                YRsiz: data[j + 2]
49398              };
49399              j += 3;
49400              calculateComponentDimensions(component, siz);
49401              components.push(component);
49402            }
49403            context.SIZ = siz;
49404            context.components = components;
49405            calculateTileGrids(context, components);
49406            context.QCC = [];
49407            context.COC = [];
49408            break;
49409          case 0xff5c:
49410            length = (0, _core_utils.readUint16)(data, position);
49411            const qcd = {};
49412            j = position + 2;
49413            sqcd = data[j++];
49414            switch (sqcd & 0x1f) {
49415              case 0:
49416                spqcdSize = 8;
49417                scalarExpounded = true;
49418                break;
49419              case 1:
49420                spqcdSize = 16;
49421                scalarExpounded = false;
49422                break;
49423              case 2:
49424                spqcdSize = 16;
49425                scalarExpounded = true;
49426                break;
49427              default:
49428                throw new Error("Invalid SQcd value " + sqcd);
49429            }
49430            qcd.noQuantization = spqcdSize === 8;
49431            qcd.scalarExpounded = scalarExpounded;
49432            qcd.guardBits = sqcd >> 5;
49433            spqcds = [];
49434            while (j < length + position) {
49435              const spqcd = {};
49436              if (spqcdSize === 8) {
49437                spqcd.epsilon = data[j++] >> 3;
49438                spqcd.mu = 0;
49439              } else {
49440                spqcd.epsilon = data[j] >> 3;
49441                spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
49442                j += 2;
49443              }
49444              spqcds.push(spqcd);
49445            }
49446            qcd.SPqcds = spqcds;
49447            if (context.mainHeader) {
49448              context.QCD = qcd;
49449            } else {
49450              context.currentTile.QCD = qcd;
49451              context.currentTile.QCC = [];
49452            }
49453            break;
49454          case 0xff5d:
49455            length = (0, _core_utils.readUint16)(data, position);
49456            const qcc = {};
49457            j = position + 2;
49458            let cqcc;
49459            if (context.SIZ.Csiz < 257) {
49460              cqcc = data[j++];
49461            } else {
49462              cqcc = (0, _core_utils.readUint16)(data, j);
49463              j += 2;
49464            }
49465            sqcd = data[j++];
49466            switch (sqcd & 0x1f) {
49467              case 0:
49468                spqcdSize = 8;
49469                scalarExpounded = true;
49470                break;
49471              case 1:
49472                spqcdSize = 16;
49473                scalarExpounded = false;
49474                break;
49475              case 2:
49476                spqcdSize = 16;
49477                scalarExpounded = true;
49478                break;
49479              default:
49480                throw new Error("Invalid SQcd value " + sqcd);
49481            }
49482            qcc.noQuantization = spqcdSize === 8;
49483            qcc.scalarExpounded = scalarExpounded;
49484            qcc.guardBits = sqcd >> 5;
49485            spqcds = [];
49486            while (j < length + position) {
49487              const spqcd = {};
49488              if (spqcdSize === 8) {
49489                spqcd.epsilon = data[j++] >> 3;
49490                spqcd.mu = 0;
49491              } else {
49492                spqcd.epsilon = data[j] >> 3;
49493                spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
49494                j += 2;
49495              }
49496              spqcds.push(spqcd);
49497            }
49498            qcc.SPqcds = spqcds;
49499            if (context.mainHeader) {
49500              context.QCC[cqcc] = qcc;
49501            } else {
49502              context.currentTile.QCC[cqcc] = qcc;
49503            }
49504            break;
49505          case 0xff52:
49506            length = (0, _core_utils.readUint16)(data, position);
49507            const cod = {};
49508            j = position + 2;
49509            const scod = data[j++];
49510            cod.entropyCoderWithCustomPrecincts = !!(scod & 1);
49511            cod.sopMarkerUsed = !!(scod & 2);
49512            cod.ephMarkerUsed = !!(scod & 4);
49513            cod.progressionOrder = data[j++];
49514            cod.layersCount = (0, _core_utils.readUint16)(data, j);
49515            j += 2;
49516            cod.multipleComponentTransform = data[j++];
49517            cod.decompositionLevelsCount = data[j++];
49518            cod.xcb = (data[j++] & 0xf) + 2;
49519            cod.ycb = (data[j++] & 0xf) + 2;
49520            const blockStyle = data[j++];
49521            cod.selectiveArithmeticCodingBypass = !!(blockStyle & 1);
49522            cod.resetContextProbabilities = !!(blockStyle & 2);
49523            cod.terminationOnEachCodingPass = !!(blockStyle & 4);
49524            cod.verticallyStripe = !!(blockStyle & 8);
49525            cod.predictableTermination = !!(blockStyle & 16);
49526            cod.segmentationSymbolUsed = !!(blockStyle & 32);
49527            cod.reversibleTransformation = data[j++];
49528            if (cod.entropyCoderWithCustomPrecincts) {
49529              const precinctsSizes = [];
49530              while (j < length + position) {
49531                const precinctsSize = data[j++];
49532                precinctsSizes.push({
49533                  PPx: precinctsSize & 0xf,
49534                  PPy: precinctsSize >> 4
49535                });
49536              }
49537              cod.precinctsSizes = precinctsSizes;
49538            }
49539            const unsupported = [];
49540            if (cod.selectiveArithmeticCodingBypass) {
49541              unsupported.push("selectiveArithmeticCodingBypass");
49542            }
49543            if (cod.terminationOnEachCodingPass) {
49544              unsupported.push("terminationOnEachCodingPass");
49545            }
49546            if (cod.verticallyStripe) {
49547              unsupported.push("verticallyStripe");
49548            }
49549            if (cod.predictableTermination) {
49550              unsupported.push("predictableTermination");
49551            }
49552            if (unsupported.length > 0) {
49553              doNotRecover = true;
49554              (0, _util.warn)(`JPX: Unsupported COD options (${unsupported.join(", ")}).`);
49555            }
49556            if (context.mainHeader) {
49557              context.COD = cod;
49558            } else {
49559              context.currentTile.COD = cod;
49560              context.currentTile.COC = [];
49561            }
49562            break;
49563          case 0xff90:
49564            length = (0, _core_utils.readUint16)(data, position);
49565            tile = {};
49566            tile.index = (0, _core_utils.readUint16)(data, position + 2);
49567            tile.length = (0, _core_utils.readUint32)(data, position + 4);
49568            tile.dataEnd = tile.length + position - 2;
49569            tile.partIndex = data[position + 8];
49570            tile.partsCount = data[position + 9];
49571            context.mainHeader = false;
49572            if (tile.partIndex === 0) {
49573              tile.COD = context.COD;
49574              tile.COC = context.COC.slice(0);
49575              tile.QCD = context.QCD;
49576              tile.QCC = context.QCC.slice(0);
49577            }
49578            context.currentTile = tile;
49579            break;
49580          case 0xff93:
49581            tile = context.currentTile;
49582            if (tile.partIndex === 0) {
49583              initializeTile(context, tile.index);
49584              buildPackets(context);
49585            }
49586            length = tile.dataEnd - position;
49587            parseTilePackets(context, data, position, length);
49588            break;
49589          case 0xff53:
49590            (0, _util.warn)("JPX: Codestream code 0xFF53 (COC) is not implemented.");
49591          case 0xff55:
49592          case 0xff57:
49593          case 0xff58:
49594          case 0xff64:
49595            length = (0, _core_utils.readUint16)(data, position);
49596            break;
49597          default:
49598            throw new Error("Unknown codestream code: " + code.toString(16));
49599        }
49600        position += length;
49601      }
49602    } catch (e) {
49603      if (doNotRecover || this.failOnCorruptedImage) {
49604        throw new JpxError(e.message);
49605      } else {
49606        (0, _util.warn)(`JPX: Trying to recover from: "${e.message}".`);
49607      }
49608    }
49609    this.tiles = transformComponents(context);
49610    this.width = context.SIZ.Xsiz - context.SIZ.XOsiz;
49611    this.height = context.SIZ.Ysiz - context.SIZ.YOsiz;
49612    this.componentsCount = context.SIZ.Csiz;
49613  }
49614}
49615exports.JpxImage = JpxImage;
49616function calculateComponentDimensions(component, siz) {
49617  component.x0 = Math.ceil(siz.XOsiz / component.XRsiz);
49618  component.x1 = Math.ceil(siz.Xsiz / component.XRsiz);
49619  component.y0 = Math.ceil(siz.YOsiz / component.YRsiz);
49620  component.y1 = Math.ceil(siz.Ysiz / component.YRsiz);
49621  component.width = component.x1 - component.x0;
49622  component.height = component.y1 - component.y0;
49623}
49624function calculateTileGrids(context, components) {
49625  const siz = context.SIZ;
49626  const tiles = [];
49627  let tile;
49628  const numXtiles = Math.ceil((siz.Xsiz - siz.XTOsiz) / siz.XTsiz);
49629  const numYtiles = Math.ceil((siz.Ysiz - siz.YTOsiz) / siz.YTsiz);
49630  for (let q = 0; q < numYtiles; q++) {
49631    for (let p = 0; p < numXtiles; p++) {
49632      tile = {};
49633      tile.tx0 = Math.max(siz.XTOsiz + p * siz.XTsiz, siz.XOsiz);
49634      tile.ty0 = Math.max(siz.YTOsiz + q * siz.YTsiz, siz.YOsiz);
49635      tile.tx1 = Math.min(siz.XTOsiz + (p + 1) * siz.XTsiz, siz.Xsiz);
49636      tile.ty1 = Math.min(siz.YTOsiz + (q + 1) * siz.YTsiz, siz.Ysiz);
49637      tile.width = tile.tx1 - tile.tx0;
49638      tile.height = tile.ty1 - tile.ty0;
49639      tile.components = [];
49640      tiles.push(tile);
49641    }
49642  }
49643  context.tiles = tiles;
49644  const componentsCount = siz.Csiz;
49645  for (let i = 0, ii = componentsCount; i < ii; i++) {
49646    const component = components[i];
49647    for (let j = 0, jj = tiles.length; j < jj; j++) {
49648      const tileComponent = {};
49649      tile = tiles[j];
49650      tileComponent.tcx0 = Math.ceil(tile.tx0 / component.XRsiz);
49651      tileComponent.tcy0 = Math.ceil(tile.ty0 / component.YRsiz);
49652      tileComponent.tcx1 = Math.ceil(tile.tx1 / component.XRsiz);
49653      tileComponent.tcy1 = Math.ceil(tile.ty1 / component.YRsiz);
49654      tileComponent.width = tileComponent.tcx1 - tileComponent.tcx0;
49655      tileComponent.height = tileComponent.tcy1 - tileComponent.tcy0;
49656      tile.components[i] = tileComponent;
49657    }
49658  }
49659}
49660function getBlocksDimensions(context, component, r) {
49661  const codOrCoc = component.codingStyleParameters;
49662  const result = {};
49663  if (!codOrCoc.entropyCoderWithCustomPrecincts) {
49664    result.PPx = 15;
49665    result.PPy = 15;
49666  } else {
49667    result.PPx = codOrCoc.precinctsSizes[r].PPx;
49668    result.PPy = codOrCoc.precinctsSizes[r].PPy;
49669  }
49670  result.xcb_ = r > 0 ? Math.min(codOrCoc.xcb, result.PPx - 1) : Math.min(codOrCoc.xcb, result.PPx);
49671  result.ycb_ = r > 0 ? Math.min(codOrCoc.ycb, result.PPy - 1) : Math.min(codOrCoc.ycb, result.PPy);
49672  return result;
49673}
49674function buildPrecincts(context, resolution, dimensions) {
49675  const precinctWidth = 1 << dimensions.PPx;
49676  const precinctHeight = 1 << dimensions.PPy;
49677  const isZeroRes = resolution.resLevel === 0;
49678  const precinctWidthInSubband = 1 << dimensions.PPx + (isZeroRes ? 0 : -1);
49679  const precinctHeightInSubband = 1 << dimensions.PPy + (isZeroRes ? 0 : -1);
49680  const numprecinctswide = resolution.trx1 > resolution.trx0 ? Math.ceil(resolution.trx1 / precinctWidth) - Math.floor(resolution.trx0 / precinctWidth) : 0;
49681  const numprecinctshigh = resolution.try1 > resolution.try0 ? Math.ceil(resolution.try1 / precinctHeight) - Math.floor(resolution.try0 / precinctHeight) : 0;
49682  const numprecincts = numprecinctswide * numprecinctshigh;
49683  resolution.precinctParameters = {
49684    precinctWidth,
49685    precinctHeight,
49686    numprecinctswide,
49687    numprecinctshigh,
49688    numprecincts,
49689    precinctWidthInSubband,
49690    precinctHeightInSubband
49691  };
49692}
49693function buildCodeblocks(context, subband, dimensions) {
49694  const xcb_ = dimensions.xcb_;
49695  const ycb_ = dimensions.ycb_;
49696  const codeblockWidth = 1 << xcb_;
49697  const codeblockHeight = 1 << ycb_;
49698  const cbx0 = subband.tbx0 >> xcb_;
49699  const cby0 = subband.tby0 >> ycb_;
49700  const cbx1 = subband.tbx1 + codeblockWidth - 1 >> xcb_;
49701  const cby1 = subband.tby1 + codeblockHeight - 1 >> ycb_;
49702  const precinctParameters = subband.resolution.precinctParameters;
49703  const codeblocks = [];
49704  const precincts = [];
49705  let i, j, codeblock, precinctNumber;
49706  for (j = cby0; j < cby1; j++) {
49707    for (i = cbx0; i < cbx1; i++) {
49708      codeblock = {
49709        cbx: i,
49710        cby: j,
49711        tbx0: codeblockWidth * i,
49712        tby0: codeblockHeight * j,
49713        tbx1: codeblockWidth * (i + 1),
49714        tby1: codeblockHeight * (j + 1)
49715      };
49716      codeblock.tbx0_ = Math.max(subband.tbx0, codeblock.tbx0);
49717      codeblock.tby0_ = Math.max(subband.tby0, codeblock.tby0);
49718      codeblock.tbx1_ = Math.min(subband.tbx1, codeblock.tbx1);
49719      codeblock.tby1_ = Math.min(subband.tby1, codeblock.tby1);
49720      const pi = Math.floor((codeblock.tbx0_ - subband.tbx0) / precinctParameters.precinctWidthInSubband);
49721      const pj = Math.floor((codeblock.tby0_ - subband.tby0) / precinctParameters.precinctHeightInSubband);
49722      precinctNumber = pi + pj * precinctParameters.numprecinctswide;
49723      codeblock.precinctNumber = precinctNumber;
49724      codeblock.subbandType = subband.type;
49725      codeblock.Lblock = 3;
49726      if (codeblock.tbx1_ <= codeblock.tbx0_ || codeblock.tby1_ <= codeblock.tby0_) {
49727        continue;
49728      }
49729      codeblocks.push(codeblock);
49730      let precinct = precincts[precinctNumber];
49731      if (precinct !== undefined) {
49732        if (i < precinct.cbxMin) {
49733          precinct.cbxMin = i;
49734        } else if (i > precinct.cbxMax) {
49735          precinct.cbxMax = i;
49736        }
49737        if (j < precinct.cbyMin) {
49738          precinct.cbxMin = j;
49739        } else if (j > precinct.cbyMax) {
49740          precinct.cbyMax = j;
49741        }
49742      } else {
49743        precincts[precinctNumber] = precinct = {
49744          cbxMin: i,
49745          cbyMin: j,
49746          cbxMax: i,
49747          cbyMax: j
49748        };
49749      }
49750      codeblock.precinct = precinct;
49751    }
49752  }
49753  subband.codeblockParameters = {
49754    codeblockWidth: xcb_,
49755    codeblockHeight: ycb_,
49756    numcodeblockwide: cbx1 - cbx0 + 1,
49757    numcodeblockhigh: cby1 - cby0 + 1
49758  };
49759  subband.codeblocks = codeblocks;
49760  subband.precincts = precincts;
49761}
49762function createPacket(resolution, precinctNumber, layerNumber) {
49763  const precinctCodeblocks = [];
49764  const subbands = resolution.subbands;
49765  for (let i = 0, ii = subbands.length; i < ii; i++) {
49766    const subband = subbands[i];
49767    const codeblocks = subband.codeblocks;
49768    for (let j = 0, jj = codeblocks.length; j < jj; j++) {
49769      const codeblock = codeblocks[j];
49770      if (codeblock.precinctNumber !== precinctNumber) {
49771        continue;
49772      }
49773      precinctCodeblocks.push(codeblock);
49774    }
49775  }
49776  return {
49777    layerNumber,
49778    codeblocks: precinctCodeblocks
49779  };
49780}
49781function LayerResolutionComponentPositionIterator(context) {
49782  const siz = context.SIZ;
49783  const tileIndex = context.currentTile.index;
49784  const tile = context.tiles[tileIndex];
49785  const layersCount = tile.codingStyleDefaultParameters.layersCount;
49786  const componentsCount = siz.Csiz;
49787  let maxDecompositionLevelsCount = 0;
49788  for (let q = 0; q < componentsCount; q++) {
49789    maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
49790  }
49791  let l = 0,
49792    r = 0,
49793    i = 0,
49794    k = 0;
49795  this.nextPacket = function JpxImage_nextPacket() {
49796    for (; l < layersCount; l++) {
49797      for (; r <= maxDecompositionLevelsCount; r++) {
49798        for (; i < componentsCount; i++) {
49799          const component = tile.components[i];
49800          if (r > component.codingStyleParameters.decompositionLevelsCount) {
49801            continue;
49802          }
49803          const resolution = component.resolutions[r];
49804          const numprecincts = resolution.precinctParameters.numprecincts;
49805          for (; k < numprecincts;) {
49806            const packet = createPacket(resolution, k, l);
49807            k++;
49808            return packet;
49809          }
49810          k = 0;
49811        }
49812        i = 0;
49813      }
49814      r = 0;
49815    }
49816    throw new JpxError("Out of packets");
49817  };
49818}
49819function ResolutionLayerComponentPositionIterator(context) {
49820  const siz = context.SIZ;
49821  const tileIndex = context.currentTile.index;
49822  const tile = context.tiles[tileIndex];
49823  const layersCount = tile.codingStyleDefaultParameters.layersCount;
49824  const componentsCount = siz.Csiz;
49825  let maxDecompositionLevelsCount = 0;
49826  for (let q = 0; q < componentsCount; q++) {
49827    maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
49828  }
49829  let r = 0,
49830    l = 0,
49831    i = 0,
49832    k = 0;
49833  this.nextPacket = function JpxImage_nextPacket() {
49834    for (; r <= maxDecompositionLevelsCount; r++) {
49835      for (; l < layersCount; l++) {
49836        for (; i < componentsCount; i++) {
49837          const component = tile.components[i];
49838          if (r > component.codingStyleParameters.decompositionLevelsCount) {
49839            continue;
49840          }
49841          const resolution = component.resolutions[r];
49842          const numprecincts = resolution.precinctParameters.numprecincts;
49843          for (; k < numprecincts;) {
49844            const packet = createPacket(resolution, k, l);
49845            k++;
49846            return packet;
49847          }
49848          k = 0;
49849        }
49850        i = 0;
49851      }
49852      l = 0;
49853    }
49854    throw new JpxError("Out of packets");
49855  };
49856}
49857function ResolutionPositionComponentLayerIterator(context) {
49858  const siz = context.SIZ;
49859  const tileIndex = context.currentTile.index;
49860  const tile = context.tiles[tileIndex];
49861  const layersCount = tile.codingStyleDefaultParameters.layersCount;
49862  const componentsCount = siz.Csiz;
49863  let l, r, c, p;
49864  let maxDecompositionLevelsCount = 0;
49865  for (c = 0; c < componentsCount; c++) {
49866    const component = tile.components[c];
49867    maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, component.codingStyleParameters.decompositionLevelsCount);
49868  }
49869  const maxNumPrecinctsInLevel = new Int32Array(maxDecompositionLevelsCount + 1);
49870  for (r = 0; r <= maxDecompositionLevelsCount; ++r) {
49871    let maxNumPrecincts = 0;
49872    for (c = 0; c < componentsCount; ++c) {
49873      const resolutions = tile.components[c].resolutions;
49874      if (r < resolutions.length) {
49875        maxNumPrecincts = Math.max(maxNumPrecincts, resolutions[r].precinctParameters.numprecincts);
49876      }
49877    }
49878    maxNumPrecinctsInLevel[r] = maxNumPrecincts;
49879  }
49880  l = 0;
49881  r = 0;
49882  c = 0;
49883  p = 0;
49884  this.nextPacket = function JpxImage_nextPacket() {
49885    for (; r <= maxDecompositionLevelsCount; r++) {
49886      for (; p < maxNumPrecinctsInLevel[r]; p++) {
49887        for (; c < componentsCount; c++) {
49888          const component = tile.components[c];
49889          if (r > component.codingStyleParameters.decompositionLevelsCount) {
49890            continue;
49891          }
49892          const resolution = component.resolutions[r];
49893          const numprecincts = resolution.precinctParameters.numprecincts;
49894          if (p >= numprecincts) {
49895            continue;
49896          }
49897          for (; l < layersCount;) {
49898            const packet = createPacket(resolution, p, l);
49899            l++;
49900            return packet;
49901          }
49902          l = 0;
49903        }
49904        c = 0;
49905      }
49906      p = 0;
49907    }
49908    throw new JpxError("Out of packets");
49909  };
49910}
49911function PositionComponentResolutionLayerIterator(context) {
49912  const siz = context.SIZ;
49913  const tileIndex = context.currentTile.index;
49914  const tile = context.tiles[tileIndex];
49915  const layersCount = tile.codingStyleDefaultParameters.layersCount;
49916  const componentsCount = siz.Csiz;
49917  const precinctsSizes = getPrecinctSizesInImageScale(tile);
49918  const precinctsIterationSizes = precinctsSizes;
49919  let l = 0,
49920    r = 0,
49921    c = 0,
49922    px = 0,
49923    py = 0;
49924  this.nextPacket = function JpxImage_nextPacket() {
49925    for (; py < precinctsIterationSizes.maxNumHigh; py++) {
49926      for (; px < precinctsIterationSizes.maxNumWide; px++) {
49927        for (; c < componentsCount; c++) {
49928          const component = tile.components[c];
49929          const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
49930          for (; r <= decompositionLevelsCount; r++) {
49931            const resolution = component.resolutions[r];
49932            const sizeInImageScale = precinctsSizes.components[c].resolutions[r];
49933            const k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
49934            if (k === null) {
49935              continue;
49936            }
49937            for (; l < layersCount;) {
49938              const packet = createPacket(resolution, k, l);
49939              l++;
49940              return packet;
49941            }
49942            l = 0;
49943          }
49944          r = 0;
49945        }
49946        c = 0;
49947      }
49948      px = 0;
49949    }
49950    throw new JpxError("Out of packets");
49951  };
49952}
49953function ComponentPositionResolutionLayerIterator(context) {
49954  const siz = context.SIZ;
49955  const tileIndex = context.currentTile.index;
49956  const tile = context.tiles[tileIndex];
49957  const layersCount = tile.codingStyleDefaultParameters.layersCount;
49958  const componentsCount = siz.Csiz;
49959  const precinctsSizes = getPrecinctSizesInImageScale(tile);
49960  let l = 0,
49961    r = 0,
49962    c = 0,
49963    px = 0,
49964    py = 0;
49965  this.nextPacket = function JpxImage_nextPacket() {
49966    for (; c < componentsCount; ++c) {
49967      const component = tile.components[c];
49968      const precinctsIterationSizes = precinctsSizes.components[c];
49969      const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
49970      for (; py < precinctsIterationSizes.maxNumHigh; py++) {
49971        for (; px < precinctsIterationSizes.maxNumWide; px++) {
49972          for (; r <= decompositionLevelsCount; r++) {
49973            const resolution = component.resolutions[r];
49974            const sizeInImageScale = precinctsIterationSizes.resolutions[r];
49975            const k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
49976            if (k === null) {
49977              continue;
49978            }
49979            for (; l < layersCount;) {
49980              const packet = createPacket(resolution, k, l);
49981              l++;
49982              return packet;
49983            }
49984            l = 0;
49985          }
49986          r = 0;
49987        }
49988        px = 0;
49989      }
49990      py = 0;
49991    }
49992    throw new JpxError("Out of packets");
49993  };
49994}
49995function getPrecinctIndexIfExist(pxIndex, pyIndex, sizeInImageScale, precinctIterationSizes, resolution) {
49996  const posX = pxIndex * precinctIterationSizes.minWidth;
49997  const posY = pyIndex * precinctIterationSizes.minHeight;
49998  if (posX % sizeInImageScale.width !== 0 || posY % sizeInImageScale.height !== 0) {
49999    return null;
50000  }
50001  const startPrecinctRowIndex = posY / sizeInImageScale.width * resolution.precinctParameters.numprecinctswide;
50002  return posX / sizeInImageScale.height + startPrecinctRowIndex;
50003}
50004function getPrecinctSizesInImageScale(tile) {
50005  const componentsCount = tile.components.length;
50006  let minWidth = Number.MAX_VALUE;
50007  let minHeight = Number.MAX_VALUE;
50008  let maxNumWide = 0;
50009  let maxNumHigh = 0;
50010  const sizePerComponent = new Array(componentsCount);
50011  for (let c = 0; c < componentsCount; c++) {
50012    const component = tile.components[c];
50013    const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
50014    const sizePerResolution = new Array(decompositionLevelsCount + 1);
50015    let minWidthCurrentComponent = Number.MAX_VALUE;
50016    let minHeightCurrentComponent = Number.MAX_VALUE;
50017    let maxNumWideCurrentComponent = 0;
50018    let maxNumHighCurrentComponent = 0;
50019    let scale = 1;
50020    for (let r = decompositionLevelsCount; r >= 0; --r) {
50021      const resolution = component.resolutions[r];
50022      const widthCurrentResolution = scale * resolution.precinctParameters.precinctWidth;
50023      const heightCurrentResolution = scale * resolution.precinctParameters.precinctHeight;
50024      minWidthCurrentComponent = Math.min(minWidthCurrentComponent, widthCurrentResolution);
50025      minHeightCurrentComponent = Math.min(minHeightCurrentComponent, heightCurrentResolution);
50026      maxNumWideCurrentComponent = Math.max(maxNumWideCurrentComponent, resolution.precinctParameters.numprecinctswide);
50027      maxNumHighCurrentComponent = Math.max(maxNumHighCurrentComponent, resolution.precinctParameters.numprecinctshigh);
50028      sizePerResolution[r] = {
50029        width: widthCurrentResolution,
50030        height: heightCurrentResolution
50031      };
50032      scale <<= 1;
50033    }
50034    minWidth = Math.min(minWidth, minWidthCurrentComponent);
50035    minHeight = Math.min(minHeight, minHeightCurrentComponent);
50036    maxNumWide = Math.max(maxNumWide, maxNumWideCurrentComponent);
50037    maxNumHigh = Math.max(maxNumHigh, maxNumHighCurrentComponent);
50038    sizePerComponent[c] = {
50039      resolutions: sizePerResolution,
50040      minWidth: minWidthCurrentComponent,
50041      minHeight: minHeightCurrentComponent,
50042      maxNumWide: maxNumWideCurrentComponent,
50043      maxNumHigh: maxNumHighCurrentComponent
50044    };
50045  }
50046  return {
50047    components: sizePerComponent,
50048    minWidth,
50049    minHeight,
50050    maxNumWide,
50051    maxNumHigh
50052  };
50053}
50054function buildPackets(context) {
50055  const siz = context.SIZ;
50056  const tileIndex = context.currentTile.index;
50057  const tile = context.tiles[tileIndex];
50058  const componentsCount = siz.Csiz;
50059  for (let c = 0; c < componentsCount; c++) {
50060    const component = tile.components[c];
50061    const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
50062    const resolutions = [];
50063    const subbands = [];
50064    for (let r = 0; r <= decompositionLevelsCount; r++) {
50065      const blocksDimensions = getBlocksDimensions(context, component, r);
50066      const resolution = {};
50067      const scale = 1 << decompositionLevelsCount - r;
50068      resolution.trx0 = Math.ceil(component.tcx0 / scale);
50069      resolution.try0 = Math.ceil(component.tcy0 / scale);
50070      resolution.trx1 = Math.ceil(component.tcx1 / scale);
50071      resolution.try1 = Math.ceil(component.tcy1 / scale);
50072      resolution.resLevel = r;
50073      buildPrecincts(context, resolution, blocksDimensions);
50074      resolutions.push(resolution);
50075      let subband;
50076      if (r === 0) {
50077        subband = {};
50078        subband.type = "LL";
50079        subband.tbx0 = Math.ceil(component.tcx0 / scale);
50080        subband.tby0 = Math.ceil(component.tcy0 / scale);
50081        subband.tbx1 = Math.ceil(component.tcx1 / scale);
50082        subband.tby1 = Math.ceil(component.tcy1 / scale);
50083        subband.resolution = resolution;
50084        buildCodeblocks(context, subband, blocksDimensions);
50085        subbands.push(subband);
50086        resolution.subbands = [subband];
50087      } else {
50088        const bscale = 1 << decompositionLevelsCount - r + 1;
50089        const resolutionSubbands = [];
50090        subband = {};
50091        subband.type = "HL";
50092        subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
50093        subband.tby0 = Math.ceil(component.tcy0 / bscale);
50094        subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
50095        subband.tby1 = Math.ceil(component.tcy1 / bscale);
50096        subband.resolution = resolution;
50097        buildCodeblocks(context, subband, blocksDimensions);
50098        subbands.push(subband);
50099        resolutionSubbands.push(subband);
50100        subband = {};
50101        subband.type = "LH";
50102        subband.tbx0 = Math.ceil(component.tcx0 / bscale);
50103        subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
50104        subband.tbx1 = Math.ceil(component.tcx1 / bscale);
50105        subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
50106        subband.resolution = resolution;
50107        buildCodeblocks(context, subband, blocksDimensions);
50108        subbands.push(subband);
50109        resolutionSubbands.push(subband);
50110        subband = {};
50111        subband.type = "HH";
50112        subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
50113        subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
50114        subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
50115        subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
50116        subband.resolution = resolution;
50117        buildCodeblocks(context, subband, blocksDimensions);
50118        subbands.push(subband);
50119        resolutionSubbands.push(subband);
50120        resolution.subbands = resolutionSubbands;
50121      }
50122    }
50123    component.resolutions = resolutions;
50124    component.subbands = subbands;
50125  }
50126  const progressionOrder = tile.codingStyleDefaultParameters.progressionOrder;
50127  switch (progressionOrder) {
50128    case 0:
50129      tile.packetsIterator = new LayerResolutionComponentPositionIterator(context);
50130      break;
50131    case 1:
50132      tile.packetsIterator = new ResolutionLayerComponentPositionIterator(context);
50133      break;
50134    case 2:
50135      tile.packetsIterator = new ResolutionPositionComponentLayerIterator(context);
50136      break;
50137    case 3:
50138      tile.packetsIterator = new PositionComponentResolutionLayerIterator(context);
50139      break;
50140    case 4:
50141      tile.packetsIterator = new ComponentPositionResolutionLayerIterator(context);
50142      break;
50143    default:
50144      throw new JpxError(`Unsupported progression order ${progressionOrder}`);
50145  }
50146}
50147function parseTilePackets(context, data, offset, dataLength) {
50148  let position = 0;
50149  let buffer,
50150    bufferSize = 0,
50151    skipNextBit = false;
50152  function readBits(count) {
50153    while (bufferSize < count) {
50154      const b = data[offset + position];
50155      position++;
50156      if (skipNextBit) {
50157        buffer = buffer << 7 | b;
50158        bufferSize += 7;
50159        skipNextBit = false;
50160      } else {
50161        buffer = buffer << 8 | b;
50162        bufferSize += 8;
50163      }
50164      if (b === 0xff) {
50165        skipNextBit = true;
50166      }
50167    }
50168    bufferSize -= count;
50169    return buffer >>> bufferSize & (1 << count) - 1;
50170  }
50171  function skipMarkerIfEqual(value) {
50172    if (data[offset + position - 1] === 0xff && data[offset + position] === value) {
50173      skipBytes(1);
50174      return true;
50175    } else if (data[offset + position] === 0xff && data[offset + position + 1] === value) {
50176      skipBytes(2);
50177      return true;
50178    }
50179    return false;
50180  }
50181  function skipBytes(count) {
50182    position += count;
50183  }
50184  function alignToByte() {
50185    bufferSize = 0;
50186    if (skipNextBit) {
50187      position++;
50188      skipNextBit = false;
50189    }
50190  }
50191  function readCodingpasses() {
50192    if (readBits(1) === 0) {
50193      return 1;
50194    }
50195    if (readBits(1) === 0) {
50196      return 2;
50197    }
50198    let value = readBits(2);
50199    if (value < 3) {
50200      return value + 3;
50201    }
50202    value = readBits(5);
50203    if (value < 31) {
50204      return value + 6;
50205    }
50206    value = readBits(7);
50207    return value + 37;
50208  }
50209  const tileIndex = context.currentTile.index;
50210  const tile = context.tiles[tileIndex];
50211  const sopMarkerUsed = context.COD.sopMarkerUsed;
50212  const ephMarkerUsed = context.COD.ephMarkerUsed;
50213  const packetsIterator = tile.packetsIterator;
50214  while (position < dataLength) {
50215    alignToByte();
50216    if (sopMarkerUsed && skipMarkerIfEqual(0x91)) {
50217      skipBytes(4);
50218    }
50219    const packet = packetsIterator.nextPacket();
50220    if (!readBits(1)) {
50221      continue;
50222    }
50223    const layerNumber = packet.layerNumber,
50224      queue = [];
50225    let codeblock;
50226    for (let i = 0, ii = packet.codeblocks.length; i < ii; i++) {
50227      codeblock = packet.codeblocks[i];
50228      let precinct = codeblock.precinct;
50229      const codeblockColumn = codeblock.cbx - precinct.cbxMin;
50230      const codeblockRow = codeblock.cby - precinct.cbyMin;
50231      let codeblockIncluded = false;
50232      let firstTimeInclusion = false;
50233      let valueReady, zeroBitPlanesTree;
50234      if (codeblock.included !== undefined) {
50235        codeblockIncluded = !!readBits(1);
50236      } else {
50237        precinct = codeblock.precinct;
50238        let inclusionTree;
50239        if (precinct.inclusionTree !== undefined) {
50240          inclusionTree = precinct.inclusionTree;
50241        } else {
50242          const width = precinct.cbxMax - precinct.cbxMin + 1;
50243          const height = precinct.cbyMax - precinct.cbyMin + 1;
50244          inclusionTree = new InclusionTree(width, height, layerNumber);
50245          zeroBitPlanesTree = new TagTree(width, height);
50246          precinct.inclusionTree = inclusionTree;
50247          precinct.zeroBitPlanesTree = zeroBitPlanesTree;
50248          for (let l = 0; l < layerNumber; l++) {
50249            if (readBits(1) !== 0) {
50250              throw new JpxError("Invalid tag tree");
50251            }
50252          }
50253        }
50254        if (inclusionTree.reset(codeblockColumn, codeblockRow, layerNumber)) {
50255          while (true) {
50256            if (readBits(1)) {
50257              valueReady = !inclusionTree.nextLevel();
50258              if (valueReady) {
50259                codeblock.included = true;
50260                codeblockIncluded = firstTimeInclusion = true;
50261                break;
50262              }
50263            } else {
50264              inclusionTree.incrementValue(layerNumber);
50265              break;
50266            }
50267          }
50268        }
50269      }
50270      if (!codeblockIncluded) {
50271        continue;
50272      }
50273      if (firstTimeInclusion) {
50274        zeroBitPlanesTree = precinct.zeroBitPlanesTree;
50275        zeroBitPlanesTree.reset(codeblockColumn, codeblockRow);
50276        while (true) {
50277          if (readBits(1)) {
50278            valueReady = !zeroBitPlanesTree.nextLevel();
50279            if (valueReady) {
50280              break;
50281            }
50282          } else {
50283            zeroBitPlanesTree.incrementValue();
50284          }
50285        }
50286        codeblock.zeroBitPlanes = zeroBitPlanesTree.value;
50287      }
50288      const codingpasses = readCodingpasses();
50289      while (readBits(1)) {
50290        codeblock.Lblock++;
50291      }
50292      const codingpassesLog2 = (0, _core_utils.log2)(codingpasses);
50293      const bits = (codingpasses < 1 << codingpassesLog2 ? codingpassesLog2 - 1 : codingpassesLog2) + codeblock.Lblock;
50294      const codedDataLength = readBits(bits);
50295      queue.push({
50296        codeblock,
50297        codingpasses,
50298        dataLength: codedDataLength
50299      });
50300    }
50301    alignToByte();
50302    if (ephMarkerUsed) {
50303      skipMarkerIfEqual(0x92);
50304    }
50305    while (queue.length > 0) {
50306      const packetItem = queue.shift();
50307      codeblock = packetItem.codeblock;
50308      if (codeblock.data === undefined) {
50309        codeblock.data = [];
50310      }
50311      codeblock.data.push({
50312        data,
50313        start: offset + position,
50314        end: offset + position + packetItem.dataLength,
50315        codingpasses: packetItem.codingpasses
50316      });
50317      position += packetItem.dataLength;
50318    }
50319  }
50320  return position;
50321}
50322function copyCoefficients(coefficients, levelWidth, levelHeight, subband, delta, mb, reversible, segmentationSymbolUsed, resetContextProbabilities) {
50323  const x0 = subband.tbx0;
50324  const y0 = subband.tby0;
50325  const width = subband.tbx1 - subband.tbx0;
50326  const codeblocks = subband.codeblocks;
50327  const right = subband.type.charAt(0) === "H" ? 1 : 0;
50328  const bottom = subband.type.charAt(1) === "H" ? levelWidth : 0;
50329  for (let i = 0, ii = codeblocks.length; i < ii; ++i) {
50330    const codeblock = codeblocks[i];
50331    const blockWidth = codeblock.tbx1_ - codeblock.tbx0_;
50332    const blockHeight = codeblock.tby1_ - codeblock.tby0_;
50333    if (blockWidth === 0 || blockHeight === 0) {
50334      continue;
50335    }
50336    if (codeblock.data === undefined) {
50337      continue;
50338    }
50339    const bitModel = new BitModel(blockWidth, blockHeight, codeblock.subbandType, codeblock.zeroBitPlanes, mb);
50340    let currentCodingpassType = 2;
50341    const data = codeblock.data;
50342    let totalLength = 0,
50343      codingpasses = 0;
50344    let j, jj, dataItem;
50345    for (j = 0, jj = data.length; j < jj; j++) {
50346      dataItem = data[j];
50347      totalLength += dataItem.end - dataItem.start;
50348      codingpasses += dataItem.codingpasses;
50349    }
50350    const encodedData = new Uint8Array(totalLength);
50351    let position = 0;
50352    for (j = 0, jj = data.length; j < jj; j++) {
50353      dataItem = data[j];
50354      const chunk = dataItem.data.subarray(dataItem.start, dataItem.end);
50355      encodedData.set(chunk, position);
50356      position += chunk.length;
50357    }
50358    const decoder = new _arithmetic_decoder.ArithmeticDecoder(encodedData, 0, totalLength);
50359    bitModel.setDecoder(decoder);
50360    for (j = 0; j < codingpasses; j++) {
50361      switch (currentCodingpassType) {
50362        case 0:
50363          bitModel.runSignificancePropagationPass();
50364          break;
50365        case 1:
50366          bitModel.runMagnitudeRefinementPass();
50367          break;
50368        case 2:
50369          bitModel.runCleanupPass();
50370          if (segmentationSymbolUsed) {
50371            bitModel.checkSegmentationSymbol();
50372          }
50373          break;
50374      }
50375      if (resetContextProbabilities) {
50376        bitModel.reset();
50377      }
50378      currentCodingpassType = (currentCodingpassType + 1) % 3;
50379    }
50380    let offset = codeblock.tbx0_ - x0 + (codeblock.tby0_ - y0) * width;
50381    const sign = bitModel.coefficentsSign;
50382    const magnitude = bitModel.coefficentsMagnitude;
50383    const bitsDecoded = bitModel.bitsDecoded;
50384    const magnitudeCorrection = reversible ? 0 : 0.5;
50385    let k, n, nb;
50386    position = 0;
50387    const interleave = subband.type !== "LL";
50388    for (j = 0; j < blockHeight; j++) {
50389      const row = offset / width | 0;
50390      const levelOffset = 2 * row * (levelWidth - width) + right + bottom;
50391      for (k = 0; k < blockWidth; k++) {
50392        n = magnitude[position];
50393        if (n !== 0) {
50394          n = (n + magnitudeCorrection) * delta;
50395          if (sign[position] !== 0) {
50396            n = -n;
50397          }
50398          nb = bitsDecoded[position];
50399          const pos = interleave ? levelOffset + (offset << 1) : offset;
50400          
50400coefficients[pos] = reversible && nb >= mb ? n : n * (1 << mb - nb);
vendor: 8,899 bytes, lines 50400-50677
50400
50401        }
50402        offset++;
50403        position++;
50404      }
50405      offset += width - blockWidth;
50406    }
50407  }
50408}
50409function transformTile(context, tile, c) {
50410  const component = tile.components[c];
50411  const codingStyleParameters = component.codingStyleParameters;
50412  const quantizationParameters = component.quantizationParameters;
50413  const decompositionLevelsCount = codingStyleParameters.decompositionLevelsCount;
50414  const spqcds = quantizationParameters.SPqcds;
50415  const scalarExpounded = quantizationParameters.scalarExpounded;
50416  const guardBits = quantizationParameters.guardBits;
50417  const segmentationSymbolUsed = codingStyleParameters.segmentationSymbolUsed;
50418  const resetContextProbabilities = codingStyleParameters.resetContextProbabilities;
50419  const precision = context.components[c].precision;
50420  const reversible = codingStyleParameters.reversibleTransformation;
50421  const transform = reversible ? new ReversibleTransform() : new IrreversibleTransform();
50422  const subbandCoefficients = [];
50423  let b = 0;
50424  for (let i = 0; i <= decompositionLevelsCount; i++) {
50425    const resolution = component.resolutions[i];
50426    const width = resolution.trx1 - resolution.trx0;
50427    const height = resolution.try1 - resolution.try0;
50428    const coefficients = new Float32Array(width * height);
50429    for (let j = 0, jj = resolution.subbands.length; j < jj; j++) {
50430      let mu, epsilon;
50431      if (!scalarExpounded) {
50432        mu = spqcds[0].mu;
50433        epsilon = spqcds[0].epsilon + (i > 0 ? 1 - i : 0);
50434      } else {
50435        mu = spqcds[b].mu;
50436        epsilon = spqcds[b].epsilon;
50437        b++;
50438      }
50439      const subband = resolution.subbands[j];
50440      const gainLog2 = SubbandsGainLog2[subband.type];
50441      const delta = reversible ? 1 : 2 ** (precision + gainLog2 - epsilon) * (1 + mu / 2048);
50442      const mb = guardBits + epsilon - 1;
50443      copyCoefficients(coefficients, width, height, subband, delta, mb, reversible, segmentationSymbolUsed, resetContextProbabilities);
50444    }
50445    subbandCoefficients.push({
50446      width,
50447      height,
50448      items: coefficients
50449    });
50450  }
50451  const result = transform.calculate(subbandCoefficients, component.tcx0, component.tcy0);
50452  return {
50453    left: component.tcx0,
50454    top: component.tcy0,
50455    width: result.width,
50456    height: result.height,
50457    items: result.items
50458  };
50459}
50460function transformComponents(context) {
50461  const siz = context.SIZ;
50462  const components = context.components;
50463  const componentsCount = siz.Csiz;
50464  const resultImages = [];
50465  for (let i = 0, ii = context.tiles.length; i < ii; i++) {
50466    const tile = context.tiles[i];
50467    const transformedTiles = [];
50468    for (let c = 0; c < componentsCount; c++) {
50469      transformedTiles[c] = transformTile(context, tile, c);
50470    }
50471    const tile0 = transformedTiles[0];
50472    const out = new Uint8ClampedArray(tile0.items.length * componentsCount);
50473    const result = {
50474      left: tile0.left,
50475      top: tile0.top,
50476      width: tile0.width,
50477      height: tile0.height,
50478      items: out
50479    };
50480    let shift, offset;
50481    let pos = 0,
50482      j,
50483      jj,
50484      y0,
50485      y1,
50486      y2;
50487    if (tile.codingStyleDefaultParameters.multipleComponentTransform) {
50488      const fourComponents = componentsCount === 4;
50489      const y0items = transformedTiles[0].items;
50490      const y1items = transformedTiles[1].items;
50491      const y2items = transformedTiles[2].items;
50492      const y3items = fourComponents ? transformedTiles[3].items : null;
50493      shift = components[0].precision - 8;
50494      offset = (128 << shift) + 0.5;
50495      const component0 = tile.components[0];
50496      const alpha01 = componentsCount - 3;
50497      jj = y0items.length;
50498      if (!component0.codingStyleParameters.reversibleTransformation) {
50499        for (j = 0; j < jj; j++, pos += alpha01) {
50500          y0 = y0items[j] + offset;
50501          y1 = y1items[j];
50502          y2 = y2items[j];
50503          out[pos++] = y0 + 1.402 * y2 >> shift;
50504          out[pos++] = y0 - 0.34413 * y1 - 0.71414 * y2 >> shift;
50505          out[pos++] = y0 + 1.772 * y1 >> shift;
50506        }
50507      } else {
50508        for (j = 0; j < jj; j++, pos += alpha01) {
50509          y0 = y0items[j] + offset;
50510          y1 = y1items[j];
50511          y2 = y2items[j];
50512          const g = y0 - (y2 + y1 >> 2);
50513          out[pos++] = g + y2 >> shift;
50514          out[pos++] = g >> shift;
50515          out[pos++] = g + y1 >> shift;
50516        }
50517      }
50518      if (fourComponents) {
50519        for (j = 0, pos = 3; j < jj; j++, pos += 4) {
50520          out[pos] = y3items[j] + offset >> shift;
50521        }
50522      }
50523    } else {
50524      for (let c = 0; c < componentsCount; c++) {
50525        const items = transformedTiles[c].items;
50526        shift = components[c].precision - 8;
50527        offset = (128 << shift) + 0.5;
50528        for (pos = c, j = 0, jj = items.length; j < jj; j++) {
50529          out[pos] = items[j] + offset >> shift;
50530          pos += componentsCount;
50531        }
50532      }
50533    }
50534    resultImages.push(result);
50535  }
50536  return resultImages;
50537}
50538function initializeTile(context, tileIndex) {
50539  const siz = context.SIZ;
50540  const componentsCount = siz.Csiz;
50541  const tile = context.tiles[tileIndex];
50542  for (let c = 0; c < componentsCount; c++) {
50543    const component = tile.components[c];
50544    const qcdOrQcc = context.currentTile.QCC[c] !== undefined ? context.currentTile.QCC[c] : context.currentTile.QCD;
50545    component.quantizationParameters = qcdOrQcc;
50546    const codOrCoc = context.currentTile.COC[c] !== undefined ? context.currentTile.COC[c] : context.currentTile.COD;
50547    component.codingStyleParameters = codOrCoc;
50548  }
50549  tile.codingStyleDefaultParameters = context.currentTile.COD;
50550}
50551class TagTree {
50552  constructor(width, height) {
50553    const levelsLength = (0, _core_utils.log2)(Math.max(width, height)) + 1;
50554    this.levels = [];
50555    for (let i = 0; i < levelsLength; i++) {
50556      const level = {
50557        width,
50558        height,
50559        items: []
50560      };
50561      this.levels.push(level);
50562      width = Math.ceil(width / 2);
50563      height = Math.ceil(height / 2);
50564    }
50565  }
50566  reset(i, j) {
50567    let currentLevel = 0,
50568      value = 0,
50569      level;
50570    while (currentLevel < this.levels.length) {
50571      level = this.levels[currentLevel];
50572      const index = i + j * level.width;
50573      if (level.items[index] !== undefined) {
50574        value = level.items[index];
50575        break;
50576      }
50577      level.index = index;
50578      i >>= 1;
50579      j >>= 1;
50580      currentLevel++;
50581    }
50582    currentLevel--;
50583    level = this.levels[currentLevel];
50584    level.items[level.index] = value;
50585    this.currentLevel = currentLevel;
50586    delete this.value;
50587  }
50588  incrementValue() {
50589    const level = this.levels[this.currentLevel];
50590    level.items[level.index]++;
50591  }
50592  nextLevel() {
50593    let currentLevel = this.currentLevel;
50594    let level = this.levels[currentLevel];
50595    const value = level.items[level.index];
50596    currentLevel--;
50597    if (currentLevel < 0) {
50598      this.value = value;
50599      return false;
50600    }
50601    this.currentLevel = currentLevel;
50602    level = this.levels[currentLevel];
50603    level.items[level.index] = value;
50604    return true;
50605  }
50606}
50607class InclusionTree {
50608  constructor(width, height, defaultValue) {
50609    const levelsLength = (0, _core_utils.log2)(Math.max(width, height)) + 1;
50610    this.levels = [];
50611    for (let i = 0; i < levelsLength; i++) {
50612      const items = new Uint8Array(width * height);
50613      for (let j = 0, jj = items.length; j < jj; j++) {
50614        items[j] = defaultValue;
50615      }
50616      const level = {
50617        width,
50618        height,
50619        items
50620      };
50621      this.levels.push(level);
50622      width = Math.ceil(width / 2);
50623      height = Math.ceil(height / 2);
50624    }
50625  }
50626  reset(i, j, stopValue) {
50627    let currentLevel = 0;
50628    while (currentLevel < this.levels.length) {
50629      const level = this.levels[currentLevel];
50630      const index = i + j * level.width;
50631      level.index = index;
50632      const value = level.items[index];
50633      if (value === 0xff) {
50634        break;
50635      }
50636      if (value > stopValue) {
50637        this.currentLevel = currentLevel;
50638        this.propagateValues();
50639        return false;
50640      }
50641      i >>= 1;
50642      j >>= 1;
50643      currentLevel++;
50644    }
50645    this.currentLevel = currentLevel - 1;
50646    return true;
50647  }
50648  incrementValue(stopValue) {
50649    const level = this.levels[this.currentLevel];
50650    level.items[level.index] = stopValue + 1;
50651    this.propagateValues();
50652  }
50653  propagateValues() {
50654    let levelIndex = this.currentLevel;
50655    let level = this.levels[levelIndex];
50656    const currentValue = level.items[level.index];
50657    while (--levelIndex >= 0) {
50658      level = this.levels[levelIndex];
50659      level.items[level.index] = currentValue;
50660    }
50661  }
50662  nextLevel() {
50663    let currentLevel = this.currentLevel;
50664    let level = this.levels[currentLevel];
50665    const value = level.items[level.index];
50666    level.items[level.index] = 0xff;
50667    currentLevel--;
50668    if (currentLevel < 0) {
50669      return false;
50670    }
50671    this.currentLevel = currentLevel;
50672    level = this.levels[currentLevel];
50673    level.items[level.index] = value;
50674    return true;
50675  }
50676}
50677c
vendor: 62,892 bytes, lines 50677-52494
50677lass BitModel {
50678  static UNIFORM_CONTEXT = 17;
50679  static RUNLENGTH_CONTEXT = 18;
50680  static LLAndLHContextsLabel = new Uint8Array([0, 5, 8, 0, 3, 7, 8, 0, 4, 7, 8, 0, 0, 0, 0, 0, 1, 6, 8, 0, 3, 7, 8, 0, 4, 7, 8, 0, 0, 0, 0, 0, 2, 6, 8, 0, 3, 7, 8, 0, 4, 7, 8, 0, 0, 0, 0, 0, 2, 6, 8, 0, 3, 7, 8, 0, 4, 7, 8, 0, 0, 0, 0, 0, 2, 6, 8, 0, 3, 7, 8, 0, 4, 7, 8]);
50681  static HLContextLabel = new Uint8Array([0, 3, 4, 0, 5, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 1, 3, 4, 0, 6, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 2, 3, 4, 0, 6, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 2, 3, 4, 0, 6, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 2, 3, 4, 0, 6, 7, 7, 0, 8, 8, 8]);
50682  static HHContextLabel = new Uint8Array([0, 1, 2, 0, 1, 2, 2, 0, 2, 2, 2, 0, 0, 0, 0, 0, 3, 4, 5, 0, 4, 5, 5, 0, 5, 5, 5, 0, 0, 0, 0, 0, 6, 7, 7, 0, 7, 7, 7, 0, 7, 7, 7, 0, 0, 0, 0, 0, 8, 8, 8, 0, 8, 8, 8, 0, 8, 8, 8, 0, 0, 0, 0, 0, 8, 8, 8, 0, 8, 8, 8, 0, 8, 8, 8]);
50683  constructor(width, height, subband, zeroBitPlanes, mb) {
50684    this.width = width;
50685    this.height = height;
50686    let contextLabelTable;
50687    if (subband === "HH") {
50688      contextLabelTable = BitModel.HHContextLabel;
50689    } else if (subband === "HL") {
50690      contextLabelTable = BitModel.HLContextLabel;
50691    } else {
50692      contextLabelTable = BitModel.LLAndLHContextsLabel;
50693    }
50694    this.contextLabelTable = contextLabelTable;
50695    const coefficientCount = width * height;
50696    this.neighborsSignificance = new Uint8Array(coefficientCount);
50697    this.coefficentsSign = new Uint8Array(coefficientCount);
50698    let coefficentsMagnitude;
50699    if (mb > 14) {
50700      coefficentsMagnitude = new Uint32Array(coefficientCount);
50701    } else if (mb > 6) {
50702      coefficentsMagnitude = new Uint16Array(coefficientCount);
50703    } else {
50704      coefficentsMagnitude = new Uint8Array(coefficientCount);
50705    }
50706    this.coefficentsMagnitude = coefficentsMagnitude;
50707    this.processingFlags = new Uint8Array(coefficientCount);
50708    const bitsDecoded = new Uint8Array(coefficientCount);
50709    if (zeroBitPlanes !== 0) {
50710      for (let i = 0; i < coefficientCount; i++) {
50711        bitsDecoded[i] = zeroBitPlanes;
50712      }
50713    }
50714    this.bitsDecoded = bitsDecoded;
50715    this.reset();
50716  }
50717  setDecoder(decoder) {
50718    this.decoder = decoder;
50719  }
50720  reset() {
50721    this.contexts = new Int8Array(19);
50722    this.contexts[0] = 4 << 1 | 0;
50723    this.contexts[BitModel.UNIFORM_CONTEXT] = 46 << 1 | 0;
50724    this.contexts[BitModel.RUNLENGTH_CONTEXT] = 3 << 1 | 0;
50725  }
50726  setNeighborsSignificance(row, column, index) {
50727    const neighborsSignificance = this.neighborsSignificance;
50728    const width = this.width,
50729      height = this.height;
50730    const left = column > 0;
50731    const right = column + 1 < width;
50732    let i;
50733    if (row > 0) {
50734      i = index - width;
50735      if (left) {
50736        neighborsSignificance[i - 1] += 0x10;
50737      }
50738      if (right) {
50739        neighborsSignificance[i + 1] += 0x10;
50740      }
50741      neighborsSignificance[i] += 0x04;
50742    }
50743    if (row + 1 < height) {
50744      i = index + width;
50745      if (left) {
50746        neighborsSignificance[i - 1] += 0x10;
50747      }
50748      if (right) {
50749        neighborsSignificance[i + 1] += 0x10;
50750      }
50751      neighborsSignificance[i] += 0x04;
50752    }
50753    if (left) {
50754      neighborsSignificance[index - 1] += 0x01;
50755    }
50756    if (right) {
50757      neighborsSignificance[index + 1] += 0x01;
50758    }
50759    neighborsSignificance[index] |= 0x80;
50760  }
50761  runSignificancePropagationPass() {
50762    const decoder = this.decoder;
50763    const width = this.width,
50764      height = this.height;
50765    const coefficentsMagnitude = this.coefficentsMagnitude;
50766    const coefficentsSign = this.coefficentsSign;
50767    const neighborsSignificance = this.neighborsSignificance;
50768    const processingFlags = this.processingFlags;
50769    const contexts = this.contexts;
50770    const labels = this.contextLabelTable;
50771    const bitsDecoded = this.bitsDecoded;
50772    const processedInverseMask = ~1;
50773    const processedMask = 1;
50774    const firstMagnitudeBitMask = 2;
50775    for (let i0 = 0; i0 < height; i0 += 4) {
50776      for (let j = 0; j < width; j++) {
50777        let index = i0 * width + j;
50778        for (let i1 = 0; i1 < 4; i1++, index += width) {
50779          const i = i0 + i1;
50780          if (i >= height) {
50781            break;
50782          }
50783          processingFlags[index] &= processedInverseMask;
50784          if (coefficentsMagnitude[index] || !neighborsSignificance[index]) {
50785            continue;
50786          }
50787          const contextLabel = labels[neighborsSignificance[index]];
50788          const decision = decoder.readBit(contexts, contextLabel);
50789          if (decision) {
50790            const sign = this.decodeSignBit(i, j, index);
50791            coefficentsSign[index] = sign;
50792            coefficentsMagnitude[index] = 1;
50793            this.setNeighborsSignificance(i, j, index);
50794            processingFlags[index] |= firstMagnitudeBitMask;
50795          }
50796          bitsDecoded[index]++;
50797          processingFlags[index] |= processedMask;
50798        }
50799      }
50800    }
50801  }
50802  decodeSignBit(row, column, index) {
50803    const width = this.width,
50804      height = this.height;
50805    const coefficentsMagnitude = this.coefficentsMagnitude;
50806    const coefficentsSign = this.coefficentsSign;
50807    let contribution, sign0, sign1, significance1;
50808    let contextLabel, decoded;
50809    significance1 = column > 0 && coefficentsMagnitude[index - 1] !== 0;
50810    if (column + 1 < width && coefficentsMagnitude[index + 1] !== 0) {
50811      sign1 = coefficentsSign[index + 1];
50812      if (significance1) {
50813        sign0 = coefficentsSign[index - 1];
50814        contribution = 1 - sign1 - sign0;
50815      } else {
50816        contribution = 1 - sign1 - sign1;
50817      }
50818    } else if (significance1) {
50819      sign0 = coefficentsSign[index - 1];
50820      contribution = 1 - sign0 - sign0;
50821    } else {
50822      contribution = 0;
50823    }
50824    const horizontalContribution = 3 * contribution;
50825    significance1 = row > 0 && coefficentsMagnitude[index - width] !== 0;
50826    if (row + 1 < height && coefficentsMagnitude[index + width] !== 0) {
50827      sign1 = coefficentsSign[index + width];
50828      if (significance1) {
50829        sign0 = coefficentsSign[index - width];
50830        contribution = 1 - sign1 - sign0 + horizontalContribution;
50831      } else {
50832        contribution = 1 - sign1 - sign1 + horizontalContribution;
50833      }
50834    } else if (significance1) {
50835      sign0 = coefficentsSign[index - width];
50836      contribution = 1 - sign0 - sign0 + horizontalContribution;
50837    } else {
50838      contribution = horizontalContribution;
50839    }
50840    if (contribution >= 0) {
50841      contextLabel = 9 + contribution;
50842      decoded = this.decoder.readBit(this.contexts, contextLabel);
50843    } else {
50844      contextLabel = 9 - contribution;
50845      decoded = this.decoder.readBit(this.contexts, contextLabel) ^ 1;
50846    }
50847    return decoded;
50848  }
50849  runMagnitudeRefinementPass() {
50850    const decoder = this.decoder;
50851    const width = this.width,
50852      height = this.height;
50853    const coefficentsMagnitude = this.coefficentsMagnitude;
50854    const neighborsSignificance = this.neighborsSignificance;
50855    const contexts = this.contexts;
50856    const bitsDecoded = this.bitsDecoded;
50857    const processingFlags = this.processingFlags;
50858    const processedMask = 1;
50859    const firstMagnitudeBitMask = 2;
50860    const length = width * height;
50861    const width4 = width * 4;
50862    for (let index0 = 0, indexNext; index0 < length; index0 = indexNext) {
50863      indexNext = Math.min(length, index0 + width4);
50864      for (let j = 0; j < width; j++) {
50865        for (let index = index0 + j; index < indexNext; index += width) {
50866          if (!coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
50867            continue;
50868          }
50869          let contextLabel = 16;
50870          if ((processingFlags[index] & firstMagnitudeBitMask) !== 0) {
50871            processingFlags[index] ^= firstMagnitudeBitMask;
50872            const significance = neighborsSignificance[index] & 127;
50873            contextLabel = significance === 0 ? 15 : 14;
50874          }
50875          const bit = decoder.readBit(contexts, contextLabel);
50876          coefficentsMagnitude[index] = coefficentsMagnitude[index] << 1 | bit;
50877          bitsDecoded[index]++;
50878          processingFlags[index] |= processedMask;
50879        }
50880      }
50881    }
50882  }
50883  runCleanupPass() {
50884    const decoder = this.decoder;
50885    const width = this.width,
50886      height = this.height;
50887    const neighborsSignificance = this.neighborsSignificance;
50888    const coefficentsMagnitude = this.coefficentsMagnitude;
50889    const coefficentsSign = this.coefficentsSign;
50890    const contexts = this.contexts;
50891    const labels = this.contextLabelTable;
50892    const bitsDecoded = this.bitsDecoded;
50893    const processingFlags = this.processingFlags;
50894    const processedMask = 1;
50895    const firstMagnitudeBitMask = 2;
50896    const oneRowDown = width;
50897    const twoRowsDown = width * 2;
50898    const threeRowsDown = width * 3;
50899    let iNext;
50900    for (let i0 = 0; i0 < height; i0 = iNext) {
50901      iNext = Math.min(i0 + 4, height);
50902      const indexBase = i0 * width;
50903      const checkAllEmpty = i0 + 3 < height;
50904      for (let j = 0; j < width; j++) {
50905        const index0 = indexBase + j;
50906        const allEmpty = checkAllEmpty && processingFlags[index0] === 0 && processingFlags[index0 + oneRowDown] === 0 && processingFlags[index0 + twoRowsDown] === 0 && processingFlags[index0 + threeRowsDown] === 0 && neighborsSignificance[index0] === 0 && neighborsSignificance[index0 + oneRowDown] === 0 && neighborsSignificance[index0 + twoRowsDown] === 0 && neighborsSignificance[index0 + threeRowsDown] === 0;
50907        let i1 = 0,
50908          index = index0;
50909        let i = i0,
50910          sign;
50911        if (allEmpty) {
50912          const hasSignificantCoefficent = decoder.readBit(contexts, BitModel.RUNLENGTH_CONTEXT);
50913          if (!hasSignificantCoefficent) {
50914            bitsDecoded[index0]++;
50915            bitsDecoded[index0 + oneRowDown]++;
50916            bitsDecoded[index0 + twoRowsDown]++;
50917            bitsDecoded[index0 + threeRowsDown]++;
50918            continue;
50919          }
50920          i1 = decoder.readBit(contexts, BitModel.UNIFORM_CONTEXT) << 1 | decoder.readBit(contexts, BitModel.UNIFORM_CONTEXT);
50921          if (i1 !== 0) {
50922            i = i0 + i1;
50923            index += i1 * width;
50924          }
50925          sign = this.decodeSignBit(i, j, index);
50926          coefficentsSign[index] = sign;
50927          coefficentsMagnitude[index] = 1;
50928          this.setNeighborsSignificance(i, j, index);
50929          processingFlags[index] |= firstMagnitudeBitMask;
50930          index = index0;
50931          for (let i2 = i0; i2 <= i; i2++, index += width) {
50932            bitsDecoded[index]++;
50933          }
50934          i1++;
50935        }
50936        for (i = i0 + i1; i < iNext; i++, index += width) {
50937          if (coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
50938            continue;
50939          }
50940          const contextLabel = labels[neighborsSignificance[index]];
50941          const decision = decoder.readBit(contexts, contextLabel);
50942          if (decision === 1) {
50943            sign = this.decodeSignBit(i, j, index);
50944            coefficentsSign[index] = sign;
50945            coefficentsMagnitude[index] = 1;
50946            this.setNeighborsSignificance(i, j, index);
50947            processingFlags[index] |= firstMagnitudeBitMask;
50948          }
50949          bitsDecoded[index]++;
50950        }
50951      }
50952    }
50953  }
50954  checkSegmentationSymbol() {
50955    const decoder = this.decoder;
50956    const contexts = this.contexts;
50957    const symbol = decoder.readBit(contexts, BitModel.UNIFORM_CONTEXT) << 3 | decoder.readBit(contexts, BitModel.UNIFORM_CONTEXT) << 2 | decoder.readBit(contexts, BitModel.UNIFORM_CONTEXT) << 1 | decoder.readBit(contexts, BitModel.UNIFORM_CONTEXT);
50958    if (symbol !== 0xa) {
50959      throw new JpxError("Invalid segmentation symbol");
50960    }
50961  }
50962}
50963class Transform {
50964  constructor() {
50965    if (this.constructor === Transform) {
50966      (0, _util.unreachable)("Cannot initialize Transform.");
50967    }
50968  }
50969  calculate(subbands, u0, v0) {
50970    let ll = subbands[0];
50971    for (let i = 1, ii = subbands.length; i < ii; i++) {
50972      ll = this.iterate(ll, subbands[i], u0, v0);
50973    }
50974    return ll;
50975  }
50976  extend(buffer, offset, size) {
50977    let i1 = offset - 1,
50978      j1 = offset + 1;
50979    let i2 = offset + size - 2,
50980      j2 = offset + size;
50981    buffer[i1--] = buffer[j1++];
50982    buffer[j2++] = buffer[i2--];
50983    buffer[i1--] = buffer[j1++];
50984    buffer[j2++] = buffer[i2--];
50985    buffer[i1--] = buffer[j1++];
50986    buffer[j2++] = buffer[i2--];
50987    buffer[i1] = buffer[j1];
50988    buffer[j2] = buffer[i2];
50989  }
50990  filter(x, offset, length) {
50991    (0, _util.unreachable)("Abstract method `filter` called");
50992  }
50993  iterate(ll, hl_lh_hh, u0, v0) {
50994    const llWidth = ll.width,
50995      llHeight = ll.height;
50996    let llItems = ll.items;
50997    const width = hl_lh_hh.width;
50998    const height = hl_lh_hh.height;
50999    const items = hl_lh_hh.items;
51000    let i, j, k, l, u, v;
51001    for (k = 0, i = 0; i < llHeight; i++) {
51002      l = i * 2 * width;
51003      for (j = 0; j < llWidth; j++, k++, l += 2) {
51004        items[l] = llItems[k];
51005      }
51006    }
51007    llItems = ll.items = null;
51008    const bufferPadding = 4;
51009    const rowBuffer = new Float32Array(width + 2 * bufferPadding);
51010    if (width === 1) {
51011      if ((u0 & 1) !== 0) {
51012        for (v = 0, k = 0; v < height; v++, k += width) {
51013          items[k] *= 0.5;
51014        }
51015      }
51016    } else {
51017      for (v = 0, k = 0; v < height; v++, k += width) {
51018        rowBuffer.set(items.subarray(k, k + width), bufferPadding);
51019        this.extend(rowBuffer, bufferPadding, width);
51020        this.filter(rowBuffer, bufferPadding, width);
51021        items.set(rowBuffer.subarray(bufferPadding, bufferPadding + width), k);
51022      }
51023    }
51024    let numBuffers = 16;
51025    const colBuffers = [];
51026    for (i = 0; i < numBuffers; i++) {
51027      colBuffers.push(new Float32Array(height + 2 * bufferPadding));
51028    }
51029    let b,
51030      currentBuffer = 0;
51031    ll = bufferPadding + height;
51032    if (height === 1) {
51033      if ((v0 & 1) !== 0) {
51034        for (u = 0; u < width; u++) {
51035          items[u] *= 0.5;
51036        }
51037      }
51038    } else {
51039      for (u = 0; u < width; u++) {
51040        if (currentBuffer === 0) {
51041          numBuffers = Math.min(width - u, numBuffers);
51042          for (k = u, l = bufferPadding; l < ll; k += width, l++) {
51043            for (b = 0; b < numBuffers; b++) {
51044              colBuffers[b][l] = items[k + b];
51045            }
51046          }
51047          currentBuffer = numBuffers;
51048        }
51049        currentBuffer--;
51050        const buffer = colBuffers[currentBuffer];
51051        this.extend(buffer, bufferPadding, height);
51052        this.filter(buffer, bufferPadding, height);
51053        if (currentBuffer === 0) {
51054          k = u - numBuffers + 1;
51055          for (l = bufferPadding; l < ll; k += width, l++) {
51056            for (b = 0; b < numBuffers; b++) {
51057              items[k + b] = colBuffers[b][l];
51058            }
51059          }
51060        }
51061      }
51062    }
51063    return {
51064      width,
51065      height,
51066      items
51067    };
51068  }
51069}
51070class IrreversibleTransform extends Transform {
51071  filter(x, offset, length) {
51072    const len = length >> 1;
51073    offset |= 0;
51074    let j, n, current, next;
51075    const alpha = -1.586134342059924;
51076    const beta = -0.052980118572961;
51077    const gamma = 0.882911075530934;
51078    const delta = 0.443506852043971;
51079    const K = 1.230174104914001;
51080    const K_ = 1 / K;
51081    j = offset - 3;
51082    for (n = len + 4; n--; j += 2) {
51083      x[j] *= K_;
51084    }
51085    j = offset - 2;
51086    current = delta * x[j - 1];
51087    for (n = len + 3; n--; j += 2) {
51088      next = delta * x[j + 1];
51089      x[j] = K * x[j] - current - next;
51090      if (n--) {
51091        j += 2;
51092        current = delta * x[j + 1];
51093        x[j] = K * x[j] - current - next;
51094      } else {
51095        break;
51096      }
51097    }
51098    j = offset - 1;
51099    current = gamma * x[j - 1];
51100    for (n = len + 2; n--; j += 2) {
51101      next = gamma * x[j + 1];
51102      x[j] -= current + next;
51103      if (n--) {
51104        j += 2;
51105        current = gamma * x[j + 1];
51106        x[j] -= current + next;
51107      } else {
51108        break;
51109      }
51110    }
51111    j = offset;
51112    current = beta * x[j - 1];
51113    for (n = len + 1; n--; j += 2) {
51114      next = beta * x[j + 1];
51115      x[j] -= current + next;
51116      if (n--) {
51117        j += 2;
51118        current = beta * x[j + 1];
51119        x[j] -= current + next;
51120      } else {
51121        break;
51122      }
51123    }
51124    if (len !== 0) {
51125      j = offset + 1;
51126      current = alpha * x[j - 1];
51127      for (n = len; n--; j += 2) {
51128        next = alpha * x[j + 1];
51129        x[j] -= current + next;
51130        if (n--) {
51131          j += 2;
51132          current = alpha * x[j + 1];
51133          x[j] -= current + next;
51134        } else {
51135          break;
51136        }
51137      }
51138    }
51139  }
51140}
51141class ReversibleTransform extends Transform {
51142  filter(x, offset, length) {
51143    const len = length >> 1;
51144    offset |= 0;
51145    let j, n;
51146    for (j = offset, n = len + 1; n--; j += 2) {
51147      x[j] -= x[j - 1] + x[j + 1] + 2 >> 2;
51148    }
51149    for (j = offset + 1, n = len; n--; j += 2) {
51150      x[j] += x[j - 1] + x[j + 1] >> 1;
51151    }
51152  }
51153}
51154
51155/***/ }),
51156/* 31 */
51157/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
51158
51159
51160
51161Object.defineProperty(exports, "__esModule", ({
51162  value: true
51163}));
51164exports.LZWStream = void 0;
51165var _decode_stream = __w_pdfjs_require__(18);
51166class LZWStream extends _decode_stream.DecodeStream {
51167  constructor(str, maybeLength, earlyChange) {
51168    super(maybeLength);
51169    this.str = str;
51170    this.dict = str.dict;
51171    this.cachedData = 0;
51172    this.bitsCached = 0;
51173    const maxLzwDictionarySize = 4096;
51174    const lzwState = {
51175      earlyChange,
51176      codeLength: 9,
51177      nextCode: 258,
51178      dictionaryValues: new Uint8Array(maxLzwDictionarySize),
51179      dictionaryLengths: new Uint16Array(maxLzwDictionarySize),
51180      dictionaryPrevCodes: new Uint16Array(maxLzwDictionarySize),
51181      currentSequence: new Uint8Array(maxLzwDictionarySize),
51182      currentSequenceLength: 0
51183    };
51184    for (let i = 0; i < 256; ++i) {
51185      lzwState.dictionaryValues[i] = i;
51186      lzwState.dictionaryLengths[i] = 1;
51187    }
51188    this.lzwState = lzwState;
51189  }
51190  readBits(n) {
51191    let bitsCached = this.bitsCached;
51192    let cachedData = this.cachedData;
51193    while (bitsCached < n) {
51194      const c = this.str.getByte();
51195      if (c === -1) {
51196        this.eof = true;
51197        return null;
51198      }
51199      cachedData = cachedData << 8 | c;
51200      bitsCached += 8;
51201    }
51202    this.bitsCached = bitsCached -= n;
51203    this.cachedData = cachedData;
51204    this.lastCode = null;
51205    return cachedData >>> bitsCached & (1 << n) - 1;
51206  }
51207  readBlock() {
51208    const blockSize = 512,
51209      decodedSizeDelta = blockSize;
51210    let estimatedDecodedSize = blockSize * 2;
51211    let i, j, q;
51212    const lzwState = this.lzwState;
51213    if (!lzwState) {
51214      return;
51215    }
51216    const earlyChange = lzwState.earlyChange;
51217    let nextCode = lzwState.nextCode;
51218    const dictionaryValues = lzwState.dictionaryValues;
51219    const dictionaryLengths = lzwState.dictionaryLengths;
51220    const dictionaryPrevCodes = lzwState.dictionaryPrevCodes;
51221    let codeLength = lzwState.codeLength;
51222    let prevCode = lzwState.prevCode;
51223    const currentSequence = lzwState.currentSequence;
51224    let currentSequenceLength = lzwState.currentSequenceLength;
51225    let decodedLength = 0;
51226    let currentBufferLength = this.bufferLength;
51227    let buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
51228    for (i = 0; i < blockSize; i++) {
51229      const code = this.readBits(codeLength);
51230      const hasPrev = currentSequenceLength > 0;
51231      if (code < 256) {
51232        currentSequence[0] = code;
51233        currentSequenceLength = 1;
51234      } else if (code >= 258) {
51235        if (code < nextCode) {
51236          currentSequenceLength = dictionaryLengths[code];
51237          for (j = currentSequenceLength - 1, q = code; j >= 0; j--) {
51238            currentSequence[j] = dictionaryValues[q];
51239            q = dictionaryPrevCodes[q];
51240          }
51241        } else {
51242          currentSequence[currentSequenceLength++] = currentSequence[0];
51243        }
51244      } else if (code === 256) {
51245        codeLength = 9;
51246        nextCode = 258;
51247        currentSequenceLength = 0;
51248        continue;
51249      } else {
51250        this.eof = true;
51251        delete this.lzwState;
51252        break;
51253      }
51254      if (hasPrev) {
51255        dictionaryPrevCodes[nextCode] = prevCode;
51256        dictionaryLengths[nextCode] = dictionaryLengths[prevCode] + 1;
51257        dictionaryValues[nextCode] = currentSequence[0];
51258        nextCode++;
51259        codeLength = nextCode + earlyChange & nextCode + earlyChange - 1 ? codeLength : Math.min(Math.log(nextCode + earlyChange) / 0.6931471805599453 + 1, 12) | 0;
51260      }
51261      prevCode = code;
51262      decodedLength += currentSequenceLength;
51263      if (estimatedDecodedSize < decodedLength) {
51264        do {
51265          estimatedDecodedSize += decodedSizeDelta;
51266        } while (estimatedDecodedSize < decodedLength);
51267        buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
51268      }
51269      for (j = 0; j < currentSequenceLength; j++) {
51270        buffer[currentBufferLength++] = currentSequence[j];
51271      }
51272    }
51273    lzwState.nextCode = nextCode;
51274    lzwState.codeLength = codeLength;
51275    lzwState.prevCode = prevCode;
51276    lzwState.currentSequenceLength = currentSequenceLength;
51277    this.bufferLength = currentBufferLength;
51278  }
51279}
51280exports.LZWStream = LZWStream;
51281
51282/***/ }),
51283/* 32 */
51284/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
51285
51286
51287
51288Object.defineProperty(exports, "__esModule", ({
51289  value: true
51290}));
51291exports.PredictorStream = void 0;
51292var _decode_stream = __w_pdfjs_require__(18);
51293var _primitives = __w_pdfjs_require__(4);
51294var _util = __w_pdfjs_require__(2);
51295class PredictorStream extends _decode_stream.DecodeStream {
51296  constructor(str, maybeLength, params) {
51297    super(maybeLength);
51298    if (!(params instanceof _primitives.Dict)) {
51299      return str;
51300    }
51301    const predictor = this.predictor = params.get("Predictor") || 1;
51302    if (predictor <= 1) {
51303      return str;
51304    }
51305    if (predictor !== 2 && (predictor < 10 || predictor > 15)) {
51306      throw new _util.FormatError(`Unsupported predictor: ${predictor}`);
51307    }
51308    this.readBlock = predictor === 2 ? this.readBlockTiff : this.readBlockPng;
51309    this.str = str;
51310    this.dict = str.dict;
51311    const colors = this.colors = params.get("Colors") || 1;
51312    const bits = this.bits = params.get("BPC", "BitsPerComponent") || 8;
51313    const columns = this.columns = params.get("Columns") || 1;
51314    this.pixBytes = colors * bits + 7 >> 3;
51315    this.rowBytes = columns * colors * bits + 7 >> 3;
51316    return this;
51317  }
51318  readBlockTiff() {
51319    const rowBytes = this.rowBytes;
51320    const bufferLength = this.bufferLength;
51321    const buffer = this.ensureBuffer(bufferLength + rowBytes);
51322    const bits = this.bits;
51323    const colors = this.colors;
51324    const rawBytes = this.str.getBytes(rowBytes);
51325    this.eof = !rawBytes.length;
51326    if (this.eof) {
51327      return;
51328    }
51329    let inbuf = 0,
51330      outbuf = 0;
51331    let inbits = 0,
51332      outbits = 0;
51333    let pos = bufferLength;
51334    let i;
51335    if (bits === 1 && colors === 1) {
51336      for (i = 0; i < rowBytes; ++i) {
51337        let c = rawBytes[i] ^ inbuf;
51338        c ^= c >> 1;
51339        c ^= c >> 2;
51340        c ^= c >> 4;
51341        inbuf = (c & 1) << 7;
51342        buffer[pos++] = c;
51343      }
51344    } else if (bits === 8) {
51345      for (i = 0; i < colors; ++i) {
51346        buffer[pos++] = rawBytes[i];
51347      }
51348      for (; i < rowBytes; ++i) {
51349        buffer[pos] = buffer[pos - colors] + rawBytes[i];
51350        pos++;
51351      }
51352    } else if (bits === 16) {
51353      const bytesPerPixel = colors * 2;
51354      for (i = 0; i < bytesPerPixel; ++i) {
51355        buffer[pos++] = rawBytes[i];
51356      }
51357      for (; i < rowBytes; i += 2) {
51358        const sum = ((rawBytes[i] & 0xff) << 8) + (rawBytes[i + 1] & 0xff) + ((buffer[pos - bytesPerPixel] & 0xff) << 8) + (buffer[pos - bytesPerPixel + 1] & 0xff);
51359        buffer[pos++] = sum >> 8 & 0xff;
51360        buffer[pos++] = sum & 0xff;
51361      }
51362    } else {
51363      const compArray = new Uint8Array(colors + 1);
51364      const bitMask = (1 << bits) - 1;
51365      let j = 0,
51366        k = bufferLength;
51367      const columns = this.columns;
51368      for (i = 0; i < columns; ++i) {
51369        for (let kk = 0; kk < colors; ++kk) {
51370          if (inbits < bits) {
51371            inbuf = inbuf << 8 | rawBytes[j++] & 0xff;
51372            inbits += 8;
51373          }
51374          compArray[kk] = compArray[kk] + (inbuf >> inbits - bits) & bitMask;
51375          inbits -= bits;
51376          outbuf = outbuf << bits | compArray[kk];
51377          outbits += bits;
51378          if (outbits >= 8) {
51379            buffer[k++] = outbuf >> outbits - 8 & 0xff;
51380            outbits -= 8;
51381          }
51382        }
51383      }
51384      if (outbits > 0) {
51385        buffer[k++] = (outbuf << 8 - outbits) + (inbuf & (1 << 8 - outbits) - 1);
51386      }
51387    }
51388    this.bufferLength += rowBytes;
51389  }
51390  readBlockPng() {
51391    const rowBytes = this.rowBytes;
51392    const pixBytes = this.pixBytes;
51393    const predictor = this.str.getByte();
51394    const rawBytes = this.str.getBytes(rowBytes);
51395    this.eof = !rawBytes.length;
51396    if (this.eof) {
51397      return;
51398    }
51399    const bufferLength = this.bufferLength;
51400    const buffer = this.ensureBuffer(bufferLength + rowBytes);
51401    let prevRow = buffer.subarray(bufferLength - rowBytes, bufferLength);
51402    if (prevRow.length === 0) {
51403      prevRow = new Uint8Array(rowBytes);
51404    }
51405    let i,
51406      j = bufferLength,
51407      up,
51408      c;
51409    switch (predictor) {
51410      case 0:
51411        for (i = 0; i < rowBytes; ++i) {
51412          buffer[j++] = rawBytes[i];
51413        }
51414        break;
51415      case 1:
51416        for (i = 0; i < pixBytes; ++i) {
51417          buffer[j++] = rawBytes[i];
51418        }
51419        for (; i < rowBytes; ++i) {
51420          buffer[j] = buffer[j - pixBytes] + rawBytes[i] & 0xff;
51421          j++;
51422        }
51423        break;
51424      case 2:
51425        for (i = 0; i < rowBytes; ++i) {
51426          buffer[j++] = prevRow[i] + rawBytes[i] & 0xff;
51427        }
51428        break;
51429      case 3:
51430        for (i = 0; i < pixBytes; ++i) {
51431          buffer[j++] = (prevRow[i] >> 1) + rawBytes[i];
51432        }
51433        for (; i < rowBytes; ++i) {
51434          buffer[j] = (prevRow[i] + buffer[j - pixBytes] >> 1) + rawBytes[i] & 0xff;
51435          j++;
51436        }
51437        break;
51438      case 4:
51439        for (i = 0; i < pixBytes; ++i) {
51440          up = prevRow[i];
51441          c = rawBytes[i];
51442          buffer[j++] = up + c;
51443        }
51444        for (; i < rowBytes; ++i) {
51445          up = prevRow[i];
51446          const upLeft = prevRow[i - pixBytes];
51447          const left = buffer[j - pixBytes];
51448          const p = left + up - upLeft;
51449          let pa = p - left;
51450          if (pa < 0) {
51451            pa = -pa;
51452          }
51453          let pb = p - up;
51454          if (pb < 0) {
51455            pb = -pb;
51456          }
51457          let pc = p - upLeft;
51458          if (pc < 0) {
51459            pc = -pc;
51460          }
51461          c = rawBytes[i];
51462          if (pa <= pb && pa <= pc) {
51463            buffer[j++] = left + c;
51464          } else if (pb <= pc) {
51465            buffer[j++] = up + c;
51466          } else {
51467            buffer[j++] = upLeft + c;
51468          }
51469        }
51470        break;
51471      default:
51472        throw new _util.FormatError(`Unsupported predictor: ${predictor}`);
51473    }
51474    this.bufferLength += rowBytes;
51475  }
51476}
51477exports.PredictorStream = PredictorStream;
51478
51479/***/ }),
51480/* 33 */
51481/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
51482
51483
51484
51485Object.defineProperty(exports, "__esModule", ({
51486  value: true
51487}));
51488exports.RunLengthStream = void 0;
51489var _decode_stream = __w_pdfjs_require__(18);
51490class RunLengthStream extends _decode_stream.DecodeStream {
51491  constructor(str, maybeLength) {
51492    super(maybeLength);
51493    this.str = str;
51494    this.dict = str.dict;
51495  }
51496  readBlock() {
51497    const repeatHeader = this.str.getBytes(2);
51498    if (!repeatHeader || repeatHeader.length < 2 || repeatHeader[0] === 128) {
51499      this.eof = true;
51500      return;
51501    }
51502    let buffer;
51503    let bufferLength = this.bufferLength;
51504    let n = repeatHeader[0];
51505    if (n < 128) {
51506      buffer = this.ensureBuffer(bufferLength + n + 1);
51507      buffer[bufferLength++] = repeatHeader[1];
51508      if (n > 0) {
51509        const source = this.str.getBytes(n);
51510        buffer.set(source, bufferLength);
51511        bufferLength += n;
51512      }
51513    } else {
51514      n = 257 - n;
51515      const b = repeatHeader[1];
51516      buffer = this.ensureBuffer(bufferLength + n + 1);
51517      for (let i = 0; i < n; i++) {
51518        buffer[bufferLength++] = b;
51519      }
51520    }
51521    this.bufferLength = bufferLength;
51522  }
51523}
51524exports.RunLengthStream = RunLengthStream;
51525
51526/***/ }),
51527/* 34 */
51528/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
51529
51530
51531
51532Object.defineProperty(exports, "__esModule", ({
51533  value: true
51534}));
51535exports.Font = exports.ErrorFont = void 0;
51536var _util = __w_pdfjs_require__(2);
51537var _cff_parser = __w_pdfjs_require__(35);
51538var _fonts_utils = __w_pdfjs_require__(38);
51539var _unicode = __w_pdfjs_require__(40);
51540var _glyphlist = __w_pdfjs_require__(39);
51541var _encodings = __w_pdfjs_require__(37);
51542var _standard_fonts = __w_pdfjs_require__(41);
51543var _to_unicode_map = __w_pdfjs_require__(42);
51544var _cff_font = __w_pdfjs_require__(43);
51545var _font_renderer = __w_pdfjs_require__(44);
51546var _metrics = __w_pdfjs_require__(45);
51547var _glyf = __w_pdfjs_require__(46);
51548var _cmap = __w_pdfjs_require__(14);
51549var _opentype_file_builder = __w_pdfjs_require__(47);
51550var _core_utils = __w_pdfjs_require__(3);
51551var _stream = __w_pdfjs_require__(8);
51552var _type1_font = __w_pdfjs_require__(48);
51553const PRIVATE_USE_AREAS = [[0xe000, 0xf8ff], [0x100000, 0x10fffd]];
51554const PDF_GLYPH_SPACE_UNITS = 1000;
51555const EXPORT_DATA_PROPERTIES = ["ascent", "bbox", "black", "bold", "charProcOperatorList", "composite", "cssFontInfo", "data", "defaultVMetrics", "defaultWidth", "descent", "fallbackName", "fontMatrix", "isInvalidPDFjsFont", "isType3Font", "italic", "loadedName", "mimetype", "missingFile", "name", "remeasure", "subtype", "systemFontInfo", "type", "vertical"];
51556const EXPORT_DATA_EXTRA_PROPERTIES = ["cMap", "defaultEncoding", "differences", "isMonospace", "isSerifFont", "isSymbolicFont", "seacMap", "toFontChar", "toUnicode", "vmetrics", "widths"];
51557function adjustWidths(properties) {
51558  if (!properties.fontMatrix) {
51559    return;
51560  }
51561  if (properties.fontMatrix[0] === _util.FONT_IDENTITY_MATRIX[0]) {
51562    return;
51563  }
51564  const scale = 0.001 / properties.fontMatrix[0];
51565  const glyphsWidths = properties.widths;
51566  for (const glyph in glyphsWidths) {
51567    glyphsWidths[glyph] *= scale;
51568  }
51569  properties.defaultWidth *= scale;
51570}
51571function adjustTrueTypeToUnicode(properties, isSymbolicFont, nameRecords) {
51572  if (properties.isInternalFont) {
51573    return;
51574  }
51575  if (properties.hasIncludedToUnicodeMap) {
51576    return;
51577  }
51578  if (properties.hasEncoding) {
51579    return;
51580  }
51581  if (properties.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
51582    return;
51583  }
51584  if (!isSymbolicFont) {
51585    return;
51586  }
51587  if (nameRecords.length === 0) {
51588    return;
51589  }
51590  if (properties.defaultEncoding === _encodings.WinAnsiEncoding) {
51591    return;
51592  }
51593  for (const r of nameRecords) {
51594    if (!isWinNameRecord(r)) {
51595      return;
51596    }
51597  }
51598  const encoding = _encodings.WinAnsiEncoding;
51599  const toUnicode = [],
51600    glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
51601  for (const charCode in encoding) {
51602    const glyphName = encoding[charCode];
51603    if (glyphName === "") {
51604      continue;
51605    }
51606    const unicode = glyphsUnicodeMap[glyphName];
51607    if (unicode === undefined) {
51608      continue;
51609    }
51610    toUnicode[charCode] = String.fromCharCode(unicode);
51611  }
51612  if (toUnicode.length > 0) {
51613    properties.toUnicode.amend(toUnicode);
51614  }
51615}
51616function adjustType1ToUnicode(properties, builtInEncoding) {
51617  if (properties.isInternalFont) {
51618    return;
51619  }
51620  if (properties.hasIncludedToUnicodeMap) {
51621    return;
51622  }
51623  if (builtInEncoding === properties.defaultEncoding) {
51624    return;
51625  }
51626  if (properties.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
51627    return;
51628  }
51629  const toUnicode = [],
51630    glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
51631  for (const charCode in builtInEncoding) {
51632    if (properties.hasEncoding) {
51633      if (properties.baseEncodingName || properties.differences[charCode] !== undefined) {
51634        continue;
51635      }
51636    }
51637    const glyphName = builtInEncoding[charCode];
51638    const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
51639    if (unicode !== -1) {
51640      toUnicode[charCode] = String.fromCharCode(unicode);
51641    }
51642  }
51643  if (toUnicode.length > 0) {
51644    properties.toUnicode.amend(toUnicode);
51645  }
51646}
51647function amendFallbackToUnicode(properties) {
51648  if (!properties.fallbackToUnicode) {
51649    return;
51650  }
51651  if (properties.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
51652    return;
51653  }
51654  const toUnicode = [];
51655  for (const charCode in properties.fallbackToUnicode) {
51656    if (properties.toUnicode.has(charCode)) {
51657      continue;
51658    }
51659    toUnicode[charCode] = properties.fallbackToUnicode[charCode];
51660  }
51661  if (toUnicode.length > 0) {
51662    properties.toUnicode.amend(toUnicode);
51663  }
51664}
51665class Glyph {
51666  constructor(originalCharCode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
51667    this.originalCharCode = originalCharCode;
51668    this.fontChar = fontChar;
51669    this.unicode = unicode;
51670    this.accent = accent;
51671    this.width = width;
51672    this.vmetric = vmetric;
51673    this.operatorListId = operatorListId;
51674    this.isSpace = isSpace;
51675    this.isInFont = isInFont;
51676  }
51677  get category() {
51678    return (0, _util.shadow)(this, "category", (0, _unicode.getCharUnicodeCategory)(this.unicode), true);
51679  }
51680}
51681function int16(b0, b1) {
51682  return (b0 << 8) + b1;
51683}
51684function writeSignedInt16(bytes, index, value) {
51685  bytes[index + 1] = value;
51686  bytes[index] = value >>> 8;
51687}
51688function signedInt16(b0, b1) {
51689  const value = (b0 << 8) + b1;
51690  return value & 1 << 15 ? value - 0x10000 : value;
51691}
51692function int32(b0, b1, b2, b3) {
51693  return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
51694}
51695function string16(value) {
51696  return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
51697}
51698function safeString16(value) {
51699  if (value > 0x7fff) {
51700    value = 0x7fff;
51701  } else if (value < -0x8000) {
51702    value = -0x8000;
51703  }
51704  return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
51705}
51706function isTrueTypeFile(file) {
51707  const header = file.peekBytes(4);
51708  return (0, _core_utils.readUint32)(header, 0) === 0x00010000 || (0, _util.bytesToString)(header) === "true";
51709}
51710function isTrueTypeCollectionFile(file) {
51711  const header = file.peekBytes(4);
51712  return (0, _util.bytesToString)(header) === "ttcf";
51713}
51714function isOpenTypeFile(file) {
51715  const header = file.peekBytes(4);
51716  return (0, _util.bytesToString)(header) === "OTTO";
51717}
51718function isType1File(file) {
51719  const header = file.peekBytes(2);
51720  if (header[0] === 0x25 && header[1] === 0x21) {
51721    return true;
51722  }
51723  if (header[0] === 0x80 && header[1] === 0x01) {
51724    return true;
51725  }
51726  return false;
51727}
51728function isCFFFile(file) {
51729  const header = file.peekBytes(4);
51730  if (header[0] >= 1 && header[3] >= 1 && header[3] <= 4) {
51731    return true;
51732  }
51733  return false;
51734}
51735function getFontFileType(file, {
51736  type,
51737  subtype,
51738  composite
51739}) {
51740  let fileType, fileSubtype;
51741  if (isTrueTypeFile(file) || isTrueTypeCollectionFile(file)) {
51742    fileType = composite ? "CIDFontType2" : "TrueType";
51743  } else if (isOpenTypeFile(file)) {
51744    fileType = composite ? "CIDFontType2" : "OpenType";
51745  } else if (isType1File(file)) {
51746    if (composite) {
51747      fileType = "CIDFontType0";
51748    } else {
51749      fileType = type === "MMType1" ? "MMType1" : "Type1";
51750    }
51751  } else if (isCFFFile(file)) {
51752    if (composite) {
51753      fileType = "CIDFontType0";
51754      fileSubtype = "CIDFontType0C";
51755    } else {
51756      fileType = type === "MMType1" ? "MMType1" : "Type1";
51757      fileSubtype = "Type1C";
51758    }
51759  } else {
51760    (0, _util.warn)("getFontFileType: Unable to detect correct font file Type/Subtype.");
51761    fileType = type;
51762    fileSubtype = subtype;
51763  }
51764  return [fileType, fileSubtype];
51765}
51766function applyStandardFontGlyphMap(map, glyphMap) {
51767  for (const charCode in glyphMap) {
51768    map[+charCode] = glyphMap[charCode];
51769  }
51770}
51771function buildToFontChar(encoding, glyphsUnicodeMap, differences) {
51772  const toFontChar = [];
51773  let unicode;
51774  for (let i = 0, ii = encoding.length; i < ii; i++) {
51775    unicode = (0, _unicode.getUnicodeForGlyph)(encoding[i], glyphsUnicodeMap);
51776    if (unicode !== -1) {
51777      toFontChar[i] = unicode;
51778    }
51779  }
51780  for (const charCode in differences) {
51781    unicode = (0, _unicode.getUnicodeForGlyph)(differences[charCode], glyphsUnicodeMap);
51782    if (unicode !== -1) {
51783      toFontChar[+charCode] = unicode;
51784    }
51785  }
51786  return toFontChar;
51787}
51788function isMacNameRecord(r) {
51789  return r.platform === 1 && r.encoding === 0 && r.language === 0;
51790}
51791function isWinNameRecord(r) {
51792  return r.platform === 3 && r.encoding === 1 && r.language === 0x409;
51793}
51794function convertCidString(charCode, cid, shouldThrow = false) {
51795  switch (cid.length) {
51796    case 1:
51797      return cid.charCodeAt(0);
51798    case 2:
51799      return cid.charCodeAt(0) << 8 | cid.charCodeAt(1);
51800  }
51801  const msg = `Unsupported CID string (charCode ${charCode}): "${cid}".`;
51802  if (shouldThrow) {
51803    throw new _util.FormatError(msg);
51804  }
51805  (0, _util.warn)(msg);
51806  return cid;
51807}
51808function adjustMapping(charCodeToGlyphId, hasGlyph, newGlyphZeroId, toUnicode) {
51809  const newMap = Object.create(null);
51810  const toUnicodeExtraMap = new Map();
51811  const toFontChar = [];
51812  const usedGlyphIds = new Set();
51813  let privateUseAreaIndex = 0;
51814  const privateUseOffetStart = PRIVATE_USE_AREAS[privateUseAreaIndex][0];
51815  let nextAvailableFontCharCode = privateUseOffetStart;
51816  let privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
51817  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];
51818  for (let originalCharCode in charCodeToGlyphId) {
51819    originalCharCode |= 0;
51820    let glyphId = charCodeToGlyphId[originalCharCode];
51821    if (!hasGlyph(glyphId)) {
51822      continue;
51823    }
51824    if (nextAvailableFontCharCode > privateUseOffetEnd) {
51825      privateUseAreaIndex++;
51826      if (privateUseAreaIndex >= PRIVATE_USE_AREAS.length) {
51827        (0, _util.warn)("Ran out of space in font private use area.");
51828        break;
51829      }
51830      nextAvailableFontCharCode = PRIVATE_USE_AREAS[privateUseAreaIndex][0];
51831      privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
51832    }
51833    const fontCharCode = nextAvailableFontCharCode++;
51834    if (glyphId === 0) {
51835      glyphId = newGlyphZeroId;
51836    }
51837    let unicode = toUnicode.get(originalCharCode);
51838    if (typeof unicode === "string") {
51839      unicode = unicode.codePointAt(0);
51840    }
51841    if (unicode && !isInPrivateArea(unicode) && !usedGlyphIds.has(glyphId)) {
51842      toUnicodeExtraMap.set(unicode, glyphId);
51843      usedGlyphIds.add(glyphId);
51844    }
51845    newMap[fontCharCode] = glyphId;
51846    toFontChar[originalCharCode] = fontCharCode;
51847  }
51848  return {
51849    toFontChar,
51850    charCodeToGlyphId: newMap,
51851    toUnicodeExtraMap,
51852    nextAvailableFontCharCode
51853  };
51854}
51855function getRanges(glyphs, toUnicodeExtraMap, numGlyphs) {
51856  const codes = [];
51857  for (const charCode in glyphs) {
51858    if (glyphs[charCode] >= numGlyphs) {
51859      continue;
51860    }
51861    codes.push({
51862      fontCharCode: charCode | 0,
51863      glyphId: glyphs[charCode]
51864    });
51865  }
51866  if (toUnicodeExtraMap) {
51867    for (const [unicode, glyphId] of toUnicodeExtraMap) {
51868      if (glyphId >= numGlyphs) {
51869        continue;
51870      }
51871      codes.push({
51872        fontCharCode: unicode,
51873        glyphId
51874      });
51875    }
51876  }
51877  if (codes.length === 0) {
51878    codes.push({
51879      fontCharCode: 0,
51880      glyphId: 0
51881    });
51882  }
51883  codes.sort(function fontGetRangesSort(a, b) {
51884    return a.fontCharCode - b.fontCharCode;
51885  });
51886  const ranges = [];
51887  const length = codes.length;
51888  for (let n = 0; n < length;) {
51889    const start = codes[n].fontCharCode;
51890    const codeIndices = [codes[n].glyphId];
51891    ++n;
51892    let end = start;
51893    while (n < length && end + 1 === codes[n].fontCharCode) {
51894      codeIndices.push(codes[n].glyphId);
51895      ++end;
51896      ++n;
51897      if (end === 0xffff) {
51898        break;
51899      }
51900    }
51901    ranges.push([start, end, codeIndices]);
51902  }
51903  return ranges;
51904}
51905function createCmapTable(glyphs, toUnicodeExtraMap, numGlyphs) {
51906  const ranges = getRanges(glyphs, toUnicodeExtraMap, numGlyphs);
51907  const numTables = ranges.at(-1)[1] > 0xffff ? 2 : 1;
51908  let cmap = "\x00\x00" + string16(numTables) + "\x00\x03" + "\x00\x01" + (0, _util.string32)(4 + numTables * 8);
51909  let i, ii, j, jj;
51910  for (i = ranges.length - 1; i >= 0; --i) {
51911    if (ranges[i][0] <= 0xffff) {
51912      break;
51913    }
51914  }
51915  const bmpLength = i + 1;
51916  if (ranges[i][0] < 0xffff && ranges[i][1] === 0xffff) {
51917    ranges[i][1] = 0xfffe;
51918  }
51919  const trailingRangesCount = ranges[i][1] < 0xffff ? 1 : 0;
51920  const segCount = bmpLength + trailingRangesCount;
51921  const searchParams = _opentype_file_builder.OpenTypeFileBuilder.getSearchParams(segCount, 2);
51922  let startCount = "";
51923  let endCount = "";
51924  let idDeltas = "";
51925  let idRangeOffsets = "";
51926  let glyphsIds = "";
51927  let bias = 0;
51928  let range, start, end, codes;
51929  for (i = 0, ii = bmpLength; i < ii; i++) {
51930    range = ranges[i];
51931    start = range[0];
51932    end = range[1];
51933    startCount += string16(start);
51934    endCount += string16(end);
51935    codes = range[2];
51936    let contiguous = true;
51937    for (j = 1, jj = codes.length; j < jj; ++j) {
51938      if (codes[j] !== codes[j - 1] + 1) {
51939        contiguous = false;
51940        break;
51941      }
51942    }
51943    if (!contiguous) {
51944      const offset = (segCount - i) * 2 + bias * 2;
51945      bias += end - start + 1;
51946      idDeltas += string16(0);
51947      idRangeOffsets += string16(offset);
51948      for (j = 0, jj = codes.length; j < jj; ++j) {
51949        glyphsIds += string16(codes[j]);
51950      }
51951    } else {
51952      const startCode = codes[0];
51953      idDeltas += string16(startCode - start & 0xffff);
51954      idRangeOffsets += string16(0);
51955    }
51956  }
51957  if (trailingRangesCount > 0) {
51958    endCount += "\xFF\xFF";
51959    startCount += "\xFF\xFF";
51960    idDeltas += "\x00\x01";
51961    idRangeOffsets += "\x00\x00";
51962  }
51963  const format314 = "\x00\x00" + string16(2 * segCount) + string16(searchParams.range) + string16(searchParams.entry) + string16(searchParams.rangeShift) + endCount + "\x00\x00" + startCount + idDeltas + idRangeOffsets + glyphsIds;
51964  let format31012 = "";
51965  let header31012 = "";
51966  if (numTables > 1) {
51967    cmap += "\x00\x03" + "\x00\x0A" + (0, _util.string32)(4 + numTables * 8 + 4 + format314.length);
51968    format31012 = "";
51969    for (i = 0, ii = ranges.length; i < ii; i++) {
51970      range = ranges[i];
51971      start = range[0];
51972      codes = range[2];
51973      let code = codes[0];
51974      for (j = 1, jj = codes.length; j < jj; ++j) {
51975        if (codes[j] !== codes[j - 1] + 1) {
51976          end = range[0] + j - 1;
51977          format31012 += (0, _util.string32)(start) + (0, _util.string32)(end) + (0, _util.string32)(code);
51978          start = end + 1;
51979          code = codes[j];
51980        }
51981      }
51982      format31012 += (0, _util.string32)(start) + (0, _util.string32)(range[1]) + (0, _util.string32)(code);
51983    }
51984    header31012 = "\x00\x0C" + "\x00\x00" + (0, _util.string32)(format31012.length + 16) + "\x00\x00\x00\x00" + (0, _util.string32)(format31012.length / 12);
51985  }
51986  return cmap + "\x00\x04" + string16(format314.length + 4) + format314 + header31012 + format31012;
51987}
51988function validateOS2Table(os2, file) {
51989  file.pos = (file.start || 0) + os2.offset;
51990  const version = file.getUint16();
51991  file.skip(60);
51992  const selection = file.getUint16();
51993  if (version < 4 && selection & 0x0300) {
51994    return false;
51995  }
51996  const firstChar = file.getUint16();
51997  const lastChar = file.getUint16();
51998  if (firstChar > lastChar) {
51999    return false;
52000  }
52001  file.skip(6);
52002  const usWinAscent = file.getUint16();
52003  if (usWinAscent === 0) {
52004    return false;
52005  }
52006  os2.data[8] = os2.data[9] = 0;
52007  return true;
52008}
52009function createOS2Table(properties, charstrings, override) {
52010  override ||= {
52011    unitsPerEm: 0,
52012    yMax: 0,
52013    yMin: 0,
52014    ascent: 0,
52015    descent: 0
52016  };
52017  let ulUnicodeRange1 = 0;
52018  let ulUnicodeRange2 = 0;
52019  let ulUnicodeRange3 = 0;
52020  let ulUnicodeRange4 = 0;
52021  let firstCharIndex = null;
52022  let lastCharIndex = 0;
52023  let position = -1;
52024  if (charstrings) {
52025    for (let code in charstrings) {
52026      code |= 0;
52027      if (firstCharIndex > code || !firstCharIndex) {
52028        firstCharIndex = code;
52029      }
52030      if (lastCharIndex < code) {
52031        lastCharIndex = code;
52032      }
52033      position = (0, _unicode.getUnicodeRangeFor)(code, position);
52034      if (position < 32) {
52035        ulUnicodeRange1 |= 1 << position;
52036      } else if (position < 64) {
52037        ulUnicodeRange2 |= 1 << position - 32;
52038      } else if (position < 96) {
52039        ulUnicodeRange3 |= 1 << position - 64;
52040      } else if (position < 123) {
52041        ulUnicodeRange4 |= 1 << position - 96;
52042      } else {
52043        throw new _util.FormatError("Unicode ranges Bits > 123 are reserved for internal usage");
52044      }
52045    }
52046    if (lastCharIndex > 0xffff) {
52047      lastCharIndex = 0xffff;
52048    }
52049  } else {
52050    firstCharIndex = 0;
52051    lastCharIndex = 255;
52052  }
52053  const bbox = properties.bbox || [0, 0, 0, 0];
52054  const unitsPerEm = override.unitsPerEm || 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0];
52055  const scale = properties.ascentScaled ? 1.0 : unitsPerEm / PDF_GLYPH_SPACE_UNITS;
52056  const typoAscent = override.ascent || Math.round(scale * (properties.ascent || bbox[3]));
52057  let typoDescent = override.descent || Math.round(scale * (properties.descent || bbox[1]));
52058  if (typoDescent > 0 && properties.descent > 0 && bbox[1] < 0) {
52059    typoDescent = -typoDescent;
52060  }
52061  const winAscent = override.yMax || typoAscent;
52062  const winDescent = -override.yMin || -typoDescent;
52063  return "\x00\x03" + "\x02\x24" + "\x01\xF4" + "\x00\x05" + "\x00\x00" + "\x02\x8A" + "\x02\xBB" + "\x00\x00" + "\x00\x8C" + "\x02\x8A" + "\x02\xBB" + "\x00\x00" + "\x01\xDF" + "\x00\x31" + "\x01\x02" + "\x00\x00" + "\x00\x00\x06" + String.fromCharCode(properties.fixedPitch ? 0x09 : 0x00) + "\x00\x00\x00\x00\x00\x00" + (0, _util.string32)(ulUnicodeRange1) + (0, _util.string32)(ulUnicodeRange2) + (0, _util.string32)(ulUnicodeRange3) + (0, _util.string32)(ulUnicodeRange4) + "\x2A\x32\x31\x2A" + string16(properties.italicAngle ? 1 : 0) + string16(firstCharIndex || properties.firstChar) + string16(lastCharIndex || properties.lastChar) + string16(typoAscent) + string16(typoDescent) + "\x00\x64" + string16(winAscent) + string16(winDescent) + "\x00\x00\x00\x00" + "\x00\x00\x00\x00" + string16(properties.xHeight) + string16(properties.capHeight) + string16(0) + string16(firstCharIndex || properties.firstChar) + "\x00\x03";
52064}
52065function createPostTable(properties) {
52066  const angle = Math.floor(properties.italicAngle * 2 ** 16);
52067  return "\x00\x03\x00\x00" + (0, _util.string32)(angle) + "\x00\x00" + "\x00\x00" + (0, _util.string32)(properties.fixedPitch ? 1 : 0) + "\x00\x00\x00\x00" + "\x00\x00\x00\x00" + "\x00\x00\x00\x00" + "\x00\x00\x00\x00";
52068}
52069function createPostscriptName(name) {
52070  return name.replaceAll(/[^\x21-\x7E]|[[\](){}<>/%]/g, "").slice(0, 63);
52071}
52072function createNameTable(name, proto) {
52073  if (!proto) {
52074    proto = [[], []];
52075  }
52076  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"];
52077  const stringsUnicode = [];
52078  let i, ii, j, jj, str;
52079  for (i = 0, ii = strings.length; i < ii; i++) {
52080    str = proto[1][i] || strings[i];
52081    const strBufUnicode = [];
52082    for (j = 0, jj = str.length; j < jj; j++) {
52083      strBufUnicode.push(string16(str.charCodeAt(j)));
52084    }
52085    stringsUnicode.push(strBufUnicode.join(""));
52086  }
52087  const names = [strings, stringsUnicode];
52088  const platforms = ["\x00\x01", "\x00\x03"];
52089  const encodings = ["\x00\x00", "\x00\x01"];
52090  const languages = ["\x00\x00", "\x04\x09"];
52091  const namesRecordCount = strings.length * platforms.length;
52092  let nameTable = "\x00\x00" + string16(namesRecordCount) + string16(namesRecordCount * 12 + 6);
52093  let strOffset = 0;
52094  for (i = 0, ii = platforms.length; i < ii; i++) {
52095    const strs = names[i];
52096    for (j = 0, jj = strs.length; j < jj; j++) {
52097      str = strs[j];
52098      const nameRecord = platforms[i] + encodings[i] + languages[i] + string16(j) + string16(str.length) + string16(strOffset);
52099      nameTable += nameRecord;
52100      strOffset += str.length;
52101    }
52102  }
52103  nameTable += strings.join("") + stringsUnicode.join("");
52104  return nameTable;
52105}
52106class Font {
52107  constructor(name, file, properties) {
52108    this.name = name;
52109    this.psName = null;
52110    this.mimetype = null;
52111    this.disableFontFace = false;
52112    this.loadedName = properties.loadedName;
52113    this.isType3Font = properties.isType3Font;
52114    this.missingFile = false;
52115    this.cssFontInfo = properties.cssFontInfo;
52116    this._charsCache = Object.create(null);
52117    this._glyphCache = Object.create(null);
52118    let isSerifFont = !!(properties.flags & _fonts_utils.FontFlags.Serif);
52119    if (!isSerifFont && !properties.isSimulatedFlags) {
52120      const baseName = name.replaceAll(/[,_]/g, "-").split("-")[0],
52121        serifFonts = (0, _standard_fonts.getSerifFonts)();
52122      for (const namePart of baseName.split("+")) {
52123        if (serifFonts[namePart]) {
52124          isSerifFont = true;
52125          break;
52126        }
52127      }
52128    }
52129    this.isSerifFont = isSerifFont;
52130    this.isSymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Symbolic);
52131    this.isMonospace = !!(properties.flags & _fonts_utils.FontFlags.FixedPitch);
52132    let {
52133      type,
52134      subtype
52135    } = properties;
52136    this.type = type;
52137    this.subtype = subtype;
52138    this.systemFontInfo = properties.systemFontInfo;
52139    const matches = name.match(/^InvalidPDFjsFont_(.*)_\d+$/);
52140    this.isInvalidPDFjsFont = !!matches;
52141    if (this.isInvalidPDFjsFont) {
52142      this.fallbackName = matches[1];
52143    } else if (this.isMonospace) {
52144      this.fallbackName = "monospace";
52145    } else if (this.isSerifFont) {
52146      this.fallbackName = "serif";
52147    } else {
52148      this.fallbackName = "sans-serif";
52149    }
52150    if (this.systemFontInfo?.guessFallback) {
52151      this.systemFontInfo.guessFallback = false;
52152      this.systemFontInfo.css += `,${this.fallbackName}`;
52153    }
52154    this.differences = properties.differences;
52155    this.widths = properties.widths;
52156    this.defaultWidth = properties.defaultWidth;
52157    this.composite = properties.composite;
52158    this.cMap = properties.cMap;
52159    this.capHeight = properties.capHeight / PDF_GLYPH_SPACE_UNITS;
52160    this.ascent = properties.ascent / PDF_GLYPH_SPACE_UNITS;
52161    this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS;
52162    this.lineHeight = this.ascent - this.descent;
52163    this.fontMatrix = properties.fontMatrix;
52164    this.bbox = properties.bbox;
52165    this.defaultEncoding = properties.defaultEncoding;
52166    this.toUnicode = properties.toUnicode;
52167    this.toFontChar = [];
52168    if (properties.type === "Type3") {
52169      for (let charCode = 0; charCode < 256; charCode++) {
52170        this.toFontChar[charCode] = this.differences[charCode] || properties.defaultEncoding[charCode];
52171      }
52172      return;
52173    }
52174    this.cidEncoding = properties.cidEncoding || "";
52175    this.vertical = !!properties.vertical;
52176    if (this.vertical) {
52177      this.vmetrics = properties.vmetrics;
52178      this.defaultVMetrics = properties.defaultVMetrics;
52179    }
52180    if (!file || file.isEmpty) {
52181      if (file) {
52182        (0, _util.warn)('Font file is empty in "' + name + '" (' + this.loadedName + ")");
52183      }
52184      this.fallbackToSystemFont(properties);
52185      return;
52186    }
52187    [type, subtype] = getFontFileType(file, properties);
52188    if (type !== this.type || subtype !== this.subtype) {
52189      (0, _util.info)("Inconsistent font file Type/SubType, expected: " + `${this.type}/${this.subtype} but found: ${type}/${subtype}.`);
52190    }
52191    let data;
52192    try {
52193      switch (type) {
52194        case "MMType1":
52195          (0, _util.info)("MMType1 font (" + name + "), falling back to Type1.");
52196        case "Type1":
52197        case "CIDFontType0":
52198          this.mimetype = "font/opentype";
52199          const cff = subtype === "Type1C" || subtype === "CIDFontType0C" ? new _cff_font.CFFFont(file, properties) : new _type1_font.Type1Font(name, file, properties);
52200          adjustWidths(properties);
52201          data = this.convert(name, cff, properties);
52202          break;
52203        case "OpenType":
52204        case "TrueType":
52205        case "CIDFontType2":
52206          this.mimetype = "font/opentype";
52207          data = this.checkAndRepair(name, file, properties);
52208          if (this.isOpenType) {
52209            adjustWidths(properties);
52210            type = "OpenType";
52211          }
52212          break;
52213        default:
52214          throw new _util.FormatError(`Font ${type} is not supported`);
52215      }
52216    } catch (e) {
52217      (0, _util.warn)(e);
52218      this.fallbackToSystemFont(properties);
52219      return;
52220    }
52221    amendFallbackToUnicode(properties);
52222    this.data = data;
52223    this.type = type;
52224    this.subtype = subtype;
52225    this.fontMatrix = properties.fontMatrix;
52226    this.widths = properties.widths;
52227    this.defaultWidth = properties.defaultWidth;
52228    this.toUnicode = properties.toUnicode;
52229    this.seacMap = properties.seacMap;
52230  }
52231  get renderer() {
52232    const renderer = _font_renderer.FontRendererFactory.create(this, _fonts_utils.SEAC_ANALYSIS_ENABLED);
52233    return (0, _util.shadow)(this, "renderer", renderer);
52234  }
52235  exportData(extraProperties = false) {
52236    const exportDataProperties = extraProperties ? [...EXPORT_DATA_PROPERTIES, ...EXPORT_DATA_EXTRA_PROPERTIES] : EXPORT_DATA_PROPERTIES;
52237    const data = Object.create(null);
52238    let property, value;
52239    for (property of exportDataProperties) {
52240      value = this[property];
52241      if (value !== undefined) {
52242        data[property] = value;
52243      }
52244    }
52245    return data;
52246  }
52247  fallbackToSystemFont(properties) {
52248    this.missingFile = true;
52249    const {
52250      name,
52251      type
52252    } = this;
52253    let fontName = (0, _fonts_utils.normalizeFontName)(name);
52254    const stdFontMap = (0, _standard_fonts.getStdFontMap)(),
52255      nonStdFontMap = (0, _standard_fonts.getNonStdFontMap)();
52256    const isStandardFont = !!stdFontMap[fontName];
52257    const isMappedToStandardFont = !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]);
52258    fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName;
52259    const fontBasicMetricsMap = (0, _metrics.getFontBasicMetrics)();
52260    const metrics = fontBasicMetricsMap[fontName];
52261    if (metrics) {
52262      if (isNaN(this.ascent)) {
52263        this.ascent = metrics.ascent / PDF_GLYPH_SPACE_UNITS;
52264      }
52265      if (isNaN(this.descent)) {
52266        this.descent = metrics.descent / PDF_GLYPH_SPACE_UNITS;
52267      }
52268      if (isNaN(this.capHeight)) {
52269        this.capHeight = metrics.capHeight / PDF_GLYPH_SPACE_UNITS;
52270      }
52271    }
52272    this.bold = /bold/gi.test(fontName);
52273    this.italic = /oblique|italic/gi.test(fontName);
52274    this.black = /Black/g.test(name);
52275    const isNarrow = /Narrow/g.test(name);
52276    this.remeasure = (!isStandardFont || isNarrow) && Object.keys(this.widths).length > 0;
52277    if ((isStandardFont || isMappedToStandardFont) && type === "CIDFontType2" && this.cidEncoding.startsWith("Identity-")) {
52278      const cidToGidMap = properties.cidToGidMap;
52279      const map = [];
52280      applyStandardFontGlyphMap(map, (0, _standard_fonts.getGlyphMapForStandardFonts)());
52281      if (/Arial-?Black/i.test(name)) {
52282        applyStandardFontGlyphMap(map, (0, _standard_fonts.getSupplementalGlyphMapForArialBlack)());
52283      } else if (/Calibri/i.test(name)) {
52284        applyStandardFontGlyphMap(map, (0, _standard_fonts.getSupplementalGlyphMapForCalibri)());
52285      }
52286      if (cidToGidMap) {
52287        for (const charCode in map) {
52288          const cid = map[charCode];
52289          if (cidToGidMap[cid] !== undefined) {
52290            map[+charCode] = cidToGidMap[cid];
52291          }
52292        }
52293        if (cidToGidMap.length !== this.toUnicode.length && properties.hasIncludedToUnicodeMap && this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
52294          this.toUnicode.forEach(function (charCode, unicodeCharCode) {
52295            const cid = map[charCode];
52296            if (cidToGidMap[cid] === undefined) {
52297              map[+charCode] = unicodeCharCode;
52298            }
52299          });
52300        }
52301      }
52302      if (!(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) {
52303        this.toUnicode.forEach(function (charCode, unicodeCharCode) {
52304          map[+charCode] = unicodeCharCode;
52305        });
52306      }
52307      this.toFontChar = map;
52308      this.toUnicode = new _to_unicode_map.ToUnicodeMap(map);
52309    } else if (/Symbol/i.test(fontName)) {
52310      this.toFontChar = buildToFontChar(_encodings.SymbolSetEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences);
52311    } else if (/Dingbats/i.test(fontName)) {
52312      this.toFontChar = buildToFontChar(_encodings.ZapfDingbatsEncoding, (0, _glyphlist.getDingbatsGlyphsUnicode)(), this.differences);
52313    } else if (isStandardFont) {
52314      const map = buildToFontChar(this.defaultEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences);
52315      if (type === "CIDFontType2" && !this.cidEncoding.startsWith("Identity-") && !(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) {
52316        this.toUnicode.forEach(function (charCode, unicodeCharCode) {
52317          map[+charCode] = unicodeCharCode;
52318        });
52319      }
52320      this.toFontChar = map;
52321    } else {
52322      const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
52323      const map = [];
52324      this.toUnicode.forEach((charCode, unicodeCharCode) => {
52325        if (!this.composite) {
52326          const glyphName = this.differences[charCode] || this.defaultEncoding[charCode];
52327          const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
52328          if (unicode !== -1) {
52329            unicodeCharCode = unicode;
52330          }
52331        }
52332        map[+charCode] = unicodeCharCode;
52333      });
52334      if (this.composite && this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
52335        if (/Tahoma|Verdana/i.test(name)) {
52336          applyStandardFontGlyphMap(map, (0, _standard_fonts.getGlyphMapForStandardFonts)());
52337        }
52338      }
52339      this.toFontChar = map;
52340    }
52341    amendFallbackToUnicode(properties);
52342    this.loadedName = fontName.split("-")[0];
52343  }
52344  checkAndRepair(name, font, properties) {
52345    const VALID_TABLES = ["OS/2", "cmap", "head", "hhea", "hmtx", "maxp", "name", "post", "loca", "glyf", "fpgm", "prep", "cvt ", "CFF "];
52346    function readTables(file, numTables) {
52347      const tables = Object.create(null);
52348      tables["OS/2"] = null;
52349      tables.cmap = null;
52350      tables.head = null;
52351      tables.hhea = null;
52352      tables.hmtx = null;
52353      tables.maxp = null;
52354      tables.name = null;
52355      tables.post = null;
52356      for (let i = 0; i < numTables; i++) {
52357        const table = readTableEntry(file);
52358        if (!VALID_TABLES.includes(table.tag)) {
52359          continue;
52360        }
52361        if (table.length === 0) {
52362          continue;
52363        }
52364        tables[table.tag] = table;
52365      }
52366      return tables;
52367    }
52368    function readTableEntry(file) {
52369      const tag = file.getString(4);
52370      const checksum = file.getInt32() >>> 0;
52371      const offset = file.getInt32() >>> 0;
52372      const length = file.getInt32() >>> 0;
52373      const previousPosition = file.pos;
52374      file.pos = file.start || 0;
52375      file.skip(offset);
52376      const data = file.getBytes(length);
52377      file.pos = previousPosition;
52378      if (tag === "head") {
52379        data[8] = data[9] = data[10] = data[11] = 0;
52380        data[17] |= 0x20;
52381      }
52382      return {
52383        tag,
52384        checksum,
52385        length,
52386        offset,
52387        data
52388      };
52389    }
52390    function readOpenTypeHeader(ttf) {
52391      return {
52392        version: ttf.getString(4),
52393        numTables: ttf.getUint16(),
52394        searchRange: ttf.getUint16(),
52395        entrySelector: ttf.getUint16(),
52396        rangeShift: ttf.getUint16()
52397      };
52398    }
52399    function readTrueTypeCollectionHeader(ttc) {
52400      const ttcTag = ttc.getString(4);
52401      (0, _util.assert)(ttcTag === "ttcf", "Must be a TrueType Collection font.");
52402      const majorVersion = ttc.getUint16();
52403      const minorVersion = ttc.getUint16();
52404      const numFonts = ttc.getInt32() >>> 0;
52405      const offsetTable = [];
52406      for (let i = 0; i < numFonts; i++) {
52407        offsetTable.push(ttc.getInt32() >>> 0);
52408      }
52409      const header = {
52410        ttcTag,
52411        majorVersion,
52412        minorVersion,
52413        numFonts,
52414        offsetTable
52415      };
52416      switch (majorVersion) {
52417        case 1:
52418          return header;
52419        case 2:
52420          header.dsigTag = ttc.getInt32() >>> 0;
52421          header.dsigLength = ttc.getInt32() >>> 0;
52422          header.dsigOffset = ttc.getInt32() >>> 0;
52423          return header;
52424      }
52425      throw new _util.FormatError(`Invalid TrueType Collection majorVersion: ${majorVersion}.`);
52426    }
52427    function readTrueTypeCollectionData(ttc, fontName) {
52428      const {
52429        numFonts,
52430        offsetTable
52431      } = readTrueTypeCollectionHeader(ttc);
52432      const fontNameParts = fontName.split("+");
52433      let fallbackData;
52434      for (let i = 0; i < numFonts; i++) {
52435        ttc.pos = (ttc.start || 0) + offsetTable[i];
52436        const potentialHeader = readOpenTypeHeader(ttc);
52437        const potentialTables = readTables(ttc, potentialHeader.numTables);
52438        if (!potentialTables.name) {
52439          throw new _util.FormatError('TrueType Collection font must contain a "name" table.');
52440        }
52441        const [nameTable] = readNameTable(potentialTables.name);
52442        for (let j = 0, jj = nameTable.length; j < jj; j++) {
52443          for (let k = 0, kk = nameTable[j].length; k < kk; k++) {
52444            const nameEntry = nameTable[j][k]?.replaceAll(/\s/g, "");
52445            if (!nameEntry) {
52446              continue;
52447            }
52448            if (nameEntry === fontName) {
52449              return {
52450                header: potentialHeader,
52451                tables: potentialTables
52452              };
52453            }
52454            if (fontNameParts.length < 2) {
52455              continue;
52456            }
52457            for (const part of fontNameParts) {
52458              if (nameEntry === part) {
52459                fallbackData = {
52460                  name: part,
52461                  header: potentialHeader,
52462                  tables: potentialTables
52463                };
52464              }
52465            }
52466          }
52467        }
52468      }
52469      if (fallbackData) {
52470        (0, _util.warn)(`TrueType Collection does not contain "${fontName}" font, ` + `falling back to "${fallbackData.name}" font instead.`);
52471        return {
52472          header: fallbackData.header,
52473          tables: fallbackData.tables
52474        };
52475      }
52476      throw new _util.FormatError(`TrueType Collection does not contain "${fontName}" font.`);
52477    }
52478    function readCmapTable(cmap, file, isSymbolicFont, hasEncoding) {
52479      if (!cmap) {
52480        (0, _util.warn)("No cmap table available.");
52481        return {
52482          platformId: -1,
52483          encodingId: -1,
52484          mappings: [],
52485          hasShortCmap: false
52486        };
52487      }
52488      let segment;
52489      let start = (file.start || 0) + cmap.offset;
52490      file.pos = start;
52491      file.skip(2);
52492      const numTables = file.getUint16();
52493      let potentialTable;
52494      let canBreak = false;
vendor: 5,454 bytes, lines 52495-52655
52495      for (let i = 0; i < numTables; i++) {
52496        const platformId = file.getUint16();
52497        const encodingId = file.getUint16();
52498        const offset = file.getInt32() >>> 0;
52499        let useTable = false;
52500        if (potentialTable?.platformId === platformId && potentialTable?.encodingId === encodingId) {
52501          continue;
52502        }
52503        if (platformId === 0 && (encodingId === 0 || encodingId === 1 || encodingId === 3)) {
52504          useTable = true;
52505        } else if (platformId === 1 && encodingId === 0) {
52506          useTable = true;
52507        } else if (platformId === 3 && encodingId === 1 && (hasEncoding || !potentialTable)) {
52508          useTable = true;
52509          if (!isSymbolicFont) {
52510            canBreak = true;
52511          }
52512        } else if (isSymbolicFont && platformId === 3 && encodingId === 0) {
52513          useTable = true;
52514          let correctlySorted = true;
52515          if (i < numTables - 1) {
52516            const nextBytes = file.peekBytes(2),
52517              nextPlatformId = int16(nextBytes[0], nextBytes[1]);
52518            if (nextPlatformId < platformId) {
52519              correctlySorted = false;
52520            }
52521          }
52522          if (correctlySorted) {
52523            canBreak = true;
52524          }
52525        }
52526        if (useTable) {
52527          potentialTable = {
52528            platformId,
52529            encodingId,
52530            offset
52531          };
52532        }
52533        if (canBreak) {
52534          break;
52535        }
52536      }
52537      if (potentialTable) {
52538        file.pos = start + potentialTable.offset;
52539      }
52540      if (!potentialTable || file.peekByte() === -1) {
52541        (0, _util.warn)("Could not find a preferred cmap table.");
52542        return {
52543          platformId: -1,
52544          encodingId: -1,
52545          mappings: [],
52546          hasShortCmap: false
52547        };
52548      }
52549      const format = file.getUint16();
52550      let hasShortCmap = false;
52551      const mappings = [];
52552      let j, glyphId;
52553      if (format === 0) {
52554        file.skip(2 + 2);
52555        for (j = 0; j < 256; j++) {
52556          const index = file.getByte();
52557          if (!index) {
52558            continue;
52559          }
52560          mappings.push({
52561            charCode: j,
52562            glyphId: index
52563          });
52564        }
52565        hasShortCmap = true;
52566      } else if (format === 2) {
52567        file.skip(2 + 2);
52568        const subHeaderKeys = [];
52569        let maxSubHeaderKey = 0;
52570        for (let i = 0; i < 256; i++) {
52571          const subHeaderKey = file.getUint16() >> 3;
52572          subHeaderKeys.push(subHeaderKey);
52573          maxSubHeaderKey = Math.max(subHeaderKey, maxSubHeaderKey);
52574        }
52575        const subHeaders = [];
52576        for (let i = 0; i <= maxSubHeaderKey; i++) {
52577          subHeaders.push({
52578            firstCode: file.getUint16(),
52579            entryCount: file.getUint16(),
52580            idDelta: signedInt16(file.getByte(), file.getByte()),
52581            idRangePos: file.pos + file.getUint16()
52582          });
52583        }
52584        for (let i = 0; i < 256; i++) {
52585          if (subHeaderKeys[i] === 0) {
52586            file.pos = subHeaders[0].idRangePos + 2 * i;
52587            glyphId = file.getUint16();
52588            mappings.push({
52589              charCode: i,
52590              glyphId
52591            });
52592          } else {
52593            const s = subHeaders[subHeaderKeys[i]];
52594            for (j = 0; j < s.entryCount; j++) {
52595              const charCode = (i << 8) + j + s.firstCode;
52596              file.pos = s.idRangePos + 2 * j;
52597              glyphId = file.getUint16();
52598              if (glyphId !== 0) {
52599                glyphId = (glyphId + s.idDelta) % 65536;
52600              }
52601              mappings.push({
52602                charCode,
52603                glyphId
52604              });
52605            }
52606          }
52607        }
52608      } else if (format === 4) {
52609        file.skip(2 + 2);
52610        const segCount = file.getUint16() >> 1;
52611        file.skip(6);
52612        const segments = [];
52613        let segIndex;
52614        for (segIndex = 0; segIndex < segCount; segIndex++) {
52615          segments.push({
52616            end: file.getUint16()
52617          });
52618        }
52619        file.skip(2);
52620        for (segIndex = 0; segIndex < segCount; segIndex++) {
52621          segments[segIndex].start = file.getUint16();
52622        }
52623        for (segIndex = 0; segIndex < segCount; segIndex++) {
52624          segments[segIndex].delta = file.getUint16();
52625        }
52626        let offsetsCount = 0,
52627          offsetIndex;
52628        for (segIndex = 0; segIndex < segCount; segIndex++) {
52629          segment = segments[segIndex];
52630          const rangeOffset = file.getUint16();
52631          if (!rangeOffset) {
52632            segment.offsetIndex = -1;
52633            continue;
52634          }
52635          offsetIndex = (rangeOffset >> 1) - (segCount - segIndex);
52636          segment.offsetIndex = offsetIndex;
52637          offsetsCount = Math.max(offsetsCount, offsetIndex + segment.end - segment.start + 1);
52638        }
52639        const offsets = [];
52640        for (j = 0; j < offsetsCount; j++) {
52641          offsets.push(file.getUint16());
52642        }
52643        for (segIndex = 0; segIndex < segCount; segIndex++) {
52644          segment = segments[segIndex];
52645          start = segment.start;
52646          const end = segment.end;
52647          const delta = segment.delta;
52648          offsetIndex = segment.offsetIndex;
52649          for (j = start; j <= end; j++) {
52650            if (j === 0xffff) {
52651              continue;
52652            }
52653            glyphId = offsetIndex < 0 ? j : offsets[offsetIndex + j - start];
52654            glyphId = glyphId + delta & 0xffff;
52655            mappings.push({
vendor: 10,487 bytes, lines 52656-52960
52656              charCode: j,
52657              glyphId
52658            });
52659          }
52660        }
52661      } else if (format === 6) {
52662        file.skip(2 + 2);
52663        const firstCode = file.getUint16();
52664        const entryCount = file.getUint16();
52665        for (j = 0; j < entryCount; j++) {
52666          glyphId = file.getUint16();
52667          const charCode = firstCode + j;
52668          mappings.push({
52669            charCode,
52670            glyphId
52671          });
52672        }
52673      } else if (format === 12) {
52674        file.skip(2 + 4 + 4);
52675        const nGroups = file.getInt32() >>> 0;
52676        for (j = 0; j < nGroups; j++) {
52677          const startCharCode = file.getInt32() >>> 0;
52678          const endCharCode = file.getInt32() >>> 0;
52679          let glyphCode = file.getInt32() >>> 0;
52680          for (let charCode = startCharCode; charCode <= endCharCode; charCode++) {
52681            mappings.push({
52682              charCode,
52683              glyphId: glyphCode++
52684            });
52685          }
52686        }
52687      } else {
52688        (0, _util.warn)("cmap table has unsupported format: " + format);
52689        return {
52690          platformId: -1,
52691          encodingId: -1,
52692          mappings: [],
52693          hasShortCmap: false
52694        };
52695      }
52696      mappings.sort(function (a, b) {
52697        return a.charCode - b.charCode;
52698      });
52699      for (let i = 1; i < mappings.length; i++) {
52700        if (mappings[i - 1].charCode === mappings[i].charCode) {
52701          mappings.splice(i, 1);
52702          i--;
52703        }
52704      }
52705      return {
52706        platformId: potentialTable.platformId,
52707        encodingId: potentialTable.encodingId,
52708        mappings,
52709        hasShortCmap
52710      };
52711    }
52712    function sanitizeMetrics(file, header, metrics, headTable, numGlyphs, dupFirstEntry) {
52713      if (!header) {
52714        if (metrics) {
52715          metrics.data = null;
52716        }
52717        return;
52718      }
52719      file.pos = (file.start || 0) + header.offset;
52720      file.pos += 4;
52721      file.pos += 2;
52722      file.pos += 2;
52723      file.pos += 2;
52724      file.pos += 2;
52725      file.pos += 2;
52726      file.pos += 2;
52727      file.pos += 2;
52728      file.pos += 2;
52729      file.pos += 2;
52730      const caretOffset = file.getUint16();
52731      file.pos += 8;
52732      file.pos += 2;
52733      let numOfMetrics = file.getUint16();
52734      if (caretOffset !== 0) {
52735        const macStyle = int16(headTable.data[44], headTable.data[45]);
52736        if (!(macStyle & 2)) {
52737          header.data[22] = 0;
52738          header.data[23] = 0;
52739        }
52740      }
52741      if (numOfMetrics > numGlyphs) {
52742        (0, _util.info)(`The numOfMetrics (${numOfMetrics}) should not be ` + `greater than the numGlyphs (${numGlyphs}).`);
52743        numOfMetrics = numGlyphs;
52744        header.data[34] = (numOfMetrics & 0xff00) >> 8;
52745        header.data[35] = numOfMetrics & 0x00ff;
52746      }
52747      const numOfSidebearings = numGlyphs - numOfMetrics;
52748      const numMissing = numOfSidebearings - (metrics.length - numOfMetrics * 4 >> 1);
52749      if (numMissing > 0) {
52750        const entries = new Uint8Array(metrics.length + numMissing * 2);
52751        entries.set(metrics.data);
52752        if (dupFirstEntry) {
52753          entries[metrics.length] = metrics.data[2];
52754          entries[metrics.length + 1] = metrics.data[3];
52755        }
52756        metrics.data = entries;
52757      }
52758    }
52759    function sanitizeGlyph(source, sourceStart, sourceEnd, dest, destStart, hintsValid) {
52760      const glyphProfile = {
52761        length: 0,
52762        sizeOfInstructions: 0
52763      };
52764      if (sourceStart < 0 || sourceStart >= source.length || sourceEnd > source.length || sourceEnd - sourceStart <= 12) {
52765        return glyphProfile;
52766      }
52767      const glyf = source.subarray(sourceStart, sourceEnd);
52768      const xMin = signedInt16(glyf[2], glyf[3]);
52769      const yMin = signedInt16(glyf[4], glyf[5]);
52770      const xMax = signedInt16(glyf[6], glyf[7]);
52771      const yMax = signedInt16(glyf[8], glyf[9]);
52772      if (xMin > xMax) {
52773        writeSignedInt16(glyf, 2, xMax);
52774        writeSignedInt16(glyf, 6, xMin);
52775      }
52776      if (yMin > yMax) {
52777        writeSignedInt16(glyf, 4, yMax);
52778        writeSignedInt16(glyf, 8, yMin);
52779      }
52780      const contoursCount = signedInt16(glyf[0], glyf[1]);
52781      if (contoursCount < 0) {
52782        if (contoursCount < -1) {
52783          return glyphProfile;
52784        }
52785        dest.set(glyf, destStart);
52786        glyphProfile.length = glyf.length;
52787        return glyphProfile;
52788      }
52789      let i,
52790        j = 10,
52791        flagsCount = 0;
52792      for (i = 0; i < contoursCount; i++) {
52793        const endPoint = glyf[j] << 8 | glyf[j + 1];
52794        flagsCount = endPoint + 1;
52795        j += 2;
52796      }
52797      const instructionsStart = j;
52798      const instructionsLength = glyf[j] << 8 | glyf[j + 1];
52799      glyphProfile.sizeOfInstructions = instructionsLength;
52800      j += 2 + instructionsLength;
52801      const instructionsEnd = j;
52802      let coordinatesLength = 0;
52803      for (i = 0; i < flagsCount; i++) {
52804        const flag = glyf[j++];
52805        if (flag & 0xc0) {
52806          glyf[j - 1] = flag & 0x3f;
52807        }
52808        let xLength = 2;
52809        if (flag & 2) {
52810          xLength = 1;
52811        } else if (flag & 16) {
52812          xLength = 0;
52813        }
52814        let yLength = 2;
52815        if (flag & 4) {
52816          yLength = 1;
52817        } else if (flag & 32) {
52818          yLength = 0;
52819        }
52820        const xyLength = xLength + yLength;
52821        coordinatesLength += xyLength;
52822        if (flag & 8) {
52823          const repeat = glyf[j++];
52824          if (repeat === 0) {
52825            glyf[j - 1] ^= 8;
52826          }
52827          i += repeat;
52828          coordinatesLength += repeat * xyLength;
52829        }
52830      }
52831      if (coordinatesLength === 0) {
52832        return glyphProfile;
52833      }
52834      let glyphDataLength = j + coordinatesLength;
52835      if (glyphDataLength > glyf.length) {
52836        return glyphProfile;
52837      }
52838      if (!hintsValid && instructionsLength > 0) {
52839        dest.set(glyf.subarray(0, instructionsStart), destStart);
52840        dest.set([0, 0], destStart + instructionsStart);
52841        dest.set(glyf.subarray(instructionsEnd, glyphDataLength), destStart + instructionsStart + 2);
52842        glyphDataLength -= instructionsLength;
52843        if (glyf.length - glyphDataLength > 3) {
52844          glyphDataLength = glyphDataLength + 3 & ~3;
52845        }
52846        glyphProfile.length = glyphDataLength;
52847        return glyphProfile;
52848      }
52849      if (glyf.length - glyphDataLength > 3) {
52850        glyphDataLength = glyphDataLength + 3 & ~3;
52851        dest.set(glyf.subarray(0, glyphDataLength), destStart);
52852        glyphProfile.length = glyphDataLength;
52853        return glyphProfile;
52854      }
52855      dest.set(glyf, destStart);
52856      glyphProfile.length = glyf.length;
52857      return glyphProfile;
52858    }
52859    function sanitizeHead(head, numGlyphs, locaLength) {
52860      const data = head.data;
52861      const version = int32(data[0], data[1], data[2], data[3]);
52862      if (version >> 16 !== 1) {
52863        (0, _util.info)("Attempting to fix invalid version in head table: " + version);
52864        data[0] = 0;
52865        data[1] = 1;
52866        data[2] = 0;
52867        data[3] = 0;
52868      }
52869      const indexToLocFormat = int16(data[50], data[51]);
52870      if (indexToLocFormat < 0 || indexToLocFormat > 1) {
52871        (0, _util.info)("Attempting to fix invalid indexToLocFormat in head table: " + indexToLocFormat);
52872        const numGlyphsPlusOne = numGlyphs + 1;
52873        if (locaLength === numGlyphsPlusOne << 1) {
52874          data[50] = 0;
52875          data[51] = 0;
52876        } else if (locaLength === numGlyphsPlusOne << 2) {
52877          data[50] = 0;
52878          data[51] = 1;
52879        } else {
52880          throw new _util.FormatError("Could not fix indexToLocFormat: " + indexToLocFormat);
52881        }
52882      }
52883    }
52884    function sanitizeGlyphLocations(loca, glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions) {
52885      let itemSize, itemDecode, itemEncode;
52886      if (isGlyphLocationsLong) {
52887        itemSize = 4;
52888        itemDecode = function fontItemDecodeLong(data, offset) {
52889          return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
52890        };
52891        itemEncode = function fontItemEncodeLong(data, offset, value) {
52892          data[offset] = value >>> 24 & 0xff;
52893          data[offset + 1] = value >> 16 & 0xff;
52894          data[offset + 2] = value >> 8 & 0xff;
52895          data[offset + 3] = value & 0xff;
52896        };
52897      } else {
52898        itemSize = 2;
52899        itemDecode = function fontItemDecode(data, offset) {
52900          return data[offset] << 9 | data[offset + 1] << 1;
52901        };
52902        itemEncode = function fontItemEncode(data, offset, value) {
52903          data[offset] = value >> 9 & 0xff;
52904          data[offset + 1] = value >> 1 & 0xff;
52905        };
52906      }
52907      const numGlyphsOut = dupFirstEntry ? numGlyphs + 1 : numGlyphs;
52908      const locaDataSize = itemSize * (1 + numGlyphsOut);
52909      const locaData = new Uint8Array(locaDataSize);
52910      locaData.set(loca.data.subarray(0, locaDataSize));
52911      loca.data = locaData;
52912      const oldGlyfData = glyf.data;
52913      const oldGlyfDataLength = oldGlyfData.length;
52914      const newGlyfData = new Uint8Array(oldGlyfDataLength);
52915      let i, j;
52916      const locaEntries = [];
52917      for (i = 0, j = 0; i < numGlyphs + 1; i++, j += itemSize) {
52918        let offset = itemDecode(locaData, j);
52919        if (offset > oldGlyfDataLength) {
52920          offset = oldGlyfDataLength;
52921        }
52922        locaEntries.push({
52923          index: i,
52924          offset,
52925          endOffset: 0
52926        });
52927      }
52928      locaEntries.sort((a, b) => {
52929        return a.offset - b.offset;
52930      });
52931      for (i = 0; i < numGlyphs; i++) {
52932        locaEntries[i].endOffset = locaEntries[i + 1].offset;
52933      }
52934      locaEntries.sort((a, b) => {
52935        return a.index - b.index;
52936      });
52937      for (i = 0; i < numGlyphs; i++) {
52938        const {
52939          offset,
52940          endOffset
52941        } = locaEntries[i];
52942        if (offset !== 0 || endOffset !== 0) {
52943          break;
52944        }
52945        const nextOffset = locaEntries[i + 1].offset;
52946        if (nextOffset === 0) {
52947          continue;
52948        }
52949        locaEntries[i].endOffset = nextOffset;
52950        break;
52951      }
52952      const missingGlyphs = Object.create(null);
52953      let writeOffset = 0;
52954      itemEncode(locaData, 0, writeOffset);
52955      for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) {
52956        const glyphProfile = sanitizeGlyph(oldGlyfData, locaEntries[i].offset, locaEntries[i].endOffset, newGlyfData, writeOffset, hintsValid);
52957        const newLength = glyphProfile.length;
52958        if (newLength === 0) {
52959          missingGlyphs[i] = true;
52960        }
vendor: 5,014 bytes, lines 52961-53106
52961        if (glyphProfile.sizeOfInstructions > maxSizeOfInstructions) {
52962          maxSizeOfInstructions = glyphProfile.sizeOfInstructions;
52963        }
52964        writeOffset += newLength;
52965        itemEncode(locaData, j, writeOffset);
52966      }
52967      if (writeOffset === 0) {
52968        const simpleGlyph = new Uint8Array([0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 0]);
52969        for (i = 0, j = itemSize; i < numGlyphsOut; i++, j += itemSize) {
52970          itemEncode(locaData, j, simpleGlyph.length);
52971        }
52972        glyf.data = simpleGlyph;
52973      } else if (dupFirstEntry) {
52974        const firstEntryLength = itemDecode(locaData, itemSize);
52975        if (newGlyfData.length > firstEntryLength + writeOffset) {
52976          glyf.data = newGlyfData.subarray(0, firstEntryLength + writeOffset);
52977        } else {
52978          glyf.data = new Uint8Array(firstEntryLength + writeOffset);
52979          glyf.data.set(newGlyfData.subarray(0, writeOffset));
52980        }
52981        glyf.data.set(newGlyfData.subarray(0, firstEntryLength), writeOffset);
52982        itemEncode(loca.data, locaData.length - itemSize, writeOffset + firstEntryLength);
52983      } else {
52984        glyf.data = newGlyfData.subarray(0, writeOffset);
52985      }
52986      return {
52987        missingGlyphs,
52988        maxSizeOfInstructions
52989      };
52990    }
52991    function readPostScriptTable(post, propertiesObj, maxpNumGlyphs) {
52992      const start = (font.start || 0) + post.offset;
52993      font.pos = start;
52994      const length = post.length,
52995        end = start + length;
52996      const version = font.getInt32();
52997      font.skip(28);
52998      let glyphNames;
52999      let valid = true;
53000      let i;
53001      switch (version) {
53002        case 0x00010000:
53003          glyphNames = _fonts_utils.MacStandardGlyphOrdering;
53004          break;
53005        case 0x00020000:
53006          const numGlyphs = font.getUint16();
53007          if (numGlyphs !== maxpNumGlyphs) {
53008            valid = false;
53009            break;
53010          }
53011          const glyphNameIndexes = [];
53012          for (i = 0; i < numGlyphs; ++i) {
53013            const index = font.getUint16();
53014            if (index >= 32768) {
53015              valid = false;
53016              break;
53017            }
53018            glyphNameIndexes.push(index);
53019          }
53020          if (!valid) {
53021            break;
53022          }
53023          const customNames = [],
53024            strBuf = [];
53025          while (font.pos < end) {
53026            const stringLength = font.getByte();
53027            strBuf.length = stringLength;
53028            for (i = 0; i < stringLength; ++i) {
53029              strBuf[i] = String.fromCharCode(font.getByte());
53030            }
53031            customNames.push(strBuf.join(""));
53032          }
53033          glyphNames = [];
53034          for (i = 0; i < numGlyphs; ++i) {
53035            const j = glyphNameIndexes[i];
53036            if (j < 258) {
53037              glyphNames.push(_fonts_utils.MacStandardGlyphOrdering[j]);
53038              continue;
53039            }
53040            glyphNames.push(customNames[j - 258]);
53041          }
53042          break;
53043        case 0x00030000:
53044          break;
53045        default:
53046          (0, _util.warn)("Unknown/unsupported post table version " + version);
53047          valid = false;
53048          if (propertiesObj.defaultEncoding) {
53049            glyphNames = propertiesObj.defaultEncoding;
53050          }
53051          break;
53052      }
53053      propertiesObj.glyphNames = glyphNames;
53054      return valid;
53055    }
53056    function readNameTable(nameTable) {
53057      const start = (font.start || 0) + nameTable.offset;
53058      font.pos = start;
53059      const names = [[], []],
53060        records = [];
53061      const length = nameTable.length,
53062        end = start + length;
53063      const format = font.getUint16();
53064      const FORMAT_0_HEADER_LENGTH = 6;
53065      if (format !== 0 || length < FORMAT_0_HEADER_LENGTH) {
53066        return [names, records];
53067      }
53068      const numRecords = font.getUint16();
53069      const stringsStart = font.getUint16();
53070      const NAME_RECORD_LENGTH = 12;
53071      let i, ii;
53072      for (i = 0; i < numRecords && font.pos + NAME_RECORD_LENGTH <= end; i++) {
53073        const r = {
53074          platform: font.getUint16(),
53075          encoding: font.getUint16(),
53076          language: font.getUint16(),
53077          name: font.getUint16(),
53078          length: font.getUint16(),
53079          offset: font.getUint16()
53080        };
53081        if (isMacNameRecord(r) || isWinNameRecord(r)) {
53082          records.push(r);
53083        }
53084      }
53085      for (i = 0, ii = records.length; i < ii; i++) {
53086        const record = records[i];
53087        if (record.length <= 0) {
53088          continue;
53089        }
53090        const pos = start + stringsStart + record.offset;
53091        if (pos + record.length > end) {
53092          continue;
53093        }
53094        font.pos = pos;
53095        const nameIndex = record.name;
53096        if (record.encoding) {
53097          let str = "";
53098          for (let j = 0, jj = record.length; j < jj; j += 2) {
53099            str += String.fromCharCode(font.getUint16());
53100          }
53101          names[1][nameIndex] = str;
53102        } else {
53103          names[0][nameIndex] = font.getString(record.length);
53104        }
53105      }
53106      return [names, records]
vendor: 8,720 bytes, lines 53106-53364
53106;
53107    }
53108    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];
53109    function sanitizeTTProgram(table, ttContext) {
53110      let data = table.data;
53111      let i = 0,
53112        j,
53113        n,
53114        b,
53115        funcId,
53116        pc,
53117        lastEndf = 0,
53118        lastDeff = 0;
53119      const stack = [];
53120      const callstack = [];
53121      const functionsCalled = [];
53122      let tooComplexToFollowFunctions = ttContext.tooComplexToFollowFunctions;
53123      let inFDEF = false,
53124        ifLevel = 0,
53125        inELSE = 0;
53126      for (let ii = data.length; i < ii;) {
53127        const op = data[i++];
53128        if (op === 0x40) {
53129          n = data[i++];
53130          if (inFDEF || inELSE) {
53131            i += n;
53132          } else {
53133            for (j = 0; j < n; j++) {
53134              stack.push(data[i++]);
53135            }
53136          }
53137        } else if (op === 0x41) {
53138          n = data[i++];
53139          if (inFDEF || inELSE) {
53140            i += n * 2;
53141          } else {
53142            for (j = 0; j < n; j++) {
53143              b = data[i++];
53144              stack.push(b << 8 | data[i++]);
53145            }
53146          }
53147        } else if ((op & 0xf8) === 0xb0) {
53148          n = op - 0xb0 + 1;
53149          if (inFDEF || inELSE) {
53150            i += n;
53151          } else {
53152            for (j = 0; j < n; j++) {
53153              stack.push(data[i++]);
53154            }
53155          }
53156        } else if ((op & 0xf8) === 0xb8) {
53157          n = op - 0xb8 + 1;
53158          if (inFDEF || inELSE) {
53159            i += n * 2;
53160          } else {
53161            for (j = 0; j < n; j++) {
53162              b = data[i++];
53163              stack.push(b << 8 | data[i++]);
53164            }
53165          }
53166        } else if (op === 0x2b && !tooComplexToFollowFunctions) {
53167          if (!inFDEF && !inELSE) {
53168            funcId = stack.at(-1);
53169            if (isNaN(funcId)) {
53170              (0, _util.info)("TT: CALL empty stack (or invalid entry).");
53171            } else {
53172              ttContext.functionsUsed[funcId] = true;
53173              if (funcId in ttContext.functionsStackDeltas) {
53174                const newStackLength = stack.length + ttContext.functionsStackDeltas[funcId];
53175                if (newStackLength < 0) {
53176                  (0, _util.warn)("TT: CALL invalid functions stack delta.");
53177                  ttContext.hintsValid = false;
53178                  return;
53179                }
53180                stack.length = newStackLength;
53181              } else if (funcId in ttContext.functionsDefined && !functionsCalled.includes(funcId)) {
53182                callstack.push({
53183                  data,
53184                  i,
53185                  stackTop: stack.length - 1
53186                });
53187                functionsCalled.push(funcId);
53188                pc = ttContext.functionsDefined[funcId];
53189                if (!pc) {
53190                  (0, _util.warn)("TT: CALL non-existent function");
53191                  ttContext.hintsValid = false;
53192                  return;
53193                }
53194                data = pc.data;
53195                i = pc.i;
53196              }
53197            }
53198          }
53199        } else if (op === 0x2c && !tooComplexToFollowFunctions) {
53200          if (inFDEF || inELSE) {
53201            (0, _util.warn)("TT: nested FDEFs not allowed");
53202            tooComplexToFollowFunctions = true;
53203          }
53204          inFDEF = true;
53205          lastDeff = i;
53206          funcId = stack.pop();
53207          ttContext.functionsDefined[funcId] = {
53208            data,
53209            i
53210          };
53211        } else if (op === 0x2d) {
53212          if (inFDEF) {
53213            inFDEF = false;
53214            lastEndf = i;
53215          } else {
53216            pc = callstack.pop();
53217            if (!pc) {
53218              (0, _util.warn)("TT: ENDF bad stack");
53219              ttContext.hintsValid = false;
53220              return;
53221            }
53222            funcId = functionsCalled.pop();
53223            data = pc.data;
53224            i = pc.i;
53225            ttContext.functionsStackDeltas[funcId] = stack.length - pc.stackTop;
53226          }
53227        } else if (op === 0x89) {
53228          if (inFDEF || inELSE) {
53229            (0, _util.warn)("TT: nested IDEFs not allowed");
53230            tooComplexToFollowFunctions = true;
53231          }
53232          inFDEF = true;
53233          lastDeff = i;
53234        } else if (op === 0x58) {
53235          ++ifLevel;
53236        } else if (op === 0x1b) {
53237          inELSE = ifLevel;
53238        } else if (op === 0x59) {
53239          if (inELSE === ifLevel) {
53240            inELSE = 0;
53241          }
53242          --ifLevel;
53243        } else if (op === 0x1c) {
53244          if (!inFDEF && !inELSE) {
53245            const offset = stack.at(-1);
53246            if (offset > 0) {
53247              i += offset - 1;
53248            }
53249          }
53250        }
53251        if (!inFDEF && !inELSE) {
53252          let stackDelta = 0;
53253          if (op <= 0x8e) {
53254            stackDelta = TTOpsStackDeltas[op];
53255          } else if (op >= 0xc0 && op <= 0xdf) {
53256            stackDelta = -1;
53257          } else if (op >= 0xe0) {
53258            stackDelta = -2;
53259          }
53260          if (op >= 0x71 && op <= 0x75) {
53261            n = stack.pop();
53262            if (!isNaN(n)) {
53263              stackDelta = -n * 2;
53264            }
53265          }
53266          while (stackDelta < 0 && stack.length > 0) {
53267            stack.pop();
53268            stackDelta++;
53269          }
53270          while (stackDelta > 0) {
53271            stack.push(NaN);
53272            stackDelta--;
53273          }
53274        }
53275      }
53276      ttContext.tooComplexToFollowFunctions = tooComplexToFollowFunctions;
53277      const content = [data];
53278      if (i > data.length) {
53279        content.push(new Uint8Array(i - data.length));
53280      }
53281      if (lastDeff > lastEndf) {
53282        (0, _util.warn)("TT: complementing a missing function tail");
53283        content.push(new Uint8Array([0x22, 0x2d]));
53284      }
53285      foldTTTable(table, content);
53286    }
53287    function checkInvalidFunctions(ttContext, maxFunctionDefs) {
53288      if (ttContext.tooComplexToFollowFunctions) {
53289        return;
53290      }
53291      if (ttContext.functionsDefined.length > maxFunctionDefs) {
53292        (0, _util.warn)("TT: more functions defined than expected");
53293        ttContext.hintsValid = false;
53294        return;
53295      }
53296      for (let j = 0, jj = ttContext.functionsUsed.length; j < jj; j++) {
53297        if (j > maxFunctionDefs) {
53298          (0, _util.warn)("TT: invalid function id: " + j);
53299          ttContext.hintsValid = false;
53300          return;
53301        }
53302        if (ttContext.functionsUsed[j] && !ttContext.functionsDefined[j]) {
53303          (0, _util.warn)("TT: undefined function: " + j);
53304          ttContext.hintsValid = false;
53305          return;
53306        }
53307      }
53308    }
53309    function foldTTTable(table, content) {
53310      if (content.length > 1) {
53311        let newLength = 0;
53312        let j, jj;
53313        for (j = 0, jj = content.length; j < jj; j++) {
53314          newLength += content[j].length;
53315        }
53316        newLength = newLength + 3 & ~3;
53317        const result = new Uint8Array(newLength);
53318        let pos = 0;
53319        for (j = 0, jj = content.length; j < jj; j++) {
53320          result.set(content[j], pos);
53321          pos += content[j].length;
53322        }
53323        table.data = result;
53324        table.length = newLength;
53325      }
53326    }
53327    function sanitizeTTPrograms(fpgm, prep, cvt, maxFunctionDefs) {
53328      const ttContext = {
53329        functionsDefined: [],
53330        functionsUsed: [],
53331        functionsStackDeltas: [],
53332        tooComplexToFollowFunctions: false,
53333        hintsValid: true
53334      };
53335      if (fpgm) {
53336        sanitizeTTProgram(fpgm, ttContext);
53337      }
53338      if (prep) {
53339        sanitizeTTProgram(prep, ttContext);
53340      }
53341      if (fpgm) {
53342        checkInvalidFunctions(ttContext, maxFunctionDefs);
53343      }
53344      if (cvt && cvt.length & 1) {
53345        const cvtData = new Uint8Array(cvt.length + 1);
53346        cvtData.set(cvt.data);
53347        cvt.data = cvtData;
53348      }
53349      return ttContext.hintsValid;
53350    }
53351    font = new _stream.Stream(new Uint8Array(font.getBytes()));
53352    let header, tables;
53353    if (isTrueTypeCollectionFile(font)) {
53354      const ttcData = readTrueTypeCollectionData(font, this.name);
53355      header = ttcData.header;
53356      tables = ttcData.tables;
53357    } else {
53358      header = readOpenTypeHeader(font);
53359      tables = readTables(font, header.numTables);
53360    }
53361    let cff, cffFile;
53362    const isTrueType = !tables["CFF "];
53363    if (!isTrueType) {
53364      const isComposite = properties.composite && (
vendor: 5,138 bytes, lines 53364-53491
53364properties.cidToGidMap?.length > 0 || !(properties.cMap instanceof _cmap.IdentityCMap));
53365      if (header.version === "OTTO" && !isComposite || !tables.head || !tables.hhea || !tables.maxp || !tables.post) {
53366        cffFile = new _stream.Stream(tables["CFF "].data);
53367        cff = new _cff_font.CFFFont(cffFile, properties);
53368        adjustWidths(properties);
53369        return this.convert(name, cff, properties);
53370      }
53371      delete tables.glyf;
53372      delete tables.loca;
53373      delete tables.fpgm;
53374      delete tables.prep;
53375      delete tables["cvt "];
53376      this.isOpenType = true;
53377    } else {
53378      if (!tables.loca) {
53379        throw new _util.FormatError('Required "loca" table is not found');
53380      }
53381      if (!tables.glyf) {
53382        (0, _util.warn)('Required "glyf" table is not found -- trying to recover.');
53383        tables.glyf = {
53384          tag: "glyf",
53385          data: new Uint8Array(0)
53386        };
53387      }
53388      this.isOpenType = false;
53389    }
53390    if (!tables.maxp) {
53391      throw new _util.FormatError('Required "maxp" table is not found');
53392    }
53393    font.pos = (font.start || 0) + tables.maxp.offset;
53394    const version = font.getInt32();
53395    const numGlyphs = font.getUint16();
53396    if (properties.scaleFactors?.length === numGlyphs && isTrueType) {
53397      const {
53398        scaleFactors
53399      } = properties;
53400      const isGlyphLocationsLong = int16(tables.head.data[50], tables.head.data[51]);
53401      const glyphs = new _glyf.GlyfTable({
53402        glyfTable: tables.glyf.data,
53403        isGlyphLocationsLong,
53404        locaTable: tables.loca.data,
53405        numGlyphs
53406      });
53407      glyphs.scale(scaleFactors);
53408      const {
53409        glyf,
53410        loca,
53411        isLocationLong
53412      } = glyphs.write();
53413      tables.glyf.data = glyf;
53414      tables.loca.data = loca;
53415      if (isLocationLong !== !!isGlyphLocationsLong) {
53416        tables.head.data[50] = 0;
53417        tables.head.data[51] = isLocationLong ? 1 : 0;
53418      }
53419      const metrics = tables.hmtx.data;
53420      for (let i = 0; i < numGlyphs; i++) {
53421        const j = 4 * i;
53422        const advanceWidth = Math.round(scaleFactors[i] * int16(metrics[j], metrics[j + 1]));
53423        metrics[j] = advanceWidth >> 8 & 0xff;
53424        metrics[j + 1] = advanceWidth & 0xff;
53425        const lsb = Math.round(scaleFactors[i] * signedInt16(metrics[j + 2], metrics[j + 3]));
53426        writeSignedInt16(metrics, j + 2, lsb);
53427      }
53428    }
53429    let numGlyphsOut = numGlyphs + 1;
53430    let dupFirstEntry = true;
53431    if (numGlyphsOut > 0xffff) {
53432      dupFirstEntry = false;
53433      numGlyphsOut = numGlyphs;
53434      (0, _util.warn)("Not enough space in glyfs to duplicate first glyph.");
53435    }
53436    let maxFunctionDefs = 0;
53437    let maxSizeOfInstructions = 0;
53438    if (version >= 0x00010000 && tables.maxp.length >= 22) {
53439      font.pos += 8;
53440      const maxZones = font.getUint16();
53441      if (maxZones > 2) {
53442        tables.maxp.data[14] = 0;
53443        tables.maxp.data[15] = 2;
53444      }
53445      font.pos += 4;
53446      maxFunctionDefs = font.getUint16();
53447      font.pos += 4;
53448      maxSizeOfInstructions = font.getUint16();
53449    }
53450    tables.maxp.data[4] = numGlyphsOut >> 8;
53451    tables.maxp.data[5] = numGlyphsOut & 255;
53452    const hintsValid = sanitizeTTPrograms(tables.fpgm, tables.prep, tables["cvt "], maxFunctionDefs);
53453    if (!hintsValid) {
53454      delete tables.fpgm;
53455      delete tables.prep;
53456      delete tables["cvt "];
53457    }
53458    sanitizeMetrics(font, tables.hhea, tables.hmtx, tables.head, numGlyphsOut, dupFirstEntry);
53459    if (!tables.head) {
53460      throw new _util.FormatError('Required "head" table is not found');
53461    }
53462    sanitizeHead(tables.head, numGlyphs, isTrueType ? tables.loca.length : 0);
53463    let missingGlyphs = Object.create(null);
53464    if (isTrueType) {
53465      const isGlyphLocationsLong = int16(tables.head.data[50], tables.head.data[51]);
53466      const glyphsInfo = sanitizeGlyphLocations(tables.loca, tables.glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions);
53467      missingGlyphs = glyphsInfo.missingGlyphs;
53468      if (version >= 0x00010000 && tables.maxp.length >= 22) {
53469        tables.maxp.data[26] = glyphsInfo.maxSizeOfInstructions >> 8;
53470        tables.maxp.data[27] = glyphsInfo.maxSizeOfInstructions & 255;
53471      }
53472    }
53473    if (!tables.hhea) {
53474      throw new _util.FormatError('Required "hhea" table is not found');
53475    }
53476    if (tables.hhea.data[10] === 0 && tables.hhea.data[11] === 0) {
53477      tables.hhea.data[10] = 0xff;
53478      tables.hhea.data[11] = 0xff;
53479    }
53480    const metricsOverride = {
53481      unitsPerEm: int16(tables.head.data[18], tables.head.data[19]),
53482      yMax: signedInt16(tables.head.data[42], tables.head.data[43]),
53483      yMin: signedInt16(tables.head.data[38], tables.head.data[39]),
53484      ascent: signedInt16(tables.hhea.data[4], tables.hhea.data[5]),
53485      descent: signedInt16(tables.hhea.data[6], tables.hhea.data[7]),
53486      lineGap: signedInt16(tables.hhea.data[8], tables.hhea.data[9])
53487    };
53488    this.ascent = metricsOverride.ascent / metricsOverride.unitsPerEm;
53489    this.descent = metricsOverride.descent / metricsOverride.unitsPerEm;
53490    this.lineGap = metricsOverride.lineGap / metricsOverride.unitsPerEm;
53491    if (this.cssFontInfo?
vendor: 5,860 bytes, lines 53491-53637
53491.lineHeight) {
53492      this.lineHeight = this.cssFontInfo.metrics.lineHeight;
53493      this.lineGap = this.cssFontInfo.metrics.lineGap;
53494    } else {
53495      this.lineHeight = this.ascent - this.descent + this.lineGap;
53496    }
53497    if (tables.post) {
53498      readPostScriptTable(tables.post, properties, numGlyphs);
53499    }
53500    tables.post = {
53501      tag: "post",
53502      data: createPostTable(properties)
53503    };
53504    const charCodeToGlyphId = [];
53505    function hasGlyph(glyphId) {
53506      return !missingGlyphs[glyphId];
53507    }
53508    if (properties.composite) {
53509      const cidToGidMap = properties.cidToGidMap || [];
53510      const isCidToGidMapEmpty = cidToGidMap.length === 0;
53511      properties.cMap.forEach(function (charCode, cid) {
53512        if (typeof cid === "string") {
53513          cid = convertCidString(charCode, cid, true);
53514        }
53515        if (cid > 0xffff) {
53516          throw new _util.FormatError("Max size of CID is 65,535");
53517        }
53518        let glyphId = -1;
53519        if (isCidToGidMapEmpty) {
53520          glyphId = cid;
53521        } else if (cidToGidMap[cid] !== undefined) {
53522          glyphId = cidToGidMap[cid];
53523        }
53524        if (glyphId >= 0 && glyphId < numGlyphs && hasGlyph(glyphId)) {
53525          charCodeToGlyphId[charCode] = glyphId;
53526        }
53527      });
53528    } else {
53529      const cmapTable = readCmapTable(tables.cmap, font, this.isSymbolicFont, properties.hasEncoding);
53530      const cmapPlatformId = cmapTable.platformId;
53531      const cmapEncodingId = cmapTable.encodingId;
53532      const cmapMappings = cmapTable.mappings;
53533      let baseEncoding = [],
53534        forcePostTable = false;
53535      if (properties.hasEncoding && (properties.baseEncodingName === "MacRomanEncoding" || properties.baseEncodingName === "WinAnsiEncoding")) {
53536        baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName);
53537      }
53538      if (properties.hasEncoding && !this.isSymbolicFont && (cmapPlatformId === 3 && cmapEncodingId === 1 || cmapPlatformId === 1 && cmapEncodingId === 0)) {
53539        const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
53540        for (let charCode = 0; charCode < 256; charCode++) {
53541          let glyphName;
53542          if (this.differences[charCode] !== undefined) {
53543            glyphName = this.differences[charCode];
53544          } else if (baseEncoding.length && baseEncoding[charCode] !== "") {
53545            glyphName = baseEncoding[charCode];
53546          } else {
53547            glyphName = _encodings.StandardEncoding[charCode];
53548          }
53549          if (!glyphName) {
53550            continue;
53551          }
53552          const standardGlyphName = (0, _fonts_utils.recoverGlyphName)(glyphName, glyphsUnicodeMap);
53553          let unicodeOrCharCode;
53554          if (cmapPlatformId === 3 && cmapEncodingId === 1) {
53555            unicodeOrCharCode = glyphsUnicodeMap[standardGlyphName];
53556          } else if (cmapPlatformId === 1 && cmapEncodingId === 0) {
53557            unicodeOrCharCode = _encodings.MacRomanEncoding.indexOf(standardGlyphName);
53558          }
53559          if (unicodeOrCharCode === undefined) {
53560            if (!properties.glyphNames && properties.hasIncludedToUnicodeMap && !(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) {
53561              const unicode = this.toUnicode.get(charCode);
53562              if (unicode) {
53563                unicodeOrCharCode = unicode.codePointAt(0);
53564              }
53565            }
53566            if (unicodeOrCharCode === undefined) {
53567              continue;
53568            }
53569          }
53570          for (const mapping of cmapMappings) {
53571            if (mapping.charCode !== unicodeOrCharCode) {
53572              continue;
53573            }
53574            charCodeToGlyphId[charCode] = mapping.glyphId;
53575            break;
53576          }
53577        }
53578      } else if (cmapPlatformId === 0) {
53579        for (const mapping of cmapMappings) {
53580          charCodeToGlyphId[mapping.charCode] = mapping.glyphId;
53581        }
53582        forcePostTable = true;
53583      } else {
53584        for (const mapping of cmapMappings) {
53585          let charCode = mapping.charCode;
53586          if (cmapPlatformId === 3 && charCode >= 0xf000 && charCode <= 0xf0ff) {
53587            charCode &= 0xff;
53588          }
53589          charCodeToGlyphId[charCode] = mapping.glyphId;
53590        }
53591      }
53592      if (properties.glyphNames && (baseEncoding.length || this.differences.length)) {
53593        for (let i = 0; i < 256; ++i) {
53594          if (!forcePostTable && charCodeToGlyphId[i] !== undefined) {
53595            continue;
53596          }
53597          const glyphName = this.differences[i] || baseEncoding[i];
53598          if (!glyphName) {
53599            continue;
53600          }
53601          const glyphId = properties.glyphNames.indexOf(glyphName);
53602          if (glyphId > 0 && hasGlyph(glyphId)) {
53603            charCodeToGlyphId[i] = glyphId;
53604          }
53605        }
53606      }
53607    }
53608    if (charCodeToGlyphId.length === 0) {
53609      charCodeToGlyphId[0] = 0;
53610    }
53611    let glyphZeroId = numGlyphsOut - 1;
53612    if (!dupFirstEntry) {
53613      glyphZeroId = 0;
53614    }
53615    if (!properties.cssFontInfo) {
53616      const newMapping = adjustMapping(charCodeToGlyphId, hasGlyph, glyphZeroId, this.toUnicode);
53617      this.toFontChar = newMapping.toFontChar;
53618      tables.cmap = {
53619        tag: "cmap",
53620        data: createCmapTable(newMapping.charCodeToGlyphId, newMapping.toUnicodeExtraMap, numGlyphsOut)
53621      };
53622      if (!tables["OS/2"] || !validateOS2Table(tables["OS/2"], font)) {
53623        tables["OS/2"] = {
53624          tag: "OS/2",
53625          data: createOS2Table(properties, newMapping.charCodeToGlyphId, metricsOverride)
53626        };
53627      }
53628    }
53629    if (!isTrueType) {
53630      try {
53631        cffFile = new _stream.Stream(tables["CFF "].data);
53632        const parser = new _cff_parser.CFFParser(cffFile, properties, _fonts_utils.SEAC_ANALYSIS_ENABLED);
53633        cff = parser.parse();
53634        cff.duplicateFirstGlyph();
53635        const compiler = new _cff_parser.CFFCompiler(cff);
53636        tables["CFF "].data = compiler.compile();
53637      } catch 
vendor: 8,163 bytes, lines 53637-53832
53637{
53638        (0, _util.warn)("Failed to compile font " + properties.loadedName);
53639      }
53640    }
53641    if (!tables.name) {
53642      tables.name = {
53643        tag: "name",
53644        data: createNameTable(this.name)
53645      };
53646    } else {
53647      const [namePrototype, nameRecords] = readNameTable(tables.name);
53648      tables.name.data = createNameTable(name, namePrototype);
53649      this.psName = namePrototype[0][6] || null;
53650      if (!properties.composite) {
53651        adjustTrueTypeToUnicode(properties, this.isSymbolicFont, nameRecords);
53652      }
53653    }
53654    const builder = new _opentype_file_builder.OpenTypeFileBuilder(header.version);
53655    for (const tableTag in tables) {
53656      builder.addTable(tableTag, tables[tableTag].data);
53657    }
53658    return builder.toArray();
53659  }
53660  convert(fontName, font, properties) {
53661    properties.fixedPitch = false;
53662    if (properties.builtInEncoding) {
53663      adjustType1ToUnicode(properties, properties.builtInEncoding);
53664    }
53665    let glyphZeroId = 1;
53666    if (font instanceof _cff_font.CFFFont) {
53667      glyphZeroId = font.numGlyphs - 1;
53668    }
53669    const mapping = font.getGlyphMapping(properties);
53670    let newMapping = null;
53671    let newCharCodeToGlyphId = mapping;
53672    let toUnicodeExtraMap = null;
53673    if (!properties.cssFontInfo) {
53674      newMapping = adjustMapping(mapping, font.hasGlyphId.bind(font), glyphZeroId, this.toUnicode);
53675      this.toFontChar = newMapping.toFontChar;
53676      newCharCodeToGlyphId = newMapping.charCodeToGlyphId;
53677      toUnicodeExtraMap = newMapping.toUnicodeExtraMap;
53678    }
53679    const numGlyphs = font.numGlyphs;
53680    function getCharCodes(charCodeToGlyphId, glyphId) {
53681      let charCodes = null;
53682      for (const charCode in charCodeToGlyphId) {
53683        if (glyphId === charCodeToGlyphId[charCode]) {
53684          (charCodes ||= []).push(charCode | 0);
53685        }
53686      }
53687      return charCodes;
53688    }
53689    function createCharCode(charCodeToGlyphId, glyphId) {
53690      for (const charCode in charCodeToGlyphId) {
53691        if (glyphId === charCodeToGlyphId[charCode]) {
53692          return charCode | 0;
53693        }
53694      }
53695      newMapping.charCodeToGlyphId[newMapping.nextAvailableFontCharCode] = glyphId;
53696      return newMapping.nextAvailableFontCharCode++;
53697    }
53698    const seacs = font.seacs;
53699    if (newMapping && _fonts_utils.SEAC_ANALYSIS_ENABLED && seacs?.length) {
53700      const matrix = properties.fontMatrix || _util.FONT_IDENTITY_MATRIX;
53701      const charset = font.getCharset();
53702      const seacMap = Object.create(null);
53703      for (let glyphId in seacs) {
53704        glyphId |= 0;
53705        const seac = seacs[glyphId];
53706        const baseGlyphName = _encodings.StandardEncoding[seac[2]];
53707        const accentGlyphName = _encodings.StandardEncoding[seac[3]];
53708        const baseGlyphId = charset.indexOf(baseGlyphName);
53709        const accentGlyphId = charset.indexOf(accentGlyphName);
53710        if (baseGlyphId < 0 || accentGlyphId < 0) {
53711          continue;
53712        }
53713        const accentOffset = {
53714          x: seac[0] * matrix[0] + seac[1] * matrix[2] + matrix[4],
53715          y: seac[0] * matrix[1] + seac[1] * matrix[3] + matrix[5]
53716        };
53717        const charCodes = getCharCodes(mapping, glyphId);
53718        if (!charCodes) {
53719          continue;
53720        }
53721        for (const charCode of charCodes) {
53722          const charCodeToGlyphId = newMapping.charCodeToGlyphId;
53723          const baseFontCharCode = createCharCode(charCodeToGlyphId, baseGlyphId);
53724          const accentFontCharCode = createCharCode(charCodeToGlyphId, accentGlyphId);
53725          seacMap[charCode] = {
53726            baseFontCharCode,
53727            accentFontCharCode,
53728            accentOffset
53729          };
53730        }
53731      }
53732      properties.seacMap = seacMap;
53733    }
53734    const unitsPerEm = 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0];
53735    const builder = new _opentype_file_builder.OpenTypeFileBuilder("\x4F\x54\x54\x4F");
53736    builder.addTable("CFF ", font.data);
53737    builder.addTable("OS/2", createOS2Table(properties, newCharCodeToGlyphId));
53738    builder.addTable("cmap", createCmapTable(newCharCodeToGlyphId, toUnicodeExtraMap, numGlyphs));
53739    builder.addTable("head", "\x00\x01\x00\x00" + "\x00\x00\x10\x00" + "\x00\x00\x00\x00" + "\x5F\x0F\x3C\xF5" + "\x00\x00" + safeString16(unitsPerEm) + "\x00\x00\x00\x00\x9e\x0b\x7e\x27" + "\x00\x00\x00\x00\x9e\x0b\x7e\x27" + "\x00\x00" + safeString16(properties.descent) + "\x0F\xFF" + safeString16(properties.ascent) + string16(properties.italicAngle ? 2 : 0) + "\x00\x11" + "\x00\x00" + "\x00\x00" + "\x00\x00");
53740    builder.addTable("hhea", "\x00\x01\x00\x00" + safeString16(properties.ascent) + safeString16(properties.descent) + "\x00\x00" + "\xFF\xFF" + "\x00\x00" + "\x00\x00" + "\x00\x00" + safeString16(properties.capHeight) + safeString16(Math.tan(properties.italicAngle) * properties.xHeight) + "\x00\x00" + "\x00\x00" + "\x00\x00" + "\x00\x00" + "\x00\x00" + "\x00\x00" + string16(numGlyphs));
53741    builder.addTable("hmtx", function fontFieldsHmtx() {
53742      const charstrings = font.charstrings;
53743      const cffWidths = font.cff ? font.cff.widths : null;
53744      let hmtx = "\x00\x00\x00\x00";
53745      for (let i = 1, ii = numGlyphs; i < ii; i++) {
53746        let width = 0;
53747        if (charstrings) {
53748          const charstring = charstrings[i - 1];
53749          width = "width" in charstring ? charstring.width : 0;
53750        } else if (cffWidths) {
53751          width = Math.ceil(cffWidths[i] || 0);
53752        }
53753        hmtx += string16(width) + string16(0);
53754      }
53755      return hmtx;
53756    }());
53757    builder.addTable("maxp", "\x00\x00\x50\x00" + string16(numGlyphs));
53758    builder.addTable("name", createNameTable(fontName));
53759    builder.addTable("post", createPostTable(properties));
53760    return builder.toArray();
53761  }
53762  get spaceWidth() {
53763    const possibleSpaceReplacements = ["space", "minus", "one", "i", "I"];
53764    let width;
53765    for (const glyphName of possibleSpaceReplacements) {
53766      if (glyphName in this.widths) {
53767        width = this.widths[glyphName];
53768        break;
53769      }
53770      const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
53771      const glyphUnicode = glyphsUnicodeMap[glyphName];
53772      let charcode = 0;
53773      if (this.composite && this.cMap.contains(glyphUnicode)) {
53774        charcode = this.cMap.lookup(glyphUnicode);
53775        if (typeof charcode === "string") {
53776          charcode = convertCidString(glyphUnicode, charcode);
53777        }
53778      }
53779      if (!charcode && this.toUnicode) {
53780        charcode = this.toUnicode.charCodeOf(glyphUnicode);
53781      }
53782      if (charcode <= 0) {
53783        charcode = glyphUnicode;
53784      }
53785      width = this.widths[charcode];
53786      if (width) {
53787        break;
53788      }
53789    }
53790    return (0, _util.shadow)(this, "spaceWidth", width || this.defaultWidth);
53791  }
53792  _charToGlyph(charcode, isSpace = false) {
53793    let glyph = this._glyphCache[charcode];
53794    if (glyph?.isSpace === isSpace) {
53795      return glyph;
53796    }
53797    let fontCharCode, width, operatorListId;
53798    let widthCode = charcode;
53799    if (this.cMap?.contains(charcode)) {
53800      widthCode = this.cMap.lookup(charcode);
53801      if (typeof widthCode === "string") {
53802        widthCode = convertCidString(charcode, widthCode);
53803      }
53804    }
53805    width = this.widths[widthCode];
53806    if (typeof width !== "number") {
53807      width = this.defaultWidth;
53808    }
53809    const vmetric = this.vmetrics?.[widthCode];
53810    let unicode = this.toUnicode.get(charcode) || charcode;
53811    if (typeof unicode === "number") {
53812      unicode = String.fromCharCode(unicode);
53813    }
53814    let isInFont = this.toFontChar[charcode] !== undefined;
53815    fontCharCode = this.toFontChar[charcode] || charcode;
53816    if (this.missingFile) {
53817      const glyphName = this.differences[charcode] || this.defaultEncoding[charcode];
53818      if ((glyphName === ".notdef" || glyphName === "") && this.type === "Type1") {
53819        fontCharCode = 0x20;
53820      }
53821      fontCharCode = (0, _unicode.mapSpecialUnicodeValues)(fontCharCode);
53822    }
53823    if (this.isType3Font) {
53824      operatorListId = fontCharCode;
53825    }
53826    let accent = null;
53827    if (this.seacMap?.[charcode]) {
53828      isInFont = true;
53829      const seac = this.seacMap[charcode];
53830      fontCharCode = seac.baseFontCharCode;
53831      accent = {
53832        fontChar: String.fromCodePoint(seac.accentFontCharCode),
vendor: 3,976 bytes, lines 53833-53964
53833        offset: seac.accentOffset
53834      };
53835    }
53836    let fontChar = "";
53837    if (typeof fontCharCode === "number") {
53838      if (fontCharCode <= 0x10ffff) {
53839        fontChar = String.fromCodePoint(fontCharCode);
53840      } else {
53841        (0, _util.warn)(`charToGlyph - invalid fontCharCode: ${fontCharCode}`);
53842      }
53843    }
53844    glyph = new Glyph(charcode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont);
53845    return this._glyphCache[charcode] = glyph;
53846  }
53847  charsToGlyphs(chars) {
53848    let glyphs = this._charsCache[chars];
53849    if (glyphs) {
53850      return glyphs;
53851    }
53852    glyphs = [];
53853    if (this.cMap) {
53854      const c = Object.create(null),
53855        ii = chars.length;
53856      let i = 0;
53857      while (i < ii) {
53858        this.cMap.readCharCode(chars, i, c);
53859        const {
53860          charcode,
53861          length
53862        } = c;
53863        i += length;
53864        const glyph = this._charToGlyph(charcode, length === 1 && chars.charCodeAt(i - 1) === 0x20);
53865        glyphs.push(glyph);
53866      }
53867    } else {
53868      for (let i = 0, ii = chars.length; i < ii; ++i) {
53869        const charcode = chars.charCodeAt(i);
53870        const glyph = this._charToGlyph(charcode, charcode === 0x20);
53871        glyphs.push(glyph);
53872      }
53873    }
53874    return this._charsCache[chars] = glyphs;
53875  }
53876  getCharPositions(chars) {
53877    const positions = [];
53878    if (this.cMap) {
53879      const c = Object.create(null);
53880      let i = 0;
53881      while (i < chars.length) {
53882        this.cMap.readCharCode(chars, i, c);
53883        const length = c.length;
53884        positions.push([i, i + length]);
53885        i += length;
53886      }
53887    } else {
53888      for (let i = 0, ii = chars.length; i < ii; ++i) {
53889        positions.push([i, i + 1]);
53890      }
53891    }
53892    return positions;
53893  }
53894  get glyphCacheValues() {
53895    return Object.values(this._glyphCache);
53896  }
53897  encodeString(str) {
53898    const buffers = [];
53899    const currentBuf = [];
53900    const hasCurrentBufErrors = () => buffers.length % 2 === 1;
53901    const getCharCode = this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap ? unicode => this.toUnicode.charCodeOf(unicode) : unicode => this.toUnicode.charCodeOf(String.fromCodePoint(unicode));
53902    for (let i = 0, ii = str.length; i < ii; i++) {
53903      const unicode = str.codePointAt(i);
53904      if (unicode > 0xd7ff && (unicode < 0xe000 || unicode > 0xfffd)) {
53905        i++;
53906      }
53907      if (this.toUnicode) {
53908        const charCode = getCharCode(unicode);
53909        if (charCode !== -1) {
53910          if (hasCurrentBufErrors()) {
53911            buffers.push(currentBuf.join(""));
53912            currentBuf.length = 0;
53913          }
53914          const charCodeLength = this.cMap ? this.cMap.getCharCodeLength(charCode) : 1;
53915          for (let j = charCodeLength - 1; j >= 0; j--) {
53916            currentBuf.push(String.fromCharCode(charCode >> 8 * j & 0xff));
53917          }
53918          continue;
53919        }
53920      }
53921      if (!hasCurrentBufErrors()) {
53922        buffers.push(currentBuf.join(""));
53923        currentBuf.length = 0;
53924      }
53925      currentBuf.push(String.fromCodePoint(unicode));
53926    }
53927    buffers.push(currentBuf.join(""));
53928    return buffers;
53929  }
53930}
53931exports.Font = Font;
53932class ErrorFont {
53933  constructor(error) {
53934    this.error = error;
53935    this.loadedName = "g_font_error";
53936    this.missingFile = true;
53937  }
53938  charsToGlyphs() {
53939    return [];
53940  }
53941  encodeString(chars) {
53942    return [chars];
53943  }
53944  exportData(extraProperties = false) {
53945    return {
53946      error: this.error
53947    };
53948  }
53949}
53950exports.ErrorFont = ErrorFont;
53951
53952/***/ }),
53953/* 35 */
53954/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
53955
53956
53957
53958Object.defineProperty(exports, "__esModule", ({
53959  value: true
53960}));
53961exports.CFFTopDict = exports.CFFStrings = exports.CFFStandardStrings = exports.CFFPrivateDict = exports.CFFParser = exports.CFFIndex = exports.CFFHeader = exports.CFFFDSelect = exports.CFFCompiler = exports.CFFCharset = exports.CFF = void 0;
53962var _util = __w_pdfjs_require__(2);
53963var _charsets = __w_pdfjs_require__(36);
53964var _encodings = __w_pdfjs_require__(37
vendor: 14,899 bytes, lines 53964-54394
53964);
53965const MAX_SUBR_NESTING = 10;
53966const 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", "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", "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"];
53967exports.CFFStandardStrings = CFFStandardStrings;
53968const NUM_STANDARD_CFF_STRINGS = 391;
53969const CharstringValidationData = [null, {
53970  id: "hstem",
53971  min: 2,
53972  stackClearing: true,
53973  stem: true
53974}, null, {
53975  id: "vstem",
53976  min: 2,
53977  stackClearing: true,
53978  stem: true
53979}, {
53980  id: "vmoveto",
53981  min: 1,
53982  stackClearing: true
53983}, {
53984  id: "rlineto",
53985  min: 2,
53986  resetStack: true
53987}, {
53988  id: "hlineto",
53989  min: 1,
53990  resetStack: true
53991}, {
53992  id: "vlineto",
53993  min: 1,
53994  resetStack: true
53995}, {
53996  id: "rrcurveto",
53997  min: 6,
53998  resetStack: true
53999}, null, {
54000  id: "callsubr",
54001  min: 1,
54002  undefStack: true
54003}, {
54004  id: "return",
54005  min: 0,
54006  undefStack: true
54007}, null, null, {
54008  id: "endchar",
54009  min: 0,
54010  stackClearing: true
54011}, null, null, null, {
54012  id: "hstemhm",
54013  min: 2,
54014  stackClearing: true,
54015  stem: true
54016}, {
54017  id: "hintmask",
54018  min: 0,
54019  stackClearing: true
54020}, {
54021  id: "cntrmask",
54022  min: 0,
54023  stackClearing: true
54024}, {
54025  id: "rmoveto",
54026  min: 2,
54027  stackClearing: true
54028}, {
54029  id: "hmoveto",
54030  min: 1,
54031  stackClearing: true
54032}, {
54033  id: "vstemhm",
54034  min: 2,
54035  stackClearing: true,
54036  stem: true
54037}, {
54038  id: "rcurveline",
54039  min: 8,
54040  resetStack: true
54041}, {
54042  id: "rlinecurve",
54043  min: 8,
54044  resetStack: true
54045}, {
54046  id: "vvcurveto",
54047  min: 4,
54048  resetStack: true
54049}, {
54050  id: "hhcurveto",
54051  min: 4,
54052  resetStack: true
54053}, null, {
54054  id: "callgsubr",
54055  min: 1,
54056  undefStack: true
54057}, {
54058  id: "vhcurveto",
54059  min: 4,
54060  resetStack: true
54061}, {
54062  id: "hvcurveto",
54063  min: 4,
54064  resetStack: true
54065}];
54066const CharstringValidationData12 = [null, null, null, {
54067  id: "and",
54068  min: 2,
54069  stackDelta: -1
54070}, {
54071  id: "or",
54072  min: 2,
54073  stackDelta: -1
54074}, {
54075  id: "not",
54076  min: 1,
54077  stackDelta: 0
54078}, null, null, null, {
54079  id: "abs",
54080  min: 1,
54081  stackDelta: 0
54082}, {
54083  id: "add",
54084  min: 2,
54085  stackDelta: -1,
54086  stackFn(stack, index) {
54087    stack[index - 2] = stack[index - 2] + stack[index - 1];
54088  }
54089}, {
54090  id: "sub",
54091  min: 2,
54092  stackDelta: -1,
54093  stackFn(stack, index) {
54094    stack[index - 2] = stack[index - 2] - stack[index - 1];
54095  }
54096}, {
54097  id: "div",
54098  min: 2,
54099  stackDelta: -1,
54100  stackFn(stack, index) {
54101    stack[index - 2] = stack[index - 2] / stack[index - 1];
54102  }
54103}, null, {
54104  id: "neg",
54105  min: 1,
54106  stackDelta: 0,
54107  stackFn(stack, index) {
54108    stack[index - 1] = -stack[index - 1];
54109  }
54110}, {
54111  id: "eq",
54112  min: 2,
54113  stackDelta: -1
54114}, null, null, {
54115  id: "drop",
54116  min: 1,
54117  stackDelta: -1
54118}, null, {
54119  id: "put",
54120  min: 2,
54121  stackDelta: -2
54122}, {
54123  id: "get",
54124  min: 1,
54125  stackDelta: 0
54126}, {
54127  id: "ifelse",
54128  min: 4,
54129  stackDelta: -3
54130}, {
54131  id: "random",
54132  min: 0,
54133  stackDelta: 1
54134}, {
54135  id: "mul",
54136  min: 2,
54137  stackDelta: -1,
54138  stackFn(stack, index) {
54139    stack[index - 2] = stack[index - 2] * stack[index - 1];
54140  }
54141}, null, {
54142  id: "sqrt",
54143  min: 1,
54144  stackDelta: 0
54145}, {
54146  id: "dup",
54147  min: 1,
54148  stackDelta: 1
54149}, {
54150  id: "exch",
54151  min: 2,
54152  stackDelta: 0
54153}, {
54154  id: "index",
54155  min: 2,
54156  stackDelta: 0
54157}, {
54158  id: "roll",
54159  min: 3,
54160  stackDelta: -2
54161}, null, null, null, {
54162  id: "hflex",
54163  min: 7,
54164  resetStack: true
54165}, {
54166  id: "flex",
54167  min: 13,
54168  resetStack: true
54169}, {
54170  id: "hflex1",
54171  min: 9,
54172  resetStack: true
54173}, {
54174  id: "flex1",
54175  min: 11,
54176  resetStack: true
54177}];
54178class CFFParser {
54179  constructor(file, properties, seacAnalysisEnabled) {
54180    this.bytes = file.getBytes();
54181    this.properties = properties;
54182    this.seacAnalysisEnabled = !!seacAnalysisEnabled;
54183  }
54184  parse() {
54185    const properties = this.properties;
54186    const cff = new CFF();
54187    this.cff = cff;
54188    const header = this.parseHeader();
54189    const nameIndex = this.parseIndex(header.endPos);
54190    const topDictIndex = this.parseIndex(nameIndex.endPos);
54191    const stringIndex = this.parseIndex(topDictIndex.endPos);
54192    const globalSubrIndex = this.parseIndex(stringIndex.endPos);
54193    const topDictParsed = this.parseDict(topDictIndex.obj.get(0));
54194    const topDict = this.createDict(CFFTopDict, topDictParsed, cff.strings);
54195    cff.header = header.obj;
54196    cff.names = this.parseNameIndex(nameIndex.obj);
54197    cff.strings = this.parseStringIndex(stringIndex.obj);
54198    cff.topDict = topDict;
54199    cff.globalSubrIndex = globalSubrIndex.obj;
54200    this.parsePrivateDict(cff.topDict);
54201    cff.isCIDFont = topDict.hasName("ROS");
54202    const charStringOffset = topDict.getByName("CharStrings");
54203    const charStringIndex = this.parseIndex(charStringOffset).obj;
54204    const fontMatrix = topDict.getByName("FontMatrix");
54205    if (fontMatrix) {
54206      properties.fontMatrix = fontMatrix;
54207    }
54208    const fontBBox = topDict.getByName("FontBBox");
54209    if (fontBBox) {
54210      properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
54211      properties.descent = Math.min(fontBBox[1], fontBBox[3]);
54212      properties.ascentScaled = true;
54213    }
54214    let charset, encoding;
54215    if (cff.isCIDFont) {
54216      const fdArrayIndex = this.parseIndex(topDict.getByName("FDArray")).obj;
54217      for (let i = 0, ii = fdArrayIndex.count; i < ii; ++i) {
54218        const dictRaw = fdArrayIndex.get(i);
54219        const fontDict = this.createDict(CFFTopDict, this.parseDict(dictRaw), cff.strings);
54220        this.parsePrivateDict(fontDict);
54221        cff.fdArray.push(fontDict);
54222      }
54223      encoding = null;
54224      charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, true);
54225      cff.fdSelect = this.parseFDSelect(topDict.getByName("FDSelect"), charStringIndex.count);
54226    } else {
54227      charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, false);
54228      encoding = this.parseEncoding(topDict.getByName("Encoding"), properties, cff.strings, charset.charset);
54229    }
54230    cff.charset = charset;
54231    cff.encoding = encoding;
54232    const charStringsAndSeacs = this.parseCharStrings({
54233      charStrings: charStringIndex,
54234      localSubrIndex: topDict.privateDict.subrsIndex,
54235      globalSubrIndex: globalSubrIndex.obj,
54236      fdSelect: cff.fdSelect,
54237      fdArray: cff.fdArray,
54238      privateDict: topDict.privateDict
54239    });
54240    cff.charStrings = charStringsAndSeacs.charStrings;
54241    cff.seacs = charStringsAndSeacs.seacs;
54242    cff.widths = charStringsAndSeacs.widths;
54243    return cff;
54244  }
54245  parseHeader() {
54246    let bytes = this.bytes;
54247    const bytesLength = bytes.length;
54248    let offset = 0;
54249    while (offset < bytesLength && bytes[offset] !== 1) {
54250      ++offset;
54251    }
54252    if (offset >= bytesLength) {
54253      throw new _util.FormatError("Invalid CFF header");
54254    }
54255    if (offset !== 0) {
54256      (0, _util.info)("cff data is shifted");
54257      bytes = bytes.subarray(offset);
54258      this.bytes = bytes;
54259    }
54260    const major = bytes[0];
54261    const minor = bytes[1];
54262    const hdrSize = bytes[2];
54263    const offSize = bytes[3];
54264    const header = new CFFHeader(major, minor, hdrSize, offSize);
54265    return {
54266      obj: header,
54267      endPos: hdrSize
54268    };
54269  }
54270  parseDict(dict) {
54271    let pos = 0;
54272    function parseOperand() {
54273      let value = dict[pos++];
54274      if (value === 30) {
54275        return parseFloatOperand();
54276      } else if (value === 28) {
54277        value = dict[pos++];
54278        value = (value << 24 | dict[pos++] << 16) >> 16;
54279        return value;
54280      } else if (value === 29) {
54281        value = dict[pos++];
54282        value = value << 8 | dict[pos++];
54283        value = value << 8 | dict[pos++];
54284        value = value << 8 | dict[pos++];
54285        return value;
54286      } else if (value >= 32 && value <= 246) {
54287        return value - 139;
54288      } else if (value >= 247 && value <= 250) {
54289        return (value - 247) * 256 + dict[pos++] + 108;
54290      } else if (value >= 251 && value <= 254) {
54291        return -((value - 251) * 256) - dict[pos++] - 108;
54292      }
54293      (0, _util.warn)('CFFParser_parseDict: "' + value + '" is a reserved command.');
54294      return NaN;
54295    }
54296    function parseFloatOperand() {
54297      let str = "";
54298      const eof = 15;
54299      const lookup = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ".", "E", "E-", null, "-"];
54300      const length = dict.length;
54301      while (pos < length) {
54302        const b = dict[pos++];
54303        const b1 = b >> 4;
54304        const b2 = b & 15;
54305        if (b1 === eof) {
54306          break;
54307        }
54308        str += lookup[b1];
54309        if (b2 === eof) {
54310          break;
54311        }
54312        str += lookup[b2];
54313      }
54314      return parseFloat(str);
54315    }
54316    let operands = [];
54317    const entries = [];
54318    pos = 0;
54319    const end = dict.length;
54320    while (pos < end) {
54321      let b = dict[pos];
54322      if (b <= 21) {
54323        if (b === 12) {
54324          b = b << 8 | dict[++pos];
54325        }
54326        entries.push([b, operands]);
54327        operands = [];
54328        ++pos;
54329      } else {
54330        operands.push(parseOperand());
54331      }
54332    }
54333    return entries;
54334  }
54335  parseIndex(pos) {
54336    const cffIndex = new CFFIndex();
54337    const bytes = this.bytes;
54338    const count = bytes[pos++] << 8 | bytes[pos++];
54339    const offsets = [];
54340    let end = pos;
54341    let i, ii;
54342    if (count !== 0) {
54343      const offsetSize = bytes[pos++];
54344      const startPos = pos + (count + 1) * offsetSize - 1;
54345      for (i = 0, ii = count + 1; i < ii; ++i) {
54346        let offset = 0;
54347        for (let j = 0; j < offsetSize; ++j) {
54348          offset <<= 8;
54349          offset += bytes[pos++];
54350        }
54351        offsets.push(startPos + offset);
54352      }
54353      end = offsets[count];
54354    }
54355    for (i = 0, ii = offsets.length - 1; i < ii; ++i) {
54356      const offsetStart = offsets[i];
54357      const offsetEnd = offsets[i + 1];
54358      cffIndex.add(bytes.subarray(offsetStart, offsetEnd));
54359    }
54360    return {
54361      obj: cffIndex,
54362      endPos: end
54363    };
54364  }
54365  parseNameIndex(index) {
54366    const names = [];
54367    for (let i = 0, ii = index.count; i < ii; ++i) {
54368      const name = index.get(i);
54369      names.push((0, _util.bytesToString)(name));
54370    }
54371    return names;
54372  }
54373  parseStringIndex(index) {
54374    const strings = new CFFStrings();
54375    for (let i = 0, ii = index.count; i < ii; ++i) {
54376      const data = index.get(i);
54377      strings.add((0, _util.bytesToString)(data));
54378    }
54379    return strings;
54380  }
54381  createDict(Type, dict, strings) {
54382    const cffDict = new Type(strings);
54383    for (const [key, value] of dict) {
54384      cffDict.setByKey(key, value);
54385    }
54386    return cffDict;
54387  }
54388  parseCharString(state, data, localSubrIndex, globalSubrIndex) {
54389    if (!data || state.callDepth > MAX_SUBR_NESTING) {
54390      return false;
54391    }
54392    let stackSize = state.stackSize;
54393    const stack = state.stack;
54394    
vendor: 4,017 bytes, lines 54394-54501
54394let length = data.length;
54395    for (let j = 0; j < length;) {
54396      const value = data[j++];
54397      let validationCommand = null;
54398      if (value === 12) {
54399        const q = data[j++];
54400        if (q === 0) {
54401          data[j - 2] = 139;
54402          data[j - 1] = 22;
54403          stackSize = 0;
54404        } else {
54405          validationCommand = CharstringValidationData12[q];
54406        }
54407      } else if (value === 28) {
54408        stack[stackSize] = (data[j] << 24 | data[j + 1] << 16) >> 16;
54409        j += 2;
54410        stackSize++;
54411      } else if (value === 14) {
54412        if (stackSize >= 4) {
54413          stackSize -= 4;
54414          if (this.seacAnalysisEnabled) {
54415            state.seac = stack.slice(stackSize, stackSize + 4);
54416            return false;
54417          }
54418        }
54419        validationCommand = CharstringValidationData[value];
54420      } else if (value >= 32 && value <= 246) {
54421        stack[stackSize] = value - 139;
54422        stackSize++;
54423      } else if (value >= 247 && value <= 254) {
54424        stack[stackSize] = value < 251 ? (value - 247 << 8) + data[j] + 108 : -(value - 251 << 8) - data[j] - 108;
54425        j++;
54426        stackSize++;
54427      } else if (value === 255) {
54428        stack[stackSize] = (data[j] << 24 | data[j + 1] << 16 | data[j + 2] << 8 | data[j + 3]) / 65536;
54429        j += 4;
54430        stackSize++;
54431      } else if (value === 19 || value === 20) {
54432        state.hints += stackSize >> 1;
54433        if (state.hints === 0) {
54434          data.copyWithin(j - 1, j, -1);
54435          j -= 1;
54436          length -= 1;
54437          continue;
54438        }
54439        j += state.hints + 7 >> 3;
54440        stackSize %= 2;
54441        validationCommand = CharstringValidationData[value];
54442      } else if (value === 10 || value === 29) {
54443        const subrsIndex = value === 10 ? localSubrIndex : globalSubrIndex;
54444        if (!subrsIndex) {
54445          validationCommand = CharstringValidationData[value];
54446          (0, _util.warn)("Missing subrsIndex for " + validationCommand.id);
54447          return false;
54448        }
54449        let bias = 32768;
54450        if (subrsIndex.count < 1240) {
54451          bias = 107;
54452        } else if (subrsIndex.count < 33900) {
54453          bias = 1131;
54454        }
54455        const subrNumber = stack[--stackSize] + bias;
54456        if (subrNumber < 0 || subrNumber >= subrsIndex.count || isNaN(subrNumber)) {
54457          validationCommand = CharstringValidationData[value];
54458          (0, _util.warn)("Out of bounds subrIndex for " + validationCommand.id);
54459          return false;
54460        }
54461        state.stackSize = stackSize;
54462        state.callDepth++;
54463        const valid = this.parseCharString(state, subrsIndex.get(subrNumber), localSubrIndex, globalSubrIndex);
54464        if (!valid) {
54465          return false;
54466        }
54467        state.callDepth--;
54468        stackSize = state.stackSize;
54469        continue;
54470      } else if (value === 11) {
54471        state.stackSize = stackSize;
54472        return true;
54473      } else if (value === 0 && j === data.length) {
54474        data[j - 1] = 14;
54475        validationCommand = CharstringValidationData[14];
54476      } else if (value === 9) {
54477        data.copyWithin(j - 1, j, -1);
54478        j -= 1;
54479        length -= 1;
54480        continue;
54481      } else {
54482        validationCommand = CharstringValidationData[value];
54483      }
54484      if (validationCommand) {
54485        if (validationCommand.stem) {
54486          state.hints += stackSize >> 1;
54487          if (value === 3 || value === 23) {
54488            state.hasVStems = true;
54489          } else if (state.hasVStems && (value === 1 || value === 18)) {
54490            (0, _util.warn)("CFF stem hints are in wrong order");
54491            data[j - 1] = value === 1 ? 3 : 23;
54492          }
54493        }
54494        if ("min" in validationCommand) {
54495          if (!state.undefStack && stackSize < validationCommand.min) {
54496            (0, _util.warn)("Not enough parameters for " + validationCommand.id + "; actual: " + stackSize + ", expected: " + validationCommand.min);
54497            if (stackSize === 0) {
54498              data[j - 1] = 14;
54499              return true;
54500            }
54501            return false;
vendor: 18,202 bytes, lines 54502-55053
54502          }
54503        }
54504        if (state.firstStackClearing && validationCommand.stackClearing) {
54505          state.firstStackClearing = false;
54506          stackSize -= validationCommand.min;
54507          if (stackSize >= 2 && validationCommand.stem) {
54508            stackSize %= 2;
54509          } else if (stackSize > 1) {
54510            (0, _util.warn)("Found too many parameters for stack-clearing command");
54511          }
54512          if (stackSize > 0) {
54513            state.width = stack[stackSize - 1];
54514          }
54515        }
54516        if ("stackDelta" in validationCommand) {
54517          if ("stackFn" in validationCommand) {
54518            validationCommand.stackFn(stack, stackSize);
54519          }
54520          stackSize += validationCommand.stackDelta;
54521        } else if (validationCommand.stackClearing) {
54522          stackSize = 0;
54523        } else if (validationCommand.resetStack) {
54524          stackSize = 0;
54525          state.undefStack = false;
54526        } else if (validationCommand.undefStack) {
54527          stackSize = 0;
54528          state.undefStack = true;
54529          state.firstStackClearing = false;
54530        }
54531      }
54532    }
54533    if (length < data.length) {
54534      data.fill(14, length);
54535    }
54536    state.stackSize = stackSize;
54537    return true;
54538  }
54539  parseCharStrings({
54540    charStrings,
54541    localSubrIndex,
54542    globalSubrIndex,
54543    fdSelect,
54544    fdArray,
54545    privateDict
54546  }) {
54547    const seacs = [];
54548    const widths = [];
54549    const count = charStrings.count;
54550    for (let i = 0; i < count; i++) {
54551      const charstring = charStrings.get(i);
54552      const state = {
54553        callDepth: 0,
54554        stackSize: 0,
54555        stack: [],
54556        undefStack: true,
54557        hints: 0,
54558        firstStackClearing: true,
54559        seac: null,
54560        width: null,
54561        hasVStems: false
54562      };
54563      let valid = true;
54564      let localSubrToUse = null;
54565      let privateDictToUse = privateDict;
54566      if (fdSelect && fdArray.length) {
54567        const fdIndex = fdSelect.getFDIndex(i);
54568        if (fdIndex === -1) {
54569          (0, _util.warn)("Glyph index is not in fd select.");
54570          valid = false;
54571        }
54572        if (fdIndex >= fdArray.length) {
54573          (0, _util.warn)("Invalid fd index for glyph index.");
54574          valid = false;
54575        }
54576        if (valid) {
54577          privateDictToUse = fdArray[fdIndex].privateDict;
54578          localSubrToUse = privateDictToUse.subrsIndex;
54579        }
54580      } else if (localSubrIndex) {
54581        localSubrToUse = localSubrIndex;
54582      }
54583      if (valid) {
54584        valid = this.parseCharString(state, charstring, localSubrToUse, globalSubrIndex);
54585      }
54586      if (state.width !== null) {
54587        const nominalWidth = privateDictToUse.getByName("nominalWidthX");
54588        widths[i] = nominalWidth + state.width;
54589      } else {
54590        const defaultWidth = privateDictToUse.getByName("defaultWidthX");
54591        widths[i] = defaultWidth;
54592      }
54593      if (state.seac !== null) {
54594        seacs[i] = state.seac;
54595      }
54596      if (!valid) {
54597        charStrings.set(i, new Uint8Array([14]));
54598      }
54599    }
54600    return {
54601      charStrings,
54602      seacs,
54603      widths
54604    };
54605  }
54606  emptyPrivateDictionary(parentDict) {
54607    const privateDict = this.createDict(CFFPrivateDict, [], parentDict.strings);
54608    parentDict.setByKey(18, [0, 0]);
54609    parentDict.privateDict = privateDict;
54610  }
54611  parsePrivateDict(parentDict) {
54612    if (!parentDict.hasName("Private")) {
54613      this.emptyPrivateDictionary(parentDict);
54614      return;
54615    }
54616    const privateOffset = parentDict.getByName("Private");
54617    if (!Array.isArray(privateOffset) || privateOffset.length !== 2) {
54618      parentDict.removeByName("Private");
54619      return;
54620    }
54621    const size = privateOffset[0];
54622    const offset = privateOffset[1];
54623    if (size === 0 || offset >= this.bytes.length) {
54624      this.emptyPrivateDictionary(parentDict);
54625      return;
54626    }
54627    const privateDictEnd = offset + size;
54628    const dictData = this.bytes.subarray(offset, privateDictEnd);
54629    const dict = this.parseDict(dictData);
54630    const privateDict = this.createDict(CFFPrivateDict, dict, parentDict.strings);
54631    parentDict.privateDict = privateDict;
54632    if (privateDict.getByName("ExpansionFactor") === 0) {
54633      privateDict.setByName("ExpansionFactor", 0.06);
54634    }
54635    if (!privateDict.getByName("Subrs")) {
54636      return;
54637    }
54638    const subrsOffset = privateDict.getByName("Subrs");
54639    const relativeOffset = offset + subrsOffset;
54640    if (subrsOffset === 0 || relativeOffset >= this.bytes.length) {
54641      this.emptyPrivateDictionary(parentDict);
54642      return;
54643    }
54644    const subrsIndex = this.parseIndex(relativeOffset);
54645    privateDict.subrsIndex = subrsIndex.obj;
54646  }
54647  parseCharsets(pos, length, strings, cid) {
54648    if (pos === 0) {
54649      return new CFFCharset(true, CFFCharsetPredefinedTypes.ISO_ADOBE, _charsets.ISOAdobeCharset);
54650    } else if (pos === 1) {
54651      return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT, _charsets.ExpertCharset);
54652    } else if (pos === 2) {
54653      return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT_SUBSET, _charsets.ExpertSubsetCharset);
54654    }
54655    const bytes = this.bytes;
54656    const start = pos;
54657    const format = bytes[pos++];
54658    const charset = [cid ? 0 : ".notdef"];
54659    let id, count, i;
54660    length -= 1;
54661    switch (format) {
54662      case 0:
54663        for (i = 0; i < length; i++) {
54664          id = bytes[pos++] << 8 | bytes[pos++];
54665          charset.push(cid ? id : strings.get(id));
54666        }
54667        break;
54668      case 1:
54669        while (charset.length <= length) {
54670          id = bytes[pos++] << 8 | bytes[pos++];
54671          count = bytes[pos++];
54672          for (i = 0; i <= count; i++) {
54673            charset.push(cid ? id++ : strings.get(id++));
54674          }
54675        }
54676        break;
54677      case 2:
54678        while (charset.length <= length) {
54679          id = bytes[pos++] << 8 | bytes[pos++];
54680          count = bytes[pos++] << 8 | bytes[pos++];
54681          for (i = 0; i <= count; i++) {
54682            charset.push(cid ? id++ : strings.get(id++));
54683          }
54684        }
54685        break;
54686      default:
54687        throw new _util.FormatError("Unknown charset format");
54688    }
54689    const end = pos;
54690    const raw = bytes.subarray(start, end);
54691    return new CFFCharset(false, format, charset, raw);
54692  }
54693  parseEncoding(pos, properties, strings, charset) {
54694    const encoding = Object.create(null);
54695    const bytes = this.bytes;
54696    let predefined = false;
54697    let format, i, ii;
54698    let raw = null;
54699    function readSupplement() {
54700      const supplementsCount = bytes[pos++];
54701      for (i = 0; i < supplementsCount; i++) {
54702        const code = bytes[pos++];
54703        const sid = (bytes[pos++] << 8) + (bytes[pos++] & 0xff);
54704        encoding[code] = charset.indexOf(strings.get(sid));
54705      }
54706    }
54707    if (pos === 0 || pos === 1) {
54708      predefined = true;
54709      format = pos;
54710      const baseEncoding = pos ? _encodings.ExpertEncoding : _encodings.StandardEncoding;
54711      for (i = 0, ii = charset.length; i < ii; i++) {
54712        const index = baseEncoding.indexOf(charset[i]);
54713        if (index !== -1) {
54714          encoding[index] = i;
54715        }
54716      }
54717    } else {
54718      const dataStart = pos;
54719      format = bytes[pos++];
54720      switch (format & 0x7f) {
54721        case 0:
54722          const glyphsCount = bytes[pos++];
54723          for (i = 1; i <= glyphsCount; i++) {
54724            encoding[bytes[pos++]] = i;
54725          }
54726          break;
54727        case 1:
54728          const rangesCount = bytes[pos++];
54729          let gid = 1;
54730          for (i = 0; i < rangesCount; i++) {
54731            const start = bytes[pos++];
54732            const left = bytes[pos++];
54733            for (let j = start; j <= start + left; j++) {
54734              encoding[j] = gid++;
54735            }
54736          }
54737          break;
54738        default:
54739          throw new _util.FormatError(`Unknown encoding format: ${format} in CFF`);
54740      }
54741      const dataEnd = pos;
54742      if (format & 0x80) {
54743        bytes[dataStart] &= 0x7f;
54744        readSupplement();
54745      }
54746      raw = bytes.subarray(dataStart, dataEnd);
54747    }
54748    format &= 0x7f;
54749    return new CFFEncoding(predefined, format, encoding, raw);
54750  }
54751  parseFDSelect(pos, length) {
54752    const bytes = this.bytes;
54753    const format = bytes[pos++];
54754    const fdSelect = [];
54755    let i;
54756    switch (format) {
54757      case 0:
54758        for (i = 0; i < length; ++i) {
54759          const id = bytes[pos++];
54760          fdSelect.push(id);
54761        }
54762        break;
54763      case 3:
54764        const rangesCount = bytes[pos++] << 8 | bytes[pos++];
54765        for (i = 0; i < rangesCount; ++i) {
54766          let first = bytes[pos++] << 8 | bytes[pos++];
54767          if (i === 0 && first !== 0) {
54768            (0, _util.warn)("parseFDSelect: The first range must have a first GID of 0" + " -- trying to recover.");
54769            first = 0;
54770          }
54771          const fdIndex = bytes[pos++];
54772          const next = bytes[pos] << 8 | bytes[pos + 1];
54773          for (let j = first; j < next; ++j) {
54774            fdSelect.push(fdIndex);
54775          }
54776        }
54777        pos += 2;
54778        break;
54779      default:
54780        throw new _util.FormatError(`parseFDSelect: Unknown format "${format}".`);
54781    }
54782    if (fdSelect.length !== length) {
54783      throw new _util.FormatError("parseFDSelect: Invalid font data.");
54784    }
54785    return new CFFFDSelect(format, fdSelect);
54786  }
54787}
54788exports.CFFParser = CFFParser;
54789class CFF {
54790  constructor() {
54791    this.header = null;
54792    this.names = [];
54793    this.topDict = null;
54794    this.strings = new CFFStrings();
54795    this.globalSubrIndex = null;
54796    this.encoding = null;
54797    this.charset = null;
54798    this.charStrings = null;
54799    this.fdArray = [];
54800    this.fdSelect = null;
54801    this.isCIDFont = false;
54802  }
54803  duplicateFirstGlyph() {
54804    if (this.charStrings.count >= 65535) {
54805      (0, _util.warn)("Not enough space in charstrings to duplicate first glyph.");
54806      return;
54807    }
54808    const glyphZero = this.charStrings.get(0);
54809    this.charStrings.add(glyphZero);
54810    if (this.isCIDFont) {
54811      this.fdSelect.fdSelect.push(this.fdSelect.fdSelect[0]);
54812    }
54813  }
54814  hasGlyphId(id) {
54815    if (id < 0 || id >= this.charStrings.count) {
54816      return false;
54817    }
54818    const glyph = this.charStrings.get(id);
54819    return glyph.length > 0;
54820  }
54821}
54822exports.CFF = CFF;
54823class CFFHeader {
54824  constructor(major, minor, hdrSize, offSize) {
54825    this.major = major;
54826    this.minor = minor;
54827    this.hdrSize = hdrSize;
54828    this.offSize = offSize;
54829  }
54830}
54831exports.CFFHeader = CFFHeader;
54832class CFFStrings {
54833  constructor() {
54834    this.strings = [];
54835  }
54836  get(index) {
54837    if (index >= 0 && index <= NUM_STANDARD_CFF_STRINGS - 1) {
54838      return CFFStandardStrings[index];
54839    }
54840    if (index - NUM_STANDARD_CFF_STRINGS <= this.strings.length) {
54841      return this.strings[index - NUM_STANDARD_CFF_STRINGS];
54842    }
54843    return CFFStandardStrings[0];
54844  }
54845  getSID(str) {
54846    let index = CFFStandardStrings.indexOf(str);
54847    if (index !== -1) {
54848      return index;
54849    }
54850    index = this.strings.indexOf(str);
54851    if (index !== -1) {
54852      return index + NUM_STANDARD_CFF_STRINGS;
54853    }
54854    return -1;
54855  }
54856  add(value) {
54857    this.strings.push(value);
54858  }
54859  get count() {
54860    return this.strings.length;
54861  }
54862}
54863exports.CFFStrings = CFFStrings;
54864class CFFIndex {
54865  constructor() {
54866    this.objects = [];
54867    this.length = 0;
54868  }
54869  add(data) {
54870    this.length += data.length;
54871    this.objects.push(data);
54872  }
54873  set(index, data) {
54874    this.length += data.length - this.objects[index].length;
54875    this.objects[index] = data;
54876  }
54877  get(index) {
54878    return this.objects[index];
54879  }
54880  get count() {
54881    return this.objects.length;
54882  }
54883}
54884exports.CFFIndex = CFFIndex;
54885class CFFDict {
54886  constructor(tables, strings) {
54887    this.keyToNameMap = tables.keyToNameMap;
54888    this.nameToKeyMap = tables.nameToKeyMap;
54889    this.defaults = tables.defaults;
54890    this.types = tables.types;
54891    this.opcodes = tables.opcodes;
54892    this.order = tables.order;
54893    this.strings = strings;
54894    this.values = Object.create(null);
54895  }
54896  setByKey(key, value) {
54897    if (!(key in this.keyToNameMap)) {
54898      return false;
54899    }
54900    if (value.length === 0) {
54901      return true;
54902    }
54903    for (const val of value) {
54904      if (isNaN(val)) {
54905        (0, _util.warn)(`Invalid CFFDict value: "${value}" for key "${key}".`);
54906        return true;
54907      }
54908    }
54909    const type = this.types[key];
54910    if (type === "num" || type === "sid" || type === "offset") {
54911      value = value[0];
54912    }
54913    this.values[key] = value;
54914    return true;
54915  }
54916  setByName(name, value) {
54917    if (!(name in this.nameToKeyMap)) {
54918      throw new _util.FormatError(`Invalid dictionary name "${name}"`);
54919    }
54920    this.values[this.nameToKeyMap[name]] = value;
54921  }
54922  hasName(name) {
54923    return this.nameToKeyMap[name] in this.values;
54924  }
54925  getByName(name) {
54926    if (!(name in this.nameToKeyMap)) {
54927      throw new _util.FormatError(`Invalid dictionary name ${name}"`);
54928    }
54929    const key = this.nameToKeyMap[name];
54930    if (!(key in this.values)) {
54931      return this.defaults[key];
54932    }
54933    return this.values[key];
54934  }
54935  removeByName(name) {
54936    delete this.values[this.nameToKeyMap[name]];
54937  }
54938  static createTables(layout) {
54939    const tables = {
54940      keyToNameMap: {},
54941      nameToKeyMap: {},
54942      defaults: {},
54943      types: {},
54944      opcodes: {},
54945      order: []
54946    };
54947    for (const entry of layout) {
54948      const key = Array.isArray(entry[0]) ? (entry[0][0] << 8) + entry[0][1] : entry[0];
54949      tables.keyToNameMap[key] = entry[1];
54950      tables.nameToKeyMap[entry[1]] = key;
54951      tables.types[key] = entry[2];
54952      tables.defaults[key] = entry[3];
54953      tables.opcodes[key] = Array.isArray(entry[0]) ? entry[0] : [entry[0]];
54954      tables.order.push(key);
54955    }
54956    return tables;
54957  }
54958}
54959const 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]];
54960class CFFTopDict extends CFFDict {
54961  static get tables() {
54962    return (0, _util.shadow)(this, "tables", this.createTables(CFFTopDictLayout));
54963  }
54964  constructor(strings) {
54965    super(CFFTopDict.tables, strings);
54966    this.privateDict = null;
54967  }
54968}
54969exports.CFFTopDict = CFFTopDict;
54970const 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]];
54971class CFFPrivateDict extends CFFDict {
54972  static get tables() {
54973    return (0, _util.shadow)(this, "tables", this.createTables(CFFPrivateDictLayout));
54974  }
54975  constructor(strings) {
54976    super(CFFPrivateDict.tables, strings);
54977    this.subrsIndex = null;
54978  }
54979}
54980exports.CFFPrivateDict = CFFPrivateDict;
54981const CFFCharsetPredefinedTypes = {
54982  ISO_ADOBE: 0,
54983  EXPERT: 1,
54984  EXPERT_SUBSET: 2
54985};
54986class CFFCharset {
54987  constructor(predefined, format, charset, raw) {
54988    this.predefined = predefined;
54989    this.format = format;
54990    this.charset = charset;
54991    this.raw = raw;
54992  }
54993}
54994exports.CFFCharset = CFFCharset;
54995class CFFEncoding {
54996  constructor(predefined, format, encoding, raw) {
54997    this.predefined = predefined;
54998    this.format = format;
54999    this.encoding = encoding;
55000    this.raw = raw;
55001  }
55002}
55003class CFFFDSelect {
55004  constructor(format, fdSelect) {
55005    this.format = format;
55006    this.fdSelect = fdSelect;
55007  }
55008  getFDIndex(glyphIndex) {
55009    if (glyphIndex < 0 || glyphIndex >= this.fdSelect.length) {
55010      return -1;
55011    }
55012    return this.fdSelect[glyphIndex];
55013  }
55014}
55015exports.CFFFDSelect = CFFFDSelect;
55016class CFFOffsetTracker {
55017  constructor() {
55018    this.offsets = Object.create(null);
55019  }
55020  isTracking(key) {
55021    return key in this.offsets;
55022  }
55023  track(key, location) {
55024    if (key in this.offsets) {
55025      throw new _util.FormatError(`Already tracking location of ${key}`);
55026    }
55027    this.offsets[key] = location;
55028  }
55029  offset(value) {
55030    for (const key in this.offsets) {
55031      this.offsets[key] += value;
55032    }
55033  }
55034  setEntryLocation(key, values, output) {
55035    if (!(key in this.offsets)) {
55036      throw new _util.FormatError(`Not tracking location of ${key}`);
55037    }
55038    const data = output.data;
55039    const dataOffset = this.offsets[key];
55040    const size = 5;
55041    for (let i = 0, ii = values.length; i < ii; ++i) {
55042      const offset0 = i * size + dataOffset;
55043      const offset1 = offset0 + 1;
55044      const offset2 = offset0 + 2;
55045      const offset3 = offset0 + 3;
55046      const offset4 = offset0 + 4;
55047      if (data[offset0] !== 0x1d || data[offset1] !== 0 || data[offset2] !== 0 || data[offset3] !== 0 || data[offset4] !== 0) {
55048        throw new _util.FormatError("writing to an offset that is not empty");
55049      }
55050      const value = values[i];
55051      data[offset0] = 0x1d;
55052      data[offset1] = value >> 24 & 0xff;
55053      data[offset2] = value >> 16 & 0xff;
vendor: 1,142 bytes, lines 55054-55095
55054      data[offset3] = value >> 8 & 0xff;
55055      data[offset4] = value & 0xff;
55056    }
55057  }
55058}
55059class CFFCompiler {
55060  constructor(cff) {
55061    this.cff = cff;
55062  }
55063  compile() {
55064    const cff = this.cff;
55065    const output = {
55066      data: [],
55067      length: 0,
55068      add(data) {
55069        try {
55070          this.data.push(...data);
55071        } catch {
55072          this.data = this.data.concat(data);
55073        }
55074        this.length = this.data.length;
55075      }
55076    };
55077    const header = this.compileHeader(cff.header);
55078    output.add(header);
55079    const nameIndex = this.compileNameIndex(cff.names);
55080    output.add(nameIndex);
55081    if (cff.isCIDFont) {
55082      if (cff.topDict.hasName("FontMatrix")) {
55083        const base = cff.topDict.getByName("FontMatrix");
55084        cff.topDict.removeByName("FontMatrix");
55085        for (const subDict of cff.fdArray) {
55086          let matrix = base.slice(0);
55087          if (subDict.hasName("FontMatrix")) {
55088            matrix = _util.Util.transform(matrix, subDict.getByName("FontMatrix"));
55089          }
55090          subDict.setByName("FontMatrix", matrix);
55091        }
55092      }
55093    }
55094    const xuid = cff.topDict.getByName("XUID");
55095    if (xuid?
vendor: 7,852 bytes, lines 55095-55312
55095.length > 16) {
55096      cff.topDict.removeByName("XUID");
55097    }
55098    cff.topDict.setByName("charset", 0);
55099    let compiled = this.compileTopDicts([cff.topDict], output.length, cff.isCIDFont);
55100    output.add(compiled.output);
55101    const topDictTracker = compiled.trackers[0];
55102    const stringIndex = this.compileStringIndex(cff.strings.strings);
55103    output.add(stringIndex);
55104    const globalSubrIndex = this.compileIndex(cff.globalSubrIndex);
55105    output.add(globalSubrIndex);
55106    if (cff.encoding && cff.topDict.hasName("Encoding")) {
55107      if (cff.encoding.predefined) {
55108        topDictTracker.setEntryLocation("Encoding", [cff.encoding.format], output);
55109      } else {
55110        const encoding = this.compileEncoding(cff.encoding);
55111        topDictTracker.setEntryLocation("Encoding", [output.length], output);
55112        output.add(encoding);
55113      }
55114    }
55115    const charset = this.compileCharset(cff.charset, cff.charStrings.count, cff.strings, cff.isCIDFont);
55116    topDictTracker.setEntryLocation("charset", [output.length], output);
55117    output.add(charset);
55118    const charStrings = this.compileCharStrings(cff.charStrings);
55119    topDictTracker.setEntryLocation("CharStrings", [output.length], output);
55120    output.add(charStrings);
55121    if (cff.isCIDFont) {
55122      topDictTracker.setEntryLocation("FDSelect", [output.length], output);
55123      const fdSelect = this.compileFDSelect(cff.fdSelect);
55124      output.add(fdSelect);
55125      compiled = this.compileTopDicts(cff.fdArray, output.length, true);
55126      topDictTracker.setEntryLocation("FDArray", [output.length], output);
55127      output.add(compiled.output);
55128      const fontDictTrackers = compiled.trackers;
55129      this.compilePrivateDicts(cff.fdArray, fontDictTrackers, output);
55130    }
55131    this.compilePrivateDicts([cff.topDict], [topDictTracker], output);
55132    output.add([0]);
55133    return output.data;
55134  }
55135  encodeNumber(value) {
55136    if (Number.isInteger(value)) {
55137      return this.encodeInteger(value);
55138    }
55139    return this.encodeFloat(value);
55140  }
55141  static get EncodeFloatRegExp() {
55142    return (0, _util.shadow)(this, "EncodeFloatRegExp", /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/);
55143  }
55144  encodeFloat(num) {
55145    let value = num.toString();
55146    const m = CFFCompiler.EncodeFloatRegExp.exec(value);
55147    if (m) {
55148      const epsilon = parseFloat("1e" + ((m[2] ? +m[2] : 0) + m[1].length));
55149      value = (Math.round(num * epsilon) / epsilon).toString();
55150    }
55151    let nibbles = "";
55152    let i, ii;
55153    for (i = 0, ii = value.length; i < ii; ++i) {
55154      const a = value[i];
55155      if (a === "e") {
55156        nibbles += value[++i] === "-" ? "c" : "b";
55157      } else if (a === ".") {
55158        nibbles += "a";
55159      } else if (a === "-") {
55160        nibbles += "e";
55161      } else {
55162        nibbles += a;
55163      }
55164    }
55165    nibbles += nibbles.length & 1 ? "f" : "ff";
55166    const out = [30];
55167    for (i = 0, ii = nibbles.length; i < ii; i += 2) {
55168      out.push(parseInt(nibbles.substring(i, i + 2), 16));
55169    }
55170    return out;
55171  }
55172  encodeInteger(value) {
55173    let code;
55174    if (value >= -107 && value <= 107) {
55175      code = [value + 139];
55176    } else if (value >= 108 && value <= 1131) {
55177      value -= 108;
55178      code = [(value >> 8) + 247, value & 0xff];
55179    } else if (value >= -1131 && value <= -108) {
55180      value = -value - 108;
55181      code = [(value >> 8) + 251, value & 0xff];
55182    } else if (value >= -32768 && value <= 32767) {
55183      code = [0x1c, value >> 8 & 0xff, value & 0xff];
55184    } else {
55185      code = [0x1d, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff];
55186    }
55187    return code;
55188  }
55189  compileHeader(header) {
55190    return [header.major, header.minor, 4, header.offSize];
55191  }
55192  compileNameIndex(names) {
55193    const nameIndex = new CFFIndex();
55194    for (const name of names) {
55195      const length = Math.min(name.length, 127);
55196      let sanitizedName = new Array(length);
55197      for (let j = 0; j < length; j++) {
55198        let char = name[j];
55199        if (char < "!" || char > "~" || char === "[" || char === "]" || char === "(" || char === ")" || char === "{" || char === "}" || char === "<" || char === ">" || char === "/" || char === "%") {
55200          char = "_";
55201        }
55202        sanitizedName[j] = char;
55203      }
55204      sanitizedName = sanitizedName.join("");
55205      if (sanitizedName === "") {
55206        sanitizedName = "Bad_Font_Name";
55207      }
55208      nameIndex.add((0, _util.stringToBytes)(sanitizedName));
55209    }
55210    return this.compileIndex(nameIndex);
55211  }
55212  compileTopDicts(dicts, length, removeCidKeys) {
55213    const fontDictTrackers = [];
55214    let fdArrayIndex = new CFFIndex();
55215    for (const fontDict of dicts) {
55216      if (removeCidKeys) {
55217        fontDict.removeByName("CIDFontVersion");
55218        fontDict.removeByName("CIDFontRevision");
55219        fontDict.removeByName("CIDFontType");
55220        fontDict.removeByName("CIDCount");
55221        fontDict.removeByName("UIDBase");
55222      }
55223      const fontDictTracker = new CFFOffsetTracker();
55224      const fontDictData = this.compileDict(fontDict, fontDictTracker);
55225      fontDictTrackers.push(fontDictTracker);
55226      fdArrayIndex.add(fontDictData);
55227      fontDictTracker.offset(length);
55228    }
55229    fdArrayIndex = this.compileIndex(fdArrayIndex, fontDictTrackers);
55230    return {
55231      trackers: fontDictTrackers,
55232      output: fdArrayIndex
55233    };
55234  }
55235  compilePrivateDicts(dicts, trackers, output) {
55236    for (let i = 0, ii = dicts.length; i < ii; ++i) {
55237      const fontDict = dicts[i];
55238      const privateDict = fontDict.privateDict;
55239      if (!privateDict || !fontDict.hasName("Private")) {
55240        throw new _util.FormatError("There must be a private dictionary.");
55241      }
55242      const privateDictTracker = new CFFOffsetTracker();
55243      const privateDictData = this.compileDict(privateDict, privateDictTracker);
55244      let outputLength = output.length;
55245      privateDictTracker.offset(outputLength);
55246      if (!privateDictData.length) {
55247        outputLength = 0;
55248      }
55249      trackers[i].setEntryLocation("Private", [privateDictData.length, outputLength], output);
55250      output.add(privateDictData);
55251      if (privateDict.subrsIndex && privateDict.hasName("Subrs")) {
55252        const subrs = this.compileIndex(privateDict.subrsIndex);
55253        privateDictTracker.setEntryLocation("Subrs", [privateDictData.length], output);
55254        output.add(subrs);
55255      }
55256    }
55257  }
55258  compileDict(dict, offsetTracker) {
55259    const out = [];
55260    for (const key of dict.order) {
55261      if (!(key in dict.values)) {
55262        continue;
55263      }
55264      let values = dict.values[key];
55265      let types = dict.types[key];
55266      if (!Array.isArray(types)) {
55267        types = [types];
55268      }
55269      if (!Array.isArray(values)) {
55270        values = [values];
55271      }
55272      if (values.length === 0) {
55273        continue;
55274      }
55275      for (let j = 0, jj = types.length; j < jj; ++j) {
55276        const type = types[j];
55277        const value = values[j];
55278        switch (type) {
55279          case "num":
55280          case "sid":
55281            out.push(...this.encodeNumber(value));
55282            break;
55283          case "offset":
55284            const name = dict.keyToNameMap[key];
55285            if (!offsetTracker.isTracking(name)) {
55286              offsetTracker.track(name, out.length);
55287            }
55288            out.push(0x1d, 0, 0, 0, 0);
55289            break;
55290          case "array":
55291          case "delta":
55292            out.push(...this.encodeNumber(value));
55293            for (let k = 1, kk = values.length; k < kk; ++k) {
55294              out.push(...this.encodeNumber(values[k]));
55295            }
55296            break;
55297          default:
55298            throw new _util.FormatError(`Unknown data type of ${type}`);
55299        }
55300      }
55301      out.push(...dict.opcodes[key]);
55302    }
55303    return out;
55304  }
55305  compileStringIndex(strings) {
55306    const stringIndex = new CFFIndex();
55307    for (const string of strings) {
55308      stringIndex.add((0, _util.stringToBytes)(string));
55309    }
55310    return this.compileIndex(stringIndex);
55311  }
55312  compile
vendor: 3,975 bytes, lines 55312-55442
55312CharStrings(charStrings) {
55313    const charStringsIndex = new CFFIndex();
55314    for (let i = 0; i < charStrings.count; i++) {
55315      const glyph = charStrings.get(i);
55316      if (glyph.length === 0) {
55317        charStringsIndex.add(new Uint8Array([0x8b, 0x0e]));
55318        continue;
55319      }
55320      charStringsIndex.add(glyph);
55321    }
55322    return this.compileIndex(charStringsIndex);
55323  }
55324  compileCharset(charset, numGlyphs, strings, isCIDFont) {
55325    let out;
55326    const numGlyphsLessNotDef = numGlyphs - 1;
55327    if (isCIDFont) {
55328      out = new Uint8Array([2, 0, 0, numGlyphsLessNotDef >> 8 & 0xff, numGlyphsLessNotDef & 0xff]);
55329    } else {
55330      const length = 1 + numGlyphsLessNotDef * 2;
55331      out = new Uint8Array(length);
55332      out[0] = 0;
55333      let charsetIndex = 0;
55334      const numCharsets = charset.charset.length;
55335      let warned = false;
55336      for (let i = 1; i < out.length; i += 2) {
55337        let sid = 0;
55338        if (charsetIndex < numCharsets) {
55339          const name = charset.charset[charsetIndex++];
55340          sid = strings.getSID(name);
55341          if (sid === -1) {
55342            sid = 0;
55343            if (!warned) {
55344              warned = true;
55345              (0, _util.warn)(`Couldn't find ${name} in CFF strings`);
55346            }
55347          }
55348        }
55349        out[i] = sid >> 8 & 0xff;
55350        out[i + 1] = sid & 0xff;
55351      }
55352    }
55353    return this.compileTypedArray(out);
55354  }
55355  compileEncoding(encoding) {
55356    return this.compileTypedArray(encoding.raw);
55357  }
55358  compileFDSelect(fdSelect) {
55359    const format = fdSelect.format;
55360    let out, i;
55361    switch (format) {
55362      case 0:
55363        out = new Uint8Array(1 + fdSelect.fdSelect.length);
55364        out[0] = format;
55365        for (i = 0; i < fdSelect.fdSelect.length; i++) {
55366          out[i + 1] = fdSelect.fdSelect[i];
55367        }
55368        break;
55369      case 3:
55370        const start = 0;
55371        let lastFD = fdSelect.fdSelect[0];
55372        const ranges = [format, 0, 0, start >> 8 & 0xff, start & 0xff, lastFD];
55373        for (i = 1; i < fdSelect.fdSelect.length; i++) {
55374          const currentFD = fdSelect.fdSelect[i];
55375          if (currentFD !== lastFD) {
55376            ranges.push(i >> 8 & 0xff, i & 0xff, currentFD);
55377            lastFD = currentFD;
55378          }
55379        }
55380        const numRanges = (ranges.length - 3) / 3;
55381        ranges[1] = numRanges >> 8 & 0xff;
55382        ranges[2] = numRanges & 0xff;
55383        ranges.push(i >> 8 & 0xff, i & 0xff);
55384        out = new Uint8Array(ranges);
55385        break;
55386    }
55387    return this.compileTypedArray(out);
55388  }
55389  compileTypedArray(data) {
55390    return Array.from(data);
55391  }
55392  compileIndex(index, trackers = []) {
55393    const objects = index.objects;
55394    const count = objects.length;
55395    if (count === 0) {
55396      return [0, 0];
55397    }
55398    const data = [count >> 8 & 0xff, count & 0xff];
55399    let lastOffset = 1,
55400      i;
55401    for (i = 0; i < count; ++i) {
55402      lastOffset += objects[i].length;
55403    }
55404    let offsetSize;
55405    if (lastOffset < 0x100) {
55406      offsetSize = 1;
55407    } else if (lastOffset < 0x10000) {
55408      offsetSize = 2;
55409    } else if (lastOffset < 0x1000000) {
55410      offsetSize = 3;
55411    } else {
55412      offsetSize = 4;
55413    }
55414    data.push(offsetSize);
55415    let relativeOffset = 1;
55416    for (i = 0; i < count + 1; i++) {
55417      if (offsetSize === 1) {
55418        data.push(relativeOffset & 0xff);
55419      } else if (offsetSize === 2) {
55420        data.push(relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
55421      } else if (offsetSize === 3) {
55422        data.push(relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
55423      } else {
55424        data.push(relativeOffset >>> 24 & 0xff, relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
55425      }
55426      if (objects[i]) {
55427        relativeOffset += objects[i].length;
55428      }
55429    }
55430    for (i = 0; i < count; i++) {
55431      if (trackers[i]) {
55432        trackers[i].offset(data.length);
55433      }
55434      data.push(...objects[i]);
55435    }
55436    return data;
55437  }
55438}
55439exports.CFFCompiler = CFFCompiler;
55440
55441/***/ }),
55442/* 36
vendor: 6,402 bytes, lines 55442-55459
55442 */
55443/***/ ((__unused_webpack_module, exports) => {
55444
55445
55446
55447Object.defineProperty(exports, "__esModule", ({
55448  value: true
55449}));
55450exports.ISOAdobeCharset = exports.ExpertSubsetCharset = exports.ExpertCharset = void 0;
55451const 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", "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", "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"];
55452exports.ISOAdobeCharset = ISOAdobeCharset;
55453const 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"];
55454exports.ExpertCharset = ExpertCharset;
55455const 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"];
55456exports.ExpertSubsetCharset = ExpertSubsetCharset;
55457
55458/***/ }),
55459/* 3
554597
vendor: 17,529 bytes, lines 55459-55504
55459 */
55460/***/ ((__unused_webpack_module, exports) => {
55461
55462
55463
55464Object.defineProperty(exports, "__esModule", ({
55465  value: true
55466}));
55467exports.ZapfDingbatsEncoding = exports.WinAnsiEncoding = exports.SymbolSetEncoding = exports.StandardEncoding = exports.MacRomanEncoding = exports.ExpertEncoding = void 0;
55468exports.getEncoding = getEncoding;
55469const 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"];
55470exports.ExpertEncoding = ExpertEncoding;
55471const 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", "", "", "", ""];
55472const 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"];
55473exports.MacRomanEncoding = MacRomanEncoding;
55474const 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", "", "", "", ""];
55475exports.StandardEncoding = StandardEncoding;
55476const 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"];
55477exports.WinAnsiEncoding = WinAnsiEncoding;
55478const 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", ""];
55479exports.SymbolSetEncoding = SymbolSetEncoding;
55480const 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", ""];
55481exports.ZapfDingbatsEncoding = ZapfDingbatsEncoding;
55482function getEncoding(encodingName) {
55483  switch (encodingName) {
55484    case "WinAnsiEncoding":
55485      return WinAnsiEncoding;
55486    case "StandardEncoding":
55487      return StandardEncoding;
55488    case "MacRomanEncoding":
55489      return MacRomanEncoding;
55490    case "SymbolSetEncoding":
55491      return SymbolSetEncoding;
55492    case "ZapfDingbatsEncoding":
55493      return ZapfDingbatsEncoding;
55494    case "ExpertEncoding":
55495      return ExpertEncoding;
55496    case "MacExpertEncoding":
55497      return MacExpertEncoding;
55498    default:
55499      return null;
55500  }
55501}
55502
55503/***/ }),
55504/* 3
555048 */
55505/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
55506
55507
55508
55509Object.defineProperty(exports, "__esModule", ({
55510  value: true
55511}));
55512exports.SEAC_ANALYSIS_ENABLED = exports.MacStandardGlyphOrdering = exports.FontFlags = void 0;
55513exports.normalizeFontName = normalizeFontName;
55514exports.recoverGlyphName = recoverGlyphName;
55515exports.type1FontGlyphMapping = type1FontGlyphMapping;
55516var _encodings = __w_pdfjs_require__(37);
55517var _glyphlist = __w_pdfjs_require__(39);
55518var _unicode = __w_pdfjs_require__(40);
55519var _util = __w_pdfjs_require__(2);
55520const SEAC_ANALYSIS_ENABLED = true;
55521exports.SEAC_ANALYSIS_ENABLED = SEAC_ANALYSIS_ENABLED;
55522const FontFlags = {
55523  FixedPitch: 1,
55524  Serif: 2,
55525  Symbolic: 4,
55526  Script: 8,
55527  Nonsymbolic: 32,
55528  Italic: 64,
55529  AllCap: 65536,
55530  SmallCap: 131072,
55531  ForceBold: 262144
55532};
55533exports.FontFlags = FontFlags;
55534const 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", "periodce
55534ntered", "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"];
55535exports.MacStandardGlyphOrdering = MacStandardGlyphOrdering;
55536function recoverGlyphName(name, glyphsUnicodeMap) {
55537  if (glyphsUnicodeMap[name] !== undefined) {
55538    return name;
55539  }
55540  const unicode = (0, _unicode.getUnicodeForGlyph)(name, glyphsUnicodeMap);
55541  if (unicode !== -1) {
55542    for (const key in glyphsUnicodeMap) {
55543      if (glyphsUnicodeMap[key] === unicode) {
55544        return key;
55545      }
55546    }
55547  }
55548  (0, _util.info)("Unable to recover a standard glyph name for: " + name);
55549  return name;
55550}
55551function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) {
55552  const charCodeToGlyphId = Object.create(null);
55553  let glyphId, charCode, baseEncoding;
55554  const isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
55555  if (properties.isInternalFont) {
55556    baseEncoding = builtInEncoding;
55557    for (charCode = 0; charCode < baseEncoding.length; charCode++) {
55558      glyphId = glyphNames.indexOf(baseEncoding[charCode]);
55559      charCodeToGlyphId[charCode] = glyphId >= 0 ? glyphId : 0;
55560    }
55561  } else if (properties.baseEncodingName) {
55562    baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName);
55563    for (charCode = 0; charCode < baseEncoding.length; charCode++) {
55564      glyphId = glyphNames.indexOf(baseEncoding[charCode]);
55565      charCodeToGlyphId[charCode] = glyphId >= 0 ? glyphId : 0;
55566    }
55567  } else if (isSymbolicFont) {
55568    for (charCode in builtInEncoding) {
55569      charCodeToGlyphId[charCode] = builtInEncoding[charCode];
55570    }
55571  } else {
55572    baseEncoding = _encodings.StandardEncoding;
55573    for (charCode = 0; charCode < baseEncoding.length; charCode++) {
55574      glyphId = glyphNames.indexOf(baseEncoding[charCode]);
55575      charCodeToGlyphId[charCode] = glyphId >= 0 ? glyphId : 0;
55576    }
55577  }
55578  const differences = properties.differences;
55579  let glyphsUnicodeMap;
55580  if (differences) {
55581    for (charCode in differences) {
55582      const glyphName = differences[charCode];
55583      glyphId = glyphNames.indexOf(glyphName);
55584      if (glyphId === -1) {
55585        if (!glyphsUnicodeMap) {
55586          glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
55587        }
55588        const standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
55589        if (standardGlyphName !== glyphName) {
55590          glyphId = glyphNames.indexOf(standardGlyphName);
55591        }
55592      }
55593      charCodeToGlyphId[charCode] = glyphId >= 0 ? glyphId : 0;
55594    }
55595  }
55596  return charCodeToGlyphId;
55597}
55598function normalizeFontName(name) {
55599  return name.replaceAll(/[,_]/g, "-").replaceAll(/\s/g, "");
55600}
55601
55602/***/ }),
55603/* 39 */
55604/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
55605
55606
55607
55608Object.defineProperty(exports, "__esModule", ({
55609  value: true
55610}));
55611exports.getGlyphsUnicode = exports.getDingbatsGlyphsUnicode = void 0;
55612var _core_utils = __w_pdfjs_require__(3);
55613const getGlyphsUnicode = (0, _core_utils.getLookupTableFactory)
vendor: 115,428 bytes, lines 55613-59942
55613(function (t) {
55614  t.A = 0x0041;
55615  t.AE = 0x00c6;
55616  t.AEacute = 0x01fc;
55617  t.AEmacron = 0x01e2;
55618  t.AEsmall = 0xf7e6;
55619  t.Aacute = 0x00c1;
55620  t.Aacutesmall = 0xf7e1;
55621  t.Abreve = 0x0102;
55622  t.Abreveacute = 0x1eae;
55623  t.Abrevecyrillic = 0x04d0;
55624  t.Abrevedotbelow = 0x1eb6;
55625  t.Abrevegrave = 0x1eb0;
55626  t.Abrevehookabove = 0x1eb2;
55627  t.Abrevetilde = 0x1eb4;
55628  t.Acaron = 0x01cd;
55629  t.Acircle = 0x24b6;
55630  t.Acircumflex = 0x00c2;
55631  t.Acircumflexacute = 0x1ea4;
55632  t.Acircumflexdotbelow = 0x1eac;
55633  t.Acircumflexgrave = 0x1ea6;
55634  t.Acircumflexhookabove = 0x1ea8;
55635  t.Acircumflexsmall = 0xf7e2;
55636  t.Acircumflextilde = 0x1eaa;
55637  t.Acute = 0xf6c9;
55638  t.Acutesmall = 0xf7b4;
55639  t.Acyrillic = 0x0410;
55640  t.Adblgrave = 0x0200;
55641  t.Adieresis = 0x00c4;
55642  t.Adieresiscyrillic = 0x04d2;
55643  t.Adieresismacron = 0x01de;
55644  t.Adieresissmall = 0xf7e4;
55645  t.Adotbelow = 0x1ea0;
55646  t.Adotmacron = 0x01e0;
55647  t.Agrave = 0x00c0;
55648  t.Agravesmall = 0xf7e0;
55649  t.Ahookabove = 0x1ea2;
55650  t.Aiecyrillic = 0x04d4;
55651  t.Ainvertedbreve = 0x0202;
55652  t.Alpha = 0x0391;
55653  t.Alphatonos = 0x0386;
55654  t.Amacron = 0x0100;
55655  t.Amonospace = 0xff21;
55656  t.Aogonek = 0x0104;
55657  t.Aring = 0x00c5;
55658  t.Aringacute = 0x01fa;
55659  t.Aringbelow = 0x1e00;
55660  t.Aringsmall = 0xf7e5;
55661  t.Asmall = 0xf761;
55662  t.Atilde = 0x00c3;
55663  t.Atildesmall = 0xf7e3;
55664  t.Aybarmenian = 0x0531;
55665  t.B = 0x0042;
55666  t.Bcircle = 0x24b7;
55667  t.Bdotaccent = 0x1e02;
55668  t.Bdotbelow = 0x1e04;
55669  t.Becyrillic = 0x0411;
55670  t.Benarmenian = 0x0532;
55671  t.Beta = 0x0392;
55672  t.Bhook = 0x0181;
55673  t.Blinebelow = 0x1e06;
55674  t.Bmonospace = 0xff22;
55675  t.Brevesmall = 0xf6f4;
55676  t.Bsmall = 0xf762;
55677  t.Btopbar = 0x0182;
55678  t.C = 0x0043;
55679  t.Caarmenian = 0x053e;
55680  t.Cacute = 0x0106;
55681  t.Caron = 0xf6ca;
55682  t.Caronsmall = 0xf6f5;
55683  t.Ccaron = 0x010c;
55684  t.Ccedilla = 0x00c7;
55685  t.Ccedillaacute = 0x1e08;
55686  t.Ccedillasmall = 0xf7e7;
55687  t.Ccircle = 0x24b8;
55688  t.Ccircumflex = 0x0108;
55689  t.Cdot = 0x010a;
55690  t.Cdotaccent = 0x010a;
55691  t.Cedillasmall = 0xf7b8;
55692  t.Chaarmenian = 0x0549;
55693  t.Cheabkhasiancyrillic = 0x04bc;
55694  t.Checyrillic = 0x0427;
55695  t.Chedescenderabkhasiancyrillic = 0x04be;
55696  t.Chedescendercyrillic = 0x04b6;
55697  t.Chedieresiscyrillic = 0x04f4;
55698  t.Cheharmenian = 0x0543;
55699  t.Chekhakassiancyrillic = 0x04cb;
55700  t.Cheverticalstrokecyrillic = 0x04b8;
55701  t.Chi = 0x03a7;
55702  t.Chook = 0x0187;
55703  t.Circumflexsmall = 0xf6f6;
55704  t.Cmonospace = 0xff23;
55705  t.Coarmenian = 0x0551;
55706  t.Csmall = 0xf763;
55707  t.D = 0x0044;
55708  t.DZ = 0x01f1;
55709  t.DZcaron = 0x01c4;
55710  t.Daarmenian = 0x0534;
55711  t.Dafrican = 0x0189;
55712  t.Dcaron = 0x010e;
55713  t.Dcedilla = 0x1e10;
55714  t.Dcircle = 0x24b9;
55715  t.Dcircumflexbelow = 0x1e12;
55716  t.Dcroat = 0x0110;
55717  t.Ddotaccent = 0x1e0a;
55718  t.Ddotbelow = 0x1e0c;
55719  t.Decyrillic = 0x0414;
55720  t.Deicoptic = 0x03ee;
55721  t.Delta = 0x2206;
55722  t.Deltagreek = 0x0394;
55723  t.Dhook = 0x018a;
55724  t.Dieresis = 0xf6cb;
55725  t.DieresisAcute = 0xf6cc;
55726  t.DieresisGrave = 0xf6cd;
55727  t.Dieresissmall = 0xf7a8;
55728  t.Digammagreek = 0x03dc;
55729  t.Djecyrillic = 0x0402;
55730  t.Dlinebelow = 0x1e0e;
55731  t.Dmonospace = 0xff24;
55732  t.Dotaccentsmall = 0xf6f7;
55733  t.Dslash = 0x0110;
55734  t.Dsmall = 0xf764;
55735  t.Dtopbar = 0x018b;
55736  t.Dz = 0x01f2;
55737  t.Dzcaron = 0x01c5;
55738  t.Dzeabkhasiancyrillic = 0x04e0;
55739  t.Dzecyrillic = 0x0405;
55740  t.Dzhecyrillic = 0x040f;
55741  t.E = 0x0045;
55742  t.Eacute = 0x00c9;
55743  t.Eacutesmall = 0xf7e9;
55744  t.Ebreve = 0x0114;
55745  t.Ecaron = 0x011a;
55746  t.Ecedillabreve = 0x1e1c;
55747  t.Echarmenian = 0x0535;
55748  t.Ecircle = 0x24ba;
55749  t.Ecircumflex = 0x00ca;
55750  t.Ecircumflexacute = 0x1ebe;
55751  t.Ecircumflexbelow = 0x1e18;
55752  t.Ecircumflexdotbelow = 0x1ec6;
55753  t.Ecircumflexgrave = 0x1ec0;
55754  t.Ecircumflexhookabove = 0x1ec2;
55755  t.Ecircumflexsmall = 0xf7ea;
55756  t.Ecircumflextilde = 0x1ec4;
55757  t.Ecyrillic = 0x0404;
55758  t.Edblgrave = 0x0204;
55759  t.Edieresis = 0x00cb;
55760  t.Edieresissmall = 0xf7eb;
55761  t.Edot = 0x0116;
55762  t.Edotaccent = 0x0116;
55763  t.Edotbelow = 0x1eb8;
55764  t.Efcyrillic = 0x0424;
55765  t.Egrave = 0x00c8;
55766  t.Egravesmall = 0xf7e8;
55767  t.Eharmenian = 0x0537;
55768  t.Ehookabove = 0x1eba;
55769  t.Eightroman = 0x2167;
55770  t.Einvertedbreve = 0x0206;
55771  t.Eiotifiedcyrillic = 0x0464;
55772  t.Elcyrillic = 0x041b;
55773  t.Elevenroman = 0x216a;
55774  t.Emacron = 0x0112;
55775  t.Emacronacute = 0x1e16;
55776  t.Emacrongrave = 0x1e14;
55777  t.Emcyrillic = 0x041c;
55778  t.Emonospace = 0xff25;
55779  t.Encyrillic = 0x041d;
55780  t.Endescendercyrillic = 0x04a2;
55781  t.Eng = 0x014a;
55782  t.Enghecyrillic = 0x04a4;
55783  t.Enhookcyrillic = 0x04c7;
55784  t.Eogonek = 0x0118;
55785  t.Eopen = 0x0190;
55786  t.Epsilon = 0x0395;
55787  t.Epsilontonos = 0x0388;
55788  t.Ercyrillic = 0x0420;
55789  t.Ereversed = 0x018e;
55790  t.Ereversedcyrillic = 0x042d;
55791  t.Escyrillic = 0x0421;
55792  t.Esdescendercyrillic = 0x04aa;
55793  t.Esh = 0x01a9;
55794  t.Esmall = 0xf765;
55795  t.Eta = 0x0397;
55796  t.Etarmenian = 0x0538;
55797  t.Etatonos = 0x0389;
55798  t.Eth = 0x00d0;
55799  t.Ethsmall = 0xf7f0;
55800  t.Etilde = 0x1ebc;
55801  t.Etildebelow = 0x1e1a;
55802  t.Euro = 0x20ac;
55803  t.Ezh = 0x01b7;
55804  t.Ezhcaron = 0x01ee;
55805  t.Ezhreversed = 0x01b8;
55806  t.F = 0x0046;
55807  t.Fcircle = 0x24bb;
55808  t.Fdotaccent = 0x1e1e;
55809  t.Feharmenian = 0x0556;
55810  t.Feicoptic = 0x03e4;
55811  t.Fhook = 0x0191;
55812  t.Fitacyrillic = 0x0472;
55813  t.Fiveroman = 0x2164;
55814  t.Fmonospace = 0xff26;
55815  t.Fourroman = 0x2163;
55816  t.Fsmall = 0xf766;
55817  t.G = 0x0047;
55818  t.GBsquare = 0x3387;
55819  t.Gacute = 0x01f4;
55820  t.Gamma = 0x0393;
55821  t.Gammaafrican = 0x0194;
55822  t.Gangiacoptic = 0x03ea;
55823  t.Gbreve = 0x011e;
55824  t.Gcaron = 0x01e6;
55825  t.Gcedilla = 0x0122;
55826  t.Gcircle = 0x24bc;
55827  t.Gcircumflex = 0x011c;
55828  t.Gcommaaccent = 0x0122;
55829  t.Gdot = 0x0120;
55830  t.Gdotaccent = 0x0120;
55831  t.Gecyrillic = 0x0413;
55832  t.Ghadarmenian = 0x0542;
55833  t.Ghemiddlehookcyrillic = 0x0494;
55834  t.Ghestrokecyrillic = 0x0492;
55835  t.Gheupturncyrillic = 0x0490;
55836  t.Ghook = 0x0193;
55837  t.Gimarmenian = 0x0533;
55838  t.Gjecyrillic = 0x0403;
55839  t.Gmacron = 0x1e20;
55840  t.Gmonospace = 0xff27;
55841  t.Grave = 0xf6ce;
55842  t.Gravesmall = 0xf760;
55843  t.Gsmall = 0xf767;
55844  t.Gsmallhook = 0x029b;
55845  t.Gstroke = 0x01e4;
55846  t.H = 0x0048;
55847  t.H18533 = 0x25cf;
55848  t.H18543 = 0x25aa;
55849  t.H18551 = 0x25ab;
55850  t.H22073 = 0x25a1;
55851  t.HPsquare = 0x33cb;
55852  t.Haabkhasiancyrillic = 0x04a8;
55853  t.Hadescendercyrillic = 0x04b2;
55854  t.Hardsigncyrillic = 0x042a;
55855  t.Hbar = 0x0126;
55856  t.Hbrevebelow = 0x1e2a;
55857  t.Hcedilla = 0x1e28;
55858  t.Hcircle = 0x24bd;
55859  t.Hcircumflex = 0x0124;
55860  t.Hdieresis = 0x1e26;
55861  t.Hdotaccent = 0x1e22;
55862  t.Hdotbelow = 0x1e24;
55863  t.Hmonospace = 0xff28;
55864  t.Hoarmenian = 0x0540;
55865  t.Horicoptic = 0x03e8;
55866  t.Hsmall = 0xf768;
55867  t.Hungarumlaut = 0xf6cf;
55868  t.Hungarumlautsmall = 0xf6f8;
55869  t.Hzsquare = 0x3390;
55870  t.I = 0x0049;
55871  t.IAcyrillic = 0x042f;
55872  t.IJ = 0x0132;
55873  t.IUcyrillic = 0x042e;
55874  t.Iacute = 0x00cd;
55875  t.Iacutesmall = 0xf7ed;
55876  t.Ibreve = 0x012c;
55877  t.Icaron = 0x01cf;
55878  t.Icircle = 0x24be;
55879  t.Icircumflex = 0x00ce;
55880  t.Icircumflexsmall = 0xf7ee;
55881  t.Icyrillic = 0x0406;
55882  t.Idblgrave = 0x0208;
55883  t.Idieresis = 0x00cf;
55884  t.Idieresisacute = 0x1e2e;
55885  t.Idieresiscyrillic = 0x04e4;
55886  t.Idieresissmall = 0xf7ef;
55887  t.Idot = 0x0130;
55888  t.Idotaccent = 0x0130;
55889  t.Idotbelow = 0x1eca;
55890  t.Iebrevecyrillic = 0x04d6;
55891  t.Iecyrillic = 0x0415;
55892  t.Ifraktur = 0x2111;
55893  t.Igrave = 0x00cc;
55894  t.Igravesmall = 0xf7ec;
55895  t.Ihookabove = 0x1ec8;
55896  t.Iicyrillic = 0x0418;
55897  t.Iinvertedbreve = 0x020a;
55898  t.Iishortcyrillic = 0x0419;
55899  t.Imacron = 0x012a;
55900  t.Imacroncyrillic = 0x04e2;
55901  t.Imonospace = 0xff29;
55902  t.Iniarmenian = 0x053b;
55903  t.Iocyrillic = 0x0401;
55904  t.Iogonek = 0x012e;
55905  t.Iota = 0x0399;
55906  t.Iotaafrican = 0x0196;
55907  t.Iotadieresis = 0x03aa;
55908  t.Iotatonos = 0x038a;
55909  t.Ismall = 0xf769;
55910  t.Istroke = 0x0197;
55911  t.Itilde = 0x0128;
55912  t.Itildebelow = 0x1e2c;
55913  t.Izhitsacyrillic = 0x0474;
55914  t.Izhitsadblgravecyrillic = 0x0476;
55915  t.J = 0x004a;
55916  t.Jaarmenian = 0x0541;
55917  t.Jcircle = 0x24bf;
55918  t.Jcircumflex = 0x0134;
55919  t.Jecyrillic = 0x0408;
55920  t.Jheharmenian = 0x054b;
55921  t.Jmonospace = 0xff2a;
55922  t.Jsmall = 0xf76a;
55923  t.K = 0x004b;
55924  t.KBsquare = 0x3385;
55925  t.KKsquare = 0x33cd;
55926  t.Kabashkircyrillic = 0x04a0;
55927  t.Kacute = 0x1e30;
55928  t.Kacyrillic = 0x041a;
55929  t.Kadescendercyrillic = 0x049a;
55930  t.Kahookcyrillic = 0x04c3;
55931  t.Kappa = 0x039a;
55932  t.Kastrokecyrillic = 0x049e;
55933  t.Kaverticalstrokecyrillic = 0x049c;
55934  t.Kcaron = 0x01e8;
55935  t.Kcedilla = 0x0136;
55936  t.Kcircle = 0x24c0;
55937  t.Kcommaaccent = 0x0136;
55938  t.Kdotbelow = 0x1e32;
55939  t.Keharmenian = 0x0554;
55940  t.Kenarmenian = 0x053f;
55941  t.Khacyrillic = 0x0425;
55942  t.Kheicoptic = 0x03e6;
55943  t.Khook = 0x0198;
55944  t.Kjecyrillic = 0x040c;
55945  t.Klinebelow = 0x1e34;
55946  t.Kmonospace = 0xff2b;
55947  t.Koppacyrillic = 0x0480;
55948  t.Koppagreek = 0x03de;
55949  t.Ksicyrillic = 0x046e;
55950  t.Ksmall = 0xf76b;
55951  t.L = 0x004c;
55952  t.LJ = 0x01c7;
55953  t.LL = 0xf6bf;
55954  t.Lacute = 0x0139;
55955  t.Lambda = 0x039b;
55956  t.Lcaron = 0x013d;
55957  t.Lcedilla = 0x013b;
55958  t.Lcircle = 0x24c1;
55959  t.Lcircumflexbelow = 0x1e3c;
55960  t.Lcommaaccent = 0x013b;
55961  t.Ldot = 0x013f;
55962  t.Ldotaccent = 0x013f;
55963  t.Ldotbelow = 0x1e36;
55964  t.Ldotbelowmacron = 0x1e38;
55965  t.Liwnarmenian = 0x053c;
55966  t.Lj = 0x01c8;
55967  t.Ljecyrillic = 0x0409;
55968  t.Llinebelow = 0x1e3a;
55969  t.Lmonospace = 0xff2c;
55970  t.Lslash = 0x0141;
55971  t.Lslashsmall = 0xf6f9;
55972  t.Lsmall = 0xf76c;
55973  t.M = 0x004d;
55974  t.MBsquare = 0x3386;
55975  t.Macron = 0xf6d0;
55976  t.Macronsmall = 0xf7af;
55977  t.Macute = 0x1e3e;
55978  t.Mcircle = 0x24c2;
55979  t.Mdotaccent = 0x1e40;
55980  t.Mdotbelow = 0x1e42;
55981  t.Menarmenian = 0x0544;
55982  t.Mmonospace = 0xff2d;
55983  t.Msmall = 0xf76d;
55984  t.Mturned = 0x019c;
55985  t.Mu = 0x039c;
55986  t.N = 0x004e;
55987  t.NJ = 0x01ca;
55988  t.Nacute = 0x0143;
55989  t.Ncaron = 0x0147;
55990  t.Ncedilla = 0x0145;
55991  t.Ncircle = 0x24c3;
55992  t.Ncircumflexbelow = 0x1e4a;
55993  t.Ncommaaccent = 0x0145;
55994  t.Ndotaccent = 0x1e44;
55995  t.Ndotbelow = 0x1e46;
55996  t.Nhookleft = 0x019d;
55997  t.Nineroman = 0x2168;
55998  t.Nj = 0x01cb;
55999  t.Njecyrillic = 0x040a;
56000  t.Nlinebelow = 0x1e48;
56001  t.Nmonospace = 0xff2e;
56002  t.Nowarmenian = 0x0546;
56003  t.Nsmall = 0xf76e;
56004  t.Ntilde = 0x00d1;
56005  t.Ntildesmall = 0xf7f1;
56006  t.Nu = 0x039d;
56007  t.O = 0x004f;
56008  t.OE = 0x0152;
56009  t.OEsmall = 0xf6fa;
56010  t.Oacute = 0x00d3;
56011  t.Oacutesmall = 0xf7f3;
56012  t.Obarredcyrillic = 0x04e8;
56013  t.Obarreddieresiscyrillic = 0x04ea;
56014  t.Obreve = 0x014e;
56015  t.Ocaron = 0x01d1;
56016  t.Ocenteredtilde = 0x019f;
56017  t.Ocircle = 0x24c4;
56018  t.Ocircumflex = 0x00d4;
56019  t.Ocircumflexacute = 0x1ed0;
56020  t.Ocircumflexdotbelow = 0x1ed8;
56021  t.Ocircumflexgrave = 0x1ed2;
56022  t.Ocircumflexhookabove = 0x1ed4;
56023  t.Ocircumflexsmall = 0xf7f4;
56024  t.Ocircumflextilde = 0x1ed6;
56025  t.Ocyrillic = 0x041e;
56026  t.Odblacute = 0x0150;
56027  t.Odblgrave = 0x020c;
56028  t.Odieresis = 0x00d6;
56029  t.Odieresiscyrillic = 0x04e6;
56030  t.Odieresissmall = 0xf7f6;
56031  t.Odotbelow = 0x1ecc;
56032  t.Ogoneksmall = 0xf6fb;
56033  t.Ograve = 0x00d2;
56034  t.Ogravesmall = 0xf7f2;
56035  t.Oharmenian = 0x0555;
56036  t.Ohm = 0x2126;
56037  t.Ohookabove = 0x1ece;
56038  t.Ohorn = 0x01a0;
56039  t.Ohornacute = 0x1eda;
56040  t.Ohorndotbelow = 0x1ee2;
56041  t.Ohorngrave = 0x1edc;
56042  t.Ohornhookabove = 0x1ede;
56043  t.Ohorntilde = 0x1ee0;
56044  t.Ohungarumlaut = 0x0150;
56045  t.Oi = 0x01a2;
56046  t.Oinvertedbreve = 0x020e;
56047  t.Omacron = 0x014c;
56048  t.Omacronacute = 0x1e52;
56049  t.Omacrongrave = 0x1e50;
56050  t.Omega = 0x2126;
56051  t.Omegacyrillic = 0x0460;
56052  t.Omegagreek = 0x03a9;
56053  t.Omegaroundcyrillic = 0x047a;
56054  t.Omegatitlocyrillic = 0x047c;
56055  t.Omegatonos = 0x038f;
56056  t.Omicron = 0x039f;
56057  t.Omicrontonos = 0x038c;
56058  t.Omonospace = 0xff2f;
56059  t.Oneroman = 0x2160;
56060  t.Oogonek = 0x01ea;
56061  t.Oogonekmacron = 0x01ec;
56062  t.Oopen = 0x0186;
56063  t.Oslash = 0x00d8;
56064  t.Oslashacute = 0x01fe;
56065  t.Oslashsmall = 0xf7f8;
56066  t.Osmall = 0xf76f;
56067  t.Ostrokeacute = 0x01fe;
56068  t.Otcyrillic = 0x047e;
56069  t.Otilde = 0x00d5;
56070  t.Otildeacute = 0x1e4c;
56071  t.Otildedieresis = 0x1e4e;
56072  t.Otildesmall = 0xf7f5;
56073  t.P = 0x0050;
56074  t.Pacute = 0x1e54;
56075  t.Pcircle = 0x24c5;
56076  t.Pdotaccent = 0x1e56;
56077  t.Pecyrillic = 0x041f;
56078  t.Peharmenian = 0x054a;
56079  t.Pemiddlehookcyrillic = 0x04a6;
56080  t.Phi = 0x03a6;
56081  t.Phook = 0x01a4;
56082  t.Pi = 0x03a0;
56083  t.Piwrarmenian = 0x0553;
56084  t.Pmonospace = 0xff30;
56085  t.Psi = 0x03a8;
56086  t.Psicyrillic = 0x0470;
56087  t.Psmall = 0xf770;
56088  t.Q = 0x0051;
56089  t.Qcircle = 0x24c6;
56090  t.Qmonospace = 0xff31;
56091  t.Qsmall = 0xf771;
56092  t.R = 0x0052;
56093  t.Raarmenian = 0x054c;
56094  t.Racute = 0x0154;
56095  t.Rcaron = 0x0158;
56096  t.Rcedilla = 0x0156;
56097  t.Rcircle = 0x24c7;
56098  t.Rcommaaccent = 0x0156;
56099  t.Rdblgrave = 0x0210;
56100  t.Rdotaccent = 0x1e58;
56101  t.Rdotbelow = 0x1e5a;
56102  t.Rdotbelowmacron = 0x1e5c;
56103  t.Reharmenian = 0x0550;
56104  t.Rfraktur = 0x211c;
56105  t.Rho = 0x03a1;
56106  t.Ringsmall = 0xf6fc;
56107  t.Rinvertedbreve = 0x0212;
56108  t.Rlinebelow = 0x1e5e;
56109  t.Rmonospace = 0xff32;
56110  t.Rsmall = 0xf772;
56111  t.Rsmallinverted = 0x0281;
56112  t.Rsmallinvertedsuperior = 0x02b6;
56113  t.S = 0x0053;
56114  t.SF010000 = 0x250c;
56115  t.SF020000 = 0x2514;
56116  t.SF030000 = 0x2510;
56117  t.SF040000 = 0x2518;
56118  t.SF050000 = 0x253c;
56119  t.SF060000 = 0x252c;
56120  t.SF070000 = 0x2534;
56121  t.SF080000 = 0x251c;
56122  t.SF090000 = 0x2524;
56123  t.SF100000 = 0x2500;
56124  t.SF110000 = 0x2502;
56125  t.SF190000 = 0x2561;
56126  t.SF200000 = 0x2562;
56127  t.SF210000 = 0x2556;
56128  t.SF220000 = 0x2555;
56129  t.SF230000 = 0x2563;
56130  t.SF240000 = 0x2551;
56131  t.SF250000 = 0x2557;
56132  t.SF260000 = 0x255d;
56133  t.SF270000 = 0x255c;
56134  t.SF280000 = 0x255b;
56135  t.SF360000 = 0x255e;
56136  t.SF370000 = 0x255f;
56137  t.SF380000 = 0x255a;
56138  t.SF390000 = 0x2554;
56139  t.SF400000 = 0x2569;
56140  t.SF410000 = 0x2566;
56141  t.SF420000 = 0x2560;
56142  t.SF430000 = 0x2550;
56143  t.SF440000 = 0x256c;
56144  t.SF450000 = 0x2567;
56145  t.SF460000 = 0x2568;
56146  t.SF470000 = 0x2564;
56147  t.SF480000 = 0x2565;
56148  t.SF490000 = 0x2559;
56149  t.SF500000 = 0x2558;
56150  t.SF510000 = 0x2552;
56151  t.SF520000 = 0x2553;
56152  t.SF530000 = 0x256b;
56153  t.SF540000 = 0x256a;
56154  t.Sacute = 0x015a;
56155  t.Sacutedotaccent = 0x1e64;
56156  t.Sampigreek = 0x03e0;
56157  t.Scaron = 0x0160;
56158  t.Scarondotaccent = 0x1e66;
56159  t.Scaronsmall = 0xf6fd;
56160  t.Scedilla = 0x015e;
56161  t.Schwa = 0x018f;
56162  t.Schwacyrillic = 0x04d8;
56163  t.Schwadieresiscyrillic = 0x04da;
56164  t.Scircle = 0x24c8;
56165  t.Scircumflex = 0x015c;
56166  t.Scommaaccent = 0x0218;
56167  t.Sdotaccent = 0x1e60;
56168  t.Sdotbelow = 0x1e62;
56169  t.Sdotbelowdotaccent = 0x1e68;
56170  t.Seharmenian = 0x054d;
56171  t.Sevenroman = 0x2166;
56172  t.Shaarmenian = 0x0547;
56173  t.Shacyrillic = 0x0428;
56174  t.Shchacyrillic = 0x0429;
56175  t.Sheicoptic = 0x03e2;
56176  t.Shhacyrillic = 0x04ba;
56177  t.Shimacoptic = 0x03ec;
56178  t.Sigma = 0x03a3;
56179  t.Sixroman = 0x2165;
56180  t.Smonospace = 0xff33;
56181  t.Softsigncyrillic = 0x042c;
56182  t.Ssmall = 0xf773;
56183  t.Stigmagreek = 0x03da;
56184  t.T = 0x0054;
56185  t.Tau = 0x03a4;
56186  t.Tbar = 0x0166;
56187  t.Tcaron = 0x0164;
56188  t.Tcedilla = 0x0162;
56189  t.Tcircle = 0x24c9;
56190  t.Tcircumflexbelow = 0x1e70;
56191  t.Tcommaaccent = 0x0162;
56192  t.Tdotaccent = 0x1e6a;
56193  t.Tdotbelow = 0x1e6c;
56194  t.Tecyrillic = 0x0422;
56195  t.Tedescendercyrillic = 0x04ac;
56196  t.Tenroman = 0x2169;
56197  t.Tetsecyrillic = 0x04b4;
56198  t.Theta = 0x0398;
56199  t.Thook = 0x01ac;
56200  t.Thorn = 0x00de;
56201  t.Thornsmall = 0xf7fe;
56202  t.Threeroman = 0x2162;
56203  t.Tildesmall = 0xf6fe;
56204  t.Tiwnarmenian = 0x054f;
56205  t.Tlinebelow = 0x1e6e;
56206  t.Tmonospace = 0xff34;
56207  t.Toarmenian = 0x0539;
56208  t.Tonefive = 0x01bc;
56209  t.Tonesix = 0x0184;
56210  t.Tonetwo = 0x01a7;
56211  t.Tretroflexhook = 0x01ae;
56212  t.Tsecyrillic = 0x0426;
56213  t.Tshecyrillic = 0x040b;
56214  t.Tsmall = 0xf774;
56215  t.Twelveroman = 0x216b;
56216  t.Tworoman = 0x2161;
56217  t.U = 0x0055;
56218  t.Uacute = 0x00da;
56219  t.Uacutesmall = 0xf7fa;
56220  t.Ubreve = 0x016c;
56221  t.Ucaron = 0x01d3;
56222  t.Ucircle = 0x24ca;
56223  t.Ucircumflex = 0x00db;
56224  t.Ucircumflexbelow = 0x1e76;
56225  t.Ucircumflexsmall = 0xf7fb;
56226  t.Ucyrillic = 0x0423;
56227  t.Udblacute = 0x0170;
56228  t.Udblgrave = 0x0214;
56229  t.Udieresis = 0x00dc;
56230  t.Udieresisacute = 0x01d7;
56231  t.Udieresisbelow = 0x1e72;
56232  t.Udieresiscaron = 0x01d9;
56233  t.Udieresiscyrillic = 0x04f0;
56234  t.Udieresisgrave = 0x01db;
56235  t.Udieresismacron = 0x01d5;
56236  t.Udieresissmall = 0xf7fc;
56237  t.Udotbelow = 0x1ee4;
56238  t.Ugrave = 0x00d9;
56239  t.Ugravesmall = 0xf7f9;
56240  t.Uhookabove = 0x1ee6;
56241  t.Uhorn = 0x01af;
56242  t.Uhornacute = 0x1ee8;
56243  t.Uhorndotbelow = 0x1ef0;
56244  t.Uhorngrave = 0x1eea;
56245  t.Uhornhookabove = 0x1eec;
56246  t.Uhorntilde = 0x1eee;
56247  t.Uhungarumlaut = 0x0170;
56248  t.Uhungarumlautcyrillic = 0x04f2;
56249  t.Uinvertedbreve = 0x0216;
56250  t.Ukcyrillic = 0x0478;
56251  t.Umacron = 0x016a;
56252  t.Umacroncyrillic = 0x04ee;
56253  t.Umacrondieresis = 0x1e7a;
56254  t.Umonospace = 0xff35;
56255  t.Uogonek = 0x0172;
56256  t.Upsilon = 0x03a5;
56257  t.Upsilon1 = 0x03d2;
56258  t.Upsilonacutehooksymbolgreek = 0x03d3;
56259  t.Upsilonafrican = 0x01b1;
56260  t.Upsilondieresis = 0x03ab;
56261  t.Upsilondieresishooksymbolgreek = 0x03d4;
56262  t.Upsilonhooksymbol = 0x03d2;
56263  t.Upsilontonos = 0x038e;
56264  t.Uring = 0x016e;
56265  t.Ushortcyrillic = 0x040e;
56266  t.Usmall = 0xf775;
56267  t.Ustraightcyrillic = 0x04ae;
56268  t.Ustraightstrokecyrillic = 0x04b0;
56269  t.Utilde = 0x0168;
56270  t.Utildeacute = 0x1e78;
56271  t.Utildebelow = 0x1e74;
56272  t.V = 0x0056;
56273  t.Vcircle = 0x24cb;
56274  t.Vdotbelow = 0x1e7e;
56275  t.Vecyrillic = 0x0412;
56276  t.Vewarmenian = 0x054e;
56277  t.Vhook = 0x01b2;
56278  t.Vmonospace = 0xff36;
56279  t.Voarmenian = 0x0548;
56280  t.Vsmall = 0xf776;
56281  t.Vtilde = 0x1e7c;
56282  t.W = 0x0057;
56283  t.Wacute = 0x1e82;
56284  t.Wcircle = 0x24cc;
56285  t.Wcircumflex = 0x0174;
56286  t.Wdieresis = 0x1e84;
56287  t.Wdotaccent = 0x1e86;
56288  t.Wdotbelow = 0x1e88;
56289  t.Wgrave = 0x1e80;
56290  t.Wmonospace = 0xff37;
56291  t.Wsmall = 0xf777;
56292  t.X = 0x0058;
56293  t.Xcircle = 0x24cd;
56294  t.Xdieresis = 0x1e8c;
56295  t.Xdotaccent = 0x1e8a;
56296  t.Xeharmenian = 0x053d;
56297  t.Xi = 0x039e;
56298  t.Xmonospace = 0xff38;
56299  t.Xsmall = 0xf778;
56300  t.Y = 0x0059;
56301  t.Yacute = 0x00dd;
56302  t.Yacutesmall = 0xf7fd;
56303  t.Yatcyrillic = 0x0462;
56304  t.Ycircle = 0x24ce;
56305  t.Ycircumflex = 0x0176;
56306  t.Ydieresis = 0x0178;
56307  t.Ydieresissmall = 0xf7ff;
56308  t.Ydotaccent = 0x1e8e;
56309  t.Ydotbelow = 0x1ef4;
56310  t.Yericyrillic = 0x042b;
56311  t.Yerudieresiscyrillic = 0x04f8;
56312  t.Ygrave = 0x1ef2;
56313  t.Yhook = 0x01b3;
56314  t.Yhookabove = 0x1ef6;
56315  t.Yiarmenian = 0x0545;
56316  t.Yicyrillic = 0x0407;
56317  t.Yiwnarmenian = 0x0552;
56318  t.Ymonospace = 0xff39;
56319  t.Ysmall = 0xf779;
56320  t.Ytilde = 0x1ef8;
56321  t.Yusbigcyrillic = 0x046a;
56322  t.Yusbigiotifiedcyrillic = 0x046c;
56323  t.Yuslittlecyrillic = 0x0466;
56324  t.Yuslittleiotifiedcyrillic = 0x0468;
56325  t.Z = 0x005a;
56326  t.Zaarmenian = 0x0536;
56327  t.Zacute = 0x0179;
56328  t.Zcaron = 0x017d;
56329  t.Zcaronsmall = 0xf6ff;
56330  t.Zcircle = 0x24cf;
56331  t.Zcircumflex = 0x1e90;
56332  t.Zdot = 0x017b;
56333  t.Zdotaccent = 0x017b;
56334  t.Zdotbelow = 0x1e92;
56335  t.Zecyrillic = 0x0417;
56336  t.Zedescendercyrillic = 0x0498;
56337  t.Zedieresiscyrillic = 0x04de;
56338  t.Zeta = 0x0396;
56339  t.Zhearmenian = 0x053a;
56340  t.Zhebrevecyrillic = 0x04c1;
56341  t.Zhecyrillic = 0x0416;
56342  t.Zhedescendercyrillic = 0x0496;
56343  t.Zhedieresiscyrillic = 0x04dc;
56344  t.Zlinebelow = 0x1e94;
56345  t.Zmonospace = 0xff3a;
56346  t.Zsmall = 0xf77a;
56347  t.Zstroke = 0x01b5;
56348  t.a = 0x0061;
56349  t.aabengali = 0x0986;
56350  t.aacute = 0x00e1;
56351  t.aadeva = 0x0906;
56352  t.aagujarati = 0x0a86;
56353  t.aagurmukhi = 0x0a06;
56354  t.aamatragurmukhi = 0x0a3e;
56355  t.aarusquare = 0x3303;
56356  t.aavowelsignbengali = 0x09be;
56357  t.aavowelsigndeva = 0x093e;
56358  t.aavowelsigngujarati = 0x0abe;
56359  t.abbreviationmarkarmenian = 0x055f;
56360  t.abbreviationsigndeva = 0x0970;
56361  t.abengali = 0x0985;
56362  t.abopomofo = 0x311a;
56363  t.abreve = 0x0103;
56364  t.abreveacute = 0x1eaf;
56365  t.abrevecyrillic = 0x04d1;
56366  t.abrevedotbelow = 0x1eb7;
56367  t.abrevegrave = 0x1eb1;
56368  t.abrevehookabove = 0x1eb3;
56369  t.abrevetilde = 0x1eb5;
56370  t.acaron = 0x01ce;
56371  t.acircle = 0x24d0;
56372  t.acircumflex = 0x00e2;
56373  t.acircumflexacute = 0x1ea5;
56374  t.acircumflexdotbelow = 0x1ead;
56375  t.acircumflexgrave = 0x1ea7;
56376  t.acircumflexhookabove = 0x1ea9;
56377  t.acircumflextilde = 0x1eab;
56378  t.acute = 0x00b4;
56379  t.acutebelowcmb = 0x0317;
56380  t.acutecmb = 0x0301;
56381  t.acutecomb = 0x0301;
56382  t.acutedeva = 0x0954;
56383  t.acutelowmod = 0x02cf;
56384  t.acutetonecmb = 0x0341;
56385  t.acyrillic = 0x0430;
56386  t.adblgrave = 0x0201;
56387  t.addakgurmukhi = 0x0a71;
56388  t.adeva = 0x0905;
56389  t.adieresis = 0x00e4;
56390  t.adieresiscyrillic = 0x04d3;
56391  t.adieresismacron = 0x01df;
56392  t.adotbelow = 0x1ea1;
56393  t.adotmacron = 0x01e1;
56394  t.ae = 0x00e6;
56395  t.aeacute = 0x01fd;
56396  t.aekorean = 0x3150;
56397  t.aemacron = 0x01e3;
56398  t.afii00208 = 0x2015;
56399  t.afii08941 = 0x20a4;
56400  t.afii10017 = 0x0410;
56401  t.afii10018 = 0x0411;
56402  t.afii10019 = 0x0412;
56403  t.afii10020 = 0x0413;
56404  t.afii10021 = 0x0414;
56405  t.afii10022 = 0x0415;
56406  t.afii10023 = 0x0401;
56407  t.afii10024 = 0x0416;
56408  t.afii10025 = 0x0417;
56409  t.afii10026 = 0x0418;
56410  t.afii10027 = 0x0419;
56411  t.afii10028 = 0x041a;
56412  t.afii10029 = 0x041b;
56413  t.afii10030 = 0x041c;
56414  t.afii10031 = 0x041d;
56415  t.afii10032 = 0x041e;
56416  t.afii10033 = 0x041f;
56417  t.afii10034 = 0x0420;
56418  t.afii10035 = 0x0421;
56419  t.afii10036 = 0x0422;
56420  t.afii10037 = 0x0423;
56421  t.afii10038 = 0x0424;
56422  t.afii10039 = 0x0425;
56423  t.afii10040 = 0x0426;
56424  t.afii10041 = 0x0427;
56425  t.afii10042 = 0x0428;
56426  t.afii10043 = 0x0429;
56427  t.afii10044 = 0x042a;
56428  t.afii10045 = 0x042b;
56429  t.afii10046 = 0x042c;
56430  t.afii10047 = 0x042d;
56431  t.afii10048 = 0x042e;
56432  t.afii10049 = 0x042f;
56433  t.afii10050 = 0x0490;
56434  t.afii10051 = 0x0402;
56435  t.afii10052 = 0x0403;
56436  t.afii10053 = 0x0404;
56437  t.afii10054 = 0x0405;
56438  t.afii10055 = 0x0406;
56439  t.afii10056 = 0x0407;
56440  t.afii10057 = 0x0408;
56441  t.afii10058 = 0x0409;
56442  t.afii10059 = 0x040a;
56443  t.afii10060 = 0x040b;
56444  t.afii10061 = 0x040c;
56445  t.afii10062 = 0x040e;
56446  t.afii10063 = 0xf6c4;
56447  t.afii10064 = 0xf6c5;
56448  t.afii10065 = 0x0430;
56449  t.afii10066 = 0x0431;
56450  t.afii10067 = 0x0432;
56451  t.afii10068 = 0x0433;
56452  t.afii10069 = 0x0434;
56453  t.afii10070 = 0x0435;
56454  t.afii10071 = 0x0451;
56455  t.afii10072 = 0x0436;
56456  t.afii10073 = 0x0437;
56457  t.afii10074 = 0x0438;
56458  t.afii10075 = 0x0439;
56459  t.afii10076 = 0x043a;
56460  t.afii10077 = 0x043b;
56461  t.afii10078 = 0x043c;
56462  t.afii10079 = 0x043d;
56463  t.afii10080 = 0x043e;
56464  t.afii10081 = 0x043f;
56465  t.afii10082 = 0x0440;
56466  t.afii10083 = 0x0441;
56467  t.afii10084 = 0x0442;
56468  t.afii10085 = 0x0443;
56469  t.afii10086 = 0x0444;
56470  t.afii10087 = 0x0445;
56471  t.afii10088 = 0x0446;
56472  t.afii10089 = 0x0447;
56473  t.afii10090 = 0x0448;
56474  t.afii10091 = 0x0449;
56475  t.afii10092 = 0x044a;
56476  t.afii10093 = 0x044b;
56477  t.afii10094 = 0x044c;
56478  t.afii10095 = 0x044d;
56479  t.afii10096 = 0x044e;
56480  t.afii10097 = 0x044f;
56481  t.afii10098 = 0x0491;
56482  t.afii10099 = 0x0452;
56483  t.afii10100 = 0x0453;
56484  t.afii10101 = 0x0454;
56485  t.afii10102 = 0x0455;
56486  t.afii10103 = 0x0456;
56487  t.afii10104 = 0x0457;
56488  t.afii10105 = 0x0458;
56489  t.afii10106 = 0x0459;
56490  t.afii10107 = 0x045a;
56491  t.afii10108 = 0x045b;
56492  t.afii10109 = 0x045c;
56493  t.afii10110 = 0x045e;
56494  t.afii10145 = 0x040f;
56495  t.afii10146 = 0x0462;
56496  t.afii10147 = 0x0472;
56497  t.afii10148 = 0x0474;
56498  t.afii10192 = 0xf6c6;
56499  t.afii10193 = 0x045f;
56500  t.afii10194 = 0x0463;
56501  t.afii10195 = 0x0473;
56502  t.afii10196 = 0x0475;
56503  t.afii10831 = 0xf6c7;
56504  t.afii10832 = 0xf6c8;
56505  t.afii10846 = 0x04d9;
56506  t.afii299 = 0x200e;
56507  t.afii300 = 0x200f;
56508  t.afii301 = 0x200d;
56509  t.afii57381 = 0x066a;
56510  t.afii57388 = 0x060c;
56511  t.afii57392 = 0x0660;
56512  t.afii57393 = 0x0661;
56513  t.afii57394 = 0x0662;
56514  t.afii57395 = 0x0663;
56515  t.afii57396 = 0x0664;
56516  t.afii57397 = 0x0665;
56517  t.afii57398 = 0x0666;
56518  t.afii57399 = 0x0667;
56519  t.afii57400 = 0x0668;
56520  t.afii57401 = 0x0669;
56521  t.afii57403 = 0x061b;
56522  t.afii57407 = 0x061f;
56523  t.afii57409 = 0x0621;
56524  t.afii57410 = 0x0622;
56525  t.afii57411 = 0x0623;
56526  t.afii57412 = 0x0624;
56527  t.afii57413 = 0x0625;
56528  t.afii57414 = 0x0626;
56529  t.afii57415 = 0x0627;
56530  t.afii57416 = 0x0628;
56531  t.afii57417 = 0x0629;
56532  t.afii57418 = 0x062a;
56533  t.afii57419 = 0x062b;
56534  t.afii57420 = 0x062c;
56535  t.afii57421 = 0x062d;
56536  t.afii57422 = 0x062e;
56537  t.afii57423 = 0x062f;
56538  t.afii57424 = 0x0630;
56539  t.afii57425 = 0x0631;
56540  t.afii57426 = 0x0632;
56541  t.afii57427 = 0x0633;
56542  t.afii57428 = 0x0634;
56543  t.afii57429 = 0x0635;
56544  t.afii57430 = 0x0636;
56545  t.afii57431 = 0x0637;
56546  t.afii57432 = 0x0638;
56547  t.afii57433 = 0x0639;
56548  t.afii57434 = 0x063a;
56549  t.afii57440 = 0x0640;
56550  t.afii57441 = 0x0641;
56551  t.afii57442 = 0x0642;
56552  t.afii57443 = 0x0643;
56553  t.afii57444 = 0x0644;
56554  t.afii57445 = 0x0645;
56555  t.afii57446 = 0x0646;
56556  t.afii57448 = 0x0648;
56557  t.afii57449 = 0x0649;
56558  t.afii57450 = 0x064a;
56559  t.afii57451 = 0x064b;
56560  t.afii57452 = 0x064c;
56561  t.afii57453 = 0x064d;
56562  t.afii57454 = 0x064e;
56563  t.afii57455 = 0x064f;
56564  t.afii57456 = 0x0650;
56565  t.afii57457 = 0x0651;
56566  t.afii57458 = 0x0652;
56567  t.afii57470 = 0x0647;
56568  t.afii57505 = 0x06a4;
56569  t.afii57506 = 0x067e;
56570  t.afii57507 = 0x0686;
56571  t.afii57508 = 0x0698;
56572  t.afii57509 = 0x06af;
56573  t.afii57511 = 0x0679;
56574  t.afii57512 = 0x0688;
56575  t.afii57513 = 0x0691;
56576  t.afii57514 = 0x06ba;
56577  t.afii57519 = 0x06d2;
56578  t.afii57534 = 0x06d5;
56579  t.afii57636 = 0x20aa;
56580  t.afii57645 = 0x05be;
56581  t.afii57658 = 0x05c3;
56582  t.afii57664 = 0x05d0;
56583  t.afii57665 = 0x05d1;
56584  t.afii57666 = 0x05d2;
56585  t.afii57667 = 0x05d3;
56586  t.afii57668 = 0x05d4;
56587  t.afii57669 = 0x05d5;
56588  t.afii57670 = 0x05d6;
56589  t.afii57671 = 0x05d7;
56590  t.afii57672 = 0x05d8;
56591  t.afii57673 = 0x05d9;
56592  t.afii57674 = 0x05da;
56593  t.afii57675 = 0x05db;
56594  t.afii57676 = 0x05dc;
56595  t.afii57677 = 0x05dd;
56596  t.afii57678 = 0x05de;
56597  t.afii57679 = 0x05df;
56598  t.afii57680 = 0x05e0;
56599  t.afii57681 = 0x05e1;
56600  t.afii57682 = 0x05e2;
56601  t.afii57683 = 0x05e3;
56602  t.afii57684 = 0x05e4;
56603  t.afii57685 = 0x05e5;
56604  t.afii57686 = 0x05e6;
56605  t.afii57687 = 0x05e7;
56606  t.afii57688 = 0x05e8;
56607  t.afii57689 = 0x05e9;
56608  t.afii57690 = 0x05ea;
56609  t.afii57694 = 0xfb2a;
56610  t.afii57695 = 0xfb2b;
56611  t.afii57700 = 0xfb4b;
56612  t.afii57705 = 0xfb1f;
56613  t.afii57716 = 0x05f0;
56614  t.afii57717 = 0x05f1;
56615  t.afii57718 = 0x05f2;
56616  t.afii57723 = 0xfb35;
56617  t.afii57793 = 0x05b4;
56618  t.afii57794 = 0x05b5;
56619  t.afii57795 = 0x05b6;
56620  t.afii57796 = 0x05bb;
56621  t.afii57797 = 0x05b8;
56622  t.afii57798 = 0x05b7;
56623  t.afii57799 = 0x05b0;
56624  t.afii57800 = 0x05b2;
56625  t.afii57801 = 0x05b1;
56626  t.afii57802 = 0x05b3;
56627  t.afii57803 = 0x05c2;
56628  t.afii57804 = 0x05c1;
56629  t.afii57806 = 0x05b9;
56630  t.afii57807 = 0x05bc;
56631  t.afii57839 = 0x05bd;
56632  t.afii57841 = 0x05bf;
56633  t.afii57842 = 0x05c0;
56634  t.afii57929 = 0x02bc;
56635  t.afii61248 = 0x2105;
56636  t.afii61289 = 0x2113;
56637  t.afii61352 = 0x2116;
56638  t.afii61573 = 0x202c;
56639  t.afii61574 = 0x202d;
56640  t.afii61575 = 0x202e;
56641  t.afii61664 = 0x200c;
56642  t.afii63167 = 0x066d;
56643  t.afii64937 = 0x02bd;
56644  t.agrave = 0x00e0;
56645  t.agujarati = 0x0a85;
56646  t.agurmukhi = 0x0a05;
56647  t.ahiragana = 0x3042;
56648  t.ahookabove = 0x1ea3;
56649  t.aibengali = 0x0990;
56650  t.aibopomofo = 0x311e;
56651  t.aideva = 0x0910;
56652  t.aiecyrillic = 0x04d5;
56653  t.aigujarati = 0x0a90;
56654  t.aigurmukhi = 0x0a10;
56655  t.aimatragurmukhi = 0x0a48;
56656  t.ainarabic = 0x0639;
56657  t.ainfinalarabic = 0xfeca;
56658  t.aininitialarabic = 0xfecb;
56659  t.ainmedialarabic = 0xfecc;
56660  t.ainvertedbreve = 0x0203;
56661  t.aivowelsignbengali = 0x09c8;
56662  t.aivowelsigndeva = 0x0948;
56663  t.aivowelsigngujarati = 0x0ac8;
56664  t.akatakana = 0x30a2;
56665  t.akatakanahalfwidth = 0xff71;
56666  t.akorean = 0x314f;
56667  t.alef = 0x05d0;
56668  t.alefarabic = 0x0627;
56669  t.alefdageshhebrew = 0xfb30;
56670  t.aleffinalarabic = 0xfe8e;
56671  t.alefhamzaabovearabic = 0x0623;
56672  t.alefhamzaabovefinalarabic = 0xfe84;
56673  t.alefhamzabelowarabic = 0x0625;
56674  t.alefhamzabelowfinalarabic = 0xfe88;
56675  t.alefhebrew = 0x05d0;
56676  t.aleflamedhebrew = 0xfb4f;
56677  t.alefmaddaabovearabic = 0x0622;
56678  t.alefmaddaabovefinalarabic = 0xfe82;
56679  t.alefmaksuraarabic = 0x0649;
56680  t.alefmaksurafinalarabic = 0xfef0;
56681  t.alefmaksurainitialarabic = 0xfef3;
56682  t.alefmaksuramedialarabic = 0xfef4;
56683  t.alefpatahhebrew = 0xfb2e;
56684  t.alefqamatshebrew = 0xfb2f;
56685  t.aleph = 0x2135;
56686  t.allequal = 0x224c;
56687  t.alpha = 0x03b1;
56688  t.alphatonos = 0x03ac;
56689  t.amacron = 0x0101;
56690  t.amonospace = 0xff41;
56691  t.ampersand = 0x0026;
56692  t.ampersandmonospace = 0xff06;
56693  t.ampersandsmall = 0xf726;
56694  t.amsquare = 0x33c2;
56695  t.anbopomofo = 0x3122;
56696  t.angbopomofo = 0x3124;
56697  t.angbracketleft = 0x3008;
56698  t.angbracketright = 0x3009;
56699  t.angkhankhuthai = 0x0e5a;
56700  t.angle = 0x2220;
56701  t.anglebracketleft = 0x3008;
56702  t.anglebracketleftvertical = 0xfe3f;
56703  t.anglebracketright = 0x3009;
56704  t.anglebracketrightvertical = 0xfe40;
56705  t.angleleft = 0x2329;
56706  t.angleright = 0x232a;
56707  t.angstrom = 0x212b;
56708  t.anoteleia = 0x0387;
56709  t.anudattadeva = 0x0952;
56710  t.anusvarabengali = 0x0982;
56711  t.anusvaradeva = 0x0902;
56712  t.anusvaragujarati = 0x0a82;
56713  t.aogonek = 0x0105;
56714  t.apaatosquare = 0x3300;
56715  t.aparen = 0x249c;
56716  t.apostrophearmenian = 0x055a;
56717  t.apostrophemod = 0x02bc;
56718  t.apple = 0xf8ff;
56719  t.approaches = 0x2250;
56720  t.approxequal = 0x2248;
56721  t.approxequalorimage = 0x2252;
56722  t.approximatelyequal = 0x2245;
56723  t.araeaekorean = 0x318e;
56724  t.araeakorean = 0x318d;
56725  t.arc = 0x2312;
56726  t.arighthalfring = 0x1e9a;
56727  t.aring = 0x00e5;
56728  t.aringacute = 0x01fb;
56729  t.aringbelow = 0x1e01;
56730  t.arrowboth = 0x2194;
56731  t.arrowdashdown = 0x21e3;
56732  t.arrowdashleft = 0x21e0;
56733  t.arrowdashright = 0x21e2;
56734  t.arrowdashup = 0x21e1;
56735  t.arrowdblboth = 0x21d4;
56736  t.arrowdbldown = 0x21d3;
56737  t.arrowdblleft = 0x21d0;
56738  t.arrowdblright = 0x21d2;
56739  t.arrowdblup = 0x21d1;
56740  t.arrowdown = 0x2193;
56741  t.arrowdownleft = 0x2199;
56742  t.arrowdownright = 0x2198;
56743  t.arrowdownwhite = 0x21e9;
56744  t.arrowheaddownmod = 0x02c5;
56745  t.arrowheadleftmod = 0x02c2;
56746  t.arrowheadrightmod = 0x02c3;
56747  t.arrowheadupmod = 0x02c4;
56748  t.arrowhorizex = 0xf8e7;
56749  t.arrowleft = 0x2190;
56750  t.arrowleftdbl = 0x21d0;
56751  t.arrowleftdblstroke = 0x21cd;
56752  t.arrowleftoverright = 0x21c6;
56753  t.arrowleftwhite = 0x21e6;
56754  t.arrowright = 0x2192;
56755  t.arrowrightdblstroke = 0x21cf;
56756  t.arrowrightheavy = 0x279e;
56757  t.arrowrightoverleft = 0x21c4;
56758  t.arrowrightwhite = 0x21e8;
56759  t.arrowtableft = 0x21e4;
56760  t.arrowtabright = 0x21e5;
56761  t.arrowup = 0x2191;
56762  t.arrowupdn = 0x2195;
56763  t.arrowupdnbse = 0x21a8;
56764  t.arrowupdownbase = 0x21a8;
56765  t.arrowupleft = 0x2196;
56766  t.arrowupleftofdown = 0x21c5;
56767  t.arrowupright = 0x2197;
56768  t.arrowupwhite = 0x21e7;
56769  t.arrowvertex = 0xf8e6;
56770  t.asciicircum = 0x005e;
56771  t.asciicircummonospace = 0xff3e;
56772  t.asciitilde = 0x007e;
56773  t.asciitildemonospace = 0xff5e;
56774  t.ascript = 0x0251;
56775  t.ascriptturned = 0x0252;
56776  t.asmallhiragana = 0x3041;
56777  t.asmallkatakana = 0x30a1;
56778  t.asmallkatakanahalfwidth = 0xff67;
56779  t.asterisk = 0x002a;
56780  t.asteriskaltonearabic = 0x066d;
56781  t.asteriskarabic = 0x066d;
56782  t.asteriskmath = 0x2217;
56783  t.asteriskmonospace = 0xff0a;
56784  t.asterisksmall = 0xfe61;
56785  t.asterism = 0x2042;
56786  t.asuperior = 0xf6e9;
56787  t.asymptoticallyequal = 0x2243;
56788  t.at = 0x0040;
56789  t.atilde = 0x00e3;
56790  t.atmonospace = 0xff20;
56791  t.atsmall = 0xfe6b;
56792  t.aturned = 0x0250;
56793  t.aubengali = 0x0994;
56794  t.aubopomofo = 0x3120;
56795  t.audeva = 0x0914;
56796  t.augujarati = 0x0a94;
56797  t.augurmukhi = 0x0a14;
56798  t.aulengthmarkbengali = 0x09d7;
56799  t.aumatragurmukhi = 0x0a4c;
56800  t.auvowelsignbengali = 0x09cc;
56801  t.auvowelsigndeva = 0x094c;
56802  t.auvowelsigngujarati = 0x0acc;
56803  t.avagrahadeva = 0x093d;
56804  t.aybarmenian = 0x0561;
56805  t.ayin = 0x05e2;
56806  t.ayinaltonehebrew = 0xfb20;
56807  t.ayinhebrew = 0x05e2;
56808  t.b = 0x0062;
56809  t.babengali = 0x09ac;
56810  t.backslash = 0x005c;
56811  t.backslashmonospace = 0xff3c;
56812  t.badeva = 0x092c;
56813  t.bagujarati = 0x0aac;
56814  t.bagurmukhi = 0x0a2c;
56815  t.bahiragana = 0x3070;
56816  t.bahtthai = 0x0e3f;
56817  t.bakatakana = 0x30d0;
56818  t.bar = 0x007c;
56819  t.barmonospace = 0xff5c;
56820  t.bbopomofo = 0x3105;
56821  t.bcircle = 0x24d1;
56822  t.bdotaccent = 0x1e03;
56823  t.bdotbelow = 0x1e05;
56824  t.beamedsixteenthnotes = 0x266c;
56825  t.because = 0x2235;
56826  t.becyrillic = 0x0431;
56827  t.beharabic = 0x0628;
56828  t.behfinalarabic = 0xfe90;
56829  t.behinitialarabic = 0xfe91;
56830  t.behiragana = 0x3079;
56831  t.behmedialarabic = 0xfe92;
56832  t.behmeeminitialarabic = 0xfc9f;
56833  t.behmeemisolatedarabic = 0xfc08;
56834  t.behnoonfinalarabic = 0xfc6d;
56835  t.bekatakana = 0x30d9;
56836  t.benarmenian = 0x0562;
56837  t.bet = 0x05d1;
56838  t.beta = 0x03b2;
56839  t.betasymbolgreek = 0x03d0;
56840  t.betdagesh = 0xfb31;
56841  t.betdageshhebrew = 0xfb31;
56842  t.bethebrew = 0x05d1;
56843  t.betrafehebrew = 0xfb4c;
56844  t.bhabengali = 0x09ad;
56845  t.bhadeva = 0x092d;
56846  t.bhagujarati = 0x0aad;
56847  t.bhagurmukhi = 0x0a2d;
56848  t.bhook = 0x0253;
56849  t.bihiragana = 0x3073;
56850  t.bikatakana = 0x30d3;
56851  t.bilabialclick = 0x0298;
56852  t.bindigurmukhi = 0x0a02;
56853  t.birusquare = 0x3331;
56854  t.blackcircle = 0x25cf;
56855  t.blackdiamond = 0x25c6;
56856  t.blackdownpointingtriangle = 0x25bc;
56857  t.blackleftpointingpointer = 0x25c4;
56858  t.blackleftpointingtriangle = 0x25c0;
56859  t.blacklenticularbracketleft = 0x3010;
56860  t.blacklenticularbracketleftvertical = 0xfe3b;
56861  t.blacklenticularbracketright = 0x3011;
56862  t.blacklenticularbracketrightvertical = 0xfe3c;
56863  t.blacklowerlefttriangle = 0x25e3;
56864  t.blacklowerrighttriangle = 0x25e2;
56865  t.blackrectangle = 0x25ac;
56866  t.blackrightpointingpointer = 0x25ba;
56867  t.blackrightpointingtriangle = 0x25b6;
56868  t.blacksmallsquare = 0x25aa;
56869  t.blacksmilingface = 0x263b;
56870  t.blacksquare = 0x25a0;
56871  t.blackstar = 0x2605;
56872  t.blackupperlefttriangle = 0x25e4;
56873  t.blackupperrighttriangle = 0x25e5;
56874  t.blackuppointingsmalltriangle = 0x25b4;
56875  t.blackuppointingtriangle = 0x25b2;
56876  t.blank = 0x2423;
56877  t.blinebelow = 0x1e07;
56878  t.block = 0x2588;
56879  t.bmonospace = 0xff42;
56880  t.bobaimaithai = 0x0e1a;
56881  t.bohiragana = 0x307c;
56882  t.bokatakana = 0x30dc;
56883  t.bparen = 0x249d;
56884  t.bqsquare = 0x33c3;
56885  t.braceex = 0xf8f4;
56886  t.braceleft = 0x007b;
56887  t.braceleftbt = 0xf8f3;
56888  t.braceleftmid = 0xf8f2;
56889  t.braceleftmonospace = 0xff5b;
56890  t.braceleftsmall = 0xfe5b;
56891  t.bracelefttp = 0xf8f1;
56892  t.braceleftvertical = 0xfe37;
56893  t.braceright = 0x007d;
56894  t.bracerightbt = 0xf8fe;
56895  t.bracerightmid = 0xf8fd;
56896  t.bracerightmonospace = 0xff5d;
56897  t.bracerightsmall = 0xfe5c;
56898  t.bracerighttp = 0xf8fc;
56899  t.bracerightvertical = 0xfe38;
56900  t.bracketleft = 0x005b;
56901  t.bracketleftbt = 0xf8f0;
56902  t.bracketleftex = 0xf8ef;
56903  t.bracketleftmonospace = 0xff3b;
56904  t.bracketlefttp = 0xf8ee;
56905  t.bracketright = 0x005d;
56906  t.bracketrightbt = 0xf8fb;
56907  t.bracketrightex = 0xf8fa;
56908  t.bracketrightmonospace = 0xff3d;
56909  t.bracketrighttp = 0xf8f9;
56910  t.breve = 0x02d8;
56911  t.brevebelowcmb = 0x032e;
56912  t.brevecmb = 0x0306;
56913  t.breveinvertedbelowcmb = 0x032f;
56914  t.breveinvertedcmb = 0x0311;
56915  t.breveinverteddoublecmb = 0x0361;
56916  t.bridgebelowcmb = 0x032a;
56917  t.bridgeinvertedbelowcmb = 0x033a;
56918  t.brokenbar = 0x00a6;
56919  t.bstroke = 0x0180;
56920  t.bsuperior = 0xf6ea;
56921  t.btopbar = 0x0183;
56922  t.buhiragana = 0x3076;
56923  t.bukatakana = 0x30d6;
56924  t.bullet = 0x2022;
56925  t.bulletinverse = 0x25d8;
56926  t.bulletoperator = 0x2219;
56927  t.bullseye = 0x25ce;
56928  t.c = 0x0063;
56929  t.caarmenian = 0x056e;
56930  t.cabengali = 0x099a;
56931  t.cacute = 0x0107;
56932  t.cadeva = 0x091a;
56933  t.cagujarati = 0x0a9a;
56934  t.cagurmukhi = 0x0a1a;
56935  t.calsquare = 0x3388;
56936  t.candrabindubengali = 0x0981;
56937  t.candrabinducmb = 0x0310;
56938  t.candrabindudeva = 0x0901;
56939  t.candrabindugujarati = 0x0a81;
56940  t.capslock = 0x21ea;
56941  t.careof = 0x2105;
56942  t.caron = 0x02c7;
56943  t.caronbelowcmb = 0x032c;
56944  t.caroncmb = 0x030c;
56945  t.carriagereturn = 0x21b5;
56946  t.cbopomofo = 0x3118;
56947  t.ccaron = 0x010d;
56948  t.ccedilla = 0x00e7;
56949  t.ccedillaacute = 0x1e09;
56950  t.ccircle = 0x24d2;
56951  t.ccircumflex = 0x0109;
56952  t.ccurl = 0x0255;
56953  t.cdot = 0x010b;
56954  t.cdotaccent = 0x010b;
56955  t.cdsquare = 0x33c5;
56956  t.cedilla = 0x00b8;
56957  t.cedillacmb = 0x0327;
56958  t.cent = 0x00a2;
56959  t.centigrade = 0x2103;
56960  t.centinferior = 0xf6df;
56961  t.centmonospace = 0xffe0;
56962  t.centoldstyle = 0xf7a2;
56963  t.centsuperior = 0xf6e0;
56964  t.chaarmenian = 0x0579;
56965  t.chabengali = 0x099b;
56966  t.chadeva = 0x091b;
56967  t.chagujarati = 0x0a9b;
56968  t.chagurmukhi = 0x0a1b;
56969  t.chbopomofo = 0x3114;
56970  t.cheabkhasiancyrillic = 0x04bd;
56971  t.checkmark = 0x2713;
56972  t.checyrillic = 0x0447;
56973  t.chedescenderabkhasiancyrillic = 0x04bf;
56974  t.chedescendercyrillic = 0x04b7;
56975  t.chedieresiscyrillic = 0x04f5;
56976  t.cheharmenian = 0x0573;
56977  t.chekhakassiancyrillic = 0x04cc;
56978  t.cheverticalstrokecyrillic = 0x04b9;
56979  t.chi = 0x03c7;
56980  t.chieuchacirclekorean = 0x3277;
56981  t.chieuchaparenkorean = 0x3217;
56982  t.chieuchcirclekorean = 0x3269;
56983  t.chieuchkorean = 0x314a;
56984  t.chieuchparenkorean = 0x3209;
56985  t.chochangthai = 0x0e0a;
56986  t.chochanthai = 0x0e08;
56987  t.chochingthai = 0x0e09;
56988  t.chochoethai = 0x0e0c;
56989  t.chook = 0x0188;
56990  t.cieucacirclekorean = 0x3276;
56991  t.cieucaparenkorean = 0x3216;
56992  t.cieuccirclekorean = 0x3268;
56993  t.cieuckorean = 0x3148;
56994  t.cieucparenkorean = 0x3208;
56995  t.cieucuparenkorean = 0x321c;
56996  t.circle = 0x25cb;
56997  t.circlecopyrt = 0x00a9;
56998  t.circlemultiply = 0x2297;
56999  t.circleot = 0x2299;
57000  t.circleplus = 0x2295;
57001  t.circlepostalmark = 0x3036;
57002  t.circlewithlefthalfblack = 0x25d0;
57003  t.circlewithrighthalfblack = 0x25d1;
57004  t.circumflex = 0x02c6;
57005  t.circumflexbelowcmb = 0x032d;
57006  t.circumflexcmb = 0x0302;
57007  t.clear = 0x2327;
57008  t.clickalveolar = 0x01c2;
57009  t.clickdental = 0x01c0;
57010  t.clicklateral = 0x01c1;
57011  t.clickretroflex = 0x01c3;
57012  t.club = 0x2663;
57013  t.clubsuitblack = 0x2663;
57014  t.clubsuitwhite = 0x2667;
57015  t.cmcubedsquare = 0x33a4;
57016  t.cmonospace = 0xff43;
57017  t.cmsquaredsquare = 0x33a0;
57018  t.coarmenian = 0x0581;
57019  t.colon = 0x003a;
57020  t.colonmonetary = 0x20a1;
57021  t.colonmonospace = 0xff1a;
57022  t.colonsign = 0x20a1;
57023  t.colonsmall = 0xfe55;
57024  t.colontriangularhalfmod = 0x02d1;
57025  t.colontriangularmod = 0x02d0;
57026  t.comma = 0x002c;
57027  t.commaabovecmb = 0x0313;
57028  t.commaaboverightcmb = 0x0315;
57029  t.commaaccent = 0xf6c3;
57030  t.commaarabic = 0x060c;
57031  t.commaarmenian = 0x055d;
57032  t.commainferior = 0xf6e1;
57033  t.commamonospace = 0xff0c;
57034  t.commareversedabovecmb = 0x0314;
57035  t.commareversedmod = 0x02bd;
57036  t.commasmall = 0xfe50;
57037  t.commasuperior = 0xf6e2;
57038  t.commaturnedabovecmb = 0x0312;
57039  t.commaturnedmod = 0x02bb;
57040  t.compass = 0x263c;
57041  t.congruent = 0x2245;
57042  t.contourintegral = 0x222e;
57043  t.control = 0x2303;
57044  t.controlACK = 0x0006;
57045  t.controlBEL = 0x0007;
57046  t.controlBS = 0x0008;
57047  t.controlCAN = 0x0018;
57048  t.controlCR = 0x000d;
57049  t.controlDC1 = 0x0011;
57050  t.controlDC2 = 0x0012;
57051  t.controlDC3 = 0x0013;
57052  t.controlDC4 = 0x0014;
57053  t.controlDEL = 0x007f;
57054  t.controlDLE = 0x0010;
57055  t.controlEM = 0x0019;
57056  t.controlENQ = 0x0005;
57057  t.controlEOT = 0x0004;
57058  t.controlESC = 0x001b;
57059  t.controlETB = 0x0017;
57060  t.controlETX = 0x0003;
57061  t.controlFF = 0x000c;
57062  t.controlFS = 0x001c;
57063  t.controlGS = 0x001d;
57064  t.controlHT = 0x0009;
57065  t.controlLF = 0x000a;
57066  t.controlNAK = 0x0015;
57067  t.controlNULL = 0x0000;
57068  t.controlRS = 0x001e;
57069  t.controlSI = 0x000f;
57070  t.controlSO = 0x000e;
57071  t.controlSOT = 0x0002;
57072  t.controlSTX = 0x0001;
57073  t.controlSUB = 0x001a;
57074  t.controlSYN = 0x0016;
57075  t.controlUS = 0x001f;
57076  t.controlVT = 0x000b;
57077  t.copyright = 0x00a9;
57078  t.copyrightsans = 0xf8e9;
57079  t.copyrightserif = 0xf6d9;
57080  t.cornerbracketleft = 0x300c;
57081  t.cornerbracketlefthalfwidth = 0xff62;
57082  t.cornerbracketleftvertical = 0xfe41;
57083  t.cornerbracketright = 0x300d;
57084  t.cornerbracketrighthalfwidth = 0xff63;
57085  t.cornerbracketrightvertical = 0xfe42;
57086  t.corporationsquare = 0x337f;
57087  t.cosquare = 0x33c7;
57088  t.coverkgsquare = 0x33c6;
57089  t.cparen = 0x249e;
57090  t.cruzeiro = 0x20a2;
57091  t.cstretched = 0x0297;
57092  t.curlyand = 0x22cf;
57093  t.curlyor = 0x22ce;
57094  t.currency = 0x00a4;
57095  t.cyrBreve = 0xf6d1;
57096  t.cyrFlex = 0xf6d2;
57097  t.cyrbreve = 0xf6d4;
57098  t.cyrflex = 0xf6d5;
57099  t.d = 0x0064;
57100  t.daarmenian = 0x0564;
57101  t.dabengali = 0x09a6;
57102  t.dadarabic = 0x0636;
57103  t.dadeva = 0x0926;
57104  t.dadfinalarabic = 0xfebe;
57105  t.dadinitialarabic = 0xfebf;
57106  t.dadmedialarabic = 0xfec0;
57107  t.dagesh = 0x05bc;
57108  t.dageshhebrew = 0x05bc;
57109  t.dagger = 0x2020;
57110  t.daggerdbl = 0x2021;
57111  t.dagujarati = 0x0aa6;
57112  t.dagurmukhi = 0x0a26;
57113  t.dahiragana = 0x3060;
57114  t.dakatakana = 0x30c0;
57115  t.dalarabic = 0x062f;
57116  t.dalet = 0x05d3;
57117  t.daletdagesh = 0xfb33;
57118  t.daletdageshhebrew = 0xfb33;
57119  t.dalethebrew = 0x05d3;
57120  t.dalfinalarabic = 0xfeaa;
57121  t.dammaarabic = 0x064f;
57122  t.dammalowarabic = 0x064f;
57123  t.dammatanaltonearabic = 0x064c;
57124  t.dammatanarabic = 0x064c;
57125  t.danda = 0x0964;
57126  t.dargahebrew = 0x05a7;
57127  t.dargalefthebrew = 0x05a7;
57128  t.dasiapneumatacyrilliccmb = 0x0485;
57129  t.dblGrave = 0xf6d3;
57130  t.dblanglebracketleft = 0x300a;
57131  t.dblanglebracketleftvertical = 0xfe3d;
57132  t.dblanglebracketright = 0x300b;
57133  t.dblanglebracketrightvertical = 0xfe3e;
57134  t.dblarchinvertedbelowcmb = 0x032b;
57135  t.dblarrowleft = 0x21d4;
57136  t.dblarrowright = 0x21d2;
57137  t.dbldanda = 0x0965;
57138  t.dblgrave = 0xf6d6;
57139  t.dblgravecmb = 0x030f;
57140  t.dblintegral = 0x222c;
57141  t.dbllowline = 0x2017;
57142  t.dbllowlinecmb = 0x0333;
57143  t.dbloverlinecmb = 0x033f;
57144  t.dblprimemod = 0x02ba;
57145  t.dblverticalbar = 0x2016;
57146  t.dblverticallineabovecmb = 0x030e;
57147  t.dbopomofo = 0x3109;
57148  t.dbsquare = 0x33c8;
57149  t.dcaron = 0x010f;
57150  t.dcedilla = 0x1e11;
57151  t.dcircle = 0x24d3;
57152  t.dcircumflexbelow = 0x1e13;
57153  t.dcroat = 0x0111;
57154  t.ddabengali = 0x09a1;
57155  t.ddadeva = 0x0921;
57156  t.ddagujarati = 0x0aa1;
57157  t.ddagurmukhi = 0x0a21;
57158  t.ddalarabic = 0x0688;
57159  t.ddalfinalarabic = 0xfb89;
57160  t.dddhadeva = 0x095c;
57161  t.ddhabengali = 0x09a2;
57162  t.ddhadeva = 0x0922;
57163  t.ddhagujarati = 0x0aa2;
57164  t.ddhagurmukhi = 0x0a22;
57165  t.ddotaccent = 0x1e0b;
57166  t.ddotbelow = 0x1e0d;
57167  t.decimalseparatorarabic = 0x066b;
57168  t.decimalseparatorpersian = 0x066b;
57169  t.decyrillic = 0x0434;
57170  t.degree = 0x00b0;
57171  t.dehihebrew = 0x05ad;
57172  t.dehiragana = 0x3067;
57173  t.deicoptic = 0x03ef;
57174  t.dekatakana = 0x30c7;
57175  t.deleteleft = 0x232b;
57176  t.deleteright = 0x2326;
57177  t.delta = 0x03b4;
57178  t.deltaturned = 0x018d;
57179  t.denominatorminusonenumeratorbengali = 0x09f8;
57180  t.dezh = 0x02a4;
57181  t.dhabengali = 0x09a7;
57182  t.dhadeva = 0x0927;
57183  t.dhagujarati = 0x0aa7;
57184  t.dhagurmukhi = 0x0a27;
57185  t.dhook = 0x0257;
57186  t.dialytikatonos = 0x0385;
57187  t.dialytikatonoscmb = 0x0344;
57188  t.diamond = 0x2666;
57189  t.diamondsuitwhite = 0x2662;
57190  t.dieresis = 0x00a8;
57191  t.dieresisacute = 0xf6d7;
57192  t.dieresisbelowcmb = 0x0324;
57193  t.dieresiscmb = 0x0308;
57194  t.dieresisgrave = 0xf6d8;
57195  t.dieresistonos = 0x0385;
57196  t.dihiragana = 0x3062;
57197  t.dikatakana = 0x30c2;
57198  t.dittomark = 0x3003;
57199  t.divide = 0x00f7;
57200  t.divides = 0x2223;
57201  t.divisionslash = 0x2215;
57202  t.djecyrillic = 0x0452;
57203  t.dkshade = 0x2593;
57204  t.dlinebelow = 0x1e0f;
57205  t.dlsquare = 0x3397;
57206  t.dmacron = 0x0111;
57207  t.dmonospace = 0xff44;
57208  t.dnblock = 0x2584;
57209  t.dochadathai = 0x0e0e;
57210  t.dodekthai = 0x0e14;
57211  t.dohiragana = 0x3069;
57212  t.dokatakana = 0x30c9;
57213  t.dollar = 0x0024;
57214  t.dollarinferior = 0xf6e3;
57215  t.dollarmonospace = 0xff04;
57216  t.dollaroldstyle = 0xf724;
57217  t.dollarsmall = 0xfe69;
57218  t.dollarsuperior = 0xf6e4;
57219  t.dong = 0x20ab;
57220  t.dorusquare = 0x3326;
57221  t.dotaccent = 0x02d9;
57222  t.dotaccentcmb = 0x0307;
57223  t.dotbelowcmb = 0x0323;
57224  t.dotbelowcomb = 0x0323;
57225  t.dotkatakana = 0x30fb;
57226  t.dotlessi = 0x0131;
57227  t.dotlessj = 0xf6be;
57228  t.dotlessjstrokehook = 0x0284;
57229  t.dotmath = 0x22c5;
57230  t.dottedcircle = 0x25cc;
57231  t.doubleyodpatah = 0xfb1f;
57232  t.doubleyodpatahhebrew = 0xfb1f;
57233  t.downtackbelowcmb = 0x031e;
57234  t.downtackmod = 0x02d5;
57235  t.dparen = 0x249f;
57236  t.dsuperior = 0xf6eb;
57237  t.dtail = 0x0256;
57238  t.dtopbar = 0x018c;
57239  t.duhiragana = 0x3065;
57240  t.dukatakana = 0x30c5;
57241  t.dz = 0x01f3;
57242  t.dzaltone = 0x02a3;
57243  t.dzcaron = 0x01c6;
57244  t.dzcurl = 0x02a5;
57245  t.dzeabkhasiancyrillic = 0x04e1;
57246  t.dzecyrillic = 0x0455;
57247  t.dzhecyrillic = 0x045f;
57248  t.e = 0x0065;
57249  t.eacute = 0x00e9;
57250  t.earth = 0x2641;
57251  t.ebengali = 0x098f;
57252  t.ebopomofo = 0x311c;
57253  t.ebreve = 0x0115;
57254  t.ecandradeva = 0x090d;
57255  t.ecandragujarati = 0x0a8d;
57256  t.ecandravowelsigndeva = 0x0945;
57257  t.ecandravowelsigngujarati = 0x0ac5;
57258  t.ecaron = 0x011b;
57259  t.ecedillabreve = 0x1e1d;
57260  t.echarmenian = 0x0565;
57261  t.echyiwnarmenian = 0x0587;
57262  t.ecircle = 0x24d4;
57263  t.ecircumflex = 0x00ea;
57264  t.ecircumflexacute = 0x1ebf;
57265  t.ecircumflexbelow = 0x1e19;
57266  t.ecircumflexdotbelow = 0x1ec7;
57267  t.ecircumflexgrave = 0x1ec1;
57268  t.ecircumflexhookabove = 0x1ec3;
57269  t.ecircumflextilde = 0x1ec5;
57270  t.ecyrillic = 0x0454;
57271  t.edblgrave = 0x0205;
57272  t.edeva = 0x090f;
57273  t.edieresis = 0x00eb;
57274  t.edot = 0x0117;
57275  t.edotaccent = 0x0117;
57276  t.edotbelow = 0x1eb9;
57277  t.eegurmukhi = 0x0a0f;
57278  t.eematragurmukhi = 0x0a47;
57279  t.efcyrillic = 0x0444;
57280  t.egrave = 0x00e8;
57281  t.egujarati = 0x0a8f;
57282  t.eharmenian = 0x0567;
57283  t.ehbopomofo = 0x311d;
57284  t.ehiragana = 0x3048;
57285  t.ehookabove = 0x1ebb;
57286  t.eibopomofo = 0x311f;
57287  t.eight = 0x0038;
57288  t.eightarabic = 0x0668;
57289  t.eightbengali = 0x09ee;
57290  t.eightcircle = 0x2467;
57291  t.eightcircleinversesansserif = 0x2791;
57292  t.eightdeva = 0x096e;
57293  t.eighteencircle = 0x2471;
57294  t.eighteenparen = 0x2485;
57295  t.eighteenperiod = 0x2499;
57296  t.eightgujarati = 0x0aee;
57297  t.eightgurmukhi = 0x0a6e;
57298  t.eighthackarabic = 0x0668;
57299  t.eighthangzhou = 0x3028;
57300  t.eighthnotebeamed = 0x266b;
57301  t.eightideographicparen = 0x3227;
57302  t.eightinferior = 0x2088;
57303  t.eightmonospace = 0xff18;
57304  t.eightoldstyle = 0xf738;
57305  t.eightparen = 0x247b;
57306  t.eightperiod = 0x248f;
57307  t.eightpersian = 0x06f8;
57308  t.eightroman = 0x2177;
57309  t.eightsuperior = 0x2078;
57310  t.eightthai = 0x0e58;
57311  t.einvertedbreve = 0x0207;
57312  t.eiotifiedcyrillic = 0x0465;
57313  t.ekatakana = 0x30a8;
57314  t.ekatakanahalfwidth = 0xff74;
57315  t.ekonkargurmukhi = 0x0a74;
57316  t.ekorean = 0x3154;
57317  t.elcyrillic = 0x043b;
57318  t.element = 0x2208;
57319  t.elevencircle = 0x246a;
57320  t.elevenparen = 0x247e;
57321  t.elevenperiod = 0x2492;
57322  t.elevenroman = 0x217a;
57323  t.ellipsis = 0x2026;
57324  t.ellipsisvertical = 0x22ee;
57325  t.emacron = 0x0113;
57326  t.emacronacute = 0x1e17;
57327  t.emacrongrave = 0x1e15;
57328  t.emcyrillic = 0x043c;
57329  t.emdash = 0x2014;
57330  t.emdashvertical = 0xfe31;
57331  t.emonospace = 0xff45;
57332  t.emphasismarkarmenian = 0x055b;
57333  t.emptyset = 0x2205;
57334  t.enbopomofo = 0x3123;
57335  t.encyrillic = 0x043d;
57336  t.endash = 0x2013;
57337  t.endashvertical = 0xfe32;
57338  t.endescendercyrillic = 0x04a3;
57339  t.eng = 0x014b;
57340  t.engbopomofo = 0x3125;
57341  t.enghecyrillic = 0x04a5;
57342  t.enhookcyrillic = 0x04c8;
57343  t.enspace = 0x2002;
57344  t.eogonek = 0x0119;
57345  t.eokorean = 0x3153;
57346  t.eopen = 0x025b;
57347  t.eopenclosed = 0x029a;
57348  t.eopenreversed = 0x025c;
57349  t.eopenreversedclosed = 0x025e;
57350  t.eopenreversedhook = 0x025d;
57351  t.eparen = 0x24a0;
57352  t.epsilon = 0x03b5;
57353  t.epsilontonos = 0x03ad;
57354  t.equal = 0x003d;
57355  t.equalmonospace = 0xff1d;
57356  t.equalsmall = 0xfe66;
57357  t.equalsuperior = 0x207c;
57358  t.equivalence = 0x2261;
57359  t.erbopomofo = 0x3126;
57360  t.ercyrillic = 0x0440;
57361  t.ereversed = 0x0258;
57362  t.ereversedcyrillic = 0x044d;
57363  t.escyrillic = 0x0441;
57364  t.esdescendercyrillic = 0x04ab;
57365  t.esh = 0x0283;
57366  t.eshcurl = 0x0286;
57367  t.eshortdeva = 0x090e;
57368  t.eshortvowelsigndeva = 0x0946;
57369  t.eshreversedloop = 0x01aa;
57370  t.eshsquatreversed = 0x0285;
57371  t.esmallhiragana = 0x3047;
57372  t.esmallkatakana = 0x30a7;
57373  t.esmallkatakanahalfwidth = 0xff6a;
57374  t.estimated = 0x212e;
57375  t.esuperior = 0xf6ec;
57376  t.eta = 0x03b7;
57377  t.etarmenian = 0x0568;
57378  t.etatonos = 0x03ae;
57379  t.eth = 0x00f0;
57380  t.etilde = 0x1ebd;
57381  t.etildebelow = 0x1e1b;
57382  t.etnahtafoukhhebrew = 0x0591;
57383  t.etnahtafoukhlefthebrew = 0x0591;
57384  t.etnahtahebrew = 0x0591;
57385  t.etnahtalefthebrew = 0x0591;
57386  t.eturned = 0x01dd;
57387  t.eukorean = 0x3161;
57388  t.euro = 0x20ac;
57389  t.evowelsignbengali = 0x09c7;
57390  t.evowelsigndeva = 0x0947;
57391  t.evowelsigngujarati = 0x0ac7;
57392  t.exclam = 0x0021;
57393  t.exclamarmenian = 0x055c;
57394  t.exclamdbl = 0x203c;
57395  t.exclamdown = 0x00a1;
57396  t.exclamdownsmall = 0xf7a1;
57397  t.exclammonospace = 0xff01;
57398  t.exclamsmall = 0xf721;
57399  t.existential = 0x2203;
57400  t.ezh = 0x0292;
57401  t.ezhcaron = 0x01ef;
57402  t.ezhcurl = 0x0293;
57403  t.ezhreversed = 0x01b9;
57404  t.ezhtail = 0x01ba;
57405  t.f = 0x0066;
57406  t.fadeva = 0x095e;
57407  t.fagurmukhi = 0x0a5e;
57408  t.fahrenheit = 0x2109;
57409  t.fathaarabic = 0x064e;
57410  t.fathalowarabic = 0x064e;
57411  t.fathatanarabic = 0x064b;
57412  t.fbopomofo = 0x3108;
57413  t.fcircle = 0x24d5;
57414  t.fdotaccent = 0x1e1f;
57415  t.feharabic = 0x0641;
57416  t.feharmenian = 0x0586;
57417  t.fehfinalarabic = 0xfed2;
57418  t.fehinitialarabic = 0xfed3;
57419  t.fehmedialarabic = 0xfed4;
57420  t.feicoptic = 0x03e5;
57421  t.female = 0x2640;
57422  t.ff = 0xfb00;
57423  t.f_f = 0xfb00;
57424  t.ffi = 0xfb03;
57425  t.f_f_i = 0xfb03;
57426  t.ffl = 0xfb04;
57427  t.f_f_l = 0xfb04;
57428  t.fi = 0xfb01;
57429  t.f_i = 0xfb01;
57430  t.fifteencircle = 0x246e;
57431  t.fifteenparen = 0x2482;
57432  t.fifteenperiod = 0x2496;
57433  t.figuredash = 0x2012;
57434  t.filledbox = 0x25a0;
57435  t.filledrect = 0x25ac;
57436  t.finalkaf = 0x05da;
57437  t.finalkafdagesh = 0xfb3a;
57438  t.finalkafdageshhebrew = 0xfb3a;
57439  t.finalkafhebrew = 0x05da;
57440  t.finalmem = 0x05dd;
57441  t.finalmemhebrew = 0x05dd;
57442  t.finalnun = 0x05df;
57443  t.finalnunhebrew = 0x05df;
57444  t.finalpe = 0x05e3;
57445  t.finalpehebrew = 0x05e3;
57446  t.finaltsadi = 0x05e5;
57447  t.finaltsadihebrew = 0x05e5;
57448  t.firsttonechinese = 0x02c9;
57449  t.fisheye = 0x25c9;
57450  t.fitacyrillic = 0x0473;
57451  t.five = 0x0035;
57452  t.fivearabic = 0x0665;
57453  t.fivebengali = 0x09eb;
57454  t.fivecircle = 0x2464;
57455  t.fivecircleinversesansserif = 0x278e;
57456  t.fivedeva = 0x096b;
57457  t.fiveeighths = 0x215d;
57458  t.fivegujarati = 0x0aeb;
57459  t.fivegurmukhi = 0x0a6b;
57460  t.fivehackarabic = 0x0665;
57461  t.fivehangzhou = 0x3025;
57462  t.fiveideographicparen = 0x3224;
57463  t.fiveinferior = 0x2085;
57464  t.fivemonospace = 0xff15;
57465  t.fiveoldstyle = 0xf735;
57466  t.fiveparen = 0x2478;
57467  t.fiveperiod = 0x248c;
57468  t.fivepersian = 0x06f5;
57469  t.fiveroman = 0x2174;
57470  t.fivesuperior = 0x2075;
57471  t.fivethai = 0x0e55;
57472  t.fl = 0xfb02;
57473  t.f_l = 0xfb02;
57474  t.florin = 0x0192;
57475  t.fmonospace = 0xff46;
57476  t.fmsquare = 0x3399;
57477  t.fofanthai = 0x0e1f;
57478  t.fofathai = 0x0e1d;
57479  t.fongmanthai = 0x0e4f;
57480  t.forall = 0x2200;
57481  t.four = 0x0034;
57482  t.fourarabic = 0x0664;
57483  t.fourbengali = 0x09ea;
57484  t.fourcircle = 0x2463;
57485  t.fourcircleinversesansserif = 0x278d;
57486  t.fourdeva = 0x096a;
57487  t.fourgujarati = 0x0aea;
57488  t.fourgurmukhi = 0x0a6a;
57489  t.fourhackarabic = 0x0664;
57490  t.fourhangzhou = 0x3024;
57491  t.fourideographicparen = 0x3223;
57492  t.fourinferior = 0x2084;
57493  t.fourmonospace = 0xff14;
57494  t.fournumeratorbengali = 0x09f7;
57495  t.fouroldstyle = 0xf734;
57496  t.fourparen = 0x2477;
57497  t.fourperiod = 0x248b;
57498  t.fourpersian = 0x06f4;
57499  t.fourroman = 0x2173;
57500  t.foursuperior = 0x2074;
57501  t.fourteencircle = 0x246d;
57502  t.fourteenparen = 0x2481;
57503  t.fourteenperiod = 0x2495;
57504  t.fourthai = 0x0e54;
57505  t.fourthtonechinese = 0x02cb;
57506  t.fparen = 0x24a1;
57507  t.fraction = 0x2044;
57508  t.franc = 0x20a3;
57509  t.g = 0x0067;
57510  t.gabengali = 0x0997;
57511  t.gacute = 0x01f5;
57512  t.gadeva = 0x0917;
57513  t.gafarabic = 0x06af;
57514  t.gaffinalarabic = 0xfb93;
57515  t.gafinitialarabic = 0xfb94;
57516  t.gafmedialarabic = 0xfb95;
57517  t.gagujarati = 0x0a97;
57518  t.gagurmukhi = 0x0a17;
57519  t.gahiragana = 0x304c;
57520  t.gakatakana = 0x30ac;
57521  t.gamma = 0x03b3;
57522  t.gammalatinsmall = 0x0263;
57523  t.gammasuperior = 0x02e0;
57524  t.gangiacoptic = 0x03eb;
57525  t.gbopomofo = 0x310d;
57526  t.gbreve = 0x011f;
57527  t.gcaron = 0x01e7;
57528  t.gcedilla = 0x0123;
57529  t.gcircle = 0x24d6;
57530  t.gcircumflex = 0x011d;
57531  t.gcommaaccent = 0x0123;
57532  t.gdot = 0x0121;
57533  t.gdotaccent = 0x0121;
57534  t.gecyrillic = 0x0433;
57535  t.gehiragana = 0x3052;
57536  t.gekatakana = 0x30b2;
57537  t.geometricallyequal = 0x2251;
57538  t.gereshaccenthebrew = 0x059c;
57539  t.gereshhebrew = 0x05f3;
57540  t.gereshmuqdamhebrew = 0x059d;
57541  t.germandbls = 0x00df;
57542  t.gershayimaccenthebrew = 0x059e;
57543  t.gershayimhebrew = 0x05f4;
57544  t.getamark = 0x3013;
57545  t.ghabengali = 0x0998;
57546  t.ghadarmenian = 0x0572;
57547  t.ghadeva = 0x0918;
57548  t.ghagujarati = 0x0a98;
57549  t.ghagurmukhi = 0x0a18;
57550  t.ghainarabic = 0x063a;
57551  t.ghainfinalarabic = 0xfece;
57552  t.ghaininitialarabic = 0xfecf;
57553  t.ghainmedialarabic = 0xfed0;
57554  t.ghemiddlehookcyrillic = 0x0495;
57555  t.ghestrokecyrillic = 0x0493;
57556  t.gheupturncyrillic = 0x0491;
57557  t.ghhadeva = 0x095a;
57558  t.ghhagurmukhi = 0x0a5a;
57559  t.ghook = 0x0260;
57560  t.ghzsquare = 0x3393;
57561  t.gihiragana = 0x304e;
57562  t.gikatakana = 0x30ae;
57563  t.gimarmenian = 0x0563;
57564  t.gimel = 0x05d2;
57565  t.gimeldagesh = 0xfb32;
57566  t.gimeldageshhebrew = 0xfb32;
57567  t.gimelhebrew = 0x05d2;
57568  t.gjecyrillic = 0x0453;
57569  t.glottalinvertedstroke = 0x01be;
57570  t.glottalstop = 0x0294;
57571  t.glottalstopinverted = 0x0296;
57572  t.glottalstopmod = 0x02c0;
57573  t.glottalstopreversed = 0x0295;
57574  t.glottalstopreversedmod = 0x02c1;
57575  t.glottalstopreversedsuperior = 0x02e4;
57576  t.glottalstopstroke = 0x02a1;
57577  t.glottalstopstrokereversed = 0x02a2;
57578  t.gmacron = 0x1e21;
57579  t.gmonospace = 0xff47;
57580  t.gohiragana = 0x3054;
57581  t.gokatakana = 0x30b4;
57582  t.gparen = 0x24a2;
57583  t.gpasquare = 0x33ac;
57584  t.gradient = 0x2207;
57585  t.grave = 0x0060;
57586  t.gravebelowcmb = 0x0316;
57587  t.gravecmb = 0x0300;
57588  t.gravecomb = 0x0300;
57589  t.gravedeva = 0x0953;
57590  t.gravelowmod = 0x02ce;
57591  t.gravemonospace = 0xff40;
57592  t.gravetonecmb = 0x0340;
57593  t.greater = 0x003e;
57594  t.greaterequal = 0x2265;
57595  t.greaterequalorless = 0x22db;
57596  t.greatermonospace = 0xff1e;
57597  t.greaterorequivalent = 0x2273;
57598  t.greaterorless = 0x2277;
57599  t.greateroverequal = 0x2267;
57600  t.greatersmall = 0xfe65;
57601  t.gscript = 0x0261;
57602  t.gstroke = 0x01e5;
57603  t.guhiragana = 0x3050;
57604  t.guillemotleft = 0x00ab;
57605  t.guillemotright = 0x00bb;
57606  t.guilsinglleft = 0x2039;
57607  t.guilsinglright = 0x203a;
57608  t.gukatakana = 0x30b0;
57609  t.guramusquare = 0x3318;
57610  t.gysquare = 0x33c9;
57611  t.h = 0x0068;
57612  t.haabkhasiancyrillic = 0x04a9;
57613  t.haaltonearabic = 0x06c1;
57614  t.habengali = 0x09b9;
57615  t.hadescendercyrillic = 0x04b3;
57616  t.hadeva = 0x0939;
57617  t.hagujarati = 0x0ab9;
57618  t.hagurmukhi = 0x0a39;
57619  t.haharabic = 0x062d;
57620  t.hahfinalarabic = 0xfea2;
57621  t.hahinitialarabic = 0xfea3;
57622  t.hahiragana = 0x306f;
57623  t.hahmedialarabic = 0xfea4;
57624  t.haitusquare = 0x332a;
57625  t.hakatakana = 0x30cf;
57626  t.hakatakanahalfwidth = 0xff8a;
57627  t.halantgurmukhi = 0x0a4d;
57628  t.hamzaarabic = 0x0621;
57629  t.hamzalowarabic = 0x0621;
57630  t.hangulfiller = 0x3164;
57631  t.hardsigncyrillic = 0x044a;
57632  t.harpoonleftbarbup = 0x21bc;
57633  t.harpoonrightbarbup = 0x21c0;
57634  t.hasquare = 0x33ca;
57635  t.hatafpatah = 0x05b2;
57636  t.hatafpatah16 = 0x05b2;
57637  t.hatafpatah23 = 0x05b2;
57638  t.hatafpatah2f = 0x05b2;
57639  t.hatafpatahhebrew = 0x05b2;
57640  t.hatafpatahnarrowhebrew = 0x05b2;
57641  t.hatafpatahquarterhebrew = 0x05b2;
57642  t.hatafpatahwidehebrew = 0x05b2;
57643  t.hatafqamats = 0x05b3;
57644  t.hatafqamats1b = 0x05b3;
57645  t.hatafqamats28 = 0x05b3;
57646  t.hatafqamats34 = 0x05b3;
57647  t.hatafqamatshebrew = 0x05b3;
57648  t.hatafqamatsnarrowhebrew = 0x05b3;
57649  t.hatafqamatsquarterhebrew = 0x05b3;
57650  t.hatafqamatswidehebrew = 0x05b3;
57651  t.hatafsegol = 0x05b1;
57652  t.hatafsegol17 = 0x05b1;
57653  t.hatafsegol24 = 0x05b1;
57654  t.hatafsegol30 = 0x05b1;
57655  t.hatafsegolhebrew = 0x05b1;
57656  t.hatafsegolnarrowhebrew = 0x05b1;
57657  t.hatafsegolquarterhebrew = 0x05b1;
57658  t.hatafsegolwidehebrew = 0x05b1;
57659  t.hbar = 0x0127;
57660  t.hbopomofo = 0x310f;
57661  t.hbrevebelow = 0x1e2b;
57662  t.hcedilla = 0x1e29;
57663  t.hcircle = 0x24d7;
57664  t.hcircumflex = 0x0125;
57665  t.hdieresis = 0x1e27;
57666  t.hdotaccent = 0x1e23;
57667  t.hdotbelow = 0x1e25;
57668  t.he = 0x05d4;
57669  t.heart = 0x2665;
57670  t.heartsuitblack = 0x2665;
57671  t.heartsuitwhite = 0x2661;
57672  t.hedagesh = 0xfb34;
57673  t.hedageshhebrew = 0xfb34;
57674  t.hehaltonearabic = 0x06c1;
57675  t.heharabic = 0x0647;
57676  t.hehebrew = 0x05d4;
57677  t.hehfinalaltonearabic = 0xfba7;
57678  t.hehfinalalttwoarabic = 0xfeea;
57679  t.hehfinalarabic = 0xfeea;
57680  t.hehhamzaabovefinalarabic = 0xfba5;
57681  t.hehhamzaaboveisolatedarabic = 0xfba4;
57682  t.hehinitialaltonearabic = 0xfba8;
57683  t.hehinitialarabic = 0xfeeb;
57684  t.hehiragana = 0x3078;
57685  t.hehmedialaltonearabic = 0xfba9;
57686  t.hehmedialarabic = 0xfeec;
57687  t.heiseierasquare = 0x337b;
57688  t.hekatakana = 0x30d8;
57689  t.hekatakanahalfwidth = 0xff8d;
57690  t.hekutaarusquare = 0x3336;
57691  t.henghook = 0x0267;
57692  t.herutusquare = 0x3339;
57693  t.het = 0x05d7;
57694  t.hethebrew = 0x05d7;
57695  t.hhook = 0x0266;
57696  t.hhooksuperior = 0x02b1;
57697  t.hieuhacirclekorean = 0x327b;
57698  t.hieuhaparenkorean = 0x321b;
57699  t.hieuhcirclekorean = 0x326d;
57700  t.hieuhkorean = 0x314e;
57701  t.hieuhparenkorean = 0x320d;
57702  t.hihiragana = 0x3072;
57703  t.hikatakana = 0x30d2;
57704  t.hikatakanahalfwidth = 0xff8b;
57705  t.hiriq = 0x05b4;
57706  t.hiriq14 = 0x05b4;
57707  t.hiriq21 = 0x05b4;
57708  t.hiriq2d = 0x05b4;
57709  t.hiriqhebrew = 0x05b4;
57710  t.hiriqnarrowhebrew = 0x05b4;
57711  t.hiriqquarterhebrew = 0x05b4;
57712  t.hiriqwidehebrew = 0x05b4;
57713  t.hlinebelow = 0x1e96;
57714  t.hmonospace = 0xff48;
57715  t.hoarmenian = 0x0570;
57716  t.hohipthai = 0x0e2b;
57717  t.hohiragana = 0x307b;
57718  t.hokatakana = 0x30db;
57719  t.hokatakanahalfwidth = 0xff8e;
57720  t.holam = 0x05b9;
57721  t.holam19 = 0x05b9;
57722  t.holam26 = 0x05b9;
57723  t.holam32 = 0x05b9;
57724  t.holamhebrew = 0x05b9;
57725  t.holamnarrowhebrew = 0x05b9;
57726  t.holamquarterhebrew = 0x05b9;
57727  t.holamwidehebrew = 0x05b9;
57728  t.honokhukthai = 0x0e2e;
57729  t.hookabovecomb = 0x0309;
57730  t.hookcmb = 0x0309;
57731  t.hookpalatalizedbelowcmb = 0x0321;
57732  t.hookretroflexbelowcmb = 0x0322;
57733  t.hoonsquare = 0x3342;
57734  t.horicoptic = 0x03e9;
57735  t.horizontalbar = 0x2015;
57736  t.horncmb = 0x031b;
57737  t.hotsprings = 0x2668;
57738  t.house = 0x2302;
57739  t.hparen = 0x24a3;
57740  t.hsuperior = 0x02b0;
57741  t.hturned = 0x0265;
57742  t.huhiragana = 0x3075;
57743  t.huiitosquare = 0x3333;
57744  t.hukatakana = 0x30d5;
57745  t.hukatakanahalfwidth = 0xff8c;
57746  t.hungarumlaut = 0x02dd;
57747  t.hungarumlautcmb = 0x030b;
57748  t.hv = 0x0195;
57749  t.hyphen = 0x002d;
57750  t.hypheninferior = 0xf6e5;
57751  t.hyphenmonospace = 0xff0d;
57752  t.hyphensmall = 0xfe63;
57753  t.hyphensuperior = 0xf6e6;
57754  t.hyphentwo = 0x2010;
57755  t.i = 0x0069;
57756  t.iacute = 0x00ed;
57757  t.iacyrillic = 0x044f;
57758  t.ibengali = 0x0987;
57759  t.ibopomofo = 0x3127;
57760  t.ibreve = 0x012d;
57761  t.icaron = 0x01d0;
57762  t.icircle = 0x24d8;
57763  t.icircumflex = 0x00ee;
57764  t.icyrillic = 0x0456;
57765  t.idblgrave = 0x0209;
57766  t.ideographearthcircle = 0x328f;
57767  t.ideographfirecircle = 0x328b;
57768  t.ideographicallianceparen = 0x323f;
57769  t.ideographiccallparen = 0x323a;
57770  t.ideographiccentrecircle = 0x32a5;
57771  t.ideographicclose = 0x3006;
57772  t.ideographiccomma = 0x3001;
57773  t.ideographiccommaleft = 0xff64;
57774  t.ideographiccongratulationparen = 0x3237;
57775  t.ideographiccorrectcircle = 0x32a3;
57776  t.ideographicearthparen = 0x322f;
57777  t.ideographicenterpriseparen = 0x323d;
57778  t.ideographicexcellentcircle = 0x329d;
57779  t.ideographicfestivalparen = 0x3240;
57780  t.ideographicfinancialcircle = 0x3296;
57781  t.ideographicfinancialparen = 0x3236;
57782  t.ideographicfireparen = 0x322b;
57783  t.ideographichaveparen = 0x3232;
57784  t.ideographichighcircle = 0x32a4;
57785  t.ideographiciterationmark = 0x3005;
57786  t.ideographiclaborcircle = 0x3298;
57787  t.ideographiclaborparen = 0x3238;
57788  t.ideographicleftcircle = 0x32a7;
57789  t.ideographiclowcircle = 0x32a6;
57790  t.ideographicmedicinecircle = 0x32a9;
57791  t.ideographicmetalparen = 0x322e;
57792  t.ideographicmoonparen = 0x322a;
57793  t.ideographicnameparen = 0x3234;
57794  t.ideographicperiod = 0x3002;
57795  t.ideographicprintcircle = 0x329e;
57796  t.ideographicreachparen = 0x3243;
57797  t.ideographicrepresentparen = 0x3239;
57798  t.ideographicresourceparen = 0x323e;
57799  t.ideographicrightcircle = 0x32a8;
57800  t.ideographicsecretcircle = 0x3299;
57801  t.ideographicselfparen = 0x3242;
57802  t.ideographicsocietyparen = 0x3233;
57803  t.ideographicspace = 0x3000;
57804  t.ideographicspecialparen = 0x3235;
57805  t.ideographicstockparen = 0x3231;
57806  t.ideographicstudyparen = 0x323b;
57807  t.ideographicsunparen = 0x3230;
57808  t.ideographicsuperviseparen = 0x323c;
57809  t.ideographicwaterparen = 0x322c;
57810  t.ideographicwoodparen = 0x322d;
57811  t.ideographiczero = 0x3007;
57812  t.ideographmetalcircle = 0x328e;
57813  t.ideographmooncircle = 0x328a;
57814  t.ideographnamecircle = 0x3294;
57815  t.ideographsuncircle = 0x3290;
57816  t.ideographwatercircle = 0x328c;
57817  t.ideographwoodcircle = 0x328d;
57818  t.ideva = 0x0907;
57819  t.idieresis = 0x00ef;
57820  t.idieresisacute = 0x1e2f;
57821  t.idieresiscyrillic = 0x04e5;
57822  t.idotbelow = 0x1ecb;
57823  t.iebrevecyrillic = 0x04d7;
57824  t.iecyrillic = 0x0435;
57825  t.ieungacirclekorean = 0x3275;
57826  t.ieungaparenkorean = 0x3215;
57827  t.ieungcirclekorean = 0x3267;
57828  t.ieungkorean = 0x3147;
57829  t.ieungparenkorean = 0x3207;
57830  t.igrave = 0x00ec;
57831  t.igujarati = 0x0a87;
57832  t.igurmukhi = 0x0a07;
57833  t.ihiragana = 0x3044;
57834  t.ihookabove = 0x1ec9;
57835  t.iibengali = 0x0988;
57836  t.iicyrillic = 0x0438;
57837  t.iideva = 0x0908;
57838  t.iigujarati = 0x0a88;
57839  t.iigurmukhi = 0x0a08;
57840  t.iimatragurmukhi = 0x0a40;
57841  t.iinvertedbreve = 0x020b;
57842  t.iishortcyrillic = 0x0439;
57843  t.iivowelsignbengali = 0x09c0;
57844  t.iivowelsigndeva = 0x0940;
57845  t.iivowelsigngujarati = 0x0ac0;
57846  t.ij = 0x0133;
57847  t.ikatakana = 0x30a4;
57848  t.ikatakanahalfwidth = 0xff72;
57849  t.ikorean = 0x3163;
57850  t.ilde = 0x02dc;
57851  t.iluyhebrew = 0x05ac;
57852  t.imacron = 0x012b;
57853  t.imacroncyrillic = 0x04e3;
57854  t.imageorapproximatelyequal = 0x2253;
57855  t.imatragurmukhi = 0x0a3f;
57856  t.imonospace = 0xff49;
57857  t.increment = 0x2206;
57858  t.infinity = 0x221e;
57859  t.iniarmenian = 0x056b;
57860  t.integral = 0x222b;
57861  t.integralbottom = 0x2321;
57862  t.integralbt = 0x2321;
57863  t.integralex = 0xf8f5;
57864  t.integraltop = 0x2320;
57865  t.integraltp = 0x2320;
57866  t.intersection = 0x2229;
57867  t.intisquare = 0x3305;
57868  t.invbullet = 0x25d8;
57869  t.invcircle = 0x25d9;
57870  t.invsmileface = 0x263b;
57871  t.iocyrillic = 0x0451;
57872  t.iogonek = 0x012f;
57873  t.iota = 0x03b9;
57874  t.iotadieresis = 0x03ca;
57875  t.iotadieresistonos = 0x0390;
57876  t.iotalatin = 0x0269;
57877  t.iotatonos = 0x03af;
57878  t.iparen = 0x24a4;
57879  t.irigurmukhi = 0x0a72;
57880  t.ismallhiragana = 0x3043;
57881  t.ismallkatakana = 0x30a3;
57882  t.ismallkatakanahalfwidth = 0xff68;
57883  t.issharbengali = 0x09fa;
57884  t.istroke = 0x0268;
57885  t.isuperior = 0xf6ed;
57886  t.iterationhiragana = 0x309d;
57887  t.iterationkatakana = 0x30fd;
57888  t.itilde = 0x0129;
57889  t.itildebelow = 0x1e2d;
57890  t.iubopomofo = 0x3129;
57891  t.iucyrillic = 0x044e;
57892  t.ivowelsignbengali = 0x09bf;
57893  t.ivowelsigndeva = 0x093f;
57894  t.ivowelsigngujarati = 0x0abf;
57895  t.izhitsacyrillic = 0x0475;
57896  t.izhitsadblgravecyrillic = 0x0477;
57897  t.j = 0x006a;
57898  t.jaarmenian = 0x0571;
57899  t.jabengali = 0x099c;
57900  t.jadeva = 0x091c;
57901  t.jagujarati = 0x0a9c;
57902  t.jagurmukhi = 0x0a1c;
57903  t.jbopomofo = 0x3110;
57904  t.jcaron = 0x01f0;
57905  t.jcircle = 0x24d9;
57906  t.jcircumflex = 0x0135;
57907  t.jcrossedtail = 0x029d;
57908  t.jdotlessstroke = 0x025f;
57909  t.jecyrillic = 0x0458;
57910  t.jeemarabic = 0x062c;
57911  t.jeemfinalarabic = 0xfe9e;
57912  t.jeeminitialarabic = 0xfe9f;
57913  t.jeemmedialarabic = 0xfea0;
57914  t.jeharabic = 0x0698;
57915  t.jehfinalarabic = 0xfb8b;
57916  t.jhabengali = 0x099d;
57917  t.jhadeva = 0x091d;
57918  t.jhagujarati = 0x0a9d;
57919  t.jhagurmukhi = 0x0a1d;
57920  t.jheharmenian = 0x057b;
57921  t.jis = 0x3004;
57922  t.jmonospace = 0xff4a;
57923  t.jparen = 0x24a5;
57924  t.jsuperior = 0x02b2;
57925  t.k = 0x006b;
57926  t.kabashkircyrillic = 0x04a1;
57927  t.kabengali = 0x0995;
57928  t.kacute = 0x1e31;
57929  t.kacyrillic = 0x043a;
57930  t.kadescendercyrillic = 0x049b;
57931  t.kadeva = 0x0915;
57932  t.kaf = 0x05db;
57933  t.kafarabic = 0x0643;
57934  t.kafdagesh = 0xfb3b;
57935  t.kafdageshhebrew = 0xfb3b;
57936  t.kaffinalarabic = 0xfeda;
57937  t.kafhebrew = 0x05db;
57938  t.kafinitialarabic = 0xfedb;
57939  t.kafmedialarabic = 0xfedc;
57940  t.kafrafehebrew = 0xfb4d;
57941  t.kagujarati = 0x0a95;
57942  t.kagurmukhi = 0x0a15;
57943  t.kahiragana = 0x304b;
57944  t.kahookcyrillic = 0x04c4;
57945  t.kakatakana = 0x30ab;
57946  t.kakatakanahalfwidth = 0xff76;
57947  t.kappa = 0x03ba;
57948  t.kappasymbolgreek = 0x03f0;
57949  t.kapyeounmieumkorean = 0x3171;
57950  t.kapyeounphieuphkorean = 0x3184;
57951  t.kapyeounpieupkorean = 0x3178;
57952  t.kapyeounssangpieupkorean = 0x3179;
57953  t.karoriisquare = 0x330d;
57954  t.kashidaautoarabic = 0x0640;
57955  t.kashidaautonosidebearingarabic = 0x0640;
57956  t.kasmallkatakana = 0x30f5;
57957  t.kasquare = 0x3384;
57958  t.kasraarabic = 0x0650;
57959  t.kasratanarabic = 0x064d;
57960  t.kastrokecyrillic = 0x049f;
57961  t.katahiraprolongmarkhalfwidth = 0xff70;
57962  t.kaverticalstrokecyrillic = 0x049d;
57963  t.kbopomofo = 0x310e;
57964  t.kcalsquare = 0x3389;
57965  t.kcaron = 0x01e9;
57966  t.kcedilla = 0x0137;
57967  t.kcircle = 0x24da;
57968  t.kcommaaccent = 0x0137;
57969  t.kdotbelow = 0x1e33;
57970  t.keharmenian = 0x0584;
57971  t.kehiragana = 0x3051;
57972  t.kekatakana = 0x30b1;
57973  t.kekatakanahalfwidth = 0xff79;
57974  t.kenarmenian = 0x056f;
57975  t.kesmallkatakana = 0x30f6;
57976  t.kgreenlandic = 0x0138;
57977  t.khabengali = 0x0996;
57978  t.khacyrillic = 0x0445;
57979  t.khadeva = 0x0916;
57980  t.khagujarati = 0x0a96;
57981  t.khagurmukhi = 0x0a16;
57982  t.khaharabic = 0x062e;
57983  t.khahfinalarabic = 0xfea6;
57984  t.khahinitialarabic = 0xfea7;
57985  t.khahmedialarabic = 0xfea8;
57986  t.kheicoptic = 0x03e7;
57987  t.khhadeva = 0x0959;
57988  t.khhagurmukhi = 0x0a59;
57989  t.khieukhacirclekorean = 0x3278;
57990  t.khieukhaparenkorean = 0x3218;
57991  t.khieukhcirclekorean = 0x326a;
57992  t.khieukhkorean = 0x314b;
57993  t.khieukhparenkorean = 0x320a;
57994  t.khokhaithai = 0x0e02;
57995  t.khokhonthai = 0x0e05;
57996  t.khokhuatthai = 0x0e03;
57997  t.khokhwaithai = 0x0e04;
57998  t.khomutthai = 0x0e5b;
57999  t.khook = 0x0199;
58000  t.khorakhangthai = 0x0e06;
58001  t.khzsquare = 0x3391;
58002  t.kihiragana = 0x304d;
58003  t.kikatakana = 0x30ad;
58004  t.kikatakanahalfwidth = 0xff77;
58005  t.kiroguramusquare = 0x3315;
58006  t.kiromeetorusquare = 0x3316;
58007  t.kirosquare = 0x3314;
58008  t.kiyeokacirclekorean = 0x326e;
58009  t.kiyeokaparenkorean = 0x320e;
58010  t.kiyeokcirclekorean = 0x3260;
58011  t.kiyeokkorean = 0x3131;
58012  t.kiyeokparenkorean = 0x3200;
58013  t.kiyeoksioskorean = 0x3133;
58014  t.kjecyrillic = 0x045c;
58015  t.klinebelow = 0x1e35;
58016  t.klsquare = 0x3398;
58017  t.kmcubedsquare = 0x33a6;
58018  t.kmonospace = 0xff4b;
58019  t.kmsquaredsquare = 0x33a2;
58020  t.kohiragana = 0x3053;
58021  t.kohmsquare = 0x33c0;
58022  t.kokaithai = 0x0e01;
58023  t.kokatakana = 0x30b3;
58024  t.kokatakanahalfwidth = 0xff7a;
58025  t.kooposquare = 0x331e;
58026  t.koppacyrillic = 0x0481;
58027  t.koreanstandardsymbol = 0x327f;
58028  t.koroniscmb = 0x0343;
58029  t.kparen = 0x24a6;
58030  t.kpasquare = 0x33aa;
58031  t.ksicyrillic = 0x046f;
58032  t.ktsquare = 0x33cf;
58033  t.kturned = 0x029e;
58034  t.kuhiragana = 0x304f;
58035  t.kukatakana = 0x30af;
58036  t.kukatakanahalfwidth = 0xff78;
58037  t.kvsquare = 0x33b8;
58038  t.kwsquare = 0x33be;
58039  t.l = 0x006c;
58040  t.labengali = 0x09b2;
58041  t.lacute = 0x013a;
58042  t.ladeva = 0x0932;
58043  t.lagujarati = 0x0ab2;
58044  t.lagurmukhi = 0x0a32;
58045  t.lakkhangyaothai = 0x0e45;
58046  t.lamaleffinalarabic = 0xfefc;
58047  t.lamalefhamzaabovefinalarabic = 0xfef8;
58048  t.lamalefhamzaaboveisolatedarabic = 0xfef7;
58049  t.lamalefhamzabelowfinalarabic = 0xfefa;
58050  t.lamalefhamzabelowisolatedarabic = 0xfef9;
58051  t.lamalefisolatedarabic = 0xfefb;
58052  t.lamalefmaddaabovefinalarabic = 0xfef6;
58053  t.lamalefmaddaaboveisolatedarabic = 0xfef5;
58054  t.lamarabic = 0x0644;
58055  t.lambda = 0x03bb;
58056  t.lambdastroke = 0x019b;
58057  t.lamed = 0x05dc;
58058  t.lameddagesh = 0xfb3c;
58059  t.lameddageshhebrew = 0xfb3c;
58060  t.lamedhebrew = 0x05dc;
58061  t.lamfinalarabic = 0xfede;
58062  t.lamhahinitialarabic = 0xfcca;
58063  t.laminitialarabic = 0xfedf;
58064  t.lamjeeminitialarabic = 0xfcc9;
58065  t.lamkhahinitialarabic = 0xfccb;
58066  t.lamlamhehisolatedarabic = 0xfdf2;
58067  t.lammedialarabic = 0xfee0;
58068  t.lammeemhahinitialarabic = 0xfd88;
58069  t.lammeeminitialarabic = 0xfccc;
58070  t.largecircle = 0x25ef;
58071  t.lbar = 0x019a;
58072  t.lbelt = 0x026c;
58073  t.lbopomofo = 0x310c;
58074  t.lcaron = 0x013e;
58075  t.lcedilla = 0x013c;
58076  t.lcircle = 0x24db;
58077  t.lcircumflexbelow = 0x1e3d;
58078  t.lcommaaccent = 0x013c;
58079  t.ldot = 0x0140;
58080  t.ldotaccent = 0x0140;
58081  t.ldotbelow = 0x1e37;
58082  t.ldotbelowmacron = 0x1e39;
58083  t.leftangleabovecmb = 0x031a;
58084  t.lefttackbelowcmb = 0x0318;
58085  t.less = 0x003c;
58086  t.lessequal = 0x2264;
58087  t.lessequalorgreater = 0x22da;
58088  t.lessmonospace = 0xff1c;
58089  t.lessorequivalent = 0x2272;
58090  t.lessorgreater = 0x2276;
58091  t.lessoverequal = 0x2266;
58092  t.lesssmall = 0xfe64;
58093  t.lezh = 0x026e;
58094  t.lfblock = 0x258c;
58095  t.lhookretroflex = 0x026d;
58096  t.lira = 0x20a4;
58097  t.liwnarmenian = 0x056c;
58098  t.lj = 0x01c9;
58099  t.ljecyrillic = 0x0459;
58100  t.ll = 0xf6c0;
58101  t.lladeva = 0x0933;
58102  t.llagujarati = 0x0ab3;
58103  t.llinebelow = 0x1e3b;
58104  t.llladeva = 0x0934;
58105  t.llvocalicbengali = 0x09e1;
58106  t.llvocalicdeva = 0x0961;
58107  t.llvocalicvowelsignbengali = 0x09e3;
58108  t.llvocalicvowelsigndeva = 0x0963;
58109  t.lmiddletilde = 0x026b;
58110  t.lmonospace = 0xff4c;
58111  t.lmsquare = 0x33d0;
58112  t.lochulathai = 0x0e2c;
58113  t.logicaland = 0x2227;
58114  t.logicalnot = 0x00ac;
58115  t.logicalnotreversed = 0x2310;
58116  t.logicalor = 0x2228;
58117  t.lolingthai = 0x0e25;
58118  t.longs = 0x017f;
58119  t.lowlinecenterline = 0xfe4e;
58120  t.lowlinecmb = 0x0332;
58121  t.lowlinedashed = 0xfe4d;
58122  t.lozenge = 0x25ca;
58123  t.lparen = 0x24a7;
58124  t.lslash = 0x0142;
58125  t.lsquare = 0x2113;
58126  t.lsuperior = 0xf6ee;
58127  t.ltshade = 0x2591;
58128  t.luthai = 0x0e26;
58129  t.lvocalicbengali = 0x098c;
58130  t.lvocalicdeva = 0x090c;
58131  t.lvocalicvowelsignbengali = 0x09e2;
58132  t.lvocalicvowelsigndeva = 0x0962;
58133  t.lxsquare = 0x33d3;
58134  t.m = 0x006d;
58135  t.mabengali = 0x09ae;
58136  t.macron = 0x00af;
58137  t.macronbelowcmb = 0x0331;
58138  t.macroncmb = 0x0304;
58139  t.macronlowmod = 0x02cd;
58140  t.macronmonospace = 0xffe3;
58141  t.macute = 0x1e3f;
58142  t.madeva = 0x092e;
58143  t.magujarati = 0x0aae;
58144  t.magurmukhi = 0x0a2e;
58145  t.mahapakhhebrew = 0x05a4;
58146  t.mahapakhlefthebrew = 0x05a4;
58147  t.mahiragana = 0x307e;
58148  t.maichattawalowleftthai = 0xf895;
58149  t.maichattawalowrightthai = 0xf894;
58150  t.maichattawathai = 0x0e4b;
58151  t.maichattawaupperleftthai = 0xf893;
58152  t.maieklowleftthai = 0xf88c;
58153  t.maieklowrightthai = 0xf88b;
58154  t.maiekthai = 0x0e48;
58155  t.maiekupperleftthai = 0xf88a;
58156  t.maihanakatleftthai = 0xf884;
58157  t.maihanakatthai = 0x0e31;
58158  t.maitaikhuleftthai = 0xf889;
58159  t.maitaikhuthai = 0x0e47;
58160  t.maitholowleftthai = 0xf88f;
58161  t.maitholowrightthai = 0xf88e;
58162  t.maithothai = 0x0e49;
58163  t.maithoupperleftthai = 0xf88d;
58164  t.maitrilowleftthai = 0xf892;
58165  t.maitrilowrightthai = 0xf891;
58166  t.maitrithai = 0x0e4a;
58167  t.maitriupperleftthai = 0xf890;
58168  t.maiyamokthai = 0x0e46;
58169  t.makatakana = 0x30de;
58170  t.makatakanahalfwidth = 0xff8f;
58171  t.male = 0x2642;
58172  t.mansyonsquare = 0x3347;
58173  t.maqafhebrew = 0x05be;
58174  t.mars = 0x2642;
58175  t.masoracirclehebrew = 0x05af;
58176  t.masquare = 0x3383;
58177  t.mbopomofo = 0x3107;
58178  t.mbsquare = 0x33d4;
58179  t.mcircle = 0x24dc;
58180  t.mcubedsquare = 0x33a5;
58181  t.mdotaccent = 0x1e41;
58182  t.mdotbelow = 0x1e43;
58183  t.meemarabic = 0x0645;
58184  t.meemfinalarabic = 0xfee2;
58185  t.meeminitialarabic = 0xfee3;
58186  t.meemmedialarabic = 0xfee4;
58187  t.meemmeeminitialarabic = 0xfcd1;
58188  t.meemmeemisolatedarabic = 0xfc48;
58189  t.meetorusquare = 0x334d;
58190  t.mehiragana = 0x3081;
58191  t.meizierasquare = 0x337e;
58192  t.mekatakana = 0x30e1;
58193  t.mekatakanahalfwidth = 0xff92;
58194  t.mem = 0x05de;
58195  t.memdagesh = 0xfb3e;
58196  t.memdageshhebrew = 0xfb3e;
58197  t.memhebrew = 0x05de;
58198  t.menarmenian = 0x0574;
58199  t.merkhahebrew = 0x05a5;
58200  t.merkhakefulahebrew = 0x05a6;
58201  t.merkhakefulalefthebrew = 0x05a6;
58202  t.merkhalefthebrew = 0x05a5;
58203  t.mhook = 0x0271;
58204  t.mhzsquare = 0x3392;
58205  t.middledotkatakanahalfwidth = 0xff65;
58206  t.middot = 0x00b7;
58207  t.mieumacirclekorean = 0x3272;
58208  t.mieumaparenkorean = 0x3212;
58209  t.mieumcirclekorean = 0x3264;
58210  t.mieumkorean = 0x3141;
58211  t.mieumpansioskorean = 0x3170;
58212  t.mieumparenkorean = 0x3204;
58213  t.mieumpieupkorean = 0x316e;
58214  t.mieumsioskorean = 0x316f;
58215  t.mihiragana = 0x307f;
58216  t.mikatakana = 0x30df;
58217  t.mikatakanahalfwidth = 0xff90;
58218  t.minus = 0x2212;
58219  t.minusbelowcmb = 0x0320;
58220  t.minuscircle = 0x2296;
58221  t.minusmod = 0x02d7;
58222  t.minusplus = 0x2213;
58223  t.minute = 0x2032;
58224  t.miribaarusquare = 0x334a;
58225  t.mirisquare = 0x3349;
58226  t.mlonglegturned = 0x0270;
58227  t.mlsquare = 0x3396;
58228  t.mmcubedsquare = 0x33a3;
58229  t.mmonospace = 0xff4d;
58230  t.mmsquaredsquare = 0x339f;
58231  t.mohiragana = 0x3082;
58232  t.mohmsquare = 0x33c1;
58233  t.mokatakana = 0x30e2;
58234  t.mokatakanahalfwidth = 0xff93;
58235  t.molsquare = 0x33d6;
58236  t.momathai = 0x0e21;
58237  t.moverssquare = 0x33a7;
58238  t.moverssquaredsquare = 0x33a8;
58239  t.mparen = 0x24a8;
58240  t.mpasquare = 0x33ab;
58241  t.mssquare = 0x33b3;
58242  t.msuperior = 0xf6ef;
58243  t.mturned = 0x026f;
58244  t.mu = 0x00b5;
58245  t.mu1 = 0x00b5;
58246  t.muasquare = 0x3382;
58247  t.muchgreater = 0x226b;
58248  t.muchless = 0x226a;
58249  t.mufsquare = 0x338c;
58250  t.mugreek = 0x03bc;
58251  t.mugsquare = 0x338d;
58252  t.muhiragana = 0x3080;
58253  t.mukatakana = 0x30e0;
58254  t.mukatakanahalfwidth = 0xff91;
58255  t.mulsquare = 0x3395;
58256  t.multiply = 0x00d7;
58257  t.mumsquare = 0x339b;
58258  t.munahhebrew = 0x05a3;
58259  t.munahlefthebrew = 0x05a3;
58260  t.musicalnote = 0x266a;
58261  t.musicalnotedbl = 0x266b;
58262  t.musicflatsign = 0x266d;
58263  t.musicsharpsign = 0x266f;
58264  t.mussquare = 0x33b2;
58265  t.muvsquare = 0x33b6;
58266  t.muwsquare = 0x33bc;
58267  t.mvmegasquare = 0x33b9;
58268  t.mvsquare = 0x33b7;
58269  t.mwmegasquare = 0x33bf;
58270  t.mwsquare = 0x33bd;
58271  t.n = 0x006e;
58272  t.nabengali = 0x09a8;
58273  t.nabla = 0x2207;
58274  t.nacute = 0x0144;
58275  t.nadeva = 0x0928;
58276  t.nagujarati = 0x0aa8;
58277  t.nagurmukhi = 0x0a28;
58278  t.nahiragana = 0x306a;
58279  t.nakatakana = 0x30ca;
58280  t.nakatakanahalfwidth = 0xff85;
58281  t.napostrophe = 0x0149;
58282  t.nasquare = 0x3381;
58283  t.nbopomofo = 0x310b;
58284  t.nbspace = 0x00a0;
58285  t.ncaron = 0x0148;
58286  t.ncedilla = 0x0146;
58287  t.ncircle = 0x24dd;
58288  t.ncircumflexbelow = 0x1e4b;
58289  t.ncommaaccent = 0x0146;
58290  t.ndotaccent = 0x1e45;
58291  t.ndotbelow = 0x1e47;
58292  t.nehiragana = 0x306d;
58293  t.nekatakana = 0x30cd;
58294  t.nekatakanahalfwidth = 0xff88;
58295  t.newsheqelsign = 0x20aa;
58296  t.nfsquare = 0x338b;
58297  t.ngabengali = 0x0999;
58298  t.ngadeva = 0x0919;
58299  t.ngagujarati = 0x0a99;
58300  t.ngagurmukhi = 0x0a19;
58301  t.ngonguthai = 0x0e07;
58302  t.nhiragana = 0x3093;
58303  t.nhookleft = 0x0272;
58304  t.nhookretroflex = 0x0273;
58305  t.nieunacirclekorean = 0x326f;
58306  t.nieunaparenkorean = 0x320f;
58307  t.nieuncieuckorean = 0x3135;
58308  t.nieuncirclekorean = 0x3261;
58309  t.nieunhieuhkorean = 0x3136;
58310  t.nieunkorean = 0x3134;
58311  t.nieunpansioskorean = 0x3168;
58312  t.nieunparenkorean = 0x3201;
58313  t.nieunsioskorean = 0x3167;
58314  t.nieuntikeutkorean = 0x3166;
58315  t.nihiragana = 0x306b;
58316  t.nikatakana = 0x30cb;
58317  t.nikatakanahalfwidth = 0xff86;
58318  t.nikhahitleftthai = 0xf899;
58319  t.nikhahitthai = 0x0e4d;
58320  t.nine = 0x0039;
58321  t.ninearabic = 0x0669;
58322  t.ninebengali = 0x09ef;
58323  t.ninecircle = 0x2468;
58324  t.ninecircleinversesansserif = 0x2792;
58325  t.ninedeva = 0x096f;
58326  t.ninegujarati = 0x0aef;
58327  t.ninegurmukhi = 0x0a6f;
58328  t.ninehackarabic = 0x0669;
58329  t.ninehangzhou = 0x3029;
58330  t.nineideographicparen = 0x3228;
58331  t.nineinferior = 0x2089;
58332  t.ninemonospace = 0xff19;
58333  t.nineoldstyle = 0xf739;
58334  t.nineparen = 0x247c;
58335  t.nineperiod = 0x2490;
58336  t.ninepersian = 0x06f9;
58337  t.nineroman = 0x2178;
58338  t.ninesuperior = 0x2079;
58339  t.nineteencircle = 0x2472;
58340  t.nineteenparen = 0x2486;
58341  t.nineteenperiod = 0x249a;
58342  t.ninethai = 0x0e59;
58343  t.nj = 0x01cc;
58344  t.njecyrillic = 0x045a;
58345  t.nkatakana = 0x30f3;
58346  t.nkatakanahalfwidth = 0xff9d;
58347  t.nlegrightlong = 0x019e;
58348  t.nlinebelow = 0x1e49;
58349  t.nmonospace = 0xff4e;
58350  t.nmsquare = 0x339a;
58351  t.nnabengali = 0x09a3;
58352  t.nnadeva = 0x0923;
58353  t.nnagujarati = 0x0aa3;
58354  t.nnagurmukhi = 0x0a23;
58355  t.nnnadeva = 0x0929;
58356  t.nohiragana = 0x306e;
58357  t.nokatakana = 0x30ce;
58358  t.nokatakanahalfwidth = 0xff89;
58359  t.nonbreakingspace = 0x00a0;
58360  t.nonenthai = 0x0e13;
58361  t.nonuthai = 0x0e19;
58362  t.noonarabic = 0x0646;
58363  t.noonfinalarabic = 0xfee6;
58364  t.noonghunnaarabic = 0x06ba;
58365  t.noonghunnafinalarabic = 0xfb9f;
58366  t.nooninitialarabic = 0xfee7;
58367  t.noonjeeminitialarabic = 0xfcd2;
58368  t.noonjeemisolatedarabic = 0xfc4b;
58369  t.noonmedialarabic = 0xfee8;
58370  t.noonmeeminitialarabic = 0xfcd5;
58371  t.noonmeemisolatedarabic = 0xfc4e;
58372  t.noonnoonfinalarabic = 0xfc8d;
58373  t.notcontains = 0x220c;
58374  t.notelement = 0x2209;
58375  t.notelementof = 0x2209;
58376  t.notequal = 0x2260;
58377  t.notgreater = 0x226f;
58378  t.notgreaternorequal = 0x2271;
58379  t.notgreaternorless = 0x2279;
58380  t.notidentical = 0x2262;
58381  t.notless = 0x226e;
58382  t.notlessnorequal = 0x2270;
58383  t.notparallel = 0x2226;
58384  t.notprecedes = 0x2280;
58385  t.notsubset = 0x2284;
58386  t.notsucceeds = 0x2281;
58387  t.notsuperset = 0x2285;
58388  t.nowarmenian = 0x0576;
58389  t.nparen = 0x24a9;
58390  t.nssquare = 0x33b1;
58391  t.nsuperior = 0x207f;
58392  t.ntilde = 0x00f1;
58393  t.nu = 0x03bd;
58394  t.nuhiragana = 0x306c;
58395  t.nukatakana = 0x30cc;
58396  t.nukatakanahalfwidth = 0xff87;
58397  t.nuktabengali = 0x09bc;
58398  t.nuktadeva = 0x093c;
58399  t.nuktagujarati = 0x0abc;
58400  t.nuktagurmukhi = 0x0a3c;
58401  t.numbersign = 0x0023;
58402  t.numbersignmonospace = 0xff03;
58403  t.numbersignsmall = 0xfe5f;
58404  t.numeralsigngreek = 0x0374;
58405  t.numeralsignlowergreek = 0x0375;
58406  t.numero = 0x2116;
58407  t.nun = 0x05e0;
58408  t.nundagesh = 0xfb40;
58409  t.nundageshhebrew = 0xfb40;
58410  t.nunhebrew = 0x05e0;
58411  t.nvsquare = 0x33b5;
58412  t.nwsquare = 0x33bb;
58413  t.nyabengali = 0x099e;
58414  t.nyadeva = 0x091e;
58415  t.nyagujarati = 0x0a9e;
58416  t.nyagurmukhi = 0x0a1e;
58417  t.o = 0x006f;
58418  t.oacute = 0x00f3;
58419  t.oangthai = 0x0e2d;
58420  t.obarred = 0x0275;
58421  t.obarredcyrillic = 0x04e9;
58422  t.obarreddieresiscyrillic = 0x04eb;
58423  t.obengali = 0x0993;
58424  t.obopomofo = 0x311b;
58425  t.obreve = 0x014f;
58426  t.ocandradeva = 0x0911;
58427  t.ocandragujarati = 0x0a91;
58428  t.ocandravowelsigndeva = 0x0949;
58429  t.ocandravowelsigngujarati = 0x0ac9;
58430  t.ocaron = 0x01d2;
58431  t.ocircle = 0x24de;
58432  t.ocircumflex = 0x00f4;
58433  t.ocircumflexacute = 0x1ed1;
58434  t.ocircumflexdotbelow = 0x1ed9;
58435  t.ocircumflexgrave = 0x1ed3;
58436  t.ocircumflexhookabove = 0x1ed5;
58437  t.ocircumflextilde = 0x1ed7;
58438  t.ocyrillic = 0x043e;
58439  t.odblacute = 0x0151;
58440  t.odblgrave = 0x020d;
58441  t.odeva = 0x0913;
58442  t.odieresis = 0x00f6;
58443  t.odieresiscyrillic = 0x04e7;
58444  t.odotbelow = 0x1ecd;
58445  t.oe = 0x0153;
58446  t.oekorean = 0x315a;
58447  t.ogonek = 0x02db;
58448  t.ogonekcmb = 0x0328;
58449  t.ograve = 0x00f2;
58450  t.ogujarati = 0x0a93;
58451  t.oharmenian = 0x0585;
58452  t.ohiragana = 0x304a;
58453  t.ohookabove = 0x1ecf;
58454  t.ohorn = 0x01a1;
58455  t.ohornacute = 0x1edb;
58456  t.ohorndotbelow = 0x1ee3;
58457  t.ohorngrave = 0x1edd;
58458  t.ohornhookabove = 0x1edf;
58459  t.ohorntilde = 0x1ee1;
58460  t.ohungarumlaut = 0x0151;
58461  t.oi = 0x01a3;
58462  t.oinvertedbreve = 0x020f;
58463  t.okatakana = 0x30aa;
58464  t.okatakanahalfwidth = 0xff75;
58465  t.okorean = 0x3157;
58466  t.olehebrew = 0x05ab;
58467  t.omacron = 0x014d;
58468  t.omacronacute = 0x1e53;
58469  t.omacrongrave = 0x1e51;
58470  t.omdeva = 0x0950;
58471  t.omega = 0x03c9;
58472  t.omega1 = 0x03d6;
58473  t.omegacyrillic = 0x0461;
58474  t.omegalatinclosed = 0x0277;
58475  t.omegaroundcyrillic = 0x047b;
58476  t.omegatitlocyrillic = 0x047d;
58477  t.omegatonos = 0x03ce;
58478  t.omgujarati = 0x0ad0;
58479  t.omicron = 0x03bf;
58480  t.omicrontonos = 0x03cc;
58481  t.omonospace = 0xff4f;
58482  t.one = 0x0031;
58483  t.onearabic = 0x0661;
58484  t.onebengali = 0x09e7;
58485  t.onecircle = 0x2460;
58486  t.onecircleinversesansserif = 0x278a;
58487  t.onedeva = 0x0967;
58488  t.onedotenleader = 0x2024;
58489  t.oneeighth = 0x215b;
58490  t.onefitted = 0xf6dc;
58491  t.onegujarati = 0x0ae7;
58492  t.onegurmukhi = 0x0a67;
58493  t.onehackarabic = 0x0661;
58494  t.onehalf = 0x00bd;
58495  t.onehangzhou = 0x3021;
58496  t.oneideographicparen = 0x3220;
58497  t.oneinferior = 0x2081;
58498  t.onemonospace = 0xff11;
58499  t.onenumeratorbengali = 0x09f4;
58500  t.oneoldstyle = 0xf731;
58501  t.oneparen = 0x2474;
58502  t.oneperiod = 0x2488;
58503  t.onepersian = 0x06f1;
58504  t.onequarter = 0x00bc;
58505  t.oneroman = 0x2170;
58506  t.onesuperior = 0x00b9;
58507  t.onethai = 0x0e51;
58508  t.onethird = 0x2153;
58509  t.oogonek = 0x01eb;
58510  t.oogonekmacron = 0x01ed;
58511  t.oogurmukhi = 0x0a13;
58512  t.oomatragurmukhi = 0x0a4b;
58513  t.oopen = 0x0254;
58514  t.oparen = 0x24aa;
58515  t.openbullet = 0x25e6;
58516  t.option = 0x2325;
58517  t.ordfeminine = 0x00aa;
58518  t.ordmasculine = 0x00ba;
58519  t.orthogonal = 0x221f;
58520  t.oshortdeva = 0x0912;
58521  t.oshortvowelsigndeva = 0x094a;
58522  t.oslash = 0x00f8;
58523  t.oslashacute = 0x01ff;
58524  t.osmallhiragana = 0x3049;
58525  t.osmallkatakana = 0x30a9;
58526  t.osmallkatakanahalfwidth = 0xff6b;
58527  t.ostrokeacute = 0x01ff;
58528  t.osuperior = 0xf6f0;
58529  t.otcyrillic = 0x047f;
58530  t.otilde = 0x00f5;
58531  t.otildeacute = 0x1e4d;
58532  t.otildedieresis = 0x1e4f;
58533  t.oubopomofo = 0x3121;
58534  t.overline = 0x203e;
58535  t.overlinecenterline = 0xfe4a;
58536  t.overlinecmb = 0x0305;
58537  t.overlinedashed = 0xfe49;
58538  t.overlinedblwavy = 0xfe4c;
58539  t.overlinewavy = 0xfe4b;
58540  t.overscore = 0x00af;
58541  t.ovowelsignbengali = 0x09cb;
58542  t.ovowelsigndeva = 0x094b;
58543  t.ovowelsigngujarati = 0x0acb;
58544  t.p = 0x0070;
58545  t.paampssquare = 0x3380;
58546  t.paasentosquare = 0x332b;
58547  t.pabengali = 0x09aa;
58548  t.pacute = 0x1e55;
58549  t.padeva = 0x092a;
58550  t.pagedown = 0x21df;
58551  t.pageup = 0x21de;
58552  t.pagujarati = 0x0aaa;
58553  t.pagurmukhi = 0x0a2a;
58554  t.pahiragana = 0x3071;
58555  t.paiyannoithai = 0x0e2f;
58556  t.pakatakana = 0x30d1;
58557  t.palatalizationcyrilliccmb = 0x0484;
58558  t.palochkacyrillic = 0x04c0;
58559  t.pansioskorean = 0x317f;
58560  t.paragraph = 0x00b6;
58561  t.parallel = 0x2225;
58562  t.parenleft = 0x0028;
58563  t.parenleftaltonearabic = 0xfd3e;
58564  t.parenleftbt = 0xf8ed;
58565  t.parenleftex = 0xf8ec;
58566  t.parenleftinferior = 0x208d;
58567  t.parenleftmonospace = 0xff08;
58568  t.parenleftsmall = 0xfe59;
58569  t.parenleftsuperior = 0x207d;
58570  t.parenlefttp = 0xf8eb;
58571  t.parenleftvertical = 0xfe35;
58572  t.parenright = 0x0029;
58573  t.parenrightaltonearabic = 0xfd3f;
58574  t.parenrightbt = 0xf8f8;
58575  t.parenrightex = 0xf8f7;
58576  t.parenrightinferior = 0x208e;
58577  t.parenrightmonospace = 0xff09;
58578  t.parenrightsmall = 0xfe5a;
58579  t.parenrightsuperior = 0x207e;
58580  t.parenrighttp = 0xf8f6;
58581  t.parenrightvertical = 0xfe36;
58582  t.partialdiff = 0x2202;
58583  t.paseqhebrew = 0x05c0;
58584  t.pashtahebrew = 0x0599;
58585  t.pasquare = 0x33a9;
58586  t.patah = 0x05b7;
58587  t.patah11 = 0x05b7;
58588  t.patah1d = 0x05b7;
58589  t.patah2a = 0x05b7;
58590  t.patahhebrew = 0x05b7;
58591  t.patahnarrowhebrew = 0x05b7;
58592  t.patahquarterhebrew = 0x05b7;
58593  t.patahwidehebrew = 0x05b7;
58594  t.pazerhebrew = 0x05a1;
58595  t.pbopomofo = 0x3106;
58596  t.pcircle = 0x24df;
58597  t.pdotaccent = 0x1e57;
58598  t.pe = 0x05e4;
58599  t.pecyrillic = 0x043f;
58600  t.pedagesh = 0xfb44;
58601  t.pedageshhebrew = 0xfb44;
58602  t.peezisquare = 0x333b;
58603  t.pefinaldageshhebrew = 0xfb43;
58604  t.peharabic = 0x067e;
58605  t.peharmenian = 0x057a;
58606  t.pehebrew = 0x05e4;
58607  t.pehfinalarabic = 0xfb57;
58608  t.pehinitialarabic = 0xfb58;
58609  t.pehiragana = 0x307a;
58610  t.pehmedialarabic = 0xfb59;
58611  t.pekatakana = 0x30da;
58612  t.pemiddlehookcyrillic = 0x04a7;
58613  t.perafehebrew = 0xfb4e;
58614  t.percent = 0x0025;
58615  t.percentarabic = 0x066a;
58616  t.percentmonospace = 0xff05;
58617  t.percentsmall = 0xfe6a;
58618  t.period = 0x002e;
58619  t.periodarmenian = 0x0589;
58620  t.periodcentered = 0x00b7;
58621  t.periodhalfwidth = 0xff61;
58622  t.periodinferior = 0xf6e7;
58623  t.periodmonospace = 0xff0e;
58624  t.periodsmall = 0xfe52;
58625  t.periodsuperior = 0xf6e8;
58626  t.perispomenigreekcmb = 0x0342;
58627  t.perpendicular = 0x22a5;
58628  t.perthousand = 0x2030;
58629  t.peseta = 0x20a7;
58630  t.pfsquare = 0x338a;
58631  t.phabengali = 0x09ab;
58632  t.phadeva = 0x092b;
58633  t.phagujarati = 0x0aab;
58634  t.phagurmukhi = 0x0a2b;
58635  t.phi = 0x03c6;
58636  t.phi1 = 0x03d5;
58637  t.phieuphacirclekorean = 0x327a;
58638  t.phieuphaparenkorean = 0x321a;
58639  t.phieuphcirclekorean = 0x326c;
58640  t.phieuphkorean = 0x314d;
58641  t.phieuphparenkorean = 0x320c;
58642  t.philatin = 0x0278;
58643  t.phinthuthai = 0x0e3a;
58644  t.phisymbolgreek = 0x03d5;
58645  t.phook = 0x01a5;
58646  t.phophanthai = 0x0e1e;
58647  t.phophungthai = 0x0e1c;
58648  t.phosamphaothai = 0x0e20;
58649  t.pi = 0x03c0;
58650  t.pieupacirclekorean = 0x3273;
58651  t.pieupaparenkorean = 0x3213;
58652  t.pieupcieuckorean = 0x3176;
58653  t.pieupcirclekorean = 0x3265;
58654  t.pieupkiyeokkorean = 0x3172;
58655  t.pieupkorean = 0x3142;
58656  t.pieupparenkorean = 0x3205;
58657  t.pieupsioskiyeokkorean = 0x3174;
58658  t.pieupsioskorean = 0x3144;
58659  t.pieupsiostikeutkorean = 0x3175;
58660  t.pieupthieuthkorean = 0x3177;
58661  t.pieuptikeutkorean = 0x3173;
58662  t.pihiragana = 0x3074;
58663  t.pikatakana = 0x30d4;
58664  t.pisymbolgreek = 0x03d6;
58665  t.piwrarmenian = 0x0583;
58666  t.planckover2pi = 0x210f;
58667  t.planckover2pi1 = 0x210f;
58668  t.plus = 0x002b;
58669  t.plusbelowcmb = 0x031f;
58670  t.pluscircle = 0x2295;
58671  t.plusminus = 0x00b1;
58672  t.plusmod = 0x02d6;
58673  t.plusmonospace = 0xff0b;
58674  t.plussmall = 0xfe62;
58675  t.plussuperior = 0x207a;
58676  t.pmonospace = 0xff50;
58677  t.pmsquare = 0x33d8;
58678  t.pohiragana = 0x307d;
58679  t.pointingindexdownwhite = 0x261f;
58680  t.pointingindexleftwhite = 0x261c;
58681  t.pointingindexrightwhite = 0x261e;
58682  t.pointingindexupwhite = 0x261d;
58683  t.pokatakana = 0x30dd;
58684  t.poplathai = 0x0e1b;
58685  t.postalmark = 0x3012;
58686  t.postalmarkface = 0x3020;
58687  t.pparen = 0x24ab;
58688  t.precedes = 0x227a;
58689  t.prescription = 0x211e;
58690  t.primemod = 0x02b9;
58691  t.primereversed = 0x2035;
58692  t.product = 0x220f;
58693  t.projective = 0x2305;
58694  t.prolongedkana = 0x30fc;
58695  t.propellor = 0x2318;
58696  t.propersubset = 0x2282;
58697  t.propersuperset = 0x2283;
58698  t.proportion = 0x2237;
58699  t.proportional = 0x221d;
58700  t.psi = 0x03c8;
58701  t.psicyrillic = 0x0471;
58702  t.psilipneumatacyrilliccmb = 0x0486;
58703  t.pssquare = 0x33b0;
58704  t.puhiragana = 0x3077;
58705  t.pukatakana = 0x30d7;
58706  t.pvsquare = 0x33b4;
58707  t.pwsquare = 0x33ba;
58708  t.q = 0x0071;
58709  t.qadeva = 0x0958;
58710  t.qadmahebrew = 0x05a8;
58711  t.qafarabic = 0x0642;
58712  t.qaffinalarabic = 0xfed6;
58713  t.qafinitialarabic = 0xfed7;
58714  t.qafmedialarabic = 0xfed8;
58715  t.qamats = 0x05b8;
58716  t.qamats10 = 0x05b8;
58717  t.qamats1a = 0x05b8;
58718  t.qamats1c = 0x05b8;
58719  t.qamats27 = 0x05b8;
58720  t.qamats29 = 0x05b8;
58721  t.qamats33 = 0x05b8;
58722  t.qamatsde = 0x05b8;
58723  t.qamatshebrew = 0x05b8;
58724  t.qamatsnarrowhebrew = 0x05b8;
58725  t.qamatsqatanhebrew = 0x05b8;
58726  t.qamatsqatannarrowhebrew = 0x05b8;
58727  t.qamatsqatanquarterhebrew = 0x05b8;
58728  t.qamatsqatanwidehebrew = 0x05b8;
58729  t.qamatsquarterhebrew = 0x05b8;
58730  t.qamatswidehebrew = 0x05b8;
58731  t.qarneyparahebrew = 0x059f;
58732  t.qbopomofo = 0x3111;
58733  t.qcircle = 0x24e0;
58734  t.qhook = 0x02a0;
58735  t.qmonospace = 0xff51;
58736  t.qof = 0x05e7;
58737  t.qofdagesh = 0xfb47;
58738  t.qofdageshhebrew = 0xfb47;
58739  t.qofhebrew = 0x05e7;
58740  t.qparen = 0x24ac;
58741  t.quarternote = 0x2669;
58742  t.qubuts = 0x05bb;
58743  t.qubuts18 = 0x05bb;
58744  t.qubuts25 = 0x05bb;
58745  t.qubuts31 = 0x05bb;
58746  t.qubutshebrew = 0x05bb;
58747  t.qubutsnarrowhebrew = 0x05bb;
58748  t.qubutsquarterhebrew = 0x05bb;
58749  t.qubutswidehebrew = 0x05bb;
58750  t.question = 0x003f;
58751  t.questionarabic = 0x061f;
58752  t.questionarmenian = 0x055e;
58753  t.questiondown = 0x00bf;
58754  t.questiondownsmall = 0xf7bf;
58755  t.questiongreek = 0x037e;
58756  t.questionmonospace = 0xff1f;
58757  t.questionsmall = 0xf73f;
58758  t.quotedbl = 0x0022;
58759  t.quotedblbase = 0x201e;
58760  t.quotedblleft = 0x201c;
58761  t.quotedblmonospace = 0xff02;
58762  t.quotedblprime = 0x301e;
58763  t.quotedblprimereversed = 0x301d;
58764  t.quotedblright = 0x201d;
58765  t.quoteleft = 0x2018;
58766  t.quoteleftreversed = 0x201b;
58767  t.quotereversed = 0x201b;
58768  t.quoteright = 0x2019;
58769  t.quoterightn = 0x0149;
58770  t.quotesinglbase = 0x201a;
58771  t.quotesingle = 0x0027;
58772  t.quotesinglemonospace = 0xff07;
58773  t.r = 0x0072;
58774  t.raarmenian = 0x057c;
58775  t.rabengali = 0x09b0;
58776  t.racute = 0x0155;
58777  t.radeva = 0x0930;
58778  t.radical = 0x221a;
58779  t.radicalex = 0xf8e5;
58780  t.radoverssquare = 0x33ae;
58781  t.radoverssquaredsquare = 0x33af;
58782  t.radsquare = 0x33ad;
58783  t.rafe = 0x05bf;
58784  t.rafehebrew = 0x05bf;
58785  t.ragujarati = 0x0ab0;
58786  t.ragurmukhi = 0x0a30;
58787  t.rahiragana = 0x3089;
58788  t.rakatakana = 0x30e9;
58789  t.rakatakanahalfwidth = 0xff97;
58790  t.ralowerdiagonalbengali = 0x09f1;
58791  t.ramiddlediagonalbengali = 0x09f0;
58792  t.ramshorn = 0x0264;
58793  t.ratio = 0x2236;
58794  t.rbopomofo = 0x3116;
58795  t.rcaron = 0x0159;
58796  t.rcedilla = 0x0157;
58797  t.rcircle = 0x24e1;
58798  t.rcommaaccent = 0x0157;
58799  t.rdblgrave = 0x0211;
58800  t.rdotaccent = 0x1e59;
58801  t.rdotbelow = 0x1e5b;
58802  t.rdotbelowmacron = 0x1e5d;
58803  t.referencemark = 0x203b;
58804  t.reflexsubset = 0x2286;
58805  t.reflexsuperset = 0x2287;
58806  t.registered = 0x00ae;
58807  t.registersans = 0xf8e8;
58808  t.registerserif = 0xf6da;
58809  t.reharabic = 0x0631;
58810  t.reharmenian = 0x0580;
58811  t.rehfinalarabic = 0xfeae;
58812  t.rehiragana = 0x308c;
58813  t.rekatakana = 0x30ec;
58814  t.rekatakanahalfwidth = 0xff9a;
58815  t.resh = 0x05e8;
58816  t.reshdageshhebrew = 0xfb48;
58817  t.reshhebrew = 0x05e8;
58818  t.reversedtilde = 0x223d;
58819  t.reviahebrew = 0x0597;
58820  t.reviamugrashhebrew = 0x0597;
58821  t.revlogicalnot = 0x2310;
58822  t.rfishhook = 0x027e;
58823  t.rfishhookreversed = 0x027f;
58824  t.rhabengali = 0x09dd;
58825  t.rhadeva = 0x095d;
58826  t.rho = 0x03c1;
58827  t.rhook = 0x027d;
58828  t.rhookturned = 0x027b;
58829  t.rhookturnedsuperior = 0x02b5;
58830  t.rhosymbolgreek = 0x03f1;
58831  t.rhotichookmod = 0x02de;
58832  t.rieulacirclekorean = 0x3271;
58833  t.rieulaparenkorean = 0x3211;
58834  t.rieulcirclekorean = 0x3263;
58835  t.rieulhieuhkorean = 0x3140;
58836  t.rieulkiyeokkorean = 0x313a;
58837  t.rieulkiyeoksioskorean = 0x3169;
58838  t.rieulkorean = 0x3139;
58839  t.rieulmieumkorean = 0x313b;
58840  t.rieulpansioskorean = 0x316c;
58841  t.rieulparenkorean = 0x3203;
58842  t.rieulphieuphkorean = 0x313f;
58843  t.rieulpieupkorean = 0x313c;
58844  t.rieulpieupsioskorean = 0x316b;
58845  t.rieulsioskorean = 0x313d;
58846  t.rieulthieuthkorean = 0x313e;
58847  t.rieultikeutkorean = 0x316a;
58848  t.rieulyeorinhieuhkorean = 0x316d;
58849  t.rightangle = 0x221f;
58850  t.righttackbelowcmb = 0x0319;
58851  t.righttriangle = 0x22bf;
58852  t.rihiragana = 0x308a;
58853  t.rikatakana = 0x30ea;
58854  t.rikatakanahalfwidth = 0xff98;
58855  t.ring = 0x02da;
58856  t.ringbelowcmb = 0x0325;
58857  t.ringcmb = 0x030a;
58858  t.ringhalfleft = 0x02bf;
58859  t.ringhalfleftarmenian = 0x0559;
58860  t.ringhalfleftbelowcmb = 0x031c;
58861  t.ringhalfleftcentered = 0x02d3;
58862  t.ringhalfright = 0x02be;
58863  t.ringhalfrightbelowcmb = 0x0339;
58864  t.ringhalfrightcentered = 0x02d2;
58865  t.rinvertedbreve = 0x0213;
58866  t.rittorusquare = 0x3351;
58867  t.rlinebelow = 0x1e5f;
58868  t.rlongleg = 0x027c;
58869  t.rlonglegturned = 0x027a;
58870  t.rmonospace = 0xff52;
58871  t.rohiragana = 0x308d;
58872  t.rokatakana = 0x30ed;
58873  t.rokatakanahalfwidth = 0xff9b;
58874  t.roruathai = 0x0e23;
58875  t.rparen = 0x24ad;
58876  t.rrabengali = 0x09dc;
58877  t.rradeva = 0x0931;
58878  t.rragurmukhi = 0x0a5c;
58879  t.rreharabic = 0x0691;
58880  t.rrehfinalarabic = 0xfb8d;
58881  t.rrvocalicbengali = 0x09e0;
58882  t.rrvocalicdeva = 0x0960;
58883  t.rrvocalicgujarati = 0x0ae0;
58884  t.rrvocalicvowelsignbengali = 0x09c4;
58885  t.rrvocalicvowelsigndeva = 0x0944;
58886  t.rrvocalicvowelsigngujarati = 0x0ac4;
58887  t.rsuperior = 0xf6f1;
58888  t.rtblock = 0x2590;
58889  t.rturned = 0x0279;
58890  t.rturnedsuperior = 0x02b4;
58891  t.ruhiragana = 0x308b;
58892  t.rukatakana = 0x30eb;
58893  t.rukatakanahalfwidth = 0xff99;
58894  t.rupeemarkbengali = 0x09f2;
58895  t.rupeesignbengali = 0x09f3;
58896  t.rupiah = 0xf6dd;
58897  t.ruthai = 0x0e24;
58898  t.rvocalicbengali = 0x098b;
58899  t.rvocalicdeva = 0x090b;
58900  t.rvocalicgujarati = 0x0a8b;
58901  t.rvocalicvowelsignbengali = 0x09c3;
58902  t.rvocalicvowelsigndeva = 0x0943;
58903  t.rvocalicvowelsigngujarati = 0x0ac3;
58904  t.s = 0x0073;
58905  t.sabengali = 0x09b8;
58906  t.sacute = 0x015b;
58907  t.sacutedotaccent = 0x1e65;
58908  t.sadarabic = 0x0635;
58909  t.sadeva = 0x0938;
58910  t.sadfinalarabic = 0xfeba;
58911  t.sadinitialarabic = 0xfebb;
58912  t.sadmedialarabic = 0xfebc;
58913  t.sagujarati = 0x0ab8;
58914  t.sagurmukhi = 0x0a38;
58915  t.sahiragana = 0x3055;
58916  t.sakatakana = 0x30b5;
58917  t.sakatakanahalfwidth = 0xff7b;
58918  t.sallallahoualayhewasallamarabic = 0xfdfa;
58919  t.samekh = 0x05e1;
58920  t.samekhdagesh = 0xfb41;
58921  t.samekhdageshhebrew = 0xfb41;
58922  t.samekhhebrew = 0x05e1;
58923  t.saraaathai = 0x0e32;
58924  t.saraaethai = 0x0e41;
58925  t.saraaimaimalaithai = 0x0e44;
58926  t.saraaimaimuanthai = 0x0e43;
58927  t.saraamthai = 0x0e33;
58928  t.saraathai = 0x0e30;
58929  t.saraethai = 0x0e40;
58930  t.saraiileftthai = 0xf886;
58931  t.saraiithai = 0x0e35;
58932  t.saraileftthai = 0xf885;
58933  t.saraithai = 0x0e34;
58934  t.saraothai = 0x0e42;
58935  t.saraueeleftthai = 0xf888;
58936  t.saraueethai = 0x0e37;
58937  t.saraueleftthai = 0xf887;
58938  t.sarauethai = 0x0e36;
58939  t.sarauthai = 0x0e38;
58940  t.sarauuthai = 0x0e39;
58941  t.sbopomofo = 0x3119;
58942  t.scaron = 0x0161;
58943  t.scarondotaccent = 0x1e67;
58944  t.scedilla = 0x015f;
58945  t.schwa = 0x0259;
58946  t.schwacyrillic = 0x04d9;
58947  t.schwadieresiscyrillic = 0x04db;
58948  t.schwahook = 0x025a;
58949  t.scircle = 0x24e2;
58950  t.scircumflex = 0x015d;
58951  t.scommaaccent = 0x0219;
58952  t.sdotaccent = 0x1e61;
58953  t.sdotbelow = 0x1e63;
58954  t.sdotbelowdotaccent = 0x1e69;
58955  t.seagullbelowcmb = 0x033c;
58956  t.second = 0x2033;
58957  t.secondtonechinese = 0x02ca;
58958  t.section = 0x00a7;
58959  t.seenarabic = 0x0633;
58960  t.seenfinalarabic = 0xfeb2;
58961  t.seeninitialarabic = 0xfeb3;
58962  t.seenmedialarabic = 0xfeb4;
58963  t.segol = 0x05b6;
58964  t.segol13 = 0x05b6;
58965  t.segol1f = 0x05b6;
58966  t.segol2c = 0x05b6;
58967  t.segolhebrew = 0x05b6;
58968  t.segolnarrowhebrew = 0x05b6;
58969  t.segolquarterhebrew = 0x05b6;
58970  t.segoltahebrew = 0x0592;
58971  t.segolwidehebrew = 0x05b6;
58972  t.seharmenian = 0x057d;
58973  t.sehiragana = 0x305b;
58974  t.sekatakana = 0x30bb;
58975  t.sekatakanahalfwidth = 0xff7e;
58976  t.semicolon = 0x003b;
58977  t.semicolonarabic = 0x061b;
58978  t.semicolonmonospace = 0xff1b;
58979  t.semicolonsmall = 0xfe54;
58980  t.semivoicedmarkkana = 0x309c;
58981  t.semivoicedmarkkanahalfwidth = 0xff9f;
58982  t.sentisquare = 0x3322;
58983  t.sentosquare = 0x3323;
58984  t.seven = 0x0037;
58985  t.sevenarabic = 0x0667;
58986  t.sevenbengali = 0x09ed;
58987  t.sevencircle = 0x2466;
58988  t.sevencircleinversesansserif = 0x2790;
58989  t.sevendeva = 0x096d;
58990  t.seveneighths = 0x215e;
58991  t.sevengujarati = 0x0aed;
58992  t.sevengurmukhi = 0x0a6d;
58993  t.sevenhackarabic = 0x0667;
58994  t.sevenhangzhou = 0x3027;
58995  t.sevenideographicparen = 0x3226;
58996  t.seveninferior = 0x2087;
58997  t.sevenmonospace = 0xff17;
58998  t.sevenoldstyle = 0xf737;
58999  t.sevenparen = 0x247a;
59000  t.sevenperiod = 0x248e;
59001  t.sevenpersian = 0x06f7;
59002  t.sevenroman = 0x2176;
59003  t.sevensuperior = 0x2077;
59004  t.seventeencircle = 0x2470;
59005  t.seventeenparen = 0x2484;
59006  t.seventeenperiod = 0x2498;
59007  t.seventhai = 0x0e57;
59008  t.sfthyphen = 0x00ad;
59009  t.shaarmenian = 0x0577;
59010  t.shabengali = 0x09b6;
59011  t.shacyrillic = 0x0448;
59012  t.shaddaarabic = 0x0651;
59013  t.shaddadammaarabic = 0xfc61;
59014  t.shaddadammatanarabic = 0xfc5e;
59015  t.shaddafathaarabic = 0xfc60;
59016  t.shaddakasraarabic = 0xfc62;
59017  t.shaddakasratanarabic = 0xfc5f;
59018  t.shade = 0x2592;
59019  t.shadedark = 0x2593;
59020  t.shadelight = 0x2591;
59021  t.shademedium = 0x2592;
59022  t.shadeva = 0x0936;
59023  t.shagujarati = 0x0ab6;
59024  t.shagurmukhi = 0x0a36;
59025  t.shalshelethebrew = 0x0593;
59026  t.shbopomofo = 0x3115;
59027  t.shchacyrillic = 0x0449;
59028  t.sheenarabic = 0x0634;
59029  t.sheenfinalarabic = 0xfeb6;
59030  t.sheeninitialarabic = 0xfeb7;
59031  t.sheenmedialarabic = 0xfeb8;
59032  t.sheicoptic = 0x03e3;
59033  t.sheqel = 0x20aa;
59034  t.sheqelhebrew = 0x20aa;
59035  t.sheva = 0x05b0;
59036  t.sheva115 = 0x05b0;
59037  t.sheva15 = 0x05b0;
59038  t.sheva22 = 0x05b0;
59039  t.sheva2e = 0x05b0;
59040  t.shevahebrew = 0x05b0;
59041  t.shevanarrowhebrew = 0x05b0;
59042  t.shevaquarterhebrew = 0x05b0;
59043  t.shevawidehebrew = 0x05b0;
59044  t.shhacyrillic = 0x04bb;
59045  t.shimacoptic = 0x03ed;
59046  t.shin = 0x05e9;
59047  t.shindagesh = 0xfb49;
59048  t.shindageshhebrew = 0xfb49;
59049  t.shindageshshindot = 0xfb2c;
59050  t.shindageshshindothebrew = 0xfb2c;
59051  t.shindageshsindot = 0xfb2d;
59052  t.shindageshsindothebrew = 0xfb2d;
59053  t.shindothebrew = 0x05c1;
59054  t.shinhebrew = 0x05e9;
59055  t.shinshindot = 0xfb2a;
59056  t.shinshindothebrew = 0xfb2a;
59057  t.shinsindot = 0xfb2b;
59058  t.shinsindothebrew = 0xfb2b;
59059  t.shook = 0x0282;
59060  t.sigma = 0x03c3;
59061  t.sigma1 = 0x03c2;
59062  t.sigmafinal = 0x03c2;
59063  t.sigmalunatesymbolgreek = 0x03f2;
59064  t.sihiragana = 0x3057;
59065  t.sikatakana = 0x30b7;
59066  t.sikatakanahalfwidth = 0xff7c;
59067  t.siluqhebrew = 0x05bd;
59068  t.siluqlefthebrew = 0x05bd;
59069  t.similar = 0x223c;
59070  t.sindothebrew = 0x05c2;
59071  t.siosacirclekorean = 0x3274;
59072  t.siosaparenkorean = 0x3214;
59073  t.sioscieuckorean = 0x317e;
59074  t.sioscirclekorean = 0x3266;
59075  t.sioskiyeokkorean = 0x317a;
59076  t.sioskorean = 0x3145;
59077  t.siosnieunkorean = 0x317b;
59078  t.siosparenkorean = 0x3206;
59079  t.siospieupkorean = 0x317d;
59080  t.siostikeutkorean = 0x317c;
59081  t.six = 0x0036;
59082  t.sixarabic = 0x0666;
59083  t.sixbengali = 0x09ec;
59084  t.sixcircle = 0x2465;
59085  t.sixcircleinversesansserif = 0x278f;
59086  t.sixdeva = 0x096c;
59087  t.sixgujarati = 0x0aec;
59088  t.sixgurmukhi = 0x0a6c;
59089  t.sixhackarabic = 0x0666;
59090  t.sixhangzhou = 0x3026;
59091  t.sixideographicparen = 0x3225;
59092  t.sixinferior = 0x2086;
59093  t.sixmonospace = 0xff16;
59094  t.sixoldstyle = 0xf736;
59095  t.sixparen = 0x2479;
59096  t.sixperiod = 0x248d;
59097  t.sixpersian = 0x06f6;
59098  t.sixroman = 0x2175;
59099  t.sixsuperior = 0x2076;
59100  t.sixteencircle = 0x246f;
59101  t.sixteencurrencydenominatorbengali = 0x09f9;
59102  t.sixteenparen = 0x2483;
59103  t.sixteenperiod = 0x2497;
59104  t.sixthai = 0x0e56;
59105  t.slash = 0x002f;
59106  t.slashmonospace = 0xff0f;
59107  t.slong = 0x017f;
59108  t.slongdotaccent = 0x1e9b;
59109  t.smileface = 0x263a;
59110  t.smonospace = 0xff53;
59111  t.sofpasuqhebrew = 0x05c3;
59112  t.softhyphen = 0x00ad;
59113  t.softsigncyrillic = 0x044c;
59114  t.sohiragana = 0x305d;
59115  t.sokatakana = 0x30bd;
59116  t.sokatakanahalfwidth = 0xff7f;
59117  t.soliduslongoverlaycmb = 0x0338;
59118  t.solidusshortoverlaycmb = 0x0337;
59119  t.sorusithai = 0x0e29;
59120  t.sosalathai = 0x0e28;
59121  t.sosothai = 0x0e0b;
59122  t.sosuathai = 0x0e2a;
59123  t.space = 0x0020;
59124  t.spacehackarabic = 0x0020;
59125  t.spade = 0x2660;
59126  t.spadesuitblack = 0x2660;
59127  t.spadesuitwhite = 0x2664;
59128  t.sparen = 0x24ae;
59129  t.squarebelowcmb = 0x033b;
59130  t.squarecc = 0x33c4;
59131  t.squarecm = 0x339d;
59132  t.squarediagonalcrosshatchfill = 0x25a9;
59133  t.squarehorizontalfill = 0x25a4;
59134  t.squarekg = 0x338f;
59135  t.squarekm = 0x339e;
59136  t.squarekmcapital = 0x33ce;
59137  t.squareln = 0x33d1;
59138  t.squarelog = 0x33d2;
59139  t.squaremg = 0x338e;
59140  t.squaremil = 0x33d5;
59141  t.squaremm = 0x339c;
59142  t.squaremsquared = 0x33a1;
59143  t.squareorthogonalcrosshatchfill = 0x25a6;
59144  t.squareupperlefttolowerrightfill = 0x25a7;
59145  t.squareupperrighttolowerleftfill = 0x25a8;
59146  t.squareverticalfill = 0x25a5;
59147  t.squarewhitewithsmallblack = 0x25a3;
59148  t.srsquare = 0x33db;
59149  t.ssabengali = 0x09b7;
59150  t.ssadeva = 0x0937;
59151  t.ssagujarati = 0x0ab7;
59152  t.ssangcieuckorean = 0x3149;
59153  t.ssanghieuhkorean = 0x3185;
59154  t.ssangieungkorean = 0x3180;
59155  t.ssangkiyeokkorean = 0x3132;
59156  t.ssangnieunkorean = 0x3165;
59157  t.ssangpieupkorean = 0x3143;
59158  t.ssangsioskorean = 0x3146;
59159  t.ssangtikeutkorean = 0x3138;
59160  t.ssuperior = 0xf6f2;
59161  t.sterling = 0x00a3;
59162  t.sterlingmonospace = 0xffe1;
59163  t.strokelongoverlaycmb = 0x0336;
59164  t.strokeshortoverlaycmb = 0x0335;
59165  t.subset = 0x2282;
59166  t.subsetnotequal = 0x228a;
59167  t.subsetorequal = 0x2286;
59168  t.succeeds = 0x227b;
59169  t.suchthat = 0x220b;
59170  t.suhiragana = 0x3059;
59171  t.sukatakana = 0x30b9;
59172  t.sukatakanahalfwidth = 0xff7d;
59173  t.sukunarabic = 0x0652;
59174  t.summation = 0x2211;
59175  t.sun = 0x263c;
59176  t.superset = 0x2283;
59177  t.supersetnotequal = 0x228b;
59178  t.supersetorequal = 0x2287;
59179  t.svsquare = 0x33dc;
59180  t.syouwaerasquare = 0x337c;
59181  t.t = 0x0074;
59182  t.tabengali = 0x09a4;
59183  t.tackdown = 0x22a4;
59184  t.tackleft = 0x22a3;
59185  t.tadeva = 0x0924;
59186  t.tagujarati = 0x0aa4;
59187  t.tagurmukhi = 0x0a24;
59188  t.taharabic = 0x0637;
59189  t.tahfinalarabic = 0xfec2;
59190  t.tahinitialarabic = 0xfec3;
59191  t.tahiragana = 0x305f;
59192  t.tahmedialarabic = 0xfec4;
59193  t.taisyouerasquare = 0x337d;
59194  t.takatakana = 0x30bf;
59195  t.takatakanahalfwidth = 0xff80;
59196  t.tatweelarabic = 0x0640;
59197  t.tau = 0x03c4;
59198  t.tav = 0x05ea;
59199  t.tavdages = 0xfb4a;
59200  t.tavdagesh = 0xfb4a;
59201  t.tavdageshhebrew = 0xfb4a;
59202  t.tavhebrew = 0x05ea;
59203  t.tbar = 0x0167;
59204  t.tbopomofo = 0x310a;
59205  t.tcaron = 0x0165;
59206  t.tccurl = 0x02a8;
59207  t.tcedilla = 0x0163;
59208  t.tcheharabic = 0x0686;
59209  t.tchehfinalarabic = 0xfb7b;
59210  t.tchehinitialarabic = 0xfb7c;
59211  t.tchehmedialarabic = 0xfb7d;
59212  t.tcircle = 0x24e3;
59213  t.tcircumflexbelow = 0x1e71;
59214  t.tcommaaccent = 0x0163;
59215  t.tdieresis = 0x1e97;
59216  t.tdotaccent = 0x1e6b;
59217  t.tdotbelow = 0x1e6d;
59218  t.tecyrillic = 0x0442;
59219  t.tedescendercyrillic = 0x04ad;
59220  t.teharabic = 0x062a;
59221  t.tehfinalarabic = 0xfe96;
59222  t.tehhahinitialarabic = 0xfca2;
59223  t.tehhahisolatedarabic = 0xfc0c;
59224  t.tehinitialarabic = 0xfe97;
59225  t.tehiragana = 0x3066;
59226  t.tehjeeminitialarabic = 0xfca1;
59227  t.tehjeemisolatedarabic = 0xfc0b;
59228  t.tehmarbutaarabic = 0x0629;
59229  t.tehmarbutafinalarabic = 0xfe94;
59230  t.tehmedialarabic = 0xfe98;
59231  t.tehmeeminitialarabic = 0xfca4;
59232  t.tehmeemisolatedarabic = 0xfc0e;
59233  t.tehnoonfinalarabic = 0xfc73;
59234  t.tekatakana = 0x30c6;
59235  t.tekatakanahalfwidth = 0xff83;
59236  t.telephone = 0x2121;
59237  t.telephoneblack = 0x260e;
59238  t.telishagedolahebrew = 0x05a0;
59239  t.telishaqetanahebrew = 0x05a9;
59240  t.tencircle = 0x2469;
59241  t.tenideographicparen = 0x3229;
59242  t.tenparen = 0x247d;
59243  t.tenperiod = 0x2491;
59244  t.tenroman = 0x2179;
59245  t.tesh = 0x02a7;
59246  t.tet = 0x05d8;
59247  t.tetdagesh = 0xfb38;
59248  t.tetdageshhebrew = 0xfb38;
59249  t.tethebrew = 0x05d8;
59250  t.tetsecyrillic = 0x04b5;
59251  t.tevirhebrew = 0x059b;
59252  t.tevirlefthebrew = 0x059b;
59253  t.thabengali = 0x09a5;
59254  t.thadeva = 0x0925;
59255  t.thagujarati = 0x0aa5;
59256  t.thagurmukhi = 0x0a25;
59257  t.thalarabic = 0x0630;
59258  t.thalfinalarabic = 0xfeac;
59259  t.thanthakhatlowleftthai = 0xf898;
59260  t.thanthakhatlowrightthai = 0xf897;
59261  t.thanthakhatthai = 0x0e4c;
59262  t.thanthakhatupperleftthai = 0xf896;
59263  t.theharabic = 0x062b;
59264  t.thehfinalarabic = 0xfe9a;
59265  t.thehinitialarabic = 0xfe9b;
59266  t.thehmedialarabic = 0xfe9c;
59267  t.thereexists = 0x2203;
59268  t.therefore = 0x2234;
59269  t.theta = 0x03b8;
59270  t.theta1 = 0x03d1;
59271  t.thetasymbolgreek = 0x03d1;
59272  t.thieuthacirclekorean = 0x3279;
59273  t.thieuthaparenkorean = 0x3219;
59274  t.thieuthcirclekorean = 0x326b;
59275  t.thieuthkorean = 0x314c;
59276  t.thieuthparenkorean = 0x320b;
59277  t.thirteencircle = 0x246c;
59278  t.thirteenparen = 0x2480;
59279  t.thirteenperiod = 0x2494;
59280  t.thonangmonthothai = 0x0e11;
59281  t.thook = 0x01ad;
59282  t.thophuthaothai = 0x0e12;
59283  t.thorn = 0x00fe;
59284  t.thothahanthai = 0x0e17;
59285  t.thothanthai = 0x0e10;
59286  t.thothongthai = 0x0e18;
59287  t.thothungthai = 0x0e16;
59288  t.thousandcyrillic = 0x0482;
59289  t.thousandsseparatorarabic = 0x066c;
59290  t.thousandsseparatorpersian = 0x066c;
59291  t.three = 0x0033;
59292  t.threearabic = 0x0663;
59293  t.threebengali = 0x09e9;
59294  t.threecircle = 0x2462;
59295  t.threecircleinversesansserif = 0x278c;
59296  t.threedeva = 0x0969;
59297  t.threeeighths = 0x215c;
59298  t.threegujarati = 0x0ae9;
59299  t.threegurmukhi = 0x0a69;
59300  t.threehackarabic = 0x0663;
59301  t.threehangzhou = 0x3023;
59302  t.threeideographicparen = 0x3222;
59303  t.threeinferior = 0x2083;
59304  t.threemonospace = 0xff13;
59305  t.threenumeratorbengali = 0x09f6;
59306  t.threeoldstyle = 0xf733;
59307  t.threeparen = 0x2476;
59308  t.threeperiod = 0x248a;
59309  t.threepersian = 0x06f3;
59310  t.threequarters = 0x00be;
59311  t.threequartersemdash = 0xf6de;
59312  t.threeroman = 0x2172;
59313  t.threesuperior = 0x00b3;
59314  t.threethai = 0x0e53;
59315  t.thzsquare = 0x3394;
59316  t.tihiragana = 0x3061;
59317  t.tikatakana = 0x30c1;
59318  t.tikatakanahalfwidth = 0xff81;
59319  t.tikeutacirclekorean = 0x3270;
59320  t.tikeutaparenkorean = 0x3210;
59321  t.tikeutcirclekorean = 0x3262;
59322  t.tikeutkorean = 0x3137;
59323  t.tikeutparenkorean = 0x3202;
59324  t.tilde = 0x02dc;
59325  t.tildebelowcmb = 0x0330;
59326  t.tildecmb = 0x0303;
59327  t.tildecomb = 0x0303;
59328  t.tildedoublecmb = 0x0360;
59329  t.tildeoperator = 0x223c;
59330  t.tildeoverlaycmb = 0x0334;
59331  t.tildeverticalcmb = 0x033e;
59332  t.timescircle = 0x2297;
59333  t.tipehahebrew = 0x0596;
59334  t.tipehalefthebrew = 0x0596;
59335  t.tippigurmukhi = 0x0a70;
59336  t.titlocyrilliccmb = 0x0483;
59337  t.tiwnarmenian = 0x057f;
59338  t.tlinebelow = 0x1e6f;
59339  t.tmonospace = 0xff54;
59340  t.toarmenian = 0x0569;
59341  t.tohiragana = 0x3068;
59342  t.tokatakana = 0x30c8;
59343  t.tokatakanahalfwidth = 0xff84;
59344  t.tonebarextrahighmod = 0x02e5;
59345  t.tonebarextralowmod = 0x02e9;
59346  t.tonebarhighmod = 0x02e6;
59347  t.tonebarlowmod = 0x02e8;
59348  t.tonebarmidmod = 0x02e7;
59349  t.tonefive = 0x01bd;
59350  t.tonesix = 0x0185;
59351  t.tonetwo = 0x01a8;
59352  t.tonos = 0x0384;
59353  t.tonsquare = 0x3327;
59354  t.topatakthai = 0x0e0f;
59355  t.tortoiseshellbracketleft = 0x3014;
59356  t.tortoiseshellbracketleftsmall = 0xfe5d;
59357  t.tortoiseshellbracketleftvertical = 0xfe39;
59358  t.tortoiseshellbracketright = 0x3015;
59359  t.tortoiseshellbracketrightsmall = 0xfe5e;
59360  t.tortoiseshellbracketrightvertical = 0xfe3a;
59361  t.totaothai = 0x0e15;
59362  t.tpalatalhook = 0x01ab;
59363  t.tparen = 0x24af;
59364  t.trademark = 0x2122;
59365  t.trademarksans = 0xf8ea;
59366  t.trademarkserif = 0xf6db;
59367  t.tretroflexhook = 0x0288;
59368  t.triagdn = 0x25bc;
59369  t.triaglf = 0x25c4;
59370  t.triagrt = 0x25ba;
59371  t.triagup = 0x25b2;
59372  t.ts = 0x02a6;
59373  t.tsadi = 0x05e6;
59374  t.tsadidagesh = 0xfb46;
59375  t.tsadidageshhebrew = 0xfb46;
59376  t.tsadihebrew = 0x05e6;
59377  t.tsecyrillic = 0x0446;
59378  t.tsere = 0x05b5;
59379  t.tsere12 = 0x05b5;
59380  t.tsere1e = 0x05b5;
59381  t.tsere2b = 0x05b5;
59382  t.tserehebrew = 0x05b5;
59383  t.tserenarrowhebrew = 0x05b5;
59384  t.tserequarterhebrew = 0x05b5;
59385  t.tserewidehebrew = 0x05b5;
59386  t.tshecyrillic = 0x045b;
59387  t.tsuperior = 0xf6f3;
59388  t.ttabengali = 0x099f;
59389  t.ttadeva = 0x091f;
59390  t.ttagujarati = 0x0a9f;
59391  t.ttagurmukhi = 0x0a1f;
59392  t.tteharabic = 0x0679;
59393  t.ttehfinalarabic = 0xfb67;
59394  t.ttehinitialarabic = 0xfb68;
59395  t.ttehmedialarabic = 0xfb69;
59396  t.tthabengali = 0x09a0;
59397  t.tthadeva = 0x0920;
59398  t.tthagujarati = 0x0aa0;
59399  t.tthagurmukhi = 0x0a20;
59400  t.tturned = 0x0287;
59401  t.tuhiragana = 0x3064;
59402  t.tukatakana = 0x30c4;
59403  t.tukatakanahalfwidth = 0xff82;
59404  t.tusmallhiragana = 0x3063;
59405  t.tusmallkatakana = 0x30c3;
59406  t.tusmallkatakanahalfwidth = 0xff6f;
59407  t.twelvecircle = 0x246b;
59408  t.twelveparen = 0x247f;
59409  t.twelveperiod = 0x2493;
59410  t.twelveroman = 0x217b;
59411  t.twentycircle = 0x2473;
59412  t.twentyhangzhou = 0x5344;
59413  t.twentyparen = 0x2487;
59414  t.twentyperiod = 0x249b;
59415  t.two = 0x0032;
59416  t.twoarabic = 0x0662;
59417  t.twobengali = 0x09e8;
59418  t.twocircle = 0x2461;
59419  t.twocircleinversesansserif = 0x278b;
59420  t.twodeva = 0x0968;
59421  t.twodotenleader = 0x2025;
59422  t.twodotleader = 0x2025;
59423  t.twodotleadervertical = 0xfe30;
59424  t.twogujarati = 0x0ae8;
59425  t.twogurmukhi = 0x0a68;
59426  t.twohackarabic = 0x0662;
59427  t.twohangzhou = 0x3022;
59428  t.twoideographicparen = 0x3221;
59429  t.twoinferior = 0x2082;
59430  t.twomonospace = 0xff12;
59431  t.twonumeratorbengali = 0x09f5;
59432  t.twooldstyle = 0xf732;
59433  t.twoparen = 0x2475;
59434  t.twoperiod = 0x2489;
59435  t.twopersian = 0x06f2;
59436  t.tworoman = 0x2171;
59437  t.twostroke = 0x01bb;
59438  t.twosuperior = 0x00b2;
59439  t.twothai = 0x0e52;
59440  t.twothirds = 0x2154;
59441  t.u = 0x0075;
59442  t.uacute = 0x00fa;
59443  t.ubar = 0x0289;
59444  t.ubengali = 0x0989;
59445  t.ubopomofo = 0x3128;
59446  t.ubreve = 0x016d;
59447  t.ucaron = 0x01d4;
59448  t.ucircle = 0x24e4;
59449  t.ucircumflex = 0x00fb;
59450  t.ucircumflexbelow = 0x1e77;
59451  t.ucyrillic = 0x0443;
59452  t.udattadeva = 0x0951;
59453  t.udblacute = 0x0171;
59454  t.udblgrave = 0x0215;
59455  t.udeva = 0x0909;
59456  t.udieresis = 0x00fc;
59457  t.udieresisacute = 0x01d8;
59458  t.udieresisbelow = 0x1e73;
59459  t.udieresiscaron = 0x01da;
59460  t.udieresiscyrillic = 0x04f1;
59461  t.udieresisgrave = 0x01dc;
59462  t.udieresismacron = 0x01d6;
59463  t.udotbelow = 0x1ee5;
59464  t.ugrave = 0x00f9;
59465  t.ugujarati = 0x0a89;
59466  t.ugurmukhi = 0x0a09;
59467  t.uhiragana = 0x3046;
59468  t.uhookabove = 0x1ee7;
59469  t.uhorn = 0x01b0;
59470  t.uhornacute = 0x1ee9;
59471  t.uhorndotbelow = 0x1ef1;
59472  t.uhorngrave = 0x1eeb;
59473  t.uhornhookabove = 0x1eed;
59474  t.uhorntilde = 0x1eef;
59475  t.uhungarumlaut = 0x0171;
59476  t.uhungarumlautcyrillic = 0x04f3;
59477  t.uinvertedbreve = 0x0217;
59478  t.ukatakana = 0x30a6;
59479  t.ukatakanahalfwidth = 0xff73;
59480  t.ukcyrillic = 0x0479;
59481  t.ukorean = 0x315c;
59482  t.umacron = 0x016b;
59483  t.umacroncyrillic = 0x04ef;
59484  t.umacrondieresis = 0x1e7b;
59485  t.umatragurmukhi = 0x0a41;
59486  t.umonospace = 0xff55;
59487  t.underscore = 0x005f;
59488  t.underscoredbl = 0x2017;
59489  t.underscoremonospace = 0xff3f;
59490  t.underscorevertical = 0xfe33;
59491  t.underscorewavy = 0xfe4f;
59492  t.union = 0x222a;
59493  t.universal = 0x2200;
59494  t.uogonek = 0x0173;
59495  t.uparen = 0x24b0;
59496  t.upblock = 0x2580;
59497  t.upperdothebrew = 0x05c4;
59498  t.upsilon = 0x03c5;
59499  t.upsilondieresis = 0x03cb;
59500  t.upsilondieresistonos = 0x03b0;
59501  t.upsilonlatin = 0x028a;
59502  t.upsilontonos = 0x03cd;
59503  t.uptackbelowcmb = 0x031d;
59504  t.uptackmod = 0x02d4;
59505  t.uragurmukhi = 0x0a73;
59506  t.uring = 0x016f;
59507  t.ushortcyrillic = 0x045e;
59508  t.usmallhiragana = 0x3045;
59509  t.usmallkatakana = 0x30a5;
59510  t.usmallkatakanahalfwidth = 0xff69;
59511  t.ustraightcyrillic = 0x04af;
59512  t.ustraightstrokecyrillic = 0x04b1;
59513  t.utilde = 0x0169;
59514  t.utildeacute = 0x1e79;
59515  t.utildebelow = 0x1e75;
59516  t.uubengali = 0x098a;
59517  t.uudeva = 0x090a;
59518  t.uugujarati = 0x0a8a;
59519  t.uugurmukhi = 0x0a0a;
59520  t.uumatragurmukhi = 0x0a42;
59521  t.uuvowelsignbengali = 0x09c2;
59522  t.uuvowelsigndeva = 0x0942;
59523  t.uuvowelsigngujarati = 0x0ac2;
59524  t.uvowelsignbengali = 0x09c1;
59525  t.uvowelsigndeva = 0x0941;
59526  t.uvowelsigngujarati = 0x0ac1;
59527  t.v = 0x0076;
59528  t.vadeva = 0x0935;
59529  t.vagujarati = 0x0ab5;
59530  t.vagurmukhi = 0x0a35;
59531  t.vakatakana = 0x30f7;
59532  t.vav = 0x05d5;
59533  t.vavdagesh = 0xfb35;
59534  t.vavdagesh65 = 0xfb35;
59535  t.vavdageshhebrew = 0xfb35;
59536  t.vavhebrew = 0x05d5;
59537  t.vavholam = 0xfb4b;
59538  t.vavholamhebrew = 0xfb4b;
59539  t.vavvavhebrew = 0x05f0;
59540  t.vavyodhebrew = 0x05f1;
59541  t.vcircle = 0x24e5;
59542  t.vdotbelow = 0x1e7f;
59543  t.vecyrillic = 0x0432;
59544  t.veharabic = 0x06a4;
59545  t.vehfinalarabic = 0xfb6b;
59546  t.vehinitialarabic = 0xfb6c;
59547  t.vehmedialarabic = 0xfb6d;
59548  t.vekatakana = 0x30f9;
59549  t.venus = 0x2640;
59550  t.verticalbar = 0x007c;
59551  t.verticallineabovecmb = 0x030d;
59552  t.verticallinebelowcmb = 0x0329;
59553  t.verticallinelowmod = 0x02cc;
59554  t.verticallinemod = 0x02c8;
59555  t.vewarmenian = 0x057e;
59556  t.vhook = 0x028b;
59557  t.vikatakana = 0x30f8;
59558  t.viramabengali = 0x09cd;
59559  t.viramadeva = 0x094d;
59560  t.viramagujarati = 0x0acd;
59561  t.visargabengali = 0x0983;
59562  t.visargadeva = 0x0903;
59563  t.visargagujarati = 0x0a83;
59564  t.vmonospace = 0xff56;
59565  t.voarmenian = 0x0578;
59566  t.voicediterationhiragana = 0x309e;
59567  t.voicediterationkatakana = 0x30fe;
59568  t.voicedmarkkana = 0x309b;
59569  t.voicedmarkkanahalfwidth = 0xff9e;
59570  t.vokatakana = 0x30fa;
59571  t.vparen = 0x24b1;
59572  t.vtilde = 0x1e7d;
59573  t.vturned = 0x028c;
59574  t.vuhiragana = 0x3094;
59575  t.vukatakana = 0x30f4;
59576  t.w = 0x0077;
59577  t.wacute = 0x1e83;
59578  t.waekorean = 0x3159;
59579  t.wahiragana = 0x308f;
59580  t.wakatakana = 0x30ef;
59581  t.wakatakanahalfwidth = 0xff9c;
59582  t.wakorean = 0x3158;
59583  t.wasmallhiragana = 0x308e;
59584  t.wasmallkatakana = 0x30ee;
59585  t.wattosquare = 0x3357;
59586  t.wavedash = 0x301c;
59587  t.wavyunderscorevertical = 0xfe34;
59588  t.wawarabic = 0x0648;
59589  t.wawfinalarabic = 0xfeee;
59590  t.wawhamzaabovearabic = 0x0624;
59591  t.wawhamzaabovefinalarabic = 0xfe86;
59592  t.wbsquare = 0x33dd;
59593  t.wcircle = 0x24e6;
59594  t.wcircumflex = 0x0175;
59595  t.wdieresis = 0x1e85;
59596  t.wdotaccent = 0x1e87;
59597  t.wdotbelow = 0x1e89;
59598  t.wehiragana = 0x3091;
59599  t.weierstrass = 0x2118;
59600  t.wekatakana = 0x30f1;
59601  t.wekorean = 0x315e;
59602  t.weokorean = 0x315d;
59603  t.wgrave = 0x1e81;
59604  t.whitebullet = 0x25e6;
59605  t.whitecircle = 0x25cb;
59606  t.whitecircleinverse = 0x25d9;
59607  t.whitecornerbracketleft = 0x300e;
59608  t.whitecornerbracketleftvertical = 0xfe43;
59609  t.whitecornerbracketright = 0x300f;
59610  t.whitecornerbracketrightvertical = 0xfe44;
59611  t.whitediamond = 0x25c7;
59612  t.whitediamondcontainingblacksmalldiamond = 0x25c8;
59613  t.whitedownpointingsmalltriangle = 0x25bf;
59614  t.whitedownpointingtriangle = 0x25bd;
59615  t.whiteleftpointingsmalltriangle = 0x25c3;
59616  t.whiteleftpointingtriangle = 0x25c1;
59617  t.whitelenticularbracketleft = 0x3016;
59618  t.whitelenticularbracketright = 0x3017;
59619  t.whiterightpointingsmalltriangle = 0x25b9;
59620  t.whiterightpointingtriangle = 0x25b7;
59621  t.whitesmallsquare = 0x25ab;
59622  t.whitesmilingface = 0x263a;
59623  t.whitesquare = 0x25a1;
59624  t.whitestar = 0x2606;
59625  t.whitetelephone = 0x260f;
59626  t.whitetortoiseshellbracketleft = 0x3018;
59627  t.whitetortoiseshellbracketright = 0x3019;
59628  t.whiteuppointingsmalltriangle = 0x25b5;
59629  t.whiteuppointingtriangle = 0x25b3;
59630  t.wihiragana = 0x3090;
59631  t.wikatakana = 0x30f0;
59632  t.wikorean = 0x315f;
59633  t.wmonospace = 0xff57;
59634  t.wohiragana = 0x3092;
59635  t.wokatakana = 0x30f2;
59636  t.wokatakanahalfwidth = 0xff66;
59637  t.won = 0x20a9;
59638  t.wonmonospace = 0xffe6;
59639  t.wowaenthai = 0x0e27;
59640  t.wparen = 0x24b2;
59641  t.wring = 0x1e98;
59642  t.wsuperior = 0x02b7;
59643  t.wturned = 0x028d;
59644  t.wynn = 0x01bf;
59645  t.x = 0x0078;
59646  t.xabovecmb = 0x033d;
59647  t.xbopomofo = 0x3112;
59648  t.xcircle = 0x24e7;
59649  t.xdieresis = 0x1e8d;
59650  t.xdotaccent = 0x1e8b;
59651  t.xeharmenian = 0x056d;
59652  t.xi = 0x03be;
59653  t.xmonospace = 0xff58;
59654  t.xparen = 0x24b3;
59655  t.xsuperior = 0x02e3;
59656  t.y = 0x0079;
59657  t.yaadosquare = 0x334e;
59658  t.yabengali = 0x09af;
59659  t.yacute = 0x00fd;
59660  t.yadeva = 0x092f;
59661  t.yaekorean = 0x3152;
59662  t.yagujarati = 0x0aaf;
59663  t.yagurmukhi = 0x0a2f;
59664  t.yahiragana = 0x3084;
59665  t.yakatakana = 0x30e4;
59666  t.yakatakanahalfwidth = 0xff94;
59667  t.yakorean = 0x3151;
59668  t.yamakkanthai = 0x0e4e;
59669  t.yasmallhiragana = 0x3083;
59670  t.yasmallkatakana = 0x30e3;
59671  t.yasmallkatakanahalfwidth = 0xff6c;
59672  t.yatcyrillic = 0x0463;
59673  t.ycircle = 0x24e8;
59674  t.ycircumflex = 0x0177;
59675  t.ydieresis = 0x00ff;
59676  t.ydotaccent = 0x1e8f;
59677  t.ydotbelow = 0x1ef5;
59678  t.yeharabic = 0x064a;
59679  t.yehbarreearabic = 0x06d2;
59680  t.yehbarreefinalarabic = 0xfbaf;
59681  t.yehfinalarabic = 0xfef2;
59682  t.yehhamzaabovearabic = 0x0626;
59683  t.yehhamzaabovefinalarabic = 0xfe8a;
59684  t.yehhamzaaboveinitialarabic = 0xfe8b;
59685  t.yehhamzaabovemedialarabic = 0xfe8c;
59686  t.yehinitialarabic = 0xfef3;
59687  t.yehmedialarabic = 0xfef4;
59688  t.yehmeeminitialarabic = 0xfcdd;
59689  t.yehmeemisolatedarabic = 0xfc58;
59690  t.yehnoonfinalarabic = 0xfc94;
59691  t.yehthreedotsbelowarabic = 0x06d1;
59692  t.yekorean = 0x3156;
59693  t.yen = 0x00a5;
59694  t.yenmonospace = 0xffe5;
59695  t.yeokorean = 0x3155;
59696  t.yeorinhieuhkorean = 0x3186;
59697  t.yerahbenyomohebrew = 0x05aa;
59698  t.yerahbenyomolefthebrew = 0x05aa;
59699  t.yericyrillic = 0x044b;
59700  t.yerudieresiscyrillic = 0x04f9;
59701  t.yesieungkorean = 0x3181;
59702  t.yesieungpansioskorean = 0x3183;
59703  t.yesieungsioskorean = 0x3182;
59704  t.yetivhebrew = 0x059a;
59705  t.ygrave = 0x1ef3;
59706  t.yhook = 0x01b4;
59707  t.yhookabove = 0x1ef7;
59708  t.yiarmenian = 0x0575;
59709  t.yicyrillic = 0x0457;
59710  t.yikorean = 0x3162;
59711  t.yinyang = 0x262f;
59712  t.yiwnarmenian = 0x0582;
59713  t.ymonospace = 0xff59;
59714  t.yod = 0x05d9;
59715  t.yoddagesh = 0xfb39;
59716  t.yoddageshhebrew = 0xfb39;
59717  t.yodhebrew = 0x05d9;
59718  t.yodyodhebrew = 0x05f2;
59719  t.yodyodpatahhebrew = 0xfb1f;
59720  t.yohiragana = 0x3088;
59721  t.yoikorean = 0x3189;
59722  t.yokatakana = 0x30e8;
59723  t.yokatakanahalfwidth = 0xff96;
59724  t.yokorean = 0x315b;
59725  t.yosmallhiragana = 0x3087;
59726  t.yosmallkatakana = 0x30e7;
59727  t.yosmallkatakanahalfwidth = 0xff6e;
59728  t.yotgreek = 0x03f3;
59729  t.yoyaekorean = 0x3188;
59730  t.yoyakorean = 0x3187;
59731  t.yoyakthai = 0x0e22;
59732  t.yoyingthai = 0x0e0d;
59733  t.yparen = 0x24b4;
59734  t.ypogegrammeni = 0x037a;
59735  t.ypogegrammenigreekcmb = 0x0345;
59736  t.yr = 0x01a6;
59737  t.yring = 0x1e99;
59738  t.ysuperior = 0x02b8;
59739  t.ytilde = 0x1ef9;
59740  t.yturned = 0x028e;
59741  t.yuhiragana = 0x3086;
59742  t.yuikorean = 0x318c;
59743  t.yukatakana = 0x30e6;
59744  t.yukatakanahalfwidth = 0xff95;
59745  t.yukorean = 0x3160;
59746  t.yusbigcyrillic = 0x046b;
59747  t.yusbigiotifiedcyrillic = 0x046d;
59748  t.yuslittlecyrillic = 0x0467;
59749  t.yuslittleiotifiedcyrillic = 0x0469;
59750  t.yusmallhiragana = 0x3085;
59751  t.yusmallkatakana = 0x30e5;
59752  t.yusmallkatakanahalfwidth = 0xff6d;
59753  t.yuyekorean = 0x318b;
59754  t.yuyeokorean = 0x318a;
59755  t.yyabengali = 0x09df;
59756  t.yyadeva = 0x095f;
59757  t.z = 0x007a;
59758  t.zaarmenian = 0x0566;
59759  t.zacute = 0x017a;
59760  t.zadeva = 0x095b;
59761  t.zagurmukhi = 0x0a5b;
59762  t.zaharabic = 0x0638;
59763  t.zahfinalarabic = 0xfec6;
59764  t.zahinitialarabic = 0xfec7;
59765  t.zahiragana = 0x3056;
59766  t.zahmedialarabic = 0xfec8;
59767  t.zainarabic = 0x0632;
59768  t.zainfinalarabic = 0xfeb0;
59769  t.zakatakana = 0x30b6;
59770  t.zaqefgadolhebrew = 0x0595;
59771  t.zaqefqatanhebrew = 0x0594;
59772  t.zarqahebrew = 0x0598;
59773  t.zayin = 0x05d6;
59774  t.zayindagesh = 0xfb36;
59775  t.zayindageshhebrew = 0xfb36;
59776  t.zayinhebrew = 0x05d6;
59777  t.zbopomofo = 0x3117;
59778  t.zcaron = 0x017e;
59779  t.zcircle = 0x24e9;
59780  t.zcircumflex = 0x1e91;
59781  t.zcurl = 0x0291;
59782  t.zdot = 0x017c;
59783  t.zdotaccent = 0x017c;
59784  t.zdotbelow = 0x1e93;
59785  t.zecyrillic = 0x0437;
59786  t.zedescendercyrillic = 0x0499;
59787  t.zedieresiscyrillic = 0x04df;
59788  t.zehiragana = 0x305c;
59789  t.zekatakana = 0x30bc;
59790  t.zero = 0x0030;
59791  t.zeroarabic = 0x0660;
59792  t.zerobengali = 0x09e6;
59793  t.zerodeva = 0x0966;
59794  t.zerogujarati = 0x0ae6;
59795  t.zerogurmukhi = 0x0a66;
59796  t.zerohackarabic = 0x0660;
59797  t.zeroinferior = 0x2080;
59798  t.zeromonospace = 0xff10;
59799  t.zerooldstyle = 0xf730;
59800  t.zeropersian = 0x06f0;
59801  t.zerosuperior = 0x2070;
59802  t.zerothai = 0x0e50;
59803  t.zerowidthjoiner = 0xfeff;
59804  t.zerowidthnonjoiner = 0x200c;
59805  t.zerowidthspace = 0x200b;
59806  t.zeta = 0x03b6;
59807  t.zhbopomofo = 0x3113;
59808  t.zhearmenian = 0x056a;
59809  t.zhebrevecyrillic = 0x04c2;
59810  t.zhecyrillic = 0x0436;
59811  t.zhedescendercyrillic = 0x0497;
59812  t.zhedieresiscyrillic = 0x04dd;
59813  t.zihiragana = 0x3058;
59814  t.zikatakana = 0x30b8;
59815  t.zinorhebrew = 0x05ae;
59816  t.zlinebelow = 0x1e95;
59817  t.zmonospace = 0xff5a;
59818  t.zohiragana = 0x305e;
59819  t.zokatakana = 0x30be;
59820  t.zparen = 0x24b5;
59821  t.zretroflexhook = 0x0290;
59822  t.zstroke = 0x01b6;
59823  t.zuhiragana = 0x305a;
59824  t.zukatakana = 0x30ba;
59825  t[".notdef"] = 0x0000;
59826  t.angbracketleftbig = 0x2329;
59827  t.angbracketleftBig = 0x2329;
59828  t.angbracketleftbigg = 0x2329;
59829  t.angbracketleftBigg = 0x2329;
59830  t.angbracketrightBig = 0x232a;
59831  t.angbracketrightbig = 0x232a;
59832  t.angbracketrightBigg = 0x232a;
59833  t.angbracketrightbigg = 0x232a;
59834  t.arrowhookleft = 0x21aa;
59835  t.arrowhookright = 0x21a9;
59836  t.arrowlefttophalf = 0x21bc;
59837  t.arrowleftbothalf = 0x21bd;
59838  t.arrownortheast = 0x2197;
59839  t.arrownorthwest = 0x2196;
59840  t.arrowrighttophalf = 0x21c0;
59841  t.arrowrightbothalf = 0x21c1;
59842  t.arrowsoutheast = 0x2198;
59843  t.arrowsouthwest = 0x2199;
59844  t.backslashbig = 0x2216;
59845  t.backslashBig = 0x2216;
59846  t.backslashBigg = 0x2216;
59847  t.backslashbigg = 0x2216;
59848  t.bardbl = 0x2016;
59849  t.bracehtipdownleft = 0xfe37;
59850  t.bracehtipdownright = 0xfe37;
59851  t.bracehtipupleft = 0xfe38;
59852  t.bracehtipupright = 0xfe38;
59853  t.braceleftBig = 0x007b;
59854  t.braceleftbig = 0x007b;
59855  t.braceleftbigg = 0x007b;
59856  t.braceleftBigg = 0x007b;
59857  t.bracerightBig = 0x007d;
59858  t.bracerightbig = 0x007d;
59859  t.bracerightbigg = 0x007d;
59860  t.bracerightBigg = 0x007d;
59861  t.bracketleftbig = 0x005b;
59862  t.bracketleftBig = 0x005b;
59863  t.bracketleftbigg = 0x005b;
59864  t.bracketleftBigg = 0x005b;
59865  t.bracketrightBig = 0x005d;
59866  t.bracketrightbig = 0x005d;
59867  t.bracketrightbigg = 0x005d;
59868  t.bracketrightBigg = 0x005d;
59869  t.ceilingleftbig = 0x2308;
59870  t.ceilingleftBig = 0x2308;
59871  t.ceilingleftBigg = 0x2308;
59872  t.ceilingleftbigg = 0x2308;
59873  t.ceilingrightbig = 0x2309;
59874  t.ceilingrightBig = 0x2309;
59875  t.ceilingrightbigg = 0x2309;
59876  t.ceilingrightBigg = 0x2309;
59877  t.circledotdisplay = 0x2299;
59878  t.circledottext = 0x2299;
59879  t.circlemultiplydisplay = 0x2297;
59880  t.circlemultiplytext = 0x2297;
59881  t.circleplusdisplay = 0x2295;
59882  t.circleplustext = 0x2295;
59883  t.contintegraldisplay = 0x222e;
59884  t.contintegraltext = 0x222e;
59885  t.coproductdisplay = 0x2210;
59886  t.coproducttext = 0x2210;
59887  t.floorleftBig = 0x230a;
59888  t.floorleftbig = 0x230a;
59889  t.floorleftbigg = 0x230a;
59890  t.floorleftBigg = 0x230a;
59891  t.floorrightbig = 0x230b;
59892  t.floorrightBig = 0x230b;
59893  t.floorrightBigg = 0x230b;
59894  t.floorrightbigg = 0x230b;
59895  t.hatwide = 0x0302;
59896  t.hatwider = 0x0302;
59897  t.hatwidest = 0x0302;
59898  t.intercal = 0x1d40;
59899  t.integraldisplay = 0x222b;
59900  t.integraltext = 0x222b;
59901  t.intersectiondisplay = 0x22c2;
59902  t.intersectiontext = 0x22c2;
59903  t.logicalanddisplay = 0x2227;
59904  t.logicalandtext = 0x2227;
59905  t.logicalordisplay = 0x2228;
59906  t.logicalortext = 0x2228;
59907  t.parenleftBig = 0x0028;
59908  t.parenleftbig = 0x0028;
59909  t.parenleftBigg = 0x0028;
59910  t.parenleftbigg = 0x0028;
59911  t.parenrightBig = 0x0029;
59912  t.parenrightbig = 0x0029;
59913  t.parenrightBigg = 0x0029;
59914  t.parenrightbigg = 0x0029;
59915  t.prime = 0x2032;
59916  t.productdisplay = 0x220f;
59917  t.producttext = 0x220f;
59918  t.radicalbig = 0x221a;
59919  t.radicalBig = 0x221a;
59920  t.radicalBigg = 0x221a;
59921  t.radicalbigg = 0x221a;
59922  t.radicalbt = 0x221a;
59923  t.radicaltp = 0x221a;
59924  t.radicalvertex = 0x221a;
59925  t.slashbig = 0x002f;
59926  t.slashBig = 0x002f;
59927  t.slashBigg = 0x002f;
59928  t.slashbigg = 0x002f;
59929  t.summationdisplay = 0x2211;
59930  t.summationtext = 0x2211;
59931  t.tildewide = 0x02dc;
59932  t.tildewider = 0x02dc;
59933  t.tildewidest = 0x02dc;
59934  t.uniondisplay = 0x22c3;
59935  t.unionmultidisplay = 0x228e;
59936  t.unionmultitext = 0x228e;
59937  t.unionsqdisplay = 0x2294;
59938  t.unionsqtext = 0x2294;
59939  t.uniontext = 0x22c3;
59940  t.vextenddouble = 0x2225;
59941  t.vextendsingle = 0x2223;
59942});
59943exports.getGlyphsUnicode = getGlyphsUnicode;
59944const getDingbatsGlyphsUnicode = (0, _core_utils.getLookupTableFactory)(function (t) {
59945  t.space = 0x0020;
59946  t.a1 = 0x2701;
59947  t.a2 = 0x2702;
59948  t.a202 = 0x2703;
59949  t.a3 = 0x2704;
59950  t.a4 = 0x260e;
59951  t.a5 = 0x2706;
59952  t.a119 = 0x2707;
59953  t.a118 = 0x2708;
59954  t.a117 = 0x2709;
59955  t.a11 = 0x261b;
59956  t.a12 = 0x261e;
59957  t.a13 = 0x270c;
59958  t.a14 = 0x270d;
59959  t.a15 = 0x270e;
59960  t.a16 = 0x270f;
59961  t.a105 = 0x2710;
59962  t.a17 = 0x2711;
59963  t.a18 = 0x2712;
59964  t.a19 = 0x2713;
59965  t.a20 = 0x2714;
59966  t.a21 = 0x2715;
59967  t.a22 = 0x2716;
59968  t.a23 = 0x2717;
59969  t.a24 = 0x2718;
59970  t.a25 = 0x2719;
59971  t.a26 = 0x271a;
59972  t.a27 = 0x271b;
59973  t.a28 = 0x271c;
59974  t.a6 = 0x271d;
59975  t.a7 = 0x271e;
59976  t.a8 = 0x271f;
59977  t.a9 = 0x2720;
59978  t.a10 = 0x2721;
59979  t.a29 = 0x2722;
59980  t.a30 = 0x2723;
59981  t.a31 = 0x2724;
59982  t.a32 = 0x2725;
59983  t.a33 = 0x2726;
59984  t.a34 = 0x2727;
59985  t.a35 = 0x2605;
59986  t.a36 = 0x2729;
59987  t.a37 = 0x272a;
59988  t.a38 = 0x272b;
59989  t.a39 = 0x272c;
59990  t.a40 = 0x272d;
59991  t.a41 = 0x272e;
59992  t.a42 = 0x272f;
59993  t.a43 = 0x2730;
59994  t.a44 = 0x2731;
59995  t.a45 = 0x2732;
59996  t.a46 = 0x2733;
59997  t.a47 = 0x2734;
59998  t.a48 = 0x2735;
59999  t.a49 = 0x2736;
60000  t.a50 = 0x2737;
60001  t.a51 = 0x2738;
60002  t.a52 = 0x2739;
60003  t.a53 = 0x273a;
60004  t.a54 = 0x273b;
60005  t.a55 = 0x273c;
60006  t.a56 = 0x273d;
60007  t.a57 = 0x273e;
60008  t.a58 = 0x273f;
60009  t.a59 = 0x2740;
60010  t.a60 = 0x2741;
60011  t.a61 = 0x2742;
60012  t.a62 = 0x2743;
60013  t.a63 = 0x2744;
60014  t.a64 = 0x2745;
60015  t.a65 = 0x2746;
60016  t.a66 = 0x2747;
60017  t.a67 = 0x2748;
60018  t.a68 = 0x2749;
60019  t.a69 = 0x274a;
60020  t.a70 = 0x274b;
60021  t.a71 = 0x25cf;
60022  t.a72 = 0x274d;
60023  t.a73 = 0x25a0;
60024  t.a74 = 0x274f;
60025  t.a203 = 0x2750;
60026  t.a75 = 0x2751;
60027  t.a204 = 0x2752;
60028  t.a76 = 0x25b2;
60029  t.a77 = 0x25bc;
60030  t.a78 = 0x25c6;
60031  t.a79 = 0x2756;
60032  t.a81 = 0x25d7;
60033  t.a82 = 0x2758;
60034  t.a83 = 0x2759;
60035  t.a84 = 0x275a;
60036  t.a97 = 0x275b;
60037  t.a98 = 0x275c;
60038  t.a99 = 0x275d;
60039  t.a100 = 0x275e;
60040  t.a101 = 0x2761;
60041  t.a102 = 0x2762;
60042  t.a103 = 0x2763;
60043  t.a104 = 0x2764;
60044  t.a106 = 0x2765;
60045  t.a107 = 0x2766;
60046  t.a108 = 0x2767;
60047  t.a112 = 0x2663;
60048  t.a111 = 0x2666;
60049  t.a110 = 0x2665;
60050  t.a109 = 0x2660;
60051  t.a120 = 0x2460;
60052  t.a121 = 0x2461;
60053  t.a122 = 0x2462;
60054  t.a123 = 0x2463;
60055  t.a124 = 0x2464;
60056  t.a125 = 0x2465;
60057  t.a126 = 0x2466;
60058  t.a127 = 0x2467;
60059  t.a128 = 0x2468;
60060  t.a129 = 0x2469;
60061  t.a130 = 0x2776;
60062  t.a131 = 0x2777;
60063  t.a132 = 0x2778;
60064  t.a133 = 0x2779;
60065  t.a134 = 0x277a;
60066  t.a135 = 0x277b;
60067  t.a136 = 0x277c;
60068  t.a137 = 0x277d;
60069  t.a138 = 0x277e;
60070  t.a139 = 0x277f;
60071  t.a140 = 0x2780;
60072  t.a141 = 0x2781;
60073  t.a142 = 0x2782;
60074  t.a143 = 0x2783;
60075  t.a144 = 0x2784;
60076  t.a145 = 0x2785;
60077  t.a146 = 0x2786;
60078  t.a147 = 0x2787;
60079  t.a148 = 0x2788;
60080  t.a149 = 0x2789;
60081  t.a150 = 0x278a;
60082  t.a151 = 0x278b;
60083  t.a152 = 0x278c;
60084  t.a153 = 0x278d;
60085  t.a154 = 0x278e;
60086  t.a155 = 0x278f;
60087  t.a156 = 0x2790;
60088  t.a157 = 0x2791;
60089  t.a158 = 0x2792;
60090  t.a159 = 0x2793;
60091  t.a160 = 0x2794;
60092  t.a161 = 0x2192;
60093  t.a163 = 0x2194;
60094  t.a164 = 0x2195;
60095  t.a196 = 0x2798;
60096  t.a165 = 0x2799;
60097  t.a192 = 0x279a;
60098  t.a166 = 0x279b;
60099  t.a167 = 0x279c;
60100  t.a168 = 0x279d;
60101  t.a169 = 0x279e;
60102  t.a170 = 0x279f;
60103  t.a171 = 0x27a0;
60104  t.a172 = 0x27a1;
60105  t.a173 = 0x27a2;
60106  t.a162 = 0x27a3;
60107  t.a174 = 0x27a4;
60108  t.a175 = 0x27a5;
60109  t.a176 = 0x27a6;
60110  t.a177 = 0x27a7;
60111  t.a178 = 0x27a8;
60112  t.a179 = 0x27a9;
60113  t.a193 = 0x27aa;
60114  t.a180 = 0x27ab;
60115  t.a199 = 0x27ac;
60116  t.a181 = 0x27ad;
60117  t.a200 = 0x27ae;
60118  t.a182 = 0x27af;
60119  t.a201 = 0x27b1;
60120  t.a183 = 0x27b2;
60121  t.a184 = 0x27b3;
60122  t.a197 = 0x27b4;
60123  t.a185 = 0x27b5;
60124  t.a194 = 0x27b6;
60125  t.a198 = 0x27b7;
60126  t.a186 = 0x27b8;
60127  t.a195 = 0x27b9;
60128  t.a187 = 0x27ba;
60129  t.a188 = 0x27bb;
60130  t.a189 = 0x27bc;
60131  t.a190 = 0x27bd;
60132  t.a191 = 0x27be;
60133  t.a89 = 0x2768;
60134  t.a90 = 0x2769;
60135  t.a93 = 0x276a;
60136  t.a94 = 0x276b;
60137  t.a91 = 0x276c;
60138  t.a92 = 0x276d;
60139  t.a205 = 0x276e;
60140  t.a85 = 0x276f;
60141  t.a206 = 0x2770;
60142  t.a86 = 0x2771;
60143  t.a87 = 0x2772;
60144  t.a88 = 0x2773;
60145  t.a95 = 0x2774;
60146  t.a96 = 0x2775;
60147  t[".notdef"] = 0x0000;
60148});
60149exports.getDingbatsGlyphsUnicode = getDingbatsGlyphsUnicode;
60150
60151/***/ }),
60152/* 40 */
60153/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
60154
60155
60156
60157Object.defineProperty(exports, "__esModule", ({
60158  value: true
60159}));
60160exports.clearUnicodeCaches = clearUnicodeCaches;
60161exports.getCharUnicodeCategory = getCharUnicodeCategory;
60162exports.getUnicodeForGlyph = getUnicodeForGlyph;
60163exports.getUnicodeRangeFor = getUnicodeRangeFor;
60164exports.mapSpecialUnicodeValues = mapSpecialUnicodeValues;
60165var _core_utils = __w_pdfjs_require__(3);
vendor: 5,739 bytes, lines 60166-60277
60166const getSpecialPUASymbols = (0, _core_utils.getLookupTableFactory)(function (t) {
60167  t[63721] = 0x00a9;
60168  t[63193] = 0x00a9;
60169  t[63720] = 0x00ae;
60170  t[63194] = 0x00ae;
60171  t[63722] = 0x2122;
60172  t[63195] = 0x2122;
60173  t[63729] = 0x23a7;
60174  t[63730] = 0x23a8;
60175  t[63731] = 0x23a9;
60176  t[63740] = 0x23ab;
60177  t[63741] = 0x23ac;
60178  t[63742] = 0x23ad;
60179  t[63726] = 0x23a1;
60180  t[63727] = 0x23a2;
60181  t[63728] = 0x23a3;
60182  t[63737] = 0x23a4;
60183  t[63738] = 0x23a5;
60184  t[63739] = 0x23a6;
60185  t[63723] = 0x239b;
60186  t[63724] = 0x239c;
60187  t[63725] = 0x239d;
60188  t[63734] = 0x239e;
60189  t[63735] = 0x239f;
60190  t[63736] = 0x23a0;
60191});
60192function mapSpecialUnicodeValues(code) {
60193  if (code >= 0xfff0 && code <= 0xffff) {
60194    return 0;
60195  } else if (code >= 0xf600 && code <= 0xf8ff) {
60196    return getSpecialPUASymbols()[code] || code;
60197  } else if (code === 0x00ad) {
60198    return 0x002d;
60199  }
60200  return code;
60201}
60202function getUnicodeForGlyph(name, glyphsUnicodeMap) {
60203  let unicode = glyphsUnicodeMap[name];
60204  if (unicode !== undefined) {
60205    return unicode;
60206  }
60207  if (!name) {
60208    return -1;
60209  }
60210  if (name[0] === "u") {
60211    const nameLen = name.length;
60212    let hexStr;
60213    if (nameLen === 7 && name[1] === "n" && name[2] === "i") {
60214      hexStr = name.substring(3);
60215    } else if (nameLen >= 5 && nameLen <= 7) {
60216      hexStr = name.substring(1);
60217    } else {
60218      return -1;
60219    }
60220    if (hexStr === hexStr.toUpperCase()) {
60221      unicode = parseInt(hexStr, 16);
60222      if (unicode >= 0) {
60223        return unicode;
60224      }
60225    }
60226  }
60227  return -1;
60228}
60229const 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]];
60230function getUnicodeRangeFor(value, lastPosition = -1) {
60231  if (lastPosition !== -1) {
60232    const range = UnicodeRanges[lastPosition];
60233    for (let i = 0, ii = range.length; i < ii; i += 2) {
60234      if (value >= range[i] && value <= range[i + 1]) {
60235        return lastPosition;
60236      }
60237    }
60238  }
60239  for (let i = 0, ii = UnicodeRanges.length; i < ii; i++) {
60240    const range = UnicodeRanges[i];
60241    for (let j = 0, jj = range.length; j < jj; j += 2) {
60242      if (value >= range[j] && value <= range[j + 1]) {
60243        return i;
60244      }
60245    }
60246  }
60247  return -1;
60248}
60249const SpecialCharRegExp = new RegExp("^(\\s)|(\\p{Mn})|(\\p{Cf})$", "u");
60250const CategoryCache = new Map();
60251function getCharUnicodeCategory(char) {
60252  const cachedCategory = CategoryCache.get(char);
60253  if (cachedCategory) {
60254    return cachedCategory;
60255  }
60256  const groups = char.match(SpecialCharRegExp);
60257  const category = {
60258    isWhitespace: !!groups?.[1],
60259    isZeroWidthDiacritic: !!groups?.[2],
60260    isInvisibleFormatMark: !!groups?.[3]
60261  };
60262  CategoryCache.set(char, category);
60263  return category;
60264}
60265function clearUnicodeCaches() {
60266  CategoryCache.clear();
60267}
60268
60269/***/ }),
60270/* 41 */
60271/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
60272
60273
60274
60275Object.defineProperty(exports, "__esModule", ({
60276  value: true
60277}));
60278exports.getSerifFonts = exports.getNonStdFontMap = exports.getGlyphMapForStandardFonts = exports.getFontNameToFileMap = void 0;
60279exports.getStandardFontName = getStandardFontName;
60280exports.getSymbolsFonts = exports.getSupplementalGlyphMapForCalibri = exports.getSupplementalGlyphMapForArialBlack = exports.getStdFontMap = void 0;
60281exports.isKnownFontName = isKnownFontName;
60282var _core_utils = __w_pdfjs_require__(3);
60283var _fonts_utils = __w_pdfjs_require__(38);
60284const getStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
60285  t["Times-Roman"] = "Times-Roman";
60286  t.Helvetica = "Helvetica";
60287  t.Courier = "Courier";
60288  t.Symbol = "Symbol";
60289  t["Times-Bold"] = "Times-Bold";
60290  t["Helvetica-Bold"] = "Helvetica-Bold";
60291  t["Courier-Bold"] = "Courier-Bold";
60292  t.ZapfDingbats = "ZapfDingbats";
60293  t["Times-Italic"] = "Times-Italic";
60294  t["Helvetica-Oblique"] = "Helvetica-Oblique";
60295  t["Courier-Oblique"] = "Courier-Oblique";
60296  t["Times-BoldItalic"] = "Times-BoldItalic";
60297  t["Helvetica-BoldOblique"] = "Helvetica-BoldOblique";
60298  t["Courier-BoldOblique"] = "Courier-BoldOblique";
60299  t.ArialNarrow = "Helvetica";
60300  t["ArialNarrow-Bold"] = "Helvetica-Bold";
60301  t["ArialNarrow-BoldItalic"] = "Helvetica-BoldOblique";
60302  t["ArialNarrow-Italic"] = "Helvetica-Oblique";
60303  t.ArialBlack = "Helvetica";
60304  t["ArialBlack-Bold"] = "Helvetica-Bold";
60305  t["ArialBlack-BoldItalic"] = "Helvetica-BoldOblique";
60306  t["ArialBlack-Italic"] = "Helvetica-Oblique";
60307  t["Arial-Black"] = "Helvetica";
60308  t["Arial-Black-Bold"] = "Helvetica-Bold";
60309  t["Arial-Black-BoldItalic"] = "Helvetica-BoldOblique";
60310  t["Arial-Black-Italic"] = "Helvetica-Oblique";
60311  t.Arial = "Helvetica";
60312  t["Arial-Bold"] = "Helvetica-Bold";
60313  t["Arial-BoldItalic"] = "Helvetica-BoldOblique";
60314  t["Arial-Italic"] = "Helvetica-Oblique";
60315  t.ArialMT = "Helvetica";
60316  t["Arial-BoldItalicMT"] = "Helvetica-BoldOblique";
60317  t["Arial-BoldMT"] = "Helvetica-Bold";
60318  t["Arial-ItalicMT"] = "Helvetica-Oblique";
60319  t["Arial-BoldItalicMT-BoldItalic"] = "Helvetica-BoldOblique";
60320  t["Arial-BoldMT-Bold"] = "Helvetica-Bold";
60321  t["Arial-ItalicMT-Italic"] = "Helvetica-Oblique";
60322  t.ArialUnicodeMS = "Helvetica";
60323  t["ArialUnicodeMS-Bold"] = "Helvetica-Bold";
60324  t["ArialUnicodeMS-BoldItalic"] = "Helvetica-BoldOblique";
60325  t["ArialUnicodeMS-Italic"] = "Helvetica-Oblique";
60326  t["Courier-BoldItalic"] = "Courier-BoldOblique";
60327  t["Courier-Italic"] = "Courier-Oblique";
60328  t.CourierNew = "Courier";
60329  t["CourierNew-Bold"] = "Courier-Bold";
60330  t["CourierNew-BoldItalic"] = "Courier-BoldOblique";
60331  t["CourierNew-Italic"] = "Courier-Oblique";
60332  t["CourierNewPS-BoldItalicMT"] = "Courier-BoldOblique";
60333  t["CourierNewPS-BoldMT"] = "Courier-Bold";
60334  t["CourierNewPS-ItalicMT"] = "Courier-Oblique";
60335  t.CourierNewPSMT = "Courier";
60336  t["Helvetica-BoldItalic"] = "Helvetica-BoldOblique";
60337  t["Helvetica-Italic"] = "Helvetica-Oblique";
60338  t["Symbol-Bold"] = "Symbol";
60339  t["Symbol-BoldItalic"] = "Symbol";
60340  t["Symbol-Italic"] = "Symbol";
60341  t.TimesNewRoman = "Times-Roman";
60342  t["TimesNewRoman-Bold"] = "Times-Bold";
60343  t["TimesNewRoman-BoldItalic"] = "Times-BoldItalic";
60344  t["TimesNewRoman-Italic"] = "Times-Italic";
60345  t.TimesNewRomanPS = "Times-Roman";
60346  t["TimesNewRomanPS-Bold"] = "Times-Bold";
60347  t["TimesNewRomanPS-BoldItalic"] = "Times-BoldItalic";
60348  t["TimesNewRomanPS-BoldItalicMT"] = "Times-BoldItalic";
60349  t["TimesNewRomanPS-BoldMT"] = "Times-Bold";
60350  t["TimesNewRomanPS-Italic"] = "Times-Italic";
60351  t["TimesNewRomanPS-ItalicMT"] = "Times-Italic";
60352  t.TimesNewRomanPSMT = "Times-Roman";
60353  t["TimesNewRomanPSMT-Bold"] = "Times-Bold";
60354  t["TimesNewRomanPSMT-BoldItalic"] = "Times-BoldItalic";
60355  t["TimesNewRomanPSMT-Italic"] = "Times-Italic";
60356});
60357exports.getStdFontMap = getStdFontMap;
60358const getFontNameToFileMap = (0, _core_utils.getLookupTableFactory)(function (t) {
60359  t.Courier = "FoxitFixed.pfb";
60360  t["Courier-Bold"] = "FoxitFixedBold.pfb";
60361  t["Courier-BoldOblique"] = "FoxitFixedBoldItalic.pfb";
60362  t["Courier-Oblique"] = "FoxitFixedItalic.pfb";
60363  t.Helvetica = "LiberationSans-Regular.ttf";
60364  t["Helvetica-Bold"] = "LiberationSans-Bold.ttf";
60365  t["Helvetica-BoldOblique"] = "LiberationSans-BoldItalic.ttf";
60366  t["Helvetica-Oblique"] = "LiberationSans-Italic.ttf";
60367  t["Times-Roman"] = "FoxitSerif.pfb";
60368  t["Times-Bold"] = "FoxitSerifBold.pfb";
60369  t["Times-BoldItalic"] = "FoxitSerifBoldItalic.pfb";
60370  t["Times-Italic"] = "FoxitSerifItalic.pfb";
60371  t.Symbol = "FoxitSymbol.pfb";
60372  t.ZapfDingbats = "FoxitDingbats.pfb";
60373  t["LiberationSans-Regular"] = "LiberationSans-Regular.ttf";
60374  t["LiberationSans-Bold"] = "LiberationSans-Bold.ttf";
60375  t["LiberationSans-Italic"] = "LiberationSans-Italic.ttf";
60376  t["LiberationSans-BoldItalic"] = "LiberationSans-BoldItalic.ttf";
60377});
60378exports.getFontNameToFileMap = getFontNameToFileMap;
60379const getNonStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
60380  t.Calibri = "Helvetica";
60381  t["Calibri-Bold"] = "Helvetica-Bold";
60382  t["Calibri-BoldItalic"] = "Helvetica-BoldOblique";
60383  t["Calibri-Italic"] = "Helvetica-Oblique";
60384  t.CenturyGothic = "Helvetica";
60385  t["CenturyGothic-Bold"] = "Helvetica-Bold";
60386  t["CenturyGothic-BoldItalic"] = "Helvetica-BoldOblique";
60387  t["CenturyGothic-Italic"] = "Helvetica-Oblique";
60388  t.ComicSansMS = "Comic Sans MS";
60389  t["ComicSansMS-Bold"] = "Comic Sans MS-Bold";
60390  t["ComicSansMS-BoldItalic"] = "Comic Sans MS-BoldItalic";
60391  t["ComicSansMS-Italic"] = "Comic Sans MS-Italic";
60392  t.Impact = "Helvetica";
60393  t["ItcSymbol-Bold"] = "Helvetica-Bold";
60394  t["ItcSymbol-BoldItalic"] = "Helvetica-BoldOblique";
60395  t["ItcSymbol-Book"] = "Helvetica";
60396  t["ItcSymbol-BookItalic"] = "Helvetica-Oblique";
60397  t["ItcSymbol-Medium"] = "Helvetica";
60398  t["ItcSymbol-MediumItalic"] = "Helvetica-Oblique";
60399  t.LucidaConsole = "Courier";
60400  t["LucidaConsole-Bold"] = "Courier-Bold";
60401  t["LucidaConsole-BoldItalic"] = "Courier-BoldOblique";
60402  t["LucidaConsole-Italic"] = "Courier-Oblique";
60403  t["LucidaSans-Demi"] = "Helvetica-Bold";
60404  t["MS-Gothic"] = "MS Gothic";
60405  t["MS-Gothic-Bold"] = "MS Gothic-Bold";
60406  t["MS-Gothic-BoldItalic"] = "MS Gothic-BoldItalic";
60407  t["MS-Gothic-Italic"] = "MS Gothic-Italic";
60408  t["MS-Mincho"] = "MS Mincho";
60409  t["MS-Mincho-Bold"] = "MS Mincho-Bold";
60410  t["MS-Mincho-BoldItalic"] = "MS Mincho-BoldItalic";
60411  t["MS-Mincho-Italic"] = "MS Mincho-Italic";
60412  t["MS-PGothic"] = "MS PGothic";
60413  t["MS-PGothic-Bold"] = "MS PGothic-Bold";
60414  t["MS-PGothic-BoldItalic"] = "MS PGothic-BoldItalic";
60415  t["MS-PGothic-Italic"] = "MS PGothic-Italic";
60416  t["MS-PMincho"] = "MS PMincho";
60417  t["MS-PMincho-Bold"] = "MS PMincho-Bold";
60418  t["MS-PMincho-BoldItalic"] = "MS PMincho-BoldItalic";
60419  t["MS-PMincho-Italic"] = "MS PMincho-Italic";
60420  t.NuptialScript = "Times-Italic";
60421  t.SegoeUISymbol = "Helvetica";
60422});
60423exports.getNonStdFontMap = getNonStdFontMap;
60424const getSerifFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
60425  t["Adobe Jenson"] = true;
60426  t["Adobe Text"] = true;
60427  t.Albertus = true;
60428  t.Aldus = true;
60429  t.Alexandria = true;
60430  t.Algerian = true;
60431  t["American Typewriter"] = true;
60432  t.Antiqua = true;
60433  t.Apex = true;
60434  t.Arno = true;
60435  t.Aster = true;
60436  t.Aurora = true;
60437  t.Baskerville = true;
60438  t.Bell = true;
60439  t.Bembo = true;
60440  t["Bembo Schoolbook"] = true;
60441  t.Benguiat = true;
60442  t["Berkeley Old Style"] = true;
60443  t["Bernhard Modern"] = true;
60444  t["Berthold City"] = true;
60445  t.Bodoni = true;
60446  t["Bauer Bodoni"] = true;
60447  t["Book Antiqua"] = true;
60448  t.Bookman = true;
60449  t["Bordeaux Roman"] = true;
60450  t["Californian FB"] = true;
60451  t.Calisto = true;
60452  t.Calvert = true;
60453  t.Capitals = true;
60454  t.Cambria = true;
60455  t.Cartier = true;
60456  t.Caslon = true;
60457  t.Catull = true;
60458  t.Centaur = true;
60459  t["Century Old Style"] = true;
60460  t["Century Schoolbook"] = true;
60461  t.Chaparral = true;
60462  t["Charis SIL"] = true;
60463  t.Cheltenham = true;
60464  t["Cholla Slab"] = true;
60465  t.Clarendon = true;
60466  t.Clearface = true;
60467  t.Cochin = true;
60468  t.Colonna = true;
60469  t["Computer Modern"] = true;
60470  t["Concrete Roman"] = true;
60471  t.Constantia = true;
60472  t["Cooper Black"] = true;
60473  t.Corona = true;
60474  t.Ecotype = true;
60475  t.Egyptienne = true;
60476  t.Elephant = true;
60477  t.Excelsior = true;
60478  t.Fairfield = true;
60479  t["FF Scala"] = true;
60480  t.Folkard = true;
60481  t.Footlight = true;
60482  t.FreeSerif = true;
60483  t["Friz Quadrata"] = true;
60484  t.Garamond = true;
60485  t.Gentium = true;
60486  t.Georgia = true;
60487  t.Gloucester = true;
60488  t["Goudy Old Style"] = true;
60489  t["Goudy Schoolbook"] = true;
60490  t["Goudy Pro Font"] = true;
60491  t.Granjon = true;
60492  t["Guardian Egyptian"] = true;
60493  t.Heather = true;
60494  t.Hercules = true;
60495  t["High Tower Text"] = true;
60496  t.Hiroshige = true;
60497  t["Hoefler Text"] = true;
60498  t["Humana Serif"] = true;
60499  t.Imprint = true;
60500  t["Ionic No. 5"] = true;
60501  t.Janson = true;
60502  t.Joanna = true;
60503  t.Korinna = true;
60504  t.Lexicon = true;
60505  t.LiberationSerif = true;
60506  t["Liberation Serif"] = true;
60507  t["Linux Libertine"] = true;
60508  t.Literaturnaya = true;
60509  t.Lucida = true;
60510  t["Lucida Bright"] = true;
60511  t.Melior = true;
60512  t.Memphis = true;
60513  t.Miller = true;
60514  t.Minion = true;
60515  t.Modern = true;
60516  t["Mona Lisa"] = true;
60517  t["Mrs Eaves"] = true;
60518  t["MS Serif"] = true;
60519  t["Museo Slab"] = true;
60520  t["New York"] = true;
60521  t["Nimbus Roman"] = true;
60522  t["NPS Rawlinson Roadway"] = true;
60523  t.NuptialScript = true;
60524  t.Palatino = true;
60525  t.Perpetua = true;
60526  t.Plantin = true;
60527  t["Plantin Schoolbook"] = true;
60528  t.Playbill = true;
60529  t["Poor Richard"] = true;
60530  t["Rawlinson Roadway"] = true;
60531  t.Renault = true;
60532  t.Requiem = true;
60533  t.Rockwell = true;
60534  t.Roman = true;
60535  t["Rotis Serif"] = true;
60536  t.Sabon = true;
60537  t.Scala = true;
60538  t.Seagull = true;
60539  t.Sistina = true;
60540  t.Souvenir = true;
60541  t.STIX = true;
60542  t["Stone Informal"] = true;
60543  t["Stone Serif"] = true;
60544  t.Sylfaen = true;
60545  t.Times = true;
60546  t.Trajan = true;
60547  t["Trinité"] = true;
60548  t["Trump Mediaeval"] = true;
60549  t.Utopia = true;
60550  t["Vale Type"] = true;
60551  t["Bitstream Vera"] = true;
60552  t["Vera Serif"] = true;
60553  t.Versailles = true;
60554  t.Wanted = true;
60555  t.Weiss = true;
60556  t["Wide Latin"] = true;
60557  t.Windsor = true;
60558  t.XITS = true;
60559});
60560exports.getSerifFonts = getSerifFonts;
60561const getSymbolsFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
60562  t.Dingbats = true;
60563  t.Symbol = true;
60564  t.ZapfDingbats = true;
60565  t.Wingdings = true;
60566  t["Wingdings-Bold"] = true;
60567  t["Wingdings-Regular"] = true;
60568});
60569exports.getSymbolsFonts = getSymbolsFonts;
60570const getGlyphMapForStandardFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
60571  t[2] = 10;
60572  t[3] = 32;
60573  t[4] = 33;
60574  t[5] = 34;
60575  t[6] = 35;
60576  t[7] = 36;
60577  t[8] = 37;
60578  t[9] = 38;
60579  t[10] = 39;
60580  t[11] = 40;
60581  t[12] = 41;
60582  t[13] = 42;
60583  t[14] = 43;
60584  t[15] = 44;
60585  t[16] = 45;
60586  t[17] = 46;
60587  t[18] = 47;
60588  t[19] = 48;
60589  t[20] = 49;
60590  t[21] = 50;
60591  t[22] = 51;
60592  t[23] = 52;
60593  t[24] = 53;
60594  t[25] = 54;
60595  t[26] = 55;
60596  t[27] = 56;
60597  t[28] = 57;
60598  t[29] = 58;
60599  t[30] = 894;
60600  t[31] = 60;
60601  t[32] = 61;
60602  t[33] = 62;
60603  t[34] = 63;
60604  t[35] = 64;
60605  t[36] = 65;
60606  t[37] = 66;
60607  t[38] = 67;
60608  t[39] = 68;
60609  t[40] = 69;
60610  t[41] = 70;
60611  t[42] = 71;
60612  t[43] = 72;
60613  t[44] = 73;
60614  t[45] = 74;
60615  t[46] = 75;
60616  t[47] = 76;
60617  t[48] = 77;
60618  t[49] = 78;
60619  t[50] = 79;
60620  t[51] = 80;
60621  t[52] = 81;
60622  t[53] = 82;
60623  t[54] = 83;
60624  t[55] = 84;
60625  t[56] = 85;
60626  t[57] = 86;
60627  t[58] = 87;
60628  t[59] = 88;
60629  t[60] = 89;
60630  t[61] = 90;
60631  t[62] = 91;
60632  t[63] = 92;
60633  t[64] = 93;
60634  t[65] = 94;
60635  t[66] = 95;
60636  t[67] = 96;
60637  t[68] = 97;
60638  t[69] = 98;
60639  t[70] = 99;
60640  t[71] = 100;
60641  t[72] = 101;
60642  t[73] = 102;
60643  t[74] = 103;
60644  t[75] = 104;
60645  t[76] = 105;
60646  t[77] = 106;
60647  t[78] = 107;
60648  t[79] = 108;
60649  t[80] = 109;
60650  t[81] = 110;
60651  t[82] = 111;
60652  t[83] = 112;
60653  t[84] = 113;
60654  t[85] = 114;
60655  t[86] = 115;
60656  t[87] = 116;
60657  t[88] = 117;
60658  t[89] = 118;
60659  t[90] = 119;
60660  t[91] = 120;
60661  t[92] = 121;
60662  t[93] = 122;
60663  t[94] = 123;
60664  t[95] = 124;
60665  t[96] = 125;
60666  t[97] = 126;
60667  t[98] = 196;
60668  t[99] = 197;
60669  t[100] = 199;
60670  t[101] = 201;
60671  t[102] = 209;
60672  t[103] = 214;
60673  t[104] = 220;
60674  t[105] = 225;
60675  t[106] = 224;
60676  t[107] = 226;
60677  t[108] = 228;
60678  t[109] = 227;
60679  t[110] = 229;
60680  t[111] = 231;
60681  t[112] = 233;
60682  t[113] = 232;
60683  t[114] = 234;
60684  t[115] = 235;
60685  t[116] = 237;
60686  t[117] = 236;
60687  t[118] = 238;
60688  t[119] = 239;
60689  t[120] = 241;
60690  t[121] = 243;
60691  t[122] = 242;
60692  t[123] = 244;
60693  t[124] = 246;
60694  t[125] = 245;
60695  t[126] = 250;
60696  t[127] = 249;
60697  t[128] = 251;
60698  t[129] = 252;
60699  t[130] = 8224;
60700  t[131] = 176;
60701  t[132] = 162;
60702  t[133] = 163;
60703  t[134] = 167;
60704  t[135] = 8226;
60705  t[136] = 182;
60706  t[137] = 223;
60707  t[138] = 174;
60708  t[139] = 169;
60709  t[140] = 8482;
60710  t[141] = 180;
60711  t[142] = 168;
60712  t[143] = 8800;
60713  t[144] = 198;
60714  t[145] = 216;
60715  t[146] = 8734;
60716  t[147] = 177;
60717  t[148] = 8804;
60718  t[149] = 8805;
60719  t[150] = 165;
60720  t[151] = 181;
60721  t[152] = 8706;
60722  t[153] = 8721;
60723  t[154] = 8719;
60724  t[156] = 8747;
60725  t[157] = 170;
60726  t[158] = 186;
60727  t[159] = 8486;
60728  t[160] = 230;
60729  t[161] = 248;
60730  t[162] = 191;
60731  t[163] = 161;
60732  t[164] = 172;
60733  t[165] = 8730;
60734  t[166] = 402;
60735  t[167] = 8776;
60736  t[168] = 8710;
60737  t[169] = 171;
60738  t[170] = 187;
60739  t[171] = 8230;
60740  t[179] = 8220;
60741  t[180] = 8221;
60742  t[181] = 8216;
60743  t[182] = 8217;
60744  t[200] = 193;
60745  t[203] = 205;
60746  t[207] = 211;
60747  t[210] = 218;
60748  t[223] = 711;
60749  t[224] = 321;
60750  t[225] = 322;
60751  t[226] = 352;
60752  t[227] = 353;
60753  t[228] = 381;
60754  t[229] = 382;
60755  t[233] = 221;
60756  t[234] = 253;
60757  t[252] = 263;
60758  t[253] = 268;
60759  t[254] = 269;
60760  t[258] = 258;
60761  t[260] = 260;
60762  t[261] = 261;
60763  t[265] = 280;
60764  t[266] = 281;
60765  t[267] = 282;
60766  t[268] = 283;
60767  t[269] = 313;
60768  t[275] = 323;
60769  t[276] = 324;
60770  t[278] = 328;
60771  t[283] = 344;
60772  t[284] = 345;
60773  t[285] = 346;
60774  t[286] = 347;
60775  t[292] = 367;
60776  t[295] = 377;
60777  t[296] = 378;
60778  t[298] = 380;
60779  t[305] = 963;
60780  t[306] = 964;
60781  t[307] = 966;
60782  t[308] = 8215;
60783  t[309] = 8252;
60784  t[310] = 8319;
60785  t[311] = 8359;
60786  t[312] = 8592;
60787  t[313] = 8593;
60788  t[337] = 9552;
60789  t[493] = 1039;
60790  t[494] = 1040;
60791  t[672] = 1488;
60792  t[673] = 1489;
60793  t[674] = 1490;
60794  t[675] = 1491;
60795  t[676] = 1492;
60796  t[677] = 1493;
60797  t[678] = 1494;
60798  t[679] = 1495;
60799  t[680] = 1496;
60800  t[681] = 1497;
60801  t[682] = 1498;
60802  t[683] = 1499;
60803  t[684] = 1500;
60804  t[685] = 1501;
60805  t[686] = 1502;
60806  t[687] = 1503;
60807  t[688] = 1504;
60808  t[689] = 1505;
60809  t[690] = 1506;
60810  t[691] = 1507;
60811  t[692] = 1508;
60812  t[693] = 1509;
60813  t[694] = 1510;
60814  t[695] = 1511;
60815  t[696] = 1512;
60816  t[697] = 1513;
60817  t[698] = 1514;
60818  t[705] = 1524;
60819  t[706] = 8362;
60820  t[710] = 64288;
60821  t[711] = 64298;
60822  t[759] = 1617;
60823  t[761] = 1776;
60824  t[763] = 1778;
60825  t[775] = 1652;
60826  t[777] = 1764;
60827  t[778] = 1780;
60828  t[779] = 1781;
60829  t[780] = 1782;
60830  t[782] = 771;
60831  t[783] = 64726;
60832  t[786] = 8363;
60833  t[788] = 8532;
60834  t[790] = 768;
60835  t[791] = 769;
60836  t[792] = 768;
60837  t[795] = 803;
60838  t[797] = 64336;
60839  t[798] = 64337;
60840  t[799] = 64342;
60841  t[800] = 64343;
60842  t[801] = 64344;
60843  t[802] = 64345;
60844  t[803] = 64362;
60845  t[804] = 64363;
60846  t[805] = 64364;
60847  t[2424] = 7821;
60848  t[2425] = 7822;
60849  t[2426] = 7823;
60850  t[2427] = 7824;
60851  t[2428] = 7825;
60852  t[2429] = 7826;
60853  t[2430] = 7827;
60854  t[2433] = 7682;
60855  t[2678] = 8045;
60856  t[2679] = 8046;
60857  t[2830] = 1552;
60858  t[2838] = 686;
60859  t[2840] = 751;
60860  t[2842] = 753;
60861  t[2843] = 754;
60862  t[2844] = 755;
60863  t[2846] = 757;
60864  t[2856] = 767;
60865  t[2857] = 848;
60866  t[2858] = 849;
60867  t[2862] = 853;
60868  t[2863] = 854;
60869  t[2864] = 855;
60870  t[2865] = 861;
60871  t[2866] = 862;
60872  t[2906] = 7460;
60873  t[2908] = 7462;
60874  t[2909] = 7463;
60875  t[2910] = 7464;
60876  t[2912] = 7466;
60877  t[2913] = 7467;
60878  t[2914] = 7468;
60879  t[2916] = 7470;
60880  t[2917] = 7471;
60881  t[2918] = 7472;
60882  t[2920] = 7474;
60883  t[2921] = 7475;
60884  t[2922] = 7476;
60885  t[2924] = 7478;
60886  t[2925] = 7479;
60887  t[2926] = 7480;
60888  t[2928] = 7482;
60889  t[2929] = 7483;
60890  t[2930] = 7484;
60891  t[2932] = 7486;
60892  t[2933] = 7487;
60893  t[2934] = 7488;
60894  t[2936] = 7490;
60895  t[2937] = 7491;
60896  t[2938] = 7492;
60897  t[2940] = 7494;
60898  t[2941] = 7495;
60899  t[2942] = 7496;
60900  t[2944] = 7498;
60901  t[2946] = 7500;
60902  t[2948] = 7502;
60903  t[2950] = 7504;
60904  t[2951] = 7505;
60905  t[2952] = 7506;
60906  t[2954] = 7508;
60907  t[2955] = 7509;
60908  t[2956] = 7510;
60909  t[2958] = 7512;
60910  t[2959] = 7513;
60911  t[2960] = 7514;
60912  t[2962] = 7516;
60913  t[2963] = 7517;
60914  t[2964] = 7518;
60915  t[2966] = 7520;
60916  t[2967] = 7521;
60917  t[2968] = 7522;
60918  t[2970] = 7524;
60919  t[2971] = 7525;
60920  t[2972] = 7526;
60921  t[2974] = 7528;
60922  t[2975] = 7529;
60923  t[2976] = 7530;
60924  t[2978] = 1537;
60925  t[2979] = 1538;
60926  t[2980] = 1539;
60927  t[2982] = 1549;
60928  t[2983] = 1551;
60929  t[2984] = 1552;
60930  t[2986] = 1554;
60931  t[2987] = 1555;
60932  t[2988] = 1556;
60933  t[2990] = 1623;
60934  t[2991] = 1624;
60935  t[2995] = 1775;
60936  t[2999] = 1791;
60937  t[3002] = 64290;
60938  t[3003] = 64291;
60939  t[3004] = 64292;
60940  t[3006] = 64294;
60941  t[3007] = 64295;
60942  t[3008] = 64296;
60943  t[3011] = 1900;
60944  t[3014] = 8223;
60945  t[3015] = 8244;
60946  t[3017] = 7532;
60947  t[3018] = 7533;
60948  t[3019] = 7534;
60949  t[3075] = 7590;
60950  t[3076] = 7591;
60951  t[3079] = 7594;
60952  t[3080] = 7595;
60953  t[3083] = 7598;
60954  t[3084] = 7599;
60955  t[3087] = 7602;
60956  t[3088] = 7603;
60957  t[3091] = 7606;
60958  t[3092] = 7607;
60959  t[3095] = 7610;
60960  t[3096] = 7611;
60961  t[3099] = 7614;
60962  t[3100] = 7615;
60963  t[3103] = 7618;
60964  t[3104] = 7619;
60965  t[3107] = 8337;
60966  t[3108] = 8338;
60967  t[3116] = 1884;
60968  t[3119] = 1885;
60969  t[3120] = 1885;
60970  t[3123] = 1886;
60971  t[3124] = 1886;
60972  t[3127] = 1887;
60973  t[3128] = 1887;
60974  t[3131] = 1888;
60975  t[3132] = 1888;
60976  t[3135] = 1889;
60977  t[3136] = 1889;
60978  t[3139] = 1890;
60979  t[3140] = 1890;
60980  t[3143] = 1891;
60981  t[3144] = 1891;
60982  t[3147] = 1892;
60983  t[3148] = 1892;
60984  t[3153] = 580;
60985  t[3154] = 581;
60986  t[3157] = 584;
60987  t[3158] = 585;
60988  t[3161] = 588;
60989  t[3162] = 589;
60990  t[3165] = 891;
60991  t[3166] = 892;
60992  t[3169] = 1274;
60993  t[3170] = 1275;
60994  t[3173] = 1278;
60995  t[3174] = 1279;
60996  t[3181] = 7622;
60997  t[3182] = 7623;
60998  t[3282] = 11799;
60999  t[3316] = 578;
61000  t[3379] = 42785;
61001  t[3393] = 1159;
61002  t[3416] = 8377;
61003});
61004exports.getGlyphMapForStandardFonts = getGlyphMapForStandardFonts;
61005const getSupplementalGlyphMapForArialBlack = (0, _core_utils.getLookupTableFactory)(function (t) {
61006  t[227] = 322;
61007  t[264] = 261;
61008  t[291] = 346;
61009});
61010exports.getSupplementalGlyphMapForArialBlack = getSupplementalGlyphMapForArialBlack;
61011const getSupplementalGlyphMapForCalibri = (0, _core_utils.getLookupTableFactory)(function (t) {
61012  t[1] = 32;
61013  t[4] = 65;
61014  t[5] = 192;
61015  t[6] = 193;
61016  t[9] = 196;
61017  t[17] = 66;
61018  t[18] = 67;
61019  t[21] = 268;
61020  t[24] = 68;
61021  t[28] = 69;
61022  t[29] = 200;
61023  t[30] = 201;
61024  t[32] = 282;
61025  t[38] = 70;
61026  t[39] = 71;
61027  t[44] = 72;
61028  t[47] = 73;
61029  t[48] = 204;
61030  t[49] = 205;
61031  t[58] = 74;
61032  t[60] = 75;
61033  t[62] = 76;
61034  t[68] = 77;
61035  t[69] = 78;
61036  t[75] = 79;
61037  t[76] = 210;
61038  t[80] = 214;
61039  t[87] = 80;
61040  t[89] = 81;
61041  t[90] = 82;
61042  t[92] = 344;
61043  t[94] = 83;
61044  t[97] = 352;
61045  t[100] = 84;
61046  t[104] = 85;
61047  t[109] = 220;
61048  t[115] = 86;
61049  t[116] = 87;
61050  t[121] = 88;
61051  t[122] = 89;
61052  t[124] = 221;
61053  t[127] = 90;
61054  t[129] = 381;
61055  t[258] = 97;
61056  t[259] = 224;
61057  t[260] = 225;
61058  t[263] = 228;
61059  t[268] = 261;
61060  t[271] = 98;
61061  t[272] = 99;
61062  t[273] = 263;
61063  t[275] = 269;
61064  t[282] = 100;
61065  t[286] = 101;
61066  t[287] = 232;
61067  t[288] = 233;
61068  t[290] = 283;
61069  t[295] = 281;
61070  t[296] = 102;
61071  t[336] = 103;
61072  t[346] = 104;
61073  t[349] = 105;
61074  t[350] = 236;
61075  t[351] = 237;
61076  t[361] = 106;
61077  t[364] = 107;
61078  t[367] = 108;
61079  t[371] = 322;
61080  t[373] = 109;
61081  t[374] = 110;
61082  t[381] = 111;
61083  t[382] = 242;
61084  t[383] = 243;
61085  t[386] = 246;
61086  t[393] = 112;
61087  t[395] = 113;
61088  t[396] = 114;
61089  t[398] = 345;
61090  t[400] = 115;
61091  t[401] = 347;
61092  t[403] = 353;
61093  t[410] = 116;
61094  t[437] = 117;
61095  t[442] = 252;
61096  t[448] = 118;
61097  t[449] = 119;
61098  t[454] = 120;
61099  t[455] = 121;
61100  t[457] = 253;
61101  t[460] = 122;
61102  t[462] = 382;
61103  t[463] = 380;
61104  t[853] = 44;
61105  t[855] = 58;
61106  t[856] = 46;
61107  t[876] = 47;
61108  t[878] = 45;
61109  t[882] = 45;
61110  t[894] = 40;
61111  t[895] = 41;
61112  t[896] = 91;
61113  t[897] = 93;
61114  t[923] = 64;
61115  t[1004] = 48;
61116  t[1005] = 49;
61117  t[1006] = 50;
61118  t[1007] = 51;
61119  t[1008] = 52;
61120  t[1009] = 53;
61121  t[1010] = 54;
61122  t[1011] = 55;
vendor: 14,544 bytes, lines 61123-61671
61123  t[1012] = 56;
61124  t[1013] = 57;
61125  t[1081] = 37;
61126  t[1085] = 43;
61127  t[1086] = 45;
61128});
61129exports.getSupplementalGlyphMapForCalibri = getSupplementalGlyphMapForCalibri;
61130function getStandardFontName(name) {
61131  const fontName = (0, _fonts_utils.normalizeFontName)(name);
61132  const stdFontMap = getStdFontMap();
61133  return stdFontMap[fontName];
61134}
61135function isKnownFontName(name) {
61136  const fontName = (0, _fonts_utils.normalizeFontName)(name);
61137  return !!(getStdFontMap()[fontName] || getNonStdFontMap()[fontName] || getSerifFonts()[fontName] || getSymbolsFonts()[fontName]);
61138}
61139
61140/***/ }),
61141/* 42 */
61142/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
61143
61144
61145
61146Object.defineProperty(exports, "__esModule", ({
61147  value: true
61148}));
61149exports.ToUnicodeMap = exports.IdentityToUnicodeMap = void 0;
61150var _util = __w_pdfjs_require__(2);
61151class ToUnicodeMap {
61152  constructor(cmap = []) {
61153    this._map = cmap;
61154  }
61155  get length() {
61156    return this._map.length;
61157  }
61158  forEach(callback) {
61159    for (const charCode in this._map) {
61160      callback(charCode, this._map[charCode].charCodeAt(0));
61161    }
61162  }
61163  has(i) {
61164    return this._map[i] !== undefined;
61165  }
61166  get(i) {
61167    return this._map[i];
61168  }
61169  charCodeOf(value) {
61170    const map = this._map;
61171    if (map.length <= 0x10000) {
61172      return map.indexOf(value);
61173    }
61174    for (const charCode in map) {
61175      if (map[charCode] === value) {
61176        return charCode | 0;
61177      }
61178    }
61179    return -1;
61180  }
61181  amend(map) {
61182    for (const charCode in map) {
61183      this._map[charCode] = map[charCode];
61184    }
61185  }
61186}
61187exports.ToUnicodeMap = ToUnicodeMap;
61188class IdentityToUnicodeMap {
61189  constructor(firstChar, lastChar) {
61190    this.firstChar = firstChar;
61191    this.lastChar = lastChar;
61192  }
61193  get length() {
61194    return this.lastChar + 1 - this.firstChar;
61195  }
61196  forEach(callback) {
61197    for (let i = this.firstChar, ii = this.lastChar; i <= ii; i++) {
61198      callback(i, i);
61199    }
61200  }
61201  has(i) {
61202    return this.firstChar <= i && i <= this.lastChar;
61203  }
61204  get(i) {
61205    if (this.firstChar <= i && i <= this.lastChar) {
61206      return String.fromCharCode(i);
61207    }
61208    return undefined;
61209  }
61210  charCodeOf(v) {
61211    return Number.isInteger(v) && v >= this.firstChar && v <= this.lastChar ? v : -1;
61212  }
61213  amend(map) {
61214    (0, _util.unreachable)("Should not call amend()");
61215  }
61216}
61217exports.IdentityToUnicodeMap = IdentityToUnicodeMap;
61218
61219/***/ }),
61220/* 43 */
61221/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
61222
61223
61224
61225Object.defineProperty(exports, "__esModule", ({
61226  value: true
61227}));
61228exports.CFFFont = void 0;
61229var _cff_parser = __w_pdfjs_require__(35);
61230var _fonts_utils = __w_pdfjs_require__(38);
61231var _util = __w_pdfjs_require__(2);
61232class CFFFont {
61233  constructor(file, properties) {
61234    this.properties = properties;
61235    const parser = new _cff_parser.CFFParser(file, properties, _fonts_utils.SEAC_ANALYSIS_ENABLED);
61236    this.cff = parser.parse();
61237    this.cff.duplicateFirstGlyph();
61238    const compiler = new _cff_parser.CFFCompiler(this.cff);
61239    this.seacs = this.cff.seacs;
61240    try {
61241      this.data = compiler.compile();
61242    } catch {
61243      (0, _util.warn)("Failed to compile font " + properties.loadedName);
61244      this.data = file;
61245    }
61246    this._createBuiltInEncoding();
61247  }
61248  get numGlyphs() {
61249    return this.cff.charStrings.count;
61250  }
61251  getCharset() {
61252    return this.cff.charset.charset;
61253  }
61254  getGlyphMapping() {
61255    const cff = this.cff;
61256    const properties = this.properties;
61257    const {
61258      cidToGidMap,
61259      cMap
61260    } = properties;
61261    const charsets = cff.charset.charset;
61262    let charCodeToGlyphId;
61263    let glyphId;
61264    if (properties.composite) {
61265      let invCidToGidMap;
61266      if (cidToGidMap?.length > 0) {
61267        invCidToGidMap = Object.create(null);
61268        for (let i = 0, ii = cidToGidMap.length; i < ii; i++) {
61269          const gid = cidToGidMap[i];
61270          if (gid !== undefined) {
61271            invCidToGidMap[gid] = i;
61272          }
61273        }
61274      }
61275      charCodeToGlyphId = Object.create(null);
61276      let charCode;
61277      if (cff.isCIDFont) {
61278        for (glyphId = 0; glyphId < charsets.length; glyphId++) {
61279          const cid = charsets[glyphId];
61280          charCode = cMap.charCodeOf(cid);
61281          if (invCidToGidMap?.[charCode] !== undefined) {
61282            charCode = invCidToGidMap[charCode];
61283          }
61284          charCodeToGlyphId[charCode] = glyphId;
61285        }
61286      } else {
61287        for (glyphId = 0; glyphId < cff.charStrings.count; glyphId++) {
61288          charCode = cMap.charCodeOf(glyphId);
61289          charCodeToGlyphId[charCode] = glyphId;
61290        }
61291      }
61292      return charCodeToGlyphId;
61293    }
61294    let encoding = cff.encoding ? cff.encoding.encoding : null;
61295    if (properties.isInternalFont) {
61296      encoding = properties.defaultEncoding;
61297    }
61298    charCodeToGlyphId = (0, _fonts_utils.type1FontGlyphMapping)(properties, encoding, charsets);
61299    return charCodeToGlyphId;
61300  }
61301  hasGlyphId(id) {
61302    return this.cff.hasGlyphId(id);
61303  }
61304  _createBuiltInEncoding() {
61305    const {
61306      charset,
61307      encoding
61308    } = this.cff;
61309    if (!charset || !encoding) {
61310      return;
61311    }
61312    const charsets = charset.charset,
61313      encodings = encoding.encoding;
61314    const map = [];
61315    for (const charCode in encodings) {
61316      const glyphId = encodings[charCode];
61317      if (glyphId >= 0) {
61318        const glyphName = charsets[glyphId];
61319        if (glyphName) {
61320          map[charCode] = glyphName;
61321        }
61322      }
61323    }
61324    if (map.length > 0) {
61325      this.properties.builtInEncoding = map;
61326    }
61327  }
61328}
61329exports.CFFFont = CFFFont;
61330
61331/***/ }),
61332/* 44 */
61333/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
61334
61335
61336
61337Object.defineProperty(exports, "__esModule", ({
61338  value: true
61339}));
61340exports.FontRendererFactory = void 0;
61341var _util = __w_pdfjs_require__(2);
61342var _cff_parser = __w_pdfjs_require__(35);
61343var _glyphlist = __w_pdfjs_require__(39);
61344var _encodings = __w_pdfjs_require__(37);
61345var _stream = __w_pdfjs_require__(8);
61346function getUint32(data, offset) {
61347  return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
61348}
61349function getUint16(data, offset) {
61350  return data[offset] << 8 | data[offset + 1];
61351}
61352function getInt16(data, offset) {
61353  return (data[offset] << 24 | data[offset + 1] << 16) >> 16;
61354}
61355function getInt8(data, offset) {
61356  return data[offset] << 24 >> 24;
61357}
61358function getFloat214(data, offset) {
61359  return getInt16(data, offset) / 16384;
61360}
61361function getSubroutineBias(subrs) {
61362  const numSubrs = subrs.length;
61363  let bias = 32768;
61364  if (numSubrs < 1240) {
61365    bias = 107;
61366  } else if (numSubrs < 33900) {
61367    bias = 1131;
61368  }
61369  return bias;
61370}
61371function parseCmap(data, start, end) {
61372  const offset = getUint16(data, start + 2) === 1 ? getUint32(data, start + 8) : getUint32(data, start + 16);
61373  const format = getUint16(data, start + offset);
61374  let ranges, p, i;
61375  if (format === 4) {
61376    getUint16(data, start + offset + 2);
61377    const segCount = getUint16(data, start + offset + 6) >> 1;
61378    p = start + offset + 14;
61379    ranges = [];
61380    for (i = 0; i < segCount; i++, p += 2) {
61381      ranges[i] = {
61382        end: getUint16(data, p)
61383      };
61384    }
61385    p += 2;
61386    for (i = 0; i < segCount; i++, p += 2) {
61387      ranges[i].start = getUint16(data, p);
61388    }
61389    for (i = 0; i < segCount; i++, p += 2) {
61390      ranges[i].idDelta = getUint16(data, p);
61391    }
61392    for (i = 0; i < segCount; i++, p += 2) {
61393      let idOffset = getUint16(data, p);
61394      if (idOffset === 0) {
61395        continue;
61396      }
61397      ranges[i].ids = [];
61398      for (let j = 0, jj = ranges[i].end - ranges[i].start + 1; j < jj; j++) {
61399        ranges[i].ids[j] = getUint16(data, p + idOffset);
61400        idOffset += 2;
61401      }
61402    }
61403    return ranges;
61404  } else if (format === 12) {
61405    const groups = getUint32(data, start + offset + 12);
61406    p = start + offset + 16;
61407    ranges = [];
61408    for (i = 0; i < groups; i++) {
61409      start = getUint32(data, p);
61410      ranges.push({
61411        start,
61412        end: getUint32(data, p + 4),
61413        idDelta: getUint32(data, p + 8) - start
61414      });
61415      p += 12;
61416    }
61417    return ranges;
61418  }
61419  throw new _util.FormatError(`unsupported cmap: ${format}`);
61420}
61421function parseCff(data, start, end, seacAnalysisEnabled) {
61422  const properties = {};
61423  const parser = new _cff_parser.CFFParser(new _stream.Stream(data, start, end - start), properties, seacAnalysisEnabled);
61424  const cff = parser.parse();
61425  return {
61426    glyphs: cff.charStrings.objects,
61427    subrs: cff.topDict.privateDict?.subrsIndex?.objects,
61428    gsubrs: cff.globalSubrIndex?.objects,
61429    isCFFCIDFont: cff.isCIDFont,
61430    fdSelect: cff.fdSelect,
61431    fdArray: cff.fdArray
61432  };
61433}
61434function parseGlyfTable(glyf, loca, isGlyphLocationsLong) {
61435  let itemSize, itemDecode;
61436  if (isGlyphLocationsLong) {
61437    itemSize = 4;
61438    itemDecode = getUint32;
61439  } else {
61440    itemSize = 2;
61441    itemDecode = (data, offset) => 2 * getUint16(data, offset);
61442  }
61443  const glyphs = [];
61444  let startOffset = itemDecode(loca, 0);
61445  for (let j = itemSize; j < loca.length; j += itemSize) {
61446    const endOffset = itemDecode(loca, j);
61447    glyphs.push(glyf.subarray(startOffset, endOffset));
61448    startOffset = endOffset;
61449  }
61450  return glyphs;
61451}
61452function lookupCmap(ranges, unicode) {
61453  const code = unicode.codePointAt(0);
61454  let gid = 0,
61455    l = 0,
61456    r = ranges.length - 1;
61457  while (l < r) {
61458    const c = l + r + 1 >> 1;
61459    if (code < ranges[c].start) {
61460      r = c - 1;
61461    } else {
61462      l = c;
61463    }
61464  }
61465  if (ranges[l].start <= code && code <= ranges[l].end) {
61466    gid = ranges[l].idDelta + (ranges[l].ids ? ranges[l].ids[code - ranges[l].start] : code) & 0xffff;
61467  }
61468  return {
61469    charCode: code,
61470    glyphId: gid
61471  };
61472}
61473function compileGlyf(code, cmds, font) {
61474  function moveTo(x, y) {
61475    cmds.push({
61476      cmd: "moveTo",
61477      args: [x, y]
61478    });
61479  }
61480  function lineTo(x, y) {
61481    cmds.push({
61482      cmd: "lineTo",
61483      args: [x, y]
61484    });
61485  }
61486  function quadraticCurveTo(xa, ya, x, y) {
61487    cmds.push({
61488      cmd: "quadraticCurveTo",
61489      args: [xa, ya, x, y]
61490    });
61491  }
61492  let i = 0;
61493  const numberOfContours = getInt16(code, i);
61494  let flags;
61495  let x = 0,
61496    y = 0;
61497  i += 10;
61498  if (numberOfContours < 0) {
61499    do {
61500      flags = getUint16(code, i);
61501      const glyphIndex = getUint16(code, i + 2);
61502      i += 4;
61503      let arg1, arg2;
61504      if (flags & 0x01) {
61505        if (flags & 0x02) {
61506          arg1 = getInt16(code, i);
61507          arg2 = getInt16(code, i + 2);
61508        } else {
61509          arg1 = getUint16(code, i);
61510          arg2 = getUint16(code, i + 2);
61511        }
61512        i += 4;
61513      } else if (flags & 0x02) {
61514        arg1 = getInt8(code, i++);
61515        arg2 = getInt8(code, i++);
61516      } else {
61517        arg1 = code[i++];
61518        arg2 = code[i++];
61519      }
61520      if (flags & 0x02) {
61521        x = arg1;
61522        y = arg2;
61523      } else {
61524        x = 0;
61525        y = 0;
61526      }
61527      let scaleX = 1,
61528        scaleY = 1,
61529        scale01 = 0,
61530        scale10 = 0;
61531      if (flags & 0x08) {
61532        scaleX = scaleY = getFloat214(code, i);
61533        i += 2;
61534      } else if (flags & 0x40) {
61535        scaleX = getFloat214(code, i);
61536        scaleY = getFloat214(code, i + 2);
61537        i += 4;
61538      } else if (flags & 0x80) {
61539        scaleX = getFloat214(code, i);
61540        scale01 = getFloat214(code, i + 2);
61541        scale10 = getFloat214(code, i + 4);
61542        scaleY = getFloat214(code, i + 6);
61543        i += 8;
61544      }
61545      const subglyph = font.glyphs[glyphIndex];
61546      if (subglyph) {
61547        cmds.push({
61548          cmd: "save"
61549        }, {
61550          cmd: "transform",
61551          args: [scaleX, scale01, scale10, scaleY, x, y]
61552        });
61553        if (!(flags & 0x02)) {}
61554        compileGlyf(subglyph, cmds, font);
61555        cmds.push({
61556          cmd: "restore"
61557        });
61558      }
61559    } while (flags & 0x20);
61560  } else {
61561    const endPtsOfContours = [];
61562    let j, jj;
61563    for (j = 0; j < numberOfContours; j++) {
61564      endPtsOfContours.push(getUint16(code, i));
61565      i += 2;
61566    }
61567    const instructionLength = getUint16(code, i);
61568    i += 2 + instructionLength;
61569    const numberOfPoints = endPtsOfContours.at(-1) + 1;
61570    const points = [];
61571    while (points.length < numberOfPoints) {
61572      flags = code[i++];
61573      let repeat = 1;
61574      if (flags & 0x08) {
61575        repeat += code[i++];
61576      }
61577      while (repeat-- > 0) {
61578        points.push({
61579          flags
61580        });
61581      }
61582    }
61583    for (j = 0; j < numberOfPoints; j++) {
61584      switch (points[j].flags & 0x12) {
61585        case 0x00:
61586          x += getInt16(code, i);
61587          i += 2;
61588          break;
61589        case 0x02:
61590          x -= code[i++];
61591          break;
61592        case 0x12:
61593          x += code[i++];
61594          break;
61595      }
61596      points[j].x = x;
61597    }
61598    for (j = 0; j < numberOfPoints; j++) {
61599      switch (points[j].flags & 0x24) {
61600        case 0x00:
61601          y += getInt16(code, i);
61602          i += 2;
61603          break;
61604        case 0x04:
61605          y -= code[i++];
61606          break;
61607        case 0x24:
61608          y += code[i++];
61609          break;
61610      }
61611      points[j].y = y;
61612    }
61613    let startPoint = 0;
61614    for (i = 0; i < numberOfContours; i++) {
61615      const endPoint = endPtsOfContours[i];
61616      const contour = points.slice(startPoint, endPoint + 1);
61617      if (contour[0].flags & 1) {
61618        contour.push(contour[0]);
61619      } else if (contour.at(-1).flags & 1) {
61620        contour.unshift(contour.at(-1));
61621      } else {
61622        const p = {
61623          flags: 1,
61624          x: (contour[0].x + contour.at(-1).x) / 2,
61625          y: (contour[0].y + contour.at(-1).y) / 2
61626        };
61627        contour.unshift(p);
61628        contour.push(p);
61629      }
61630      moveTo(contour[0].x, contour[0].y);
61631      for (j = 1, jj = contour.length; j < jj; j++) {
61632        if (contour[j].flags & 1) {
61633          lineTo(contour[j].x, contour[j].y);
61634        } else if (contour[j + 1].flags & 1) {
61635          quadraticCurveTo(contour[j].x, contour[j].y, contour[j + 1].x, contour[j + 1].y);
61636          j++;
61637        } else {
61638          quadraticCurveTo(contour[j].x, contour[j].y, (contour[j].x + contour[j + 1].x) / 2, (contour[j].y + contour[j + 1].y) / 2);
61639        }
61640      }
61641      startPoint = endPoint + 1;
61642    }
61643  }
61644}
61645function compileCharString(charStringCode, cmds, font, glyphId) {
61646  function moveTo(x, y) {
61647    cmds.push({
61648      cmd: "moveTo",
61649      args: [x, y]
61650    });
61651  }
61652  function lineTo(x, y) {
61653    cmds.push({
61654      cmd: "lineTo",
61655      args: [x, y]
61656    });
61657  }
61658  function bezierCurveTo(x1, y1, x2, y2, x, y) {
61659    cmds.push({
61660      cmd: "bezierCurveTo",
61661      args: [x1, y1, x2, y2, x, y]
61662    });
61663  }
61664  const stack = [];
61665  let x = 0,
61666    y = 0;
61667  let stems = 0;
61668  function parse(code) {
61669    let i = 0;
61670    while (i < code.length) {
61671      let stackClean = false;
vendor: 1,824 bytes, lines 61672-61736
61672      let v = code[i++];
61673      let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
61674      switch (v) {
61675        case 1:
61676          stems += stack.length >> 1;
61677          stackClean = true;
61678          break;
61679        case 3:
61680          stems += stack.length >> 1;
61681          stackClean = true;
61682          break;
61683        case 4:
61684          y += stack.pop();
61685          moveTo(x, y);
61686          stackClean = true;
61687          break;
61688        case 5:
61689          while (stack.length > 0) {
61690            x += stack.shift();
61691            y += stack.shift();
61692            lineTo(x, y);
61693          }
61694          break;
61695        case 6:
61696          while (stack.length > 0) {
61697            x += stack.shift();
61698            lineTo(x, y);
61699            if (stack.length === 0) {
61700              break;
61701            }
61702            y += stack.shift();
61703            lineTo(x, y);
61704          }
61705          break;
61706        case 7:
61707          while (stack.length > 0) {
61708            y += stack.shift();
61709            lineTo(x, y);
61710            if (stack.length === 0) {
61711              break;
61712            }
61713            x += stack.shift();
61714            lineTo(x, y);
61715          }
61716          break;
61717        case 8:
61718          while (stack.length > 0) {
61719            xa = x + stack.shift();
61720            ya = y + stack.shift();
61721            xb = xa + stack.shift();
61722            yb = ya + stack.shift();
61723            x = xb + stack.shift();
61724            y = yb + stack.shift();
61725            bezierCurveTo(xa, ya, xb, yb, x, y);
61726          }
61727          break;
61728        case 10:
61729          n = stack.pop();
61730          subrCode = null;
61731          if (font.isCFFCIDFont) {
61732            const fdIndex = font.fdSelect.getFDIndex(glyphId);
61733            if (fdIndex >= 0 && fdIndex < font.fdArray.length) {
61734              const fontDict = font.fdArray[fdIndex];
61735              let subrs;
61736              if (fontDict.privateDict?
vendor: 13,101 bytes, lines 61736-62147
61736.subrsIndex) {
61737                subrs = fontDict.privateDict.subrsIndex.objects;
61738              }
61739              if (subrs) {
61740                n += getSubroutineBias(subrs);
61741                subrCode = subrs[n];
61742              }
61743            } else {
61744              (0, _util.warn)("Invalid fd index for glyph index.");
61745            }
61746          } else {
61747            subrCode = font.subrs[n + font.subrsBias];
61748          }
61749          if (subrCode) {
61750            parse(subrCode);
61751          }
61752          break;
61753        case 11:
61754          return;
61755        case 12:
61756          v = code[i++];
61757          switch (v) {
61758            case 34:
61759              xa = x + stack.shift();
61760              xb = xa + stack.shift();
61761              y1 = y + stack.shift();
61762              x = xb + stack.shift();
61763              bezierCurveTo(xa, y, xb, y1, x, y1);
61764              xa = x + stack.shift();
61765              xb = xa + stack.shift();
61766              x = xb + stack.shift();
61767              bezierCurveTo(xa, y1, xb, y, x, y);
61768              break;
61769            case 35:
61770              xa = x + stack.shift();
61771              ya = y + stack.shift();
61772              xb = xa + stack.shift();
61773              yb = ya + stack.shift();
61774              x = xb + stack.shift();
61775              y = yb + stack.shift();
61776              bezierCurveTo(xa, ya, xb, yb, x, y);
61777              xa = x + stack.shift();
61778              ya = y + stack.shift();
61779              xb = xa + stack.shift();
61780              yb = ya + stack.shift();
61781              x = xb + stack.shift();
61782              y = yb + stack.shift();
61783              bezierCurveTo(xa, ya, xb, yb, x, y);
61784              stack.pop();
61785              break;
61786            case 36:
61787              xa = x + stack.shift();
61788              y1 = y + stack.shift();
61789              xb = xa + stack.shift();
61790              y2 = y1 + stack.shift();
61791              x = xb + stack.shift();
61792              bezierCurveTo(xa, y1, xb, y2, x, y2);
61793              xa = x + stack.shift();
61794              xb = xa + stack.shift();
61795              y3 = y2 + stack.shift();
61796              x = xb + stack.shift();
61797              bezierCurveTo(xa, y2, xb, y3, x, y);
61798              break;
61799            case 37:
61800              const x0 = x,
61801                y0 = y;
61802              xa = x + stack.shift();
61803              ya = y + stack.shift();
61804              xb = xa + stack.shift();
61805              yb = ya + stack.shift();
61806              x = xb + stack.shift();
61807              y = yb + stack.shift();
61808              bezierCurveTo(xa, ya, xb, yb, x, y);
61809              xa = x + stack.shift();
61810              ya = y + stack.shift();
61811              xb = xa + stack.shift();
61812              yb = ya + stack.shift();
61813              x = xb;
61814              y = yb;
61815              if (Math.abs(x - x0) > Math.abs(y - y0)) {
61816                x += stack.shift();
61817              } else {
61818                y += stack.shift();
61819              }
61820              bezierCurveTo(xa, ya, xb, yb, x, y);
61821              break;
61822            default:
61823              throw new _util.FormatError(`unknown operator: 12 ${v}`);
61824          }
61825          break;
61826        case 14:
61827          if (stack.length >= 4) {
61828            const achar = stack.pop();
61829            const bchar = stack.pop();
61830            y = stack.pop();
61831            x = stack.pop();
61832            cmds.push({
61833              cmd: "save"
61834            }, {
61835              cmd: "translate",
61836              args: [x, y]
61837            });
61838            let cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[achar]]));
61839            compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
61840            cmds.push({
61841              cmd: "restore"
61842            });
61843            cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[bchar]]));
61844            compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
61845          }
61846          return;
61847        case 18:
61848          stems += stack.length >> 1;
61849          stackClean = true;
61850          break;
61851        case 19:
61852          stems += stack.length >> 1;
61853          i += stems + 7 >> 3;
61854          stackClean = true;
61855          break;
61856        case 20:
61857          stems += stack.length >> 1;
61858          i += stems + 7 >> 3;
61859          stackClean = true;
61860          break;
61861        case 21:
61862          y += stack.pop();
61863          x += stack.pop();
61864          moveTo(x, y);
61865          stackClean = true;
61866          break;
61867        case 22:
61868          x += stack.pop();
61869          moveTo(x, y);
61870          stackClean = true;
61871          break;
61872        case 23:
61873          stems += stack.length >> 1;
61874          stackClean = true;
61875          break;
61876        case 24:
61877          while (stack.length > 2) {
61878            xa = x + stack.shift();
61879            ya = y + stack.shift();
61880            xb = xa + stack.shift();
61881            yb = ya + stack.shift();
61882            x = xb + stack.shift();
61883            y = yb + stack.shift();
61884            bezierCurveTo(xa, ya, xb, yb, x, y);
61885          }
61886          x += stack.shift();
61887          y += stack.shift();
61888          lineTo(x, y);
61889          break;
61890        case 25:
61891          while (stack.length > 6) {
61892            x += stack.shift();
61893            y += stack.shift();
61894            lineTo(x, y);
61895          }
61896          xa = x + stack.shift();
61897          ya = y + stack.shift();
61898          xb = xa + stack.shift();
61899          yb = ya + stack.shift();
61900          x = xb + stack.shift();
61901          y = yb + stack.shift();
61902          bezierCurveTo(xa, ya, xb, yb, x, y);
61903          break;
61904        case 26:
61905          if (stack.length % 2) {
61906            x += stack.shift();
61907          }
61908          while (stack.length > 0) {
61909            xa = x;
61910            ya = y + stack.shift();
61911            xb = xa + stack.shift();
61912            yb = ya + stack.shift();
61913            x = xb;
61914            y = yb + stack.shift();
61915            bezierCurveTo(xa, ya, xb, yb, x, y);
61916          }
61917          break;
61918        case 27:
61919          if (stack.length % 2) {
61920            y += stack.shift();
61921          }
61922          while (stack.length > 0) {
61923            xa = x + stack.shift();
61924            ya = y;
61925            xb = xa + stack.shift();
61926            yb = ya + stack.shift();
61927            x = xb + stack.shift();
61928            y = yb;
61929            bezierCurveTo(xa, ya, xb, yb, x, y);
61930          }
61931          break;
61932        case 28:
61933          stack.push((code[i] << 24 | code[i + 1] << 16) >> 16);
61934          i += 2;
61935          break;
61936        case 29:
61937          n = stack.pop() + font.gsubrsBias;
61938          subrCode = font.gsubrs[n];
61939          if (subrCode) {
61940            parse(subrCode);
61941          }
61942          break;
61943        case 30:
61944          while (stack.length > 0) {
61945            xa = x;
61946            ya = y + stack.shift();
61947            xb = xa + stack.shift();
61948            yb = ya + stack.shift();
61949            x = xb + stack.shift();
61950            y = yb + (stack.length === 1 ? stack.shift() : 0);
61951            bezierCurveTo(xa, ya, xb, yb, x, y);
61952            if (stack.length === 0) {
61953              break;
61954            }
61955            xa = x + stack.shift();
61956            ya = y;
61957            xb = xa + stack.shift();
61958            yb = ya + stack.shift();
61959            y = yb + stack.shift();
61960            x = xb + (stack.length === 1 ? stack.shift() : 0);
61961            bezierCurveTo(xa, ya, xb, yb, x, y);
61962          }
61963          break;
61964        case 31:
61965          while (stack.length > 0) {
61966            xa = x + stack.shift();
61967            ya = y;
61968            xb = xa + stack.shift();
61969            yb = ya + stack.shift();
61970            y = yb + stack.shift();
61971            x = xb + (stack.length === 1 ? stack.shift() : 0);
61972            bezierCurveTo(xa, ya, xb, yb, x, y);
61973            if (stack.length === 0) {
61974              break;
61975            }
61976            xa = x;
61977            ya = y + stack.shift();
61978            xb = xa + stack.shift();
61979            yb = ya + stack.shift();
61980            x = xb + stack.shift();
61981            y = yb + (stack.length === 1 ? stack.shift() : 0);
61982            bezierCurveTo(xa, ya, xb, yb, x, y);
61983          }
61984          break;
61985        default:
61986          if (v < 32) {
61987            throw new _util.FormatError(`unknown operator: ${v}`);
61988          }
61989          if (v < 247) {
61990            stack.push(v - 139);
61991          } else if (v < 251) {
61992            stack.push((v - 247) * 256 + code[i++] + 108);
61993          } else if (v < 255) {
61994            stack.push(-(v - 251) * 256 - code[i++] - 108);
61995          } else {
61996            stack.push((code[i] << 24 | code[i + 1] << 16 | code[i + 2] << 8 | code[i + 3]) / 65536);
61997            i += 4;
61998          }
61999          break;
62000      }
62001      if (stackClean) {
62002        stack.length = 0;
62003      }
62004    }
62005  }
62006  parse(charStringCode);
62007}
62008const NOOP = [];
62009class CompiledFont {
62010  constructor(fontMatrix) {
62011    if (this.constructor === CompiledFont) {
62012      (0, _util.unreachable)("Cannot initialize CompiledFont.");
62013    }
62014    this.fontMatrix = fontMatrix;
62015    this.compiledGlyphs = Object.create(null);
62016    this.compiledCharCodeToGlyphId = Object.create(null);
62017  }
62018  getPathJs(unicode) {
62019    const {
62020      charCode,
62021      glyphId
62022    } = lookupCmap(this.cmap, unicode);
62023    let fn = this.compiledGlyphs[glyphId];
62024    if (!fn) {
62025      try {
62026        fn = this.compileGlyph(this.glyphs[glyphId], glyphId);
62027        this.compiledGlyphs[glyphId] = fn;
62028      } catch (ex) {
62029        this.compiledGlyphs[glyphId] = NOOP;
62030        if (this.compiledCharCodeToGlyphId[charCode] === undefined) {
62031          this.compiledCharCodeToGlyphId[charCode] = glyphId;
62032        }
62033        throw ex;
62034      }
62035    }
62036    if (this.compiledCharCodeToGlyphId[charCode] === undefined) {
62037      this.compiledCharCodeToGlyphId[charCode] = glyphId;
62038    }
62039    return fn;
62040  }
62041  compileGlyph(code, glyphId) {
62042    if (!code || code.length === 0 || code[0] === 14) {
62043      return NOOP;
62044    }
62045    let fontMatrix = this.fontMatrix;
62046    if (this.isCFFCIDFont) {
62047      const fdIndex = this.fdSelect.getFDIndex(glyphId);
62048      if (fdIndex >= 0 && fdIndex < this.fdArray.length) {
62049        const fontDict = this.fdArray[fdIndex];
62050        fontMatrix = fontDict.getByName("FontMatrix") || _util.FONT_IDENTITY_MATRIX;
62051      } else {
62052        (0, _util.warn)("Invalid fd index for glyph index.");
62053      }
62054    }
62055    const cmds = [{
62056      cmd: "save"
62057    }, {
62058      cmd: "transform",
62059      args: fontMatrix.slice()
62060    }, {
62061      cmd: "scale",
62062      args: ["size", "-size"]
62063    }];
62064    this.compileGlyphImpl(code, cmds, glyphId);
62065    cmds.push({
62066      cmd: "restore"
62067    });
62068    return cmds;
62069  }
62070  compileGlyphImpl() {
62071    (0, _util.unreachable)("Children classes should implement this.");
62072  }
62073  hasBuiltPath(unicode) {
62074    const {
62075      charCode,
62076      glyphId
62077    } = lookupCmap(this.cmap, unicode);
62078    return this.compiledGlyphs[glyphId] !== undefined && this.compiledCharCodeToGlyphId[charCode] !== undefined;
62079  }
62080}
62081class TrueTypeCompiled extends CompiledFont {
62082  constructor(glyphs, cmap, fontMatrix) {
62083    super(fontMatrix || [0.000488, 0, 0, 0.000488, 0, 0]);
62084    this.glyphs = glyphs;
62085    this.cmap = cmap;
62086  }
62087  compileGlyphImpl(code, cmds) {
62088    compileGlyf(code, cmds, this);
62089  }
62090}
62091class Type2Compiled extends CompiledFont {
62092  constructor(cffInfo, cmap, fontMatrix, glyphNameMap) {
62093    super(fontMatrix || [0.001, 0, 0, 0.001, 0, 0]);
62094    this.glyphs = cffInfo.glyphs;
62095    this.gsubrs = cffInfo.gsubrs || [];
62096    this.subrs = cffInfo.subrs || [];
62097    this.cmap = cmap;
62098    this.glyphNameMap = glyphNameMap || (0, _glyphlist.getGlyphsUnicode)();
62099    this.gsubrsBias = getSubroutineBias(this.gsubrs);
62100    this.subrsBias = getSubroutineBias(this.subrs);
62101    this.isCFFCIDFont = cffInfo.isCFFCIDFont;
62102    this.fdSelect = cffInfo.fdSelect;
62103    this.fdArray = cffInfo.fdArray;
62104  }
62105  compileGlyphImpl(code, cmds, glyphId) {
62106    compileCharString(code, cmds, this, glyphId);
62107  }
62108}
62109class FontRendererFactory {
62110  static create(font, seacAnalysisEnabled) {
62111    const data = new Uint8Array(font.data);
62112    let cmap, glyf, loca, cff, indexToLocFormat, unitsPerEm;
62113    const numTables = getUint16(data, 4);
62114    for (let i = 0, p = 12; i < numTables; i++, p += 16) {
62115      const tag = (0, _util.bytesToString)(data.subarray(p, p + 4));
62116      const offset = getUint32(data, p + 8);
62117      const length = getUint32(data, p + 12);
62118      switch (tag) {
62119        case "cmap":
62120          cmap = parseCmap(data, offset, offset + length);
62121          break;
62122        case "glyf":
62123          glyf = data.subarray(offset, offset + length);
62124          break;
62125        case "loca":
62126          loca = data.subarray(offset, offset + length);
62127          break;
62128        case "head":
62129          unitsPerEm = getUint16(data, offset + 18);
62130          indexToLocFormat = getUint16(data, offset + 50);
62131          break;
62132        case "CFF ":
62133          cff = parseCff(data, offset, offset + length, seacAnalysisEnabled);
62134          break;
62135      }
62136    }
62137    if (glyf) {
62138      const fontMatrix = !unitsPerEm ? font.fontMatrix : [1 / unitsPerEm, 0, 0, 1 / unitsPerEm, 0, 0];
62139      return new TrueTypeCompiled(parseGlyfTable(glyf, loca, indexToLocFormat), cmap, fontMatrix);
62140    }
62141    return new Type2Compiled(cff, cmap, font.fontMatrix, font.glyphNameMap);
62142  }
62143}
62144exports.FontRendererFactory = FontRendererFactory;
62145
62146/***/ }),
62147/* 4
621475 */
62148/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
62149
62150
62151
62152Object.defineProperty(exports, "__esModule", ({
62153  value: true
62154}));
62155exports.getMetrics = exports.getFontBasicMetrics = void 0;
62156var _core_utils = __w_pdfjs_require__(3
vendor: 51,191 bytes, lines 62156-64618
62156);
62157const getMetrics = (0, _core_utils.getLookupTableFactory)(function (t) {
62158  t.Courier = 600;
62159  t["Courier-Bold"] = 600;
62160  t["Courier-BoldOblique"] = 600;
62161  t["Courier-Oblique"] = 600;
62162  t.Helvetica = (0, _core_utils.getLookupTableFactory)(function (t) {
62163    t.space = 278;
62164    t.exclam = 278;
62165    t.quotedbl = 355;
62166    t.numbersign = 556;
62167    t.dollar = 556;
62168    t.percent = 889;
62169    t.ampersand = 667;
62170    t.quoteright = 222;
62171    t.parenleft = 333;
62172    t.parenright = 333;
62173    t.asterisk = 389;
62174    t.plus = 584;
62175    t.comma = 278;
62176    t.hyphen = 333;
62177    t.period = 278;
62178    t.slash = 278;
62179    t.zero = 556;
62180    t.one = 556;
62181    t.two = 556;
62182    t.three = 556;
62183    t.four = 556;
62184    t.five = 556;
62185    t.six = 556;
62186    t.seven = 556;
62187    t.eight = 556;
62188    t.nine = 556;
62189    t.colon = 278;
62190    t.semicolon = 278;
62191    t.less = 584;
62192    t.equal = 584;
62193    t.greater = 584;
62194    t.question = 556;
62195    t.at = 1015;
62196    t.A = 667;
62197    t.B = 667;
62198    t.C = 722;
62199    t.D = 722;
62200    t.E = 667;
62201    t.F = 611;
62202    t.G = 778;
62203    t.H = 722;
62204    t.I = 278;
62205    t.J = 500;
62206    t.K = 667;
62207    t.L = 556;
62208    t.M = 833;
62209    t.N = 722;
62210    t.O = 778;
62211    t.P = 667;
62212    t.Q = 778;
62213    t.R = 722;
62214    t.S = 667;
62215    t.T = 611;
62216    t.U = 722;
62217    t.V = 667;
62218    t.W = 944;
62219    t.X = 667;
62220    t.Y = 667;
62221    t.Z = 611;
62222    t.bracketleft = 278;
62223    t.backslash = 278;
62224    t.bracketright = 278;
62225    t.asciicircum = 469;
62226    t.underscore = 556;
62227    t.quoteleft = 222;
62228    t.a = 556;
62229    t.b = 556;
62230    t.c = 500;
62231    t.d = 556;
62232    t.e = 556;
62233    t.f = 278;
62234    t.g = 556;
62235    t.h = 556;
62236    t.i = 222;
62237    t.j = 222;
62238    t.k = 500;
62239    t.l = 222;
62240    t.m = 833;
62241    t.n = 556;
62242    t.o = 556;
62243    t.p = 556;
62244    t.q = 556;
62245    t.r = 333;
62246    t.s = 500;
62247    t.t = 278;
62248    t.u = 556;
62249    t.v = 500;
62250    t.w = 722;
62251    t.x = 500;
62252    t.y = 500;
62253    t.z = 500;
62254    t.braceleft = 334;
62255    t.bar = 260;
62256    t.braceright = 334;
62257    t.asciitilde = 584;
62258    t.exclamdown = 333;
62259    t.cent = 556;
62260    t.sterling = 556;
62261    t.fraction = 167;
62262    t.yen = 556;
62263    t.florin = 556;
62264    t.section = 556;
62265    t.currency = 556;
62266    t.quotesingle = 191;
62267    t.quotedblleft = 333;
62268    t.guillemotleft = 556;
62269    t.guilsinglleft = 333;
62270    t.guilsinglright = 333;
62271    t.fi = 500;
62272    t.fl = 500;
62273    t.endash = 556;
62274    t.dagger = 556;
62275    t.daggerdbl = 556;
62276    t.periodcentered = 278;
62277    t.paragraph = 537;
62278    t.bullet = 350;
62279    t.quotesinglbase = 222;
62280    t.quotedblbase = 333;
62281    t.quotedblright = 333;
62282    t.guillemotright = 556;
62283    t.ellipsis = 1000;
62284    t.perthousand = 1000;
62285    t.questiondown = 611;
62286    t.grave = 333;
62287    t.acute = 333;
62288    t.circumflex = 333;
62289    t.tilde = 333;
62290    t.macron = 333;
62291    t.breve = 333;
62292    t.dotaccent = 333;
62293    t.dieresis = 333;
62294    t.ring = 333;
62295    t.cedilla = 333;
62296    t.hungarumlaut = 333;
62297    t.ogonek = 333;
62298    t.caron = 333;
62299    t.emdash = 1000;
62300    t.AE = 1000;
62301    t.ordfeminine = 370;
62302    t.Lslash = 556;
62303    t.Oslash = 778;
62304    t.OE = 1000;
62305    t.ordmasculine = 365;
62306    t.ae = 889;
62307    t.dotlessi = 278;
62308    t.lslash = 222;
62309    t.oslash = 611;
62310    t.oe = 944;
62311    t.germandbls = 611;
62312    t.Idieresis = 278;
62313    t.eacute = 556;
62314    t.abreve = 556;
62315    t.uhungarumlaut = 556;
62316    t.ecaron = 556;
62317    t.Ydieresis = 667;
62318    t.divide = 584;
62319    t.Yacute = 667;
62320    t.Acircumflex = 667;
62321    t.aacute = 556;
62322    t.Ucircumflex = 722;
62323    t.yacute = 500;
62324    t.scommaaccent = 500;
62325    t.ecircumflex = 556;
62326    t.Uring = 722;
62327    t.Udieresis = 722;
62328    t.aogonek = 556;
62329    t.Uacute = 722;
62330    t.uogonek = 556;
62331    t.Edieresis = 667;
62332    t.Dcroat = 722;
62333    t.commaaccent = 250;
62334    t.copyright = 737;
62335    t.Emacron = 667;
62336    t.ccaron = 500;
62337    t.aring = 556;
62338    t.Ncommaaccent = 722;
62339    t.lacute = 222;
62340    t.agrave = 556;
62341    t.Tcommaaccent = 611;
62342    t.Cacute = 722;
62343    t.atilde = 556;
62344    t.Edotaccent = 667;
62345    t.scaron = 500;
62346    t.scedilla = 500;
62347    t.iacute = 278;
62348    t.lozenge = 471;
62349    t.Rcaron = 722;
62350    t.Gcommaaccent = 778;
62351    t.ucircumflex = 556;
62352    t.acircumflex = 556;
62353    t.Amacron = 667;
62354    t.rcaron = 333;
62355    t.ccedilla = 500;
62356    t.Zdotaccent = 611;
62357    t.Thorn = 667;
62358    t.Omacron = 778;
62359    t.Racute = 722;
62360    t.Sacute = 667;
62361    t.dcaron = 643;
62362    t.Umacron = 722;
62363    t.uring = 556;
62364    t.threesuperior = 333;
62365    t.Ograve = 778;
62366    t.Agrave = 667;
62367    t.Abreve = 667;
62368    t.multiply = 584;
62369    t.uacute = 556;
62370    t.Tcaron = 611;
62371    t.partialdiff = 476;
62372    t.ydieresis = 500;
62373    t.Nacute = 722;
62374    t.icircumflex = 278;
62375    t.Ecircumflex = 667;
62376    t.adieresis = 556;
62377    t.edieresis = 556;
62378    t.cacute = 500;
62379    t.nacute = 556;
62380    t.umacron = 556;
62381    t.Ncaron = 722;
62382    t.Iacute = 278;
62383    t.plusminus = 584;
62384    t.brokenbar = 260;
62385    t.registered = 737;
62386    t.Gbreve = 778;
62387    t.Idotaccent = 278;
62388    t.summation = 600;
62389    t.Egrave = 667;
62390    t.racute = 333;
62391    t.omacron = 556;
62392    t.Zacute = 611;
62393    t.Zcaron = 611;
62394    t.greaterequal = 549;
62395    t.Eth = 722;
62396    t.Ccedilla = 722;
62397    t.lcommaaccent = 222;
62398    t.tcaron = 317;
62399    t.eogonek = 556;
62400    t.Uogonek = 722;
62401    t.Aacute = 667;
62402    t.Adieresis = 667;
62403    t.egrave = 556;
62404    t.zacute = 500;
62405    t.iogonek = 222;
62406    t.Oacute = 778;
62407    t.oacute = 556;
62408    t.amacron = 556;
62409    t.sacute = 500;
62410    t.idieresis = 278;
62411    t.Ocircumflex = 778;
62412    t.Ugrave = 722;
62413    t.Delta = 612;
62414    t.thorn = 556;
62415    t.twosuperior = 333;
62416    t.Odieresis = 778;
62417    t.mu = 556;
62418    t.igrave = 278;
62419    t.ohungarumlaut = 556;
62420    t.Eogonek = 667;
62421    t.dcroat = 556;
62422    t.threequarters = 834;
62423    t.Scedilla = 667;
62424    t.lcaron = 299;
62425    t.Kcommaaccent = 667;
62426    t.Lacute = 556;
62427    t.trademark = 1000;
62428    t.edotaccent = 556;
62429    t.Igrave = 278;
62430    t.Imacron = 278;
62431    t.Lcaron = 556;
62432    t.onehalf = 834;
62433    t.lessequal = 549;
62434    t.ocircumflex = 556;
62435    t.ntilde = 556;
62436    t.Uhungarumlaut = 722;
62437    t.Eacute = 667;
62438    t.emacron = 556;
62439    t.gbreve = 556;
62440    t.onequarter = 834;
62441    t.Scaron = 667;
62442    t.Scommaaccent = 667;
62443    t.Ohungarumlaut = 778;
62444    t.degree = 400;
62445    t.ograve = 556;
62446    t.Ccaron = 722;
62447    t.ugrave = 556;
62448    t.radical = 453;
62449    t.Dcaron = 722;
62450    t.rcommaaccent = 333;
62451    t.Ntilde = 722;
62452    t.otilde = 556;
62453    t.Rcommaaccent = 722;
62454    t.Lcommaaccent = 556;
62455    t.Atilde = 667;
62456    t.Aogonek = 667;
62457    t.Aring = 667;
62458    t.Otilde = 778;
62459    t.zdotaccent = 500;
62460    t.Ecaron = 667;
62461    t.Iogonek = 278;
62462    t.kcommaaccent = 500;
62463    t.minus = 584;
62464    t.Icircumflex = 278;
62465    t.ncaron = 556;
62466    t.tcommaaccent = 278;
62467    t.logicalnot = 584;
62468    t.odieresis = 556;
62469    t.udieresis = 556;
62470    t.notequal = 549;
62471    t.gcommaaccent = 556;
62472    t.eth = 556;
62473    t.zcaron = 500;
62474    t.ncommaaccent = 556;
62475    t.onesuperior = 333;
62476    t.imacron = 278;
62477    t.Euro = 556;
62478  });
62479  t["Helvetica-Bold"] = (0, _core_utils.getLookupTableFactory)(function (t) {
62480    t.space = 278;
62481    t.exclam = 333;
62482    t.quotedbl = 474;
62483    t.numbersign = 556;
62484    t.dollar = 556;
62485    t.percent = 889;
62486    t.ampersand = 722;
62487    t.quoteright = 278;
62488    t.parenleft = 333;
62489    t.parenright = 333;
62490    t.asterisk = 389;
62491    t.plus = 584;
62492    t.comma = 278;
62493    t.hyphen = 333;
62494    t.period = 278;
62495    t.slash = 278;
62496    t.zero = 556;
62497    t.one = 556;
62498    t.two = 556;
62499    t.three = 556;
62500    t.four = 556;
62501    t.five = 556;
62502    t.six = 556;
62503    t.seven = 556;
62504    t.eight = 556;
62505    t.nine = 556;
62506    t.colon = 333;
62507    t.semicolon = 333;
62508    t.less = 584;
62509    t.equal = 584;
62510    t.greater = 584;
62511    t.question = 611;
62512    t.at = 975;
62513    t.A = 722;
62514    t.B = 722;
62515    t.C = 722;
62516    t.D = 722;
62517    t.E = 667;
62518    t.F = 611;
62519    t.G = 778;
62520    t.H = 722;
62521    t.I = 278;
62522    t.J = 556;
62523    t.K = 722;
62524    t.L = 611;
62525    t.M = 833;
62526    t.N = 722;
62527    t.O = 778;
62528    t.P = 667;
62529    t.Q = 778;
62530    t.R = 722;
62531    t.S = 667;
62532    t.T = 611;
62533    t.U = 722;
62534    t.V = 667;
62535    t.W = 944;
62536    t.X = 667;
62537    t.Y = 667;
62538    t.Z = 611;
62539    t.bracketleft = 333;
62540    t.backslash = 278;
62541    t.bracketright = 333;
62542    t.asciicircum = 584;
62543    t.underscore = 556;
62544    t.quoteleft = 278;
62545    t.a = 556;
62546    t.b = 611;
62547    t.c = 556;
62548    t.d = 611;
62549    t.e = 556;
62550    t.f = 333;
62551    t.g = 611;
62552    t.h = 611;
62553    t.i = 278;
62554    t.j = 278;
62555    t.k = 556;
62556    t.l = 278;
62557    t.m = 889;
62558    t.n = 611;
62559    t.o = 611;
62560    t.p = 611;
62561    t.q = 611;
62562    t.r = 389;
62563    t.s = 556;
62564    t.t = 333;
62565    t.u = 611;
62566    t.v = 556;
62567    t.w = 778;
62568    t.x = 556;
62569    t.y = 556;
62570    t.z = 500;
62571    t.braceleft = 389;
62572    t.bar = 280;
62573    t.braceright = 389;
62574    t.asciitilde = 584;
62575    t.exclamdown = 333;
62576    t.cent = 556;
62577    t.sterling = 556;
62578    t.fraction = 167;
62579    t.yen = 556;
62580    t.florin = 556;
62581    t.section = 556;
62582    t.currency = 556;
62583    t.quotesingle = 238;
62584    t.quotedblleft = 500;
62585    t.guillemotleft = 556;
62586    t.guilsinglleft = 333;
62587    t.guilsinglright = 333;
62588    t.fi = 611;
62589    t.fl = 611;
62590    t.endash = 556;
62591    t.dagger = 556;
62592    t.daggerdbl = 556;
62593    t.periodcentered = 278;
62594    t.paragraph = 556;
62595    t.bullet = 350;
62596    t.quotesinglbase = 278;
62597    t.quotedblbase = 500;
62598    t.quotedblright = 500;
62599    t.guillemotright = 556;
62600    t.ellipsis = 1000;
62601    t.perthousand = 1000;
62602    t.questiondown = 611;
62603    t.grave = 333;
62604    t.acute = 333;
62605    t.circumflex = 333;
62606    t.tilde = 333;
62607    t.macron = 333;
62608    t.breve = 333;
62609    t.dotaccent = 333;
62610    t.dieresis = 333;
62611    t.ring = 333;
62612    t.cedilla = 333;
62613    t.hungarumlaut = 333;
62614    t.ogonek = 333;
62615    t.caron = 333;
62616    t.emdash = 1000;
62617    t.AE = 1000;
62618    t.ordfeminine = 370;
62619    t.Lslash = 611;
62620    t.Oslash = 778;
62621    t.OE = 1000;
62622    t.ordmasculine = 365;
62623    t.ae = 889;
62624    t.dotlessi = 278;
62625    t.lslash = 278;
62626    t.oslash = 611;
62627    t.oe = 944;
62628    t.germandbls = 611;
62629    t.Idieresis = 278;
62630    t.eacute = 556;
62631    t.abreve = 556;
62632    t.uhungarumlaut = 611;
62633    t.ecaron = 556;
62634    t.Ydieresis = 667;
62635    t.divide = 584;
62636    t.Yacute = 667;
62637    t.Acircumflex = 722;
62638    t.aacute = 556;
62639    t.Ucircumflex = 722;
62640    t.yacute = 556;
62641    t.scommaaccent = 556;
62642    t.ecircumflex = 556;
62643    t.Uring = 722;
62644    t.Udieresis = 722;
62645    t.aogonek = 556;
62646    t.Uacute = 722;
62647    t.uogonek = 611;
62648    t.Edieresis = 667;
62649    t.Dcroat = 722;
62650    t.commaaccent = 250;
62651    t.copyright = 737;
62652    t.Emacron = 667;
62653    t.ccaron = 556;
62654    t.aring = 556;
62655    t.Ncommaaccent = 722;
62656    t.lacute = 278;
62657    t.agrave = 556;
62658    t.Tcommaaccent = 611;
62659    t.Cacute = 722;
62660    t.atilde = 556;
62661    t.Edotaccent = 667;
62662    t.scaron = 556;
62663    t.scedilla = 556;
62664    t.iacute = 278;
62665    t.lozenge = 494;
62666    t.Rcaron = 722;
62667    t.Gcommaaccent = 778;
62668    t.ucircumflex = 611;
62669    t.acircumflex = 556;
62670    t.Amacron = 722;
62671    t.rcaron = 389;
62672    t.ccedilla = 556;
62673    t.Zdotaccent = 611;
62674    t.Thorn = 667;
62675    t.Omacron = 778;
62676    t.Racute = 722;
62677    t.Sacute = 667;
62678    t.dcaron = 743;
62679    t.Umacron = 722;
62680    t.uring = 611;
62681    t.threesuperior = 333;
62682    t.Ograve = 778;
62683    t.Agrave = 722;
62684    t.Abreve = 722;
62685    t.multiply = 584;
62686    t.uacute = 611;
62687    t.Tcaron = 611;
62688    t.partialdiff = 494;
62689    t.ydieresis = 556;
62690    t.Nacute = 722;
62691    t.icircumflex = 278;
62692    t.Ecircumflex = 667;
62693    t.adieresis = 556;
62694    t.edieresis = 556;
62695    t.cacute = 556;
62696    t.nacute = 611;
62697    t.umacron = 611;
62698    t.Ncaron = 722;
62699    t.Iacute = 278;
62700    t.plusminus = 584;
62701    t.brokenbar = 280;
62702    t.registered = 737;
62703    t.Gbreve = 778;
62704    t.Idotaccent = 278;
62705    t.summation = 600;
62706    t.Egrave = 667;
62707    t.racute = 389;
62708    t.omacron = 611;
62709    t.Zacute = 611;
62710    t.Zcaron = 611;
62711    t.greaterequal = 549;
62712    t.Eth = 722;
62713    t.Ccedilla = 722;
62714    t.lcommaaccent = 278;
62715    t.tcaron = 389;
62716    t.eogonek = 556;
62717    t.Uogonek = 722;
62718    t.Aacute = 722;
62719    t.Adieresis = 722;
62720    t.egrave = 556;
62721    t.zacute = 500;
62722    t.iogonek = 278;
62723    t.Oacute = 778;
62724    t.oacute = 611;
62725    t.amacron = 556;
62726    t.sacute = 556;
62727    t.idieresis = 278;
62728    t.Ocircumflex = 778;
62729    t.Ugrave = 722;
62730    t.Delta = 612;
62731    t.thorn = 611;
62732    t.twosuperior = 333;
62733    t.Odieresis = 778;
62734    t.mu = 611;
62735    t.igrave = 278;
62736    t.ohungarumlaut = 611;
62737    t.Eogonek = 667;
62738    t.dcroat = 611;
62739    t.threequarters = 834;
62740    t.Scedilla = 667;
62741    t.lcaron = 400;
62742    t.Kcommaaccent = 722;
62743    t.Lacute = 611;
62744    t.trademark = 1000;
62745    t.edotaccent = 556;
62746    t.Igrave = 278;
62747    t.Imacron = 278;
62748    t.Lcaron = 611;
62749    t.onehalf = 834;
62750    t.lessequal = 549;
62751    t.ocircumflex = 611;
62752    t.ntilde = 611;
62753    t.Uhungarumlaut = 722;
62754    t.Eacute = 667;
62755    t.emacron = 556;
62756    t.gbreve = 611;
62757    t.onequarter = 834;
62758    t.Scaron = 667;
62759    t.Scommaaccent = 667;
62760    t.Ohungarumlaut = 778;
62761    t.degree = 400;
62762    t.ograve = 611;
62763    t.Ccaron = 722;
62764    t.ugrave = 611;
62765    t.radical = 549;
62766    t.Dcaron = 722;
62767    t.rcommaaccent = 389;
62768    t.Ntilde = 722;
62769    t.otilde = 611;
62770    t.Rcommaaccent = 722;
62771    t.Lcommaaccent = 611;
62772    t.Atilde = 722;
62773    t.Aogonek = 722;
62774    t.Aring = 722;
62775    t.Otilde = 778;
62776    t.zdotaccent = 500;
62777    t.Ecaron = 667;
62778    t.Iogonek = 278;
62779    t.kcommaaccent = 556;
62780    t.minus = 584;
62781    t.Icircumflex = 278;
62782    t.ncaron = 611;
62783    t.tcommaaccent = 333;
62784    t.logicalnot = 584;
62785    t.odieresis = 611;
62786    t.udieresis = 611;
62787    t.notequal = 549;
62788    t.gcommaaccent = 611;
62789    t.eth = 611;
62790    t.zcaron = 500;
62791    t.ncommaaccent = 611;
62792    t.onesuperior = 333;
62793    t.imacron = 278;
62794    t.Euro = 556;
62795  });
62796  t["Helvetica-BoldOblique"] = (0, _core_utils.getLookupTableFactory)(function (t) {
62797    t.space = 278;
62798    t.exclam = 333;
62799    t.quotedbl = 474;
62800    t.numbersign = 556;
62801    t.dollar = 556;
62802    t.percent = 889;
62803    t.ampersand = 722;
62804    t.quoteright = 278;
62805    t.parenleft = 333;
62806    t.parenright = 333;
62807    t.asterisk = 389;
62808    t.plus = 584;
62809    t.comma = 278;
62810    t.hyphen = 333;
62811    t.period = 278;
62812    t.slash = 278;
62813    t.zero = 556;
62814    t.one = 556;
62815    t.two = 556;
62816    t.three = 556;
62817    t.four = 556;
62818    t.five = 556;
62819    t.six = 556;
62820    t.seven = 556;
62821    t.eight = 556;
62822    t.nine = 556;
62823    t.colon = 333;
62824    t.semicolon = 333;
62825    t.less = 584;
62826    t.equal = 584;
62827    t.greater = 584;
62828    t.question = 611;
62829    t.at = 975;
62830    t.A = 722;
62831    t.B = 722;
62832    t.C = 722;
62833    t.D = 722;
62834    t.E = 667;
62835    t.F = 611;
62836    t.G = 778;
62837    t.H = 722;
62838    t.I = 278;
62839    t.J = 556;
62840    t.K = 722;
62841    t.L = 611;
62842    t.M = 833;
62843    t.N = 722;
62844    t.O = 778;
62845    t.P = 667;
62846    t.Q = 778;
62847    t.R = 722;
62848    t.S = 667;
62849    t.T = 611;
62850    t.U = 722;
62851    t.V = 667;
62852    t.W = 944;
62853    t.X = 667;
62854    t.Y = 667;
62855    t.Z = 611;
62856    t.bracketleft = 333;
62857    t.backslash = 278;
62858    t.bracketright = 333;
62859    t.asciicircum = 584;
62860    t.underscore = 556;
62861    t.quoteleft = 278;
62862    t.a = 556;
62863    t.b = 611;
62864    t.c = 556;
62865    t.d = 611;
62866    t.e = 556;
62867    t.f = 333;
62868    t.g = 611;
62869    t.h = 611;
62870    t.i = 278;
62871    t.j = 278;
62872    t.k = 556;
62873    t.l = 278;
62874    t.m = 889;
62875    t.n = 611;
62876    t.o = 611;
62877    t.p = 611;
62878    t.q = 611;
62879    t.r = 389;
62880    t.s = 556;
62881    t.t = 333;
62882    t.u = 611;
62883    t.v = 556;
62884    t.w = 778;
62885    t.x = 556;
62886    t.y = 556;
62887    t.z = 500;
62888    t.braceleft = 389;
62889    t.bar = 280;
62890    t.braceright = 389;
62891    t.asciitilde = 584;
62892    t.exclamdown = 333;
62893    t.cent = 556;
62894    t.sterling = 556;
62895    t.fraction = 167;
62896    t.yen = 556;
62897    t.florin = 556;
62898    t.section = 556;
62899    t.currency = 556;
62900    t.quotesingle = 238;
62901    t.quotedblleft = 500;
62902    t.guillemotleft = 556;
62903    t.guilsinglleft = 333;
62904    t.guilsinglright = 333;
62905    t.fi = 611;
62906    t.fl = 611;
62907    t.endash = 556;
62908    t.dagger = 556;
62909    t.daggerdbl = 556;
62910    t.periodcentered = 278;
62911    t.paragraph = 556;
62912    t.bullet = 350;
62913    t.quotesinglbase = 278;
62914    t.quotedblbase = 500;
62915    t.quotedblright = 500;
62916    t.guillemotright = 556;
62917    t.ellipsis = 1000;
62918    t.perthousand = 1000;
62919    t.questiondown = 611;
62920    t.grave = 333;
62921    t.acute = 333;
62922    t.circumflex = 333;
62923    t.tilde = 333;
62924    t.macron = 333;
62925    t.breve = 333;
62926    t.dotaccent = 333;
62927    t.dieresis = 333;
62928    t.ring = 333;
62929    t.cedilla = 333;
62930    t.hungarumlaut = 333;
62931    t.ogonek = 333;
62932    t.caron = 333;
62933    t.emdash = 1000;
62934    t.AE = 1000;
62935    t.ordfeminine = 370;
62936    t.Lslash = 611;
62937    t.Oslash = 778;
62938    t.OE = 1000;
62939    t.ordmasculine = 365;
62940    t.ae = 889;
62941    t.dotlessi = 278;
62942    t.lslash = 278;
62943    t.oslash = 611;
62944    t.oe = 944;
62945    t.germandbls = 611;
62946    t.Idieresis = 278;
62947    t.eacute = 556;
62948    t.abreve = 556;
62949    t.uhungarumlaut = 611;
62950    t.ecaron = 556;
62951    t.Ydieresis = 667;
62952    t.divide = 584;
62953    t.Yacute = 667;
62954    t.Acircumflex = 722;
62955    t.aacute = 556;
62956    t.Ucircumflex = 722;
62957    t.yacute = 556;
62958    t.scommaaccent = 556;
62959    t.ecircumflex = 556;
62960    t.Uring = 722;
62961    t.Udieresis = 722;
62962    t.aogonek = 556;
62963    t.Uacute = 722;
62964    t.uogonek = 611;
62965    t.Edieresis = 667;
62966    t.Dcroat = 722;
62967    t.commaaccent = 250;
62968    t.copyright = 737;
62969    t.Emacron = 667;
62970    t.ccaron = 556;
62971    t.aring = 556;
62972    t.Ncommaaccent = 722;
62973    t.lacute = 278;
62974    t.agrave = 556;
62975    t.Tcommaaccent = 611;
62976    t.Cacute = 722;
62977    t.atilde = 556;
62978    t.Edotaccent = 667;
62979    t.scaron = 556;
62980    t.scedilla = 556;
62981    t.iacute = 278;
62982    t.lozenge = 494;
62983    t.Rcaron = 722;
62984    t.Gcommaaccent = 778;
62985    t.ucircumflex = 611;
62986    t.acircumflex = 556;
62987    t.Amacron = 722;
62988    t.rcaron = 389;
62989    t.ccedilla = 556;
62990    t.Zdotaccent = 611;
62991    t.Thorn = 667;
62992    t.Omacron = 778;
62993    t.Racute = 722;
62994    t.Sacute = 667;
62995    t.dcaron = 743;
62996    t.Umacron = 722;
62997    t.uring = 611;
62998    t.threesuperior = 333;
62999    t.Ograve = 778;
63000    t.Agrave = 722;
63001    t.Abreve = 722;
63002    t.multiply = 584;
63003    t.uacute = 611;
63004    t.Tcaron = 611;
63005    t.partialdiff = 494;
63006    t.ydieresis = 556;
63007    t.Nacute = 722;
63008    t.icircumflex = 278;
63009    t.Ecircumflex = 667;
63010    t.adieresis = 556;
63011    t.edieresis = 556;
63012    t.cacute = 556;
63013    t.nacute = 611;
63014    t.umacron = 611;
63015    t.Ncaron = 722;
63016    t.Iacute = 278;
63017    t.plusminus = 584;
63018    t.brokenbar = 280;
63019    t.registered = 737;
63020    t.Gbreve = 778;
63021    t.Idotaccent = 278;
63022    t.summation = 600;
63023    t.Egrave = 667;
63024    t.racute = 389;
63025    t.omacron = 611;
63026    t.Zacute = 611;
63027    t.Zcaron = 611;
63028    t.greaterequal = 549;
63029    t.Eth = 722;
63030    t.Ccedilla = 722;
63031    t.lcommaaccent = 278;
63032    t.tcaron = 389;
63033    t.eogonek = 556;
63034    t.Uogonek = 722;
63035    t.Aacute = 722;
63036    t.Adieresis = 722;
63037    t.egrave = 556;
63038    t.zacute = 500;
63039    t.iogonek = 278;
63040    t.Oacute = 778;
63041    t.oacute = 611;
63042    t.amacron = 556;
63043    t.sacute = 556;
63044    t.idieresis = 278;
63045    t.Ocircumflex = 778;
63046    t.Ugrave = 722;
63047    t.Delta = 612;
63048    t.thorn = 611;
63049    t.twosuperior = 333;
63050    t.Odieresis = 778;
63051    t.mu = 611;
63052    t.igrave = 278;
63053    t.ohungarumlaut = 611;
63054    t.Eogonek = 667;
63055    t.dcroat = 611;
63056    t.threequarters = 834;
63057    t.Scedilla = 667;
63058    t.lcaron = 400;
63059    t.Kcommaaccent = 722;
63060    t.Lacute = 611;
63061    t.trademark = 1000;
63062    t.edotaccent = 556;
63063    t.Igrave = 278;
63064    t.Imacron = 278;
63065    t.Lcaron = 611;
63066    t.onehalf = 834;
63067    t.lessequal = 549;
63068    t.ocircumflex = 611;
63069    t.ntilde = 611;
63070    t.Uhungarumlaut = 722;
63071    t.Eacute = 667;
63072    t.emacron = 556;
63073    t.gbreve = 611;
63074    t.onequarter = 834;
63075    t.Scaron = 667;
63076    t.Scommaaccent = 667;
63077    t.Ohungarumlaut = 778;
63078    t.degree = 400;
63079    t.ograve = 611;
63080    t.Ccaron = 722;
63081    t.ugrave = 611;
63082    t.radical = 549;
63083    t.Dcaron = 722;
63084    t.rcommaaccent = 389;
63085    t.Ntilde = 722;
63086    t.otilde = 611;
63087    t.Rcommaaccent = 722;
63088    t.Lcommaaccent = 611;
63089    t.Atilde = 722;
63090    t.Aogonek = 722;
63091    t.Aring = 722;
63092    t.Otilde = 778;
63093    t.zdotaccent = 500;
63094    t.Ecaron = 667;
63095    t.Iogonek = 278;
63096    t.kcommaaccent = 556;
63097    t.minus = 584;
63098    t.Icircumflex = 278;
63099    t.ncaron = 611;
63100    t.tcommaaccent = 333;
63101    t.logicalnot = 584;
63102    t.odieresis = 611;
63103    t.udieresis = 611;
63104    t.notequal = 549;
63105    t.gcommaaccent = 611;
63106    t.eth = 611;
63107    t.zcaron = 500;
63108    t.ncommaaccent = 611;
63109    t.onesuperior = 333;
63110    t.imacron = 278;
63111    t.Euro = 556;
63112  });
63113  t["Helvetica-Oblique"] = (0, _core_utils.getLookupTableFactory)(function (t) {
63114    t.space = 278;
63115    t.exclam = 278;
63116    t.quotedbl = 355;
63117    t.numbersign = 556;
63118    t.dollar = 556;
63119    t.percent = 889;
63120    t.ampersand = 667;
63121    t.quoteright = 222;
63122    t.parenleft = 333;
63123    t.parenright = 333;
63124    t.asterisk = 389;
63125    t.plus = 584;
63126    t.comma = 278;
63127    t.hyphen = 333;
63128    t.period = 278;
63129    t.slash = 278;
63130    t.zero = 556;
63131    t.one = 556;
63132    t.two = 556;
63133    t.three = 556;
63134    t.four = 556;
63135    t.five = 556;
63136    t.six = 556;
63137    t.seven = 556;
63138    t.eight = 556;
63139    t.nine = 556;
63140    t.colon = 278;
63141    t.semicolon = 278;
63142    t.less = 584;
63143    t.equal = 584;
63144    t.greater = 584;
63145    t.question = 556;
63146    t.at = 1015;
63147    t.A = 667;
63148    t.B = 667;
63149    t.C = 722;
63150    t.D = 722;
63151    t.E = 667;
63152    t.F = 611;
63153    t.G = 778;
63154    t.H = 722;
63155    t.I = 278;
63156    t.J = 500;
63157    t.K = 667;
63158    t.L = 556;
63159    t.M = 833;
63160    t.N = 722;
63161    t.O = 778;
63162    t.P = 667;
63163    t.Q = 778;
63164    t.R = 722;
63165    t.S = 667;
63166    t.T = 611;
63167    t.U = 722;
63168    t.V = 667;
63169    t.W = 944;
63170    t.X = 667;
63171    t.Y = 667;
63172    t.Z = 611;
63173    t.bracketleft = 278;
63174    t.backslash = 278;
63175    t.bracketright = 278;
63176    t.asciicircum = 469;
63177    t.underscore = 556;
63178    t.quoteleft = 222;
63179    t.a = 556;
63180    t.b = 556;
63181    t.c = 500;
63182    t.d = 556;
63183    t.e = 556;
63184    t.f = 278;
63185    t.g = 556;
63186    t.h = 556;
63187    t.i = 222;
63188    t.j = 222;
63189    t.k = 500;
63190    t.l = 222;
63191    t.m = 833;
63192    t.n = 556;
63193    t.o = 556;
63194    t.p = 556;
63195    t.q = 556;
63196    t.r = 333;
63197    t.s = 500;
63198    t.t = 278;
63199    t.u = 556;
63200    t.v = 500;
63201    t.w = 722;
63202    t.x = 500;
63203    t.y = 500;
63204    t.z = 500;
63205    t.braceleft = 334;
63206    t.bar = 260;
63207    t.braceright = 334;
63208    t.asciitilde = 584;
63209    t.exclamdown = 333;
63210    t.cent = 556;
63211    t.sterling = 556;
63212    t.fraction = 167;
63213    t.yen = 556;
63214    t.florin = 556;
63215    t.section = 556;
63216    t.currency = 556;
63217    t.quotesingle = 191;
63218    t.quotedblleft = 333;
63219    t.guillemotleft = 556;
63220    t.guilsinglleft = 333;
63221    t.guilsinglright = 333;
63222    t.fi = 500;
63223    t.fl = 500;
63224    t.endash = 556;
63225    t.dagger = 556;
63226    t.daggerdbl = 556;
63227    t.periodcentered = 278;
63228    t.paragraph = 537;
63229    t.bullet = 350;
63230    t.quotesinglbase = 222;
63231    t.quotedblbase = 333;
63232    t.quotedblright = 333;
63233    t.guillemotright = 556;
63234    t.ellipsis = 1000;
63235    t.perthousand = 1000;
63236    t.questiondown = 611;
63237    t.grave = 333;
63238    t.acute = 333;
63239    t.circumflex = 333;
63240    t.tilde = 333;
63241    t.macron = 333;
63242    t.breve = 333;
63243    t.dotaccent = 333;
63244    t.dieresis = 333;
63245    t.ring = 333;
63246    t.cedilla = 333;
63247    t.hungarumlaut = 333;
63248    t.ogonek = 333;
63249    t.caron = 333;
63250    t.emdash = 1000;
63251    t.AE = 1000;
63252    t.ordfeminine = 370;
63253    t.Lslash = 556;
63254    t.Oslash = 778;
63255    t.OE = 1000;
63256    t.ordmasculine = 365;
63257    t.ae = 889;
63258    t.dotlessi = 278;
63259    t.lslash = 222;
63260    t.oslash = 611;
63261    t.oe = 944;
63262    t.germandbls = 611;
63263    t.Idieresis = 278;
63264    t.eacute = 556;
63265    t.abreve = 556;
63266    t.uhungarumlaut = 556;
63267    t.ecaron = 556;
63268    t.Ydieresis = 667;
63269    t.divide = 584;
63270    t.Yacute = 667;
63271    t.Acircumflex = 667;
63272    t.aacute = 556;
63273    t.Ucircumflex = 722;
63274    t.yacute = 500;
63275    t.scommaaccent = 500;
63276    t.ecircumflex = 556;
63277    t.Uring = 722;
63278    t.Udieresis = 722;
63279    t.aogonek = 556;
63280    t.Uacute = 722;
63281    t.uogonek = 556;
63282    t.Edieresis = 667;
63283    t.Dcroat = 722;
63284    t.commaaccent = 250;
63285    t.copyright = 737;
63286    t.Emacron = 667;
63287    t.ccaron = 500;
63288    t.aring = 556;
63289    t.Ncommaaccent = 722;
63290    t.lacute = 222;
63291    t.agrave = 556;
63292    t.Tcommaaccent = 611;
63293    t.Cacute = 722;
63294    t.atilde = 556;
63295    t.Edotaccent = 667;
63296    t.scaron = 500;
63297    t.scedilla = 500;
63298    t.iacute = 278;
63299    t.lozenge = 471;
63300    t.Rcaron = 722;
63301    t.Gcommaaccent = 778;
63302    t.ucircumflex = 556;
63303    t.acircumflex = 556;
63304    t.Amacron = 667;
63305    t.rcaron = 333;
63306    t.ccedilla = 500;
63307    t.Zdotaccent = 611;
63308    t.Thorn = 667;
63309    t.Omacron = 778;
63310    t.Racute = 722;
63311    t.Sacute = 667;
63312    t.dcaron = 643;
63313    t.Umacron = 722;
63314    t.uring = 556;
63315    t.threesuperior = 333;
63316    t.Ograve = 778;
63317    t.Agrave = 667;
63318    t.Abreve = 667;
63319    t.multiply = 584;
63320    t.uacute = 556;
63321    t.Tcaron = 611;
63322    t.partialdiff = 476;
63323    t.ydieresis = 500;
63324    t.Nacute = 722;
63325    t.icircumflex = 278;
63326    t.Ecircumflex = 667;
63327    t.adieresis = 556;
63328    t.edieresis = 556;
63329    t.cacute = 500;
63330    t.nacute = 556;
63331    t.umacron = 556;
63332    t.Ncaron = 722;
63333    t.Iacute = 278;
63334    t.plusminus = 584;
63335    t.brokenbar = 260;
63336    t.registered = 737;
63337    t.Gbreve = 778;
63338    t.Idotaccent = 278;
63339    t.summation = 600;
63340    t.Egrave = 667;
63341    t.racute = 333;
63342    t.omacron = 556;
63343    t.Zacute = 611;
63344    t.Zcaron = 611;
63345    t.greaterequal = 549;
63346    t.Eth = 722;
63347    t.Ccedilla = 722;
63348    t.lcommaaccent = 222;
63349    t.tcaron = 317;
63350    t.eogonek = 556;
63351    t.Uogonek = 722;
63352    t.Aacute = 667;
63353    t.Adieresis = 667;
63354    t.egrave = 556;
63355    t.zacute = 500;
63356    t.iogonek = 222;
63357    t.Oacute = 778;
63358    t.oacute = 556;
63359    t.amacron = 556;
63360    t.sacute = 500;
63361    t.idieresis = 278;
63362    t.Ocircumflex = 778;
63363    t.Ugrave = 722;
63364    t.Delta = 612;
63365    t.thorn = 556;
63366    t.twosuperior = 333;
63367    t.Odieresis = 778;
63368    t.mu = 556;
63369    t.igrave = 278;
63370    t.ohungarumlaut = 556;
63371    t.Eogonek = 667;
63372    t.dcroat = 556;
63373    t.threequarters = 834;
63374    t.Scedilla = 667;
63375    t.lcaron = 299;
63376    t.Kcommaaccent = 667;
63377    t.Lacute = 556;
63378    t.trademark = 1000;
63379    t.edotaccent = 556;
63380    t.Igrave = 278;
63381    t.Imacron = 278;
63382    t.Lcaron = 556;
63383    t.onehalf = 834;
63384    t.lessequal = 549;
63385    t.ocircumflex = 556;
63386    t.ntilde = 556;
63387    t.Uhungarumlaut = 722;
63388    t.Eacute = 667;
63389    t.emacron = 556;
63390    t.gbreve = 556;
63391    t.onequarter = 834;
63392    t.Scaron = 667;
63393    t.Scommaaccent = 667;
63394    t.Ohungarumlaut = 778;
63395    t.degree = 400;
63396    t.ograve = 556;
63397    t.Ccaron = 722;
63398    t.ugrave = 556;
63399    t.radical = 453;
63400    t.Dcaron = 722;
63401    t.rcommaaccent = 333;
63402    t.Ntilde = 722;
63403    t.otilde = 556;
63404    t.Rcommaaccent = 722;
63405    t.Lcommaaccent = 556;
63406    t.Atilde = 667;
63407    t.Aogonek = 667;
63408    t.Aring = 667;
63409    t.Otilde = 778;
63410    t.zdotaccent = 500;
63411    t.Ecaron = 667;
63412    t.Iogonek = 278;
63413    t.kcommaaccent = 500;
63414    t.minus = 584;
63415    t.Icircumflex = 278;
63416    t.ncaron = 556;
63417    t.tcommaaccent = 278;
63418    t.logicalnot = 584;
63419    t.odieresis = 556;
63420    t.udieresis = 556;
63421    t.notequal = 549;
63422    t.gcommaaccent = 556;
63423    t.eth = 556;
63424    t.zcaron = 500;
63425    t.ncommaaccent = 556;
63426    t.onesuperior = 333;
63427    t.imacron = 278;
63428    t.Euro = 556;
63429  });
63430  t.Symbol = (0, _core_utils.getLookupTableFactory)(function (t) {
63431    t.space = 250;
63432    t.exclam = 333;
63433    t.universal = 713;
63434    t.numbersign = 500;
63435    t.existential = 549;
63436    t.percent = 833;
63437    t.ampersand = 778;
63438    t.suchthat = 439;
63439    t.parenleft = 333;
63440    t.parenright = 333;
63441    t.asteriskmath = 500;
63442    t.plus = 549;
63443    t.comma = 250;
63444    t.minus = 549;
63445    t.period = 250;
63446    t.slash = 278;
63447    t.zero = 500;
63448    t.one = 500;
63449    t.two = 500;
63450    t.three = 500;
63451    t.four = 500;
63452    t.five = 500;
63453    t.six = 500;
63454    t.seven = 500;
63455    t.eight = 500;
63456    t.nine = 500;
63457    t.colon = 278;
63458    t.semicolon = 278;
63459    t.less = 549;
63460    t.equal = 549;
63461    t.greater = 549;
63462    t.question = 444;
63463    t.congruent = 549;
63464    t.Alpha = 722;
63465    t.Beta = 667;
63466    t.Chi = 722;
63467    t.Delta = 612;
63468    t.Epsilon = 611;
63469    t.Phi = 763;
63470    t.Gamma = 603;
63471    t.Eta = 722;
63472    t.Iota = 333;
63473    t.theta1 = 631;
63474    t.Kappa = 722;
63475    t.Lambda = 686;
63476    t.Mu = 889;
63477    t.Nu = 722;
63478    t.Omicron = 722;
63479    t.Pi = 768;
63480    t.Theta = 741;
63481    t.Rho = 556;
63482    t.Sigma = 592;
63483    t.Tau = 611;
63484    t.Upsilon = 690;
63485    t.sigma1 = 439;
63486    t.Omega = 768;
63487    t.Xi = 645;
63488    t.Psi = 795;
63489    t.Zeta = 611;
63490    t.bracketleft = 333;
63491    t.therefore = 863;
63492    t.bracketright = 333;
63493    t.perpendicular = 658;
63494    t.underscore = 500;
63495    t.radicalex = 500;
63496    t.alpha = 631;
63497    t.beta = 549;
63498    t.chi = 549;
63499    t.delta = 494;
63500    t.epsilon = 439;
63501    t.phi = 521;
63502    t.gamma = 411;
63503    t.eta = 603;
63504    t.iota = 329;
63505    t.phi1 = 603;
63506    t.kappa = 549;
63507    t.lambda = 549;
63508    t.mu = 576;
63509    t.nu = 521;
63510    t.omicron = 549;
63511    t.pi = 549;
63512    t.theta = 521;
63513    t.rho = 549;
63514    t.sigma = 603;
63515    t.tau = 439;
63516    t.upsilon = 576;
63517    t.omega1 = 713;
63518    t.omega = 686;
63519    t.xi = 493;
63520    t.psi = 686;
63521    t.zeta = 494;
63522    t.braceleft = 480;
63523    t.bar = 200;
63524    t.braceright = 480;
63525    t.similar = 549;
63526    t.Euro = 750;
63527    t.Upsilon1 = 620;
63528    t.minute = 247;
63529    t.lessequal = 549;
63530    t.fraction = 167;
63531    t.infinity = 713;
63532    t.florin = 500;
63533    t.club = 753;
63534    t.diamond = 753;
63535    t.heart = 753;
63536    t.spade = 753;
63537    t.arrowboth = 1042;
63538    t.arrowleft = 987;
63539    t.arrowup = 603;
63540    t.arrowright = 987;
63541    t.arrowdown = 603;
63542    t.degree = 400;
63543    t.plusminus = 549;
63544    t.second = 411;
63545    t.greaterequal = 549;
63546    t.multiply = 549;
63547    t.proportional = 713;
63548    t.partialdiff = 494;
63549    t.bullet = 460;
63550    t.divide = 549;
63551    t.notequal = 549;
63552    t.equivalence = 549;
63553    t.approxequal = 549;
63554    t.ellipsis = 1000;
63555    t.arrowvertex = 603;
63556    t.arrowhorizex = 1000;
63557    t.carriagereturn = 658;
63558    t.aleph = 823;
63559    t.Ifraktur = 686;
63560    t.Rfraktur = 795;
63561    t.weierstrass = 987;
63562    t.circlemultiply = 768;
63563    t.circleplus = 768;
63564    t.emptyset = 823;
63565    t.intersection = 768;
63566    t.union = 768;
63567    t.propersuperset = 713;
63568    t.reflexsuperset = 713;
63569    t.notsubset = 713;
63570    t.propersubset = 713;
63571    t.reflexsubset = 713;
63572    t.element = 713;
63573    t.notelement = 713;
63574    t.angle = 768;
63575    t.gradient = 713;
63576    t.registerserif = 790;
63577    t.copyrightserif = 790;
63578    t.trademarkserif = 890;
63579    t.product = 823;
63580    t.radical = 549;
63581    t.dotmath = 250;
63582    t.logicalnot = 713;
63583    t.logicaland = 603;
63584    t.logicalor = 603;
63585    t.arrowdblboth = 1042;
63586    t.arrowdblleft = 987;
63587    t.arrowdblup = 603;
63588    t.arrowdblright = 987;
63589    t.arrowdbldown = 603;
63590    t.lozenge = 494;
63591    t.angleleft = 329;
63592    t.registersans = 790;
63593    t.copyrightsans = 790;
63594    t.trademarksans = 786;
63595    t.summation = 713;
63596    t.parenlefttp = 384;
63597    t.parenleftex = 384;
63598    t.parenleftbt = 384;
63599    t.bracketlefttp = 384;
63600    t.bracketleftex = 384;
63601    t.bracketleftbt = 384;
63602    t.bracelefttp = 494;
63603    t.braceleftmid = 494;
63604    t.braceleftbt = 494;
63605    t.braceex = 494;
63606    t.angleright = 329;
63607    t.integral = 274;
63608    t.integraltp = 686;
63609    t.integralex = 686;
63610    t.integralbt = 686;
63611    t.parenrighttp = 384;
63612    t.parenrightex = 384;
63613    t.parenrightbt = 384;
63614    t.bracketrighttp = 384;
63615    t.bracketrightex = 384;
63616    t.bracketrightbt = 384;
63617    t.bracerighttp = 494;
63618    t.bracerightmid = 494;
63619    t.bracerightbt = 494;
63620    t.apple = 790;
63621  });
63622  t["Times-Roman"] = (0, _core_utils.getLookupTableFactory)(function (t) {
63623    t.space = 250;
63624    t.exclam = 333;
63625    t.quotedbl = 408;
63626    t.numbersign = 500;
63627    t.dollar = 500;
63628    t.percent = 833;
63629    t.ampersand = 778;
63630    t.quoteright = 333;
63631    t.parenleft = 333;
63632    t.parenright = 333;
63633    t.asterisk = 500;
63634    t.plus = 564;
63635    t.comma = 250;
63636    t.hyphen = 333;
63637    t.period = 250;
63638    t.slash = 278;
63639    t.zero = 500;
63640    t.one = 500;
63641    t.two = 500;
63642    t.three = 500;
63643    t.four = 500;
63644    t.five = 500;
63645    t.six = 500;
63646    t.seven = 500;
63647    t.eight = 500;
63648    t.nine = 500;
63649    t.colon = 278;
63650    t.semicolon = 278;
63651    t.less = 564;
63652    t.equal = 564;
63653    t.greater = 564;
63654    t.question = 444;
63655    t.at = 921;
63656    t.A = 722;
63657    t.B = 667;
63658    t.C = 667;
63659    t.D = 722;
63660    t.E = 611;
63661    t.F = 556;
63662    t.G = 722;
63663    t.H = 722;
63664    t.I = 333;
63665    t.J = 389;
63666    t.K = 722;
63667    t.L = 611;
63668    t.M = 889;
63669    t.N = 722;
63670    t.O = 722;
63671    t.P = 556;
63672    t.Q = 722;
63673    t.R = 667;
63674    t.S = 556;
63675    t.T = 611;
63676    t.U = 722;
63677    t.V = 722;
63678    t.W = 944;
63679    t.X = 722;
63680    t.Y = 722;
63681    t.Z = 611;
63682    t.bracketleft = 333;
63683    t.backslash = 278;
63684    t.bracketright = 333;
63685    t.asciicircum = 469;
63686    t.underscore = 500;
63687    t.quoteleft = 333;
63688    t.a = 444;
63689    t.b = 500;
63690    t.c = 444;
63691    t.d = 500;
63692    t.e = 444;
63693    t.f = 333;
63694    t.g = 500;
63695    t.h = 500;
63696    t.i = 278;
63697    t.j = 278;
63698    t.k = 500;
63699    t.l = 278;
63700    t.m = 778;
63701    t.n = 500;
63702    t.o = 500;
63703    t.p = 500;
63704    t.q = 500;
63705    t.r = 333;
63706    t.s = 389;
63707    t.t = 278;
63708    t.u = 500;
63709    t.v = 500;
63710    t.w = 722;
63711    t.x = 500;
63712    t.y = 500;
63713    t.z = 444;
63714    t.braceleft = 480;
63715    t.bar = 200;
63716    t.braceright = 480;
63717    t.asciitilde = 541;
63718    t.exclamdown = 333;
63719    t.cent = 500;
63720    t.sterling = 500;
63721    t.fraction = 167;
63722    t.yen = 500;
63723    t.florin = 500;
63724    t.section = 500;
63725    t.currency = 500;
63726    t.quotesingle = 180;
63727    t.quotedblleft = 444;
63728    t.guillemotleft = 500;
63729    t.guilsinglleft = 333;
63730    t.guilsinglright = 333;
63731    t.fi = 556;
63732    t.fl = 556;
63733    t.endash = 500;
63734    t.dagger = 500;
63735    t.daggerdbl = 500;
63736    t.periodcentered = 250;
63737    t.paragraph = 453;
63738    t.bullet = 350;
63739    t.quotesinglbase = 333;
63740    t.quotedblbase = 444;
63741    t.quotedblright = 444;
63742    t.guillemotright = 500;
63743    t.ellipsis = 1000;
63744    t.perthousand = 1000;
63745    t.questiondown = 444;
63746    t.grave = 333;
63747    t.acute = 333;
63748    t.circumflex = 333;
63749    t.tilde = 333;
63750    t.macron = 333;
63751    t.breve = 333;
63752    t.dotaccent = 333;
63753    t.dieresis = 333;
63754    t.ring = 333;
63755    t.cedilla = 333;
63756    t.hungarumlaut = 333;
63757    t.ogonek = 333;
63758    t.caron = 333;
63759    t.emdash = 1000;
63760    t.AE = 889;
63761    t.ordfeminine = 276;
63762    t.Lslash = 611;
63763    t.Oslash = 722;
63764    t.OE = 889;
63765    t.ordmasculine = 310;
63766    t.ae = 667;
63767    t.dotlessi = 278;
63768    t.lslash = 278;
63769    t.oslash = 500;
63770    t.oe = 722;
63771    t.germandbls = 500;
63772    t.Idieresis = 333;
63773    t.eacute = 444;
63774    t.abreve = 444;
63775    t.uhungarumlaut = 500;
63776    t.ecaron = 444;
63777    t.Ydieresis = 722;
63778    t.divide = 564;
63779    t.Yacute = 722;
63780    t.Acircumflex = 722;
63781    t.aacute = 444;
63782    t.Ucircumflex = 722;
63783    t.yacute = 500;
63784    t.scommaaccent = 389;
63785    t.ecircumflex = 444;
63786    t.Uring = 722;
63787    t.Udieresis = 722;
63788    t.aogonek = 444;
63789    t.Uacute = 722;
63790    t.uogonek = 500;
63791    t.Edieresis = 611;
63792    t.Dcroat = 722;
63793    t.commaaccent = 250;
63794    t.copyright = 760;
63795    t.Emacron = 611;
63796    t.ccaron = 444;
63797    t.aring = 444;
63798    t.Ncommaaccent = 722;
63799    t.lacute = 278;
63800    t.agrave = 444;
63801    t.Tcommaaccent = 611;
63802    t.Cacute = 667;
63803    t.atilde = 444;
63804    t.Edotaccent = 611;
63805    t.scaron = 389;
63806    t.scedilla = 389;
63807    t.iacute = 278;
63808    t.lozenge = 471;
63809    t.Rcaron = 667;
63810    t.Gcommaaccent = 722;
63811    t.ucircumflex = 500;
63812    t.acircumflex = 444;
63813    t.Amacron = 722;
63814    t.rcaron = 333;
63815    t.ccedilla = 444;
63816    t.Zdotaccent = 611;
63817    t.Thorn = 556;
63818    t.Omacron = 722;
63819    t.Racute = 667;
63820    t.Sacute = 556;
63821    t.dcaron = 588;
63822    t.Umacron = 722;
63823    t.uring = 500;
63824    t.threesuperior = 300;
63825    t.Ograve = 722;
63826    t.Agrave = 722;
63827    t.Abreve = 722;
63828    t.multiply = 564;
63829    t.uacute = 500;
63830    t.Tcaron = 611;
63831    t.partialdiff = 476;
63832    t.ydieresis = 500;
63833    t.Nacute = 722;
63834    t.icircumflex = 278;
63835    t.Ecircumflex = 611;
63836    t.adieresis = 444;
63837    t.edieresis = 444;
63838    t.cacute = 444;
63839    t.nacute = 500;
63840    t.umacron = 500;
63841    t.Ncaron = 722;
63842    t.Iacute = 333;
63843    t.plusminus = 564;
63844    t.brokenbar = 200;
63845    t.registered = 760;
63846    t.Gbreve = 722;
63847    t.Idotaccent = 333;
63848    t.summation = 600;
63849    t.Egrave = 611;
63850    t.racute = 333;
63851    t.omacron = 500;
63852    t.Zacute = 611;
63853    t.Zcaron = 611;
63854    t.greaterequal = 549;
63855    t.Eth = 722;
63856    t.Ccedilla = 667;
63857    t.lcommaaccent = 278;
63858    t.tcaron = 326;
63859    t.eogonek = 444;
63860    t.Uogonek = 722;
63861    t.Aacute = 722;
63862    t.Adieresis = 722;
63863    t.egrave = 444;
63864    t.zacute = 444;
63865    t.iogonek = 278;
63866    t.Oacute = 722;
63867    t.oacute = 500;
63868    t.amacron = 444;
63869    t.sacute = 389;
63870    t.idieresis = 278;
63871    t.Ocircumflex = 722;
63872    t.Ugrave = 722;
63873    t.Delta = 612;
63874    t.thorn = 500;
63875    t.twosuperior = 300;
63876    t.Odieresis = 722;
63877    t.mu = 500;
63878    t.igrave = 278;
63879    t.ohungarumlaut = 500;
63880    t.Eogonek = 611;
63881    t.dcroat = 500;
63882    t.threequarters = 750;
63883    t.Scedilla = 556;
63884    t.lcaron = 344;
63885    t.Kcommaaccent = 722;
63886    t.Lacute = 611;
63887    t.trademark = 980;
63888    t.edotaccent = 444;
63889    t.Igrave = 333;
63890    t.Imacron = 333;
63891    t.Lcaron = 611;
63892    t.onehalf = 750;
63893    t.lessequal = 549;
63894    t.ocircumflex = 500;
63895    t.ntilde = 500;
63896    t.Uhungarumlaut = 722;
63897    t.Eacute = 611;
63898    t.emacron = 444;
63899    t.gbreve = 500;
63900    t.onequarter = 750;
63901    t.Scaron = 556;
63902    t.Scommaaccent = 556;
63903    t.Ohungarumlaut = 722;
63904    t.degree = 400;
63905    t.ograve = 500;
63906    t.Ccaron = 667;
63907    t.ugrave = 500;
63908    t.radical = 453;
63909    t.Dcaron = 722;
63910    t.rcommaaccent = 333;
63911    t.Ntilde = 722;
63912    t.otilde = 500;
63913    t.Rcommaaccent = 667;
63914    t.Lcommaaccent = 611;
63915    t.Atilde = 722;
63916    t.Aogonek = 722;
63917    t.Aring = 722;
63918    t.Otilde = 722;
63919    t.zdotaccent = 444;
63920    t.Ecaron = 611;
63921    t.Iogonek = 333;
63922    t.kcommaaccent = 500;
63923    t.minus = 564;
63924    t.Icircumflex = 333;
63925    t.ncaron = 500;
63926    t.tcommaaccent = 278;
63927    t.logicalnot = 564;
63928    t.odieresis = 500;
63929    t.udieresis = 500;
63930    t.notequal = 549;
63931    t.gcommaaccent = 500;
63932    t.eth = 500;
63933    t.zcaron = 444;
63934    t.ncommaaccent = 500;
63935    t.onesuperior = 300;
63936    t.imacron = 278;
63937    t.Euro = 500;
63938  });
63939  t["Times-Bold"] = (0, _core_utils.getLookupTableFactory)(function (t) {
63940    t.space = 250;
63941    t.exclam = 333;
63942    t.quotedbl = 555;
63943    t.numbersign = 500;
63944    t.dollar = 500;
63945    t.percent = 1000;
63946    t.ampersand = 833;
63947    t.quoteright = 333;
63948    t.parenleft = 333;
63949    t.parenright = 333;
63950    t.asterisk = 500;
63951    t.plus = 570;
63952    t.comma = 250;
63953    t.hyphen = 333;
63954    t.period = 250;
63955    t.slash = 278;
63956    t.zero = 500;
63957    t.one = 500;
63958    t.two = 500;
63959    t.three = 500;
63960    t.four = 500;
63961    t.five = 500;
63962    t.six = 500;
63963    t.seven = 500;
63964    t.eight = 500;
63965    t.nine = 500;
63966    t.colon = 333;
63967    t.semicolon = 333;
63968    t.less = 570;
63969    t.equal = 570;
63970    t.greater = 570;
63971    t.question = 500;
63972    t.at = 930;
63973    t.A = 722;
63974    t.B = 667;
63975    t.C = 722;
63976    t.D = 722;
63977    t.E = 667;
63978    t.F = 611;
63979    t.G = 778;
63980    t.H = 778;
63981    t.I = 389;
63982    t.J = 500;
63983    t.K = 778;
63984    t.L = 667;
63985    t.M = 944;
63986    t.N = 722;
63987    t.O = 778;
63988    t.P = 611;
63989    t.Q = 778;
63990    t.R = 722;
63991    t.S = 556;
63992    t.T = 667;
63993    t.U = 722;
63994    t.V = 722;
63995    t.W = 1000;
63996    t.X = 722;
63997    t.Y = 722;
63998    t.Z = 667;
63999    t.bracketleft = 333;
64000    t.backslash = 278;
64001    t.bracketright = 333;
64002    t.asciicircum = 581;
64003    t.underscore = 500;
64004    t.quoteleft = 333;
64005    t.a = 500;
64006    t.b = 556;
64007    t.c = 444;
64008    t.d = 556;
64009    t.e = 444;
64010    t.f = 333;
64011    t.g = 500;
64012    t.h = 556;
64013    t.i = 278;
64014    t.j = 333;
64015    t.k = 556;
64016    t.l = 278;
64017    t.m = 833;
64018    t.n = 556;
64019    t.o = 500;
64020    t.p = 556;
64021    t.q = 556;
64022    t.r = 444;
64023    t.s = 389;
64024    t.t = 333;
64025    t.u = 556;
64026    t.v = 500;
64027    t.w = 722;
64028    t.x = 500;
64029    t.y = 500;
64030    t.z = 444;
64031    t.braceleft = 394;
64032    t.bar = 220;
64033    t.braceright = 394;
64034    t.asciitilde = 520;
64035    t.exclamdown = 333;
64036    t.cent = 500;
64037    t.sterling = 500;
64038    t.fraction = 167;
64039    t.yen = 500;
64040    t.florin = 500;
64041    t.section = 500;
64042    t.currency = 500;
64043    t.quotesingle = 278;
64044    t.quotedblleft = 500;
64045    t.guillemotleft = 500;
64046    t.guilsinglleft = 333;
64047    t.guilsinglright = 333;
64048    t.fi = 556;
64049    t.fl = 556;
64050    t.endash = 500;
64051    t.dagger = 500;
64052    t.daggerdbl = 500;
64053    t.periodcentered = 250;
64054    t.paragraph = 540;
64055    t.bullet = 350;
64056    t.quotesinglbase = 333;
64057    t.quotedblbase = 500;
64058    t.quotedblright = 500;
64059    t.guillemotright = 500;
64060    t.ellipsis = 1000;
64061    t.perthousand = 1000;
64062    t.questiondown = 500;
64063    t.grave = 333;
64064    t.acute = 333;
64065    t.circumflex = 333;
64066    t.tilde = 333;
64067    t.macron = 333;
64068    t.breve = 333;
64069    t.dotaccent = 333;
64070    t.dieresis = 333;
64071    t.ring = 333;
64072    t.cedilla = 333;
64073    t.hungarumlaut = 333;
64074    t.ogonek = 333;
64075    t.caron = 333;
64076    t.emdash = 1000;
64077    t.AE = 1000;
64078    t.ordfeminine = 300;
64079    t.Lslash = 667;
64080    t.Oslash = 778;
64081    t.OE = 1000;
64082    t.ordmasculine = 330;
64083    t.ae = 722;
64084    t.dotlessi = 278;
64085    t.lslash = 278;
64086    t.oslash = 500;
64087    t.oe = 722;
64088    t.germandbls = 556;
64089    t.Idieresis = 389;
64090    t.eacute = 444;
64091    t.abreve = 500;
64092    t.uhungarumlaut = 556;
64093    t.ecaron = 444;
64094    t.Ydieresis = 722;
64095    t.divide = 570;
64096    t.Yacute = 722;
64097    t.Acircumflex = 722;
64098    t.aacute = 500;
64099    t.Ucircumflex = 722;
64100    t.yacute = 500;
64101    t.scommaaccent = 389;
64102    t.ecircumflex = 444;
64103    t.Uring = 722;
64104    t.Udieresis = 722;
64105    t.aogonek = 500;
64106    t.Uacute = 722;
64107    t.uogonek = 556;
64108    t.Edieresis = 667;
64109    t.Dcroat = 722;
64110    t.commaaccent = 250;
64111    t.copyright = 747;
64112    t.Emacron = 667;
64113    t.ccaron = 444;
64114    t.aring = 500;
64115    t.Ncommaaccent = 722;
64116    t.lacute = 278;
64117    t.agrave = 500;
64118    t.Tcommaaccent = 667;
64119    t.Cacute = 722;
64120    t.atilde = 500;
64121    t.Edotaccent = 667;
64122    t.scaron = 389;
64123    t.scedilla = 389;
64124    t.iacute = 278;
64125    t.lozenge = 494;
64126    t.Rcaron = 722;
64127    t.Gcommaaccent = 778;
64128    t.ucircumflex = 556;
64129    t.acircumflex = 500;
64130    t.Amacron = 722;
64131    t.rcaron = 444;
64132    t.ccedilla = 444;
64133    t.Zdotaccent = 667;
64134    t.Thorn = 611;
64135    t.Omacron = 778;
64136    t.Racute = 722;
64137    t.Sacute = 556;
64138    t.dcaron = 672;
64139    t.Umacron = 722;
64140    t.uring = 556;
64141    t.threesuperior = 300;
64142    t.Ograve = 778;
64143    t.Agrave = 722;
64144    t.Abreve = 722;
64145    t.multiply = 570;
64146    t.uacute = 556;
64147    t.Tcaron = 667;
64148    t.partialdiff = 494;
64149    t.ydieresis = 500;
64150    t.Nacute = 722;
64151    t.icircumflex = 278;
64152    t.Ecircumflex = 667;
64153    t.adieresis = 500;
64154    t.edieresis = 444;
64155    t.cacute = 444;
64156    t.nacute = 556;
64157    t.umacron = 556;
64158    t.Ncaron = 722;
64159    t.Iacute = 389;
64160    t.plusminus = 570;
64161    t.brokenbar = 220;
64162    t.registered = 747;
64163    t.Gbreve = 778;
64164    t.Idotaccent = 389;
64165    t.summation = 600;
64166    t.Egrave = 667;
64167    t.racute = 444;
64168    t.omacron = 500;
64169    t.Zacute = 667;
64170    t.Zcaron = 667;
64171    t.greaterequal = 549;
64172    t.Eth = 722;
64173    t.Ccedilla = 722;
64174    t.lcommaaccent = 278;
64175    t.tcaron = 416;
64176    t.eogonek = 444;
64177    t.Uogonek = 722;
64178    t.Aacute = 722;
64179    t.Adieresis = 722;
64180    t.egrave = 444;
64181    t.zacute = 444;
64182    t.iogonek = 278;
64183    t.Oacute = 778;
64184    t.oacute = 500;
64185    t.amacron = 500;
64186    t.sacute = 389;
64187    t.idieresis = 278;
64188    t.Ocircumflex = 778;
64189    t.Ugrave = 722;
64190    t.Delta = 612;
64191    t.thorn = 556;
64192    t.twosuperior = 300;
64193    t.Odieresis = 778;
64194    t.mu = 556;
64195    t.igrave = 278;
64196    t.ohungarumlaut = 500;
64197    t.Eogonek = 667;
64198    t.dcroat = 556;
64199    t.threequarters = 750;
64200    t.Scedilla = 556;
64201    t.lcaron = 394;
64202    t.Kcommaaccent = 778;
64203    t.Lacute = 667;
64204    t.trademark = 1000;
64205    t.edotaccent = 444;
64206    t.Igrave = 389;
64207    t.Imacron = 389;
64208    t.Lcaron = 667;
64209    t.onehalf = 750;
64210    t.lessequal = 549;
64211    t.ocircumflex = 500;
64212    t.ntilde = 556;
64213    t.Uhungarumlaut = 722;
64214    t.Eacute = 667;
64215    t.emacron = 444;
64216    t.gbreve = 500;
64217    t.onequarter = 750;
64218    t.Scaron = 556;
64219    t.Scommaaccent = 556;
64220    t.Ohungarumlaut = 778;
64221    t.degree = 400;
64222    t.ograve = 500;
64223    t.Ccaron = 722;
64224    t.ugrave = 556;
64225    t.radical = 549;
64226    t.Dcaron = 722;
64227    t.rcommaaccent = 444;
64228    t.Ntilde = 722;
64229    t.otilde = 500;
64230    t.Rcommaaccent = 722;
64231    t.Lcommaaccent = 667;
64232    t.Atilde = 722;
64233    t.Aogonek = 722;
64234    t.Aring = 722;
64235    t.Otilde = 778;
64236    t.zdotaccent = 444;
64237    t.Ecaron = 667;
64238    t.Iogonek = 389;
64239    t.kcommaaccent = 556;
64240    t.minus = 570;
64241    t.Icircumflex = 389;
64242    t.ncaron = 556;
64243    t.tcommaaccent = 333;
64244    t.logicalnot = 570;
64245    t.odieresis = 500;
64246    t.udieresis = 556;
64247    t.notequal = 549;
64248    t.gcommaaccent = 500;
64249    t.eth = 500;
64250    t.zcaron = 444;
64251    t.ncommaaccent = 556;
64252    t.onesuperior = 300;
64253    t.imacron = 278;
64254    t.Euro = 500;
64255  });
64256  t["Times-BoldItalic"] = (0, _core_utils.getLookupTableFactory)(function (t) {
64257    t.space = 250;
64258    t.exclam = 389;
64259    t.quotedbl = 555;
64260    t.numbersign = 500;
64261    t.dollar = 500;
64262    t.percent = 833;
64263    t.ampersand = 778;
64264    t.quoteright = 333;
64265    t.parenleft = 333;
64266    t.parenright = 333;
64267    t.asterisk = 500;
64268    t.plus = 570;
64269    t.comma = 250;
64270    t.hyphen = 333;
64271    t.period = 250;
64272    t.slash = 278;
64273    t.zero = 500;
64274    t.one = 500;
64275    t.two = 500;
64276    t.three = 500;
64277    t.four = 500;
64278    t.five = 500;
64279    t.six = 500;
64280    t.seven = 500;
64281    t.eight = 500;
64282    t.nine = 500;
64283    t.colon = 333;
64284    t.semicolon = 333;
64285    t.less = 570;
64286    t.equal = 570;
64287    t.greater = 570;
64288    t.question = 500;
64289    t.at = 832;
64290    t.A = 667;
64291    t.B = 667;
64292    t.C = 667;
64293    t.D = 722;
64294    t.E = 667;
64295    t.F = 667;
64296    t.G = 722;
64297    t.H = 778;
64298    t.I = 389;
64299    t.J = 500;
64300    t.K = 667;
64301    t.L = 611;
64302    t.M = 889;
64303    t.N = 722;
64304    t.O = 722;
64305    t.P = 611;
64306    t.Q = 722;
64307    t.R = 667;
64308    t.S = 556;
64309    t.T = 611;
64310    t.U = 722;
64311    t.V = 667;
64312    t.W = 889;
64313    t.X = 667;
64314    t.Y = 611;
64315    t.Z = 611;
64316    t.bracketleft = 333;
64317    t.backslash = 278;
64318    t.bracketright = 333;
64319    t.asciicircum = 570;
64320    t.underscore = 500;
64321    t.quoteleft = 333;
64322    t.a = 500;
64323    t.b = 500;
64324    t.c = 444;
64325    t.d = 500;
64326    t.e = 444;
64327    t.f = 333;
64328    t.g = 500;
64329    t.h = 556;
64330    t.i = 278;
64331    t.j = 278;
64332    t.k = 500;
64333    t.l = 278;
64334    t.m = 778;
64335    t.n = 556;
64336    t.o = 500;
64337    t.p = 500;
64338    t.q = 500;
64339    t.r = 389;
64340    t.s = 389;
64341    t.t = 278;
64342    t.u = 556;
64343    t.v = 444;
64344    t.w = 667;
64345    t.x = 500;
64346    t.y = 444;
64347    t.z = 389;
64348    t.braceleft = 348;
64349    t.bar = 220;
64350    t.braceright = 348;
64351    t.asciitilde = 570;
64352    t.exclamdown = 389;
64353    t.cent = 500;
64354    t.sterling = 500;
64355    t.fraction = 167;
64356    t.yen = 500;
64357    t.florin = 500;
64358    t.section = 500;
64359    t.currency = 500;
64360    t.quotesingle = 278;
64361    t.quotedblleft = 500;
64362    t.guillemotleft = 500;
64363    t.guilsinglleft = 333;
64364    t.guilsinglright = 333;
64365    t.fi = 556;
64366    t.fl = 556;
64367    t.endash = 500;
64368    t.dagger = 500;
64369    t.daggerdbl = 500;
64370    t.periodcentered = 250;
64371    t.paragraph = 500;
64372    t.bullet = 350;
64373    t.quotesinglbase = 333;
64374    t.quotedblbase = 500;
64375    t.quotedblright = 500;
64376    t.guillemotright = 500;
64377    t.ellipsis = 1000;
64378    t.perthousand = 1000;
64379    t.questiondown = 500;
64380    t.grave = 333;
64381    t.acute = 333;
64382    t.circumflex = 333;
64383    t.tilde = 333;
64384    t.macron = 333;
64385    t.breve = 333;
64386    t.dotaccent = 333;
64387    t.dieresis = 333;
64388    t.ring = 333;
64389    t.cedilla = 333;
64390    t.hungarumlaut = 333;
64391    t.ogonek = 333;
64392    t.caron = 333;
64393    t.emdash = 1000;
64394    t.AE = 944;
64395    t.ordfeminine = 266;
64396    t.Lslash = 611;
64397    t.Oslash = 722;
64398    t.OE = 944;
64399    t.ordmasculine = 300;
64400    t.ae = 722;
64401    t.dotlessi = 278;
64402    t.lslash = 278;
64403    t.oslash = 500;
64404    t.oe = 722;
64405    t.germandbls = 500;
64406    t.Idieresis = 389;
64407    t.eacute = 444;
64408    t.abreve = 500;
64409    t.uhungarumlaut = 556;
64410    t.ecaron = 444;
64411    t.Ydieresis = 611;
64412    t.divide = 570;
64413    t.Yacute = 611;
64414    t.Acircumflex = 667;
64415    t.aacute = 500;
64416    t.Ucircumflex = 722;
64417    t.yacute = 444;
64418    t.scommaaccent = 389;
64419    t.ecircumflex = 444;
64420    t.Uring = 722;
64421    t.Udieresis = 722;
64422    t.aogonek = 500;
64423    t.Uacute = 722;
64424    t.uogonek = 556;
64425    t.Edieresis = 667;
64426    t.Dcroat = 722;
64427    t.commaaccent = 250;
64428    t.copyright = 747;
64429    t.Emacron = 667;
64430    t.ccaron = 444;
64431    t.aring = 500;
64432    t.Ncommaaccent = 722;
64433    t.lacute = 278;
64434    t.agrave = 500;
64435    t.Tcommaaccent = 611;
64436    t.Cacute = 667;
64437    t.atilde = 500;
64438    t.Edotaccent = 667;
64439    t.scaron = 389;
64440    t.scedilla = 389;
64441    t.iacute = 278;
64442    t.lozenge = 494;
64443    t.Rcaron = 667;
64444    t.Gcommaaccent = 722;
64445    t.ucircumflex = 556;
64446    t.acircumflex = 500;
64447    t.Amacron = 667;
64448    t.rcaron = 389;
64449    t.ccedilla = 444;
64450    t.Zdotaccent = 611;
64451    t.Thorn = 611;
64452    t.Omacron = 722;
64453    t.Racute = 667;
64454    t.Sacute = 556;
64455    t.dcaron = 608;
64456    t.Umacron = 722;
64457    t.uring = 556;
64458    t.threesuperior = 300;
64459    t.Ograve = 722;
64460    t.Agrave = 667;
64461    t.Abreve = 667;
64462    t.multiply = 570;
64463    t.uacute = 556;
64464    t.Tcaron = 611;
64465    t.partialdiff = 494;
64466    t.ydieresis = 444;
64467    t.Nacute = 722;
64468    t.icircumflex = 278;
64469    t.Ecircumflex = 667;
64470    t.adieresis = 500;
64471    t.edieresis = 444;
64472    t.cacute = 444;
64473    t.nacute = 556;
64474    t.umacron = 556;
64475    t.Ncaron = 722;
64476    t.Iacute = 389;
64477    t.plusminus = 570;
64478    t.brokenbar = 220;
64479    t.registered = 747;
64480    t.Gbreve = 722;
64481    t.Idotaccent = 389;
64482    t.summation = 600;
64483    t.Egrave = 667;
64484    t.racute = 389;
64485    t.omacron = 500;
64486    t.Zacute = 611;
64487    t.Zcaron = 611;
64488    t.greaterequal = 549;
64489    t.Eth = 722;
64490    t.Ccedilla = 667;
64491    t.lcommaaccent = 278;
64492    t.tcaron = 366;
64493    t.eogonek = 444;
64494    t.Uogonek = 722;
64495    t.Aacute = 667;
64496    t.Adieresis = 667;
64497    t.egrave = 444;
64498    t.zacute = 389;
64499    t.iogonek = 278;
64500    t.Oacute = 722;
64501    t.oacute = 500;
64502    t.amacron = 500;
64503    t.sacute = 389;
64504    t.idieresis = 278;
64505    t.Ocircumflex = 722;
64506    t.Ugrave = 722;
64507    t.Delta = 612;
64508    t.thorn = 500;
64509    t.twosuperior = 300;
64510    t.Odieresis = 722;
64511    t.mu = 576;
64512    t.igrave = 278;
64513    t.ohungarumlaut = 500;
64514    t.Eogonek = 667;
64515    t.dcroat = 500;
64516    t.threequarters = 750;
64517    t.Scedilla = 556;
64518    t.lcaron = 382;
64519    t.Kcommaaccent = 667;
64520    t.Lacute = 611;
64521    t.trademark = 1000;
64522    t.edotaccent = 444;
64523    t.Igrave = 389;
64524    t.Imacron = 389;
64525    t.Lcaron = 611;
64526    t.onehalf = 750;
64527    t.lessequal = 549;
64528    t.ocircumflex = 500;
64529    t.ntilde = 556;
64530    t.Uhungarumlaut = 722;
64531    t.Eacute = 667;
64532    t.emacron = 444;
64533    t.gbreve = 500;
64534    t.onequarter = 750;
64535    t.Scaron = 556;
64536    t.Scommaaccent = 556;
64537    t.Ohungarumlaut = 722;
64538    t.degree = 400;
64539    t.ograve = 500;
64540    t.Ccaron = 667;
64541    t.ugrave = 556;
64542    t.radical = 549;
64543    t.Dcaron = 722;
64544    t.rcommaaccent = 389;
64545    t.Ntilde = 722;
64546    t.otilde = 500;
64547    t.Rcommaaccent = 667;
64548    t.Lcommaaccent = 611;
64549    t.Atilde = 667;
64550    t.Aogonek = 667;
64551    t.Aring = 667;
64552    t.Otilde = 722;
64553    t.zdotaccent = 389;
64554    t.Ecaron = 667;
64555    t.Iogonek = 389;
64556    t.kcommaaccent = 500;
64557    t.minus = 606;
64558    t.Icircumflex = 389;
64559    t.ncaron = 556;
64560    t.tcommaaccent = 278;
64561    t.logicalnot = 606;
64562    t.odieresis = 500;
64563    t.udieresis = 556;
64564    t.notequal = 549;
64565    t.gcommaaccent = 500;
64566    t.eth = 500;
64567    t.zcaron = 389;
64568    t.ncommaaccent = 556;
64569    t.onesuperior = 300;
64570    t.imacron = 278;
64571    t.Euro = 500;
64572  });
64573  t["Times-Italic"] = (0, _core_utils.getLookupTableFactory)(function (t) {
64574    t.space = 250;
64575    t.exclam = 333;
64576    t.quotedbl = 420;
64577    t.numbersign = 500;
64578    t.dollar = 500;
64579    t.percent = 833;
64580    t.ampersand = 778;
64581    t.quoteright = 333;
64582    t.parenleft = 333;
64583    t.parenright = 333;
64584    t.asterisk = 500;
64585    t.plus = 675;
64586    t.comma = 250;
64587    t.hyphen = 333;
64588    t.period = 250;
64589    t.slash = 278;
64590    t.zero = 500;
64591    t.one = 500;
64592    t.two = 500;
64593    t.three = 500;
64594    t.four = 500;
64595    t.five = 500;
64596    t.six = 500;
64597    t.seven = 500;
64598    t.eight = 500;
64599    t.nine = 500;
64600    t.colon = 333;
64601    t.semicolon = 333;
64602    t.less = 675;
64603    t.equal = 675;
64604    t.greater = 675;
64605    t.question = 500;
64606    t.at = 920;
64607    t.A = 611;
64608    t.B = 611;
64609    t.C = 667;
64610    t.D = 722;
64611    t.E = 611;
64612    t.F = 611;
64613    t.G = 722;
64614    t.H = 722;
64615    t.I = 333;
64616    t.J = 444;
64617    t.K = 667;
64618    t.L = 556;
vendor: 4,861 bytes, lines 64619-64853
64619    t.M = 833;
64620    t.N = 667;
64621    t.O = 722;
64622    t.P = 611;
64623    t.Q = 722;
64624    t.R = 611;
64625    t.S = 500;
64626    t.T = 556;
64627    t.U = 722;
64628    t.V = 611;
64629    t.W = 833;
64630    t.X = 611;
64631    t.Y = 556;
64632    t.Z = 556;
64633    t.bracketleft = 389;
64634    t.backslash = 278;
64635    t.bracketright = 389;
64636    t.asciicircum = 422;
64637    t.underscore = 500;
64638    t.quoteleft = 333;
64639    t.a = 500;
64640    t.b = 500;
64641    t.c = 444;
64642    t.d = 500;
64643    t.e = 444;
64644    t.f = 278;
64645    t.g = 500;
64646    t.h = 500;
64647    t.i = 278;
64648    t.j = 278;
64649    t.k = 444;
64650    t.l = 278;
64651    t.m = 722;
64652    t.n = 500;
64653    t.o = 500;
64654    t.p = 500;
64655    t.q = 500;
64656    t.r = 389;
64657    t.s = 389;
64658    t.t = 278;
64659    t.u = 500;
64660    t.v = 444;
64661    t.w = 667;
64662    t.x = 444;
64663    t.y = 444;
64664    t.z = 389;
64665    t.braceleft = 400;
64666    t.bar = 275;
64667    t.braceright = 400;
64668    t.asciitilde = 541;
64669    t.exclamdown = 389;
64670    t.cent = 500;
64671    t.sterling = 500;
64672    t.fraction = 167;
64673    t.yen = 500;
64674    t.florin = 500;
64675    t.section = 500;
64676    t.currency = 500;
64677    t.quotesingle = 214;
64678    t.quotedblleft = 556;
64679    t.guillemotleft = 500;
64680    t.guilsinglleft = 333;
64681    t.guilsinglright = 333;
64682    t.fi = 500;
64683    t.fl = 500;
64684    t.endash = 500;
64685    t.dagger = 500;
64686    t.daggerdbl = 500;
64687    t.periodcentered = 250;
64688    t.paragraph = 523;
64689    t.bullet = 350;
64690    t.quotesinglbase = 333;
64691    t.quotedblbase = 556;
64692    t.quotedblright = 556;
64693    t.guillemotright = 500;
64694    t.ellipsis = 889;
64695    t.perthousand = 1000;
64696    t.questiondown = 500;
64697    t.grave = 333;
64698    t.acute = 333;
64699    t.circumflex = 333;
64700    t.tilde = 333;
64701    t.macron = 333;
64702    t.breve = 333;
64703    t.dotaccent = 333;
64704    t.dieresis = 333;
64705    t.ring = 333;
64706    t.cedilla = 333;
64707    t.hungarumlaut = 333;
64708    t.ogonek = 333;
64709    t.caron = 333;
64710    t.emdash = 889;
64711    t.AE = 889;
64712    t.ordfeminine = 276;
64713    t.Lslash = 556;
64714    t.Oslash = 722;
64715    t.OE = 944;
64716    t.ordmasculine = 310;
64717    t.ae = 667;
64718    t.dotlessi = 278;
64719    t.lslash = 278;
64720    t.oslash = 500;
64721    t.oe = 667;
64722    t.germandbls = 500;
64723    t.Idieresis = 333;
64724    t.eacute = 444;
64725    t.abreve = 500;
64726    t.uhungarumlaut = 500;
64727    t.ecaron = 444;
64728    t.Ydieresis = 556;
64729    t.divide = 675;
64730    t.Yacute = 556;
64731    t.Acircumflex = 611;
64732    t.aacute = 500;
64733    t.Ucircumflex = 722;
64734    t.yacute = 444;
64735    t.scommaaccent = 389;
64736    t.ecircumflex = 444;
64737    t.Uring = 722;
64738    t.Udieresis = 722;
64739    t.aogonek = 500;
64740    t.Uacute = 722;
64741    t.uogonek = 500;
64742    t.Edieresis = 611;
64743    t.Dcroat = 722;
64744    t.commaaccent = 250;
64745    t.copyright = 760;
64746    t.Emacron = 611;
64747    t.ccaron = 444;
64748    t.aring = 500;
64749    t.Ncommaaccent = 667;
64750    t.lacute = 278;
64751    t.agrave = 500;
64752    t.Tcommaaccent = 556;
64753    t.Cacute = 667;
64754    t.atilde = 500;
64755    t.Edotaccent = 611;
64756    t.scaron = 389;
64757    t.scedilla = 389;
64758    t.iacute = 278;
64759    t.lozenge = 471;
64760    t.Rcaron = 611;
64761    t.Gcommaaccent = 722;
64762    t.ucircumflex = 500;
64763    t.acircumflex = 500;
64764    t.Amacron = 611;
64765    t.rcaron = 389;
64766    t.ccedilla = 444;
64767    t.Zdotaccent = 556;
64768    t.Thorn = 611;
64769    t.Omacron = 722;
64770    t.Racute = 611;
64771    t.Sacute = 500;
64772    t.dcaron = 544;
64773    t.Umacron = 722;
64774    t.uring = 500;
64775    t.threesuperior = 300;
64776    t.Ograve = 722;
64777    t.Agrave = 611;
64778    t.Abreve = 611;
64779    t.multiply = 675;
64780    t.uacute = 500;
64781    t.Tcaron = 556;
64782    t.partialdiff = 476;
64783    t.ydieresis = 444;
64784    t.Nacute = 667;
64785    t.icircumflex = 278;
64786    t.Ecircumflex = 611;
64787    t.adieresis = 500;
64788    t.edieresis = 444;
64789    t.cacute = 444;
64790    t.nacute = 500;
64791    t.umacron = 500;
64792    t.Ncaron = 667;
64793    t.Iacute = 333;
64794    t.plusminus = 675;
64795    t.brokenbar = 275;
64796    t.registered = 760;
64797    t.Gbreve = 722;
64798    t.Idotaccent = 333;
64799    t.summation = 600;
64800    t.Egrave = 611;
64801    t.racute = 389;
64802    t.omacron = 500;
64803    t.Zacute = 556;
64804    t.Zcaron = 556;
64805    t.greaterequal = 549;
64806    t.Eth = 722;
64807    t.Ccedilla = 667;
64808    t.lcommaaccent = 278;
64809    t.tcaron = 300;
64810    t.eogonek = 444;
64811    t.Uogonek = 722;
64812    t.Aacute = 611;
64813    t.Adieresis = 611;
64814    t.egrave = 444;
64815    t.zacute = 389;
64816    t.iogonek = 278;
64817    t.Oacute = 722;
64818    t.oacute = 500;
64819    t.amacron = 500;
64820    t.sacute = 389;
64821    t.idieresis = 278;
64822    t.Ocircumflex = 722;
64823    t.Ugrave = 722;
64824    t.Delta = 612;
64825    t.thorn = 500;
64826    t.twosuperior = 300;
64827    t.Odieresis = 722;
64828    t.mu = 500;
64829    t.igrave = 278;
64830    t.ohungarumlaut = 500;
64831    t.Eogonek = 611;
64832    t.dcroat = 500;
64833    t.threequarters = 750;
64834    t.Scedilla = 500;
64835    t.lcaron = 300;
64836    t.Kcommaaccent = 667;
64837    t.Lacute = 556;
64838    t.trademark = 980;
64839    t.edotaccent = 444;
64840    t.Igrave = 333;
64841    t.Imacron = 333;
64842    t.Lcaron = 611;
64843    t.onehalf = 750;
64844    t.lessequal = 549;
64845    t.ocircumflex = 500;
64846    t.ntilde = 500;
64847    t.Uhungarumlaut = 722;
64848    t.Eacute = 611;
64849    t.emacron = 444;
64850    t.gbreve = 500;
64851    t.onequarter = 750;
64852    t.Scaron = 500;
64853    t.Scommaaccent = 500;
vendor: 6,045 bytes, lines 64854-65185
64854    t.Ohungarumlaut = 722;
64855    t.degree = 400;
64856    t.ograve = 500;
64857    t.Ccaron = 667;
64858    t.ugrave = 500;
64859    t.radical = 453;
64860    t.Dcaron = 722;
64861    t.rcommaaccent = 389;
64862    t.Ntilde = 667;
64863    t.otilde = 500;
64864    t.Rcommaaccent = 611;
64865    t.Lcommaaccent = 556;
64866    t.Atilde = 611;
64867    t.Aogonek = 611;
64868    t.Aring = 611;
64869    t.Otilde = 722;
64870    t.zdotaccent = 389;
64871    t.Ecaron = 611;
64872    t.Iogonek = 333;
64873    t.kcommaaccent = 444;
64874    t.minus = 675;
64875    t.Icircumflex = 333;
64876    t.ncaron = 500;
64877    t.tcommaaccent = 278;
64878    t.logicalnot = 675;
64879    t.odieresis = 500;
64880    t.udieresis = 500;
64881    t.notequal = 549;
64882    t.gcommaaccent = 500;
64883    t.eth = 500;
64884    t.zcaron = 389;
64885    t.ncommaaccent = 500;
64886    t.onesuperior = 300;
64887    t.imacron = 278;
64888    t.Euro = 500;
64889  });
64890  t.ZapfDingbats = (0, _core_utils.getLookupTableFactory)(function (t) {
64891    t.space = 278;
64892    t.a1 = 974;
64893    t.a2 = 961;
64894    t.a202 = 974;
64895    t.a3 = 980;
64896    t.a4 = 719;
64897    t.a5 = 789;
64898    t.a119 = 790;
64899    t.a118 = 791;
64900    t.a117 = 690;
64901    t.a11 = 960;
64902    t.a12 = 939;
64903    t.a13 = 549;
64904    t.a14 = 855;
64905    t.a15 = 911;
64906    t.a16 = 933;
64907    t.a105 = 911;
64908    t.a17 = 945;
64909    t.a18 = 974;
64910    t.a19 = 755;
64911    t.a20 = 846;
64912    t.a21 = 762;
64913    t.a22 = 761;
64914    t.a23 = 571;
64915    t.a24 = 677;
64916    t.a25 = 763;
64917    t.a26 = 760;
64918    t.a27 = 759;
64919    t.a28 = 754;
64920    t.a6 = 494;
64921    t.a7 = 552;
64922    t.a8 = 537;
64923    t.a9 = 577;
64924    t.a10 = 692;
64925    t.a29 = 786;
64926    t.a30 = 788;
64927    t.a31 = 788;
64928    t.a32 = 790;
64929    t.a33 = 793;
64930    t.a34 = 794;
64931    t.a35 = 816;
64932    t.a36 = 823;
64933    t.a37 = 789;
64934    t.a38 = 841;
64935    t.a39 = 823;
64936    t.a40 = 833;
64937    t.a41 = 816;
64938    t.a42 = 831;
64939    t.a43 = 923;
64940    t.a44 = 744;
64941    t.a45 = 723;
64942    t.a46 = 749;
64943    t.a47 = 790;
64944    t.a48 = 792;
64945    t.a49 = 695;
64946    t.a50 = 776;
64947    t.a51 = 768;
64948    t.a52 = 792;
64949    t.a53 = 759;
64950    t.a54 = 707;
64951    t.a55 = 708;
64952    t.a56 = 682;
64953    t.a57 = 701;
64954    t.a58 = 826;
64955    t.a59 = 815;
64956    t.a60 = 789;
64957    t.a61 = 789;
64958    t.a62 = 707;
64959    t.a63 = 687;
64960    t.a64 = 696;
64961    t.a65 = 689;
64962    t.a66 = 786;
64963    t.a67 = 787;
64964    t.a68 = 713;
64965    t.a69 = 791;
64966    t.a70 = 785;
64967    t.a71 = 791;
64968    t.a72 = 873;
64969    t.a73 = 761;
64970    t.a74 = 762;
64971    t.a203 = 762;
64972    t.a75 = 759;
64973    t.a204 = 759;
64974    t.a76 = 892;
64975    t.a77 = 892;
64976    t.a78 = 788;
64977    t.a79 = 784;
64978    t.a81 = 438;
64979    t.a82 = 138;
64980    t.a83 = 277;
64981    t.a84 = 415;
64982    t.a97 = 392;
64983    t.a98 = 392;
64984    t.a99 = 668;
64985    t.a100 = 668;
64986    t.a89 = 390;
64987    t.a90 = 390;
64988    t.a93 = 317;
64989    t.a94 = 317;
64990    t.a91 = 276;
64991    t.a92 = 276;
64992    t.a205 = 509;
64993    t.a85 = 509;
64994    t.a206 = 410;
64995    t.a86 = 410;
64996    t.a87 = 234;
64997    t.a88 = 234;
64998    t.a95 = 334;
64999    t.a96 = 334;
65000    t.a101 = 732;
65001    t.a102 = 544;
65002    t.a103 = 544;
65003    t.a104 = 910;
65004    t.a106 = 667;
65005    t.a107 = 760;
65006    t.a108 = 760;
65007    t.a112 = 776;
65008    t.a111 = 595;
65009    t.a110 = 694;
65010    t.a109 = 626;
65011    t.a120 = 788;
65012    t.a121 = 788;
65013    t.a122 = 788;
65014    t.a123 = 788;
65015    t.a124 = 788;
65016    t.a125 = 788;
65017    t.a126 = 788;
65018    t.a127 = 788;
65019    t.a128 = 788;
65020    t.a129 = 788;
65021    t.a130 = 788;
65022    t.a131 = 788;
65023    t.a132 = 788;
65024    t.a133 = 788;
65025    t.a134 = 788;
65026    t.a135 = 788;
65027    t.a136 = 788;
65028    t.a137 = 788;
65029    t.a138 = 788;
65030    t.a139 = 788;
65031    t.a140 = 788;
65032    t.a141 = 788;
65033    t.a142 = 788;
65034    t.a143 = 788;
65035    t.a144 = 788;
65036    t.a145 = 788;
65037    t.a146 = 788;
65038    t.a147 = 788;
65039    t.a148 = 788;
65040    t.a149 = 788;
65041    t.a150 = 788;
65042    t.a151 = 788;
65043    t.a152 = 788;
65044    t.a153 = 788;
65045    t.a154 = 788;
65046    t.a155 = 788;
65047    t.a156 = 788;
65048    t.a157 = 788;
65049    t.a158 = 788;
65050    t.a159 = 788;
65051    t.a160 = 894;
65052    t.a161 = 838;
65053    t.a163 = 1016;
65054    t.a164 = 458;
65055    t.a196 = 748;
65056    t.a165 = 924;
65057    t.a192 = 748;
65058    t.a166 = 918;
65059    t.a167 = 927;
65060    t.a168 = 928;
65061    t.a169 = 928;
65062    t.a170 = 834;
65063    t.a171 = 873;
65064    t.a172 = 828;
65065    t.a173 = 924;
65066    t.a162 = 924;
65067    t.a174 = 917;
65068    t.a175 = 930;
65069    t.a176 = 931;
65070    t.a177 = 463;
65071    t.a178 = 883;
65072    t.a179 = 836;
65073    t.a193 = 836;
65074    t.a180 = 867;
65075    t.a199 = 867;
65076    t.a181 = 696;
65077    t.a200 = 696;
65078    t.a182 = 874;
65079    t.a201 = 874;
65080    t.a183 = 760;
65081    t.a184 = 946;
65082    t.a197 = 771;
65083    t.a185 = 865;
65084    t.a194 = 771;
65085    t.a198 = 888;
65086    t.a186 = 967;
65087    t.a195 = 888;
65088    t.a187 = 831;
65089    t.a188 = 873;
65090    t.a189 = 927;
65091    t.a190 = 970;
65092    t.a191 = 918;
65093  });
65094});
65095exports.getMetrics = getMetrics;
65096const getFontBasicMetrics = (0, _core_utils.getLookupTableFactory)(function (t) {
65097  t.Courier = {
65098    ascent: 629,
65099    descent: -157,
65100    capHeight: 562,
65101    xHeight: -426
65102  };
65103  t["Courier-Bold"] = {
65104    ascent: 629,
65105    descent: -157,
65106    capHeight: 562,
65107    xHeight: 439
65108  };
65109  t["Courier-Oblique"] = {
65110    ascent: 629,
65111    descent: -157,
65112    capHeight: 562,
65113    xHeight: 426
65114  };
65115  t["Courier-BoldOblique"] = {
65116    ascent: 629,
65117    descent: -157,
65118    capHeight: 562,
65119    xHeight: 426
65120  };
65121  t.Helvetica = {
65122    ascent: 718,
65123    descent: -207,
65124    capHeight: 718,
65125    xHeight: 523
65126  };
65127  t["Helvetica-Bold"] = {
65128    ascent: 718,
65129    descent: -207,
65130    capHeight: 718,
65131    xHeight: 532
65132  };
65133  t["Helvetica-Oblique"] = {
65134    ascent: 718,
65135    descent: -207,
65136    capHeight: 718,
65137    xHeight: 523
65138  };
65139  t["Helvetica-BoldOblique"] = {
65140    ascent: 718,
65141    descent: -207,
65142    capHeight: 718,
65143    xHeight: 532
65144  };
65145  t["Times-Roman"] = {
65146    ascent: 683,
65147    descent: -217,
65148    capHeight: 662,
65149    xHeight: 450
65150  };
65151  t["Times-Bold"] = {
65152    ascent: 683,
65153    descent: -217,
65154    capHeight: 676,
65155    xHeight: 461
65156  };
65157  t["Times-Italic"] = {
65158    ascent: 683,
65159    descent: -217,
65160    capHeight: 653,
65161    xHeight: 441
65162  };
65163  t["Times-BoldItalic"] = {
65164    ascent: 683,
65165    descent: -217,
65166    capHeight: 669,
65167    xHeight: 462
65168  };
65169  t.Symbol = {
65170    ascent: Math.NaN,
65171    descent: Math.NaN,
65172    capHeight: Math.NaN,
65173    xHeight: Math.NaN
65174  };
65175  t.ZapfDingbats = {
65176    ascent: Math.NaN,
65177    descent: Math.NaN,
65178    capHeight: Math.NaN,
65179    xHeight: Math.NaN
65180  };
65181});
65182exports.getFontBasicMetrics = getFontBasicMetrics;
65183
65184/***/ }),
65185/* 4
vendor: 5,081 bytes, lines 65185-65376
651856 */
65186/***/ ((__unused_webpack_module, exports) => {
65187
65188
65189
65190Object.defineProperty(exports, "__esModule", ({
65191  value: true
65192}));
65193exports.GlyfTable = void 0;
65194const ON_CURVE_POINT = 1 << 0;
65195const X_SHORT_VECTOR = 1 << 1;
65196const Y_SHORT_VECTOR = 1 << 2;
65197const REPEAT_FLAG = 1 << 3;
65198const X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR = 1 << 4;
65199const Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR = 1 << 5;
65200const OVERLAP_SIMPLE = 1 << 6;
65201const ARG_1_AND_2_ARE_WORDS = 1 << 0;
65202const ARGS_ARE_XY_VALUES = 1 << 1;
65203const WE_HAVE_A_SCALE = 1 << 3;
65204const MORE_COMPONENTS = 1 << 5;
65205const WE_HAVE_AN_X_AND_Y_SCALE = 1 << 6;
65206const WE_HAVE_A_TWO_BY_TWO = 1 << 7;
65207const WE_HAVE_INSTRUCTIONS = 1 << 8;
65208class GlyfTable {
65209  constructor({
65210    glyfTable,
65211    isGlyphLocationsLong,
65212    locaTable,
65213    numGlyphs
65214  }) {
65215    this.glyphs = [];
65216    const loca = new DataView(locaTable.buffer, locaTable.byteOffset, locaTable.byteLength);
65217    const glyf = new DataView(glyfTable.buffer, glyfTable.byteOffset, glyfTable.byteLength);
65218    const offsetSize = isGlyphLocationsLong ? 4 : 2;
65219    let prev = isGlyphLocationsLong ? loca.getUint32(0) : 2 * loca.getUint16(0);
65220    let pos = 0;
65221    for (let i = 0; i < numGlyphs; i++) {
65222      pos += offsetSize;
65223      const next = isGlyphLocationsLong ? loca.getUint32(pos) : 2 * loca.getUint16(pos);
65224      if (next === prev) {
65225        this.glyphs.push(new Glyph({}));
65226        continue;
65227      }
65228      const glyph = Glyph.parse(prev, glyf);
65229      this.glyphs.push(glyph);
65230      prev = next;
65231    }
65232  }
65233  getSize() {
65234    return this.glyphs.reduce((a, g) => {
65235      const size = g.getSize();
65236      return a + (size + 3 & ~3);
65237    }, 0);
65238  }
65239  write() {
65240    const totalSize = this.getSize();
65241    const glyfTable = new DataView(new ArrayBuffer(totalSize));
65242    const isLocationLong = totalSize > 0x1fffe;
65243    const offsetSize = isLocationLong ? 4 : 2;
65244    const locaTable = new DataView(new ArrayBuffer((this.glyphs.length + 1) * offsetSize));
65245    if (isLocationLong) {
65246      locaTable.setUint32(0, 0);
65247    } else {
65248      locaTable.setUint16(0, 0);
65249    }
65250    let pos = 0;
65251    let locaIndex = 0;
65252    for (const glyph of this.glyphs) {
65253      pos += glyph.write(pos, glyfTable);
65254      pos = pos + 3 & ~3;
65255      locaIndex += offsetSize;
65256      if (isLocationLong) {
65257        locaTable.setUint32(locaIndex, pos);
65258      } else {
65259        locaTable.setUint16(locaIndex, pos >> 1);
65260      }
65261    }
65262    return {
65263      isLocationLong,
65264      loca: new Uint8Array(locaTable.buffer),
65265      glyf: new Uint8Array(glyfTable.buffer)
65266    };
65267  }
65268  scale(factors) {
65269    for (let i = 0, ii = this.glyphs.length; i < ii; i++) {
65270      this.glyphs[i].scale(factors[i]);
65271    }
65272  }
65273}
65274exports.GlyfTable = GlyfTable;
65275class Glyph {
65276  constructor({
65277    header = null,
65278    simple = null,
65279    composites = null
65280  }) {
65281    this.header = header;
65282    this.simple = simple;
65283    this.composites = composites;
65284  }
65285  static parse(pos, glyf) {
65286    const [read, header] = GlyphHeader.parse(pos, glyf);
65287    pos += read;
65288    if (header.numberOfContours < 0) {
65289      const composites = [];
65290      while (true) {
65291        const [n, composite] = CompositeGlyph.parse(pos, glyf);
65292        pos += n;
65293        composites.push(composite);
65294        if (!(composite.flags & MORE_COMPONENTS)) {
65295          break;
65296        }
65297      }
65298      return new Glyph({
65299        header,
65300        composites
65301      });
65302    }
65303    const simple = SimpleGlyph.parse(pos, glyf, header.numberOfContours);
65304    return new Glyph({
65305      header,
65306      simple
65307    });
65308  }
65309  getSize() {
65310    if (!this.header) {
65311      return 0;
65312    }
65313    const size = this.simple ? this.simple.getSize() : this.composites.reduce((a, c) => a + c.getSize(), 0);
65314    return this.header.getSize() + size;
65315  }
65316  write(pos, buf) {
65317    if (!this.header) {
65318      return 0;
65319    }
65320    const spos = pos;
65321    pos += this.header.write(pos, buf);
65322    if (this.simple) {
65323      pos += this.simple.write(pos, buf);
65324    } else {
65325      for (const composite of this.composites) {
65326        pos += composite.write(pos, buf);
65327      }
65328    }
65329    return pos - spos;
65330  }
65331  scale(factor) {
65332    if (!this.header) {
65333      return;
65334    }
65335    const xMiddle = (this.header.xMin + this.header.xMax) / 2;
65336    this.header.scale(xMiddle, factor);
65337    if (this.simple) {
65338      this.simple.scale(xMiddle, factor);
65339    } else {
65340      for (const composite of this.composites) {
65341        composite.scale(xMiddle, factor);
65342      }
65343    }
65344  }
65345}
65346class GlyphHeader {
65347  constructor({
65348    numberOfContours,
65349    xMin,
65350    yMin,
65351    xMax,
65352    yMax
65353  }) {
65354    this.numberOfContours = numberOfContours;
65355    this.xMin = xMin;
65356    this.yMin = yMin;
65357    this.xMax = xMax;
65358    this.yMax = yMax;
65359  }
65360  static parse(pos, glyf) {
65361    return [10, new GlyphHeader({
65362      numberOfContours: glyf.getInt16(pos),
65363      xMin: glyf.getInt16(pos + 2),
65364      yMin: glyf.getInt16(pos + 4),
65365      xMax: glyf.getInt16(pos + 6),
65366      yMax: glyf.getInt16(pos + 8)
65367    })];
65368  }
65369  getSize() {
65370    return 10;
65371  }
65372  write(pos, buf) {
65373    buf.setInt16(pos, this.numberOfContours);
65374    buf.setInt16(pos + 2, this.xMin);
65375    buf.setInt16(pos + 4, this.yMin);
65376    buf.setInt16(pos + 6, this.xMax);
vendor: 10,701 bytes, lines 65377-65735
65377    buf.setInt16(pos + 8, this.yMax);
65378    return 10;
65379  }
65380  scale(x, factor) {
65381    this.xMin = Math.round(x + (this.xMin - x) * factor);
65382    this.xMax = Math.round(x + (this.xMax - x) * factor);
65383  }
65384}
65385class Contour {
65386  constructor({
65387    flags,
65388    xCoordinates,
65389    yCoordinates
65390  }) {
65391    this.xCoordinates = xCoordinates;
65392    this.yCoordinates = yCoordinates;
65393    this.flags = flags;
65394  }
65395}
65396class SimpleGlyph {
65397  constructor({
65398    contours,
65399    instructions
65400  }) {
65401    this.contours = contours;
65402    this.instructions = instructions;
65403  }
65404  static parse(pos, glyf, numberOfContours) {
65405    const endPtsOfContours = [];
65406    for (let i = 0; i < numberOfContours; i++) {
65407      const endPt = glyf.getUint16(pos);
65408      pos += 2;
65409      endPtsOfContours.push(endPt);
65410    }
65411    const numberOfPt = endPtsOfContours[numberOfContours - 1] + 1;
65412    const instructionLength = glyf.getUint16(pos);
65413    pos += 2;
65414    const instructions = new Uint8Array(glyf).slice(pos, pos + instructionLength);
65415    pos += instructionLength;
65416    const flags = [];
65417    for (let i = 0; i < numberOfPt; pos++, i++) {
65418      let flag = glyf.getUint8(pos);
65419      flags.push(flag);
65420      if (flag & REPEAT_FLAG) {
65421        const count = glyf.getUint8(++pos);
65422        flag ^= REPEAT_FLAG;
65423        for (let m = 0; m < count; m++) {
65424          flags.push(flag);
65425        }
65426        i += count;
65427      }
65428    }
65429    const allXCoordinates = [];
65430    let xCoordinates = [];
65431    let yCoordinates = [];
65432    let pointFlags = [];
65433    const contours = [];
65434    let endPtsOfContoursIndex = 0;
65435    let lastCoordinate = 0;
65436    for (let i = 0; i < numberOfPt; i++) {
65437      const flag = flags[i];
65438      if (flag & X_SHORT_VECTOR) {
65439        const x = glyf.getUint8(pos++);
65440        lastCoordinate += flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR ? x : -x;
65441        xCoordinates.push(lastCoordinate);
65442      } else if (flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR) {
65443        xCoordinates.push(lastCoordinate);
65444      } else {
65445        lastCoordinate += glyf.getInt16(pos);
65446        pos += 2;
65447        xCoordinates.push(lastCoordinate);
65448      }
65449      if (endPtsOfContours[endPtsOfContoursIndex] === i) {
65450        endPtsOfContoursIndex++;
65451        allXCoordinates.push(xCoordinates);
65452        xCoordinates = [];
65453      }
65454    }
65455    lastCoordinate = 0;
65456    endPtsOfContoursIndex = 0;
65457    for (let i = 0; i < numberOfPt; i++) {
65458      const flag = flags[i];
65459      if (flag & Y_SHORT_VECTOR) {
65460        const y = glyf.getUint8(pos++);
65461        lastCoordinate += flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR ? y : -y;
65462        yCoordinates.push(lastCoordinate);
65463      } else if (flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR) {
65464        yCoordinates.push(lastCoordinate);
65465      } else {
65466        lastCoordinate += glyf.getInt16(pos);
65467        pos += 2;
65468        yCoordinates.push(lastCoordinate);
65469      }
65470      pointFlags.push(flag & ON_CURVE_POINT | flag & OVERLAP_SIMPLE);
65471      if (endPtsOfContours[endPtsOfContoursIndex] === i) {
65472        xCoordinates = allXCoordinates[endPtsOfContoursIndex];
65473        endPtsOfContoursIndex++;
65474        contours.push(new Contour({
65475          flags: pointFlags,
65476          xCoordinates,
65477          yCoordinates
65478        }));
65479        yCoordinates = [];
65480        pointFlags = [];
65481      }
65482    }
65483    return new SimpleGlyph({
65484      contours,
65485      instructions
65486    });
65487  }
65488  getSize() {
65489    let size = this.contours.length * 2 + 2 + this.instructions.length;
65490    let lastX = 0;
65491    let lastY = 0;
65492    for (const contour of this.contours) {
65493      size += contour.flags.length;
65494      for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
65495        const x = contour.xCoordinates[i];
65496        const y = contour.yCoordinates[i];
65497        let abs = Math.abs(x - lastX);
65498        if (abs > 255) {
65499          size += 2;
65500        } else if (abs > 0) {
65501          size += 1;
65502        }
65503        lastX = x;
65504        abs = Math.abs(y - lastY);
65505        if (abs > 255) {
65506          size += 2;
65507        } else if (abs > 0) {
65508          size += 1;
65509        }
65510        lastY = y;
65511      }
65512    }
65513    return size;
65514  }
65515  write(pos, buf) {
65516    const spos = pos;
65517    const xCoordinates = [];
65518    const yCoordinates = [];
65519    const flags = [];
65520    let lastX = 0;
65521    let lastY = 0;
65522    for (const contour of this.contours) {
65523      for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
65524        let flag = contour.flags[i];
65525        const x = contour.xCoordinates[i];
65526        let delta = x - lastX;
65527        if (delta === 0) {
65528          flag |= X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR;
65529          xCoordinates.push(0);
65530        } else {
65531          const abs = Math.abs(delta);
65532          if (abs <= 255) {
65533            flag |= delta >= 0 ? X_SHORT_VECTOR | X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR : X_SHORT_VECTOR;
65534            xCoordinates.push(abs);
65535          } else {
65536            xCoordinates.push(delta);
65537          }
65538        }
65539        lastX = x;
65540        const y = contour.yCoordinates[i];
65541        delta = y - lastY;
65542        if (delta === 0) {
65543          flag |= Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR;
65544          yCoordinates.push(0);
65545        } else {
65546          const abs = Math.abs(delta);
65547          if (abs <= 255) {
65548            flag |= delta >= 0 ? Y_SHORT_VECTOR | Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR : Y_SHORT_VECTOR;
65549            yCoordinates.push(abs);
65550          } else {
65551            yCoordinates.push(delta);
65552          }
65553        }
65554        lastY = y;
65555        flags.push(flag);
65556      }
65557      buf.setUint16(pos, xCoordinates.length - 1);
65558      pos += 2;
65559    }
65560    buf.setUint16(pos, this.instructions.length);
65561    pos += 2;
65562    if (this.instructions.length) {
65563      new Uint8Array(buf.buffer, 0, buf.buffer.byteLength).set(this.instructions, pos);
65564      pos += this.instructions.length;
65565    }
65566    for (const flag of flags) {
65567      buf.setUint8(pos++, flag);
65568    }
65569    for (let i = 0, ii = xCoordinates.length; i < ii; i++) {
65570      const x = xCoordinates[i];
65571      const flag = flags[i];
65572      if (flag & X_SHORT_VECTOR) {
65573        buf.setUint8(pos++, x);
65574      } else if (!(flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR)) {
65575        buf.setInt16(pos, x);
65576        pos += 2;
65577      }
65578    }
65579    for (let i = 0, ii = yCoordinates.length; i < ii; i++) {
65580      const y = yCoordinates[i];
65581      const flag = flags[i];
65582      if (flag & Y_SHORT_VECTOR) {
65583        buf.setUint8(pos++, y);
65584      } else if (!(flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR)) {
65585        buf.setInt16(pos, y);
65586        pos += 2;
65587      }
65588    }
65589    return pos - spos;
65590  }
65591  scale(x, factor) {
65592    for (const contour of this.contours) {
65593      if (contour.xCoordinates.length === 0) {
65594        continue;
65595      }
65596      for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
65597        contour.xCoordinates[i] = Math.round(x + (contour.xCoordinates[i] - x) * factor);
65598      }
65599    }
65600  }
65601}
65602class CompositeGlyph {
65603  constructor({
65604    flags,
65605    glyphIndex,
65606    argument1,
65607    argument2,
65608    transf,
65609    instructions
65610  }) {
65611    this.flags = flags;
65612    this.glyphIndex = glyphIndex;
65613    this.argument1 = argument1;
65614    this.argument2 = argument2;
65615    this.transf = transf;
65616    this.instructions = instructions;
65617  }
65618  static parse(pos, glyf) {
65619    const spos = pos;
65620    const transf = [];
65621    let flags = glyf.getUint16(pos);
65622    const glyphIndex = glyf.getUint16(pos + 2);
65623    pos += 4;
65624    let argument1, argument2;
65625    if (flags & ARG_1_AND_2_ARE_WORDS) {
65626      if (flags & ARGS_ARE_XY_VALUES) {
65627        argument1 = glyf.getInt16(pos);
65628        argument2 = glyf.getInt16(pos + 2);
65629      } else {
65630        argument1 = glyf.getUint16(pos);
65631        argument2 = glyf.getUint16(pos + 2);
65632      }
65633      pos += 4;
65634      flags ^= ARG_1_AND_2_ARE_WORDS;
65635    } else {
65636      if (flags & ARGS_ARE_XY_VALUES) {
65637        argument1 = glyf.getInt8(pos);
65638        argument2 = glyf.getInt8(pos + 1);
65639      } else {
65640        argument1 = glyf.getUint8(pos);
65641        argument2 = glyf.getUint8(pos + 1);
65642      }
65643      pos += 2;
65644    }
65645    if (flags & WE_HAVE_A_SCALE) {
65646      transf.push(glyf.getUint16(pos));
65647      pos += 2;
65648    } else if (flags & WE_HAVE_AN_X_AND_Y_SCALE) {
65649      transf.push(glyf.getUint16(pos), glyf.getUint16(pos + 2));
65650      pos += 4;
65651    } else if (flags & WE_HAVE_A_TWO_BY_TWO) {
65652      transf.push(glyf.getUint16(pos), glyf.getUint16(pos + 2), glyf.getUint16(pos + 4), glyf.getUint16(pos + 6));
65653      pos += 8;
65654    }
65655    let instructions = null;
65656    if (flags & WE_HAVE_INSTRUCTIONS) {
65657      const instructionLength = glyf.getUint16(pos);
65658      pos += 2;
65659      instructions = new Uint8Array(glyf).slice(pos, pos + instructionLength);
65660      pos += instructionLength;
65661    }
65662    return [pos - spos, new CompositeGlyph({
65663      flags,
65664      glyphIndex,
65665      argument1,
65666      argument2,
65667      transf,
65668      instructions
65669    })];
65670  }
65671  getSize() {
65672    let size = 2 + 2 + this.transf.length * 2;
65673    if (this.flags & WE_HAVE_INSTRUCTIONS) {
65674      size += 2 + this.instructions.length;
65675    }
65676    size += 2;
65677    if (this.flags & 2) {
65678      if (!(this.argument1 >= -128 && this.argument1 <= 127 && this.argument2 >= -128 && this.argument2 <= 127)) {
65679        size += 2;
65680      }
65681    } else if (!(this.argument1 >= 0 && this.argument1 <= 255 && this.argument2 >= 0 && this.argument2 <= 255)) {
65682      size += 2;
65683    }
65684    return size;
65685  }
65686  write(pos, buf) {
65687    const spos = pos;
65688    if (this.flags & ARGS_ARE_XY_VALUES) {
65689      if (!(this.argument1 >= -128 && this.argument1 <= 127 && this.argument2 >= -128 && this.argument2 <= 127)) {
65690        this.flags |= ARG_1_AND_2_ARE_WORDS;
65691      }
65692    } else if (!(this.argument1 >= 0 && this.argument1 <= 255 && this.argument2 >= 0 && this.argument2 <= 255)) {
65693      this.flags |= ARG_1_AND_2_ARE_WORDS;
65694    }
65695    buf.setUint16(pos, this.flags);
65696    buf.setUint16(pos + 2, this.glyphIndex);
65697    pos += 4;
65698    if (this.flags & ARG_1_AND_2_ARE_WORDS) {
65699      if (this.flags & ARGS_ARE_XY_VALUES) {
65700        buf.setInt16(pos, this.argument1);
65701        buf.setInt16(pos + 2, this.argument2);
65702      } else {
65703        buf.setUint16(pos, this.argument1);
65704        buf.setUint16(pos + 2, this.argument2);
65705      }
65706      pos += 4;
65707    } else {
65708      buf.setUint8(pos, this.argument1);
65709      buf.setUint8(pos + 1, this.argument2);
65710      pos += 2;
65711    }
65712    if (this.flags & WE_HAVE_INSTRUCTIONS) {
65713      buf.setUint16(pos, this.instructions.length);
65714      pos += 2;
65715      if (this.instructions.length) {
65716        new Uint8Array(buf.buffer, 0, buf.buffer.byteLength).set(this.instructions, pos);
65717        pos += this.instructions.length;
65718      }
65719    }
65720    return pos - spos;
65721  }
65722  scale(x, factor) {}
65723}
65724
65725/***/ }),
65726/* 47 */
65727/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
65728
65729
65730
65731Object.defineProperty(exports, "__esModule", ({
65732  value: true
65733}));
65734exports.OpenTypeFileBuilder = void 0;
65735var _core_utils = __w_pdfjs_require__(3
vendor: 3,391 bytes, lines 65735-65842
65735);
65736var _util = __w_pdfjs_require__(2);
65737function writeInt16(dest, offset, num) {
65738  dest[offset] = num >> 8 & 0xff;
65739  dest[offset + 1] = num & 0xff;
65740}
65741function writeInt32(dest, offset, num) {
65742  dest[offset] = num >> 24 & 0xff;
65743  dest[offset + 1] = num >> 16 & 0xff;
65744  dest[offset + 2] = num >> 8 & 0xff;
65745  dest[offset + 3] = num & 0xff;
65746}
65747function writeData(dest, offset, data) {
65748  if (data instanceof Uint8Array) {
65749    dest.set(data, offset);
65750  } else if (typeof data === "string") {
65751    for (let i = 0, ii = data.length; i < ii; i++) {
65752      dest[offset++] = data.charCodeAt(i) & 0xff;
65753    }
65754  } else {
65755    for (const num of data) {
65756      dest[offset++] = num & 0xff;
65757    }
65758  }
65759}
65760const OTF_HEADER_SIZE = 12;
65761const OTF_TABLE_ENTRY_SIZE = 16;
65762class OpenTypeFileBuilder {
65763  constructor(sfnt) {
65764    this.sfnt = sfnt;
65765    this.tables = Object.create(null);
65766  }
65767  static getSearchParams(entriesCount, entrySize) {
65768    let maxPower2 = 1,
65769      log2 = 0;
65770    while ((maxPower2 ^ entriesCount) > maxPower2) {
65771      maxPower2 <<= 1;
65772      log2++;
65773    }
65774    const searchRange = maxPower2 * entrySize;
65775    return {
65776      range: searchRange,
65777      entry: log2,
65778      rangeShift: entrySize * entriesCount - searchRange
65779    };
65780  }
65781  toArray() {
65782    let sfnt = this.sfnt;
65783    const tables = this.tables;
65784    const tablesNames = Object.keys(tables);
65785    tablesNames.sort();
65786    const numTables = tablesNames.length;
65787    let i, j, jj, table, tableName;
65788    let offset = OTF_HEADER_SIZE + numTables * OTF_TABLE_ENTRY_SIZE;
65789    const tableOffsets = [offset];
65790    for (i = 0; i < numTables; i++) {
65791      table = tables[tablesNames[i]];
65792      const paddedLength = (table.length + 3 & ~3) >>> 0;
65793      offset += paddedLength;
65794      tableOffsets.push(offset);
65795    }
65796    const file = new Uint8Array(offset);
65797    for (i = 0; i < numTables; i++) {
65798      table = tables[tablesNames[i]];
65799      writeData(file, tableOffsets[i], table);
65800    }
65801    if (sfnt === "true") {
65802      sfnt = (0, _util.string32)(0x00010000);
65803    }
65804    file[0] = sfnt.charCodeAt(0) & 0xff;
65805    file[1] = sfnt.charCodeAt(1) & 0xff;
65806    file[2] = sfnt.charCodeAt(2) & 0xff;
65807    file[3] = sfnt.charCodeAt(3) & 0xff;
65808    writeInt16(file, 4, numTables);
65809    const searchParams = OpenTypeFileBuilder.getSearchParams(numTables, 16);
65810    writeInt16(file, 6, searchParams.range);
65811    writeInt16(file, 8, searchParams.entry);
65812    writeInt16(file, 10, searchParams.rangeShift);
65813    offset = OTF_HEADER_SIZE;
65814    for (i = 0; i < numTables; i++) {
65815      tableName = tablesNames[i];
65816      file[offset] = tableName.charCodeAt(0) & 0xff;
65817      file[offset + 1] = tableName.charCodeAt(1) & 0xff;
65818      file[offset + 2] = tableName.charCodeAt(2) & 0xff;
65819      file[offset + 3] = tableName.charCodeAt(3) & 0xff;
65820      let checksum = 0;
65821      for (j = tableOffsets[i], jj = tableOffsets[i + 1]; j < jj; j += 4) {
65822        const quad = (0, _core_utils.readUint32)(file, j);
65823        checksum = checksum + quad >>> 0;
65824      }
65825      writeInt32(file, offset + 4, checksum);
65826      writeInt32(file, offset + 8, tableOffsets[i]);
65827      writeInt32(file, offset + 12, tables[tableName].length);
65828      offset += OTF_TABLE_ENTRY_SIZE;
65829    }
65830    return file;
65831  }
65832  addTable(tag, data) {
65833    if (tag in this.tables) {
65834      throw new Error("Table " + tag + " already exists");
65835    }
65836    this.tables[tag] = data;
65837  }
65838}
65839exports.OpenTypeFileBuilder = OpenTypeFileBuilder;
65840
65841/***/ }),
65842/* 4
vendor: 9,876 bytes, lines 65842-66141
658428 */
65843/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
65844
65845
65846
65847Object.defineProperty(exports, "__esModule", ({
65848  value: true
65849}));
65850exports.Type1Font = void 0;
65851var _cff_parser = __w_pdfjs_require__(35);
65852var _util = __w_pdfjs_require__(2);
65853var _fonts_utils = __w_pdfjs_require__(38);
65854var _core_utils = __w_pdfjs_require__(3);
65855var _stream = __w_pdfjs_require__(8);
65856var _type1_parser = __w_pdfjs_require__(49);
65857function findBlock(streamBytes, signature, startIndex) {
65858  const streamBytesLength = streamBytes.length;
65859  const signatureLength = signature.length;
65860  const scanLength = streamBytesLength - signatureLength;
65861  let i = startIndex,
65862    found = false;
65863  while (i < scanLength) {
65864    let j = 0;
65865    while (j < signatureLength && streamBytes[i + j] === signature[j]) {
65866      j++;
65867    }
65868    if (j >= signatureLength) {
65869      i += j;
65870      while (i < streamBytesLength && (0, _core_utils.isWhiteSpace)(streamBytes[i])) {
65871        i++;
65872      }
65873      found = true;
65874      break;
65875    }
65876    i++;
65877  }
65878  return {
65879    found,
65880    length: i
65881  };
65882}
65883function getHeaderBlock(stream, suggestedLength) {
65884  const EEXEC_SIGNATURE = [0x65, 0x65, 0x78, 0x65, 0x63];
65885  const streamStartPos = stream.pos;
65886  let headerBytes, headerBytesLength, block;
65887  try {
65888    headerBytes = stream.getBytes(suggestedLength);
65889    headerBytesLength = headerBytes.length;
65890  } catch {}
65891  if (headerBytesLength === suggestedLength) {
65892    block = findBlock(headerBytes, EEXEC_SIGNATURE, suggestedLength - 2 * EEXEC_SIGNATURE.length);
65893    if (block.found && block.length === suggestedLength) {
65894      return {
65895        stream: new _stream.Stream(headerBytes),
65896        length: suggestedLength
65897      };
65898    }
65899  }
65900  (0, _util.warn)('Invalid "Length1" property in Type1 font -- trying to recover.');
65901  stream.pos = streamStartPos;
65902  const SCAN_BLOCK_LENGTH = 2048;
65903  let actualLength;
65904  while (true) {
65905    const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
65906    block = findBlock(scanBytes, EEXEC_SIGNATURE, 0);
65907    if (block.length === 0) {
65908      break;
65909    }
65910    stream.pos += block.length;
65911    if (block.found) {
65912      actualLength = stream.pos - streamStartPos;
65913      break;
65914    }
65915  }
65916  stream.pos = streamStartPos;
65917  if (actualLength) {
65918    return {
65919      stream: new _stream.Stream(stream.getBytes(actualLength)),
65920      length: actualLength
65921    };
65922  }
65923  (0, _util.warn)('Unable to recover "Length1" property in Type1 font -- using as is.');
65924  return {
65925    stream: new _stream.Stream(stream.getBytes(suggestedLength)),
65926    length: suggestedLength
65927  };
65928}
65929function getEexecBlock(stream, suggestedLength) {
65930  const eexecBytes = stream.getBytes();
65931  if (eexecBytes.length === 0) {
65932    throw new _util.FormatError("getEexecBlock - no font program found.");
65933  }
65934  return {
65935    stream: new _stream.Stream(eexecBytes),
65936    length: eexecBytes.length
65937  };
65938}
65939class Type1Font {
65940  constructor(name, file, properties) {
65941    const PFB_HEADER_SIZE = 6;
65942    let headerBlockLength = properties.length1;
65943    let eexecBlockLength = properties.length2;
65944    let pfbHeader = file.peekBytes(PFB_HEADER_SIZE);
65945    const pfbHeaderPresent = pfbHeader[0] === 0x80 && pfbHeader[1] === 0x01;
65946    if (pfbHeaderPresent) {
65947      file.skip(PFB_HEADER_SIZE);
65948      headerBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
65949    }
65950    const headerBlock = getHeaderBlock(file, headerBlockLength);
65951    const headerBlockParser = new _type1_parser.Type1Parser(headerBlock.stream, false, _fonts_utils.SEAC_ANALYSIS_ENABLED);
65952    headerBlockParser.extractFontHeader(properties);
65953    if (pfbHeaderPresent) {
65954      pfbHeader = file.getBytes(PFB_HEADER_SIZE);
65955      eexecBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
65956    }
65957    const eexecBlock = getEexecBlock(file, eexecBlockLength);
65958    const eexecBlockParser = new _type1_parser.Type1Parser(eexecBlock.stream, true, _fonts_utils.SEAC_ANALYSIS_ENABLED);
65959    const data = eexecBlockParser.extractFontProgram(properties);
65960    for (const key in data.properties) {
65961      properties[key] = data.properties[key];
65962    }
65963    const charstrings = data.charstrings;
65964    const type2Charstrings = this.getType2Charstrings(charstrings);
65965    const subrs = this.getType2Subrs(data.subrs);
65966    this.charstrings = charstrings;
65967    this.data = this.wrap(name, type2Charstrings, this.charstrings, subrs, properties);
65968    this.seacs = this.getSeacs(data.charstrings);
65969  }
65970  get numGlyphs() {
65971    return this.charstrings.length + 1;
65972  }
65973  getCharset() {
65974    const charset = [".notdef"];
65975    for (const {
65976      glyphName
65977    } of this.charstrings) {
65978      charset.push(glyphName);
65979    }
65980    return charset;
65981  }
65982  getGlyphMapping(properties) {
65983    const charstrings = this.charstrings;
65984    if (properties.composite) {
65985      const charCodeToGlyphId = Object.create(null);
65986      for (let glyphId = 0, charstringsLen = charstrings.length; glyphId < charstringsLen; glyphId++) {
65987        const charCode = properties.cMap.charCodeOf(glyphId);
65988        charCodeToGlyphId[charCode] = glyphId + 1;
65989      }
65990      return charCodeToGlyphId;
65991    }
65992    const glyphNames = [".notdef"];
65993    let builtInEncoding, glyphId;
65994    for (glyphId = 0; glyphId < charstrings.length; glyphId++) {
65995      glyphNames.push(charstrings[glyphId].glyphName);
65996    }
65997    const encoding = properties.builtInEncoding;
65998    if (encoding) {
65999      builtInEncoding = Object.create(null);
66000      for (const charCode in encoding) {
66001        glyphId = glyphNames.indexOf(encoding[charCode]);
66002        if (glyphId >= 0) {
66003          builtInEncoding[charCode] = glyphId;
66004        }
66005      }
66006    }
66007    return (0, _fonts_utils.type1FontGlyphMapping)(properties, builtInEncoding, glyphNames);
66008  }
66009  hasGlyphId(id) {
66010    if (id < 0 || id >= this.numGlyphs) {
66011      return false;
66012    }
66013    if (id === 0) {
66014      return true;
66015    }
66016    const glyph = this.charstrings[id - 1];
66017    return glyph.charstring.length > 0;
66018  }
66019  getSeacs(charstrings) {
66020    const seacMap = [];
66021    for (let i = 0, ii = charstrings.length; i < ii; i++) {
66022      const charstring = charstrings[i];
66023      if (charstring.seac) {
66024        seacMap[i + 1] = charstring.seac;
66025      }
66026    }
66027    return seacMap;
66028  }
66029  getType2Charstrings(type1Charstrings) {
66030    const type2Charstrings = [];
66031    for (const type1Charstring of type1Charstrings) {
66032      type2Charstrings.push(type1Charstring.charstring);
66033    }
66034    return type2Charstrings;
66035  }
66036  getType2Subrs(type1Subrs) {
66037    let bias = 0;
66038    const count = type1Subrs.length;
66039    if (count < 1133) {
66040      bias = 107;
66041    } else if (count < 33769) {
66042      bias = 1131;
66043    } else {
66044      bias = 32768;
66045    }
66046    const type2Subrs = [];
66047    let i;
66048    for (i = 0; i < bias; i++) {
66049      type2Subrs.push([0x0b]);
66050    }
66051    for (i = 0; i < count; i++) {
66052      type2Subrs.push(type1Subrs[i]);
66053    }
66054    return type2Subrs;
66055  }
66056  wrap(name, glyphs, charstrings, subrs, properties) {
66057    const cff = new _cff_parser.CFF();
66058    cff.header = new _cff_parser.CFFHeader(1, 0, 4, 4);
66059    cff.names = [name];
66060    const topDict = new _cff_parser.CFFTopDict();
66061    topDict.setByName("version", 391);
66062    topDict.setByName("Notice", 392);
66063    topDict.setByName("FullName", 393);
66064    topDict.setByName("FamilyName", 394);
66065    topDict.setByName("Weight", 395);
66066    topDict.setByName("Encoding", null);
66067    topDict.setByName("FontMatrix", properties.fontMatrix);
66068    topDict.setByName("FontBBox", properties.bbox);
66069    topDict.setByName("charset", null);
66070    topDict.setByName("CharStrings", null);
66071    topDict.setByName("Private", null);
66072    cff.topDict = topDict;
66073    const strings = new _cff_parser.CFFStrings();
66074    strings.add("Version 0.11");
66075    strings.add("See original notice");
66076    strings.add(name);
66077    strings.add(name);
66078    strings.add("Medium");
66079    cff.strings = strings;
66080    cff.globalSubrIndex = new _cff_parser.CFFIndex();
66081    const count = glyphs.length;
66082    const charsetArray = [".notdef"];
66083    let i, ii;
66084    for (i = 0; i < count; i++) {
66085      const glyphName = charstrings[i].glyphName;
66086      const index = _cff_parser.CFFStandardStrings.indexOf(glyphName);
66087      if (index === -1) {
66088        strings.add(glyphName);
66089      }
66090      charsetArray.push(glyphName);
66091    }
66092    cff.charset = new _cff_parser.CFFCharset(false, 0, charsetArray);
66093    const charStringsIndex = new _cff_parser.CFFIndex();
66094    charStringsIndex.add([0x8b, 0x0e]);
66095    for (i = 0; i < count; i++) {
66096      charStringsIndex.add(glyphs[i]);
66097    }
66098    cff.charStrings = charStringsIndex;
66099    const privateDict = new _cff_parser.CFFPrivateDict();
66100    privateDict.setByName("Subrs", null);
66101    const fields = ["BlueValues", "OtherBlues", "FamilyBlues", "FamilyOtherBlues", "StemSnapH", "StemSnapV", "BlueShift", "BlueFuzz", "BlueScale", "LanguageGroup", "ExpansionFactor", "ForceBold", "StdHW", "StdVW"];
66102    for (i = 0, ii = fields.length; i < ii; i++) {
66103      const field = fields[i];
66104      if (!(field in properties.privateData)) {
66105        continue;
66106      }
66107      const value = properties.privateData[field];
66108      if (Array.isArray(value)) {
66109        for (let j = value.length - 1; j > 0; j--) {
66110          value[j] -= value[j - 1];
66111        }
66112      }
66113      privateDict.setByName(field, value);
66114    }
66115    cff.topDict.privateDict = privateDict;
66116    const subrIndex = new _cff_parser.CFFIndex();
66117    for (i = 0, ii = subrs.length; i < ii; i++) {
66118      subrIndex.add(subrs[i]);
66119    }
66120    privateDict.subrsIndex = subrIndex;
66121    const compiler = new _cff_parser.CFFCompiler(cff);
66122    return compiler.compile();
66123  }
66124}
66125exports.Type1Font = Type1Font;
66126
66127/***/ }),
66128/* 49 */
66129/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
66130
66131
66132
66133Object.defineProperty(exports, "__esModule", ({
66134  value: true
66135}));
66136exports.Type1Parser = void 0;
66137var _encodings = __w_pdfjs_require__(37);
66138var _core_utils = __w_pdfjs_require__(3);
66139var _stream = __w_pdfjs_require__(8);
66140var _util = __w_pdfjs_require__(2);
66141const HINTING_ENABLED = false;
vendor: 5,446 bytes, lines 66142-66325
66142const COMMAND_MAP = {
66143  hstem: [1],
66144  vstem: [3],
66145  vmoveto: [4],
66146  rlineto: [5],
66147  hlineto: [6],
66148  vlineto: [7],
66149  rrcurveto: [8],
66150  callsubr: [10],
66151  flex: [12, 35],
66152  drop: [12, 18],
66153  endchar: [14],
66154  rmoveto: [21],
66155  hmoveto: [22],
66156  vhcurveto: [30],
66157  hvcurveto: [31]
66158};
66159class Type1CharString {
66160  constructor() {
66161    this.width = 0;
66162    this.lsb = 0;
66163    this.flexing = false;
66164    this.output = [];
66165    this.stack = [];
66166  }
66167  convert(encoded, subrs, seacAnalysisEnabled) {
66168    const count = encoded.length;
66169    let error = false;
66170    let wx, sbx, subrNumber;
66171    for (let i = 0; i < count; i++) {
66172      let value = encoded[i];
66173      if (value < 32) {
66174        if (value === 12) {
66175          value = (value << 8) + encoded[++i];
66176        }
66177        switch (value) {
66178          case 1:
66179            if (!HINTING_ENABLED) {
66180              this.stack = [];
66181              break;
66182            }
66183            error = this.executeCommand(2, COMMAND_MAP.hstem);
66184            break;
66185          case 3:
66186            if (!HINTING_ENABLED) {
66187              this.stack = [];
66188              break;
66189            }
66190            error = this.executeCommand(2, COMMAND_MAP.vstem);
66191            break;
66192          case 4:
66193            if (this.flexing) {
66194              if (this.stack.length < 1) {
66195                error = true;
66196                break;
66197              }
66198              const dy = this.stack.pop();
66199              this.stack.push(0, dy);
66200              break;
66201            }
66202            error = this.executeCommand(1, COMMAND_MAP.vmoveto);
66203            break;
66204          case 5:
66205            error = this.executeCommand(2, COMMAND_MAP.rlineto);
66206            break;
66207          case 6:
66208            error = this.executeCommand(1, COMMAND_MAP.hlineto);
66209            break;
66210          case 7:
66211            error = this.executeCommand(1, COMMAND_MAP.vlineto);
66212            break;
66213          case 8:
66214            error = this.executeCommand(6, COMMAND_MAP.rrcurveto);
66215            break;
66216          case 9:
66217            this.stack = [];
66218            break;
66219          case 10:
66220            if (this.stack.length < 1) {
66221              error = true;
66222              break;
66223            }
66224            subrNumber = this.stack.pop();
66225            if (!subrs[subrNumber]) {
66226              error = true;
66227              break;
66228            }
66229            error = this.convert(subrs[subrNumber], subrs, seacAnalysisEnabled);
66230            break;
66231          case 11:
66232            return error;
66233          case 13:
66234            if (this.stack.length < 2) {
66235              error = true;
66236              break;
66237            }
66238            wx = this.stack.pop();
66239            sbx = this.stack.pop();
66240            this.lsb = sbx;
66241            this.width = wx;
66242            this.stack.push(wx, sbx);
66243            error = this.executeCommand(2, COMMAND_MAP.hmoveto);
66244            break;
66245          case 14:
66246            this.output.push(COMMAND_MAP.endchar[0]);
66247            break;
66248          case 21:
66249            if (this.flexing) {
66250              break;
66251            }
66252            error = this.executeCommand(2, COMMAND_MAP.rmoveto);
66253            break;
66254          case 22:
66255            if (this.flexing) {
66256              this.stack.push(0);
66257              break;
66258            }
66259            error = this.executeCommand(1, COMMAND_MAP.hmoveto);
66260            break;
66261          case 30:
66262            error = this.executeCommand(4, COMMAND_MAP.vhcurveto);
66263            break;
66264          case 31:
66265            error = this.executeCommand(4, COMMAND_MAP.hvcurveto);
66266            break;
66267          case (12 << 8) + 0:
66268            this.stack = [];
66269            break;
66270          case (12 << 8) + 1:
66271            if (!HINTING_ENABLED) {
66272              this.stack = [];
66273              break;
66274            }
66275            error = this.executeCommand(2, COMMAND_MAP.vstem);
66276            break;
66277          case (12 << 8) + 2:
66278            if (!HINTING_ENABLED) {
66279              this.stack = [];
66280              break;
66281            }
66282            error = this.executeCommand(2, COMMAND_MAP.hstem);
66283            break;
66284          case (12 << 8) + 6:
66285            if (seacAnalysisEnabled) {
66286              const asb = this.stack.at(-5);
66287              this.seac = this.stack.splice(-4, 4);
66288              this.seac[0] += this.lsb - asb;
66289              error = this.executeCommand(0, COMMAND_MAP.endchar);
66290            } else {
66291              error = this.executeCommand(4, COMMAND_MAP.endchar);
66292            }
66293            break;
66294          case (12 << 8) + 7:
66295            if (this.stack.length < 4) {
66296              error = true;
66297              break;
66298            }
66299            this.stack.pop();
66300            wx = this.stack.pop();
66301            const sby = this.stack.pop();
66302            sbx = this.stack.pop();
66303            this.lsb = sbx;
66304            this.width = wx;
66305            this.stack.push(wx, sbx, sby);
66306            error = this.executeCommand(3, COMMAND_MAP.rmoveto);
66307            break;
66308          case (12 << 8) + 12:
66309            if (this.stack.length < 2) {
66310              error = true;
66311              break;
66312            }
66313            const num2 = this.stack.pop();
66314            const num1 = this.stack.pop();
66315            this.stack.push(num1 / num2);
66316            break;
66317          case (12 << 8) + 16:
66318            if (this.stack.length < 2) {
66319              error = true;
66320              break;
66321            }
66322            subrNumber = this.stack.pop();
66323            const numArgs = this.stack.pop();
66324            if (subrNumber === 0 && numArgs === 3) {
66325              const flexArgs = this.stack.splice(-
vendor: 8,702 bytes, lines 66325-66608
6632517, 17);
66326              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]);
66327              error = this.executeCommand(13, COMMAND_MAP.flex, true);
66328              this.flexing = false;
66329              this.stack.push(flexArgs[15], flexArgs[16]);
66330            } else if (subrNumber === 1 && numArgs === 0) {
66331              this.flexing = true;
66332            }
66333            break;
66334          case (12 << 8) + 17:
66335            break;
66336          case (12 << 8) + 33:
66337            this.stack = [];
66338            break;
66339          default:
66340            (0, _util.warn)('Unknown type 1 charstring command of "' + value + '"');
66341            break;
66342        }
66343        if (error) {
66344          break;
66345        }
66346        continue;
66347      } else if (value <= 246) {
66348        value -= 139;
66349      } else if (value <= 250) {
66350        value = (value - 247) * 256 + encoded[++i] + 108;
66351      } else if (value <= 254) {
66352        value = -((value - 251) * 256) - encoded[++i] - 108;
66353      } else {
66354        value = (encoded[++i] & 0xff) << 24 | (encoded[++i] & 0xff) << 16 | (encoded[++i] & 0xff) << 8 | (encoded[++i] & 0xff) << 0;
66355      }
66356      this.stack.push(value);
66357    }
66358    return error;
66359  }
66360  executeCommand(howManyArgs, command, keepStack) {
66361    const stackLength = this.stack.length;
66362    if (howManyArgs > stackLength) {
66363      return true;
66364    }
66365    const start = stackLength - howManyArgs;
66366    for (let i = start; i < stackLength; i++) {
66367      let value = this.stack[i];
66368      if (Number.isInteger(value)) {
66369        this.output.push(28, value >> 8 & 0xff, value & 0xff);
66370      } else {
66371        value = 65536 * value | 0;
66372        this.output.push(255, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
66373      }
66374    }
66375    this.output.push(...command);
66376    if (keepStack) {
66377      this.stack.splice(start, howManyArgs);
66378    } else {
66379      this.stack.length = 0;
66380    }
66381    return false;
66382  }
66383}
66384const EEXEC_ENCRYPT_KEY = 55665;
66385const CHAR_STRS_ENCRYPT_KEY = 4330;
66386function isHexDigit(code) {
66387  return code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102;
66388}
66389function decrypt(data, key, discardNumber) {
66390  if (discardNumber >= data.length) {
66391    return new Uint8Array(0);
66392  }
66393  const c1 = 52845,
66394    c2 = 22719;
66395  let r = key | 0,
66396    i,
66397    j;
66398  for (i = 0; i < discardNumber; i++) {
66399    r = (data[i] + r) * c1 + c2 & (1 << 16) - 1;
66400  }
66401  const count = data.length - discardNumber;
66402  const decrypted = new Uint8Array(count);
66403  for (i = discardNumber, j = 0; j < count; i++, j++) {
66404    const value = data[i];
66405    decrypted[j] = value ^ r >> 8;
66406    r = (value + r) * c1 + c2 & (1 << 16) - 1;
66407  }
66408  return decrypted;
66409}
66410function decryptAscii(data, key, discardNumber) {
66411  const c1 = 52845,
66412    c2 = 22719;
66413  let r = key | 0;
66414  const count = data.length,
66415    maybeLength = count >>> 1;
66416  const decrypted = new Uint8Array(maybeLength);
66417  let i, j;
66418  for (i = 0, j = 0; i < count; i++) {
66419    const digit1 = data[i];
66420    if (!isHexDigit(digit1)) {
66421      continue;
66422    }
66423    i++;
66424    let digit2;
66425    while (i < count && !isHexDigit(digit2 = data[i])) {
66426      i++;
66427    }
66428    if (i < count) {
66429      const value = parseInt(String.fromCharCode(digit1, digit2), 16);
66430      decrypted[j++] = value ^ r >> 8;
66431      r = (value + r) * c1 + c2 & (1 << 16) - 1;
66432    }
66433  }
66434  return decrypted.slice(discardNumber, j);
66435}
66436function isSpecial(c) {
66437  return c === 0x2f || c === 0x5b || c === 0x5d || c === 0x7b || c === 0x7d || c === 0x28 || c === 0x29;
66438}
66439class Type1Parser {
66440  constructor(stream, encrypted, seacAnalysisEnabled) {
66441    if (encrypted) {
66442      const data = stream.getBytes();
66443      const isBinary = !((isHexDigit(data[0]) || (0, _core_utils.isWhiteSpace)(data[0])) && isHexDigit(data[1]) && isHexDigit(data[2]) && isHexDigit(data[3]) && isHexDigit(data[4]) && isHexDigit(data[5]) && isHexDigit(data[6]) && isHexDigit(data[7]));
66444      stream = new _stream.Stream(isBinary ? decrypt(data, EEXEC_ENCRYPT_KEY, 4) : decryptAscii(data, EEXEC_ENCRYPT_KEY, 4));
66445    }
66446    this.seacAnalysisEnabled = !!seacAnalysisEnabled;
66447    this.stream = stream;
66448    this.nextChar();
66449  }
66450  readNumberArray() {
66451    this.getToken();
66452    const array = [];
66453    while (true) {
66454      const token = this.getToken();
66455      if (token === null || token === "]" || token === "}") {
66456        break;
66457      }
66458      array.push(parseFloat(token || 0));
66459    }
66460    return array;
66461  }
66462  readNumber() {
66463    const token = this.getToken();
66464    return parseFloat(token || 0);
66465  }
66466  readInt() {
66467    const token = this.getToken();
66468    return parseInt(token || 0, 10) | 0;
66469  }
66470  readBoolean() {
66471    const token = this.getToken();
66472    return token === "true" ? 1 : 0;
66473  }
66474  nextChar() {
66475    return this.currentChar = this.stream.getByte();
66476  }
66477  prevChar() {
66478    this.stream.skip(-2);
66479    return this.currentChar = this.stream.getByte();
66480  }
66481  getToken() {
66482    let comment = false;
66483    let ch = this.currentChar;
66484    while (true) {
66485      if (ch === -1) {
66486        return null;
66487      }
66488      if (comment) {
66489        if (ch === 0x0a || ch === 0x0d) {
66490          comment = false;
66491        }
66492      } else if (ch === 0x25) {
66493        comment = true;
66494      } else if (!(0, _core_utils.isWhiteSpace)(ch)) {
66495        break;
66496      }
66497      ch = this.nextChar();
66498    }
66499    if (isSpecial(ch)) {
66500      this.nextChar();
66501      return String.fromCharCode(ch);
66502    }
66503    let token = "";
66504    do {
66505      token += String.fromCharCode(ch);
66506      ch = this.nextChar();
66507    } while (ch >= 0 && !(0, _core_utils.isWhiteSpace)(ch) && !isSpecial(ch));
66508    return token;
66509  }
66510  readCharStrings(bytes, lenIV) {
66511    if (lenIV === -1) {
66512      return bytes;
66513    }
66514    return decrypt(bytes, CHAR_STRS_ENCRYPT_KEY, lenIV);
66515  }
66516  extractFontProgram(properties) {
66517    const stream = this.stream;
66518    const subrs = [],
66519      charstrings = [];
66520    const privateData = Object.create(null);
66521    privateData.lenIV = 4;
66522    const program = {
66523      subrs: [],
66524      charstrings: [],
66525      properties: {
66526        privateData
66527      }
66528    };
66529    let token, length, data, lenIV;
66530    while ((token = this.getToken()) !== null) {
66531      if (token !== "/") {
66532        continue;
66533      }
66534      token = this.getToken();
66535      switch (token) {
66536        case "CharStrings":
66537          this.getToken();
66538          this.getToken();
66539          this.getToken();
66540          this.getToken();
66541          while (true) {
66542            token = this.getToken();
66543            if (token === null || token === "end") {
66544              break;
66545            }
66546            if (token !== "/") {
66547              continue;
66548            }
66549            const glyph = this.getToken();
66550            length = this.readInt();
66551            this.getToken();
66552            data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
66553            lenIV = program.properties.privateData.lenIV;
66554            const encoded = this.readCharStrings(data, lenIV);
66555            this.nextChar();
66556            token = this.getToken();
66557            if (token === "noaccess") {
66558              this.getToken();
66559            } else if (token === "/") {
66560              this.prevChar();
66561            }
66562            charstrings.push({
66563              glyph,
66564              encoded
66565            });
66566          }
66567          break;
66568        case "Subrs":
66569          this.readInt();
66570          this.getToken();
66571          while (this.getToken() === "dup") {
66572            const index = this.readInt();
66573            length = this.readInt();
66574            this.getToken();
66575            data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
66576            lenIV = program.properties.privateData.lenIV;
66577            const encoded = this.readCharStrings(data, lenIV);
66578            this.nextChar();
66579            token = this.getToken();
66580            if (token === "noaccess") {
66581              this.getToken();
66582            }
66583            subrs[index] = encoded;
66584          }
66585          break;
66586        case "BlueValues":
66587        case "OtherBlues":
66588        case "FamilyBlues":
66589        case "FamilyOtherBlues":
66590          const blueArray = this.readNumberArray();
66591          if (blueArray.length > 0 && blueArray.length % 2 === 0 && HINTING_ENABLED) {
66592            program.properties.privateData[token] = blueArray;
66593          }
66594          break;
66595        case "StemSnapH":
66596        case "StemSnapV":
66597          program.properties.privateData[token] = this.readNumberArray();
66598          break;
66599        case "StdHW":
66600        case "StdVW":
66601          program.properties.privateData[token] = this.readNumberArray()[0];
66602          break;
66603        case "BlueShift":
66604        case "lenIV":
66605        case "BlueFuzz":
66606        case "BlueScale":
66607        case "LanguageGroup":
66608        
vendor: 5,692 bytes, lines 66608-66790
66608  program.properties.privateData[token] = this.readNumber();
66609          break;
66610        case "ExpansionFactor":
66611          program.properties.privateData[token] = this.readNumber() || 0.06;
66612          break;
66613        case "ForceBold":
66614          program.properties.privateData[token] = this.readBoolean();
66615          break;
66616      }
66617    }
66618    for (const {
66619      encoded,
66620      glyph
66621    } of charstrings) {
66622      const charString = new Type1CharString();
66623      const error = charString.convert(encoded, subrs, this.seacAnalysisEnabled);
66624      let output = charString.output;
66625      if (error) {
66626        output = [14];
66627      }
66628      const charStringObject = {
66629        glyphName: glyph,
66630        charstring: output,
66631        width: charString.width,
66632        lsb: charString.lsb,
66633        seac: charString.seac
66634      };
66635      if (glyph === ".notdef") {
66636        program.charstrings.unshift(charStringObject);
66637      } else {
66638        program.charstrings.push(charStringObject);
66639      }
66640      if (properties.builtInEncoding) {
66641        const index = properties.builtInEncoding.indexOf(glyph);
66642        if (index > -1 && properties.widths[index] === undefined && index >= properties.firstChar && index <= properties.lastChar) {
66643          properties.widths[index] = charString.width;
66644        }
66645      }
66646    }
66647    return program;
66648  }
66649  extractFontHeader(properties) {
66650    let token;
66651    while ((token = this.getToken()) !== null) {
66652      if (token !== "/") {
66653        continue;
66654      }
66655      token = this.getToken();
66656      switch (token) {
66657        case "FontMatrix":
66658          const matrix = this.readNumberArray();
66659          properties.fontMatrix = matrix;
66660          break;
66661        case "Encoding":
66662          const encodingArg = this.getToken();
66663          let encoding;
66664          if (!/^\d+$/.test(encodingArg)) {
66665            encoding = (0, _encodings.getEncoding)(encodingArg);
66666          } else {
66667            encoding = [];
66668            const size = parseInt(encodingArg, 10) | 0;
66669            this.getToken();
66670            for (let j = 0; j < size; j++) {
66671              token = this.getToken();
66672              while (token !== "dup" && token !== "def") {
66673                token = this.getToken();
66674                if (token === null) {
66675                  return;
66676                }
66677              }
66678              if (token === "def") {
66679                break;
66680              }
66681              const index = this.readInt();
66682              this.getToken();
66683              const glyph = this.getToken();
66684              encoding[index] = glyph;
66685              this.getToken();
66686            }
66687          }
66688          properties.builtInEncoding = encoding;
66689          break;
66690        case "FontBBox":
66691          const fontBBox = this.readNumberArray();
66692          properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
66693          properties.descent = Math.min(fontBBox[1], fontBBox[3]);
66694          properties.ascentScaled = true;
66695          break;
66696      }
66697    }
66698  }
66699}
66700exports.Type1Parser = Type1Parser;
66701
66702/***/ }),
66703/* 50 */
66704/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
66705
66706
66707
66708Object.defineProperty(exports, "__esModule", ({
66709  value: true
66710}));
66711exports.Pattern = void 0;
66712exports.clearPatternCaches = clearPatternCaches;
66713exports.getTilingPatternIR = getTilingPatternIR;
66714var _util = __w_pdfjs_require__(2);
66715var _base_stream = __w_pdfjs_require__(5);
66716var _colorspace = __w_pdfjs_require__(12);
66717var _core_utils = __w_pdfjs_require__(3);
66718const ShadingType = {
66719  FUNCTION_BASED: 1,
66720  AXIAL: 2,
66721  RADIAL: 3,
66722  FREE_FORM_MESH: 4,
66723  LATTICE_FORM_MESH: 5,
66724  COONS_PATCH_MESH: 6,
66725  TENSOR_PATCH_MESH: 7
66726};
66727class Pattern {
66728  constructor() {
66729    (0, _util.unreachable)("Cannot initialize Pattern.");
66730  }
66731  static parseShading(shading, xref, res, pdfFunctionFactory, localColorSpaceCache) {
66732    const dict = shading instanceof _base_stream.BaseStream ? shading.dict : shading;
66733    const type = dict.get("ShadingType");
66734    try {
66735      switch (type) {
66736        case ShadingType.AXIAL:
66737        case ShadingType.RADIAL:
66738          return new RadialAxialShading(dict, xref, res, pdfFunctionFactory, localColorSpaceCache);
66739        case ShadingType.FREE_FORM_MESH:
66740        case ShadingType.LATTICE_FORM_MESH:
66741        case ShadingType.COONS_PATCH_MESH:
66742        case ShadingType.TENSOR_PATCH_MESH:
66743          return new MeshShading(shading, xref, res, pdfFunctionFactory, localColorSpaceCache);
66744        default:
66745          throw new _util.FormatError("Unsupported ShadingType: " + type);
66746      }
66747    } catch (ex) {
66748      if (ex instanceof _core_utils.MissingDataException) {
66749        throw ex;
66750      }
66751      (0, _util.warn)(ex);
66752      return new DummyShading();
66753    }
66754  }
66755}
66756exports.Pattern = Pattern;
66757class BaseShading {
66758  static SMALL_NUMBER = 1e-6;
66759  constructor() {
66760    if (this.constructor === BaseShading) {
66761      (0, _util.unreachable)("Cannot initialize BaseShading.");
66762    }
66763  }
66764  getIR() {
66765    (0, _util.unreachable)("Abstract method `getIR` called.");
66766  }
66767}
66768class RadialAxialShading extends BaseShading {
66769  constructor(dict, xref, resources, pdfFunctionFactory, localColorSpaceCache) {
66770    super();
66771    this.coordsArr = dict.getArray("Coords");
66772    this.shadingType = dict.get("ShadingType");
66773    const cs = _colorspace.ColorSpace.parse({
66774      cs: dict.getRaw("CS") || dict.getRaw("ColorSpace"),
66775      xref,
66776      resources,
66777      pdfFunctionFactory,
66778      localColorSpaceCache
66779    });
66780    const bbox = dict.getArray("BBox");
66781    this.bbox = Array.isArray(bbox) && bbox.length === 4 ? _util.Util.normalizeRect(bbox) : null;
66782    let t0 = 0.0,
66783      t1 = 1.0;
66784    if (dict.has("Domain")) {
66785      const domainArr = dict.getArray("Domain");
66786      t0 = domainArr[0];
66787      t1 = domainArr[1];
66788    }
66789    let extendStart = false,
66790      extendEnd = false;
66791    if (dict.has("Extend")) {
66792      const extendArr = dict.getArray("Extend");
66793      extendStart = extendArr[0];
66794      extendEnd = extendArr[1];
66795    }
66796    if (this.shadingType === ShadingType.RADIAL && (!extendStart || !extendEnd)) {
66797      const [x1, y1, r1, x2, y2, r2] = this.coordsArr;
66798      const distance = Math.hypot(x1 - x2, y1 - y2);
66799      if (r1 <= r2 + distance && r2 <= r1 + distance) {
66800        (0, _util.warn)("Unsupported radial gradient.");
66801      }
66802    }
66803    this.extendStart = extendStart;
66804    this.extendEnd = extendEnd;
66805    const fnObj = dict.getRaw("Function");
66806    const fn = pdfFunctionFactory.createFromArray(fnObj);
66807    const NUMBER_OF_SAMPLES = 840;
66808    const step = (t1 - t0) / NUMBER_OF_SAMPLES;
66809    const colorStops = this.colorStops = [];
66810    if (t0 >= t1 || step <= 0) {
66811      (0, _util.info)("Bad shading domain.");
66812      return;
66813    }
66814    const color = new Float32Array(cs.numComps),
66815      ratio = new Float32Array(1);
66816    let rgbColor;
66817    let iBase = 0;
66818    ratio[0] = t0;
66819    fn(ratio, 0, color, 0);
66820    let rgbBase = cs.getRgb(color, 0);
66821    const cssColorBase = _util.Util.makeHexColor(rgbBase[0], rgbBase[1], rgbBase[2]);
66822    colorStops.push([0, cssColorBase]);
66823    let iPrev = 1;
66824    ratio[0] = t0 + step;
66825    fn(ratio, 0, color, 0);
66826    let rgbPrev = cs.getRgb(color, 0);
66827    let maxSlopeR = rgbPrev[0] - rgbBase[0] + 1;
66828    let maxSlopeG = rgbPrev[1] - rgbBase[1] + 1;
66829    let maxSlopeB = rgbPrev[2] - rgbBase[2] + 1;
66830    let minSlopeR = rgbPrev[0] - rgbBase[0] - 1;
66831    let minSlopeG = rgbPrev[1] - rgbBase[1] - 1;
66832    let minSlopeB = rgbPrev[2] - rgbBase[2] - 1;
66833    for (let i = 2; i < NUMBER_OF_SAMPLES; i++) {
66834      ratio[0] = t0 + i * step;
66835      fn(ratio, 0, color, 0);
66836      rgbColor = cs.getRgb(color, 0);
66837      const run = i - iBase;
66838      maxSlopeR = Math.min(maxSlopeR, (rgbColor[0] - rgbBase[0] + 1) / run);
66839      maxSlopeG = Math.min(maxSlopeG, (rgbColor[1] - rgbBase[1] + 1) / run);
66840      maxSlopeB = Math.min(maxSlopeB, (rgbColor[2] - rgbBase[2] + 1) / run);
66841      minSlopeR = Math.max(minSlopeR, (rgbColor[0] - rgbBase[0] - 1) / run);
66842      minSlopeG = Math.max(minSlopeG, (rgbColor[1] - rgbBase[1] - 1) / run);
66843      minSlopeB = Math.max(minSlopeB, (rgbColor[2] - rgbBase[2] - 1) / run);
66844      const slopesExist = minSlopeR <= maxSlopeR && minSlopeG <= maxSlopeG && minSlopeB <= maxSlopeB;
66845      if (!slopesExist) {
66846        const cssColor = _util.Util.makeHexColor(rgbPrev[0], rgbPrev[1], rgbPrev[2]);
66847        colorStops.push([iPrev / NUMBER_OF_SAMPLES, cssColor]);
66848        maxSlopeR = rgbColor[0] - rgbPrev[0] + 1;
66849        maxSlopeG = rgbColor[1] - rgbPrev[1] + 1;
66850        maxSlopeB = rgbColor[2] - rgbPrev[2] + 1;
66851        minSlopeR = rgbColor[0] - rgbPrev[0] - 1;
66852        minSlopeG = rgbColor[1] - rgbPrev[1] - 1;
66853        minSlopeB = rgbColor[2] - rgbPrev[2] - 1;
66854        iBase = iPrev;
66855        rgbBase = rgbPrev;
66856      }
66857      iPrev = i;
66858      rgbPrev = rgbColor;
66859    }
66860    const cssColor = _util.Util.makeHexColor(rgbPrev[0], rgbPrev[1], rgbPrev[2]);
66861    colorStops.push([1, cssColor]);
66862    let background = "transparent";
vendor: 5,070 bytes, lines 66863-67009
66863    if (dict.has("Background")) {
66864      rgbColor = cs.getRgb(dict.get("Background"), 0);
66865      background = _util.Util.makeHexColor(rgbColor[0], rgbColor[1], rgbColor[2]);
66866    }
66867    if (!extendStart) {
66868      colorStops.unshift([0, background]);
66869      colorStops[1][0] += BaseShading.SMALL_NUMBER;
66870    }
66871    if (!extendEnd) {
66872      colorStops.at(-1)[0] -= BaseShading.SMALL_NUMBER;
66873      colorStops.push([1, background]);
66874    }
66875    this.colorStops = colorStops;
66876  }
66877  getIR() {
66878    const coordsArr = this.coordsArr;
66879    const shadingType = this.shadingType;
66880    let type, p0, p1, r0, r1;
66881    if (shadingType === ShadingType.AXIAL) {
66882      p0 = [coordsArr[0], coordsArr[1]];
66883      p1 = [coordsArr[2], coordsArr[3]];
66884      r0 = null;
66885      r1 = null;
66886      type = "axial";
66887    } else if (shadingType === ShadingType.RADIAL) {
66888      p0 = [coordsArr[0], coordsArr[1]];
66889      p1 = [coordsArr[3], coordsArr[4]];
66890      r0 = coordsArr[2];
66891      r1 = coordsArr[5];
66892      type = "radial";
66893    } else {
66894      (0, _util.unreachable)(`getPattern type unknown: ${shadingType}`);
66895    }
66896    return ["RadialAxial", type, this.bbox, this.colorStops, p0, p1, r0, r1];
66897  }
66898}
66899class MeshStreamReader {
66900  constructor(stream, context) {
66901    this.stream = stream;
66902    this.context = context;
66903    this.buffer = 0;
66904    this.bufferLength = 0;
66905    const numComps = context.numComps;
66906    this.tmpCompsBuf = new Float32Array(numComps);
66907    const csNumComps = context.colorSpace.numComps;
66908    this.tmpCsCompsBuf = context.colorFn ? new Float32Array(csNumComps) : this.tmpCompsBuf;
66909  }
66910  get hasData() {
66911    if (this.stream.end) {
66912      return this.stream.pos < this.stream.end;
66913    }
66914    if (this.bufferLength > 0) {
66915      return true;
66916    }
66917    const nextByte = this.stream.getByte();
66918    if (nextByte < 0) {
66919      return false;
66920    }
66921    this.buffer = nextByte;
66922    this.bufferLength = 8;
66923    return true;
66924  }
66925  readBits(n) {
66926    let buffer = this.buffer;
66927    let bufferLength = this.bufferLength;
66928    if (n === 32) {
66929      if (bufferLength === 0) {
66930        return (this.stream.getByte() << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte()) >>> 0;
66931      }
66932      buffer = buffer << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte();
66933      const nextByte = this.stream.getByte();
66934      this.buffer = nextByte & (1 << bufferLength) - 1;
66935      return (buffer << 8 - bufferLength | (nextByte & 0xff) >> bufferLength) >>> 0;
66936    }
66937    if (n === 8 && bufferLength === 0) {
66938      return this.stream.getByte();
66939    }
66940    while (bufferLength < n) {
66941      buffer = buffer << 8 | this.stream.getByte();
66942      bufferLength += 8;
66943    }
66944    bufferLength -= n;
66945    this.bufferLength = bufferLength;
66946    this.buffer = buffer & (1 << bufferLength) - 1;
66947    return buffer >> bufferLength;
66948  }
66949  align() {
66950    this.buffer = 0;
66951    this.bufferLength = 0;
66952  }
66953  readFlag() {
66954    return this.readBits(this.context.bitsPerFlag);
66955  }
66956  readCoordinate() {
66957    const bitsPerCoordinate = this.context.bitsPerCoordinate;
66958    const xi = this.readBits(bitsPerCoordinate);
66959    const yi = this.readBits(bitsPerCoordinate);
66960    const decode = this.context.decode;
66961    const scale = bitsPerCoordinate < 32 ? 1 / ((1 << bitsPerCoordinate) - 1) : 2.3283064365386963e-10;
66962    return [xi * scale * (decode[1] - decode[0]) + decode[0], yi * scale * (decode[3] - decode[2]) + decode[2]];
66963  }
66964  readComponents() {
66965    const numComps = this.context.numComps;
66966    const bitsPerComponent = this.context.bitsPerComponent;
66967    const scale = bitsPerComponent < 32 ? 1 / ((1 << bitsPerComponent) - 1) : 2.3283064365386963e-10;
66968    const decode = this.context.decode;
66969    const components = this.tmpCompsBuf;
66970    for (let i = 0, j = 4; i < numComps; i++, j += 2) {
66971      const ci = this.readBits(bitsPerComponent);
66972      components[i] = ci * scale * (decode[j + 1] - decode[j]) + decode[j];
66973    }
66974    const color = this.tmpCsCompsBuf;
66975    if (this.context.colorFn) {
66976      this.context.colorFn(components, 0, color, 0);
66977    }
66978    return this.context.colorSpace.getRgb(color, 0);
66979  }
66980}
66981let bCache = Object.create(null);
66982function buildB(count) {
66983  const lut = [];
66984  for (let i = 0; i <= count; i++) {
66985    const t = i / count,
66986      t_ = 1 - t;
66987    lut.push(new Float32Array([t_ ** 3, 3 * t * t_ ** 2, 3 * t ** 2 * t_, t ** 3]));
66988  }
66989  return lut;
66990}
66991function getB(count) {
66992  return bCache[count] ||= buildB(count);
66993}
66994function clearPatternCaches() {
66995  bCache = Object.create(null);
66996}
66997class MeshShading extends BaseShading {
66998  static MIN_SPLIT_PATCH_CHUNKS_AMOUNT = 3;
66999  static MAX_SPLIT_PATCH_CHUNKS_AMOUNT = 20;
67000  static TRIANGLE_DENSITY = 20;
67001  constructor(stream, xref, resources, pdfFunctionFactory, localColorSpaceCache) {
67002    super();
67003    if (!(stream instanceof _base_stream.BaseStream)) {
67004      throw new _util.FormatError("Mesh data is not a stream");
67005    }
67006    const dict = stream.dict;
67007    this.shadingType = dict.get("ShadingType");
67008    const bbox = dict.getArray("BBox");
67009    this.bbox = Array.isArray(bbox) && bbox.length === 4 ? _util.Util.normalizeRect(bbox) : null;
vendor: 16,813 bytes, lines 67009-67508
67009
67010    const cs = _colorspace.ColorSpace.parse({
67011      cs: dict.getRaw("CS") || dict.getRaw("ColorSpace"),
67012      xref,
67013      resources,
67014      pdfFunctionFactory,
67015      localColorSpaceCache
67016    });
67017    this.background = dict.has("Background") ? cs.getRgb(dict.get("Background"), 0) : null;
67018    const fnObj = dict.getRaw("Function");
67019    const fn = fnObj ? pdfFunctionFactory.createFromArray(fnObj) : null;
67020    this.coords = [];
67021    this.colors = [];
67022    this.figures = [];
67023    const decodeContext = {
67024      bitsPerCoordinate: dict.get("BitsPerCoordinate"),
67025      bitsPerComponent: dict.get("BitsPerComponent"),
67026      bitsPerFlag: dict.get("BitsPerFlag"),
67027      decode: dict.getArray("Decode"),
67028      colorFn: fn,
67029      colorSpace: cs,
67030      numComps: fn ? 1 : cs.numComps
67031    };
67032    const reader = new MeshStreamReader(stream, decodeContext);
67033    let patchMesh = false;
67034    switch (this.shadingType) {
67035      case ShadingType.FREE_FORM_MESH:
67036        this._decodeType4Shading(reader);
67037        break;
67038      case ShadingType.LATTICE_FORM_MESH:
67039        const verticesPerRow = dict.get("VerticesPerRow") | 0;
67040        if (verticesPerRow < 2) {
67041          throw new _util.FormatError("Invalid VerticesPerRow");
67042        }
67043        this._decodeType5Shading(reader, verticesPerRow);
67044        break;
67045      case ShadingType.COONS_PATCH_MESH:
67046        this._decodeType6Shading(reader);
67047        patchMesh = true;
67048        break;
67049      case ShadingType.TENSOR_PATCH_MESH:
67050        this._decodeType7Shading(reader);
67051        patchMesh = true;
67052        break;
67053      default:
67054        (0, _util.unreachable)("Unsupported mesh type.");
67055        break;
67056    }
67057    if (patchMesh) {
67058      this._updateBounds();
67059      for (let i = 0, ii = this.figures.length; i < ii; i++) {
67060        this._buildFigureFromPatch(i);
67061      }
67062    }
67063    this._updateBounds();
67064    this._packData();
67065  }
67066  _decodeType4Shading(reader) {
67067    const coords = this.coords;
67068    const colors = this.colors;
67069    const operators = [];
67070    const ps = [];
67071    let verticesLeft = 0;
67072    while (reader.hasData) {
67073      const f = reader.readFlag();
67074      const coord = reader.readCoordinate();
67075      const color = reader.readComponents();
67076      if (verticesLeft === 0) {
67077        if (!(0 <= f && f <= 2)) {
67078          throw new _util.FormatError("Unknown type4 flag");
67079        }
67080        switch (f) {
67081          case 0:
67082            verticesLeft = 3;
67083            break;
67084          case 1:
67085            ps.push(ps.at(-2), ps.at(-1));
67086            verticesLeft = 1;
67087            break;
67088          case 2:
67089            ps.push(ps.at(-3), ps.at(-1));
67090            verticesLeft = 1;
67091            break;
67092        }
67093        operators.push(f);
67094      }
67095      ps.push(coords.length);
67096      coords.push(coord);
67097      colors.push(color);
67098      verticesLeft--;
67099      reader.align();
67100    }
67101    this.figures.push({
67102      type: "triangles",
67103      coords: new Int32Array(ps),
67104      colors: new Int32Array(ps)
67105    });
67106  }
67107  _decodeType5Shading(reader, verticesPerRow) {
67108    const coords = this.coords;
67109    const colors = this.colors;
67110    const ps = [];
67111    while (reader.hasData) {
67112      const coord = reader.readCoordinate();
67113      const color = reader.readComponents();
67114      ps.push(coords.length);
67115      coords.push(coord);
67116      colors.push(color);
67117    }
67118    this.figures.push({
67119      type: "lattice",
67120      coords: new Int32Array(ps),
67121      colors: new Int32Array(ps),
67122      verticesPerRow
67123    });
67124  }
67125  _decodeType6Shading(reader) {
67126    const coords = this.coords;
67127    const colors = this.colors;
67128    const ps = new Int32Array(16);
67129    const cs = new Int32Array(4);
67130    while (reader.hasData) {
67131      const f = reader.readFlag();
67132      if (!(0 <= f && f <= 3)) {
67133        throw new _util.FormatError("Unknown type6 flag");
67134      }
67135      const pi = coords.length;
67136      for (let i = 0, ii = f !== 0 ? 8 : 12; i < ii; i++) {
67137        coords.push(reader.readCoordinate());
67138      }
67139      const ci = colors.length;
67140      for (let i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
67141        colors.push(reader.readComponents());
67142      }
67143      let tmp1, tmp2, tmp3, tmp4;
67144      switch (f) {
67145        case 0:
67146          ps[12] = pi + 3;
67147          ps[13] = pi + 4;
67148          ps[14] = pi + 5;
67149          ps[15] = pi + 6;
67150          ps[8] = pi + 2;
67151          ps[11] = pi + 7;
67152          ps[4] = pi + 1;
67153          ps[7] = pi + 8;
67154          ps[0] = pi;
67155          ps[1] = pi + 11;
67156          ps[2] = pi + 10;
67157          ps[3] = pi + 9;
67158          cs[2] = ci + 1;
67159          cs[3] = ci + 2;
67160          cs[0] = ci;
67161          cs[1] = ci + 3;
67162          break;
67163        case 1:
67164          tmp1 = ps[12];
67165          tmp2 = ps[13];
67166          tmp3 = ps[14];
67167          tmp4 = ps[15];
67168          ps[12] = tmp4;
67169          ps[13] = pi + 0;
67170          ps[14] = pi + 1;
67171          ps[15] = pi + 2;
67172          ps[8] = tmp3;
67173          ps[11] = pi + 3;
67174          ps[4] = tmp2;
67175          ps[7] = pi + 4;
67176          ps[0] = tmp1;
67177          ps[1] = pi + 7;
67178          ps[2] = pi + 6;
67179          ps[3] = pi + 5;
67180          tmp1 = cs[2];
67181          tmp2 = cs[3];
67182          cs[2] = tmp2;
67183          cs[3] = ci;
67184          cs[0] = tmp1;
67185          cs[1] = ci + 1;
67186          break;
67187        case 2:
67188          tmp1 = ps[15];
67189          tmp2 = ps[11];
67190          ps[12] = ps[3];
67191          ps[13] = pi + 0;
67192          ps[14] = pi + 1;
67193          ps[15] = pi + 2;
67194          ps[8] = ps[7];
67195          ps[11] = pi + 3;
67196          ps[4] = tmp2;
67197          ps[7] = pi + 4;
67198          ps[0] = tmp1;
67199          ps[1] = pi + 7;
67200          ps[2] = pi + 6;
67201          ps[3] = pi + 5;
67202          tmp1 = cs[3];
67203          cs[2] = cs[1];
67204          cs[3] = ci;
67205          cs[0] = tmp1;
67206          cs[1] = ci + 1;
67207          break;
67208        case 3:
67209          ps[12] = ps[0];
67210          ps[13] = pi + 0;
67211          ps[14] = pi + 1;
67212          ps[15] = pi + 2;
67213          ps[8] = ps[1];
67214          ps[11] = pi + 3;
67215          ps[4] = ps[2];
67216          ps[7] = pi + 4;
67217          ps[0] = ps[3];
67218          ps[1] = pi + 7;
67219          ps[2] = pi + 6;
67220          ps[3] = pi + 5;
67221          cs[2] = cs[0];
67222          cs[3] = ci;
67223          cs[0] = cs[1];
67224          cs[1] = ci + 1;
67225          break;
67226      }
67227      ps[5] = coords.length;
67228      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]);
67229      ps[6] = coords.length;
67230      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]);
67231      ps[9] = coords.length;
67232      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]);
67233      ps[10] = coords.length;
67234      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]);
67235      this.figures.push({
67236        type: "patch",
67237        coords: new Int32Array(ps),
67238        colors: new Int32Array(cs)
67239      });
67240    }
67241  }
67242  _decodeType7Shading(reader) {
67243    const coords = this.coords;
67244    const colors = this.colors;
67245    const ps = new Int32Array(16);
67246    const cs = new Int32Array(4);
67247    while (reader.hasData) {
67248      const f = reader.readFlag();
67249      if (!(0 <= f && f <= 3)) {
67250        throw new _util.FormatError("Unknown type7 flag");
67251      }
67252      const pi = coords.length;
67253      for (let i = 0, ii = f !== 0 ? 12 : 16; i < ii; i++) {
67254        coords.push(reader.readCoordinate());
67255      }
67256      const ci = colors.length;
67257      for (let i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
67258        colors.push(reader.readComponents());
67259      }
67260      let tmp1, tmp2, tmp3, tmp4;
67261      switch (f) {
67262        case 0:
67263          ps[12] = pi + 3;
67264          ps[13] = pi + 4;
67265          ps[14] = pi + 5;
67266          ps[15] = pi + 6;
67267          ps[8] = pi + 2;
67268          ps[9] = pi + 13;
67269          ps[10] = pi + 14;
67270          ps[11] = pi + 7;
67271          ps[4] = pi + 1;
67272          ps[5] = pi + 12;
67273          ps[6] = pi + 15;
67274          ps[7] = pi + 8;
67275          ps[0] = pi;
67276          ps[1] = pi + 11;
67277          ps[2] = pi + 10;
67278          ps[3] = pi + 9;
67279          cs[2] = ci + 1;
67280          cs[3] = ci + 2;
67281          cs[0] = ci;
67282          cs[1] = ci + 3;
67283          break;
67284        case 1:
67285          tmp1 = ps[12];
67286          tmp2 = ps[13];
67287          tmp3 = ps[14];
67288          tmp4 = ps[15];
67289          ps[12] = tmp4;
67290          ps[13] = pi + 0;
67291          ps[14] = pi + 1;
67292          ps[15] = pi + 2;
67293          ps[8] = tmp3;
67294          ps[9] = pi + 9;
67295          ps[10] = pi + 10;
67296          ps[11] = pi + 3;
67297          ps[4] = tmp2;
67298          ps[5] = pi + 8;
67299          ps[6] = pi + 11;
67300          ps[7] = pi + 4;
67301          ps[0] = tmp1;
67302          ps[1] = pi + 7;
67303          ps[2] = pi + 6;
67304          ps[3] = pi + 5;
67305          tmp1 = cs[2];
67306          tmp2 = cs[3];
67307          cs[2] = tmp2;
67308          cs[3] = ci;
67309          cs[0] = tmp1;
67310          cs[1] = ci + 1;
67311          break;
67312        case 2:
67313          tmp1 = ps[15];
67314          tmp2 = ps[11];
67315          ps[12] = ps[3];
67316          ps[13] = pi + 0;
67317          ps[14] = pi + 1;
67318          ps[15] = pi + 2;
67319          ps[8] = ps[7];
67320          ps[9] = pi + 9;
67321          ps[10] = pi + 10;
67322          ps[11] = pi + 3;
67323          ps[4] = tmp2;
67324          ps[5] = pi + 8;
67325          ps[6] = pi + 11;
67326          ps[7] = pi + 4;
67327          ps[0] = tmp1;
67328          ps[1] = pi + 7;
67329          ps[2] = pi + 6;
67330          ps[3] = pi + 5;
67331          tmp1 = cs[3];
67332          cs[2] = cs[1];
67333          cs[3] = ci;
67334          cs[0] = tmp1;
67335          cs[1] = ci + 1;
67336          break;
67337        case 3:
67338          ps[12] = ps[0];
67339          ps[13] = pi + 0;
67340          ps[14] = pi + 1;
67341          ps[15] = pi + 2;
67342          ps[8] = ps[1];
67343          ps[9] = pi + 9;
67344          ps[10] = pi + 10;
67345          ps[11] = pi + 3;
67346          ps[4] = ps[2];
67347          ps[5] = pi + 8;
67348          ps[6] = pi + 11;
67349          ps[7] = pi + 4;
67350          ps[0] = ps[3];
67351          ps[1] = pi + 7;
67352          ps[2] = pi + 6;
67353          ps[3] = pi + 5;
67354          cs[2] = cs[0];
67355          cs[3] = ci;
67356          cs[0] = cs[1];
67357          cs[1] = ci + 1;
67358          break;
67359      }
67360      this.figures.push({
67361        type: "patch",
67362        coords: new Int32Array(ps),
67363        colors: new Int32Array(cs)
67364      });
67365    }
67366  }
67367  _buildFigureFromPatch(index) {
67368    const figure = this.figures[index];
67369    (0, _util.assert)(figure.type === "patch", "Unexpected patch mesh figure");
67370    const coords = this.coords,
67371      colors = this.colors;
67372    const pi = figure.coords;
67373    const ci = figure.colors;
67374    const figureMinX = Math.min(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
67375    const figureMinY = Math.min(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
67376    const figureMaxX = Math.max(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
67377    const figureMaxY = Math.max(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
67378    let splitXBy = Math.ceil((figureMaxX - figureMinX) * MeshShading.TRIANGLE_DENSITY / (this.bounds[2] - this.bounds[0]));
67379    splitXBy = Math.max(MeshShading.MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MeshShading.MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitXBy));
67380    let splitYBy = Math.ceil((figureMaxY - figureMinY) * MeshShading.TRIANGLE_DENSITY / (this.bounds[3] - this.bounds[1]));
67381    splitYBy = Math.max(MeshShading.MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MeshShading.MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitYBy));
67382    const verticesPerRow = splitXBy + 1;
67383    const figureCoords = new Int32Array((splitYBy + 1) * verticesPerRow);
67384    const figureColors = new Int32Array((splitYBy + 1) * verticesPerRow);
67385    let k = 0;
67386    const cl = new Uint8Array(3),
67387      cr = new Uint8Array(3);
67388    const c0 = colors[ci[0]],
67389      c1 = colors[ci[1]],
67390      c2 = colors[ci[2]],
67391      c3 = colors[ci[3]];
67392    const bRow = getB(splitYBy),
67393      bCol = getB(splitXBy);
67394    for (let row = 0; row <= splitYBy; row++) {
67395      cl[0] = (c0[0] * (splitYBy - row) + c2[0] * row) / splitYBy | 0;
67396      cl[1] = (c0[1] * (splitYBy - row) + c2[1] * row) / splitYBy | 0;
67397      cl[2] = (c0[2] * (splitYBy - row) + c2[2] * row) / splitYBy | 0;
67398      cr[0] = (c1[0] * (splitYBy - row) + c3[0] * row) / splitYBy | 0;
67399      cr[1] = (c1[1] * (splitYBy - row) + c3[1] * row) / splitYBy | 0;
67400      cr[2] = (c1[2] * (splitYBy - row) + c3[2] * row) / splitYBy | 0;
67401      for (let col = 0; col <= splitXBy; col++, k++) {
67402        if ((row === 0 || row === splitYBy) && (col === 0 || col === splitXBy)) {
67403          continue;
67404        }
67405        let x = 0,
67406          y = 0;
67407        let q = 0;
67408        for (let i = 0; i <= 3; i++) {
67409          for (let j = 0; j <= 3; j++, q++) {
67410            const m = bRow[row][i] * bCol[col][j];
67411            x += coords[pi[q]][0] * m;
67412            y += coords[pi[q]][1] * m;
67413          }
67414        }
67415        figureCoords[k] = coords.length;
67416        coords.push([x, y]);
67417        figureColors[k] = colors.length;
67418        const newColor = new Uint8Array(3);
67419        newColor[0] = (cl[0] * (splitXBy - col) + cr[0] * col) / splitXBy | 0;
67420        newColor[1] = (cl[1] * (splitXBy - col) + cr[1] * col) / splitXBy | 0;
67421        newColor[2] = (cl[2] * (splitXBy - col) + cr[2] * col) / splitXBy | 0;
67422        colors.push(newColor);
67423      }
67424    }
67425    figureCoords[0] = pi[0];
67426    figureColors[0] = ci[0];
67427    figureCoords[splitXBy] = pi[3];
67428    figureColors[splitXBy] = ci[1];
67429    figureCoords[verticesPerRow * splitYBy] = pi[12];
67430    figureColors[verticesPerRow * splitYBy] = ci[2];
67431    figureCoords[verticesPerRow * splitYBy + splitXBy] = pi[15];
67432    figureColors[verticesPerRow * splitYBy + splitXBy] = ci[3];
67433    this.figures[index] = {
67434      type: "lattice",
67435      coords: figureCoords,
67436      colors: figureColors,
67437      verticesPerRow
67438    };
67439  }
67440  _updateBounds() {
67441    let minX = this.coords[0][0],
67442      minY = this.coords[0][1],
67443      maxX = minX,
67444      maxY = minY;
67445    for (let i = 1, ii = this.coords.length; i < ii; i++) {
67446      const x = this.coords[i][0],
67447        y = this.coords[i][1];
67448      minX = minX > x ? x : minX;
67449      minY = minY > y ? y : minY;
67450      maxX = maxX < x ? x : maxX;
67451      maxY = maxY < y ? y : maxY;
67452    }
67453    this.bounds = [minX, minY, maxX, maxY];
67454  }
67455  _packData() {
67456    let i, ii, j, jj;
67457    const coords = this.coords;
67458    const coordsPacked = new Float32Array(coords.length * 2);
67459    for (i = 0, j = 0, ii = coords.length; i < ii; i++) {
67460      const xy = coords[i];
67461      coordsPacked[j++] = xy[0];
67462      coordsPacked[j++] = xy[1];
67463    }
67464    this.coords = coordsPacked;
67465    const colors = this.colors;
67466    const colorsPacked = new Uint8Array(colors.length * 3);
67467    for (i = 0, j = 0, ii = colors.length; i < ii; i++) {
67468      const c = colors[i];
67469      colorsPacked[j++] = c[0];
67470      colorsPacked[j++] = c[1];
67471      colorsPacked[j++] = c[2];
67472    }
67473    this.colors = colorsPacked;
67474    const figures = this.figures;
67475    for (i = 0, ii = figures.length; i < ii; i++) {
67476      const figure = figures[i],
67477        ps = figure.coords,
67478        cs = figure.colors;
67479      for (j = 0, jj = ps.length; j < jj; j++) {
67480        ps[j] *= 2;
67481        cs[j] *= 3;
67482      }
67483    }
67484  }
67485  getIR() {
67486    return ["Mesh", this.shadingType, this.coords, this.colors, this.figures, this.bounds, this.bbox, this.background];
67487  }
67488}
67489class DummyShading extends BaseShading {
67490  getIR() {
67491    return ["Dummy"];
67492  }
67493}
67494function getTilingPatternIR(operatorList, dict, color) {
67495  const matrix = dict.getArray("Matrix");
67496  const bbox = _util.Util.normalizeRect(dict.getArray("BBox"));
67497  const xstep = dict.get("XStep");
67498  const ystep = dict.get("YStep");
67499  const paintType = dict.get("PaintType");
67500  const tilingType = dict.get("TilingType");
67501  if (bbox[2] - bbox[0] === 0 || bbox[3] - bbox[1] === 0) {
67502    throw new _util.FormatError(`Invalid getTilingPatternIR /BBox array: [${bbox}].`);
67503  }
67504  return ["TilingPattern", color, operatorList, matrix, bbox, xstep, ystep, paintType, tilingType];
67505}
67506
67507/***/ }),
67508/* 
6750851 */
67509/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
67510
67511
67512
67513Object.defineProperty(exports, "__esModule", ({
67514  value: true
67515}));
67516exports.getXfaFontDict = getXfaFontDict;
67517exports.getXfaFontName = getXfaFontName;
67518var _calibri_factors = __w_pdfjs_require__(52);
67519var _primitives = __w_pdfjs_require__(4);
67520var _helvetica_factors = __w_pdfjs_require__(53);
67521var _liberationsans_widths = __w_pdfjs_require__(54);
67522var _myriadpro_factors = __w_pdfjs_require__(55);
67523var _segoeui_factors = __w_pdfjs_require__(56);
67524var _core_utils = __w_pdfjs_require__(3);
67525var _fonts_utils = __w_pdfjs_require__(38
vendor: 6,525 bytes, lines 67525-67675
67525);
67526const getXFAFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
67527  t["MyriadPro-Regular"] = t["PdfJS-Fallback-Regular"] = {
67528    name: "LiberationSans-Regular",
67529    factors: _myriadpro_factors.MyriadProRegularFactors,
67530    baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
67531    baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
67532    metrics: _myriadpro_factors.MyriadProRegularMetrics
67533  };
67534  t["MyriadPro-Bold"] = t["PdfJS-Fallback-Bold"] = {
67535    name: "LiberationSans-Bold",
67536    factors: _myriadpro_factors.MyriadProBoldFactors,
67537    baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
67538    baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
67539    metrics: _myriadpro_factors.MyriadProBoldMetrics
67540  };
67541  t["MyriadPro-It"] = t["MyriadPro-Italic"] = t["PdfJS-Fallback-Italic"] = {
67542    name: "LiberationSans-Italic",
67543    factors: _myriadpro_factors.MyriadProItalicFactors,
67544    baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
67545    baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
67546    metrics: _myriadpro_factors.MyriadProItalicMetrics
67547  };
67548  t["MyriadPro-BoldIt"] = t["MyriadPro-BoldItalic"] = t["PdfJS-Fallback-BoldItalic"] = {
67549    name: "LiberationSans-BoldItalic",
67550    factors: _myriadpro_factors.MyriadProBoldItalicFactors,
67551    baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
67552    baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
67553    metrics: _myriadpro_factors.MyriadProBoldItalicMetrics
67554  };
67555  t.ArialMT = t.Arial = t["Arial-Regular"] = {
67556    name: "LiberationSans-Regular",
67557    baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
67558    baseMapping: _liberationsans_widths.LiberationSansRegularMapping
67559  };
67560  t["Arial-BoldMT"] = t["Arial-Bold"] = {
67561    name: "LiberationSans-Bold",
67562    baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
67563    baseMapping: _liberationsans_widths.LiberationSansBoldMapping
67564  };
67565  t["Arial-ItalicMT"] = t["Arial-Italic"] = {
67566    name: "LiberationSans-Italic",
67567    baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
67568    baseMapping: _liberationsans_widths.LiberationSansItalicMapping
67569  };
67570  t["Arial-BoldItalicMT"] = t["Arial-BoldItalic"] = {
67571    name: "LiberationSans-BoldItalic",
67572    baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
67573    baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping
67574  };
67575  t["Calibri-Regular"] = {
67576    name: "LiberationSans-Regular",
67577    factors: _calibri_factors.CalibriRegularFactors,
67578    baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
67579    baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
67580    metrics: _calibri_factors.CalibriRegularMetrics
67581  };
67582  t["Calibri-Bold"] = {
67583    name: "LiberationSans-Bold",
67584    factors: _calibri_factors.CalibriBoldFactors,
67585    baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
67586    baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
67587    metrics: _calibri_factors.CalibriBoldMetrics
67588  };
67589  t["Calibri-Italic"] = {
67590    name: "LiberationSans-Italic",
67591    factors: _calibri_factors.CalibriItalicFactors,
67592    baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
67593    baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
67594    metrics: _calibri_factors.CalibriItalicMetrics
67595  };
67596  t["Calibri-BoldItalic"] = {
67597    name: "LiberationSans-BoldItalic",
67598    factors: _calibri_factors.CalibriBoldItalicFactors,
67599    baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
67600    baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
67601    metrics: _calibri_factors.CalibriBoldItalicMetrics
67602  };
67603  t["Segoeui-Regular"] = {
67604    name: "LiberationSans-Regular",
67605    factors: _segoeui_factors.SegoeuiRegularFactors,
67606    baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
67607    baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
67608    metrics: _segoeui_factors.SegoeuiRegularMetrics
67609  };
67610  t["Segoeui-Bold"] = {
67611    name: "LiberationSans-Bold",
67612    factors: _segoeui_factors.SegoeuiBoldFactors,
67613    baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
67614    baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
67615    metrics: _segoeui_factors.SegoeuiBoldMetrics
67616  };
67617  t["Segoeui-Italic"] = {
67618    name: "LiberationSans-Italic",
67619    factors: _segoeui_factors.SegoeuiItalicFactors,
67620    baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
67621    baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
67622    metrics: _segoeui_factors.SegoeuiItalicMetrics
67623  };
67624  t["Segoeui-BoldItalic"] = {
67625    name: "LiberationSans-BoldItalic",
67626    factors: _segoeui_factors.SegoeuiBoldItalicFactors,
67627    baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
67628    baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
67629    metrics: _segoeui_factors.SegoeuiBoldItalicMetrics
67630  };
67631  t["Helvetica-Regular"] = t.Helvetica = {
67632    name: "LiberationSans-Regular",
67633    factors: _helvetica_factors.HelveticaRegularFactors,
67634    baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
67635    baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
67636    metrics: _helvetica_factors.HelveticaRegularMetrics
67637  };
67638  t["Helvetica-Bold"] = {
67639    name: "LiberationSans-Bold",
67640    factors: _helvetica_factors.HelveticaBoldFactors,
67641    baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
67642    baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
67643    metrics: _helvetica_factors.HelveticaBoldMetrics
67644  };
67645  t["Helvetica-Italic"] = {
67646    name: "LiberationSans-Italic",
67647    factors: _helvetica_factors.HelveticaItalicFactors,
67648    baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
67649    baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
67650    metrics: _helvetica_factors.HelveticaItalicMetrics
67651  };
67652  t["Helvetica-BoldItalic"] = {
67653    name: "LiberationSans-BoldItalic",
67654    factors: _helvetica_factors.HelveticaBoldItalicFactors,
67655    baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
67656    baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
67657    metrics: _helvetica_factors.HelveticaBoldItalicMetrics
67658  };
67659});
67660function getXfaFontName(name) {
67661  const fontName = (0, _fonts_utils.normalizeFontName)(name);
67662  const fontMap = getXFAFontMap();
67663  return fontMap[fontName];
67664}
67665function getXfaFontWidths(name) {
67666  const info = getXfaFontName(name);
67667  if (!info) {
67668    return null;
67669  }
67670  const {
67671    baseWidths,
67672    baseMapping,
67673    factors
67674  } = info;
67675  
vendor: 1,899 bytes, lines 67675-67724
67675const rescaledBaseWidths = !factors ? baseWidths : baseWidths.map((w, i) => w * factors[i]);
67676  let currentCode = -2;
67677  let currentArray;
67678  const newWidths = [];
67679  for (const [unicode, glyphIndex] of baseMapping.map((charUnicode, index) => [charUnicode, index]).sort(([unicode1], [unicode2]) => unicode1 - unicode2)) {
67680    if (unicode === -1) {
67681      continue;
67682    }
67683    if (unicode === currentCode + 1) {
67684      currentArray.push(rescaledBaseWidths[glyphIndex]);
67685      currentCode += 1;
67686    } else {
67687      currentCode = unicode;
67688      currentArray = [rescaledBaseWidths[glyphIndex]];
67689      newWidths.push(unicode, currentArray);
67690    }
67691  }
67692  return newWidths;
67693}
67694function getXfaFontDict(name) {
67695  const widths = getXfaFontWidths(name);
67696  const dict = new _primitives.Dict(null);
67697  dict.set("BaseFont", _primitives.Name.get(name));
67698  dict.set("Type", _primitives.Name.get("Font"));
67699  dict.set("Subtype", _primitives.Name.get("CIDFontType2"));
67700  dict.set("Encoding", _primitives.Name.get("Identity-H"));
67701  dict.set("CIDToGIDMap", _primitives.Name.get("Identity"));
67702  dict.set("W", widths);
67703  dict.set("FirstChar", widths[0]);
67704  dict.set("LastChar", widths.at(-2) + widths.at(-1).length - 1);
67705  const descriptor = new _primitives.Dict(null);
67706  dict.set("FontDescriptor", descriptor);
67707  const systemInfo = new _primitives.Dict(null);
67708  systemInfo.set("Ordering", "Identity");
67709  systemInfo.set("Registry", "Adobe");
67710  systemInfo.set("Supplement", 0);
67711  dict.set("CIDSystemInfo", systemInfo);
67712  return dict;
67713}
67714
67715/***/ }),
67716/* 52 */
67717/***/ ((__unused_webpack_module, exports) => {
67718
67719
67720
67721Object.defineProperty(exports, "__esModule", ({
67722  value: true
67723}));
67724exports.CalibriRegularMetrics = exports.CalibriRegularFactors = exports.CalibriItalicMetrics = exports.CalibriItalicFactors = exports.CalibriBoldMetrics = exports.CalibriBoldItalicMetrics = exports.CalibriBoldItalicFactors = exports.CalibriBoldFactors = void 0;
vendor: 3,187 bytes, lines 67724-67725
67724
67725const 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, 0.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: 7,325 bytes, lines 67725-67739
677250.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];
67726exports.CalibriBoldFactors = CalibriBoldFactors;
67727const CalibriBoldMetrics = {
67728  lineHeight: 1.2207,
67729  lineGap: 0.2207
67730};
67731exports.CalibriBoldMetrics = CalibriBoldMetrics;
67732const 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, 0.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.77312, 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];
67733exports.CalibriBoldItalicFactors = CalibriBoldItalicFactors;
67734const CalibriBoldItalicMetrics = {
67735  lineHeight: 1.2207,
67736  lineGap: 0.2207
67737};
67738exports.CalibriBoldItalicMetrics = CalibriBoldItalicMetrics;
67739const 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 67739
677390.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,327 bytes, lines 67739-67746
6773976, 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];
67740exports.CalibriItalicFactors = CalibriItalicFactors;
67741const CalibriItalicMetrics = {
67742  lineHeight: 1.2207,
67743  lineGap: 0.2207
67744};
67745exports.CalibriItalicMetrics = CalibriItalicMetrics;
67746const 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: 4,437 bytes, line 67746
677460.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.0176, 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];
67747exports.CalibriRegularFactors = CalibriRegularFactors;
67748const CalibriRegularMetrics = {
67749  lineHeight: 1.2207,
67750  lineGap: 0.2207
67751};
67752exports.CalibriRegularMetrics = CalibriRegularMetrics;
67753
67754/***/ }),
67755/* 53
vendor: 23,599 bytes, lines 67755-67794
67755 */
67756/***/ ((__unused_webpack_module, exports) => {
67757
67758
67759
67760Object.defineProperty(exports, "__esModule", ({
67761  value: true
67762}));
67763exports.HelveticaRegularMetrics = exports.HelveticaRegularFactors = exports.HelveticaItalicMetrics = exports.HelveticaItalicFactors = exports.HelveticaBoldMetrics = exports.HelveticaBoldItalicMetrics = exports.HelveticaBoldItalicFactors = exports.HelveticaBoldFactors = void 0;
67764const 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];
67765exports.HelveticaBoldFactors = HelveticaBoldFactors;
67766const HelveticaBoldMetrics = {
67767  lineHeight: 1.2,
67768  lineGap: 0.2
67769};
67770exports.HelveticaBoldMetrics = HelveticaBoldMetrics;
67771const 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];
67772exports.HelveticaBoldItalicFactors = HelveticaBoldItalicFactors;
67773const HelveticaBoldItalicMetrics = {
67774  lineHeight: 1.35,
67775  lineGap: 0.2
67776};
67777exports.HelveticaBoldItalicMetrics = HelveticaBoldItalicMetrics;
67778const 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];
67779exports.HelveticaItalicFactors = HelveticaItalicFactors;
67780const HelveticaItalicMetrics = {
67781  lineHeight: 1.35,
67782  lineGap: 0.2
67783};
67784exports.HelveticaItalicMetrics = HelveticaItalicMetrics;
67785const 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];
67786exports.HelveticaRegularFactors = HelveticaRegularFactors;
67787const HelveticaRegularMetrics = {
67788  lineHeight: 1.2,
67789  lineGap: 0.2
67790};
67791exports.HelveticaRegularMetrics = HelveticaRegularMetrics;
67792
67793/***/ }),
67794/* 5
677944
vendor: 29,274 bytes, lines 67794-67821
67794 */
67795/***/ ((__unused_webpack_module, exports) => {
67796
67797
67798
67799Object.defineProperty(exports, "__esModule", ({
67800  value: true
67801}));
67802exports.LiberationSansRegularWidths = exports.LiberationSansRegularMapping = exports.LiberationSansItalicWidths = exports.LiberationSansItalicMapping = exports.LiberationSansBoldWidths = exports.LiberationSansBoldMapping = exports.LiberationSansBoldItalicWidths = exports.LiberationSansBoldItalicMapping = void 0;
67803const 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];
67804exports.LiberationSansBoldWidths = LiberationSansBoldWidths;
67805const 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];
67806exports.LiberationSansBoldMapping = LiberationSansBoldMapping;
67807const 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];
67808exports.LiberationSansBoldItalicWidths = LiberationSansBoldItalicWidths;
67809const 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];
67810exports.LiberationSansBoldItalicMapping = LiberationSansBoldItalicMapping;
67811const 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];
67812exports.LiberationSansItalicWidths = LiberationSansItalicWidths;
67813const 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];
67814exports.LiberationSansItalicMapping = LiberationSansItalicMapping;
67815const 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];
67816exports.LiberationSansRegularWidths = LiberationSansRegularWidths;
67817const 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];
67818exports.LiberationSansRegularMapping = LiberationSansRegularMapping;
67819
67820/***/ }),
67821/* 5
678215
vendor: 5,531 bytes, lines 67821-67837
67821 */
67822/***/ ((__unused_webpack_module, exports) => {
67823
67824
67825
67826Object.defineProperty(exports, "__esModule", ({
67827  value: true
67828}));
67829exports.MyriadProRegularMetrics = exports.MyriadProRegularFactors = exports.MyriadProItalicMetrics = exports.MyriadProItalicFactors = exports.MyriadProBoldMetrics = exports.MyriadProBoldItalicMetrics = exports.MyriadProBoldItalicFactors = exports.MyriadProBoldFactors = void 0;
67830const 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];
67831exports.MyriadProBoldFactors = MyriadProBoldFactors;
67832const MyriadProBoldMetrics = {
67833  lineHeight: 1.2,
67834  lineGap: 0.2
67835};
67836exports.MyriadProBoldMetrics = MyriadProBoldMetrics;
67837const 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 67837
678371, 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: 12,325 bytes, lines 67837-67860
6783777, 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];
67838exports.MyriadProBoldItalicFactors = MyriadProBoldItalicFactors;
67839const MyriadProBoldItalicMetrics = {
67840  lineHeight: 1.2,
67841  lineGap: 0.2
67842};
67843exports.MyriadProBoldItalicMetrics = MyriadProBoldItalicMetrics;
67844const 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];
67845exports.MyriadProItalicFactors = MyriadProItalicFactors;
67846const MyriadProItalicMetrics = {
67847  lineHeight: 1.2,
67848  lineGap: 0.2
67849};
67850exports.MyriadProItalicMetrics = MyriadProItalicMetrics;
67851const 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];
67852exports.MyriadProRegularFactors = MyriadProRegularFactors;
67853const MyriadProRegularMetrics = {
67854  lineHeight: 1.2,
67855  lineGap: 0.2
67856};
67857exports.MyriadProRegularMetrics = MyriadProRegularMetrics;
67858
67859/***/ }),
67860/* 5
678606
vendor: 20,492 bytes, lines 67860-67899
67860 */
67861/***/ ((__unused_webpack_module, exports) => {
67862
67863
67864
67865Object.defineProperty(exports, "__esModule", ({
67866  value: true
67867}));
67868exports.SegoeuiRegularMetrics = exports.SegoeuiRegularFactors = exports.SegoeuiItalicMetrics = exports.SegoeuiItalicFactors = exports.SegoeuiBoldMetrics = exports.SegoeuiBoldItalicMetrics = exports.SegoeuiBoldItalicFactors = exports.SegoeuiBoldFactors = void 0;
67869const 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];
67870exports.SegoeuiBoldFactors = SegoeuiBoldFactors;
67871const SegoeuiBoldMetrics = {
67872  lineHeight: 1.33008,
67873  lineGap: 0
67874};
67875exports.SegoeuiBoldMetrics = SegoeuiBoldMetrics;
67876const 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];
67877exports.SegoeuiBoldItalicFactors = SegoeuiBoldItalicFactors;
67878const SegoeuiBoldItalicMetrics = {
67879  lineHeight: 1.33008,
67880  lineGap: 0
67881};
67882exports.SegoeuiBoldItalicMetrics = SegoeuiBoldItalicMetrics;
67883const 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];
67884exports.SegoeuiItalicFactors = SegoeuiItalicFactors;
67885const SegoeuiItalicMetrics = {
67886  lineHeight: 1.33008,
67887  lineGap: 0
67888};
67889exports.SegoeuiItalicMetrics = SegoeuiItalicMetrics;
67890const 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];
67891exports.SegoeuiRegularFactors = SegoeuiRegularFactors;
67892const SegoeuiRegularMetrics = {
67893  lineHeight: 1.33008,
67894  lineGap: 0
67895};
67896exports.SegoeuiRegularMetrics = SegoeuiRegularMetrics;
67897
67898/***/ }),
67899/* 5
vendor: 12,645 bytes, lines 67899-68333
678997 */
67900/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
67901
67902
67903
67904Object.defineProperty(exports, "__esModule", ({
67905  value: true
67906}));
67907exports.PostScriptEvaluator = exports.PostScriptCompiler = exports.PDFFunctionFactory = void 0;
67908exports.isPDFFunction = isPDFFunction;
67909var _primitives = __w_pdfjs_require__(4);
67910var _util = __w_pdfjs_require__(2);
67911var _ps_parser = __w_pdfjs_require__(58);
67912var _base_stream = __w_pdfjs_require__(5);
67913var _image_utils = __w_pdfjs_require__(59);
67914class PDFFunctionFactory {
67915  constructor({
67916    xref,
67917    isEvalSupported = true
67918  }) {
67919    this.xref = xref;
67920    this.isEvalSupported = isEvalSupported !== false;
67921  }
67922  create(fn) {
67923    const cachedFunction = this.getCached(fn);
67924    if (cachedFunction) {
67925      return cachedFunction;
67926    }
67927    const parsedFunction = PDFFunction.parse({
67928      xref: this.xref,
67929      isEvalSupported: this.isEvalSupported,
67930      fn: fn instanceof _primitives.Ref ? this.xref.fetch(fn) : fn
67931    });
67932    this._cache(fn, parsedFunction);
67933    return parsedFunction;
67934  }
67935  createFromArray(fnObj) {
67936    const cachedFunction = this.getCached(fnObj);
67937    if (cachedFunction) {
67938      return cachedFunction;
67939    }
67940    const parsedFunction = PDFFunction.parseArray({
67941      xref: this.xref,
67942      isEvalSupported: this.isEvalSupported,
67943      fnObj: fnObj instanceof _primitives.Ref ? this.xref.fetch(fnObj) : fnObj
67944    });
67945    this._cache(fnObj, parsedFunction);
67946    return parsedFunction;
67947  }
67948  getCached(cacheKey) {
67949    let fnRef;
67950    if (cacheKey instanceof _primitives.Ref) {
67951      fnRef = cacheKey;
67952    } else if (cacheKey instanceof _primitives.Dict) {
67953      fnRef = cacheKey.objId;
67954    } else if (cacheKey instanceof _base_stream.BaseStream) {
67955      fnRef = cacheKey.dict?.objId;
67956    }
67957    if (fnRef) {
67958      const localFunction = this._localFunctionCache.getByRef(fnRef);
67959      if (localFunction) {
67960        return localFunction;
67961      }
67962    }
67963    return null;
67964  }
67965  _cache(cacheKey, parsedFunction) {
67966    if (!parsedFunction) {
67967      throw new Error('PDFFunctionFactory._cache - expected "parsedFunction" argument.');
67968    }
67969    let fnRef;
67970    if (cacheKey instanceof _primitives.Ref) {
67971      fnRef = cacheKey;
67972    } else if (cacheKey instanceof _primitives.Dict) {
67973      fnRef = cacheKey.objId;
67974    } else if (cacheKey instanceof _base_stream.BaseStream) {
67975      fnRef = cacheKey.dict?.objId;
67976    }
67977    if (fnRef) {
67978      this._localFunctionCache.set(null, fnRef, parsedFunction);
67979    }
67980  }
67981  get _localFunctionCache() {
67982    return (0, _util.shadow)(this, "_localFunctionCache", new _image_utils.LocalFunctionCache());
67983  }
67984}
67985exports.PDFFunctionFactory = PDFFunctionFactory;
67986function toNumberArray(arr) {
67987  if (!Array.isArray(arr)) {
67988    return null;
67989  }
67990  const length = arr.length;
67991  for (let i = 0; i < length; i++) {
67992    if (typeof arr[i] !== "number") {
67993      const result = new Array(length);
67994      for (let j = 0; j < length; j++) {
67995        result[j] = +arr[j];
67996      }
67997      return result;
67998    }
67999  }
68000  return arr;
68001}
68002class PDFFunction {
68003  static getSampleArray(size, outputSize, bps, stream) {
68004    let i, ii;
68005    let length = 1;
68006    for (i = 0, ii = size.length; i < ii; i++) {
68007      length *= size[i];
68008    }
68009    length *= outputSize;
68010    const array = new Array(length);
68011    let codeSize = 0;
68012    let codeBuf = 0;
68013    const sampleMul = 1.0 / (2.0 ** bps - 1);
68014    const strBytes = stream.getBytes((length * bps + 7) / 8);
68015    let strIdx = 0;
68016    for (i = 0; i < length; i++) {
68017      while (codeSize < bps) {
68018        codeBuf <<= 8;
68019        codeBuf |= strBytes[strIdx++];
68020        codeSize += 8;
68021      }
68022      codeSize -= bps;
68023      array[i] = (codeBuf >> codeSize) * sampleMul;
68024      codeBuf &= (1 << codeSize) - 1;
68025    }
68026    return array;
68027  }
68028  static parse({
68029    xref,
68030    isEvalSupported,
68031    fn
68032  }) {
68033    const dict = fn.dict || fn;
68034    const typeNum = dict.get("FunctionType");
68035    switch (typeNum) {
68036      case 0:
68037        return this.constructSampled({
68038          xref,
68039          isEvalSupported,
68040          fn,
68041          dict
68042        });
68043      case 1:
68044        break;
68045      case 2:
68046        return this.constructInterpolated({
68047          xref,
68048          isEvalSupported,
68049          dict
68050        });
68051      case 3:
68052        return this.constructStiched({
68053          xref,
68054          isEvalSupported,
68055          dict
68056        });
68057      case 4:
68058        return this.constructPostScript({
68059          xref,
68060          isEvalSupported,
68061          fn,
68062          dict
68063        });
68064    }
68065    throw new _util.FormatError("Unknown type of function");
68066  }
68067  static parseArray({
68068    xref,
68069    isEvalSupported,
68070    fnObj
68071  }) {
68072    if (!Array.isArray(fnObj)) {
68073      return this.parse({
68074        xref,
68075        isEvalSupported,
68076        fn: fnObj
68077      });
68078    }
68079    const fnArray = [];
68080    for (const fn of fnObj) {
68081      fnArray.push(this.parse({
68082        xref,
68083        isEvalSupported,
68084        fn: xref.fetchIfRef(fn)
68085      }));
68086    }
68087    return function (src, srcOffset, dest, destOffset) {
68088      for (let i = 0, ii = fnArray.length; i < ii; i++) {
68089        fnArray[i](src, srcOffset, dest, destOffset + i);
68090      }
68091    };
68092  }
68093  static constructSampled({
68094    xref,
68095    isEvalSupported,
68096    fn,
68097    dict
68098  }) {
68099    function toMultiArray(arr) {
68100      const inputLength = arr.length;
68101      const out = [];
68102      let index = 0;
68103      for (let i = 0; i < inputLength; i += 2) {
68104        out[index++] = [arr[i], arr[i + 1]];
68105      }
68106      return out;
68107    }
68108    function interpolate(x, xmin, xmax, ymin, ymax) {
68109      return ymin + (x - xmin) * ((ymax - ymin) / (xmax - xmin));
68110    }
68111    let domain = toNumberArray(dict.getArray("Domain"));
68112    let range = toNumberArray(dict.getArray("Range"));
68113    if (!domain || !range) {
68114      throw new _util.FormatError("No domain or range");
68115    }
68116    const inputSize = domain.length / 2;
68117    const outputSize = range.length / 2;
68118    domain = toMultiArray(domain);
68119    range = toMultiArray(range);
68120    const size = toNumberArray(dict.getArray("Size"));
68121    const bps = dict.get("BitsPerSample");
68122    const order = dict.get("Order") || 1;
68123    if (order !== 1) {
68124      (0, _util.info)("No support for cubic spline interpolation: " + order);
68125    }
68126    let encode = toNumberArray(dict.getArray("Encode"));
68127    if (!encode) {
68128      encode = [];
68129      for (let i = 0; i < inputSize; ++i) {
68130        encode.push([0, size[i] - 1]);
68131      }
68132    } else {
68133      encode = toMultiArray(encode);
68134    }
68135    let decode = toNumberArray(dict.getArray("Decode"));
68136    decode = !decode ? range : toMultiArray(decode);
68137    const samples = this.getSampleArray(size, outputSize, bps, fn);
68138    return function constructSampledFn(src, srcOffset, dest, destOffset) {
68139      const cubeVertices = 1 << inputSize;
68140      const cubeN = new Float64Array(cubeVertices);
68141      const cubeVertex = new Uint32Array(cubeVertices);
68142      let i, j;
68143      for (j = 0; j < cubeVertices; j++) {
68144        cubeN[j] = 1;
68145      }
68146      let k = outputSize,
68147        pos = 1;
68148      for (i = 0; i < inputSize; ++i) {
68149        const domain_2i = domain[i][0];
68150        const domain_2i_1 = domain[i][1];
68151        const xi = Math.min(Math.max(src[srcOffset + i], domain_2i), domain_2i_1);
68152        let e = interpolate(xi, domain_2i, domain_2i_1, encode[i][0], encode[i][1]);
68153        const size_i = size[i];
68154        e = Math.min(Math.max(e, 0), size_i - 1);
68155        const e0 = e < size_i - 1 ? Math.floor(e) : e - 1;
68156        const n0 = e0 + 1 - e;
68157        const n1 = e - e0;
68158        const offset0 = e0 * k;
68159        const offset1 = offset0 + k;
68160        for (j = 0; j < cubeVertices; j++) {
68161          if (j & pos) {
68162            cubeN[j] *= n1;
68163            cubeVertex[j] += offset1;
68164          } else {
68165            cubeN[j] *= n0;
68166            cubeVertex[j] += offset0;
68167          }
68168        }
68169        k *= size_i;
68170        pos <<= 1;
68171      }
68172      for (j = 0; j < outputSize; ++j) {
68173        let rj = 0;
68174        for (i = 0; i < cubeVertices; i++) {
68175          rj += samples[cubeVertex[i] + j] * cubeN[i];
68176        }
68177        rj = interpolate(rj, 0, 1, decode[j][0], decode[j][1]);
68178        dest[destOffset + j] = Math.min(Math.max(rj, range[j][0]), range[j][1]);
68179      }
68180    };
68181  }
68182  static constructInterpolated({
68183    xref,
68184    isEvalSupported,
68185    dict
68186  }) {
68187    const c0 = toNumberArray(dict.getArray("C0")) || [0];
68188    const c1 = toNumberArray(dict.getArray("C1")) || [1];
68189    const n = dict.get("N");
68190    const diff = [];
68191    for (let i = 0, ii = c0.length; i < ii; ++i) {
68192      diff.push(c1[i] - c0[i]);
68193    }
68194    const length = diff.length;
68195    return function constructInterpolatedFn(src, srcOffset, dest, destOffset) {
68196      const x = n === 1 ? src[srcOffset] : src[srcOffset] ** n;
68197      for (let j = 0; j < length; ++j) {
68198        dest[destOffset + j] = c0[j] + x * diff[j];
68199      }
68200    };
68201  }
68202  static constructStiched({
68203    xref,
68204    isEvalSupported,
68205    dict
68206  }) {
68207    const domain = toNumberArray(dict.getArray("Domain"));
68208    if (!domain) {
68209      throw new _util.FormatError("No domain");
68210    }
68211    const inputSize = domain.length / 2;
68212    if (inputSize !== 1) {
68213      throw new _util.FormatError("Bad domain for stiched function");
68214    }
68215    const fns = [];
68216    for (const fn of dict.get("Functions")) {
68217      fns.push(this.parse({
68218        xref,
68219        isEvalSupported,
68220        fn: xref.fetchIfRef(fn)
68221      }));
68222    }
68223    const bounds = toNumberArray(dict.getArray("Bounds"));
68224    const encode = toNumberArray(dict.getArray("Encode"));
68225    const tmpBuf = new Float32Array(1);
68226    return function constructStichedFn(src, srcOffset, dest, destOffset) {
68227      const clip = function constructStichedFromIRClip(v, min, max) {
68228        if (v > max) {
68229          v = max;
68230        } else if (v < min) {
68231          v = min;
68232        }
68233        return v;
68234      };
68235      const v = clip(src[srcOffset], domain[0], domain[1]);
68236      const length = bounds.length;
68237      let i;
68238      for (i = 0; i < length; ++i) {
68239        if (v < bounds[i]) {
68240          break;
68241        }
68242      }
68243      let dmin = domain[0];
68244      if (i > 0) {
68245        dmin = bounds[i - 1];
68246      }
68247      let dmax = domain[1];
68248      if (i < bounds.length) {
68249        dmax = bounds[i];
68250      }
68251      const rmin = encode[2 * i];
68252      const rmax = encode[2 * i + 1];
68253      tmpBuf[0] = dmin === dmax ? rmin : rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin);
68254      fns[i](tmpBuf, 0, dest, destOffset);
68255    };
68256  }
68257  static constructPostScript({
68258    xref,
68259    isEvalSupported,
68260    fn,
68261    dict
68262  }) {
68263    const domain = toNumberArray(dict.getArray("Domain"));
68264    const range = toNumberArray(dict.getArray("Range"));
68265    if (!domain) {
68266      throw new _util.FormatError("No domain.");
68267    }
68268    if (!range) {
68269      throw new _util.FormatError("No range.");
68270    }
68271    const lexer = new _ps_parser.PostScriptLexer(fn);
68272    const parser = new _ps_parser.PostScriptParser(lexer);
68273    const code = parser.parse();
68274    if (isEvalSupported && _util.FeatureTest.isEvalSupported) {
68275      const compiled = new PostScriptCompiler().compile(code, domain, range);
68276      if (compiled) {
68277        return new Function("src", "srcOffset", "dest", "destOffset", compiled);
68278      }
68279    }
68280    (0, _util.info)("Unable to compile PS function");
68281    const numOutputs = range.length >> 1;
68282    const numInputs = domain.length >> 1;
68283    const evaluator = new PostScriptEvaluator(code);
68284    const cache = Object.create(null);
68285    const MAX_CACHE_SIZE = 2048 * 4;
68286    let cache_available = MAX_CACHE_SIZE;
68287    const tmpBuf = new Float32Array(numInputs);
68288    return function constructPostScriptFn(src, srcOffset, dest, destOffset) {
68289      let i, value;
68290      let key = "";
68291      const input = tmpBuf;
68292      for (i = 0; i < numInputs; i++) {
68293        value = src[srcOffset + i];
68294        input[i] = value;
68295        key += value + "_";
68296      }
68297      const cachedValue = cache[key];
68298      if (cachedValue !== undefined) {
68299        dest.set(cachedValue, destOffset);
68300        return;
68301      }
68302      const output = new Float32Array(numOutputs);
68303      const stack = evaluator.execute(input);
68304      const stackIndex = stack.length - numOutputs;
68305      for (i = 0; i < numOutputs; i++) {
68306        value = stack[stackIndex + i];
68307        let bound = range[i * 2];
68308        if (value < bound) {
68309          value = bound;
68310        } else {
68311          bound = range[i * 2 + 1];
68312          if (value > bound) {
68313            value = bound;
68314          }
68315        }
68316        output[i] = value;
68317      }
68318      if (cache_available > 0) {
68319        cache_available--;
68320        cache[key] = output;
68321      }
68322      dest.set(output, destOffset);
68323    };
68324  }
68325}
68326function isPDFFunction(v) {
68327  let fnDict;
68328  if (v instanceof _primitives.Dict) {
68329    fnDict = v;
68330  } else if (v instanceof _base_stream.BaseStream) {
68331    fnDict = v.dict;
68332  } else {
68333    return false;
vendor: 7,308 bytes, lines 68334-68626
68334  }
68335  return fnDict.has("FunctionType");
68336}
68337class PostScriptStack {
68338  static MAX_STACK_SIZE = 100;
68339  constructor(initialStack) {
68340    this.stack = initialStack ? Array.from(initialStack) : [];
68341  }
68342  push(value) {
68343    if (this.stack.length >= PostScriptStack.MAX_STACK_SIZE) {
68344      throw new Error("PostScript function stack overflow.");
68345    }
68346    this.stack.push(value);
68347  }
68348  pop() {
68349    if (this.stack.length <= 0) {
68350      throw new Error("PostScript function stack underflow.");
68351    }
68352    return this.stack.pop();
68353  }
68354  copy(n) {
68355    if (this.stack.length + n >= PostScriptStack.MAX_STACK_SIZE) {
68356      throw new Error("PostScript function stack overflow.");
68357    }
68358    const stack = this.stack;
68359    for (let i = stack.length - n, j = n - 1; j >= 0; j--, i++) {
68360      stack.push(stack[i]);
68361    }
68362  }
68363  index(n) {
68364    this.push(this.stack[this.stack.length - n - 1]);
68365  }
68366  roll(n, p) {
68367    const stack = this.stack;
68368    const l = stack.length - n;
68369    const r = stack.length - 1;
68370    const c = l + (p - Math.floor(p / n) * n);
68371    for (let i = l, j = r; i < j; i++, j--) {
68372      const t = stack[i];
68373      stack[i] = stack[j];
68374      stack[j] = t;
68375    }
68376    for (let i = l, j = c - 1; i < j; i++, j--) {
68377      const t = stack[i];
68378      stack[i] = stack[j];
68379      stack[j] = t;
68380    }
68381    for (let i = c, j = r; i < j; i++, j--) {
68382      const t = stack[i];
68383      stack[i] = stack[j];
68384      stack[j] = t;
68385    }
68386  }
68387}
68388class PostScriptEvaluator {
68389  constructor(operators) {
68390    this.operators = operators;
68391  }
68392  execute(initialStack) {
68393    const stack = new PostScriptStack(initialStack);
68394    let counter = 0;
68395    const operators = this.operators;
68396    const length = operators.length;
68397    let operator, a, b;
68398    while (counter < length) {
68399      operator = operators[counter++];
68400      if (typeof operator === "number") {
68401        stack.push(operator);
68402        continue;
68403      }
68404      switch (operator) {
68405        case "jz":
68406          b = stack.pop();
68407          a = stack.pop();
68408          if (!a) {
68409            counter = b;
68410          }
68411          break;
68412        case "j":
68413          a = stack.pop();
68414          counter = a;
68415          break;
68416        case "abs":
68417          a = stack.pop();
68418          stack.push(Math.abs(a));
68419          break;
68420        case "add":
68421          b = stack.pop();
68422          a = stack.pop();
68423          stack.push(a + b);
68424          break;
68425        case "and":
68426          b = stack.pop();
68427          a = stack.pop();
68428          if (typeof a === "boolean" && typeof b === "boolean") {
68429            stack.push(a && b);
68430          } else {
68431            stack.push(a & b);
68432          }
68433          break;
68434        case "atan":
68435          b = stack.pop();
68436          a = stack.pop();
68437          a = Math.atan2(a, b) / Math.PI * 180;
68438          if (a < 0) {
68439            a += 360;
68440          }
68441          stack.push(a);
68442          break;
68443        case "bitshift":
68444          b = stack.pop();
68445          a = stack.pop();
68446          if (a > 0) {
68447            stack.push(a << b);
68448          } else {
68449            stack.push(a >> b);
68450          }
68451          break;
68452        case "ceiling":
68453          a = stack.pop();
68454          stack.push(Math.ceil(a));
68455          break;
68456        case "copy":
68457          a = stack.pop();
68458          stack.copy(a);
68459          break;
68460        case "cos":
68461          a = stack.pop();
68462          stack.push(Math.cos(a % 360 / 180 * Math.PI));
68463          break;
68464        case "cvi":
68465          a = stack.pop() | 0;
68466          stack.push(a);
68467          break;
68468        case "cvr":
68469          break;
68470        case "div":
68471          b = stack.pop();
68472          a = stack.pop();
68473          stack.push(a / b);
68474          break;
68475        case "dup":
68476          stack.copy(1);
68477          break;
68478        case "eq":
68479          b = stack.pop();
68480          a = stack.pop();
68481          stack.push(a === b);
68482          break;
68483        case "exch":
68484          stack.roll(2, 1);
68485          break;
68486        case "exp":
68487          b = stack.pop();
68488          a = stack.pop();
68489          stack.push(a ** b);
68490          break;
68491        case "false":
68492          stack.push(false);
68493          break;
68494        case "floor":
68495          a = stack.pop();
68496          stack.push(Math.floor(a));
68497          break;
68498        case "ge":
68499          b = stack.pop();
68500          a = stack.pop();
68501          stack.push(a >= b);
68502          break;
68503        case "gt":
68504          b = stack.pop();
68505          a = stack.pop();
68506          stack.push(a > b);
68507          break;
68508        case "idiv":
68509          b = stack.pop();
68510          a = stack.pop();
68511          stack.push(a / b | 0);
68512          break;
68513        case "index":
68514          a = stack.pop();
68515          stack.index(a);
68516          break;
68517        case "le":
68518          b = stack.pop();
68519          a = stack.pop();
68520          stack.push(a <= b);
68521          break;
68522        case "ln":
68523          a = stack.pop();
68524          stack.push(Math.log(a));
68525          break;
68526        case "log":
68527          a = stack.pop();
68528          stack.push(Math.log10(a));
68529          break;
68530        case "lt":
68531          b = stack.pop();
68532          a = stack.pop();
68533          stack.push(a < b);
68534          break;
68535        case "mod":
68536          b = stack.pop();
68537          a = stack.pop();
68538          stack.push(a % b);
68539          break;
68540        case "mul":
68541          b = stack.pop();
68542          a = stack.pop();
68543          stack.push(a * b);
68544          break;
68545        case "ne":
68546          b = stack.pop();
68547          a = stack.pop();
68548          stack.push(a !== b);
68549          break;
68550        case "neg":
68551          a = stack.pop();
68552          stack.push(-a);
68553          break;
68554        case "not":
68555          a = stack.pop();
68556          if (typeof a === "boolean") {
68557            stack.push(!a);
68558          } else {
68559            stack.push(~a);
68560          }
68561          break;
68562        case "or":
68563          b = stack.pop();
68564          a = stack.pop();
68565          if (typeof a === "boolean" && typeof b === "boolean") {
68566            stack.push(a || b);
68567          } else {
68568            stack.push(a | b);
68569          }
68570          break;
68571        case "pop":
68572          stack.pop();
68573          break;
68574        case "roll":
68575          b = stack.pop();
68576          a = stack.pop();
68577          stack.roll(a, b);
68578          break;
68579        case "round":
68580          a = stack.pop();
68581          stack.push(Math.round(a));
68582          break;
68583        case "sin":
68584          a = stack.pop();
68585          stack.push(Math.sin(a % 360 / 180 * Math.PI));
68586          break;
68587        case "sqrt":
68588          a = stack.pop();
68589          stack.push(Math.sqrt(a));
68590          break;
68591        case "sub":
68592          b = stack.pop();
68593          a = stack.pop();
68594          stack.push(a - b);
68595          break;
68596        case "true":
68597          stack.push(true);
68598          break;
68599        case "truncate":
68600          a = stack.pop();
68601          a = a < 0 ? Math.ceil(a) : Math.floor(a);
68602          stack.push(a);
68603          break;
68604        case "xor":
68605          b = stack.pop();
68606          a = stack.pop();
68607          if (typeof a === "boolean" && typeof b === "boolean") {
68608            stack.push(a !== b);
68609          } else {
68610            stack.push(a ^ b);
68611          }
68612          break;
68613        default:
68614          throw new _util.FormatError(`Unknown operator ${operator}`);
68615      }
68616    }
68617    return stack.stack;
68618  }
68619}
68620exports.PostScriptEvaluator = PostScriptEvaluator;
68621class AstNode {
68622  constructor(type) {
68623    this.type = type;
68624  }
68625  visit(visitor) {
68626    (0, _util.unreachable)
vendor: 8,967 bytes, lines 68626-68944
68626("abstract method");
68627  }
68628}
68629class AstArgument extends AstNode {
68630  constructor(index, min, max) {
68631    super("args");
68632    this.index = index;
68633    this.min = min;
68634    this.max = max;
68635  }
68636  visit(visitor) {
68637    visitor.visitArgument(this);
68638  }
68639}
68640class AstLiteral extends AstNode {
68641  constructor(number) {
68642    super("literal");
68643    this.number = number;
68644    this.min = number;
68645    this.max = number;
68646  }
68647  visit(visitor) {
68648    visitor.visitLiteral(this);
68649  }
68650}
68651class AstBinaryOperation extends AstNode {
68652  constructor(op, arg1, arg2, min, max) {
68653    super("binary");
68654    this.op = op;
68655    this.arg1 = arg1;
68656    this.arg2 = arg2;
68657    this.min = min;
68658    this.max = max;
68659  }
68660  visit(visitor) {
68661    visitor.visitBinaryOperation(this);
68662  }
68663}
68664class AstMin extends AstNode {
68665  constructor(arg, max) {
68666    super("max");
68667    this.arg = arg;
68668    this.min = arg.min;
68669    this.max = max;
68670  }
68671  visit(visitor) {
68672    visitor.visitMin(this);
68673  }
68674}
68675class AstVariable extends AstNode {
68676  constructor(index, min, max) {
68677    super("var");
68678    this.index = index;
68679    this.min = min;
68680    this.max = max;
68681  }
68682  visit(visitor) {
68683    visitor.visitVariable(this);
68684  }
68685}
68686class AstVariableDefinition extends AstNode {
68687  constructor(variable, arg) {
68688    super("definition");
68689    this.variable = variable;
68690    this.arg = arg;
68691  }
68692  visit(visitor) {
68693    visitor.visitVariableDefinition(this);
68694  }
68695}
68696class ExpressionBuilderVisitor {
68697  constructor() {
68698    this.parts = [];
68699  }
68700  visitArgument(arg) {
68701    this.parts.push("Math.max(", arg.min, ", Math.min(", arg.max, ", src[srcOffset + ", arg.index, "]))");
68702  }
68703  visitVariable(variable) {
68704    this.parts.push("v", variable.index);
68705  }
68706  visitLiteral(literal) {
68707    this.parts.push(literal.number);
68708  }
68709  visitBinaryOperation(operation) {
68710    this.parts.push("(");
68711    operation.arg1.visit(this);
68712    this.parts.push(" ", operation.op, " ");
68713    operation.arg2.visit(this);
68714    this.parts.push(")");
68715  }
68716  visitVariableDefinition(definition) {
68717    this.parts.push("var ");
68718    definition.variable.visit(this);
68719    this.parts.push(" = ");
68720    definition.arg.visit(this);
68721    this.parts.push(";");
68722  }
68723  visitMin(max) {
68724    this.parts.push("Math.min(");
68725    max.arg.visit(this);
68726    this.parts.push(", ", max.max, ")");
68727  }
68728  toString() {
68729    return this.parts.join("");
68730  }
68731}
68732function buildAddOperation(num1, num2) {
68733  if (num2.type === "literal" && num2.number === 0) {
68734    return num1;
68735  }
68736  if (num1.type === "literal" && num1.number === 0) {
68737    return num2;
68738  }
68739  if (num2.type === "literal" && num1.type === "literal") {
68740    return new AstLiteral(num1.number + num2.number);
68741  }
68742  return new AstBinaryOperation("+", num1, num2, num1.min + num2.min, num1.max + num2.max);
68743}
68744function buildMulOperation(num1, num2) {
68745  if (num2.type === "literal") {
68746    if (num2.number === 0) {
68747      return new AstLiteral(0);
68748    } else if (num2.number === 1) {
68749      return num1;
68750    } else if (num1.type === "literal") {
68751      return new AstLiteral(num1.number * num2.number);
68752    }
68753  }
68754  if (num1.type === "literal") {
68755    if (num1.number === 0) {
68756      return new AstLiteral(0);
68757    } else if (num1.number === 1) {
68758      return num2;
68759    }
68760  }
68761  const min = Math.min(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
68762  const max = Math.max(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
68763  return new AstBinaryOperation("*", num1, num2, min, max);
68764}
68765function buildSubOperation(num1, num2) {
68766  if (num2.type === "literal") {
68767    if (num2.number === 0) {
68768      return num1;
68769    } else if (num1.type === "literal") {
68770      return new AstLiteral(num1.number - num2.number);
68771    }
68772  }
68773  if (num2.type === "binary" && num2.op === "-" && num1.type === "literal" && num1.number === 1 && num2.arg1.type === "literal" && num2.arg1.number === 1) {
68774    return num2.arg2;
68775  }
68776  return new AstBinaryOperation("-", num1, num2, num1.min - num2.max, num1.max - num2.min);
68777}
68778function buildMinOperation(num1, max) {
68779  if (num1.min >= max) {
68780    return new AstLiteral(max);
68781  } else if (num1.max <= max) {
68782    return num1;
68783  }
68784  return new AstMin(num1, max);
68785}
68786class PostScriptCompiler {
68787  compile(code, domain, range) {
68788    const stack = [];
68789    const instructions = [];
68790    const inputSize = domain.length >> 1,
68791      outputSize = range.length >> 1;
68792    let lastRegister = 0;
68793    let n, j;
68794    let num1, num2, ast1, ast2, tmpVar, item;
68795    for (let i = 0; i < inputSize; i++) {
68796      stack.push(new AstArgument(i, domain[i * 2], domain[i * 2 + 1]));
68797    }
68798    for (let i = 0, ii = code.length; i < ii; i++) {
68799      item = code[i];
68800      if (typeof item === "number") {
68801        stack.push(new AstLiteral(item));
68802        continue;
68803      }
68804      switch (item) {
68805        case "add":
68806          if (stack.length < 2) {
68807            return null;
68808          }
68809          num2 = stack.pop();
68810          num1 = stack.pop();
68811          stack.push(buildAddOperation(num1, num2));
68812          break;
68813        case "cvr":
68814          if (stack.length < 1) {
68815            return null;
68816          }
68817          break;
68818        case "mul":
68819          if (stack.length < 2) {
68820            return null;
68821          }
68822          num2 = stack.pop();
68823          num1 = stack.pop();
68824          stack.push(buildMulOperation(num1, num2));
68825          break;
68826        case "sub":
68827          if (stack.length < 2) {
68828            return null;
68829          }
68830          num2 = stack.pop();
68831          num1 = stack.pop();
68832          stack.push(buildSubOperation(num1, num2));
68833          break;
68834        case "exch":
68835          if (stack.length < 2) {
68836            return null;
68837          }
68838          ast1 = stack.pop();
68839          ast2 = stack.pop();
68840          stack.push(ast1, ast2);
68841          break;
68842        case "pop":
68843          if (stack.length < 1) {
68844            return null;
68845          }
68846          stack.pop();
68847          break;
68848        case "index":
68849          if (stack.length < 1) {
68850            return null;
68851          }
68852          num1 = stack.pop();
68853          if (num1.type !== "literal") {
68854            return null;
68855          }
68856          n = num1.number;
68857          if (n < 0 || !Number.isInteger(n) || stack.length < n) {
68858            return null;
68859          }
68860          ast1 = stack[stack.length - n - 1];
68861          if (ast1.type === "literal" || ast1.type === "var") {
68862            stack.push(ast1);
68863            break;
68864          }
68865          tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
68866          stack[stack.length - n - 1] = tmpVar;
68867          stack.push(tmpVar);
68868          instructions.push(new AstVariableDefinition(tmpVar, ast1));
68869          break;
68870        case "dup":
68871          if (stack.length < 1) {
68872            return null;
68873          }
68874          if (typeof code[i + 1] === "number" && code[i + 2] === "gt" && code[i + 3] === i + 7 && code[i + 4] === "jz" && code[i + 5] === "pop" && code[i + 6] === code[i + 1]) {
68875            num1 = stack.pop();
68876            stack.push(buildMinOperation(num1, code[i + 1]));
68877            i += 6;
68878            break;
68879          }
68880          ast1 = stack.at(-1);
68881          if (ast1.type === "literal" || ast1.type === "var") {
68882            stack.push(ast1);
68883            break;
68884          }
68885          tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
68886          stack[stack.length - 1] = tmpVar;
68887          stack.push(tmpVar);
68888          instructions.push(new AstVariableDefinition(tmpVar, ast1));
68889          break;
68890        case "roll":
68891          if (stack.length < 2) {
68892            return null;
68893          }
68894          num2 = stack.pop();
68895          num1 = stack.pop();
68896          if (num2.type !== "literal" || num1.type !== "literal") {
68897            return null;
68898          }
68899          j = num2.number;
68900          n = num1.number;
68901          if (n <= 0 || !Number.isInteger(n) || !Number.isInteger(j) || stack.length < n) {
68902            return null;
68903          }
68904          j = (j % n + n) % n;
68905          if (j === 0) {
68906            break;
68907          }
68908          stack.push(...stack.splice(stack.length - n, n - j));
68909          break;
68910        default:
68911          return null;
68912      }
68913    }
68914    if (stack.length !== outputSize) {
68915      return null;
68916    }
68917    const result = [];
68918    for (const instruction of instructions) {
68919      const statementBuilder = new ExpressionBuilderVisitor();
68920      instruction.visit(statementBuilder);
68921      result.push(statementBuilder.toString());
68922    }
68923    for (let i = 0, ii = stack.length; i < ii; i++) {
68924      const expr = stack[i],
68925        statementBuilder = new ExpressionBuilderVisitor();
68926      expr.visit(statementBuilder);
68927      const min = range[i * 2],
68928        max = range[i * 2 + 1];
68929      const out = [statementBuilder.toString()];
68930      if (min > expr.min) {
68931        out.unshift("Math.max(", min, ", ");
68932        out.push(")");
68933      }
68934      if (max < expr.max) {
68935        out.unshift("Math.min(", max, ", ");
68936        out.push(")");
68937      }
68938      out.unshift("dest[destOffset + ", i, "] = ");
68939      out.push(";");
68940      result.push(out.join(""));
68941    }
68942    return result.join("\n");
68943  }
68944}
vendor: 2,882 bytes, lines 68945-69046
68945exports.PostScriptCompiler = PostScriptCompiler;
68946
68947/***/ }),
68948/* 58 */
68949/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
68950
68951
68952
68953Object.defineProperty(exports, "__esModule", ({
68954  value: true
68955}));
68956exports.PostScriptParser = exports.PostScriptLexer = void 0;
68957var _util = __w_pdfjs_require__(2);
68958var _primitives = __w_pdfjs_require__(4);
68959var _core_utils = __w_pdfjs_require__(3);
68960class PostScriptParser {
68961  constructor(lexer) {
68962    this.lexer = lexer;
68963    this.operators = [];
68964    this.token = null;
68965    this.prev = null;
68966  }
68967  nextToken() {
68968    this.prev = this.token;
68969    this.token = this.lexer.getToken();
68970  }
68971  accept(type) {
68972    if (this.token.type === type) {
68973      this.nextToken();
68974      return true;
68975    }
68976    return false;
68977  }
68978  expect(type) {
68979    if (this.accept(type)) {
68980      return true;
68981    }
68982    throw new _util.FormatError(`Unexpected symbol: found ${this.token.type} expected ${type}.`);
68983  }
68984  parse() {
68985    this.nextToken();
68986    this.expect(PostScriptTokenTypes.LBRACE);
68987    this.parseBlock();
68988    this.expect(PostScriptTokenTypes.RBRACE);
68989    return this.operators;
68990  }
68991  parseBlock() {
68992    while (true) {
68993      if (this.accept(PostScriptTokenTypes.NUMBER)) {
68994        this.operators.push(this.prev.value);
68995      } else if (this.accept(PostScriptTokenTypes.OPERATOR)) {
68996        this.operators.push(this.prev.value);
68997      } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
68998        this.parseCondition();
68999      } else {
69000        return;
69001      }
69002    }
69003  }
69004  parseCondition() {
69005    const conditionLocation = this.operators.length;
69006    this.operators.push(null, null);
69007    this.parseBlock();
69008    this.expect(PostScriptTokenTypes.RBRACE);
69009    if (this.accept(PostScriptTokenTypes.IF)) {
69010      this.operators[conditionLocation] = this.operators.length;
69011      this.operators[conditionLocation + 1] = "jz";
69012    } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
69013      const jumpLocation = this.operators.length;
69014      this.operators.push(null, null);
69015      const endOfTrue = this.operators.length;
69016      this.parseBlock();
69017      this.expect(PostScriptTokenTypes.RBRACE);
69018      this.expect(PostScriptTokenTypes.IFELSE);
69019      this.operators[jumpLocation] = this.operators.length;
69020      this.operators[jumpLocation + 1] = "j";
69021      this.operators[conditionLocation] = endOfTrue;
69022      this.operators[conditionLocation + 1] = "jz";
69023    } else {
69024      throw new _util.FormatError("PS Function: error parsing conditional.");
69025    }
69026  }
69027}
69028exports.PostScriptParser = PostScriptParser;
69029const PostScriptTokenTypes = {
69030  LBRACE: 0,
69031  RBRACE: 1,
69032  NUMBER: 2,
69033  OPERATOR: 3,
69034  IF: 4,
69035  IFELSE: 5
69036};
69037class PostScriptToken {
69038  static get opCache() {
69039    return (0, _util.shadow)(this, "opCache", Object.create(null));
69040  }
69041  constructor(type, value) {
69042    this.type = type;
69043    this.value = value;
69044  }
69045  static getOperator(op) {
69046    return PostScriptToken.opCache[op] ||
vendor: 2,757 bytes, lines 69046-69148
69046= new PostScriptToken(PostScriptTokenTypes.OPERATOR, op);
69047  }
69048  static get LBRACE() {
69049    return (0, _util.shadow)(this, "LBRACE", new PostScriptToken(PostScriptTokenTypes.LBRACE, "{"));
69050  }
69051  static get RBRACE() {
69052    return (0, _util.shadow)(this, "RBRACE", new PostScriptToken(PostScriptTokenTypes.RBRACE, "}"));
69053  }
69054  static get IF() {
69055    return (0, _util.shadow)(this, "IF", new PostScriptToken(PostScriptTokenTypes.IF, "IF"));
69056  }
69057  static get IFELSE() {
69058    return (0, _util.shadow)(this, "IFELSE", new PostScriptToken(PostScriptTokenTypes.IFELSE, "IFELSE"));
69059  }
69060}
69061class PostScriptLexer {
69062  constructor(stream) {
69063    this.stream = stream;
69064    this.nextChar();
69065    this.strBuf = [];
69066  }
69067  nextChar() {
69068    return this.currentChar = this.stream.getByte();
69069  }
69070  getToken() {
69071    let comment = false;
69072    let ch = this.currentChar;
69073    while (true) {
69074      if (ch < 0) {
69075        return _primitives.EOF;
69076      }
69077      if (comment) {
69078        if (ch === 0x0a || ch === 0x0d) {
69079          comment = false;
69080        }
69081      } else if (ch === 0x25) {
69082        comment = true;
69083      } else if (!(0, _core_utils.isWhiteSpace)(ch)) {
69084        break;
69085      }
69086      ch = this.nextChar();
69087    }
69088    switch (ch | 0) {
69089      case 0x30:
69090      case 0x31:
69091      case 0x32:
69092      case 0x33:
69093      case 0x34:
69094      case 0x35:
69095      case 0x36:
69096      case 0x37:
69097      case 0x38:
69098      case 0x39:
69099      case 0x2b:
69100      case 0x2d:
69101      case 0x2e:
69102        return new PostScriptToken(PostScriptTokenTypes.NUMBER, this.getNumber());
69103      case 0x7b:
69104        this.nextChar();
69105        return PostScriptToken.LBRACE;
69106      case 0x7d:
69107        this.nextChar();
69108        return PostScriptToken.RBRACE;
69109    }
69110    const strBuf = this.strBuf;
69111    strBuf.length = 0;
69112    strBuf[0] = String.fromCharCode(ch);
69113    while ((ch = this.nextChar()) >= 0 && (ch >= 0x41 && ch <= 0x5a || ch >= 0x61 && ch <= 0x7a)) {
69114      strBuf.push(String.fromCharCode(ch));
69115    }
69116    const str = strBuf.join("");
69117    switch (str.toLowerCase()) {
69118      case "if":
69119        return PostScriptToken.IF;
69120      case "ifelse":
69121        return PostScriptToken.IFELSE;
69122      default:
69123        return PostScriptToken.getOperator(str);
69124    }
69125  }
69126  getNumber() {
69127    let ch = this.currentChar;
69128    const strBuf = this.strBuf;
69129    strBuf.length = 0;
69130    strBuf[0] = String.fromCharCode(ch);
69131    while ((ch = this.nextChar()) >= 0) {
69132      if (ch >= 0x30 && ch <= 0x39 || ch === 0x2d || ch === 0x2e) {
69133        strBuf.push(String.fromCharCode(ch));
69134      } else {
69135        break;
69136      }
69137    }
69138    const value = parseFloat(strBuf.join(""));
69139    if (isNaN(value)) {
69140      throw new _util.FormatError(`Invalid floating point number: ${value}`);
69141    }
69142    return value;
69143  }
69144}
69145exports.PostScriptLexer = PostScriptLexer;
69146
69147/***/ }),
69148/* 5
vendor: 10,268 bytes, lines 69148-69432
691489 */
69149/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
69150
69151
69152
69153Object.defineProperty(exports, "__esModule", ({
69154  value: true
69155}));
69156exports.RegionalImageCache = exports.LocalTilingPatternCache = exports.LocalImageCache = exports.LocalGStateCache = exports.LocalFunctionCache = exports.LocalColorSpaceCache = exports.GlobalImageCache = void 0;
69157var _util = __w_pdfjs_require__(2);
69158var _primitives = __w_pdfjs_require__(4);
69159class BaseLocalCache {
69160  constructor(options) {
69161    if (this.constructor === BaseLocalCache) {
69162      (0, _util.unreachable)("Cannot initialize BaseLocalCache.");
69163    }
69164    this._onlyRefs = options?.onlyRefs === true;
69165    if (!this._onlyRefs) {
69166      this._nameRefMap = new Map();
69167      this._imageMap = new Map();
69168    }
69169    this._imageCache = new _primitives.RefSetCache();
69170  }
69171  getByName(name) {
69172    if (this._onlyRefs) {
69173      (0, _util.unreachable)("Should not call `getByName` method.");
69174    }
69175    const ref = this._nameRefMap.get(name);
69176    if (ref) {
69177      return this.getByRef(ref);
69178    }
69179    return this._imageMap.get(name) || null;
69180  }
69181  getByRef(ref) {
69182    return this._imageCache.get(ref) || null;
69183  }
69184  set(name, ref, data) {
69185    (0, _util.unreachable)("Abstract method `set` called.");
69186  }
69187}
69188class LocalImageCache extends BaseLocalCache {
69189  set(name, ref = null, data) {
69190    if (typeof name !== "string") {
69191      throw new Error('LocalImageCache.set - expected "name" argument.');
69192    }
69193    if (ref) {
69194      if (this._imageCache.has(ref)) {
69195        return;
69196      }
69197      this._nameRefMap.set(name, ref);
69198      this._imageCache.put(ref, data);
69199      return;
69200    }
69201    if (this._imageMap.has(name)) {
69202      return;
69203    }
69204    this._imageMap.set(name, data);
69205  }
69206}
69207exports.LocalImageCache = LocalImageCache;
69208class LocalColorSpaceCache extends BaseLocalCache {
69209  set(name = null, ref = null, data) {
69210    if (typeof name !== "string" && !ref) {
69211      throw new Error('LocalColorSpaceCache.set - expected "name" and/or "ref" argument.');
69212    }
69213    if (ref) {
69214      if (this._imageCache.has(ref)) {
69215        return;
69216      }
69217      if (name !== null) {
69218        this._nameRefMap.set(name, ref);
69219      }
69220      this._imageCache.put(ref, data);
69221      return;
69222    }
69223    if (this._imageMap.has(name)) {
69224      return;
69225    }
69226    this._imageMap.set(name, data);
69227  }
69228}
69229exports.LocalColorSpaceCache = LocalColorSpaceCache;
69230class LocalFunctionCache extends BaseLocalCache {
69231  constructor(options) {
69232    super({
69233      onlyRefs: true
69234    });
69235  }
69236  set(name = null, ref, data) {
69237    if (!ref) {
69238      throw new Error('LocalFunctionCache.set - expected "ref" argument.');
69239    }
69240    if (this._imageCache.has(ref)) {
69241      return;
69242    }
69243    this._imageCache.put(ref, data);
69244  }
69245}
69246exports.LocalFunctionCache = LocalFunctionCache;
69247class LocalGStateCache extends BaseLocalCache {
69248  set(name, ref = null, data) {
69249    if (typeof name !== "string") {
69250      throw new Error('LocalGStateCache.set - expected "name" argument.');
69251    }
69252    if (ref) {
69253      if (this._imageCache.has(ref)) {
69254        return;
69255      }
69256      this._nameRefMap.set(name, ref);
69257      this._imageCache.put(ref, data);
69258      return;
69259    }
69260    if (this._imageMap.has(name)) {
69261      return;
69262    }
69263    this._imageMap.set(name, data);
69264  }
69265}
69266exports.LocalGStateCache = LocalGStateCache;
69267class LocalTilingPatternCache extends BaseLocalCache {
69268  constructor(options) {
69269    super({
69270      onlyRefs: true
69271    });
69272  }
69273  set(name = null, ref, data) {
69274    if (!ref) {
69275      throw new Error('LocalTilingPatternCache.set - expected "ref" argument.');
69276    }
69277    if (this._imageCache.has(ref)) {
69278      return;
69279    }
69280    this._imageCache.put(ref, data);
69281  }
69282}
69283exports.LocalTilingPatternCache = LocalTilingPatternCache;
69284class RegionalImageCache extends BaseLocalCache {
69285  constructor(options) {
69286    super({
69287      onlyRefs: true
69288    });
69289  }
69290  set(name = null, ref, data) {
69291    if (!ref) {
69292      throw new Error('RegionalImageCache.set - expected "ref" argument.');
69293    }
69294    if (this._imageCache.has(ref)) {
69295      return;
69296    }
69297    this._imageCache.put(ref, data);
69298  }
69299}
69300exports.RegionalImageCache = RegionalImageCache;
69301class GlobalImageCache {
69302  static NUM_PAGES_THRESHOLD = 2;
69303  static MIN_IMAGES_TO_CACHE = 10;
69304  static MAX_BYTE_SIZE = 5 * _util.MAX_IMAGE_SIZE_TO_CACHE;
69305  constructor() {
69306    this._refCache = new _primitives.RefSetCache();
69307    this._imageCache = new _primitives.RefSetCache();
69308  }
69309  get _byteSize() {
69310    let byteSize = 0;
69311    for (const imageData of this._imageCache) {
69312      byteSize += imageData.byteSize;
69313    }
69314    return byteSize;
69315  }
69316  get _cacheLimitReached() {
69317    if (this._imageCache.size < GlobalImageCache.MIN_IMAGES_TO_CACHE) {
69318      return false;
69319    }
69320    if (this._byteSize < GlobalImageCache.MAX_BYTE_SIZE) {
69321      return false;
69322    }
69323    return true;
69324  }
69325  shouldCache(ref, pageIndex) {
69326    let pageIndexSet = this._refCache.get(ref);
69327    if (!pageIndexSet) {
69328      pageIndexSet = new Set();
69329      this._refCache.put(ref, pageIndexSet);
69330    }
69331    pageIndexSet.add(pageIndex);
69332    if (pageIndexSet.size < GlobalImageCache.NUM_PAGES_THRESHOLD) {
69333      return false;
69334    }
69335    if (!this._imageCache.has(ref) && this._cacheLimitReached) {
69336      return false;
69337    }
69338    return true;
69339  }
69340  addByteSize(ref, byteSize) {
69341    const imageData = this._imageCache.get(ref);
69342    if (!imageData) {
69343      return;
69344    }
69345    if (imageData.byteSize) {
69346      return;
69347    }
69348    imageData.byteSize = byteSize;
69349  }
69350  getData(ref, pageIndex) {
69351    const pageIndexSet = this._refCache.get(ref);
69352    if (!pageIndexSet) {
69353      return null;
69354    }
69355    if (pageIndexSet.size < GlobalImageCache.NUM_PAGES_THRESHOLD) {
69356      return null;
69357    }
69358    const imageData = this._imageCache.get(ref);
69359    if (!imageData) {
69360      return null;
69361    }
69362    pageIndexSet.add(pageIndex);
69363    return imageData;
69364  }
69365  setData(ref, data) {
69366    if (!this._refCache.has(ref)) {
69367      throw new Error('GlobalImageCache.setData - expected "shouldCache" to have been called.');
69368    }
69369    if (this._imageCache.has(ref)) {
69370      return;
69371    }
69372    if (this._cacheLimitReached) {
69373      (0, _util.warn)("GlobalImageCache.setData - cache limit reached.");
69374      return;
69375    }
69376    this._imageCache.put(ref, data);
69377  }
69378  clear(onlyData = false) {
69379    if (!onlyData) {
69380      this._refCache.clear();
69381    }
69382    this._imageCache.clear();
69383  }
69384}
69385exports.GlobalImageCache = GlobalImageCache;
69386
69387/***/ }),
69388/* 60 */
69389/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
69390
69391
69392
69393Object.defineProperty(exports, "__esModule", ({
69394  value: true
69395}));
69396exports.bidi = bidi;
69397var _util = __w_pdfjs_require__(2);
69398const 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"];
69399const 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"];
69400function isOdd(i) {
69401  return (i & 1) !== 0;
69402}
69403function isEven(i) {
69404  return (i & 1) === 0;
69405}
69406function findUnequal(arr, start, value) {
69407  let j, jj;
69408  for (j = start, jj = arr.length; j < jj; ++j) {
69409    if (arr[j] !== value) {
69410      return j;
69411    }
69412  }
69413  return j;
69414}
69415function setValues(arr, start, end, value) {
69416  for (let j = start; j < end; ++j) {
69417    arr[j] = value;
69418  }
69419}
69420function reverseValues(arr, start, end) {
69421  for (let i = start, j = end - 1; i < j; ++i, --j) {
69422    const temp = arr[i];
69423    arr[i] = arr[j];
69424    arr[j] = temp;
69425  }
69426}
69427function createBidiText(str, isLTR, vertical = false) {
69428  let dir = "ltr";
69429  if (vertical) {
69430    dir = "ttb";
69431  } else if (!isLTR) {
69432    dir = "rtl";
vendor: 4,205 bytes, lines 69433-69600
69433  }
69434  return {
69435    str,
69436    dir
69437  };
69438}
69439const chars = [];
69440const types = [];
69441function bidi(str, startLevel = -1, vertical = false) {
69442  let isLTR = true;
69443  const strLength = str.length;
69444  if (strLength === 0 || vertical) {
69445    return createBidiText(str, isLTR, vertical);
69446  }
69447  chars.length = strLength;
69448  types.length = strLength;
69449  let numBidi = 0;
69450  let i, ii;
69451  for (i = 0; i < strLength; ++i) {
69452    chars[i] = str.charAt(i);
69453    const charCode = str.charCodeAt(i);
69454    let charType = "L";
69455    if (charCode <= 0x00ff) {
69456      charType = baseTypes[charCode];
69457    } else if (0x0590 <= charCode && charCode <= 0x05f4) {
69458      charType = "R";
69459    } else if (0x0600 <= charCode && charCode <= 0x06ff) {
69460      charType = arabicTypes[charCode & 0xff];
69461      if (!charType) {
69462        (0, _util.warn)("Bidi: invalid Unicode character " + charCode.toString(16));
69463      }
69464    } else if (0x0700 <= charCode && charCode <= 0x08ac || 0xfb50 <= charCode && charCode <= 0xfdff || 0xfe70 <= charCode && charCode <= 0xfeff) {
69465      charType = "AL";
69466    }
69467    if (charType === "R" || charType === "AL" || charType === "AN") {
69468      numBidi++;
69469    }
69470    types[i] = charType;
69471  }
69472  if (numBidi === 0) {
69473    isLTR = true;
69474    return createBidiText(str, isLTR);
69475  }
69476  if (startLevel === -1) {
69477    if (numBidi / strLength < 0.3 && strLength > 4) {
69478      isLTR = true;
69479      startLevel = 0;
69480    } else {
69481      isLTR = false;
69482      startLevel = 1;
69483    }
69484  }
69485  const levels = [];
69486  for (i = 0; i < strLength; ++i) {
69487    levels[i] = startLevel;
69488  }
69489  const e = isOdd(startLevel) ? "R" : "L";
69490  const sor = e;
69491  const eor = sor;
69492  let lastType = sor;
69493  for (i = 0; i < strLength; ++i) {
69494    if (types[i] === "NSM") {
69495      types[i] = lastType;
69496    } else {
69497      lastType = types[i];
69498    }
69499  }
69500  lastType = sor;
69501  let t;
69502  for (i = 0; i < strLength; ++i) {
69503    t = types[i];
69504    if (t === "EN") {
69505      types[i] = lastType === "AL" ? "AN" : "EN";
69506    } else if (t === "R" || t === "L" || t === "AL") {
69507      lastType = t;
69508    }
69509  }
69510  for (i = 0; i < strLength; ++i) {
69511    t = types[i];
69512    if (t === "AL") {
69513      types[i] = "R";
69514    }
69515  }
69516  for (i = 1; i < strLength - 1; ++i) {
69517    if (types[i] === "ES" && types[i - 1] === "EN" && types[i + 1] === "EN") {
69518      types[i] = "EN";
69519    }
69520    if (types[i] === "CS" && (types[i - 1] === "EN" || types[i - 1] === "AN") && types[i + 1] === types[i - 1]) {
69521      types[i] = types[i - 1];
69522    }
69523  }
69524  for (i = 0; i < strLength; ++i) {
69525    if (types[i] === "EN") {
69526      for (let j = i - 1; j >= 0; --j) {
69527        if (types[j] !== "ET") {
69528          break;
69529        }
69530        types[j] = "EN";
69531      }
69532      for (let j = i + 1; j < strLength; ++j) {
69533        if (types[j] !== "ET") {
69534          break;
69535        }
69536        types[j] = "EN";
69537      }
69538    }
69539  }
69540  for (i = 0; i < strLength; ++i) {
69541    t = types[i];
69542    if (t === "WS" || t === "ES" || t === "ET" || t === "CS") {
69543      types[i] = "ON";
69544    }
69545  }
69546  lastType = sor;
69547  for (i = 0; i < strLength; ++i) {
69548    t = types[i];
69549    if (t === "EN") {
69550      types[i] = lastType === "L" ? "L" : "EN";
69551    } else if (t === "R" || t === "L") {
69552      lastType = t;
69553    }
69554  }
69555  for (i = 0; i < strLength; ++i) {
69556    if (types[i] === "ON") {
69557      const end = findUnequal(types, i + 1, "ON");
69558      let before = sor;
69559      if (i > 0) {
69560        before = types[i - 1];
69561      }
69562      let after = eor;
69563      if (end + 1 < strLength) {
69564        after = types[end + 1];
69565      }
69566      if (before !== "L") {
69567        before = "R";
69568      }
69569      if (after !== "L") {
69570        after = "R";
69571      }
69572      if (before === after) {
69573        setValues(types, i, end, before);
69574      }
69575      i = end - 1;
69576    }
69577  }
69578  for (i = 0; i < strLength; ++i) {
69579    if (types[i] === "ON") {
69580      types[i] = e;
69581    }
69582  }
69583  for (i = 0; i < strLength; ++i) {
69584    t = types[i];
69585    if (isEven(levels[i])) {
69586      if (t === "R") {
69587        levels[i] += 1;
69588      } else if (t === "AN" || t === "EN") {
69589        levels[i] += 2;
69590      }
69591    } else if (t === "L" || t === "AN" || t === "EN") {
69592      levels[i] += 1;
69593    }
69594  }
69595  let highestLevel = -1;
69596  let lowestOddLevel = 99;
69597  let level;
69598  for (i = 0, ii = levels.length; i < ii; ++i) {
69599    level = levels[i];
69600    if (highestLevel < level) {
vendor: 1,405 bytes, lines 69601-69661
69601      highestLevel = level;
69602    }
69603    if (lowestOddLevel > level && isOdd(level)) {
69604      lowestOddLevel = level;
69605    }
69606  }
69607  for (level = highestLevel; level >= lowestOddLevel; --level) {
69608    let start = -1;
69609    for (i = 0, ii = levels.length; i < ii; ++i) {
69610      if (levels[i] < level) {
69611        if (start >= 0) {
69612          reverseValues(chars, start, i);
69613          start = -1;
69614        }
69615      } else if (start < 0) {
69616        start = i;
69617      }
69618    }
69619    if (start >= 0) {
69620      reverseValues(chars, start, levels.length);
69621    }
69622  }
69623  for (i = 0, ii = chars.length; i < ii; ++i) {
69624    const ch = chars[i];
69625    if (ch === "<" || ch === ">") {
69626      chars[i] = "";
69627    }
69628  }
69629  return createBidiText(chars.join(""), isLTR);
69630}
69631
69632/***/ }),
69633/* 61 */
69634/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
69635
69636
69637
69638Object.defineProperty(exports, "__esModule", ({
69639  value: true
69640}));
69641exports.getFontSubstitution = getFontSubstitution;
69642var _fonts_utils = __w_pdfjs_require__(38);
69643var _core_utils = __w_pdfjs_require__(3);
69644const NORMAL = {
69645  style: "normal",
69646  weight: "normal"
69647};
69648const BOLD = {
69649  style: "normal",
69650  weight: "bold"
69651};
69652const ITALIC = {
69653  style: "italic",
69654  weight: "normal"
69655};
69656const BOLDITALIC = {
69657  style: "italic",
69658  weight: "bold"
69659};
69660const substitutionMap = new Map([["Times-Roman", {
69661  local: ["Times New Roman", "Times-Roman", "Times", "Liberation Serif", "Nimbus Roman", "Nimbus Roman 
vendor: 5,279 bytes, lines 69661-69847
69661L", "Tinos", "Thorndale", "TeX Gyre Termes", "FreeSerif", "DejaVu Serif", "Bitstream Vera Serif", "Ubuntu"],
69662  style: NORMAL,
69663  ultimate: "serif"
69664}], ["Times-Bold", {
69665  alias: "Times-Roman",
69666  style: BOLD,
69667  ultimate: "serif"
69668}], ["Times-Italic", {
69669  alias: "Times-Roman",
69670  style: ITALIC,
69671  ultimate: "serif"
69672}], ["Times-BoldItalic", {
69673  alias: "Times-Roman",
69674  style: BOLDITALIC,
69675  ultimate: "serif"
69676}], ["Helvetica", {
69677  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"],
69678  path: "LiberationSans-Regular.ttf",
69679  style: NORMAL,
69680  ultimate: "sans-serif"
69681}], ["Helvetica-Bold", {
69682  alias: "Helvetica",
69683  path: "LiberationSans-Bold.ttf",
69684  style: BOLD,
69685  ultimate: "sans-serif"
69686}], ["Helvetica-Oblique", {
69687  alias: "Helvetica",
69688  path: "LiberationSans-Italic.ttf",
69689  style: ITALIC,
69690  ultimate: "sans-serif"
69691}], ["Helvetica-BoldOblique", {
69692  alias: "Helvetica",
69693  path: "LiberationSans-BoldItalic.ttf",
69694  style: BOLDITALIC,
69695  ultimate: "sans-serif"
69696}], ["Courier", {
69697  local: ["Courier", "Courier New", "Liberation Mono", "Nimbus Mono", "Nimbus Mono L", "Cousine", "Cumberland", "TeX Gyre Cursor", "FreeMono"],
69698  style: NORMAL,
69699  ultimate: "monospace"
69700}], ["Courier-Bold", {
69701  alias: "Courier",
69702  style: BOLD,
69703  ultimate: "monospace"
69704}], ["Courier-Oblique", {
69705  alias: "Courier",
69706  style: ITALIC,
69707  ultimate: "monospace"
69708}], ["Courier-BoldOblique", {
69709  alias: "Courier",
69710  style: BOLDITALIC,
69711  ultimate: "monospace"
69712}], ["ArialBlack", {
69713  local: ["Arial Black"],
69714  style: {
69715    style: "normal",
69716    weight: "900"
69717  },
69718  fallback: "Helvetica-Bold"
69719}], ["ArialBlack-Bold", {
69720  alias: "ArialBlack"
69721}], ["ArialBlack-Italic", {
69722  alias: "ArialBlack",
69723  style: {
69724    style: "italic",
69725    weight: "900"
69726  },
69727  fallback: "Helvetica-BoldOblique"
69728}], ["ArialBlack-BoldItalic", {
69729  alias: "ArialBlack-Italic"
69730}], ["ArialNarrow", {
69731  local: ["Arial Narrow", "Liberation Sans Narrow", "Helvetica Condensed", "Nimbus Sans Narrow", "TeX Gyre Heros Cn"],
69732  style: NORMAL,
69733  fallback: "Helvetica"
69734}], ["ArialNarrow-Bold", {
69735  alias: "ArialNarrow",
69736  style: BOLD,
69737  fallback: "Helvetica-Bold"
69738}], ["ArialNarrow-Italic", {
69739  alias: "ArialNarrow",
69740  style: ITALIC,
69741  fallback: "Helvetica-Oblique"
69742}], ["ArialNarrow-BoldItalic", {
69743  alias: "ArialNarrow",
69744  style: BOLDITALIC,
69745  fallback: "Helvetica-BoldOblique"
69746}], ["Calibri", {
69747  local: ["Calibri", "Carlito"],
69748  style: NORMAL,
69749  fallback: "Helvetica"
69750}], ["Calibri-Bold", {
69751  alias: "Calibri",
69752  style: BOLD,
69753  fallback: "Helvetica-Bold"
69754}], ["Calibri-Italic", {
69755  alias: "Calibri",
69756  style: ITALIC,
69757  fallback: "Helvetica-Oblique"
69758}], ["Calibri-BoldItalic", {
69759  alias: "Calibri",
69760  style: BOLDITALIC,
69761  fallback: "Helvetica-BoldOblique"
69762}], ["Wingdings", {
69763  local: ["Wingdings", "URW Dingbats"],
69764  style: NORMAL
69765}], ["Wingdings-Regular", {
69766  alias: "Wingdings"
69767}], ["Wingdings-Bold", {
69768  alias: "Wingdings"
69769}]]);
69770const fontAliases = new Map([["Arial-Black", "ArialBlack"]]);
69771function getStyleToAppend(style) {
69772  switch (style) {
69773    case BOLD:
69774      return "Bold";
69775    case ITALIC:
69776      return "Italic";
69777    case BOLDITALIC:
69778      return "Bold Italic";
69779    default:
69780      if (style?.weight === "bold") {
69781        return "Bold";
69782      }
69783      if (style?.style === "italic") {
69784        return "Italic";
69785      }
69786  }
69787  return "";
69788}
69789function generateFont({
69790  alias,
69791  local,
69792  path,
69793  fallback,
69794  style,
69795  ultimate
69796}, src, localFontPath, useFallback = true, usePath = true, append = "") {
69797  const result = {
69798    style: null,
69799    ultimate: null
69800  };
69801  if (local) {
69802    const extra = append ? ` ${append}` : "";
69803    for (const name of local) {
69804      src.push(`local(${name}${extra})`);
69805    }
69806  }
69807  if (alias) {
69808    const substitution = substitutionMap.get(alias);
69809    const aliasAppend = append || getStyleToAppend(style);
69810    Object.assign(result, generateFont(substitution, src, localFontPath, useFallback && !fallback, usePath && !path, aliasAppend));
69811  }
69812  if (style) {
69813    result.style = style;
69814  }
69815  if (ultimate) {
69816    result.ultimate = ultimate;
69817  }
69818  if (useFallback && fallback) {
69819    const fallbackInfo = substitutionMap.get(fallback);
69820    const {
69821      ultimate: fallbackUltimate
69822    } = generateFont(fallbackInfo, src, localFontPath, useFallback, usePath && !path, append);
69823    result.ultimate ||= fallbackUltimate;
69824  }
69825  if (usePath && path && localFontPath) {
69826    src.push(`url(${localFontPath}${path})`);
69827  }
69828  return result;
69829}
69830function getFontSubstitution(systemFontCache, idFactory, localFontPath, baseFontName, standardFontName) {
69831  baseFontName = (0, _fonts_utils.normalizeFontName)(baseFontName);
69832  const key = baseFontName;
69833  let substitutionInfo = systemFontCache.get(key);
69834  if (substitutionInfo) {
69835    return substitutionInfo;
69836  }
69837  let substitution = substitutionMap.get(baseFontName);
69838  if (!substitution) {
69839    for (const [alias, subst] of fontAliases) {
69840      if (baseFontName.startsWith(alias)) {
69841        baseFontName = `${subst}${baseFontName.substring(alias.length)}`;
69842        substitution = substitutionMap.get(baseFontName);
69843        break;
69844      }
69845    }
69846  }
69847  let mustAddBaseFont = false;
69848  if (!substitution) {
69849    substitution = substitutionMap.get(standardFontName);
69850    mustAddBaseFont = true;
69851  }
69852  const loadedName = `${idFactory.getDocId()}_s${idFactory.createFontId()}`;
69853  if (!substitution) {
69854    if (!(0, _core_utils.validateFontName)(baseFontName)) {
69855      systemFontCache.set(key, null);
69856      return null;
69857    }
69858    const bold = /bold/gi.test(baseFontName);
69859    const italic = /oblique|italic/gi.test(baseFontName);
69860    const style = bold && italic && BOLDITALIC || bold && BOLD || italic && ITALIC || NORMAL;
69861    substitutionInfo = {
69862      css: loadedName,
69863      guessFallback: true,
69864      loadedName,
69865      baseFontName,
69866      src: `local(${baseFontName})`,
69867      style
69868    };
69869    systemFontCache.set(key, substitutionInfo);
69870    return substitutionInfo;
69871  }
69872  const src = [];
69873  if (mustAddBaseFont && (0, _core_utils.validateFontName)(baseFontName)) {
69874    src.push(`local(${baseFontName})`);
69875  }
69876  const {
69877    style,
69878    ultimate
69879  } = generateFont(substitution, src, localFontPath);
69880  const guessFallback = ultimate === null;
69881  const fallback = guessFallback ? "" : `,${ultimate}`;
69882  substitutionInfo = {
69883    css: `${loadedName}${fallback}`,
69884    guessFallback,
69885    loadedName,
69886    baseFontName,
69887    src: src.join(","),
69888    style
69889  };
69890  systemFontCache.set(key, substitutionInfo);
69891  return substitutionInfo;
69892}
69893
69894/***/ }),
69895/* 62 */
69896/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
69897
69898
69899
69900Object.defineProperty(exports, "__esModule", ({
69901  value: true
69902}));
69903exports.ImageResizer = void 0;
69904var _util = __w_pdfjs_require__(2);
69905const MIN_IMAGE_DIM = 2048;
69906const MAX_IMAGE_DIM = 65537;
69907const MAX_ERROR = 128;
69908class ImageResizer {
69909  constructor(imgData, isMask) {
69910    this._imgData = imgData;
69911    this._isMask = isMask;
69912  }
69913  static needsToBeResized(width, height) {
69914    if (width <= this._goodSquareLength && height <= this._goodSquareLength) {
69915      return false;
69916    }
69917    const {
69918      MAX_DIM
69919    } = this;
69920    if (width > MAX_DIM || height > MAX_DIM) {
69921      return true;
69922    }
69923    const area = width * height;
69924    if (this._hasMaxArea) {
69925      return area > this.MAX_AREA;
69926    }
69927    if (area < this._goodSquareLength ** 2) {
69928      return false;
69929    }
69930    if (this._areGoodDims(width, height)) {
69931      this._goodSquareLength = Math.max(this._goodSquareLength, Math.floor(Math.sqrt(width * height)));
69932      return false;
69933    }
69934    this._goodSquareLength = this._guessMax(this._goodSquareLength, MAX_DIM, MAX_ERROR, 0);
69935    const maxArea = this.MAX_AREA = this._goodSquareLength ** 2;
69936    return area > maxArea;
69937  }
69938  static get MAX_DIM() {
69939    return (0, _util.shadow)(this, "MAX_DIM", this._guessMax(MIN_IMAGE_DIM, MAX_IMAGE_DIM, 0, 1));
69940  }
69941  static get MAX_AREA() {
69942    this._hasMaxArea = true;
69943    return (0, _util.shadow)(this, "MAX_AREA", this._guessMax(ImageResizer._goodSquareLength, this.MAX_DIM, MAX_ERROR, 0) ** 2);
69944  }
69945  static set MAX_AREA(area) {
69946    if (area >= 0) {
69947      this._hasMaxArea = true;
69948      (0, _util.shadow)(this, "MAX_AREA", area);
69949    }
69950  }
69951  static setMaxArea(area) {
69952    if (!this._hasMaxArea) {
69953      this.MAX_AREA = area >> 2;
69954    }
69955  }
69956  static _areGoodDims(width, height) {
69957    try {
69958      const canvas = new OffscreenCanvas(width, height);
69959      const ctx = canvas.getContext("2d");
69960      ctx.fillRect(0, 0, 1, 1);
69961      const opacity = ctx.getImageData(0, 0, 1, 1).data[3];
69962      canvas.width = canvas.height = 1;
69963      return opacity !== 0;
69964    } catch {
69965      return false;
69966    }
69967  }
69968  static _guessMax(start, end, tolerance, defaultHeight) {
69969    while (start + tolerance + 1 < end) {
69970      const middle = Math.floor((start + end) / 2);
69971      const height = defaultHeight || middle;
69972      if (this._areGoodDims(middle, height)) {
69973        start = middle;
69974      } else {
69975        end = middle;
69976      }
69977    }
69978    return start;
69979  }
69980  static async createImage(imgData, isMask = false) {
69981    return new ImageResizer(imgData, isMask)._createImage();
69982  }
69983  async _createImage() {
69984    const data = this._encodeBMP();
69985    const blob = new Blob([data.buffer], {
69986      type: "image/bmp"
69987    });
69988    const bitmapPromise = createImageBitmap(blob);
69989    const {
69990      MAX_AREA,
69991      MAX_DIM
69992    } = ImageResizer;
69993    const {
69994      _imgData: imgData
69995    } = this;
69996    const {
69997      width,
69998      height
69999    } = imgData;
70000    const minFactor = Math.max(width / MAX_DIM, height / MAX_DIM, Math.sqrt(width * height / MAX_AREA));
70001    const firstFactor = Math.max(minFactor, 2);
70002    const factor = Math.round(10 * (minFactor + 1.25)) / 10 / firstFactor;
70003    const N = Math.floor(Math.log2(factor));
70004    const steps = new Array(N + 2).fill(2);
70005    steps[0] = firstFactor;
70006    steps.splice(-1, 1, factor / (1 << N));
70007    let newWidth = width;
70008    let newHeight = height;
70009    let bitmap = await bitmapPromise;
70010    for (const step of steps) {
70011      const prevWidth = newWidth;
70012      const prevHeight = newHeight;
70013      newWidth = Math.floor(newWidth / step) - 1;
70014      newHeight = Math.floor(newHeight / step) - 1;
70015      const canvas = new OffscreenCanvas(newWidth, newHeight);
70016      const ctx = canvas.getContext("2d");
70017      ctx.drawImage(bitmap, 0, 0, prevWidth, prevHeight, 0, 0, newWidth, newHeight);
70018      bitmap = canvas.transferToImageBitmap();
70019    }
70020    imgData.data = null;
70021    imgData.bitmap = bitmap;
70022    imgData.width = newWidth;
70023    imgData.height = newHeight;
70024    return imgData;
70025  }
70026  _encodeBMP() {
70027    const {
70028      width,
70029      height,
70030      kind
70031    } = this._imgData;
70032    let data = this._imgData.data;
70033    let bitPerPixel;
vendor: 5,198 bytes, lines 70034-70199
70034    let colorTable = new Uint8Array(0);
70035    let maskTable = colorTable;
70036    let compression = 0;
70037    switch (kind) {
70038      case _util.ImageKind.GRAYSCALE_1BPP:
70039        {
70040          bitPerPixel = 1;
70041          colorTable = new Uint8Array(this._isMask ? [255, 255, 255, 255, 0, 0, 0, 0] : [0, 0, 0, 0, 255, 255, 255, 255]);
70042          const rowLen = width + 7 >> 3;
70043          const rowSize = rowLen + 3 & -4;
70044          if (rowLen !== rowSize) {
70045            const newData = new Uint8Array(rowSize * height);
70046            let k = 0;
70047            for (let i = 0, ii = height * rowLen; i < ii; i += rowLen, k += rowSize) {
70048              newData.set(data.subarray(i, i + rowLen), k);
70049            }
70050            data = newData;
70051          }
70052          break;
70053        }
70054      case _util.ImageKind.RGB_24BPP:
70055        {
70056          bitPerPixel = 24;
70057          if (width & 3) {
70058            const rowLen = 3 * width;
70059            const rowSize = rowLen + 3 & -4;
70060            const extraLen = rowSize - rowLen;
70061            const newData = new Uint8Array(rowSize * height);
70062            let k = 0;
70063            for (let i = 0, ii = height * rowLen; i < ii; i += rowLen) {
70064              const row = data.subarray(i, i + rowLen);
70065              for (let j = 0; j < rowLen; j += 3) {
70066                newData[k++] = row[j + 2];
70067                newData[k++] = row[j + 1];
70068                newData[k++] = row[j];
70069              }
70070              k += extraLen;
70071            }
70072            data = newData;
70073          } else {
70074            for (let i = 0, ii = data.length; i < ii; i += 3) {
70075              const tmp = data[i];
70076              data[i] = data[i + 2];
70077              data[i + 2] = tmp;
70078            }
70079          }
70080          break;
70081        }
70082      case _util.ImageKind.RGBA_32BPP:
70083        bitPerPixel = 32;
70084        compression = 3;
70085        maskTable = new Uint8Array(4 + 4 + 4 + 4 + 52);
70086        const view = new DataView(maskTable.buffer);
70087        if (_util.FeatureTest.isLittleEndian) {
70088          view.setUint32(0, 0x000000ff, true);
70089          view.setUint32(4, 0x0000ff00, true);
70090          view.setUint32(8, 0x00ff0000, true);
70091          view.setUint32(12, 0xff000000, true);
70092        } else {
70093          view.setUint32(0, 0xff000000, true);
70094          view.setUint32(4, 0x00ff0000, true);
70095          view.setUint32(8, 0x0000ff00, true);
70096          view.setUint32(12, 0x000000ff, true);
70097        }
70098        break;
70099      default:
70100        throw new Error("invalid format");
70101    }
70102    let i = 0;
70103    const headerLength = 40 + maskTable.length;
70104    const fileLength = 14 + headerLength + colorTable.length + data.length;
70105    const bmpData = new Uint8Array(fileLength);
70106    const view = new DataView(bmpData.buffer);
70107    view.setUint16(i, 0x4d42, true);
70108    i += 2;
70109    view.setUint32(i, fileLength, true);
70110    i += 4;
70111    view.setUint32(i, 0, true);
70112    i += 4;
70113    view.setUint32(i, 14 + headerLength + colorTable.length, true);
70114    i += 4;
70115    view.setUint32(i, headerLength, true);
70116    i += 4;
70117    view.setInt32(i, width, true);
70118    i += 4;
70119    view.setInt32(i, -height, true);
70120    i += 4;
70121    view.setUint16(i, 1, true);
70122    i += 2;
70123    view.setUint16(i, bitPerPixel, true);
70124    i += 2;
70125    view.setUint32(i, compression, true);
70126    i += 4;
70127    view.setUint32(i, 0, true);
70128    i += 4;
70129    view.setInt32(i, 0, true);
70130    i += 4;
70131    view.setInt32(i, 0, true);
70132    i += 4;
70133    view.setUint32(i, colorTable.length / 4, true);
70134    i += 4;
70135    view.setUint32(i, 0, true);
70136    i += 4;
70137    bmpData.set(maskTable, i);
70138    i += maskTable.length;
70139    bmpData.set(colorTable, i);
70140    i += colorTable.length;
70141    bmpData.set(data, i);
70142    return bmpData;
70143  }
70144}
70145exports.ImageResizer = ImageResizer;
70146ImageResizer._goodSquareLength = MIN_IMAGE_DIM;
70147
70148/***/ }),
70149/* 63 */
70150/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
70151
70152
70153
70154Object.defineProperty(exports, "__esModule", ({
70155  value: true
70156}));
70157exports.MurmurHash3_64 = void 0;
70158var _util = __w_pdfjs_require__(2);
70159const SEED = 0xc3d2e1f0;
70160const MASK_HIGH = 0xffff0000;
70161const MASK_LOW = 0xffff;
70162class MurmurHash3_64 {
70163  constructor(seed) {
70164    this.h1 = seed ? seed & 0xffffffff : SEED;
70165    this.h2 = seed ? seed & 0xffffffff : SEED;
70166  }
70167  update(input) {
70168    let data, length;
70169    if (typeof input === "string") {
70170      data = new Uint8Array(input.length * 2);
70171      length = 0;
70172      for (let i = 0, ii = input.length; i < ii; i++) {
70173        const code = input.charCodeAt(i);
70174        if (code <= 0xff) {
70175          data[length++] = code;
70176        } else {
70177          data[length++] = code >>> 8;
70178          data[length++] = code & 0xff;
70179        }
70180      }
70181    } else if ((0, _util.isArrayBuffer)(input)) {
70182      data = input.slice();
70183      length = data.byteLength;
70184    } else {
70185      throw new Error("Wrong data format in MurmurHash3_64_update. " + "Input must be a string or array.");
70186    }
70187    const blockCounts = length >> 2;
70188    const tailLength = length - blockCounts * 4;
70189    const dataUint32 = new Uint32Array(data.buffer, 0, blockCounts);
70190    let k1 = 0,
70191      k2 = 0;
70192    let h1 = this.h1,
70193      h2 = this.h2;
70194    const C1 = 0xcc9e2d51,
70195      C2 = 0x1b873593;
70196    const C1_LOW = C1 & MASK_LOW,
70197      C2_LOW = C2 & MASK_LOW;
70198    for (let i = 0; i < blockCounts; i++) {
70199      if (i & 1) {
vendor: 2,407 bytes, lines 70200-70277
70200        k1 = dataUint32[i];
70201        k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
70202        k1 = k1 << 15 | k1 >>> 17;
70203        k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
70204        h1 ^= k1;
70205        h1 = h1 << 13 | h1 >>> 19;
70206        h1 = h1 * 5 + 0xe6546b64;
70207      } else {
70208        k2 = dataUint32[i];
70209        k2 = k2 * C1 & MASK_HIGH | k2 * C1_LOW & MASK_LOW;
70210        k2 = k2 << 15 | k2 >>> 17;
70211        k2 = k2 * C2 & MASK_HIGH | k2 * C2_LOW & MASK_LOW;
70212        h2 ^= k2;
70213        h2 = h2 << 13 | h2 >>> 19;
70214        h2 = h2 * 5 + 0xe6546b64;
70215      }
70216    }
70217    k1 = 0;
70218    switch (tailLength) {
70219      case 3:
70220        k1 ^= data[blockCounts * 4 + 2] << 16;
70221      case 2:
70222        k1 ^= data[blockCounts * 4 + 1] << 8;
70223      case 1:
70224        k1 ^= data[blockCounts * 4];
70225        k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
70226        k1 = k1 << 15 | k1 >>> 17;
70227        k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
70228        if (blockCounts & 1) {
70229          h1 ^= k1;
70230        } else {
70231          h2 ^= k1;
70232        }
70233    }
70234    this.h1 = h1;
70235    this.h2 = h2;
70236  }
70237  hexdigest() {
70238    let h1 = this.h1,
70239      h2 = this.h2;
70240    h1 ^= h2 >>> 1;
70241    h1 = h1 * 0xed558ccd & MASK_HIGH | h1 * 0x8ccd & MASK_LOW;
70242    h2 = h2 * 0xff51afd7 & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xafd7ed55 & MASK_HIGH) >>> 16;
70243    h1 ^= h2 >>> 1;
70244    h1 = h1 * 0x1a85ec53 & MASK_HIGH | h1 * 0xec53 & MASK_LOW;
70245    h2 = h2 * 0xc4ceb9fe & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xb9fe1a85 & MASK_HIGH) >>> 16;
70246    h1 ^= h2 >>> 1;
70247    return (h1 >>> 0).toString(16).padStart(8, "0") + (h2 >>> 0).toString(16).padStart(8, "0");
70248  }
70249}
70250exports.MurmurHash3_64 = MurmurHash3_64;
70251
70252/***/ }),
70253/* 64 */
70254/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
70255
70256
70257
70258Object.defineProperty(exports, "__esModule", ({
70259  value: true
70260}));
70261exports.OperatorList = void 0;
70262var _util = __w_pdfjs_require__(2);
70263function addState(parentState, pattern, checkFn, iterateFn, processFn) {
70264  let state = parentState;
70265  for (let i = 0, ii = pattern.length - 1; i < ii; i++) {
70266    const item = pattern[i];
70267    state = state[item] ||= [];
70268  }
70269  state[pattern.at(-1)] = {
70270    checkFn,
70271    iterateFn,
70272    processFn
70273  };
70274}
70275const InitialState = [];
70276addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintInlineImageXObject, _util.OPS.restore], null, function iterateInlineImageGroup(context, i) {
70277  const fnArray = context.fnArray;
vendor: 3,513 bytes, lines 70278-70373
70278  const iFirstSave = context.iCurr - 3;
70279  const pos = (i - iFirstSave) % 4;
70280  switch (pos) {
70281    case 0:
70282      return fnArray[i] === _util.OPS.save;
70283    case 1:
70284      return fnArray[i] === _util.OPS.transform;
70285    case 2:
70286      return fnArray[i] === _util.OPS.paintInlineImageXObject;
70287    case 3:
70288      return fnArray[i] === _util.OPS.restore;
70289  }
70290  throw new Error(`iterateInlineImageGroup - invalid pos: ${pos}`);
70291}, function foundInlineImageGroup(context, i) {
70292  const MIN_IMAGES_IN_INLINE_IMAGES_BLOCK = 10;
70293  const MAX_IMAGES_IN_INLINE_IMAGES_BLOCK = 200;
70294  const MAX_WIDTH = 1000;
70295  const IMAGE_PADDING = 1;
70296  const fnArray = context.fnArray,
70297    argsArray = context.argsArray;
70298  const curr = context.iCurr;
70299  const iFirstSave = curr - 3;
70300  const iFirstTransform = curr - 2;
70301  const iFirstPIIXO = curr - 1;
70302  const count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_INLINE_IMAGES_BLOCK);
70303  if (count < MIN_IMAGES_IN_INLINE_IMAGES_BLOCK) {
70304    return i - (i - iFirstSave) % 4;
70305  }
70306  let maxX = 0;
70307  const map = [];
70308  let maxLineHeight = 0;
70309  let currentX = IMAGE_PADDING,
70310    currentY = IMAGE_PADDING;
70311  for (let q = 0; q < count; q++) {
70312    const transform = argsArray[iFirstTransform + (q << 2)];
70313    const img = argsArray[iFirstPIIXO + (q << 2)][0];
70314    if (currentX + img.width > MAX_WIDTH) {
70315      maxX = Math.max(maxX, currentX);
70316      currentY += maxLineHeight + 2 * IMAGE_PADDING;
70317      currentX = 0;
70318      maxLineHeight = 0;
70319    }
70320    map.push({
70321      transform,
70322      x: currentX,
70323      y: currentY,
70324      w: img.width,
70325      h: img.height
70326    });
70327    currentX += img.width + 2 * IMAGE_PADDING;
70328    maxLineHeight = Math.max(maxLineHeight, img.height);
70329  }
70330  const imgWidth = Math.max(maxX, currentX) + IMAGE_PADDING;
70331  const imgHeight = currentY + maxLineHeight + IMAGE_PADDING;
70332  const imgData = new Uint8Array(imgWidth * imgHeight * 4);
70333  const imgRowSize = imgWidth << 2;
70334  for (let q = 0; q < count; q++) {
70335    const data = argsArray[iFirstPIIXO + (q << 2)][0].data;
70336    const rowSize = map[q].w << 2;
70337    let dataOffset = 0;
70338    let offset = map[q].x + map[q].y * imgWidth << 2;
70339    imgData.set(data.subarray(0, rowSize), offset - imgRowSize);
70340    for (let k = 0, kk = map[q].h; k < kk; k++) {
70341      imgData.set(data.subarray(dataOffset, dataOffset + rowSize), offset);
70342      dataOffset += rowSize;
70343      offset += imgRowSize;
70344    }
70345    imgData.set(data.subarray(dataOffset - rowSize, dataOffset), offset);
70346    while (offset >= 0) {
70347      data[offset - 4] = data[offset];
70348      data[offset - 3] = data[offset + 1];
70349      data[offset - 2] = data[offset + 2];
70350      data[offset - 1] = data[offset + 3];
70351      data[offset + rowSize] = data[offset + rowSize - 4];
70352      data[offset + rowSize + 1] = data[offset + rowSize - 3];
70353      data[offset + rowSize + 2] = data[offset + rowSize - 2];
70354      data[offset + rowSize + 3] = data[offset + rowSize - 1];
70355      offset -= imgRowSize;
70356    }
70357  }
70358  const img = {
70359    width: imgWidth,
70360    height: imgHeight
70361  };
70362  if (context.isOffscreenCanvasSupported) {
70363    const canvas = new OffscreenCanvas(imgWidth, imgHeight);
70364    const ctx = canvas.getContext("2d");
70365    ctx.putImageData(new ImageData(new Uint8ClampedArray(imgData.buffer), imgWidth, imgHeight), 0, 0);
70366    img.bitmap = canvas.transferToImageBitmap();
70367    img.data = null;
70368  } else {
70369    img.kind = _util.ImageKind.RGBA_32BPP;
70370    img.data = imgData;
70371  }
70372  fnArray.splice(iFirstSave, count * 4, _util.OPS.paintInlineImageXObjectGroup);
70373  argsArray.splice(iFirstSave, count * 4, [img
vendor: 8,763 bytes, lines 70373-70601
70373, map]);
70374  return iFirstSave + 1;
70375});
70376addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageMaskXObject, _util.OPS.restore], null, function iterateImageMaskGroup(context, i) {
70377  const fnArray = context.fnArray;
70378  const iFirstSave = context.iCurr - 3;
70379  const pos = (i - iFirstSave) % 4;
70380  switch (pos) {
70381    case 0:
70382      return fnArray[i] === _util.OPS.save;
70383    case 1:
70384      return fnArray[i] === _util.OPS.transform;
70385    case 2:
70386      return fnArray[i] === _util.OPS.paintImageMaskXObject;
70387    case 3:
70388      return fnArray[i] === _util.OPS.restore;
70389  }
70390  throw new Error(`iterateImageMaskGroup - invalid pos: ${pos}`);
70391}, function foundImageMaskGroup(context, i) {
70392  const MIN_IMAGES_IN_MASKS_BLOCK = 10;
70393  const MAX_IMAGES_IN_MASKS_BLOCK = 100;
70394  const MAX_SAME_IMAGES_IN_MASKS_BLOCK = 1000;
70395  const fnArray = context.fnArray,
70396    argsArray = context.argsArray;
70397  const curr = context.iCurr;
70398  const iFirstSave = curr - 3;
70399  const iFirstTransform = curr - 2;
70400  const iFirstPIMXO = curr - 1;
70401  let count = Math.floor((i - iFirstSave) / 4);
70402  if (count < MIN_IMAGES_IN_MASKS_BLOCK) {
70403    return i - (i - iFirstSave) % 4;
70404  }
70405  let isSameImage = false;
70406  let iTransform, transformArgs;
70407  const firstPIMXOArg0 = argsArray[iFirstPIMXO][0];
70408  const firstTransformArg0 = argsArray[iFirstTransform][0],
70409    firstTransformArg1 = argsArray[iFirstTransform][1],
70410    firstTransformArg2 = argsArray[iFirstTransform][2],
70411    firstTransformArg3 = argsArray[iFirstTransform][3];
70412  if (firstTransformArg1 === firstTransformArg2) {
70413    isSameImage = true;
70414    iTransform = iFirstTransform + 4;
70415    let iPIMXO = iFirstPIMXO + 4;
70416    for (let q = 1; q < count; q++, iTransform += 4, iPIMXO += 4) {
70417      transformArgs = argsArray[iTransform];
70418      if (argsArray[iPIMXO][0] !== firstPIMXOArg0 || transformArgs[0] !== firstTransformArg0 || transformArgs[1] !== firstTransformArg1 || transformArgs[2] !== firstTransformArg2 || transformArgs[3] !== firstTransformArg3) {
70419        if (q < MIN_IMAGES_IN_MASKS_BLOCK) {
70420          isSameImage = false;
70421        } else {
70422          count = q;
70423        }
70424        break;
70425      }
70426    }
70427  }
70428  if (isSameImage) {
70429    count = Math.min(count, MAX_SAME_IMAGES_IN_MASKS_BLOCK);
70430    const positions = new Float32Array(count * 2);
70431    iTransform = iFirstTransform;
70432    for (let q = 0; q < count; q++, iTransform += 4) {
70433      transformArgs = argsArray[iTransform];
70434      positions[q << 1] = transformArgs[4];
70435      positions[(q << 1) + 1] = transformArgs[5];
70436    }
70437    fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectRepeat);
70438    argsArray.splice(iFirstSave, count * 4, [firstPIMXOArg0, firstTransformArg0, firstTransformArg1, firstTransformArg2, firstTransformArg3, positions]);
70439  } else {
70440    count = Math.min(count, MAX_IMAGES_IN_MASKS_BLOCK);
70441    const images = [];
70442    for (let q = 0; q < count; q++) {
70443      transformArgs = argsArray[iFirstTransform + (q << 2)];
70444      const maskParams = argsArray[iFirstPIMXO + (q << 2)][0];
70445      images.push({
70446        data: maskParams.data,
70447        width: maskParams.width,
70448        height: maskParams.height,
70449        interpolate: maskParams.interpolate,
70450        count: maskParams.count,
70451        transform: transformArgs
70452      });
70453    }
70454    fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectGroup);
70455    argsArray.splice(iFirstSave, count * 4, [images]);
70456  }
70457  return iFirstSave + 1;
70458});
70459addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageXObject, _util.OPS.restore], function (context) {
70460  const argsArray = context.argsArray;
70461  const iFirstTransform = context.iCurr - 2;
70462  return argsArray[iFirstTransform][1] === 0 && argsArray[iFirstTransform][2] === 0;
70463}, function iterateImageGroup(context, i) {
70464  const fnArray = context.fnArray,
70465    argsArray = context.argsArray;
70466  const iFirstSave = context.iCurr - 3;
70467  const pos = (i - iFirstSave) % 4;
70468  switch (pos) {
70469    case 0:
70470      return fnArray[i] === _util.OPS.save;
70471    case 1:
70472      if (fnArray[i] !== _util.OPS.transform) {
70473        return false;
70474      }
70475      const iFirstTransform = context.iCurr - 2;
70476      const firstTransformArg0 = argsArray[iFirstTransform][0];
70477      const firstTransformArg3 = argsArray[iFirstTransform][3];
70478      if (argsArray[i][0] !== firstTransformArg0 || argsArray[i][1] !== 0 || argsArray[i][2] !== 0 || argsArray[i][3] !== firstTransformArg3) {
70479        return false;
70480      }
70481      return true;
70482    case 2:
70483      if (fnArray[i] !== _util.OPS.paintImageXObject) {
70484        return false;
70485      }
70486      const iFirstPIXO = context.iCurr - 1;
70487      const firstPIXOArg0 = argsArray[iFirstPIXO][0];
70488      if (argsArray[i][0] !== firstPIXOArg0) {
70489        return false;
70490      }
70491      return true;
70492    case 3:
70493      return fnArray[i] === _util.OPS.restore;
70494  }
70495  throw new Error(`iterateImageGroup - invalid pos: ${pos}`);
70496}, function (context, i) {
70497  const MIN_IMAGES_IN_BLOCK = 3;
70498  const MAX_IMAGES_IN_BLOCK = 1000;
70499  const fnArray = context.fnArray,
70500    argsArray = context.argsArray;
70501  const curr = context.iCurr;
70502  const iFirstSave = curr - 3;
70503  const iFirstTransform = curr - 2;
70504  const iFirstPIXO = curr - 1;
70505  const firstPIXOArg0 = argsArray[iFirstPIXO][0];
70506  const firstTransformArg0 = argsArray[iFirstTransform][0];
70507  const firstTransformArg3 = argsArray[iFirstTransform][3];
70508  const count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_BLOCK);
70509  if (count < MIN_IMAGES_IN_BLOCK) {
70510    return i - (i - iFirstSave) % 4;
70511  }
70512  const positions = new Float32Array(count * 2);
70513  let iTransform = iFirstTransform;
70514  for (let q = 0; q < count; q++, iTransform += 4) {
70515    const transformArgs = argsArray[iTransform];
70516    positions[q << 1] = transformArgs[4];
70517    positions[(q << 1) + 1] = transformArgs[5];
70518  }
70519  const args = [firstPIXOArg0, firstTransformArg0, firstTransformArg3, positions];
70520  fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageXObjectRepeat);
70521  argsArray.splice(iFirstSave, count * 4, args);
70522  return iFirstSave + 1;
70523});
70524addState(InitialState, [_util.OPS.beginText, _util.OPS.setFont, _util.OPS.setTextMatrix, _util.OPS.showText, _util.OPS.endText], null, function iterateShowTextGroup(context, i) {
70525  const fnArray = context.fnArray,
70526    argsArray = context.argsArray;
70527  const iFirstSave = context.iCurr - 4;
70528  const pos = (i - iFirstSave) % 5;
70529  switch (pos) {
70530    case 0:
70531      return fnArray[i] === _util.OPS.beginText;
70532    case 1:
70533      return fnArray[i] === _util.OPS.setFont;
70534    case 2:
70535      return fnArray[i] === _util.OPS.setTextMatrix;
70536    case 3:
70537      if (fnArray[i] !== _util.OPS.showText) {
70538        return false;
70539      }
70540      const iFirstSetFont = context.iCurr - 3;
70541      const firstSetFontArg0 = argsArray[iFirstSetFont][0];
70542      const firstSetFontArg1 = argsArray[iFirstSetFont][1];
70543      if (argsArray[i][0] !== firstSetFontArg0 || argsArray[i][1] !== firstSetFontArg1) {
70544        return false;
70545      }
70546      return true;
70547    case 4:
70548      return fnArray[i] === _util.OPS.endText;
70549  }
70550  throw new Error(`iterateShowTextGroup - invalid pos: ${pos}`);
70551}, function (context, i) {
70552  const MIN_CHARS_IN_BLOCK = 3;
70553  const MAX_CHARS_IN_BLOCK = 1000;
70554  const fnArray = context.fnArray,
70555    argsArray = context.argsArray;
70556  const curr = context.iCurr;
70557  const iFirstBeginText = curr - 4;
70558  const iFirstSetFont = curr - 3;
70559  const iFirstSetTextMatrix = curr - 2;
70560  const iFirstShowText = curr - 1;
70561  const iFirstEndText = curr;
70562  const firstSetFontArg0 = argsArray[iFirstSetFont][0];
70563  const firstSetFontArg1 = argsArray[iFirstSetFont][1];
70564  let count = Math.min(Math.floor((i - iFirstBeginText) / 5), MAX_CHARS_IN_BLOCK);
70565  if (count < MIN_CHARS_IN_BLOCK) {
70566    return i - (i - iFirstBeginText) % 5;
70567  }
70568  let iFirst = iFirstBeginText;
70569  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) {
70570    count++;
70571    iFirst -= 5;
70572  }
70573  let iEndText = iFirst + 4;
70574  for (let q = 1; q < count; q++) {
70575    fnArray.splice(iEndText, 3);
70576    argsArray.splice(iEndText, 3);
70577    iEndText += 2;
70578  }
70579  return iEndText + 1;
70580});
70581class NullOptimizer {
70582  constructor(queue) {
70583    this.queue = queue;
70584  }
70585  _optimize() {}
70586  push(fn, args) {
70587    this.queue.fnArray.push(fn);
70588    this.queue.argsArray.push(args);
70589    this._optimize();
70590  }
70591  flush() {}
70592  reset() {}
70593}
70594class QueueOptimizer extends NullOptimizer {
70595  constructor(queue) {
70596    super(queue);
70597    this.state = null;
70598    this.context = {
70599      iCurr: 0,
70600      fnArray: queue.fnArray,
70601      argsArray: queue.argsArray
vendor: 19,506 bytes, lines 70601-71285
70601,
70602      isOffscreenCanvasSupported: false
70603    };
70604    this.match = null;
70605    this.lastProcessed = 0;
70606  }
70607  set isOffscreenCanvasSupported(value) {
70608    this.context.isOffscreenCanvasSupported = value;
70609  }
70610  _optimize() {
70611    const fnArray = this.queue.fnArray;
70612    let i = this.lastProcessed,
70613      ii = fnArray.length;
70614    let state = this.state;
70615    let match = this.match;
70616    if (!state && !match && i + 1 === ii && !InitialState[fnArray[i]]) {
70617      this.lastProcessed = ii;
70618      return;
70619    }
70620    const context = this.context;
70621    while (i < ii) {
70622      if (match) {
70623        const iterate = (0, match.iterateFn)(context, i);
70624        if (iterate) {
70625          i++;
70626          continue;
70627        }
70628        i = (0, match.processFn)(context, i + 1);
70629        ii = fnArray.length;
70630        match = null;
70631        state = null;
70632        if (i >= ii) {
70633          break;
70634        }
70635      }
70636      state = (state || InitialState)[fnArray[i]];
70637      if (!state || Array.isArray(state)) {
70638        i++;
70639        continue;
70640      }
70641      context.iCurr = i;
70642      i++;
70643      if (state.checkFn && !(0, state.checkFn)(context)) {
70644        state = null;
70645        continue;
70646      }
70647      match = state;
70648      state = null;
70649    }
70650    this.state = state;
70651    this.match = match;
70652    this.lastProcessed = i;
70653  }
70654  flush() {
70655    while (this.match) {
70656      const length = this.queue.fnArray.length;
70657      this.lastProcessed = (0, this.match.processFn)(this.context, length);
70658      this.match = null;
70659      this.state = null;
70660      this._optimize();
70661    }
70662  }
70663  reset() {
70664    this.state = null;
70665    this.match = null;
70666    this.lastProcessed = 0;
70667  }
70668}
70669class OperatorList {
70670  static CHUNK_SIZE = 1000;
70671  static CHUNK_SIZE_ABOUT = this.CHUNK_SIZE - 5;
70672  constructor(intent = 0, streamSink) {
70673    this._streamSink = streamSink;
70674    this.fnArray = [];
70675    this.argsArray = [];
70676    this.optimizer = streamSink && !(intent & _util.RenderingIntentFlag.OPLIST) ? new QueueOptimizer(this) : new NullOptimizer(this);
70677    this.dependencies = new Set();
70678    this._totalLength = 0;
70679    this.weight = 0;
70680    this._resolved = streamSink ? null : Promise.resolve();
70681  }
70682  set isOffscreenCanvasSupported(value) {
70683    this.optimizer.isOffscreenCanvasSupported = value;
70684  }
70685  get length() {
70686    return this.argsArray.length;
70687  }
70688  get ready() {
70689    return this._resolved || this._streamSink.ready;
70690  }
70691  get totalLength() {
70692    return this._totalLength + this.length;
70693  }
70694  addOp(fn, args) {
70695    this.optimizer.push(fn, args);
70696    this.weight++;
70697    if (this._streamSink) {
70698      if (this.weight >= OperatorList.CHUNK_SIZE) {
70699        this.flush();
70700      } else if (this.weight >= OperatorList.CHUNK_SIZE_ABOUT && (fn === _util.OPS.restore || fn === _util.OPS.endText)) {
70701        this.flush();
70702      }
70703    }
70704  }
70705  addImageOps(fn, args, optionalContent) {
70706    if (optionalContent !== undefined) {
70707      this.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
70708    }
70709    this.addOp(fn, args);
70710    if (optionalContent !== undefined) {
70711      this.addOp(_util.OPS.endMarkedContent, []);
70712    }
70713  }
70714  addDependency(dependency) {
70715    if (this.dependencies.has(dependency)) {
70716      return;
70717    }
70718    this.dependencies.add(dependency);
70719    this.addOp(_util.OPS.dependency, [dependency]);
70720  }
70721  addDependencies(dependencies) {
70722    for (const dependency of dependencies) {
70723      this.addDependency(dependency);
70724    }
70725  }
70726  addOpList(opList) {
70727    if (!(opList instanceof OperatorList)) {
70728      (0, _util.warn)('addOpList - ignoring invalid "opList" parameter.');
70729      return;
70730    }
70731    for (const dependency of opList.dependencies) {
70732      this.dependencies.add(dependency);
70733    }
70734    for (let i = 0, ii = opList.length; i < ii; i++) {
70735      this.addOp(opList.fnArray[i], opList.argsArray[i]);
70736    }
70737  }
70738  getIR() {
70739    return {
70740      fnArray: this.fnArray,
70741      argsArray: this.argsArray,
70742      length: this.length
70743    };
70744  }
70745  get _transfers() {
70746    const transfers = [];
70747    const {
70748      fnArray,
70749      argsArray,
70750      length
70751    } = this;
70752    for (let i = 0; i < length; i++) {
70753      switch (fnArray[i]) {
70754        case _util.OPS.paintInlineImageXObject:
70755        case _util.OPS.paintInlineImageXObjectGroup:
70756        case _util.OPS.paintImageMaskXObject:
70757          const arg = argsArray[i][0];
70758          if (!arg.cached && arg.data?.buffer instanceof ArrayBuffer) {
70759            transfers.push(arg.data.buffer);
70760          }
70761          break;
70762      }
70763    }
70764    return transfers;
70765  }
70766  flush(lastChunk = false, separateAnnots = null) {
70767    this.optimizer.flush();
70768    const length = this.length;
70769    this._totalLength += length;
70770    this._streamSink.enqueue({
70771      fnArray: this.fnArray,
70772      argsArray: this.argsArray,
70773      lastChunk,
70774      separateAnnots,
70775      length
70776    }, 1, this._transfers);
70777    this.dependencies.clear();
70778    this.fnArray.length = 0;
70779    this.argsArray.length = 0;
70780    this.weight = 0;
70781    this.optimizer.reset();
70782  }
70783}
70784exports.OperatorList = OperatorList;
70785
70786/***/ }),
70787/* 65 */
70788/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
70789
70790
70791
70792Object.defineProperty(exports, "__esModule", ({
70793  value: true
70794}));
70795exports.PDFImage = void 0;
70796var _util = __w_pdfjs_require__(2);
70797var _image_utils = __w_pdfjs_require__(28);
70798var _base_stream = __w_pdfjs_require__(5);
70799var _colorspace = __w_pdfjs_require__(12);
70800var _decode_stream = __w_pdfjs_require__(18);
70801var _image_resizer = __w_pdfjs_require__(62);
70802var _jpeg_stream = __w_pdfjs_require__(26);
70803var _jpx = __w_pdfjs_require__(30);
70804var _primitives = __w_pdfjs_require__(4);
70805function decodeAndClamp(value, addend, coefficient, max) {
70806  value = addend + value * coefficient;
70807  if (value < 0) {
70808    value = 0;
70809  } else if (value > max) {
70810    value = max;
70811  }
70812  return value;
70813}
70814function resizeImageMask(src, bpc, w1, h1, w2, h2) {
70815  const length = w2 * h2;
70816  let dest;
70817  if (bpc <= 8) {
70818    dest = new Uint8Array(length);
70819  } else if (bpc <= 16) {
70820    dest = new Uint16Array(length);
70821  } else {
70822    dest = new Uint32Array(length);
70823  }
70824  const xRatio = w1 / w2;
70825  const yRatio = h1 / h2;
70826  let i,
70827    j,
70828    py,
70829    newIndex = 0,
70830    oldIndex;
70831  const xScaled = new Uint16Array(w2);
70832  const w1Scanline = w1;
70833  for (i = 0; i < w2; i++) {
70834    xScaled[i] = Math.floor(i * xRatio);
70835  }
70836  for (i = 0; i < h2; i++) {
70837    py = Math.floor(i * yRatio) * w1Scanline;
70838    for (j = 0; j < w2; j++) {
70839      oldIndex = py + xScaled[j];
70840      dest[newIndex++] = src[oldIndex];
70841    }
70842  }
70843  return dest;
70844}
70845class PDFImage {
70846  constructor({
70847    xref,
70848    res,
70849    image,
70850    isInline = false,
70851    smask = null,
70852    mask = null,
70853    isMask = false,
70854    pdfFunctionFactory,
70855    localColorSpaceCache
70856  }) {
70857    this.image = image;
70858    const dict = image.dict;
70859    const filter = dict.get("F", "Filter");
70860    let filterName;
70861    if (filter instanceof _primitives.Name) {
70862      filterName = filter.name;
70863    } else if (Array.isArray(filter)) {
70864      const filterZero = xref.fetchIfRef(filter[0]);
70865      if (filterZero instanceof _primitives.Name) {
70866        filterName = filterZero.name;
70867      }
70868    }
70869    switch (filterName) {
70870      case "JPXDecode":
70871        const jpxImage = new _jpx.JpxImage();
70872        jpxImage.parseImageProperties(image.stream);
70873        image.stream.reset();
70874        image.width = jpxImage.width;
70875        image.height = jpxImage.height;
70876        image.bitsPerComponent = jpxImage.bitsPerComponent;
70877        image.numComps = jpxImage.componentsCount;
70878        break;
70879      case "JBIG2Decode":
70880        image.bitsPerComponent = 1;
70881        image.numComps = 1;
70882        break;
70883    }
70884    let width = dict.get("W", "Width");
70885    let height = dict.get("H", "Height");
70886    if (Number.isInteger(image.width) && image.width > 0 && Number.isInteger(image.height) && image.height > 0 && (image.width !== width || image.height !== height)) {
70887      (0, _util.warn)("PDFImage - using the Width/Height of the image data, " + "rather than the image dictionary.");
70888      width = image.width;
70889      height = image.height;
70890    }
70891    if (width < 1 || height < 1) {
70892      throw new _util.FormatError(`Invalid image width: ${width} or height: ${height}`);
70893    }
70894    this.width = width;
70895    this.height = height;
70896    this.interpolate = dict.get("I", "Interpolate");
70897    this.imageMask = dict.get("IM", "ImageMask") || false;
70898    this.matte = dict.get("Matte") || false;
70899    let bitsPerComponent = image.bitsPerComponent;
70900    if (!bitsPerComponent) {
70901      bitsPerComponent = dict.get("BPC", "BitsPerComponent");
70902      if (!bitsPerComponent) {
70903        if (this.imageMask) {
70904          bitsPerComponent = 1;
70905        } else {
70906          throw new _util.FormatError(`Bits per component missing in image: ${this.imageMask}`);
70907        }
70908      }
70909    }
70910    this.bpc = bitsPerComponent;
70911    if (!this.imageMask) {
70912      let colorSpace = dict.getRaw("CS") || dict.getRaw("ColorSpace");
70913      if (!colorSpace) {
70914        (0, _util.info)("JPX images (which do not require color spaces)");
70915        switch (image.numComps) {
70916          case 1:
70917            colorSpace = _primitives.Name.get("DeviceGray");
70918            break;
70919          case 3:
70920            colorSpace = _primitives.Name.get("DeviceRGB");
70921            break;
70922          case 4:
70923            colorSpace = _primitives.Name.get("DeviceCMYK");
70924            break;
70925          default:
70926            throw new Error(`JPX images with ${image.numComps} color components not supported.`);
70927        }
70928      }
70929      this.colorSpace = _colorspace.ColorSpace.parse({
70930        cs: colorSpace,
70931        xref,
70932        resources: isInline ? res : null,
70933        pdfFunctionFactory,
70934        localColorSpaceCache
70935      });
70936      this.numComps = this.colorSpace.numComps;
70937    }
70938    this.decode = dict.getArray("D", "Decode");
70939    this.needsDecode = false;
70940    if (this.decode && (this.colorSpace && !this.colorSpace.isDefaultDecode(this.decode, bitsPerComponent) || isMask && !_colorspace.ColorSpace.isDefaultDecode(this.decode, 1))) {
70941      this.needsDecode = true;
70942      const max = (1 << bitsPerComponent) - 1;
70943      this.decodeCoefficients = [];
70944      this.decodeAddends = [];
70945      const isIndexed = this.colorSpace?.name === "Indexed";
70946      for (let i = 0, j = 0; i < this.decode.length; i += 2, ++j) {
70947        const dmin = this.decode[i];
70948        const dmax = this.decode[i + 1];
70949        this.decodeCoefficients[j] = isIndexed ? (dmax - dmin) / max : dmax - dmin;
70950        this.decodeAddends[j] = isIndexed ? dmin : max * dmin;
70951      }
70952    }
70953    if (smask) {
70954      this.smask = new PDFImage({
70955        xref,
70956        res,
70957        image: smask,
70958        isInline,
70959        pdfFunctionFactory,
70960        localColorSpaceCache
70961      });
70962    } else if (mask) {
70963      if (mask instanceof _base_stream.BaseStream) {
70964        const maskDict = mask.dict,
70965          imageMask = maskDict.get("IM", "ImageMask");
70966        if (!imageMask) {
70967          (0, _util.warn)("Ignoring /Mask in image without /ImageMask.");
70968        } else {
70969          this.mask = new PDFImage({
70970            xref,
70971            res,
70972            image: mask,
70973            isInline,
70974            isMask: true,
70975            pdfFunctionFactory,
70976            localColorSpaceCache
70977          });
70978        }
70979      } else {
70980        this.mask = mask;
70981      }
70982    }
70983  }
70984  static async buildImage({
70985    xref,
70986    res,
70987    image,
70988    isInline = false,
70989    pdfFunctionFactory,
70990    localColorSpaceCache
70991  }) {
70992    const imageData = image;
70993    let smaskData = null;
70994    let maskData = null;
70995    const smask = image.dict.get("SMask");
70996    const mask = image.dict.get("Mask");
70997    if (smask) {
70998      if (smask instanceof _base_stream.BaseStream) {
70999        smaskData = smask;
71000      } else {
71001        (0, _util.warn)("Unsupported /SMask format.");
71002      }
71003    } else if (mask) {
71004      if (mask instanceof _base_stream.BaseStream || Array.isArray(mask)) {
71005        maskData = mask;
71006      } else {
71007        (0, _util.warn)("Unsupported /Mask format.");
71008      }
71009    }
71010    return new PDFImage({
71011      xref,
71012      res,
71013      image: imageData,
71014      isInline,
71015      smask: smaskData,
71016      mask: maskData,
71017      pdfFunctionFactory,
71018      localColorSpaceCache
71019    });
71020  }
71021  static createRawMask({
71022    imgArray,
71023    width,
71024    height,
71025    imageIsFromDecodeStream,
71026    inverseDecode,
71027    interpolate
71028  }) {
71029    const computedLength = (width + 7 >> 3) * height;
71030    const actualLength = imgArray.byteLength;
71031    const haveFullData = computedLength === actualLength;
71032    let data, i;
71033    if (imageIsFromDecodeStream && (!inverseDecode || haveFullData)) {
71034      data = imgArray;
71035    } else if (!inverseDecode) {
71036      data = new Uint8Array(imgArray);
71037    } else {
71038      data = new Uint8Array(computedLength);
71039      data.set(imgArray);
71040      data.fill(0xff, actualLength);
71041    }
71042    if (inverseDecode) {
71043      for (i = 0; i < actualLength; i++) {
71044        data[i] ^= 0xff;
71045      }
71046    }
71047    return {
71048      data,
71049      width,
71050      height,
71051      interpolate
71052    };
71053  }
71054  static async createMask({
71055    imgArray,
71056    width,
71057    height,
71058    imageIsFromDecodeStream,
71059    inverseDecode,
71060    interpolate,
71061    isOffscreenCanvasSupported = false
71062  }) {
71063    const isSingleOpaquePixel = width === 1 && height === 1 && inverseDecode === (imgArray.length === 0 || !!(imgArray[0] & 128));
71064    if (isSingleOpaquePixel) {
71065      return {
71066        isSingleOpaquePixel
71067      };
71068    }
71069    if (isOffscreenCanvasSupported) {
71070      if (_image_resizer.ImageResizer.needsToBeResized(width, height)) {
71071        const data = new Uint8ClampedArray(width * height * 4);
71072        (0, _image_utils.convertBlackAndWhiteToRGBA)({
71073          src: imgArray,
71074          dest: data,
71075          width,
71076          height,
71077          nonBlackColor: 0,
71078          inverseDecode
71079        });
71080        return _image_resizer.ImageResizer.createImage({
71081          kind: _util.ImageKind.RGBA_32BPP,
71082          data,
71083          width,
71084          height,
71085          interpolate
71086        });
71087      }
71088      const canvas = new OffscreenCanvas(width, height);
71089      const ctx = canvas.getContext("2d");
71090      const imgData = ctx.createImageData(width, height);
71091      (0, _image_utils.convertBlackAndWhiteToRGBA)({
71092        src: imgArray,
71093        dest: imgData.data,
71094        width,
71095        height,
71096        nonBlackColor: 0,
71097        inverseDecode
71098      });
71099      ctx.putImageData(imgData, 0, 0);
71100      const bitmap = canvas.transferToImageBitmap();
71101      return {
71102        data: null,
71103        width,
71104        height,
71105        interpolate,
71106        bitmap
71107      };
71108    }
71109    return this.createRawMask({
71110      imgArray,
71111      width,
71112      height,
71113      inverseDecode,
71114      imageIsFromDecodeStream,
71115      interpolate
71116    });
71117  }
71118  get drawWidth() {
71119    return Math.max(this.width, this.smask?.width || 0, this.mask?.width || 0);
71120  }
71121  get drawHeight() {
71122    return Math.max(this.height, this.smask?.height || 0, this.mask?.height || 0);
71123  }
71124  decodeBuffer(buffer) {
71125    const bpc = this.bpc;
71126    const numComps = this.numComps;
71127    const decodeAddends = this.decodeAddends;
71128    const decodeCoefficients = this.decodeCoefficients;
71129    const max = (1 << bpc) - 1;
71130    let i, ii;
71131    if (bpc === 1) {
71132      for (i = 0, ii = buffer.length; i < ii; i++) {
71133        buffer[i] = +!buffer[i];
71134      }
71135      return;
71136    }
71137    let index = 0;
71138    for (i = 0, ii = this.width * this.height; i < ii; i++) {
71139      for (let j = 0; j < numComps; j++) {
71140        buffer[index] = decodeAndClamp(buffer[index], decodeAddends[j], decodeCoefficients[j], max);
71141        index++;
71142      }
71143    }
71144  }
71145  getComponents(buffer) {
71146    const bpc = this.bpc;
71147    if (bpc === 8) {
71148      return buffer;
71149    }
71150    const width = this.width;
71151    const height = this.height;
71152    const numComps = this.numComps;
71153    const length = width * height * numComps;
71154    let bufferPos = 0;
71155    let output;
71156    if (bpc <= 8) {
71157      output = new Uint8Array(length);
71158    } else if (bpc <= 16) {
71159      output = new Uint16Array(length);
71160    } else {
71161      output = new Uint32Array(length);
71162    }
71163    const rowComps = width * numComps;
71164    const max = (1 << bpc) - 1;
71165    let i = 0,
71166      ii,
71167      buf;
71168    if (bpc === 1) {
71169      let mask, loop1End, loop2End;
71170      for (let j = 0; j < height; j++) {
71171        loop1End = i + (rowComps & ~7);
71172        loop2End = i + rowComps;
71173        while (i < loop1End) {
71174          buf = buffer[bufferPos++];
71175          output[i] = buf >> 7 & 1;
71176          output[i + 1] = buf >> 6 & 1;
71177          output[i + 2] = buf >> 5 & 1;
71178          output[i + 3] = buf >> 4 & 1;
71179          output[i + 4] = buf >> 3 & 1;
71180          output[i + 5] = buf >> 2 & 1;
71181          output[i + 6] = buf >> 1 & 1;
71182          output[i + 7] = buf & 1;
71183          i += 8;
71184        }
71185        if (i < loop2End) {
71186          buf = buffer[bufferPos++];
71187          mask = 128;
71188          while (i < loop2End) {
71189            output[i++] = +!!(buf & mask);
71190            mask >>= 1;
71191          }
71192        }
71193      }
71194    } else {
71195      let bits = 0;
71196      buf = 0;
71197      for (i = 0, ii = length; i < ii; ++i) {
71198        if (i % rowComps === 0) {
71199          buf = 0;
71200          bits = 0;
71201        }
71202        while (bits < bpc) {
71203          buf = buf << 8 | buffer[bufferPos++];
71204          bits += 8;
71205        }
71206        const remainingBits = bits - bpc;
71207        let value = buf >> remainingBits;
71208        if (value < 0) {
71209          value = 0;
71210        } else if (value > max) {
71211          value = max;
71212        }
71213        output[i] = value;
71214        buf &= (1 << remainingBits) - 1;
71215        bits = remainingBits;
71216      }
71217    }
71218    return output;
71219  }
71220  fillOpacity(rgbaBuf, width, height, actualHeight, image) {
71221    const smask = this.smask;
71222    const mask = this.mask;
71223    let alphaBuf, sw, sh, i, ii, j;
71224    if (smask) {
71225      sw = smask.width;
71226      sh = smask.height;
71227      alphaBuf = new Uint8ClampedArray(sw * sh);
71228      smask.fillGrayBuffer(alphaBuf);
71229      if (sw !== width || sh !== height) {
71230        alphaBuf = resizeImageMask(alphaBuf, smask.bpc, sw, sh, width, height);
71231      }
71232    } else if (mask) {
71233      if (mask instanceof PDFImage) {
71234        sw = mask.width;
71235        sh = mask.height;
71236        alphaBuf = new Uint8ClampedArray(sw * sh);
71237        mask.numComps = 1;
71238        mask.fillGrayBuffer(alphaBuf);
71239        for (i = 0, ii = sw * sh; i < ii; ++i) {
71240          alphaBuf[i] = 255 - alphaBuf[i];
71241        }
71242        if (sw !== width || sh !== height) {
71243          alphaBuf = resizeImageMask(alphaBuf, mask.bpc, sw, sh, width, height);
71244        }
71245      } else if (Array.isArray(mask)) {
71246        alphaBuf = new Uint8ClampedArray(width * height);
71247        const numComps = this.numComps;
71248        for (i = 0, ii = width * height; i < ii; ++i) {
71249          let opacity = 0;
71250          const imageOffset = i * numComps;
71251          for (j = 0; j < numComps; ++j) {
71252            const color = image[imageOffset + j];
71253            const maskOffset = j * 2;
71254            if (color < mask[maskOffset] || color > mask[maskOffset + 1]) {
71255              opacity = 255;
71256              break;
71257            }
71258          }
71259          alphaBuf[i] = opacity;
71260        }
71261      } else {
71262        throw new _util.FormatError("Unknown mask format.");
71263      }
71264    }
71265    if (alphaBuf) {
71266      for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
71267        rgbaBuf[j] = alphaBuf[i];
71268      }
71269    } else {
71270      for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
71271        rgbaBuf[j] = 255;
71272      }
71273    }
71274  }
71275  undoPreblend(buffer, width, height) {
71276    const matte = this.smask?.matte;
71277    if (!matte) {
71278      return;
71279    }
71280    const matteRgb = this.colorSpace.getRgb(matte, 0);
71281    const matteR = matteRgb[0];
71282    const matteG = matteRgb[1];
71283    const matteB = matteRgb[2];
71284    const length = width * height * 4;
71285    for (let i = 0; i < length; i += 4) {
71286      const alpha = buffer[i + 3];
71287      if (alpha === 0) {
71288        buffer[i] = 255;
71289        buffer[i + 1] = 255;
71290        buffer[i + 2] = 255;
71291        continue;
71292      }
71293      const k = 255 / alpha;
71294      buffer[i] = (buffer[i] - matteR) * k + matteR;
71295      buffer[i + 1] = (buffer[i + 1] - matteG) * k + matteG;
71296      buffer[i + 2] = (buffer[i + 2] - matteB) * k + matteB;
71297    }
71298  }
71299  async createImageData(forceRGBA = false, isOffscreenCanvasSupported = false) {
71300    const drawWidth = this.drawWidth;
71301    const drawHeight = this.drawHeight;
71302    const imgData = {
71303      width: drawWidth,
71304      height: drawHeight,
71305      interpolate: this.interpolate,
71306      kind: 0,
71307      data: null
71308    };
71309    const numComps = this.numComps;
71310    const originalWidth = this.width;
71311    const originalHeight = this.height;
71312    const bpc = this.bpc;
71313    const rowBytes = originalWidth * numComps * bpc + 7 >> 3;
71314    const mustBeResized = isOffscreenCanvasSupported && _image_resizer.ImageResizer.needsToBeResized(drawWidth, drawHeight);
71315    if (!forceRGBA) {
71316      let kind;
71317      if (this.colorSpace.name === "DeviceGray" && bpc === 1) {
71318        kind = _util.ImageKind.GRAYSCALE_1BPP;
71319      } else if (this.colorSpace.name === "DeviceRGB" && bpc === 8 && !this.needsDecode) {
71320        kind = _util.ImageKind.RGB_24BPP;
71321      }
71322      if (kind && !this.smask && !this.mask && drawWidth === originalWidth && drawHeight === originalHeight) {
71323        const data = this.getImageBytes(originalHeight * rowBytes, {});
71324        if (isOffscreenCanvasSupported) {
71325          if (mustBeResized) {
71326            return _image_resizer.ImageResizer.createImage({
71327              data,
71328              kind,
71329              width: drawWidth,
71330              height: drawHeight,
71331              interpolate: this.interpolate
71332            }, this.needsDecode);
71333          }
71334          return this.createBitmap(kind, originalWidth, originalHeight, data);
71335        }
71336        imgData.kind = kind;
71337        imgData.data = data;
71338        if (this.needsDecode) {
71339          (0, _util.assert)(kind === _util.ImageKind.GRAYSCALE_1BPP, "PDFImage.createImageData: The image must be grayscale.");
71340          const buffer = imgData.data;
71341          for (let i = 0, ii = buffer.length; i < ii; i++) {
71342            buffer[i] ^= 0xff;
71343          }
71344        }
71345        return imgData;
71346      }
71347      if (this.image instanceof _jpeg_stream.JpegStream && !this.smask && !this.mask && !this.needsDecode) {
71348        let imageLength = originalHeight * rowBytes;
71349        if (isOffscreenCanvasSupported && !mustBeResized) {
71350          let isHandled = false;
71351          switch (this.colorSpace.name) {
71352            case "DeviceGray":
71353              imageLength *= 4;
71354              isHandled = true;
71355              break;
71356            case "DeviceRGB":
71357              imageLength = imageLength / 3 * 4;
71358              isHandled = true;
71359              break;
71360            case "DeviceCMYK":
71361              isHandled = true;
71362              break;
71363          }
71364          if (isHandled) {
71365            const rgba = this.getImageBytes(imageLength, {
71366              drawWidth,
71367              drawHeight,
71368              forceRGBA: true
71369            });
71370            return this.createBitmap(_util.ImageKind.RGBA_32BPP, drawWidth, drawHeight, rgba);
71371          }
71372        } else {
71373          switch (this.colorSpace.name) {
71374            case "DeviceGray":
71375              imageLength *= 3;
71376            case "DeviceRGB":
71377            case "DeviceCMYK":
71378              imgData.kind = _util.ImageKind.RGB_24BPP;
71379              imgData.data = this.getImageBytes(imageLength, {
71380                drawWidth,
71381                drawHeight,
71382                forceRGB: true
71383              });
71384              if (mustBeResized) {
71385                return _image_resizer.ImageResizer.createImage(imgData);
71386              }
71387              return imgData;
71388          }
71389        }
71390      }
71391    }
71392    const imgArray = this.getImageBytes(originalHeight * rowBytes, {
71393      internal: true
71394    });
71395    const actualHeight = 0 | imgArray.length / rowBytes * drawHeight / originalHeight;
71396    const comps = this.getComponents(imgArray);
71397    let alpha01, maybeUndoPreblend;
71398    let canvas, ctx, canvasImgData, data;
71399    if (isOffscreenCanvasSupported && !mustBeResized) {
71400      canvas = new OffscreenCanvas(drawWidth, drawHeight);
71401      ctx = canvas.getContext("2d");
71402      canvasImgData = ctx.createImageData(drawWidth, drawHeight);
71403      data = canvasImgData.data;
71404    }
71405    imgData.kind = _util.ImageKind.RGBA_32BPP;
71406    if (!forceRGBA && !this.smask && !this.mask) {
71407      if (!isOffscreenCanvasSupported || mustBeResized) {
71408        imgData.kind = _util.ImageKind.RGB_24BPP;
71409        data = new Uint8ClampedArray(drawWidth * drawHeight * 3);
71410        alpha01 = 0;
71411      } else {
71412        const arr = new Uint32Array(data.buffer);
71413        arr.fill(_util.FeatureTest.isLittleEndian ? 0xff000000 : 0x000000ff);
71414        alpha01 = 1;
71415      }
71416      maybeUndoPreblend = false;
71417    } else {
71418      if (!isOffscreenCanvasSupported || mustBeResized) {
71419        data = new Uint8ClampedArray(drawWidth * drawHeight * 4);
71420      }
71421      alpha01 = 1;
71422      maybeUndoPreblend = true;
71423      this.fillOpacity(data, drawWidth, drawHeight, actualHeight, comps);
71424    }
71425    if (this.needsDecode) {
71426      this.decodeBuffer(comps);
71427    }
71428    this.colorSpace.fillRgb(data, originalWidth, originalHeight, drawWidth, drawHeight, actualHeight, bpc, comps, alpha01);
71429    if (maybeUndoPreblend) {
71430      this.undoPreblend(data, drawWidth, actualHeight);
71431    }
71432    if (isOffscreenCanvasSupported && !mustBeResized) {
71433      ctx.putImageData(canvasImgData, 0, 0);
71434      const bitmap = canvas.transferToImageBitmap();
71435      return {
71436        data: null,
71437        width: drawWidth,
71438        height: drawHeight,
71439        bitmap,
71440        interpolate: this.interpolate
71441      };
71442    }
71443    imgData.data = data;
71444    if (mustBeResized) {
71445      return _image_resizer.ImageResizer.createImage(imgData);
71446    }
71447    return imgData;
71448  }
71449  fillGrayBuffer(buffer) {
71450    const numComps = this.numComps;
71451    if (numComps !== 1) {
71452      throw new _util.FormatError(`Reading gray scale from a color image: ${numComps}`);
71453    }
71454    const width = this.width;
71455    const height = this.height;
71456    const bpc = this.bpc;
71457    const rowBytes = width * numComps * bpc + 7 >> 3;
71458    const imgArray = this.getImageBytes(height * rowBytes, {
71459      internal: true
71460    });
71461    const comps = this.getComponents(imgArray);
71462    let i, length;
71463    if (bpc === 1) {
71464      length = width * height;
71465      if (this.needsDecode) {
71466        for (i = 0; i < length; ++i) {
71467          buffer[i] = comps[i] - 1 & 255;
71468        }
71469      } else {
71470        for (i = 0; i < length; ++i) {
71471          buffer[i] = -comps[i] & 255;
71472        }
71473      }
71474      return;
71475    }
71476    if (this.needsDecode) {
71477      this.decodeBuffer(comps);
71478    }
71479    length = width * height;
71480    const scale = 255 / ((1 << bpc) - 1);
71481    for (i = 0; i < length; ++i) {
71482      buffer[i] = scale * comps[i];
71483    }
71484  }
71485  createBitmap(kind, width, height, src) {
71486    const canvas = new OffscreenCanvas(width, height);
71487    const ctx = canvas.getContext("2d");
71488    let imgData;
71489    if (kind === _util.ImageKind.RGBA_32BPP) {
71490      imgData = new ImageData(src, width, height);
71491    } else {
71492      imgData = ctx.createImageData(width, height);
71493      (0, _image_utils.convertToRGBA)({
71494        kind,
71495        src,
71496        dest: new Uint32Array(imgData.data.buffer),
71497        width,
71498        height,
71499        inverseDecode: this.needsDecode
71500      });
71501    }
71502    ctx.putImageData(imgData, 0, 0);
71503    const bitmap = canvas.transferToImageBitmap();
71504    return {
71505      data: null,
71506      width,
71507      height,
71508      bitmap,
71509      interpolate: this.interpolate
71510    };
71511  }
71512  getImageBytes(length, {
71513    drawWidth,
71514    drawHeight,
71515    forceRGBA = false,
71516    forceRGB = false,
71517    internal = false
71518  }) {
71519    this.image.reset();
71520    this.image.drawWidth = drawWidth || this.width;
71521    this.image.drawHeight = drawHeight || this.height;
71522    this.image.forceRGBA = !!forceRGBA;
71523    this.image.forceRGB = !!forceRGB;
71524    const imageBytes = this.image.getBytes(length);
71525    if (internal || this.image instanceof _decode_stream.DecodeStream) {
71526      return imageBytes;
71527    }
71528    (0, _util.assert)(imageBytes instanceof Uint8Array, 'PDFImage.getImageBytes: Unsupported "imageBytes" type.');
71529    return new Uint8Array(imageBytes);
71530  }
71531}
71532exports.PDFImage = PDFImage;
71533
71534/***/ }),
71535/* 66 */
71536/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
71537
71538
71539
71540Object.defineProperty(exports, "__esModule", ({
71541  value: true
71542}));
71543exports.Catalog = void 0;
71544var _core_utils = __w_pdfjs_require__(3);
71545var _util = __w_pdfjs_require__(2);
71546var _primitives = __w_pdfjs_require__(4);
71547var _name_number_tree = __w_pdfjs_require__(67);
71548var _base_stream = __w_pdfjs_require__(5);
71549var _cleanup_helper = __w_pdfjs_require__(68);
71550var _colorspace = __w_pdfjs_require__(12);
71551var _file_spec = __w_pdfjs_require__(69);
71552var _image_utils = __w_pdfjs_require__(59);
71553var _metadata_parser = __w_pdfjs_require__(70);
71554var _struct_tree = __w_pdfjs_require__(72);
71555function fetchDestination(dest) {
71556  if (dest instanceof _primitives.Dict) {
71557    dest = dest.get("D");
71558  }
71559  return Array.isArray(dest) ? dest : null;
71560}
71561class Catalog {
71562  constructor(pdfManager, xref) {
71563    this.pdfManager = pdfManager;
71564    this.xref = xref;
71565    this._catDict = xref.getCatalogObj();
71566    if (!(this._catDict instanceof _primitives.Dict)) {
71567      throw new _util.FormatError("Catalog object is not a dictionary.");
71568    }
71569    this.toplevelPagesDict;
71570    this._actualNumPages = null;
71571    this.fontCache = new _primitives.RefSetCache();
71572    this.builtInCMapCache = new Map();
71573    this.standardFontDataCache = new Map();
71574    this.globalImageCache = new _image_utils.GlobalImageCache();
71575    this.pageKidsCountCache = new _primitives.RefSetCache();
71576    this.pageIndexCache = new _primitives.RefSetCache();
71577    this.nonBlendModesSet = new _primitives.RefSet();
71578    this.systemFontCache = new Map();
71579  }
71580  cloneDict() {
71581    return this._catDict.clone();
71582  }
71583  get version() {
71584    const version = this._catDict.get("Version");
71585    if (version instanceof _primitives.Name) {
71586      if (_core_utils.PDF_VERSION_REGEXP.test(version.name)) {
71587        return (0, _util.shadow)(this, "version", version.name);
71588      }
71589      (0, _util.warn)(`Invalid PDF catalog version: ${version.name}`);
71590    }
71591    return (0, _util.shadow)(this, "version", null);
71592  }
71593  get lang() {
71594    const lang = this._catDict.get("Lang");
71595    return (0, _util.shadow)(this, "lang", typeof lang === "string" ? (0, _util.stringToPDFString)(lang) : null);
71596  }
71597  get needsRendering() {
71598    const needsRendering = this._catDict.get("NeedsRendering");
71599    return (0, _util.shadow)(this, "needsRendering", typeof needsRendering === "boolean" ? needsRendering : false);
71600  }
71601  get collection() {
vendor: 5,122 bytes, lines 71602-71769
71602    let collection = null;
71603    try {
71604      const obj = this._catDict.get("Collection");
71605      if (obj instanceof _primitives.Dict && obj.size > 0) {
71606        collection = obj;
71607      }
71608    } catch (ex) {
71609      if (ex instanceof _core_utils.MissingDataException) {
71610        throw ex;
71611      }
71612      (0, _util.info)("Cannot fetch Collection entry; assuming no collection is present.");
71613    }
71614    return (0, _util.shadow)(this, "collection", collection);
71615  }
71616  get acroForm() {
71617    let acroForm = null;
71618    try {
71619      const obj = this._catDict.get("AcroForm");
71620      if (obj instanceof _primitives.Dict && obj.size > 0) {
71621        acroForm = obj;
71622      }
71623    } catch (ex) {
71624      if (ex instanceof _core_utils.MissingDataException) {
71625        throw ex;
71626      }
71627      (0, _util.info)("Cannot fetch AcroForm entry; assuming no forms are present.");
71628    }
71629    return (0, _util.shadow)(this, "acroForm", acroForm);
71630  }
71631  get acroFormRef() {
71632    const value = this._catDict.getRaw("AcroForm");
71633    return (0, _util.shadow)(this, "acroFormRef", value instanceof _primitives.Ref ? value : null);
71634  }
71635  get metadata() {
71636    const streamRef = this._catDict.getRaw("Metadata");
71637    if (!(streamRef instanceof _primitives.Ref)) {
71638      return (0, _util.shadow)(this, "metadata", null);
71639    }
71640    let metadata = null;
71641    try {
71642      const stream = this.xref.fetch(streamRef, !this.xref.encrypt?.encryptMetadata);
71643      if (stream instanceof _base_stream.BaseStream && stream.dict instanceof _primitives.Dict) {
71644        const type = stream.dict.get("Type");
71645        const subtype = stream.dict.get("Subtype");
71646        if ((0, _primitives.isName)(type, "Metadata") && (0, _primitives.isName)(subtype, "XML")) {
71647          const data = (0, _util.stringToUTF8String)(stream.getString());
71648          if (data) {
71649            metadata = new _metadata_parser.MetadataParser(data).serializable;
71650          }
71651        }
71652      }
71653    } catch (ex) {
71654      if (ex instanceof _core_utils.MissingDataException) {
71655        throw ex;
71656      }
71657      (0, _util.info)(`Skipping invalid Metadata: "${ex}".`);
71658    }
71659    return (0, _util.shadow)(this, "metadata", metadata);
71660  }
71661  get markInfo() {
71662    let markInfo = null;
71663    try {
71664      markInfo = this._readMarkInfo();
71665    } catch (ex) {
71666      if (ex instanceof _core_utils.MissingDataException) {
71667        throw ex;
71668      }
71669      (0, _util.warn)("Unable to read mark info.");
71670    }
71671    return (0, _util.shadow)(this, "markInfo", markInfo);
71672  }
71673  _readMarkInfo() {
71674    const obj = this._catDict.get("MarkInfo");
71675    if (!(obj instanceof _primitives.Dict)) {
71676      return null;
71677    }
71678    const markInfo = {
71679      Marked: false,
71680      UserProperties: false,
71681      Suspects: false
71682    };
71683    for (const key in markInfo) {
71684      const value = obj.get(key);
71685      if (typeof value === "boolean") {
71686        markInfo[key] = value;
71687      }
71688    }
71689    return markInfo;
71690  }
71691  get structTreeRoot() {
71692    let structTree = null;
71693    try {
71694      structTree = this._readStructTreeRoot();
71695    } catch (ex) {
71696      if (ex instanceof _core_utils.MissingDataException) {
71697        throw ex;
71698      }
71699      (0, _util.warn)("Unable read to structTreeRoot info.");
71700    }
71701    return (0, _util.shadow)(this, "structTreeRoot", structTree);
71702  }
71703  _readStructTreeRoot() {
71704    const rawObj = this._catDict.getRaw("StructTreeRoot");
71705    const obj = this.xref.fetchIfRef(rawObj);
71706    if (!(obj instanceof _primitives.Dict)) {
71707      return null;
71708    }
71709    const root = new _struct_tree.StructTreeRoot(obj, rawObj);
71710    root.init();
71711    return root;
71712  }
71713  get toplevelPagesDict() {
71714    const pagesObj = this._catDict.get("Pages");
71715    if (!(pagesObj instanceof _primitives.Dict)) {
71716      throw new _util.FormatError("Invalid top-level pages dictionary.");
71717    }
71718    return (0, _util.shadow)(this, "toplevelPagesDict", pagesObj);
71719  }
71720  get documentOutline() {
71721    let obj = null;
71722    try {
71723      obj = this._readDocumentOutline();
71724    } catch (ex) {
71725      if (ex instanceof _core_utils.MissingDataException) {
71726        throw ex;
71727      }
71728      (0, _util.warn)("Unable to read document outline.");
71729    }
71730    return (0, _util.shadow)(this, "documentOutline", obj);
71731  }
71732  _readDocumentOutline() {
71733    let obj = this._catDict.get("Outlines");
71734    if (!(obj instanceof _primitives.Dict)) {
71735      return null;
71736    }
71737    obj = obj.getRaw("First");
71738    if (!(obj instanceof _primitives.Ref)) {
71739      return null;
71740    }
71741    const root = {
71742      items: []
71743    };
71744    const queue = [{
71745      obj,
71746      parent: root
71747    }];
71748    const processed = new _primitives.RefSet();
71749    processed.put(obj);
71750    const xref = this.xref,
71751      blackColor = new Uint8ClampedArray(3);
71752    while (queue.length > 0) {
71753      const i = queue.shift();
71754      const outlineDict = xref.fetchIfRef(i.obj);
71755      if (outlineDict === null) {
71756        continue;
71757      }
71758      if (!outlineDict.has("Title")) {
71759        throw new _util.FormatError("Invalid outline item encountered.");
71760      }
71761      const data = {
71762        url: null,
71763        dest: null,
71764        action: null
71765      };
71766      Catalog.parseDestDictionary({
71767        destDict: outlineDict,
71768        resultObj: data,
71769        docBaseUrl: this.b
vendor: 8,244 bytes, lines 71769-72027
71769aseUrl,
71770        docAttachments: this.attachments
71771      });
71772      const title = outlineDict.get("Title");
71773      const flags = outlineDict.get("F") || 0;
71774      const color = outlineDict.getArray("C");
71775      const count = outlineDict.get("Count");
71776      let rgbColor = blackColor;
71777      if (Array.isArray(color) && color.length === 3 && (color[0] !== 0 || color[1] !== 0 || color[2] !== 0)) {
71778        rgbColor = _colorspace.ColorSpace.singletons.rgb.getRgb(color, 0);
71779      }
71780      const outlineItem = {
71781        action: data.action,
71782        attachment: data.attachment,
71783        dest: data.dest,
71784        url: data.url,
71785        unsafeUrl: data.unsafeUrl,
71786        newWindow: data.newWindow,
71787        setOCGState: data.setOCGState,
71788        title: (0, _util.stringToPDFString)(title),
71789        color: rgbColor,
71790        count: Number.isInteger(count) ? count : undefined,
71791        bold: !!(flags & 2),
71792        italic: !!(flags & 1),
71793        items: []
71794      };
71795      i.parent.items.push(outlineItem);
71796      obj = outlineDict.getRaw("First");
71797      if (obj instanceof _primitives.Ref && !processed.has(obj)) {
71798        queue.push({
71799          obj,
71800          parent: outlineItem
71801        });
71802        processed.put(obj);
71803      }
71804      obj = outlineDict.getRaw("Next");
71805      if (obj instanceof _primitives.Ref && !processed.has(obj)) {
71806        queue.push({
71807          obj,
71808          parent: i.parent
71809        });
71810        processed.put(obj);
71811      }
71812    }
71813    return root.items.length > 0 ? root.items : null;
71814  }
71815  get permissions() {
71816    let permissions = null;
71817    try {
71818      permissions = this._readPermissions();
71819    } catch (ex) {
71820      if (ex instanceof _core_utils.MissingDataException) {
71821        throw ex;
71822      }
71823      (0, _util.warn)("Unable to read permissions.");
71824    }
71825    return (0, _util.shadow)(this, "permissions", permissions);
71826  }
71827  _readPermissions() {
71828    const encrypt = this.xref.trailer.get("Encrypt");
71829    if (!(encrypt instanceof _primitives.Dict)) {
71830      return null;
71831    }
71832    let flags = encrypt.get("P");
71833    if (typeof flags !== "number") {
71834      return null;
71835    }
71836    flags += 2 ** 32;
71837    const permissions = [];
71838    for (const key in _util.PermissionFlag) {
71839      const value = _util.PermissionFlag[key];
71840      if (flags & value) {
71841        permissions.push(value);
71842      }
71843    }
71844    return permissions;
71845  }
71846  get optionalContentConfig() {
71847    let config = null;
71848    try {
71849      const properties = this._catDict.get("OCProperties");
71850      if (!properties) {
71851        return (0, _util.shadow)(this, "optionalContentConfig", null);
71852      }
71853      const defaultConfig = properties.get("D");
71854      if (!defaultConfig) {
71855        return (0, _util.shadow)(this, "optionalContentConfig", null);
71856      }
71857      const groupsData = properties.get("OCGs");
71858      if (!Array.isArray(groupsData)) {
71859        return (0, _util.shadow)(this, "optionalContentConfig", null);
71860      }
71861      const groups = [];
71862      const groupRefs = [];
71863      for (const groupRef of groupsData) {
71864        if (!(groupRef instanceof _primitives.Ref)) {
71865          continue;
71866        }
71867        groupRefs.push(groupRef);
71868        const group = this.xref.fetchIfRef(groupRef);
71869        groups.push({
71870          id: groupRef.toString(),
71871          name: typeof group.get("Name") === "string" ? (0, _util.stringToPDFString)(group.get("Name")) : null,
71872          intent: typeof group.get("Intent") === "string" ? (0, _util.stringToPDFString)(group.get("Intent")) : null
71873        });
71874      }
71875      config = this._readOptionalContentConfig(defaultConfig, groupRefs);
71876      config.groups = groups;
71877    } catch (ex) {
71878      if (ex instanceof _core_utils.MissingDataException) {
71879        throw ex;
71880      }
71881      (0, _util.warn)(`Unable to read optional content config: ${ex}`);
71882    }
71883    return (0, _util.shadow)(this, "optionalContentConfig", config);
71884  }
71885  _readOptionalContentConfig(config, contentGroupRefs) {
71886    function parseOnOff(refs) {
71887      const onParsed = [];
71888      if (Array.isArray(refs)) {
71889        for (const value of refs) {
71890          if (!(value instanceof _primitives.Ref)) {
71891            continue;
71892          }
71893          if (contentGroupRefs.includes(value)) {
71894            onParsed.push(value.toString());
71895          }
71896        }
71897      }
71898      return onParsed;
71899    }
71900    function parseOrder(refs, nestedLevels = 0) {
71901      if (!Array.isArray(refs)) {
71902        return null;
71903      }
71904      const order = [];
71905      for (const value of refs) {
71906        if (value instanceof _primitives.Ref && contentGroupRefs.includes(value)) {
71907          parsedOrderRefs.put(value);
71908          order.push(value.toString());
71909          continue;
71910        }
71911        const nestedOrder = parseNestedOrder(value, nestedLevels);
71912        if (nestedOrder) {
71913          order.push(nestedOrder);
71914        }
71915      }
71916      if (nestedLevels > 0) {
71917        return order;
71918      }
71919      const hiddenGroups = [];
71920      for (const groupRef of contentGroupRefs) {
71921        if (parsedOrderRefs.has(groupRef)) {
71922          continue;
71923        }
71924        hiddenGroups.push(groupRef.toString());
71925      }
71926      if (hiddenGroups.length) {
71927        order.push({
71928          name: null,
71929          order: hiddenGroups
71930        });
71931      }
71932      return order;
71933    }
71934    function parseNestedOrder(ref, nestedLevels) {
71935      if (++nestedLevels > MAX_NESTED_LEVELS) {
71936        (0, _util.warn)("parseNestedOrder - reached MAX_NESTED_LEVELS.");
71937        return null;
71938      }
71939      const value = xref.fetchIfRef(ref);
71940      if (!Array.isArray(value)) {
71941        return null;
71942      }
71943      const nestedName = xref.fetchIfRef(value[0]);
71944      if (typeof nestedName !== "string") {
71945        return null;
71946      }
71947      const nestedOrder = parseOrder(value.slice(1), nestedLevels);
71948      if (!nestedOrder || !nestedOrder.length) {
71949        return null;
71950      }
71951      return {
71952        name: (0, _util.stringToPDFString)(nestedName),
71953        order: nestedOrder
71954      };
71955    }
71956    const xref = this.xref,
71957      parsedOrderRefs = new _primitives.RefSet(),
71958      MAX_NESTED_LEVELS = 10;
71959    return {
71960      name: typeof config.get("Name") === "string" ? (0, _util.stringToPDFString)(config.get("Name")) : null,
71961      creator: typeof config.get("Creator") === "string" ? (0, _util.stringToPDFString)(config.get("Creator")) : null,
71962      baseState: config.get("BaseState") instanceof _primitives.Name ? config.get("BaseState").name : null,
71963      on: parseOnOff(config.get("ON")),
71964      off: parseOnOff(config.get("OFF")),
71965      order: parseOrder(config.get("Order")),
71966      groups: null
71967    };
71968  }
71969  setActualNumPages(num = null) {
71970    this._actualNumPages = num;
71971  }
71972  get hasActualNumPages() {
71973    return this._actualNumPages !== null;
71974  }
71975  get _pagesCount() {
71976    const obj = this.toplevelPagesDict.get("Count");
71977    if (!Number.isInteger(obj)) {
71978      throw new _util.FormatError("Page count in top-level pages dictionary is not an integer.");
71979    }
71980    return (0, _util.shadow)(this, "_pagesCount", obj);
71981  }
71982  get numPages() {
71983    return this.hasActualNumPages ? this._actualNumPages : this._pagesCount;
71984  }
71985  get destinations() {
71986    const obj = this._readDests(),
71987      dests = Object.create(null);
71988    if (obj instanceof _name_number_tree.NameTree) {
71989      for (const [key, value] of obj.getAll()) {
71990        const dest = fetchDestination(value);
71991        if (dest) {
71992          dests[(0, _util.stringToPDFString)(key)] = dest;
71993        }
71994      }
71995    } else if (obj instanceof _primitives.Dict) {
71996      obj.forEach(function (key, value) {
71997        const dest = fetchDestination(value);
71998        if (dest) {
71999          dests[key] = dest;
72000        }
72001      });
72002    }
72003    return (0, _util.shadow)(this, "destinations", dests);
72004  }
72005  getDestination(id) {
72006    const obj = this._readDests();
72007    if (obj instanceof _name_number_tree.NameTree) {
72008      const dest = fetchDestination(obj.get(id));
72009      if (dest) {
72010        return dest;
72011      }
72012      const allDest = this.destinations[id];
72013      if (allDest) {
72014        (0, _util.warn)(`Found "${id}" at an incorrect position in the NameTree.`);
72015        return allDest;
72016      }
72017    } else if (obj instanceof _primitives.Dict) {
72018      const dest = fetchDestination(obj.get(id));
72019      if (dest) {
72020        return dest;
72021      }
72022    }
72023    return null;
72024  }
72025  _readDests() {
72026    const obj = this._catDict.get("Names");
72027    if (obj
vendor: 12,046 bytes, lines 72027-72402
72027?.has("Dests")) {
72028      return new _name_number_tree.NameTree(obj.getRaw("Dests"), this.xref);
72029    } else if (this._catDict.has("Dests")) {
72030      return this._catDict.get("Dests");
72031    }
72032    return undefined;
72033  }
72034  get pageLabels() {
72035    let obj = null;
72036    try {
72037      obj = this._readPageLabels();
72038    } catch (ex) {
72039      if (ex instanceof _core_utils.MissingDataException) {
72040        throw ex;
72041      }
72042      (0, _util.warn)("Unable to read page labels.");
72043    }
72044    return (0, _util.shadow)(this, "pageLabels", obj);
72045  }
72046  _readPageLabels() {
72047    const obj = this._catDict.getRaw("PageLabels");
72048    if (!obj) {
72049      return null;
72050    }
72051    const pageLabels = new Array(this.numPages);
72052    let style = null,
72053      prefix = "";
72054    const numberTree = new _name_number_tree.NumberTree(obj, this.xref);
72055    const nums = numberTree.getAll();
72056    let currentLabel = "",
72057      currentIndex = 1;
72058    for (let i = 0, ii = this.numPages; i < ii; i++) {
72059      const labelDict = nums.get(i);
72060      if (labelDict !== undefined) {
72061        if (!(labelDict instanceof _primitives.Dict)) {
72062          throw new _util.FormatError("PageLabel is not a dictionary.");
72063        }
72064        if (labelDict.has("Type") && !(0, _primitives.isName)(labelDict.get("Type"), "PageLabel")) {
72065          throw new _util.FormatError("Invalid type in PageLabel dictionary.");
72066        }
72067        if (labelDict.has("S")) {
72068          const s = labelDict.get("S");
72069          if (!(s instanceof _primitives.Name)) {
72070            throw new _util.FormatError("Invalid style in PageLabel dictionary.");
72071          }
72072          style = s.name;
72073        } else {
72074          style = null;
72075        }
72076        if (labelDict.has("P")) {
72077          const p = labelDict.get("P");
72078          if (typeof p !== "string") {
72079            throw new _util.FormatError("Invalid prefix in PageLabel dictionary.");
72080          }
72081          prefix = (0, _util.stringToPDFString)(p);
72082        } else {
72083          prefix = "";
72084        }
72085        if (labelDict.has("St")) {
72086          const st = labelDict.get("St");
72087          if (!(Number.isInteger(st) && st >= 1)) {
72088            throw new _util.FormatError("Invalid start in PageLabel dictionary.");
72089          }
72090          currentIndex = st;
72091        } else {
72092          currentIndex = 1;
72093        }
72094      }
72095      switch (style) {
72096        case "D":
72097          currentLabel = currentIndex;
72098          break;
72099        case "R":
72100        case "r":
72101          currentLabel = (0, _core_utils.toRomanNumerals)(currentIndex, style === "r");
72102          break;
72103        case "A":
72104        case "a":
72105          const LIMIT = 26;
72106          const A_UPPER_CASE = 0x41,
72107            A_LOWER_CASE = 0x61;
72108          const baseCharCode = style === "a" ? A_LOWER_CASE : A_UPPER_CASE;
72109          const letterIndex = currentIndex - 1;
72110          const character = String.fromCharCode(baseCharCode + letterIndex % LIMIT);
72111          currentLabel = character.repeat(Math.floor(letterIndex / LIMIT) + 1);
72112          break;
72113        default:
72114          if (style) {
72115            throw new _util.FormatError(`Invalid style "${style}" in PageLabel dictionary.`);
72116          }
72117          currentLabel = "";
72118      }
72119      pageLabels[i] = prefix + currentLabel;
72120      currentIndex++;
72121    }
72122    return pageLabels;
72123  }
72124  get pageLayout() {
72125    const obj = this._catDict.get("PageLayout");
72126    let pageLayout = "";
72127    if (obj instanceof _primitives.Name) {
72128      switch (obj.name) {
72129        case "SinglePage":
72130        case "OneColumn":
72131        case "TwoColumnLeft":
72132        case "TwoColumnRight":
72133        case "TwoPageLeft":
72134        case "TwoPageRight":
72135          pageLayout = obj.name;
72136      }
72137    }
72138    return (0, _util.shadow)(this, "pageLayout", pageLayout);
72139  }
72140  get pageMode() {
72141    const obj = this._catDict.get("PageMode");
72142    let pageMode = "UseNone";
72143    if (obj instanceof _primitives.Name) {
72144      switch (obj.name) {
72145        case "UseNone":
72146        case "UseOutlines":
72147        case "UseThumbs":
72148        case "FullScreen":
72149        case "UseOC":
72150        case "UseAttachments":
72151          pageMode = obj.name;
72152      }
72153    }
72154    return (0, _util.shadow)(this, "pageMode", pageMode);
72155  }
72156  get viewerPreferences() {
72157    const obj = this._catDict.get("ViewerPreferences");
72158    if (!(obj instanceof _primitives.Dict)) {
72159      return (0, _util.shadow)(this, "viewerPreferences", null);
72160    }
72161    let prefs = null;
72162    for (const key of obj.getKeys()) {
72163      const value = obj.get(key);
72164      let prefValue;
72165      switch (key) {
72166        case "HideToolbar":
72167        case "HideMenubar":
72168        case "HideWindowUI":
72169        case "FitWindow":
72170        case "CenterWindow":
72171        case "DisplayDocTitle":
72172        case "PickTrayByPDFSize":
72173          if (typeof value === "boolean") {
72174            prefValue = value;
72175          }
72176          break;
72177        case "NonFullScreenPageMode":
72178          if (value instanceof _primitives.Name) {
72179            switch (value.name) {
72180              case "UseNone":
72181              case "UseOutlines":
72182              case "UseThumbs":
72183              case "UseOC":
72184                prefValue = value.name;
72185                break;
72186              default:
72187                prefValue = "UseNone";
72188            }
72189          }
72190          break;
72191        case "Direction":
72192          if (value instanceof _primitives.Name) {
72193            switch (value.name) {
72194              case "L2R":
72195              case "R2L":
72196                prefValue = value.name;
72197                break;
72198              default:
72199                prefValue = "L2R";
72200            }
72201          }
72202          break;
72203        case "ViewArea":
72204        case "ViewClip":
72205        case "PrintArea":
72206        case "PrintClip":
72207          if (value instanceof _primitives.Name) {
72208            switch (value.name) {
72209              case "MediaBox":
72210              case "CropBox":
72211              case "BleedBox":
72212              case "TrimBox":
72213              case "ArtBox":
72214                prefValue = value.name;
72215                break;
72216              default:
72217                prefValue = "CropBox";
72218            }
72219          }
72220          break;
72221        case "PrintScaling":
72222          if (value instanceof _primitives.Name) {
72223            switch (value.name) {
72224              case "None":
72225              case "AppDefault":
72226                prefValue = value.name;
72227                break;
72228              default:
72229                prefValue = "AppDefault";
72230            }
72231          }
72232          break;
72233        case "Duplex":
72234          if (value instanceof _primitives.Name) {
72235            switch (value.name) {
72236              case "Simplex":
72237              case "DuplexFlipShortEdge":
72238              case "DuplexFlipLongEdge":
72239                prefValue = value.name;
72240                break;
72241              default:
72242                prefValue = "None";
72243            }
72244          }
72245          break;
72246        case "PrintPageRange":
72247          if (Array.isArray(value) && value.length % 2 === 0) {
72248            const isValid = value.every((page, i, arr) => {
72249              return Number.isInteger(page) && page > 0 && (i === 0 || page >= arr[i - 1]) && page <= this.numPages;
72250            });
72251            if (isValid) {
72252              prefValue = value;
72253            }
72254          }
72255          break;
72256        case "NumCopies":
72257          if (Number.isInteger(value) && value > 0) {
72258            prefValue = value;
72259          }
72260          break;
72261        default:
72262          (0, _util.warn)(`Ignoring non-standard key in ViewerPreferences: ${key}.`);
72263          continue;
72264      }
72265      if (prefValue === undefined) {
72266        (0, _util.warn)(`Bad value, for key "${key}", in ViewerPreferences: ${value}.`);
72267        continue;
72268      }
72269      if (!prefs) {
72270        prefs = Object.create(null);
72271      }
72272      prefs[key] = prefValue;
72273    }
72274    return (0, _util.shadow)(this, "viewerPreferences", prefs);
72275  }
72276  get openAction() {
72277    const obj = this._catDict.get("OpenAction");
72278    const openAction = Object.create(null);
72279    if (obj instanceof _primitives.Dict) {
72280      const destDict = new _primitives.Dict(this.xref);
72281      destDict.set("A", obj);
72282      const resultObj = {
72283        url: null,
72284        dest: null,
72285        action: null
72286      };
72287      Catalog.parseDestDictionary({
72288        destDict,
72289        resultObj
72290      });
72291      if (Array.isArray(resultObj.dest)) {
72292        openAction.dest = resultObj.dest;
72293      } else if (resultObj.action) {
72294        openAction.action = resultObj.action;
72295      }
72296    } else if (Array.isArray(obj)) {
72297      openAction.dest = obj;
72298    }
72299    return (0, _util.shadow)(this, "openAction", (0, _util.objectSize)(openAction) > 0 ? openAction : null);
72300  }
72301  get attachments() {
72302    const obj = this._catDict.get("Names");
72303    let attachments = null;
72304    if (obj instanceof _primitives.Dict && obj.has("EmbeddedFiles")) {
72305      const nameTree = new _name_number_tree.NameTree(obj.getRaw("EmbeddedFiles"), this.xref);
72306      for (const [key, value] of nameTree.getAll()) {
72307        const fs = new _file_spec.FileSpec(value, this.xref);
72308        if (!attachments) {
72309          attachments = Object.create(null);
72310        }
72311        attachments[(0, _util.stringToPDFString)(key)] = fs.serializable;
72312      }
72313    }
72314    return (0, _util.shadow)(this, "attachments", attachments);
72315  }
72316  get xfaImages() {
72317    const obj = this._catDict.get("Names");
72318    let xfaImages = null;
72319    if (obj instanceof _primitives.Dict && obj.has("XFAImages")) {
72320      const nameTree = new _name_number_tree.NameTree(obj.getRaw("XFAImages"), this.xref);
72321      for (const [key, value] of nameTree.getAll()) {
72322        if (!xfaImages) {
72323          xfaImages = new _primitives.Dict(this.xref);
72324        }
72325        xfaImages.set((0, _util.stringToPDFString)(key), value);
72326      }
72327    }
72328    return (0, _util.shadow)(this, "xfaImages", xfaImages);
72329  }
72330  _collectJavaScript() {
72331    const obj = this._catDict.get("Names");
72332    let javaScript = null;
72333    function appendIfJavaScriptDict(name, jsDict) {
72334      if (!(jsDict instanceof _primitives.Dict)) {
72335        return;
72336      }
72337      if (!(0, _primitives.isName)(jsDict.get("S"), "JavaScript")) {
72338        return;
72339      }
72340      let js = jsDict.get("JS");
72341      if (js instanceof _base_stream.BaseStream) {
72342        js = js.getString();
72343      } else if (typeof js !== "string") {
72344        return;
72345      }
72346      js = (0, _util.stringToPDFString)(js).replaceAll("\x00", "");
72347      if (js) {
72348        (javaScript ||= new Map()).set(name, js);
72349      }
72350    }
72351    if (obj instanceof _primitives.Dict && obj.has("JavaScript")) {
72352      const nameTree = new _name_number_tree.NameTree(obj.getRaw("JavaScript"), this.xref);
72353      for (const [key, value] of nameTree.getAll()) {
72354        appendIfJavaScriptDict((0, _util.stringToPDFString)(key), value);
72355      }
72356    }
72357    const openAction = this._catDict.get("OpenAction");
72358    if (openAction) {
72359      appendIfJavaScriptDict("OpenAction", openAction);
72360    }
72361    return javaScript;
72362  }
72363  get jsActions() {
72364    const javaScript = this._collectJavaScript();
72365    let actions = (0, _core_utils.collectActions)(this.xref, this._catDict, _util.DocumentActionEventType);
72366    if (javaScript) {
72367      actions ||= Object.create(null);
72368      for (const [key, val] of javaScript) {
72369        if (key in actions) {
72370          actions[key].push(val);
72371        } else {
72372          actions[key] = [val];
72373        }
72374      }
72375    }
72376    return (0, _util.shadow)(this, "jsActions", actions);
72377  }
72378  async fontFallback(id, handler) {
72379    const translatedFonts = await Promise.all(this.fontCache);
72380    for (const translatedFont of translatedFonts) {
72381      if (translatedFont.loadedName === id) {
72382        translatedFont.fallback(handler);
72383        return;
72384      }
72385    }
72386  }
72387  async cleanup(manuallyTriggered = false) {
72388    (0, _cleanup_helper.clearGlobalCaches)();
72389    this.globalImageCache.clear(manuallyTriggered);
72390    this.pageKidsCountCache.clear();
72391    this.pageIndexCache.clear();
72392    this.nonBlendModesSet.clear();
72393    const translatedFonts = await Promise.all(this.fontCache);
72394    for (const {
72395      dict
72396    } of translatedFonts) {
72397      delete dict.cacheKey;
72398    }
72399    this.fontCache.clear();
72400    this.builtInCMapCache.clear();
72401    this.standardFontDataCache.clear();
72402    this.systemFont
vendor: 9,172 bytes, lines 72402-72678
72402Cache.clear();
72403  }
72404  async getPageDict(pageIndex) {
72405    const nodesToVisit = [this.toplevelPagesDict];
72406    const visitedNodes = new _primitives.RefSet();
72407    const pagesRef = this._catDict.getRaw("Pages");
72408    if (pagesRef instanceof _primitives.Ref) {
72409      visitedNodes.put(pagesRef);
72410    }
72411    const xref = this.xref,
72412      pageKidsCountCache = this.pageKidsCountCache,
72413      pageIndexCache = this.pageIndexCache;
72414    let currentPageIndex = 0;
72415    while (nodesToVisit.length) {
72416      const currentNode = nodesToVisit.pop();
72417      if (currentNode instanceof _primitives.Ref) {
72418        const count = pageKidsCountCache.get(currentNode);
72419        if (count >= 0 && currentPageIndex + count <= pageIndex) {
72420          currentPageIndex += count;
72421          continue;
72422        }
72423        if (visitedNodes.has(currentNode)) {
72424          throw new _util.FormatError("Pages tree contains circular reference.");
72425        }
72426        visitedNodes.put(currentNode);
72427        const obj = await xref.fetchAsync(currentNode);
72428        if (obj instanceof _primitives.Dict) {
72429          let type = obj.getRaw("Type");
72430          if (type instanceof _primitives.Ref) {
72431            type = await xref.fetchAsync(type);
72432          }
72433          if ((0, _primitives.isName)(type, "Page") || !obj.has("Kids")) {
72434            if (!pageKidsCountCache.has(currentNode)) {
72435              pageKidsCountCache.put(currentNode, 1);
72436            }
72437            if (!pageIndexCache.has(currentNode)) {
72438              pageIndexCache.put(currentNode, currentPageIndex);
72439            }
72440            if (currentPageIndex === pageIndex) {
72441              return [obj, currentNode];
72442            }
72443            currentPageIndex++;
72444            continue;
72445          }
72446        }
72447        nodesToVisit.push(obj);
72448        continue;
72449      }
72450      if (!(currentNode instanceof _primitives.Dict)) {
72451        throw new _util.FormatError("Page dictionary kid reference points to wrong type of object.");
72452      }
72453      const {
72454        objId
72455      } = currentNode;
72456      let count = currentNode.getRaw("Count");
72457      if (count instanceof _primitives.Ref) {
72458        count = await xref.fetchAsync(count);
72459      }
72460      if (Number.isInteger(count) && count >= 0) {
72461        if (objId && !pageKidsCountCache.has(objId)) {
72462          pageKidsCountCache.put(objId, count);
72463        }
72464        if (currentPageIndex + count <= pageIndex) {
72465          currentPageIndex += count;
72466          continue;
72467        }
72468      }
72469      let kids = currentNode.getRaw("Kids");
72470      if (kids instanceof _primitives.Ref) {
72471        kids = await xref.fetchAsync(kids);
72472      }
72473      if (!Array.isArray(kids)) {
72474        let type = currentNode.getRaw("Type");
72475        if (type instanceof _primitives.Ref) {
72476          type = await xref.fetchAsync(type);
72477        }
72478        if ((0, _primitives.isName)(type, "Page") || !currentNode.has("Kids")) {
72479          if (currentPageIndex === pageIndex) {
72480            return [currentNode, null];
72481          }
72482          currentPageIndex++;
72483          continue;
72484        }
72485        throw new _util.FormatError("Page dictionary kids object is not an array.");
72486      }
72487      for (let last = kids.length - 1; last >= 0; last--) {
72488        nodesToVisit.push(kids[last]);
72489      }
72490    }
72491    throw new Error(`Page index ${pageIndex} not found.`);
72492  }
72493  async getAllPageDicts(recoveryMode = false) {
72494    const {
72495      ignoreErrors
72496    } = this.pdfManager.evaluatorOptions;
72497    const queue = [{
72498      currentNode: this.toplevelPagesDict,
72499      posInKids: 0
72500    }];
72501    const visitedNodes = new _primitives.RefSet();
72502    const pagesRef = this._catDict.getRaw("Pages");
72503    if (pagesRef instanceof _primitives.Ref) {
72504      visitedNodes.put(pagesRef);
72505    }
72506    const map = new Map(),
72507      xref = this.xref,
72508      pageIndexCache = this.pageIndexCache;
72509    let pageIndex = 0;
72510    function addPageDict(pageDict, pageRef) {
72511      if (pageRef && !pageIndexCache.has(pageRef)) {
72512        pageIndexCache.put(pageRef, pageIndex);
72513      }
72514      map.set(pageIndex++, [pageDict, pageRef]);
72515    }
72516    function addPageError(error) {
72517      if (error instanceof _core_utils.XRefEntryException && !recoveryMode) {
72518        throw error;
72519      }
72520      if (recoveryMode && ignoreErrors && pageIndex === 0) {
72521        (0, _util.warn)(`getAllPageDicts - Skipping invalid first page: "${error}".`);
72522        error = _primitives.Dict.empty;
72523      }
72524      map.set(pageIndex++, [error, null]);
72525    }
72526    while (queue.length > 0) {
72527      const queueItem = queue.at(-1);
72528      const {
72529        currentNode,
72530        posInKids
72531      } = queueItem;
72532      let kids = currentNode.getRaw("Kids");
72533      if (kids instanceof _primitives.Ref) {
72534        try {
72535          kids = await xref.fetchAsync(kids);
72536        } catch (ex) {
72537          addPageError(ex);
72538          break;
72539        }
72540      }
72541      if (!Array.isArray(kids)) {
72542        addPageError(new _util.FormatError("Page dictionary kids object is not an array."));
72543        break;
72544      }
72545      if (posInKids >= kids.length) {
72546        queue.pop();
72547        continue;
72548      }
72549      const kidObj = kids[posInKids];
72550      let obj;
72551      if (kidObj instanceof _primitives.Ref) {
72552        if (visitedNodes.has(kidObj)) {
72553          addPageError(new _util.FormatError("Pages tree contains circular reference."));
72554          break;
72555        }
72556        visitedNodes.put(kidObj);
72557        try {
72558          obj = await xref.fetchAsync(kidObj);
72559        } catch (ex) {
72560          addPageError(ex);
72561          break;
72562        }
72563      } else {
72564        obj = kidObj;
72565      }
72566      if (!(obj instanceof _primitives.Dict)) {
72567        addPageError(new _util.FormatError("Page dictionary kid reference points to wrong type of object."));
72568        break;
72569      }
72570      let type = obj.getRaw("Type");
72571      if (type instanceof _primitives.Ref) {
72572        try {
72573          type = await xref.fetchAsync(type);
72574        } catch (ex) {
72575          addPageError(ex);
72576          break;
72577        }
72578      }
72579      if ((0, _primitives.isName)(type, "Page") || !obj.has("Kids")) {
72580        addPageDict(obj, kidObj instanceof _primitives.Ref ? kidObj : null);
72581      } else {
72582        queue.push({
72583          currentNode: obj,
72584          posInKids: 0
72585        });
72586      }
72587      queueItem.posInKids++;
72588    }
72589    return map;
72590  }
72591  getPageIndex(pageRef) {
72592    const cachedPageIndex = this.pageIndexCache.get(pageRef);
72593    if (cachedPageIndex !== undefined) {
72594      return Promise.resolve(cachedPageIndex);
72595    }
72596    const xref = this.xref;
72597    function pagesBeforeRef(kidRef) {
72598      let total = 0,
72599        parentRef;
72600      return xref.fetchAsync(kidRef).then(function (node) {
72601        if ((0, _primitives.isRefsEqual)(kidRef, pageRef) && !(0, _primitives.isDict)(node, "Page") && !(node instanceof _primitives.Dict && !node.has("Type") && node.has("Contents"))) {
72602          throw new _util.FormatError("The reference does not point to a /Page dictionary.");
72603        }
72604        if (!node) {
72605          return null;
72606        }
72607        if (!(node instanceof _primitives.Dict)) {
72608          throw new _util.FormatError("Node must be a dictionary.");
72609        }
72610        parentRef = node.getRaw("Parent");
72611        return node.getAsync("Parent");
72612      }).then(function (parent) {
72613        if (!parent) {
72614          return null;
72615        }
72616        if (!(parent instanceof _primitives.Dict)) {
72617          throw new _util.FormatError("Parent must be a dictionary.");
72618        }
72619        return parent.getAsync("Kids");
72620      }).then(function (kids) {
72621        if (!kids) {
72622          return null;
72623        }
72624        const kidPromises = [];
72625        let found = false;
72626        for (const kid of kids) {
72627          if (!(kid instanceof _primitives.Ref)) {
72628            throw new _util.FormatError("Kid must be a reference.");
72629          }
72630          if ((0, _primitives.isRefsEqual)(kid, kidRef)) {
72631            found = true;
72632            break;
72633          }
72634          kidPromises.push(xref.fetchAsync(kid).then(function (obj) {
72635            if (!(obj instanceof _primitives.Dict)) {
72636              throw new _util.FormatError("Kid node must be a dictionary.");
72637            }
72638            if (obj.has("Count")) {
72639              total += obj.get("Count");
72640            } else {
72641              total++;
72642            }
72643          }));
72644        }
72645        if (!found) {
72646          throw new _util.FormatError("Kid reference not found in parent's kids.");
72647        }
72648        return Promise.all(kidPromises).then(function () {
72649          return [total, parentRef];
72650        });
72651      });
72652    }
72653    let total = 0;
72654    const next = ref => pagesBeforeRef(ref).then(args => {
72655      if (!args) {
72656        this.pageIndexCache.put(pageRef, total);
72657        return total;
72658      }
72659      const [count, parentRef] = args;
72660      total += count;
72661      return next(parentRef);
72662    });
72663    return next(pageRef);
72664  }
72665  get baseUrl() {
72666    const uri = this._catDict.get("URI");
72667    if (uri instanceof _primitives.Dict) {
72668      const base = uri.get("Base");
72669      if (typeof base === "string") {
72670        const absoluteUrl = (0, _util.createValidAbsoluteUrl)(base, null, {
72671          tryConvertEncoding: true
72672        });
72673        if (absoluteUrl) {
72674          return (0, _util.shadow)(this, "baseUrl", absoluteUrl.href);
72675        }
72676      }
72677    }
72678    return (0, _util.shadow)(this, "baseUrl", 
72678this.pdfManager.docBaseUrl);
72679  }
72680  static parseDestDictionary({
72681    destDict,
72682    resultObj,
72683    docBaseUrl = null,
72684    docAttachments = null
72685  }) {
72686    if (!(destDict instanceof _primitives.Dict)) {
72687      (0, _util.warn)("parseDestDictionary: `destDict` must be a dictionary.");
72688      return;
72689    }
72690    let action = destDict.get("A"),
72691      url,
72692      dest;
72693    if (!(action instanceof _primitives.Dict)) {
72694      if (destDict.has("Dest")) {
72695        action = destDict.get("Dest");
72696      } else {
72697        action = destDict.get("AA");
72698        if (action instanceof _primitives.Dict) {
72699          if (action.has("D")) {
72700            action = action.get("D");
72701          } else if (action.has("U")) {
72702            action = action.get("U");
72703          }
72704        }
72705      }
72706    }
72707    if (action instanceof _primitives.Dict) {
72708      const actionType = action.get("S");
72709      if (!(actionType instanceof _primitives.Name)) {
72710        (0, _util.warn)("parseDestDictionary: Invalid type in Action dictionary.");
72711        return;
72712      }
vendor: 15,366 bytes, lines 72713-73237
72713      const actionName = actionType.name;
72714      switch (actionName) {
72715        case "ResetForm":
72716          const flags = action.get("Flags");
72717          const include = ((typeof flags === "number" ? flags : 0) & 1) === 0;
72718          const fields = [];
72719          const refs = [];
72720          for (const obj of action.get("Fields") || []) {
72721            if (obj instanceof _primitives.Ref) {
72722              refs.push(obj.toString());
72723            } else if (typeof obj === "string") {
72724              fields.push((0, _util.stringToPDFString)(obj));
72725            }
72726          }
72727          resultObj.resetForm = {
72728            fields,
72729            refs,
72730            include
72731          };
72732          break;
72733        case "URI":
72734          url = action.get("URI");
72735          if (url instanceof _primitives.Name) {
72736            url = "/" + url.name;
72737          }
72738          break;
72739        case "GoTo":
72740          dest = action.get("D");
72741          break;
72742        case "Launch":
72743        case "GoToR":
72744          const urlDict = action.get("F");
72745          if (urlDict instanceof _primitives.Dict) {
72746            url = urlDict.get("F") || null;
72747          } else if (typeof urlDict === "string") {
72748            url = urlDict;
72749          }
72750          let remoteDest = action.get("D");
72751          if (remoteDest) {
72752            if (remoteDest instanceof _primitives.Name) {
72753              remoteDest = remoteDest.name;
72754            }
72755            if (typeof url === "string") {
72756              const baseUrl = url.split("#")[0];
72757              if (typeof remoteDest === "string") {
72758                url = baseUrl + "#" + remoteDest;
72759              } else if (Array.isArray(remoteDest)) {
72760                url = baseUrl + "#" + JSON.stringify(remoteDest);
72761              }
72762            }
72763          }
72764          const newWindow = action.get("NewWindow");
72765          if (typeof newWindow === "boolean") {
72766            resultObj.newWindow = newWindow;
72767          }
72768          break;
72769        case "GoToE":
72770          const target = action.get("T");
72771          let attachment;
72772          if (docAttachments && target instanceof _primitives.Dict) {
72773            const relationship = target.get("R");
72774            const name = target.get("N");
72775            if ((0, _primitives.isName)(relationship, "C") && typeof name === "string") {
72776              attachment = docAttachments[(0, _util.stringToPDFString)(name)];
72777            }
72778          }
72779          if (attachment) {
72780            resultObj.attachment = attachment;
72781          } else {
72782            (0, _util.warn)(`parseDestDictionary - unimplemented "GoToE" action.`);
72783          }
72784          break;
72785        case "Named":
72786          const namedAction = action.get("N");
72787          if (namedAction instanceof _primitives.Name) {
72788            resultObj.action = namedAction.name;
72789          }
72790          break;
72791        case "SetOCGState":
72792          const state = action.get("State");
72793          const preserveRB = action.get("PreserveRB");
72794          if (!Array.isArray(state) || state.length === 0) {
72795            break;
72796          }
72797          const stateArr = [];
72798          for (const elem of state) {
72799            if (elem instanceof _primitives.Name) {
72800              switch (elem.name) {
72801                case "ON":
72802                case "OFF":
72803                case "Toggle":
72804                  stateArr.push(elem.name);
72805                  break;
72806              }
72807            } else if (elem instanceof _primitives.Ref) {
72808              stateArr.push(elem.toString());
72809            }
72810          }
72811          if (stateArr.length !== state.length) {
72812            break;
72813          }
72814          resultObj.setOCGState = {
72815            state: stateArr,
72816            preserveRB: typeof preserveRB === "boolean" ? preserveRB : true
72817          };
72818          break;
72819        case "JavaScript":
72820          const jsAction = action.get("JS");
72821          let js;
72822          if (jsAction instanceof _base_stream.BaseStream) {
72823            js = jsAction.getString();
72824          } else if (typeof jsAction === "string") {
72825            js = jsAction;
72826          }
72827          const jsURL = js && (0, _core_utils.recoverJsURL)((0, _util.stringToPDFString)(js));
72828          if (jsURL) {
72829            url = jsURL.url;
72830            resultObj.newWindow = jsURL.newWindow;
72831            break;
72832          }
72833        default:
72834          if (actionName === "JavaScript" || actionName === "SubmitForm") {
72835            break;
72836          }
72837          (0, _util.warn)(`parseDestDictionary - unsupported action: "${actionName}".`);
72838          break;
72839      }
72840    } else if (destDict.has("Dest")) {
72841      dest = destDict.get("Dest");
72842    }
72843    if (typeof url === "string") {
72844      const absoluteUrl = (0, _util.createValidAbsoluteUrl)(url, docBaseUrl, {
72845        addDefaultProtocol: true,
72846        tryConvertEncoding: true
72847      });
72848      if (absoluteUrl) {
72849        resultObj.url = absoluteUrl.href;
72850      }
72851      resultObj.unsafeUrl = url;
72852    }
72853    if (dest) {
72854      if (dest instanceof _primitives.Name) {
72855        dest = dest.name;
72856      }
72857      if (typeof dest === "string") {
72858        resultObj.dest = (0, _util.stringToPDFString)(dest);
72859      } else if (Array.isArray(dest)) {
72860        resultObj.dest = dest;
72861      }
72862    }
72863  }
72864}
72865exports.Catalog = Catalog;
72866
72867/***/ }),
72868/* 67 */
72869/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
72870
72871
72872
72873Object.defineProperty(exports, "__esModule", ({
72874  value: true
72875}));
72876exports.NumberTree = exports.NameTree = void 0;
72877var _primitives = __w_pdfjs_require__(4);
72878var _util = __w_pdfjs_require__(2);
72879class NameOrNumberTree {
72880  constructor(root, xref, type) {
72881    if (this.constructor === NameOrNumberTree) {
72882      (0, _util.unreachable)("Cannot initialize NameOrNumberTree.");
72883    }
72884    this.root = root;
72885    this.xref = xref;
72886    this._type = type;
72887  }
72888  getAll() {
72889    const map = new Map();
72890    if (!this.root) {
72891      return map;
72892    }
72893    const xref = this.xref;
72894    const processed = new _primitives.RefSet();
72895    processed.put(this.root);
72896    const queue = [this.root];
72897    while (queue.length > 0) {
72898      const obj = xref.fetchIfRef(queue.shift());
72899      if (!(obj instanceof _primitives.Dict)) {
72900        continue;
72901      }
72902      if (obj.has("Kids")) {
72903        const kids = obj.get("Kids");
72904        if (!Array.isArray(kids)) {
72905          continue;
72906        }
72907        for (const kid of kids) {
72908          if (processed.has(kid)) {
72909            throw new _util.FormatError(`Duplicate entry in "${this._type}" tree.`);
72910          }
72911          queue.push(kid);
72912          processed.put(kid);
72913        }
72914        continue;
72915      }
72916      const entries = obj.get(this._type);
72917      if (!Array.isArray(entries)) {
72918        continue;
72919      }
72920      for (let i = 0, ii = entries.length; i < ii; i += 2) {
72921        map.set(xref.fetchIfRef(entries[i]), xref.fetchIfRef(entries[i + 1]));
72922      }
72923    }
72924    return map;
72925  }
72926  get(key) {
72927    if (!this.root) {
72928      return null;
72929    }
72930    const xref = this.xref;
72931    let kidsOrEntries = xref.fetchIfRef(this.root);
72932    let loopCount = 0;
72933    const MAX_LEVELS = 10;
72934    while (kidsOrEntries.has("Kids")) {
72935      if (++loopCount > MAX_LEVELS) {
72936        (0, _util.warn)(`Search depth limit reached for "${this._type}" tree.`);
72937        return null;
72938      }
72939      const kids = kidsOrEntries.get("Kids");
72940      if (!Array.isArray(kids)) {
72941        return null;
72942      }
72943      let l = 0,
72944        r = kids.length - 1;
72945      while (l <= r) {
72946        const m = l + r >> 1;
72947        const kid = xref.fetchIfRef(kids[m]);
72948        const limits = kid.get("Limits");
72949        if (key < xref.fetchIfRef(limits[0])) {
72950          r = m - 1;
72951        } else if (key > xref.fetchIfRef(limits[1])) {
72952          l = m + 1;
72953        } else {
72954          kidsOrEntries = kid;
72955          break;
72956        }
72957      }
72958      if (l > r) {
72959        return null;
72960      }
72961    }
72962    const entries = kidsOrEntries.get(this._type);
72963    if (Array.isArray(entries)) {
72964      let l = 0,
72965        r = entries.length - 2;
72966      while (l <= r) {
72967        const tmp = l + r >> 1,
72968          m = tmp + (tmp & 1);
72969        const currentKey = xref.fetchIfRef(entries[m]);
72970        if (key < currentKey) {
72971          r = m - 2;
72972        } else if (key > currentKey) {
72973          l = m + 2;
72974        } else {
72975          return xref.fetchIfRef(entries[m + 1]);
72976        }
72977      }
72978    }
72979    return null;
72980  }
72981}
72982class NameTree extends NameOrNumberTree {
72983  constructor(root, xref) {
72984    super(root, xref, "Names");
72985  }
72986}
72987exports.NameTree = NameTree;
72988class NumberTree extends NameOrNumberTree {
72989  constructor(root, xref) {
72990    super(root, xref, "Nums");
72991  }
72992}
72993exports.NumberTree = NumberTree;
72994
72995/***/ }),
72996/* 68 */
72997/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
72998
72999
73000
73001Object.defineProperty(exports, "__esModule", ({
73002  value: true
73003}));
73004exports.clearGlobalCaches = clearGlobalCaches;
73005var _pattern = __w_pdfjs_require__(50);
73006var _primitives = __w_pdfjs_require__(4);
73007var _unicode = __w_pdfjs_require__(40);
73008function clearGlobalCaches() {
73009  (0, _pattern.clearPatternCaches)();
73010  (0, _primitives.clearPrimitiveCaches)();
73011  (0, _unicode.clearUnicodeCaches)();
73012}
73013
73014/***/ }),
73015/* 69 */
73016/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
73017
73018
73019
73020Object.defineProperty(exports, "__esModule", ({
73021  value: true
73022}));
73023exports.FileSpec = void 0;
73024var _util = __w_pdfjs_require__(2);
73025var _base_stream = __w_pdfjs_require__(5);
73026var _primitives = __w_pdfjs_require__(4);
73027function pickPlatformItem(dict) {
73028  if (dict.has("UF")) {
73029    return dict.get("UF");
73030  } else if (dict.has("F")) {
73031    return dict.get("F");
73032  } else if (dict.has("Unix")) {
73033    return dict.get("Unix");
73034  } else if (dict.has("Mac")) {
73035    return dict.get("Mac");
73036  } else if (dict.has("DOS")) {
73037    return dict.get("DOS");
73038  }
73039  return null;
73040}
73041class FileSpec {
73042  constructor(root, xref) {
73043    if (!(root instanceof _primitives.Dict)) {
73044      return;
73045    }
73046    this.xref = xref;
73047    this.root = root;
73048    if (root.has("FS")) {
73049      this.fs = root.get("FS");
73050    }
73051    this.description = root.has("Desc") ? (0, _util.stringToPDFString)(root.get("Desc")) : "";
73052    if (root.has("RF")) {
73053      (0, _util.warn)("Related file specifications are not supported");
73054    }
73055    this.contentAvailable = true;
73056    if (!root.has("EF")) {
73057      this.contentAvailable = false;
73058      (0, _util.warn)("Non-embedded file specifications are not supported");
73059    }
73060  }
73061  get filename() {
73062    if (!this._filename && this.root) {
73063      const filename = pickPlatformItem(this.root) || "unnamed";
73064      this._filename = (0, _util.stringToPDFString)(filename).replaceAll("\\\\", "\\").replaceAll("\\/", "/").replaceAll("\\", "/");
73065    }
73066    return this._filename;
73067  }
73068  get content() {
73069    if (!this.contentAvailable) {
73070      return null;
73071    }
73072    if (!this.contentRef && this.root) {
73073      this.contentRef = pickPlatformItem(this.root.get("EF"));
73074    }
73075    let content = null;
73076    if (this.contentRef) {
73077      const fileObj = this.xref.fetchIfRef(this.contentRef);
73078      if (fileObj instanceof _base_stream.BaseStream) {
73079        content = fileObj.getBytes();
73080      } else {
73081        (0, _util.warn)("Embedded file specification points to non-existing/invalid content");
73082      }
73083    } else {
73084      (0, _util.warn)("Embedded file specification does not have a content");
73085    }
73086    return content;
73087  }
73088  get serializable() {
73089    return {
73090      filename: this.filename,
73091      content: this.content
73092    };
73093  }
73094}
73095exports.FileSpec = FileSpec;
73096
73097/***/ }),
73098/* 70 */
73099/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
73100
73101
73102
73103Object.defineProperty(exports, "__esModule", ({
73104  value: true
73105}));
73106exports.MetadataParser = void 0;
73107var _xml_parser = __w_pdfjs_require__(71);
73108class MetadataParser {
73109  constructor(data) {
73110    data = this._repair(data);
73111    const parser = new _xml_parser.SimpleXMLParser({
73112      lowerCaseName: true
73113    });
73114    const xmlDocument = parser.parseFromString(data);
73115    this._metadataMap = new Map();
73116    this._data = data;
73117    if (xmlDocument) {
73118      this._parse(xmlDocument);
73119    }
73120  }
73121  _repair(data) {
73122    return data.replace(/^[^<]+/, "").replaceAll(/>\\376\\377([^<]+)/g, function (all, codes) {
73123      const bytes = codes.replaceAll(/\\([0-3])([0-7])([0-7])/g, function (code, d1, d2, d3) {
73124        return String.fromCharCode(d1 * 64 + d2 * 8 + d3 * 1);
73125      }).replaceAll(/&(amp|apos|gt|lt|quot);/g, function (str, name) {
73126        switch (name) {
73127          case "amp":
73128            return "&";
73129          case "apos":
73130            return "'";
73131          case "gt":
73132            return ">";
73133          case "lt":
73134            return "<";
73135          case "quot":
73136            return '"';
73137        }
73138        throw new Error(`_repair: ${name} isn't defined.`);
73139      });
73140      const charBuf = [">"];
73141      for (let i = 0, ii = bytes.length; i < ii; i += 2) {
73142        const code = bytes.charCodeAt(i) * 256 + bytes.charCodeAt(i + 1);
73143        if (code >= 32 && code < 127 && code !== 60 && code !== 62 && code !== 38) {
73144          charBuf.push(String.fromCharCode(code));
73145        } else {
73146          charBuf.push("&#x" + (0x10000 + code).toString(16).substring(1) + ";");
73147        }
73148      }
73149      return charBuf.join("");
73150    });
73151  }
73152  _getSequence(entry) {
73153    const name = entry.nodeName;
73154    if (name !== "rdf:bag" && name !== "rdf:seq" && name !== "rdf:alt") {
73155      return null;
73156    }
73157    return entry.childNodes.filter(node => node.nodeName === "rdf:li");
73158  }
73159  _parseArray(entry) {
73160    if (!entry.hasChildNodes()) {
73161      return;
73162    }
73163    const [seqNode] = entry.childNodes;
73164    const sequence = this._getSequence(seqNode) || [];
73165    this._metadataMap.set(entry.nodeName, sequence.map(node => node.textContent.trim()));
73166  }
73167  _parse(xmlDocument) {
73168    let rdf = xmlDocument.documentElement;
73169    if (rdf.nodeName !== "rdf:rdf") {
73170      rdf = rdf.firstChild;
73171      while (rdf && rdf.nodeName !== "rdf:rdf") {
73172        rdf = rdf.nextSibling;
73173      }
73174    }
73175    if (!rdf || rdf.nodeName !== "rdf:rdf" || !rdf.hasChildNodes()) {
73176      return;
73177    }
73178    for (const desc of rdf.childNodes) {
73179      if (desc.nodeName !== "rdf:description") {
73180        continue;
73181      }
73182      for (const entry of desc.childNodes) {
73183        const name = entry.nodeName;
73184        switch (name) {
73185          case "#text":
73186            continue;
73187          case "dc:creator":
73188          case "dc:subject":
73189            this._parseArray(entry);
73190            continue;
73191        }
73192        this._metadataMap.set(name, entry.textContent.trim());
73193      }
73194    }
73195  }
73196  get serializable() {
73197    return {
73198      parsedData: this._metadataMap,
73199      rawData: this._data
73200    };
73201  }
73202}
73203exports.MetadataParser = MetadataParser;
73204
73205/***/ }),
73206/* 71 */
73207/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
73208
73209
73210
73211Object.defineProperty(exports, "__esModule", ({
73212  value: true
73213}));
73214exports.XMLParserErrorCode = exports.XMLParserBase = exports.SimpleXMLParser = exports.SimpleDOMNode = void 0;
73215var _core_utils = __w_pdfjs_require__(3);
73216const XMLParserErrorCode = {
73217  NoError: 0,
73218  EndOfDocument: -1,
73219  UnterminatedCdat: -2,
73220  UnterminatedXmlDeclaration: -3,
73221  UnterminatedDoctypeDeclaration: -4,
73222  UnterminatedComment: -5,
73223  MalformedElement: -6,
73224  OutOfMemory: -7,
73225  UnterminatedAttributeValue: -8,
73226  UnterminatedElement: -9,
73227  ElementNeverBegun: -10
73228};
73229exports.XMLParserErrorCode = XMLParserErrorCode;
73230function isWhitespace(s, index) {
73231  const ch = s[index];
73232  return ch === " " || ch === "\n" || ch === "\r" || ch === "\t";
73233}
73234function isWhitespaceString(s) {
73235  for (let i = 0, ii = s.length; i < ii; i++) {
73236    if (!isWhitespace(s, i)) {
73237      return false;
vendor: 9,465 bytes, lines 73238-73564
73238    }
73239  }
73240  return true;
73241}
73242class XMLParserBase {
73243  _resolveEntities(s) {
73244    return s.replaceAll(/&([^;]+);/g, (all, entity) => {
73245      if (entity.substring(0, 2) === "#x") {
73246        return String.fromCodePoint(parseInt(entity.substring(2), 16));
73247      } else if (entity.substring(0, 1) === "#") {
73248        return String.fromCodePoint(parseInt(entity.substring(1), 10));
73249      }
73250      switch (entity) {
73251        case "lt":
73252          return "<";
73253        case "gt":
73254          return ">";
73255        case "amp":
73256          return "&";
73257        case "quot":
73258          return '"';
73259        case "apos":
73260          return "'";
73261      }
73262      return this.onResolveEntity(entity);
73263    });
73264  }
73265  _parseContent(s, start) {
73266    const attributes = [];
73267    let pos = start;
73268    function skipWs() {
73269      while (pos < s.length && isWhitespace(s, pos)) {
73270        ++pos;
73271      }
73272    }
73273    while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "/") {
73274      ++pos;
73275    }
73276    const name = s.substring(start, pos);
73277    skipWs();
73278    while (pos < s.length && s[pos] !== ">" && s[pos] !== "/" && s[pos] !== "?") {
73279      skipWs();
73280      let attrName = "",
73281        attrValue = "";
73282      while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== "=") {
73283        attrName += s[pos];
73284        ++pos;
73285      }
73286      skipWs();
73287      if (s[pos] !== "=") {
73288        return null;
73289      }
73290      ++pos;
73291      skipWs();
73292      const attrEndChar = s[pos];
73293      if (attrEndChar !== '"' && attrEndChar !== "'") {
73294        return null;
73295      }
73296      const attrEndIndex = s.indexOf(attrEndChar, ++pos);
73297      if (attrEndIndex < 0) {
73298        return null;
73299      }
73300      attrValue = s.substring(pos, attrEndIndex);
73301      attributes.push({
73302        name: attrName,
73303        value: this._resolveEntities(attrValue)
73304      });
73305      pos = attrEndIndex + 1;
73306      skipWs();
73307    }
73308    return {
73309      name,
73310      attributes,
73311      parsed: pos - start
73312    };
73313  }
73314  _parseProcessingInstruction(s, start) {
73315    let pos = start;
73316    function skipWs() {
73317      while (pos < s.length && isWhitespace(s, pos)) {
73318        ++pos;
73319      }
73320    }
73321    while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "?" && s[pos] !== "/") {
73322      ++pos;
73323    }
73324    const name = s.substring(start, pos);
73325    skipWs();
73326    const attrStart = pos;
73327    while (pos < s.length && (s[pos] !== "?" || s[pos + 1] !== ">")) {
73328      ++pos;
73329    }
73330    const value = s.substring(attrStart, pos);
73331    return {
73332      name,
73333      value,
73334      parsed: pos - start
73335    };
73336  }
73337  parseXml(s) {
73338    let i = 0;
73339    while (i < s.length) {
73340      const ch = s[i];
73341      let j = i;
73342      if (ch === "<") {
73343        ++j;
73344        const ch2 = s[j];
73345        let q;
73346        switch (ch2) {
73347          case "/":
73348            ++j;
73349            q = s.indexOf(">", j);
73350            if (q < 0) {
73351              this.onError(XMLParserErrorCode.UnterminatedElement);
73352              return;
73353            }
73354            this.onEndElement(s.substring(j, q));
73355            j = q + 1;
73356            break;
73357          case "?":
73358            ++j;
73359            const pi = this._parseProcessingInstruction(s, j);
73360            if (s.substring(j + pi.parsed, j + pi.parsed + 2) !== "?>") {
73361              this.onError(XMLParserErrorCode.UnterminatedXmlDeclaration);
73362              return;
73363            }
73364            this.onPi(pi.name, pi.value);
73365            j += pi.parsed + 2;
73366            break;
73367          case "!":
73368            if (s.substring(j + 1, j + 3) === "--") {
73369              q = s.indexOf("-->", j + 3);
73370              if (q < 0) {
73371                this.onError(XMLParserErrorCode.UnterminatedComment);
73372                return;
73373              }
73374              this.onComment(s.substring(j + 3, q));
73375              j = q + 3;
73376            } else if (s.substring(j + 1, j + 8) === "[CDATA[") {
73377              q = s.indexOf("]]>", j + 8);
73378              if (q < 0) {
73379                this.onError(XMLParserErrorCode.UnterminatedCdat);
73380                return;
73381              }
73382              this.onCdata(s.substring(j + 8, q));
73383              j = q + 3;
73384            } else if (s.substring(j + 1, j + 8) === "DOCTYPE") {
73385              const q2 = s.indexOf("[", j + 8);
73386              let complexDoctype = false;
73387              q = s.indexOf(">", j + 8);
73388              if (q < 0) {
73389                this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration);
73390                return;
73391              }
73392              if (q2 > 0 && q > q2) {
73393                q = s.indexOf("]>", j + 8);
73394                if (q < 0) {
73395                  this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration);
73396                  return;
73397                }
73398                complexDoctype = true;
73399              }
73400              const doctypeContent = s.substring(j + 8, q + (complexDoctype ? 1 : 0));
73401              this.onDoctype(doctypeContent);
73402              j = q + (complexDoctype ? 2 : 1);
73403            } else {
73404              this.onError(XMLParserErrorCode.MalformedElement);
73405              return;
73406            }
73407            break;
73408          default:
73409            const content = this._parseContent(s, j);
73410            if (content === null) {
73411              this.onError(XMLParserErrorCode.MalformedElement);
73412              return;
73413            }
73414            let isClosed = false;
73415            if (s.substring(j + content.parsed, j + content.parsed + 2) === "/>") {
73416              isClosed = true;
73417            } else if (s.substring(j + content.parsed, j + content.parsed + 1) !== ">") {
73418              this.onError(XMLParserErrorCode.UnterminatedElement);
73419              return;
73420            }
73421            this.onBeginElement(content.name, content.attributes, isClosed);
73422            j += content.parsed + (isClosed ? 2 : 1);
73423            break;
73424        }
73425      } else {
73426        while (j < s.length && s[j] !== "<") {
73427          j++;
73428        }
73429        const text = s.substring(i, j);
73430        this.onText(this._resolveEntities(text));
73431      }
73432      i = j;
73433    }
73434  }
73435  onResolveEntity(name) {
73436    return `&${name};`;
73437  }
73438  onPi(name, value) {}
73439  onComment(text) {}
73440  onCdata(text) {}
73441  onDoctype(doctypeContent) {}
73442  onText(text) {}
73443  onBeginElement(name, attributes, isEmpty) {}
73444  onEndElement(name) {}
73445  onError(code) {}
73446}
73447exports.XMLParserBase = XMLParserBase;
73448class SimpleDOMNode {
73449  constructor(nodeName, nodeValue) {
73450    this.nodeName = nodeName;
73451    this.nodeValue = nodeValue;
73452    Object.defineProperty(this, "parentNode", {
73453      value: null,
73454      writable: true
73455    });
73456  }
73457  get firstChild() {
73458    return this.childNodes?.[0];
73459  }
73460  get nextSibling() {
73461    const childNodes = this.parentNode.childNodes;
73462    if (!childNodes) {
73463      return undefined;
73464    }
73465    const index = childNodes.indexOf(this);
73466    if (index === -1) {
73467      return undefined;
73468    }
73469    return childNodes[index + 1];
73470  }
73471  get textContent() {
73472    if (!this.childNodes) {
73473      return this.nodeValue || "";
73474    }
73475    return this.childNodes.map(function (child) {
73476      return child.textContent;
73477    }).join("");
73478  }
73479  get children() {
73480    return this.childNodes || [];
73481  }
73482  hasChildNodes() {
73483    return this.childNodes?.length > 0;
73484  }
73485  searchNode(paths, pos) {
73486    if (pos >= paths.length) {
73487      return this;
73488    }
73489    const component = paths[pos];
73490    if (component.name.startsWith("#") && pos < paths.length - 1) {
73491      return this.searchNode(paths, pos + 1);
73492    }
73493    const stack = [];
73494    let node = this;
73495    while (true) {
73496      if (component.name === node.nodeName) {
73497        if (component.pos === 0) {
73498          const res = node.searchNode(paths, pos + 1);
73499          if (res !== null) {
73500            return res;
73501          }
73502        } else if (stack.length === 0) {
73503          return null;
73504        } else {
73505          const [parent] = stack.pop();
73506          let siblingPos = 0;
73507          for (const child of parent.childNodes) {
73508            if (component.name === child.nodeName) {
73509              if (siblingPos === component.pos) {
73510                return child.searchNode(paths, pos + 1);
73511              }
73512              siblingPos++;
73513            }
73514          }
73515          return node.searchNode(paths, pos + 1);
73516        }
73517      }
73518      if (node.childNodes?.length > 0) {
73519        stack.push([node, 0]);
73520        node = node.childNodes[0];
73521      } else if (stack.length === 0) {
73522        return null;
73523      } else {
73524        while (stack.length !== 0) {
73525          const [parent, currentPos] = stack.pop();
73526          const newPos = currentPos + 1;
73527          if (newPos < parent.childNodes.length) {
73528            stack.push([parent, newPos]);
73529            node = parent.childNodes[newPos];
73530            break;
73531          }
73532        }
73533        if (stack.length === 0) {
73534          return null;
73535        }
73536      }
73537    }
73538  }
73539  dump(buffer) {
73540    if (this.nodeName === "#text") {
73541      buffer.push((0, _core_utils.encodeToXmlString)(this.nodeValue));
73542      return;
73543    }
73544    buffer.push(`<${this.nodeName}`);
73545    if (this.attributes) {
73546      for (const attribute of this.attributes) {
73547        buffer.push(` ${attribute.name}="${(0, _core_utils.encodeToXmlString)(attribute.value)}"`);
73548      }
73549    }
73550    if (this.hasChildNodes()) {
73551      buffer.push(">");
73552      for (const child of this.childNodes) {
73553        child.dump(buffer);
73554      }
73555      buffer.push(`</${this.nodeName}>`);
73556    } else if (this.nodeValue) {
73557      buffer.push(`>${(0, _core_utils.encodeToXmlString)(this.nodeValue)}</${this.nodeName}>`);
73558    } else {
73559      buffer.push("/>");
73560    }
73561  }
73562}
73563exports.SimpleDOMNode = SimpleDOMNode;
73564class SimpleXMLParser extends XMLParserBase {
73565  constructor({
73566    hasAttributes = false,
73567    lowerCaseName = false
73568  }) {
73569    super();
73570    this._currentFragment = null;
73571    this._stack = null;
73572    this._errorCode = XMLParserErrorCode.NoError;
73573    this._hasAttributes = hasAttributes;
73574    this._lowerCaseName = lowerCaseName;
73575  }
73576  parseFromString(data) {
73577    this._currentFragment = [];
73578    this._stack = [];
73579    this._errorCode = XMLParserErrorCode.NoError;
73580    this.parseXml(data);
73581    if (this._errorCode !== XMLParserErrorCode.NoError) {
73582      return undefined;
73583    }
73584    const [documentElement] = this._currentFragment;
73585    if (!documentElement) {
73586      return undefined;
73587    }
73588    return {
73589      documentElement
73590    };
73591  }
73592  onText(text) {
73593    if (isWhitespaceString(text)) {
73594      return;
73595    }
73596    const node = new SimpleDOMNode("#text", text);
73597    this._currentFragment.push(node);
73598  }
73599  onCdata(text) {
73600    const node = new SimpleDOMNode("#text", text);
73601    this._currentFragment.push(node);
73602  }
73603  onBeginElement(name, attributes, isEmpty) {
73604    if (this._lowerCaseName) {
73605      name = name.toLowerCase();
73606    }
73607    const node = new SimpleDOMNode(name);
73608    node.childNodes = [];
73609    if (this._hasAttributes) {
73610      node.attributes = attributes;
73611    }
73612    this._currentFragment.push(node);
73613    if (isEmpty) {
73614      return;
73615    }
73616    this._stack.push(this._currentFragment);
73617    this._currentFragment = node.childNodes;
73618  }
73619  onEndElement(name) {
73620    this._currentFragment = this._stack.pop() || [];
73621    const lastElement = this._currentFragment.at(-1);
73622    if (!lastElement) {
73623      return null;
73624    }
73625    for (const childNode of lastElement.childNodes) {
73626      childNode.parentNode = lastElement;
73627    }
73628    return lastElement;
73629  }
73630  onError(code) {
73631    this._errorCode = code;
73632  }
73633}
73634exports.SimpleXMLParser = SimpleXMLParser;
73635
73636/***/ }),
73637/* 72 */
73638/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
73639
73640
73641
73642Object.defineProperty(exports, "__esModule", ({
73643  value: true
73644}));
73645exports.StructTreeRoot = exports.StructTreePage = void 0;
73646var _util = __w_pdfjs_require__(2);
73647var _primitives = __w_pdfjs_require__(4);
73648var _name_number_tree = __w_pdfjs_require__(67);
73649var _writer = __w_pdfjs_require__(73);
73650const MAX_DEPTH = 40;
73651const StructElementType = {
73652  PAGE_CONTENT: 1,
73653  STREAM_CONTENT: 2,
73654  OBJECT: 3,
73655  ANNOTATION: 4,
73656  ELEMENT: 5
73657};
73658class StructTreeRoot {
73659  constructor(rootDict, rootRef) {
73660    this.dict = rootDict;
73661    this.ref = rootRef instanceof _primitives.Ref ? rootRef : null;
73662    this.roleMap = new Map();
73663    this.structParentIds = null;
73664  }
73665  init() {
73666    this.readRoleMap();
73667  }
73668  #addIdToPage(pageRef, id, type) {
73669    if (!(pageRef instanceof _primitives.Ref) || id < 0) {
73670      return;
73671    }
73672    this.structParentIds ||= new _primitives.RefSetCache();
73673    let ids = this.structParentIds.get(pageRef);
73674    if (!ids) {
73675      ids = [];
73676      this.structParentIds.put(pageRef, ids);
73677    }
73678    ids.push([id, type]);
73679  }
73680  addAnnotationIdToPage(pageRef, id) {
73681    this.#addIdToPage(pageRef, id, StructElementType.ANNOTATION);
73682  }
73683  readRoleMap() {
73684    const roleMapDict = this.dict.get("RoleMap");
73685    if (!(roleMapDict instanceof _primitives.Dict)) {
73686      return;
73687    }
73688    roleMapDict.forEach((key, value) => {
73689      if (!(value instanceof _primitives.Name)) {
73690        return;
73691      }
73692      this.roleMap.set(key, value.name);
73693    });
73694  }
73695  static async canCreateStructureTree({
73696    catalogRef,
73697    pdfManager,
73698    newAnnotationsByPage
73699  }) {
73700    if (!(catalogRef instanceof _primitives.Ref)) {
73701      (0, _util.warn)("Cannot save the struct tree: no catalog reference.");
73702      return false;
73703    }
73704    let nextKey = 0;
73705    let hasNothingToUpdate = true;
73706    for (const [pageIndex, elements] of newAnnotationsByPage) {
73707      const {
73708        ref: pageRef
73709      } = await pdfManager.getPage(pageIndex);
73710      if (!(pageRef instanceof _primitives.Ref)) {
73711        (0, _util.warn)(`Cannot save the struct tree: page ${pageIndex} has no ref.`);
73712        hasNothingToUpdate = true;
73713        break;
73714      }
73715      for (const element of elements) {
73716        if (element.accessibilityData?.type) {
73717          element.parentTreeId = nextKey++;
73718          hasNothingToUpdate = false;
73719        }
73720      }
73721    }
73722    if (hasNothingToUpdate) {
73723      for (const elements of newAnnotationsByPage.values()) {
73724        for (const element of elements) {
73725          delete element.parentTreeId;
73726        }
73727      }
73728      return false;
73729    }
73730    return true;
73731  }
73732  static async createStructureTree({
73733    newAnnotationsByPage,
73734    xref,
73735    catalogRef,
73736    pdfManager,
73737    newRefs
73738  }) {
73739    const root = pdfManager.catalog.cloneDict();
73740    const structTreeRootRef = xref.getNewTemporaryRef();
73741    root.set("StructTreeRoot", structTreeRootRef);
73742    const buffer = [];
73743    await (0, _writer.writeObject)(catalogRef, root, buffer, xref);
73744    newRefs.push({
73745      ref: catalogRef,
73746      data: buffer.join("")
73747    });
73748    const structTreeRoot = new _primitives.Dict(xref);
73749    structTreeRoot.set("Type", _primitives.Name.get("StructTreeRoot"));
73750    const parentTreeRef = xref.getNewTemporaryRef();
73751    structTreeRoot.set("ParentTree", parentTreeRef);
73752    const kids = [];
73753    structTreeRoot.set("K", kids);
73754    const parentTree = new _primitives.Dict(xref);
73755    const nums = [];
73756    parentTree.set("Nums", nums);
73757    const nextKey = await this.#writeKids({
73758      newAnnotationsByPage,
73759      structTreeRootRef,
73760      kids,
73761      nums,
73762      xref,
73763      pdfManager,
73764      newRefs,
73765      buffer
73766    });
73767    structTreeRoot.set("ParentTreeNextKey", nextKey);
73768    buffer.length = 0;
73769    await (0, _writer.writeObject)(parentTreeRef, parentTree, buffer, xref);
73770    newRefs.push({
73771      ref: parentTreeRef,
73772      data: buffer.join("")
73773    });
73774    buffer.length = 0;
73775    await (0, _writer.writeObject)(structTreeRootRef, structTreeRoot, buffer, xref);
73776    newRefs.push({
73777      ref: structTreeRootRef,
73778      data: buffer.join("")
73779    });
73780  }
73781  async canUpdateStructTree({
73782    pdfManager,
73783    newAnnotationsByPage
73784  }) {
73785    if (!this.ref) {
73786      (0, _util.warn)("Cannot update the struct tree: no root reference.");
73787      return false;
73788    }
73789    let nextKey = this.dict.get("ParentTreeNextKey");
73790    if (!Number.isInteger(nextKey) || nextKey < 0) {
73791      (0, _util.warn)("Cannot update the struct tree: invalid next key.");
73792      return false;
73793    }
73794    const parentTree = this.dict.get("ParentTree");
73795    if (!(parentTree instanceof _primitives.Dict)) {
73796      (0, _util.warn)("Cannot update the struct tree: ParentTree isn't a dict.");
73797      return false;
73798    }
73799    const nums = parentTree.get("Nums");
73800    if (!Array.isArray(nums)) {
73801      (0, _util.warn)("Cannot update the struct tree: nums isn't an array.");
73802      return false;
73803    }
73804    const {
73805      numPages
73806    } = pdfManager.catalog;
73807    for (const pageIndex of newAnnotationsByPage.keys()) {
73808      const {
73809        pageDict,
73810        ref: pageRef
73811      } = await pdfManager.getPage(pageIndex);
73812      if (!(pageRef instanceof _primitives.Ref)) {
73813        (0, _util.warn)(`Cannot save the struct tree: page ${pageIndex} has no ref.`);
73814        return false;
73815      }
73816      const id = pageDict.get("StructParents");
73817      if (!Number.isInteger(id) || id < 0 || id >= numPages) {
73818        (0, _util.warn)(`Cannot save the struct tree: page ${pageIndex} has no id.`);
73819        return false;
73820      }
73821    }
73822    let hasNothingToUpdate = true;
73823    for (const [pageIndex, elements] of newAnnotationsByPage) {
73824      const {
73825        pageDict
73826      } = await pdfManager.getPage(pageIndex);
73827      StructTreeRoot.#collectParents({
73828        elements,
73829        xref: this.dict.xref,
73830        pageDict,
73831        parentTree
73832      });
73833      for (const element of elements) {
73834        if (element.accessibilityData?.type) {
73835          element.parentTreeId = nextKey++;
73836          hasNothingToUpdate = false;
73837        }
73838      }
73839    }
73840    if (hasNothingToUpdate) {
73841      for (const elements of newAnnotationsByPage.values()) {
73842        for (const element of elements) {
73843          delete element.parentTreeId;
73844          delete element.structTreeParent;
73845        }
73846      }
73847      return false;
73848    }
73849    return true;
73850  }
73851  async updateStructureTree({
73852    newAnnotationsByPage,
73853    pdfManager,
73854    newRefs
73855  }) {
73856    const xref = this.dict.xref;
73857    const structTreeRoot = this.dict.clone();
73858    const structTreeRootRef = this.ref;
73859    let parentTreeRef = structTreeRoot.getRaw("ParentTree");
73860    let parentTree;
73861    if (parentTreeRef instanceof _primitives.Ref) {
73862      parentTree = xref.fetch(parentTreeRef);
73863    } else {
73864      parentTree = parentTreeRef;
73865      parentTreeRef = xref.getNewTemporaryRef();
73866      structTreeRoot.set("ParentTree", parentTreeRef);
73867    }
73868    parentTree = parentTree.clone();
73869    let nums = parentTree.getRaw("Nums");
73870    let numsRef = null;
73871    if (nums instanceof _primitives.Ref) {
73872      numsRef = nums;
73873      nums = xref.fetch(numsRef);
73874    }
73875    nums = nums.slice();
73876    if (!numsRef) {
73877      parentTree.set("Nums", nums);
73878    }
73879    let kids = structTreeRoot.getRaw("K");
73880    let kidsRef = null;
73881    if (kids instanceof _primitives.Ref) {
73882      kidsRef = kids;
73883      kids = xref.fetch(kidsRef);
73884    } else {
73885      kidsRef = xref.getNewTemporaryRef();
73886      structTreeRoot.set("K", kidsRef);
73887    }
73888    kids = Array.isArray(kids) ? kids.slice() : [kids];
73889    const buffer = [];
73890    const newNextkey = await StructTreeRoot.#writeKids({
73891      newAnnotationsByPage,
73892      structTreeRootRef,
73893      kids,
73894      nums,
73895      xref,
73896      pdfManager,
73897      newRefs,
73898      buffer
73899    });
73900    structTreeRoot.set("ParentTreeNextKey", newNextkey);
73901    buffer.length = 0;
73902    await (0, _writer.writeObject)(kidsRef, kids, buffer, xref);
73903    newRefs.push({
73904      ref: kidsRef,
73905      data: buffer.join("")
73906    });
73907    if (numsRef) {
73908      buffer.length = 0;
73909      await (0, _writer.writeObject)(numsRef, nums, buffer, xref);
73910      newRefs.push({
73911        ref: numsRef,
73912        data: buffer.join("")
73913      });
73914    }
73915    buffer.length = 0;
73916    await (0, _writer.writeObject)(parentTreeRef, parentTree, buffer, xref);
73917    newRefs.push({
73918      ref: parentTreeRef,
73919      data: buffer.join("")
73920    });
73921    buffer.length = 0;
73922    await (0, _writer.writeObject)(structTreeRootRef, structTreeRoot, buffer, xref);
73923    newRefs.push({
73924      ref: structTreeRootRef,
73925      data: buffer.join("")
73926    });
73927  }
73928  static async #writeKids({
73929    newAnnotationsByPage,
73930    structTreeRootRef,
73931    kids,
73932    nums,
73933    xref,
73934    pdfManager,
73935    newRefs,
73936    buffer
73937  }) {
73938    const objr = _primitives.Name.get("OBJR");
73939    let nextKey = -Infinity;
73940    for (const [pageIndex, elements] of newAnnotationsByPage) {
73941      const {
73942        ref: pageRef
73943      } = await pdfManager.getPage(pageIndex);
73944      for (const {
73945        accessibilityData: {
73946          type,
73947          title,
73948          lang,
73949          alt,
73950          expanded,
73951          actualText
73952        },
73953        ref,
73954        parentTreeId,
73955        structTreeParent
73956      } of elements) {
73957        nextKey = Math.max(nextKey, parentTreeId);
73958        const tagRef = xref.getNewTemporaryRef();
73959        const tagDict = new _primitives.Dict(xref);
73960        tagDict.set("S", _primitives.Name.get(type));
73961        if (title) {
73962          tagDict.set("T", title);
73963        }
73964        if (lang) {
73965          tagDict.set("Lang", lang);
73966        }
73967        if (alt) {
73968          tagDict.set("Alt", alt);
73969        }
73970        if (expanded) {
73971          tagDict.set("E", expanded);
73972        }
73973        if (actualText) {
73974          tagDict.set("ActualText", actualText);
73975        }
73976        if (structTreeParent) {
73977          await this.#updateParentTag({
73978            structTreeParent,
73979            tagDict,
73980            newTagRef: tagRef,
73981            fallbackRef: structTreeRootRef,
73982            xref,
73983            newRefs,
73984            buffer
73985          });
73986        } else {
73987          tagDict.set("P", structTreeRootRef);
73988        }
73989        const objDict = new _primitives.Dict(xref);
73990        tagDict.set("K", objDict);
73991        objDict.set("Type", objr);
73992        objDict.set("Pg", pageRef);
73993        objDict.set("Obj", ref);
73994        buffer.length = 0;
73995        await (0, _writer.writeObject)(tagRef, tagDict, buffer, xref);
73996        newRefs.push({
73997          ref: tagRef,
73998          data: buffer.join("")
73999        });
74000        nums.push(parentTreeId, tagRef);
74001        kids.push(tagRef);
74002      }
74003    }
74004    return nextKey + 1;
74005  }
74006  static #collectParents({
74007    elements,
74008    xref,
74009    pageDict,
74010    parentTree
74011  }) {
74012    const idToElement = new Map();
74013    for (const element of elements) {
74014      if (element.structTreeParentId) {
74015        const id = parseInt(element.structTreeParentId.split("_mc")[1], 10);
74016        idToElement.set(id, element);
74017      }
74018    }
74019    const id = pageDict.get("StructParents");
74020    const numberTree = new _name_number_tree.NumberTree(parentTree, xref);
74021    const parentArray = numberTree.get(id);
74022    if (!Array.isArray(parentArray)) {
74023      return;
74024    }
74025    const updateElement = (kid, pageKid, kidRef) => {
74026      const element = idToElement.get(kid);
74027      if (element) {
74028        const parentRef = pageKid.getRaw("P");
74029        const parentDict = xref.fetchIfRef(parentRef);
74030        if (parentRef instanceof _primitives.Ref && parentDict instanceof _primitives.Dict) {
74031          element.structTreeParent = {
74032            ref: kidRef,
74033            dict: pageKid
74034          };
74035        }
74036        return true;
74037      }
74038      return false;
74039    };
74040    for (const kidRef of parentArray) {
74041      if (!(kidRef instanceof _primitives.Ref)) {
74042        continue;
74043      }
74044      const pageKid = xref.fetch(kidRef);
74045      const k = pageKid.get("K");
74046      if (Number.isInteger(k)) {
74047        updateElement(k, pageKid, kidRef);
74048        continue;
74049      }
74050      if (!Array.isArray(k)) {
74051        continue;
74052      }
74053      for (let kid of k) {
74054        kid = xref.fetchIfRef(kid);
74055        if (Number.isInteger(kid) && updateElement(kid, pageKid, kidRef)) {
74056          break;
74057        }
74058      }
74059    }
74060  }
74061  static async #updateParentTag({
74062    structTreeParent: {
74063      ref,
74064      dict
74065    },
74066    tagDict,
74067    newTagRef,
74068    fallbackRef,
74069    xref,
74070    newRefs,
74071    buffer
74072  }) {
74073    const parentRef = dict.getRaw("P");
74074    let parentDict = xref.fetchIfRef(parentRef);
74075    tagDict.set("P", parentRef);
74076    let saveParentDict = false;
74077    let parentKids;
74078    let parentKidsRef = parentDict.getRaw("K");
74079    if (!(parentKidsRef instanceof _primitives.Ref)) {
74080      parentKids = parentKidsRef;
74081      parentKidsRef = xref.getNewTemporaryRef();
74082      parentDict = parentDict.clone();
74083      parentDict.set("K", parentKidsRef);
74084      saveParentDict = true;
74085    } else {
74086      parentKids = xref.fetch(parentKidsRef);
74087    }
74088    if (Array.isArray(parentKids)) {
74089      const index = parentKids.indexOf(ref);
74090      if (index >= 0) {
74091        parentKids = parentKids.slice();
74092        parentKids.splice(index + 1, 0, newTagRef);
74093      } else {
74094        (0, _util.warn)("Cannot update the struct tree: parent kid not found.");
74095        tagDict.set("P", fallbackRef);
74096        return;
74097      }
74098    } else if (parentKids instanceof _primitives.Dict) {
74099      parentKids = [parentKidsRef, newTagRef];
74100      parentKidsRef = xref.getNewTemporaryRef();
74101      parentDict.set("K", parentKidsRef);
74102      saveParentDict = true;
74103    }
74104    buffer.length = 0;
74105    await (0, _writer.writeObject)(parentKidsRef, parentKids, buffer, xref);
74106    newRefs.push({
74107      ref: parentKidsRef,
74108      data: buffer.join("")
74109    });
74110    if (!saveParentDict) {
74111      return;
74112    }
74113    buffer.length = 0;
74114    await (0, _writer.writeObject)(parentRef, parentDict, buffer, xref);
74115    newRefs.push({
74116      ref: parentRef,
74117      data: buffer.join("")
74118    });
74119  }
74120}
74121exports.StructTreeRoot = StructTreeRoot;
74122class StructElementNode {
74123  constructor(tree, dict) {
74124    this.tree = tree;
74125    this.dict = dict;
74126    this.kids = [];
74127    this.parseKids();
74128  }
74129  get role() {
74130    const nameObj = this.dict.get("S");
74131    const name = nameObj instanceof _primitives.Name ? nameObj.name : "";
74132    const {
74133      root
74134    } = this.tree;
74135    if (root.roleMap.has(name)) {
74136      return root.roleMap.get(name);
74137    }
74138    return name;
74139  }
74140  parseKids() {
74141    let pageObjId = null;
74142    const objRef = this.dict.getRaw("Pg");
74143    if (objRef instanceof _primitives.Ref) {
74144      pageObjId = objRef.toString();
74145    }
74146    const kids = this.dict.get("K");
74147    if (Array.isArray(kids)) {
74148      for (const kid of kids) {
74149        const element = this.parseKid(pageObjId, kid);
74150        if (element) {
74151          this.kids.push(element);
74152        }
74153      }
74154    } else {
74155      const element = this.parseKid(pageObjId, kids);
74156      if (element) {
74157        this.kids.push(element);
74158      }
74159    }
74160  }
74161  parseKid(pageObjId, kid) {
74162    if (Number.isInteger(kid)) {
74163      if (this.tree.pageDict.objId !== pageObjId) {
74164        return null;
74165      }
74166      return new StructElement({
74167        type: StructElementType.PAGE_CONTENT,
74168        mcid: kid,
74169        pageObjId
74170      });
74171    }
74172    let kidDict = null;
74173    if (kid instanceof _primitives.Ref) {
74174      kidDict = this.dict.xref.fetch(kid);
74175    } else if (kid instanceof _primitives.Dict) {
74176      kidDict = kid;
74177    }
74178    if (!kidDict) {
74179      return null;
74180    }
74181    const pageRef = kidDict.getRaw("Pg");
74182    if (pageRef instanceof _primitives.Ref) {
74183      pageObjId = pageRef.toString();
74184    }
74185    const type = kidDict.get("Type") instanceof _primitives.Name ? kidDict.get("Type").name : null;
74186    if (type === "MCR") {
74187      if (this.tree.pageDict.objId !== pageObjId) {
74188        return null;
74189      }
74190      const kidRef = kidDict.getRaw("Stm");
74191      return new StructElement({
74192        type: StructElementType.STREAM_CONTENT,
74193        refObjId: kidRef instanceof _primitives.Ref ? kidRef.toString() : null,
74194        pageObjId,
74195        mcid: kidDict.get("MCID")
74196      });
74197    }
74198    if (type === "OBJR") {
74199      if (this.tree.pageDict.objId !== pageObjId) {
74200        return null;
74201      }
74202      const kidRef = kidDict.getRaw("Obj");
74203      return new StructElement({
74204        type: StructElementType.OBJECT,
74205        refObjId: kidRef instanceof _primitives.Ref ? kidRef.toString() : null,
74206        pageObjId
74207      });
74208    }
74209    return new StructElement({
74210      type: StructElementType.ELEMENT,
74211      dict: kidDict
74212    });
74213  }
74214}
74215class StructElement {
74216  constructor({
74217    type,
74218    dict = null,
74219    mcid = null,
74220    pageObjId = null,
74221    refObjId = null
74222  }) {
74223    this.type = type;
74224    this.dict = dict;
74225    this.mcid = mcid;
74226    this.pageObjId = pageObjId;
74227    this.refObjId = refObjId;
74228    this.parentNode = null;
74229  }
74230}
74231class StructTreePage {
74232  constructor(structTreeRoot, pageDict) {
74233    this.root = structTreeRoot;
74234    this.rootDict = structTreeRoot ? structTreeRoot.dict : null;
74235    this.pageDict = pageDict;
74236    this.nodes = [];
74237  }
74238  parse(pageRef) {
74239    if (!this.root || !this.rootDict) {
74240      return;
74241    }
74242    const parentTree = this.rootDict.get("ParentTree");
74243    if (!parentTree) {
74244      return;
74245    }
74246    const id = this.pageDict.get("StructParents");
74247    const ids = pageRef instanceof _primitives.Ref && this.root.structParentIds?.get(pageRef);
74248    if (!Number.isInteger(id) && !ids) {
74249      return;
74250    }
74251    const map = new Map();
74252    const numberTree = new _name_number_tree.NumberTree(parentTree, this.rootDict.xref);
74253    if (Number.isInteger(id)) {
74254      const parentArray = numberTree.get(id);
74255      if (Array.isArray(parentArray)) {
74256        for (const ref of parentArray) {
74257          if (ref instanceof _primitives.Ref) {
74258            this.addNode(this.rootDict.xref.fetch(ref), map);
74259          }
74260        }
74261      }
74262    }
74263    if (!ids) {
74264      return;
74265    }
74266    for (const [elemId, type] of ids) {
74267      const obj = numberTree.get(elemId);
74268      if (obj) {
74269        const elem = this.addNode(this.rootDict.xref.fetchIfRef(obj), map);
74270        if (elem?.kids?.length === 1 && elem.kids[0].type === StructElementType.OBJECT) {
74271          elem.kids[0].type = type;
74272        }
74273      }
74274    }
74275  }
74276  addNode(dict, map, level = 0) {
74277    if (level > MAX_DEPTH) {
74278      (0, _util.warn)("StructTree MAX_DEPTH reached.");
74279      return null;
74280    }
74281    if (map.has(dict)) {
74282      return map.get(dict);
74283    }
74284    const element = new StructElementNode(this, dict);
74285    map.set(dict, element);
74286    const parent = dict.get("P");
74287    if (!parent || (0, _primitives.isName)(parent.get("Type"), "StructTreeRoot")) {
74288      if (!this.addTopLevelNode(dict, element)) {
74289        map.delete(dict);
74290      }
74291      return element;
74292    }
74293    const parentNode = this.addNode(parent, map, level + 1);
74294    if (!parentNode) {
74295      return element;
74296    }
74297    let save = false;
74298    for (const kid of parentNode.kids) {
74299      if (kid.type === StructElementType.ELEMENT && kid.dict === dict) {
74300        kid.parentNode = element;
74301        save = true;
74302      }
74303    }
74304    if (!save) {
74305      map.delete(dict);
74306    }
74307    return element;
74308  }
74309  addTopLevelNode(dict, element) {
74310    const obj = this.rootDict.get("K");
74311    if (!obj) {
74312      return false;
74313    }
74314    if (obj instanceof _primitives.Dict) {
74315      if (obj.objId !== dict.objId) {
74316        return false;
74317      }
74318      this.nodes[0] = element;
74319      return true;
74320    }
74321    if (!Array.isArray(obj)) {
74322      return true;
74323    }
74324    let save = false;
74325    for (let i = 0; i < obj.length; i++) {
74326      const kidRef = obj[i];
74327      if (kidRef?.toString() === dict.objId) {
74328        this.nodes[i] = element;
74329        save = true;
74330      }
74331    }
74332    return save;
74333  }
74334  get serializable() {
74335    function nodeToSerializable(node, parent, level = 0) {
74336      if (level > MAX_DEPTH) {
74337        (0, _util.warn)("StructTree too deep to be fully serialized.");
74338        return;
74339      }
74340      const obj = Object.create(null);
74341      obj.role = node.role;
74342      obj.children = [];
74343      parent.children.push(obj);
74344      const alt = node.dict.get("Alt");
74345      if (typeof alt === "string") {
74346        obj.alt = (0, _util.stringToPDFString)(alt);
74347      }
74348      const lang = node.dict.get("Lang");
74349      if (typeof lang === "string") {
74350        obj.lang = (0, _util.stringToPDFString)(lang);
74351      }
74352      for (const kid of node.kids) {
74353        const kidElement = kid.type === StructElementType.ELEMENT ? kid.parentNode : null;
74354        if (kidElement) {
74355          nodeToSerializable(kidElement, obj, level + 1);
74356          continue;
74357        } else if (kid.type === StructElementType.PAGE_CONTENT || kid.type === StructElementType.STREAM_CONTENT) {
74358          obj.children.push({
74359            type: "content",
74360            id: `p${kid.pageObjId}_mc${kid.mcid}`
74361          });
74362        } else if (kid.type === StructElementType.OBJECT) {
74363          obj.children.push({
74364            type: "object",
74365            id: kid.refObjId
74366          });
74367        } else if (kid.type === StructElementType.ANNOTATION) {
74368          obj.children.push({
74369            type: "annotation",
74370            id: `${_util.AnnotationPrefix}${kid.refObjId}`
74371          });
74372        }
74373      }
74374    }
74375    const root = Object.create(null);
74376    root.children = [];
74377    root.role = "Root";
74378    for (const child of this.nodes) {
74379      if (!child) {
74380        continue;
74381      }
74382      nodeToSerializable(child, root);
74383    }
74384    return root;
74385  }
74386}
74387exports.StructTreePage = StructTreePage;
74388
74389/***/ }),
74390/* 73 */
74391/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
74392
74393
74394
74395Object.defineProperty(exports, "__esModule", ({
74396  value: true
74397}));
74398exports.incrementalUpdate = incrementalUpdate;
74399exports.writeDict = writeDict;
74400exports.writeObject = writeObject;
74401var _util = __w_pdfjs_require__(2);
74402var _primitives = __w_pdfjs_require__(4);
74403var _core_utils = __w_pdfjs_require__(3);
74404var _xml_parser = __w_pdfjs_require__(71);
74405var _base_stream = __w_pdfjs_require__(5);
74406var _crypto = __w_pdfjs_require__(74);
74407async function writeObject(ref, obj, buffer, {
74408  encrypt = null
74409}) {
74410  const transform = encrypt?.createCipherTransform(ref.num, ref.gen);
74411  buffer.push(`${ref.num} ${ref.gen} obj\n`);
74412  if (obj instanceof _primitives.Dict) {
74413    await writeDict(obj, buffer, transform);
74414  } else if (obj instanceof _base_stream.BaseStream) {
74415    await writeStream(obj, buffer, transform);
74416  } else if (Array.isArray(obj)) {
74417    await writeArray(obj, buffer, transform);
74418  }
74419  buffer.push("\nendobj\n");
74420}
74421async function writeDict(dict, buffer, transform) {
74422  buffer.push("<<");
74423  for (const key of dict.getKeys()) {
74424    buffer.push(` /${(0, _core_utils.escapePDFName)(key)} `);
74425    await writeValue(dict.getRaw(key), buffer, transform);
74426  }
74427  buffer.push(">>");
74428}
74429async function writeStream(stream, buffer, transform) {
74430  let string = stream.getString();
74431  const {
74432    dict
74433  } = stream;
74434  const [filter, params] = await Promise.all([dict.getAsync("Filter"), dict.getAsync("DecodeParms")]);
74435  const filterZero = Array.isArray(filter) ? await dict.xref.fetchIfRefAsync(filter[0]) : filter;
74436  const isFilterZeroFlateDecode = (0, _primitives.isName)(filterZero, "FlateDecode");
74437  const MIN_LENGTH_FOR_COMPRESSING = 256;
74438  if (typeof CompressionStream !== "undefined" && (string.length >= MIN_LENGTH_FOR_COMPRESSING || isFilterZeroFlateDecode)) {
74439    try {
74440      const byteArray = (0, _util.stringToBytes)(string);
74441      const cs = new CompressionStream("deflate");
74442      const writer = cs.writable.getWriter();
74443      writer.write(byteArray);
74444      writer.close();
74445      const buf = await new Response(cs.readable).arrayBuffer();
74446      string = (0, _util.bytesToString)(new Uint8Array(buf));
74447      let newFilter, newParams;
74448      if (!filter) {
74449        newFilter = _primitives.Name.get("FlateDecode");
74450      } else if (!isFilterZeroFlateDecode) {
74451        newFilter = Array.isArray(filter) ? [_primitives.Name.get("FlateDecode"), ...filter] : [_primitives.Name.get("FlateDecode"), filter];
74452        if (params) {
74453          newParams = Array.isArray(params) ? [null, ...params] : [null, params];
74454        }
74455      }
74456      if (newFilter) {
74457        dict.set("Filter", newFilter);
74458      }
74459      if (newParams) {
74460        dict.set("DecodeParms", newParams);
74461      }
74462    } catch (ex) {
74463      (0, _util.info)(`writeStream - cannot compress data: "${ex}".`);
74464    }
74465  }
74466  if (transform) {
74467    string = transform.encryptString(string);
74468  }
74469  dict.set("Length", string.length);
74470  await writeDict(dict, buffer, transform);
74471  buffer.push(" stream\n", string, "\nendstream");
74472}
74473async function writeArray(array, buffer, transform) {
74474  buffer.push("[");
74475  let first = true;
74476  for (const val of array) {
74477    if (!first) {
74478      buffer.push(" ");
74479    } else {
74480      first = false;
74481    }
74482    await writeValue(val, buffer, transform);
74483  }
74484  buffer.push("]");
74485}
74486async function writeValue(value, buffer, transform) {
74487  if (value instanceof _primitives.Name) {
74488    buffer.push(`/${(0, _core_utils.escapePDFName)(value.name)}`);
74489  } else if (value instanceof _primitives.Ref) {
74490    buffer.push(`${value.num} ${value.gen} R`);
74491  } else if (Array.isArray(value)) {
74492    await writeArray(value, buffer, transform);
74493  } else if (typeof value === "string") {
74494    if (transform) {
74495      value = transform.encryptString(value);
74496    }
74497    buffer.push(`(${(0, _core_utils.escapeString)(value)})`);
74498  } else if (typeof value === "number") {
74499    buffer.push((0, _core_utils.numberToString)(value));
74500  } else if (typeof value === "boolean") {
74501    buffer.push(value.toString());
74502  } else if (value instanceof _primitives.Dict) {
74503    await writeDict(value, buffer, transform);
74504  } else if (value instanceof _base_stream.BaseStream) {
74505    await writeStream(value, buffer, transform);
74506  } else if (value === null) {
74507    buffer.push("null");
74508  } else {
74509    (0, _util.warn)(`Unhandled value in writer: ${typeof value}, please file a bug.`);
74510  }
74511}
74512function writeInt(number, size, offset, buffer) {
74513  for (let i = size + offset - 1; i > offset - 1; i--) {
74514    buffer[i] = number & 0xff;
74515    number >>= 8;
74516  }
74517  return offset + size;
74518}
74519function writeString(string, offset, buffer) {
74520  for (let i = 0, len = string.length; i < len; i++) {
74521    buffer[offset + i] = string.charCodeAt(i) & 0xff;
74522  }
74523}
74524function computeMD5(filesize, xrefInfo) {
74525  const time = Math.floor(Date.now() / 1000);
74526  const filename = xrefInfo.filename || "";
74527  const md5Buffer = [time.toString(), filename, filesize.toString()];
74528  let md5BufferLen = md5Buffer.reduce((a, str) => a + str.length, 0);
74529  for (const value of Object.values(xrefInfo.info)) {
74530    md5Buffer.push(value);
74531    md5BufferLen += value.length;
74532  }
74533  const array = new Uint8Array(md5BufferLen);
74534  let offset = 0;
74535  for (const str of md5Buffer) {
74536    writeString(str, offset, array);
74537    offset += str.length;
74538  }
74539  return (0, _util.bytesToString)((0, _crypto.calculateMD5)(array));
74540}
74541function writeXFADataForAcroform(str, newRefs) {
74542  const xml = new _xml_parser.SimpleXMLParser({
74543    hasAttributes: true
74544  }).parseFromString(str);
74545  for (const {
74546    xfa
74547  } of newRefs) {
74548    if (!xfa) {
74549      continue;
74550    }
74551    const {
74552      path,
74553      value
74554    } = xfa;
74555    if (!path) {
74556      continue;
74557    }
74558    const nodePath = (0, _core_utils.parseXFAPath)(path);
74559    let node = xml.documentElement.searchNode(nodePath, 0);
74560    if (!node && nodePath.length > 1) {
74561      node = xml.documentElement.searchNode([nodePath.at(-1)], 0);
74562    }
74563    if (node) {
74564      node.childNodes = Array.isArray(value) ? value.map(val => new _xml_parser.SimpleDOMNode("value", val)) : [new _xml_parser.SimpleDOMNode("#text", value)];
74565    } else {
74566      (0, _util.warn)(`Node not found for path: ${path}`);
74567    }
74568  }
74569  const buffer = [];
74570  xml.documentElement.dump(buffer);
74571  return buffer.join("");
74572}
74573async function updateAcroform({
74574  xref,
74575  acroForm,
74576  acroFormRef,
74577  hasXfa,
74578  hasXfaDatasetsEntry,
74579  xfaDatasetsRef,
74580  needAppearances,
74581  newRefs
74582}) {
74583  if (hasXfa && !hasXfaDatasetsEntry && !xfaDatasetsRef) {
74584    (0, _util.warn)("XFA - Cannot save it");
74585  }
74586  if (!needAppearances && (!hasXfa || !xfaDatasetsRef || hasXfaDatasetsEntry)) {
74587    return;
74588  }
74589  const dict = acroForm.clone();
74590  if (hasXfa && !hasXfaDatasetsEntry) {
74591    const newXfa = acroForm.get("XFA").slice();
74592    newXfa.splice(2, 0, "datasets");
74593    newXfa.splice(3, 0, xfaDatasetsRef);
74594    dict.set("XFA", newXfa);
74595  }
74596  if (needAppearances) {
74597    dict.set("NeedAppearances", true);
74598  }
74599  const buffer = [];
74600  await writeObject(acroFormRef, dict, buffer, xref);
74601  newRefs.push({
74602    ref: acroFormRef,
74603    data: buffer.join("")
74604  });
74605}
74606function updateXFA({
74607  xfaData,
74608  xfaDatasetsRef,
74609  newRefs,
74610  xref
74611}) {
74612  if (xfaData === null) {
74613    const datasets = xref.fetchIfRef(xfaDatasetsRef);
74614    xfaData = writeXFADataForAcroform(datasets.getString(), newRefs);
74615  }
74616  const encrypt = xref.encrypt;
74617  if (encrypt) {
74618    const transform = encrypt.createCipherTransform(xfaDatasetsRef.num, xfaDatasetsRef.gen);
74619    xfaData = transform.encryptString(xfaData);
74620  }
74621  const data = `${xfaDatasetsRef.num} ${xfaDatasetsRef.gen} obj\n` + `<< /Type /EmbeddedFile /Length ${xfaData.length}>>\nstream\n` + xfaData + "\nendstream\nendobj\n";
74622  newRefs.push({
74623    ref: xfaDatasetsRef,
74624    data
74625  });
74626}
74627async function incrementalUpdate({
74628  originalData,
74629  xrefInfo,
74630  newRefs,
74631  xref = null,
74632  hasXfa = false,
74633  xfaDatasetsRef = null,
74634  hasXfaDatasetsEntry = false,
74635  needAppearances,
74636  acroFormRef = null,
74637  acroForm = null,
74638  xfaData = null
74639}) {
74640  await updateAcroform({
74641    xref,
74642    acroForm,
74643    acroFormRef,
74644    hasXfa,
74645    hasXfaDatasetsEntry,
74646    xfaDatasetsRef,
74647    needAppearances,
74648    newRefs
74649  });
74650  if (hasXfa) {
74651    updateXFA({
74652      xfaData,
74653      xfaDatasetsRef,
74654      newRefs,
74655      xref
74656    });
74657  }
74658  const newXref = new _primitives.Dict(null);
74659  const refForXrefTable = xrefInfo.newRef;
74660  let buffer, baseOffset;
vendor: 2,950 bytes, lines 74661-74747
74661  const lastByte = originalData.at(-1);
74662  if (lastByte === 0x0a || lastByte === 0x0d) {
74663    buffer = [];
74664    baseOffset = originalData.length;
74665  } else {
74666    buffer = ["\n"];
74667    baseOffset = originalData.length + 1;
74668  }
74669  newXref.set("Size", refForXrefTable.num + 1);
74670  newXref.set("Prev", xrefInfo.startXRef);
74671  newXref.set("Type", _primitives.Name.get("XRef"));
74672  if (xrefInfo.rootRef !== null) {
74673    newXref.set("Root", xrefInfo.rootRef);
74674  }
74675  if (xrefInfo.infoRef !== null) {
74676    newXref.set("Info", xrefInfo.infoRef);
74677  }
74678  if (xrefInfo.encryptRef !== null) {
74679    newXref.set("Encrypt", xrefInfo.encryptRef);
74680  }
74681  newRefs.push({
74682    ref: refForXrefTable,
74683    data: ""
74684  });
74685  newRefs = newRefs.sort((a, b) => {
74686    return a.ref.num - b.ref.num;
74687  });
74688  const xrefTableData = [[0, 1, 0xffff]];
74689  const indexes = [0, 1];
74690  let maxOffset = 0;
74691  for (const {
74692    ref,
74693    data
74694  } of newRefs) {
74695    maxOffset = Math.max(maxOffset, baseOffset);
74696    xrefTableData.push([1, baseOffset, Math.min(ref.gen, 0xffff)]);
74697    baseOffset += data.length;
74698    indexes.push(ref.num, 1);
74699    buffer.push(data);
74700  }
74701  newXref.set("Index", indexes);
74702  if (Array.isArray(xrefInfo.fileIds) && xrefInfo.fileIds.length > 0) {
74703    const md5 = computeMD5(baseOffset, xrefInfo);
74704    newXref.set("ID", [xrefInfo.fileIds[0], md5]);
74705  }
74706  const offsetSize = Math.ceil(Math.log2(maxOffset) / 8);
74707  const sizes = [1, offsetSize, 2];
74708  const structSize = sizes[0] + sizes[1] + sizes[2];
74709  const tableLength = structSize * xrefTableData.length;
74710  newXref.set("W", sizes);
74711  newXref.set("Length", tableLength);
74712  buffer.push(`${refForXrefTable.num} ${refForXrefTable.gen} obj\n`);
74713  await writeDict(newXref, buffer, null);
74714  buffer.push(" stream\n");
74715  const bufferLen = buffer.reduce((a, str) => a + str.length, 0);
74716  const footer = `\nendstream\nendobj\nstartxref\n${baseOffset}\n%%EOF\n`;
74717  const array = new Uint8Array(originalData.length + bufferLen + tableLength + footer.length);
74718  array.set(originalData);
74719  let offset = originalData.length;
74720  for (const str of buffer) {
74721    writeString(str, offset, array);
74722    offset += str.length;
74723  }
74724  for (const [type, objOffset, gen] of xrefTableData) {
74725    offset = writeInt(type, sizes[0], offset, array);
74726    offset = writeInt(objOffset, sizes[1], offset, array);
74727    offset = writeInt(gen, sizes[2], offset, array);
74728  }
74729  writeString(footer, offset, array);
74730  return array;
74731}
74732
74733/***/ }),
74734/* 74 */
74735/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
74736
74737
74738
74739Object.defineProperty(exports, "__esModule", ({
74740  value: true
74741}));
74742exports.calculateSHA256 = exports.calculateMD5 = exports.PDF20 = exports.PDF17 = exports.CipherTransformFactory = exports.ARCFourCipher = exports.AES256Cipher = exports.AES128Cipher = void 0;
74743exports.calculateSHA384 = calculateSHA384;
74744exports.calculateSHA512 = void 0;
74745var _util = __w_pdfjs_require__(2);
74746var _primitives = __w_pdfjs_require__(4);
74747var _decrypt_stream = __w_pdfjs_require__(75
vendor: 24,600 bytes, lines 74747-75260
74747);
74748class ARCFourCipher {
74749  constructor(key) {
74750    this.a = 0;
74751    this.b = 0;
74752    const s = new Uint8Array(256);
74753    const keyLength = key.length;
74754    for (let i = 0; i < 256; ++i) {
74755      s[i] = i;
74756    }
74757    for (let i = 0, j = 0; i < 256; ++i) {
74758      const tmp = s[i];
74759      j = j + tmp + key[i % keyLength] & 0xff;
74760      s[i] = s[j];
74761      s[j] = tmp;
74762    }
74763    this.s = s;
74764  }
74765  encryptBlock(data) {
74766    let a = this.a,
74767      b = this.b;
74768    const s = this.s;
74769    const n = data.length;
74770    const output = new Uint8Array(n);
74771    for (let i = 0; i < n; ++i) {
74772      a = a + 1 & 0xff;
74773      const tmp = s[a];
74774      b = b + tmp & 0xff;
74775      const tmp2 = s[b];
74776      s[a] = tmp2;
74777      s[b] = tmp;
74778      output[i] = data[i] ^ s[tmp + tmp2 & 0xff];
74779    }
74780    this.a = a;
74781    this.b = b;
74782    return output;
74783  }
74784  decryptBlock(data) {
74785    return this.encryptBlock(data);
74786  }
74787  encrypt(data) {
74788    return this.encryptBlock(data);
74789  }
74790}
74791exports.ARCFourCipher = ARCFourCipher;
74792const calculateMD5 = function calculateMD5Closure() {
74793  const 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]);
74794  const 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]);
74795  function hash(data, offset, length) {
74796    let h0 = 1732584193,
74797      h1 = -271733879,
74798      h2 = -1732584194,
74799      h3 = 271733878;
74800    const paddedLength = length + 72 & ~63;
74801    const padded = new Uint8Array(paddedLength);
74802    let i, j;
74803    for (i = 0; i < length; ++i) {
74804      padded[i] = data[offset++];
74805    }
74806    padded[i++] = 0x80;
74807    const n = paddedLength - 8;
74808    while (i < n) {
74809      padded[i++] = 0;
74810    }
74811    padded[i++] = length << 3 & 0xff;
74812    padded[i++] = length >> 5 & 0xff;
74813    padded[i++] = length >> 13 & 0xff;
74814    padded[i++] = length >> 21 & 0xff;
74815    padded[i++] = length >>> 29 & 0xff;
74816    padded[i++] = 0;
74817    padded[i++] = 0;
74818    padded[i++] = 0;
74819    const w = new Int32Array(16);
74820    for (i = 0; i < paddedLength;) {
74821      for (j = 0; j < 16; ++j, i += 4) {
74822        w[j] = padded[i] | padded[i + 1] << 8 | padded[i + 2] << 16 | padded[i + 3] << 24;
74823      }
74824      let a = h0,
74825        b = h1,
74826        c = h2,
74827        d = h3,
74828        f,
74829        g;
74830      for (j = 0; j < 64; ++j) {
74831        if (j < 16) {
74832          f = b & c | ~b & d;
74833          g = j;
74834        } else if (j < 32) {
74835          f = d & b | ~d & c;
74836          g = 5 * j + 1 & 15;
74837        } else if (j < 48) {
74838          f = b ^ c ^ d;
74839          g = 3 * j + 5 & 15;
74840        } else {
74841          f = c ^ (b | ~d);
74842          g = 7 * j & 15;
74843        }
74844        const tmp = d,
74845          rotateArg = a + f + k[j] + w[g] | 0,
74846          rotate = r[j];
74847        d = c;
74848        c = b;
74849        b = b + (rotateArg << rotate | rotateArg >>> 32 - rotate) | 0;
74850        a = tmp;
74851      }
74852      h0 = h0 + a | 0;
74853      h1 = h1 + b | 0;
74854      h2 = h2 + c | 0;
74855      h3 = h3 + d | 0;
74856    }
74857    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]);
74858  }
74859  return hash;
74860}();
74861exports.calculateMD5 = calculateMD5;
74862class Word64 {
74863  constructor(highInteger, lowInteger) {
74864    this.high = highInteger | 0;
74865    this.low = lowInteger | 0;
74866  }
74867  and(word) {
74868    this.high &= word.high;
74869    this.low &= word.low;
74870  }
74871  xor(word) {
74872    this.high ^= word.high;
74873    this.low ^= word.low;
74874  }
74875  or(word) {
74876    this.high |= word.high;
74877    this.low |= word.low;
74878  }
74879  shiftRight(places) {
74880    if (places >= 32) {
74881      this.low = this.high >>> places - 32 | 0;
74882      this.high = 0;
74883    } else {
74884      this.low = this.low >>> places | this.high << 32 - places;
74885      this.high = this.high >>> places | 0;
74886    }
74887  }
74888  shiftLeft(places) {
74889    if (places >= 32) {
74890      this.high = this.low << places - 32;
74891      this.low = 0;
74892    } else {
74893      this.high = this.high << places | this.low >>> 32 - places;
74894      this.low <<= places;
74895    }
74896  }
74897  rotateRight(places) {
74898    let low, high;
74899    if (places & 32) {
74900      high = this.low;
74901      low = this.high;
74902    } else {
74903      low = this.low;
74904      high = this.high;
74905    }
74906    places &= 31;
74907    this.low = low >>> places | high << 32 - places;
74908    this.high = high >>> places | low << 32 - places;
74909  }
74910  not() {
74911    this.high = ~this.high;
74912    this.low = ~this.low;
74913  }
74914  add(word) {
74915    const lowAdd = (this.low >>> 0) + (word.low >>> 0);
74916    let highAdd = (this.high >>> 0) + (word.high >>> 0);
74917    if (lowAdd > 0xffffffff) {
74918      highAdd += 1;
74919    }
74920    this.low = lowAdd | 0;
74921    this.high = highAdd | 0;
74922  }
74923  copyTo(bytes, offset) {
74924    bytes[offset] = this.high >>> 24 & 0xff;
74925    bytes[offset + 1] = this.high >> 16 & 0xff;
74926    bytes[offset + 2] = this.high >> 8 & 0xff;
74927    bytes[offset + 3] = this.high & 0xff;
74928    bytes[offset + 4] = this.low >>> 24 & 0xff;
74929    bytes[offset + 5] = this.low >> 16 & 0xff;
74930    bytes[offset + 6] = this.low >> 8 & 0xff;
74931    bytes[offset + 7] = this.low & 0xff;
74932  }
74933  assign(word) {
74934    this.high = word.high;
74935    this.low = word.low;
74936  }
74937}
74938const calculateSHA256 = function calculateSHA256Closure() {
74939  function rotr(x, n) {
74940    return x >>> n | x << 32 - n;
74941  }
74942  function ch(x, y, z) {
74943    return x & y ^ ~x & z;
74944  }
74945  function maj(x, y, z) {
74946    return x & y ^ x & z ^ y & z;
74947  }
74948  function sigma(x) {
74949    return rotr(x, 2) ^ rotr(x, 13) ^ rotr(x, 22);
74950  }
74951  function sigmaPrime(x) {
74952    return rotr(x, 6) ^ rotr(x, 11) ^ rotr(x, 25);
74953  }
74954  function littleSigma(x) {
74955    return rotr(x, 7) ^ rotr(x, 18) ^ x >>> 3;
74956  }
74957  function littleSigmaPrime(x) {
74958    return rotr(x, 17) ^ rotr(x, 19) ^ x >>> 10;
74959  }
74960  const 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];
74961  function hash(data, offset, length) {
74962    let h0 = 0x6a09e667,
74963      h1 = 0xbb67ae85,
74964      h2 = 0x3c6ef372,
74965      h3 = 0xa54ff53a,
74966      h4 = 0x510e527f,
74967      h5 = 0x9b05688c,
74968      h6 = 0x1f83d9ab,
74969      h7 = 0x5be0cd19;
74970    const paddedLength = Math.ceil((length + 9) / 64) * 64;
74971    const padded = new Uint8Array(paddedLength);
74972    let i, j;
74973    for (i = 0; i < length; ++i) {
74974      padded[i] = data[offset++];
74975    }
74976    padded[i++] = 0x80;
74977    const n = paddedLength - 8;
74978    while (i < n) {
74979      padded[i++] = 0;
74980    }
74981    padded[i++] = 0;
74982    padded[i++] = 0;
74983    padded[i++] = 0;
74984    padded[i++] = length >>> 29 & 0xff;
74985    padded[i++] = length >> 21 & 0xff;
74986    padded[i++] = length >> 13 & 0xff;
74987    padded[i++] = length >> 5 & 0xff;
74988    padded[i++] = length << 3 & 0xff;
74989    const w = new Uint32Array(64);
74990    for (i = 0; i < paddedLength;) {
74991      for (j = 0; j < 16; ++j) {
74992        w[j] = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
74993        i += 4;
74994      }
74995      for (j = 16; j < 64; ++j) {
74996        w[j] = littleSigmaPrime(w[j - 2]) + w[j - 7] + littleSigma(w[j - 15]) + w[j - 16] | 0;
74997      }
74998      let a = h0,
74999        b = h1,
75000        c = h2,
75001        d = h3,
75002        e = h4,
75003        f = h5,
75004        g = h6,
75005        h = h7,
75006        t1,
75007        t2;
75008      for (j = 0; j < 64; ++j) {
75009        t1 = h + sigmaPrime(e) + ch(e, f, g) + k[j] + w[j];
75010        t2 = sigma(a) + maj(a, b, c);
75011        h = g;
75012        g = f;
75013        f = e;
75014        e = d + t1 | 0;
75015        d = c;
75016        c = b;
75017        b = a;
75018        a = t1 + t2 | 0;
75019      }
75020      h0 = h0 + a | 0;
75021      h1 = h1 + b | 0;
75022      h2 = h2 + c | 0;
75023      h3 = h3 + d | 0;
75024      h4 = h4 + e | 0;
75025      h5 = h5 + f | 0;
75026      h6 = h6 + g | 0;
75027      h7 = h7 + h | 0;
75028    }
75029    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]);
75030  }
75031  return hash;
75032}();
75033exports.calculateSHA256 = calculateSHA256;
75034const calculateSHA512 = function calculateSHA512Closure() {
75035  function ch(result, x, y, z, tmp) {
75036    result.assign(x);
75037    result.and(y);
75038    tmp.assign(x);
75039    tmp.not();
75040    tmp.and(z);
75041    result.xor(tmp);
75042  }
75043  function maj(result, x, y, z, tmp) {
75044    result.assign(x);
75045    result.and(y);
75046    tmp.assign(x);
75047    tmp.and(z);
75048    result.xor(tmp);
75049    tmp.assign(y);
75050    tmp.and(z);
75051    result.xor(tmp);
75052  }
75053  function sigma(result, x, tmp) {
75054    result.assign(x);
75055    result.rotateRight(28);
75056    tmp.assign(x);
75057    tmp.rotateRight(34);
75058    result.xor(tmp);
75059    tmp.assign(x);
75060    tmp.rotateRight(39);
75061    result.xor(tmp);
75062  }
75063  function sigmaPrime(result, x, tmp) {
75064    result.assign(x);
75065    result.rotateRight(14);
75066    tmp.assign(x);
75067    tmp.rotateRight(18);
75068    result.xor(tmp);
75069    tmp.assign(x);
75070    tmp.rotateRight(41);
75071    result.xor(tmp);
75072  }
75073  function littleSigma(result, x, tmp) {
75074    result.assign(x);
75075    result.rotateRight(1);
75076    tmp.assign(x);
75077    tmp.rotateRight(8);
75078    result.xor(tmp);
75079    tmp.assign(x);
75080    tmp.shiftRight(7);
75081    result.xor(tmp);
75082  }
75083  function littleSigmaPrime(result, x, tmp) {
75084    result.assign(x);
75085    result.rotateRight(19);
75086    tmp.assign(x);
75087    tmp.rotateRight(61);
75088    result.xor(tmp);
75089    tmp.assign(x);
75090    tmp.shiftRight(6);
75091    result.xor(tmp);
75092  }
75093  const 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)];
75094  function hash(data, offset, length, mode384 = false) {
75095    let h0, h1, h2, h3, h4, h5, h6, h7;
75096    if (!mode384) {
75097      h0 = new Word64(0x6a09e667, 0xf3bcc908);
75098      h1 = new Word64(0xbb67ae85, 0x84caa73b);
75099      h2 = new Word64(0x3c6ef372, 0xfe94f82b);
75100      h3 = new Word64(0xa54ff53a, 0x5f1d36f1);
75101      h4 = new Word64(0x510e527f, 0xade682d1);
75102      h5 = new Word64(0x9b05688c, 0x2b3e6c1f);
75103      h6 = new Word64(0x1f83d9ab, 0xfb41bd6b);
75104      h7 = new Word64(0x5be0cd19, 0x137e2179);
75105    } else {
75106      h0 = new Word64(0xcbbb9d5d, 0xc1059ed8);
75107      h1 = new Word64(0x629a292a, 0x367cd507);
75108      h2 = new Word64(0x9159015a, 0x3070dd17);
75109      h3 = new Word64(0x152fecd8, 0xf70e5939);
75110      h4 = new Word64(0x67332667, 0xffc00b31);
75111      h5 = new Word64(0x8eb44a87, 0x68581511);
75112      h6 = new Word64(0xdb0c2e0d, 0x64f98fa7);
75113      h7 = new Word64(0x47b5481d, 0xbefa4fa4);
75114    }
75115    const paddedLength = Math.ceil((length + 17) / 128) * 128;
75116    const padded = new Uint8Array(paddedLength);
75117    let i, j;
75118    for (i = 0; i < length; ++i) {
75119      padded[i] = data[offset++];
75120    }
75121    padded[i++] = 0x80;
75122    const n = paddedLength - 16;
75123    while (i < n) {
75124      padded[i++] = 0;
75125    }
75126    padded[i++] = 0;
75127    padded[i++] = 0;
75128    padded[i++] = 0;
75129    padded[i++] = 0;
75130    padded[i++] = 0;
75131    padded[i++] = 0;
75132    padded[i++] = 0;
75133    padded[i++] = 0;
75134    padded[i++] = 0;
75135    padded[i++] = 0;
75136    padded[i++] = 0;
75137    padded[i++] = length >>> 29 & 0xff;
75138    padded[i++] = length >> 21 & 0xff;
75139    padded[i++] = length >> 13 & 0xff;
75140    padded[i++] = length >> 5 & 0xff;
75141    padded[i++] = length << 3 & 0xff;
75142    const w = new Array(80);
75143    for (i = 0; i < 80; i++) {
75144      w[i] = new Word64(0, 0);
75145    }
75146    let a = new Word64(0, 0),
75147      b = new Word64(0, 0),
75148      c = new Word64(0, 0);
75149    let d = new Word64(0, 0),
75150      e = new Word64(0, 0),
75151      f = new Word64(0, 0);
75152    let g = new Word64(0, 0),
75153      h = new Word64(0, 0);
75154    const t1 = new Word64(0, 0),
75155      t2 = new Word64(0, 0);
75156    const tmp1 = new Word64(0, 0),
75157      tmp2 = new Word64(0, 0);
75158    let tmp3;
75159    for (i = 0; i < paddedLength;) {
75160      for (j = 0; j < 16; ++j) {
75161        w[j].high = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
75162        w[j].low = padded[i + 4] << 24 | padded[i + 5] << 16 | padded[i + 6] << 8 | padded[i + 7];
75163        i += 8;
75164      }
75165      for (j = 16; j < 80; ++j) {
75166        tmp3 = w[j];
75167        littleSigmaPrime(tmp3, w[j - 2], tmp2);
75168        tmp3.add(w[j - 7]);
75169        littleSigma(tmp1, w[j - 15], tmp2);
75170        tmp3.add(tmp1);
75171        tmp3.add(w[j - 16]);
75172      }
75173      a.assign(h0);
75174      b.assign(h1);
75175      c.assign(h2);
75176      d.assign(h3);
75177      e.assign(h4);
75178      f.assign(h5);
75179      g.assign(h6);
75180      h.assign(h7);
75181      for (j = 0; j < 80; ++j) {
75182        t1.assign(h);
75183        sigmaPrime(tmp1, e, tmp2);
75184        t1.add(tmp1);
75185        ch(tmp1, e, f, g, tmp2);
75186        t1.add(tmp1);
75187        t1.add(k[j]);
75188        t1.add(w[j]);
75189        sigma(t2, a, tmp2);
75190        maj(tmp1, a, b, c, tmp2);
75191        t2.add(tmp1);
75192        tmp3 = h;
75193        h = g;
75194        g = f;
75195        f = e;
75196        d.add(t1);
75197        e = d;
75198        d = c;
75199        c = b;
75200        b = a;
75201        tmp3.assign(t1);
75202        tmp3.add(t2);
75203        a = tmp3;
75204      }
75205      h0.add(a);
75206      h1.add(b);
75207      h2.add(c);
75208      h3.add(d);
75209      h4.add(e);
75210      h5.add(f);
75211      h6.add(g);
75212      h7.add(h);
75213    }
75214    let result;
75215    if (!mode384) {
75216      result = new Uint8Array(64);
75217      h0.copyTo(result, 0);
75218      h1.copyTo(result, 8);
75219      h2.copyTo(result, 16);
75220      h3.copyTo(result, 24);
75221      h4.copyTo(result, 32);
75222      h5.copyTo(result, 40);
75223      h6.copyTo(result, 48);
75224      h7.copyTo(result, 56);
75225    } else {
75226      result = new Uint8Array(48);
75227      h0.copyTo(result, 0);
75228      h1.copyTo(result, 8);
75229      h2.copyTo(result, 16);
75230      h3.copyTo(result, 24);
75231      h4.copyTo(result, 32);
75232      h5.copyTo(result, 40);
75233    }
75234    return result;
75235  }
75236  return hash;
75237}();
75238exports.calculateSHA512 = calculateSHA512;
75239function calculateSHA384(data, offset, length) {
75240  return calculateSHA512(data, offset, length, true);
75241}
75242class NullCipher {
75243  decryptBlock(data) {
75244    return data;
75245  }
75246  encrypt(data) {
75247    return data;
75248  }
75249}
75250class AESBaseCipher {
75251  constructor() {
75252    if (this.constructor === AESBaseCipher) {
75253      (0, _util.unreachable)("Cannot initialize AESBaseCipher.");
75254    }
75255    this._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]);
75256    this._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]);
75257    this._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, 0x51f4a750, 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]);
75258    this._mixCol = new Uint8Array(256);
75259    for (let i = 0; i < 256; i++) {
75260      
75260this._mixCol[i] = i < 128 ? i << 1 : i << 1 ^ 0x1b;
vendor: 12,113 bytes, lines 75260-75637
75260
75261    }
75262    this.buffer = new Uint8Array(16);
75263    this.bufferPosition = 0;
75264  }
75265  _expandKey(cipherKey) {
75266    (0, _util.unreachable)("Cannot call `_expandKey` on the base class");
75267  }
75268  _decrypt(input, key) {
75269    let t, u, v;
75270    const state = new Uint8Array(16);
75271    state.set(input);
75272    for (let j = 0, k = this._keySize; j < 16; ++j, ++k) {
75273      state[j] ^= key[k];
75274    }
75275    for (let i = this._cyclesOfRepetition - 1; i >= 1; --i) {
75276      t = state[13];
75277      state[13] = state[9];
75278      state[9] = state[5];
75279      state[5] = state[1];
75280      state[1] = t;
75281      t = state[14];
75282      u = state[10];
75283      state[14] = state[6];
75284      state[10] = state[2];
75285      state[6] = t;
75286      state[2] = u;
75287      t = state[15];
75288      u = state[11];
75289      v = state[7];
75290      state[15] = state[3];
75291      state[11] = t;
75292      state[7] = u;
75293      state[3] = v;
75294      for (let j = 0; j < 16; ++j) {
75295        state[j] = this._inv_s[state[j]];
75296      }
75297      for (let j = 0, k = i * 16; j < 16; ++j, ++k) {
75298        state[j] ^= key[k];
75299      }
75300      for (let j = 0; j < 16; j += 4) {
75301        const s0 = this._mix[state[j]];
75302        const s1 = this._mix[state[j + 1]];
75303        const s2 = this._mix[state[j + 2]];
75304        const s3 = this._mix[state[j + 3]];
75305        t = s0 ^ s1 >>> 8 ^ s1 << 24 ^ s2 >>> 16 ^ s2 << 16 ^ s3 >>> 24 ^ s3 << 8;
75306        state[j] = t >>> 24 & 0xff;
75307        state[j + 1] = t >> 16 & 0xff;
75308        state[j + 2] = t >> 8 & 0xff;
75309        state[j + 3] = t & 0xff;
75310      }
75311    }
75312    t = state[13];
75313    state[13] = state[9];
75314    state[9] = state[5];
75315    state[5] = state[1];
75316    state[1] = t;
75317    t = state[14];
75318    u = state[10];
75319    state[14] = state[6];
75320    state[10] = state[2];
75321    state[6] = t;
75322    state[2] = u;
75323    t = state[15];
75324    u = state[11];
75325    v = state[7];
75326    state[15] = state[3];
75327    state[11] = t;
75328    state[7] = u;
75329    state[3] = v;
75330    for (let j = 0; j < 16; ++j) {
75331      state[j] = this._inv_s[state[j]];
75332      state[j] ^= key[j];
75333    }
75334    return state;
75335  }
75336  _encrypt(input, key) {
75337    const s = this._s;
75338    let t, u, v;
75339    const state = new Uint8Array(16);
75340    state.set(input);
75341    for (let j = 0; j < 16; ++j) {
75342      state[j] ^= key[j];
75343    }
75344    for (let i = 1; i < this._cyclesOfRepetition; i++) {
75345      for (let j = 0; j < 16; ++j) {
75346        state[j] = s[state[j]];
75347      }
75348      v = state[1];
75349      state[1] = state[5];
75350      state[5] = state[9];
75351      state[9] = state[13];
75352      state[13] = v;
75353      v = state[2];
75354      u = state[6];
75355      state[2] = state[10];
75356      state[6] = state[14];
75357      state[10] = v;
75358      state[14] = u;
75359      v = state[3];
75360      u = state[7];
75361      t = state[11];
75362      state[3] = state[15];
75363      state[7] = v;
75364      state[11] = u;
75365      state[15] = t;
75366      for (let j = 0; j < 16; j += 4) {
75367        const s0 = state[j + 0];
75368        const s1 = state[j + 1];
75369        const s2 = state[j + 2];
75370        const s3 = state[j + 3];
75371        t = s0 ^ s1 ^ s2 ^ s3;
75372        state[j + 0] ^= t ^ this._mixCol[s0 ^ s1];
75373        state[j + 1] ^= t ^ this._mixCol[s1 ^ s2];
75374        state[j + 2] ^= t ^ this._mixCol[s2 ^ s3];
75375        state[j + 3] ^= t ^ this._mixCol[s3 ^ s0];
75376      }
75377      for (let j = 0, k = i * 16; j < 16; ++j, ++k) {
75378        state[j] ^= key[k];
75379      }
75380    }
75381    for (let j = 0; j < 16; ++j) {
75382      state[j] = s[state[j]];
75383    }
75384    v = state[1];
75385    state[1] = state[5];
75386    state[5] = state[9];
75387    state[9] = state[13];
75388    state[13] = v;
75389    v = state[2];
75390    u = state[6];
75391    state[2] = state[10];
75392    state[6] = state[14];
75393    state[10] = v;
75394    state[14] = u;
75395    v = state[3];
75396    u = state[7];
75397    t = state[11];
75398    state[3] = state[15];
75399    state[7] = v;
75400    state[11] = u;
75401    state[15] = t;
75402    for (let j = 0, k = this._keySize; j < 16; ++j, ++k) {
75403      state[j] ^= key[k];
75404    }
75405    return state;
75406  }
75407  _decryptBlock2(data, finalize) {
75408    const sourceLength = data.length;
75409    let buffer = this.buffer,
75410      bufferLength = this.bufferPosition;
75411    const result = [];
75412    let iv = this.iv;
75413    for (let i = 0; i < sourceLength; ++i) {
75414      buffer[bufferLength] = data[i];
75415      ++bufferLength;
75416      if (bufferLength < 16) {
75417        continue;
75418      }
75419      const plain = this._decrypt(buffer, this._key);
75420      for (let j = 0; j < 16; ++j) {
75421        plain[j] ^= iv[j];
75422      }
75423      iv = buffer;
75424      result.push(plain);
75425      buffer = new Uint8Array(16);
75426      bufferLength = 0;
75427    }
75428    this.buffer = buffer;
75429    this.bufferLength = bufferLength;
75430    this.iv = iv;
75431    if (result.length === 0) {
75432      return new Uint8Array(0);
75433    }
75434    let outputLength = 16 * result.length;
75435    if (finalize) {
75436      const lastBlock = result.at(-1);
75437      let psLen = lastBlock[15];
75438      if (psLen <= 16) {
75439        for (let i = 15, ii = 16 - psLen; i >= ii; --i) {
75440          if (lastBlock[i] !== psLen) {
75441            psLen = 0;
75442            break;
75443          }
75444        }
75445        outputLength -= psLen;
75446        result[result.length - 1] = lastBlock.subarray(0, 16 - psLen);
75447      }
75448    }
75449    const output = new Uint8Array(outputLength);
75450    for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
75451      output.set(result[i], j);
75452    }
75453    return output;
75454  }
75455  decryptBlock(data, finalize, iv = null) {
75456    const sourceLength = data.length;
75457    const buffer = this.buffer;
75458    let bufferLength = this.bufferPosition;
75459    if (iv) {
75460      this.iv = iv;
75461    } else {
75462      for (let i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) {
75463        buffer[bufferLength] = data[i];
75464      }
75465      if (bufferLength < 16) {
75466        this.bufferLength = bufferLength;
75467        return new Uint8Array(0);
75468      }
75469      this.iv = buffer;
75470      data = data.subarray(16);
75471    }
75472    this.buffer = new Uint8Array(16);
75473    this.bufferLength = 0;
75474    this.decryptBlock = this._decryptBlock2;
75475    return this.decryptBlock(data, finalize);
75476  }
75477  encrypt(data, iv) {
75478    const sourceLength = data.length;
75479    let buffer = this.buffer,
75480      bufferLength = this.bufferPosition;
75481    const result = [];
75482    if (!iv) {
75483      iv = new Uint8Array(16);
75484    }
75485    for (let i = 0; i < sourceLength; ++i) {
75486      buffer[bufferLength] = data[i];
75487      ++bufferLength;
75488      if (bufferLength < 16) {
75489        continue;
75490      }
75491      for (let j = 0; j < 16; ++j) {
75492        buffer[j] ^= iv[j];
75493      }
75494      const cipher = this._encrypt(buffer, this._key);
75495      iv = cipher;
75496      result.push(cipher);
75497      buffer = new Uint8Array(16);
75498      bufferLength = 0;
75499    }
75500    this.buffer = buffer;
75501    this.bufferLength = bufferLength;
75502    this.iv = iv;
75503    if (result.length === 0) {
75504      return new Uint8Array(0);
75505    }
75506    const outputLength = 16 * result.length;
75507    const output = new Uint8Array(outputLength);
75508    for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
75509      output.set(result[i], j);
75510    }
75511    return output;
75512  }
75513}
75514class AES128Cipher extends AESBaseCipher {
75515  constructor(key) {
75516    super();
75517    this._cyclesOfRepetition = 10;
75518    this._keySize = 160;
75519    this._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]);
75520    this._key = this._expandKey(key);
75521  }
75522  _expandKey(cipherKey) {
75523    const b = 176;
75524    const s = this._s;
75525    const rcon = this._rcon;
75526    const result = new Uint8Array(b);
75527    result.set(cipherKey);
75528    for (let j = 16, i = 1; j < b; ++i) {
75529      let t1 = result[j - 3];
75530      let t2 = result[j - 2];
75531      let t3 = result[j - 1];
75532      let t4 = result[j - 4];
75533      t1 = s[t1];
75534      t2 = s[t2];
75535      t3 = s[t3];
75536      t4 = s[t4];
75537      t1 ^= rcon[i];
75538      for (let n = 0; n < 4; ++n) {
75539        result[j] = t1 ^= result[j - 16];
75540        j++;
75541        result[j] = t2 ^= result[j - 16];
75542        j++;
75543        result[j] = t3 ^= result[j - 16];
75544        j++;
75545        result[j] = t4 ^= result[j - 16];
75546        j++;
75547      }
75548    }
75549    return result;
75550  }
75551}
75552exports.AES128Cipher = AES128Cipher;
75553class AES256Cipher extends AESBaseCipher {
75554  constructor(key) {
75555    super();
75556    this._cyclesOfRepetition = 14;
75557    this._keySize = 224;
75558    this._key = this._expandKey(key);
75559  }
75560  _expandKey(cipherKey) {
75561    const b = 240;
75562    const s = this._s;
75563    const result = new Uint8Array(b);
75564    result.set(cipherKey);
75565    let r = 1;
75566    let t1, t2, t3, t4;
75567    for (let j = 32, i = 1; j < b; ++i) {
75568      if (j % 32 === 16) {
75569        t1 = s[t1];
75570        t2 = s[t2];
75571        t3 = s[t3];
75572        t4 = s[t4];
75573      } else if (j % 32 === 0) {
75574        t1 = result[j - 3];
75575        t2 = result[j - 2];
75576        t3 = result[j - 1];
75577        t4 = result[j - 4];
75578        t1 = s[t1];
75579        t2 = s[t2];
75580        t3 = s[t3];
75581        t4 = s[t4];
75582        t1 ^= r;
75583        if ((r <<= 1) >= 256) {
75584          r = (r ^ 0x1b) & 0xff;
75585        }
75586      }
75587      for (let n = 0; n < 4; ++n) {
75588        result[j] = t1 ^= result[j - 32];
75589        j++;
75590        result[j] = t2 ^= result[j - 32];
75591        j++;
75592        result[j] = t3 ^= result[j - 32];
75593        j++;
75594        result[j] = t4 ^= result[j - 32];
75595        j++;
75596      }
75597    }
75598    return result;
75599  }
75600}
75601exports.AES256Cipher = AES256Cipher;
75602class PDF17 {
75603  checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
75604    const hashData = new Uint8Array(password.length + 56);
75605    hashData.set(password, 0);
75606    hashData.set(ownerValidationSalt, password.length);
75607    hashData.set(userBytes, password.length + ownerValidationSalt.length);
75608    const result = calculateSHA256(hashData, 0, hashData.length);
75609    return (0, _util.isArrayEqual)(result, ownerPassword);
75610  }
75611  checkUserPassword(password, userValidationSalt, userPassword) {
75612    const hashData = new Uint8Array(password.length + 8);
75613    hashData.set(password, 0);
75614    hashData.set(userValidationSalt, password.length);
75615    const result = calculateSHA256(hashData, 0, hashData.length);
75616    return (0, _util.isArrayEqual)(result, userPassword);
75617  }
75618  getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
75619    const hashData = new Uint8Array(password.length + 56);
75620    hashData.set(password, 0);
75621    hashData.set(ownerKeySalt, password.length);
75622    hashData.set(userBytes, password.length + ownerKeySalt.length);
75623    const key = calculateSHA256(hashData, 0, hashData.length);
75624    const cipher = new AES256Cipher(key);
75625    return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
75626  }
75627  getUserKey(password, userKeySalt, userEncryption) {
75628    const hashData = new Uint8Array(password.length + 8);
75629    hashData.set(password, 0);
75630    hashData.set(userKeySalt, password.length);
75631    const key = calculateSHA256(hashData, 0, hashData.length);
75632    const cipher = new AES256Cipher(key);
75633    return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
75634  }
75635}
75636exports.PDF17 = PDF17;
75637c
vendor: 13,718 bytes, lines 75637-75991
75637lass PDF20 {
75638  _hash(password, input, userBytes) {
75639    let k = calculateSHA256(input, 0, input.length).subarray(0, 32);
75640    let e = [0];
75641    let i = 0;
75642    while (i < 64 || e.at(-1) > i - 32) {
75643      const combinedLength = password.length + k.length + userBytes.length,
75644        combinedArray = new Uint8Array(combinedLength);
75645      let writeOffset = 0;
75646      combinedArray.set(password, writeOffset);
75647      writeOffset += password.length;
75648      combinedArray.set(k, writeOffset);
75649      writeOffset += k.length;
75650      combinedArray.set(userBytes, writeOffset);
75651      const k1 = new Uint8Array(combinedLength * 64);
75652      for (let j = 0, pos = 0; j < 64; j++, pos += combinedLength) {
75653        k1.set(combinedArray, pos);
75654      }
75655      const cipher = new AES128Cipher(k.subarray(0, 16));
75656      e = cipher.encrypt(k1, k.subarray(16, 32));
75657      const remainder = e.slice(0, 16).reduce((a, b) => a + b, 0) % 3;
75658      if (remainder === 0) {
75659        k = calculateSHA256(e, 0, e.length);
75660      } else if (remainder === 1) {
75661        k = calculateSHA384(e, 0, e.length);
75662      } else if (remainder === 2) {
75663        k = calculateSHA512(e, 0, e.length);
75664      }
75665      i++;
75666    }
75667    return k.subarray(0, 32);
75668  }
75669  checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
75670    const hashData = new Uint8Array(password.length + 56);
75671    hashData.set(password, 0);
75672    hashData.set(ownerValidationSalt, password.length);
75673    hashData.set(userBytes, password.length + ownerValidationSalt.length);
75674    const result = this._hash(password, hashData, userBytes);
75675    return (0, _util.isArrayEqual)(result, ownerPassword);
75676  }
75677  checkUserPassword(password, userValidationSalt, userPassword) {
75678    const hashData = new Uint8Array(password.length + 8);
75679    hashData.set(password, 0);
75680    hashData.set(userValidationSalt, password.length);
75681    const result = this._hash(password, hashData, []);
75682    return (0, _util.isArrayEqual)(result, userPassword);
75683  }
75684  getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
75685    const hashData = new Uint8Array(password.length + 56);
75686    hashData.set(password, 0);
75687    hashData.set(ownerKeySalt, password.length);
75688    hashData.set(userBytes, password.length + ownerKeySalt.length);
75689    const key = this._hash(password, hashData, userBytes);
75690    const cipher = new AES256Cipher(key);
75691    return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
75692  }
75693  getUserKey(password, userKeySalt, userEncryption) {
75694    const hashData = new Uint8Array(password.length + 8);
75695    hashData.set(password, 0);
75696    hashData.set(userKeySalt, password.length);
75697    const key = this._hash(password, hashData, []);
75698    const cipher = new AES256Cipher(key);
75699    return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
75700  }
75701}
75702exports.PDF20 = PDF20;
75703class CipherTransform {
75704  constructor(stringCipherConstructor, streamCipherConstructor) {
75705    this.StringCipherConstructor = stringCipherConstructor;
75706    this.StreamCipherConstructor = streamCipherConstructor;
75707  }
75708  createStream(stream, length) {
75709    const cipher = new this.StreamCipherConstructor();
75710    return new _decrypt_stream.DecryptStream(stream, length, function cipherTransformDecryptStream(data, finalize) {
75711      return cipher.decryptBlock(data, finalize);
75712    });
75713  }
75714  decryptString(s) {
75715    const cipher = new this.StringCipherConstructor();
75716    let data = (0, _util.stringToBytes)(s);
75717    data = cipher.decryptBlock(data, true);
75718    return (0, _util.bytesToString)(data);
75719  }
75720  encryptString(s) {
75721    const cipher = new this.StringCipherConstructor();
75722    if (cipher instanceof AESBaseCipher) {
75723      const strLen = s.length;
75724      const pad = 16 - strLen % 16;
75725      s += String.fromCharCode(pad).repeat(pad);
75726      const iv = new Uint8Array(16);
75727      if (typeof crypto !== "undefined") {
75728        crypto.getRandomValues(iv);
75729      } else {
75730        for (let i = 0; i < 16; i++) {
75731          iv[i] = Math.floor(256 * Math.random());
75732        }
75733      }
75734      let data = (0, _util.stringToBytes)(s);
75735      data = cipher.encrypt(data, iv);
75736      const buf = new Uint8Array(16 + data.length);
75737      buf.set(iv);
75738      buf.set(data, 16);
75739      return (0, _util.bytesToString)(buf);
75740    }
75741    let data = (0, _util.stringToBytes)(s);
75742    data = cipher.encrypt(data);
75743    return (0, _util.bytesToString)(data);
75744  }
75745}
75746class CipherTransformFactory {
75747  static #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]);
75748  #createEncryptionKey20(revision, password, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms) {
75749    if (password) {
75750      const passwordLength = Math.min(127, password.length);
75751      password = password.subarray(0, passwordLength);
75752    } else {
75753      password = [];
75754    }
75755    const pdfAlgorithm = revision === 6 ? new PDF20() : new PDF17();
75756    if (pdfAlgorithm.checkUserPassword(password, userValidationSalt, userPassword)) {
75757      return pdfAlgorithm.getUserKey(password, userKeySalt, userEncryption);
75758    } else if (password.length && pdfAlgorithm.checkOwnerPassword(password, ownerValidationSalt, uBytes, ownerPassword)) {
75759      return pdfAlgorithm.getOwnerKey(password, ownerKeySalt, uBytes, ownerEncryption);
75760    }
75761    return null;
75762  }
75763  #prepareKeyData(fileId, password, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata) {
75764    const hashDataSize = 40 + ownerPassword.length + fileId.length;
75765    const hashData = new Uint8Array(hashDataSize);
75766    let i = 0,
75767      j,
75768      n;
75769    if (password) {
75770      n = Math.min(32, password.length);
75771      for (; i < n; ++i) {
75772        hashData[i] = password[i];
75773      }
75774    }
75775    j = 0;
75776    while (i < 32) {
75777      hashData[i++] = CipherTransformFactory.#defaultPasswordBytes[j++];
75778    }
75779    for (j = 0, n = ownerPassword.length; j < n; ++j) {
75780      hashData[i++] = ownerPassword[j];
75781    }
75782    hashData[i++] = flags & 0xff;
75783    hashData[i++] = flags >> 8 & 0xff;
75784    hashData[i++] = flags >> 16 & 0xff;
75785    hashData[i++] = flags >>> 24 & 0xff;
75786    for (j = 0, n = fileId.length; j < n; ++j) {
75787      hashData[i++] = fileId[j];
75788    }
75789    if (revision >= 4 && !encryptMetadata) {
75790      hashData[i++] = 0xff;
75791      hashData[i++] = 0xff;
75792      hashData[i++] = 0xff;
75793      hashData[i++] = 0xff;
75794    }
75795    let hash = calculateMD5(hashData, 0, i);
75796    const keyLengthInBytes = keyLength >> 3;
75797    if (revision >= 3) {
75798      for (j = 0; j < 50; ++j) {
75799        hash = calculateMD5(hash, 0, keyLengthInBytes);
75800      }
75801    }
75802    const encryptionKey = hash.subarray(0, keyLengthInBytes);
75803    let cipher, checkData;
75804    if (revision >= 3) {
75805      for (i = 0; i < 32; ++i) {
75806        hashData[i] = CipherTransformFactory.#defaultPasswordBytes[i];
75807      }
75808      for (j = 0, n = fileId.length; j < n; ++j) {
75809        hashData[i++] = fileId[j];
75810      }
75811      cipher = new ARCFourCipher(encryptionKey);
75812      checkData = cipher.encryptBlock(calculateMD5(hashData, 0, i));
75813      n = encryptionKey.length;
75814      const derivedKey = new Uint8Array(n);
75815      for (j = 1; j <= 19; ++j) {
75816        for (let k = 0; k < n; ++k) {
75817          derivedKey[k] = encryptionKey[k] ^ j;
75818        }
75819        cipher = new ARCFourCipher(derivedKey);
75820        checkData = cipher.encryptBlock(checkData);
75821      }
75822      for (j = 0, n = checkData.length; j < n; ++j) {
75823        if (userPassword[j] !== checkData[j]) {
75824          return null;
75825        }
75826      }
75827    } else {
75828      cipher = new ARCFourCipher(encryptionKey);
75829      checkData = cipher.encryptBlock(CipherTransformFactory.#defaultPasswordBytes);
75830      for (j = 0, n = checkData.length; j < n; ++j) {
75831        if (userPassword[j] !== checkData[j]) {
75832          return null;
75833        }
75834      }
75835    }
75836    return encryptionKey;
75837  }
75838  #decodeUserPassword(password, ownerPassword, revision, keyLength) {
75839    const hashData = new Uint8Array(32);
75840    let i = 0;
75841    const n = Math.min(32, password.length);
75842    for (; i < n; ++i) {
75843      hashData[i] = password[i];
75844    }
75845    let j = 0;
75846    while (i < 32) {
75847      hashData[i++] = CipherTransformFactory.#defaultPasswordBytes[j++];
75848    }
75849    let hash = calculateMD5(hashData, 0, i);
75850    const keyLengthInBytes = keyLength >> 3;
75851    if (revision >= 3) {
75852      for (j = 0; j < 50; ++j) {
75853        hash = calculateMD5(hash, 0, hash.length);
75854      }
75855    }
75856    let cipher, userPassword;
75857    if (revision >= 3) {
75858      userPassword = ownerPassword;
75859      const derivedKey = new Uint8Array(keyLengthInBytes);
75860      for (j = 19; j >= 0; j--) {
75861        for (let k = 0; k < keyLengthInBytes; ++k) {
75862          derivedKey[k] = hash[k] ^ j;
75863        }
75864        cipher = new ARCFourCipher(derivedKey);
75865        userPassword = cipher.encryptBlock(userPassword);
75866      }
75867    } else {
75868      cipher = new ARCFourCipher(hash.subarray(0, keyLengthInBytes));
75869      userPassword = cipher.encryptBlock(ownerPassword);
75870    }
75871    return userPassword;
75872  }
75873  #buildObjectKey(num, gen, encryptionKey, isAes = false) {
75874    const key = new Uint8Array(encryptionKey.length + 9);
75875    const n = encryptionKey.length;
75876    let i;
75877    for (i = 0; i < n; ++i) {
75878      key[i] = encryptionKey[i];
75879    }
75880    key[i++] = num & 0xff;
75881    key[i++] = num >> 8 & 0xff;
75882    key[i++] = num >> 16 & 0xff;
75883    key[i++] = gen & 0xff;
75884    key[i++] = gen >> 8 & 0xff;
75885    if (isAes) {
75886      key[i++] = 0x73;
75887      key[i++] = 0x41;
75888      key[i++] = 0x6c;
75889      key[i++] = 0x54;
75890    }
75891    const hash = calculateMD5(key, 0, i);
75892    return hash.subarray(0, Math.min(encryptionKey.length + 5, 16));
75893  }
75894  #buildCipherConstructor(cf, name, num, gen, key) {
75895    if (!(name instanceof _primitives.Name)) {
75896      throw new _util.FormatError("Invalid crypt filter name.");
75897    }
75898    const self = this;
75899    const cryptFilter = cf.get(name.name);
75900    const cfm = cryptFilter?.get("CFM");
75901    if (!cfm || cfm.name === "None") {
75902      return function () {
75903        return new NullCipher();
75904      };
75905    }
75906    if (cfm.name === "V2") {
75907      return function () {
75908        return new ARCFourCipher(self.#buildObjectKey(num, gen, key, false));
75909      };
75910    }
75911    if (cfm.name === "AESV2") {
75912      return function () {
75913        return new AES128Cipher(self.#buildObjectKey(num, gen, key, true));
75914      };
75915    }
75916    if (cfm.name === "AESV3") {
75917      return function () {
75918        return new AES256Cipher(key);
75919      };
75920    }
75921    throw new _util.FormatError("Unknown crypto method");
75922  }
75923  constructor(dict, fileId, password) {
75924    const filter = dict.get("Filter");
75925    if (!(0, _primitives.isName)(filter, "Standard")) {
75926      throw new _util.FormatError("unknown encryption method");
75927    }
75928    this.filterName = filter.name;
75929    this.dict = dict;
75930    const algorithm = dict.get("V");
75931    if (!Number.isInteger(algorithm) || algorithm !== 1 && algorithm !== 2 && algorithm !== 4 && algorithm !== 5) {
75932      throw new _util.FormatError("unsupported encryption algorithm");
75933    }
75934    this.algorithm = algorithm;
75935    let keyLength = dict.get("Length");
75936    if (!keyLength) {
75937      if (algorithm <= 3) {
75938        keyLength = 40;
75939      } else {
75940        const cfDict = dict.get("CF");
75941        const streamCryptoName = dict.get("StmF");
75942        if (cfDict instanceof _primitives.Dict && streamCryptoName instanceof _primitives.Name) {
75943          cfDict.suppressEncryption = true;
75944          const handlerDict = cfDict.get(streamCryptoName.name);
75945          keyLength = handlerDict?.get("Length") || 128;
75946          if (keyLength < 40) {
75947            keyLength <<= 3;
75948          }
75949        }
75950      }
75951    }
75952    if (!Number.isInteger(keyLength) || keyLength < 40 || keyLength % 8 !== 0) {
75953      throw new _util.FormatError("invalid key length");
75954    }
75955    const ownerBytes = (0, _util.stringToBytes)(dict.get("O")),
75956      userBytes = (0, _util.stringToBytes)(dict.get("U"));
75957    const ownerPassword = ownerBytes.subarray(0, 32);
75958    const userPassword = userBytes.subarray(0, 32);
75959    const flags = dict.get("P");
75960    const revision = dict.get("R");
75961    const encryptMetadata = (algorithm === 4 || algorithm === 5) && dict.get("EncryptMetadata") !== false;
75962    this.encryptMetadata = encryptMetadata;
75963    const fileIdBytes = (0, _util.stringToBytes)(fileId);
75964    let passwordBytes;
75965    if (password) {
75966      if (revision === 6) {
75967        try {
75968          password = (0, _util.utf8StringToString)(password);
75969        } catch {
75970          (0, _util.warn)("CipherTransformFactory: Unable to convert UTF8 encoded password.");
75971        }
75972      }
75973      passwordBytes = (0, _util.stringToBytes)(password);
75974    }
75975    let encryptionKey;
75976    if (algorithm !== 5) {
75977      encryptionKey = this.#prepareKeyData(fileIdBytes, passwordBytes, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
75978    } else {
75979      const ownerValidationSalt = ownerBytes.subarray(32, 40);
75980      const ownerKeySalt = ownerBytes.subarray(40, 48);
75981      const uBytes = userBytes.subarray(0, 48);
75982      const userValidationSalt = userBytes.subarray(32, 40);
75983      const userKeySalt = userBytes.subarray(40, 48);
75984      const ownerEncryption = (0, _util.stringToBytes)(dict.get("OE"));
75985      const userEncryption = (0, _util.stringToBytes)(dict.get("UE"));
75986      const perms = (0, _util.stringToBytes)(dict.get("Perms"));
75987      encryptionKey = this.#createEncryptionKey20(revision, passwordBytes, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms);
75988    }
75989    if (!encryptionKey && !password) {
75990      throw new _util.PasswordException("No password given", _util.PasswordResponses.NEED_PASSWORD);
75991    } else if (!encryptionKey && password) {
75992      const decodedPassword = this.#decodeUserPassword(passwordBytes, ownerPassword, revision, keyLength);
75993      encryptionKey = this.#prepareKeyData(fileIdBytes, decodedPassword, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
75994    }
75995    if (!encryptionKey) {
75996      throw new _util.PasswordException("Incorrect Password", _util.PasswordResponses.INCORRECT_PASSWORD);
75997    }
75998    this.encryptionKey = encryptionKey;
75999    if (algorithm >= 4) {
76000      const cf = dict.get("CF");
76001      if (cf instanceof _primitives.Dict) {
76002        cf.suppressEncryption = true;
76003      }
76004      this.cf = cf;
76005      this.stmf = dict.get("StmF") || _primitives.Name.get("Identity");
76006      this.strf = dict.get("StrF") || _primitives.Name.get("Identity");
76007      this.eff = dict.get("EFF") || this.stmf;
76008    }
76009  }
76010  createCipherTransform(num, gen) {
76011    if (this.algorithm === 4 || this.algorithm === 5) {
76012      return new CipherTransform(this.#buildCipherConstructor(this.cf, this.strf, num, gen, this.encryptionKey), this.#buildCipherConstructor(this.cf, this.stmf, num, gen, this.encryptionKey));
76013    }
76014    const key = this.#buildObjectKey(num, gen, this.encryptionKey, false);
76015    const cipherConstructor = function () {
76016      return new ARCFourCipher(key);
76017    };
76018    return new CipherTransform(cipherConstructor, cipherConstructor);
76019  }
76020}
76021exports.CipherTransformFactory = CipherTransformFactory;
76022
76023/***/ }),
76024/* 75 */
76025/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
76026
76027
76028
76029Object.defineProperty(exports, "__esModule", ({
76030  value: true
76031}));
76032exports.DecryptStream = void 0;
76033var _decode_stream = __w_pdfjs_require__(18);
76034const chunkSize = 512;
76035class DecryptStream extends _decode_stream.DecodeStream {
76036  constructor(str, maybeLength, decrypt) {
76037    super(maybeLength);
76038    this.str = str;
76039    this.dict = str.dict;
76040    this.decrypt = decrypt;
76041    this.nextChunk = null;
76042    this.initialized = false;
76043  }
76044  readBlock() {
vendor: 29,321 bytes, lines 76045-76912
76045    let chunk;
76046    if (this.initialized) {
76047      chunk = this.nextChunk;
76048    } else {
76049      chunk = this.str.getBytes(chunkSize);
76050      this.initialized = true;
76051    }
76052    if (!chunk || chunk.length === 0) {
76053      this.eof = true;
76054      return;
76055    }
76056    this.nextChunk = this.str.getBytes(chunkSize);
76057    const hasMoreData = this.nextChunk?.length > 0;
76058    const decrypt = this.decrypt;
76059    chunk = decrypt(chunk, !hasMoreData);
76060    const bufferLength = this.bufferLength,
76061      newLength = bufferLength + chunk.length,
76062      buffer = this.ensureBuffer(newLength);
76063    buffer.set(chunk, bufferLength);
76064    this.bufferLength = newLength;
76065  }
76066}
76067exports.DecryptStream = DecryptStream;
76068
76069/***/ }),
76070/* 76 */
76071/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
76072
76073
76074
76075Object.defineProperty(exports, "__esModule", ({
76076  value: true
76077}));
76078exports.ObjectLoader = void 0;
76079var _primitives = __w_pdfjs_require__(4);
76080var _base_stream = __w_pdfjs_require__(5);
76081var _core_utils = __w_pdfjs_require__(3);
76082var _util = __w_pdfjs_require__(2);
76083function mayHaveChildren(value) {
76084  return value instanceof _primitives.Ref || value instanceof _primitives.Dict || value instanceof _base_stream.BaseStream || Array.isArray(value);
76085}
76086function addChildren(node, nodesToVisit) {
76087  if (node instanceof _primitives.Dict) {
76088    node = node.getRawValues();
76089  } else if (node instanceof _base_stream.BaseStream) {
76090    node = node.dict.getRawValues();
76091  } else if (!Array.isArray(node)) {
76092    return;
76093  }
76094  for (const rawValue of node) {
76095    if (mayHaveChildren(rawValue)) {
76096      nodesToVisit.push(rawValue);
76097    }
76098  }
76099}
76100class ObjectLoader {
76101  constructor(dict, keys, xref) {
76102    this.dict = dict;
76103    this.keys = keys;
76104    this.xref = xref;
76105    this.refSet = null;
76106  }
76107  async load() {
76108    if (this.xref.stream.isDataLoaded) {
76109      return undefined;
76110    }
76111    const {
76112      keys,
76113      dict
76114    } = this;
76115    this.refSet = new _primitives.RefSet();
76116    const nodesToVisit = [];
76117    for (const key of keys) {
76118      const rawValue = dict.getRaw(key);
76119      if (rawValue !== undefined) {
76120        nodesToVisit.push(rawValue);
76121      }
76122    }
76123    return this._walk(nodesToVisit);
76124  }
76125  async _walk(nodesToVisit) {
76126    const nodesToRevisit = [];
76127    const pendingRequests = [];
76128    while (nodesToVisit.length) {
76129      let currentNode = nodesToVisit.pop();
76130      if (currentNode instanceof _primitives.Ref) {
76131        if (this.refSet.has(currentNode)) {
76132          continue;
76133        }
76134        try {
76135          this.refSet.put(currentNode);
76136          currentNode = this.xref.fetch(currentNode);
76137        } catch (ex) {
76138          if (!(ex instanceof _core_utils.MissingDataException)) {
76139            (0, _util.warn)(`ObjectLoader._walk - requesting all data: "${ex}".`);
76140            this.refSet = null;
76141            const {
76142              manager
76143            } = this.xref.stream;
76144            return manager.requestAllChunks();
76145          }
76146          nodesToRevisit.push(currentNode);
76147          pendingRequests.push({
76148            begin: ex.begin,
76149            end: ex.end
76150          });
76151        }
76152      }
76153      if (currentNode instanceof _base_stream.BaseStream) {
76154        const baseStreams = currentNode.getBaseStreams();
76155        if (baseStreams) {
76156          let foundMissingData = false;
76157          for (const stream of baseStreams) {
76158            if (stream.isDataLoaded) {
76159              continue;
76160            }
76161            foundMissingData = true;
76162            pendingRequests.push({
76163              begin: stream.start,
76164              end: stream.end
76165            });
76166          }
76167          if (foundMissingData) {
76168            nodesToRevisit.push(currentNode);
76169          }
76170        }
76171      }
76172      addChildren(currentNode, nodesToVisit);
76173    }
76174    if (pendingRequests.length) {
76175      await this.xref.stream.manager.requestRanges(pendingRequests);
76176      for (const node of nodesToRevisit) {
76177        if (node instanceof _primitives.Ref) {
76178          this.refSet.remove(node);
76179        }
76180      }
76181      return this._walk(nodesToRevisit);
76182    }
76183    this.refSet = null;
76184    return undefined;
76185  }
76186}
76187exports.ObjectLoader = ObjectLoader;
76188
76189/***/ }),
76190/* 77 */
76191/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
76192
76193
76194
76195Object.defineProperty(exports, "__esModule", ({
76196  value: true
76197}));
76198exports.XFAFactory = void 0;
76199var _symbol_utils = __w_pdfjs_require__(78);
76200var _bind = __w_pdfjs_require__(79);
76201var _data = __w_pdfjs_require__(89);
76202var _fonts = __w_pdfjs_require__(85);
76203var _utils = __w_pdfjs_require__(84);
76204var _util = __w_pdfjs_require__(2);
76205var _parser = __w_pdfjs_require__(90);
76206var _xhtml = __w_pdfjs_require__(100);
76207class XFAFactory {
76208  constructor(data) {
76209    try {
76210      this.root = new _parser.XFAParser().parse(XFAFactory._createDocument(data));
76211      const binder = new _bind.Binder(this.root);
76212      this.form = binder.bind();
76213      this.dataHandler = new _data.DataHandler(this.root, binder.getData());
76214      this.form[_symbol_utils.$globalData].template = this.form;
76215    } catch (e) {
76216      (0, _util.warn)(`XFA - an error occurred during parsing and binding: ${e}`);
76217    }
76218  }
76219  isValid() {
76220    return this.root && this.form;
76221  }
76222  _createPagesHelper() {
76223    const iterator = this.form[_symbol_utils.$toPages]();
76224    return new Promise((resolve, reject) => {
76225      const nextIteration = () => {
76226        try {
76227          const value = iterator.next();
76228          if (value.done) {
76229            resolve(value.value);
76230          } else {
76231            setTimeout(nextIteration, 0);
76232          }
76233        } catch (e) {
76234          reject(e);
76235        }
76236      };
76237      setTimeout(nextIteration, 0);
76238    });
76239  }
76240  async _createPages() {
76241    try {
76242      this.pages = await this._createPagesHelper();
76243      this.dims = this.pages.children.map(c => {
76244        const {
76245          width,
76246          height
76247        } = c.attributes.style;
76248        return [0, 0, parseInt(width), parseInt(height)];
76249      });
76250    } catch (e) {
76251      (0, _util.warn)(`XFA - an error occurred during layout: ${e}`);
76252    }
76253  }
76254  getBoundingBox(pageIndex) {
76255    return this.dims[pageIndex];
76256  }
76257  async getNumPages() {
76258    if (!this.pages) {
76259      await this._createPages();
76260    }
76261    return this.dims.length;
76262  }
76263  setImages(images) {
76264    this.form[_symbol_utils.$globalData].images = images;
76265  }
76266  setFonts(fonts) {
76267    this.form[_symbol_utils.$globalData].fontFinder = new _fonts.FontFinder(fonts);
76268    const missingFonts = [];
76269    for (let typeface of this.form[_symbol_utils.$globalData].usedTypefaces) {
76270      typeface = (0, _utils.stripQuotes)(typeface);
76271      const font = this.form[_symbol_utils.$globalData].fontFinder.find(typeface);
76272      if (!font) {
76273        missingFonts.push(typeface);
76274      }
76275    }
76276    if (missingFonts.length > 0) {
76277      return missingFonts;
76278    }
76279    return null;
76280  }
76281  appendFonts(fonts, reallyMissingFonts) {
76282    this.form[_symbol_utils.$globalData].fontFinder.add(fonts, reallyMissingFonts);
76283  }
76284  async getPages() {
76285    if (!this.pages) {
76286      await this._createPages();
76287    }
76288    const pages = this.pages;
76289    this.pages = null;
76290    return pages;
76291  }
76292  serializeData(storage) {
76293    return this.dataHandler.serialize(storage);
76294  }
76295  static _createDocument(data) {
76296    if (!data["/xdp:xdp"]) {
76297      return data["xdp:xdp"];
76298    }
76299    return Object.values(data).join("");
76300  }
76301  static getRichTextAsHtml(rc) {
76302    if (!rc || typeof rc !== "string") {
76303      return null;
76304    }
76305    try {
76306      let root = new _parser.XFAParser(_xhtml.XhtmlNamespace, true).parse(rc);
76307      if (!["body", "xhtml"].includes(root[_symbol_utils.$nodeName])) {
76308        const newRoot = _xhtml.XhtmlNamespace.body({});
76309        newRoot[_symbol_utils.$appendChild](root);
76310        root = newRoot;
76311      }
76312      const result = root[_symbol_utils.$toHTML]();
76313      if (!result.success) {
76314        return null;
76315      }
76316      const {
76317        html
76318      } = result;
76319      const {
76320        attributes
76321      } = html;
76322      if (attributes) {
76323        if (attributes.class) {
76324          attributes.class = attributes.class.filter(attr => !attr.startsWith("xfa"));
76325        }
76326        attributes.dir = "auto";
76327      }
76328      return {
76329        html,
76330        str: root[_symbol_utils.$text]()
76331      };
76332    } catch (e) {
76333      (0, _util.warn)(`XFA - an error occurred during parsing of rich text: ${e}`);
76334    }
76335    return null;
76336  }
76337}
76338exports.XFAFactory = XFAFactory;
76339
76340/***/ }),
76341/* 78 */
76342/***/ ((__unused_webpack_module, exports) => {
76343
76344
76345
76346Object.defineProperty(exports, "__esModule", ({
76347  value: true
76348}));
76349exports.$uid = exports.$toStyle = exports.$toString = exports.$toPages = exports.$toHTML = exports.$text = exports.$tabIndex = exports.$setValue = exports.$setSetAttributes = exports.$setId = exports.$searchNode = exports.$root = exports.$resolvePrototypes = exports.$removeChild = exports.$pushPara = exports.$pushGlyphs = exports.$popPara = exports.$onText = exports.$onChildCheck = exports.$onChild = exports.$nsAttributes = exports.$nodeName = exports.$namespaceId = exports.$lastAttribute = exports.$isUsable = exports.$isTransparent = exports.$isThereMoreWidth = exports.$isSplittable = exports.$isNsAgnostic = exports.$isDescendent = exports.$isDataValue = exports.$isCDATAXml = exports.$isBindable = exports.$insertAt = exports.$indexOf = exports.$ids = exports.$hasSettableValue = exports.$globalData = exports.$getTemplateRoot = exports.$getSubformParent = exports.$getRealChildrenByNameIt = exports.$getParent = exports.$getNextPage = exports.$getExtra = exports.$getDataValue = exports.$getContainedChildren = exports.$getChildrenByNameIt = exports.$getChildrenByName = exports.$getChildrenByClass = exports.$getChildren = exports.$getAvailableSpace = exports.$getAttributes = exports.$getAttributeIt = exports.$flushHTML = exports.$finalize = exports.$extra = exports.$dump = exports.$data = exports.$content = exports.$consumed = exports.$clone = exports.$cleanup = exports.$cleanPage = exports.$clean = exports.$childrenToHTML = exports.$appendChild = exports.$addHTML = exports.$acceptWhitespace = void 0;
76350const $acceptWhitespace = Symbol();
76351exports.$acceptWhitespace = $acceptWhitespace;
76352const $addHTML = Symbol();
76353exports.$addHTML = $addHTML;
76354const $appendChild = Symbol();
76355exports.$appendChild = $appendChild;
76356const $childrenToHTML = Symbol();
76357exports.$childrenToHTML = $childrenToHTML;
76358const $clean = Symbol();
76359exports.$clean = $clean;
76360const $cleanPage = Symbol();
76361exports.$cleanPage = $cleanPage;
76362const $cleanup = Symbol();
76363exports.$cleanup = $cleanup;
76364const $clone = Symbol();
76365exports.$clone = $clone;
76366const $consumed = Symbol();
76367exports.$consumed = $consumed;
76368const $content = Symbol("content");
76369exports.$content = $content;
76370const $data = Symbol("data");
76371exports.$data = $data;
76372const $dump = Symbol();
76373exports.$dump = $dump;
76374const $extra = Symbol("extra");
76375exports.$extra = $extra;
76376const $finalize = Symbol();
76377exports.$finalize = $finalize;
76378const $flushHTML = Symbol();
76379exports.$flushHTML = $flushHTML;
76380const $getAttributeIt = Symbol();
76381exports.$getAttributeIt = $getAttributeIt;
76382const $getAttributes = Symbol();
76383exports.$getAttributes = $getAttributes;
76384const $getAvailableSpace = Symbol();
76385exports.$getAvailableSpace = $getAvailableSpace;
76386const $getChildrenByClass = Symbol();
76387exports.$getChildrenByClass = $getChildrenByClass;
76388const $getChildrenByName = Symbol();
76389exports.$getChildrenByName = $getChildrenByName;
76390const $getChildrenByNameIt = Symbol();
76391exports.$getChildrenByNameIt = $getChildrenByNameIt;
76392const $getDataValue = Symbol();
76393exports.$getDataValue = $getDataValue;
76394const $getExtra = Symbol();
76395exports.$getExtra = $getExtra;
76396const $getRealChildrenByNameIt = Symbol();
76397exports.$getRealChildrenByNameIt = $getRealChildrenByNameIt;
76398const $getChildren = Symbol();
76399exports.$getChildren = $getChildren;
76400const $getContainedChildren = Symbol();
76401exports.$getContainedChildren = $getContainedChildren;
76402const $getNextPage = Symbol();
76403exports.$getNextPage = $getNextPage;
76404const $getSubformParent = Symbol();
76405exports.$getSubformParent = $getSubformParent;
76406const $getParent = Symbol();
76407exports.$getParent = $getParent;
76408const $getTemplateRoot = Symbol();
76409exports.$getTemplateRoot = $getTemplateRoot;
76410const $globalData = Symbol();
76411exports.$globalData = $globalData;
76412const $hasSettableValue = Symbol();
76413exports.$hasSettableValue = $hasSettableValue;
76414const $ids = Symbol();
76415exports.$ids = $ids;
76416const $indexOf = Symbol();
76417exports.$indexOf = $indexOf;
76418const $insertAt = Symbol();
76419exports.$insertAt = $insertAt;
76420const $isCDATAXml = Symbol();
76421exports.$isCDATAXml = $isCDATAXml;
76422const $isBindable = Symbol();
76423exports.$isBindable = $isBindable;
76424const $isDataValue = Symbol();
76425exports.$isDataValue = $isDataValue;
76426const $isDescendent = Symbol();
76427exports.$isDescendent = $isDescendent;
76428const $isNsAgnostic = Symbol();
76429exports.$isNsAgnostic = $isNsAgnostic;
76430const $isSplittable = Symbol();
76431exports.$isSplittable = $isSplittable;
76432const $isThereMoreWidth = Symbol();
76433exports.$isThereMoreWidth = $isThereMoreWidth;
76434const $isTransparent = Symbol();
76435exports.$isTransparent = $isTransparent;
76436const $isUsable = Symbol();
76437exports.$isUsable = $isUsable;
76438const $lastAttribute = Symbol();
76439exports.$lastAttribute = $lastAttribute;
76440const $namespaceId = Symbol("namespaceId");
76441exports.$namespaceId = $namespaceId;
76442const $nodeName = Symbol("nodeName");
76443exports.$nodeName = $nodeName;
76444const $nsAttributes = Symbol();
76445exports.$nsAttributes = $nsAttributes;
76446const $onChild = Symbol();
76447exports.$onChild = $onChild;
76448const $onChildCheck = Symbol();
76449exports.$onChildCheck = $onChildCheck;
76450const $onText = Symbol();
76451exports.$onText = $onText;
76452const $pushGlyphs = Symbol();
76453exports.$pushGlyphs = $pushGlyphs;
76454const $popPara = Symbol();
76455exports.$popPara = $popPara;
76456const $pushPara = Symbol();
76457exports.$pushPara = $pushPara;
76458const $removeChild = Symbol();
76459exports.$removeChild = $removeChild;
76460const $root = Symbol("root");
76461exports.$root = $root;
76462const $resolvePrototypes = Symbol();
76463exports.$resolvePrototypes = $resolvePrototypes;
76464const $searchNode = Symbol();
76465exports.$searchNode = $searchNode;
76466const $setId = Symbol();
76467exports.$setId = $setId;
76468const $setSetAttributes = Symbol();
76469exports.$setSetAttributes = $setSetAttributes;
76470const $setValue = Symbol();
76471exports.$setValue = $setValue;
76472const $tabIndex = Symbol();
76473exports.$tabIndex = $tabIndex;
76474const $text = Symbol();
76475exports.$text = $text;
76476const $toPages = Symbol();
76477exports.$toPages = $toPages;
76478const $toHTML = Symbol();
76479exports.$toHTML = $toHTML;
76480const $toString = Symbol();
76481exports.$toString = $toString;
76482const $toStyle = Symbol();
76483exports.$toStyle = $toStyle;
76484const $uid = Symbol("uid");
76485exports.$uid = $uid;
76486
76487/***/ }),
76488/* 79 */
76489/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
76490
76491
76492
76493Object.defineProperty(exports, "__esModule", ({
76494  value: true
76495}));
76496exports.Binder = void 0;
76497var _symbol_utils = __w_pdfjs_require__(78);
76498var _template = __w_pdfjs_require__(80);
76499var _som = __w_pdfjs_require__(88);
76500var _xfa_object = __w_pdfjs_require__(87);
76501var _namespaces = __w_pdfjs_require__(81);
76502var _util = __w_pdfjs_require__(2);
76503const NS_DATASETS = _namespaces.NamespaceIds.datasets.id;
76504function createText(content) {
76505  const node = new _template.Text({});
76506  node[_symbol_utils.$content] = content;
76507  return node;
76508}
76509class Binder {
76510  constructor(root) {
76511    this.root = root;
76512    this.datasets = root.datasets;
76513    this.data = root.datasets?.data || new _xfa_object.XmlObject(_namespaces.NamespaceIds.datasets.id, "data");
76514    this.emptyMerge = this.data[_symbol_utils.$getChildren]().length === 0;
76515    this.root.form = this.form = root.template[_symbol_utils.$clone]();
76516  }
76517  _isConsumeData() {
76518    return !this.emptyMerge && this._mergeMode;
76519  }
76520  _isMatchTemplate() {
76521    return !this._isConsumeData();
76522  }
76523  bind() {
76524    this._bindElement(this.form, this.data);
76525    return this.form;
76526  }
76527  getData() {
76528    return this.data;
76529  }
76530  _bindValue(formNode, data, picture) {
76531    formNode[_symbol_utils.$data] = data;
76532    if (formNode[_symbol_utils.$hasSettableValue]()) {
76533      if (data[_symbol_utils.$isDataValue]()) {
76534        const value = data[_symbol_utils.$getDataValue]();
76535        formNode[_symbol_utils.$setValue](createText(value));
76536      } else if (formNode instanceof _template.Field && formNode.ui?.choiceList?.open === "multiSelect") {
76537        const value = data[_symbol_utils.$getChildren]().map(child => child[_symbol_utils.$content].trim()).join("\n");
76538        formNode[_symbol_utils.$setValue](createText(value));
76539      } else if (this._isConsumeData()) {
76540        (0, _util.warn)(`XFA - Nodes haven't the same type.`);
76541      }
76542    } else if (!data[_symbol_utils.$isDataValue]() || this._isMatchTemplate()) {
76543      this._bindElement(formNode, data);
76544    } else {
76545      (0, _util.warn)(`XFA - Nodes haven't the same type.`);
76546    }
76547  }
76548  _findDataByNameToConsume(name, isValue, dataNode, global) {
76549    if (!name) {
76550      return null;
76551    }
76552    let generator, match;
76553    for (let i = 0; i < 3; i++) {
76554      generator = dataNode[_symbol_utils.$getRealChildrenByNameIt](name, false, true);
76555      while (true) {
76556        match = generator.next().value;
76557        if (!match) {
76558          break;
76559        }
76560        if (isValue === match[_symbol_utils.$isDataValue]()) {
76561          return match;
76562        }
76563      }
76564      if (dataNode[_symbol_utils.$namespaceId] === _namespaces.NamespaceIds.datasets.id && dataNode[_symbol_utils.$nodeName] === "data") {
76565        break;
76566      }
76567      dataNode = dataNode[_symbol_utils.$getParent]();
76568    }
76569    if (!global) {
76570      return null;
76571    }
76572    generator = this.data[_symbol_utils.$getRealChildrenByNameIt](name, true, false);
76573    match = generator.next().value;
76574    if (match) {
76575      return match;
76576    }
76577    generator = this.data[_symbol_utils.$getAttributeIt](name, true);
76578    match = generator.next().value;
76579    if (match?.[_symbol_utils.$isDataValue]()) {
76580      return match;
76581    }
76582    return null;
76583  }
76584  _setProperties(formNode, dataNode) {
76585    if (!formNode.hasOwnProperty("setProperty")) {
76586      return;
76587    }
76588    for (const {
76589      ref,
76590      target,
76591      connection
76592    } of formNode.setProperty.children) {
76593      if (connection) {
76594        continue;
76595      }
76596      if (!ref) {
76597        continue;
76598      }
76599      const nodes = (0, _som.searchNode)(this.root, dataNode, ref, false, false);
76600      if (!nodes) {
76601        (0, _util.warn)(`XFA - Invalid reference: ${ref}.`);
76602        continue;
76603      }
76604      const [node] = nodes;
76605      if (!node[_symbol_utils.$isDescendent](this.data)) {
76606        (0, _util.warn)(`XFA - Invalid node: must be a data node.`);
76607        continue;
76608      }
76609      const targetNodes = (0, _som.searchNode)(this.root, formNode, target, false, false);
76610      if (!targetNodes) {
76611        (0, _util.warn)(`XFA - Invalid target: ${target}.`);
76612        continue;
76613      }
76614      const [targetNode] = targetNodes;
76615      if (!targetNode[_symbol_utils.$isDescendent](formNode)) {
76616        (0, _util.warn)(`XFA - Invalid target: must be a property or subproperty.`);
76617        continue;
76618      }
76619      const targetParent = targetNode[_symbol_utils.$getParent]();
76620      if (targetNode instanceof _template.SetProperty || targetParent instanceof _template.SetProperty) {
76621        (0, _util.warn)(`XFA - Invalid target: cannot be a setProperty or one of its properties.`);
76622        continue;
76623      }
76624      if (targetNode instanceof _template.BindItems || targetParent instanceof _template.BindItems) {
76625        (0, _util.warn)(`XFA - Invalid target: cannot be a bindItems or one of its properties.`);
76626        continue;
76627      }
76628      const content = node[_symbol_utils.$text]();
76629      const name = targetNode[_symbol_utils.$nodeName];
76630      if (targetNode instanceof _xfa_object.XFAAttribute) {
76631        const attrs = Object.create(null);
76632        attrs[name] = content;
76633        const obj = Reflect.construct(Object.getPrototypeOf(targetParent).constructor, [attrs]);
76634        targetParent[name] = obj[name];
76635        continue;
76636      }
76637      if (!targetNode.hasOwnProperty(_symbol_utils.$content)) {
76638        (0, _util.warn)(`XFA - Invalid node to use in setProperty`);
76639        continue;
76640      }
76641      targetNode[_symbol_utils.$data] = node;
76642      targetNode[_symbol_utils.$content] = content;
76643      targetNode[_symbol_utils.$finalize]();
76644    }
76645  }
76646  _bindItems(formNode, dataNode) {
76647    if (!formNode.hasOwnProperty("items") || !formNode.hasOwnProperty("bindItems") || formNode.bindItems.isEmpty()) {
76648      return;
76649    }
76650    for (const item of formNode.items.children) {
76651      formNode[_symbol_utils.$removeChild](item);
76652    }
76653    formNode.items.clear();
76654    const labels = new _template.Items({});
76655    const values = new _template.Items({});
76656    formNode[_symbol_utils.$appendChild](labels);
76657    formNode.items.push(labels);
76658    formNode[_symbol_utils.$appendChild](values);
76659    formNode.items.push(values);
76660    for (const {
76661      ref,
76662      labelRef,
76663      valueRef,
76664      connection
76665    } of formNode.bindItems.children) {
76666      if (connection) {
76667        continue;
76668      }
76669      if (!ref) {
76670        continue;
76671      }
76672      const nodes = (0, _som.searchNode)(this.root, dataNode, ref, false, false);
76673      if (!nodes) {
76674        (0, _util.warn)(`XFA - Invalid reference: ${ref}.`);
76675        continue;
76676      }
76677      for (const node of nodes) {
76678        if (!node[_symbol_utils.$isDescendent](this.datasets)) {
76679          (0, _util.warn)(`XFA - Invalid ref (${ref}): must be a datasets child.`);
76680          continue;
76681        }
76682        const labelNodes = (0, _som.searchNode)(this.root, node, labelRef, true, false);
76683        if (!labelNodes) {
76684          (0, _util.warn)(`XFA - Invalid label: ${labelRef}.`);
76685          continue;
76686        }
76687        const [labelNode] = labelNodes;
76688        if (!labelNode[_symbol_utils.$isDescendent](this.datasets)) {
76689          (0, _util.warn)(`XFA - Invalid label: must be a datasets child.`);
76690          continue;
76691        }
76692        const valueNodes = (0, _som.searchNode)(this.root, node, valueRef, true, false);
76693        if (!valueNodes) {
76694          (0, _util.warn)(`XFA - Invalid value: ${valueRef}.`);
76695          continue;
76696        }
76697        const [valueNode] = valueNodes;
76698        if (!valueNode[_symbol_utils.$isDescendent](this.datasets)) {
76699          (0, _util.warn)(`XFA - Invalid value: must be a datasets child.`);
76700          continue;
76701        }
76702        const label = createText(labelNode[_symbol_utils.$text]());
76703        const value = createText(valueNode[_symbol_utils.$text]());
76704        labels[_symbol_utils.$appendChild](label);
76705        labels.text.push(label);
76706        values[_symbol_utils.$appendChild](value);
76707        values.text.push(value);
76708      }
76709    }
76710  }
76711  _bindOccurrences(formNode, matches, picture) {
76712    let baseClone;
76713    if (matches.length > 1) {
76714      baseClone = formNode[_symbol_utils.$clone]();
76715      baseClone[_symbol_utils.$removeChild](baseClone.occur);
76716      baseClone.occur = null;
76717    }
76718    this._bindValue(formNode, matches[0], picture);
76719    this._setProperties(formNode, matches[0]);
76720    this._bindItems(formNode, matches[0]);
76721    if (matches.length === 1) {
76722      return;
76723    }
76724    const parent = formNode[_symbol_utils.$getParent]();
76725    const name = formNode[_symbol_utils.$nodeName];
76726    const pos = parent[_symbol_utils.$indexOf](formNode);
76727    for (let i = 1, ii = matches.length; i < ii; i++) {
76728      const match = matches[i];
76729      const clone = baseClone[_symbol_utils.$clone]();
76730      parent[name].push(clone);
76731      parent[_symbol_utils.$insertAt](pos + i, clone);
76732      this._bindValue(clone, match, picture);
76733      this._setProperties(clone, match);
76734      this._bindItems(clone, match);
76735    }
76736  }
76737  _createOccurrences(formNode) {
76738    if (!this.emptyMerge) {
76739      return;
76740    }
76741    const {
76742      occur
76743    } = formNode;
76744    if (!occur || occur.initial <= 1) {
76745      return;
76746    }
76747    const parent = formNode[_symbol_utils.$getParent]();
76748    const name = formNode[_symbol_utils.$nodeName];
76749    if (!(parent[name] instanceof _xfa_object.XFAObjectArray)) {
76750      return;
76751    }
76752    let currentNumber;
76753    if (formNode.name) {
76754      currentNumber = parent[name].children.filter(e => e.name === formNode.name).length;
76755    } else {
76756      currentNumber = parent[name].children.length;
76757    }
76758    const pos = parent[_symbol_utils.$indexOf](formNode) + 1;
76759    const ii = occur.initial - currentNumber;
76760    if (ii) {
76761      const nodeClone = formNode[_symbol_utils.$clone]();
76762      nodeClone[_symbol_utils.$removeChild](nodeClone.occur);
76763      nodeClone.occur = null;
76764      parent[name].push(nodeClone);
76765      parent[_symbol_utils.$insertAt](pos, nodeClone);
76766      for (let i = 1; i < ii; i++) {
76767        const clone = nodeClone[_symbol_utils.$clone]();
76768        parent[name].push(clone);
76769        parent[_symbol_utils.$insertAt](pos + i, clone);
76770      }
76771    }
76772  }
76773  _getOccurInfo(formNode) {
76774    const {
76775      name,
76776      occur
76777    } = formNode;
76778    if (!occur || !name) {
76779      return [1, 1];
76780    }
76781    const max = occur.max === -1 ? Infinity : occur.max;
76782    return [occur.min, max];
76783  }
76784  _setAndBind(formNode, dataNode) {
76785    this._setProperties(formNode, dataNode);
76786    this._bindItems(formNode, dataNode);
76787    this._bindElement(formNode, dataNode);
76788  }
76789  _bindElement(formNode, dataNode) {
76790    const uselessNodes = [];
76791    this._createOccurrences(formNode);
76792    for (const child of formNode[_symbol_utils.$getChildren]()) {
76793      if (child[_symbol_utils.$data]) {
76794        continue;
76795      }
76796      if (this._mergeMode === undefined && child[_symbol_utils.$nodeName] === "subform") {
76797        this._mergeMode = child.mergeMode === "consumeData";
76798        const dataChildren = dataNode[_symbol_utils.$getChildren]();
76799        if (dataChildren.length > 0) {
76800          this._bindOccurrences(child, [dataChildren[0]], null);
76801        } else if (this.emptyMerge) {
76802          const nsId = dataNode[_symbol_utils.$namespaceId] === NS_DATASETS ? -1 : dataNode[_symbol_utils.$namespaceId];
76803          const dataChild = child[_symbol_utils.$data] = new _xfa_object.XmlObject(nsId, child.name || "root");
76804          dataNode[_symbol_utils.$appendChild](dataChild);
76805          this._bindElement(child, dataChild);
76806        }
76807        continue;
76808      }
76809      if (!child[_symbol_utils.$isBindable]()) {
76810        continue;
76811      }
76812      let global = false;
76813      let picture = null;
76814      let ref = null;
76815      let match = null;
76816      if (child.bind) {
76817        switch (child.bind.match) {
76818          case "none":
76819            this._setAndBind(child, dataNode);
76820            continue;
76821          case "global":
76822            global = true;
76823            break;
76824          case "dataRef":
76825            if (!child.bind.ref) {
76826              (0, _util.warn)(`XFA - ref is empty in node ${child[_symbol_utils.$nodeName]}.`);
76827              this._setAndBind(child, dataNode);
76828              continue;
76829            }
76830            ref = child.bind.ref;
76831            break;
76832          default:
76833            break;
76834        }
76835        if (child.bind.picture) {
76836          picture = child.bind.picture[_symbol_utils.$content];
76837        }
76838      }
76839      const [min, max] = this._getOccurInfo(child);
76840      if (ref) {
76841        match = (0, _som.searchNode)(this.root, dataNode, ref, true, false);
76842        if (match === null) {
76843          match = (0, _som.createDataNode)(this.data, dataNode, ref);
76844          if (!match) {
76845            continue;
76846          }
76847          if (this._isConsumeData()) {
76848            match[_symbol_utils.$consumed] = true;
76849          }
76850          this._setAndBind(child, match);
76851          continue;
76852        } else {
76853          if (this._isConsumeData()) {
76854            match = match.filter(node => !node[_symbol_utils.$consumed]);
76855          }
76856          if (match.length > max) {
76857            match = match.slice(0, max);
76858          } else if (match.length === 0) {
76859            match = null;
76860          }
76861          if (match && this._isConsumeData()) {
76862            match.forEach(node => {
76863              node[_symbol_utils.$consumed] = true;
76864            });
76865          }
76866        }
76867      } else {
76868        if (!child.name) {
76869          this._setAndBind(child, dataNode);
76870          continue;
76871        }
76872        if (this._isConsumeData()) {
76873          const matches = [];
76874          while (matches.length < max) {
76875            const found = this._findDataByNameToConsume(child.name, child[_symbol_utils.$hasSettableValue](), dataNode, global);
76876            if (!found) {
76877              break;
76878            }
76879            found[_symbol_utils.$consumed] = true;
76880            matches.push(found);
76881          }
76882          match = matches.length > 0 ? matches : null;
76883        } else {
76884          match = dataNode[_symbol_utils.$getRealChildrenByNameIt](child.name, false, this.emptyMerge).next().value;
76885          if (!match) {
76886            if (min === 0) {
76887              uselessNodes.push(child);
76888              continue;
76889            }
76890            const nsId = dataNode[_symbol_utils.$namespaceId] === NS_DATASETS ? -1 : dataNode[_symbol_utils.$namespaceId];
76891            match = child[_symbol_utils.$data] = new _xfa_object.XmlObject(nsId, child.name);
76892            if (this.emptyMerge) {
76893              match[_symbol_utils.$consumed] = true;
76894            }
76895            dataNode[_symbol_utils.$appendChild](match);
76896            this._setAndBind(child, match);
76897            continue;
76898          }
76899          if (this.emptyMerge) {
76900            match[_symbol_utils.$consumed] = true;
76901          }
76902          match = [match];
76903        }
76904      }
76905      if (match) {
76906        this._bindOccurrences(child, match, picture);
76907      } else if (min > 0) {
76908        this._setAndBind(child, dataNode);
76909      } else {
76910        uselessNodes.push(child);
76911      }
76912    }
76913    uselessNodes.forEach(node => node[_symbol_utils.$getParent]()[_symbol_utils.$removeChild](node));
76914  }
76915}
76916exports.Binder = Binder;
76917
76918/***/ }),
76919/* 80 */
76920/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
76921
76922
76923
76924Object.defineProperty(exports, "__esModule", ({
76925  value: true
76926}));
76927exports.Value = exports.Text = exports.TemplateNamespace = exports.Template = exports.SetProperty = exports.Items = exports.Field = exports.BindItems = void 0;
76928var _symbol_utils = __w_pdfjs_require__(78);
76929var _namespaces = __w_pdfjs_require__(81);
76930var _layout = __w_pdfjs_require__(82);
76931var _html_utils = __w_pdfjs_require__(83);
76932var _xfa_object = __w_pdfjs_require__(87);
76933var _utils = __w_pdfjs_require__(84);
76934var _util = __w_pdfjs_require__(2);
76935var _fonts = __w_pdfjs_require__(85);
76936var _core_utils = __w_pdfjs_require__(3);
76937var _som = __w_pdfjs_require__(88);
76938const TEMPLATE_NS_ID = _namespaces.NamespaceIds.template.id;
76939const SVG_NS = "http://www.w3.org/2000/svg";
76940const MAX_ATTEMPTS_FOR_LRTB_LAYOUT = 2;
76941const MAX_EMPTY_PAGES = 3;
76942const DEFAULT_TAB_INDEX = 5000;
76943const HEADING_PATTERN = /^H(\d+)$/;
vendor: 113,321 bytes, lines 76944-80113
76944const 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"]);
76945const 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"]];
76946function getBorderDims(node) {
76947  if (!node || !node.border) {
76948    return {
76949      w: 0,
76950      h: 0
76951    };
76952  }
76953  const borderExtra = node.border[_symbol_utils.$getExtra]();
76954  if (!borderExtra) {
76955    return {
76956      w: 0,
76957      h: 0
76958    };
76959  }
76960  return {
76961    w: borderExtra.widths[0] + borderExtra.widths[2] + borderExtra.insets[0] + borderExtra.insets[2],
76962    h: borderExtra.widths[1] + borderExtra.widths[3] + borderExtra.insets[1] + borderExtra.insets[3]
76963  };
76964}
76965function hasMargin(node) {
76966  return node.margin && (node.margin.topInset || node.margin.rightInset || node.margin.bottomInset || node.margin.leftInset);
76967}
76968function _setValue(templateNode, value) {
76969  if (!templateNode.value) {
76970    const nodeValue = new Value({});
76971    templateNode[_symbol_utils.$appendChild](nodeValue);
76972    templateNode.value = nodeValue;
76973  }
76974  templateNode.value[_symbol_utils.$setValue](value);
76975}
76976function* getContainedChildren(node) {
76977  for (const child of node[_symbol_utils.$getChildren]()) {
76978    if (child instanceof SubformSet) {
76979      yield* child[_symbol_utils.$getContainedChildren]();
76980      continue;
76981    }
76982    yield child;
76983  }
76984}
76985function isRequired(node) {
76986  return node.validate?.nullTest === "error";
76987}
76988function setTabIndex(node) {
76989  while (node) {
76990    if (!node.traversal) {
76991      node[_symbol_utils.$tabIndex] = node[_symbol_utils.$getParent]()[_symbol_utils.$tabIndex];
76992      return;
76993    }
76994    if (node[_symbol_utils.$tabIndex]) {
76995      return;
76996    }
76997    let next = null;
76998    for (const child of node.traversal[_symbol_utils.$getChildren]()) {
76999      if (child.operation === "next") {
77000        next = child;
77001        break;
77002      }
77003    }
77004    if (!next || !next.ref) {
77005      node[_symbol_utils.$tabIndex] = node[_symbol_utils.$getParent]()[_symbol_utils.$tabIndex];
77006      return;
77007    }
77008    const root = node[_symbol_utils.$getTemplateRoot]();
77009    node[_symbol_utils.$tabIndex] = ++root[_symbol_utils.$tabIndex];
77010    const ref = root[_symbol_utils.$searchNode](next.ref, node);
77011    if (!ref) {
77012      return;
77013    }
77014    node = ref[0];
77015  }
77016}
77017function applyAssist(obj, attributes) {
77018  const assist = obj.assist;
77019  if (assist) {
77020    const assistTitle = assist[_symbol_utils.$toHTML]();
77021    if (assistTitle) {
77022      attributes.title = assistTitle;
77023    }
77024    const role = assist.role;
77025    const match = role.match(HEADING_PATTERN);
77026    if (match) {
77027      const ariaRole = "heading";
77028      const ariaLevel = match[1];
77029      attributes.role = ariaRole;
77030      attributes["aria-level"] = ariaLevel;
77031    }
77032  }
77033  if (obj.layout === "table") {
77034    attributes.role = "table";
77035  } else if (obj.layout === "row") {
77036    attributes.role = "row";
77037  } else {
77038    const parent = obj[_symbol_utils.$getParent]();
77039    if (parent.layout === "row") {
77040      attributes.role = parent.assist?.role === "TH" ? "columnheader" : "cell";
77041    }
77042  }
77043}
77044function ariaLabel(obj) {
77045  if (!obj.assist) {
77046    return null;
77047  }
77048  const assist = obj.assist;
77049  if (assist.speak && assist.speak[_symbol_utils.$content] !== "") {
77050    return assist.speak[_symbol_utils.$content];
77051  }
77052  if (assist.toolTip) {
77053    return assist.toolTip[_symbol_utils.$content];
77054  }
77055  return null;
77056}
77057function valueToHtml(value) {
77058  return _utils.HTMLResult.success({
77059    name: "div",
77060    attributes: {
77061      class: ["xfaRich"],
77062      style: Object.create(null)
77063    },
77064    children: [{
77065      name: "span",
77066      attributes: {
77067        style: Object.create(null)
77068      },
77069      value
77070    }]
77071  });
77072}
77073function setFirstUnsplittable(node) {
77074  const root = node[_symbol_utils.$getTemplateRoot]();
77075  if (root[_symbol_utils.$extra].firstUnsplittable === null) {
77076    root[_symbol_utils.$extra].firstUnsplittable = node;
77077    root[_symbol_utils.$extra].noLayoutFailure = true;
77078  }
77079}
77080function unsetFirstUnsplittable(node) {
77081  const root = node[_symbol_utils.$getTemplateRoot]();
77082  if (root[_symbol_utils.$extra].firstUnsplittable === node) {
77083    root[_symbol_utils.$extra].noLayoutFailure = false;
77084  }
77085}
77086function handleBreak(node) {
77087  if (node[_symbol_utils.$extra]) {
77088    return false;
77089  }
77090  node[_symbol_utils.$extra] = Object.create(null);
77091  if (node.targetType === "auto") {
77092    return false;
77093  }
77094  const root = node[_symbol_utils.$getTemplateRoot]();
77095  let target = null;
77096  if (node.target) {
77097    target = root[_symbol_utils.$searchNode](node.target, node[_symbol_utils.$getParent]());
77098    if (!target) {
77099      return false;
77100    }
77101    target = target[0];
77102  }
77103  const {
77104    currentPageArea,
77105    currentContentArea
77106  } = root[_symbol_utils.$extra];
77107  if (node.targetType === "pageArea") {
77108    if (!(target instanceof PageArea)) {
77109      target = null;
77110    }
77111    if (node.startNew) {
77112      node[_symbol_utils.$extra].target = target || currentPageArea;
77113      return true;
77114    } else if (target && target !== currentPageArea) {
77115      node[_symbol_utils.$extra].target = target;
77116      return true;
77117    }
77118    return false;
77119  }
77120  if (!(target instanceof ContentArea)) {
77121    target = null;
77122  }
77123  const pageArea = target && target[_symbol_utils.$getParent]();
77124  let index;
77125  let nextPageArea = pageArea;
77126  if (node.startNew) {
77127    if (target) {
77128      const contentAreas = pageArea.contentArea.children;
77129      const indexForCurrent = contentAreas.indexOf(currentContentArea);
77130      const indexForTarget = contentAreas.indexOf(target);
77131      if (indexForCurrent !== -1 && indexForCurrent < indexForTarget) {
77132        nextPageArea = null;
77133      }
77134      index = indexForTarget - 1;
77135    } else {
77136      index = currentPageArea.contentArea.children.indexOf(currentContentArea);
77137    }
77138  } else if (target && target !== currentContentArea) {
77139    const contentAreas = pageArea.contentArea.children;
77140    index = contentAreas.indexOf(target) - 1;
77141    nextPageArea = pageArea === currentPageArea ? null : pageArea;
77142  } else {
77143    return false;
77144  }
77145  node[_symbol_utils.$extra].target = nextPageArea;
77146  node[_symbol_utils.$extra].index = index;
77147  return true;
77148}
77149function handleOverflow(node, extraNode, space) {
77150  const root = node[_symbol_utils.$getTemplateRoot]();
77151  const saved = root[_symbol_utils.$extra].noLayoutFailure;
77152  const savedMethod = extraNode[_symbol_utils.$getSubformParent];
77153  extraNode[_symbol_utils.$getSubformParent] = () => node;
77154  root[_symbol_utils.$extra].noLayoutFailure = true;
77155  const res = extraNode[_symbol_utils.$toHTML](space);
77156  node[_symbol_utils.$addHTML](res.html, res.bbox);
77157  root[_symbol_utils.$extra].noLayoutFailure = saved;
77158  extraNode[_symbol_utils.$getSubformParent] = savedMethod;
77159}
77160class AppearanceFilter extends _xfa_object.StringObject {
77161  constructor(attributes) {
77162    super(TEMPLATE_NS_ID, "appearanceFilter");
77163    this.id = attributes.id || "";
77164    this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
77165    this.use = attributes.use || "";
77166    this.usehref = attributes.usehref || "";
77167  }
77168}
77169class Arc extends _xfa_object.XFAObject {
77170  constructor(attributes) {
77171    super(TEMPLATE_NS_ID, "arc", true);
77172    this.circular = (0, _utils.getInteger)({
77173      data: attributes.circular,
77174      defaultValue: 0,
77175      validate: x => x === 1
77176    });
77177    this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
77178    this.id = attributes.id || "";
77179    this.startAngle = (0, _utils.getFloat)({
77180      data: attributes.startAngle,
77181      defaultValue: 0,
77182      validate: x => true
77183    });
77184    this.sweepAngle = (0, _utils.getFloat)({
77185      data: attributes.sweepAngle,
77186      defaultValue: 360,
77187      validate: x => true
77188    });
77189    this.use = attributes.use || "";
77190    this.usehref = attributes.usehref || "";
77191    this.edge = null;
77192    this.fill = null;
77193  }
77194  [_symbol_utils.$toHTML]() {
77195    const edge = this.edge || new Edge({});
77196    const edgeStyle = edge[_symbol_utils.$toStyle]();
77197    const style = Object.create(null);
77198    if (this.fill?.presence === "visible") {
77199      Object.assign(style, this.fill[_symbol_utils.$toStyle]());
77200    } else {
77201      style.fill = "transparent";
77202    }
77203    style.strokeWidth = (0, _html_utils.measureToString)(edge.presence === "visible" ? edge.thickness : 0);
77204    style.stroke = edgeStyle.color;
77205    let arc;
77206    const attributes = {
77207      xmlns: SVG_NS,
77208      style: {
77209        width: "100%",
77210        height: "100%",
77211        overflow: "visible"
77212      }
77213    };
77214    if (this.sweepAngle === 360) {
77215      arc = {
77216        name: "ellipse",
77217        attributes: {
77218          xmlns: SVG_NS,
77219          cx: "50%",
77220          cy: "50%",
77221          rx: "50%",
77222          ry: "50%",
77223          style
77224        }
77225      };
77226    } else {
77227      const startAngle = this.startAngle * Math.PI / 180;
77228      const sweepAngle = this.sweepAngle * Math.PI / 180;
77229      const largeArc = this.sweepAngle > 180 ? 1 : 0;
77230      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))];
77231      arc = {
77232        name: "path",
77233        attributes: {
77234          xmlns: SVG_NS,
77235          d: `M ${x1} ${y1} A 50 50 0 ${largeArc} 0 ${x2} ${y2}`,
77236          vectorEffect: "non-scaling-stroke",
77237          style
77238        }
77239      };
77240      Object.assign(attributes, {
77241        viewBox: "0 0 100 100",
77242        preserveAspectRatio: "none"
77243      });
77244    }
77245    const svg = {
77246      name: "svg",
77247      children: [arc],
77248      attributes
77249    };
77250    const parent = this[_symbol_utils.$getParent]()[_symbol_utils.$getParent]();
77251    if (hasMargin(parent)) {
77252      return _utils.HTMLResult.success({
77253        name: "div",
77254        attributes: {
77255          style: {
77256            display: "inline",
77257            width: "100%",
77258            height: "100%"
77259          }
77260        },
77261        children: [svg]
77262      });
77263    }
77264    svg.attributes.style.position = "absolute";
77265    return _utils.HTMLResult.success(svg);
77266  }
77267}
77268class Area extends _xfa_object.XFAObject {
77269  constructor(attributes) {
77270    super(TEMPLATE_NS_ID, "area", true);
77271    this.colSpan = (0, _utils.getInteger)({
77272      data: attributes.colSpan,
77273      defaultValue: 1,
77274      validate: n => n >= 1 || n === -1
77275    });
77276    this.id = attributes.id || "";
77277    this.name = attributes.name || "";
77278    this.relevant = (0, _utils.getRelevant)(attributes.relevant);
77279    this.use = attributes.use || "";
77280    this.usehref = attributes.usehref || "";
77281    this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
77282    this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
77283    this.desc = null;
77284    this.extras = null;
77285    this.area = new _xfa_object.XFAObjectArray();
77286    this.draw = new _xfa_object.XFAObjectArray();
77287    this.exObject = new _xfa_object.XFAObjectArray();
77288    this.exclGroup = new _xfa_object.XFAObjectArray();
77289    this.field = new _xfa_object.XFAObjectArray();
77290    this.subform = new _xfa_object.XFAObjectArray();
77291    this.subformSet = new _xfa_object.XFAObjectArray();
77292  }
77293  *[_symbol_utils.$getContainedChildren]() {
77294    yield* getContainedChildren(this);
77295  }
77296  [_symbol_utils.$isTransparent]() {
77297    return true;
77298  }
77299  [_symbol_utils.$isBindable]() {
77300    return true;
77301  }
77302  [_symbol_utils.$addHTML](html, bbox) {
77303    const [x, y, w, h] = bbox;
77304    this[_symbol_utils.$extra].width = Math.max(this[_symbol_utils.$extra].width, x + w);
77305    this[_symbol_utils.$extra].height = Math.max(this[_symbol_utils.$extra].height, y + h);
77306    this[_symbol_utils.$extra].children.push(html);
77307  }
77308  [_symbol_utils.$getAvailableSpace]() {
77309    return this[_symbol_utils.$extra].availableSpace;
77310  }
77311  [_symbol_utils.$toHTML](availableSpace) {
77312    const style = (0, _html_utils.toStyle)(this, "position");
77313    const attributes = {
77314      style,
77315      id: this[_symbol_utils.$uid],
77316      class: ["xfaArea"]
77317    };
77318    if ((0, _html_utils.isPrintOnly)(this)) {
77319      attributes.class.push("xfaPrintOnly");
77320    }
77321    if (this.name) {
77322      attributes.xfaName = this.name;
77323    }
77324    const children = [];
77325    this[_symbol_utils.$extra] = {
77326      children,
77327      width: 0,
77328      height: 0,
77329      availableSpace
77330    };
77331    const result = this[_symbol_utils.$childrenToHTML]({
77332      filter: new Set(["area", "draw", "field", "exclGroup", "subform", "subformSet"]),
77333      include: true
77334    });
77335    if (!result.success) {
77336      if (result.isBreak()) {
77337        return result;
77338      }
77339      delete this[_symbol_utils.$extra];
77340      return _utils.HTMLResult.FAILURE;
77341    }
77342    style.width = (0, _html_utils.measureToString)(this[_symbol_utils.$extra].width);
77343    style.height = (0, _html_utils.measureToString)(this[_symbol_utils.$extra].height);
77344    const html = {
77345      name: "div",
77346      attributes,
77347      children
77348    };
77349    const bbox = [this.x, this.y, this[_symbol_utils.$extra].width, this[_symbol_utils.$extra].height];
77350    delete this[_symbol_utils.$extra];
77351    return _utils.HTMLResult.success(html, bbox);
77352  }
77353}
77354class Assist extends _xfa_object.XFAObject {
77355  constructor(attributes) {
77356    super(TEMPLATE_NS_ID, "assist", true);
77357    this.id = attributes.id || "";
77358    this.role = attributes.role || "";
77359    this.use = attributes.use || "";
77360    this.usehref = attributes.usehref || "";
77361    this.speak = null;
77362    this.toolTip = null;
77363  }
77364  [_symbol_utils.$toHTML]() {
77365    return this.toolTip?.[_symbol_utils.$content] || null;
77366  }
77367}
77368class Barcode extends _xfa_object.XFAObject {
77369  constructor(attributes) {
77370    super(TEMPLATE_NS_ID, "barcode", true);
77371    this.charEncoding = (0, _utils.getKeyword)({
77372      data: attributes.charEncoding ? attributes.charEncoding.toLowerCase() : "",
77373      defaultValue: "",
77374      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}/)
77375    });
77376    this.checksum = (0, _utils.getStringOption)(attributes.checksum, ["none", "1mod10", "1mod10_1mod11", "2mod10", "auto"]);
77377    this.dataColumnCount = (0, _utils.getInteger)({
77378      data: attributes.dataColumnCount,
77379      defaultValue: -1,
77380      validate: x => x >= 0
77381    });
77382    this.dataLength = (0, _utils.getInteger)({
77383      data: attributes.dataLength,
77384      defaultValue: -1,
77385      validate: x => x >= 0
77386    });
77387    this.dataPrep = (0, _utils.getStringOption)(attributes.dataPrep, ["none", "flateCompress"]);
77388    this.dataRowCount = (0, _utils.getInteger)({
77389      data: attributes.dataRowCount,
77390      defaultValue: -1,
77391      validate: x => x >= 0
77392    });
77393    this.endChar = attributes.endChar || "";
77394    this.errorCorrectionLevel = (0, _utils.getInteger)({
77395      data: attributes.errorCorrectionLevel,
77396      defaultValue: -1,
77397      validate: x => x >= 0 && x <= 8
77398    });
77399    this.id = attributes.id || "";
77400    this.moduleHeight = (0, _utils.getMeasurement)(attributes.moduleHeight, "5mm");
77401    this.moduleWidth = (0, _utils.getMeasurement)(attributes.moduleWidth, "0.25mm");
77402    this.printCheckDigit = (0, _utils.getInteger)({
77403      data: attributes.printCheckDigit,
77404      defaultValue: 0,
77405      validate: x => x === 1
77406    });
77407    this.rowColumnRatio = (0, _utils.getRatio)(attributes.rowColumnRatio);
77408    this.startChar = attributes.startChar || "";
77409    this.textLocation = (0, _utils.getStringOption)(attributes.textLocation, ["below", "above", "aboveEmbedded", "belowEmbedded", "none"]);
77410    this.truncate = (0, _utils.getInteger)({
77411      data: attributes.truncate,
77412      defaultValue: 0,
77413      validate: x => x === 1
77414    });
77415    this.type = (0, _utils.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"]);
77416    this.upsMode = (0, _utils.getStringOption)(attributes.upsMode, ["usCarrier", "internationalCarrier", "secureSymbol", "standardSymbol"]);
77417    this.use = attributes.use || "";
77418    this.usehref = attributes.usehref || "";
77419    this.wideNarrowRatio = (0, _utils.getRatio)(attributes.wideNarrowRatio);
77420    this.encrypt = null;
77421    this.extras = null;
77422  }
77423}
77424class Bind extends _xfa_object.XFAObject {
77425  constructor(attributes) {
77426    super(TEMPLATE_NS_ID, "bind", true);
77427    this.match = (0, _utils.getStringOption)(attributes.match, ["once", "dataRef", "global", "none"]);
77428    this.ref = attributes.ref || "";
77429    this.picture = null;
77430  }
77431}
77432class BindItems extends _xfa_object.XFAObject {
77433  constructor(attributes) {
77434    super(TEMPLATE_NS_ID, "bindItems");
77435    this.connection = attributes.connection || "";
77436    this.labelRef = attributes.labelRef || "";
77437    this.ref = attributes.ref || "";
77438    this.valueRef = attributes.valueRef || "";
77439  }
77440}
77441exports.BindItems = BindItems;
77442class Bookend extends _xfa_object.XFAObject {
77443  constructor(attributes) {
77444    super(TEMPLATE_NS_ID, "bookend");
77445    this.id = attributes.id || "";
77446    this.leader = attributes.leader || "";
77447    this.trailer = attributes.trailer || "";
77448    this.use = attributes.use || "";
77449    this.usehref = attributes.usehref || "";
77450  }
77451}
77452class BooleanElement extends _xfa_object.Option01 {
77453  constructor(attributes) {
77454    super(TEMPLATE_NS_ID, "boolean");
77455    this.id = attributes.id || "";
77456    this.name = attributes.name || "";
77457    this.use = attributes.use || "";
77458    this.usehref = attributes.usehref || "";
77459  }
77460  [_symbol_utils.$toHTML](availableSpace) {
77461    return valueToHtml(this[_symbol_utils.$content] === 1 ? "1" : "0");
77462  }
77463}
77464class Border extends _xfa_object.XFAObject {
77465  constructor(attributes) {
77466    super(TEMPLATE_NS_ID, "border", true);
77467    this.break = (0, _utils.getStringOption)(attributes.break, ["close", "open"]);
77468    this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
77469    this.id = attributes.id || "";
77470    this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
77471    this.relevant = (0, _utils.getRelevant)(attributes.relevant);
77472    this.use = attributes.use || "";
77473    this.usehref = attributes.usehref || "";
77474    this.corner = new _xfa_object.XFAObjectArray(4);
77475    this.edge = new _xfa_object.XFAObjectArray(4);
77476    this.extras = null;
77477    this.fill = null;
77478    this.margin = null;
77479  }
77480  [_symbol_utils.$getExtra]() {
77481    if (!this[_symbol_utils.$extra]) {
77482      const edges = this.edge.children.slice();
77483      if (edges.length < 4) {
77484        const defaultEdge = edges.at(-1) || new Edge({});
77485        for (let i = edges.length; i < 4; i++) {
77486          edges.push(defaultEdge);
77487        }
77488      }
77489      const widths = edges.map(edge => edge.thickness);
77490      const insets = [0, 0, 0, 0];
77491      if (this.margin) {
77492        insets[0] = this.margin.topInset;
77493        insets[1] = this.margin.rightInset;
77494        insets[2] = this.margin.bottomInset;
77495        insets[3] = this.margin.leftInset;
77496      }
77497      this[_symbol_utils.$extra] = {
77498        widths,
77499        insets,
77500        edges
77501      };
77502    }
77503    return this[_symbol_utils.$extra];
77504  }
77505  [_symbol_utils.$toStyle]() {
77506    const {
77507      edges
77508    } = this[_symbol_utils.$getExtra]();
77509    const edgeStyles = edges.map(node => {
77510      const style = node[_symbol_utils.$toStyle]();
77511      style.color ||= "#000000";
77512      return style;
77513    });
77514    const style = Object.create(null);
77515    if (this.margin) {
77516      Object.assign(style, this.margin[_symbol_utils.$toStyle]());
77517    }
77518    if (this.fill?.presence === "visible") {
77519      Object.assign(style, this.fill[_symbol_utils.$toStyle]());
77520    }
77521    if (this.corner.children.some(node => node.radius !== 0)) {
77522      const cornerStyles = this.corner.children.map(node => node[_symbol_utils.$toStyle]());
77523      if (cornerStyles.length === 2 || cornerStyles.length === 3) {
77524        const last = cornerStyles.at(-1);
77525        for (let i = cornerStyles.length; i < 4; i++) {
77526          cornerStyles.push(last);
77527        }
77528      }
77529      style.borderRadius = cornerStyles.map(s => s.radius).join(" ");
77530    }
77531    switch (this.presence) {
77532      case "invisible":
77533      case "hidden":
77534        style.borderStyle = "";
77535        break;
77536      case "inactive":
77537        style.borderStyle = "none";
77538        break;
77539      default:
77540        style.borderStyle = edgeStyles.map(s => s.style).join(" ");
77541        break;
77542    }
77543    style.borderWidth = edgeStyles.map(s => s.width).join(" ");
77544    style.borderColor = edgeStyles.map(s => s.color).join(" ");
77545    return style;
77546  }
77547}
77548class Break extends _xfa_object.XFAObject {
77549  constructor(attributes) {
77550    super(TEMPLATE_NS_ID, "break", true);
77551    this.after = (0, _utils.getStringOption)(attributes.after, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]);
77552    this.afterTarget = attributes.afterTarget || "";
77553    this.before = (0, _utils.getStringOption)(attributes.before, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]);
77554    this.beforeTarget = attributes.beforeTarget || "";
77555    this.bookendLeader = attributes.bookendLeader || "";
77556    this.bookendTrailer = attributes.bookendTrailer || "";
77557    this.id = attributes.id || "";
77558    this.overflowLeader = attributes.overflowLeader || "";
77559    this.overflowTarget = attributes.overflowTarget || "";
77560    this.overflowTrailer = attributes.overflowTrailer || "";
77561    this.startNew = (0, _utils.getInteger)({
77562      data: attributes.startNew,
77563      defaultValue: 0,
77564      validate: x => x === 1
77565    });
77566    this.use = attributes.use || "";
77567    this.usehref = attributes.usehref || "";
77568    this.extras = null;
77569  }
77570}
77571class BreakAfter extends _xfa_object.XFAObject {
77572  constructor(attributes) {
77573    super(TEMPLATE_NS_ID, "breakAfter", true);
77574    this.id = attributes.id || "";
77575    this.leader = attributes.leader || "";
77576    this.startNew = (0, _utils.getInteger)({
77577      data: attributes.startNew,
77578      defaultValue: 0,
77579      validate: x => x === 1
77580    });
77581    this.target = attributes.target || "";
77582    this.targetType = (0, _utils.getStringOption)(attributes.targetType, ["auto", "contentArea", "pageArea"]);
77583    this.trailer = attributes.trailer || "";
77584    this.use = attributes.use || "";
77585    this.usehref = attributes.usehref || "";
77586    this.script = null;
77587  }
77588}
77589class BreakBefore extends _xfa_object.XFAObject {
77590  constructor(attributes) {
77591    super(TEMPLATE_NS_ID, "breakBefore", true);
77592    this.id = attributes.id || "";
77593    this.leader = attributes.leader || "";
77594    this.startNew = (0, _utils.getInteger)({
77595      data: attributes.startNew,
77596      defaultValue: 0,
77597      validate: x => x === 1
77598    });
77599    this.target = attributes.target || "";
77600    this.targetType = (0, _utils.getStringOption)(attributes.targetType, ["auto", "contentArea", "pageArea"]);
77601    this.trailer = attributes.trailer || "";
77602    this.use = attributes.use || "";
77603    this.usehref = attributes.usehref || "";
77604    this.script = null;
77605  }
77606  [_symbol_utils.$toHTML](availableSpace) {
77607    this[_symbol_utils.$extra] = {};
77608    return _utils.HTMLResult.FAILURE;
77609  }
77610}
77611class Button extends _xfa_object.XFAObject {
77612  constructor(attributes) {
77613    super(TEMPLATE_NS_ID, "button", true);
77614    this.highlight = (0, _utils.getStringOption)(attributes.highlight, ["inverted", "none", "outline", "push"]);
77615    this.id = attributes.id || "";
77616    this.use = attributes.use || "";
77617    this.usehref = attributes.usehref || "";
77618    this.extras = null;
77619  }
77620  [_symbol_utils.$toHTML](availableSpace) {
77621    const parent = this[_symbol_utils.$getParent]();
77622    const grandpa = parent[_symbol_utils.$getParent]();
77623    const htmlButton = {
77624      name: "button",
77625      attributes: {
77626        id: this[_symbol_utils.$uid],
77627        class: ["xfaButton"],
77628        style: {}
77629      },
77630      children: []
77631    };
77632    for (const event of grandpa.event.children) {
77633      if (event.activity !== "click" || !event.script) {
77634        continue;
77635      }
77636      const jsURL = (0, _core_utils.recoverJsURL)(event.script[_symbol_utils.$content]);
77637      if (!jsURL) {
77638        continue;
77639      }
77640      const href = (0, _html_utils.fixURL)(jsURL.url);
77641      if (!href) {
77642        continue;
77643      }
77644      htmlButton.children.push({
77645        name: "a",
77646        attributes: {
77647          id: "link" + this[_symbol_utils.$uid],
77648          href,
77649          newWindow: jsURL.newWindow,
77650          class: ["xfaLink"],
77651          style: {}
77652        },
77653        children: []
77654      });
77655    }
77656    return _utils.HTMLResult.success(htmlButton);
77657  }
77658}
77659class Calculate extends _xfa_object.XFAObject {
77660  constructor(attributes) {
77661    super(TEMPLATE_NS_ID, "calculate", true);
77662    this.id = attributes.id || "";
77663    this.override = (0, _utils.getStringOption)(attributes.override, ["disabled", "error", "ignore", "warning"]);
77664    this.use = attributes.use || "";
77665    this.usehref = attributes.usehref || "";
77666    this.extras = null;
77667    this.message = null;
77668    this.script = null;
77669  }
77670}
77671class Caption extends _xfa_object.XFAObject {
77672  constructor(attributes) {
77673    super(TEMPLATE_NS_ID, "caption", true);
77674    this.id = attributes.id || "";
77675    this.placement = (0, _utils.getStringOption)(attributes.placement, ["left", "bottom", "inline", "right", "top"]);
77676    this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
77677    this.reserve = Math.ceil((0, _utils.getMeasurement)(attributes.reserve));
77678    this.use = attributes.use || "";
77679    this.usehref = attributes.usehref || "";
77680    this.extras = null;
77681    this.font = null;
77682    this.margin = null;
77683    this.para = null;
77684    this.value = null;
77685  }
77686  [_symbol_utils.$setValue](value) {
77687    _setValue(this, value);
77688  }
77689  [_symbol_utils.$getExtra](availableSpace) {
77690    if (!this[_symbol_utils.$extra]) {
77691      let {
77692        width,
77693        height
77694      } = availableSpace;
77695      switch (this.placement) {
77696        case "left":
77697        case "right":
77698        case "inline":
77699          width = this.reserve <= 0 ? width : this.reserve;
77700          break;
77701        case "top":
77702        case "bottom":
77703          height = this.reserve <= 0 ? height : this.reserve;
77704          break;
77705      }
77706      this[_symbol_utils.$extra] = (0, _html_utils.layoutNode)(this, {
77707        width,
77708        height
77709      });
77710    }
77711    return this[_symbol_utils.$extra];
77712  }
77713  [_symbol_utils.$toHTML](availableSpace) {
77714    if (!this.value) {
77715      return _utils.HTMLResult.EMPTY;
77716    }
77717    this[_symbol_utils.$pushPara]();
77718    const value = this.value[_symbol_utils.$toHTML](availableSpace).html;
77719    if (!value) {
77720      this[_symbol_utils.$popPara]();
77721      return _utils.HTMLResult.EMPTY;
77722    }
77723    const savedReserve = this.reserve;
77724    if (this.reserve <= 0) {
77725      const {
77726        w,
77727        h
77728      } = this[_symbol_utils.$getExtra](availableSpace);
77729      switch (this.placement) {
77730        case "left":
77731        case "right":
77732        case "inline":
77733          this.reserve = w;
77734          break;
77735        case "top":
77736        case "bottom":
77737          this.reserve = h;
77738          break;
77739      }
77740    }
77741    const children = [];
77742    if (typeof value === "string") {
77743      children.push({
77744        name: "#text",
77745        value
77746      });
77747    } else {
77748      children.push(value);
77749    }
77750    const style = (0, _html_utils.toStyle)(this, "font", "margin", "visibility");
77751    switch (this.placement) {
77752      case "left":
77753      case "right":
77754        if (this.reserve > 0) {
77755          style.width = (0, _html_utils.measureToString)(this.reserve);
77756        }
77757        break;
77758      case "top":
77759      case "bottom":
77760        if (this.reserve > 0) {
77761          style.height = (0, _html_utils.measureToString)(this.reserve);
77762        }
77763        break;
77764    }
77765    (0, _html_utils.setPara)(this, null, value);
77766    this[_symbol_utils.$popPara]();
77767    this.reserve = savedReserve;
77768    return _utils.HTMLResult.success({
77769      name: "div",
77770      attributes: {
77771        style,
77772        class: ["xfaCaption"]
77773      },
77774      children
77775    });
77776  }
77777}
77778class Certificate extends _xfa_object.StringObject {
77779  constructor(attributes) {
77780    super(TEMPLATE_NS_ID, "certificate");
77781    this.id = attributes.id || "";
77782    this.name = attributes.name || "";
77783    this.use = attributes.use || "";
77784    this.usehref = attributes.usehref || "";
77785  }
77786}
77787class Certificates extends _xfa_object.XFAObject {
77788  constructor(attributes) {
77789    super(TEMPLATE_NS_ID, "certificates", true);
77790    this.credentialServerPolicy = (0, _utils.getStringOption)(attributes.credentialServerPolicy, ["optional", "required"]);
77791    this.id = attributes.id || "";
77792    this.url = attributes.url || "";
77793    this.urlPolicy = attributes.urlPolicy || "";
77794    this.use = attributes.use || "";
77795    this.usehref = attributes.usehref || "";
77796    this.encryption = null;
77797    this.issuers = null;
77798    this.keyUsage = null;
77799    this.oids = null;
77800    this.signing = null;
77801    this.subjectDNs = null;
77802  }
77803}
77804class CheckButton extends _xfa_object.XFAObject {
77805  constructor(attributes) {
77806    super(TEMPLATE_NS_ID, "checkButton", true);
77807    this.id = attributes.id || "";
77808    this.mark = (0, _utils.getStringOption)(attributes.mark, ["default", "check", "circle", "cross", "diamond", "square", "star"]);
77809    this.shape = (0, _utils.getStringOption)(attributes.shape, ["square", "round"]);
77810    this.size = (0, _utils.getMeasurement)(attributes.size, "10pt");
77811    this.use = attributes.use || "";
77812    this.usehref = attributes.usehref || "";
77813    this.border = null;
77814    this.extras = null;
77815    this.margin = null;
77816  }
77817  [_symbol_utils.$toHTML](availableSpace) {
77818    const style = (0, _html_utils.toStyle)("margin");
77819    const size = (0, _html_utils.measureToString)(this.size);
77820    style.width = style.height = size;
77821    let type;
77822    let className;
77823    let groupId;
77824    const field = this[_symbol_utils.$getParent]()[_symbol_utils.$getParent]();
77825    const items = field.items.children.length && field.items.children[0][_symbol_utils.$toHTML]().html || [];
77826    const exportedValue = {
77827      on: (items[0] !== undefined ? items[0] : "on").toString(),
77828      off: (items[1] !== undefined ? items[1] : "off").toString()
77829    };
77830    const value = field.value?.[_symbol_utils.$text]() || "off";
77831    const checked = value === exportedValue.on || undefined;
77832    const container = field[_symbol_utils.$getSubformParent]();
77833    const fieldId = field[_symbol_utils.$uid];
77834    let dataId;
77835    if (container instanceof ExclGroup) {
77836      groupId = container[_symbol_utils.$uid];
77837      type = "radio";
77838      className = "xfaRadio";
77839      dataId = container[_symbol_utils.$data]?.[_symbol_utils.$uid] || container[_symbol_utils.$uid];
77840    } else {
77841      type = "checkbox";
77842      className = "xfaCheckbox";
77843      dataId = field[_symbol_utils.$data]?.[_symbol_utils.$uid] || field[_symbol_utils.$uid];
77844    }
77845    const input = {
77846      name: "input",
77847      attributes: {
77848        class: [className],
77849        style,
77850        fieldId,
77851        dataId,
77852        type,
77853        checked,
77854        xfaOn: exportedValue.on,
77855        xfaOff: exportedValue.off,
77856        "aria-label": ariaLabel(field),
77857        "aria-required": false
77858      }
77859    };
77860    if (groupId) {
77861      input.attributes.name = groupId;
77862    }
77863    if (isRequired(field)) {
77864      input.attributes["aria-required"] = true;
77865      input.attributes.required = true;
77866    }
77867    return _utils.HTMLResult.success({
77868      name: "label",
77869      attributes: {
77870        class: ["xfaLabel"]
77871      },
77872      children: [input]
77873    });
77874  }
77875}
77876class ChoiceList extends _xfa_object.XFAObject {
77877  constructor(attributes) {
77878    super(TEMPLATE_NS_ID, "choiceList", true);
77879    this.commitOn = (0, _utils.getStringOption)(attributes.commitOn, ["select", "exit"]);
77880    this.id = attributes.id || "";
77881    this.open = (0, _utils.getStringOption)(attributes.open, ["userControl", "always", "multiSelect", "onEntry"]);
77882    this.textEntry = (0, _utils.getInteger)({
77883      data: attributes.textEntry,
77884      defaultValue: 0,
77885      validate: x => x === 1
77886    });
77887    this.use = attributes.use || "";
77888    this.usehref = attributes.usehref || "";
77889    this.border = null;
77890    this.extras = null;
77891    this.margin = null;
77892  }
77893  [_symbol_utils.$toHTML](availableSpace) {
77894    const style = (0, _html_utils.toStyle)(this, "border", "margin");
77895    const ui = this[_symbol_utils.$getParent]();
77896    const field = ui[_symbol_utils.$getParent]();
77897    const fontSize = field.font?.size || 10;
77898    const optionStyle = {
77899      fontSize: `calc(${fontSize}px * var(--scale-factor))`
77900    };
77901    const children = [];
77902    if (field.items.children.length > 0) {
77903      const items = field.items;
77904      let displayedIndex = 0;
77905      let saveIndex = 0;
77906      if (items.children.length === 2) {
77907        displayedIndex = items.children[0].save;
77908        saveIndex = 1 - displayedIndex;
77909      }
77910      const displayed = items.children[displayedIndex][_symbol_utils.$toHTML]().html;
77911      const values = items.children[saveIndex][_symbol_utils.$toHTML]().html;
77912      let selected = false;
77913      const value = field.value?.[_symbol_utils.$text]() || "";
77914      for (let i = 0, ii = displayed.length; i < ii; i++) {
77915        const option = {
77916          name: "option",
77917          attributes: {
77918            value: values[i] || displayed[i],
77919            style: optionStyle
77920          },
77921          value: displayed[i]
77922        };
77923        if (values[i] === value) {
77924          option.attributes.selected = selected = true;
77925        }
77926        children.push(option);
77927      }
77928      if (!selected) {
77929        children.splice(0, 0, {
77930          name: "option",
77931          attributes: {
77932            hidden: true,
77933            selected: true
77934          },
77935          value: " "
77936        });
77937      }
77938    }
77939    const selectAttributes = {
77940      class: ["xfaSelect"],
77941      fieldId: field[_symbol_utils.$uid],
77942      dataId: field[_symbol_utils.$data]?.[_symbol_utils.$uid] || field[_symbol_utils.$uid],
77943      style,
77944      "aria-label": ariaLabel(field),
77945      "aria-required": false
77946    };
77947    if (isRequired(field)) {
77948      selectAttributes["aria-required"] = true;
77949      selectAttributes.required = true;
77950    }
77951    if (this.open === "multiSelect") {
77952      selectAttributes.multiple = true;
77953    }
77954    return _utils.HTMLResult.success({
77955      name: "label",
77956      attributes: {
77957        class: ["xfaLabel"]
77958      },
77959      children: [{
77960        name: "select",
77961        children,
77962        attributes: selectAttributes
77963      }]
77964    });
77965  }
77966}
77967class Color extends _xfa_object.XFAObject {
77968  constructor(attributes) {
77969    super(TEMPLATE_NS_ID, "color", true);
77970    this.cSpace = (0, _utils.getStringOption)(attributes.cSpace, ["SRGB"]);
77971    this.id = attributes.id || "";
77972    this.use = attributes.use || "";
77973    this.usehref = attributes.usehref || "";
77974    this.value = attributes.value ? (0, _utils.getColor)(attributes.value) : "";
77975    this.extras = null;
77976  }
77977  [_symbol_utils.$hasSettableValue]() {
77978    return false;
77979  }
77980  [_symbol_utils.$toStyle]() {
77981    return this.value ? _util.Util.makeHexColor(this.value.r, this.value.g, this.value.b) : null;
77982  }
77983}
77984class Comb extends _xfa_object.XFAObject {
77985  constructor(attributes) {
77986    super(TEMPLATE_NS_ID, "comb");
77987    this.id = attributes.id || "";
77988    this.numberOfCells = (0, _utils.getInteger)({
77989      data: attributes.numberOfCells,
77990      defaultValue: 0,
77991      validate: x => x >= 0
77992    });
77993    this.use = attributes.use || "";
77994    this.usehref = attributes.usehref || "";
77995  }
77996}
77997class Connect extends _xfa_object.XFAObject {
77998  constructor(attributes) {
77999    super(TEMPLATE_NS_ID, "connect", true);
78000    this.connection = attributes.connection || "";
78001    this.id = attributes.id || "";
78002    this.ref = attributes.ref || "";
78003    this.usage = (0, _utils.getStringOption)(attributes.usage, ["exportAndImport", "exportOnly", "importOnly"]);
78004    this.use = attributes.use || "";
78005    this.usehref = attributes.usehref || "";
78006    this.picture = null;
78007  }
78008}
78009class ContentArea extends _xfa_object.XFAObject {
78010  constructor(attributes) {
78011    super(TEMPLATE_NS_ID, "contentArea", true);
78012    this.h = (0, _utils.getMeasurement)(attributes.h);
78013    this.id = attributes.id || "";
78014    this.name = attributes.name || "";
78015    this.relevant = (0, _utils.getRelevant)(attributes.relevant);
78016    this.use = attributes.use || "";
78017    this.usehref = attributes.usehref || "";
78018    this.w = (0, _utils.getMeasurement)(attributes.w);
78019    this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
78020    this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
78021    this.desc = null;
78022    this.extras = null;
78023  }
78024  [_symbol_utils.$toHTML](availableSpace) {
78025    const left = (0, _html_utils.measureToString)(this.x);
78026    const top = (0, _html_utils.measureToString)(this.y);
78027    const style = {
78028      left,
78029      top,
78030      width: (0, _html_utils.measureToString)(this.w),
78031      height: (0, _html_utils.measureToString)(this.h)
78032    };
78033    const classNames = ["xfaContentarea"];
78034    if ((0, _html_utils.isPrintOnly)(this)) {
78035      classNames.push("xfaPrintOnly");
78036    }
78037    return _utils.HTMLResult.success({
78038      name: "div",
78039      children: [],
78040      attributes: {
78041        style,
78042        class: classNames,
78043        id: this[_symbol_utils.$uid]
78044      }
78045    });
78046  }
78047}
78048class Corner extends _xfa_object.XFAObject {
78049  constructor(attributes) {
78050    super(TEMPLATE_NS_ID, "corner", true);
78051    this.id = attributes.id || "";
78052    this.inverted = (0, _utils.getInteger)({
78053      data: attributes.inverted,
78054      defaultValue: 0,
78055      validate: x => x === 1
78056    });
78057    this.join = (0, _utils.getStringOption)(attributes.join, ["square", "round"]);
78058    this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
78059    this.radius = (0, _utils.getMeasurement)(attributes.radius);
78060    this.stroke = (0, _utils.getStringOption)(attributes.stroke, ["solid", "dashDot", "dashDotDot", "dashed", "dotted", "embossed", "etched", "lowered", "raised"]);
78061    this.thickness = (0, _utils.getMeasurement)(attributes.thickness, "0.5pt");
78062    this.use = attributes.use || "";
78063    this.usehref = attributes.usehref || "";
78064    this.color = null;
78065    this.extras = null;
78066  }
78067  [_symbol_utils.$toStyle]() {
78068    const style = (0, _html_utils.toStyle)(this, "visibility");
78069    style.radius = (0, _html_utils.measureToString)(this.join === "square" ? 0 : this.radius);
78070    return style;
78071  }
78072}
78073class DateElement extends _xfa_object.ContentObject {
78074  constructor(attributes) {
78075    super(TEMPLATE_NS_ID, "date");
78076    this.id = attributes.id || "";
78077    this.name = attributes.name || "";
78078    this.use = attributes.use || "";
78079    this.usehref = attributes.usehref || "";
78080  }
78081  [_symbol_utils.$finalize]() {
78082    const date = this[_symbol_utils.$content].trim();
78083    this[_symbol_utils.$content] = date ? new Date(date) : null;
78084  }
78085  [_symbol_utils.$toHTML](availableSpace) {
78086    return valueToHtml(this[_symbol_utils.$content] ? this[_symbol_utils.$content].toString() : "");
78087  }
78088}
78089class DateTime extends _xfa_object.ContentObject {
78090  constructor(attributes) {
78091    super(TEMPLATE_NS_ID, "dateTime");
78092    this.id = attributes.id || "";
78093    this.name = attributes.name || "";
78094    this.use = attributes.use || "";
78095    this.usehref = attributes.usehref || "";
78096  }
78097  [_symbol_utils.$finalize]() {
78098    const date = this[_symbol_utils.$content].trim();
78099    this[_symbol_utils.$content] = date ? new Date(date) : null;
78100  }
78101  [_symbol_utils.$toHTML](availableSpace) {
78102    return valueToHtml(this[_symbol_utils.$content] ? this[_symbol_utils.$content].toString() : "");
78103  }
78104}
78105class DateTimeEdit extends _xfa_object.XFAObject {
78106  constructor(attributes) {
78107    super(TEMPLATE_NS_ID, "dateTimeEdit", true);
78108    this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
78109    this.id = attributes.id || "";
78110    this.picker = (0, _utils.getStringOption)(attributes.picker, ["host", "none"]);
78111    this.use = attributes.use || "";
78112    this.usehref = attributes.usehref || "";
78113    this.border = null;
78114    this.comb = null;
78115    this.extras = null;
78116    this.margin = null;
78117  }
78118  [_symbol_utils.$toHTML](availableSpace) {
78119    const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
78120    const field = this[_symbol_utils.$getParent]()[_symbol_utils.$getParent]();
78121    const html = {
78122      name: "input",
78123      attributes: {
78124        type: "text",
78125        fieldId: field[_symbol_utils.$uid],
78126        dataId: field[_symbol_utils.$data]?.[_symbol_utils.$uid] || field[_symbol_utils.$uid],
78127        class: ["xfaTextfield"],
78128        style,
78129        "aria-label": ariaLabel(field),
78130        "aria-required": false
78131      }
78132    };
78133    if (isRequired(field)) {
78134      html.attributes["aria-required"] = true;
78135      html.attributes.required = true;
78136    }
78137    return _utils.HTMLResult.success({
78138      name: "label",
78139      attributes: {
78140        class: ["xfaLabel"]
78141      },
78142      children: [html]
78143    });
78144  }
78145}
78146class Decimal extends _xfa_object.ContentObject {
78147  constructor(attributes) {
78148    super(TEMPLATE_NS_ID, "decimal");
78149    this.fracDigits = (0, _utils.getInteger)({
78150      data: attributes.fracDigits,
78151      defaultValue: 2,
78152      validate: x => true
78153    });
78154    this.id = attributes.id || "";
78155    this.leadDigits = (0, _utils.getInteger)({
78156      data: attributes.leadDigits,
78157      defaultValue: -1,
78158      validate: x => true
78159    });
78160    this.name = attributes.name || "";
78161    this.use = attributes.use || "";
78162    this.usehref = attributes.usehref || "";
78163  }
78164  [_symbol_utils.$finalize]() {
78165    const number = parseFloat(this[_symbol_utils.$content].trim());
78166    this[_symbol_utils.$content] = isNaN(number) ? null : number;
78167  }
78168  [_symbol_utils.$toHTML](availableSpace) {
78169    return valueToHtml(this[_symbol_utils.$content] !== null ? this[_symbol_utils.$content].toString() : "");
78170  }
78171}
78172class DefaultUi extends _xfa_object.XFAObject {
78173  constructor(attributes) {
78174    super(TEMPLATE_NS_ID, "defaultUi", true);
78175    this.id = attributes.id || "";
78176    this.use = attributes.use || "";
78177    this.usehref = attributes.usehref || "";
78178    this.extras = null;
78179  }
78180}
78181class Desc extends _xfa_object.XFAObject {
78182  constructor(attributes) {
78183    super(TEMPLATE_NS_ID, "desc", true);
78184    this.id = attributes.id || "";
78185    this.use = attributes.use || "";
78186    this.usehref = attributes.usehref || "";
78187    this.boolean = new _xfa_object.XFAObjectArray();
78188    this.date = new _xfa_object.XFAObjectArray();
78189    this.dateTime = new _xfa_object.XFAObjectArray();
78190    this.decimal = new _xfa_object.XFAObjectArray();
78191    this.exData = new _xfa_object.XFAObjectArray();
78192    this.float = new _xfa_object.XFAObjectArray();
78193    this.image = new _xfa_object.XFAObjectArray();
78194    this.integer = new _xfa_object.XFAObjectArray();
78195    this.text = new _xfa_object.XFAObjectArray();
78196    this.time = new _xfa_object.XFAObjectArray();
78197  }
78198}
78199class DigestMethod extends _xfa_object.OptionObject {
78200  constructor(attributes) {
78201    super(TEMPLATE_NS_ID, "digestMethod", ["", "SHA1", "SHA256", "SHA512", "RIPEMD160"]);
78202    this.id = attributes.id || "";
78203    this.use = attributes.use || "";
78204    this.usehref = attributes.usehref || "";
78205  }
78206}
78207class DigestMethods extends _xfa_object.XFAObject {
78208  constructor(attributes) {
78209    super(TEMPLATE_NS_ID, "digestMethods", true);
78210    this.id = attributes.id || "";
78211    this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
78212    this.use = attributes.use || "";
78213    this.usehref = attributes.usehref || "";
78214    this.digestMethod = new _xfa_object.XFAObjectArray();
78215  }
78216}
78217class Draw extends _xfa_object.XFAObject {
78218  constructor(attributes) {
78219    super(TEMPLATE_NS_ID, "draw", true);
78220    this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
78221    this.colSpan = (0, _utils.getInteger)({
78222      data: attributes.colSpan,
78223      defaultValue: 1,
78224      validate: n => n >= 1 || n === -1
78225    });
78226    this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
78227    this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
78228    this.id = attributes.id || "";
78229    this.locale = attributes.locale || "";
78230    this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
78231    this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
78232    this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
78233    this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
78234    this.name = attributes.name || "";
78235    this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
78236    this.relevant = (0, _utils.getRelevant)(attributes.relevant);
78237    this.rotate = (0, _utils.getInteger)({
78238      data: attributes.rotate,
78239      defaultValue: 0,
78240      validate: x => x % 90 === 0
78241    });
78242    this.use = attributes.use || "";
78243    this.usehref = attributes.usehref || "";
78244    this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
78245    this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
78246    this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
78247    this.assist = null;
78248    this.border = null;
78249    this.caption = null;
78250    this.desc = null;
78251    this.extras = null;
78252    this.font = null;
78253    this.keep = null;
78254    this.margin = null;
78255    this.para = null;
78256    this.traversal = null;
78257    this.ui = null;
78258    this.value = null;
78259    this.setProperty = new _xfa_object.XFAObjectArray();
78260  }
78261  [_symbol_utils.$setValue](value) {
78262    _setValue(this, value);
78263  }
78264  [_symbol_utils.$toHTML](availableSpace) {
78265    setTabIndex(this);
78266    if (this.presence === "hidden" || this.presence === "inactive") {
78267      return _utils.HTMLResult.EMPTY;
78268    }
78269    (0, _html_utils.fixDimensions)(this);
78270    this[_symbol_utils.$pushPara]();
78271    const savedW = this.w;
78272    const savedH = this.h;
78273    const {
78274      w,
78275      h,
78276      isBroken
78277    } = (0, _html_utils.layoutNode)(this, availableSpace);
78278    if (w && this.w === "") {
78279      if (isBroken && this[_symbol_utils.$getSubformParent]()[_symbol_utils.$isThereMoreWidth]()) {
78280        this[_symbol_utils.$popPara]();
78281        return _utils.HTMLResult.FAILURE;
78282      }
78283      this.w = w;
78284    }
78285    if (h && this.h === "") {
78286      this.h = h;
78287    }
78288    setFirstUnsplittable(this);
78289    if (!(0, _layout.checkDimensions)(this, availableSpace)) {
78290      this.w = savedW;
78291      this.h = savedH;
78292      this[_symbol_utils.$popPara]();
78293      return _utils.HTMLResult.FAILURE;
78294    }
78295    unsetFirstUnsplittable(this);
78296    const style = (0, _html_utils.toStyle)(this, "font", "hAlign", "dimensions", "position", "presence", "rotate", "anchorType", "border", "margin");
78297    (0, _html_utils.setMinMaxDimensions)(this, style);
78298    if (style.margin) {
78299      style.padding = style.margin;
78300      delete style.margin;
78301    }
78302    const classNames = ["xfaDraw"];
78303    if (this.font) {
78304      classNames.push("xfaFont");
78305    }
78306    if ((0, _html_utils.isPrintOnly)(this)) {
78307      classNames.push("xfaPrintOnly");
78308    }
78309    const attributes = {
78310      style,
78311      id: this[_symbol_utils.$uid],
78312      class: classNames
78313    };
78314    if (this.name) {
78315      attributes.xfaName = this.name;
78316    }
78317    const html = {
78318      name: "div",
78319      attributes,
78320      children: []
78321    };
78322    applyAssist(this, attributes);
78323    const bbox = (0, _html_utils.computeBbox)(this, html, availableSpace);
78324    const value = this.value ? this.value[_symbol_utils.$toHTML](availableSpace).html : null;
78325    if (value === null) {
78326      this.w = savedW;
78327      this.h = savedH;
78328      this[_symbol_utils.$popPara]();
78329      return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
78330    }
78331    html.children.push(value);
78332    (0, _html_utils.setPara)(this, style, value);
78333    this.w = savedW;
78334    this.h = savedH;
78335    this[_symbol_utils.$popPara]();
78336    return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
78337  }
78338}
78339class Edge extends _xfa_object.XFAObject {
78340  constructor(attributes) {
78341    super(TEMPLATE_NS_ID, "edge", true);
78342    this.cap = (0, _utils.getStringOption)(attributes.cap, ["square", "butt", "round"]);
78343    this.id = attributes.id || "";
78344    this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
78345    this.stroke = (0, _utils.getStringOption)(attributes.stroke, ["solid", "dashDot", "dashDotDot", "dashed", "dotted", "embossed", "etched", "lowered", "raised"]);
78346    this.thickness = (0, _utils.getMeasurement)(attributes.thickness, "0.5pt");
78347    this.use = attributes.use || "";
78348    this.usehref = attributes.usehref || "";
78349    this.color = null;
78350    this.extras = null;
78351  }
78352  [_symbol_utils.$toStyle]() {
78353    const style = (0, _html_utils.toStyle)(this, "visibility");
78354    Object.assign(style, {
78355      linecap: this.cap,
78356      width: (0, _html_utils.measureToString)(this.thickness),
78357      color: this.color ? this.color[_symbol_utils.$toStyle]() : "#000000",
78358      style: ""
78359    });
78360    if (this.presence !== "visible") {
78361      style.style = "none";
78362    } else {
78363      switch (this.stroke) {
78364        case "solid":
78365          style.style = "solid";
78366          break;
78367        case "dashDot":
78368          style.style = "dashed";
78369          break;
78370        case "dashDotDot":
78371          style.style = "dashed";
78372          break;
78373        case "dashed":
78374          style.style = "dashed";
78375          break;
78376        case "dotted":
78377          style.style = "dotted";
78378          break;
78379        case "embossed":
78380          style.style = "ridge";
78381          break;
78382        case "etched":
78383          style.style = "groove";
78384          break;
78385        case "lowered":
78386          style.style = "inset";
78387          break;
78388        case "raised":
78389          style.style = "outset";
78390          break;
78391      }
78392    }
78393    return style;
78394  }
78395}
78396class Encoding extends _xfa_object.OptionObject {
78397  constructor(attributes) {
78398    super(TEMPLATE_NS_ID, "encoding", ["adbe.x509.rsa_sha1", "adbe.pkcs7.detached", "adbe.pkcs7.sha1"]);
78399    this.id = attributes.id || "";
78400    this.use = attributes.use || "";
78401    this.usehref = attributes.usehref || "";
78402  }
78403}
78404class Encodings extends _xfa_object.XFAObject {
78405  constructor(attributes) {
78406    super(TEMPLATE_NS_ID, "encodings", true);
78407    this.id = attributes.id || "";
78408    this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
78409    this.use = attributes.use || "";
78410    this.usehref = attributes.usehref || "";
78411    this.encoding = new _xfa_object.XFAObjectArray();
78412  }
78413}
78414class Encrypt extends _xfa_object.XFAObject {
78415  constructor(attributes) {
78416    super(TEMPLATE_NS_ID, "encrypt", true);
78417    this.id = attributes.id || "";
78418    this.use = attributes.use || "";
78419    this.usehref = attributes.usehref || "";
78420    this.certificate = null;
78421  }
78422}
78423class EncryptData extends _xfa_object.XFAObject {
78424  constructor(attributes) {
78425    super(TEMPLATE_NS_ID, "encryptData", true);
78426    this.id = attributes.id || "";
78427    this.operation = (0, _utils.getStringOption)(attributes.operation, ["encrypt", "decrypt"]);
78428    this.target = attributes.target || "";
78429    this.use = attributes.use || "";
78430    this.usehref = attributes.usehref || "";
78431    this.filter = null;
78432    this.manifest = null;
78433  }
78434}
78435class Encryption extends _xfa_object.XFAObject {
78436  constructor(attributes) {
78437    super(TEMPLATE_NS_ID, "encryption", true);
78438    this.id = attributes.id || "";
78439    this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
78440    this.use = attributes.use || "";
78441    this.usehref = attributes.usehref || "";
78442    this.certificate = new _xfa_object.XFAObjectArray();
78443  }
78444}
78445class EncryptionMethod extends _xfa_object.OptionObject {
78446  constructor(attributes) {
78447    super(TEMPLATE_NS_ID, "encryptionMethod", ["", "AES256-CBC", "TRIPLEDES-CBC", "AES128-CBC", "AES192-CBC"]);
78448    this.id = attributes.id || "";
78449    this.use = attributes.use || "";
78450    this.usehref = attributes.usehref || "";
78451  }
78452}
78453class EncryptionMethods extends _xfa_object.XFAObject {
78454  constructor(attributes) {
78455    super(TEMPLATE_NS_ID, "encryptionMethods", true);
78456    this.id = attributes.id || "";
78457    this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
78458    this.use = attributes.use || "";
78459    this.usehref = attributes.usehref || "";
78460    this.encryptionMethod = new _xfa_object.XFAObjectArray();
78461  }
78462}
78463class Event extends _xfa_object.XFAObject {
78464  constructor(attributes) {
78465    super(TEMPLATE_NS_ID, "event", true);
78466    this.activity = (0, _utils.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"]);
78467    this.id = attributes.id || "";
78468    this.listen = (0, _utils.getStringOption)(attributes.listen, ["refOnly", "refAndDescendents"]);
78469    this.name = attributes.name || "";
78470    this.ref = attributes.ref || "";
78471    this.use = attributes.use || "";
78472    this.usehref = attributes.usehref || "";
78473    this.extras = null;
78474    this.encryptData = null;
78475    this.execute = null;
78476    this.script = null;
78477    this.signData = null;
78478    this.submit = null;
78479  }
78480}
78481class ExData extends _xfa_object.ContentObject {
78482  constructor(attributes) {
78483    super(TEMPLATE_NS_ID, "exData");
78484    this.contentType = attributes.contentType || "";
78485    this.href = attributes.href || "";
78486    this.id = attributes.id || "";
78487    this.maxLength = (0, _utils.getInteger)({
78488      data: attributes.maxLength,
78489      defaultValue: -1,
78490      validate: x => x >= -1
78491    });
78492    this.name = attributes.name || "";
78493    this.rid = attributes.rid || "";
78494    this.transferEncoding = (0, _utils.getStringOption)(attributes.transferEncoding, ["none", "base64", "package"]);
78495    this.use = attributes.use || "";
78496    this.usehref = attributes.usehref || "";
78497  }
78498  [_symbol_utils.$isCDATAXml]() {
78499    return this.contentType === "text/html";
78500  }
78501  [_symbol_utils.$onChild](child) {
78502    if (this.contentType === "text/html" && child[_symbol_utils.$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
78503      this[_symbol_utils.$content] = child;
78504      return true;
78505    }
78506    if (this.contentType === "text/xml") {
78507      this[_symbol_utils.$content] = child;
78508      return true;
78509    }
78510    return false;
78511  }
78512  [_symbol_utils.$toHTML](availableSpace) {
78513    if (this.contentType !== "text/html" || !this[_symbol_utils.$content]) {
78514      return _utils.HTMLResult.EMPTY;
78515    }
78516    return this[_symbol_utils.$content][_symbol_utils.$toHTML](availableSpace);
78517  }
78518}
78519class ExObject extends _xfa_object.XFAObject {
78520  constructor(attributes) {
78521    super(TEMPLATE_NS_ID, "exObject", true);
78522    this.archive = attributes.archive || "";
78523    this.classId = attributes.classId || "";
78524    this.codeBase = attributes.codeBase || "";
78525    this.codeType = attributes.codeType || "";
78526    this.id = attributes.id || "";
78527    this.name = attributes.name || "";
78528    this.use = attributes.use || "";
78529    this.usehref = attributes.usehref || "";
78530    this.extras = null;
78531    this.boolean = new _xfa_object.XFAObjectArray();
78532    this.date = new _xfa_object.XFAObjectArray();
78533    this.dateTime = new _xfa_object.XFAObjectArray();
78534    this.decimal = new _xfa_object.XFAObjectArray();
78535    this.exData = new _xfa_object.XFAObjectArray();
78536    this.exObject = new _xfa_object.XFAObjectArray();
78537    this.float = new _xfa_object.XFAObjectArray();
78538    this.image = new _xfa_object.XFAObjectArray();
78539    this.integer = new _xfa_object.XFAObjectArray();
78540    this.text = new _xfa_object.XFAObjectArray();
78541    this.time = new _xfa_object.XFAObjectArray();
78542  }
78543}
78544class ExclGroup extends _xfa_object.XFAObject {
78545  constructor(attributes) {
78546    super(TEMPLATE_NS_ID, "exclGroup", true);
78547    this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
78548    this.accessKey = attributes.accessKey || "";
78549    this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
78550    this.colSpan = (0, _utils.getInteger)({
78551      data: attributes.colSpan,
78552      defaultValue: 1,
78553      validate: n => n >= 1 || n === -1
78554    });
78555    this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
78556    this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
78557    this.id = attributes.id || "";
78558    this.layout = (0, _utils.getStringOption)(attributes.layout, ["position", "lr-tb", "rl-row", "rl-tb", "row", "table", "tb"]);
78559    this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
78560    this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
78561    this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
78562    this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
78563    this.name = attributes.name || "";
78564    this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
78565    this.relevant = (0, _utils.getRelevant)(attributes.relevant);
78566    this.use = attributes.use || "";
78567    this.usehref = attributes.usehref || "";
78568    this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
78569    this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
78570    this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
78571    this.assist = null;
78572    this.bind = null;
78573    this.border = null;
78574    this.calculate = null;
78575    this.caption = null;
78576    this.desc = null;
78577    this.extras = null;
78578    this.margin = null;
78579    this.para = null;
78580    this.traversal = null;
78581    this.validate = null;
78582    this.connect = new _xfa_object.XFAObjectArray();
78583    this.event = new _xfa_object.XFAObjectArray();
78584    this.field = new _xfa_object.XFAObjectArray();
78585    this.setProperty = new _xfa_object.XFAObjectArray();
78586  }
78587  [_symbol_utils.$isBindable]() {
78588    return true;
78589  }
78590  [_symbol_utils.$hasSettableValue]() {
78591    return true;
78592  }
78593  [_symbol_utils.$setValue](value) {
78594    for (const field of this.field.children) {
78595      if (!field.value) {
78596        const nodeValue = new Value({});
78597        field[_symbol_utils.$appendChild](nodeValue);
78598        field.value = nodeValue;
78599      }
78600      field.value[_symbol_utils.$setValue](value);
78601    }
78602  }
78603  [_symbol_utils.$isThereMoreWidth]() {
78604    return this.layout.endsWith("-tb") && this[_symbol_utils.$extra].attempt === 0 && this[_symbol_utils.$extra].numberInLine > 0 || this[_symbol_utils.$getParent]()[_symbol_utils.$isThereMoreWidth]();
78605  }
78606  [_symbol_utils.$isSplittable]() {
78607    const parent = this[_symbol_utils.$getSubformParent]();
78608    if (!parent[_symbol_utils.$isSplittable]()) {
78609      return false;
78610    }
78611    if (this[_symbol_utils.$extra]._isSplittable !== undefined) {
78612      return this[_symbol_utils.$extra]._isSplittable;
78613    }
78614    if (this.layout === "position" || this.layout.includes("row")) {
78615      this[_symbol_utils.$extra]._isSplittable = false;
78616      return false;
78617    }
78618    if (parent.layout?.endsWith("-tb") && parent[_symbol_utils.$extra].numberInLine !== 0) {
78619      return false;
78620    }
78621    this[_symbol_utils.$extra]._isSplittable = true;
78622    return true;
78623  }
78624  [_symbol_utils.$flushHTML]() {
78625    return (0, _layout.flushHTML)(this);
78626  }
78627  [_symbol_utils.$addHTML](html, bbox) {
78628    (0, _layout.addHTML)(this, html, bbox);
78629  }
78630  [_symbol_utils.$getAvailableSpace]() {
78631    return (0, _layout.getAvailableSpace)(this);
78632  }
78633  [_symbol_utils.$toHTML](availableSpace) {
78634    setTabIndex(this);
78635    if (this.presence === "hidden" || this.presence === "inactive" || this.h === 0 || this.w === 0) {
78636      return _utils.HTMLResult.EMPTY;
78637    }
78638    (0, _html_utils.fixDimensions)(this);
78639    const children = [];
78640    const attributes = {
78641      id: this[_symbol_utils.$uid],
78642      class: []
78643    };
78644    (0, _html_utils.setAccess)(this, attributes.class);
78645    if (!this[_symbol_utils.$extra]) {
78646      this[_symbol_utils.$extra] = Object.create(null);
78647    }
78648    Object.assign(this[_symbol_utils.$extra], {
78649      children,
78650      attributes,
78651      attempt: 0,
78652      line: null,
78653      numberInLine: 0,
78654      availableSpace: {
78655        width: Math.min(this.w || Infinity, availableSpace.width),
78656        height: Math.min(this.h || Infinity, availableSpace.height)
78657      },
78658      width: 0,
78659      height: 0,
78660      prevHeight: 0,
78661      currentWidth: 0
78662    });
78663    const isSplittable = this[_symbol_utils.$isSplittable]();
78664    if (!isSplittable) {
78665      setFirstUnsplittable(this);
78666    }
78667    if (!(0, _layout.checkDimensions)(this, availableSpace)) {
78668      return _utils.HTMLResult.FAILURE;
78669    }
78670    const filter = new Set(["field"]);
78671    if (this.layout.includes("row")) {
78672      const columnWidths = this[_symbol_utils.$getSubformParent]().columnWidths;
78673      if (Array.isArray(columnWidths) && columnWidths.length > 0) {
78674        this[_symbol_utils.$extra].columnWidths = columnWidths;
78675        this[_symbol_utils.$extra].currentColumn = 0;
78676      }
78677    }
78678    const style = (0, _html_utils.toStyle)(this, "anchorType", "dimensions", "position", "presence", "border", "margin", "hAlign");
78679    const classNames = ["xfaExclgroup"];
78680    const cl = (0, _html_utils.layoutClass)(this);
78681    if (cl) {
78682      classNames.push(cl);
78683    }
78684    if ((0, _html_utils.isPrintOnly)(this)) {
78685      classNames.push("xfaPrintOnly");
78686    }
78687    attributes.style = style;
78688    attributes.class = classNames;
78689    if (this.name) {
78690      attributes.xfaName = this.name;
78691    }
78692    this[_symbol_utils.$pushPara]();
78693    const isLrTb = this.layout === "lr-tb" || this.layout === "rl-tb";
78694    const maxRun = isLrTb ? MAX_ATTEMPTS_FOR_LRTB_LAYOUT : 1;
78695    for (; this[_symbol_utils.$extra].attempt < maxRun; this[_symbol_utils.$extra].attempt++) {
78696      if (isLrTb && this[_symbol_utils.$extra].attempt === MAX_ATTEMPTS_FOR_LRTB_LAYOUT - 1) {
78697        this[_symbol_utils.$extra].numberInLine = 0;
78698      }
78699      const result = this[_symbol_utils.$childrenToHTML]({
78700        filter,
78701        include: true
78702      });
78703      if (result.success) {
78704        break;
78705      }
78706      if (result.isBreak()) {
78707        this[_symbol_utils.$popPara]();
78708        return result;
78709      }
78710      if (isLrTb && this[_symbol_utils.$extra].attempt === 0 && this[_symbol_utils.$extra].numberInLine === 0 && !this[_symbol_utils.$getTemplateRoot]()[_symbol_utils.$extra].noLayoutFailure) {
78711        this[_symbol_utils.$extra].attempt = maxRun;
78712        break;
78713      }
78714    }
78715    this[_symbol_utils.$popPara]();
78716    if (!isSplittable) {
78717      unsetFirstUnsplittable(this);
78718    }
78719    if (this[_symbol_utils.$extra].attempt === maxRun) {
78720      if (!isSplittable) {
78721        delete this[_symbol_utils.$extra];
78722      }
78723      return _utils.HTMLResult.FAILURE;
78724    }
78725    let marginH = 0;
78726    let marginV = 0;
78727    if (this.margin) {
78728      marginH = this.margin.leftInset + this.margin.rightInset;
78729      marginV = this.margin.topInset + this.margin.bottomInset;
78730    }
78731    const width = Math.max(this[_symbol_utils.$extra].width + marginH, this.w || 0);
78732    const height = Math.max(this[_symbol_utils.$extra].height + marginV, this.h || 0);
78733    const bbox = [this.x, this.y, width, height];
78734    if (this.w === "") {
78735      style.width = (0, _html_utils.measureToString)(width);
78736    }
78737    if (this.h === "") {
78738      style.height = (0, _html_utils.measureToString)(height);
78739    }
78740    const html = {
78741      name: "div",
78742      attributes,
78743      children
78744    };
78745    applyAssist(this, attributes);
78746    delete this[_symbol_utils.$extra];
78747    return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
78748  }
78749}
78750class Execute extends _xfa_object.XFAObject {
78751  constructor(attributes) {
78752    super(TEMPLATE_NS_ID, "execute");
78753    this.connection = attributes.connection || "";
78754    this.executeType = (0, _utils.getStringOption)(attributes.executeType, ["import", "remerge"]);
78755    this.id = attributes.id || "";
78756    this.runAt = (0, _utils.getStringOption)(attributes.runAt, ["client", "both", "server"]);
78757    this.use = attributes.use || "";
78758    this.usehref = attributes.usehref || "";
78759  }
78760}
78761class Extras extends _xfa_object.XFAObject {
78762  constructor(attributes) {
78763    super(TEMPLATE_NS_ID, "extras", true);
78764    this.id = attributes.id || "";
78765    this.name = attributes.name || "";
78766    this.use = attributes.use || "";
78767    this.usehref = attributes.usehref || "";
78768    this.boolean = new _xfa_object.XFAObjectArray();
78769    this.date = new _xfa_object.XFAObjectArray();
78770    this.dateTime = new _xfa_object.XFAObjectArray();
78771    this.decimal = new _xfa_object.XFAObjectArray();
78772    this.exData = new _xfa_object.XFAObjectArray();
78773    this.extras = new _xfa_object.XFAObjectArray();
78774    this.float = new _xfa_object.XFAObjectArray();
78775    this.image = new _xfa_object.XFAObjectArray();
78776    this.integer = new _xfa_object.XFAObjectArray();
78777    this.text = new _xfa_object.XFAObjectArray();
78778    this.time = new _xfa_object.XFAObjectArray();
78779  }
78780}
78781class Field extends _xfa_object.XFAObject {
78782  constructor(attributes) {
78783    super(TEMPLATE_NS_ID, "field", true);
78784    this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
78785    this.accessKey = attributes.accessKey || "";
78786    this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
78787    this.colSpan = (0, _utils.getInteger)({
78788      data: attributes.colSpan,
78789      defaultValue: 1,
78790      validate: n => n >= 1 || n === -1
78791    });
78792    this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
78793    this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
78794    this.id = attributes.id || "";
78795    this.locale = attributes.locale || "";
78796    this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
78797    this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
78798    this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
78799    this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
78800    this.name = attributes.name || "";
78801    this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
78802    this.relevant = (0, _utils.getRelevant)(attributes.relevant);
78803    this.rotate = (0, _utils.getInteger)({
78804      data: attributes.rotate,
78805      defaultValue: 0,
78806      validate: x => x % 90 === 0
78807    });
78808    this.use = attributes.use || "";
78809    this.usehref = attributes.usehref || "";
78810    this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
78811    this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
78812    this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
78813    this.assist = null;
78814    this.bind = null;
78815    this.border = null;
78816    this.calculate = null;
78817    this.caption = null;
78818    this.desc = null;
78819    this.extras = null;
78820    this.font = null;
78821    this.format = null;
78822    this.items = new _xfa_object.XFAObjectArray(2);
78823    this.keep = null;
78824    this.margin = null;
78825    this.para = null;
78826    this.traversal = null;
78827    this.ui = null;
78828    this.validate = null;
78829    this.value = null;
78830    this.bindItems = new _xfa_object.XFAObjectArray();
78831    this.connect = new _xfa_object.XFAObjectArray();
78832    this.event = new _xfa_object.XFAObjectArray();
78833    this.setProperty = new _xfa_object.XFAObjectArray();
78834  }
78835  [_symbol_utils.$isBindable]() {
78836    return true;
78837  }
78838  [_symbol_utils.$setValue](value) {
78839    _setValue(this, value);
78840  }
78841  [_symbol_utils.$toHTML](availableSpace) {
78842    setTabIndex(this);
78843    if (!this.ui) {
78844      this.ui = new Ui({});
78845      this.ui[_symbol_utils.$globalData] = this[_symbol_utils.$globalData];
78846      this[_symbol_utils.$appendChild](this.ui);
78847      let node;
78848      switch (this.items.children.length) {
78849        case 0:
78850          node = new TextEdit({});
78851          this.ui.textEdit = node;
78852          break;
78853        case 1:
78854          node = new CheckButton({});
78855          this.ui.checkButton = node;
78856          break;
78857        case 2:
78858          node = new ChoiceList({});
78859          this.ui.choiceList = node;
78860          break;
78861      }
78862      this.ui[_symbol_utils.$appendChild](node);
78863    }
78864    if (!this.ui || this.presence === "hidden" || this.presence === "inactive" || this.h === 0 || this.w === 0) {
78865      return _utils.HTMLResult.EMPTY;
78866    }
78867    if (this.caption) {
78868      delete this.caption[_symbol_utils.$extra];
78869    }
78870    this[_symbol_utils.$pushPara]();
78871    const caption = this.caption ? this.caption[_symbol_utils.$toHTML](availableSpace).html : null;
78872    const savedW = this.w;
78873    const savedH = this.h;
78874    let marginH = 0;
78875    let marginV = 0;
78876    if (this.margin) {
78877      marginH = this.margin.leftInset + this.margin.rightInset;
78878      marginV = this.margin.topInset + this.margin.bottomInset;
78879    }
78880    let borderDims = null;
78881    if (this.w === "" || this.h === "") {
78882      let width = null;
78883      let height = null;
78884      let uiW = 0;
78885      let uiH = 0;
78886      if (this.ui.checkButton) {
78887        uiW = uiH = this.ui.checkButton.size;
78888      } else {
78889        const {
78890          w,
78891          h
78892        } = (0, _html_utils.layoutNode)(this, availableSpace);
78893        if (w !== null) {
78894          uiW = w;
78895          uiH = h;
78896        } else {
78897          uiH = (0, _fonts.getMetrics)(this.font, true).lineNoGap;
78898        }
78899      }
78900      borderDims = getBorderDims(this.ui[_symbol_utils.$getExtra]());
78901      uiW += borderDims.w;
78902      uiH += borderDims.h;
78903      if (this.caption) {
78904        const {
78905          w,
78906          h,
78907          isBroken
78908        } = this.caption[_symbol_utils.$getExtra](availableSpace);
78909        if (isBroken && this[_symbol_utils.$getSubformParent]()[_symbol_utils.$isThereMoreWidth]()) {
78910          this[_symbol_utils.$popPara]();
78911          return _utils.HTMLResult.FAILURE;
78912        }
78913        width = w;
78914        height = h;
78915        switch (this.caption.placement) {
78916          case "left":
78917          case "right":
78918          case "inline":
78919            width += uiW;
78920            break;
78921          case "top":
78922          case "bottom":
78923            height += uiH;
78924            break;
78925        }
78926      } else {
78927        width = uiW;
78928        height = uiH;
78929      }
78930      if (width && this.w === "") {
78931        width += marginH;
78932        this.w = Math.min(this.maxW <= 0 ? Infinity : this.maxW, this.minW + 1 < width ? width : this.minW);
78933      }
78934      if (height && this.h === "") {
78935        height += marginV;
78936        this.h = Math.min(this.maxH <= 0 ? Infinity : this.maxH, this.minH + 1 < height ? height : this.minH);
78937      }
78938    }
78939    this[_symbol_utils.$popPara]();
78940    (0, _html_utils.fixDimensions)(this);
78941    setFirstUnsplittable(this);
78942    if (!(0, _layout.checkDimensions)(this, availableSpace)) {
78943      this.w = savedW;
78944      this.h = savedH;
78945      this[_symbol_utils.$popPara]();
78946      return _utils.HTMLResult.FAILURE;
78947    }
78948    unsetFirstUnsplittable(this);
78949    const style = (0, _html_utils.toStyle)(this, "font", "dimensions", "position", "rotate", "anchorType", "presence", "margin", "hAlign");
78950    (0, _html_utils.setMinMaxDimensions)(this, style);
78951    const classNames = ["xfaField"];
78952    if (this.font) {
78953      classNames.push("xfaFont");
78954    }
78955    if ((0, _html_utils.isPrintOnly)(this)) {
78956      classNames.push("xfaPrintOnly");
78957    }
78958    const attributes = {
78959      style,
78960      id: this[_symbol_utils.$uid],
78961      class: classNames
78962    };
78963    if (style.margin) {
78964      style.padding = style.margin;
78965      delete style.margin;
78966    }
78967    (0, _html_utils.setAccess)(this, classNames);
78968    if (this.name) {
78969      attributes.xfaName = this.name;
78970    }
78971    const children = [];
78972    const html = {
78973      name: "div",
78974      attributes,
78975      children
78976    };
78977    applyAssist(this, attributes);
78978    const borderStyle = this.border ? this.border[_symbol_utils.$toStyle]() : null;
78979    const bbox = (0, _html_utils.computeBbox)(this, html, availableSpace);
78980    const ui = this.ui[_symbol_utils.$toHTML]().html;
78981    if (!ui) {
78982      Object.assign(style, borderStyle);
78983      return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
78984    }
78985    if (this[_symbol_utils.$tabIndex]) {
78986      if (ui.children?.[0]) {
78987        ui.children[0].attributes.tabindex = this[_symbol_utils.$tabIndex];
78988      } else {
78989        ui.attributes.tabindex = this[_symbol_utils.$tabIndex];
78990      }
78991    }
78992    if (!ui.attributes.style) {
78993      ui.attributes.style = Object.create(null);
78994    }
78995    let aElement = null;
78996    if (this.ui.button) {
78997      if (ui.children.length === 1) {
78998        [aElement] = ui.children.splice(0, 1);
78999      }
79000      Object.assign(ui.attributes.style, borderStyle);
79001    } else {
79002      Object.assign(style, borderStyle);
79003    }
79004    children.push(ui);
79005    if (this.value) {
79006      if (this.ui.imageEdit) {
79007        ui.children.push(this.value[_symbol_utils.$toHTML]().html);
79008      } else if (!this.ui.button) {
79009        let value = "";
79010        if (this.value.exData) {
79011          value = this.value.exData[_symbol_utils.$text]();
79012        } else if (this.value.text) {
79013          value = this.value.text[_symbol_utils.$getExtra]();
79014        } else {
79015          const htmlValue = this.value[_symbol_utils.$toHTML]().html;
79016          if (htmlValue !== null) {
79017            value = htmlValue.children[0].value;
79018          }
79019        }
79020        if (this.ui.textEdit && this.value.text?.maxChars) {
79021          ui.children[0].attributes.maxLength = this.value.text.maxChars;
79022        }
79023        if (value) {
79024          if (this.ui.numericEdit) {
79025            value = parseFloat(value);
79026            value = isNaN(value) ? "" : value.toString();
79027          }
79028          if (ui.children[0].name === "textarea") {
79029            ui.children[0].attributes.textContent = value;
79030          } else {
79031            ui.children[0].attributes.value = value;
79032          }
79033        }
79034      }
79035    }
79036    if (!this.ui.imageEdit && ui.children?.[0] && this.h) {
79037      borderDims = borderDims || getBorderDims(this.ui[_symbol_utils.$getExtra]());
79038      let captionHeight = 0;
79039      if (this.caption && ["top", "bottom"].includes(this.caption.placement)) {
79040        captionHeight = this.caption.reserve;
79041        if (captionHeight <= 0) {
79042          captionHeight = this.caption[_symbol_utils.$getExtra](availableSpace).h;
79043        }
79044        const inputHeight = this.h - captionHeight - marginV - borderDims.h;
79045        ui.children[0].attributes.style.height = (0, _html_utils.measureToString)(inputHeight);
79046      } else {
79047        ui.children[0].attributes.style.height = "100%";
79048      }
79049    }
79050    if (aElement) {
79051      ui.children.push(aElement);
79052    }
79053    if (!caption) {
79054      if (ui.attributes.class) {
79055        ui.attributes.class.push("xfaLeft");
79056      }
79057      this.w = savedW;
79058      this.h = savedH;
79059      return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
79060    }
79061    if (this.ui.button) {
79062      if (style.padding) {
79063        delete style.padding;
79064      }
79065      if (caption.name === "div") {
79066        caption.name = "span";
79067      }
79068      ui.children.push(caption);
79069      return _utils.HTMLResult.success(html, bbox);
79070    } else if (this.ui.checkButton) {
79071      caption.attributes.class[0] = "xfaCaptionForCheckButton";
79072    }
79073    if (!ui.attributes.class) {
79074      ui.attributes.class = [];
79075    }
79076    ui.children.splice(0, 0, caption);
79077    switch (this.caption.placement) {
79078      case "left":
79079        ui.attributes.class.push("xfaLeft");
79080        break;
79081      case "right":
79082        ui.attributes.class.push("xfaRight");
79083        break;
79084      case "top":
79085        ui.attributes.class.push("xfaTop");
79086        break;
79087      case "bottom":
79088        ui.attributes.class.push("xfaBottom");
79089        break;
79090      case "inline":
79091        ui.attributes.class.push("xfaLeft");
79092        break;
79093    }
79094    this.w = savedW;
79095    this.h = savedH;
79096    return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
79097  }
79098}
79099exports.Field = Field;
79100class Fill extends _xfa_object.XFAObject {
79101  constructor(attributes) {
79102    super(TEMPLATE_NS_ID, "fill", true);
79103    this.id = attributes.id || "";
79104    this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
79105    this.use = attributes.use || "";
79106    this.usehref = attributes.usehref || "";
79107    this.color = null;
79108    this.extras = null;
79109    this.linear = null;
79110    this.pattern = null;
79111    this.radial = null;
79112    this.solid = null;
79113    this.stipple = null;
79114  }
79115  [_symbol_utils.$toStyle]() {
79116    const parent = this[_symbol_utils.$getParent]();
79117    const grandpa = parent[_symbol_utils.$getParent]();
79118    const ggrandpa = grandpa[_symbol_utils.$getParent]();
79119    const style = Object.create(null);
79120    let propName = "color";
79121    let altPropName = propName;
79122    if (parent instanceof Border) {
79123      propName = "background-color";
79124      altPropName = "background";
79125      if (ggrandpa instanceof Ui) {
79126        style.backgroundColor = "white";
79127      }
79128    }
79129    if (parent instanceof Rectangle || parent instanceof Arc) {
79130      propName = altPropName = "fill";
79131      style.fill = "white";
79132    }
79133    for (const name of Object.getOwnPropertyNames(this)) {
79134      if (name === "extras" || name === "color") {
79135        continue;
79136      }
79137      const obj = this[name];
79138      if (!(obj instanceof _xfa_object.XFAObject)) {
79139        continue;
79140      }
79141      const color = obj[_symbol_utils.$toStyle](this.color);
79142      if (color) {
79143        style[color.startsWith("#") ? propName : altPropName] = color;
79144      }
79145      return style;
79146    }
79147    if (this.color?.value) {
79148      const color = this.color[_symbol_utils.$toStyle]();
79149      style[color.startsWith("#") ? propName : altPropName] = color;
79150    }
79151    return style;
79152  }
79153}
79154class Filter extends _xfa_object.XFAObject {
79155  constructor(attributes) {
79156    super(TEMPLATE_NS_ID, "filter", true);
79157    this.addRevocationInfo = (0, _utils.getStringOption)(attributes.addRevocationInfo, ["", "required", "optional", "none"]);
79158    this.id = attributes.id || "";
79159    this.name = attributes.name || "";
79160    this.use = attributes.use || "";
79161    this.usehref = attributes.usehref || "";
79162    this.version = (0, _utils.getInteger)({
79163      data: this.version,
79164      defaultValue: 5,
79165      validate: x => x >= 1 && x <= 5
79166    });
79167    this.appearanceFilter = null;
79168    this.certificates = null;
79169    this.digestMethods = null;
79170    this.encodings = null;
79171    this.encryptionMethods = null;
79172    this.handler = null;
79173    this.lockDocument = null;
79174    this.mdp = null;
79175    this.reasons = null;
79176    this.timeStamp = null;
79177  }
79178}
79179class Float extends _xfa_object.ContentObject {
79180  constructor(attributes) {
79181    super(TEMPLATE_NS_ID, "float");
79182    this.id = attributes.id || "";
79183    this.name = attributes.name || "";
79184    this.use = attributes.use || "";
79185    this.usehref = attributes.usehref || "";
79186  }
79187  [_symbol_utils.$finalize]() {
79188    const number = parseFloat(this[_symbol_utils.$content].trim());
79189    this[_symbol_utils.$content] = isNaN(number) ? null : number;
79190  }
79191  [_symbol_utils.$toHTML](availableSpace) {
79192    return valueToHtml(this[_symbol_utils.$content] !== null ? this[_symbol_utils.$content].toString() : "");
79193  }
79194}
79195class Font extends _xfa_object.XFAObject {
79196  constructor(attributes) {
79197    super(TEMPLATE_NS_ID, "font", true);
79198    this.baselineShift = (0, _utils.getMeasurement)(attributes.baselineShift);
79199    this.fontHorizontalScale = (0, _utils.getFloat)({
79200      data: attributes.fontHorizontalScale,
79201      defaultValue: 100,
79202      validate: x => x >= 0
79203    });
79204    this.fontVerticalScale = (0, _utils.getFloat)({
79205      data: attributes.fontVerticalScale,
79206      defaultValue: 100,
79207      validate: x => x >= 0
79208    });
79209    this.id = attributes.id || "";
79210    this.kerningMode = (0, _utils.getStringOption)(attributes.kerningMode, ["none", "pair"]);
79211    this.letterSpacing = (0, _utils.getMeasurement)(attributes.letterSpacing, "0");
79212    this.lineThrough = (0, _utils.getInteger)({
79213      data: attributes.lineThrough,
79214      defaultValue: 0,
79215      validate: x => x === 1 || x === 2
79216    });
79217    this.lineThroughPeriod = (0, _utils.getStringOption)(attributes.lineThroughPeriod, ["all", "word"]);
79218    this.overline = (0, _utils.getInteger)({
79219      data: attributes.overline,
79220      defaultValue: 0,
79221      validate: x => x === 1 || x === 2
79222    });
79223    this.overlinePeriod = (0, _utils.getStringOption)(attributes.overlinePeriod, ["all", "word"]);
79224    this.posture = (0, _utils.getStringOption)(attributes.posture, ["normal", "italic"]);
79225    this.size = (0, _utils.getMeasurement)(attributes.size, "10pt");
79226    this.typeface = attributes.typeface || "Courier";
79227    this.underline = (0, _utils.getInteger)({
79228      data: attributes.underline,
79229      defaultValue: 0,
79230      validate: x => x === 1 || x === 2
79231    });
79232    this.underlinePeriod = (0, _utils.getStringOption)(attributes.underlinePeriod, ["all", "word"]);
79233    this.use = attributes.use || "";
79234    this.usehref = attributes.usehref || "";
79235    this.weight = (0, _utils.getStringOption)(attributes.weight, ["normal", "bold"]);
79236    this.extras = null;
79237    this.fill = null;
79238  }
79239  [_symbol_utils.$clean](builder) {
79240    super[_symbol_utils.$clean](builder);
79241    this[_symbol_utils.$globalData].usedTypefaces.add(this.typeface);
79242  }
79243  [_symbol_utils.$toStyle]() {
79244    const style = (0, _html_utils.toStyle)(this, "fill");
79245    const color = style.color;
79246    if (color) {
79247      if (color === "#000000") {
79248        delete style.color;
79249      } else if (!color.startsWith("#")) {
79250        style.background = color;
79251        style.backgroundClip = "text";
79252        style.color = "transparent";
79253      }
79254    }
79255    if (this.baselineShift) {
79256      style.verticalAlign = (0, _html_utils.measureToString)(this.baselineShift);
79257    }
79258    style.fontKerning = this.kerningMode === "none" ? "none" : "normal";
79259    style.letterSpacing = (0, _html_utils.measureToString)(this.letterSpacing);
79260    if (this.lineThrough !== 0) {
79261      style.textDecoration = "line-through";
79262      if (this.lineThrough === 2) {
79263        style.textDecorationStyle = "double";
79264      }
79265    }
79266    if (this.overline !== 0) {
79267      style.textDecoration = "overline";
79268      if (this.overline === 2) {
79269        style.textDecorationStyle = "double";
79270      }
79271    }
79272    style.fontStyle = this.posture;
79273    style.fontSize = (0, _html_utils.measureToString)(0.99 * this.size);
79274    (0, _html_utils.setFontFamily)(this, this, this[_symbol_utils.$globalData].fontFinder, style);
79275    if (this.underline !== 0) {
79276      style.textDecoration = "underline";
79277      if (this.underline === 2) {
79278        style.textDecorationStyle = "double";
79279      }
79280    }
79281    style.fontWeight = this.weight;
79282    return style;
79283  }
79284}
79285class Format extends _xfa_object.XFAObject {
79286  constructor(attributes) {
79287    super(TEMPLATE_NS_ID, "format", true);
79288    this.id = attributes.id || "";
79289    this.use = attributes.use || "";
79290    this.usehref = attributes.usehref || "";
79291    this.extras = null;
79292    this.picture = null;
79293  }
79294}
79295class Handler extends _xfa_object.StringObject {
79296  constructor(attributes) {
79297    super(TEMPLATE_NS_ID, "handler");
79298    this.id = attributes.id || "";
79299    this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
79300    this.use = attributes.use || "";
79301    this.usehref = attributes.usehref || "";
79302  }
79303}
79304class Hyphenation extends _xfa_object.XFAObject {
79305  constructor(attributes) {
79306    super(TEMPLATE_NS_ID, "hyphenation");
79307    this.excludeAllCaps = (0, _utils.getInteger)({
79308      data: attributes.excludeAllCaps,
79309      defaultValue: 0,
79310      validate: x => x === 1
79311    });
79312    this.excludeInitialCap = (0, _utils.getInteger)({
79313      data: attributes.excludeInitialCap,
79314      defaultValue: 0,
79315      validate: x => x === 1
79316    });
79317    this.hyphenate = (0, _utils.getInteger)({
79318      data: attributes.hyphenate,
79319      defaultValue: 0,
79320      validate: x => x === 1
79321    });
79322    this.id = attributes.id || "";
79323    this.pushCharacterCount = (0, _utils.getInteger)({
79324      data: attributes.pushCharacterCount,
79325      defaultValue: 3,
79326      validate: x => x >= 0
79327    });
79328    this.remainCharacterCount = (0, _utils.getInteger)({
79329      data: attributes.remainCharacterCount,
79330      defaultValue: 3,
79331      validate: x => x >= 0
79332    });
79333    this.use = attributes.use || "";
79334    this.usehref = attributes.usehref || "";
79335    this.wordCharacterCount = (0, _utils.getInteger)({
79336      data: attributes.wordCharacterCount,
79337      defaultValue: 7,
79338      validate: x => x >= 0
79339    });
79340  }
79341}
79342class Image extends _xfa_object.StringObject {
79343  constructor(attributes) {
79344    super(TEMPLATE_NS_ID, "image");
79345    this.aspect = (0, _utils.getStringOption)(attributes.aspect, ["fit", "actual", "height", "none", "width"]);
79346    this.contentType = attributes.contentType || "";
79347    this.href = attributes.href || "";
79348    this.id = attributes.id || "";
79349    this.name = attributes.name || "";
79350    this.transferEncoding = (0, _utils.getStringOption)(attributes.transferEncoding, ["base64", "none", "package"]);
79351    this.use = attributes.use || "";
79352    this.usehref = attributes.usehref || "";
79353  }
79354  [_symbol_utils.$toHTML]() {
79355    if (this.contentType && !MIMES.has(this.contentType.toLowerCase())) {
79356      return _utils.HTMLResult.EMPTY;
79357    }
79358    let buffer = this[_symbol_utils.$globalData].images && this[_symbol_utils.$globalData].images.get(this.href);
79359    if (!buffer && (this.href || !this[_symbol_utils.$content])) {
79360      return _utils.HTMLResult.EMPTY;
79361    }
79362    if (!buffer && this.transferEncoding === "base64") {
79363      buffer = (0, _util.stringToBytes)(atob(this[_symbol_utils.$content]));
79364    }
79365    if (!buffer) {
79366      return _utils.HTMLResult.EMPTY;
79367    }
79368    if (!this.contentType) {
79369      for (const [header, type] of IMAGES_HEADERS) {
79370        if (buffer.length > header.length && header.every((x, i) => x === buffer[i])) {
79371          this.contentType = type;
79372          break;
79373        }
79374      }
79375      if (!this.contentType) {
79376        return _utils.HTMLResult.EMPTY;
79377      }
79378    }
79379    const blob = new Blob([buffer], {
79380      type: this.contentType
79381    });
79382    let style;
79383    switch (this.aspect) {
79384      case "fit":
79385      case "actual":
79386        break;
79387      case "height":
79388        style = {
79389          height: "100%",
79390          objectFit: "fill"
79391        };
79392        break;
79393      case "none":
79394        style = {
79395          width: "100%",
79396          height: "100%",
79397          objectFit: "fill"
79398        };
79399        break;
79400      case "width":
79401        style = {
79402          width: "100%",
79403          objectFit: "fill"
79404        };
79405        break;
79406    }
79407    const parent = this[_symbol_utils.$getParent]();
79408    return _utils.HTMLResult.success({
79409      name: "img",
79410      attributes: {
79411        class: ["xfaImage"],
79412        style,
79413        src: URL.createObjectURL(blob),
79414        alt: parent ? ariaLabel(parent[_symbol_utils.$getParent]()) : null
79415      }
79416    });
79417  }
79418}
79419class ImageEdit extends _xfa_object.XFAObject {
79420  constructor(attributes) {
79421    super(TEMPLATE_NS_ID, "imageEdit", true);
79422    this.data = (0, _utils.getStringOption)(attributes.data, ["link", "embed"]);
79423    this.id = attributes.id || "";
79424    this.use = attributes.use || "";
79425    this.usehref = attributes.usehref || "";
79426    this.border = null;
79427    this.extras = null;
79428    this.margin = null;
79429  }
79430  [_symbol_utils.$toHTML](availableSpace) {
79431    if (this.data === "embed") {
79432      return _utils.HTMLResult.success({
79433        name: "div",
79434        children: [],
79435        attributes: {}
79436      });
79437    }
79438    return _utils.HTMLResult.EMPTY;
79439  }
79440}
79441class Integer extends _xfa_object.ContentObject {
79442  constructor(attributes) {
79443    super(TEMPLATE_NS_ID, "integer");
79444    this.id = attributes.id || "";
79445    this.name = attributes.name || "";
79446    this.use = attributes.use || "";
79447    this.usehref = attributes.usehref || "";
79448  }
79449  [_symbol_utils.$finalize]() {
79450    const number = parseInt(this[_symbol_utils.$content].trim(), 10);
79451    this[_symbol_utils.$content] = isNaN(number) ? null : number;
79452  }
79453  [_symbol_utils.$toHTML](availableSpace) {
79454    return valueToHtml(this[_symbol_utils.$content] !== null ? this[_symbol_utils.$content].toString() : "");
79455  }
79456}
79457class Issuers extends _xfa_object.XFAObject {
79458  constructor(attributes) {
79459    super(TEMPLATE_NS_ID, "issuers", true);
79460    this.id = attributes.id || "";
79461    this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
79462    this.use = attributes.use || "";
79463    this.usehref = attributes.usehref || "";
79464    this.certificate = new _xfa_object.XFAObjectArray();
79465  }
79466}
79467class Items extends _xfa_object.XFAObject {
79468  constructor(attributes) {
79469    super(TEMPLATE_NS_ID, "items", true);
79470    this.id = attributes.id || "";
79471    this.name = attributes.name || "";
79472    this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
79473    this.ref = attributes.ref || "";
79474    this.save = (0, _utils.getInteger)({
79475      data: attributes.save,
79476      defaultValue: 0,
79477      validate: x => x === 1
79478    });
79479    this.use = attributes.use || "";
79480    this.usehref = attributes.usehref || "";
79481    this.boolean = new _xfa_object.XFAObjectArray();
79482    this.date = new _xfa_object.XFAObjectArray();
79483    this.dateTime = new _xfa_object.XFAObjectArray();
79484    this.decimal = new _xfa_object.XFAObjectArray();
79485    this.exData = new _xfa_object.XFAObjectArray();
79486    this.float = new _xfa_object.XFAObjectArray();
79487    this.image = new _xfa_object.XFAObjectArray();
79488    this.integer = new _xfa_object.XFAObjectArray();
79489    this.text = new _xfa_object.XFAObjectArray();
79490    this.time = new _xfa_object.XFAObjectArray();
79491  }
79492  [_symbol_utils.$toHTML]() {
79493    const output = [];
79494    for (const child of this[_symbol_utils.$getChildren]()) {
79495      output.push(child[_symbol_utils.$text]());
79496    }
79497    return _utils.HTMLResult.success(output);
79498  }
79499}
79500exports.Items = Items;
79501class Keep extends _xfa_object.XFAObject {
79502  constructor(attributes) {
79503    super(TEMPLATE_NS_ID, "keep", true);
79504    this.id = attributes.id || "";
79505    const options = ["none", "contentArea", "pageArea"];
79506    this.intact = (0, _utils.getStringOption)(attributes.intact, options);
79507    this.next = (0, _utils.getStringOption)(attributes.next, options);
79508    this.previous = (0, _utils.getStringOption)(attributes.previous, options);
79509    this.use = attributes.use || "";
79510    this.usehref = attributes.usehref || "";
79511    this.extras = null;
79512  }
79513}
79514class KeyUsage extends _xfa_object.XFAObject {
79515  constructor(attributes) {
79516    super(TEMPLATE_NS_ID, "keyUsage");
79517    const options = ["", "yes", "no"];
79518    this.crlSign = (0, _utils.getStringOption)(attributes.crlSign, options);
79519    this.dataEncipherment = (0, _utils.getStringOption)(attributes.dataEncipherment, options);
79520    this.decipherOnly = (0, _utils.getStringOption)(attributes.decipherOnly, options);
79521    this.digitalSignature = (0, _utils.getStringOption)(attributes.digitalSignature, options);
79522    this.encipherOnly = (0, _utils.getStringOption)(attributes.encipherOnly, options);
79523    this.id = attributes.id || "";
79524    this.keyAgreement = (0, _utils.getStringOption)(attributes.keyAgreement, options);
79525    this.keyCertSign = (0, _utils.getStringOption)(attributes.keyCertSign, options);
79526    this.keyEncipherment = (0, _utils.getStringOption)(attributes.keyEncipherment, options);
79527    this.nonRepudiation = (0, _utils.getStringOption)(attributes.nonRepudiation, options);
79528    this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
79529    this.use = attributes.use || "";
79530    this.usehref = attributes.usehref || "";
79531  }
79532}
79533class Line extends _xfa_object.XFAObject {
79534  constructor(attributes) {
79535    super(TEMPLATE_NS_ID, "line", true);
79536    this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
79537    this.id = attributes.id || "";
79538    this.slope = (0, _utils.getStringOption)(attributes.slope, ["\\", "/"]);
79539    this.use = attributes.use || "";
79540    this.usehref = attributes.usehref || "";
79541    this.edge = null;
79542  }
79543  [_symbol_utils.$toHTML]() {
79544    const parent = this[_symbol_utils.$getParent]()[_symbol_utils.$getParent]();
79545    const edge = this.edge || new Edge({});
79546    const edgeStyle = edge[_symbol_utils.$toStyle]();
79547    const style = Object.create(null);
79548    const thickness = edge.presence === "visible" ? edge.thickness : 0;
79549    style.strokeWidth = (0, _html_utils.measureToString)(thickness);
79550    style.stroke = edgeStyle.color;
79551    let x1, y1, x2, y2;
79552    let width = "100%";
79553    let height = "100%";
79554    if (parent.w <= thickness) {
79555      [x1, y1, x2, y2] = ["50%", 0, "50%", "100%"];
79556      width = style.strokeWidth;
79557    } else if (parent.h <= thickness) {
79558      [x1, y1, x2, y2] = [0, "50%", "100%", "50%"];
79559      height = style.strokeWidth;
79560    } else if (this.slope === "\\") {
79561      [x1, y1, x2, y2] = [0, 0, "100%", "100%"];
79562    } else {
79563      [x1, y1, x2, y2] = [0, "100%", "100%", 0];
79564    }
79565    const line = {
79566      name: "line",
79567      attributes: {
79568        xmlns: SVG_NS,
79569        x1,
79570        y1,
79571        x2,
79572        y2,
79573        style
79574      }
79575    };
79576    const svg = {
79577      name: "svg",
79578      children: [line],
79579      attributes: {
79580        xmlns: SVG_NS,
79581        width,
79582        height,
79583        style: {
79584          overflow: "visible"
79585        }
79586      }
79587    };
79588    if (hasMargin(parent)) {
79589      return _utils.HTMLResult.success({
79590        name: "div",
79591        attributes: {
79592          style: {
79593            display: "inline",
79594            width: "100%",
79595            height: "100%"
79596          }
79597        },
79598        children: [svg]
79599      });
79600    }
79601    svg.attributes.style.position = "absolute";
79602    return _utils.HTMLResult.success(svg);
79603  }
79604}
79605class Linear extends _xfa_object.XFAObject {
79606  constructor(attributes) {
79607    super(TEMPLATE_NS_ID, "linear", true);
79608    this.id = attributes.id || "";
79609    this.type = (0, _utils.getStringOption)(attributes.type, ["toRight", "toBottom", "toLeft", "toTop"]);
79610    this.use = attributes.use || "";
79611    this.usehref = attributes.usehref || "";
79612    this.color = null;
79613    this.extras = null;
79614  }
79615  [_symbol_utils.$toStyle](startColor) {
79616    startColor = startColor ? startColor[_symbol_utils.$toStyle]() : "#FFFFFF";
79617    const transf = this.type.replace(/([RBLT])/, " $1").toLowerCase();
79618    const endColor = this.color ? this.color[_symbol_utils.$toStyle]() : "#000000";
79619    return `linear-gradient(${transf}, ${startColor}, ${endColor})`;
79620  }
79621}
79622class LockDocument extends _xfa_object.ContentObject {
79623  constructor(attributes) {
79624    super(TEMPLATE_NS_ID, "lockDocument");
79625    this.id = attributes.id || "";
79626    this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
79627    this.use = attributes.use || "";
79628    this.usehref = attributes.usehref || "";
79629  }
79630  [_symbol_utils.$finalize]() {
79631    this[_symbol_utils.$content] = (0, _utils.getStringOption)(this[_symbol_utils.$content], ["auto", "0", "1"]);
79632  }
79633}
79634class Manifest extends _xfa_object.XFAObject {
79635  constructor(attributes) {
79636    super(TEMPLATE_NS_ID, "manifest", true);
79637    this.action = (0, _utils.getStringOption)(attributes.action, ["include", "all", "exclude"]);
79638    this.id = attributes.id || "";
79639    this.name = attributes.name || "";
79640    this.use = attributes.use || "";
79641    this.usehref = attributes.usehref || "";
79642    this.extras = null;
79643    this.ref = new _xfa_object.XFAObjectArray();
79644  }
79645}
79646class Margin extends _xfa_object.XFAObject {
79647  constructor(attributes) {
79648    super(TEMPLATE_NS_ID, "margin", true);
79649    this.bottomInset = (0, _utils.getMeasurement)(attributes.bottomInset, "0");
79650    this.id = attributes.id || "";
79651    this.leftInset = (0, _utils.getMeasurement)(attributes.leftInset, "0");
79652    this.rightInset = (0, _utils.getMeasurement)(attributes.rightInset, "0");
79653    this.topInset = (0, _utils.getMeasurement)(attributes.topInset, "0");
79654    this.use = attributes.use || "";
79655    this.usehref = attributes.usehref || "";
79656    this.extras = null;
79657  }
79658  [_symbol_utils.$toStyle]() {
79659    return {
79660      margin: (0, _html_utils.measureToString)(this.topInset) + " " + (0, _html_utils.measureToString)(this.rightInset) + " " + (0, _html_utils.measureToString)(this.bottomInset) + " " + (0, _html_utils.measureToString)(this.leftInset)
79661    };
79662  }
79663}
79664class Mdp extends _xfa_object.XFAObject {
79665  constructor(attributes) {
79666    super(TEMPLATE_NS_ID, "mdp");
79667    this.id = attributes.id || "";
79668    this.permissions = (0, _utils.getInteger)({
79669      data: attributes.permissions,
79670      defaultValue: 2,
79671      validate: x => x === 1 || x === 3
79672    });
79673    this.signatureType = (0, _utils.getStringOption)(attributes.signatureType, ["filler", "author"]);
79674    this.use = attributes.use || "";
79675    this.usehref = attributes.usehref || "";
79676  }
79677}
79678class Medium extends _xfa_object.XFAObject {
79679  constructor(attributes) {
79680    super(TEMPLATE_NS_ID, "medium");
79681    this.id = attributes.id || "";
79682    this.imagingBBox = (0, _utils.getBBox)(attributes.imagingBBox);
79683    this.long = (0, _utils.getMeasurement)(attributes.long);
79684    this.orientation = (0, _utils.getStringOption)(attributes.orientation, ["portrait", "landscape"]);
79685    this.short = (0, _utils.getMeasurement)(attributes.short);
79686    this.stock = attributes.stock || "";
79687    this.trayIn = (0, _utils.getStringOption)(attributes.trayIn, ["auto", "delegate", "pageFront"]);
79688    this.trayOut = (0, _utils.getStringOption)(attributes.trayOut, ["auto", "delegate"]);
79689    this.use = attributes.use || "";
79690    this.usehref = attributes.usehref || "";
79691  }
79692}
79693class Message extends _xfa_object.XFAObject {
79694  constructor(attributes) {
79695    super(TEMPLATE_NS_ID, "message", true);
79696    this.id = attributes.id || "";
79697    this.use = attributes.use || "";
79698    this.usehref = attributes.usehref || "";
79699    this.text = new _xfa_object.XFAObjectArray();
79700  }
79701}
79702class NumericEdit extends _xfa_object.XFAObject {
79703  constructor(attributes) {
79704    super(TEMPLATE_NS_ID, "numericEdit", true);
79705    this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
79706    this.id = attributes.id || "";
79707    this.use = attributes.use || "";
79708    this.usehref = attributes.usehref || "";
79709    this.border = null;
79710    this.comb = null;
79711    this.extras = null;
79712    this.margin = null;
79713  }
79714  [_symbol_utils.$toHTML](availableSpace) {
79715    const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
79716    const field = this[_symbol_utils.$getParent]()[_symbol_utils.$getParent]();
79717    const html = {
79718      name: "input",
79719      attributes: {
79720        type: "text",
79721        fieldId: field[_symbol_utils.$uid],
79722        dataId: field[_symbol_utils.$data]?.[_symbol_utils.$uid] || field[_symbol_utils.$uid],
79723        class: ["xfaTextfield"],
79724        style,
79725        "aria-label": ariaLabel(field),
79726        "aria-required": false
79727      }
79728    };
79729    if (isRequired(field)) {
79730      html.attributes["aria-required"] = true;
79731      html.attributes.required = true;
79732    }
79733    return _utils.HTMLResult.success({
79734      name: "label",
79735      attributes: {
79736        class: ["xfaLabel"]
79737      },
79738      children: [html]
79739    });
79740  }
79741}
79742class Occur extends _xfa_object.XFAObject {
79743  constructor(attributes) {
79744    super(TEMPLATE_NS_ID, "occur", true);
79745    this.id = attributes.id || "";
79746    this.initial = attributes.initial !== "" ? (0, _utils.getInteger)({
79747      data: attributes.initial,
79748      defaultValue: "",
79749      validate: x => true
79750    }) : "";
79751    this.max = attributes.max !== "" ? (0, _utils.getInteger)({
79752      data: attributes.max,
79753      defaultValue: 1,
79754      validate: x => true
79755    }) : "";
79756    this.min = attributes.min !== "" ? (0, _utils.getInteger)({
79757      data: attributes.min,
79758      defaultValue: 1,
79759      validate: x => true
79760    }) : "";
79761    this.use = attributes.use || "";
79762    this.usehref = attributes.usehref || "";
79763    this.extras = null;
79764  }
79765  [_symbol_utils.$clean]() {
79766    const parent = this[_symbol_utils.$getParent]();
79767    const originalMin = this.min;
79768    if (this.min === "") {
79769      this.min = parent instanceof PageArea || parent instanceof PageSet ? 0 : 1;
79770    }
79771    if (this.max === "") {
79772      if (originalMin === "") {
79773        this.max = parent instanceof PageArea || parent instanceof PageSet ? -1 : 1;
79774      } else {
79775        this.max = this.min;
79776      }
79777    }
79778    if (this.max !== -1 && this.max < this.min) {
79779      this.max = this.min;
79780    }
79781    if (this.initial === "") {
79782      this.initial = parent instanceof Template ? 1 : this.min;
79783    }
79784  }
79785}
79786class Oid extends _xfa_object.StringObject {
79787  constructor(attributes) {
79788    super(TEMPLATE_NS_ID, "oid");
79789    this.id = attributes.id || "";
79790    this.name = attributes.name || "";
79791    this.use = attributes.use || "";
79792    this.usehref = attributes.usehref || "";
79793  }
79794}
79795class Oids extends _xfa_object.XFAObject {
79796  constructor(attributes) {
79797    super(TEMPLATE_NS_ID, "oids", true);
79798    this.id = attributes.id || "";
79799    this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
79800    this.use = attributes.use || "";
79801    this.usehref = attributes.usehref || "";
79802    this.oid = new _xfa_object.XFAObjectArray();
79803  }
79804}
79805class Overflow extends _xfa_object.XFAObject {
79806  constructor(attributes) {
79807    super(TEMPLATE_NS_ID, "overflow");
79808    this.id = attributes.id || "";
79809    this.leader = attributes.leader || "";
79810    this.target = attributes.target || "";
79811    this.trailer = attributes.trailer || "";
79812    this.use = attributes.use || "";
79813    this.usehref = attributes.usehref || "";
79814  }
79815  [_symbol_utils.$getExtra]() {
79816    if (!this[_symbol_utils.$extra]) {
79817      const parent = this[_symbol_utils.$getParent]();
79818      const root = this[_symbol_utils.$getTemplateRoot]();
79819      const target = root[_symbol_utils.$searchNode](this.target, parent);
79820      const leader = root[_symbol_utils.$searchNode](this.leader, parent);
79821      const trailer = root[_symbol_utils.$searchNode](this.trailer, parent);
79822      this[_symbol_utils.$extra] = {
79823        target: target?.[0] || null,
79824        leader: leader?.[0] || null,
79825        trailer: trailer?.[0] || null,
79826        addLeader: false,
79827        addTrailer: false
79828      };
79829    }
79830    return this[_symbol_utils.$extra];
79831  }
79832}
79833class PageArea extends _xfa_object.XFAObject {
79834  constructor(attributes) {
79835    super(TEMPLATE_NS_ID, "pageArea", true);
79836    this.blankOrNotBlank = (0, _utils.getStringOption)(attributes.blankOrNotBlank, ["any", "blank", "notBlank"]);
79837    this.id = attributes.id || "";
79838    this.initialNumber = (0, _utils.getInteger)({
79839      data: attributes.initialNumber,
79840      defaultValue: 1,
79841      validate: x => true
79842    });
79843    this.name = attributes.name || "";
79844    this.numbered = (0, _utils.getInteger)({
79845      data: attributes.numbered,
79846      defaultValue: 1,
79847      validate: x => true
79848    });
79849    this.oddOrEven = (0, _utils.getStringOption)(attributes.oddOrEven, ["any", "even", "odd"]);
79850    this.pagePosition = (0, _utils.getStringOption)(attributes.pagePosition, ["any", "first", "last", "only", "rest"]);
79851    this.relevant = (0, _utils.getRelevant)(attributes.relevant);
79852    this.use = attributes.use || "";
79853    this.usehref = attributes.usehref || "";
79854    this.desc = null;
79855    this.extras = null;
79856    this.medium = null;
79857    this.occur = null;
79858    this.area = new _xfa_object.XFAObjectArray();
79859    this.contentArea = new _xfa_object.XFAObjectArray();
79860    this.draw = new _xfa_object.XFAObjectArray();
79861    this.exclGroup = new _xfa_object.XFAObjectArray();
79862    this.field = new _xfa_object.XFAObjectArray();
79863    this.subform = new _xfa_object.XFAObjectArray();
79864  }
79865  [_symbol_utils.$isUsable]() {
79866    if (!this[_symbol_utils.$extra]) {
79867      this[_symbol_utils.$extra] = {
79868        numberOfUse: 0
79869      };
79870      return true;
79871    }
79872    return !this.occur || this.occur.max === -1 || this[_symbol_utils.$extra].numberOfUse < this.occur.max;
79873  }
79874  [_symbol_utils.$cleanPage]() {
79875    delete this[_symbol_utils.$extra];
79876  }
79877  [_symbol_utils.$getNextPage]() {
79878    if (!this[_symbol_utils.$extra]) {
79879      this[_symbol_utils.$extra] = {
79880        numberOfUse: 0
79881      };
79882    }
79883    const parent = this[_symbol_utils.$getParent]();
79884    if (parent.relation === "orderedOccurrence") {
79885      if (this[_symbol_utils.$isUsable]()) {
79886        this[_symbol_utils.$extra].numberOfUse += 1;
79887        return this;
79888      }
79889    }
79890    return parent[_symbol_utils.$getNextPage]();
79891  }
79892  [_symbol_utils.$getAvailableSpace]() {
79893    return this[_symbol_utils.$extra].space || {
79894      width: 0,
79895      height: 0
79896    };
79897  }
79898  [_symbol_utils.$toHTML]() {
79899    if (!this[_symbol_utils.$extra]) {
79900      this[_symbol_utils.$extra] = {
79901        numberOfUse: 1
79902      };
79903    }
79904    const children = [];
79905    this[_symbol_utils.$extra].children = children;
79906    const style = Object.create(null);
79907    if (this.medium && this.medium.short && this.medium.long) {
79908      style.width = (0, _html_utils.measureToString)(this.medium.short);
79909      style.height = (0, _html_utils.measureToString)(this.medium.long);
79910      this[_symbol_utils.$extra].space = {
79911        width: this.medium.short,
79912        height: this.medium.long
79913      };
79914      if (this.medium.orientation === "landscape") {
79915        const x = style.width;
79916        style.width = style.height;
79917        style.height = x;
79918        this[_symbol_utils.$extra].space = {
79919          width: this.medium.long,
79920          height: this.medium.short
79921        };
79922      }
79923    } else {
79924      (0, _util.warn)("XFA - No medium specified in pageArea: please file a bug.");
79925    }
79926    this[_symbol_utils.$childrenToHTML]({
79927      filter: new Set(["area", "draw", "field", "subform"]),
79928      include: true
79929    });
79930    this[_symbol_utils.$childrenToHTML]({
79931      filter: new Set(["contentArea"]),
79932      include: true
79933    });
79934    return _utils.HTMLResult.success({
79935      name: "div",
79936      children,
79937      attributes: {
79938        class: ["xfaPage"],
79939        id: this[_symbol_utils.$uid],
79940        style,
79941        xfaName: this.name
79942      }
79943    });
79944  }
79945}
79946class PageSet extends _xfa_object.XFAObject {
79947  constructor(attributes) {
79948    super(TEMPLATE_NS_ID, "pageSet", true);
79949    this.duplexImposition = (0, _utils.getStringOption)(attributes.duplexImposition, ["longEdge", "shortEdge"]);
79950    this.id = attributes.id || "";
79951    this.name = attributes.name || "";
79952    this.relation = (0, _utils.getStringOption)(attributes.relation, ["orderedOccurrence", "duplexPaginated", "simplexPaginated"]);
79953    this.relevant = (0, _utils.getRelevant)(attributes.relevant);
79954    this.use = attributes.use || "";
79955    this.usehref = attributes.usehref || "";
79956    this.extras = null;
79957    this.occur = null;
79958    this.pageArea = new _xfa_object.XFAObjectArray();
79959    this.pageSet = new _xfa_object.XFAObjectArray();
79960  }
79961  [_symbol_utils.$cleanPage]() {
79962    for (const page of this.pageArea.children) {
79963      page[_symbol_utils.$cleanPage]();
79964    }
79965    for (const page of this.pageSet.children) {
79966      page[_symbol_utils.$cleanPage]();
79967    }
79968  }
79969  [_symbol_utils.$isUsable]() {
79970    return !this.occur || this.occur.max === -1 || this[_symbol_utils.$extra].numberOfUse < this.occur.max;
79971  }
79972  [_symbol_utils.$getNextPage]() {
79973    if (!this[_symbol_utils.$extra]) {
79974      this[_symbol_utils.$extra] = {
79975        numberOfUse: 1,
79976        pageIndex: -1,
79977        pageSetIndex: -1
79978      };
79979    }
79980    if (this.relation === "orderedOccurrence") {
79981      if (this[_symbol_utils.$extra].pageIndex + 1 < this.pageArea.children.length) {
79982        this[_symbol_utils.$extra].pageIndex += 1;
79983        const pageArea = this.pageArea.children[this[_symbol_utils.$extra].pageIndex];
79984        return pageArea[_symbol_utils.$getNextPage]();
79985      }
79986      if (this[_symbol_utils.$extra].pageSetIndex + 1 < this.pageSet.children.length) {
79987        this[_symbol_utils.$extra].pageSetIndex += 1;
79988        return this.pageSet.children[this[_symbol_utils.$extra].pageSetIndex][_symbol_utils.$getNextPage]();
79989      }
79990      if (this[_symbol_utils.$isUsable]()) {
79991        this[_symbol_utils.$extra].numberOfUse += 1;
79992        this[_symbol_utils.$extra].pageIndex = -1;
79993        this[_symbol_utils.$extra].pageSetIndex = -1;
79994        return this[_symbol_utils.$getNextPage]();
79995      }
79996      const parent = this[_symbol_utils.$getParent]();
79997      if (parent instanceof PageSet) {
79998        return parent[_symbol_utils.$getNextPage]();
79999      }
80000      this[_symbol_utils.$cleanPage]();
80001      return this[_symbol_utils.$getNextPage]();
80002    }
80003    const pageNumber = this[_symbol_utils.$getTemplateRoot]()[_symbol_utils.$extra].pageNumber;
80004    const parity = pageNumber % 2 === 0 ? "even" : "odd";
80005    const position = pageNumber === 0 ? "first" : "rest";
80006    let page = this.pageArea.children.find(p => p.oddOrEven === parity && p.pagePosition === position);
80007    if (page) {
80008      return page;
80009    }
80010    page = this.pageArea.children.find(p => p.oddOrEven === "any" && p.pagePosition === position);
80011    if (page) {
80012      return page;
80013    }
80014    page = this.pageArea.children.find(p => p.oddOrEven === "any" && p.pagePosition === "any");
80015    if (page) {
80016      return page;
80017    }
80018    return this.pageArea.children[0];
80019  }
80020}
80021class Para extends _xfa_object.XFAObject {
80022  constructor(attributes) {
80023    super(TEMPLATE_NS_ID, "para", true);
80024    this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
80025    this.id = attributes.id || "";
80026    this.lineHeight = attributes.lineHeight ? (0, _utils.getMeasurement)(attributes.lineHeight, "0pt") : "";
80027    this.marginLeft = attributes.marginLeft ? (0, _utils.getMeasurement)(attributes.marginLeft, "0pt") : "";
80028    this.marginRight = attributes.marginRight ? (0, _utils.getMeasurement)(attributes.marginRight, "0pt") : "";
80029    this.orphans = (0, _utils.getInteger)({
80030      data: attributes.orphans,
80031      defaultValue: 0,
80032      validate: x => x >= 0
80033    });
80034    this.preserve = attributes.preserve || "";
80035    this.radixOffset = attributes.radixOffset ? (0, _utils.getMeasurement)(attributes.radixOffset, "0pt") : "";
80036    this.spaceAbove = attributes.spaceAbove ? (0, _utils.getMeasurement)(attributes.spaceAbove, "0pt") : "";
80037    this.spaceBelow = attributes.spaceBelow ? (0, _utils.getMeasurement)(attributes.spaceBelow, "0pt") : "";
80038    this.tabDefault = attributes.tabDefault ? (0, _utils.getMeasurement)(this.tabDefault) : "";
80039    this.tabStops = (attributes.tabStops || "").trim().split(/\s+/).map((x, i) => i % 2 === 1 ? (0, _utils.getMeasurement)(x) : x);
80040    this.textIndent = attributes.textIndent ? (0, _utils.getMeasurement)(attributes.textIndent, "0pt") : "";
80041    this.use = attributes.use || "";
80042    this.usehref = attributes.usehref || "";
80043    this.vAlign = (0, _utils.getStringOption)(attributes.vAlign, ["top", "bottom", "middle"]);
80044    this.widows = (0, _utils.getInteger)({
80045      data: attributes.widows,
80046      defaultValue: 0,
80047      validate: x => x >= 0
80048    });
80049    this.hyphenation = null;
80050  }
80051  [_symbol_utils.$toStyle]() {
80052    const style = (0, _html_utils.toStyle)(this, "hAlign");
80053    if (this.marginLeft !== "") {
80054      style.paddingLeft = (0, _html_utils.measureToString)(this.marginLeft);
80055    }
80056    if (this.marginRight !== "") {
80057      style.paddingight = (0, _html_utils.measureToString)(this.marginRight);
80058    }
80059    if (this.spaceAbove !== "") {
80060      style.paddingTop = (0, _html_utils.measureToString)(this.spaceAbove);
80061    }
80062    if (this.spaceBelow !== "") {
80063      style.paddingBottom = (0, _html_utils.measureToString)(this.spaceBelow);
80064    }
80065    if (this.textIndent !== "") {
80066      style.textIndent = (0, _html_utils.measureToString)(this.textIndent);
80067      (0, _html_utils.fixTextIndent)(style);
80068    }
80069    if (this.lineHeight > 0) {
80070      style.lineHeight = (0, _html_utils.measureToString)(this.lineHeight);
80071    }
80072    if (this.tabDefault !== "") {
80073      style.tabSize = (0, _html_utils.measureToString)(this.tabDefault);
80074    }
80075    if (this.tabStops.length > 0) {}
80076    if (this.hyphenatation) {
80077      Object.assign(style, this.hyphenatation[_symbol_utils.$toStyle]());
80078    }
80079    return style;
80080  }
80081}
80082class PasswordEdit extends _xfa_object.XFAObject {
80083  constructor(attributes) {
80084    super(TEMPLATE_NS_ID, "passwordEdit", true);
80085    this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
80086    this.id = attributes.id || "";
80087    this.passwordChar = attributes.passwordChar || "*";
80088    this.use = attributes.use || "";
80089    this.usehref = attributes.usehref || "";
80090    this.border = null;
80091    this.extras = null;
80092    this.margin = null;
80093  }
80094}
80095class Pattern extends _xfa_object.XFAObject {
80096  constructor(attributes) {
80097    super(TEMPLATE_NS_ID, "pattern", true);
80098    this.id = attributes.id || "";
80099    this.type = (0, _utils.getStringOption)(attributes.type, ["crossHatch", "crossDiagonal", "diagonalLeft", "diagonalRight", "horizontal", "vertical"]);
80100    this.use = attributes.use || "";
80101    this.usehref = attributes.usehref || "";
80102    this.color = null;
80103    this.extras = null;
80104  }
80105  [_symbol_utils.$toStyle](startColor) {
80106    startColor = startColor ? startColor[_symbol_utils.$toStyle]() : "#FFFFFF";
80107    const endColor = this.color ? this.color[_symbol_utils.$toStyle]() : "#000000";
80108    const width = 5;
80109    const cmd = "repeating-linear-gradient";
80110    const colors = `${startColor},${startColor} ${width}px,${endColor} ${width}px,${endColor} ${2 * width}px`;
80111    switch (this.type) {
80112      case "crossHatch":
80113        return `${cmd}
80113(to top,${colors}) ${cmd}(to right,${colors})`;
80114      case "crossDiagonal":
80115        return `${cmd}(45deg,${colors}) ${cmd}(-45deg,${colors})`;
80116      case "diagonalLeft":
80117        return `${cmd}(45deg,${colors})`;
80118      case "diagonalRight":
80119        return `${cmd}(-45deg,${colors})`;
80120      case "horizontal":
80121        return `${cmd}(to top,${colors})`;
80122      case "vertical":
80123        return `${cmd}(to right,${colors})`;
80124    }
80125    return "";
80126  }
80127}
80128class Picture extends _xfa_object.StringObject {
80129  constructor(attributes) {
80130    super(TEMPLATE_NS_ID, "picture");
80131    this.id = attributes.id || "";
80132    this.use = attributes.use || "";
80133    this.usehref = attributes.usehref || "";
80134  }
80135}
80136class Proto extends _xfa_object.XFAObject {
80137  constructor(attributes) {
80138    super(TEMPLATE_NS_ID, "proto", true);
80139    this.appearanceFilter = new _xfa_object.XFAObjectArray();
80140    this.arc = new _xfa_object.XFAObjectArray();
80141    this.area = new _xfa_object.XFAObjectArray();
80142    this.assist = new _xfa_object.XFAObjectArray();
80143    this.barcode = new _xfa_object.XFAObjectArray();
80144    this.bindItems = new _xfa_object.XFAObjectArray();
80145    this.bookend = new _xfa_object.XFAObjectArray();
80146    this.boolean = new _xfa_object.XFAObjectArray();
80147    this.border = new _xfa_object.XFAObjectArray();
80148    this.break = new _xfa_object.XFAObjectArray();
80149    this.breakAfter = new _xfa_object.XFAObjectArray();
80150    this.breakBefore = new _xfa_object.XFAObjectArray();
80151    this.button = new _xfa_object.XFAObjectArray();
80152    this.calculate = new _xfa_object.XFAObjectArray();
80153    this.caption = new _xfa_object.XFAObjectArray();
80154    this.certificate = new _xfa_object.XFAObjectArray();
80155    this.certificates = new _xfa_object.XFAObjectArray();
80156    this.checkButton = new _xfa_object.XFAObjectArray();
80157    this.choiceList = new _xfa_object.XFAObjectArray();
80158    this.color = new _xfa_object.XFAObjectArray();
80159    this.comb = new _xfa_object.XFAObjectArray();
80160    this.connect = new _xfa_object.XFAObjectArray();
80161    this.contentArea = new _xfa_object.XFAObjectArray();
80162    this.corner = new _xfa_object.XFAObjectArray();
80163    this.date = new _xfa_object.XFAObjectArray();
80164    this.dateTime = new _xfa_object.XFAObjectArray();
80165    this.dateTimeEdit = new _xfa_object.XFAObjectArray();
80166    this.decimal = new _xfa_object.XFAObjectArray();
80167    this.defaultUi = new _xfa_object.XFAObjectArray();
80168    this.desc = new _xfa_object.XFAObjectArray();
80169    this.digestMethod = new _xfa_object.XFAObjectArray();
80170    this.digestMethods = new _xfa_object.XFAObjectArray();
80171    this.draw = new _xfa_object.XFAObjectArray();
80172    this.edge = new _xfa_object.XFAObjectArray();
80173    this.encoding = new _xfa_object.XFAObjectArray();
80174    this.encodings = new _xfa_object.XFAObjectArray();
80175    this.encrypt = new _xfa_object.XFAObjectArray();
80176    this.encryptData = new _xfa_object.XFAObjectArray();
80177    this.encryption = new _xfa_object.XFAObjectArray();
80178    this.encryptionMethod = new _xfa_object.XFAObjectArray();
80179    this.encryptionMethods = new _xfa_object.XFAObjectArray();
80180    this.event = new _xfa_object.XFAObjectArray();
80181    this.exData = new _xfa_object.XFAObjectArray();
80182    this.exObject = new _xfa_object.XFAObjectArray();
80183    this.exclGroup = new _xfa_object.XFAObjectArray();
80184    this.execute = new _xfa_object.XFAObjectArray();
80185    this.extras = new _xfa_object.XFAObjectArray();
80186    this.field = new _xfa_object.XFAObjectArray();
80187    this.fill = new _xfa_object.XFAObjectArray();
80188    this.filter = new _xfa_object.XFAObjectArray();
80189    this.float = new _xfa_object.XFAObjectArray();
80190    this.font = new _xfa_object.XFAObjectArray();
80191    this.format = new _xfa_object.XFAObjectArray();
80192    this.handler = new _xfa_object.XFAObjectArray();
80193    this.hyphenation = new _xfa_object.XFAObjectArray();
80194    this.image = new _xfa_object.XFAObjectArray();
80195    this.imageEdit = new _xfa_object.XFAObjectArray();
80196    this.integer = new _xfa_object.XFAObjectArray();
80197    this.issuers = new _xfa_object.XFAObjectArray();
80198    this.items = new _xfa_object.XFAObjectArray();
80199    this.keep = new _xfa_object.XFAObjectArray();
80200    this.keyUsage = new _xfa_object.XFAObjectArray();
80201    this.line = new _xfa_object.XFAObjectArray();
80202    this.linear = new _xfa_object.XFAObjectArray();
80203    this.lockDocument = new _xfa_object.XFAObjectArray();
80204    this.manifest = new _xfa_object.XFAObjectArray();
80205    this.margin = new _xfa_object.XFAObjectArray();
80206    this.mdp = new _xfa_object.XFAObjectArray();
80207    this.medium = new _xfa_object.XFAObjectArray();
80208    this.message = new _xfa_object.XFAObjectArray();
80209    this.numericEdit = new _xfa_object.XFAObjectArray();
80210    this.occur = new _xfa_object.XFAObjectArray();
80211    this.oid = new _xfa_object.XFAObjectArray();
80212    this.oids = new _xfa_object.XFAObjectArray();
80213    this.overflow = new _xfa_object.XFAObjectArray();
80214    this.pageArea = new _xfa_object.XFAObjectArray();
80215    this.pageSet = new _xfa_object.XFAObjectArray();
80216    this.para = new _xfa_object.XFAObjectArray();
80217    this.passwordEdit = new _xfa_object.XFAObjectArray();
80218    this.pattern = new _xfa_object.XFAObjectArray();
80219    this.picture = new _xfa_object.XFAObjectArray();
80220    this.radial = new _xfa_object.XFAObjectArray();
80221    this.reason = new _xfa_object.XFAObjectArray();
80222    this.reasons = new _xfa_object.XFAObjectArray();
80223    this.rectangle = new _xfa_object.XFAObjectArray();
80224    this.ref = new _xfa_object.XFAObjectArray();
80225    this.script = new _xfa_object.XFAObjectArray();
80226    this.setProperty = new _xfa_object.XFAObjectArray();
80227    this.signData = new _xfa_object.XFAObjectArray();
80228    this.signature = new _xfa_object.XFAObjectArray();
80229    this.signing = new _xfa_object.XFAObjectArray();
80230    this.solid = new _xfa_object.XFAObjectArray();
80231    this.speak = new _xfa_object.XFAObjectArray();
80232    this.stipple = new _xfa_object.XFAObjectArray();
80233    this.subform = new _xfa_object.XFAObjectArray();
80234    this.subformSet = new _xfa_object.XFAObjectArray();
80235    this.subjectDN = new _xfa_object.XFAObjectArray();
80236    this.subjectDNs = new _xfa_object.XFAObjectArray();
80237    this.submit = new _xfa_object.XFAObjectArray();
80238    this.text = new _xfa_object.XFAObjectArray();
80239    this.textEdit = new _xfa_object.XFAObjectArray();
80240    this.time = new _xfa_object.XFAObjectArray();
80241    this.timeStamp = new _xfa_object.XFAObjectArray();
80242    this.toolTip = new _xfa_object.XFAObjectArray();
80243    this.traversal = new _xfa_object.XFAObjectArray();
80244    this.traverse = new _xfa_object.XFAObjectArray();
80245    this.ui = new _xfa_object.XFAObjectArray();
80246    this.validate = new _xfa_object.XFAObjectArray();
80247    this.value = new _xfa_object.XFAObjectArray();
80248    this.variables = new _xfa_object.XFAObjectArray();
80249  }
80250}
80251class Radial extends _xfa_object.XFAObject {
80252  constructor(attributes) {
80253    super(TEMPLATE_NS_ID, "radial", true);
80254    this.id = attributes.id || "";
80255    this.type = (0, _utils.getStringOption)(attributes.type, ["toEdge", "toCenter"]);
80256    this.use = attributes.use || "";
80257    this.usehref = attributes.usehref || "";
80258    this.color = null;
80259    this.extras = null;
80260  }
80261  [_symbol_utils.$toStyle](startColor) {
80262    startColor = startColor ? startColor[_symbol_utils.$toStyle]() : "#FFFFFF";
80263    const endColor = this.color ? this.color[_symbol_utils.$toStyle]() : "#000000";
80264    const colors = this.type === "toEdge" ? `${startColor},${endColor}` : `${endColor},${startColor}`;
80265    return `radial-gradient(circle at center, ${colors})`;
80266  }
80267}
80268class Reason extends _xfa_object.StringObject {
80269  constructor(attributes) {
80270    super(TEMPLATE_NS_ID, "reason");
80271    this.id = attributes.id || "";
80272    this.name = attributes.name || "";
80273    this.use = attributes.use || "";
80274    this.usehref = attributes.usehref || "";
80275  }
80276}
80277class Reasons extends _xfa_object.XFAObject {
80278  constructor(attributes) {
80279    super(TEMPLATE_NS_ID, "reasons", true);
80280    this.id = attributes.id || "";
80281    this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
80282    this.use = attributes.use || "";
80283    this.usehref = attributes.usehref || "";
80284    this.reason = new _xfa_object.XFAObjectArray();
80285  }
80286}
80287class Rectangle extends _xfa_object.XFAObject {
80288  constructor(attributes) {
80289    super(TEMPLATE_NS_ID, "rectangle", true);
80290    this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
80291    this.id = attributes.id || "";
80292    this.use = attributes.use || "";
80293    this.usehref = attributes.usehref || "";
80294    this.corner = new _xfa_object.XFAObjectArray(4);
80295    this.edge = new _xfa_object.XFAObjectArray(4);
80296    this.fill = null;
80297  }
80298  [_symbol_utils.$toHTML]() {
80299    const edge = this.edge.children.length ? this.edge.children[0] : new Edge({});
80300    const edgeStyle = edge[_symbol_utils.$toStyle]();
80301    const style = Object.create(null);
80302    if (this.fill?.presence === "visible") {
80303      Object.assign(style, this.fill[_symbol_utils.$toStyle]());
80304    } else {
80305      style.fill = "transparent";
vendor: 83,827 bytes, lines 80306-83099
80306    }
80307    style.strokeWidth = (0, _html_utils.measureToString)(edge.presence === "visible" ? edge.thickness : 0);
80308    style.stroke = edgeStyle.color;
80309    const corner = this.corner.children.length ? this.corner.children[0] : new Corner({});
80310    const cornerStyle = corner[_symbol_utils.$toStyle]();
80311    const rect = {
80312      name: "rect",
80313      attributes: {
80314        xmlns: SVG_NS,
80315        width: "100%",
80316        height: "100%",
80317        x: 0,
80318        y: 0,
80319        rx: cornerStyle.radius,
80320        ry: cornerStyle.radius,
80321        style
80322      }
80323    };
80324    const svg = {
80325      name: "svg",
80326      children: [rect],
80327      attributes: {
80328        xmlns: SVG_NS,
80329        style: {
80330          overflow: "visible"
80331        },
80332        width: "100%",
80333        height: "100%"
80334      }
80335    };
80336    const parent = this[_symbol_utils.$getParent]()[_symbol_utils.$getParent]();
80337    if (hasMargin(parent)) {
80338      return _utils.HTMLResult.success({
80339        name: "div",
80340        attributes: {
80341          style: {
80342            display: "inline",
80343            width: "100%",
80344            height: "100%"
80345          }
80346        },
80347        children: [svg]
80348      });
80349    }
80350    svg.attributes.style.position = "absolute";
80351    return _utils.HTMLResult.success(svg);
80352  }
80353}
80354class RefElement extends _xfa_object.StringObject {
80355  constructor(attributes) {
80356    super(TEMPLATE_NS_ID, "ref");
80357    this.id = attributes.id || "";
80358    this.use = attributes.use || "";
80359    this.usehref = attributes.usehref || "";
80360  }
80361}
80362class Script extends _xfa_object.StringObject {
80363  constructor(attributes) {
80364    super(TEMPLATE_NS_ID, "script");
80365    this.binding = attributes.binding || "";
80366    this.contentType = attributes.contentType || "";
80367    this.id = attributes.id || "";
80368    this.name = attributes.name || "";
80369    this.runAt = (0, _utils.getStringOption)(attributes.runAt, ["client", "both", "server"]);
80370    this.use = attributes.use || "";
80371    this.usehref = attributes.usehref || "";
80372  }
80373}
80374class SetProperty extends _xfa_object.XFAObject {
80375  constructor(attributes) {
80376    super(TEMPLATE_NS_ID, "setProperty");
80377    this.connection = attributes.connection || "";
80378    this.ref = attributes.ref || "";
80379    this.target = attributes.target || "";
80380  }
80381}
80382exports.SetProperty = SetProperty;
80383class SignData extends _xfa_object.XFAObject {
80384  constructor(attributes) {
80385    super(TEMPLATE_NS_ID, "signData", true);
80386    this.id = attributes.id || "";
80387    this.operation = (0, _utils.getStringOption)(attributes.operation, ["sign", "clear", "verify"]);
80388    this.ref = attributes.ref || "";
80389    this.target = attributes.target || "";
80390    this.use = attributes.use || "";
80391    this.usehref = attributes.usehref || "";
80392    this.filter = null;
80393    this.manifest = null;
80394  }
80395}
80396class Signature extends _xfa_object.XFAObject {
80397  constructor(attributes) {
80398    super(TEMPLATE_NS_ID, "signature", true);
80399    this.id = attributes.id || "";
80400    this.type = (0, _utils.getStringOption)(attributes.type, ["PDF1.3", "PDF1.6"]);
80401    this.use = attributes.use || "";
80402    this.usehref = attributes.usehref || "";
80403    this.border = null;
80404    this.extras = null;
80405    this.filter = null;
80406    this.manifest = null;
80407    this.margin = null;
80408  }
80409}
80410class Signing extends _xfa_object.XFAObject {
80411  constructor(attributes) {
80412    super(TEMPLATE_NS_ID, "signing", true);
80413    this.id = attributes.id || "";
80414    this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
80415    this.use = attributes.use || "";
80416    this.usehref = attributes.usehref || "";
80417    this.certificate = new _xfa_object.XFAObjectArray();
80418  }
80419}
80420class Solid extends _xfa_object.XFAObject {
80421  constructor(attributes) {
80422    super(TEMPLATE_NS_ID, "solid", true);
80423    this.id = attributes.id || "";
80424    this.use = attributes.use || "";
80425    this.usehref = attributes.usehref || "";
80426    this.extras = null;
80427  }
80428  [_symbol_utils.$toStyle](startColor) {
80429    return startColor ? startColor[_symbol_utils.$toStyle]() : "#FFFFFF";
80430  }
80431}
80432class Speak extends _xfa_object.StringObject {
80433  constructor(attributes) {
80434    super(TEMPLATE_NS_ID, "speak");
80435    this.disable = (0, _utils.getInteger)({
80436      data: attributes.disable,
80437      defaultValue: 0,
80438      validate: x => x === 1
80439    });
80440    this.id = attributes.id || "";
80441    this.priority = (0, _utils.getStringOption)(attributes.priority, ["custom", "caption", "name", "toolTip"]);
80442    this.rid = attributes.rid || "";
80443    this.use = attributes.use || "";
80444    this.usehref = attributes.usehref || "";
80445  }
80446}
80447class Stipple extends _xfa_object.XFAObject {
80448  constructor(attributes) {
80449    super(TEMPLATE_NS_ID, "stipple", true);
80450    this.id = attributes.id || "";
80451    this.rate = (0, _utils.getInteger)({
80452      data: attributes.rate,
80453      defaultValue: 50,
80454      validate: x => x >= 0 && x <= 100
80455    });
80456    this.use = attributes.use || "";
80457    this.usehref = attributes.usehref || "";
80458    this.color = null;
80459    this.extras = null;
80460  }
80461  [_symbol_utils.$toStyle](bgColor) {
80462    const alpha = this.rate / 100;
80463    return _util.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));
80464  }
80465}
80466class Subform extends _xfa_object.XFAObject {
80467  constructor(attributes) {
80468    super(TEMPLATE_NS_ID, "subform", true);
80469    this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
80470    this.allowMacro = (0, _utils.getInteger)({
80471      data: attributes.allowMacro,
80472      defaultValue: 0,
80473      validate: x => x === 1
80474    });
80475    this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
80476    this.colSpan = (0, _utils.getInteger)({
80477      data: attributes.colSpan,
80478      defaultValue: 1,
80479      validate: n => n >= 1 || n === -1
80480    });
80481    this.columnWidths = (attributes.columnWidths || "").trim().split(/\s+/).map(x => x === "-1" ? -1 : (0, _utils.getMeasurement)(x));
80482    this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
80483    this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
80484    this.id = attributes.id || "";
80485    this.layout = (0, _utils.getStringOption)(attributes.layout, ["position", "lr-tb", "rl-row", "rl-tb", "row", "table", "tb"]);
80486    this.locale = attributes.locale || "";
80487    this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
80488    this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
80489    this.mergeMode = (0, _utils.getStringOption)(attributes.mergeMode, ["consumeData", "matchTemplate"]);
80490    this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
80491    this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
80492    this.name = attributes.name || "";
80493    this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
80494    this.relevant = (0, _utils.getRelevant)(attributes.relevant);
80495    this.restoreState = (0, _utils.getStringOption)(attributes.restoreState, ["manual", "auto"]);
80496    this.scope = (0, _utils.getStringOption)(attributes.scope, ["name", "none"]);
80497    this.use = attributes.use || "";
80498    this.usehref = attributes.usehref || "";
80499    this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
80500    this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
80501    this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
80502    this.assist = null;
80503    this.bind = null;
80504    this.bookend = null;
80505    this.border = null;
80506    this.break = null;
80507    this.calculate = null;
80508    this.desc = null;
80509    this.extras = null;
80510    this.keep = null;
80511    this.margin = null;
80512    this.occur = null;
80513    this.overflow = null;
80514    this.pageSet = null;
80515    this.para = null;
80516    this.traversal = null;
80517    this.validate = null;
80518    this.variables = null;
80519    this.area = new _xfa_object.XFAObjectArray();
80520    this.breakAfter = new _xfa_object.XFAObjectArray();
80521    this.breakBefore = new _xfa_object.XFAObjectArray();
80522    this.connect = new _xfa_object.XFAObjectArray();
80523    this.draw = new _xfa_object.XFAObjectArray();
80524    this.event = new _xfa_object.XFAObjectArray();
80525    this.exObject = new _xfa_object.XFAObjectArray();
80526    this.exclGroup = new _xfa_object.XFAObjectArray();
80527    this.field = new _xfa_object.XFAObjectArray();
80528    this.proto = new _xfa_object.XFAObjectArray();
80529    this.setProperty = new _xfa_object.XFAObjectArray();
80530    this.subform = new _xfa_object.XFAObjectArray();
80531    this.subformSet = new _xfa_object.XFAObjectArray();
80532  }
80533  [_symbol_utils.$getSubformParent]() {
80534    const parent = this[_symbol_utils.$getParent]();
80535    if (parent instanceof SubformSet) {
80536      return parent[_symbol_utils.$getSubformParent]();
80537    }
80538    return parent;
80539  }
80540  [_symbol_utils.$isBindable]() {
80541    return true;
80542  }
80543  [_symbol_utils.$isThereMoreWidth]() {
80544    return this.layout.endsWith("-tb") && this[_symbol_utils.$extra].attempt === 0 && this[_symbol_utils.$extra].numberInLine > 0 || this[_symbol_utils.$getParent]()[_symbol_utils.$isThereMoreWidth]();
80545  }
80546  *[_symbol_utils.$getContainedChildren]() {
80547    yield* getContainedChildren(this);
80548  }
80549  [_symbol_utils.$flushHTML]() {
80550    return (0, _layout.flushHTML)(this);
80551  }
80552  [_symbol_utils.$addHTML](html, bbox) {
80553    (0, _layout.addHTML)(this, html, bbox);
80554  }
80555  [_symbol_utils.$getAvailableSpace]() {
80556    return (0, _layout.getAvailableSpace)(this);
80557  }
80558  [_symbol_utils.$isSplittable]() {
80559    const parent = this[_symbol_utils.$getSubformParent]();
80560    if (!parent[_symbol_utils.$isSplittable]()) {
80561      return false;
80562    }
80563    if (this[_symbol_utils.$extra]._isSplittable !== undefined) {
80564      return this[_symbol_utils.$extra]._isSplittable;
80565    }
80566    if (this.layout === "position" || this.layout.includes("row")) {
80567      this[_symbol_utils.$extra]._isSplittable = false;
80568      return false;
80569    }
80570    if (this.keep && this.keep.intact !== "none") {
80571      this[_symbol_utils.$extra]._isSplittable = false;
80572      return false;
80573    }
80574    if (parent.layout?.endsWith("-tb") && parent[_symbol_utils.$extra].numberInLine !== 0) {
80575      return false;
80576    }
80577    this[_symbol_utils.$extra]._isSplittable = true;
80578    return true;
80579  }
80580  [_symbol_utils.$toHTML](availableSpace) {
80581    setTabIndex(this);
80582    if (this.break) {
80583      if (this.break.after !== "auto" || this.break.afterTarget !== "") {
80584        const node = new BreakAfter({
80585          targetType: this.break.after,
80586          target: this.break.afterTarget,
80587          startNew: this.break.startNew.toString()
80588        });
80589        node[_symbol_utils.$globalData] = this[_symbol_utils.$globalData];
80590        this[_symbol_utils.$appendChild](node);
80591        this.breakAfter.push(node);
80592      }
80593      if (this.break.before !== "auto" || this.break.beforeTarget !== "") {
80594        const node = new BreakBefore({
80595          targetType: this.break.before,
80596          target: this.break.beforeTarget,
80597          startNew: this.break.startNew.toString()
80598        });
80599        node[_symbol_utils.$globalData] = this[_symbol_utils.$globalData];
80600        this[_symbol_utils.$appendChild](node);
80601        this.breakBefore.push(node);
80602      }
80603      if (this.break.overflowTarget !== "") {
80604        const node = new Overflow({
80605          target: this.break.overflowTarget,
80606          leader: this.break.overflowLeader,
80607          trailer: this.break.overflowTrailer
80608        });
80609        node[_symbol_utils.$globalData] = this[_symbol_utils.$globalData];
80610        this[_symbol_utils.$appendChild](node);
80611        this.overflow.push(node);
80612      }
80613      this[_symbol_utils.$removeChild](this.break);
80614      this.break = null;
80615    }
80616    if (this.presence === "hidden" || this.presence === "inactive") {
80617      return _utils.HTMLResult.EMPTY;
80618    }
80619    if (this.breakBefore.children.length > 1 || this.breakAfter.children.length > 1) {
80620      (0, _util.warn)("XFA - Several breakBefore or breakAfter in subforms: please file a bug.");
80621    }
80622    if (this.breakBefore.children.length >= 1) {
80623      const breakBefore = this.breakBefore.children[0];
80624      if (handleBreak(breakBefore)) {
80625        return _utils.HTMLResult.breakNode(breakBefore);
80626      }
80627    }
80628    if (this[_symbol_utils.$extra]?.afterBreakAfter) {
80629      return _utils.HTMLResult.EMPTY;
80630    }
80631    (0, _html_utils.fixDimensions)(this);
80632    const children = [];
80633    const attributes = {
80634      id: this[_symbol_utils.$uid],
80635      class: []
80636    };
80637    (0, _html_utils.setAccess)(this, attributes.class);
80638    if (!this[_symbol_utils.$extra]) {
80639      this[_symbol_utils.$extra] = Object.create(null);
80640    }
80641    Object.assign(this[_symbol_utils.$extra], {
80642      children,
80643      line: null,
80644      attributes,
80645      attempt: 0,
80646      numberInLine: 0,
80647      availableSpace: {
80648        width: Math.min(this.w || Infinity, availableSpace.width),
80649        height: Math.min(this.h || Infinity, availableSpace.height)
80650      },
80651      width: 0,
80652      height: 0,
80653      prevHeight: 0,
80654      currentWidth: 0
80655    });
80656    const root = this[_symbol_utils.$getTemplateRoot]();
80657    const savedNoLayoutFailure = root[_symbol_utils.$extra].noLayoutFailure;
80658    const isSplittable = this[_symbol_utils.$isSplittable]();
80659    if (!isSplittable) {
80660      setFirstUnsplittable(this);
80661    }
80662    if (!(0, _layout.checkDimensions)(this, availableSpace)) {
80663      return _utils.HTMLResult.FAILURE;
80664    }
80665    const filter = new Set(["area", "draw", "exclGroup", "field", "subform", "subformSet"]);
80666    if (this.layout.includes("row")) {
80667      const columnWidths = this[_symbol_utils.$getSubformParent]().columnWidths;
80668      if (Array.isArray(columnWidths) && columnWidths.length > 0) {
80669        this[_symbol_utils.$extra].columnWidths = columnWidths;
80670        this[_symbol_utils.$extra].currentColumn = 0;
80671      }
80672    }
80673    const style = (0, _html_utils.toStyle)(this, "anchorType", "dimensions", "position", "presence", "border", "margin", "hAlign");
80674    const classNames = ["xfaSubform"];
80675    const cl = (0, _html_utils.layoutClass)(this);
80676    if (cl) {
80677      classNames.push(cl);
80678    }
80679    attributes.style = style;
80680    attributes.class = classNames;
80681    if (this.name) {
80682      attributes.xfaName = this.name;
80683    }
80684    if (this.overflow) {
80685      const overflowExtra = this.overflow[_symbol_utils.$getExtra]();
80686      if (overflowExtra.addLeader) {
80687        overflowExtra.addLeader = false;
80688        handleOverflow(this, overflowExtra.leader, availableSpace);
80689      }
80690    }
80691    this[_symbol_utils.$pushPara]();
80692    const isLrTb = this.layout === "lr-tb" || this.layout === "rl-tb";
80693    const maxRun = isLrTb ? MAX_ATTEMPTS_FOR_LRTB_LAYOUT : 1;
80694    for (; this[_symbol_utils.$extra].attempt < maxRun; this[_symbol_utils.$extra].attempt++) {
80695      if (isLrTb && this[_symbol_utils.$extra].attempt === MAX_ATTEMPTS_FOR_LRTB_LAYOUT - 1) {
80696        this[_symbol_utils.$extra].numberInLine = 0;
80697      }
80698      const result = this[_symbol_utils.$childrenToHTML]({
80699        filter,
80700        include: true
80701      });
80702      if (result.success) {
80703        break;
80704      }
80705      if (result.isBreak()) {
80706        this[_symbol_utils.$popPara]();
80707        return result;
80708      }
80709      if (isLrTb && this[_symbol_utils.$extra].attempt === 0 && this[_symbol_utils.$extra].numberInLine === 0 && !root[_symbol_utils.$extra].noLayoutFailure) {
80710        this[_symbol_utils.$extra].attempt = maxRun;
80711        break;
80712      }
80713    }
80714    this[_symbol_utils.$popPara]();
80715    if (!isSplittable) {
80716      unsetFirstUnsplittable(this);
80717    }
80718    root[_symbol_utils.$extra].noLayoutFailure = savedNoLayoutFailure;
80719    if (this[_symbol_utils.$extra].attempt === maxRun) {
80720      if (this.overflow) {
80721        this[_symbol_utils.$getTemplateRoot]()[_symbol_utils.$extra].overflowNode = this.overflow;
80722      }
80723      if (!isSplittable) {
80724        delete this[_symbol_utils.$extra];
80725      }
80726      return _utils.HTMLResult.FAILURE;
80727    }
80728    if (this.overflow) {
80729      const overflowExtra = this.overflow[_symbol_utils.$getExtra]();
80730      if (overflowExtra.addTrailer) {
80731        overflowExtra.addTrailer = false;
80732        handleOverflow(this, overflowExtra.trailer, availableSpace);
80733      }
80734    }
80735    let marginH = 0;
80736    let marginV = 0;
80737    if (this.margin) {
80738      marginH = this.margin.leftInset + this.margin.rightInset;
80739      marginV = this.margin.topInset + this.margin.bottomInset;
80740    }
80741    const width = Math.max(this[_symbol_utils.$extra].width + marginH, this.w || 0);
80742    const height = Math.max(this[_symbol_utils.$extra].height + marginV, this.h || 0);
80743    const bbox = [this.x, this.y, width, height];
80744    if (this.w === "") {
80745      style.width = (0, _html_utils.measureToString)(width);
80746    }
80747    if (this.h === "") {
80748      style.height = (0, _html_utils.measureToString)(height);
80749    }
80750    if ((style.width === "0px" || style.height === "0px") && children.length === 0) {
80751      return _utils.HTMLResult.EMPTY;
80752    }
80753    const html = {
80754      name: "div",
80755      attributes,
80756      children
80757    };
80758    applyAssist(this, attributes);
80759    const result = _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
80760    if (this.breakAfter.children.length >= 1) {
80761      const breakAfter = this.breakAfter.children[0];
80762      if (handleBreak(breakAfter)) {
80763        this[_symbol_utils.$extra].afterBreakAfter = result;
80764        return _utils.HTMLResult.breakNode(breakAfter);
80765      }
80766    }
80767    delete this[_symbol_utils.$extra];
80768    return result;
80769  }
80770}
80771class SubformSet extends _xfa_object.XFAObject {
80772  constructor(attributes) {
80773    super(TEMPLATE_NS_ID, "subformSet", true);
80774    this.id = attributes.id || "";
80775    this.name = attributes.name || "";
80776    this.relation = (0, _utils.getStringOption)(attributes.relation, ["ordered", "choice", "unordered"]);
80777    this.relevant = (0, _utils.getRelevant)(attributes.relevant);
80778    this.use = attributes.use || "";
80779    this.usehref = attributes.usehref || "";
80780    this.bookend = null;
80781    this.break = null;
80782    this.desc = null;
80783    this.extras = null;
80784    this.occur = null;
80785    this.overflow = null;
80786    this.breakAfter = new _xfa_object.XFAObjectArray();
80787    this.breakBefore = new _xfa_object.XFAObjectArray();
80788    this.subform = new _xfa_object.XFAObjectArray();
80789    this.subformSet = new _xfa_object.XFAObjectArray();
80790  }
80791  *[_symbol_utils.$getContainedChildren]() {
80792    yield* getContainedChildren(this);
80793  }
80794  [_symbol_utils.$getSubformParent]() {
80795    let parent = this[_symbol_utils.$getParent]();
80796    while (!(parent instanceof Subform)) {
80797      parent = parent[_symbol_utils.$getParent]();
80798    }
80799    return parent;
80800  }
80801  [_symbol_utils.$isBindable]() {
80802    return true;
80803  }
80804}
80805class SubjectDN extends _xfa_object.ContentObject {
80806  constructor(attributes) {
80807    super(TEMPLATE_NS_ID, "subjectDN");
80808    this.delimiter = attributes.delimiter || ",";
80809    this.id = attributes.id || "";
80810    this.name = attributes.name || "";
80811    this.use = attributes.use || "";
80812    this.usehref = attributes.usehref || "";
80813  }
80814  [_symbol_utils.$finalize]() {
80815    this[_symbol_utils.$content] = new Map(this[_symbol_utils.$content].split(this.delimiter).map(kv => {
80816      kv = kv.split("=", 2);
80817      kv[0] = kv[0].trim();
80818      return kv;
80819    }));
80820  }
80821}
80822class SubjectDNs extends _xfa_object.XFAObject {
80823  constructor(attributes) {
80824    super(TEMPLATE_NS_ID, "subjectDNs", true);
80825    this.id = attributes.id || "";
80826    this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
80827    this.use = attributes.use || "";
80828    this.usehref = attributes.usehref || "";
80829    this.subjectDN = new _xfa_object.XFAObjectArray();
80830  }
80831}
80832class Submit extends _xfa_object.XFAObject {
80833  constructor(attributes) {
80834    super(TEMPLATE_NS_ID, "submit", true);
80835    this.embedPDF = (0, _utils.getInteger)({
80836      data: attributes.embedPDF,
80837      defaultValue: 0,
80838      validate: x => x === 1
80839    });
80840    this.format = (0, _utils.getStringOption)(attributes.format, ["xdp", "formdata", "pdf", "urlencoded", "xfd", "xml"]);
80841    this.id = attributes.id || "";
80842    this.target = attributes.target || "";
80843    this.textEncoding = (0, _utils.getKeyword)({
80844      data: attributes.textEncoding ? attributes.textEncoding.toLowerCase() : "",
80845      defaultValue: "",
80846      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}/)
80847    });
80848    this.use = attributes.use || "";
80849    this.usehref = attributes.usehref || "";
80850    this.xdpContent = attributes.xdpContent || "";
80851    this.encrypt = null;
80852    this.encryptData = new _xfa_object.XFAObjectArray();
80853    this.signData = new _xfa_object.XFAObjectArray();
80854  }
80855}
80856class Template extends _xfa_object.XFAObject {
80857  constructor(attributes) {
80858    super(TEMPLATE_NS_ID, "template", true);
80859    this.baseProfile = (0, _utils.getStringOption)(attributes.baseProfile, ["full", "interactiveForms"]);
80860    this.extras = null;
80861    this.subform = new _xfa_object.XFAObjectArray();
80862  }
80863  [_symbol_utils.$finalize]() {
80864    if (this.subform.children.length === 0) {
80865      (0, _util.warn)("XFA - No subforms in template node.");
80866    }
80867    if (this.subform.children.length >= 2) {
80868      (0, _util.warn)("XFA - Several subforms in template node: please file a bug.");
80869    }
80870    this[_symbol_utils.$tabIndex] = DEFAULT_TAB_INDEX;
80871  }
80872  [_symbol_utils.$isSplittable]() {
80873    return true;
80874  }
80875  [_symbol_utils.$searchNode](expr, container) {
80876    if (expr.startsWith("#")) {
80877      return [this[_symbol_utils.$ids].get(expr.slice(1))];
80878    }
80879    return (0, _som.searchNode)(this, container, expr, true, true);
80880  }
80881  *[_symbol_utils.$toPages]() {
80882    if (!this.subform.children.length) {
80883      return _utils.HTMLResult.success({
80884        name: "div",
80885        children: []
80886      });
80887    }
80888    this[_symbol_utils.$extra] = {
80889      overflowNode: null,
80890      firstUnsplittable: null,
80891      currentContentArea: null,
80892      currentPageArea: null,
80893      noLayoutFailure: false,
80894      pageNumber: 1,
80895      pagePosition: "first",
80896      oddOrEven: "odd",
80897      blankOrNotBlank: "nonBlank",
80898      paraStack: []
80899    };
80900    const root = this.subform.children[0];
80901    root.pageSet[_symbol_utils.$cleanPage]();
80902    const pageAreas = root.pageSet.pageArea.children;
80903    const mainHtml = {
80904      name: "div",
80905      children: []
80906    };
80907    let pageArea = null;
80908    let breakBefore = null;
80909    let breakBeforeTarget = null;
80910    if (root.breakBefore.children.length >= 1) {
80911      breakBefore = root.breakBefore.children[0];
80912      breakBeforeTarget = breakBefore.target;
80913    } else if (root.subform.children.length >= 1 && root.subform.children[0].breakBefore.children.length >= 1) {
80914      breakBefore = root.subform.children[0].breakBefore.children[0];
80915      breakBeforeTarget = breakBefore.target;
80916    } else if (root.break?.beforeTarget) {
80917      breakBefore = root.break;
80918      breakBeforeTarget = breakBefore.beforeTarget;
80919    } else if (root.subform.children.length >= 1 && root.subform.children[0].break?.beforeTarget) {
80920      breakBefore = root.subform.children[0].break;
80921      breakBeforeTarget = breakBefore.beforeTarget;
80922    }
80923    if (breakBefore) {
80924      const target = this[_symbol_utils.$searchNode](breakBeforeTarget, breakBefore[_symbol_utils.$getParent]());
80925      if (target instanceof PageArea) {
80926        pageArea = target;
80927        breakBefore[_symbol_utils.$extra] = {};
80928      }
80929    }
80930    if (!pageArea) {
80931      pageArea = pageAreas[0];
80932    }
80933    pageArea[_symbol_utils.$extra] = {
80934      numberOfUse: 1
80935    };
80936    const pageAreaParent = pageArea[_symbol_utils.$getParent]();
80937    pageAreaParent[_symbol_utils.$extra] = {
80938      numberOfUse: 1,
80939      pageIndex: pageAreaParent.pageArea.children.indexOf(pageArea),
80940      pageSetIndex: 0
80941    };
80942    let targetPageArea;
80943    let leader = null;
80944    let trailer = null;
80945    let hasSomething = true;
80946    let hasSomethingCounter = 0;
80947    let startIndex = 0;
80948    while (true) {
80949      if (!hasSomething) {
80950        mainHtml.children.pop();
80951        if (++hasSomethingCounter === MAX_EMPTY_PAGES) {
80952          (0, _util.warn)("XFA - Something goes wrong: please file a bug.");
80953          return mainHtml;
80954        }
80955      } else {
80956        hasSomethingCounter = 0;
80957      }
80958      targetPageArea = null;
80959      this[_symbol_utils.$extra].currentPageArea = pageArea;
80960      const page = pageArea[_symbol_utils.$toHTML]().html;
80961      mainHtml.children.push(page);
80962      if (leader) {
80963        this[_symbol_utils.$extra].noLayoutFailure = true;
80964        page.children.push(leader[_symbol_utils.$toHTML](pageArea[_symbol_utils.$extra].space).html);
80965        leader = null;
80966      }
80967      if (trailer) {
80968        this[_symbol_utils.$extra].noLayoutFailure = true;
80969        page.children.push(trailer[_symbol_utils.$toHTML](pageArea[_symbol_utils.$extra].space).html);
80970        trailer = null;
80971      }
80972      const contentAreas = pageArea.contentArea.children;
80973      const htmlContentAreas = page.children.filter(node => node.attributes.class.includes("xfaContentarea"));
80974      hasSomething = false;
80975      this[_symbol_utils.$extra].firstUnsplittable = null;
80976      this[_symbol_utils.$extra].noLayoutFailure = false;
80977      const flush = index => {
80978        const html = root[_symbol_utils.$flushHTML]();
80979        if (html) {
80980          hasSomething ||= html.children?.length > 0;
80981          htmlContentAreas[index].children.push(html);
80982        }
80983      };
80984      for (let i = startIndex, ii = contentAreas.length; i < ii; i++) {
80985        const contentArea = this[_symbol_utils.$extra].currentContentArea = contentAreas[i];
80986        const space = {
80987          width: contentArea.w,
80988          height: contentArea.h
80989        };
80990        startIndex = 0;
80991        if (leader) {
80992          htmlContentAreas[i].children.push(leader[_symbol_utils.$toHTML](space).html);
80993          leader = null;
80994        }
80995        if (trailer) {
80996          htmlContentAreas[i].children.push(trailer[_symbol_utils.$toHTML](space).html);
80997          trailer = null;
80998        }
80999        const html = root[_symbol_utils.$toHTML](space);
81000        if (html.success) {
81001          if (html.html) {
81002            hasSomething ||= html.html.children?.length > 0;
81003            htmlContentAreas[i].children.push(html.html);
81004          } else if (!hasSomething && mainHtml.children.length > 1) {
81005            mainHtml.children.pop();
81006          }
81007          return mainHtml;
81008        }
81009        if (html.isBreak()) {
81010          const node = html.breakNode;
81011          flush(i);
81012          if (node.targetType === "auto") {
81013            continue;
81014          }
81015          if (node.leader) {
81016            leader = this[_symbol_utils.$searchNode](node.leader, node[_symbol_utils.$getParent]());
81017            leader = leader ? leader[0] : null;
81018          }
81019          if (node.trailer) {
81020            trailer = this[_symbol_utils.$searchNode](node.trailer, node[_symbol_utils.$getParent]());
81021            trailer = trailer ? trailer[0] : null;
81022          }
81023          if (node.targetType === "pageArea") {
81024            targetPageArea = node[_symbol_utils.$extra].target;
81025            i = Infinity;
81026          } else if (!node[_symbol_utils.$extra].target) {
81027            i = node[_symbol_utils.$extra].index;
81028          } else {
81029            targetPageArea = node[_symbol_utils.$extra].target;
81030            startIndex = node[_symbol_utils.$extra].index + 1;
81031            i = Infinity;
81032          }
81033          continue;
81034        }
81035        if (this[_symbol_utils.$extra].overflowNode) {
81036          const node = this[_symbol_utils.$extra].overflowNode;
81037          this[_symbol_utils.$extra].overflowNode = null;
81038          const overflowExtra = node[_symbol_utils.$getExtra]();
81039          const target = overflowExtra.target;
81040          overflowExtra.addLeader = overflowExtra.leader !== null;
81041          overflowExtra.addTrailer = overflowExtra.trailer !== null;
81042          flush(i);
81043          const currentIndex = i;
81044          i = Infinity;
81045          if (target instanceof PageArea) {
81046            targetPageArea = target;
81047          } else if (target instanceof ContentArea) {
81048            const index = contentAreas.indexOf(target);
81049            if (index !== -1) {
81050              if (index > currentIndex) {
81051                i = index - 1;
81052              } else {
81053                startIndex = index;
81054              }
81055            } else {
81056              targetPageArea = target[_symbol_utils.$getParent]();
81057              startIndex = targetPageArea.contentArea.children.indexOf(target);
81058            }
81059          }
81060          continue;
81061        }
81062        flush(i);
81063      }
81064      this[_symbol_utils.$extra].pageNumber += 1;
81065      if (targetPageArea) {
81066        if (targetPageArea[_symbol_utils.$isUsable]()) {
81067          targetPageArea[_symbol_utils.$extra].numberOfUse += 1;
81068        } else {
81069          targetPageArea = null;
81070        }
81071      }
81072      pageArea = targetPageArea || pageArea[_symbol_utils.$getNextPage]();
81073      yield null;
81074    }
81075  }
81076}
81077exports.Template = Template;
81078class Text extends _xfa_object.ContentObject {
81079  constructor(attributes) {
81080    super(TEMPLATE_NS_ID, "text");
81081    this.id = attributes.id || "";
81082    this.maxChars = (0, _utils.getInteger)({
81083      data: attributes.maxChars,
81084      defaultValue: 0,
81085      validate: x => x >= 0
81086    });
81087    this.name = attributes.name || "";
81088    this.rid = attributes.rid || "";
81089    this.use = attributes.use || "";
81090    this.usehref = attributes.usehref || "";
81091  }
81092  [_symbol_utils.$acceptWhitespace]() {
81093    return true;
81094  }
81095  [_symbol_utils.$onChild](child) {
81096    if (child[_symbol_utils.$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
81097      this[_symbol_utils.$content] = child;
81098      return true;
81099    }
81100    (0, _util.warn)(`XFA - Invalid content in Text: ${child[_symbol_utils.$nodeName]}.`);
81101    return false;
81102  }
81103  [_symbol_utils.$onText](str) {
81104    if (this[_symbol_utils.$content] instanceof _xfa_object.XFAObject) {
81105      return;
81106    }
81107    super[_symbol_utils.$onText](str);
81108  }
81109  [_symbol_utils.$finalize]() {
81110    if (typeof this[_symbol_utils.$content] === "string") {
81111      this[_symbol_utils.$content] = this[_symbol_utils.$content].replaceAll("\r\n", "\n");
81112    }
81113  }
81114  [_symbol_utils.$getExtra]() {
81115    if (typeof this[_symbol_utils.$content] === "string") {
81116      return this[_symbol_utils.$content].split(/[\u2029\u2028\n]/).reduce((acc, line) => {
81117        if (line) {
81118          acc.push(line);
81119        }
81120        return acc;
81121      }, []).join("\n");
81122    }
81123    return this[_symbol_utils.$content][_symbol_utils.$text]();
81124  }
81125  [_symbol_utils.$toHTML](availableSpace) {
81126    if (typeof this[_symbol_utils.$content] === "string") {
81127      const html = valueToHtml(this[_symbol_utils.$content]).html;
81128      if (this[_symbol_utils.$content].includes("\u2029")) {
81129        html.name = "div";
81130        html.children = [];
81131        this[_symbol_utils.$content].split("\u2029").map(para => para.split(/[\u2028\n]/).reduce((acc, line) => {
81132          acc.push({
81133            name: "span",
81134            value: line
81135          }, {
81136            name: "br"
81137          });
81138          return acc;
81139        }, [])).forEach(lines => {
81140          html.children.push({
81141            name: "p",
81142            children: lines
81143          });
81144        });
81145      } else if (/[\u2028\n]/.test(this[_symbol_utils.$content])) {
81146        html.name = "div";
81147        html.children = [];
81148        this[_symbol_utils.$content].split(/[\u2028\n]/).forEach(line => {
81149          html.children.push({
81150            name: "span",
81151            value: line
81152          }, {
81153            name: "br"
81154          });
81155        });
81156      }
81157      return _utils.HTMLResult.success(html);
81158    }
81159    return this[_symbol_utils.$content][_symbol_utils.$toHTML](availableSpace);
81160  }
81161}
81162exports.Text = Text;
81163class TextEdit extends _xfa_object.XFAObject {
81164  constructor(attributes) {
81165    super(TEMPLATE_NS_ID, "textEdit", true);
81166    this.allowRichText = (0, _utils.getInteger)({
81167      data: attributes.allowRichText,
81168      defaultValue: 0,
81169      validate: x => x === 1
81170    });
81171    this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
81172    this.id = attributes.id || "";
81173    this.multiLine = (0, _utils.getInteger)({
81174      data: attributes.multiLine,
81175      defaultValue: "",
81176      validate: x => x === 0 || x === 1
81177    });
81178    this.use = attributes.use || "";
81179    this.usehref = attributes.usehref || "";
81180    this.vScrollPolicy = (0, _utils.getStringOption)(attributes.vScrollPolicy, ["auto", "off", "on"]);
81181    this.border = null;
81182    this.comb = null;
81183    this.extras = null;
81184    this.margin = null;
81185  }
81186  [_symbol_utils.$toHTML](availableSpace) {
81187    const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
81188    let html;
81189    const field = this[_symbol_utils.$getParent]()[_symbol_utils.$getParent]();
81190    if (this.multiLine === "") {
81191      this.multiLine = field instanceof Draw ? 1 : 0;
81192    }
81193    if (this.multiLine === 1) {
81194      html = {
81195        name: "textarea",
81196        attributes: {
81197          dataId: field[_symbol_utils.$data]?.[_symbol_utils.$uid] || field[_symbol_utils.$uid],
81198          fieldId: field[_symbol_utils.$uid],
81199          class: ["xfaTextfield"],
81200          style,
81201          "aria-label": ariaLabel(field),
81202          "aria-required": false
81203        }
81204      };
81205    } else {
81206      html = {
81207        name: "input",
81208        attributes: {
81209          type: "text",
81210          dataId: field[_symbol_utils.$data]?.[_symbol_utils.$uid] || field[_symbol_utils.$uid],
81211          fieldId: field[_symbol_utils.$uid],
81212          class: ["xfaTextfield"],
81213          style,
81214          "aria-label": ariaLabel(field),
81215          "aria-required": false
81216        }
81217      };
81218    }
81219    if (isRequired(field)) {
81220      html.attributes["aria-required"] = true;
81221      html.attributes.required = true;
81222    }
81223    return _utils.HTMLResult.success({
81224      name: "label",
81225      attributes: {
81226        class: ["xfaLabel"]
81227      },
81228      children: [html]
81229    });
81230  }
81231}
81232class Time extends _xfa_object.StringObject {
81233  constructor(attributes) {
81234    super(TEMPLATE_NS_ID, "time");
81235    this.id = attributes.id || "";
81236    this.name = attributes.name || "";
81237    this.use = attributes.use || "";
81238    this.usehref = attributes.usehref || "";
81239  }
81240  [_symbol_utils.$finalize]() {
81241    const date = this[_symbol_utils.$content].trim();
81242    this[_symbol_utils.$content] = date ? new Date(date) : null;
81243  }
81244  [_symbol_utils.$toHTML](availableSpace) {
81245    return valueToHtml(this[_symbol_utils.$content] ? this[_symbol_utils.$content].toString() : "");
81246  }
81247}
81248class TimeStamp extends _xfa_object.XFAObject {
81249  constructor(attributes) {
81250    super(TEMPLATE_NS_ID, "timeStamp");
81251    this.id = attributes.id || "";
81252    this.server = attributes.server || "";
81253    this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
81254    this.use = attributes.use || "";
81255    this.usehref = attributes.usehref || "";
81256  }
81257}
81258class ToolTip extends _xfa_object.StringObject {
81259  constructor(attributes) {
81260    super(TEMPLATE_NS_ID, "toolTip");
81261    this.id = attributes.id || "";
81262    this.rid = attributes.rid || "";
81263    this.use = attributes.use || "";
81264    this.usehref = attributes.usehref || "";
81265  }
81266}
81267class Traversal extends _xfa_object.XFAObject {
81268  constructor(attributes) {
81269    super(TEMPLATE_NS_ID, "traversal", true);
81270    this.id = attributes.id || "";
81271    this.use = attributes.use || "";
81272    this.usehref = attributes.usehref || "";
81273    this.extras = null;
81274    this.traverse = new _xfa_object.XFAObjectArray();
81275  }
81276}
81277class Traverse extends _xfa_object.XFAObject {
81278  constructor(attributes) {
81279    super(TEMPLATE_NS_ID, "traverse", true);
81280    this.id = attributes.id || "";
81281    this.operation = (0, _utils.getStringOption)(attributes.operation, ["next", "back", "down", "first", "left", "right", "up"]);
81282    this.ref = attributes.ref || "";
81283    this.use = attributes.use || "";
81284    this.usehref = attributes.usehref || "";
81285    this.extras = null;
81286    this.script = null;
81287  }
81288  get name() {
81289    return this.operation;
81290  }
81291  [_symbol_utils.$isTransparent]() {
81292    return false;
81293  }
81294}
81295class Ui extends _xfa_object.XFAObject {
81296  constructor(attributes) {
81297    super(TEMPLATE_NS_ID, "ui", true);
81298    this.id = attributes.id || "";
81299    this.use = attributes.use || "";
81300    this.usehref = attributes.usehref || "";
81301    this.extras = null;
81302    this.picture = null;
81303    this.barcode = null;
81304    this.button = null;
81305    this.checkButton = null;
81306    this.choiceList = null;
81307    this.dateTimeEdit = null;
81308    this.defaultUi = null;
81309    this.imageEdit = null;
81310    this.numericEdit = null;
81311    this.passwordEdit = null;
81312    this.signature = null;
81313    this.textEdit = null;
81314  }
81315  [_symbol_utils.$getExtra]() {
81316    if (this[_symbol_utils.$extra] === undefined) {
81317      for (const name of Object.getOwnPropertyNames(this)) {
81318        if (name === "extras" || name === "picture") {
81319          continue;
81320        }
81321        const obj = this[name];
81322        if (!(obj instanceof _xfa_object.XFAObject)) {
81323          continue;
81324        }
81325        this[_symbol_utils.$extra] = obj;
81326        return obj;
81327      }
81328      this[_symbol_utils.$extra] = null;
81329    }
81330    return this[_symbol_utils.$extra];
81331  }
81332  [_symbol_utils.$toHTML](availableSpace) {
81333    const obj = this[_symbol_utils.$getExtra]();
81334    if (obj) {
81335      return obj[_symbol_utils.$toHTML](availableSpace);
81336    }
81337    return _utils.HTMLResult.EMPTY;
81338  }
81339}
81340class Validate extends _xfa_object.XFAObject {
81341  constructor(attributes) {
81342    super(TEMPLATE_NS_ID, "validate", true);
81343    this.formatTest = (0, _utils.getStringOption)(attributes.formatTest, ["warning", "disabled", "error"]);
81344    this.id = attributes.id || "";
81345    this.nullTest = (0, _utils.getStringOption)(attributes.nullTest, ["disabled", "error", "warning"]);
81346    this.scriptTest = (0, _utils.getStringOption)(attributes.scriptTest, ["error", "disabled", "warning"]);
81347    this.use = attributes.use || "";
81348    this.usehref = attributes.usehref || "";
81349    this.extras = null;
81350    this.message = null;
81351    this.picture = null;
81352    this.script = null;
81353  }
81354}
81355class Value extends _xfa_object.XFAObject {
81356  constructor(attributes) {
81357    super(TEMPLATE_NS_ID, "value", true);
81358    this.id = attributes.id || "";
81359    this.override = (0, _utils.getInteger)({
81360      data: attributes.override,
81361      defaultValue: 0,
81362      validate: x => x === 1
81363    });
81364    this.relevant = (0, _utils.getRelevant)(attributes.relevant);
81365    this.use = attributes.use || "";
81366    this.usehref = attributes.usehref || "";
81367    this.arc = null;
81368    this.boolean = null;
81369    this.date = null;
81370    this.dateTime = null;
81371    this.decimal = null;
81372    this.exData = null;
81373    this.float = null;
81374    this.image = null;
81375    this.integer = null;
81376    this.line = null;
81377    this.rectangle = null;
81378    this.text = null;
81379    this.time = null;
81380  }
81381  [_symbol_utils.$setValue](value) {
81382    const parent = this[_symbol_utils.$getParent]();
81383    if (parent instanceof Field) {
81384      if (parent.ui?.imageEdit) {
81385        if (!this.image) {
81386          this.image = new Image({});
81387          this[_symbol_utils.$appendChild](this.image);
81388        }
81389        this.image[_symbol_utils.$content] = value[_symbol_utils.$content];
81390        return;
81391      }
81392    }
81393    const valueName = value[_symbol_utils.$nodeName];
81394    if (this[valueName] !== null) {
81395      this[valueName][_symbol_utils.$content] = value[_symbol_utils.$content];
81396      return;
81397    }
81398    for (const name of Object.getOwnPropertyNames(this)) {
81399      const obj = this[name];
81400      if (obj instanceof _xfa_object.XFAObject) {
81401        this[name] = null;
81402        this[_symbol_utils.$removeChild](obj);
81403      }
81404    }
81405    this[value[_symbol_utils.$nodeName]] = value;
81406    this[_symbol_utils.$appendChild](value);
81407  }
81408  [_symbol_utils.$text]() {
81409    if (this.exData) {
81410      if (typeof this.exData[_symbol_utils.$content] === "string") {
81411        return this.exData[_symbol_utils.$content].trim();
81412      }
81413      return this.exData[_symbol_utils.$content][_symbol_utils.$text]().trim();
81414    }
81415    for (const name of Object.getOwnPropertyNames(this)) {
81416      if (name === "image") {
81417        continue;
81418      }
81419      const obj = this[name];
81420      if (obj instanceof _xfa_object.XFAObject) {
81421        return (obj[_symbol_utils.$content] || "").toString().trim();
81422      }
81423    }
81424    return null;
81425  }
81426  [_symbol_utils.$toHTML](availableSpace) {
81427    for (const name of Object.getOwnPropertyNames(this)) {
81428      const obj = this[name];
81429      if (!(obj instanceof _xfa_object.XFAObject)) {
81430        continue;
81431      }
81432      return obj[_symbol_utils.$toHTML](availableSpace);
81433    }
81434    return _utils.HTMLResult.EMPTY;
81435  }
81436}
81437exports.Value = Value;
81438class Variables extends _xfa_object.XFAObject {
81439  constructor(attributes) {
81440    super(TEMPLATE_NS_ID, "variables", true);
81441    this.id = attributes.id || "";
81442    this.use = attributes.use || "";
81443    this.usehref = attributes.usehref || "";
81444    this.boolean = new _xfa_object.XFAObjectArray();
81445    this.date = new _xfa_object.XFAObjectArray();
81446    this.dateTime = new _xfa_object.XFAObjectArray();
81447    this.decimal = new _xfa_object.XFAObjectArray();
81448    this.exData = new _xfa_object.XFAObjectArray();
81449    this.float = new _xfa_object.XFAObjectArray();
81450    this.image = new _xfa_object.XFAObjectArray();
81451    this.integer = new _xfa_object.XFAObjectArray();
81452    this.manifest = new _xfa_object.XFAObjectArray();
81453    this.script = new _xfa_object.XFAObjectArray();
81454    this.text = new _xfa_object.XFAObjectArray();
81455    this.time = new _xfa_object.XFAObjectArray();
81456  }
81457  [_symbol_utils.$isTransparent]() {
81458    return true;
81459  }
81460}
81461class TemplateNamespace {
81462  static [_namespaces.$buildXFAObject](name, attributes) {
81463    if (TemplateNamespace.hasOwnProperty(name)) {
81464      const node = TemplateNamespace[name](attributes);
81465      node[_symbol_utils.$setSetAttributes](attributes);
81466      return node;
81467    }
81468    return undefined;
81469  }
81470  static appearanceFilter(attrs) {
81471    return new AppearanceFilter(attrs);
81472  }
81473  static arc(attrs) {
81474    return new Arc(attrs);
81475  }
81476  static area(attrs) {
81477    return new Area(attrs);
81478  }
81479  static assist(attrs) {
81480    return new Assist(attrs);
81481  }
81482  static barcode(attrs) {
81483    return new Barcode(attrs);
81484  }
81485  static bind(attrs) {
81486    return new Bind(attrs);
81487  }
81488  static bindItems(attrs) {
81489    return new BindItems(attrs);
81490  }
81491  static bookend(attrs) {
81492    return new Bookend(attrs);
81493  }
81494  static boolean(attrs) {
81495    return new BooleanElement(attrs);
81496  }
81497  static border(attrs) {
81498    return new Border(attrs);
81499  }
81500  static break(attrs) {
81501    return new Break(attrs);
81502  }
81503  static breakAfter(attrs) {
81504    return new BreakAfter(attrs);
81505  }
81506  static breakBefore(attrs) {
81507    return new BreakBefore(attrs);
81508  }
81509  static button(attrs) {
81510    return new Button(attrs);
81511  }
81512  static calculate(attrs) {
81513    return new Calculate(attrs);
81514  }
81515  static caption(attrs) {
81516    return new Caption(attrs);
81517  }
81518  static certificate(attrs) {
81519    return new Certificate(attrs);
81520  }
81521  static certificates(attrs) {
81522    return new Certificates(attrs);
81523  }
81524  static checkButton(attrs) {
81525    return new CheckButton(attrs);
81526  }
81527  static choiceList(attrs) {
81528    return new ChoiceList(attrs);
81529  }
81530  static color(attrs) {
81531    return new Color(attrs);
81532  }
81533  static comb(attrs) {
81534    return new Comb(attrs);
81535  }
81536  static connect(attrs) {
81537    return new Connect(attrs);
81538  }
81539  static contentArea(attrs) {
81540    return new ContentArea(attrs);
81541  }
81542  static corner(attrs) {
81543    return new Corner(attrs);
81544  }
81545  static date(attrs) {
81546    return new DateElement(attrs);
81547  }
81548  static dateTime(attrs) {
81549    return new DateTime(attrs);
81550  }
81551  static dateTimeEdit(attrs) {
81552    return new DateTimeEdit(attrs);
81553  }
81554  static decimal(attrs) {
81555    return new Decimal(attrs);
81556  }
81557  static defaultUi(attrs) {
81558    return new DefaultUi(attrs);
81559  }
81560  static desc(attrs) {
81561    return new Desc(attrs);
81562  }
81563  static digestMethod(attrs) {
81564    return new DigestMethod(attrs);
81565  }
81566  static digestMethods(attrs) {
81567    return new DigestMethods(attrs);
81568  }
81569  static draw(attrs) {
81570    return new Draw(attrs);
81571  }
81572  static edge(attrs) {
81573    return new Edge(attrs);
81574  }
81575  static encoding(attrs) {
81576    return new Encoding(attrs);
81577  }
81578  static encodings(attrs) {
81579    return new Encodings(attrs);
81580  }
81581  static encrypt(attrs) {
81582    return new Encrypt(attrs);
81583  }
81584  static encryptData(attrs) {
81585    return new EncryptData(attrs);
81586  }
81587  static encryption(attrs) {
81588    return new Encryption(attrs);
81589  }
81590  static encryptionMethod(attrs) {
81591    return new EncryptionMethod(attrs);
81592  }
81593  static encryptionMethods(attrs) {
81594    return new EncryptionMethods(attrs);
81595  }
81596  static event(attrs) {
81597    return new Event(attrs);
81598  }
81599  static exData(attrs) {
81600    return new ExData(attrs);
81601  }
81602  static exObject(attrs) {
81603    return new ExObject(attrs);
81604  }
81605  static exclGroup(attrs) {
81606    return new ExclGroup(attrs);
81607  }
81608  static execute(attrs) {
81609    return new Execute(attrs);
81610  }
81611  static extras(attrs) {
81612    return new Extras(attrs);
81613  }
81614  static field(attrs) {
81615    return new Field(attrs);
81616  }
81617  static fill(attrs) {
81618    return new Fill(attrs);
81619  }
81620  static filter(attrs) {
81621    return new Filter(attrs);
81622  }
81623  static float(attrs) {
81624    return new Float(attrs);
81625  }
81626  static font(attrs) {
81627    return new Font(attrs);
81628  }
81629  static format(attrs) {
81630    return new Format(attrs);
81631  }
81632  static handler(attrs) {
81633    return new Handler(attrs);
81634  }
81635  static hyphenation(attrs) {
81636    return new Hyphenation(attrs);
81637  }
81638  static image(attrs) {
81639    return new Image(attrs);
81640  }
81641  static imageEdit(attrs) {
81642    return new ImageEdit(attrs);
81643  }
81644  static integer(attrs) {
81645    return new Integer(attrs);
81646  }
81647  static issuers(attrs) {
81648    return new Issuers(attrs);
81649  }
81650  static items(attrs) {
81651    return new Items(attrs);
81652  }
81653  static keep(attrs) {
81654    return new Keep(attrs);
81655  }
81656  static keyUsage(attrs) {
81657    return new KeyUsage(attrs);
81658  }
81659  static line(attrs) {
81660    return new Line(attrs);
81661  }
81662  static linear(attrs) {
81663    return new Linear(attrs);
81664  }
81665  static lockDocument(attrs) {
81666    return new LockDocument(attrs);
81667  }
81668  static manifest(attrs) {
81669    return new Manifest(attrs);
81670  }
81671  static margin(attrs) {
81672    return new Margin(attrs);
81673  }
81674  static mdp(attrs) {
81675    return new Mdp(attrs);
81676  }
81677  static medium(attrs) {
81678    return new Medium(attrs);
81679  }
81680  static message(attrs) {
81681    return new Message(attrs);
81682  }
81683  static numericEdit(attrs) {
81684    return new NumericEdit(attrs);
81685  }
81686  static occur(attrs) {
81687    return new Occur(attrs);
81688  }
81689  static oid(attrs) {
81690    return new Oid(attrs);
81691  }
81692  static oids(attrs) {
81693    return new Oids(attrs);
81694  }
81695  static overflow(attrs) {
81696    return new Overflow(attrs);
81697  }
81698  static pageArea(attrs) {
81699    return new PageArea(attrs);
81700  }
81701  static pageSet(attrs) {
81702    return new PageSet(attrs);
81703  }
81704  static para(attrs) {
81705    return new Para(attrs);
81706  }
81707  static passwordEdit(attrs) {
81708    return new PasswordEdit(attrs);
81709  }
81710  static pattern(attrs) {
81711    return new Pattern(attrs);
81712  }
81713  static picture(attrs) {
81714    return new Picture(attrs);
81715  }
81716  static proto(attrs) {
81717    return new Proto(attrs);
81718  }
81719  static radial(attrs) {
81720    return new Radial(attrs);
81721  }
81722  static reason(attrs) {
81723    return new Reason(attrs);
81724  }
81725  static reasons(attrs) {
81726    return new Reasons(attrs);
81727  }
81728  static rectangle(attrs) {
81729    return new Rectangle(attrs);
81730  }
81731  static ref(attrs) {
81732    return new RefElement(attrs);
81733  }
81734  static script(attrs) {
81735    return new Script(attrs);
81736  }
81737  static setProperty(attrs) {
81738    return new SetProperty(attrs);
81739  }
81740  static signData(attrs) {
81741    return new SignData(attrs);
81742  }
81743  static signature(attrs) {
81744    return new Signature(attrs);
81745  }
81746  static signing(attrs) {
81747    return new Signing(attrs);
81748  }
81749  static solid(attrs) {
81750    return new Solid(attrs);
81751  }
81752  static speak(attrs) {
81753    return new Speak(attrs);
81754  }
81755  static stipple(attrs) {
81756    return new Stipple(attrs);
81757  }
81758  static subform(attrs) {
81759    return new Subform(attrs);
81760  }
81761  static subformSet(attrs) {
81762    return new SubformSet(attrs);
81763  }
81764  static subjectDN(attrs) {
81765    return new SubjectDN(attrs);
81766  }
81767  static subjectDNs(attrs) {
81768    return new SubjectDNs(attrs);
81769  }
81770  static submit(attrs) {
81771    return new Submit(attrs);
81772  }
81773  static template(attrs) {
81774    return new Template(attrs);
81775  }
81776  static text(attrs) {
81777    return new Text(attrs);
81778  }
81779  static textEdit(attrs) {
81780    return new TextEdit(attrs);
81781  }
81782  static time(attrs) {
81783    return new Time(attrs);
81784  }
81785  static timeStamp(attrs) {
81786    return new TimeStamp(attrs);
81787  }
81788  static toolTip(attrs) {
81789    return new ToolTip(attrs);
81790  }
81791  static traversal(attrs) {
81792    return new Traversal(attrs);
81793  }
81794  static traverse(attrs) {
81795    return new Traverse(attrs);
81796  }
81797  static ui(attrs) {
81798    return new Ui(attrs);
81799  }
81800  static validate(attrs) {
81801    return new Validate(attrs);
81802  }
81803  static value(attrs) {
81804    return new Value(attrs);
81805  }
81806  static variables(attrs) {
81807    return new Variables(attrs);
81808  }
81809}
81810exports.TemplateNamespace = TemplateNamespace;
81811
81812/***/ }),
81813/* 81 */
81814/***/ ((__unused_webpack_module, exports) => {
81815
81816
81817
81818Object.defineProperty(exports, "__esModule", ({
81819  value: true
81820}));
81821exports.NamespaceIds = exports.$buildXFAObject = void 0;
81822const $buildXFAObject = Symbol();
81823exports.$buildXFAObject = $buildXFAObject;
81824const NamespaceIds = {
81825  config: {
81826    id: 0,
81827    check: ns => ns.startsWith("http://www.xfa.org/schema/xci/")
81828  },
81829  connectionSet: {
81830    id: 1,
81831    check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-connection-set/")
81832  },
81833  datasets: {
81834    id: 2,
81835    check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-data/")
81836  },
81837  form: {
81838    id: 3,
81839    check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-form/")
81840  },
81841  localeSet: {
81842    id: 4,
81843    check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-locale-set/")
81844  },
81845  pdf: {
81846    id: 5,
81847    check: ns => ns === "http://ns.adobe.com/xdp/pdf/"
81848  },
81849  signature: {
81850    id: 6,
81851    check: ns => ns === "http://www.w3.org/2000/09/xmldsig#"
81852  },
81853  sourceSet: {
81854    id: 7,
81855    check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-source-set/")
81856  },
81857  stylesheet: {
81858    id: 8,
81859    check: ns => ns === "http://www.w3.org/1999/XSL/Transform"
81860  },
81861  template: {
81862    id: 9,
81863    check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-template/")
81864  },
81865  xdc: {
81866    id: 10,
81867    check: ns => ns.startsWith("http://www.xfa.org/schema/xdc/")
81868  },
81869  xdp: {
81870    id: 11,
81871    check: ns => ns === "http://ns.adobe.com/xdp/"
81872  },
81873  xfdf: {
81874    id: 12,
81875    check: ns => ns === "http://ns.adobe.com/xfdf/"
81876  },
81877  xhtml: {
81878    id: 13,
81879    check: ns => ns === "http://www.w3.org/1999/xhtml"
81880  },
81881  xmpmeta: {
81882    id: 14,
81883    check: ns => ns === "http://ns.adobe.com/xmpmeta/"
81884  }
81885};
81886exports.NamespaceIds = NamespaceIds;
81887
81888/***/ }),
81889/* 82 */
81890/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
81891
81892
81893
81894Object.defineProperty(exports, "__esModule", ({
81895  value: true
81896}));
81897exports.addHTML = addHTML;
81898exports.checkDimensions = checkDimensions;
81899exports.flushHTML = flushHTML;
81900exports.getAvailableSpace = getAvailableSpace;
81901var _symbol_utils = __w_pdfjs_require__(78);
81902var _html_utils = __w_pdfjs_require__(83);
81903function createLine(node, children) {
81904  return {
81905    name: "div",
81906    attributes: {
81907      class: [node.layout === "lr-tb" ? "xfaLr" : "xfaRl"]
81908    },
81909    children
81910  };
81911}
81912function flushHTML(node) {
81913  if (!node[_symbol_utils.$extra]) {
81914    return null;
81915  }
81916  const attributes = node[_symbol_utils.$extra].attributes;
81917  const html = {
81918    name: "div",
81919    attributes,
81920    children: node[_symbol_utils.$extra].children
81921  };
81922  if (node[_symbol_utils.$extra].failingNode) {
81923    const htmlFromFailing = node[_symbol_utils.$extra].failingNode[_symbol_utils.$flushHTML]();
81924    if (htmlFromFailing) {
81925      if (node.layout.endsWith("-tb")) {
81926        html.children.push(createLine(node, [htmlFromFailing]));
81927      } else {
81928        html.children.push(htmlFromFailing);
81929      }
81930    }
81931  }
81932  if (html.children.length === 0) {
81933    return null;
81934  }
81935  return html;
81936}
81937function addHTML(node, html, bbox) {
81938  const extra = node[_symbol_utils.$extra];
81939  const availableSpace = extra.availableSpace;
81940  const [x, y, w, h] = bbox;
81941  switch (node.layout) {
81942    case "position":
81943      {
81944        extra.width = Math.max(extra.width, x + w);
81945        extra.height = Math.max(extra.height, y + h);
81946        extra.children.push(html);
81947        break;
81948      }
81949    case "lr-tb":
81950    case "rl-tb":
81951      if (!extra.line || extra.attempt === 1) {
81952        extra.line = createLine(node, []);
81953        extra.children.push(extra.line);
81954        extra.numberInLine = 0;
81955      }
81956      extra.numberInLine += 1;
81957      extra.line.children.push(html);
81958      if (extra.attempt === 0) {
81959        extra.currentWidth += w;
81960        extra.height = Math.max(extra.height, extra.prevHeight + h);
81961      } else {
81962        extra.currentWidth = w;
81963        extra.prevHeight = extra.height;
81964        extra.height += h;
81965        extra.attempt = 0;
81966      }
81967      extra.width = Math.max(extra.width, extra.currentWidth);
81968      break;
81969    case "rl-row":
81970    case "row":
81971      {
81972        extra.children.push(html);
81973        extra.width += w;
81974        extra.height = Math.max(extra.height, h);
81975        const height = (0, _html_utils.measureToString)(extra.height);
81976        for (const child of extra.children) {
81977          child.attributes.style.height = height;
81978        }
81979        break;
81980      }
81981    case "table":
81982      {
81983        extra.width = Math.min(availableSpace.width, Math.max(extra.width, w));
81984        extra.height += h;
81985        extra.children.push(html);
81986        break;
81987      }
81988    case "tb":
81989      {
81990        extra.width = Math.min(availableSpace.width, Math.max(extra.width, w));
81991        extra.height += h;
81992        extra.children.push(html);
81993        break;
81994      }
81995  }
81996}
81997function getAvailableSpace(node) {
81998  const availableSpace = node[_symbol_utils.$extra].availableSpace;
81999  const marginV = node.margin ? node.margin.topInset + node.margin.bottomInset : 0;
82000  const marginH = node.margin ? node.margin.leftInset + node.margin.rightInset : 0;
82001  switch (node.layout) {
82002    case "lr-tb":
82003    case "rl-tb":
82004      if (node[_symbol_utils.$extra].attempt === 0) {
82005        return {
82006          width: availableSpace.width - marginH - node[_symbol_utils.$extra].currentWidth,
82007          height: availableSpace.height - marginV - node[_symbol_utils.$extra].prevHeight
82008        };
82009      }
82010      return {
82011        width: availableSpace.width - marginH,
82012        height: availableSpace.height - marginV - node[_symbol_utils.$extra].height
82013      };
82014    case "rl-row":
82015    case "row":
82016      const width = node[_symbol_utils.$extra].columnWidths.slice(node[_symbol_utils.$extra].currentColumn).reduce((a, x) => a + x);
82017      return {
82018        width,
82019        height: availableSpace.height - marginH
82020      };
82021    case "table":
82022    case "tb":
82023      return {
82024        width: availableSpace.width - marginH,
82025        height: availableSpace.height - marginV - node[_symbol_utils.$extra].height
82026      };
82027    case "position":
82028    default:
82029      return availableSpace;
82030  }
82031}
82032function getTransformedBBox(node) {
82033  let w = node.w === "" ? NaN : node.w;
82034  let h = node.h === "" ? NaN : node.h;
82035  let [centerX, centerY] = [0, 0];
82036  switch (node.anchorType || "") {
82037    case "bottomCenter":
82038      [centerX, centerY] = [w / 2, h];
82039      break;
82040    case "bottomLeft":
82041      [centerX, centerY] = [0, h];
82042      break;
82043    case "bottomRight":
82044      [centerX, centerY] = [w, h];
82045      break;
82046    case "middleCenter":
82047      [centerX, centerY] = [w / 2, h / 2];
82048      break;
82049    case "middleLeft":
82050      [centerX, centerY] = [0, h / 2];
82051      break;
82052    case "middleRight":
82053      [centerX, centerY] = [w, h / 2];
82054      break;
82055    case "topCenter":
82056      [centerX, centerY] = [w / 2, 0];
82057      break;
82058    case "topRight":
82059      [centerX, centerY] = [w, 0];
82060      break;
82061  }
82062  let x, y;
82063  switch (node.rotate || 0) {
82064    case 0:
82065      [x, y] = [-centerX, -centerY];
82066      break;
82067    case 90:
82068      [x, y] = [-centerY, centerX];
82069      [w, h] = [h, -w];
82070      break;
82071    case 180:
82072      [x, y] = [centerX, centerY];
82073      [w, h] = [-w, -h];
82074      break;
82075    case 270:
82076      [x, y] = [centerY, -centerX];
82077      [w, h] = [-h, w];
82078      break;
82079  }
82080  return [node.x + x + Math.min(0, w), node.y + y + Math.min(0, h), Math.abs(w), Math.abs(h)];
82081}
82082function checkDimensions(node, space) {
82083  if (node[_symbol_utils.$getTemplateRoot]()[_symbol_utils.$extra].firstUnsplittable === null) {
82084    return true;
82085  }
82086  if (node.w === 0 || node.h === 0) {
82087    return true;
82088  }
82089  const ERROR = 2;
82090  const parent = node[_symbol_utils.$getSubformParent]();
82091  const attempt = parent[_symbol_utils.$extra]?.attempt || 0;
82092  const [, y, w, h] = getTransformedBBox(node);
82093  switch (parent.layout) {
82094    case "lr-tb":
82095    case "rl-tb":
82096      if (attempt === 0) {
82097        if (!node[_symbol_utils.$getTemplateRoot]()[_symbol_utils.$extra].noLayoutFailure) {
82098          if (node.h !== "" && Math.round(h - space.height) > ERROR) {
82099            return false;
82100          }
82101          if (node.w !== "") {
82102            if (Math.round(w - space.width) <= ERROR) {
82103              return true;
82104            }
82105            if (parent[_symbol_utils.$extra].numberInLine === 0) {
82106              return space.height > ERROR;
82107            }
82108            return false;
82109          }
82110          return space.width > ERROR;
82111        }
82112        if (node.w !== "") {
82113          return Math.round(w - space.width) <= ERROR;
82114        }
82115        return space.width > ERROR;
82116      }
82117      if (node[_symbol_utils.$getTemplateRoot]()[_symbol_utils.$extra].noLayoutFailure) {
82118        return true;
82119      }
82120      if (node.h !== "" && Math.round(h - space.height) > ERROR) {
82121        return false;
82122      }
82123      if (node.w === "" || Math.round(w - space.width) <= ERROR) {
82124        return space.height > ERROR;
82125      }
82126      if (parent[_symbol_utils.$isThereMoreWidth]()) {
82127        return false;
82128      }
82129      return space.height > ERROR;
82130    case "table":
82131    case "tb":
82132      if (node[_symbol_utils.$getTemplateRoot]()[_symbol_utils.$extra].noLayoutFailure) {
82133        return true;
82134      }
82135      if (node.h !== "" && !node[_symbol_utils.$isSplittable]()) {
82136        return Math.round(h - space.height) <= ERROR;
82137      }
82138      if (node.w === "" || Math.round(w - space.width) <= ERROR) {
82139        return space.height > ERROR;
82140      }
82141      if (parent[_symbol_utils.$isThereMoreWidth]()) {
82142        return false;
82143      }
82144      return space.height > ERROR;
82145    case "position":
82146      if (node[_symbol_utils.$getTemplateRoot]()[_symbol_utils.$extra].noLayoutFailure) {
82147        return true;
82148      }
82149      if (node.h === "" || Math.round(h + y - space.height) <= ERROR) {
82150        return true;
82151      }
82152      const area = node[_symbol_utils.$getTemplateRoot]()[_symbol_utils.$extra].currentContentArea;
82153      return h + y > area.h;
82154    case "rl-row":
82155    case "row":
82156      if (node[_symbol_utils.$getTemplateRoot]()[_symbol_utils.$extra].noLayoutFailure) {
82157        return true;
82158      }
82159      if (node.h !== "") {
82160        return Math.round(h - space.height) <= ERROR;
82161      }
82162      return true;
82163    default:
82164      return true;
82165  }
82166}
82167
82168/***/ }),
82169/* 83 */
82170/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
82171
82172
82173
82174Object.defineProperty(exports, "__esModule", ({
82175  value: true
82176}));
82177exports.computeBbox = computeBbox;
82178exports.createWrapper = createWrapper;
82179exports.fixDimensions = fixDimensions;
82180exports.fixTextIndent = fixTextIndent;
82181exports.fixURL = fixURL;
82182exports.isPrintOnly = isPrintOnly;
82183exports.layoutClass = layoutClass;
82184exports.layoutNode = layoutNode;
82185exports.measureToString = measureToString;
82186exports.setAccess = setAccess;
82187exports.setFontFamily = setFontFamily;
82188exports.setMinMaxDimensions = setMinMaxDimensions;
82189exports.setPara = setPara;
82190exports.toStyle = toStyle;
82191var _symbol_utils = __w_pdfjs_require__(78);
82192var _util = __w_pdfjs_require__(2);
82193var _utils = __w_pdfjs_require__(84);
82194var _fonts = __w_pdfjs_require__(85);
82195var _text = __w_pdfjs_require__(86);
82196var _xfa_object = __w_pdfjs_require__(87);
82197function measureToString(m) {
82198  if (typeof m === "string") {
82199    return "0px";
82200  }
82201  return Number.isInteger(m) ? `${m}px` : `${m.toFixed(2)}px`;
82202}
82203const converters = {
82204  anchorType(node, style) {
82205    const parent = node[_symbol_utils.$getSubformParent]();
82206    if (!parent || parent.layout && parent.layout !== "position") {
82207      return;
82208    }
82209    if (!("transform" in style)) {
82210      style.transform = "";
82211    }
82212    switch (node.anchorType) {
82213      case "bottomCenter":
82214        style.transform += "translate(-50%, -100%)";
82215        break;
82216      case "bottomLeft":
82217        style.transform += "translate(0,-100%)";
82218        break;
82219      case "bottomRight":
82220        style.transform += "translate(-100%,-100%)";
82221        break;
82222      case "middleCenter":
82223        style.transform += "translate(-50%,-50%)";
82224        break;
82225      case "middleLeft":
82226        style.transform += "translate(0,-50%)";
82227        break;
82228      case "middleRight":
82229        style.transform += "translate(-100%,-50%)";
82230        break;
82231      case "topCenter":
82232        style.transform += "translate(-50%,0)";
82233        break;
82234      case "topRight":
82235        style.transform += "translate(-100%,0)";
82236        break;
82237    }
82238  },
82239  dimensions(node, style) {
82240    const parent = node[_symbol_utils.$getSubformParent]();
82241    let width = node.w;
82242    const height = node.h;
82243    if (parent.layout?.includes("row")) {
82244      const extra = parent[_symbol_utils.$extra];
82245      const colSpan = node.colSpan;
82246      let w;
82247      if (colSpan === -1) {
82248        w = extra.columnWidths.slice(extra.currentColumn).reduce((a, x) => a + x, 0);
82249        extra.currentColumn = 0;
82250      } else {
82251        w = extra.columnWidths.slice(extra.currentColumn, extra.currentColumn + colSpan).reduce((a, x) => a + x, 0);
82252        extra.currentColumn = (extra.currentColumn + node.colSpan) % extra.columnWidths.length;
82253      }
82254      if (!isNaN(w)) {
82255        width = node.w = w;
82256      }
82257    }
82258    style.width = width !== "" ? measureToString(width) : "auto";
82259    style.height = height !== "" ? measureToString(height) : "auto";
82260  },
82261  position(node, style) {
82262    const parent = node[_symbol_utils.$getSubformParent]();
82263    if (parent?.layout && parent.layout !== "position") {
82264      return;
82265    }
82266    style.position = "absolute";
82267    style.left = measureToString(node.x);
82268    style.top = measureToString(node.y);
82269  },
82270  rotate(node, style) {
82271    if (node.rotate) {
82272      if (!("transform" in style)) {
82273        style.transform = "";
82274      }
82275      style.transform += `rotate(-${node.rotate}deg)`;
82276      style.transformOrigin = "top left";
82277    }
82278  },
82279  presence(node, style) {
82280    switch (node.presence) {
82281      case "invisible":
82282        style.visibility = "hidden";
82283        break;
82284      case "hidden":
82285      case "inactive":
82286        style.display = "none";
82287        break;
82288    }
82289  },
82290  hAlign(node, style) {
82291    if (node[_symbol_utils.$nodeName] === "para") {
82292      switch (node.hAlign) {
82293        case "justifyAll":
82294          style.textAlign = "justify-all";
82295          break;
82296        case "radix":
82297          style.textAlign = "left";
82298          break;
82299        default:
82300          style.textAlign = node.hAlign;
82301      }
82302    } else {
82303      switch (node.hAlign) {
82304        case "left":
82305          style.alignSelf = "start";
82306          break;
82307        case "center":
82308          style.alignSelf = "center";
82309          break;
82310        case "right":
82311          style.alignSelf = "end";
82312          break;
82313      }
82314    }
82315  },
82316  margin(node, style) {
82317    if (node.margin) {
82318      style.margin = node.margin[_symbol_utils.$toStyle]().margin;
82319    }
82320  }
82321};
82322function setMinMaxDimensions(node, style) {
82323  const parent = node[_symbol_utils.$getSubformParent]();
82324  if (parent.layout === "position") {
82325    if (node.minW > 0) {
82326      style.minWidth = measureToString(node.minW);
82327    }
82328    if (node.maxW > 0) {
82329      style.maxWidth = measureToString(node.maxW);
82330    }
82331    if (node.minH > 0) {
82332      style.minHeight = measureToString(node.minH);
82333    }
82334    if (node.maxH > 0) {
82335      style.maxHeight = measureToString(node.maxH);
82336    }
82337  }
82338}
82339function layoutText(text, xfaFont, margin, lineHeight, fontFinder, width) {
82340  const measure = new _text.TextMeasure(xfaFont, margin, lineHeight, fontFinder);
82341  if (typeof text === "string") {
82342    measure.addString(text);
82343  } else {
82344    text[_symbol_utils.$pushGlyphs](measure);
82345  }
82346  return measure.compute(width);
82347}
82348function layoutNode(node, availableSpace) {
82349  let height = null;
82350  let width = null;
82351  let isBroken = false;
82352  if ((!node.w || !node.h) && node.value) {
82353    let marginH = 0;
82354    let marginV = 0;
82355    if (node.margin) {
82356      marginH = node.margin.leftInset + node.margin.rightInset;
82357      marginV = node.margin.topInset + node.margin.bottomInset;
82358    }
82359    let lineHeight = null;
82360    let margin = null;
82361    if (node.para) {
82362      margin = Object.create(null);
82363      lineHeight = node.para.lineHeight === "" ? null : node.para.lineHeight;
82364      margin.top = node.para.spaceAbove === "" ? 0 : node.para.spaceAbove;
82365      margin.bottom = node.para.spaceBelow === "" ? 0 : node.para.spaceBelow;
82366      margin.left = node.para.marginLeft === "" ? 0 : node.para.marginLeft;
82367      margin.right = node.para.marginRight === "" ? 0 : node.para.marginRight;
82368    }
82369    let font = node.font;
82370    if (!font) {
82371      const root = node[_symbol_utils.$getTemplateRoot]();
82372      let parent = node[_symbol_utils.$getParent]();
82373      while (parent && parent !== root) {
82374        if (parent.font) {
82375          font = parent.font;
82376          break;
82377        }
82378        parent = parent[_symbol_utils.$getParent]();
82379      }
82380    }
82381    const maxWidth = (node.w || availableSpace.width) - marginH;
82382    const fontFinder = node[_symbol_utils.$globalData].fontFinder;
82383    if (node.value.exData && node.value.exData[_symbol_utils.$content] && node.value.exData.contentType === "text/html") {
82384      const res = layoutText(node.value.exData[_symbol_utils.$content], font, margin, lineHeight, fontFinder, maxWidth);
82385      width = res.width;
82386      height = res.height;
82387      isBroken = res.isBroken;
82388    } else {
82389      const text = node.value[_symbol_utils.$text]();
82390      if (text) {
82391        const res = layoutText(text, font, margin, lineHeight, fontFinder, maxWidth);
82392        width = res.width;
82393        height = res.height;
82394        isBroken = res.isBroken;
82395      }
82396    }
82397    if (width !== null && !node.w) {
82398      width += marginH;
82399    }
82400    if (height !== null && !node.h) {
82401      height += marginV;
82402    }
82403  }
82404  return {
82405    w: width,
82406    h: height,
82407    isBroken
82408  };
82409}
82410function computeBbox(node, html, availableSpace) {
82411  let bbox;
82412  if (node.w !== "" && node.h !== "") {
82413    bbox = [node.x, node.y, node.w, node.h];
82414  } else {
82415    if (!availableSpace) {
82416      return null;
82417    }
82418    let width = node.w;
82419    if (width === "") {
82420      if (node.maxW === 0) {
82421        const parent = node[_symbol_utils.$getSubformParent]();
82422        width = parent.layout === "position" && parent.w !== "" ? 0 : node.minW;
82423      } else {
82424        width = Math.min(node.maxW, availableSpace.width);
82425      }
82426      html.attributes.style.width = measureToString(width);
82427    }
82428    let height = node.h;
82429    if (height === "") {
82430      if (node.maxH === 0) {
82431        const parent = node[_symbol_utils.$getSubformParent]();
82432        height = parent.layout === "position" && parent.h !== "" ? 0 : node.minH;
82433      } else {
82434        height = Math.min(node.maxH, availableSpace.height);
82435      }
82436      html.attributes.style.height = measureToString(height);
82437    }
82438    bbox = [node.x, node.y, width, height];
82439  }
82440  return bbox;
82441}
82442function fixDimensions(node) {
82443  const parent = node[_symbol_utils.$getSubformParent]();
82444  if (parent.layout?.includes("row")) {
82445    const extra = parent[_symbol_utils.$extra];
82446    const colSpan = node.colSpan;
82447    let width;
82448    if (colSpan === -1) {
82449      width = extra.columnWidths.slice(extra.currentColumn).reduce((a, w) => a + w, 0);
82450    } else {
82451      width = extra.columnWidths.slice(extra.currentColumn, extra.currentColumn + colSpan).reduce((a, w) => a + w, 0);
82452    }
82453    if (!isNaN(width)) {
82454      node.w = width;
82455    }
82456  }
82457  if (parent.layout && parent.layout !== "position") {
82458    node.x = node.y = 0;
82459  }
82460  if (node.layout === "table") {
82461    if (node.w === "" && Array.isArray(node.columnWidths)) {
82462      node.w = node.columnWidths.reduce((a, x) => a + x, 0);
82463    }
82464  }
82465}
82466function layoutClass(node) {
82467  switch (node.layout) {
82468    case "position":
82469      return "xfaPosition";
82470    case "lr-tb":
82471      return "xfaLrTb";
82472    case "rl-row":
82473      return "xfaRlRow";
82474    case "rl-tb":
82475      return "xfaRlTb";
82476    case "row":
82477      return "xfaRow";
82478    case "table":
82479      return "xfaTable";
82480    case "tb":
82481      return "xfaTb";
82482    default:
82483      return "xfaPosition";
82484  }
82485}
82486function toStyle(node, ...names) {
82487  const style = Object.create(null);
82488  for (const name of names) {
82489    const value = node[name];
82490    if (value === null) {
82491      continue;
82492    }
82493    if (converters.hasOwnProperty(name)) {
82494      converters[name](node, style);
82495      continue;
82496    }
82497    if (value instanceof _xfa_object.XFAObject) {
82498      const newStyle = value[_symbol_utils.$toStyle]();
82499      if (newStyle) {
82500        Object.assign(style, newStyle);
82501      } else {
82502        (0, _util.warn)(`(DEBUG) - XFA - style for ${name} not implemented yet`);
82503      }
82504    }
82505  }
82506  return style;
82507}
82508function createWrapper(node, html) {
82509  const {
82510    attributes
82511  } = html;
82512  const {
82513    style
82514  } = attributes;
82515  const wrapper = {
82516    name: "div",
82517    attributes: {
82518      class: ["xfaWrapper"],
82519      style: Object.create(null)
82520    },
82521    children: []
82522  };
82523  attributes.class.push("xfaWrapped");
82524  if (node.border) {
82525    const {
82526      widths,
82527      insets
82528    } = node.border[_symbol_utils.$extra];
82529    let width, height;
82530    let top = insets[0];
82531    let left = insets[3];
82532    const insetsH = insets[0] + insets[2];
82533    const insetsW = insets[1] + insets[3];
82534    switch (node.border.hand) {
82535      case "even":
82536        top -= widths[0] / 2;
82537        left -= widths[3] / 2;
82538        width = `calc(100% + ${(widths[1] + widths[3]) / 2 - insetsW}px)`;
82539        height = `calc(100% + ${(widths[0] + widths[2]) / 2 - insetsH}px)`;
82540        break;
82541      case "left":
82542        top -= widths[0];
82543        left -= widths[3];
82544        width = `calc(100% + ${widths[1] + widths[3] - insetsW}px)`;
82545        height = `calc(100% + ${widths[0] + widths[2] - insetsH}px)`;
82546        break;
82547      case "right":
82548        width = insetsW ? `calc(100% - ${insetsW}px)` : "100%";
82549        height = insetsH ? `calc(100% - ${insetsH}px)` : "100%";
82550        break;
82551    }
82552    const classNames = ["xfaBorder"];
82553    if (isPrintOnly(node.border)) {
82554      classNames.push("xfaPrintOnly");
82555    }
82556    const border = {
82557      name: "div",
82558      attributes: {
82559        class: classNames,
82560        style: {
82561          top: `${top}px`,
82562          left: `${left}px`,
82563          width,
82564          height
82565        }
82566      },
82567      children: []
82568    };
82569    for (const key of ["border", "borderWidth", "borderColor", "borderRadius", "borderStyle"]) {
82570      if (style[key] !== undefined) {
82571        border.attributes.style[key] = style[key];
82572        delete style[key];
82573      }
82574    }
82575    wrapper.children.push(border, html);
82576  } else {
82577    wrapper.children.push(html);
82578  }
82579  for (const key of ["background", "backgroundClip", "top", "left", "width", "height", "minWidth", "minHeight", "maxWidth", "maxHeight", "transform", "transformOrigin", "visibility"]) {
82580    if (style[key] !== undefined) {
82581      wrapper.attributes.style[key] = style[key];
82582      delete style[key];
82583    }
82584  }
82585  wrapper.attributes.style.position = style.position === "absolute" ? "absolute" : "relative";
82586  delete style.position;
82587  if (style.alignSelf) {
82588    wrapper.attributes.style.alignSelf = style.alignSelf;
82589    delete style.alignSelf;
82590  }
82591  return wrapper;
82592}
82593function fixTextIndent(styles) {
82594  const indent = (0, _utils.getMeasurement)(styles.textIndent, "0px");
82595  if (indent >= 0) {
82596    return;
82597  }
82598  const align = styles.textAlign === "right" ? "right" : "left";
82599  const name = "padding" + (align === "left" ? "Left" : "Right");
82600  const padding = (0, _utils.getMeasurement)(styles[name], "0px");
82601  styles[name] = `${padding - indent}px`;
82602}
82603function setAccess(node, classNames) {
82604  switch (node.access) {
82605    case "nonInteractive":
82606      classNames.push("xfaNonInteractive");
82607      break;
82608    case "readOnly":
82609      classNames.push("xfaReadOnly");
82610      break;
82611    case "protected":
82612      classNames.push("xfaDisabled");
82613      break;
82614  }
82615}
82616function isPrintOnly(node) {
82617  return node.relevant.length > 0 && !node.relevant[0].excluded && node.relevant[0].viewname === "print";
82618}
82619function getCurrentPara(node) {
82620  const stack = node[_symbol_utils.$getTemplateRoot]()[_symbol_utils.$extra].paraStack;
82621  return stack.length ? stack.at(-1) : null;
82622}
82623function setPara(node, nodeStyle, value) {
82624  if (value.attributes.class?.includes("xfaRich")) {
82625    if (nodeStyle) {
82626      if (node.h === "") {
82627        nodeStyle.height = "auto";
82628      }
82629      if (node.w === "") {
82630        nodeStyle.width = "auto";
82631      }
82632    }
82633    const para = getCurrentPara(node);
82634    if (para) {
82635      const valueStyle = value.attributes.style;
82636      valueStyle.display = "flex";
82637      valueStyle.flexDirection = "column";
82638      switch (para.vAlign) {
82639        case "top":
82640          valueStyle.justifyContent = "start";
82641          break;
82642        case "bottom":
82643          valueStyle.justifyContent = "end";
82644          break;
82645        case "middle":
82646          valueStyle.justifyContent = "center";
82647          break;
82648      }
82649      const paraStyle = para[_symbol_utils.$toStyle]();
82650      for (const [key, val] of Object.entries(paraStyle)) {
82651        if (!(key in valueStyle)) {
82652          valueStyle[key] = val;
82653        }
82654      }
82655    }
82656  }
82657}
82658function setFontFamily(xfaFont, node, fontFinder, style) {
82659  if (!fontFinder) {
82660    delete style.fontFamily;
82661    return;
82662  }
82663  const name = (0, _utils.stripQuotes)(xfaFont.typeface);
82664  style.fontFamily = `"${name}"`;
82665  const typeface = fontFinder.find(name);
82666  if (typeface) {
82667    const {
82668      fontFamily
82669    } = typeface.regular.cssFontInfo;
82670    if (fontFamily !== name) {
82671      style.fontFamily = `"${fontFamily}"`;
82672    }
82673    const para = getCurrentPara(node);
82674    if (para && para.lineHeight !== "") {
82675      return;
82676    }
82677    if (style.lineHeight) {
82678      return;
82679    }
82680    const pdfFont = (0, _fonts.selectFont)(xfaFont, typeface);
82681    if (pdfFont) {
82682      style.lineHeight = Math.max(1.2, pdfFont.lineHeight);
82683    }
82684  }
82685}
82686function fixURL(str) {
82687  const absoluteUrl = (0, _util.createValidAbsoluteUrl)(str, null, {
82688    addDefaultProtocol: true,
82689    tryConvertEncoding: true
82690  });
82691  return absoluteUrl ? absoluteUrl.href : null;
82692}
82693
82694/***/ }),
82695/* 84 */
82696/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
82697
82698
82699
82700Object.defineProperty(exports, "__esModule", ({
82701  value: true
82702}));
82703exports.HTMLResult = void 0;
82704exports.getBBox = getBBox;
82705exports.getColor = getColor;
82706exports.getFloat = getFloat;
82707exports.getInteger = getInteger;
82708exports.getKeyword = getKeyword;
82709exports.getMeasurement = getMeasurement;
82710exports.getRatio = getRatio;
82711exports.getRelevant = getRelevant;
82712exports.getStringOption = getStringOption;
82713exports.stripQuotes = stripQuotes;
82714var _util = __w_pdfjs_require__(2);
82715const dimConverters = {
82716  pt: x => x,
82717  cm: x => x / 2.54 * 72,
82718  mm: x => x / (10 * 2.54) * 72,
82719  in: x => x * 72,
82720  px: x => x
82721};
82722const measurementPattern = /([+-]?\d+\.?\d*)(.*)/;
82723function stripQuotes(str) {
82724  if (str.startsWith("'") || str.startsWith('"')) {
82725    return str.slice(1, -1);
82726  }
82727  return str;
82728}
82729function getInteger({
82730  data,
82731  defaultValue,
82732  validate
82733}) {
82734  if (!data) {
82735    return defaultValue;
82736  }
82737  data = data.trim();
82738  const n = parseInt(data, 10);
82739  if (!isNaN(n) && validate(n)) {
82740    return n;
82741  }
82742  return defaultValue;
82743}
82744function getFloat({
82745  data,
82746  defaultValue,
82747  validate
82748}) {
82749  if (!data) {
82750    return defaultValue;
82751  }
82752  data = data.trim();
82753  const n = parseFloat(data);
82754  if (!isNaN(n) && validate(n)) {
82755    return n;
82756  }
82757  return defaultValue;
82758}
82759function getKeyword({
82760  data,
82761  defaultValue,
82762  validate
82763}) {
82764  if (!data) {
82765    return defaultValue;
82766  }
82767  data = data.trim();
82768  if (validate(data)) {
82769    return data;
82770  }
82771  return defaultValue;
82772}
82773function getStringOption(data, options) {
82774  return getKeyword({
82775    data,
82776    defaultValue: options[0],
82777    validate: k => options.includes(k)
82778  });
82779}
82780function getMeasurement(str, def = "0") {
82781  def ||= "0";
82782  if (!str) {
82783    return getMeasurement(def);
82784  }
82785  const match = str.trim().match(measurementPattern);
82786  if (!match) {
82787    return getMeasurement(def);
82788  }
82789  const [, valueStr, unit] = match;
82790  const value = parseFloat(valueStr);
82791  if (isNaN(value)) {
82792    return getMeasurement(def);
82793  }
82794  if (value === 0) {
82795    return 0;
82796  }
82797  const conv = dimConverters[unit];
82798  if (conv) {
82799    return conv(value);
82800  }
82801  return value;
82802}
82803function getRatio(data) {
82804  if (!data) {
82805    return {
82806      num: 1,
82807      den: 1
82808    };
82809  }
82810  const ratio = data.trim().split(/\s*:\s*/).map(x => parseFloat(x)).filter(x => !isNaN(x));
82811  if (ratio.length === 1) {
82812    ratio.push(1);
82813  }
82814  if (ratio.length === 0) {
82815    return {
82816      num: 1,
82817      den: 1
82818    };
82819  }
82820  const [num, den] = ratio;
82821  return {
82822    num,
82823    den
82824  };
82825}
82826function getRelevant(data) {
82827  if (!data) {
82828    return [];
82829  }
82830  return data.trim().split(/\s+/).map(e => {
82831    return {
82832      excluded: e[0] === "-",
82833      viewname: e.substring(1)
82834    };
82835  });
82836}
82837function getColor(data, def = [0, 0, 0]) {
82838  let [r, g, b] = def;
82839  if (!data) {
82840    return {
82841      r,
82842      g,
82843      b
82844    };
82845  }
82846  const color = data.trim().split(/\s*,\s*/).map(c => Math.min(Math.max(0, parseInt(c.trim(), 10)), 255)).map(c => isNaN(c) ? 0 : c);
82847  if (color.length < 3) {
82848    return {
82849      r,
82850      g,
82851      b
82852    };
82853  }
82854  [r, g, b] = color;
82855  return {
82856    r,
82857    g,
82858    b
82859  };
82860}
82861function getBBox(data) {
82862  const def = -1;
82863  if (!data) {
82864    return {
82865      x: def,
82866      y: def,
82867      width: def,
82868      height: def
82869    };
82870  }
82871  const bbox = data.trim().split(/\s*,\s*/).map(m => getMeasurement(m, "-1"));
82872  if (bbox.length < 4 || bbox[2] < 0 || bbox[3] < 0) {
82873    return {
82874      x: def,
82875      y: def,
82876      width: def,
82877      height: def
82878    };
82879  }
82880  const [x, y, width, height] = bbox;
82881  return {
82882    x,
82883    y,
82884    width,
82885    height
82886  };
82887}
82888class HTMLResult {
82889  static get FAILURE() {
82890    return (0, _util.shadow)(this, "FAILURE", new HTMLResult(false, null, null, null));
82891  }
82892  static get EMPTY() {
82893    return (0, _util.shadow)(this, "EMPTY", new HTMLResult(true, null, null, null));
82894  }
82895  constructor(success, html, bbox, breakNode) {
82896    this.success = success;
82897    this.html = html;
82898    this.bbox = bbox;
82899    this.breakNode = breakNode;
82900  }
82901  isBreak() {
82902    return !!this.breakNode;
82903  }
82904  static breakNode(node) {
82905    return new HTMLResult(false, null, null, node);
82906  }
82907  static success(html, bbox = null) {
82908    return new HTMLResult(true, html, bbox, null);
82909  }
82910}
82911exports.HTMLResult = HTMLResult;
82912
82913/***/ }),
82914/* 85 */
82915/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
82916
82917
82918
82919Object.defineProperty(exports, "__esModule", ({
82920  value: true
82921}));
82922exports.FontFinder = void 0;
82923exports.getMetrics = getMetrics;
82924exports.selectFont = selectFont;
82925var _symbol_utils = __w_pdfjs_require__(78);
82926var _utils = __w_pdfjs_require__(84);
82927var _util = __w_pdfjs_require__(2);
82928class FontFinder {
82929  constructor(pdfFonts) {
82930    this.fonts = new Map();
82931    this.cache = new Map();
82932    this.warned = new Set();
82933    this.defaultFont = null;
82934    this.add(pdfFonts);
82935  }
82936  add(pdfFonts, reallyMissingFonts = null) {
82937    for (const pdfFont of pdfFonts) {
82938      this.addPdfFont(pdfFont);
82939    }
82940    for (const pdfFont of this.fonts.values()) {
82941      if (!pdfFont.regular) {
82942        pdfFont.regular = pdfFont.italic || pdfFont.bold || pdfFont.bolditalic;
82943      }
82944    }
82945    if (!reallyMissingFonts || reallyMissingFonts.size === 0) {
82946      return;
82947    }
82948    const myriad = this.fonts.get("PdfJS-Fallback-PdfJS-XFA");
82949    for (const missing of reallyMissingFonts) {
82950      this.fonts.set(missing, myriad);
82951    }
82952  }
82953  addPdfFont(pdfFont) {
82954    const cssFontInfo = pdfFont.cssFontInfo;
82955    const name = cssFontInfo.fontFamily;
82956    let font = this.fonts.get(name);
82957    if (!font) {
82958      font = Object.create(null);
82959      this.fonts.set(name, font);
82960      if (!this.defaultFont) {
82961        this.defaultFont = font;
82962      }
82963    }
82964    let property = "";
82965    const fontWeight = parseFloat(cssFontInfo.fontWeight);
82966    if (parseFloat(cssFontInfo.italicAngle) !== 0) {
82967      property = fontWeight >= 700 ? "bolditalic" : "italic";
82968    } else if (fontWeight >= 700) {
82969      property = "bold";
82970    }
82971    if (!property) {
82972      if (pdfFont.name.includes("Bold") || pdfFont.psName?.includes("Bold")) {
82973        property = "bold";
82974      }
82975      if (pdfFont.name.includes("Italic") || pdfFont.name.endsWith("It") || pdfFont.psName?.includes("Italic") || pdfFont.psName?.endsWith("It")) {
82976        property += "italic";
82977      }
82978    }
82979    if (!property) {
82980      property = "regular";
82981    }
82982    font[property] = pdfFont;
82983  }
82984  getDefault() {
82985    return this.defaultFont;
82986  }
82987  find(fontName, mustWarn = true) {
82988    let font = this.fonts.get(fontName) || this.cache.get(fontName);
82989    if (font) {
82990      return font;
82991    }
82992    const pattern = /,|-|_| |bolditalic|bold|italic|regular|it/gi;
82993    let name = fontName.replaceAll(pattern, "");
82994    font = this.fonts.get(name);
82995    if (font) {
82996      this.cache.set(fontName, font);
82997      return font;
82998    }
82999    name = name.toLowerCase();
83000    const maybe = [];
83001    for (const [family, pdfFont] of this.fonts.entries()) {
83002      if (family.replaceAll(pattern, "").toLowerCase().startsWith(name)) {
83003        maybe.push(pdfFont);
83004      }
83005    }
83006    if (maybe.length === 0) {
83007      for (const [, pdfFont] of this.fonts.entries()) {
83008        if (pdfFont.regular.name?.replaceAll(pattern, "").toLowerCase().startsWith(name)) {
83009          maybe.push(pdfFont);
83010        }
83011      }
83012    }
83013    if (maybe.length === 0) {
83014      name = name.replaceAll(/psmt|mt/gi, "");
83015      for (const [family, pdfFont] of this.fonts.entries()) {
83016        if (family.replaceAll(pattern, "").toLowerCase().startsWith(name)) {
83017          maybe.push(pdfFont);
83018        }
83019      }
83020    }
83021    if (maybe.length === 0) {
83022      for (const pdfFont of this.fonts.values()) {
83023        if (pdfFont.regular.name?.replaceAll(pattern, "").toLowerCase().startsWith(name)) {
83024          maybe.push(pdfFont);
83025        }
83026      }
83027    }
83028    if (maybe.length >= 1) {
83029      if (maybe.length !== 1 && mustWarn) {
83030        (0, _util.warn)(`XFA - Too many choices to guess the correct font: ${fontName}`);
83031      }
83032      this.cache.set(fontName, maybe[0]);
83033      return maybe[0];
83034    }
83035    if (mustWarn && !this.warned.has(fontName)) {
83036      this.warned.add(fontName);
83037      (0, _util.warn)(`XFA - Cannot find the font: ${fontName}`);
83038    }
83039    return null;
83040  }
83041}
83042exports.FontFinder = FontFinder;
83043function selectFont(xfaFont, typeface) {
83044  if (xfaFont.posture === "italic") {
83045    if (xfaFont.weight === "bold") {
83046      return typeface.bolditalic;
83047    }
83048    return typeface.italic;
83049  } else if (xfaFont.weight === "bold") {
83050    return typeface.bold;
83051  }
83052  return typeface.regular;
83053}
83054function getMetrics(xfaFont, real = false) {
83055  let pdfFont = null;
83056  if (xfaFont) {
83057    const name = (0, _utils.stripQuotes)(xfaFont.typeface);
83058    const typeface = xfaFont[_symbol_utils.$globalData].fontFinder.find(name);
83059    pdfFont = selectFont(xfaFont, typeface);
83060  }
83061  if (!pdfFont) {
83062    return {
83063      lineHeight: 12,
83064      lineGap: 2,
83065      lineNoGap: 10
83066    };
83067  }
83068  const size = xfaFont.size || 10;
83069  const lineHeight = pdfFont.lineHeight ? Math.max(real ? 0 : 1.2, pdfFont.lineHeight) : 1.2;
83070  const lineGap = pdfFont.lineGap === undefined ? 0.2 : pdfFont.lineGap;
83071  return {
83072    lineHeight: lineHeight * size,
83073    lineGap: lineGap * size,
83074    lineNoGap: Math.max(1, lineHeight - lineGap) * size
83075  };
83076}
83077
83078/***/ }),
83079/* 86 */
83080/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
83081
83082
83083
83084Object.defineProperty(exports, "__esModule", ({
83085  value: true
83086}));
83087exports.TextMeasure = void 0;
83088var _fonts = __w_pdfjs_require__(85);
83089const WIDTH_FACTOR = 1.02;
83090class FontInfo {
83091  constructor(xfaFont, margin, lineHeight, fontFinder) {
83092    this.lineHeight = lineHeight;
83093    this.paraMargin = margin || {
83094      top: 0,
83095      bottom: 0,
83096      left: 0,
83097      right: 0
83098    };
83099    if (!xfaFont) {
vendor: 4,482 bytes, lines 83100-83233
83100      [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
83101      return;
83102    }
83103    this.xfaFont = {
83104      typeface: xfaFont.typeface,
83105      posture: xfaFont.posture,
83106      weight: xfaFont.weight,
83107      size: xfaFont.size,
83108      letterSpacing: xfaFont.letterSpacing
83109    };
83110    const typeface = fontFinder.find(xfaFont.typeface);
83111    if (!typeface) {
83112      [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
83113      return;
83114    }
83115    this.pdfFont = (0, _fonts.selectFont)(xfaFont, typeface);
83116    if (!this.pdfFont) {
83117      [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
83118    }
83119  }
83120  defaultFont(fontFinder) {
83121    const font = fontFinder.find("Helvetica", false) || fontFinder.find("Myriad Pro", false) || fontFinder.find("Arial", false) || fontFinder.getDefault();
83122    if (font?.regular) {
83123      const pdfFont = font.regular;
83124      const info = pdfFont.cssFontInfo;
83125      const xfaFont = {
83126        typeface: info.fontFamily,
83127        posture: "normal",
83128        weight: "normal",
83129        size: 10,
83130        letterSpacing: 0
83131      };
83132      return [pdfFont, xfaFont];
83133    }
83134    const xfaFont = {
83135      typeface: "Courier",
83136      posture: "normal",
83137      weight: "normal",
83138      size: 10,
83139      letterSpacing: 0
83140    };
83141    return [null, xfaFont];
83142  }
83143}
83144class FontSelector {
83145  constructor(defaultXfaFont, defaultParaMargin, defaultLineHeight, fontFinder) {
83146    this.fontFinder = fontFinder;
83147    this.stack = [new FontInfo(defaultXfaFont, defaultParaMargin, defaultLineHeight, fontFinder)];
83148  }
83149  pushData(xfaFont, margin, lineHeight) {
83150    const lastFont = this.stack.at(-1);
83151    for (const name of ["typeface", "posture", "weight", "size", "letterSpacing"]) {
83152      if (!xfaFont[name]) {
83153        xfaFont[name] = lastFont.xfaFont[name];
83154      }
83155    }
83156    for (const name of ["top", "bottom", "left", "right"]) {
83157      if (isNaN(margin[name])) {
83158        margin[name] = lastFont.paraMargin[name];
83159      }
83160    }
83161    const fontInfo = new FontInfo(xfaFont, margin, lineHeight || lastFont.lineHeight, this.fontFinder);
83162    if (!fontInfo.pdfFont) {
83163      fontInfo.pdfFont = lastFont.pdfFont;
83164    }
83165    this.stack.push(fontInfo);
83166  }
83167  popFont() {
83168    this.stack.pop();
83169  }
83170  topFont() {
83171    return this.stack.at(-1);
83172  }
83173}
83174class TextMeasure {
83175  constructor(defaultXfaFont, defaultParaMargin, defaultLineHeight, fonts) {
83176    this.glyphs = [];
83177    this.fontSelector = new FontSelector(defaultXfaFont, defaultParaMargin, defaultLineHeight, fonts);
83178    this.extraHeight = 0;
83179  }
83180  pushData(xfaFont, margin, lineHeight) {
83181    this.fontSelector.pushData(xfaFont, margin, lineHeight);
83182  }
83183  popFont(xfaFont) {
83184    return this.fontSelector.popFont();
83185  }
83186  addPara() {
83187    const lastFont = this.fontSelector.topFont();
83188    this.extraHeight += lastFont.paraMargin.top + lastFont.paraMargin.bottom;
83189  }
83190  addString(str) {
83191    if (!str) {
83192      return;
83193    }
83194    const lastFont = this.fontSelector.topFont();
83195    const fontSize = lastFont.xfaFont.size;
83196    if (lastFont.pdfFont) {
83197      const letterSpacing = lastFont.xfaFont.letterSpacing;
83198      const pdfFont = lastFont.pdfFont;
83199      const fontLineHeight = pdfFont.lineHeight || 1.2;
83200      const lineHeight = lastFont.lineHeight || Math.max(1.2, fontLineHeight) * fontSize;
83201      const lineGap = pdfFont.lineGap === undefined ? 0.2 : pdfFont.lineGap;
83202      const noGap = fontLineHeight - lineGap;
83203      const firstLineHeight = Math.max(1, noGap) * fontSize;
83204      const scale = fontSize / 1000;
83205      const fallbackWidth = pdfFont.defaultWidth || pdfFont.charsToGlyphs(" ")[0].width;
83206      for (const line of str.split(/[\u2029\n]/)) {
83207        const encodedLine = pdfFont.encodeString(line).join("");
83208        const glyphs = pdfFont.charsToGlyphs(encodedLine);
83209        for (const glyph of glyphs) {
83210          const width = glyph.width || fallbackWidth;
83211          this.glyphs.push([width * scale + letterSpacing, lineHeight, firstLineHeight, glyph.unicode, false]);
83212        }
83213        this.glyphs.push([0, 0, 0, "\n", true]);
83214      }
83215      this.glyphs.pop();
83216      return;
83217    }
83218    for (const line of str.split(/[\u2029\n]/)) {
83219      for (const char of line.split("")) {
83220        this.glyphs.push([fontSize, 1.2 * fontSize, fontSize, char, false]);
83221      }
83222      this.glyphs.push([0, 0, 0, "\n", true]);
83223    }
83224    this.glyphs.pop();
83225  }
83226  compute(maxWidth) {
83227    let lastSpacePos = -1,
83228      lastSpaceWidth = 0,
83229      width = 0,
83230      height = 0,
83231      currentLineWidth = 0,
83232      currentLineHeight = 0;
83233    let isBroken = false;
83234    let isFirstLine = true;
83235    for (let i = 0, ii = this.glyphs.length; i < ii; i++) {
83236      const [glyphWidth, lineHeight, firstLineHeight, char, isEOL] = this.glyphs[i];
83237      const isSpace = char === " ";
83238      const glyphHeight = isFirstLine ? firstLineHeight : lineHeight;
83239      if (isEOL) {
83240        width = Math.max(width, currentLineWidth);
83241        currentLineWidth = 0;
83242        height += currentLineHeight;
83243        currentLineHeight = glyphHeight;
83244        lastSpacePos = -1;
83245        lastSpaceWidth = 0;
83246        isFirstLine = false;
83247        continue;
83248      }
83249      if (isSpace) {
83250        if (currentLineWidth + glyphWidth > maxWidth) {
83251          width = Math.max(width, currentLineWidth);
83252          currentLineWidth = 0;
83253          height += currentLineHeight;
83254          currentLineHeight = glyphHeight;
83255          lastSpacePos = -1;
83256          lastSpaceWidth = 0;
83257          isBroken = true;
83258          isFirstLine = false;
83259        } else {
83260          currentLineHeight = Math.max(glyphHeight, currentLineHeight);
83261          lastSpaceWidth = currentLineWidth;
83262          currentLineWidth += glyphWidth;
83263          lastSpacePos = i;
83264        }
83265        continue;
83266      }
83267      if (currentLineWidth + glyphWidth > maxWidth) {
83268        height += currentLineHeight;
83269        currentLineHeight = glyphHeight;
83270        if (lastSpacePos !== -1) {
83271          i = lastSpacePos;
83272          width = Math.max(width, lastSpaceWidth);
83273          currentLineWidth = 0;
83274          lastSpacePos = -1;
83275          lastSpaceWidth = 0;
83276        } else {
83277          width = Math.max(width, currentLineWidth);
83278          currentLineWidth = glyphWidth;
83279        }
83280        isBroken = true;
83281        isFirstLine = false;
83282        continue;
83283      }
83284      currentLineWidth += glyphWidth;
83285      currentLineHeight = Math.max(glyphHeight, currentLineHeight);
83286    }
83287    width = Math.max(width, currentLineWidth);
83288    height += currentLineHeight + this.extraHeight;
83289    return {
83290      width: WIDTH_FACTOR * width,
83291      height,
83292      isBroken
83293    };
83294  }
83295}
83296exports.TextMeasure = TextMeasure;
83297
83298/***/ }),
83299/* 87 */
83300/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
83301
83302
83303
83304Object.defineProperty(exports, "__esModule", ({
83305  value: true
83306}));
83307exports.XmlObject = exports.XFAObjectArray = exports.XFAObject = exports.XFAAttribute = exports.StringObject = exports.OptionObject = exports.Option10 = exports.Option01 = exports.IntegerObject = exports.ContentObject = void 0;
83308var _symbol_utils = __w_pdfjs_require__(78);
83309var _utils = __w_pdfjs_require__(84);
83310var _util = __w_pdfjs_require__(2);
83311var _core_utils = __w_pdfjs_require__(3);
83312var _namespaces = __w_pdfjs_require__(81);
83313var _som = __w_pdfjs_require__(88);
83314const _applyPrototype = Symbol();
83315const _attributes = Symbol();
83316const _attributeNames = Symbol();
83317const _children = Symbol("_children");
83318const _cloneAttribute = Symbol();
83319const _dataValue = Symbol();
83320const _defaultValue = Symbol();
83321const _filteredChildrenGenerator = Symbol();
83322const _getPrototype = Symbol();
83323const _getUnsetAttributes = Symbol();
83324const _hasChildren = Symbol();
83325const _max = Symbol();
83326const _options = Symbol();
83327const _parent = Symbol("parent");
83328const _resolvePrototypesHelper = Symbol();
83329const _setAttributes = Symbol();
83330const _validator = Symbol();
83331let uid = 0;
83332const NS_DATASETS = _namespaces.NamespaceIds.datasets.id;
83333class XFAObject {
83334  constructor(nsId, name, hasChildren = false) {
83335    this[_symbol_utils.$namespaceId] = nsId;
83336    this[_symbol_utils.$nodeName] = name;
83337    this[_hasChildren] = hasChildren;
83338    this[_parent] = null;
83339    this[_children] = [];
83340    this[_symbol_utils.$uid] = `${name}${uid++}`;
83341    this[_symbol_utils.$globalData] = null;
83342  }
83343  get isXFAObject() {
83344    return true;
83345  }
83346  get isXFAObjectArray() {
83347    return false;
83348  }
83349  createNodes(path) {
83350    let root = this,
83351      node = null;
83352    for (const {
83353      name,
83354      index
83355    } of path) {
83356      for (let i = 0, ii = isFinite(index) ? index : 0; i <= ii; i++) {
83357        const nsId = root[_symbol_utils.$namespaceId] === NS_DATASETS ? -1 : root[_symbol_utils.$namespaceId];
83358        node = new XmlObject(nsId, name);
83359        root[_symbol_utils.$appendChild](node);
83360      }
83361      root = node;
83362    }
83363    return node;
83364  }
83365  [_symbol_utils.$onChild](child) {
83366    if (!this[_hasChildren] || !this[_symbol_utils.$onChildCheck](child)) {
83367      return false;
83368    }
83369    const name = child[_symbol_utils.$nodeName];
83370    const node = this[name];
83371    if (node instanceof XFAObjectArray) {
83372      if (node.push(child)) {
83373        this[_symbol_utils.$appendChild](child);
83374        return true;
83375      }
83376    } else {
83377      if (node !== null) {
83378        this[_symbol_utils.$removeChild](node);
83379      }
83380      this[name] = child;
83381      this[_symbol_utils.$appendChild](child);
83382      return true;
83383    }
83384    let id = "";
83385    if (this.id) {
83386      id = ` (id: ${this.id})`;
83387    } else if (this.name) {
83388      id = ` (name: ${this.name} ${this.h.value})`;
83389    }
83390    (0, _util.warn)(`XFA - node "${this[_symbol_utils.$nodeName]}"${id} has already enough "${name}"!`);
83391    return false;
83392  }
83393  [_symbol_utils.$onChildCheck](child) {
83394    return this.hasOwnProperty(child[_symbol_utils.$nodeName]) && child[_symbol_utils.$namespaceId] === this[_symbol_utils.$namespaceId];
83395  }
83396  [_symbol_utils.$isNsAgnostic]() {
83397    return false;
83398  }
83399  [_symbol_utils.$acceptWhitespace]() {
83400    return false;
83401  }
83402  [_symbol_utils.$isCDATAXml]() {
83403    return false;
83404  }
83405  [_symbol_utils.$isBindable]() {
83406    return false;
83407  }
83408  [_symbol_utils.$popPara]() {
83409    if (this.para) {
83410      this[_symbol_utils.$getTemplateRoot]()[_symbol_utils.$extra].paraStack.pop();
83411    }
83412  }
83413  [_symbol_utils.$pushPara]() {
83414    this[_symbol_utils.$getTemplateRoot]()[_symbol_utils.$extra].paraStack.push(this.para);
83415  }
83416  [_symbol_utils.$setId](ids) {
83417    if (this.id && this[_symbol_utils.$namespaceId] === _namespaces.NamespaceIds.template.id) {
83418      ids.set(this.id, this);
83419    }
83420  }
83421  [_symbol_utils.$getTemplateRoot]() {
83422    return this[_symbol_utils.$globalData].template;
83423  }
83424  [_symbol_utils.$isSplittable]() {
83425    return false;
83426  }
83427  [_symbol_utils.$isThereMoreWidth]() {
83428    return false;
83429  }
83430  [_symbol_utils.$appendChild](child) {
83431    child[_parent] = this;
83432    this[_children].push(child);
83433    if (!child[_symbol_utils.$globalData] && this[_symbol_utils.$globalData]) {
83434      child[_symbol_utils.$globalData] = this[_symbol_utils.$globalData];
83435    }
83436  }
83437  [_symbol_utils.$removeChild](child) {
83438    const i = this[_children].indexOf(child);
83439    this[_children].splice(i, 1);
83440  }
83441  [_symbol_utils.$hasSettableValue]() {
83442    return this.hasOwnProperty("value");
83443  }
83444  [_symbol_utils.$setValue](_) {}
83445  [_symbol_utils.$onText](_) {}
83446  [_symbol_utils.$finalize]() {}
83447  [_symbol_utils.$clean](builder) {
83448    delete this[_hasChildren];
83449    if (this[_symbol_utils.$cleanup]) {
83450      builder.clean(this[_symbol_utils.$cleanup]);
83451      delete this[_symbol_utils.$cleanup];
83452    }
83453  }
83454  [_symbol_utils.$indexOf](child) {
83455    return this[_children].indexOf(child);
83456  }
83457  [_symbol_utils.$insertAt](i, child) {
83458    child[_parent] = this;
83459    this[_children].splice(i, 0, child);
83460    if (!child[_symbol_utils.$globalData] && this[_symbol_utils.$globalData]) {
83461      child[_symbol_utils.$globalData] = this[_symbol_utils.$globalData];
83462    }
83463  }
83464  [_symbol_utils.$isTransparent]() {
83465    return !this.name;
83466  }
83467  [_symbol_utils.$lastAttribute]() {
83468    return "";
83469  }
83470  [_symbol_utils.$text]() {
83471    if (this[_children].length === 0) {
83472      return this[_symbol_utils.$content];
83473    }
83474    return this[_children].map(c => c[_symbol_utils.$text]()).join("");
83475  }
83476  get [_attributeNames]() {
83477    const proto = Object.getPrototypeOf(this);
83478    if (!proto._attributes) {
83479      const attributes = proto._attributes = new Set();
83480      for (const name of Object.getOwnPropertyNames(this)) {
83481        if (this[name] === null || this[name] instanceof XFAObject || this[name] instanceof XFAObjectArray) {
83482          break;
83483        }
83484        attributes.add(name);
83485      }
83486    }
83487    return (0, _util.shadow)(this, _attributeNames, proto._attributes);
83488  }
83489  [_symbol_utils.$isDescendent](parent) {
83490    let node = this;
83491    while (node) {
83492      if (node === parent) {
83493        return true;
83494      }
83495      node = node[_symbol_utils.$getParent]();
83496    }
83497    return false;
83498  }
83499  [_symbol_utils.$getParent]() {
83500    return this[_parent];
83501  }
83502  [_symbol_utils.$getSubformParent]() {
83503    return this[_symbol_utils.$getParent]();
83504  }
83505  [_symbol_utils.$getChildren](name = null) {
83506    if (!name) {
83507      return this[_children];
83508    }
83509    return this[name];
83510  }
83511  [_symbol_utils.$dump]() {
83512    const dumped = Object.create(null);
83513    if (this[_symbol_utils.$content]) {
83514      dumped.$content = this[_symbol_utils.$content];
83515    }
83516    for (const name of Object.getOwnPropertyNames(this)) {
83517      const value = this[name];
83518      if (value === null) {
83519        continue;
83520      }
83521      if (value instanceof XFAObject) {
83522        dumped[name] = value[_symbol_utils.$dump]();
83523      } else if (value instanceof XFAObjectArray) {
83524        if (!value.isEmpty()) {
83525          dumped[name] = value.dump();
83526        }
83527      } else {
83528        dumped[name] = value;
83529      }
83530    }
83531    return dumped;
83532  }
83533  [_symbol_utils.$toStyle]() {
83534    return null;
83535  }
83536  [_symbol_utils.$toHTML]() {
83537    return _utils.HTMLResult.EMPTY;
83538  }
83539  *[_symbol_utils.$getContainedChildren]() {
83540    for (const node of this[_symbol_utils.$getChildren]()) {
83541      yield node;
83542    }
83543  }
83544  *[_filteredChildrenGenerator](filter, include) {
83545    for (const node of this[_symbol_utils.$getContainedChildren]()) {
83546      if (!filter || include === filter.has(node[_symbol_utils.$nodeName])) {
83547        const availableSpace = this[_symbol_utils.$getAvailableSpace]();
83548        const res = node[_symbol_utils.$toHTML](availableSpace);
83549        if (!res.success) {
83550          this[_symbol_utils.$extra].failingNode = node;
83551        }
83552        yield res;
83553      }
83554    }
83555  }
83556  [_symbol_utils.$flushHTML]() {
83557    return null;
83558  }
83559  [_symbol_utils.$addHTML](html, bbox) {
83560    this[_symbol_utils.$extra].children.push(html);
83561  }
83562  [_symbol_utils.$getAvailableSpace]() {}
83563  [_symbol_utils.$childrenToHTML]({
83564    filter = null,
83565    include = true
83566  }) {
83567    if (!this[_symbol_utils.$extra].generator) {
83568      this[_symbol_utils.$extra].generator = this[_filteredChildrenGenerator](filter, include);
83569    } else {
83570      const availableSpace = this[_symbol_utils.$getAvailableSpace]();
83571      const res = this[_symbol_utils.$extra].failingNode[_symbol_utils.$toHTML](availableSpace);
83572      if (!res.success) {
83573        return res;
83574      }
83575      if (res.html) {
83576        this[_symbol_utils.$addHTML](res.html, res.bbox);
83577      }
83578      delete this[_symbol_utils.$extra].failingNode;
83579    }
83580    while (true) {
83581      const gen = this[_symbol_utils.$extra].generator.next();
83582      if (gen.done) {
83583        break;
83584      }
83585      const res = gen.value;
83586      if (!res.success) {
83587        return res;
83588      }
83589      if (res.html) {
83590        this[_symbol_utils.$addHTML](res.html, res.bbox);
83591      }
83592    }
83593    this[_symbol_utils.$extra].generator = null;
83594    return _utils.HTMLResult.EMPTY;
83595  }
83596  [_symbol_utils.$setSetAttributes](attributes) {
83597    this[_setAttributes] = new Set(Object.keys(attributes));
83598  }
83599  [_getUnsetAttributes](protoAttributes) {
83600    const allAttr = this[_attributeNames];
83601    const setAttr = this[_setAttributes];
83602    return [...protoAttributes].filter(x => allAttr.has(x) && !setAttr.has(x));
83603  }
83604  [_symbol_utils.$resolvePrototypes](ids, ancestors = new Set()) {
83605    for (const child of this[_children]) {
83606      child[_resolvePrototypesHelper](ids, ancestors);
83607    }
83608  }
83609  [_resolvePrototypesHelper](ids, ancestors) {
83610    const proto = this[_getPrototype](ids, ancestors);
83611    if (proto) {
83612      this[_applyPrototype](proto, ids, ancestors);
83613    } else {
83614      this[_symbol_utils.$resolvePrototypes](ids, ancestors);
83615    }
83616  }
83617  [_getPrototype](ids, ancestors) {
83618    const {
83619      use,
83620      usehref
83621    } = this;
83622    if (!use && !usehref) {
83623      return null;
83624    }
83625    let proto = null;
83626    let somExpression = null;
83627    let id = null;
83628    let ref = use;
83629    if (usehref) {
83630      ref = usehref;
83631      if (usehref.startsWith("#som(") && usehref.endsWith(")")) {
83632        somExpression = usehref.slice("#som(".length, -1);
83633      } else if (usehref.startsWith(".#som(") && usehref.endsWith(")")) {
83634        somExpression = usehref.slice(".#som(".length, -1);
83635      } else if (usehref.startsWith("#")) {
83636        id = usehref.slice(1);
83637      } else if (usehref.startsWith(".#")) {
83638        id = usehref.slice(2);
83639      }
83640    } else if (use.startsWith("#")) {
83641      id = use.slice(1);
83642    } else {
83643      somExpression = use;
83644    }
83645    this.use = this.usehref = "";
83646    if (id) {
83647      proto = ids.get(id);
83648    } else {
83649      proto = (0, _som.searchNode)(ids.get(_symbol_utils.$root), this, somExpression, true, false);
83650      if (proto) {
83651        proto = proto[0];
83652      }
83653    }
83654    if (!proto) {
83655      (0, _util.warn)(`XFA - Invalid prototype reference: ${ref}.`);
83656      return null;
83657    }
83658    if (proto[_symbol_utils.$nodeName] !== this[_symbol_utils.$nodeName]) {
83659      (0, _util.warn)(`XFA - Incompatible prototype: ${proto[_symbol_utils.$nodeName]} !== ${this[_symbol_utils.$nodeName]}.`);
83660      return null;
83661    }
83662    if (ancestors.has(proto)) {
83663      (0, _util.warn)(`XFA - Cycle detected in prototypes use.`);
83664      return null;
83665    }
83666    ancestors.add(proto);
83667    const protoProto = proto[_getPrototype](ids, ancestors);
83668    if (protoProto) {
83669      proto[_applyPrototype](protoProto, ids, ancestors);
83670    }
83671    proto[_symbol_utils.$resolvePrototypes](ids, ancestors);
83672    ancestors.delete(proto);
83673    return proto;
83674  }
83675  [_applyPrototype](proto, ids, ancestors) {
83676    if (ancestors.has(proto)) {
83677      (0, _util.warn)(`XFA - Cycle detected in prototypes use.`);
83678      return;
83679    }
83680    if (!this[_symbol_utils.$content] && proto[_symbol_utils.$content]) {
83681      this[_symbol_utils.$content] = proto[_symbol_utils.$content];
83682    }
83683    const newAncestors = new Set(ancestors);
83684    newAncestors.add(proto);
83685    for (const unsetAttrName of this[_getUnsetAttributes](proto[_setAttributes])) {
83686      this[unsetAttrName] = proto[unsetAttrName];
83687      if (this[_setAttributes]) {
83688        this[_setAttributes].add(unsetAttrName);
83689      }
83690    }
83691    for (const name of Object.getOwnPropertyNames(this)) {
83692      if (this[_attributeNames].has(name)) {
83693        continue;
83694      }
83695      const value = this[name];
83696      const protoValue = proto[name];
83697      if (value instanceof XFAObjectArray) {
83698        for (const child of value[_children]) {
83699          child[_resolvePrototypesHelper](ids, ancestors);
83700        }
83701        for (let i = value[_children].length, ii = protoValue[_children].length; i < ii; i++) {
83702          const child = proto[_children][i][_symbol_utils.$clone]();
83703          if (value.push(child)) {
83704            child[_parent] = this;
83705            this[_children].push(child);
83706            child[_resolvePrototypesHelper](ids, ancestors);
83707          } else {
83708            break;
83709          }
83710        }
83711        continue;
83712      }
83713      if (value !== null) {
83714        value[_symbol_utils.$resolvePrototypes](ids, ancestors);
83715        if (protoValue) {
83716          value[_applyPrototype](protoValue, ids, ancestors);
83717        }
83718        continue;
83719      }
83720      if (protoValue !== null) {
83721        const child = protoValue[_symbol_utils.$clone]();
83722        child[_parent] = this;
83723        this[name] = child;
83724        this[_children].push(child);
83725        child[_resolvePrototypesHelper](ids, ancestors);
83726      }
83727    }
83728  }
83729  static [_cloneAttribute](obj) {
83730    if (Array.isArray(obj)) {
83731      return obj.map(x => XFAObject[_cloneAttribute](x));
83732    }
83733    if (typeof obj === "object" && obj !== null) {
83734      return Object.assign({}, obj);
83735    }
83736    return obj;
83737  }
83738  [_symbol_utils.$clone]() {
83739    const clone = Object.create(Object.getPrototypeOf(this));
83740    for (const $symbol of Object.getOwnPropertySymbols(this)) {
83741      try {
83742        clone[$symbol] = this[$symbol];
83743      } catch {
83744        (0, _util.shadow)(clone, $symbol, this[$symbol]);
83745      }
83746    }
83747    clone[_symbol_utils.$uid] = `${clone[_symbol_utils.$nodeName]}${uid++}`;
83748    clone[_children] = [];
83749    for (const name of Object.getOwnPropertyNames(this)) {
83750      if (this[_attributeNames].has(name)) {
83751        clone[name] = XFAObject[_cloneAttribute](this[name]);
83752        continue;
83753      }
83754      const value = this[name];
83755      clone[name] = value instanceof XFAObjectArray ? new XFAObjectArray(value[_max]) : null;
83756    }
83757    for (const child of this[_children]) {
83758      const name = child[_symbol_utils.$nodeName];
83759      const clonedChild = child[_symbol_utils.$clone]();
83760      clone[_children].push(clonedChild);
83761      clonedChild[_parent] = clone;
83762      if (clone[name] === null) {
83763        clone[name] = clonedChild;
83764      } else {
83765        clone[name][_children].push(clonedChild);
83766      }
83767    }
83768    return clone;
83769  }
83770  [_symbol_utils.$getChildren](name = null) {
83771    if (!name) {
83772      return this[_children];
83773    }
83774    return this[_children].filter(c => c[_symbol_utils.$nodeName] === name);
83775  }
83776  [_symbol_utils.$getChildrenByClass](name) {
83777    return this[name];
83778  }
83779  [_symbol_utils.$getChildrenByName](name, allTransparent, first = true) {
83780    return Array.from(this[_symbol_utils.$getChildrenByNameIt](name, allTransparent, first));
83781  }
83782  *[_symbol_utils.$getChildrenByNameIt](name, allTransparent, first = true) {
83783    if (name === "parent") {
83784      yield this[_parent];
83785      return;
83786    }
83787    for (const child of this[_children]) {
83788      if (child[_symbol_utils.$nodeName] === name) {
83789        yield child;
83790      }
83791      if (child.name === name) {
83792        yield child;
83793      }
83794      if (allTransparent || child[_symbol_utils.$isTransparent]()) {
83795        yield* child[_symbol_utils.$getChildrenByNameIt](name, allTransparent, false);
83796      }
83797    }
83798    if (first && this[_attributeNames].has(name)) {
83799      yield new XFAAttribute(this, name, this[name]);
83800    }
83801  }
83802}
83803exports.XFAObject = XFAObject;
83804class XFAObjectArray {
83805  constructor(max = Infinity) {
83806    this[_max] = max;
83807    this[_children] = [];
83808  }
83809  get isXFAObject() {
83810    return false;
83811  }
83812  get isXFAObjectArray() {
83813    return true;
83814  }
83815  push(child) {
83816    const len = this[_children].length;
83817    if (len <= this[_max]) {
83818      this[_children].push(child);
83819      return true;
83820    }
83821    (0, _util.warn)(`XFA - node "${child[_symbol_utils.$nodeName]}" accepts no more than ${this[_max]} children`);
83822    return false;
83823  }
83824  isEmpty() {
83825    return this[_children].length === 0;
83826  }
83827  dump() {
83828    return this[_children].length === 1 ? this[_children][0][_symbol_utils.$dump]() : this[_children].map(x => x[_symbol_utils.$dump]());
83829  }
83830  [_symbol_utils.$clone]() {
83831    const clone = new XFAObjectArray(this[_max]);
83832    clone[_children] = this[_children].map(c => c[_symbol_utils.$clone]());
83833    return clone;
83834  }
83835  get children() {
83836    return this[_children];
83837  }
83838  clear() {
83839    this[_children].length = 0;
83840  }
83841}
83842exports.XFAObjectArray = XFAObjectArray;
83843class XFAAttribute {
83844  constructor(node, name, value) {
83845    this[_parent] = node;
83846    this[_symbol_utils.$nodeName] = name;
83847    this[_symbol_utils.$content] = value;
83848    this[_symbol_utils.$consumed] = false;
83849    this[_symbol_utils.$uid] = `attribute${uid++}`;
83850  }
83851  [_symbol_utils.$getParent]() {
83852    return this[_parent];
83853  }
83854  [_symbol_utils.$isDataValue]() {
83855    return true;
83856  }
83857  [_symbol_utils.$getDataValue]() {
83858    return this[_symbol_utils.$content].trim();
83859  }
83860  [_symbol_utils.$setValue](value) {
83861    value = value.value || "";
83862    this[_symbol_utils.$content] = value.toString();
83863  }
83864  [_symbol_utils.$text]() {
83865    return this[_symbol_utils.$content];
83866  }
83867  [_symbol_utils.$isDescendent](parent) {
83868    return this[_parent] === parent || this[_parent][_symbol_utils.$isDescendent](parent);
83869  }
83870}
83871exports.XFAAttribute = XFAAttribute;
83872class XmlObject extends XFAObject {
83873  constructor(nsId, name, attributes = {}) {
83874    super(nsId, name);
83875    this[_symbol_utils.$content] = "";
83876    this[_dataValue] = null;
83877    if (name !== "#text") {
83878      const map = new Map();
83879      this[_attributes] = map;
83880      for (const [attrName, value] of Object.entries(attributes)) {
83881        map.set(attrName, new XFAAttribute(this, attrName, value));
83882      }
83883      if (attributes.hasOwnProperty(_symbol_utils.$nsAttributes)) {
83884        const dataNode = attributes[_symbol_utils.$nsAttributes].xfa.dataNode;
83885        if (dataNode !== undefined) {
83886          if (dataNode === "dataGroup") {
83887            this[_dataValue] = false;
83888          } else if (dataNode === "dataValue") {
83889            this[_dataValue] = true;
83890          }
83891        }
83892      }
83893    }
83894    this[_symbol_utils.$consumed] = false;
83895  }
83896  [_symbol_utils.$toString](buf) {
83897    const tagName = this[_symbol_utils.$nodeName];
83898    if (tagName === "#text") {
83899      buf.push((0, _core_utils.encodeToXmlString)(this[_symbol_utils.$content]));
83900      return;
83901    }
83902    const utf8TagName = (0, _util.utf8StringToString)(tagName);
83903    const prefix = this[_symbol_utils.$namespaceId] === NS_DATASETS ? "xfa:" : "";
83904    buf.push(`<${prefix}${utf8TagName}`);
83905    for (const [name, value] of this[_attributes].entries()) {
83906      const utf8Name = (0, _util.utf8StringToString)(name);
83907      buf.push(` ${utf8Name}="${(0, _core_utils.encodeToXmlString)(value[_symbol_utils.$content])}"`);
83908    }
83909    if (this[_dataValue] !== null) {
83910      if (this[_dataValue]) {
83911        buf.push(` xfa:dataNode="dataValue"`);
83912      } else {
83913        buf.push(` xfa:dataNode="dataGroup"`);
83914      }
83915    }
83916    if (!this[_symbol_utils.$content] && this[_children].length === 0) {
83917      buf.push("/>");
83918      return;
83919    }
83920    buf.push(">");
83921    if (this[_symbol_utils.$content]) {
83922      if (typeof this[_symbol_utils.$content] === "string") {
83923        buf.push((0, _core_utils.encodeToXmlString)(this[_symbol_utils.$content]));
83924      } else {
83925        this[_symbol_utils.$content][_symbol_utils.$toString](buf);
83926      }
83927    } else {
83928      for (const child of this[_children]) {
83929        child[_symbol_utils.$toString](buf);
83930      }
83931    }
83932    buf.push(`</${prefix}${utf8TagName}>`);
83933  }
83934  [_symbol_utils.$onChild](child) {
83935    if (this[_symbol_utils.$content]) {
83936      const node = new XmlObject(this[_symbol_utils.$namespaceId], "#text");
83937      this[_symbol_utils.$appendChild](node);
83938      node[_symbol_utils.$content] = this[_symbol_utils.$content];
83939      this[_symbol_utils.$content] = "";
83940    }
83941    this[_symbol_utils.$appendChild](child);
83942    return true;
83943  }
83944  [_symbol_utils.$onText](str) {
83945    this[_symbol_utils.$content] += str;
83946  }
83947  [_symbol_utils.$finalize]() {
83948    if (this[_symbol_utils.$content] && this[_children].length > 0) {
83949      const node = new XmlObject(this[_symbol_utils.$namespaceId], "#text");
83950      this[_symbol_utils.$appendChild](node);
83951      node[_symbol_utils.$content] = this[_symbol_utils.$content];
83952      delete this[_symbol_utils.$content];
83953    }
83954  }
83955  [_symbol_utils.$toHTML]() {
83956    if (this[_symbol_utils.$nodeName] === "#text") {
83957      return _utils.HTMLResult.success({
83958        name: "#text",
83959        value: this[_symbol_utils.$content]
83960      });
83961    }
83962    return _utils.HTMLResult.EMPTY;
83963  }
83964  [_symbol_utils.$getChildren](name = null) {
83965    if (!name) {
83966      return this[_children];
83967    }
83968    return this[_children].filter(c => c[_symbol_utils.$nodeName] === name);
83969  }
83970  [_symbol_utils.$getAttributes]() {
83971    return this[_attributes];
83972  }
83973  [_symbol_utils.$getChildrenByClass](name) {
83974    const value = this[_attributes].get(name);
83975    if (value !== undefined) {
83976      return value;
83977    }
83978    return this[_symbol_utils.$getChildren](name);
83979  }
83980  *[_symbol_utils.$getChildrenByNameIt](name, allTransparent) {
83981    const value = this[_attributes].get(name);
83982    if (value) {
83983      yield value;
83984    }
83985    for (const child of this[_children]) {
83986      if (child[_symbol_utils.$nodeName] === name) {
83987        yield child;
83988      }
83989      if (allTransparent) {
83990        yield* child[_symbol_utils.$getChildrenByNameIt](name, allTransparent);
83991      }
83992    }
83993  }
83994  *[_symbol_utils.$getAttributeIt](name, skipConsumed) {
83995    const value = this[_attributes].get(name);
83996    if (value && (!skipConsumed || !value[_symbol_utils.$consumed])) {
83997      yield value;
83998    }
83999    for (const child of this[_children]) {
84000      yield* child[_symbol_utils.$getAttributeIt](name, skipConsumed);
84001    }
84002  }
84003  *[_symbol_utils.$getRealChildrenByNameIt](name, allTransparent, skipConsumed) {
84004    for (const child of this[_children]) {
84005      if (child[_symbol_utils.$nodeName] === name && (!skipConsumed || !child[_symbol_utils.$consumed])) {
84006        yield child;
84007      }
84008      if (allTransparent) {
84009        yield* child[_symbol_utils.$getRealChildrenByNameIt](name, allTransparent, skipConsumed);
84010      }
84011    }
84012  }
84013  [_symbol_utils.$isDataValue]() {
84014    if (this[_dataValue] === null) {
84015      return this[_children].length === 0 || this[_children][0][_symbol_utils.$namespaceId] === _namespaces.NamespaceIds.xhtml.id;
84016    }
84017    return this[_dataValue];
84018  }
84019  [_symbol_utils.$getDataValue]() {
84020    if (this[_dataValue] === null) {
84021      if (this[_children].length === 0) {
84022        return this[_symbol_utils.$content].trim();
84023      }
84024      if (this[_children][0][_symbol_utils.$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
84025        return this[_children][0][_symbol_utils.$text]().trim();
84026      }
84027      return null;
84028    }
84029    return this[_symbol_utils.$content].trim();
84030  }
84031  [_symbol_utils.$setValue](value) {
84032    value = value.value || "";
84033    this[_symbol_utils.$content] = value.toString();
84034  }
84035  [_symbol_utils.$dump](hasNS = false) {
84036    const dumped = Object.create(null);
84037    if (hasNS) {
84038      dumped.$ns = this[_symbol_utils.$namespaceId];
84039    }
84040    if (this[_symbol_utils.$content]) {
84041      dumped.$content = this[_symbol_utils.$content];
84042    }
84043    dumped.$name = this[_symbol_utils.$nodeName];
84044    dumped.children = [];
84045    for (const child of this[_children]) {
84046      dumped.children.push(child[_symbol_utils.$dump](hasNS));
84047    }
84048    dumped.attributes = Object.create(null);
84049    for (const [name, value] of this[_attributes]) {
84050      dumped.attributes[name] = value[_symbol_utils.$content];
84051    }
84052    return dumped;
84053  }
84054}
84055exports.XmlObject = XmlObject;
84056class ContentObject extends XFAObject {
84057  constructor(nsId, name) {
84058    super(nsId, name);
84059    this[_symbol_utils.$content] = "";
84060  }
84061  [_symbol_utils.$onText](text) {
84062    this[_symbol_utils.$content] += text;
84063  }
84064  [_symbol_utils.$finalize]() {}
84065}
84066exports.ContentObject = ContentObject;
84067class OptionObject extends ContentObject {
84068  constructor(nsId, name, options) {
84069    super(nsId, name);
84070    this[_options] = options;
84071  }
84072  [_symbol_utils.$finalize]() {
84073    this[_symbol_utils.$content] = (0, _utils.getKeyword)({
84074      data: this[_symbol_utils.$content],
84075      defaultValue: this[_options][0],
84076      validate: k => this[_options].includes(k)
84077    });
84078  }
84079  [_symbol_utils.$clean](builder) {
84080    super[_symbol_utils.$clean](builder);
84081    delete this[_options];
84082  }
84083}
84084exports.OptionObject = OptionObject;
84085class StringObject extends ContentObject {
84086  [_symbol_utils.$finalize]() {
84087    this[_symbol_utils.$content] = this[_symbol_utils.$content].trim();
84088  }
84089}
84090exports.StringObject = StringObject;
84091class IntegerObject extends ContentObject {
84092  constructor(nsId, name, defaultValue, validator) {
84093    super(nsId, name);
84094    this[_defaultValue] = defaultValue;
84095    this[_validator] = validator;
84096  }
84097  [_symbol_utils.$finalize]() {
84098    this[_symbol_utils.$content] = (0, _utils.getInteger)({
84099      data: this[_symbol_utils.$content],
84100      defaultValue: this[_defaultValue],
84101      validate: this[_validator]
84102    });
84103  }
84104  [_symbol_utils.$clean](builder) {
84105    super[_symbol_utils.$clean](builder);
84106    delete this[_defaultValue];
84107    delete this[_validator];
84108  }
84109}
84110exports.IntegerObject = IntegerObject;
84111class Option01 extends IntegerObject {
84112  constructor(nsId, name) {
84113    super(nsId, name, 0, n => n === 1);
84114  }
84115}
84116exports.Option01 = Option01;
84117class Option10 extends IntegerObject {
84118  constructor(nsId, name) {
84119    super(nsId, name, 1, n => n === 0);
84120  }
84121}
84122exports.Option10 = Option10;
84123
84124/***/ }),
84125/* 88 */
84126/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
84127
84128
84129
84130Object.defineProperty(exports, "__esModule", ({
84131  value: true
84132}));
84133exports.createDataNode = createDataNode;
84134exports.searchNode = searchNode;
84135var _symbol_utils = __w_pdfjs_require__(78);
84136var _util = __w_pdfjs_require__(2);
84137const namePattern = /^[^.[]+/;
84138const indexPattern = /^[^\]]+/;
84139const operators = {
84140  dot: 0,
84141  dotDot: 1,
84142  dotHash: 2,
84143  dotBracket: 3,
84144  dotParen: 4
84145};
84146const shortcuts = new Map([["$data", (root, current) => root.datasets ? root.datasets.data : root], ["$record", (root, current) => (root.datasets ? root.datasets.data : root)[_symbol_utils.$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]]);
84147const somCache = new WeakMap();
84148function parseIndex(index) {
84149  index = index.trim();
84150  if (index === "*") {
84151    return Infinity;
84152  }
84153  return parseInt(index, 10) || 0;
84154}
84155function parseExpression(expr, dotDotAllowed, noExpr = true) {
84156  let match = expr.match(namePattern);
84157  if (!match) {
84158    return null;
84159  }
84160  let [name] = match;
84161  const parsed = [{
84162    name,
84163    cacheName: "." + name,
84164    index: 0,
84165    js: null,
84166    formCalc: null,
84167    operator: operators.dot
84168  }];
84169  let pos = name.length;
84170  while (pos < expr.length) {
84171    const spos = pos;
84172    const char = expr.charAt(pos++);
84173    if (char === "[") {
84174      match = expr.slice(pos).match(indexPattern);
84175      if (!match) {
84176        (0, _util.warn)("XFA - Invalid index in SOM expression");
84177        return null;
84178      }
84179      parsed.at(-1).index = parseIndex(match[0]);
84180      pos += match[0].length + 1;
84181      continue;
84182    }
84183    let operator;
84184    switch (expr.charAt(pos)) {
84185      case ".":
84186        if (!dotDotAllowed) {
84187          return null;
84188        }
84189        pos++;
84190        operator = operators.dotDot;
84191        break;
84192      case "#":
84193        pos++;
84194        operator = operators.dotHash;
84195        break;
84196      case "[":
84197        if (noExpr) {
84198          (0, _util.warn)("XFA - SOM expression contains a FormCalc subexpression which is not supported for now.");
84199          return null;
84200        }
84201        operator = operators.dotBracket;
84202        break;
84203      case "(":
84204        if (noExpr) {
84205          (0, _util.warn)("XFA - SOM expression contains a JavaScript subexpression which is not supported for now.");
84206          return null;
84207        }
84208        operator = operators.dotParen;
84209        break;
84210      default:
84211        operator = operators.dot;
84212        break;
84213    }
84214    match = expr.slice(pos).match(namePattern);
84215    if (!match) {
84216      break;
84217    }
84218    [name] = match;
84219    pos += name.length;
84220    parsed.push({
84221      name,
84222      cacheName: expr.slice(spos, pos),
84223      operator,
84224      index: 0,
84225      js: null,
84226      formCalc: null
84227    });
84228  }
84229  return parsed;
84230}
84231function searchNode(root, container, expr, dotDotAllowed = true, useCache = true) {
84232  const parsed = parseExpression(expr, dotDotAllowed);
84233  if (!parsed) {
84234    return null;
84235  }
84236  const fn = shortcuts.get(parsed[0].name);
84237  let i = 0;
84238  let isQualified;
84239  if (fn) {
84240    isQualified = true;
84241    root = [fn(root, container)];
84242    i = 1;
84243  } else {
84244    isQualified = container === null;
84245    root = [container || root];
84246  }
84247  for (let ii = parsed.length; i < ii; i++) {
84248    const {
84249      name,
84250      cacheName,
84251      operator,
84252      index
84253    } = parsed[i];
84254    const nodes = [];
84255    for (const node of root) {
84256      if (!node.isXFAObject) {
84257        continue;
84258      }
vendor: 44,085 bytes, lines 84259-85755
84259      let children, cached;
84260      if (useCache) {
84261        cached = somCache.get(node);
84262        if (!cached) {
84263          cached = new Map();
84264          somCache.set(node, cached);
84265        }
84266        children = cached.get(cacheName);
84267      }
84268      if (!children) {
84269        switch (operator) {
84270          case operators.dot:
84271            children = node[_symbol_utils.$getChildrenByName](name, false);
84272            break;
84273          case operators.dotDot:
84274            children = node[_symbol_utils.$getChildrenByName](name, true);
84275            break;
84276          case operators.dotHash:
84277            children = node[_symbol_utils.$getChildrenByClass](name);
84278            children = children.isXFAObjectArray ? children.children : [children];
84279            break;
84280          default:
84281            break;
84282        }
84283        if (useCache) {
84284          cached.set(cacheName, children);
84285        }
84286      }
84287      if (children.length > 0) {
84288        nodes.push(children);
84289      }
84290    }
84291    if (nodes.length === 0 && !isQualified && i === 0) {
84292      const parent = container[_symbol_utils.$getParent]();
84293      container = parent;
84294      if (!container) {
84295        return null;
84296      }
84297      i = -1;
84298      root = [container];
84299      continue;
84300    }
84301    root = isFinite(index) ? nodes.filter(node => index < node.length).map(node => node[index]) : nodes.flat();
84302  }
84303  if (root.length === 0) {
84304    return null;
84305  }
84306  return root;
84307}
84308function createDataNode(root, container, expr) {
84309  const parsed = parseExpression(expr);
84310  if (!parsed) {
84311    return null;
84312  }
84313  if (parsed.some(x => x.operator === operators.dotDot)) {
84314    return null;
84315  }
84316  const fn = shortcuts.get(parsed[0].name);
84317  let i = 0;
84318  if (fn) {
84319    root = fn(root, container);
84320    i = 1;
84321  } else {
84322    root = container || root;
84323  }
84324  for (let ii = parsed.length; i < ii; i++) {
84325    const {
84326      name,
84327      operator,
84328      index
84329    } = parsed[i];
84330    if (!isFinite(index)) {
84331      parsed[i].index = 0;
84332      return root.createNodes(parsed.slice(i));
84333    }
84334    let children;
84335    switch (operator) {
84336      case operators.dot:
84337        children = root[_symbol_utils.$getChildrenByName](name, false);
84338        break;
84339      case operators.dotDot:
84340        children = root[_symbol_utils.$getChildrenByName](name, true);
84341        break;
84342      case operators.dotHash:
84343        children = root[_symbol_utils.$getChildrenByClass](name);
84344        children = children.isXFAObjectArray ? children.children : [children];
84345        break;
84346      default:
84347        break;
84348    }
84349    if (children.length === 0) {
84350      return root.createNodes(parsed.slice(i));
84351    }
84352    if (index < children.length) {
84353      const child = children[index];
84354      if (!child.isXFAObject) {
84355        (0, _util.warn)(`XFA - Cannot create a node.`);
84356        return null;
84357      }
84358      root = child;
84359    } else {
84360      parsed[i].index = index - children.length;
84361      return root.createNodes(parsed.slice(i));
84362    }
84363  }
84364  return null;
84365}
84366
84367/***/ }),
84368/* 89 */
84369/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
84370
84371
84372
84373Object.defineProperty(exports, "__esModule", ({
84374  value: true
84375}));
84376exports.DataHandler = void 0;
84377var _symbol_utils = __w_pdfjs_require__(78);
84378class DataHandler {
84379  constructor(root, data) {
84380    this.data = data;
84381    this.dataset = root.datasets || null;
84382  }
84383  serialize(storage) {
84384    const stack = [[-1, this.data[_symbol_utils.$getChildren]()]];
84385    while (stack.length > 0) {
84386      const last = stack.at(-1);
84387      const [i, children] = last;
84388      if (i + 1 === children.length) {
84389        stack.pop();
84390        continue;
84391      }
84392      const child = children[++last[0]];
84393      const storageEntry = storage.get(child[_symbol_utils.$uid]);
84394      if (storageEntry) {
84395        child[_symbol_utils.$setValue](storageEntry);
84396      } else {
84397        const attributes = child[_symbol_utils.$getAttributes]();
84398        for (const value of attributes.values()) {
84399          const entry = storage.get(value[_symbol_utils.$uid]);
84400          if (entry) {
84401            value[_symbol_utils.$setValue](entry);
84402            break;
84403          }
84404        }
84405      }
84406      const nodes = child[_symbol_utils.$getChildren]();
84407      if (nodes.length > 0) {
84408        stack.push([-1, nodes]);
84409      }
84410    }
84411    const buf = [`<xfa:datasets xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">`];
84412    if (this.dataset) {
84413      for (const child of this.dataset[_symbol_utils.$getChildren]()) {
84414        if (child[_symbol_utils.$nodeName] !== "data") {
84415          child[_symbol_utils.$toString](buf);
84416        }
84417      }
84418    }
84419    this.data[_symbol_utils.$toString](buf);
84420    buf.push("</xfa:datasets>");
84421    return buf.join("");
84422  }
84423}
84424exports.DataHandler = DataHandler;
84425
84426/***/ }),
84427/* 90 */
84428/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
84429
84430
84431
84432Object.defineProperty(exports, "__esModule", ({
84433  value: true
84434}));
84435exports.XFAParser = void 0;
84436var _symbol_utils = __w_pdfjs_require__(78);
84437var _xml_parser = __w_pdfjs_require__(71);
84438var _builder = __w_pdfjs_require__(91);
84439var _util = __w_pdfjs_require__(2);
84440class XFAParser extends _xml_parser.XMLParserBase {
84441  constructor(rootNameSpace = null, richText = false) {
84442    super();
84443    this._builder = new _builder.Builder(rootNameSpace);
84444    this._stack = [];
84445    this._globalData = {
84446      usedTypefaces: new Set()
84447    };
84448    this._ids = new Map();
84449    this._current = this._builder.buildRoot(this._ids);
84450    this._errorCode = _xml_parser.XMLParserErrorCode.NoError;
84451    this._whiteRegex = /^\s+$/;
84452    this._nbsps = /\xa0+/g;
84453    this._richText = richText;
84454  }
84455  parse(data) {
84456    this.parseXml(data);
84457    if (this._errorCode !== _xml_parser.XMLParserErrorCode.NoError) {
84458      return undefined;
84459    }
84460    this._current[_symbol_utils.$finalize]();
84461    return this._current.element;
84462  }
84463  onText(text) {
84464    text = text.replace(this._nbsps, match => match.slice(1) + " ");
84465    if (this._richText || this._current[_symbol_utils.$acceptWhitespace]()) {
84466      this._current[_symbol_utils.$onText](text, this._richText);
84467      return;
84468    }
84469    if (this._whiteRegex.test(text)) {
84470      return;
84471    }
84472    this._current[_symbol_utils.$onText](text.trim());
84473  }
84474  onCdata(text) {
84475    this._current[_symbol_utils.$onText](text);
84476  }
84477  _mkAttributes(attributes, tagName) {
84478    let namespace = null;
84479    let prefixes = null;
84480    const attributeObj = Object.create({});
84481    for (const {
84482      name,
84483      value
84484    } of attributes) {
84485      if (name === "xmlns") {
84486        if (!namespace) {
84487          namespace = value;
84488        } else {
84489          (0, _util.warn)(`XFA - multiple namespace definition in <${tagName}>`);
84490        }
84491      } else if (name.startsWith("xmlns:")) {
84492        const prefix = name.substring("xmlns:".length);
84493        if (!prefixes) {
84494          prefixes = [];
84495        }
84496        prefixes.push({
84497          prefix,
84498          value
84499        });
84500      } else {
84501        const i = name.indexOf(":");
84502        if (i === -1) {
84503          attributeObj[name] = value;
84504        } else {
84505          let nsAttrs = attributeObj[_symbol_utils.$nsAttributes];
84506          if (!nsAttrs) {
84507            nsAttrs = attributeObj[_symbol_utils.$nsAttributes] = Object.create(null);
84508          }
84509          const [ns, attrName] = [name.slice(0, i), name.slice(i + 1)];
84510          const attrs = nsAttrs[ns] ||= Object.create(null);
84511          attrs[attrName] = value;
84512        }
84513      }
84514    }
84515    return [namespace, prefixes, attributeObj];
84516  }
84517  _getNameAndPrefix(name, nsAgnostic) {
84518    const i = name.indexOf(":");
84519    if (i === -1) {
84520      return [name, null];
84521    }
84522    return [name.substring(i + 1), nsAgnostic ? "" : name.substring(0, i)];
84523  }
84524  onBeginElement(tagName, attributes, isEmpty) {
84525    const [namespace, prefixes, attributesObj] = this._mkAttributes(attributes, tagName);
84526    const [name, nsPrefix] = this._getNameAndPrefix(tagName, this._builder.isNsAgnostic());
84527    const node = this._builder.build({
84528      nsPrefix,
84529      name,
84530      attributes: attributesObj,
84531      namespace,
84532      prefixes
84533    });
84534    node[_symbol_utils.$globalData] = this._globalData;
84535    if (isEmpty) {
84536      node[_symbol_utils.$finalize]();
84537      if (this._current[_symbol_utils.$onChild](node)) {
84538        node[_symbol_utils.$setId](this._ids);
84539      }
84540      node[_symbol_utils.$clean](this._builder);
84541      return;
84542    }
84543    this._stack.push(this._current);
84544    this._current = node;
84545  }
84546  onEndElement(name) {
84547    const node = this._current;
84548    if (node[_symbol_utils.$isCDATAXml]() && typeof node[_symbol_utils.$content] === "string") {
84549      const parser = new XFAParser();
84550      parser._globalData = this._globalData;
84551      const root = parser.parse(node[_symbol_utils.$content]);
84552      node[_symbol_utils.$content] = null;
84553      node[_symbol_utils.$onChild](root);
84554    }
84555    node[_symbol_utils.$finalize]();
84556    this._current = this._stack.pop();
84557    if (this._current[_symbol_utils.$onChild](node)) {
84558      node[_symbol_utils.$setId](this._ids);
84559    }
84560    node[_symbol_utils.$clean](this._builder);
84561  }
84562  onError(code) {
84563    this._errorCode = code;
84564  }
84565}
84566exports.XFAParser = XFAParser;
84567
84568/***/ }),
84569/* 91 */
84570/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
84571
84572
84573
84574Object.defineProperty(exports, "__esModule", ({
84575  value: true
84576}));
84577exports.Builder = void 0;
84578var _namespaces = __w_pdfjs_require__(81);
84579var _symbol_utils = __w_pdfjs_require__(78);
84580var _setup = __w_pdfjs_require__(92);
84581var _template = __w_pdfjs_require__(80);
84582var _unknown = __w_pdfjs_require__(101);
84583var _util = __w_pdfjs_require__(2);
84584var _xfa_object = __w_pdfjs_require__(87);
84585class Root extends _xfa_object.XFAObject {
84586  constructor(ids) {
84587    super(-1, "root", Object.create(null));
84588    this.element = null;
84589    this[_symbol_utils.$ids] = ids;
84590  }
84591  [_symbol_utils.$onChild](child) {
84592    this.element = child;
84593    return true;
84594  }
84595  [_symbol_utils.$finalize]() {
84596    super[_symbol_utils.$finalize]();
84597    if (this.element.template instanceof _template.Template) {
84598      this[_symbol_utils.$ids].set(_symbol_utils.$root, this.element);
84599      this.element.template[_symbol_utils.$resolvePrototypes](this[_symbol_utils.$ids]);
84600      this.element.template[_symbol_utils.$ids] = this[_symbol_utils.$ids];
84601    }
84602  }
84603}
84604class Empty extends _xfa_object.XFAObject {
84605  constructor() {
84606    super(-1, "", Object.create(null));
84607  }
84608  [_symbol_utils.$onChild](_) {
84609    return false;
84610  }
84611}
84612class Builder {
84613  constructor(rootNameSpace = null) {
84614    this._namespaceStack = [];
84615    this._nsAgnosticLevel = 0;
84616    this._namespacePrefixes = new Map();
84617    this._namespaces = new Map();
84618    this._nextNsId = Math.max(...Object.values(_namespaces.NamespaceIds).map(({
84619      id
84620    }) => id));
84621    this._currentNamespace = rootNameSpace || new _unknown.UnknownNamespace(++this._nextNsId);
84622  }
84623  buildRoot(ids) {
84624    return new Root(ids);
84625  }
84626  build({
84627    nsPrefix,
84628    name,
84629    attributes,
84630    namespace,
84631    prefixes
84632  }) {
84633    const hasNamespaceDef = namespace !== null;
84634    if (hasNamespaceDef) {
84635      this._namespaceStack.push(this._currentNamespace);
84636      this._currentNamespace = this._searchNamespace(namespace);
84637    }
84638    if (prefixes) {
84639      this._addNamespacePrefix(prefixes);
84640    }
84641    if (attributes.hasOwnProperty(_symbol_utils.$nsAttributes)) {
84642      const dataTemplate = _setup.NamespaceSetUp.datasets;
84643      const nsAttrs = attributes[_symbol_utils.$nsAttributes];
84644      let xfaAttrs = null;
84645      for (const [ns, attrs] of Object.entries(nsAttrs)) {
84646        const nsToUse = this._getNamespaceToUse(ns);
84647        if (nsToUse === dataTemplate) {
84648          xfaAttrs = {
84649            xfa: attrs
84650          };
84651          break;
84652        }
84653      }
84654      if (xfaAttrs) {
84655        attributes[_symbol_utils.$nsAttributes] = xfaAttrs;
84656      } else {
84657        delete attributes[_symbol_utils.$nsAttributes];
84658      }
84659    }
84660    const namespaceToUse = this._getNamespaceToUse(nsPrefix);
84661    const node = namespaceToUse?.[_namespaces.$buildXFAObject](name, attributes) || new Empty();
84662    if (node[_symbol_utils.$isNsAgnostic]()) {
84663      this._nsAgnosticLevel++;
84664    }
84665    if (hasNamespaceDef || prefixes || node[_symbol_utils.$isNsAgnostic]()) {
84666      node[_symbol_utils.$cleanup] = {
84667        hasNamespace: hasNamespaceDef,
84668        prefixes,
84669        nsAgnostic: node[_symbol_utils.$isNsAgnostic]()
84670      };
84671    }
84672    return node;
84673  }
84674  isNsAgnostic() {
84675    return this._nsAgnosticLevel > 0;
84676  }
84677  _searchNamespace(nsName) {
84678    let ns = this._namespaces.get(nsName);
84679    if (ns) {
84680      return ns;
84681    }
84682    for (const [name, {
84683      check
84684    }] of Object.entries(_namespaces.NamespaceIds)) {
84685      if (check(nsName)) {
84686        ns = _setup.NamespaceSetUp[name];
84687        if (ns) {
84688          this._namespaces.set(nsName, ns);
84689          return ns;
84690        }
84691        break;
84692      }
84693    }
84694    ns = new _unknown.UnknownNamespace(++this._nextNsId);
84695    this._namespaces.set(nsName, ns);
84696    return ns;
84697  }
84698  _addNamespacePrefix(prefixes) {
84699    for (const {
84700      prefix,
84701      value
84702    } of prefixes) {
84703      const namespace = this._searchNamespace(value);
84704      let prefixStack = this._namespacePrefixes.get(prefix);
84705      if (!prefixStack) {
84706        prefixStack = [];
84707        this._namespacePrefixes.set(prefix, prefixStack);
84708      }
84709      prefixStack.push(namespace);
84710    }
84711  }
84712  _getNamespaceToUse(prefix) {
84713    if (!prefix) {
84714      return this._currentNamespace;
84715    }
84716    const prefixStack = this._namespacePrefixes.get(prefix);
84717    if (prefixStack?.length > 0) {
84718      return prefixStack.at(-1);
84719    }
84720    (0, _util.warn)(`Unknown namespace prefix: ${prefix}.`);
84721    return null;
84722  }
84723  clean(data) {
84724    const {
84725      hasNamespace,
84726      prefixes,
84727      nsAgnostic
84728    } = data;
84729    if (hasNamespace) {
84730      this._currentNamespace = this._namespaceStack.pop();
84731    }
84732    if (prefixes) {
84733      prefixes.forEach(({
84734        prefix
84735      }) => {
84736        this._namespacePrefixes.get(prefix).pop();
84737      });
84738    }
84739    if (nsAgnostic) {
84740      this._nsAgnosticLevel--;
84741    }
84742  }
84743}
84744exports.Builder = Builder;
84745
84746/***/ }),
84747/* 92 */
84748/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
84749
84750
84751
84752Object.defineProperty(exports, "__esModule", ({
84753  value: true
84754}));
84755exports.NamespaceSetUp = void 0;
84756var _config = __w_pdfjs_require__(93);
84757var _connection_set = __w_pdfjs_require__(94);
84758var _datasets = __w_pdfjs_require__(95);
84759var _locale_set = __w_pdfjs_require__(96);
84760var _signature = __w_pdfjs_require__(97);
84761var _stylesheet = __w_pdfjs_require__(98);
84762var _template = __w_pdfjs_require__(80);
84763var _xdp = __w_pdfjs_require__(99);
84764var _xhtml = __w_pdfjs_require__(100);
84765const NamespaceSetUp = {
84766  config: _config.ConfigNamespace,
84767  connection: _connection_set.ConnectionSetNamespace,
84768  datasets: _datasets.DatasetsNamespace,
84769  localeSet: _locale_set.LocaleSetNamespace,
84770  signature: _signature.SignatureNamespace,
84771  stylesheet: _stylesheet.StylesheetNamespace,
84772  template: _template.TemplateNamespace,
84773  xdp: _xdp.XdpNamespace,
84774  xhtml: _xhtml.XhtmlNamespace
84775};
84776exports.NamespaceSetUp = NamespaceSetUp;
84777
84778/***/ }),
84779/* 93 */
84780/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
84781
84782
84783
84784Object.defineProperty(exports, "__esModule", ({
84785  value: true
84786}));
84787exports.ConfigNamespace = void 0;
84788var _namespaces = __w_pdfjs_require__(81);
84789var _symbol_utils = __w_pdfjs_require__(78);
84790var _xfa_object = __w_pdfjs_require__(87);
84791var _utils = __w_pdfjs_require__(84);
84792var _util = __w_pdfjs_require__(2);
84793const CONFIG_NS_ID = _namespaces.NamespaceIds.config.id;
84794class Acrobat extends _xfa_object.XFAObject {
84795  constructor(attributes) {
84796    super(CONFIG_NS_ID, "acrobat", true);
84797    this.acrobat7 = null;
84798    this.autoSave = null;
84799    this.common = null;
84800    this.validate = null;
84801    this.validateApprovalSignatures = null;
84802    this.submitUrl = new _xfa_object.XFAObjectArray();
84803  }
84804}
84805class Acrobat7 extends _xfa_object.XFAObject {
84806  constructor(attributes) {
84807    super(CONFIG_NS_ID, "acrobat7", true);
84808    this.dynamicRender = null;
84809  }
84810}
84811class ADBE_JSConsole extends _xfa_object.OptionObject {
84812  constructor(attributes) {
84813    super(CONFIG_NS_ID, "ADBE_JSConsole", ["delegate", "Enable", "Disable"]);
84814  }
84815}
84816class ADBE_JSDebugger extends _xfa_object.OptionObject {
84817  constructor(attributes) {
84818    super(CONFIG_NS_ID, "ADBE_JSDebugger", ["delegate", "Enable", "Disable"]);
84819  }
84820}
84821class AddSilentPrint extends _xfa_object.Option01 {
84822  constructor(attributes) {
84823    super(CONFIG_NS_ID, "addSilentPrint");
84824  }
84825}
84826class AddViewerPreferences extends _xfa_object.Option01 {
84827  constructor(attributes) {
84828    super(CONFIG_NS_ID, "addViewerPreferences");
84829  }
84830}
84831class AdjustData extends _xfa_object.Option10 {
84832  constructor(attributes) {
84833    super(CONFIG_NS_ID, "adjustData");
84834  }
84835}
84836class AdobeExtensionLevel extends _xfa_object.IntegerObject {
84837  constructor(attributes) {
84838    super(CONFIG_NS_ID, "adobeExtensionLevel", 0, n => n >= 1 && n <= 8);
84839  }
84840}
84841class Agent extends _xfa_object.XFAObject {
84842  constructor(attributes) {
84843    super(CONFIG_NS_ID, "agent", true);
84844    this.name = attributes.name ? attributes.name.trim() : "";
84845    this.common = new _xfa_object.XFAObjectArray();
84846  }
84847}
84848class AlwaysEmbed extends _xfa_object.ContentObject {
84849  constructor(attributes) {
84850    super(CONFIG_NS_ID, "alwaysEmbed");
84851  }
84852}
84853class Amd extends _xfa_object.StringObject {
84854  constructor(attributes) {
84855    super(CONFIG_NS_ID, "amd");
84856  }
84857}
84858class Area extends _xfa_object.XFAObject {
84859  constructor(attributes) {
84860    super(CONFIG_NS_ID, "area");
84861    this.level = (0, _utils.getInteger)({
84862      data: attributes.level,
84863      defaultValue: 0,
84864      validate: n => n >= 1 && n <= 3
84865    });
84866    this.name = (0, _utils.getStringOption)(attributes.name, ["", "barcode", "coreinit", "deviceDriver", "font", "general", "layout", "merge", "script", "signature", "sourceSet", "templateCache"]);
84867  }
84868}
84869class Attributes extends _xfa_object.OptionObject {
84870  constructor(attributes) {
84871    super(CONFIG_NS_ID, "attributes", ["preserve", "delegate", "ignore"]);
84872  }
84873}
84874class AutoSave extends _xfa_object.OptionObject {
84875  constructor(attributes) {
84876    super(CONFIG_NS_ID, "autoSave", ["disabled", "enabled"]);
84877  }
84878}
84879class Base extends _xfa_object.StringObject {
84880  constructor(attributes) {
84881    super(CONFIG_NS_ID, "base");
84882  }
84883}
84884class BatchOutput extends _xfa_object.XFAObject {
84885  constructor(attributes) {
84886    super(CONFIG_NS_ID, "batchOutput");
84887    this.format = (0, _utils.getStringOption)(attributes.format, ["none", "concat", "zip", "zipCompress"]);
84888  }
84889}
84890class BehaviorOverride extends _xfa_object.ContentObject {
84891  constructor(attributes) {
84892    super(CONFIG_NS_ID, "behaviorOverride");
84893  }
84894  [_symbol_utils.$finalize]() {
84895    this[_symbol_utils.$content] = new Map(this[_symbol_utils.$content].trim().split(/\s+/).filter(x => x.includes(":")).map(x => x.split(":", 2)));
84896  }
84897}
84898class Cache extends _xfa_object.XFAObject {
84899  constructor(attributes) {
84900    super(CONFIG_NS_ID, "cache", true);
84901    this.templateCache = null;
84902  }
84903}
84904class Change extends _xfa_object.Option01 {
84905  constructor(attributes) {
84906    super(CONFIG_NS_ID, "change");
84907  }
84908}
84909class Common extends _xfa_object.XFAObject {
84910  constructor(attributes) {
84911    super(CONFIG_NS_ID, "common", true);
84912    this.data = null;
84913    this.locale = null;
84914    this.localeSet = null;
84915    this.messaging = null;
84916    this.suppressBanner = null;
84917    this.template = null;
84918    this.validationMessaging = null;
84919    this.versionControl = null;
84920    this.log = new _xfa_object.XFAObjectArray();
84921  }
84922}
84923class Compress extends _xfa_object.XFAObject {
84924  constructor(attributes) {
84925    super(CONFIG_NS_ID, "compress");
84926    this.scope = (0, _utils.getStringOption)(attributes.scope, ["imageOnly", "document"]);
84927  }
84928}
84929class CompressLogicalStructure extends _xfa_object.Option01 {
84930  constructor(attributes) {
84931    super(CONFIG_NS_ID, "compressLogicalStructure");
84932  }
84933}
84934class CompressObjectStream extends _xfa_object.Option10 {
84935  constructor(attributes) {
84936    super(CONFIG_NS_ID, "compressObjectStream");
84937  }
84938}
84939class Compression extends _xfa_object.XFAObject {
84940  constructor(attributes) {
84941    super(CONFIG_NS_ID, "compression", true);
84942    this.compressLogicalStructure = null;
84943    this.compressObjectStream = null;
84944    this.level = null;
84945    this.type = null;
84946  }
84947}
84948class Config extends _xfa_object.XFAObject {
84949  constructor(attributes) {
84950    super(CONFIG_NS_ID, "config", true);
84951    this.acrobat = null;
84952    this.present = null;
84953    this.trace = null;
84954    this.agent = new _xfa_object.XFAObjectArray();
84955  }
84956}
84957class Conformance extends _xfa_object.OptionObject {
84958  constructor(attributes) {
84959    super(CONFIG_NS_ID, "conformance", ["A", "B"]);
84960  }
84961}
84962class ContentCopy extends _xfa_object.Option01 {
84963  constructor(attributes) {
84964    super(CONFIG_NS_ID, "contentCopy");
84965  }
84966}
84967class Copies extends _xfa_object.IntegerObject {
84968  constructor(attributes) {
84969    super(CONFIG_NS_ID, "copies", 1, n => n >= 1);
84970  }
84971}
84972class Creator extends _xfa_object.StringObject {
84973  constructor(attributes) {
84974    super(CONFIG_NS_ID, "creator");
84975  }
84976}
84977class CurrentPage extends _xfa_object.IntegerObject {
84978  constructor(attributes) {
84979    super(CONFIG_NS_ID, "currentPage", 0, n => n >= 0);
84980  }
84981}
84982class Data extends _xfa_object.XFAObject {
84983  constructor(attributes) {
84984    super(CONFIG_NS_ID, "data", true);
84985    this.adjustData = null;
84986    this.attributes = null;
84987    this.incrementalLoad = null;
84988    this.outputXSL = null;
84989    this.range = null;
84990    this.record = null;
84991    this.startNode = null;
84992    this.uri = null;
84993    this.window = null;
84994    this.xsl = null;
84995    this.excludeNS = new _xfa_object.XFAObjectArray();
84996    this.transform = new _xfa_object.XFAObjectArray();
84997  }
84998}
84999class Debug extends _xfa_object.XFAObject {
85000  constructor(attributes) {
85001    super(CONFIG_NS_ID, "debug", true);
85002    this.uri = null;
85003  }
85004}
85005class DefaultTypeface extends _xfa_object.ContentObject {
85006  constructor(attributes) {
85007    super(CONFIG_NS_ID, "defaultTypeface");
85008    this.writingScript = (0, _utils.getStringOption)(attributes.writingScript, ["*", "Arabic", "Cyrillic", "EastEuropeanRoman", "Greek", "Hebrew", "Japanese", "Korean", "Roman", "SimplifiedChinese", "Thai", "TraditionalChinese", "Vietnamese"]);
85009  }
85010}
85011class Destination extends _xfa_object.OptionObject {
85012  constructor(attributes) {
85013    super(CONFIG_NS_ID, "destination", ["pdf", "pcl", "ps", "webClient", "zpl"]);
85014  }
85015}
85016class DocumentAssembly extends _xfa_object.Option01 {
85017  constructor(attributes) {
85018    super(CONFIG_NS_ID, "documentAssembly");
85019  }
85020}
85021class Driver extends _xfa_object.XFAObject {
85022  constructor(attributes) {
85023    super(CONFIG_NS_ID, "driver", true);
85024    this.name = attributes.name ? attributes.name.trim() : "";
85025    this.fontInfo = null;
85026    this.xdc = null;
85027  }
85028}
85029class DuplexOption extends _xfa_object.OptionObject {
85030  constructor(attributes) {
85031    super(CONFIG_NS_ID, "duplexOption", ["simplex", "duplexFlipLongEdge", "duplexFlipShortEdge"]);
85032  }
85033}
85034class DynamicRender extends _xfa_object.OptionObject {
85035  constructor(attributes) {
85036    super(CONFIG_NS_ID, "dynamicRender", ["forbidden", "required"]);
85037  }
85038}
85039class Embed extends _xfa_object.Option01 {
85040  constructor(attributes) {
85041    super(CONFIG_NS_ID, "embed");
85042  }
85043}
85044class Encrypt extends _xfa_object.Option01 {
85045  constructor(attributes) {
85046    super(CONFIG_NS_ID, "encrypt");
85047  }
85048}
85049class Encryption extends _xfa_object.XFAObject {
85050  constructor(attributes) {
85051    super(CONFIG_NS_ID, "encryption", true);
85052    this.encrypt = null;
85053    this.encryptionLevel = null;
85054    this.permissions = null;
85055  }
85056}
85057class EncryptionLevel extends _xfa_object.OptionObject {
85058  constructor(attributes) {
85059    super(CONFIG_NS_ID, "encryptionLevel", ["40bit", "128bit"]);
85060  }
85061}
85062class Enforce extends _xfa_object.StringObject {
85063  constructor(attributes) {
85064    super(CONFIG_NS_ID, "enforce");
85065  }
85066}
85067class Equate extends _xfa_object.XFAObject {
85068  constructor(attributes) {
85069    super(CONFIG_NS_ID, "equate");
85070    this.force = (0, _utils.getInteger)({
85071      data: attributes.force,
85072      defaultValue: 1,
85073      validate: n => n === 0
85074    });
85075    this.from = attributes.from || "";
85076    this.to = attributes.to || "";
85077  }
85078}
85079class EquateRange extends _xfa_object.XFAObject {
85080  constructor(attributes) {
85081    super(CONFIG_NS_ID, "equateRange");
85082    this.from = attributes.from || "";
85083    this.to = attributes.to || "";
85084    this._unicodeRange = attributes.unicodeRange || "";
85085  }
85086  get unicodeRange() {
85087    const ranges = [];
85088    const unicodeRegex = /U\+([0-9a-fA-F]+)/;
85089    const unicodeRange = this._unicodeRange;
85090    for (let range of unicodeRange.split(",").map(x => x.trim()).filter(x => !!x)) {
85091      range = range.split("-", 2).map(x => {
85092        const found = x.match(unicodeRegex);
85093        if (!found) {
85094          return 0;
85095        }
85096        return parseInt(found[1], 16);
85097      });
85098      if (range.length === 1) {
85099        range.push(range[0]);
85100      }
85101      ranges.push(range);
85102    }
85103    return (0, _util.shadow)(this, "unicodeRange", ranges);
85104  }
85105}
85106class Exclude extends _xfa_object.ContentObject {
85107  constructor(attributes) {
85108    super(CONFIG_NS_ID, "exclude");
85109  }
85110  [_symbol_utils.$finalize]() {
85111    this[_symbol_utils.$content] = this[_symbol_utils.$content].trim().split(/\s+/).filter(x => x && ["calculate", "close", "enter", "exit", "initialize", "ready", "validate"].includes(x));
85112  }
85113}
85114class ExcludeNS extends _xfa_object.StringObject {
85115  constructor(attributes) {
85116    super(CONFIG_NS_ID, "excludeNS");
85117  }
85118}
85119class FlipLabel extends _xfa_object.OptionObject {
85120  constructor(attributes) {
85121    super(CONFIG_NS_ID, "flipLabel", ["usePrinterSetting", "on", "off"]);
85122  }
85123}
85124class FontInfo extends _xfa_object.XFAObject {
85125  constructor(attributes) {
85126    super(CONFIG_NS_ID, "fontInfo", true);
85127    this.embed = null;
85128    this.map = null;
85129    this.subsetBelow = null;
85130    this.alwaysEmbed = new _xfa_object.XFAObjectArray();
85131    this.defaultTypeface = new _xfa_object.XFAObjectArray();
85132    this.neverEmbed = new _xfa_object.XFAObjectArray();
85133  }
85134}
85135class FormFieldFilling extends _xfa_object.Option01 {
85136  constructor(attributes) {
85137    super(CONFIG_NS_ID, "formFieldFilling");
85138  }
85139}
85140class GroupParent extends _xfa_object.StringObject {
85141  constructor(attributes) {
85142    super(CONFIG_NS_ID, "groupParent");
85143  }
85144}
85145class IfEmpty extends _xfa_object.OptionObject {
85146  constructor(attributes) {
85147    super(CONFIG_NS_ID, "ifEmpty", ["dataValue", "dataGroup", "ignore", "remove"]);
85148  }
85149}
85150class IncludeXDPContent extends _xfa_object.StringObject {
85151  constructor(attributes) {
85152    super(CONFIG_NS_ID, "includeXDPContent");
85153  }
85154}
85155class IncrementalLoad extends _xfa_object.OptionObject {
85156  constructor(attributes) {
85157    super(CONFIG_NS_ID, "incrementalLoad", ["none", "forwardOnly"]);
85158  }
85159}
85160class IncrementalMerge extends _xfa_object.Option01 {
85161  constructor(attributes) {
85162    super(CONFIG_NS_ID, "incrementalMerge");
85163  }
85164}
85165class Interactive extends _xfa_object.Option01 {
85166  constructor(attributes) {
85167    super(CONFIG_NS_ID, "interactive");
85168  }
85169}
85170class Jog extends _xfa_object.OptionObject {
85171  constructor(attributes) {
85172    super(CONFIG_NS_ID, "jog", ["usePrinterSetting", "none", "pageSet"]);
85173  }
85174}
85175class LabelPrinter extends _xfa_object.XFAObject {
85176  constructor(attributes) {
85177    super(CONFIG_NS_ID, "labelPrinter", true);
85178    this.name = (0, _utils.getStringOption)(attributes.name, ["zpl", "dpl", "ipl", "tcpl"]);
85179    this.batchOutput = null;
85180    this.flipLabel = null;
85181    this.fontInfo = null;
85182    this.xdc = null;
85183  }
85184}
85185class Layout extends _xfa_object.OptionObject {
85186  constructor(attributes) {
85187    super(CONFIG_NS_ID, "layout", ["paginate", "panel"]);
85188  }
85189}
85190class Level extends _xfa_object.IntegerObject {
85191  constructor(attributes) {
85192    super(CONFIG_NS_ID, "level", 0, n => n > 0);
85193  }
85194}
85195class Linearized extends _xfa_object.Option01 {
85196  constructor(attributes) {
85197    super(CONFIG_NS_ID, "linearized");
85198  }
85199}
85200class Locale extends _xfa_object.StringObject {
85201  constructor(attributes) {
85202    super(CONFIG_NS_ID, "locale");
85203  }
85204}
85205class LocaleSet extends _xfa_object.StringObject {
85206  constructor(attributes) {
85207    super(CONFIG_NS_ID, "localeSet");
85208  }
85209}
85210class Log extends _xfa_object.XFAObject {
85211  constructor(attributes) {
85212    super(CONFIG_NS_ID, "log", true);
85213    this.mode = null;
85214    this.threshold = null;
85215    this.to = null;
85216    this.uri = null;
85217  }
85218}
85219class MapElement extends _xfa_object.XFAObject {
85220  constructor(attributes) {
85221    super(CONFIG_NS_ID, "map", true);
85222    this.equate = new _xfa_object.XFAObjectArray();
85223    this.equateRange = new _xfa_object.XFAObjectArray();
85224  }
85225}
85226class MediumInfo extends _xfa_object.XFAObject {
85227  constructor(attributes) {
85228    super(CONFIG_NS_ID, "mediumInfo", true);
85229    this.map = null;
85230  }
85231}
85232class Message extends _xfa_object.XFAObject {
85233  constructor(attributes) {
85234    super(CONFIG_NS_ID, "message", true);
85235    this.msgId = null;
85236    this.severity = null;
85237  }
85238}
85239class Messaging extends _xfa_object.XFAObject {
85240  constructor(attributes) {
85241    super(CONFIG_NS_ID, "messaging", true);
85242    this.message = new _xfa_object.XFAObjectArray();
85243  }
85244}
85245class Mode extends _xfa_object.OptionObject {
85246  constructor(attributes) {
85247    super(CONFIG_NS_ID, "mode", ["append", "overwrite"]);
85248  }
85249}
85250class ModifyAnnots extends _xfa_object.Option01 {
85251  constructor(attributes) {
85252    super(CONFIG_NS_ID, "modifyAnnots");
85253  }
85254}
85255class MsgId extends _xfa_object.IntegerObject {
85256  constructor(attributes) {
85257    super(CONFIG_NS_ID, "msgId", 1, n => n >= 1);
85258  }
85259}
85260class NameAttr extends _xfa_object.StringObject {
85261  constructor(attributes) {
85262    super(CONFIG_NS_ID, "nameAttr");
85263  }
85264}
85265class NeverEmbed extends _xfa_object.ContentObject {
85266  constructor(attributes) {
85267    super(CONFIG_NS_ID, "neverEmbed");
85268  }
85269}
85270class NumberOfCopies extends _xfa_object.IntegerObject {
85271  constructor(attributes) {
85272    super(CONFIG_NS_ID, "numberOfCopies", null, n => n >= 2 && n <= 5);
85273  }
85274}
85275class OpenAction extends _xfa_object.XFAObject {
85276  constructor(attributes) {
85277    super(CONFIG_NS_ID, "openAction", true);
85278    this.destination = null;
85279  }
85280}
85281class Output extends _xfa_object.XFAObject {
85282  constructor(attributes) {
85283    super(CONFIG_NS_ID, "output", true);
85284    this.to = null;
85285    this.type = null;
85286    this.uri = null;
85287  }
85288}
85289class OutputBin extends _xfa_object.StringObject {
85290  constructor(attributes) {
85291    super(CONFIG_NS_ID, "outputBin");
85292  }
85293}
85294class OutputXSL extends _xfa_object.XFAObject {
85295  constructor(attributes) {
85296    super(CONFIG_NS_ID, "outputXSL", true);
85297    this.uri = null;
85298  }
85299}
85300class Overprint extends _xfa_object.OptionObject {
85301  constructor(attributes) {
85302    super(CONFIG_NS_ID, "overprint", ["none", "both", "draw", "field"]);
85303  }
85304}
85305class Packets extends _xfa_object.StringObject {
85306  constructor(attributes) {
85307    super(CONFIG_NS_ID, "packets");
85308  }
85309  [_symbol_utils.$finalize]() {
85310    if (this[_symbol_utils.$content] === "*") {
85311      return;
85312    }
85313    this[_symbol_utils.$content] = this[_symbol_utils.$content].trim().split(/\s+/).filter(x => ["config", "datasets", "template", "xfdf", "xslt"].includes(x));
85314  }
85315}
85316class PageOffset extends _xfa_object.XFAObject {
85317  constructor(attributes) {
85318    super(CONFIG_NS_ID, "pageOffset");
85319    this.x = (0, _utils.getInteger)({
85320      data: attributes.x,
85321      defaultValue: "useXDCSetting",
85322      validate: n => true
85323    });
85324    this.y = (0, _utils.getInteger)({
85325      data: attributes.y,
85326      defaultValue: "useXDCSetting",
85327      validate: n => true
85328    });
85329  }
85330}
85331class PageRange extends _xfa_object.StringObject {
85332  constructor(attributes) {
85333    super(CONFIG_NS_ID, "pageRange");
85334  }
85335  [_symbol_utils.$finalize]() {
85336    const numbers = this[_symbol_utils.$content].trim().split(/\s+/).map(x => parseInt(x, 10));
85337    const ranges = [];
85338    for (let i = 0, ii = numbers.length; i < ii; i += 2) {
85339      ranges.push(numbers.slice(i, i + 2));
85340    }
85341    this[_symbol_utils.$content] = ranges;
85342  }
85343}
85344class Pagination extends _xfa_object.OptionObject {
85345  constructor(attributes) {
85346    super(CONFIG_NS_ID, "pagination", ["simplex", "duplexShortEdge", "duplexLongEdge"]);
85347  }
85348}
85349class PaginationOverride extends _xfa_object.OptionObject {
85350  constructor(attributes) {
85351    super(CONFIG_NS_ID, "paginationOverride", ["none", "forceDuplex", "forceDuplexLongEdge", "forceDuplexShortEdge", "forceSimplex"]);
85352  }
85353}
85354class Part extends _xfa_object.IntegerObject {
85355  constructor(attributes) {
85356    super(CONFIG_NS_ID, "part", 1, n => false);
85357  }
85358}
85359class Pcl extends _xfa_object.XFAObject {
85360  constructor(attributes) {
85361    super(CONFIG_NS_ID, "pcl", true);
85362    this.name = attributes.name || "";
85363    this.batchOutput = null;
85364    this.fontInfo = null;
85365    this.jog = null;
85366    this.mediumInfo = null;
85367    this.outputBin = null;
85368    this.pageOffset = null;
85369    this.staple = null;
85370    this.xdc = null;
85371  }
85372}
85373class Pdf extends _xfa_object.XFAObject {
85374  constructor(attributes) {
85375    super(CONFIG_NS_ID, "pdf", true);
85376    this.name = attributes.name || "";
85377    this.adobeExtensionLevel = null;
85378    this.batchOutput = null;
85379    this.compression = null;
85380    this.creator = null;
85381    this.encryption = null;
85382    this.fontInfo = null;
85383    this.interactive = null;
85384    this.linearized = null;
85385    this.openAction = null;
85386    this.pdfa = null;
85387    this.producer = null;
85388    this.renderPolicy = null;
85389    this.scriptModel = null;
85390    this.silentPrint = null;
85391    this.submitFormat = null;
85392    this.tagged = null;
85393    this.version = null;
85394    this.viewerPreferences = null;
85395    this.xdc = null;
85396  }
85397}
85398class Pdfa extends _xfa_object.XFAObject {
85399  constructor(attributes) {
85400    super(CONFIG_NS_ID, "pdfa", true);
85401    this.amd = null;
85402    this.conformance = null;
85403    this.includeXDPContent = null;
85404    this.part = null;
85405  }
85406}
85407class Permissions extends _xfa_object.XFAObject {
85408  constructor(attributes) {
85409    super(CONFIG_NS_ID, "permissions", true);
85410    this.accessibleContent = null;
85411    this.change = null;
85412    this.contentCopy = null;
85413    this.documentAssembly = null;
85414    this.formFieldFilling = null;
85415    this.modifyAnnots = null;
85416    this.plaintextMetadata = null;
85417    this.print = null;
85418    this.printHighQuality = null;
85419  }
85420}
85421class PickTrayByPDFSize extends _xfa_object.Option01 {
85422  constructor(attributes) {
85423    super(CONFIG_NS_ID, "pickTrayByPDFSize");
85424  }
85425}
85426class Picture extends _xfa_object.StringObject {
85427  constructor(attributes) {
85428    super(CONFIG_NS_ID, "picture");
85429  }
85430}
85431class PlaintextMetadata extends _xfa_object.Option01 {
85432  constructor(attributes) {
85433    super(CONFIG_NS_ID, "plaintextMetadata");
85434  }
85435}
85436class Presence extends _xfa_object.OptionObject {
85437  constructor(attributes) {
85438    super(CONFIG_NS_ID, "presence", ["preserve", "dissolve", "dissolveStructure", "ignore", "remove"]);
85439  }
85440}
85441class Present extends _xfa_object.XFAObject {
85442  constructor(attributes) {
85443    super(CONFIG_NS_ID, "present", true);
85444    this.behaviorOverride = null;
85445    this.cache = null;
85446    this.common = null;
85447    this.copies = null;
85448    this.destination = null;
85449    this.incrementalMerge = null;
85450    this.layout = null;
85451    this.output = null;
85452    this.overprint = null;
85453    this.pagination = null;
85454    this.paginationOverride = null;
85455    this.script = null;
85456    this.validate = null;
85457    this.xdp = null;
85458    this.driver = new _xfa_object.XFAObjectArray();
85459    this.labelPrinter = new _xfa_object.XFAObjectArray();
85460    this.pcl = new _xfa_object.XFAObjectArray();
85461    this.pdf = new _xfa_object.XFAObjectArray();
85462    this.ps = new _xfa_object.XFAObjectArray();
85463    this.submitUrl = new _xfa_object.XFAObjectArray();
85464    this.webClient = new _xfa_object.XFAObjectArray();
85465    this.zpl = new _xfa_object.XFAObjectArray();
85466  }
85467}
85468class Print extends _xfa_object.Option01 {
85469  constructor(attributes) {
85470    super(CONFIG_NS_ID, "print");
85471  }
85472}
85473class PrintHighQuality extends _xfa_object.Option01 {
85474  constructor(attributes) {
85475    super(CONFIG_NS_ID, "printHighQuality");
85476  }
85477}
85478class PrintScaling extends _xfa_object.OptionObject {
85479  constructor(attributes) {
85480    super(CONFIG_NS_ID, "printScaling", ["appdefault", "noScaling"]);
85481  }
85482}
85483class PrinterName extends _xfa_object.StringObject {
85484  constructor(attributes) {
85485    super(CONFIG_NS_ID, "printerName");
85486  }
85487}
85488class Producer extends _xfa_object.StringObject {
85489  constructor(attributes) {
85490    super(CONFIG_NS_ID, "producer");
85491  }
85492}
85493class Ps extends _xfa_object.XFAObject {
85494  constructor(attributes) {
85495    super(CONFIG_NS_ID, "ps", true);
85496    this.name = attributes.name || "";
85497    this.batchOutput = null;
85498    this.fontInfo = null;
85499    this.jog = null;
85500    this.mediumInfo = null;
85501    this.outputBin = null;
85502    this.staple = null;
85503    this.xdc = null;
85504  }
85505}
85506class Range extends _xfa_object.ContentObject {
85507  constructor(attributes) {
85508    super(CONFIG_NS_ID, "range");
85509  }
85510  [_symbol_utils.$finalize]() {
85511    this[_symbol_utils.$content] = this[_symbol_utils.$content].trim().split(/\s*,\s*/, 2).map(range => range.split("-").map(x => parseInt(x.trim(), 10))).filter(range => range.every(x => !isNaN(x))).map(range => {
85512      if (range.length === 1) {
85513        range.push(range[0]);
85514      }
85515      return range;
85516    });
85517  }
85518}
85519class Record extends _xfa_object.ContentObject {
85520  constructor(attributes) {
85521    super(CONFIG_NS_ID, "record");
85522  }
85523  [_symbol_utils.$finalize]() {
85524    this[_symbol_utils.$content] = this[_symbol_utils.$content].trim();
85525    const n = parseInt(this[_symbol_utils.$content], 10);
85526    if (!isNaN(n) && n >= 0) {
85527      this[_symbol_utils.$content] = n;
85528    }
85529  }
85530}
85531class Relevant extends _xfa_object.ContentObject {
85532  constructor(attributes) {
85533    super(CONFIG_NS_ID, "relevant");
85534  }
85535  [_symbol_utils.$finalize]() {
85536    this[_symbol_utils.$content] = this[_symbol_utils.$content].trim().split(/\s+/);
85537  }
85538}
85539class Rename extends _xfa_object.ContentObject {
85540  constructor(attributes) {
85541    super(CONFIG_NS_ID, "rename");
85542  }
85543  [_symbol_utils.$finalize]() {
85544    this[_symbol_utils.$content] = this[_symbol_utils.$content].trim();
85545    if (this[_symbol_utils.$content].toLowerCase().startsWith("xml") || new RegExp("[\\p{L}_][\\p{L}\\d._\\p{M}-]*", "u").test(this[_symbol_utils.$content])) {
85546      (0, _util.warn)("XFA - Rename: invalid XFA name");
85547    }
85548  }
85549}
85550class RenderPolicy extends _xfa_object.OptionObject {
85551  constructor(attributes) {
85552    super(CONFIG_NS_ID, "renderPolicy", ["server", "client"]);
85553  }
85554}
85555class RunScripts extends _xfa_object.OptionObject {
85556  constructor(attributes) {
85557    super(CONFIG_NS_ID, "runScripts", ["both", "client", "none", "server"]);
85558  }
85559}
85560class Script extends _xfa_object.XFAObject {
85561  constructor(attributes) {
85562    super(CONFIG_NS_ID, "script", true);
85563    this.currentPage = null;
85564    this.exclude = null;
85565    this.runScripts = null;
85566  }
85567}
85568class ScriptModel extends _xfa_object.OptionObject {
85569  constructor(attributes) {
85570    super(CONFIG_NS_ID, "scriptModel", ["XFA", "none"]);
85571  }
85572}
85573class Severity extends _xfa_object.OptionObject {
85574  constructor(attributes) {
85575    super(CONFIG_NS_ID, "severity", ["ignore", "error", "information", "trace", "warning"]);
85576  }
85577}
85578class SilentPrint extends _xfa_object.XFAObject {
85579  constructor(attributes) {
85580    super(CONFIG_NS_ID, "silentPrint", true);
85581    this.addSilentPrint = null;
85582    this.printerName = null;
85583  }
85584}
85585class Staple extends _xfa_object.XFAObject {
85586  constructor(attributes) {
85587    super(CONFIG_NS_ID, "staple");
85588    this.mode = (0, _utils.getStringOption)(attributes.mode, ["usePrinterSetting", "on", "off"]);
85589  }
85590}
85591class StartNode extends _xfa_object.StringObject {
85592  constructor(attributes) {
85593    super(CONFIG_NS_ID, "startNode");
85594  }
85595}
85596class StartPage extends _xfa_object.IntegerObject {
85597  constructor(attributes) {
85598    super(CONFIG_NS_ID, "startPage", 0, n => true);
85599  }
85600}
85601class SubmitFormat extends _xfa_object.OptionObject {
85602  constructor(attributes) {
85603    super(CONFIG_NS_ID, "submitFormat", ["html", "delegate", "fdf", "xml", "pdf"]);
85604  }
85605}
85606class SubmitUrl extends _xfa_object.StringObject {
85607  constructor(attributes) {
85608    super(CONFIG_NS_ID, "submitUrl");
85609  }
85610}
85611class SubsetBelow extends _xfa_object.IntegerObject {
85612  constructor(attributes) {
85613    super(CONFIG_NS_ID, "subsetBelow", 100, n => n >= 0 && n <= 100);
85614  }
85615}
85616class SuppressBanner extends _xfa_object.Option01 {
85617  constructor(attributes) {
85618    super(CONFIG_NS_ID, "suppressBanner");
85619  }
85620}
85621class Tagged extends _xfa_object.Option01 {
85622  constructor(attributes) {
85623    super(CONFIG_NS_ID, "tagged");
85624  }
85625}
85626class Template extends _xfa_object.XFAObject {
85627  constructor(attributes) {
85628    super(CONFIG_NS_ID, "template", true);
85629    this.base = null;
85630    this.relevant = null;
85631    this.startPage = null;
85632    this.uri = null;
85633    this.xsl = null;
85634  }
85635}
85636class Threshold extends _xfa_object.OptionObject {
85637  constructor(attributes) {
85638    super(CONFIG_NS_ID, "threshold", ["trace", "error", "information", "warning"]);
85639  }
85640}
85641class To extends _xfa_object.OptionObject {
85642  constructor(attributes) {
85643    super(CONFIG_NS_ID, "to", ["null", "memory", "stderr", "stdout", "system", "uri"]);
85644  }
85645}
85646class TemplateCache extends _xfa_object.XFAObject {
85647  constructor(attributes) {
85648    super(CONFIG_NS_ID, "templateCache");
85649    this.maxEntries = (0, _utils.getInteger)({
85650      data: attributes.maxEntries,
85651      defaultValue: 5,
85652      validate: n => n >= 0
85653    });
85654  }
85655}
85656class Trace extends _xfa_object.XFAObject {
85657  constructor(attributes) {
85658    super(CONFIG_NS_ID, "trace", true);
85659    this.area = new _xfa_object.XFAObjectArray();
85660  }
85661}
85662class Transform extends _xfa_object.XFAObject {
85663  constructor(attributes) {
85664    super(CONFIG_NS_ID, "transform", true);
85665    this.groupParent = null;
85666    this.ifEmpty = null;
85667    this.nameAttr = null;
85668    this.picture = null;
85669    this.presence = null;
85670    this.rename = null;
85671    this.whitespace = null;
85672  }
85673}
85674class Type extends _xfa_object.OptionObject {
85675  constructor(attributes) {
85676    super(CONFIG_NS_ID, "type", ["none", "ascii85", "asciiHex", "ccittfax", "flate", "lzw", "runLength", "native", "xdp", "mergedXDP"]);
85677  }
85678}
85679class Uri extends _xfa_object.StringObject {
85680  constructor(attributes) {
85681    super(CONFIG_NS_ID, "uri");
85682  }
85683}
85684class Validate extends _xfa_object.OptionObject {
85685  constructor(attributes) {
85686    super(CONFIG_NS_ID, "validate", ["preSubmit", "prePrint", "preExecute", "preSave"]);
85687  }
85688}
85689class ValidateApprovalSignatures extends _xfa_object.ContentObject {
85690  constructor(attributes) {
85691    super(CONFIG_NS_ID, "validateApprovalSignatures");
85692  }
85693  [_symbol_utils.$finalize]() {
85694    this[_symbol_utils.$content] = this[_symbol_utils.$content].trim().split(/\s+/).filter(x => ["docReady", "postSign"].includes(x));
85695  }
85696}
85697class ValidationMessaging extends _xfa_object.OptionObject {
85698  constructor(attributes) {
85699    super(CONFIG_NS_ID, "validationMessaging", ["allMessagesIndividually", "allMessagesTogether", "firstMessageOnly", "noMessages"]);
85700  }
85701}
85702class Version extends _xfa_object.OptionObject {
85703  constructor(attributes) {
85704    super(CONFIG_NS_ID, "version", ["1.7", "1.6", "1.5", "1.4", "1.3", "1.2"]);
85705  }
85706}
85707class VersionControl extends _xfa_object.XFAObject {
85708  constructor(attributes) {
85709    super(CONFIG_NS_ID, "VersionControl");
85710    this.outputBelow = (0, _utils.getStringOption)(attributes.outputBelow, ["warn", "error", "update"]);
85711    this.sourceAbove = (0, _utils.getStringOption)(attributes.sourceAbove, ["warn", "error"]);
85712    this.sourceBelow = (0, _utils.getStringOption)(attributes.sourceBelow, ["update", "maintain"]);
85713  }
85714}
85715class ViewerPreferences extends _xfa_object.XFAObject {
85716  constructor(attributes) {
85717    super(CONFIG_NS_ID, "viewerPreferences", true);
85718    this.ADBE_JSConsole = null;
85719    this.ADBE_JSDebugger = null;
85720    this.addViewerPreferences = null;
85721    this.duplexOption = null;
85722    this.enforce = null;
85723    this.numberOfCopies = null;
85724    this.pageRange = null;
85725    this.pickTrayByPDFSize = null;
85726    this.printScaling = null;
85727  }
85728}
85729class WebClient extends _xfa_object.XFAObject {
85730  constructor(attributes) {
85731    super(CONFIG_NS_ID, "webClient", true);
85732    this.name = attributes.name ? attributes.name.trim() : "";
85733    this.fontInfo = null;
85734    this.xdc = null;
85735  }
85736}
85737class Whitespace extends _xfa_object.OptionObject {
85738  constructor(attributes) {
85739    super(CONFIG_NS_ID, "whitespace", ["preserve", "ltrim", "normalize", "rtrim", "trim"]);
85740  }
85741}
85742class Window extends _xfa_object.ContentObject {
85743  constructor(attributes) {
85744    super(CONFIG_NS_ID, "window");
85745  }
85746  [_symbol_utils.$finalize]() {
85747    const pair = this[_symbol_utils.$content].trim().split(/\s*,\s*/, 2).map(x => parseInt(x, 10));
85748    if (pair.some(x => isNaN(x))) {
85749      this[_symbol_utils.$content] = [0, 0];
85750      return;
85751    }
85752    if (pair.length === 1) {
85753      pair.push(pair[0]);
85754    }
85755    this[_symbol_utils
vendor: 10,201 bytes, lines 85755-86216
85755.$content] = pair;
85756  }
85757}
85758class Xdc extends _xfa_object.XFAObject {
85759  constructor(attributes) {
85760    super(CONFIG_NS_ID, "xdc", true);
85761    this.uri = new _xfa_object.XFAObjectArray();
85762    this.xsl = new _xfa_object.XFAObjectArray();
85763  }
85764}
85765class Xdp extends _xfa_object.XFAObject {
85766  constructor(attributes) {
85767    super(CONFIG_NS_ID, "xdp", true);
85768    this.packets = null;
85769  }
85770}
85771class Xsl extends _xfa_object.XFAObject {
85772  constructor(attributes) {
85773    super(CONFIG_NS_ID, "xsl", true);
85774    this.debug = null;
85775    this.uri = null;
85776  }
85777}
85778class Zpl extends _xfa_object.XFAObject {
85779  constructor(attributes) {
85780    super(CONFIG_NS_ID, "zpl", true);
85781    this.name = attributes.name ? attributes.name.trim() : "";
85782    this.batchOutput = null;
85783    this.flipLabel = null;
85784    this.fontInfo = null;
85785    this.xdc = null;
85786  }
85787}
85788class ConfigNamespace {
85789  static [_namespaces.$buildXFAObject](name, attributes) {
85790    if (ConfigNamespace.hasOwnProperty(name)) {
85791      return ConfigNamespace[name](attributes);
85792    }
85793    return undefined;
85794  }
85795  static acrobat(attrs) {
85796    return new Acrobat(attrs);
85797  }
85798  static acrobat7(attrs) {
85799    return new Acrobat7(attrs);
85800  }
85801  static ADBE_JSConsole(attrs) {
85802    return new ADBE_JSConsole(attrs);
85803  }
85804  static ADBE_JSDebugger(attrs) {
85805    return new ADBE_JSDebugger(attrs);
85806  }
85807  static addSilentPrint(attrs) {
85808    return new AddSilentPrint(attrs);
85809  }
85810  static addViewerPreferences(attrs) {
85811    return new AddViewerPreferences(attrs);
85812  }
85813  static adjustData(attrs) {
85814    return new AdjustData(attrs);
85815  }
85816  static adobeExtensionLevel(attrs) {
85817    return new AdobeExtensionLevel(attrs);
85818  }
85819  static agent(attrs) {
85820    return new Agent(attrs);
85821  }
85822  static alwaysEmbed(attrs) {
85823    return new AlwaysEmbed(attrs);
85824  }
85825  static amd(attrs) {
85826    return new Amd(attrs);
85827  }
85828  static area(attrs) {
85829    return new Area(attrs);
85830  }
85831  static attributes(attrs) {
85832    return new Attributes(attrs);
85833  }
85834  static autoSave(attrs) {
85835    return new AutoSave(attrs);
85836  }
85837  static base(attrs) {
85838    return new Base(attrs);
85839  }
85840  static batchOutput(attrs) {
85841    return new BatchOutput(attrs);
85842  }
85843  static behaviorOverride(attrs) {
85844    return new BehaviorOverride(attrs);
85845  }
85846  static cache(attrs) {
85847    return new Cache(attrs);
85848  }
85849  static change(attrs) {
85850    return new Change(attrs);
85851  }
85852  static common(attrs) {
85853    return new Common(attrs);
85854  }
85855  static compress(attrs) {
85856    return new Compress(attrs);
85857  }
85858  static compressLogicalStructure(attrs) {
85859    return new CompressLogicalStructure(attrs);
85860  }
85861  static compressObjectStream(attrs) {
85862    return new CompressObjectStream(attrs);
85863  }
85864  static compression(attrs) {
85865    return new Compression(attrs);
85866  }
85867  static config(attrs) {
85868    return new Config(attrs);
85869  }
85870  static conformance(attrs) {
85871    return new Conformance(attrs);
85872  }
85873  static contentCopy(attrs) {
85874    return new ContentCopy(attrs);
85875  }
85876  static copies(attrs) {
85877    return new Copies(attrs);
85878  }
85879  static creator(attrs) {
85880    return new Creator(attrs);
85881  }
85882  static currentPage(attrs) {
85883    return new CurrentPage(attrs);
85884  }
85885  static data(attrs) {
85886    return new Data(attrs);
85887  }
85888  static debug(attrs) {
85889    return new Debug(attrs);
85890  }
85891  static defaultTypeface(attrs) {
85892    return new DefaultTypeface(attrs);
85893  }
85894  static destination(attrs) {
85895    return new Destination(attrs);
85896  }
85897  static documentAssembly(attrs) {
85898    return new DocumentAssembly(attrs);
85899  }
85900  static driver(attrs) {
85901    return new Driver(attrs);
85902  }
85903  static duplexOption(attrs) {
85904    return new DuplexOption(attrs);
85905  }
85906  static dynamicRender(attrs) {
85907    return new DynamicRender(attrs);
85908  }
85909  static embed(attrs) {
85910    return new Embed(attrs);
85911  }
85912  static encrypt(attrs) {
85913    return new Encrypt(attrs);
85914  }
85915  static encryption(attrs) {
85916    return new Encryption(attrs);
85917  }
85918  static encryptionLevel(attrs) {
85919    return new EncryptionLevel(attrs);
85920  }
85921  static enforce(attrs) {
85922    return new Enforce(attrs);
85923  }
85924  static equate(attrs) {
85925    return new Equate(attrs);
85926  }
85927  static equateRange(attrs) {
85928    return new EquateRange(attrs);
85929  }
85930  static exclude(attrs) {
85931    return new Exclude(attrs);
85932  }
85933  static excludeNS(attrs) {
85934    return new ExcludeNS(attrs);
85935  }
85936  static flipLabel(attrs) {
85937    return new FlipLabel(attrs);
85938  }
85939  static fontInfo(attrs) {
85940    return new FontInfo(attrs);
85941  }
85942  static formFieldFilling(attrs) {
85943    return new FormFieldFilling(attrs);
85944  }
85945  static groupParent(attrs) {
85946    return new GroupParent(attrs);
85947  }
85948  static ifEmpty(attrs) {
85949    return new IfEmpty(attrs);
85950  }
85951  static includeXDPContent(attrs) {
85952    return new IncludeXDPContent(attrs);
85953  }
85954  static incrementalLoad(attrs) {
85955    return new IncrementalLoad(attrs);
85956  }
85957  static incrementalMerge(attrs) {
85958    return new IncrementalMerge(attrs);
85959  }
85960  static interactive(attrs) {
85961    return new Interactive(attrs);
85962  }
85963  static jog(attrs) {
85964    return new Jog(attrs);
85965  }
85966  static labelPrinter(attrs) {
85967    return new LabelPrinter(attrs);
85968  }
85969  static layout(attrs) {
85970    return new Layout(attrs);
85971  }
85972  static level(attrs) {
85973    return new Level(attrs);
85974  }
85975  static linearized(attrs) {
85976    return new Linearized(attrs);
85977  }
85978  static locale(attrs) {
85979    return new Locale(attrs);
85980  }
85981  static localeSet(attrs) {
85982    return new LocaleSet(attrs);
85983  }
85984  static log(attrs) {
85985    return new Log(attrs);
85986  }
85987  static map(attrs) {
85988    return new MapElement(attrs);
85989  }
85990  static mediumInfo(attrs) {
85991    return new MediumInfo(attrs);
85992  }
85993  static message(attrs) {
85994    return new Message(attrs);
85995  }
85996  static messaging(attrs) {
85997    return new Messaging(attrs);
85998  }
85999  static mode(attrs) {
86000    return new Mode(attrs);
86001  }
86002  static modifyAnnots(attrs) {
86003    return new ModifyAnnots(attrs);
86004  }
86005  static msgId(attrs) {
86006    return new MsgId(attrs);
86007  }
86008  static nameAttr(attrs) {
86009    return new NameAttr(attrs);
86010  }
86011  static neverEmbed(attrs) {
86012    return new NeverEmbed(attrs);
86013  }
86014  static numberOfCopies(attrs) {
86015    return new NumberOfCopies(attrs);
86016  }
86017  static openAction(attrs) {
86018    return new OpenAction(attrs);
86019  }
86020  static output(attrs) {
86021    return new Output(attrs);
86022  }
86023  static outputBin(attrs) {
86024    return new OutputBin(attrs);
86025  }
86026  static outputXSL(attrs) {
86027    return new OutputXSL(attrs);
86028  }
86029  static overprint(attrs) {
86030    return new Overprint(attrs);
86031  }
86032  static packets(attrs) {
86033    return new Packets(attrs);
86034  }
86035  static pageOffset(attrs) {
86036    return new PageOffset(attrs);
86037  }
86038  static pageRange(attrs) {
86039    return new PageRange(attrs);
86040  }
86041  static pagination(attrs) {
86042    return new Pagination(attrs);
86043  }
86044  static paginationOverride(attrs) {
86045    return new PaginationOverride(attrs);
86046  }
86047  static part(attrs) {
86048    return new Part(attrs);
86049  }
86050  static pcl(attrs) {
86051    return new Pcl(attrs);
86052  }
86053  static pdf(attrs) {
86054    return new Pdf(attrs);
86055  }
86056  static pdfa(attrs) {
86057    return new Pdfa(attrs);
86058  }
86059  static permissions(attrs) {
86060    return new Permissions(attrs);
86061  }
86062  static pickTrayByPDFSize(attrs) {
86063    return new PickTrayByPDFSize(attrs);
86064  }
86065  static picture(attrs) {
86066    return new Picture(attrs);
86067  }
86068  static plaintextMetadata(attrs) {
86069    return new PlaintextMetadata(attrs);
86070  }
86071  static presence(attrs) {
86072    return new Presence(attrs);
86073  }
86074  static present(attrs) {
86075    return new Present(attrs);
86076  }
86077  static print(attrs) {
86078    return new Print(attrs);
86079  }
86080  static printHighQuality(attrs) {
86081    return new PrintHighQuality(attrs);
86082  }
86083  static printScaling(attrs) {
86084    return new PrintScaling(attrs);
86085  }
86086  static printerName(attrs) {
86087    return new PrinterName(attrs);
86088  }
86089  static producer(attrs) {
86090    return new Producer(attrs);
86091  }
86092  static ps(attrs) {
86093    return new Ps(attrs);
86094  }
86095  static range(attrs) {
86096    return new Range(attrs);
86097  }
86098  static record(attrs) {
86099    return new Record(attrs);
86100  }
86101  static relevant(attrs) {
86102    return new Relevant(attrs);
86103  }
86104  static rename(attrs) {
86105    return new Rename(attrs);
86106  }
86107  static renderPolicy(attrs) {
86108    return new RenderPolicy(attrs);
86109  }
86110  static runScripts(attrs) {
86111    return new RunScripts(attrs);
86112  }
86113  static script(attrs) {
86114    return new Script(attrs);
86115  }
86116  static scriptModel(attrs) {
86117    return new ScriptModel(attrs);
86118  }
86119  static severity(attrs) {
86120    return new Severity(attrs);
86121  }
86122  static silentPrint(attrs) {
86123    return new SilentPrint(attrs);
86124  }
86125  static staple(attrs) {
86126    return new Staple(attrs);
86127  }
86128  static startNode(attrs) {
86129    return new StartNode(attrs);
86130  }
86131  static startPage(attrs) {
86132    return new StartPage(attrs);
86133  }
86134  static submitFormat(attrs) {
86135    return new SubmitFormat(attrs);
86136  }
86137  static submitUrl(attrs) {
86138    return new SubmitUrl(attrs);
86139  }
86140  static subsetBelow(attrs) {
86141    return new SubsetBelow(attrs);
86142  }
86143  static suppressBanner(attrs) {
86144    return new SuppressBanner(attrs);
86145  }
86146  static tagged(attrs) {
86147    return new Tagged(attrs);
86148  }
86149  static template(attrs) {
86150    return new Template(attrs);
86151  }
86152  static templateCache(attrs) {
86153    return new TemplateCache(attrs);
86154  }
86155  static threshold(attrs) {
86156    return new Threshold(attrs);
86157  }
86158  static to(attrs) {
86159    return new To(attrs);
86160  }
86161  static trace(attrs) {
86162    return new Trace(attrs);
86163  }
86164  static transform(attrs) {
86165    return new Transform(attrs);
86166  }
86167  static type(attrs) {
86168    return new Type(attrs);
86169  }
86170  static uri(attrs) {
86171    return new Uri(attrs);
86172  }
86173  static validate(attrs) {
86174    return new Validate(attrs);
86175  }
86176  static validateApprovalSignatures(attrs) {
86177    return new ValidateApprovalSignatures(attrs);
86178  }
86179  static validationMessaging(attrs) {
86180    return new ValidationMessaging(attrs);
86181  }
86182  static version(attrs) {
86183    return new Version(attrs);
86184  }
86185  static versionControl(attrs) {
86186    return new VersionControl(attrs);
86187  }
86188  static viewerPreferences(attrs) {
86189    return new ViewerPreferences(attrs);
86190  }
86191  static webClient(attrs) {
86192    return new WebClient(attrs);
86193  }
86194  static whitespace(attrs) {
86195    return new Whitespace(attrs);
86196  }
86197  static window(attrs) {
86198    return new Window(attrs);
86199  }
86200  static xdc(attrs) {
86201    return new Xdc(attrs);
86202  }
86203  static xdp(attrs) {
86204    return new Xdp(attrs);
86205  }
86206  static xsl(attrs) {
86207    return new Xsl(attrs);
86208  }
86209  static zpl(attrs) {
86210    return new Zpl(attrs);
86211  }
86212}
86213exports.ConfigNamespace = ConfigNamespace;
86214
86215/***/ }),
86216/* 9
vendor: 7,040 bytes, lines 86216-86450
862164 */
86217/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
86218
86219
86220
86221Object.defineProperty(exports, "__esModule", ({
86222  value: true
86223}));
86224exports.ConnectionSetNamespace = void 0;
86225var _namespaces = __w_pdfjs_require__(81);
86226var _xfa_object = __w_pdfjs_require__(87);
86227const CONNECTION_SET_NS_ID = _namespaces.NamespaceIds.connectionSet.id;
86228class ConnectionSet extends _xfa_object.XFAObject {
86229  constructor(attributes) {
86230    super(CONNECTION_SET_NS_ID, "connectionSet", true);
86231    this.wsdlConnection = new _xfa_object.XFAObjectArray();
86232    this.xmlConnection = new _xfa_object.XFAObjectArray();
86233    this.xsdConnection = new _xfa_object.XFAObjectArray();
86234  }
86235}
86236class EffectiveInputPolicy extends _xfa_object.XFAObject {
86237  constructor(attributes) {
86238    super(CONNECTION_SET_NS_ID, "effectiveInputPolicy");
86239    this.id = attributes.id || "";
86240    this.name = attributes.name || "";
86241    this.use = attributes.use || "";
86242    this.usehref = attributes.usehref || "";
86243  }
86244}
86245class EffectiveOutputPolicy extends _xfa_object.XFAObject {
86246  constructor(attributes) {
86247    super(CONNECTION_SET_NS_ID, "effectiveOutputPolicy");
86248    this.id = attributes.id || "";
86249    this.name = attributes.name || "";
86250    this.use = attributes.use || "";
86251    this.usehref = attributes.usehref || "";
86252  }
86253}
86254class Operation extends _xfa_object.StringObject {
86255  constructor(attributes) {
86256    super(CONNECTION_SET_NS_ID, "operation");
86257    this.id = attributes.id || "";
86258    this.input = attributes.input || "";
86259    this.name = attributes.name || "";
86260    this.output = attributes.output || "";
86261    this.use = attributes.use || "";
86262    this.usehref = attributes.usehref || "";
86263  }
86264}
86265class RootElement extends _xfa_object.StringObject {
86266  constructor(attributes) {
86267    super(CONNECTION_SET_NS_ID, "rootElement");
86268    this.id = attributes.id || "";
86269    this.name = attributes.name || "";
86270    this.use = attributes.use || "";
86271    this.usehref = attributes.usehref || "";
86272  }
86273}
86274class SoapAction extends _xfa_object.StringObject {
86275  constructor(attributes) {
86276    super(CONNECTION_SET_NS_ID, "soapAction");
86277    this.id = attributes.id || "";
86278    this.name = attributes.name || "";
86279    this.use = attributes.use || "";
86280    this.usehref = attributes.usehref || "";
86281  }
86282}
86283class SoapAddress extends _xfa_object.StringObject {
86284  constructor(attributes) {
86285    super(CONNECTION_SET_NS_ID, "soapAddress");
86286    this.id = attributes.id || "";
86287    this.name = attributes.name || "";
86288    this.use = attributes.use || "";
86289    this.usehref = attributes.usehref || "";
86290  }
86291}
86292class Uri extends _xfa_object.StringObject {
86293  constructor(attributes) {
86294    super(CONNECTION_SET_NS_ID, "uri");
86295    this.id = attributes.id || "";
86296    this.name = attributes.name || "";
86297    this.use = attributes.use || "";
86298    this.usehref = attributes.usehref || "";
86299  }
86300}
86301class WsdlAddress extends _xfa_object.StringObject {
86302  constructor(attributes) {
86303    super(CONNECTION_SET_NS_ID, "wsdlAddress");
86304    this.id = attributes.id || "";
86305    this.name = attributes.name || "";
86306    this.use = attributes.use || "";
86307    this.usehref = attributes.usehref || "";
86308  }
86309}
86310class WsdlConnection extends _xfa_object.XFAObject {
86311  constructor(attributes) {
86312    super(CONNECTION_SET_NS_ID, "wsdlConnection", true);
86313    this.dataDescription = attributes.dataDescription || "";
86314    this.name = attributes.name || "";
86315    this.effectiveInputPolicy = null;
86316    this.effectiveOutputPolicy = null;
86317    this.operation = null;
86318    this.soapAction = null;
86319    this.soapAddress = null;
86320    this.wsdlAddress = null;
86321  }
86322}
86323class XmlConnection extends _xfa_object.XFAObject {
86324  constructor(attributes) {
86325    super(CONNECTION_SET_NS_ID, "xmlConnection", true);
86326    this.dataDescription = attributes.dataDescription || "";
86327    this.name = attributes.name || "";
86328    this.uri = null;
86329  }
86330}
86331class XsdConnection extends _xfa_object.XFAObject {
86332  constructor(attributes) {
86333    super(CONNECTION_SET_NS_ID, "xsdConnection", true);
86334    this.dataDescription = attributes.dataDescription || "";
86335    this.name = attributes.name || "";
86336    this.rootElement = null;
86337    this.uri = null;
86338  }
86339}
86340class ConnectionSetNamespace {
86341  static [_namespaces.$buildXFAObject](name, attributes) {
86342    if (ConnectionSetNamespace.hasOwnProperty(name)) {
86343      return ConnectionSetNamespace[name](attributes);
86344    }
86345    return undefined;
86346  }
86347  static connectionSet(attrs) {
86348    return new ConnectionSet(attrs);
86349  }
86350  static effectiveInputPolicy(attrs) {
86351    return new EffectiveInputPolicy(attrs);
86352  }
86353  static effectiveOutputPolicy(attrs) {
86354    return new EffectiveOutputPolicy(attrs);
86355  }
86356  static operation(attrs) {
86357    return new Operation(attrs);
86358  }
86359  static rootElement(attrs) {
86360    return new RootElement(attrs);
86361  }
86362  static soapAction(attrs) {
86363    return new SoapAction(attrs);
86364  }
86365  static soapAddress(attrs) {
86366    return new SoapAddress(attrs);
86367  }
86368  static uri(attrs) {
86369    return new Uri(attrs);
86370  }
86371  static wsdlAddress(attrs) {
86372    return new WsdlAddress(attrs);
86373  }
86374  static wsdlConnection(attrs) {
86375    return new WsdlConnection(attrs);
86376  }
86377  static xmlConnection(attrs) {
86378    return new XmlConnection(attrs);
86379  }
86380  static xsdConnection(attrs) {
86381    return new XsdConnection(attrs);
86382  }
86383}
86384exports.ConnectionSetNamespace = ConnectionSetNamespace;
86385
86386/***/ }),
86387/* 95 */
86388/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
86389
86390
86391
86392Object.defineProperty(exports, "__esModule", ({
86393  value: true
86394}));
86395exports.DatasetsNamespace = void 0;
86396var _symbol_utils = __w_pdfjs_require__(78);
86397var _namespaces = __w_pdfjs_require__(81);
86398var _xfa_object = __w_pdfjs_require__(87);
86399const DATASETS_NS_ID = _namespaces.NamespaceIds.datasets.id;
86400class Data extends _xfa_object.XmlObject {
86401  constructor(attributes) {
86402    super(DATASETS_NS_ID, "data", attributes);
86403  }
86404  [_symbol_utils.$isNsAgnostic]() {
86405    return true;
86406  }
86407}
86408class Datasets extends _xfa_object.XFAObject {
86409  constructor(attributes) {
86410    super(DATASETS_NS_ID, "datasets", true);
86411    this.data = null;
86412    this.Signature = null;
86413  }
86414  [_symbol_utils.$onChild](child) {
86415    const name = child[_symbol_utils.$nodeName];
86416    if (name === "data" && child[_symbol_utils.$namespaceId] === DATASETS_NS_ID || name === "Signature" && child[_symbol_utils.$namespaceId] === _namespaces.NamespaceIds.signature.id) {
86417      this[name] = child;
86418    }
86419    this[_symbol_utils.$appendChild](child);
86420  }
86421}
86422class DatasetsNamespace {
86423  static [_namespaces.$buildXFAObject](name, attributes) {
86424    if (DatasetsNamespace.hasOwnProperty(name)) {
86425      return DatasetsNamespace[name](attributes);
86426    }
86427    return undefined;
86428  }
86429  static datasets(attributes) {
86430    return new Datasets(attributes);
86431  }
86432  static data(attributes) {
86433    return new Data(attributes);
86434  }
86435}
86436exports.DatasetsNamespace = DatasetsNamespace;
86437
86438/***/ }),
86439/* 96 */
86440/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
86441
86442
86443
86444Object.defineProperty(exports, "__esModule", ({
86445  value: true
86446}));
86447exports.LocaleSetNamespace = void 0;
86448var _namespaces = __w_pdfjs_require__(81);
86449var _xfa_object = __w_pdfjs_require__(87);
86450var _utils = __w_pdfjs_require__(84
vendor: 7,048 bytes, lines 86450-86697
86450);
86451const LOCALE_SET_NS_ID = _namespaces.NamespaceIds.localeSet.id;
86452class CalendarSymbols extends _xfa_object.XFAObject {
86453  constructor(attributes) {
86454    super(LOCALE_SET_NS_ID, "calendarSymbols", true);
86455    this.name = "gregorian";
86456    this.dayNames = new _xfa_object.XFAObjectArray(2);
86457    this.eraNames = null;
86458    this.meridiemNames = null;
86459    this.monthNames = new _xfa_object.XFAObjectArray(2);
86460  }
86461}
86462class CurrencySymbol extends _xfa_object.StringObject {
86463  constructor(attributes) {
86464    super(LOCALE_SET_NS_ID, "currencySymbol");
86465    this.name = (0, _utils.getStringOption)(attributes.name, ["symbol", "isoname", "decimal"]);
86466  }
86467}
86468class CurrencySymbols extends _xfa_object.XFAObject {
86469  constructor(attributes) {
86470    super(LOCALE_SET_NS_ID, "currencySymbols", true);
86471    this.currencySymbol = new _xfa_object.XFAObjectArray(3);
86472  }
86473}
86474class DatePattern extends _xfa_object.StringObject {
86475  constructor(attributes) {
86476    super(LOCALE_SET_NS_ID, "datePattern");
86477    this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
86478  }
86479}
86480class DatePatterns extends _xfa_object.XFAObject {
86481  constructor(attributes) {
86482    super(LOCALE_SET_NS_ID, "datePatterns", true);
86483    this.datePattern = new _xfa_object.XFAObjectArray(4);
86484  }
86485}
86486class DateTimeSymbols extends _xfa_object.ContentObject {
86487  constructor(attributes) {
86488    super(LOCALE_SET_NS_ID, "dateTimeSymbols");
86489  }
86490}
86491class Day extends _xfa_object.StringObject {
86492  constructor(attributes) {
86493    super(LOCALE_SET_NS_ID, "day");
86494  }
86495}
86496class DayNames extends _xfa_object.XFAObject {
86497  constructor(attributes) {
86498    super(LOCALE_SET_NS_ID, "dayNames", true);
86499    this.abbr = (0, _utils.getInteger)({
86500      data: attributes.abbr,
86501      defaultValue: 0,
86502      validate: x => x === 1
86503    });
86504    this.day = new _xfa_object.XFAObjectArray(7);
86505  }
86506}
86507class Era extends _xfa_object.StringObject {
86508  constructor(attributes) {
86509    super(LOCALE_SET_NS_ID, "era");
86510  }
86511}
86512class EraNames extends _xfa_object.XFAObject {
86513  constructor(attributes) {
86514    super(LOCALE_SET_NS_ID, "eraNames", true);
86515    this.era = new _xfa_object.XFAObjectArray(2);
86516  }
86517}
86518class Locale extends _xfa_object.XFAObject {
86519  constructor(attributes) {
86520    super(LOCALE_SET_NS_ID, "locale", true);
86521    this.desc = attributes.desc || "";
86522    this.name = "isoname";
86523    this.calendarSymbols = null;
86524    this.currencySymbols = null;
86525    this.datePatterns = null;
86526    this.dateTimeSymbols = null;
86527    this.numberPatterns = null;
86528    this.numberSymbols = null;
86529    this.timePatterns = null;
86530    this.typeFaces = null;
86531  }
86532}
86533class LocaleSet extends _xfa_object.XFAObject {
86534  constructor(attributes) {
86535    super(LOCALE_SET_NS_ID, "localeSet", true);
86536    this.locale = new _xfa_object.XFAObjectArray();
86537  }
86538}
86539class Meridiem extends _xfa_object.StringObject {
86540  constructor(attributes) {
86541    super(LOCALE_SET_NS_ID, "meridiem");
86542  }
86543}
86544class MeridiemNames extends _xfa_object.XFAObject {
86545  constructor(attributes) {
86546    super(LOCALE_SET_NS_ID, "meridiemNames", true);
86547    this.meridiem = new _xfa_object.XFAObjectArray(2);
86548  }
86549}
86550class Month extends _xfa_object.StringObject {
86551  constructor(attributes) {
86552    super(LOCALE_SET_NS_ID, "month");
86553  }
86554}
86555class MonthNames extends _xfa_object.XFAObject {
86556  constructor(attributes) {
86557    super(LOCALE_SET_NS_ID, "monthNames", true);
86558    this.abbr = (0, _utils.getInteger)({
86559      data: attributes.abbr,
86560      defaultValue: 0,
86561      validate: x => x === 1
86562    });
86563    this.month = new _xfa_object.XFAObjectArray(12);
86564  }
86565}
86566class NumberPattern extends _xfa_object.StringObject {
86567  constructor(attributes) {
86568    super(LOCALE_SET_NS_ID, "numberPattern");
86569    this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
86570  }
86571}
86572class NumberPatterns extends _xfa_object.XFAObject {
86573  constructor(attributes) {
86574    super(LOCALE_SET_NS_ID, "numberPatterns", true);
86575    this.numberPattern = new _xfa_object.XFAObjectArray(4);
86576  }
86577}
86578class NumberSymbol extends _xfa_object.StringObject {
86579  constructor(attributes) {
86580    super(LOCALE_SET_NS_ID, "numberSymbol");
86581    this.name = (0, _utils.getStringOption)(attributes.name, ["decimal", "grouping", "percent", "minus", "zero"]);
86582  }
86583}
86584class NumberSymbols extends _xfa_object.XFAObject {
86585  constructor(attributes) {
86586    super(LOCALE_SET_NS_ID, "numberSymbols", true);
86587    this.numberSymbol = new _xfa_object.XFAObjectArray(5);
86588  }
86589}
86590class TimePattern extends _xfa_object.StringObject {
86591  constructor(attributes) {
86592    super(LOCALE_SET_NS_ID, "timePattern");
86593    this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
86594  }
86595}
86596class TimePatterns extends _xfa_object.XFAObject {
86597  constructor(attributes) {
86598    super(LOCALE_SET_NS_ID, "timePatterns", true);
86599    this.timePattern = new _xfa_object.XFAObjectArray(4);
86600  }
86601}
86602class TypeFace extends _xfa_object.XFAObject {
86603  constructor(attributes) {
86604    super(LOCALE_SET_NS_ID, "typeFace", true);
86605    this.name = attributes.name | "";
86606  }
86607}
86608class TypeFaces extends _xfa_object.XFAObject {
86609  constructor(attributes) {
86610    super(LOCALE_SET_NS_ID, "typeFaces", true);
86611    this.typeFace = new _xfa_object.XFAObjectArray();
86612  }
86613}
86614class LocaleSetNamespace {
86615  static [_namespaces.$buildXFAObject](name, attributes) {
86616    if (LocaleSetNamespace.hasOwnProperty(name)) {
86617      return LocaleSetNamespace[name](attributes);
86618    }
86619    return undefined;
86620  }
86621  static calendarSymbols(attrs) {
86622    return new CalendarSymbols(attrs);
86623  }
86624  static currencySymbol(attrs) {
86625    return new CurrencySymbol(attrs);
86626  }
86627  static currencySymbols(attrs) {
86628    return new CurrencySymbols(attrs);
86629  }
86630  static datePattern(attrs) {
86631    return new DatePattern(attrs);
86632  }
86633  static datePatterns(attrs) {
86634    return new DatePatterns(attrs);
86635  }
86636  static dateTimeSymbols(attrs) {
86637    return new DateTimeSymbols(attrs);
86638  }
86639  static day(attrs) {
86640    return new Day(attrs);
86641  }
86642  static dayNames(attrs) {
86643    return new DayNames(attrs);
86644  }
86645  static era(attrs) {
86646    return new Era(attrs);
86647  }
86648  static eraNames(attrs) {
86649    return new EraNames(attrs);
86650  }
86651  static locale(attrs) {
86652    return new Locale(attrs);
86653  }
86654  static localeSet(attrs) {
86655    return new LocaleSet(attrs);
86656  }
86657  static meridiem(attrs) {
86658    return new Meridiem(attrs);
86659  }
86660  static meridiemNames(attrs) {
86661    return new MeridiemNames(attrs);
86662  }
86663  static month(attrs) {
86664    return new Month(attrs);
86665  }
86666  static monthNames(attrs) {
86667    return new MonthNames(attrs);
86668  }
86669  static numberPattern(attrs) {
86670    return new NumberPattern(attrs);
86671  }
86672  static numberPatterns(attrs) {
86673    return new NumberPatterns(attrs);
86674  }
86675  static numberSymbol(attrs) {
86676    return new NumberSymbol(attrs);
86677  }
86678  static numberSymbols(attrs) {
86679    return new NumberSymbols(attrs);
86680  }
86681  static timePattern(attrs) {
86682    return new TimePattern(attrs);
86683  }
86684  static timePatterns(attrs) {
86685    return new TimePatterns(attrs);
86686  }
86687  static typeFace(attrs) {
86688    return new TypeFace(attrs);
86689  }
86690  static typeFaces(attrs) {
86691    return new TypeFaces(attrs);
86692  }
86693}
86694exports.LocaleSetNamespace = LocaleSetNamespace;
86695
86696/***/ }),
86697/* 9
vendor: 29,757 bytes, lines 86697-87650
866977 */
86698/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
86699
86700
86701
86702Object.defineProperty(exports, "__esModule", ({
86703  value: true
86704}));
86705exports.SignatureNamespace = void 0;
86706var _namespaces = __w_pdfjs_require__(81);
86707var _xfa_object = __w_pdfjs_require__(87);
86708const SIGNATURE_NS_ID = _namespaces.NamespaceIds.signature.id;
86709class Signature extends _xfa_object.XFAObject {
86710  constructor(attributes) {
86711    super(SIGNATURE_NS_ID, "signature", true);
86712  }
86713}
86714class SignatureNamespace {
86715  static [_namespaces.$buildXFAObject](name, attributes) {
86716    if (SignatureNamespace.hasOwnProperty(name)) {
86717      return SignatureNamespace[name](attributes);
86718    }
86719    return undefined;
86720  }
86721  static signature(attributes) {
86722    return new Signature(attributes);
86723  }
86724}
86725exports.SignatureNamespace = SignatureNamespace;
86726
86727/***/ }),
86728/* 98 */
86729/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
86730
86731
86732
86733Object.defineProperty(exports, "__esModule", ({
86734  value: true
86735}));
86736exports.StylesheetNamespace = void 0;
86737var _namespaces = __w_pdfjs_require__(81);
86738var _xfa_object = __w_pdfjs_require__(87);
86739const STYLESHEET_NS_ID = _namespaces.NamespaceIds.stylesheet.id;
86740class Stylesheet extends _xfa_object.XFAObject {
86741  constructor(attributes) {
86742    super(STYLESHEET_NS_ID, "stylesheet", true);
86743  }
86744}
86745class StylesheetNamespace {
86746  static [_namespaces.$buildXFAObject](name, attributes) {
86747    if (StylesheetNamespace.hasOwnProperty(name)) {
86748      return StylesheetNamespace[name](attributes);
86749    }
86750    return undefined;
86751  }
86752  static stylesheet(attributes) {
86753    return new Stylesheet(attributes);
86754  }
86755}
86756exports.StylesheetNamespace = StylesheetNamespace;
86757
86758/***/ }),
86759/* 99 */
86760/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
86761
86762
86763
86764Object.defineProperty(exports, "__esModule", ({
86765  value: true
86766}));
86767exports.XdpNamespace = void 0;
86768var _namespaces = __w_pdfjs_require__(81);
86769var _symbol_utils = __w_pdfjs_require__(78);
86770var _xfa_object = __w_pdfjs_require__(87);
86771const XDP_NS_ID = _namespaces.NamespaceIds.xdp.id;
86772class Xdp extends _xfa_object.XFAObject {
86773  constructor(attributes) {
86774    super(XDP_NS_ID, "xdp", true);
86775    this.uuid = attributes.uuid || "";
86776    this.timeStamp = attributes.timeStamp || "";
86777    this.config = null;
86778    this.connectionSet = null;
86779    this.datasets = null;
86780    this.localeSet = null;
86781    this.stylesheet = new _xfa_object.XFAObjectArray();
86782    this.template = null;
86783  }
86784  [_symbol_utils.$onChildCheck](child) {
86785    const ns = _namespaces.NamespaceIds[child[_symbol_utils.$nodeName]];
86786    return ns && child[_symbol_utils.$namespaceId] === ns.id;
86787  }
86788}
86789class XdpNamespace {
86790  static [_namespaces.$buildXFAObject](name, attributes) {
86791    if (XdpNamespace.hasOwnProperty(name)) {
86792      return XdpNamespace[name](attributes);
86793    }
86794    return undefined;
86795  }
86796  static xdp(attributes) {
86797    return new Xdp(attributes);
86798  }
86799}
86800exports.XdpNamespace = XdpNamespace;
86801
86802/***/ }),
86803/* 100 */
86804/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
86805
86806
86807
86808Object.defineProperty(exports, "__esModule", ({
86809  value: true
86810}));
86811exports.XhtmlNamespace = void 0;
86812var _symbol_utils = __w_pdfjs_require__(78);
86813var _namespaces = __w_pdfjs_require__(81);
86814var _html_utils = __w_pdfjs_require__(83);
86815var _utils = __w_pdfjs_require__(84);
86816var _xfa_object = __w_pdfjs_require__(87);
86817const XHTML_NS_ID = _namespaces.NamespaceIds.xhtml.id;
86818const $richText = Symbol();
86819const 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"]);
86820const 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, Math.min(parseInt(value) / 100)).toFixed(2)})`], ["xfa-font-vertical-scale", value => `scaleY(${Math.max(0, Math.min(parseInt(value) / 100)).toFixed(2)})`], ["xfa-spacerun", ""], ["xfa-tab-stops", ""], ["font-size", (value, original) => {
86821  value = original.fontSize = (0, _utils.getMeasurement)(value);
86822  return (0, _html_utils.measureToString)(0.99 * value);
86823}], ["letter-spacing", value => (0, _html_utils.measureToString)((0, _utils.getMeasurement)(value))], ["line-height", value => (0, _html_utils.measureToString)((0, _utils.getMeasurement)(value))], ["margin", value => (0, _html_utils.measureToString)((0, _utils.getMeasurement)(value))], ["margin-bottom", value => (0, _html_utils.measureToString)((0, _utils.getMeasurement)(value))], ["margin-left", value => (0, _html_utils.measureToString)((0, _utils.getMeasurement)(value))], ["margin-right", value => (0, _html_utils.measureToString)((0, _utils.getMeasurement)(value))], ["margin-top", value => (0, _html_utils.measureToString)((0, _utils.getMeasurement)(value))], ["text-indent", value => (0, _html_utils.measureToString)((0, _utils.getMeasurement)(value))], ["font-family", value => value], ["vertical-align", value => (0, _html_utils.measureToString)((0, _utils.getMeasurement)(value))]]);
86824const spacesRegExp = /\s+/g;
86825const crlfRegExp = /[\r\n]+/g;
86826const crlfForRichTextRegExp = /\r\n?/g;
86827function mapStyle(styleStr, node, richText) {
86828  const style = Object.create(null);
86829  if (!styleStr) {
86830    return style;
86831  }
86832  const original = Object.create(null);
86833  for (const [key, value] of styleStr.split(";").map(s => s.split(":", 2))) {
86834    const mapping = StyleMapping.get(key);
86835    if (mapping === "") {
86836      continue;
86837    }
86838    let newValue = value;
86839    if (mapping) {
86840      newValue = typeof mapping === "string" ? mapping : mapping(value, original);
86841    }
86842    if (key.endsWith("scale")) {
86843      style.transform = style.transform ? `${style[key]} ${newValue}` : newValue;
86844    } else {
86845      style[key.replaceAll(/-([a-zA-Z])/g, (_, x) => x.toUpperCase())] = newValue;
86846    }
86847  }
86848  if (style.fontFamily) {
86849    (0, _html_utils.setFontFamily)({
86850      typeface: style.fontFamily,
86851      weight: style.fontWeight || "normal",
86852      posture: style.fontStyle || "normal",
86853      size: original.fontSize || 0
86854    }, node, node[_symbol_utils.$globalData].fontFinder, style);
86855  }
86856  if (richText && style.verticalAlign && style.verticalAlign !== "0px" && style.fontSize) {
86857    const SUB_SUPER_SCRIPT_FACTOR = 0.583;
86858    const VERTICAL_FACTOR = 0.333;
86859    const fontSize = (0, _utils.getMeasurement)(style.fontSize);
86860    style.fontSize = (0, _html_utils.measureToString)(fontSize * SUB_SUPER_SCRIPT_FACTOR);
86861    style.verticalAlign = (0, _html_utils.measureToString)(Math.sign((0, _utils.getMeasurement)(style.verticalAlign)) * fontSize * VERTICAL_FACTOR);
86862  }
86863  if (richText && style.fontSize) {
86864    style.fontSize = `calc(${style.fontSize} * var(--scale-factor))`;
86865  }
86866  (0, _html_utils.fixTextIndent)(style);
86867  return style;
86868}
86869function checkStyle(node) {
86870  if (!node.style) {
86871    return "";
86872  }
86873  return node.style.trim().split(/\s*;\s*/).filter(s => !!s).map(s => s.split(/\s*:\s*/, 2)).filter(([key, value]) => {
86874    if (key === "font-family") {
86875      node[_symbol_utils.$globalData].usedTypefaces.add(value);
86876    }
86877    return VALID_STYLES.has(key);
86878  }).map(kv => kv.join(":")).join(";");
86879}
86880const NoWhites = new Set(["body", "html"]);
86881class XhtmlObject extends _xfa_object.XmlObject {
86882  constructor(attributes, name) {
86883    super(XHTML_NS_ID, name);
86884    this[$richText] = false;
86885    this.style = attributes.style || "";
86886  }
86887  [_symbol_utils.$clean](builder) {
86888    super[_symbol_utils.$clean](builder);
86889    this.style = checkStyle(this);
86890  }
86891  [_symbol_utils.$acceptWhitespace]() {
86892    return !NoWhites.has(this[_symbol_utils.$nodeName]);
86893  }
86894  [_symbol_utils.$onText](str, richText = false) {
86895    if (!richText) {
86896      str = str.replaceAll(crlfRegExp, "");
86897      if (!this.style.includes("xfa-spacerun:yes")) {
86898        str = str.replaceAll(spacesRegExp, " ");
86899      }
86900    } else {
86901      this[$richText] = true;
86902    }
86903    if (str) {
86904      this[_symbol_utils.$content] += str;
86905    }
86906  }
86907  [_symbol_utils.$pushGlyphs](measure, mustPop = true) {
86908    const xfaFont = Object.create(null);
86909    const margin = {
86910      top: NaN,
86911      bottom: NaN,
86912      left: NaN,
86913      right: NaN
86914    };
86915    let lineHeight = null;
86916    for (const [key, value] of this.style.split(";").map(s => s.split(":", 2))) {
86917      switch (key) {
86918        case "font-family":
86919          xfaFont.typeface = (0, _utils.stripQuotes)(value);
86920          break;
86921        case "font-size":
86922          xfaFont.size = (0, _utils.getMeasurement)(value);
86923          break;
86924        case "font-weight":
86925          xfaFont.weight = value;
86926          break;
86927        case "font-style":
86928          xfaFont.posture = value;
86929          break;
86930        case "letter-spacing":
86931          xfaFont.letterSpacing = (0, _utils.getMeasurement)(value);
86932          break;
86933        case "margin":
86934          const values = value.split(/ \t/).map(x => (0, _utils.getMeasurement)(x));
86935          switch (values.length) {
86936            case 1:
86937              margin.top = margin.bottom = margin.left = margin.right = values[0];
86938              break;
86939            case 2:
86940              margin.top = margin.bottom = values[0];
86941              margin.left = margin.right = values[1];
86942              break;
86943            case 3:
86944              margin.top = values[0];
86945              margin.bottom = values[2];
86946              margin.left = margin.right = values[1];
86947              break;
86948            case 4:
86949              margin.top = values[0];
86950              margin.left = values[1];
86951              margin.bottom = values[2];
86952              margin.right = values[3];
86953              break;
86954          }
86955          break;
86956        case "margin-top":
86957          margin.top = (0, _utils.getMeasurement)(value);
86958          break;
86959        case "margin-bottom":
86960          margin.bottom = (0, _utils.getMeasurement)(value);
86961          break;
86962        case "margin-left":
86963          margin.left = (0, _utils.getMeasurement)(value);
86964          break;
86965        case "margin-right":
86966          margin.right = (0, _utils.getMeasurement)(value);
86967          break;
86968        case "line-height":
86969          lineHeight = (0, _utils.getMeasurement)(value);
86970          break;
86971      }
86972    }
86973    measure.pushData(xfaFont, margin, lineHeight);
86974    if (this[_symbol_utils.$content]) {
86975      measure.addString(this[_symbol_utils.$content]);
86976    } else {
86977      for (const child of this[_symbol_utils.$getChildren]()) {
86978        if (child[_symbol_utils.$nodeName] === "#text") {
86979          measure.addString(child[_symbol_utils.$content]);
86980          continue;
86981        }
86982        child[_symbol_utils.$pushGlyphs](measure);
86983      }
86984    }
86985    if (mustPop) {
86986      measure.popFont();
86987    }
86988  }
86989  [_symbol_utils.$toHTML](availableSpace) {
86990    const children = [];
86991    this[_symbol_utils.$extra] = {
86992      children
86993    };
86994    this[_symbol_utils.$childrenToHTML]({});
86995    if (children.length === 0 && !this[_symbol_utils.$content]) {
86996      return _utils.HTMLResult.EMPTY;
86997    }
86998    let value;
86999    if (this[$richText]) {
87000      value = this[_symbol_utils.$content] ? this[_symbol_utils.$content].replaceAll(crlfForRichTextRegExp, "\n") : undefined;
87001    } else {
87002      value = this[_symbol_utils.$content] || undefined;
87003    }
87004    return _utils.HTMLResult.success({
87005      name: this[_symbol_utils.$nodeName],
87006      attributes: {
87007        href: this.href,
87008        style: mapStyle(this.style, this, this[$richText])
87009      },
87010      children,
87011      value
87012    });
87013  }
87014}
87015class A extends XhtmlObject {
87016  constructor(attributes) {
87017    super(attributes, "a");
87018    this.href = (0, _html_utils.fixURL)(attributes.href) || "";
87019  }
87020}
87021class B extends XhtmlObject {
87022  constructor(attributes) {
87023    super(attributes, "b");
87024  }
87025  [_symbol_utils.$pushGlyphs](measure) {
87026    measure.pushFont({
87027      weight: "bold"
87028    });
87029    super[_symbol_utils.$pushGlyphs](measure);
87030    measure.popFont();
87031  }
87032}
87033class Body extends XhtmlObject {
87034  constructor(attributes) {
87035    super(attributes, "body");
87036  }
87037  [_symbol_utils.$toHTML](availableSpace) {
87038    const res = super[_symbol_utils.$toHTML](availableSpace);
87039    const {
87040      html
87041    } = res;
87042    if (!html) {
87043      return _utils.HTMLResult.EMPTY;
87044    }
87045    html.name = "div";
87046    html.attributes.class = ["xfaRich"];
87047    return res;
87048  }
87049}
87050class Br extends XhtmlObject {
87051  constructor(attributes) {
87052    super(attributes, "br");
87053  }
87054  [_symbol_utils.$text]() {
87055    return "\n";
87056  }
87057  [_symbol_utils.$pushGlyphs](measure) {
87058    measure.addString("\n");
87059  }
87060  [_symbol_utils.$toHTML](availableSpace) {
87061    return _utils.HTMLResult.success({
87062      name: "br"
87063    });
87064  }
87065}
87066class Html extends XhtmlObject {
87067  constructor(attributes) {
87068    super(attributes, "html");
87069  }
87070  [_symbol_utils.$toHTML](availableSpace) {
87071    const children = [];
87072    this[_symbol_utils.$extra] = {
87073      children
87074    };
87075    this[_symbol_utils.$childrenToHTML]({});
87076    if (children.length === 0) {
87077      return _utils.HTMLResult.success({
87078        name: "div",
87079        attributes: {
87080          class: ["xfaRich"],
87081          style: {}
87082        },
87083        value: this[_symbol_utils.$content] || ""
87084      });
87085    }
87086    if (children.length === 1) {
87087      const child = children[0];
87088      if (child.attributes?.class.includes("xfaRich")) {
87089        return _utils.HTMLResult.success(child);
87090      }
87091    }
87092    return _utils.HTMLResult.success({
87093      name: "div",
87094      attributes: {
87095        class: ["xfaRich"],
87096        style: {}
87097      },
87098      children
87099    });
87100  }
87101}
87102class I extends XhtmlObject {
87103  constructor(attributes) {
87104    super(attributes, "i");
87105  }
87106  [_symbol_utils.$pushGlyphs](measure) {
87107    measure.pushFont({
87108      posture: "italic"
87109    });
87110    super[_symbol_utils.$pushGlyphs](measure);
87111    measure.popFont();
87112  }
87113}
87114class Li extends XhtmlObject {
87115  constructor(attributes) {
87116    super(attributes, "li");
87117  }
87118}
87119class Ol extends XhtmlObject {
87120  constructor(attributes) {
87121    super(attributes, "ol");
87122  }
87123}
87124class P extends XhtmlObject {
87125  constructor(attributes) {
87126    super(attributes, "p");
87127  }
87128  [_symbol_utils.$pushGlyphs](measure) {
87129    super[_symbol_utils.$pushGlyphs](measure, false);
87130    measure.addString("\n");
87131    measure.addPara();
87132    measure.popFont();
87133  }
87134  [_symbol_utils.$text]() {
87135    const siblings = this[_symbol_utils.$getParent]()[_symbol_utils.$getChildren]();
87136    if (siblings.at(-1) === this) {
87137      return super[_symbol_utils.$text]();
87138    }
87139    return super[_symbol_utils.$text]() + "\n";
87140  }
87141}
87142class Span extends XhtmlObject {
87143  constructor(attributes) {
87144    super(attributes, "span");
87145  }
87146}
87147class Sub extends XhtmlObject {
87148  constructor(attributes) {
87149    super(attributes, "sub");
87150  }
87151}
87152class Sup extends XhtmlObject {
87153  constructor(attributes) {
87154    super(attributes, "sup");
87155  }
87156}
87157class Ul extends XhtmlObject {
87158  constructor(attributes) {
87159    super(attributes, "ul");
87160  }
87161}
87162class XhtmlNamespace {
87163  static [_namespaces.$buildXFAObject](name, attributes) {
87164    if (XhtmlNamespace.hasOwnProperty(name)) {
87165      return XhtmlNamespace[name](attributes);
87166    }
87167    return undefined;
87168  }
87169  static a(attributes) {
87170    return new A(attributes);
87171  }
87172  static b(attributes) {
87173    return new B(attributes);
87174  }
87175  static body(attributes) {
87176    return new Body(attributes);
87177  }
87178  static br(attributes) {
87179    return new Br(attributes);
87180  }
87181  static html(attributes) {
87182    return new Html(attributes);
87183  }
87184  static i(attributes) {
87185    return new I(attributes);
87186  }
87187  static li(attributes) {
87188    return new Li(attributes);
87189  }
87190  static ol(attributes) {
87191    return new Ol(attributes);
87192  }
87193  static p(attributes) {
87194    return new P(attributes);
87195  }
87196  static span(attributes) {
87197    return new Span(attributes);
87198  }
87199  static sub(attributes) {
87200    return new Sub(attributes);
87201  }
87202  static sup(attributes) {
87203    return new Sup(attributes);
87204  }
87205  static ul(attributes) {
87206    return new Ul(attributes);
87207  }
87208}
87209exports.XhtmlNamespace = XhtmlNamespace;
87210
87211/***/ }),
87212/* 101 */
87213/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
87214
87215
87216
87217Object.defineProperty(exports, "__esModule", ({
87218  value: true
87219}));
87220exports.UnknownNamespace = void 0;
87221var _namespaces = __w_pdfjs_require__(81);
87222var _xfa_object = __w_pdfjs_require__(87);
87223class UnknownNamespace {
87224  constructor(nsId) {
87225    this.namespaceId = nsId;
87226  }
87227  [_namespaces.$buildXFAObject](name, attributes) {
87228    return new _xfa_object.XmlObject(this.namespaceId, name, attributes);
87229  }
87230}
87231exports.UnknownNamespace = UnknownNamespace;
87232
87233/***/ }),
87234/* 102 */
87235/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
87236
87237
87238
87239Object.defineProperty(exports, "__esModule", ({
87240  value: true
87241}));
87242exports.DatasetReader = void 0;
87243var _util = __w_pdfjs_require__(2);
87244var _core_utils = __w_pdfjs_require__(3);
87245var _xml_parser = __w_pdfjs_require__(71);
87246function decodeString(str) {
87247  try {
87248    return (0, _util.stringToUTF8String)(str);
87249  } catch (ex) {
87250    (0, _util.warn)(`UTF-8 decoding failed: "${ex}".`);
87251    return str;
87252  }
87253}
87254class DatasetXMLParser extends _xml_parser.SimpleXMLParser {
87255  constructor(options) {
87256    super(options);
87257    this.node = null;
87258  }
87259  onEndElement(name) {
87260    const node = super.onEndElement(name);
87261    if (node && name === "xfa:datasets") {
87262      this.node = node;
87263      throw new Error("Aborting DatasetXMLParser.");
87264    }
87265  }
87266}
87267class DatasetReader {
87268  constructor(data) {
87269    if (data.datasets) {
87270      this.node = new _xml_parser.SimpleXMLParser({
87271        hasAttributes: true
87272      }).parseFromString(data.datasets).documentElement;
87273    } else {
87274      const parser = new DatasetXMLParser({
87275        hasAttributes: true
87276      });
87277      try {
87278        parser.parseFromString(data["xdp:xdp"]);
87279      } catch {}
87280      this.node = parser.node;
87281    }
87282  }
87283  getValue(path) {
87284    if (!this.node || !path) {
87285      return "";
87286    }
87287    const node = this.node.searchNode((0, _core_utils.parseXFAPath)(path), 0);
87288    if (!node) {
87289      return "";
87290    }
87291    const first = node.firstChild;
87292    if (first?.nodeName === "value") {
87293      return node.children.map(child => decodeString(child.textContent));
87294    }
87295    return decodeString(node.textContent);
87296  }
87297}
87298exports.DatasetReader = DatasetReader;
87299
87300/***/ }),
87301/* 103 */
87302/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
87303
87304
87305
87306Object.defineProperty(exports, "__esModule", ({
87307  value: true
87308}));
87309exports.XRef = void 0;
87310var _util = __w_pdfjs_require__(2);
87311var _primitives = __w_pdfjs_require__(4);
87312var _parser = __w_pdfjs_require__(16);
87313var _core_utils = __w_pdfjs_require__(3);
87314var _base_stream = __w_pdfjs_require__(5);
87315var _crypto = __w_pdfjs_require__(74);
87316class XRef {
87317  #firstXRefStmPos = null;
87318  constructor(stream, pdfManager) {
87319    this.stream = stream;
87320    this.pdfManager = pdfManager;
87321    this.entries = [];
87322    this._xrefStms = new Set();
87323    this._cacheMap = new Map();
87324    this._pendingRefs = new _primitives.RefSet();
87325    this._newPersistentRefNum = null;
87326    this._newTemporaryRefNum = null;
87327  }
87328  getNewPersistentRef(obj) {
87329    if (this._newPersistentRefNum === null) {
87330      this._newPersistentRefNum = this.entries.length || 1;
87331    }
87332    const num = this._newPersistentRefNum++;
87333    this._cacheMap.set(num, obj);
87334    return _primitives.Ref.get(num, 0);
87335  }
87336  getNewTemporaryRef() {
87337    if (this._newTemporaryRefNum === null) {
87338      this._newTemporaryRefNum = this.entries.length || 1;
87339    }
87340    return _primitives.Ref.get(this._newTemporaryRefNum++, 0);
87341  }
87342  resetNewTemporaryRef() {
87343    this._newTemporaryRefNum = null;
87344  }
87345  setStartXRef(startXRef) {
87346    this.startXRefQueue = [startXRef];
87347  }
87348  parse(recoveryMode = false) {
87349    let trailerDict;
87350    if (!recoveryMode) {
87351      trailerDict = this.readXRef();
87352    } else {
87353      (0, _util.warn)("Indexing all PDF objects");
87354      trailerDict = this.indexObjects();
87355    }
87356    trailerDict.assignXref(this);
87357    this.trailer = trailerDict;
87358    let encrypt;
87359    try {
87360      encrypt = trailerDict.get("Encrypt");
87361    } catch (ex) {
87362      if (ex instanceof _core_utils.MissingDataException) {
87363        throw ex;
87364      }
87365      (0, _util.warn)(`XRef.parse - Invalid "Encrypt" reference: "${ex}".`);
87366    }
87367    if (encrypt instanceof _primitives.Dict) {
87368      const ids = trailerDict.get("ID");
87369      const fileId = ids?.length ? ids[0] : "";
87370      encrypt.suppressEncryption = true;
87371      this.encrypt = new _crypto.CipherTransformFactory(encrypt, fileId, this.pdfManager.password);
87372    }
87373    let root;
87374    try {
87375      root = trailerDict.get("Root");
87376    } catch (ex) {
87377      if (ex instanceof _core_utils.MissingDataException) {
87378        throw ex;
87379      }
87380      (0, _util.warn)(`XRef.parse - Invalid "Root" reference: "${ex}".`);
87381    }
87382    if (root instanceof _primitives.Dict) {
87383      try {
87384        const pages = root.get("Pages");
87385        if (pages instanceof _primitives.Dict) {
87386          this.root = root;
87387          return;
87388        }
87389      } catch (ex) {
87390        if (ex instanceof _core_utils.MissingDataException) {
87391          throw ex;
87392        }
87393        (0, _util.warn)(`XRef.parse - Invalid "Pages" reference: "${ex}".`);
87394      }
87395    }
87396    if (!recoveryMode) {
87397      throw new _core_utils.XRefParseException();
87398    }
87399    throw new _util.InvalidPDFException("Invalid Root reference.");
87400  }
87401  processXRefTable(parser) {
87402    if (!("tableState" in this)) {
87403      this.tableState = {
87404        entryNum: 0,
87405        streamPos: parser.lexer.stream.pos,
87406        parserBuf1: parser.buf1,
87407        parserBuf2: parser.buf2
87408      };
87409    }
87410    const obj = this.readXRefTable(parser);
87411    if (!(0, _primitives.isCmd)(obj, "trailer")) {
87412      throw new _util.FormatError("Invalid XRef table: could not find trailer dictionary");
87413    }
87414    let dict = parser.getObj();
87415    if (!(dict instanceof _primitives.Dict) && dict.dict) {
87416      dict = dict.dict;
87417    }
87418    if (!(dict instanceof _primitives.Dict)) {
87419      throw new _util.FormatError("Invalid XRef table: could not parse trailer dictionary");
87420    }
87421    delete this.tableState;
87422    return dict;
87423  }
87424  readXRefTable(parser) {
87425    const stream = parser.lexer.stream;
87426    const tableState = this.tableState;
87427    stream.pos = tableState.streamPos;
87428    parser.buf1 = tableState.parserBuf1;
87429    parser.buf2 = tableState.parserBuf2;
87430    let obj;
87431    while (true) {
87432      if (!("firstEntryNum" in tableState) || !("entryCount" in tableState)) {
87433        if ((0, _primitives.isCmd)(obj = parser.getObj(), "trailer")) {
87434          break;
87435        }
87436        tableState.firstEntryNum = obj;
87437        tableState.entryCount = parser.getObj();
87438      }
87439      let first = tableState.firstEntryNum;
87440      const count = tableState.entryCount;
87441      if (!Number.isInteger(first) || !Number.isInteger(count)) {
87442        throw new _util.FormatError("Invalid XRef table: wrong types in subsection header");
87443      }
87444      for (let i = tableState.entryNum; i < count; i++) {
87445        tableState.streamPos = stream.pos;
87446        tableState.entryNum = i;
87447        tableState.parserBuf1 = parser.buf1;
87448        tableState.parserBuf2 = parser.buf2;
87449        const entry = {};
87450        entry.offset = parser.getObj();
87451        entry.gen = parser.getObj();
87452        const type = parser.getObj();
87453        if (type instanceof _primitives.Cmd) {
87454          switch (type.cmd) {
87455            case "f":
87456              entry.free = true;
87457              break;
87458            case "n":
87459              entry.uncompressed = true;
87460              break;
87461          }
87462        }
87463        if (!Number.isInteger(entry.offset) || !Number.isInteger(entry.gen) || !(entry.free || entry.uncompressed)) {
87464          throw new _util.FormatError(`Invalid entry in XRef subsection: ${first}, ${count}`);
87465        }
87466        if (i === 0 && entry.free && first === 1) {
87467          first = 0;
87468        }
87469        if (!this.entries[i + first]) {
87470          this.entries[i + first] = entry;
87471        }
87472      }
87473      tableState.entryNum = 0;
87474      tableState.streamPos = stream.pos;
87475      tableState.parserBuf1 = parser.buf1;
87476      tableState.parserBuf2 = parser.buf2;
87477      delete tableState.firstEntryNum;
87478      delete tableState.entryCount;
87479    }
87480    if (this.entries[0] && !this.entries[0].free) {
87481      throw new _util.FormatError("Invalid XRef table: unexpected first object");
87482    }
87483    return obj;
87484  }
87485  processXRefStream(stream) {
87486    if (!("streamState" in this)) {
87487      const streamParameters = stream.dict;
87488      const byteWidths = streamParameters.get("W");
87489      let range = streamParameters.get("Index");
87490      if (!range) {
87491        range = [0, streamParameters.get("Size")];
87492      }
87493      this.streamState = {
87494        entryRanges: range,
87495        byteWidths,
87496        entryNum: 0,
87497        streamPos: stream.pos
87498      };
87499    }
87500    this.readXRefStream(stream);
87501    delete this.streamState;
87502    return stream.dict;
87503  }
87504  readXRefStream(stream) {
87505    const streamState = this.streamState;
87506    stream.pos = streamState.streamPos;
87507    const [typeFieldWidth, offsetFieldWidth, generationFieldWidth] = streamState.byteWidths;
87508    const entryRanges = streamState.entryRanges;
87509    while (entryRanges.length > 0) {
87510      const [first, n] = entryRanges;
87511      if (!Number.isInteger(first) || !Number.isInteger(n)) {
87512        throw new _util.FormatError(`Invalid XRef range fields: ${first}, ${n}`);
87513      }
87514      if (!Number.isInteger(typeFieldWidth) || !Number.isInteger(offsetFieldWidth) || !Number.isInteger(generationFieldWidth)) {
87515        throw new _util.FormatError(`Invalid XRef entry fields length: ${first}, ${n}`);
87516      }
87517      for (let i = streamState.entryNum; i < n; ++i) {
87518        streamState.entryNum = i;
87519        streamState.streamPos = stream.pos;
87520        let type = 0,
87521          offset = 0,
87522          generation = 0;
87523        for (let j = 0; j < typeFieldWidth; ++j) {
87524          const typeByte = stream.getByte();
87525          if (typeByte === -1) {
87526            throw new _util.FormatError("Invalid XRef byteWidths 'type'.");
87527          }
87528          type = type << 8 | typeByte;
87529        }
87530        if (typeFieldWidth === 0) {
87531          type = 1;
87532        }
87533        for (let j = 0; j < offsetFieldWidth; ++j) {
87534          const offsetByte = stream.getByte();
87535          if (offsetByte === -1) {
87536            throw new _util.FormatError("Invalid XRef byteWidths 'offset'.");
87537          }
87538          offset = offset << 8 | offsetByte;
87539        }
87540        for (let j = 0; j < generationFieldWidth; ++j) {
87541          const generationByte = stream.getByte();
87542          if (generationByte === -1) {
87543            throw new _util.FormatError("Invalid XRef byteWidths 'generation'.");
87544          }
87545          generation = generation << 8 | generationByte;
87546        }
87547        const entry = {};
87548        entry.offset = offset;
87549        entry.gen = generation;
87550        switch (type) {
87551          case 0:
87552            entry.free = true;
87553            break;
87554          case 1:
87555            entry.uncompressed = true;
87556            break;
87557          case 2:
87558            break;
87559          default:
87560            throw new _util.FormatError(`Invalid XRef entry type: ${type}`);
87561        }
87562        if (!this.entries[first + i]) {
87563          this.entries[first + i] = entry;
87564        }
87565      }
87566      streamState.entryNum = 0;
87567      streamState.streamPos = stream.pos;
87568      entryRanges.splice(0, 2);
87569    }
87570  }
87571  indexObjects() {
87572    const TAB = 0x9,
87573      LF = 0xa,
87574      CR = 0xd,
87575      SPACE = 0x20;
87576    const PERCENT = 0x25,
87577      LT = 0x3c;
87578    function readToken(data, offset) {
87579      let token = "",
87580        ch = data[offset];
87581      while (ch !== LF && ch !== CR && ch !== LT) {
87582        if (++offset >= data.length) {
87583          break;
87584        }
87585        token += String.fromCharCode(ch);
87586        ch = data[offset];
87587      }
87588      return token;
87589    }
87590    function skipUntil(data, offset, what) {
87591      const length = what.length,
87592        dataLength = data.length;
87593      let skipped = 0;
87594      while (offset < dataLength) {
87595        let i = 0;
87596        while (i < length && data[offset + i] === what[i]) {
87597          ++i;
87598        }
87599        if (i >= length) {
87600          break;
87601        }
87602        offset++;
87603        skipped++;
87604      }
87605      return skipped;
87606    }
87607    const gEndobjRegExp = /\b(endobj|\d+\s+\d+\s+obj|xref|trailer\s*<<)\b/g;
87608    const gStartxrefRegExp = /\b(startxref|\d+\s+\d+\s+obj)\b/g;
87609    const objRegExp = /^(\d+)\s+(\d+)\s+obj\b/;
87610    const trailerBytes = new Uint8Array([116, 114, 97, 105, 108, 101, 114]);
87611    const startxrefBytes = new Uint8Array([115, 116, 97, 114, 116, 120, 114, 101, 102]);
87612    const xrefBytes = new Uint8Array([47, 88, 82, 101, 102]);
87613    this.entries.length = 0;
87614    this._cacheMap.clear();
87615    const stream = this.stream;
87616    stream.pos = 0;
87617    const buffer = stream.getBytes(),
87618      bufferStr = (0, _util.bytesToString)(buffer),
87619      length = buffer.length;
87620    let position = stream.start;
87621    const trailers = [],
87622      xrefStms = [];
87623    while (position < length) {
87624      let ch = buffer[position];
87625      if (ch === TAB || ch === LF || ch === CR || ch === SPACE) {
87626        ++position;
87627        continue;
87628      }
87629      if (ch === PERCENT) {
87630        do {
87631          ++position;
87632          if (position >= length) {
87633            break;
87634          }
87635          ch = buffer[position];
87636        } while (ch !== LF && ch !== CR);
87637        continue;
87638      }
87639      const token = readToken(buffer, position);
87640      let m;
87641      if (token.startsWith("xref") && (token.length === 4 || /\s/.test(token[4]))) {
87642        position += skipUntil(buffer, position, trailerBytes);
87643        trailers.push(position);
87644        position += skipUntil(buffer, position, startxrefBytes);
87645      } else if (m = objRegExp.exec(token)) {
87646        const num = m[1] | 0,
87647          gen = m[2] | 0;
87648        const startPos = position + token.length;
87649        let contentLength,
87650          updateEntries = false;
87651        if (!this.entries[num]) {
87652          updateEntries = true;
87653        } else if (this.entries[num].gen === gen) {
87654          try {
87655            const parser = new _parser.Parser({
87656              lexer: new _parser.Lexer(stream.makeSubStream(startPos))
87657            });
87658            parser.getObj();
87659            updateEntries = true;
87660          } catch (ex) {
87661            if (ex instanceof _core_utils.ParserEOFException) {
87662              (0, _util.warn)(`indexObjects -- checking object (${token}): "${ex}".`);
87663            } else {
87664              updateEntries = true;
87665            }
87666          }
87667        }
87668        if (updateEntries) {
87669          this.entries[num] = {
87670            offset: position - stream.start,
87671            gen,
87672            uncompressed: true
87673          };
87674        }
87675        gEndobjRegExp.lastIndex = startPos;
87676        const match = gEndobjRegExp.exec(bufferStr);
87677        if (match) {
87678          const endPos = gEndobjRegExp.lastIndex + 1;
87679          contentLength = endPos - position;
87680          if (match[1] !== "endobj") {
87681            (0, _util.warn)(`indexObjects: Found "${match[1]}" inside of another "obj", ` + 'caused by missing "endobj" -- trying to recover.');
87682            contentLength -= match[1].length + 1;
87683          }
87684        } else {
87685          contentLength = length - position;
87686        }
87687        const content = buffer.subarray(position, position + contentLength);
87688        const xrefTagOffset = skipUntil(content, 0, xrefBytes);
87689        if (xrefTagOffset < contentLength && content[xrefTagOffset + 5] < 64) {
87690          xrefStms.push(position - stream.start);
87691          this._xrefStms.add(position - stream.start);
87692        }
87693        position += contentLength;
87694      } else if (token.startsWith("trailer") && (token.length === 7 || /\s/.test(token[7]))) {
87695        trailers.push(position);
87696        const startPos = position + token.length;
87697        let contentLength;
87698        gStartxrefRegExp.lastIndex = startPos;
87699        const match = gStartxrefRegExp.exec(bufferStr);
87700        if (match) {
87701          const endPos = gStartxrefRegExp.lastIndex + 1;
87702          contentLength = endPos - position;
87703          if (match[1] !== "startxref") {
87704            (0, _util.warn)(`indexObjects: Found "${match[1]}" after "trailer", ` + 'caused by missing "startxref" -- trying to recover.');
87705            contentLength -= match[1].length + 1;
87706          }
87707        } else {
87708          contentLength = length - position;
87709        }
87710        position += contentLength;
87711      } else {
87712        position += token.length + 1;
87713      }
87714    }
87715    for (const xrefStm of xrefStms) {
87716      this.startXRefQueue.push(xrefStm);
87717      this.readXRef(true);
87718    }
87719    const trailerDicts = [];
87720    let isEncrypted = false;
87721    for (const trailer of trailers) {
87722      stream.pos = trailer;
87723      const parser = new _parser.Parser({
87724        lexer: new _parser.Lexer(stream),
87725        xref: this,
87726        allowStreams: true,
87727        recoveryMode: true
87728      });
87729      const obj = parser.getObj();
87730      if (!(0, _primitives.isCmd)(obj, "trailer")) {
87731        continue;
87732      }
87733      const dict = parser.getObj();
87734      if (!(dict instanceof _primitives.Dict)) {
87735        continue;
87736      }
87737      trailerDicts.push(dict);
87738      if (dict.has("Encrypt")) {
87739        isEncrypted = true;
87740      }
87741    }
87742    let trailerDict, trailerError;
87743    for (const dict of [...trailerDicts, "genFallback", ...trailerDicts]) {
87744      if (dict === "genFallback") {
87745        if (!trailerError) {
87746          break;
87747        }
87748        this._generationFallback = true;
87749        continue;
87750      }
87751      let validPagesDict = false;
87752      try {
87753        const rootDict = dict.get("Root");
87754        if (!(rootDict instanceof _primitives.Dict)) {
87755          continue;
87756        }
87757        const pagesDict = rootDict.get("Pages");
87758        if (!(pagesDict instanceof _primitives.Dict)) {
87759          continue;
87760        }
87761        const pagesCount = pagesDict.get("Count");
87762        if (Number.isInteger(pagesCount)) {
87763          validPagesDict = true;
87764        }
87765      } catch (ex) {
87766        trailerError = ex;
87767        continue;
87768      }
87769      if (validPagesDict && (!isEncrypted || dict.has("Encrypt")) && dict.has("ID")) {
87770        return dict;
87771      }
87772      trailerDict = dict;
87773    }
87774    if (trailerDict) {
87775      return trailerDict;
87776    }
87777    if (this.topDict) {
87778      return this.topDict;
87779    }
87780    throw new _util.InvalidPDFException("Invalid PDF structure.");
87781  }
87782  readXRef(recoveryMode = false) {
87783    const stream = this.stream;
87784    const startXRefParsedCache = new Set();
87785    while (this.startXRefQueue.length) {
vendor: 22,272 bytes, lines 87786-88476
87786      try {
87787        const startXRef = this.startXRefQueue[0];
87788        if (startXRefParsedCache.has(startXRef)) {
87789          (0, _util.warn)("readXRef - skipping XRef table since it was already parsed.");
87790          this.startXRefQueue.shift();
87791          continue;
87792        }
87793        startXRefParsedCache.add(startXRef);
87794        stream.pos = startXRef + stream.start;
87795        const parser = new _parser.Parser({
87796          lexer: new _parser.Lexer(stream),
87797          xref: this,
87798          allowStreams: true
87799        });
87800        let obj = parser.getObj();
87801        let dict;
87802        if ((0, _primitives.isCmd)(obj, "xref")) {
87803          dict = this.processXRefTable(parser);
87804          if (!this.topDict) {
87805            this.topDict = dict;
87806          }
87807          obj = dict.get("XRefStm");
87808          if (Number.isInteger(obj) && !this._xrefStms.has(obj)) {
87809            this._xrefStms.add(obj);
87810            this.startXRefQueue.push(obj);
87811            this.#firstXRefStmPos ??= obj;
87812          }
87813        } else if (Number.isInteger(obj)) {
87814          if (!Number.isInteger(parser.getObj()) || !(0, _primitives.isCmd)(parser.getObj(), "obj") || !((obj = parser.getObj()) instanceof _base_stream.BaseStream)) {
87815            throw new _util.FormatError("Invalid XRef stream");
87816          }
87817          dict = this.processXRefStream(obj);
87818          if (!this.topDict) {
87819            this.topDict = dict;
87820          }
87821          if (!dict) {
87822            throw new _util.FormatError("Failed to read XRef stream");
87823          }
87824        } else {
87825          throw new _util.FormatError("Invalid XRef stream header");
87826        }
87827        obj = dict.get("Prev");
87828        if (Number.isInteger(obj)) {
87829          this.startXRefQueue.push(obj);
87830        } else if (obj instanceof _primitives.Ref) {
87831          this.startXRefQueue.push(obj.num);
87832        }
87833      } catch (e) {
87834        if (e instanceof _core_utils.MissingDataException) {
87835          throw e;
87836        }
87837        (0, _util.info)("(while reading XRef): " + e);
87838      }
87839      this.startXRefQueue.shift();
87840    }
87841    if (this.topDict) {
87842      return this.topDict;
87843    }
87844    if (recoveryMode) {
87845      return undefined;
87846    }
87847    throw new _core_utils.XRefParseException();
87848  }
87849  get lastXRefStreamPos() {
87850    return this.#firstXRefStmPos ?? (this._xrefStms.size > 0 ? Math.max(...this._xrefStms) : null);
87851  }
87852  getEntry(i) {
87853    const xrefEntry = this.entries[i];
87854    if (xrefEntry && !xrefEntry.free && xrefEntry.offset) {
87855      return xrefEntry;
87856    }
87857    return null;
87858  }
87859  fetchIfRef(obj, suppressEncryption = false) {
87860    if (obj instanceof _primitives.Ref) {
87861      return this.fetch(obj, suppressEncryption);
87862    }
87863    return obj;
87864  }
87865  fetch(ref, suppressEncryption = false) {
87866    if (!(ref instanceof _primitives.Ref)) {
87867      throw new Error("ref object is not a reference");
87868    }
87869    const num = ref.num;
87870    const cacheEntry = this._cacheMap.get(num);
87871    if (cacheEntry !== undefined) {
87872      if (cacheEntry instanceof _primitives.Dict && !cacheEntry.objId) {
87873        cacheEntry.objId = ref.toString();
87874      }
87875      return cacheEntry;
87876    }
87877    let xrefEntry = this.getEntry(num);
87878    if (xrefEntry === null) {
87879      this._cacheMap.set(num, xrefEntry);
87880      return xrefEntry;
87881    }
87882    if (this._pendingRefs.has(ref)) {
87883      this._pendingRefs.remove(ref);
87884      (0, _util.warn)(`Ignoring circular reference: ${ref}.`);
87885      return _primitives.CIRCULAR_REF;
87886    }
87887    this._pendingRefs.put(ref);
87888    try {
87889      xrefEntry = xrefEntry.uncompressed ? this.fetchUncompressed(ref, xrefEntry, suppressEncryption) : this.fetchCompressed(ref, xrefEntry, suppressEncryption);
87890      this._pendingRefs.remove(ref);
87891    } catch (ex) {
87892      this._pendingRefs.remove(ref);
87893      throw ex;
87894    }
87895    if (xrefEntry instanceof _primitives.Dict) {
87896      xrefEntry.objId = ref.toString();
87897    } else if (xrefEntry instanceof _base_stream.BaseStream) {
87898      xrefEntry.dict.objId = ref.toString();
87899    }
87900    return xrefEntry;
87901  }
87902  fetchUncompressed(ref, xrefEntry, suppressEncryption = false) {
87903    const gen = ref.gen;
87904    let num = ref.num;
87905    if (xrefEntry.gen !== gen) {
87906      const msg = `Inconsistent generation in XRef: ${ref}`;
87907      if (this._generationFallback && xrefEntry.gen < gen) {
87908        (0, _util.warn)(msg);
87909        return this.fetchUncompressed(_primitives.Ref.get(num, xrefEntry.gen), xrefEntry, suppressEncryption);
87910      }
87911      throw new _core_utils.XRefEntryException(msg);
87912    }
87913    const stream = this.stream.makeSubStream(xrefEntry.offset + this.stream.start);
87914    const parser = new _parser.Parser({
87915      lexer: new _parser.Lexer(stream),
87916      xref: this,
87917      allowStreams: true
87918    });
87919    const obj1 = parser.getObj();
87920    const obj2 = parser.getObj();
87921    const obj3 = parser.getObj();
87922    if (obj1 !== num || obj2 !== gen || !(obj3 instanceof _primitives.Cmd)) {
87923      throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);
87924    }
87925    if (obj3.cmd !== "obj") {
87926      if (obj3.cmd.startsWith("obj")) {
87927        num = parseInt(obj3.cmd.substring(3), 10);
87928        if (!Number.isNaN(num)) {
87929          return num;
87930        }
87931      }
87932      throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);
87933    }
87934    xrefEntry = this.encrypt && !suppressEncryption ? parser.getObj(this.encrypt.createCipherTransform(num, gen)) : parser.getObj();
87935    if (!(xrefEntry instanceof _base_stream.BaseStream)) {
87936      this._cacheMap.set(num, xrefEntry);
87937    }
87938    return xrefEntry;
87939  }
87940  fetchCompressed(ref, xrefEntry, suppressEncryption = false) {
87941    const tableOffset = xrefEntry.offset;
87942    const stream = this.fetch(_primitives.Ref.get(tableOffset, 0));
87943    if (!(stream instanceof _base_stream.BaseStream)) {
87944      throw new _util.FormatError("bad ObjStm stream");
87945    }
87946    const first = stream.dict.get("First");
87947    const n = stream.dict.get("N");
87948    if (!Number.isInteger(first) || !Number.isInteger(n)) {
87949      throw new _util.FormatError("invalid first and n parameters for ObjStm stream");
87950    }
87951    let parser = new _parser.Parser({
87952      lexer: new _parser.Lexer(stream),
87953      xref: this,
87954      allowStreams: true
87955    });
87956    const nums = new Array(n);
87957    const offsets = new Array(n);
87958    for (let i = 0; i < n; ++i) {
87959      const num = parser.getObj();
87960      if (!Number.isInteger(num)) {
87961        throw new _util.FormatError(`invalid object number in the ObjStm stream: ${num}`);
87962      }
87963      const offset = parser.getObj();
87964      if (!Number.isInteger(offset)) {
87965        throw new _util.FormatError(`invalid object offset in the ObjStm stream: ${offset}`);
87966      }
87967      nums[i] = num;
87968      offsets[i] = offset;
87969    }
87970    const start = (stream.start || 0) + first;
87971    const entries = new Array(n);
87972    for (let i = 0; i < n; ++i) {
87973      const length = i < n - 1 ? offsets[i + 1] - offsets[i] : undefined;
87974      if (length < 0) {
87975        throw new _util.FormatError("Invalid offset in the ObjStm stream.");
87976      }
87977      parser = new _parser.Parser({
87978        lexer: new _parser.Lexer(stream.makeSubStream(start + offsets[i], length, stream.dict)),
87979        xref: this,
87980        allowStreams: true
87981      });
87982      const obj = parser.getObj();
87983      entries[i] = obj;
87984      if (obj instanceof _base_stream.BaseStream) {
87985        continue;
87986      }
87987      const num = nums[i],
87988        entry = this.entries[num];
87989      if (entry && entry.offset === tableOffset && entry.gen === i) {
87990        this._cacheMap.set(num, obj);
87991      }
87992    }
87993    xrefEntry = entries[xrefEntry.gen];
87994    if (xrefEntry === undefined) {
87995      throw new _core_utils.XRefEntryException(`Bad (compressed) XRef entry: ${ref}`);
87996    }
87997    return xrefEntry;
87998  }
87999  async fetchIfRefAsync(obj, suppressEncryption) {
88000    if (obj instanceof _primitives.Ref) {
88001      return this.fetchAsync(obj, suppressEncryption);
88002    }
88003    return obj;
88004  }
88005  async fetchAsync(ref, suppressEncryption) {
88006    try {
88007      return this.fetch(ref, suppressEncryption);
88008    } catch (ex) {
88009      if (!(ex instanceof _core_utils.MissingDataException)) {
88010        throw ex;
88011      }
88012      await this.pdfManager.requestRange(ex.begin, ex.end);
88013      return this.fetchAsync(ref, suppressEncryption);
88014    }
88015  }
88016  getCatalogObj() {
88017    return this.root;
88018  }
88019}
88020exports.XRef = XRef;
88021
88022/***/ }),
88023/* 104 */
88024/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
88025
88026
88027
88028Object.defineProperty(exports, "__esModule", ({
88029  value: true
88030}));
88031exports.MessageHandler = void 0;
88032var _util = __w_pdfjs_require__(2);
88033const CallbackKind = {
88034  UNKNOWN: 0,
88035  DATA: 1,
88036  ERROR: 2
88037};
88038const StreamKind = {
88039  UNKNOWN: 0,
88040  CANCEL: 1,
88041  CANCEL_COMPLETE: 2,
88042  CLOSE: 3,
88043  ENQUEUE: 4,
88044  ERROR: 5,
88045  PULL: 6,
88046  PULL_COMPLETE: 7,
88047  START_COMPLETE: 8
88048};
88049function wrapReason(reason) {
88050  if (!(reason instanceof Error || typeof reason === "object" && reason !== null)) {
88051    (0, _util.unreachable)('wrapReason: Expected "reason" to be a (possibly cloned) Error.');
88052  }
88053  switch (reason.name) {
88054    case "AbortException":
88055      return new _util.AbortException(reason.message);
88056    case "MissingPDFException":
88057      return new _util.MissingPDFException(reason.message);
88058    case "PasswordException":
88059      return new _util.PasswordException(reason.message, reason.code);
88060    case "UnexpectedResponseException":
88061      return new _util.UnexpectedResponseException(reason.message, reason.status);
88062    case "UnknownErrorException":
88063      return new _util.UnknownErrorException(reason.message, reason.details);
88064    default:
88065      return new _util.UnknownErrorException(reason.message, reason.toString());
88066  }
88067}
88068class MessageHandler {
88069  constructor(sourceName, targetName, comObj) {
88070    this.sourceName = sourceName;
88071    this.targetName = targetName;
88072    this.comObj = comObj;
88073    this.callbackId = 1;
88074    this.streamId = 1;
88075    this.streamSinks = Object.create(null);
88076    this.streamControllers = Object.create(null);
88077    this.callbackCapabilities = Object.create(null);
88078    this.actionHandler = Object.create(null);
88079    this._onComObjOnMessage = event => {
88080      const data = event.data;
88081      if (data.targetName !== this.sourceName) {
88082        return;
88083      }
88084      if (data.stream) {
88085        this.#processStreamMessage(data);
88086        return;
88087      }
88088      if (data.callback) {
88089        const callbackId = data.callbackId;
88090        const capability = this.callbackCapabilities[callbackId];
88091        if (!capability) {
88092          throw new Error(`Cannot resolve callback ${callbackId}`);
88093        }
88094        delete this.callbackCapabilities[callbackId];
88095        if (data.callback === CallbackKind.DATA) {
88096          capability.resolve(data.data);
88097        } else if (data.callback === CallbackKind.ERROR) {
88098          capability.reject(wrapReason(data.reason));
88099        } else {
88100          throw new Error("Unexpected callback case");
88101        }
88102        return;
88103      }
88104      const action = this.actionHandler[data.action];
88105      if (!action) {
88106        throw new Error(`Unknown action from worker: ${data.action}`);
88107      }
88108      if (data.callbackId) {
88109        const cbSourceName = this.sourceName;
88110        const cbTargetName = data.sourceName;
88111        new Promise(function (resolve) {
88112          resolve(action(data.data));
88113        }).then(function (result) {
88114          comObj.postMessage({
88115            sourceName: cbSourceName,
88116            targetName: cbTargetName,
88117            callback: CallbackKind.DATA,
88118            callbackId: data.callbackId,
88119            data: result
88120          });
88121        }, function (reason) {
88122          comObj.postMessage({
88123            sourceName: cbSourceName,
88124            targetName: cbTargetName,
88125            callback: CallbackKind.ERROR,
88126            callbackId: data.callbackId,
88127            reason: wrapReason(reason)
88128          });
88129        });
88130        return;
88131      }
88132      if (data.streamId) {
88133        this.#createStreamSink(data);
88134        return;
88135      }
88136      action(data.data);
88137    };
88138    comObj.addEventListener("message", this._onComObjOnMessage);
88139  }
88140  on(actionName, handler) {
88141    const ah = this.actionHandler;
88142    if (ah[actionName]) {
88143      throw new Error(`There is already an actionName called "${actionName}"`);
88144    }
88145    ah[actionName] = handler;
88146  }
88147  send(actionName, data, transfers) {
88148    this.comObj.postMessage({
88149      sourceName: this.sourceName,
88150      targetName: this.targetName,
88151      action: actionName,
88152      data
88153    }, transfers);
88154  }
88155  sendWithPromise(actionName, data, transfers) {
88156    const callbackId = this.callbackId++;
88157    const capability = new _util.PromiseCapability();
88158    this.callbackCapabilities[callbackId] = capability;
88159    try {
88160      this.comObj.postMessage({
88161        sourceName: this.sourceName,
88162        targetName: this.targetName,
88163        action: actionName,
88164        callbackId,
88165        data
88166      }, transfers);
88167    } catch (ex) {
88168      capability.reject(ex);
88169    }
88170    return capability.promise;
88171  }
88172  sendWithStream(actionName, data, queueingStrategy, transfers) {
88173    const streamId = this.streamId++,
88174      sourceName = this.sourceName,
88175      targetName = this.targetName,
88176      comObj = this.comObj;
88177    return new ReadableStream({
88178      start: controller => {
88179        const startCapability = new _util.PromiseCapability();
88180        this.streamControllers[streamId] = {
88181          controller,
88182          startCall: startCapability,
88183          pullCall: null,
88184          cancelCall: null,
88185          isClosed: false
88186        };
88187        comObj.postMessage({
88188          sourceName,
88189          targetName,
88190          action: actionName,
88191          streamId,
88192          data,
88193          desiredSize: controller.desiredSize
88194        }, transfers);
88195        return startCapability.promise;
88196      },
88197      pull: controller => {
88198        const pullCapability = new _util.PromiseCapability();
88199        this.streamControllers[streamId].pullCall = pullCapability;
88200        comObj.postMessage({
88201          sourceName,
88202          targetName,
88203          stream: StreamKind.PULL,
88204          streamId,
88205          desiredSize: controller.desiredSize
88206        });
88207        return pullCapability.promise;
88208      },
88209      cancel: reason => {
88210        (0, _util.assert)(reason instanceof Error, "cancel must have a valid reason");
88211        const cancelCapability = new _util.PromiseCapability();
88212        this.streamControllers[streamId].cancelCall = cancelCapability;
88213        this.streamControllers[streamId].isClosed = true;
88214        comObj.postMessage({
88215          sourceName,
88216          targetName,
88217          stream: StreamKind.CANCEL,
88218          streamId,
88219          reason: wrapReason(reason)
88220        });
88221        return cancelCapability.promise;
88222      }
88223    }, queueingStrategy);
88224  }
88225  #createStreamSink(data) {
88226    const streamId = data.streamId,
88227      sourceName = this.sourceName,
88228      targetName = data.sourceName,
88229      comObj = this.comObj;
88230    const self = this,
88231      action = this.actionHandler[data.action];
88232    const streamSink = {
88233      enqueue(chunk, size = 1, transfers) {
88234        if (this.isCancelled) {
88235          return;
88236        }
88237        const lastDesiredSize = this.desiredSize;
88238        this.desiredSize -= size;
88239        if (lastDesiredSize > 0 && this.desiredSize <= 0) {
88240          this.sinkCapability = new _util.PromiseCapability();
88241          this.ready = this.sinkCapability.promise;
88242        }
88243        comObj.postMessage({
88244          sourceName,
88245          targetName,
88246          stream: StreamKind.ENQUEUE,
88247          streamId,
88248          chunk
88249        }, transfers);
88250      },
88251      close() {
88252        if (this.isCancelled) {
88253          return;
88254        }
88255        this.isCancelled = true;
88256        comObj.postMessage({
88257          sourceName,
88258          targetName,
88259          stream: StreamKind.CLOSE,
88260          streamId
88261        });
88262        delete self.streamSinks[streamId];
88263      },
88264      error(reason) {
88265        (0, _util.assert)(reason instanceof Error, "error must have a valid reason");
88266        if (this.isCancelled) {
88267          return;
88268        }
88269        this.isCancelled = true;
88270        comObj.postMessage({
88271          sourceName,
88272          targetName,
88273          stream: StreamKind.ERROR,
88274          streamId,
88275          reason: wrapReason(reason)
88276        });
88277      },
88278      sinkCapability: new _util.PromiseCapability(),
88279      onPull: null,
88280      onCancel: null,
88281      isCancelled: false,
88282      desiredSize: data.desiredSize,
88283      ready: null
88284    };
88285    streamSink.sinkCapability.resolve();
88286    streamSink.ready = streamSink.sinkCapability.promise;
88287    this.streamSinks[streamId] = streamSink;
88288    new Promise(function (resolve) {
88289      resolve(action(data.data, streamSink));
88290    }).then(function () {
88291      comObj.postMessage({
88292        sourceName,
88293        targetName,
88294        stream: StreamKind.START_COMPLETE,
88295        streamId,
88296        success: true
88297      });
88298    }, function (reason) {
88299      comObj.postMessage({
88300        sourceName,
88301        targetName,
88302        stream: StreamKind.START_COMPLETE,
88303        streamId,
88304        reason: wrapReason(reason)
88305      });
88306    });
88307  }
88308  #processStreamMessage(data) {
88309    const streamId = data.streamId,
88310      sourceName = this.sourceName,
88311      targetName = data.sourceName,
88312      comObj = this.comObj;
88313    const streamController = this.streamControllers[streamId],
88314      streamSink = this.streamSinks[streamId];
88315    switch (data.stream) {
88316      case StreamKind.START_COMPLETE:
88317        if (data.success) {
88318          streamController.startCall.resolve();
88319        } else {
88320          streamController.startCall.reject(wrapReason(data.reason));
88321        }
88322        break;
88323      case StreamKind.PULL_COMPLETE:
88324        if (data.success) {
88325          streamController.pullCall.resolve();
88326        } else {
88327          streamController.pullCall.reject(wrapReason(data.reason));
88328        }
88329        break;
88330      case StreamKind.PULL:
88331        if (!streamSink) {
88332          comObj.postMessage({
88333            sourceName,
88334            targetName,
88335            stream: StreamKind.PULL_COMPLETE,
88336            streamId,
88337            success: true
88338          });
88339          break;
88340        }
88341        if (streamSink.desiredSize <= 0 && data.desiredSize > 0) {
88342          streamSink.sinkCapability.resolve();
88343        }
88344        streamSink.desiredSize = data.desiredSize;
88345        new Promise(function (resolve) {
88346          resolve(streamSink.onPull?.());
88347        }).then(function () {
88348          comObj.postMessage({
88349            sourceName,
88350            targetName,
88351            stream: StreamKind.PULL_COMPLETE,
88352            streamId,
88353            success: true
88354          });
88355        }, function (reason) {
88356          comObj.postMessage({
88357            sourceName,
88358            targetName,
88359            stream: StreamKind.PULL_COMPLETE,
88360            streamId,
88361            reason: wrapReason(reason)
88362          });
88363        });
88364        break;
88365      case StreamKind.ENQUEUE:
88366        (0, _util.assert)(streamController, "enqueue should have stream controller");
88367        if (streamController.isClosed) {
88368          break;
88369        }
88370        streamController.controller.enqueue(data.chunk);
88371        break;
88372      case StreamKind.CLOSE:
88373        (0, _util.assert)(streamController, "close should have stream controller");
88374        if (streamController.isClosed) {
88375          break;
88376        }
88377        streamController.isClosed = true;
88378        streamController.controller.close();
88379        this.#deleteStreamController(streamController, streamId);
88380        break;
88381      case StreamKind.ERROR:
88382        (0, _util.assert)(streamController, "error should have stream controller");
88383        streamController.controller.error(wrapReason(data.reason));
88384        this.#deleteStreamController(streamController, streamId);
88385        break;
88386      case StreamKind.CANCEL_COMPLETE:
88387        if (data.success) {
88388          streamController.cancelCall.resolve();
88389        } else {
88390          streamController.cancelCall.reject(wrapReason(data.reason));
88391        }
88392        this.#deleteStreamController(streamController, streamId);
88393        break;
88394      case StreamKind.CANCEL:
88395        if (!streamSink) {
88396          break;
88397        }
88398        new Promise(function (resolve) {
88399          resolve(streamSink.onCancel?.(wrapReason(data.reason)));
88400        }).then(function () {
88401          comObj.postMessage({
88402            sourceName,
88403            targetName,
88404            stream: StreamKind.CANCEL_COMPLETE,
88405            streamId,
88406            success: true
88407          });
88408        }, function (reason) {
88409          comObj.postMessage({
88410            sourceName,
88411            targetName,
88412            stream: StreamKind.CANCEL_COMPLETE,
88413            streamId,
88414            reason: wrapReason(reason)
88415          });
88416        });
88417        streamSink.sinkCapability.reject(wrapReason(data.reason));
88418        streamSink.isCancelled = true;
88419        delete this.streamSinks[streamId];
88420        break;
88421      default:
88422        throw new Error("Unexpected stream case");
88423    }
88424  }
88425  async #deleteStreamController(streamController, streamId) {
88426    await Promise.allSettled([streamController.startCall?.promise, streamController.pullCall?.promise, streamController.cancelCall?.promise]);
88427    delete this.streamControllers[streamId];
88428  }
88429  destroy() {
88430    this.comObj.removeEventListener("message", this._onComObjOnMessage);
88431  }
88432}
88433exports.MessageHandler = MessageHandler;
88434
88435/***/ }),
88436/* 105 */
88437/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
88438
88439
88440
88441Object.defineProperty(exports, "__esModule", ({
88442  value: true
88443}));
88444exports.PDFWorkerStream = void 0;
88445var _util = __w_pdfjs_require__(2);
88446class PDFWorkerStream {
88447  constructor(msgHandler) {
88448    this._msgHandler = msgHandler;
88449    this._contentLength = null;
88450    this._fullRequestReader = null;
88451    this._rangeRequestReaders = [];
88452  }
88453  getFullReader() {
88454    (0, _util.assert)(!this._fullRequestReader, "PDFWorkerStream.getFullReader can only be called once.");
88455    this._fullRequestReader = new PDFWorkerStreamReader(this._msgHandler);
88456    return this._fullRequestReader;
88457  }
88458  getRangeReader(begin, end) {
88459    const reader = new PDFWorkerStreamRangeReader(begin, end, this._msgHandler);
88460    this._rangeRequestReaders.push(reader);
88461    return reader;
88462  }
88463  cancelAllRequests(reason) {
88464    this._fullRequestReader?.cancel(reason);
88465    for (const reader of this._rangeRequestReaders.slice(0)) {
88466      reader.cancel(reason);
88467    }
88468  }
88469}
88470exports.PDFWorkerStream = PDFWorkerStream;
88471class PDFWorkerStreamReader {
88472  constructor(msgHandler) {
88473    this._msgHandler = msgHandler;
88474    this.onProgress = null;
88475    this._contentLength = null;
88476    this._isRangeSupported = false;
88477    this._isStreamingSupported = false;
88478    const readableStream = this._msgHandler.sendWithStream("GetReader");
88479    this._reader = readableStream.getReader();
88480    this._headersReady = this._msgHandler.sendWithPromise("ReaderHeadersReady").then(data => {
88481      this._isStreamingSupported = data.isStreamingSupported;
88482      this._isRangeSupported = data.isRangeSupported;
88483      this._contentLength = data.contentLength;
88484    });
88485  }
88486  get headersReady() {
88487    return this._headersReady;
88488  }
88489  get contentLength() {
88490    return this._contentLength;
88491  }
88492  get isStreamingSupported() {
88493    return this._isStreamingSupported;
88494  }
88495  get isRangeSupported() {
88496    return this._isRangeSupported;
88497  }
88498  async read() {
88499    const {
88500      value,
88501      done
88502    } = await this._reader.read();
88503    if (done) {
88504      return {
88505        value: undefined,
88506        done: true
88507      };
88508    }
88509    return {
88510      value: value.buffer,
88511      done: false
88512    };
88513  }
88514  cancel(reason) {
88515    this._reader.cancel(reason);
88516  }
88517}
88518class PDFWorkerStreamRangeReader {
88519  constructor(begin, end, msgHandler) {
88520    this._msgHandler = msgHandler;
88521    this.onProgress = null;
88522    const readableStream = this._msgHandler.sendWithStream("GetRangeReader", {
88523      begin,
88524      end
88525    });
88526    this._reader = readableStream.getReader();
88527  }
88528  get isStreamingSupported() {
88529    return false;
88530  }
88531  async read() {
88532    const {
88533      value,
88534      done
88535    } = await this._reader.read();
88536    if (done) {
88537      return {
88538        value: undefined,
88539        done: true
88540      };
88541    }
88542    return {
88543      value: value.buffer,
88544      done: false
88545    };
88546  }
88547  cancel(reason) {
88548    this._reader.cancel(reason);
88549  }
88550}
88551
88552/***/ })
88553/******/ 	]);
88554/************************************************************************/
88555/******/ 	// The module cache
88556/******/ 	var __webpack_module_cache__ = {};
88557/******/ 	
88558/******/ 	// The require function
88559/******/ 	function __w_pdfjs_require__(moduleId) {
88560/******/ 		// Check if module is in cache
88561/******/ 		var cachedModule = __webpack_module_cache__[moduleId];
88562/******/ 		if (cachedModule !== undefined) {
88563/******/ 			return cachedModule.exports;
88564/******/ 		}
88565/******/ 		// Create a new module (and put it into the cache)
88566/******/ 		var module = __webpack_module_cache__[moduleId] = {
88567/******/ 			// no module.id needed
88568/******/ 			// no module.loaded needed
88569/******/ 			exports: {}
88570/******/ 		};
88571/******/ 	
88572/******/ 		// Execute the module function
88573/******/ 		__webpack_modules__[moduleId](module, module.exports, __w_pdfjs_require__);
88574/******/ 	
88575/******/ 		// Return the exports of the module
88576/******/ 		return module.exports;
88577/******/ 	}
88578/******/ 	
88579/************************************************************************/
88580var __nested_webpack_exports__ = {};
88581// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
88582(() => {
88583var exports = __nested_webpack_exports__;
88584
88585
88586Object.defineProperty(exports, "__esModule", ({
88587  value: true
88588}));
88589Object.defineProperty(exports, "WorkerMessageHandler", ({
88590  enumerable: true,
88591  get: function () {
88592    return _worker.WorkerMessageHandler;
88593  }
88594}));
88595var _worker = __w_pdfjs_require__(1);
88596const pdfjsVersion = '3.11.174';
88597const pdfjsBuild = 'ce8716743';
88598})();
88599
88600/******/ 	return __nested_webpack_exports__;
88601/******/ })()
88602;
88603});
88604//# sourceMappingURL=pdf.worker.js.map
88605
88606/***/ },
88607
88608/***/ "./node_modules/simple-concat/index.js"
88609/*!*********************************************!*\
88610  !*** ./node_modules/simple-concat/index.js ***!
88611  \*********************************************/
88612(module) {
88613
88614/*! simple-concat. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
88615module.exports = function (stream, cb) {
88616  var chunks = []
88617  stream.on('data', function (chunk) {
88618    chunks.push(chunk)
88619  })
88620  stream.once('end', function () {
88621    if (cb) cb(null, Buffer.concat(chunks))
88622    cb = null
88623  })
88624  stream.once('error', function (err) {
88625    if (cb) cb(err)
88626    cb = null
88627  })
88628}
88629
88630
88631/***/ },
88632
88633/***/ "./node_modules/simple-get/index.js"
88634/*!******************************************!*\
88635  !*** ./node_modules/simple-get/index.js ***!
88636  \******************************************/
88637(module, __unused_webpack_exports, __webpack_require__) {
88638
88639module.exports = simpleGet
88640
88641const concat = __webpack_require__(/*! simple-concat */ "./node_modules/simple-concat/index.js")
88642const decompressResponse = __webpack_require__(/*! decompress-response */ "./node_modules/simple-get/node_modules/decompress-response/index.js") // excluded from browser build
88643const http = __webpack_require__(/*! http */ "http")
88644const https = __webpack_require__(/*! https */ "https")
88645const once = __webpack_require__(/*! once */ "./node_modules/once/once.js")
88646const querystring = __webpack_require__(/*! querystring */ "querystring")
88647const url = __webpack_require__(/*! url */ "url")
88648
88649const isStream = o => o !== null && typeof o === 'object' && typeof o.pipe === 'function'
88650
88651function simpleGet (opts, cb) {
88652  opts = Object.assign({ maxRedirects: 10 }, typeof opts === 'string' ? { url: opts } : opts)
88653  cb = once(cb)
88654
88655  if (opts.url) {
88656    const { hostname, port, protocol, auth, path } = url.parse(opts.url) // eslint-disable-line node/no-deprecated-api
88657    delete opts.url
88658    if (!hostname && !port && !protocol && !auth) opts.path = path // Relative redirect
88659    else Object.assign(opts, { hostname, port, protocol, auth, path }) // Absolute redirect
88660  }
88661
88662  const headers = { 'accept-encoding': 'gzip, deflate' }
88663  if (opts.headers) Object.keys(opts.headers).forEach(k => (headers[k.toLowerCase()] = opts.headers[k]))
88664  opts.headers = headers
88665
88666  let body
88667  if (opts.body) {
88668    body = opts.json && !isStream(opts.body) ? JSON.stringify(opts.body) : opts.body
88669  } else if (opts.form) {
88670    body = typeof opts.form === 'string' ? opts.form : querystring.stringify(opts.form)
88671    opts.headers['content-type'] = 'application/x-www-form-urlencoded'
88672  }
88673
88674  if (body) {
88675    if (!opts.method) opts.method = 'POST'
88676    if (!isStream(body)) opts.headers['content-length'] = Buffer.byteLength(body)
88677    if (opts.json && !opts.form) opts.headers['content-type'] = 'application/json'
88678  }
88679  delete opts.body; delete opts.form
88680
88681  if (opts.json) opts.headers.accept = 'application/json'
88682  if (opts.method) opts.method = opts.method.toUpperCase()
88683
88684  const originalHost = opts.hostname // hostname before potential redirect
88685  const protocol = opts.protocol === 'https:' ? https : http // Support http/https urls
88686  const req = protocol.request(opts, res => {
88687    if (opts.followRedirects !== false && res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
88688      opts.url = res.headers.location // Follow 3xx redirects
88689      delete opts.headers.host // Discard `host` header on redirect (see #32)
88690      res.resume() // Discard response
88691
88692      const redirectHost = url.parse(opts.url).hostname // eslint-disable-line node/no-deprecated-api
88693      // If redirected host is different than original host, drop headers to prevent cookie leak (#73)
88694      if (redirectHost !== null && redirectHost !== originalHost) {
88695        delete opts.headers.cookie
88696        delete opts.headers.authorization
88697      }
88698
88699      if (opts.method === 'POST' && [301, 302].includes(res.statusCode)) {
88700        opts.method = 'GET' // On 301/302 redirect, change POST to GET (see #35)
88701        delete opts.headers['content-length']; delete opts.headers['content-type']
88702      }
88703
88704      if (opts.maxRedirects-- === 0) return cb(new Error('too many redirects'))
88705      else return simpleGet(opts, cb)
88706    }
88707
88708    const tryUnzip = typeof decompressResponse === 'function' && opts.method !== 'HEAD'
88709    cb(null, tryUnzip ? decompressResponse(res) : res)
88710  })
88711  req.on('timeout', () => {
88712    req.abort()
88713    cb(new Error('Request timed out'))
88714  })
88715  req.on('error', cb)
88716
88717  if (isStream(body)) body.on('error', cb).pipe(req)
88718  else req.end(body)
88719
88720  return req
88721}
88722
88723simpleGet.concat = (opts, cb) => {
88724  return simpleGet(opts, (err, res) => {
88725    if (err) return cb(err)
88726    concat(res, (err, data) => {
88727      if (err) return cb(err)
88728      if (opts.json) {
88729        try {
88730          data = JSON.parse(data.toString())
88731        } catch (err) {
88732          return cb(err, res, data)
88733        }
88734      }
88735      cb(null, res, data)
88736    })
88737  })
88738}
88739
88740;['get', 'post', 'put', 'patch', 'head', 'delete'].forEach(method => {
88741  simpleGet[method] = (opts, cb) => {
88742    if (typeof opts === 'string') opts = { url: opts }
88743    return simpleGet(Object.assign({ method: method.toUpperCase() }, opts), cb)
88744  }
88745})
88746
88747
88748/***/ },
88749
88750/***/ "./node_modules/simple-get/node_modules/decompress-response/index.js"
88751/*!***************************************************************************!*\
88752  !*** ./node_modules/simple-get/node_modules/decompress-response/index.js ***!
88753  \***************************************************************************/
88754(module, __unused_webpack_exports, __webpack_require__) {
88755
88756"use strict";
88757
88758const {PassThrough: PassThroughStream} = __webpack_require__(/*! stream */ "stream");
88759const zlib = __webpack_require__(/*! zlib */ "zlib");
88760const mimicResponse = __webpack_require__(/*! mimic-response */ "./node_modules/simple-get/node_modules/mimic-response/index.js");
88761
88762const decompressResponse = response => {
88763	const contentEncoding = (response.headers['content-encoding'] || '').toLowerCase();
88764
88765	if (!['gzip', 'deflate', 'br'].includes(contentEncoding)) {
88766		return response;
88767	}
88768
88769	const isBrotli = contentEncoding === 'br';
88770	if (isBrotli && typeof zlib.createBrotliDecompress !== 'function') {
88771		return response;
88772	}
88773
88774	const decompress = isBrotli ? zlib.createBrotliDecompress() : zlib.createUnzip();
88775	const stream = new PassThroughStream();
88776
88777	mimicResponse(response, stream);
88778
88779	decompress.on('error', error => {
88780		// Ignore empty response
88781		if (error.code === 'Z_BUF_ERROR') {
88782			stream.end();
88783			return;
88784		}
88785
88786		stream.emit('error', error);
88787	});
88788
88789	response.pipe(decompress).pipe(stream);
88790
88791	return stream;
88792};
88793
88794module.exports = decompressResponse;
88795// TODO: remove this in the next major version
88796module.exports["default"] = decompressResponse;
88797
88798
88799/***/ },
88800
88801/***/ "./node_modules/simple-get/node_modules/mimic-response/index.js"
88802/*!**********************************************************************!*\
88803  !*** ./node_modules/simple-get/node_modules/mimic-response/index.js ***!
88804  \**********************************************************************/
88805(module) {
88806
88807"use strict";
88808
88809
88810// We define these manually to ensure they're always copied
88811// even if they would move up the prototype chain
88812// https://nodejs.org/api/http.html#http_class_http_incomingmessage
88813const knownProperties = [
88814	'aborted',
88815	'complete',
88816	'destroy',
88817	'headers',
88818	'httpVersion',
88819	'httpVersionMinor',
88820	'httpVersionMajor',
88821	'method',
88822	'rawHeaders',
88823	'rawTrailers',
88824	'setTimeout',
88825	'socket',
88826	'statusCode',
88827	'statusMessage',
88828	'trailers',
88829	'url'
88830];
88831
88832module.exports = (fromStream, toStream) => {
88833	const fromProperties = new Set(Object.keys(fromStream).concat(knownProperties));
88834
88835	for (const property of fromProperties) {
88836		// Don't overwrite existing properties.
88837		if (property in toStream) {
88838			continue;
88839		}
88840
88841		toStream[property] = typeof fromStream[property] === 'function' ? fromStream[property].bind(fromStream) : fromStream[property];
88842	}
88843
88844	return toStream;
88845};
88846
88847
88848/***/ },
88849
88850/***/ "./node_modules/slick-carousel/slick/slick.js"
88851/*!****************************************************!*\
88852  !*** ./node_modules/slick-carousel/slick/slick.js ***!
88853  \****************************************************/
88854(module, exports, __webpack_require__) {
88855
88856var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*
88857     _ _      _       _
88858 ___| (_) ___| | __  (_)___
88859/ __| | |/ __| |/ /  | / __|
88860\__ \ | | (__|   < _ | \__ \
88861|___/_|_|\___|_|\_(_)/ |___/
88862                   |__/
88863
88864 Version: 1.8.1
88865  Author: Ken Wheeler
88866 Website: http://kenwheeler.github.io
88867    Docs: http://kenwheeler.github.io/slick
88868    Repo: http://github.com/kenwheeler/slick
88869  Issues: http://github.com/kenwheeler/slick/issues
88870
88871 */
88872/* global window, document, define, jQuery, setInterval, clearInterval */
88873;(function(factory) {
88874    'use strict';
88875    if (true) {
88876        !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js")], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
88877		__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
88878		(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
88879		__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
88880    } else // removed by dead control flow
88881{}
88882
88883}(function($) {
88884    'use strict';
vendor: 31,932 bytes, lines 88884-89947
88884
88885    var Slick = window.Slick || {};
88886
88887    Slick = (function() {
88888
88889        var instanceUid = 0;
88890
88891        function Slick(element, settings) {
88892
88893            var _ = this, dataSettings;
88894
88895            _.defaults = {
88896                accessibility: true,
88897                adaptiveHeight: false,
88898                appendArrows: $(element),
88899                appendDots: $(element),
88900                arrows: true,
88901                asNavFor: null,
88902                prevArrow: '<button class="slick-prev" aria-label="Previous" type="button">Previous</button>',
88903                nextArrow: '<button class="slick-next" aria-label="Next" type="button">Next</button>',
88904                autoplay: false,
88905                autoplaySpeed: 3000,
88906                centerMode: false,
88907                centerPadding: '50px',
88908                cssEase: 'ease',
88909                customPaging: function(slider, i) {
88910                    return $('<button type="button" />').text(i + 1);
88911                },
88912                dots: false,
88913                dotsClass: 'slick-dots',
88914                draggable: true,
88915                easing: 'linear',
88916                edgeFriction: 0.35,
88917                fade: false,
88918                focusOnSelect: false,
88919                focusOnChange: false,
88920                infinite: true,
88921                initialSlide: 0,
88922                lazyLoad: 'ondemand',
88923                mobileFirst: false,
88924                pauseOnHover: true,
88925                pauseOnFocus: true,
88926                pauseOnDotsHover: false,
88927                respondTo: 'window',
88928                responsive: null,
88929                rows: 1,
88930                rtl: false,
88931                slide: '',
88932                slidesPerRow: 1,
88933                slidesToShow: 1,
88934                slidesToScroll: 1,
88935                speed: 500,
88936                swipe: true,
88937                swipeToSlide: false,
88938                touchMove: true,
88939                touchThreshold: 5,
88940                useCSS: true,
88941                useTransform: true,
88942                variableWidth: false,
88943                vertical: false,
88944                verticalSwiping: false,
88945                waitForAnimate: true,
88946                zIndex: 1000
88947            };
88948
88949            _.initials = {
88950                animating: false,
88951                dragging: false,
88952                autoPlayTimer: null,
88953                currentDirection: 0,
88954                currentLeft: null,
88955                currentSlide: 0,
88956                direction: 1,
88957                $dots: null,
88958                listWidth: null,
88959                listHeight: null,
88960                loadIndex: 0,
88961                $nextArrow: null,
88962                $prevArrow: null,
88963                scrolling: false,
88964                slideCount: null,
88965                slideWidth: null,
88966                $slideTrack: null,
88967                $slides: null,
88968                sliding: false,
88969                slideOffset: 0,
88970                swipeLeft: null,
88971                swiping: false,
88972                $list: null,
88973                touchObject: {},
88974                transformsEnabled: false,
88975                unslicked: false
88976            };
88977
88978            $.extend(_, _.initials);
88979
88980            _.activeBreakpoint = null;
88981            _.animType = null;
88982            _.animProp = null;
88983            _.breakpoints = [];
88984            _.breakpointSettings = [];
88985            _.cssTransitions = false;
88986            _.focussed = false;
88987            _.interrupted = false;
88988            _.hidden = 'hidden';
88989            _.paused = true;
88990            _.positionProp = null;
88991            _.respondTo = null;
88992            _.rowCount = 1;
88993            _.shouldClick = true;
88994            _.$slider = $(element);
88995            _.$slidesCache = null;
88996            _.transformType = null;
88997            _.transitionType = null;
88998            _.visibilityChange = 'visibilitychange';
88999            _.windowWidth = 0;
89000            _.windowTimer = null;
89001
89002            dataSettings = $(element).data('slick') || {};
89003
89004            _.options = $.extend({}, _.defaults, settings, dataSettings);
89005
89006            _.currentSlide = _.options.initialSlide;
89007
89008            _.originalSettings = _.options;
89009
89010            if (typeof document.mozHidden !== 'undefined') {
89011                _.hidden = 'mozHidden';
89012                _.visibilityChange = 'mozvisibilitychange';
89013            } else if (typeof document.webkitHidden !== 'undefined') {
89014                _.hidden = 'webkitHidden';
89015                _.visibilityChange = 'webkitvisibilitychange';
89016            }
89017
89018            _.autoPlay = $.proxy(_.autoPlay, _);
89019            _.autoPlayClear = $.proxy(_.autoPlayClear, _);
89020            _.autoPlayIterator = $.proxy(_.autoPlayIterator, _);
89021            _.changeSlide = $.proxy(_.changeSlide, _);
89022            _.clickHandler = $.proxy(_.clickHandler, _);
89023            _.selectHandler = $.proxy(_.selectHandler, _);
89024            _.setPosition = $.proxy(_.setPosition, _);
89025            _.swipeHandler = $.proxy(_.swipeHandler, _);
89026            _.dragHandler = $.proxy(_.dragHandler, _);
89027            _.keyHandler = $.proxy(_.keyHandler, _);
89028
89029            _.instanceUid = instanceUid++;
89030
89031            // A simple way to check for HTML strings
89032            // Strict HTML recognition (must start with <)
89033            // Extracted from jQuery v1.11 source
89034            _.htmlExpr = /^(?:\s*(<[\w\W]+>)[^>]*)$/;
89035
89036
89037            _.registerBreakpoints();
89038            _.init(true);
89039
89040        }
89041
89042        return Slick;
89043
89044    }());
89045
89046    Slick.prototype.activateADA = function() {
89047        var _ = this;
89048
89049        _.$slideTrack.find('.slick-active').attr({
89050            'aria-hidden': 'false'
89051        }).find('a, input, button, select').attr({
89052            'tabindex': '0'
89053        });
89054
89055    };
89056
89057    Slick.prototype.addSlide = Slick.prototype.slickAdd = function(markup, index, addBefore) {
89058
89059        var _ = this;
89060
89061        if (typeof(index) === 'boolean') {
89062            addBefore = index;
89063            index = null;
89064        } else if (index < 0 || (index >= _.slideCount)) {
89065            return false;
89066        }
89067
89068        _.unload();
89069
89070        if (typeof(index) === 'number') {
89071            if (index === 0 && _.$slides.length === 0) {
89072                $(markup).appendTo(_.$slideTrack);
89073            } else if (addBefore) {
89074                $(markup).insertBefore(_.$slides.eq(index));
89075            } else {
89076                $(markup).insertAfter(_.$slides.eq(index));
89077            }
89078        } else {
89079            if (addBefore === true) {
89080                $(markup).prependTo(_.$slideTrack);
89081            } else {
89082                $(markup).appendTo(_.$slideTrack);
89083            }
89084        }
89085
89086        _.$slides = _.$slideTrack.children(this.options.slide);
89087
89088        _.$slideTrack.children(this.options.slide).detach();
89089
89090        _.$slideTrack.append(_.$slides);
89091
89092        _.$slides.each(function(index, element) {
89093            $(element).attr('data-slick-index', index);
89094        });
89095
89096        _.$slidesCache = _.$slides;
89097
89098        _.reinit();
89099
89100    };
89101
89102    Slick.prototype.animateHeight = function() {
89103        var _ = this;
89104        if (_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) {
89105            var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true);
89106            _.$list.animate({
89107                height: targetHeight
89108            }, _.options.speed);
89109        }
89110    };
89111
89112    Slick.prototype.animateSlide = function(targetLeft, callback) {
89113
89114        var animProps = {},
89115            _ = this;
89116
89117        _.animateHeight();
89118
89119        if (_.options.rtl === true && _.options.vertical === false) {
89120            targetLeft = -targetLeft;
89121        }
89122        if (_.transformsEnabled === false) {
89123            if (_.options.vertical === false) {
89124                _.$slideTrack.animate({
89125                    left: targetLeft
89126                }, _.options.speed, _.options.easing, callback);
89127            } else {
89128                _.$slideTrack.animate({
89129                    top: targetLeft
89130                }, _.options.speed, _.options.easing, callback);
89131            }
89132
89133        } else {
89134
89135            if (_.cssTransitions === false) {
89136                if (_.options.rtl === true) {
89137                    _.currentLeft = -(_.currentLeft);
89138                }
89139                $({
89140                    animStart: _.currentLeft
89141                }).animate({
89142                    animStart: targetLeft
89143                }, {
89144                    duration: _.options.speed,
89145                    easing: _.options.easing,
89146                    step: function(now) {
89147                        now = Math.ceil(now);
89148                        if (_.options.vertical === false) {
89149                            animProps[_.animType] = 'translate(' +
89150                                now + 'px, 0px)';
89151                            _.$slideTrack.css(animProps);
89152                        } else {
89153                            animProps[_.animType] = 'translate(0px,' +
89154                                now + 'px)';
89155                            _.$slideTrack.css(animProps);
89156                        }
89157                    },
89158                    complete: function() {
89159                        if (callback) {
89160                            callback.call();
89161                        }
89162                    }
89163                });
89164
89165            } else {
89166
89167                _.applyTransition();
89168                targetLeft = Math.ceil(targetLeft);
89169
89170                if (_.options.vertical === false) {
89171                    animProps[_.animType] = 'translate3d(' + targetLeft + 'px, 0px, 0px)';
89172                } else {
89173                    animProps[_.animType] = 'translate3d(0px,' + targetLeft + 'px, 0px)';
89174                }
89175                _.$slideTrack.css(animProps);
89176
89177                if (callback) {
89178                    setTimeout(function() {
89179
89180                        _.disableTransition();
89181
89182                        callback.call();
89183                    }, _.options.speed);
89184                }
89185
89186            }
89187
89188        }
89189
89190    };
89191
89192    Slick.prototype.getNavTarget = function() {
89193
89194        var _ = this,
89195            asNavFor = _.options.asNavFor;
89196
89197        if ( asNavFor && asNavFor !== null ) {
89198            asNavFor = $(asNavFor).not(_.$slider);
89199        }
89200
89201        return asNavFor;
89202
89203    };
89204
89205    Slick.prototype.asNavFor = function(index) {
89206
89207        var _ = this,
89208            asNavFor = _.getNavTarget();
89209
89210        if ( asNavFor !== null && typeof asNavFor === 'object' ) {
89211            asNavFor.each(function() {
89212                var target = $(this).slick('getSlick');
89213                if(!target.unslicked) {
89214                    target.slideHandler(index, true);
89215                }
89216            });
89217        }
89218
89219    };
89220
89221    Slick.prototype.applyTransition = function(slide) {
89222
89223        var _ = this,
89224            transition = {};
89225
89226        if (_.options.fade === false) {
89227            transition[_.transitionType] = _.transformType + ' ' + _.options.speed + 'ms ' + _.options.cssEase;
89228        } else {
89229            transition[_.transitionType] = 'opacity ' + _.options.speed + 'ms ' + _.options.cssEase;
89230        }
89231
89232        if (_.options.fade === false) {
89233            _.$slideTrack.css(transition);
89234        } else {
89235            _.$slides.eq(slide).css(transition);
89236        }
89237
89238    };
89239
89240    Slick.prototype.autoPlay = function() {
89241
89242        var _ = this;
89243
89244        _.autoPlayClear();
89245
89246        if ( _.slideCount > _.options.slidesToShow ) {
89247            _.autoPlayTimer = setInterval( _.autoPlayIterator, _.options.autoplaySpeed );
89248        }
89249
89250    };
89251
89252    Slick.prototype.autoPlayClear = function() {
89253
89254        var _ = this;
89255
89256        if (_.autoPlayTimer) {
89257            clearInterval(_.autoPlayTimer);
89258        }
89259
89260    };
89261
89262    Slick.prototype.autoPlayIterator = function() {
89263
89264        var _ = this,
89265            slideTo = _.currentSlide + _.options.slidesToScroll;
89266
89267        if ( !_.paused && !_.interrupted && !_.focussed ) {
89268
89269            if ( _.options.infinite === false ) {
89270
89271                if ( _.direction === 1 && ( _.currentSlide + 1 ) === ( _.slideCount - 1 )) {
89272                    _.direction = 0;
89273                }
89274
89275                else if ( _.direction === 0 ) {
89276
89277                    slideTo = _.currentSlide - _.options.slidesToScroll;
89278
89279                    if ( _.currentSlide - 1 === 0 ) {
89280                        _.direction = 1;
89281                    }
89282
89283                }
89284
89285            }
89286
89287            _.slideHandler( slideTo );
89288
89289        }
89290
89291    };
89292
89293    Slick.prototype.buildArrows = function() {
89294
89295        var _ = this;
89296
89297        if (_.options.arrows === true ) {
89298
89299            _.$prevArrow = $(_.options.prevArrow).addClass('slick-arrow');
89300            _.$nextArrow = $(_.options.nextArrow).addClass('slick-arrow');
89301
89302            if( _.slideCount > _.options.slidesToShow ) {
89303
89304                _.$prevArrow.removeClass('slick-hidden').removeAttr('aria-hidden tabindex');
89305                _.$nextArrow.removeClass('slick-hidden').removeAttr('aria-hidden tabindex');
89306
89307                if (_.htmlExpr.test(_.options.prevArrow)) {
89308                    _.$prevArrow.prependTo(_.options.appendArrows);
89309                }
89310
89311                if (_.htmlExpr.test(_.options.nextArrow)) {
89312                    _.$nextArrow.appendTo(_.options.appendArrows);
89313                }
89314
89315                if (_.options.infinite !== true) {
89316                    _.$prevArrow
89317                        .addClass('slick-disabled')
89318                        .attr('aria-disabled', 'true');
89319                }
89320
89321            } else {
89322
89323                _.$prevArrow.add( _.$nextArrow )
89324
89325                    .addClass('slick-hidden')
89326                    .attr({
89327                        'aria-disabled': 'true',
89328                        'tabindex': '-1'
89329                    });
89330
89331            }
89332
89333        }
89334
89335    };
89336
89337    Slick.prototype.buildDots = function() {
89338
89339        var _ = this,
89340            i, dot;
89341
89342        if (_.options.dots === true && _.slideCount > _.options.slidesToShow) {
89343
89344            _.$slider.addClass('slick-dotted');
89345
89346            dot = $('<ul />').addClass(_.options.dotsClass);
89347
89348            for (i = 0; i <= _.getDotCount(); i += 1) {
89349                dot.append($('<li />').append(_.options.customPaging.call(this, _, i)));
89350            }
89351
89352            _.$dots = dot.appendTo(_.options.appendDots);
89353
89354            _.$dots.find('li').first().addClass('slick-active');
89355
89356        }
89357
89358    };
89359
89360    Slick.prototype.buildOut = function() {
89361
89362        var _ = this;
89363
89364        _.$slides =
89365            _.$slider
89366                .children( _.options.slide + ':not(.slick-cloned)')
89367                .addClass('slick-slide');
89368
89369        _.slideCount = _.$slides.length;
89370
89371        _.$slides.each(function(index, element) {
89372            $(element)
89373                .attr('data-slick-index', index)
89374                .data('originalStyling', $(element).attr('style') || '');
89375        });
89376
89377        _.$slider.addClass('slick-slider');
89378
89379        _.$slideTrack = (_.slideCount === 0) ?
89380            $('<div class="slick-track"/>').appendTo(_.$slider) :
89381            _.$slides.wrapAll('<div class="slick-track"/>').parent();
89382
89383        _.$list = _.$slideTrack.wrap(
89384            '<div class="slick-list"/>').parent();
89385        _.$slideTrack.css('opacity', 0);
89386
89387        if (_.options.centerMode === true || _.options.swipeToSlide === true) {
89388            _.options.slidesToScroll = 1;
89389        }
89390
89391        $('img[data-lazy]', _.$slider).not('[src]').addClass('slick-loading');
89392
89393        _.setupInfinite();
89394
89395        _.buildArrows();
89396
89397        _.buildDots();
89398
89399        _.updateDots();
89400
89401
89402        _.setSlideClasses(typeof _.currentSlide === 'number' ? _.currentSlide : 0);
89403
89404        if (_.options.draggable === true) {
89405            _.$list.addClass('draggable');
89406        }
89407
89408    };
89409
89410    Slick.prototype.buildRows = function() {
89411
89412        var _ = this, a, b, c, newSlides, numOfSlides, originalSlides,slidesPerSection;
89413
89414        newSlides = document.createDocumentFragment();
89415        originalSlides = _.$slider.children();
89416
89417        if(_.options.rows > 0) {
89418
89419            slidesPerSection = _.options.slidesPerRow * _.options.rows;
89420            numOfSlides = Math.ceil(
89421                originalSlides.length / slidesPerSection
89422            );
89423
89424            for(a = 0; a < numOfSlides; a++){
89425                var slide = document.createElement('div');
89426                for(b = 0; b < _.options.rows; b++) {
89427                    var row = document.createElement('div');
89428                    for(c = 0; c < _.options.slidesPerRow; c++) {
89429                        var target = (a * slidesPerSection + ((b * _.options.slidesPerRow) + c));
89430                        if (originalSlides.get(target)) {
89431                            row.appendChild(originalSlides.get(target));
89432                        }
89433                    }
89434                    slide.appendChild(row);
89435                }
89436                newSlides.appendChild(slide);
89437            }
89438
89439            _.$slider.empty().append(newSlides);
89440            _.$slider.children().children().children()
89441                .css({
89442                    'width':(100 / _.options.slidesPerRow) + '%',
89443                    'display': 'inline-block'
89444                });
89445
89446        }
89447
89448    };
89449
89450    Slick.prototype.checkResponsive = function(initial, forceUpdate) {
89451
89452        var _ = this,
89453            breakpoint, targetBreakpoint, respondToWidth, triggerBreakpoint = false;
89454        var sliderWidth = _.$slider.width();
89455        var windowWidth = window.innerWidth || $(window).width();
89456
89457        if (_.respondTo === 'window') {
89458            respondToWidth = windowWidth;
89459        } else if (_.respondTo === 'slider') {
89460            respondToWidth = sliderWidth;
89461        } else if (_.respondTo === 'min') {
89462            respondToWidth = Math.min(windowWidth, sliderWidth);
89463        }
89464
89465        if ( _.options.responsive &&
89466            _.options.responsive.length &&
89467            _.options.responsive !== null) {
89468
89469            targetBreakpoint = null;
89470
89471            for (breakpoint in _.breakpoints) {
89472                if (_.breakpoints.hasOwnProperty(breakpoint)) {
89473                    if (_.originalSettings.mobileFirst === false) {
89474                        if (respondToWidth < _.breakpoints[breakpoint]) {
89475                            targetBreakpoint = _.breakpoints[breakpoint];
89476                        }
89477                    } else {
89478                        if (respondToWidth > _.breakpoints[breakpoint]) {
89479                            targetBreakpoint = _.breakpoints[breakpoint];
89480                        }
89481                    }
89482                }
89483            }
89484
89485            if (targetBreakpoint !== null) {
89486                if (_.activeBreakpoint !== null) {
89487                    if (targetBreakpoint !== _.activeBreakpoint || forceUpdate) {
89488                        _.activeBreakpoint =
89489                            targetBreakpoint;
89490                        if (_.breakpointSettings[targetBreakpoint] === 'unslick') {
89491                            _.unslick(targetBreakpoint);
89492                        } else {
89493                            _.options = $.extend({}, _.originalSettings,
89494                                _.breakpointSettings[
89495                                    targetBreakpoint]);
89496                            if (initial === true) {
89497                                _.currentSlide = _.options.initialSlide;
89498                            }
89499                            _.refresh(initial);
89500                        }
89501                        triggerBreakpoint = targetBreakpoint;
89502                    }
89503                } else {
89504                    _.activeBreakpoint = targetBreakpoint;
89505                    if (_.breakpointSettings[targetBreakpoint] === 'unslick') {
89506                        _.unslick(targetBreakpoint);
89507                    } else {
89508                        _.options = $.extend({}, _.originalSettings,
89509                            _.breakpointSettings[
89510                                targetBreakpoint]);
89511                        if (initial === true) {
89512                            _.currentSlide = _.options.initialSlide;
89513                        }
89514                        _.refresh(initial);
89515                    }
89516                    triggerBreakpoint = targetBreakpoint;
89517                }
89518            } else {
89519                if (_.activeBreakpoint !== null) {
89520                    _.activeBreakpoint = null;
89521                    _.options = _.originalSettings;
89522                    if (initial === true) {
89523                        _.currentSlide = _.options.initialSlide;
89524                    }
89525                    _.refresh(initial);
89526                    triggerBreakpoint = targetBreakpoint;
89527                }
89528            }
89529
89530            // only trigger breakpoints during an actual break. not on initialize.
89531            if( !initial && triggerBreakpoint !== false ) {
89532                _.$slider.trigger('breakpoint', [_, triggerBreakpoint]);
89533            }
89534        }
89535
89536    };
89537
89538    Slick.prototype.changeSlide = function(event, dontAnimate) {
89539
89540        var _ = this,
89541            $target = $(event.currentTarget),
89542            indexOffset, slideOffset, unevenOffset;
89543
89544        // If target is a link, prevent default action.
89545        if($target.is('a')) {
89546            event.preventDefault();
89547        }
89548
89549        // If target is not the <li> element (ie: a child), find the <li>.
89550        if(!$target.is('li')) {
89551            $target = $target.closest('li');
89552        }
89553
89554        unevenOffset = (_.slideCount % _.options.slidesToScroll !== 0);
89555        indexOffset = unevenOffset ? 0 : (_.slideCount - _.currentSlide) % _.options.slidesToScroll;
89556
89557        switch (event.data.message) {
89558
89559            case 'previous':
89560                slideOffset = indexOffset === 0 ? _.options.slidesToScroll : _.options.slidesToShow - indexOffset;
89561                if (_.slideCount > _.options.slidesToShow) {
89562                    _.slideHandler(_.currentSlide - slideOffset, false, dontAnimate);
89563                }
89564                break;
89565
89566            case 'next':
89567                slideOffset = indexOffset === 0 ? _.options.slidesToScroll : indexOffset;
89568                if (_.slideCount > _.options.slidesToShow) {
89569                    _.slideHandler(_.currentSlide + slideOffset, false, dontAnimate);
89570                }
89571                break;
89572
89573            case 'index':
89574                var index = event.data.index === 0 ? 0 :
89575                    event.data.index || $target.index() * _.options.slidesToScroll;
89576
89577                _.slideHandler(_.checkNavigable(index), false, dontAnimate);
89578                $target.children().trigger('focus');
89579                break;
89580
89581            default:
89582                return;
89583        }
89584
89585    };
89586
89587    Slick.prototype.checkNavigable = function(index) {
89588
89589        var _ = this,
89590            navigables, prevNavigable;
89591
89592        navigables = _.getNavigableIndexes();
89593        prevNavigable = 0;
89594        if (index > navigables[navigables.length - 1]) {
89595            index = navigables[navigables.length - 1];
89596        } else {
89597            for (var n in navigables) {
89598                if (index < navigables[n]) {
89599                    index = prevNavigable;
89600                    break;
89601                }
89602                prevNavigable = navigables[n];
89603            }
89604        }
89605
89606        return index;
89607    };
89608
89609    Slick.prototype.cleanUpEvents = function() {
89610
89611        var _ = this;
89612
89613        if (_.options.dots && _.$dots !== null) {
89614
89615            $('li', _.$dots)
89616                .off('click.slick', _.changeSlide)
89617                .off('mouseenter.slick', $.proxy(_.interrupt, _, true))
89618                .off('mouseleave.slick', $.proxy(_.interrupt, _, false));
89619
89620            if (_.options.accessibility === true) {
89621                _.$dots.off('keydown.slick', _.keyHandler);
89622            }
89623        }
89624
89625        _.$slider.off('focus.slick blur.slick');
89626
89627        if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {
89628            _.$prevArrow && _.$prevArrow.off('click.slick', _.changeSlide);
89629            _.$nextArrow && _.$nextArrow.off('click.slick', _.changeSlide);
89630
89631            if (_.options.accessibility === true) {
89632                _.$prevArrow && _.$prevArrow.off('keydown.slick', _.keyHandler);
89633                _.$nextArrow && _.$nextArrow.off('keydown.slick', _.keyHandler);
89634            }
89635        }
89636
89637        _.$list.off('touchstart.slick mousedown.slick', _.swipeHandler);
89638        _.$list.off('touchmove.slick mousemove.slick', _.swipeHandler);
89639        _.$list.off('touchend.slick mouseup.slick', _.swipeHandler);
89640        _.$list.off('touchcancel.slick mouseleave.slick', _.swipeHandler);
89641
89642        _.$list.off('click.slick', _.clickHandler);
89643
89644        $(document).off(_.visibilityChange, _.visibility);
89645
89646        _.cleanUpSlideEvents();
89647
89648        if (_.options.accessibility === true) {
89649            _.$list.off('keydown.slick', _.keyHandler);
89650        }
89651
89652        if (_.options.focusOnSelect === true) {
89653            $(_.$slideTrack).children().off('click.slick', _.selectHandler);
89654        }
89655
89656        $(window).off('orientationchange.slick.slick-' + _.instanceUid, _.orientationChange);
89657
89658        $(window).off('resize.slick.slick-' + _.instanceUid, _.resize);
89659
89660        $('[draggable!=true]', _.$slideTrack).off('dragstart', _.preventDefault);
89661
89662        $(window).off('load.slick.slick-' + _.instanceUid, _.setPosition);
89663
89664    };
89665
89666    Slick.prototype.cleanUpSlideEvents = function() {
89667
89668        var _ = this;
89669
89670        _.$list.off('mouseenter.slick', $.proxy(_.interrupt, _, true));
89671        _.$list.off('mouseleave.slick', $.proxy(_.interrupt, _, false));
89672
89673    };
89674
89675    Slick.prototype.cleanUpRows = function() {
89676
89677        var _ = this, originalSlides;
89678
89679        if(_.options.rows > 0) {
89680            originalSlides = _.$slides.children().children();
89681            originalSlides.removeAttr('style');
89682            _.$slider.empty().append(originalSlides);
89683        }
89684
89685    };
89686
89687    Slick.prototype.clickHandler = function(event) {
89688
89689        var _ = this;
89690
89691        if (_.shouldClick === false) {
89692            event.stopImmediatePropagation();
89693            event.stopPropagation();
89694            event.preventDefault();
89695        }
89696
89697    };
89698
89699    Slick.prototype.destroy = function(refresh) {
89700
89701        var _ = this;
89702
89703        _.autoPlayClear();
89704
89705        _.touchObject = {};
89706
89707        _.cleanUpEvents();
89708
89709        $('.slick-cloned', _.$slider).detach();
89710
89711        if (_.$dots) {
89712            _.$dots.remove();
89713        }
89714
89715        if ( _.$prevArrow && _.$prevArrow.length ) {
89716
89717            _.$prevArrow
89718                .removeClass('slick-disabled slick-arrow slick-hidden')
89719                .removeAttr('aria-hidden aria-disabled tabindex')
89720                .css('display','');
89721
89722            if ( _.htmlExpr.test( _.options.prevArrow )) {
89723                _.$prevArrow.remove();
89724            }
89725        }
89726
89727        if ( _.$nextArrow && _.$nextArrow.length ) {
89728
89729            _.$nextArrow
89730                .removeClass('slick-disabled slick-arrow slick-hidden')
89731                .removeAttr('aria-hidden aria-disabled tabindex')
89732                .css('display','');
89733
89734            if ( _.htmlExpr.test( _.options.nextArrow )) {
89735                _.$nextArrow.remove();
89736            }
89737        }
89738
89739
89740        if (_.$slides) {
89741
89742            _.$slides
89743                .removeClass('slick-slide slick-active slick-center slick-visible slick-current')
89744                .removeAttr('aria-hidden')
89745                .removeAttr('data-slick-index')
89746                .each(function(){
89747                    $(this).attr('style', $(this).data('originalStyling'));
89748                });
89749
89750            _.$slideTrack.children(this.options.slide).detach();
89751
89752            _.$slideTrack.detach();
89753
89754            _.$list.detach();
89755
89756            _.$slider.append(_.$slides);
89757        }
89758
89759        _.cleanUpRows();
89760
89761        _.$slider.removeClass('slick-slider');
89762        _.$slider.removeClass('slick-initialized');
89763        _.$slider.removeClass('slick-dotted');
89764
89765        _.unslicked = true;
89766
89767        if(!refresh) {
89768            _.$slider.trigger('destroy', [_]);
89769        }
89770
89771    };
89772
89773    Slick.prototype.disableTransition = function(slide) {
89774
89775        var _ = this,
89776            transition = {};
89777
89778        transition[_.transitionType] = '';
89779
89780        if (_.options.fade === false) {
89781            _.$slideTrack.css(transition);
89782        } else {
89783            _.$slides.eq(slide).css(transition);
89784        }
89785
89786    };
89787
89788    Slick.prototype.fadeSlide = function(slideIndex, callback) {
89789
89790        var _ = this;
89791
89792        if (_.cssTransitions === false) {
89793
89794            _.$slides.eq(slideIndex).css({
89795                zIndex: _.options.zIndex
89796            });
89797
89798            _.$slides.eq(slideIndex).animate({
89799                opacity: 1
89800            }, _.options.speed, _.options.easing, callback);
89801
89802        } else {
89803
89804            _.applyTransition(slideIndex);
89805
89806            _.$slides.eq(slideIndex).css({
89807                opacity: 1,
89808                zIndex: _.options.zIndex
89809            });
89810
89811            if (callback) {
89812                setTimeout(function() {
89813
89814                    _.disableTransition(slideIndex);
89815
89816                    callback.call();
89817                }, _.options.speed);
89818            }
89819
89820        }
89821
89822    };
89823
89824    Slick.prototype.fadeSlideOut = function(slideIndex) {
89825
89826        var _ = this;
89827
89828        if (_.cssTransitions === false) {
89829
89830            _.$slides.eq(slideIndex).animate({
89831                opacity: 0,
89832                zIndex: _.options.zIndex - 2
89833            }, _.options.speed, _.options.easing);
89834
89835        } else {
89836
89837            _.applyTransition(slideIndex);
89838
89839            _.$slides.eq(slideIndex).css({
89840                opacity: 0,
89841                zIndex: _.options.zIndex - 2
89842            });
89843
89844        }
89845
89846    };
89847
89848    Slick.prototype.filterSlides = Slick.prototype.slickFilter = function(filter) {
89849
89850        var _ = this;
89851
89852        if (filter !== null) {
89853
89854            _.$slidesCache = _.$slides;
89855
89856            _.unload();
89857
89858            _.$slideTrack.children(this.options.slide).detach();
89859
89860            _.$slidesCache.filter(filter).appendTo(_.$slideTrack);
89861
89862            _.reinit();
89863
89864        }
89865
89866    };
89867
89868    Slick.prototype.focusHandler = function() {
89869
89870        var _ = this;
89871
89872        _.$slider
89873            .off('focus.slick blur.slick')
89874            .on('focus.slick blur.slick', '*', function(event) {
89875
89876            event.stopImmediatePropagation();
89877            var $sf = $(this);
89878
89879            setTimeout(function() {
89880
89881                if( _.options.pauseOnFocus ) {
89882                    _.focussed = $sf.is(':focus');
89883                    _.autoPlay();
89884                }
89885
89886            }, 0);
89887
89888        });
89889    };
89890
89891    Slick.prototype.getCurrent = Slick.prototype.slickCurrentSlide = function() {
89892
89893        var _ = this;
89894        return _.currentSlide;
89895
89896    };
89897
89898    Slick.prototype.getDotCount = function() {
89899
89900        var _ = this;
89901
89902        var breakPoint = 0;
89903        var counter = 0;
89904        var pagerQty = 0;
89905
89906        if (_.options.infinite === true) {
89907            if (_.slideCount <= _.options.slidesToShow) {
89908                 ++pagerQty;
89909            } else {
89910                while (breakPoint < _.slideCount) {
89911                    ++pagerQty;
89912                    breakPoint = counter + _.options.slidesToScroll;
89913                    counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow;
89914                }
89915            }
89916        } else if (_.options.centerMode === true) {
89917            pagerQty = _.slideCount;
89918        } else if(!_.options.asNavFor) {
89919            pagerQty = 1 + Math.ceil((_.slideCount - _.options.slidesToShow) / _.options.slidesToScroll);
89920        }else {
89921            while (breakPoint < _.slideCount) {
89922                ++pagerQty;
89923                breakPoint = counter + _.options.slidesToScroll;
89924                counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow;
89925            }
89926        }
89927
89928        return pagerQty - 1;
89929
89930    };
89931
89932    Slick.prototype.getLeft = function(slideIndex) {
89933
89934        var _ = this,
89935            targetLeft,
89936            verticalHeight,
89937            verticalOffset = 0,
89938            targetSlide,
89939            coef;
89940
89941        _.slideOffset = 0;
89942        verticalHeight = _.$slides.first().outerHeight(true);
89943
89944        if (_.options.infinite === true) {
89945            if (_.slideCount > _.options.slidesToShow) {
89946                _.slideOffset = (_.slideWidth * _.options.slidesToShow) * -1;
89947                coef = -1
89947
89948
89949                if (_.options.vertical === true && _.options.centerMode === true) {
89950                    if (_.options.slidesToShow === 2) {
89951                        coef = -1.5;
89952                    } else if (_.options.slidesToShow === 1) {
89953                        coef = -2
vendor: 47,517 bytes, lines 89953-91556
89953
89954                    }
89955                }
89956                verticalOffset = (verticalHeight * _.options.slidesToShow) * coef;
89957            }
89958            if (_.slideCount % _.options.slidesToScroll !== 0) {
89959                if (slideIndex + _.options.slidesToScroll > _.slideCount && _.slideCount > _.options.slidesToShow) {
89960                    if (slideIndex > _.slideCount) {
89961                        _.slideOffset = ((_.options.slidesToShow - (slideIndex - _.slideCount)) * _.slideWidth) * -1;
89962                        verticalOffset = ((_.options.slidesToShow - (slideIndex - _.slideCount)) * verticalHeight) * -1;
89963                    } else {
89964                        _.slideOffset = ((_.slideCount % _.options.slidesToScroll) * _.slideWidth) * -1;
89965                        verticalOffset = ((_.slideCount % _.options.slidesToScroll) * verticalHeight) * -1;
89966                    }
89967                }
89968            }
89969        } else {
89970            if (slideIndex + _.options.slidesToShow > _.slideCount) {
89971                _.slideOffset = ((slideIndex + _.options.slidesToShow) - _.slideCount) * _.slideWidth;
89972                verticalOffset = ((slideIndex + _.options.slidesToShow) - _.slideCount) * verticalHeight;
89973            }
89974        }
89975
89976        if (_.slideCount <= _.options.slidesToShow) {
89977            _.slideOffset = 0;
89978            verticalOffset = 0;
89979        }
89980
89981        if (_.options.centerMode === true && _.slideCount <= _.options.slidesToShow) {
89982            _.slideOffset = ((_.slideWidth * Math.floor(_.options.slidesToShow)) / 2) - ((_.slideWidth * _.slideCount) / 2);
89983        } else if (_.options.centerMode === true && _.options.infinite === true) {
89984            _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2) - _.slideWidth;
89985        } else if (_.options.centerMode === true) {
89986            _.slideOffset = 0;
89987            _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2);
89988        }
89989
89990        if (_.options.vertical === false) {
89991            targetLeft = ((slideIndex * _.slideWidth) * -1) + _.slideOffset;
89992        } else {
89993            targetLeft = ((slideIndex * verticalHeight) * -1) + verticalOffset;
89994        }
89995
89996        if (_.options.variableWidth === true) {
89997
89998            if (_.slideCount <= _.options.slidesToShow || _.options.infinite === false) {
89999                targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex);
90000            } else {
90001                targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex + _.options.slidesToShow);
90002            }
90003
90004            if (_.options.rtl === true) {
90005                if (targetSlide[0]) {
90006                    targetLeft = (_.$slideTrack.width() - targetSlide[0].offsetLeft - targetSlide.width()) * -1;
90007                } else {
90008                    targetLeft =  0;
90009                }
90010            } else {
90011                targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0;
90012            }
90013
90014            if (_.options.centerMode === true) {
90015                if (_.slideCount <= _.options.slidesToShow || _.options.infinite === false) {
90016                    targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex);
90017                } else {
90018                    targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex + _.options.slidesToShow + 1);
90019                }
90020
90021                if (_.options.rtl === true) {
90022                    if (targetSlide[0]) {
90023                        targetLeft = (_.$slideTrack.width() - targetSlide[0].offsetLeft - targetSlide.width()) * -1;
90024                    } else {
90025                        targetLeft =  0;
90026                    }
90027                } else {
90028                    targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0;
90029                }
90030
90031                targetLeft += (_.$list.width() - targetSlide.outerWidth()) / 2;
90032            }
90033        }
90034
90035        return targetLeft;
90036
90037    };
90038
90039    Slick.prototype.getOption = Slick.prototype.slickGetOption = function(option) {
90040
90041        var _ = this;
90042
90043        return _.options[option];
90044
90045    };
90046
90047    Slick.prototype.getNavigableIndexes = function() {
90048
90049        var _ = this,
90050            breakPoint = 0,
90051            counter = 0,
90052            indexes = [],
90053            max;
90054
90055        if (_.options.infinite === false) {
90056            max = _.slideCount;
90057        } else {
90058            breakPoint = _.options.slidesToScroll * -1;
90059            counter = _.options.slidesToScroll * -1;
90060            max = _.slideCount * 2;
90061        }
90062
90063        while (breakPoint < max) {
90064            indexes.push(breakPoint);
90065            breakPoint = counter + _.options.slidesToScroll;
90066            counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow;
90067        }
90068
90069        return indexes;
90070
90071    };
90072
90073    Slick.prototype.getSlick = function() {
90074
90075        return this;
90076
90077    };
90078
90079    Slick.prototype.getSlideCount = function() {
90080
90081        var _ = this,
90082            slidesTraversed, swipedSlide, centerOffset;
90083
90084        centerOffset = _.options.centerMode === true ? _.slideWidth * Math.floor(_.options.slidesToShow / 2) : 0;
90085
90086        if (_.options.swipeToSlide === true) {
90087            _.$slideTrack.find('.slick-slide').each(function(index, slide) {
90088                if (slide.offsetLeft - centerOffset + ($(slide).outerWidth() / 2) > (_.swipeLeft * -1)) {
90089                    swipedSlide = slide;
90090                    return false;
90091                }
90092            });
90093
90094            slidesTraversed = Math.abs($(swipedSlide).attr('data-slick-index') - _.currentSlide) || 1;
90095
90096            return slidesTraversed;
90097
90098        } else {
90099            return _.options.slidesToScroll;
90100        }
90101
90102    };
90103
90104    Slick.prototype.goTo = Slick.prototype.slickGoTo = function(slide, dontAnimate) {
90105
90106        var _ = this;
90107
90108        _.changeSlide({
90109            data: {
90110                message: 'index',
90111                index: parseInt(slide)
90112            }
90113        }, dontAnimate);
90114
90115    };
90116
90117    Slick.prototype.init = function(creation) {
90118
90119        var _ = this;
90120
90121        if (!$(_.$slider).hasClass('slick-initialized')) {
90122
90123            $(_.$slider).addClass('slick-initialized');
90124
90125            _.buildRows();
90126            _.buildOut();
90127            _.setProps();
90128            _.startLoad();
90129            _.loadSlider();
90130            _.initializeEvents();
90131            _.updateArrows();
90132            _.updateDots();
90133            _.checkResponsive(true);
90134            _.focusHandler();
90135
90136        }
90137
90138        if (creation) {
90139            _.$slider.trigger('init', [_]);
90140        }
90141
90142        if (_.options.accessibility === true) {
90143            _.initADA();
90144        }
90145
90146        if ( _.options.autoplay ) {
90147
90148            _.paused = false;
90149            _.autoPlay();
90150
90151        }
90152
90153    };
90154
90155    Slick.prototype.initADA = function() {
90156        var _ = this,
90157                numDotGroups = Math.ceil(_.slideCount / _.options.slidesToShow),
90158                tabControlIndexes = _.getNavigableIndexes().filter(function(val) {
90159                    return (val >= 0) && (val < _.slideCount);
90160                });
90161
90162        _.$slides.add(_.$slideTrack.find('.slick-cloned')).attr({
90163            'aria-hidden': 'true',
90164            'tabindex': '-1'
90165        }).find('a, input, button, select').attr({
90166            'tabindex': '-1'
90167        });
90168
90169        if (_.$dots !== null) {
90170            _.$slides.not(_.$slideTrack.find('.slick-cloned')).each(function(i) {
90171                var slideControlIndex = tabControlIndexes.indexOf(i);
90172
90173                $(this).attr({
90174                    'role': 'tabpanel',
90175                    'id': 'slick-slide' + _.instanceUid + i,
90176                    'tabindex': -1
90177                });
90178
90179                if (slideControlIndex !== -1) {
90180                   var ariaButtonControl = 'slick-slide-control' + _.instanceUid + slideControlIndex
90181                   if ($('#' + ariaButtonControl).length) {
90182                     $(this).attr({
90183                         'aria-describedby': ariaButtonControl
90184                     });
90185                   }
90186                }
90187            });
90188
90189            _.$dots.attr('role', 'tablist').find('li').each(function(i) {
90190                var mappedSlideIndex = tabControlIndexes[i];
90191
90192                $(this).attr({
90193                    'role': 'presentation'
90194                });
90195
90196                $(this).find('button').first().attr({
90197                    'role': 'tab',
90198                    'id': 'slick-slide-control' + _.instanceUid + i,
90199                    'aria-controls': 'slick-slide' + _.instanceUid + mappedSlideIndex,
90200                    'aria-label': (i + 1) + ' of ' + numDotGroups,
90201                    'aria-selected': null,
90202                    'tabindex': '-1'
90203                });
90204
90205            }).eq(_.currentSlide).find('button').attr({
90206                'aria-selected': 'true',
90207                'tabindex': '0'
90208            }).end();
90209        }
90210
90211        for (var i=_.currentSlide, max=i+_.options.slidesToShow; i < max; i++) {
90212          if (_.options.focusOnChange) {
90213            _.$slides.eq(i).attr({'tabindex': '0'});
90214          } else {
90215            _.$slides.eq(i).removeAttr('tabindex');
90216          }
90217        }
90218
90219        _.activateADA();
90220
90221    };
90222
90223    Slick.prototype.initArrowEvents = function() {
90224
90225        var _ = this;
90226
90227        if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {
90228            _.$prevArrow
90229               .off('click.slick')
90230               .on('click.slick', {
90231                    message: 'previous'
90232               }, _.changeSlide);
90233            _.$nextArrow
90234               .off('click.slick')
90235               .on('click.slick', {
90236                    message: 'next'
90237               }, _.changeSlide);
90238
90239            if (_.options.accessibility === true) {
90240                _.$prevArrow.on('keydown.slick', _.keyHandler);
90241                _.$nextArrow.on('keydown.slick', _.keyHandler);
90242            }
90243        }
90244
90245    };
90246
90247    Slick.prototype.initDotEvents = function() {
90248
90249        var _ = this;
90250
90251        if (_.options.dots === true && _.slideCount > _.options.slidesToShow) {
90252            $('li', _.$dots).on('click.slick', {
90253                message: 'index'
90254            }, _.changeSlide);
90255
90256            if (_.options.accessibility === true) {
90257                _.$dots.on('keydown.slick', _.keyHandler);
90258            }
90259        }
90260
90261        if (_.options.dots === true && _.options.pauseOnDotsHover === true && _.slideCount > _.options.slidesToShow) {
90262
90263            $('li', _.$dots)
90264                .on('mouseenter.slick', $.proxy(_.interrupt, _, true))
90265                .on('mouseleave.slick', $.proxy(_.interrupt, _, false));
90266
90267        }
90268
90269    };
90270
90271    Slick.prototype.initSlideEvents = function() {
90272
90273        var _ = this;
90274
90275        if ( _.options.pauseOnHover ) {
90276
90277            _.$list.on('mouseenter.slick', $.proxy(_.interrupt, _, true));
90278            _.$list.on('mouseleave.slick', $.proxy(_.interrupt, _, false));
90279
90280        }
90281
90282    };
90283
90284    Slick.prototype.initializeEvents = function() {
90285
90286        var _ = this;
90287
90288        _.initArrowEvents();
90289
90290        _.initDotEvents();
90291        _.initSlideEvents();
90292
90293        _.$list.on('touchstart.slick mousedown.slick', {
90294            action: 'start'
90295        }, _.swipeHandler);
90296        _.$list.on('touchmove.slick mousemove.slick', {
90297            action: 'move'
90298        }, _.swipeHandler);
90299        _.$list.on('touchend.slick mouseup.slick', {
90300            action: 'end'
90301        }, _.swipeHandler);
90302        _.$list.on('touchcancel.slick mouseleave.slick', {
90303            action: 'end'
90304        }, _.swipeHandler);
90305
90306        _.$list.on('click.slick', _.clickHandler);
90307
90308        $(document).on(_.visibilityChange, $.proxy(_.visibility, _));
90309
90310        if (_.options.accessibility === true) {
90311            _.$list.on('keydown.slick', _.keyHandler);
90312        }
90313
90314        if (_.options.focusOnSelect === true) {
90315            $(_.$slideTrack).children().on('click.slick', _.selectHandler);
90316        }
90317
90318        $(window).on('orientationchange.slick.slick-' + _.instanceUid, $.proxy(_.orientationChange, _));
90319
90320        $(window).on('resize.slick.slick-' + _.instanceUid, $.proxy(_.resize, _));
90321
90322        $('[draggable!=true]', _.$slideTrack).on('dragstart', _.preventDefault);
90323
90324        $(window).on('load.slick.slick-' + _.instanceUid, _.setPosition);
90325        $(_.setPosition);
90326
90327    };
90328
90329    Slick.prototype.initUI = function() {
90330
90331        var _ = this;
90332
90333        if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {
90334
90335            _.$prevArrow.show();
90336            _.$nextArrow.show();
90337
90338        }
90339
90340        if (_.options.dots === true && _.slideCount > _.options.slidesToShow) {
90341
90342            _.$dots.show();
90343
90344        }
90345
90346    };
90347
90348    Slick.prototype.keyHandler = function(event) {
90349
90350        var _ = this;
90351         //Dont slide if the cursor is inside the form fields and arrow keys are pressed
90352        if(!event.target.tagName.match('TEXTAREA|INPUT|SELECT')) {
90353            if (event.keyCode === 37 && _.options.accessibility === true) {
90354                _.changeSlide({
90355                    data: {
90356                        message: _.options.rtl === true ? 'next' :  'previous'
90357                    }
90358                });
90359            } else if (event.keyCode === 39 && _.options.accessibility === true) {
90360                _.changeSlide({
90361                    data: {
90362                        message: _.options.rtl === true ? 'previous' : 'next'
90363                    }
90364                });
90365            }
90366        }
90367
90368    };
90369
90370    Slick.prototype.lazyLoad = function() {
90371
90372        var _ = this,
90373            loadRange, cloneRange, rangeStart, rangeEnd;
90374
90375        function loadImages(imagesScope) {
90376
90377            $('img[data-lazy]', imagesScope).each(function() {
90378
90379                var image = $(this),
90380                    imageSource = $(this).attr('data-lazy'),
90381                    imageSrcSet = $(this).attr('data-srcset'),
90382                    imageSizes  = $(this).attr('data-sizes') || _.$slider.attr('data-sizes'),
90383                    imageToLoad = document.createElement('img');
90384
90385                imageToLoad.onload = function() {
90386
90387                    image
90388                        .animate({ opacity: 0 }, 100, function() {
90389
90390                            if (imageSrcSet) {
90391                                image
90392                                    .attr('srcset', imageSrcSet );
90393
90394                                if (imageSizes) {
90395                                    image
90396                                        .attr('sizes', imageSizes );
90397                                }
90398                            }
90399
90400                            image
90401                                .attr('src', imageSource)
90402                                .animate({ opacity: 1 }, 200, function() {
90403                                    image
90404                                        .removeAttr('data-lazy data-srcset data-sizes')
90405                                        .removeClass('slick-loading');
90406                                });
90407                            _.$slider.trigger('lazyLoaded', [_, image, imageSource]);
90408                        });
90409
90410                };
90411
90412                imageToLoad.onerror = function() {
90413
90414                    image
90415                        .removeAttr( 'data-lazy' )
90416                        .removeClass( 'slick-loading' )
90417                        .addClass( 'slick-lazyload-error' );
90418
90419                    _.$slider.trigger('lazyLoadError', [ _, image, imageSource ]);
90420
90421                };
90422
90423                imageToLoad.src = imageSource;
90424
90425            });
90426
90427        }
90428
90429        if (_.options.centerMode === true) {
90430            if (_.options.infinite === true) {
90431                rangeStart = _.currentSlide + (_.options.slidesToShow / 2 + 1);
90432                rangeEnd = rangeStart + _.options.slidesToShow + 2;
90433            } else {
90434                rangeStart = Math.max(0, _.currentSlide - (_.options.slidesToShow / 2 + 1));
90435                rangeEnd = 2 + (_.options.slidesToShow / 2 + 1) + _.currentSlide;
90436            }
90437        } else {
90438            rangeStart = _.options.infinite ? _.options.slidesToShow + _.currentSlide : _.currentSlide;
90439            rangeEnd = Math.ceil(rangeStart + _.options.slidesToShow);
90440            if (_.options.fade === true) {
90441                if (rangeStart > 0) rangeStart--;
90442                if (rangeEnd <= _.slideCount) rangeEnd++;
90443            }
90444        }
90445
90446        loadRange = _.$slider.find('.slick-slide').slice(rangeStart, rangeEnd);
90447
90448        if (_.options.lazyLoad === 'anticipated') {
90449            var prevSlide = rangeStart - 1,
90450                nextSlide = rangeEnd,
90451                $slides = _.$slider.find('.slick-slide');
90452
90453            for (var i = 0; i < _.options.slidesToScroll; i++) {
90454                if (prevSlide < 0) prevSlide = _.slideCount - 1;
90455                loadRange = loadRange.add($slides.eq(prevSlide));
90456                loadRange = loadRange.add($slides.eq(nextSlide));
90457                prevSlide--;
90458                nextSlide++;
90459            }
90460        }
90461
90462        loadImages(loadRange);
90463
90464        if (_.slideCount <= _.options.slidesToShow) {
90465            cloneRange = _.$slider.find('.slick-slide');
90466            loadImages(cloneRange);
90467        } else
90468        if (_.currentSlide >= _.slideCount - _.options.slidesToShow) {
90469            cloneRange = _.$slider.find('.slick-cloned').slice(0, _.options.slidesToShow);
90470            loadImages(cloneRange);
90471        } else if (_.currentSlide === 0) {
90472            cloneRange = _.$slider.find('.slick-cloned').slice(_.options.slidesToShow * -1);
90473            loadImages(cloneRange);
90474        }
90475
90476    };
90477
90478    Slick.prototype.loadSlider = function() {
90479
90480        var _ = this;
90481
90482        _.setPosition();
90483
90484        _.$slideTrack.css({
90485            opacity: 1
90486        });
90487
90488        _.$slider.removeClass('slick-loading');
90489
90490        _.initUI();
90491
90492        if (_.options.lazyLoad === 'progressive') {
90493            _.progressiveLazyLoad();
90494        }
90495
90496    };
90497
90498    Slick.prototype.next = Slick.prototype.slickNext = function() {
90499
90500        var _ = this;
90501
90502        _.changeSlide({
90503            data: {
90504                message: 'next'
90505            }
90506        });
90507
90508    };
90509
90510    Slick.prototype.orientationChange = function() {
90511
90512        var _ = this;
90513
90514        _.checkResponsive();
90515        _.setPosition();
90516
90517    };
90518
90519    Slick.prototype.pause = Slick.prototype.slickPause = function() {
90520
90521        var _ = this;
90522
90523        _.autoPlayClear();
90524        _.paused = true;
90525
90526    };
90527
90528    Slick.prototype.play = Slick.prototype.slickPlay = function() {
90529
90530        var _ = this;
90531
90532        _.autoPlay();
90533        _.options.autoplay = true;
90534        _.paused = false;
90535        _.focussed = false;
90536        _.interrupted = false;
90537
90538    };
90539
90540    Slick.prototype.postSlide = function(index) {
90541
90542        var _ = this;
90543
90544        if( !_.unslicked ) {
90545
90546            _.$slider.trigger('afterChange', [_, index]);
90547
90548            _.animating = false;
90549
90550            if (_.slideCount > _.options.slidesToShow) {
90551                _.setPosition();
90552            }
90553
90554            _.swipeLeft = null;
90555
90556            if ( _.options.autoplay ) {
90557                _.autoPlay();
90558            }
90559
90560            if (_.options.accessibility === true) {
90561                _.initADA();
90562
90563                if (_.options.focusOnChange) {
90564                    var $currentSlide = $(_.$slides.get(_.currentSlide));
90565                    $currentSlide.attr('tabindex', 0).focus();
90566                }
90567            }
90568
90569        }
90570
90571    };
90572
90573    Slick.prototype.prev = Slick.prototype.slickPrev = function() {
90574
90575        var _ = this;
90576
90577        _.changeSlide({
90578            data: {
90579                message: 'previous'
90580            }
90581        });
90582
90583    };
90584
90585    Slick.prototype.preventDefault = function(event) {
90586
90587        event.preventDefault();
90588
90589    };
90590
90591    Slick.prototype.progressiveLazyLoad = function( tryCount ) {
90592
90593        tryCount = tryCount || 1;
90594
90595        var _ = this,
90596            $imgsToLoad = $( 'img[data-lazy]', _.$slider ),
90597            image,
90598            imageSource,
90599            imageSrcSet,
90600            imageSizes,
90601            imageToLoad;
90602
90603        if ( $imgsToLoad.length ) {
90604
90605            image = $imgsToLoad.first();
90606            imageSource = image.attr('data-lazy');
90607            imageSrcSet = image.attr('data-srcset');
90608            imageSizes  = image.attr('data-sizes') || _.$slider.attr('data-sizes');
90609            imageToLoad = document.createElement('img');
90610
90611            imageToLoad.onload = function() {
90612
90613                if (imageSrcSet) {
90614                    image
90615                        .attr('srcset', imageSrcSet );
90616
90617                    if (imageSizes) {
90618                        image
90619                            .attr('sizes', imageSizes );
90620                    }
90621                }
90622
90623                image
90624                    .attr( 'src', imageSource )
90625                    .removeAttr('data-lazy data-srcset data-sizes')
90626                    .removeClass('slick-loading');
90627
90628                if ( _.options.adaptiveHeight === true ) {
90629                    _.setPosition();
90630                }
90631
90632                _.$slider.trigger('lazyLoaded', [ _, image, imageSource ]);
90633                _.progressiveLazyLoad();
90634
90635            };
90636
90637            imageToLoad.onerror = function() {
90638
90639                if ( tryCount < 3 ) {
90640
90641                    /**
90642                     * try to load the image 3 times,
90643                     * leave a slight delay so we don't get
90644                     * servers blocking the request.
90645                     */
90646                    setTimeout( function() {
90647                        _.progressiveLazyLoad( tryCount + 1 );
90648                    }, 500 );
90649
90650                } else {
90651
90652                    image
90653                        .removeAttr( 'data-lazy' )
90654                        .removeClass( 'slick-loading' )
90655                        .addClass( 'slick-lazyload-error' );
90656
90657                    _.$slider.trigger('lazyLoadError', [ _, image, imageSource ]);
90658
90659                    _.progressiveLazyLoad();
90660
90661                }
90662
90663            };
90664
90665            imageToLoad.src = imageSource;
90666
90667        } else {
90668
90669            _.$slider.trigger('allImagesLoaded', [ _ ]);
90670
90671        }
90672
90673    };
90674
90675    Slick.prototype.refresh = function( initializing ) {
90676
90677        var _ = this, currentSlide, lastVisibleIndex;
90678
90679        lastVisibleIndex = _.slideCount - _.options.slidesToShow;
90680
90681        // in non-infinite sliders, we don't want to go past the
90682        // last visible index.
90683        if( !_.options.infinite && ( _.currentSlide > lastVisibleIndex )) {
90684            _.currentSlide = lastVisibleIndex;
90685        }
90686
90687        // if less slides than to show, go to start.
90688        if ( _.slideCount <= _.options.slidesToShow ) {
90689            _.currentSlide = 0;
90690
90691        }
90692
90693        currentSlide = _.currentSlide;
90694
90695        _.destroy(true);
90696
90697        $.extend(_, _.initials, { currentSlide: currentSlide });
90698
90699        _.init();
90700
90701        if( !initializing ) {
90702
90703            _.changeSlide({
90704                data: {
90705                    message: 'index',
90706                    index: currentSlide
90707                }
90708            }, false);
90709
90710        }
90711
90712    };
90713
90714    Slick.prototype.registerBreakpoints = function() {
90715
90716        var _ = this, breakpoint, currentBreakpoint, l,
90717            responsiveSettings = _.options.responsive || null;
90718
90719        if ( $.type(responsiveSettings) === 'array' && responsiveSettings.length ) {
90720
90721            _.respondTo = _.options.respondTo || 'window';
90722
90723            for ( breakpoint in responsiveSettings ) {
90724
90725                l = _.breakpoints.length-1;
90726
90727                if (responsiveSettings.hasOwnProperty(breakpoint)) {
90728                    currentBreakpoint = responsiveSettings[breakpoint].breakpoint;
90729
90730                    // loop through the breakpoints and cut out any existing
90731                    // ones with the same breakpoint number, we don't want dupes.
90732                    while( l >= 0 ) {
90733                        if( _.breakpoints[l] && _.breakpoints[l] === currentBreakpoint ) {
90734                            _.breakpoints.splice(l,1);
90735                        }
90736                        l--;
90737                    }
90738
90739                    _.breakpoints.push(currentBreakpoint);
90740                    _.breakpointSettings[currentBreakpoint] = responsiveSettings[breakpoint].settings;
90741
90742                }
90743
90744            }
90745
90746            _.breakpoints.sort(function(a, b) {
90747                return ( _.options.mobileFirst ) ? a-b : b-a;
90748            });
90749
90750        }
90751
90752    };
90753
90754    Slick.prototype.reinit = function() {
90755
90756        var _ = this;
90757
90758        _.$slides =
90759            _.$slideTrack
90760                .children(_.options.slide)
90761                .addClass('slick-slide');
90762
90763        _.slideCount = _.$slides.length;
90764
90765        if (_.currentSlide >= _.slideCount && _.currentSlide !== 0) {
90766            _.currentSlide = _.currentSlide - _.options.slidesToScroll;
90767        }
90768
90769        if (_.slideCount <= _.options.slidesToShow) {
90770            _.currentSlide = 0;
90771        }
90772
90773        _.registerBreakpoints();
90774
90775        _.setProps();
90776        _.setupInfinite();
90777        _.buildArrows();
90778        _.updateArrows();
90779        _.initArrowEvents();
90780        _.buildDots();
90781        _.updateDots();
90782        _.initDotEvents();
90783        _.cleanUpSlideEvents();
90784        _.initSlideEvents();
90785
90786        _.checkResponsive(false, true);
90787
90788        if (_.options.focusOnSelect === true) {
90789            $(_.$slideTrack).children().on('click.slick', _.selectHandler);
90790        }
90791
90792        _.setSlideClasses(typeof _.currentSlide === 'number' ? _.currentSlide : 0);
90793
90794        _.setPosition();
90795        _.focusHandler();
90796
90797        _.paused = !_.options.autoplay;
90798        _.autoPlay();
90799
90800        _.$slider.trigger('reInit', [_]);
90801
90802    };
90803
90804    Slick.prototype.resize = function() {
90805
90806        var _ = this;
90807
90808        if ($(window).width() !== _.windowWidth) {
90809            clearTimeout(_.windowDelay);
90810            _.windowDelay = window.setTimeout(function() {
90811                _.windowWidth = $(window).width();
90812                _.checkResponsive();
90813                if( !_.unslicked ) { _.setPosition(); }
90814            }, 50);
90815        }
90816    };
90817
90818    Slick.prototype.removeSlide = Slick.prototype.slickRemove = function(index, removeBefore, removeAll) {
90819
90820        var _ = this;
90821
90822        if (typeof(index) === 'boolean') {
90823            removeBefore = index;
90824            index = removeBefore === true ? 0 : _.slideCount - 1;
90825        } else {
90826            index = removeBefore === true ? --index : index;
90827        }
90828
90829        if (_.slideCount < 1 || index < 0 || index > _.slideCount - 1) {
90830            return false;
90831        }
90832
90833        _.unload();
90834
90835        if (removeAll === true) {
90836            _.$slideTrack.children().remove();
90837        } else {
90838            _.$slideTrack.children(this.options.slide).eq(index).remove();
90839        }
90840
90841        _.$slides = _.$slideTrack.children(this.options.slide);
90842
90843        _.$slideTrack.children(this.options.slide).detach();
90844
90845        _.$slideTrack.append(_.$slides);
90846
90847        _.$slidesCache = _.$slides;
90848
90849        _.reinit();
90850
90851    };
90852
90853    Slick.prototype.setCSS = function(position) {
90854
90855        var _ = this,
90856            positionProps = {},
90857            x, y;
90858
90859        if (_.options.rtl === true) {
90860            position = -position;
90861        }
90862        x = _.positionProp == 'left' ? Math.ceil(position) + 'px' : '0px';
90863        y = _.positionProp == 'top' ? Math.ceil(position) + 'px' : '0px';
90864
90865        positionProps[_.positionProp] = position;
90866
90867        if (_.transformsEnabled === false) {
90868            _.$slideTrack.css(positionProps);
90869        } else {
90870            positionProps = {};
90871            if (_.cssTransitions === false) {
90872                positionProps[_.animType] = 'translate(' + x + ', ' + y + ')';
90873                _.$slideTrack.css(positionProps);
90874            } else {
90875                positionProps[_.animType] = 'translate3d(' + x + ', ' + y + ', 0px)';
90876                _.$slideTrack.css(positionProps);
90877            }
90878        }
90879
90880    };
90881
90882    Slick.prototype.setDimensions = function() {
90883
90884        var _ = this;
90885
90886        if (_.options.vertical === false) {
90887            if (_.options.centerMode === true) {
90888                _.$list.css({
90889                    padding: ('0px ' + _.options.centerPadding)
90890                });
90891            }
90892        } else {
90893            _.$list.height(_.$slides.first().outerHeight(true) * _.options.slidesToShow);
90894            if (_.options.centerMode === true) {
90895                _.$list.css({
90896                    padding: (_.options.centerPadding + ' 0px')
90897                });
90898            }
90899        }
90900
90901        _.listWidth = _.$list.width();
90902        _.listHeight = _.$list.height();
90903
90904
90905        if (_.options.vertical === false && _.options.variableWidth === false) {
90906            _.slideWidth = Math.ceil(_.listWidth / _.options.slidesToShow);
90907            _.$slideTrack.width(Math.ceil((_.slideWidth * _.$slideTrack.children('.slick-slide').length)));
90908
90909        } else if (_.options.variableWidth === true) {
90910            _.$slideTrack.width(5000 * _.slideCount);
90911        } else {
90912            _.slideWidth = Math.ceil(_.listWidth);
90913            _.$slideTrack.height(Math.ceil((_.$slides.first().outerHeight(true) * _.$slideTrack.children('.slick-slide').length)));
90914        }
90915
90916        var offset = _.$slides.first().outerWidth(true) - _.$slides.first().width();
90917        if (_.options.variableWidth === false) _.$slideTrack.children('.slick-slide').width(_.slideWidth - offset);
90918
90919    };
90920
90921    Slick.prototype.setFade = function() {
90922
90923        var _ = this,
90924            targetLeft;
90925
90926        _.$slides.each(function(index, element) {
90927            targetLeft = (_.slideWidth * index) * -1;
90928            if (_.options.rtl === true) {
90929                $(element).css({
90930                    position: 'relative',
90931                    right: targetLeft,
90932                    top: 0,
90933                    zIndex: _.options.zIndex - 2,
90934                    opacity: 0
90935                });
90936            } else {
90937                $(element).css({
90938                    position: 'relative',
90939                    left: targetLeft,
90940                    top: 0,
90941                    zIndex: _.options.zIndex - 2,
90942                    opacity: 0
90943                });
90944            }
90945        });
90946
90947        _.$slides.eq(_.currentSlide).css({
90948            zIndex: _.options.zIndex - 1,
90949            opacity: 1
90950        });
90951
90952    };
90953
90954    Slick.prototype.setHeight = function() {
90955
90956        var _ = this;
90957
90958        if (_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) {
90959            var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true);
90960            _.$list.css('height', targetHeight);
90961        }
90962
90963    };
90964
90965    Slick.prototype.setOption =
90966    Slick.prototype.slickSetOption = function() {
90967
90968        /**
90969         * accepts arguments in format of:
90970         *
90971         *  - for changing a single option's value:
90972         *     .slick("setOption", option, value, refresh )
90973         *
90974         *  - for changing a set of responsive options:
90975         *     .slick("setOption", 'responsive', [{}, ...], refresh )
90976         *
90977         *  - for updating multiple values at once (not responsive)
90978         *     .slick("setOption", { 'option': value, ... }, refresh )
90979         */
90980
90981        var _ = this, l, item, option, value, refresh = false, type;
90982
90983        if( $.type( arguments[0] ) === 'object' ) {
90984
90985            option =  arguments[0];
90986            refresh = arguments[1];
90987            type = 'multiple';
90988
90989        } else if ( $.type( arguments[0] ) === 'string' ) {
90990
90991            option =  arguments[0];
90992            value = arguments[1];
90993            refresh = arguments[2];
90994
90995            if ( arguments[0] === 'responsive' && $.type( arguments[1] ) === 'array' ) {
90996
90997                type = 'responsive';
90998
90999            } else if ( typeof arguments[1] !== 'undefined' ) {
91000
91001                type = 'single';
91002
91003            }
91004
91005        }
91006
91007        if ( type === 'single' ) {
91008
91009            _.options[option] = value;
91010
91011
91012        } else if ( type === 'multiple' ) {
91013
91014            $.each( option , function( opt, val ) {
91015
91016                _.options[opt] = val;
91017
91018            });
91019
91020
91021        } else if ( type === 'responsive' ) {
91022
91023            for ( item in value ) {
91024
91025                if( $.type( _.options.responsive ) !== 'array' ) {
91026
91027                    _.options.responsive = [ value[item] ];
91028
91029                } else {
91030
91031                    l = _.options.responsive.length-1;
91032
91033                    // loop through the responsive object and splice out duplicates.
91034                    while( l >= 0 ) {
91035
91036                        if( _.options.responsive[l].breakpoint === value[item].breakpoint ) {
91037
91038                            _.options.responsive.splice(l,1);
91039
91040                        }
91041
91042                        l--;
91043
91044                    }
91045
91046                    _.options.responsive.push( value[item] );
91047
91048                }
91049
91050            }
91051
91052        }
91053
91054        if ( refresh ) {
91055
91056            _.unload();
91057            _.reinit();
91058
91059        }
91060
91061    };
91062
91063    Slick.prototype.setPosition = function() {
91064
91065        var _ = this;
91066
91067        _.setDimensions();
91068
91069        _.setHeight();
91070
91071        if (_.options.fade === false) {
91072            _.setCSS(_.getLeft(_.currentSlide));
91073        } else {
91074            _.setFade();
91075        }
91076
91077        _.$slider.trigger('setPosition', [_]);
91078
91079    };
91080
91081    Slick.prototype.setProps = function() {
91082
91083        var _ = this,
91084            bodyStyle = document.body.style;
91085
91086        _.positionProp = _.options.vertical === true ? 'top' : 'left';
91087
91088        if (_.positionProp === 'top') {
91089            _.$slider.addClass('slick-vertical');
91090        } else {
91091            _.$slider.removeClass('slick-vertical');
91092        }
91093
91094        if (bodyStyle.WebkitTransition !== undefined ||
91095            bodyStyle.MozTransition !== undefined ||
91096            bodyStyle.msTransition !== undefined) {
91097            if (_.options.useCSS === true) {
91098                _.cssTransitions = true;
91099            }
91100        }
91101
91102        if ( _.options.fade ) {
91103            if ( typeof _.options.zIndex === 'number' ) {
91104                if( _.options.zIndex < 3 ) {
91105                    _.options.zIndex = 3;
91106                }
91107            } else {
91108                _.options.zIndex = _.defaults.zIndex;
91109            }
91110        }
91111
91112        if (bodyStyle.OTransform !== undefined) {
91113            _.animType = 'OTransform';
91114            _.transformType = '-o-transform';
91115            _.transitionType = 'OTransition';
91116            if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false;
91117        }
91118        if (bodyStyle.MozTransform !== undefined) {
91119            _.animType = 'MozTransform';
91120            _.transformType = '-moz-transform';
91121            _.transitionType = 'MozTransition';
91122            if (bodyStyle.perspectiveProperty === undefined && bodyStyle.MozPerspective === undefined) _.animType = false;
91123        }
91124        if (bodyStyle.webkitTransform !== undefined) {
91125            _.animType = 'webkitTransform';
91126            _.transformType = '-webkit-transform';
91127            _.transitionType = 'webkitTransition';
91128            if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false;
91129        }
91130        if (bodyStyle.msTransform !== undefined) {
91131            _.animType = 'msTransform';
91132            _.transformType = '-ms-transform';
91133            _.transitionType = 'msTransition';
91134            if (bodyStyle.msTransform === undefined) _.animType = false;
91135        }
91136        if (bodyStyle.transform !== undefined && _.animType !== false) {
91137            _.animType = 'transform';
91138            _.transformType = 'transform';
91139            _.transitionType = 'transition';
91140        }
91141        _.transformsEnabled = _.options.useTransform && (_.animType !== null && _.animType !== false);
91142    };
91143
91144
91145    Slick.prototype.setSlideClasses = function(index) {
91146
91147        var _ = this,
91148            centerOffset, allSlides, indexOffset, remainder;
91149
91150        allSlides = _.$slider
91151            .find('.slick-slide')
91152            .removeClass('slick-active slick-center slick-current')
91153            .attr('aria-hidden', 'true');
91154
91155        _.$slides
91156            .eq(index)
91157            .addClass('slick-current');
91158
91159        if (_.options.centerMode === true) {
91160
91161            var evenCoef = _.options.slidesToShow % 2 === 0 ? 1 : 0;
91162
91163            centerOffset = Math.floor(_.options.slidesToShow / 2);
91164
91165            if (_.options.infinite === true) {
91166
91167                if (index >= centerOffset && index <= (_.slideCount - 1) - centerOffset) {
91168                    _.$slides
91169                        .slice(index - centerOffset + evenCoef, index + centerOffset + 1)
91170                        .addClass('slick-active')
91171                        .attr('aria-hidden', 'false');
91172
91173                } else {
91174
91175                    indexOffset = _.options.slidesToShow + index;
91176                    allSlides
91177                        .slice(indexOffset - centerOffset + 1 + evenCoef, indexOffset + centerOffset + 2)
91178                        .addClass('slick-active')
91179                        .attr('aria-hidden', 'false');
91180
91181                }
91182
91183                if (index === 0) {
91184
91185                    allSlides
91186                        .eq(allSlides.length - 1 - _.options.slidesToShow)
91187                        .addClass('slick-center');
91188
91189                } else if (index === _.slideCount - 1) {
91190
91191                    allSlides
91192                        .eq(_.options.slidesToShow)
91193                        .addClass('slick-center');
91194
91195                }
91196
91197            }
91198
91199            _.$slides
91200                .eq(index)
91201                .addClass('slick-center');
91202
91203        } else {
91204
91205            if (index >= 0 && index <= (_.slideCount - _.options.slidesToShow)) {
91206
91207                _.$slides
91208                    .slice(index, index + _.options.slidesToShow)
91209                    .addClass('slick-active')
91210                    .attr('aria-hidden', 'false');
91211
91212            } else if (allSlides.length <= _.options.slidesToShow) {
91213
91214                allSlides
91215                    .addClass('slick-active')
91216                    .attr('aria-hidden', 'false');
91217
91218            } else {
91219
91220                remainder = _.slideCount % _.options.slidesToShow;
91221                indexOffset = _.options.infinite === true ? _.options.slidesToShow + index : index;
91222
91223                if (_.options.slidesToShow == _.options.slidesToScroll && (_.slideCount - index) < _.options.slidesToShow) {
91224
91225                    allSlides
91226                        .slice(indexOffset - (_.options.slidesToShow - remainder), indexOffset + remainder)
91227                        .addClass('slick-active')
91228                        .attr('aria-hidden', 'false');
91229
91230                } else {
91231
91232                    allSlides
91233                        .slice(indexOffset, indexOffset + _.options.slidesToShow)
91234                        .addClass('slick-active')
91235                        .attr('aria-hidden', 'false');
91236
91237                }
91238
91239            }
91240
91241        }
91242
91243        if (_.options.lazyLoad === 'ondemand' || _.options.lazyLoad === 'anticipated') {
91244            _.lazyLoad();
91245        }
91246    };
91247
91248    Slick.prototype.setupInfinite = function() {
91249
91250        var _ = this,
91251            i, slideIndex, infiniteCount;
91252
91253        if (_.options.fade === true) {
91254            _.options.centerMode = false;
91255        }
91256
91257        if (_.options.infinite === true && _.options.fade === false) {
91258
91259            slideIndex = null;
91260
91261            if (_.slideCount > _.options.slidesToShow) {
91262
91263                if (_.options.centerMode === true) {
91264                    infiniteCount = _.options.slidesToShow + 1;
91265                } else {
91266                    infiniteCount = _.options.slidesToShow;
91267                }
91268
91269                for (i = _.slideCount; i > (_.slideCount -
91270                        infiniteCount); i -= 1) {
91271                    slideIndex = i - 1;
91272                    $(_.$slides[slideIndex]).clone(true).attr('id', '')
91273                        .attr('data-slick-index', slideIndex - _.slideCount)
91274                        .prependTo(_.$slideTrack).addClass('slick-cloned');
91275                }
91276                for (i = 0; i < infiniteCount  + _.slideCount; i += 1) {
91277                    slideIndex = i;
91278                    $(_.$slides[slideIndex]).clone(true).attr('id', '')
91279                        .attr('data-slick-index', slideIndex + _.slideCount)
91280                        .appendTo(_.$slideTrack).addClass('slick-cloned');
91281                }
91282                _.$slideTrack.find('.slick-cloned').find('[id]').each(function() {
91283                    $(this).attr('id', '');
91284                });
91285
91286            }
91287
91288        }
91289
91290    };
91291
91292    Slick.prototype.interrupt = function( toggle ) {
91293
91294        var _ = this;
91295
91296        if( !toggle ) {
91297            _.autoPlay();
91298        }
91299        _.interrupted = toggle;
91300
91301    };
91302
91303    Slick.prototype.selectHandler = function(event) {
91304
91305        var _ = this;
91306
91307        var targetElement =
91308            $(event.target).is('.slick-slide') ?
91309                $(event.target) :
91310                $(event.target).parents('.slick-slide');
91311
91312        var index = parseInt(targetElement.attr('data-slick-index'));
91313
91314        if (!index) index = 0;
91315
91316        if (_.slideCount <= _.options.slidesToShow) {
91317
91318            _.slideHandler(index, false, true);
91319            return;
91320
91321        }
91322
91323        _.slideHandler(index);
91324
91325    };
91326
91327    Slick.prototype.slideHandler = function(index, sync, dontAnimate) {
91328
91329        var targetSlide, animSlide, oldSlide, slideLeft, targetLeft = null,
91330            _ = this, navTarget;
91331
91332        sync = sync || false;
91333
91334        if (_.animating === true && _.options.waitForAnimate === true) {
91335            return;
91336        }
91337
91338        if (_.options.fade === true && _.currentSlide === index) {
91339            return;
91340        }
91341
91342        if (sync === false) {
91343            _.asNavFor(index);
91344        }
91345
91346        targetSlide = index;
91347        targetLeft = _.getLeft(targetSlide);
91348        slideLeft = _.getLeft(_.currentSlide);
91349
91350        _.currentLeft = _.swipeLeft === null ? slideLeft : _.swipeLeft;
91351
91352        if (_.options.infinite === false && _.options.centerMode === false && (index < 0 || index > _.getDotCount() * _.options.slidesToScroll)) {
91353            if (_.options.fade === false) {
91354                targetSlide = _.currentSlide;
91355                if (dontAnimate !== true && _.slideCount > _.options.slidesToShow) {
91356                    _.animateSlide(slideLeft, function() {
91357                        _.postSlide(targetSlide);
91358                    });
91359                } else {
91360                    _.postSlide(targetSlide);
91361                }
91362            }
91363            return;
91364        } else if (_.options.infinite === false && _.options.centerMode === true && (index < 0 || index > (_.slideCount - _.options.slidesToScroll))) {
91365            if (_.options.fade === false) {
91366                targetSlide = _.currentSlide;
91367                if (dontAnimate !== true && _.slideCount > _.options.slidesToShow) {
91368                    _.animateSlide(slideLeft, function() {
91369                        _.postSlide(targetSlide);
91370                    });
91371                } else {
91372                    _.postSlide(targetSlide);
91373                }
91374            }
91375            return;
91376        }
91377
91378        if ( _.options.autoplay ) {
91379            clearInterval(_.autoPlayTimer);
91380        }
91381
91382        if (targetSlide < 0) {
91383            if (_.slideCount % _.options.slidesToScroll !== 0) {
91384                animSlide = _.slideCount - (_.slideCount % _.options.slidesToScroll);
91385            } else {
91386                animSlide = _.slideCount + targetSlide;
91387            }
91388        } else if (targetSlide >= _.slideCount) {
91389            if (_.slideCount % _.options.slidesToScroll !== 0) {
91390                animSlide = 0;
91391            } else {
91392                animSlide = targetSlide - _.slideCount;
91393            }
91394        } else {
91395            animSlide = targetSlide;
91396        }
91397
91398        _.animating = true;
91399
91400        _.$slider.trigger('beforeChange', [_, _.currentSlide, animSlide]);
91401
91402        oldSlide = _.currentSlide;
91403        _.currentSlide = animSlide;
91404
91405        _.setSlideClasses(_.currentSlide);
91406
91407        if ( _.options.asNavFor ) {
91408
91409            navTarget = _.getNavTarget();
91410            navTarget = navTarget.slick('getSlick');
91411
91412            if ( navTarget.slideCount <= navTarget.options.slidesToShow ) {
91413                navTarget.setSlideClasses(_.currentSlide);
91414            }
91415
91416        }
91417
91418        _.updateDots();
91419        _.updateArrows();
91420
91421        if (_.options.fade === true) {
91422            if (dontAnimate !== true) {
91423
91424                _.fadeSlideOut(oldSlide);
91425
91426                _.fadeSlide(animSlide, function() {
91427                    _.postSlide(animSlide);
91428                });
91429
91430            } else {
91431                _.postSlide(animSlide);
91432            }
91433            _.animateHeight();
91434            return;
91435        }
91436
91437        if (dontAnimate !== true && _.slideCount > _.options.slidesToShow) {
91438            _.animateSlide(targetLeft, function() {
91439                _.postSlide(animSlide);
91440            });
91441        } else {
91442            _.postSlide(animSlide);
91443        }
91444
91445    };
91446
91447    Slick.prototype.startLoad = function() {
91448
91449        var _ = this;
91450
91451        if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {
91452
91453            _.$prevArrow.hide();
91454            _.$nextArrow.hide();
91455
91456        }
91457
91458        if (_.options.dots === true && _.slideCount > _.options.slidesToShow) {
91459
91460            _.$dots.hide();
91461
91462        }
91463
91464        _.$slider.addClass('slick-loading');
91465
91466    };
91467
91468    Slick.prototype.swipeDirection = function() {
91469
91470        var xDist, yDist, r, swipeAngle, _ = this;
91471
91472        xDist = _.touchObject.startX - _.touchObject.curX;
91473        yDist = _.touchObject.startY - _.touchObject.curY;
91474        r = Math.atan2(yDist, xDist);
91475
91476        swipeAngle = Math.round(r * 180 / Math.PI);
91477        if (swipeAngle < 0) {
91478            swipeAngle = 360 - Math.abs(swipeAngle);
91479        }
91480
91481        if ((swipeAngle <= 45) && (swipeAngle >= 0)) {
91482            return (_.options.rtl === false ? 'left' : 'right');
91483        }
91484        if ((swipeAngle <= 360) && (swipeAngle >= 315)) {
91485            return (_.options.rtl === false ? 'left' : 'right');
91486        }
91487        if ((swipeAngle >= 135) && (swipeAngle <= 225)) {
91488            return (_.options.rtl === false ? 'right' : 'left');
91489        }
91490        if (_.options.verticalSwiping === true) {
91491            if ((swipeAngle >= 35) && (swipeAngle <= 135)) {
91492                return 'down';
91493            } else {
91494                return 'up';
91495            }
91496        }
91497
91498        return 'vertical';
91499
91500    };
91501
91502    Slick.prototype.swipeEnd = function(event) {
91503
91504        var _ = this,
91505            slideCount,
91506            direction;
91507
91508        _.dragging = false;
91509        _.swiping = false;
91510
91511        if (_.scrolling) {
91512            _.scrolling = false;
91513            return false;
91514        }
91515
91516        _.interrupted = false;
91517        _.shouldClick = ( _.touchObject.swipeLength > 10 ) ? false : true;
91518
91519        if ( _.touchObject.curX === undefined ) {
91520            return false;
91521        }
91522
91523        if ( _.touchObject.edgeHit === true ) {
91524            _.$slider.trigger('edge', [_, _.swipeDirection() ]);
91525        }
91526
91527        if ( _.touchObject.swipeLength >= _.touchObject.minSwipe ) {
91528
91529            direction = _.swipeDirection();
91530
91531            switch ( direction ) {
91532
91533                case 'left':
91534                case 'down':
91535
91536                    slideCount =
91537                        _.options.swipeToSlide ?
91538                            _.checkNavigable( _.currentSlide + _.getSlideCount() ) :
91539                            _.currentSlide + _.getSlideCount();
91540
91541                    _.currentDirection = 0;
91542
91543                    break;
91544
91545                case 'right':
91546                case 'up':
91547
91548                    slideCount =
91549                        _.options.swipeToSlide ?
91550                            _.checkNavigable( _.currentSlide - _.getSlideCount() ) :
91551                            _.currentSlide - _.getSlideCount();
91552
91553                    _.currentDirection = 1;
91554
91555                    break;
91556
vendor: 3,992 bytes, lines 91557-91688
91557                default:
91558
91559
91560            }
91561
91562            if( direction != 'vertical' ) {
91563
91564                _.slideHandler( slideCount );
91565                _.touchObject = {};
91566                _.$slider.trigger('swipe', [_, direction ]);
91567
91568            }
91569
91570        } else {
91571
91572            if ( _.touchObject.startX !== _.touchObject.curX ) {
91573
91574                _.slideHandler( _.currentSlide );
91575                _.touchObject = {};
91576
91577            }
91578
91579        }
91580
91581    };
91582
91583    Slick.prototype.swipeHandler = function(event) {
91584
91585        var _ = this;
91586
91587        if ((_.options.swipe === false) || ('ontouchend' in document && _.options.swipe === false)) {
91588            return;
91589        } else if (_.options.draggable === false && event.type.indexOf('mouse') !== -1) {
91590            return;
91591        }
91592
91593        _.touchObject.fingerCount = event.originalEvent && event.originalEvent.touches !== undefined ?
91594            event.originalEvent.touches.length : 1;
91595
91596        _.touchObject.minSwipe = _.listWidth / _.options
91597            .touchThreshold;
91598
91599        if (_.options.verticalSwiping === true) {
91600            _.touchObject.minSwipe = _.listHeight / _.options
91601                .touchThreshold;
91602        }
91603
91604        switch (event.data.action) {
91605
91606            case 'start':
91607                _.swipeStart(event);
91608                break;
91609
91610            case 'move':
91611                _.swipeMove(event);
91612                break;
91613
91614            case 'end':
91615                _.swipeEnd(event);
91616                break;
91617
91618        }
91619
91620    };
91621
91622    Slick.prototype.swipeMove = function(event) {
91623
91624        var _ = this,
91625            edgeWasHit = false,
91626            curLeft, swipeDirection, swipeLength, positionOffset, touches, verticalSwipeLength;
91627
91628        touches = event.originalEvent !== undefined ? event.originalEvent.touches : null;
91629
91630        if (!_.dragging || _.scrolling || touches && touches.length !== 1) {
91631            return false;
91632        }
91633
91634        curLeft = _.getLeft(_.currentSlide);
91635
91636        _.touchObject.curX = touches !== undefined ? touches[0].pageX : event.clientX;
91637        _.touchObject.curY = touches !== undefined ? touches[0].pageY : event.clientY;
91638
91639        _.touchObject.swipeLength = Math.round(Math.sqrt(
91640            Math.pow(_.touchObject.curX - _.touchObject.startX, 2)));
91641
91642        verticalSwipeLength = Math.round(Math.sqrt(
91643            Math.pow(_.touchObject.curY - _.touchObject.startY, 2)));
91644
91645        if (!_.options.verticalSwiping && !_.swiping && verticalSwipeLength > 4) {
91646            _.scrolling = true;
91647            return false;
91648        }
91649
91650        if (_.options.verticalSwiping === true) {
91651            _.touchObject.swipeLength = verticalSwipeLength;
91652        }
91653
91654        swipeDirection = _.swipeDirection();
91655
91656        if (event.originalEvent !== undefined && _.touchObject.swipeLength > 4) {
91657            _.swiping = true;
91658            event.preventDefault();
91659        }
91660
91661        positionOffset = (_.options.rtl === false ? 1 : -1) * (_.touchObject.curX > _.touchObject.startX ? 1 : -1);
91662        if (_.options.verticalSwiping === true) {
91663            positionOffset = _.touchObject.curY > _.touchObject.startY ? 1 : -1;
91664        }
91665
91666
91667        swipeLength = _.touchObject.swipeLength;
91668
91669        _.touchObject.edgeHit = false;
91670
91671        if (_.options.infinite === false) {
91672            if ((_.currentSlide === 0 && swipeDirection === 'right') || (_.currentSlide >= _.getDotCount() && swipeDirection === 'left')) {
91673                swipeLength = _.touchObject.swipeLength * _.options.edgeFriction;
91674                _.touchObject.edgeHit = true;
91675            }
91676        }
91677
91678        if (_.options.vertical === false) {
91679            _.swipeLeft = curLeft + swipeLength * positionOffset;
91680        } else {
91681            _.swipeLeft = curLeft + (swipeLength * (_.$list.height() / _.listWidth)) * positionOffset;
91682        }
91683        if (_.options.verticalSwiping === true) {
91684            _.swipeLeft = curLeft + swipeLength * positionOffset;
91685        }
91686
91687        if (_.options.fade === true || _.options.touchMove === false) {
91688            return false;
91689        }
91690
91691        if (_.animating === true) {
91692            _.swipeLeft = null;
91693            return false;
91694        }
91695
91696        _.setCSS(_.swipeLeft);
91697
91698    };
91699
91700    Slick.prototype.swipeStart = function(event) {
91701
91702        var _ = this,
91703            touches;
91704
91705        _.interrupted = true;
91706
91707        if (_.touchObject.fingerCount !== 1 || _.slideCount <= _.options.slidesToShow) {
91708            _.touchObject = {};
91709            return false;
91710        }
91711
91712        if (event.originalEvent !== undefined && event.originalEvent.touches !== undefined) {
91713            touches = event.originalEvent.touches[0];
91714        }
91715
91716        _.touchObject.startX = _.touchObject.curX = touches !== undefined ? touches.pageX : event.clientX;
91717        _.touchObject.startY = _.touchObject.curY = touches !== undefined ? touches.pageY : event.clientY;
91718
91719        _.dragging = true;
91720
91721    };
91722
91723    Slick.prototype.unfilterSlides = Slick.prototype.slickUnfilter = function() {
91724
91725        var _ = this;
91726
91727        if (_.$slidesCache !== null) {
91728
91729            _.unload();
91730
91731            _.$slideTrack.children(this.options.slide).detach();
91732
91733            _.$slidesCache.appendTo(_.$slideTrack);
91734
91735            _.reinit();
91736
91737        }
91738
91739    };
91740
91741    Slick.prototype.unload = function() {
91742
91743        var _ = this;
91744
91745        $('.slick-cloned', _.$slider).remove();
91746
91747        if (_.$dots) {
91748            _.$dots.remove();
91749        }
91750
91751        if (_.$prevArrow && _.htmlExpr.test(_.options.prevArrow)) {
91752            _.$prevArrow.remove();
91753        }
91754
91755        if (_.$nextArrow && _.htmlExpr.test(_.options.nextArrow)) {
91756            _.$nextArrow.remove();
91757        }
91758
91759        _.$slides
91760            .removeClass('slick-slide slick-active slick-visible slick-current')
91761            .attr('aria-hidden', 'true')
91762            .css('width', '');
91763
91764    };
91765
91766    Slick.prototype.unslick = function(fromBreakpoint) {
91767
91768        var _ = this;
91769        _.$slider.trigger('unslick', [_, fromBreakpoint]);
91770        _.destroy();
91771
91772    };
91773
91774    Slick.prototype.updateArrows = function() {
91775
91776        var _ = this,
91777            centerOffset;
91778
91779        centerOffset = Math.floor(_.options.slidesToShow / 2);
91780
91781        if ( _.options.arrows === true &&
91782            _.slideCount > _.options.slidesToShow &&
91783            !_.options.infinite ) {
91784
91785            _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false');
91786            _.$nextArrow.removeClass('slick-disabled').attr('aria-disabled', 'false');
91787
91788            if (_.currentSlide === 0) {
91789
91790                _.$prevArrow.addClass('slick-disabled').attr('aria-disabled', 'true');
91791                _.$nextArrow.removeClass('slick-disabled').attr('aria-disabled', 'false');
91792
91793            } else if (_.currentSlide >= _.slideCount - _.options.slidesToShow && _.options.centerMode === false) {
91794
91795                _.$nextArrow.addClass('slick-disabled').attr('aria-disabled', 'true');
91796                _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false');
91797
91798            } else if (_.currentSlide >= _.slideCount - 1 && _.options.centerMode === true) {
91799
91800                _.$nextArrow.addClass('slick-disabled').attr('aria-disabled', 'true');
91801                _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false');
91802
91803            }
91804
91805        }
91806
91807    };
91808
91809    Slick.prototype.updateDots = function() {
91810
91811        var _ = this;
91812
91813        if (_.$dots !== null) {
91814
91815            _.$dots
91816                .find('li')
91817                    .removeClass('slick-active')
91818                    .end();
91819
91820            _.$dots
91821                .find('li')
91822                .eq(Math.floor(_.currentSlide / _.options.slidesToScroll))
91823                .addClass('slick-active');
91824
91825        }
91826
91827    };
91828
91829    Slick.prototype.visibility = function() {
91830
91831        var _ = this;
91832
91833        if ( _.options.autoplay ) {
91834
91835            if ( document[_.hidden] ) {
91836
91837                _.interrupted = true;
91838
91839            } else {
91840
91841                _.interrupted = false;
91842
91843            }
91844
91845        }
91846
91847    };
91848
91849    $.fn.slick = function() {
91850        var _ = this,
91851            opt = arguments[0],
91852            args = Array.prototype.slice.call(arguments, 1),
91853            l = _.length,
91854            i,
91855            ret;
91856        for (i = 0; i < l; i++) {
91857            if (typeof opt == 'object' || typeof opt == 'undefined')
91858                _[i].slick = new Slick(_[i], opt);
91859            else
91860                ret = _[i].slick[opt].apply(_[i].slick, args);
91861            if (typeof ret != 'undefined') return ret;
91862        }
91863        return _;
91864    };
91865
91866}));
91867
91868
91869/***/ },
91870
91871/***/ "./ts/class/_anchor_disabled.ts"
91872/*!**************************************!*\
91873  !*** ./ts/class/_anchor_disabled.ts ***!
91874  \**************************************/
91875(__unused_webpack_module, exports, __webpack_require__) {
91876
91877"use strict";
91878
91879Object.defineProperty(exports, "__esModule", ({ value: true }));
91880exports.AnchorDisabled = void 0;
91881var $ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
91882var AnchorDisabled = /** @class */ (function () {
91883    function AnchorDisabled() {
91884        this.key = '.bulletAnchorDisabled';
91885        if ($(this.key).length > 0) {
91886            for (var i = 0; i < $(this.key).length; i++) {
91887                var anchor = $(this.key).eq(i);
91888                anchor.addClass('anchor-disabled');
91889            }
91890        }
91891        $(this.key).click(function (e) {
91892            e.preventDefault();
91893        });
91894    }
91895    return AnchorDisabled;
91896}());
91897exports.AnchorDisabled = AnchorDisabled;
91898exports["default"] = AnchorDisabled;
91899
91900
91901/***/ },
91902
91903/***/ "./ts/class/_club.ts"
91904/*!***************************!*\
91905  !*** ./ts/class/_club.ts ***!
91906  \***************************/
91907(__unused_webpack_module, exports, __webpack_require__) {
91908
91909"use strict";
91910
91911Object.defineProperty(exports, "__esModule", ({ value: true }));
91912exports.Club = void 0;
91913var $ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
91914var Club = /** @class */ (function () {
91915    function Club() {
91916        this.naviNumber = 1;
91917        this.naviBoxKey = '.trigClubNavi';
91918        this.specialBoxKey = '.bulletClubSpecialBox';
91919        this.specialBoxesKey = '.bulletClubSpecialBoxes';
91920        this.specialBoxWidth = 0;
91921        var self = this;
91922        if ($(this.specialBoxesKey).length > 0) {
91923            this.naviNumber = 1;
91924            this.specialBoxWidth = $(this.specialBoxKey).eq(0).width();
91925            // console.log(this.specialBoxWidth);
91926        }
91927        // navi 移動
91928        $(this.naviBoxKey).click(function () {
91929            var number = $(this).data('number');
91930            self.slide(number);
91931        });
91932        // prev, next
91933        $('.trigClubPrevNext').click(function (e) {
91934            e.preventDefault();
91935            var type = $(this).data('type');
91936            var number = self.naviNumber;
91937            if (type == 'prev') {
91938                number--;
91939                if (number < 1) {
91940                    number = 1;
91941                }
91942            }
91943            else if (type == 'next') {
91944                number++;
91945                if (number > $(self.specialBoxKey).length) {
91946                    number = $(self.specialBoxKey).length;
91947                }
91948            }
91949            self.slide(number);
91950        });
91951    }
91952    Club.prototype.slide = function (number) {
91953        $(this.naviBoxKey).removeClass('current');
91954        $(this.naviBoxKey + '[data-number="' + number + '"]').addClass('current');
91955        var specialSlide = (this.specialBoxWidth) * (number - 1) * -1;
91956        // console.log(specialSlide);
91957        $(this.specialBoxesKey).css({ marginLeft: specialSlide });
91958        this.naviNumber = number;
91959    };
91960    return Club;
91961}());
91962exports.Club = Club;
91963exports["default"] = Club;
91964
91965
91966/***/ },
91967
91968/***/ "./ts/class/_go.ts"
91969/*!*************************!*\
91970  !*** ./ts/class/_go.ts ***!
91971  \*************************/
91972(__unused_webpack_module, exports, __webpack_require__) {
91973
91974"use strict";
91975
91976Object.defineProperty(exports, "__esModule", ({ value: true }));
91977exports.Go = void 0;
91978var $ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
91979var Go = /** @class */ (function () {
91980    function Go() {
91981        var _this = this;
91982        this.goKey = '#trigGo';
91983        this.toKey = '#bulletGo';
91984        $(this.goKey).click(function (e) {
91985            e.preventDefault();
91986            var position = $(_this.toKey).offset().top;
91987            $('body,html').stop().animate({ scrollTop: position }, 300, 'swing');
91988        });
91989    }
91990    return Go;
91991}());
91992exports.Go = Go;
91993exports["default"] = Go;
91994
91995
91996/***/ },
91997
91998/***/ "./ts/class/_hamburger.ts"
91999/*!********************************!*\
92000  !*** ./ts/class/_hamburger.ts ***!
92001  \********************************/
92002(__unused_webpack_module, exports, __webpack_require__) {
92003
92004"use strict";
92005
92006Object.defineProperty(exports, "__esModule", ({ value: true }));
92007exports.Hamburger = void 0;
92008var $ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
92009var Hamburger = /** @class */ (function () {
92010    function Hamburger() {
92011        $('.trigHamburger').click(function () {
92012            $('.bulletHamburger').toggleClass('open');
92013            $('.bulletMenu').toggleClass('open');
92014        });
92015    }
92016    return Hamburger;
92017}());
92018exports.Hamburger = Hamburger;
92019exports["default"] = Hamburger;
92020
92021
92022/***/ },
92023
92024/***/ "./ts/class/_modal.ts"
92025/*!****************************!*\
92026  !*** ./ts/class/_modal.ts ***!
92027  \****************************/
92028(__unused_webpack_module, exports, __webpack_require__) {
92029
92030"use strict";
92031
92032Object.defineProperty(exports, "__esModule", ({ value: true }));
92033exports.Modal = void 0;
92034var $ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
92035var Modal = /** @class */ (function () {
92036    function Modal() {
92037        $('.trigModalOn').on('click', function () {
92038            var path = $(this).data('path');
92039            $('#bulletModalImg').attr('src', path);
92040            $('#bulletModal').addClass('show');
92041        });
92042        $('.trigModalOnMovie').on('click', function () {
92043            var iframe = '#bulletModalIFrame';
92044            var currentMovie = $(iframe).attr('src');
92045            if (currentMovie == '') {
92046                var key = $(this).data('key');
92047                $(iframe).attr('src', 'https://www.youtube.com/embed/' + key);
92048            }
92049            $('#bulletModalMovie').addClass('show');
92050        });
92051        $('#trigChangeObjectFit').on('click', function (e) {
92052            var posX = Math.ceil(e.clientX / $(window).width() * 21);
92053            var posY = Math.ceil(e.clientY / $(window).height() * 21);
92054            console.log(posX, posY);
92055            var fit = $(this).attr('data-fit');
92056            var newFit = (fit == 'cover') ? 'contain' : 'cover';
92057            $(this).attr('data-fit', newFit);
92058            $(this).children('img').attr('data-x', posX).attr('data-y', posY);
92059        });
92060        $('.trigCloseModal').on('click', function (e) {
92061            $('#bulletModal').removeClass('show');
92062        });
92063        $('.trigCloseModalMovie').on('click', function (e) {
92064            $('#bulletModalMovie').removeClass('show');
92065        });
92066    }
92067    return Modal;
92068}());
92069exports.Modal = Modal;
92070exports["default"] = Modal;
92071
92072
92073/***/ },
92074
92075/***/ "./ts/class/_neon_box.ts"
92076/*!*******************************!*\
92077  !*** ./ts/class/_neon_box.ts ***!
92078  \*******************************/
92079(__unused_webpack_module, exports, __webpack_require__) {
92080
92081"use strict";
92082
92083Object.defineProperty(exports, "__esModule", ({ value: true }));
92084exports.NeonBox = void 0;
92085var $ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
92086var NeonBox = /** @class */ (function () {
92087    function NeonBox() {
92088        var key = '.paramNeonBox';
92089        if ($(key).length > 0) {
92090            var box = void 0;
92091            for (var i = 0; i < $(key).length; i++) {
92092                box = $(key).eq(i);
92093                box.append(this.neonBar());
92094            }
92095        }
92096    }
92097    NeonBox.prototype.neonBar = function () {
92098        var body = '';
92099        body += '<div class="neon-box__bars">';
92100        body += '<em class="neon-box__bar"></em>';
92101        body += '<em class="neon-box__bar"></em>';
92102        body += '<em class="neon-box__bar"></em>';
92103        body += '<em class="neon-box__bar"></em>';
92104        body += '<em class="neon-box__bar"></em>';
92105        body += '</div>';
92106        return body;
92107    };
92108    return NeonBox;
92109}());
92110exports.NeonBox = NeonBox;
92111exports["default"] = NeonBox;
92112
92113
92114/***/ },
92115
92116/***/ "./ts/class/_obog.ts"
92117/*!***************************!*\
92118  !*** ./ts/class/_obog.ts ***!
92119  \***************************/
92120(__unused_webpack_module, exports, __webpack_require__) {
92121
92122"use strict";
92123
92124Object.defineProperty(exports, "__esModule", ({ value: true }));
92125exports.Obog = void 0;
92126var $ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
92127var Obog = /** @class */ (function () {
92128    function Obog() {
92129        this.naviNumber = 1;
92130        this.naviBoxKey = '.trigObogNavi';
92131        this.naviBoxesKey = '.bulletObogNaviBoxes';
92132        this.specialBoxKey = '.bulletObogSpecialBox';
92133        this.specialBoxesKey = '.bulletObogSpecialBoxes';
92134        this.windowWidth = 0;
92135        this.naviBoxesWidth = 0;
92136        this.maxSlide = 0;
92137        this.naviBoxWidth = 0;
92138        this.specialBoxWidth = 0;
92139        var self = this;
92140        if ($(this.naviBoxesKey).length > 0) {
92141            this.naviNumber = Number($('#paramInitialNaviNumber').val());
92142            this.windowWidth = $(window).width();
92143            this.naviBoxesWidth = $(this.naviBoxesKey).width();
92144            this.maxSlide = this.windowWidth - this.naviBoxesWidth;
92145            this.naviBoxWidth = $(this.naviBoxKey).eq(0).width();
92146            this.specialBoxWidth = $(this.specialBoxKey).eq(0).width();
92147            if (this.windowWidth > 767) {
92148                // 初回の navi へ移動
92149                self.slide(this.naviNumber);
92150            }
92151            else {
92152                // スマホの処理
92153                self.scroll(this.naviNumber);
92154            }
92155        }
92156        // navi 移動
92157        $(this.naviBoxKey).click(function () {
92158            var number = $(this).data('number');
92159            self.slide(number);
92160        });
92161        // prev, next
92162        $('.trigObogPrevNext').click(function (e) {
92163            e.preventDefault();
92164            var type = $(this).data('type');
92165            var number = self.naviNumber;
92166            if (type == 'prev') {
92167                number--;
92168                if (number < 1) {
92169                    number = 1;
92170                }
92171            }
92172            else if (type == 'next') {
92173                number++;
92174                if (number > $(self.specialBoxKey).length) {
92175                    number = $(self.specialBoxKey).length;
92176                }
92177            }
92178            self.slide(number);
92179        });
92180    }
92181    Obog.prototype.slide = function (number) {
92182        var naviSlide = (this.naviBoxWidth + 5) * (number - 1) * -1;
92183        if (this.windowWidth > this.naviBoxWidth) {
92184            naviSlide += this.naviBoxWidth / 2;
92185        }
92186        else {
92187            naviSlide += this.windowWidth / 2;
92188        }
92189        if (naviSlide < this.maxSlide) {
92190            naviSlide = this.maxSlide;
92191        }
92192        else if (naviSlide > 0) {
92193            naviSlide = 0;
92194        }
92195        $(this.naviBoxesKey).css({ marginLeft: naviSlide });
92196        $(this.naviBoxKey).removeClass('current');
92197        $(this.naviBoxKey + '[data-number="' + number + '"]').addClass('current');
92198        var specialSlide = (this.specialBoxWidth) * (number - 1) * -1;
92199        $(this.specialBoxesKey).css({ marginLeft: specialSlide });
92200        this.naviNumber = number;
92201    };
92202    Obog.prototype.scroll = function (number) {
92203        // specialBoxKeyの位置を取得
92204        var positionY = $(".bulletObogSpecialBox[data-number=\"".concat(number, "\"]")).offset().top;
92205        var headerHeight = $('.header').outerHeight();
92206        // スクロールする
92207        window.scrollTo({
92208            top: positionY - headerHeight,
92209            behavior: 'smooth',
92210        });
92211    };
92212    return Obog;
92213}());
92214exports.Obog = Obog;
92215exports["default"] = Obog;
92216
92217
92218/***/ },
92219
92220/***/ "./ts/class/_orientation.ts"
92221/*!**********************************!*\
92222  !*** ./ts/class/_orientation.ts ***!
92223  \**********************************/
92224(__unused_webpack_module, exports, __webpack_require__) {
92225
92226"use strict";
92227
92228Object.defineProperty(exports, "__esModule", ({ value: true }));
92229exports.Orientation = void 0;
92230var $ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
92231var Orientation = /** @class */ (function () {
92232    function Orientation() {
92233        var _this = this;
92234        window.addEventListener("orientationchange", function () {
92235            _this.setResult();
92236        });
92237    }
92238    // 結果表示
92239    Orientation.prototype.setResult = function () {
92240        var angle = this.getAngle();
92241        if (angle.value === undefined) {
92242            console.log('端末の向きを取得することが出来ませんでした');
92243            return false;
92244        }
92245        if (angle.isPortrait) {
92246            // 縦向き
92247            console.log('縦向き');
92248            $('.bulletLandscape').attr('data-landscape', '0');
92249        }
92250        else {
92251            // 横向き
92252            console.log('横向き');
92253            $('.bulletLandscape').attr('data-landscape', '1');
92254        }
92255    };
92256    // 角度を取得
92257    Orientation.prototype.getAngle = function () {
92258        var angle = screen && screen.orientation && screen.orientation.angle;
92259        if (angle === undefined) {
92260            angle = window.orientation; // iOS用
92261        }
92262        var isPortrait = (angle === 0);
92263        return ({
92264            value: angle,
92265            isPortrait: isPortrait,
92266            isLandscape: !isPortrait, // 横向き
92267        });
92268    };
92269    return Orientation;
92270}());
92271exports.Orientation = Orientation;
92272exports["default"] = Orientation;
92273
92274
92275/***/ },
92276
92277/***/ "./ts/class/_pdf.ts"
92278/*!**************************!*\
92279  !*** ./ts/class/_pdf.ts ***!
92280  \**************************/
92281(__unused_webpack_module, exports, __webpack_require__) {
92282
92283"use strict";
92284
92285var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
92286    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
92287    return new (P || (P = Promise))(function (resolve, reject) {
92288        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
92289        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
92290        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
92291        step((generator = generator.apply(thisArg, _arguments || [])).next());
92292    });
92293};
92294var __generator = (this && this.__generator) || function (thisArg, body) {
92295    var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
92296    return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
92297    function verb(n) { return function (v) { return step([n, v]); }; }
92298    function step(op) {
92299        if (f) throw new TypeError("Generator is already executing.");
92300        while (g && (g = 0, op[0] && (_ = 0)), _) try {
92301            if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
92302            if (y = 0, t) op = [op[0] & 2, t.value];
92303            switch (op[0]) {
92304                case 0: case 1: t = op; break;
92305                case 4: _.label++; return { value: op[1], done: false };
92306                case 5: _.label++; y = op[1]; op = [0]; continue;
92307                case 7: op = _.ops.pop(); _.trys.pop(); continue;
92308                default:
92309                    if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
92310                    if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
92311                    if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
92312                    if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
92313                    if (t[2]) _.ops.pop();
92314                    _.trys.pop(); continue;
92315            }
92316            op = body.call(thisArg, _);
92317        } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
92318        if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
92319    }
92320};
92321Object.defineProperty(exports, "__esModule", ({ value: true }));
92322exports.PDF = void 0;
92323var pdfjsLib = __webpack_require__(/*! pdfjs-dist */ "./node_modules/pdfjs-dist/build/pdf.js");
92324var pdf_worker_js_1 = __webpack_require__(/*! pdfjs-dist/build/pdf.worker.js */ "./node_modules/pdfjs-dist/build/pdf.worker.js");
92325var PDF = /** @class */ (function () {
92326    function PDF() {
92327        pdfjsLib.GlobalWorkerOptions.workerSrc = pdf_worker_js_1.default;
92328        this.init().catch(console.error);
92329    }
92330    PDF.prototype.init = function () {
92331        return __awaiter(this, void 0, void 0, function () {
92332            var viewers;
92333            var _this = this;
92334            return __generator(this, function (_a) {
92335                switch (_a.label) {
92336                    case 0:
92337                        viewers = document.querySelectorAll(".pdf-viewer");
92338                        if (!viewers)
92339                            return [2 /*return*/];
92340                        return [4 /*yield*/, Promise.all(Array.from(viewers).map(function (viewer) { return __awaiter(_this, void 0, void 0, function () {
92341                                var pdfUrl;
92342                                return __generator(this, function (_a) {
92343                                    switch (_a.label) {
92344                                        case 0:
92345                                            pdfUrl = viewer.dataset.pdf;
92346                                            if (!pdfUrl)
92347                                                return [2 /*return*/];
92348                                            return [4 /*yield*/, this.renderPdf(viewer, pdfUrl)];
92349                                        case 1:
92350                                            _a.sent();
92351                                            return [2 /*return*/];
92352                                    }
92353                                });
92354                            }); }))];
92355                    case 1:
92356                        _a.sent();
92357                        console.log(viewers.length);
92358                        return [2 /*return*/];
92359                }
92360            });
92361        });
92362    };
92363    PDF.prototype.renderPdf = function (viewer, url) {
92364        return __awaiter(this, void 0, void 0, function () {
92365            var pdf, i, page, viewport, scale, scaledViewport, canvas, context;
92366            return __generator(this, function (_a) {
92367                switch (_a.label) {
92368                    case 0:
92369                        viewer.innerHTML = '';
92370                        return [4 /*yield*/, pdfjsLib.getDocument(url).promise];
92371                    case 1:
92372                        pdf = _a.sent();
92373                        i = 1;
92374                        _a.label = 2;
92375                    case 2:
92376                        if (!(i <= pdf.numPages)) return [3 /*break*/, 6];
92377                        return [4 /*yield*/, pdf.getPage(i)];
92378                    case 3:
92379                        page = _a.sent();
92380                        viewport = page.getViewport({ scale: 1 });
92381                        scale = viewer.clientWidth / viewport.width;
92382                        scaledViewport = page.getViewport({ scale: scale });
92383                        canvas = document.createElement("canvas");
92384                        context = canvas.getContext("2d");
92385                        if (!context)
92386                            return [3 /*break*/, 5];
92387                        canvas.width = scaledViewport.width;
92388                        canvas.height = scaledViewport.height;
92389                        return [4 /*yield*/, page.render({
92390                                canvasContext: context,
92391                                viewport: scaledViewport,
92392                            }).promise];
92393                    case 4:
92394                        _a.sent();
92395                        viewer.appendChild(canvas);
92396                        _a.label = 5;
92397                    case 5:
92398                        i++;
92399                        return [3 /*break*/, 2];
92400                    case 6: return [2 /*return*/];
92401                }
92402            });
92403        });
92404    };
92405    return PDF;
92406}());
92407exports.PDF = PDF;
92408exports["default"] = PDF;
92409
92410
92411/***/ },
92412
92413/***/ "./ts/class/_scroll_active.ts"
92414/*!************************************!*\
92415  !*** ./ts/class/_scroll_active.ts ***!
92416  \************************************/
92417(__unused_webpack_module, exports, __webpack_require__) {
92418
92419"use strict";
92420
92421Object.defineProperty(exports, "__esModule", ({ value: true }));
92422exports.ScrollActive = void 0;
92423var $ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
92424var ScrollActive = /** @class */ (function () {
92425    function ScrollActive() {
92426        if ($('.bulletScrollActive').length) {
92427            // 初期化
92428            var observer_1 = new IntersectionObserver(this.pararax);
92429            $('.bulletScrollActive').each(function () {
92430                // 監視の開始
92431                observer_1.observe(this);
92432            });
92433        }
92434    }
92435    ScrollActive.prototype.pararax = function (entries, object) {
92436        entries.forEach(function (entry) {
92437            // 交差していない
92438            if (!entry.isIntersecting)
92439                return;
92440            // ターゲット要素
92441            var target = entry.target;
92442            target.dataset.scroll = '1';
92443            // 監視の解除
92444            object.unobserve(target);
92445        });
92446    };
92447    return ScrollActive;
92448}());
92449exports.ScrollActive = ScrollActive;
92450exports["default"] = ScrollActive;
92451
92452
92453/***/ },
92454
92455/***/ "./ts/class/_slick.ts"
92456/*!****************************!*\
92457  !*** ./ts/class/_slick.ts ***!
92458  \****************************/
92459(__unused_webpack_module, exports, __webpack_require__) {
92460
92461"use strict";
92462
92463Object.defineProperty(exports, "__esModule", ({ value: true }));
92464exports.Slick = void 0;
92465var $ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
92466__webpack_require__(/*! slick-carousel */ "./node_modules/slick-carousel/slick/slick.js");
92467var Slick = /** @class */ (function () {
92468    function Slick() {
92469        this.firstPlayFlag = true;
92470        this.spTabWidth = 1024;
92471        this.spWidth = 767;
92472        var key1 = '.bulletSlickGraduate';
92473        if ($(key1).length > 0) {
92474            $(key1).slick({
92475                autoplay: true,
92476                autoplaySpeed: 0,
92477                arrows: false,
92478                cssEase: 'linear',
92479                dots: false,
92480                speed: 8000,
92481                swipe: false,
92482                pauseOnFocus: false,
92483                pauseOnHover: false,
92484                centerMode: true,
92485                initialSlide: 3,
92486                variableWidth: true,
92487                responsive: [
92488                    {
92489                        breakpoint: 1024,
92490                        settings: {
92491                            autoplaySpeed: 3000,
92492                            arrows: true,
92493                            dots: true,
92494                            fade: true,
92495                            centerMode: false,
92496                            initialSlide: 0,
92497                            slidesToShow: 1,
92498                            slidesToScroll: 1,
92499                            speed: 1000,
92500                            prevArrow: '<div class="myslick-arrow myslick-arrow--prev"><img src="/shared/img/common/icon_box_arrow.svg" alt="左矢印"></div>',
92501                            nextArrow: '<div class="myslick-arrow myslick-arrow--next"><img src="/shared/img/common/icon_box_arrow.svg" alt="右矢印"></div>',
92502                            variableWidth: false,
92503                        }
92504                    },
92505                ]
92506            });
92507        }
92508        var key2 = '.bulletSlickOpenCampus';
92509        if ($(key2).length > 0) {
92510            $(key2).slick({
92511                arrows: false,
92512                infinite: true,
92513                slidesToShow: 1,
92514                slidesToScroll: 1,
92515                autoplay: true,
92516                dots: true,
92517                fade: true,
92518                cssEase: 'linear',
92519                speed: 1000,
92520                responsive: [
92521                    {
92522                        breakpoint: 1024,
92523                        settings: {
92524                            autoplaySpeed: 3000,
92525                            arrows: false,
92526                            initialSlide: 0,
92527                        }
92528                    },
92529                ]
92530            });
92531        }
92532        var key3 = '.bulletSlickNewsImage';
92533        if ($(key3).length > 0) {
92534            $(key3).slick({
92535                slidesToShow: 1,
92536                slidesToScroll: 1,
92537                arrows: false,
92538                fade: true,
92539                asNavFor: '.bulletSlickNewsNavi',
92540            });
92541            $('.bulletSlickNewsNavi').slick({
92542                slidesToShow: 3,
92543                slidesToScroll: 1,
92544                asNavFor: '.bulletSlickNewsImage',
92545                dots: true,
92546                // centerMode: true,
92547                focusOnSelect: true,
92548                // infinite: false,
92549                cssEase: 'linear',
92550                speed: 600,
92551            });
92552        }
92553        var key4 = '.bulletSlickOpenCampusEvent';
92554        if ($(key4).length > 0) {
92555            $(key4).slick({
92556                slidesToShow: 1,
92557                slidesToScroll: 1,
92558                arrows: true,
92559                fade: false,
92560                dots: true,
92561                autoplay: false,
92562                infinite: false,
92563                prevArrow: '<div class="my-slick-prev"><span class="pagination__box__arrow prev"></span><span class="pagination__box__text prev">back</span></div>',
92564                nextArrow: '<div class="my-slick-next"><span class="pagination__box__text next">next</span><span class="pagination__box__arrow next"></span></div>',
92565                // centerMode: false,
92566                // cssEase: 'linear',
92567                // speed: 600,
92568            });
92569        }
92570        // const key5 = '.bulletSlickGraduateNavi';
92571        // const key6 = '.bulletSlickGraduateSpecial';
92572        // if( $(key5).length > 0 ){
92573        //     $(key5).slick({
92574        //         asNavFor: '.bulletSlickGraduateSpecial',
92575        //         // autoplay: true,
92576        //         // autoplaySpeed: 0,
92577        //         arrows: false,
92578        //         cssEase: 'linear',
92579        //         dots: true,
92580        //         speed: 100,
92581        //         swipe: false,
92582        //         // pauseOnFocus: false, // フォーカスが合っても止めない
92583        //         // pauseOnHover: false, // hoverで止めるか
92584        //         centerMode: true,
92585        //         initialSlide: 3, // 最初に表示させる要素の番号を指定
92586        //         variableWidth: true, // スライドの要素の幅をcssで設定できるようにする
92587        //         responsive: [
92588        //             {
92589        //                 breakpoint: 1024,
92590        //                 settings: {
92591        //                     autoplaySpeed: 3000,
92592        //                     arrows: true,
92593        //                     dots: true,
92594        //                     fade: true,
92595        //                     centerMode: false,
92596        //                     initialSlide: 0,
92597        //                     slidesToShow: 1,
92598        //                     slidesToScroll: 1,
92599        //                     speed: 1000,
92600        //                     prevArrow: '<div class="myslick-arrow myslick-arrow--prev"><img src="/shared/img/common/icon_box_arrow.svg" alt="左矢印"></div>',
92601        //                     nextArrow: '<div class="myslick-arrow myslick-arrow--next"><img src="/shared/img/common/icon_box_arrow.svg" alt="右矢印"></div>',
92602        //                     variableWidth: false,
92603        //                 }
92604        //             },
92605        //         ],
92606        //     });
92607        //     $(key6).slick({
92608        //         slidesToShow: 1,
92609        //         slidesToScroll: 1,
92610        //         arrows: true,
92611        //         fade: false,
92612        //         dots: false,
92613        //         autoplay: false,
92614        //         infinite: false,
92615        //         prevArrow: '<div class="my-slick-prev"><span class="pagination__box__arrow prev"></span><span class="pagination__box__text prev">back</span></div>',
92616        //         nextArrow: '<div class="my-slick-next"><span class="pagination__box__text next">next</span><span class="pagination__box__arrow next"></span></div>',
92617        //     });
92618        // }
92619        // GRADUATE 交互にキャプションを上下に配置
92620        var target = $('.graduate__box');
92621        $('.slick-slide:nth-of-type(odd)').find(target).attr('data-position', 'bottom');
92622        $('.slick-slide:nth-of-type(even)').find(target).attr('data-position', 'top');
92623    }
92624    return Slick;
92625}());
92626exports.Slick = Slick;
92627exports["default"] = Slick;
92628
92629
92630/***/ },
92631
92632/***/ "./ts/class/_smooth_scroll.ts"
92633/*!************************************!*\
92634  !*** ./ts/class/_smooth_scroll.ts ***!
92635  \************************************/
92636(__unused_webpack_module, exports, __webpack_require__) {
92637
92638"use strict";
92639
92640Object.defineProperty(exports, "__esModule", ({ value: true }));
92641exports.SmoothScroll = void 0;
92642var $ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
92643var SmoothScroll = /** @class */ (function () {
92644    function SmoothScroll() {
92645        var _this = this;
92646        this.goKey = '';
92647        this.toKey = '#bulletSmoothScroll';
92648        $('a[href^="#"]').click(function (e) {
92649            var href = $(this).attr('href');
92650            if (href === '#') {
92651                return;
92652            }
92653            if (href.indexOf('#') !== -1) {
92654                e.preventDefault();
92655                var position = $(href).offset().top;
92656                position -= 120;
92657                $('body,html').stop().animate({ scrollTop: position }, 500, 'swing');
92658            }
92659        });
92660        // URLがアンカーリンク付きだった時
92661        // window.addEventListener('load', () => {
92662        $(window).on('load', function () {
92663            var url = location.href;
92664            if (_this.isAnchor(url)) {
92665                $("html, body").animate({ scrollTop: 0 }, 0, 'linear');
92666                setTimeout(function () {
92667                    _this.scrollToAnchor(url);
92668                }, 300);
92669                return false;
92670            }
92671        });
92672    }
92673    SmoothScroll.prototype.isAnchor = function (href) {
92674        return href.indexOf('#') != -1;
92675    };
92676    SmoothScroll.prototype.getAnchorName = function (href) {
92677        var index = href.indexOf('#');
92678        return href.slice(index + 1);
92679    };
92680    SmoothScroll.prototype.scrollToAnchor = function (href) {
92681        var anchor = this.getAnchorName(href);
92682        var position = $('#' + anchor).offset().top - 120;
92683        $("html, body").animate({ scrollTop: position }, 400, 'linear');
92684    };
92685    return SmoothScroll;
92686}());
92687exports.SmoothScroll = SmoothScroll;
92688exports["default"] = SmoothScroll;
92689
92690
92691/***/ },
92692
92693/***/ "./node_modules/wrappy/wrappy.js"
92694/*!***************************************!*\
92695  !*** ./node_modules/wrappy/wrappy.js ***!
92696  \***************************************/
92697(module) {
92698
92699// Returns a wrapper function that returns a wrapped callback
92700// The wrapper function should do some stuff, and return a
92701// presumably different callback function.
92702// This makes sure that own properties are retained, so that
92703// decorations and such are not lost along the way.
92704module.exports = wrappy
92705function wrappy (fn, cb) {
92706  if (fn && cb) return wrappy(fn)(cb)
92707
92708  if (typeof fn !== 'function')
92709    throw new TypeError('need wrapper function')
92710
92711  Object.keys(fn).forEach(function (k) {
92712    wrapper[k] = fn[k]
92713  })
92714
92715  return wrapper
92716
92717  function wrapper() {
92718    var args = new Array(arguments.length)
92719    for (var i = 0; i < args.length; i++) {
92720      args[i] = arguments[i]
92721    }
92722    var ret = fn.apply(this, args)
92723    var cb = args[args.length-1]
92724    if (typeof ret === 'function' && ret !== cb) {
92725      Object.keys(cb).forEach(function (k) {
92726        ret[k] = cb[k]
92727      })
92728    }
92729    return ret
92730  }
92731}
92732
92733
92734/***/ },
92735
92736/***/ "fs"
92737/*!*********************!*\
92738  !*** external "fs" ***!
92739  \*********************/
92740(module) {
92741
92742"use strict";
92743module.exports = require("fs");
92744
92745/***/ },
92746
92747/***/ "http"
92748/*!***********************!*\
92749  !*** external "http" ***!
92750  \***********************/
92751(module) {
92752
92753"use strict";
92754module.exports = require("http");
92755
92756/***/ },
92757
92758/***/ "https"
92759/*!************************!*\
92760  !*** external "https" ***!
92761  \************************/
92762(module) {
92763
92764"use strict";
92765module.exports = require("https");
92766
92767/***/ },
92768
92769/***/ "querystring"
92770/*!******************************!*\
92771  !*** external "querystring" ***!
92772  \******************************/
92773(module) {
92774
92775"use strict";
92776module.exports = require("querystring");
92777
92778/***/ },
92779
92780/***/ "stream"
92781/*!*************************!*\
92782  !*** external "stream" ***!
92783  \*************************/
92784(module) {
92785
92786"use strict";
92787module.exports = require("stream");
92788
92789/***/ },
92790
92791/***/ "url"
92792/*!**********************!*\
92793  !*** external "url" ***!
92794  \**********************/
92795(module) {
92796
92797"use strict";
92798module.exports = require("url");
92799
92800/***/ },
92801
92802/***/ "util"
92803/*!***********************!*\
92804  !*** external "util" ***!
92805  \***********************/
92806(module) {
92807
92808"use strict";
92809module.exports = require("util");
92810
92811/***/ },
92812
92813/***/ "zlib"
92814/*!***********************!*\
92815  !*** external "zlib" ***!
92816  \***********************/
92817(module) {
92818
92819"use strict";
92820module.exports = require("zlib");
92821
92822/***/ },
92823
92824/***/ "./node_modules/canvas/package.json"
92825/*!******************************************!*\
92826  !*** ./node_modules/canvas/package.json ***!
92827  \******************************************/
92828(module) {
92829
92830"use strict";
92831module.exports = /*#__PURE__*/JSON.parse('{"_from":"canvas@^2.11.2","_id":"[email protected]","_inBundle":false,"_integrity":"sha512-ItanGBMrmRV7Py2Z+Xhs7cT+FNt5K0vPL4p9EZ/UX/Mu7hFbkxSjKF2KVtPwX7UYWp7dRKnrTvReflgrItJbdw==","_location":"/canvas","_phantomChildren":{},"_requested":{"type":"range","registry":true,"raw":"canvas@^2.11.2","name":"canvas","escapedName":"canvas","rawSpec":"^2.11.2","saveSpec":null,"fetchSpec":"^2.11.2"},"_requiredBy":["/pdfjs-dist"],"_resolved":"https://registry.npmjs.org/canvas/-/canvas-2.11.2.tgz","_shasum":"553d87b1e0228c7ac0fc72887c3adbac4abbd860","_spec":"canvas@^2.11.2","_where":"D:\\\\web\\\\www.tokuco.ac.jp\\\\nodejs\\\\node_modules\\\\pdfjs-dist","author":{"name":"TJ Holowaychuk","email":"[email protected]"},"binary":{"module_name":"canvas","module_path":"build/Release","host":"https://github.com/Automattic/node-canvas/releases/download/","remote_path":"v{version}","package_name":"{module_name}-v{version}-{node_abi}-{platform}-{libc}-{arch}.tar.gz"},"browser":"browser.js","bugs":{"url":"https://github.com/Automattic/node-canvas/issues"},"bundleDependencies":false,"contributors":[{"name":"Nathan Rajlich","email":"[email protected]"},{"name":"Rod Vagg","email":"[email protected]"},{"name":"Juriy Zaytsev","email":"[email protected]"}],"dependencies":{"@mapbox/node-pre-gyp":"^1.0.0","nan":"^2.17.0","simple-get":"^3.0.3"},"deprecated":false,"description":"Canvas graphics API backed by Cairo","devDependencies":{"@types/node":"^10.12.18","assert-rejects":"^1.0.0","dtslint":"^4.0.7","express":"^4.16.3","js-yaml":"^4.1.0","mocha":"^5.2.0","pixelmatch":"^4.0.2","standard":"^12.0.1","typescript":"^4.2.2"},"engines":{"node":">=6"},"files":["binding.gyp","lib/","src/","util/","types/index.d.ts"],"homepage":"https://github.com/Automattic/node-canvas","keywords":["canvas","graphic","graphics","pixman","cairo","image","images","pdf"],"license":"MIT","main":"index.js","name":"canvas","repository":{"type":"git","url":"git://github.com/Automattic/node-canvas.git"},"scripts":{"benchmark":"node benchmarks/run.js","dtslint":"dtslint types","generate-wpt":"node ./test/wpt/generate.js","install":"node-pre-gyp install --fallback-to-build --update-binary","lint":"standard examples/*.js test/server.js test/public/*.js benchmarks/run.js lib/context2d.js util/has_lib.js browser.js index.js","prebenchmark":"node-gyp build","pretest-server":"node-gyp build","test":"mocha test/*.test.js","test-server":"node test/server.js","test-wpt":"mocha test/wpt/generated/
92831*.js"},"types":"types/index.d.ts","version":"2.11.2"}');
92832
92833/***/ }
92834
92835/******/ 	});
92836/************************************************************************/
92837/******/ 	// The module cache
92838/******/ 	const __webpack_module_cache__ = {};
92839/******/ 	
92840/******/ 	// The require function
92841/******/ 	function __webpack_require__(moduleId) {
92842/******/ 		// Check if module is in cache
92843/******/ 		const cachedModule = __webpack_module_cache__[moduleId];
92844/******/ 		if (cachedModule !== undefined) {
92845/******/ 			return cachedModule.exports;
92846/******/ 		}
92847/******/ 		// Create a new module (and put it into the cache)
92848/******/ 		const module = __webpack_module_cache__[moduleId] = {
92849/******/ 			// no module.id needed
92850/******/ 			// no module.loaded needed
92851/******/ 			exports: {}
92852/******/ 		};
92853/******/ 	
92854/******/ 		// Execute the module function
92855/******/ 		if (!(moduleId in __webpack_modules__)) {
92856/******/ 			delete __webpack_module_cache__[moduleId];
92857/******/ 			const e = new Error("Cannot find module '" + moduleId + "'");
92858/******/ 			e.code = 'MODULE_NOT_FOUND';
92859/******/ 			throw e;
92860/******/ 		}
92861/******/ 		__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
92862/******/ 	
92863/******/ 		// Return the exports of the module
92864/******/ 		return module.exports;
92865/******/ 	}
92866/******/ 	
92867/************************************************************************/
92868let __webpack_exports__ = {};
92869// This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
92870(() => {
92871"use strict";
92872let exports = __webpack_exports__;
92873/*!**********************!*\
92874  !*** ./ts/script.ts ***!
92875  \**********************/
92876
92877Object.defineProperty(exports, "__esModule", ({ value: true }));
92878var $ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
92879var _smooth_scroll_1 = __webpack_require__(/*! ./class/_smooth_scroll */ "./ts/class/_smooth_scroll.ts");
92880var _hamburger_1 = __webpack_require__(/*! ./class/_hamburger */ "./ts/class/_hamburger.ts");
92881var _slick_1 = __webpack_require__(/*! ./class/_slick */ "./ts/class/_slick.ts");
92882var _scroll_active_1 = __webpack_require__(/*! ./class/_scroll_active */ "./ts/class/_scroll_active.ts");
92883var _modal_1 = __webpack_require__(/*! ./class/_modal */ "./ts/class/_modal.ts");
92884var _orientation_1 = __webpack_require__(/*! ./class/_orientation */ "./ts/class/_orientation.ts");
92885var _neon_box_1 = __webpack_require__(/*! ./class/_neon_box */ "./ts/class/_neon_box.ts");
92886var _obog_1 = __webpack_require__(/*! ./class/_obog */ "./ts/class/_obog.ts");
92887var _club_1 = __webpack_require__(/*! ./class/_club */ "./ts/class/_club.ts");
92888var _go_1 = __webpack_require__(/*! ./class/_go */ "./ts/class/_go.ts");
92889var _anchor_disabled_1 = __webpack_require__(/*! ./class/_anchor_disabled */ "./ts/class/_anchor_disabled.ts");
92890var _pdf_1 = __webpack_require__(/*! ./class/_pdf */ "./ts/class/_pdf.ts");
92891new _smooth_scroll_1.default;
92892$(function () {
92893    new _hamburger_1.default;
92894    new _slick_1.default();
92895    new _scroll_active_1.default();
92896    new _modal_1.default();
92897    new _orientation_1.default();
92898    new _neon_box_1.default;
92899    new _obog_1.default;
92900    new _club_1.default;
92901    new _go_1.default;
92902    new _anchor_disabled_1.default;
92903    new _pdf_1.default();
92904});
92905
92906})();
92907
92908/******/ })()
92909;
92910//# sourceMappingURL=script.js.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.