UNPKG

@tuttarealstep/vue-pdf.js

Version:

A Vue component for displaying PDF files using the standard `pdf.js` viewer. This package provides a simple and powerful integration to embed PDF viewers in Vue applications.

1,542 lines 1.8 MB
var wC = Object.defineProperty; var cI = (e) => { throw TypeError(e); }; var bC = (e, A, t) => A in e ? wC(e, A, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[A] = t; var _A = (e, A, t) => bC(e, typeof A != "symbol" ? A + "" : A, t), Wr = (e, A, t) => A.has(e) || cI("Cannot " + t); var IA = (e, A, t) => (Wr(e, A, "read from private field"), t ? t.call(e) : A.get(e)), NA = (e, A, t) => A.has(e) ? cI("Cannot add the same private member more than once") : A instanceof WeakSet ? A.add(e) : A.set(e, t), le = (e, A, t, i) => (Wr(e, A, "write to private field"), i ? i.call(e, t) : A.set(e, t), t), rA = (e, A, t) => (Wr(e, A, "access private method"), t); import { u as FA, s as iA, a as JA, b as dt, A as jc, U as ne, o as ko, B as Ni, c as $A, h as lI, w as b, F as K, M as Pe, i as WA, d as $t, e as ct, f as Xc, I as At, g as DC, O as y, D as He, R as It, j as ys, k as Xe, l as hI, m as ot, T as _c, n as kC, p as c0, q as SC, L as $i, r as fg, t as FC, _ as RC, v as vn, P as CI, x as Tn, y as GC, z as ug, C as NC, E as ai, G as fe, H as Hs, J as Oe, K as Xt, N as Fi, Q as dg, S as BI, V as zc, W as xg, X as QI, Y as pg, Z as EI, $ as MC, a0 as UC, a1 as LC, a2 as fI, a3 as uI, a4 as JC, a5 as HC } from "./index-2h_oXHZ_.js"; const YC = Symbol("CIRCULAR_REF"), qe = Symbol("EOF"); let Dn = /* @__PURE__ */ Object.create(null), kn = /* @__PURE__ */ Object.create(null), Ws = /* @__PURE__ */ Object.create(null); function KC() { Dn = /* @__PURE__ */ Object.create(null), kn = /* @__PURE__ */ Object.create(null), Ws = /* @__PURE__ */ Object.create(null); } class L { constructor(A) { (typeof PDFJSDev > "u" || PDFJSDev.test("TESTING")) && typeof A != "string" && FA('Name: The "name" must be a string.'), this.name = A; } static get(A) { return kn[A] || (kn[A] = new L(A)); } } class Le { constructor(A) { (typeof PDFJSDev > "u" || PDFJSDev.test("TESTING")) && typeof A != "string" && FA('Cmd: The "cmd" must be a string.'), this.cmd = A; } static get(A) { return Dn[A] || (Dn[A] = new Le(A)); } } const $c = function() { return $c; }; class F { constructor(A = null) { this._map = /* @__PURE__ */ new Map(), this.xref = A, this.objId = null, this.suppressEncryption = !1, this.__nonSerializable__ = $c; } assignXref(A) { this.xref = A; } get size() { return this._map.size; } // Automatically dereferences Ref objects. get(A, t, i) { let s = this._map.get(A); return s === void 0 && t !== void 0 && ((typeof PDFJSDev > "u" || PDFJSDev.test("TESTING")) && t.length < A.length && FA("Dict.get: Expected keys to be ordered by length."), s = this._map.get(t), s === void 0 && i !== void 0 && ((typeof PDFJSDev > "u" || PDFJSDev.test("TESTING")) && i.length < t.length && FA("Dict.get: Expected keys to be ordered by length."), s = this._map.get(i))), s instanceof oA && this.xref ? this.xref.fetch(s, this.suppressEncryption) : s; } // Same as get(), but returns a promise and uses fetchIfRefAsync(). async getAsync(A, t, i) { let s = this._map.get(A); return s === void 0 && t !== void 0 && ((typeof PDFJSDev > "u" || PDFJSDev.test("TESTING")) && t.length < A.length && FA("Dict.getAsync: Expected keys to be ordered by length."), s = this._map.get(t), s === void 0 && i !== void 0 && ((typeof PDFJSDev > "u" || PDFJSDev.test("TESTING")) && i.length < t.length && FA("Dict.getAsync: Expected keys to be ordered by length."), s = this._map.get(i))), s instanceof oA && this.xref ? this.xref.fetchAsync(s, this.suppressEncryption) : s; } // Same as get(), but dereferences all elements if the result is an Array. getArray(A, t, i) { let s = this._map.get(A); if (s === void 0 && t !== void 0 && ((typeof PDFJSDev > "u" || PDFJSDev.test("TESTING")) && t.length < A.length && FA("Dict.getArray: Expected keys to be ordered by length."), s = this._map.get(t), s === void 0 && i !== void 0 && ((typeof PDFJSDev > "u" || PDFJSDev.test("TESTING")) && i.length < t.length && FA("Dict.getArray: Expected keys to be ordered by length."), s = this._map.get(i))), s instanceof oA && this.xref && (s = this.xref.fetch(s, this.suppressEncryption)), Array.isArray(s)) { s = s.slice(); for (let a = 0, n = s.length; a < n; a++) s[a] instanceof oA && this.xref && (s[a] = this.xref.fetch(s[a], this.suppressEncryption)); } return s; } // No dereferencing. getRaw(A) { return this._map.get(A); } getKeys() { return [...this._map.keys()]; } // No dereferencing. getRawValues() { return [...this._map.values()]; } set(A, t) { (typeof PDFJSDev > "u" || PDFJSDev.test("TESTING")) && (typeof A != "string" ? FA('Dict.set: The "key" must be a string.') : t === void 0 && FA('Dict.set: The "value" cannot be undefined.')), this._map.set(A, t); } has(A) { return this._map.has(A); } *[Symbol.iterator]() { for (const [A, t] of this._map) yield [ A, t instanceof oA && this.xref ? this.xref.fetch(t, this.suppressEncryption) : t ]; } static get empty() { const A = new F(null); return A.set = (t, i) => { FA("Should not call `set` on the empty dictionary."); }, iA(this, "empty", A); } static merge({ xref: A, dictArray: t, mergeSubDicts: i = !1 }) { const s = new F(A), a = /* @__PURE__ */ new Map(); for (const n of t) if (n instanceof F) for (const [r, g] of n._map) { let o = a.get(r); if (o === void 0) o = [], a.set(r, o); else if (!i || !(g instanceof F)) continue; o.push(g); } for (const [n, r] of a) { if (r.length === 1 || !(r[0] instanceof F)) { s._map.set(n, r[0]); continue; } const g = new F(A); for (const o of r) for (const [I, l] of o._map) g._map.has(I) || g._map.set(I, l); g.size > 0 && s._map.set(n, g); } return a.clear(), s.size > 0 ? s : F.empty; } clone() { const A = new F(this.xref); for (const t of this.getKeys()) A.set(t, this.getRaw(t)); return A; } delete(A) { delete this._map[A]; } } class oA { constructor(A, t) { this.num = A, this.gen = t; } toString() { return this.gen === 0 ? `${this.num}R` : `${this.num}R${this.gen}`; } static fromString(A) { const t = Ws[A]; if (t) return t; const i = /^(\d+)R(\d*)$/.exec(A); return !i || i[1] === "0" ? null : Ws[A] = new oA( parseInt(i[1]), i[2] ? parseInt(i[2]) : 0 ); } static get(A, t) { const i = t === 0 ? `${A}R` : `${A}R${t}`; return Ws[i] || (Ws[i] = new oA(A, t)); } } class Re { constructor(A = null) { (typeof PDFJSDev > "u" || PDFJSDev.test("TESTING")) && A && !(A instanceof Re) && FA('RefSet: Invalid "parent" value.'), this._set = new Set(A == null ? void 0 : A._set); } has(A) { return this._set.has(A.toString()); } put(A) { this._set.add(A.toString()); } remove(A) { this._set.delete(A.toString()); } [Symbol.iterator]() { return this._set.values(); } clear() { this._set.clear(); } } class ft { constructor() { this._map = /* @__PURE__ */ new Map(); } get size() { return this._map.size; } get(A) { return this._map.get(A.toString()); } has(A) { return this._map.has(A.toString()); } put(A, t) { this._map.set(A.toString(), t); } putAlias(A, t) { this._map.set(A.toString(), this.get(t)); } [Symbol.iterator]() { return this._map.values(); } clear() { this._map.clear(); } *values() { yield* this._map.values(); } *items() { for (const [A, t] of this._map) yield [oA.fromString(A), t]; } } function Fe(e, A) { return e instanceof L && (A === void 0 || e.name === A); } function Te(e, A) { return e instanceof Le && (A === void 0 || e.cmd === A); } function Al(e, A) { return e instanceof F && (A === void 0 || Fe(e.get("Type"), A)); } function qn(e, A) { return (typeof PDFJSDev > "u" || PDFJSDev.test("TESTING")) && JA( e instanceof oA && A instanceof oA, "isRefsEqual: Both parameters should be `Ref`s." ), e.num === A.num && e.gen === A.gen; } class vA { constructor() { (typeof PDFJSDev > "u" || PDFJSDev.test("TESTING")) && this.constructor === vA && FA("Cannot initialize BaseStream."); } // eslint-disable-next-line getter-return get length() { FA("Abstract getter `length` accessed"); } // eslint-disable-next-line getter-return get isEmpty() { FA("Abstract getter `isEmpty` accessed"); } get isDataLoaded() { return iA(this, "isDataLoaded", !0); } getByte() { FA("Abstract method `getByte` called"); } getBytes(A) { FA("Abstract method `getBytes` called"); } /** * NOTE: This method can only be used to get image-data that is guaranteed * to be fully loaded, since otherwise intermittent errors may occur; * note the `ObjectLoader` class. */ async getImageData(A, t) { return this.getBytes(A, t); } async asyncGetBytes() { FA("Abstract method `asyncGetBytes` called"); } get isAsync() { return !1; } get isAsyncDecoder() { return !1; } get canAsyncDecodeImageFromBuffer() { return !1; } async getTransferableImage() { return null; } peekByte() { const A = this.getByte(); return A !== -1 && this.pos--, A; } peekBytes(A) { const t = this.getBytes(A); return this.pos -= t.length, t; } getUint16() { const A = this.getByte(), t = this.getByte(); return A === -1 || t === -1 ? -1 : (A << 8) + t; } getInt32() { const A = this.getByte(), t = this.getByte(), i = this.getByte(), s = this.getByte(); return (A << 24) + (t << 16) + (i << 8) + s; } getByteRange(A, t) { FA("Abstract method `getByteRange` called"); } getString(A) { return dt(this.getBytes(A)); } skip(A) { this.pos += A || 1; } reset() { FA("Abstract method `reset` called"); } moveStart() { FA("Abstract method `moveStart` called"); } makeSubStream(A, t, i = null) { FA("Abstract method `makeSubStream` called"); } /** * @returns {Array | null} */ getBaseStreams() { return null; } } const el = /^[1-9]\.\d$/, mg = 2 ** 31 - 1, vC = -(2 ** 31), zt = [1, 0, 0, 1, 0, 0], yg = [ "ColorSpace", "ExtGState", "Font", "Pattern", "Properties", "Shading", "XObject" ], wg = [ "ExtGState", "Font", "Properties", "XObject" ]; function xe(e) { let A; return function() { return e && (A = /* @__PURE__ */ Object.create(null), e(A), e = null), A; }; } class ue extends Ni { constructor(A, t) { super(`Missing data [${A}, ${t})`, "MissingDataException"), this.begin = A, this.end = t; } } class bg extends Ni { constructor(A) { super(A, "ParserEOFException"); } } class Zi extends Ni { constructor(A) { super(A, "XRefEntryException"); } } class aa extends Ni { constructor(A) { super(A, "XRefParseException"); } } function tl(e) { if (typeof PDFJSDev > "u" || PDFJSDev.test("TESTING")) for (const a of e) JA( a instanceof ArrayBuffer, "arrayBuffersToBytes - expected an ArrayBuffer." ); const A = e.length; if (A === 0) return new Uint8Array(0); if (A === 1) return new Uint8Array(e[0]); let t = 0; for (let a = 0; a < A; a++) t += e[a].byteLength; const i = new Uint8Array(t); let s = 0; for (let a = 0; a < A; a++) { const n = new Uint8Array(e[a]); i.set(n, s), s += n.byteLength; } return i; } async function Dg(e) { const A = await fetch(e); if (!A.ok) throw new Error( `Failed to fetch file "${e}" with "${A.statusText}".` ); return new Uint8Array(await A.arrayBuffer()); } function Ht({ dict: e, key: A, getArray: t = !1, stopWhenFound: i = !0 }) { let s; const a = new Re(); for (; e instanceof F && !(e.objId && a.has(e.objId)); ) { e.objId && a.put(e.objId); const n = t ? e.getArray(A) : e.get(A); if (n !== void 0) { if (i) return n; (s || (s = [])).push(n); } e = e.get("Parent"); } return s; } function TC(e, A, t) { const i = new Re(), s = e, a = { dict: null, ref: null }; for (; e instanceof F && !i.has(A) && (i.put(A), !e.has("T")); ) { if (A = e.getRaw("Parent"), !(A instanceof oA)) return a; e = t.fetch(A); } return e instanceof F && e !== s && (a.dict = e, a.ref = A), a; } const Or = [ "", "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" ]; function qC(e, A = !1) { JA( Number.isInteger(e) && e > 0, "The number should be a positive integer." ); const t = "M".repeat(e / 1e3 | 0) + Or[e % 1e3 / 100 | 0] + Or[10 + (e % 100 / 10 | 0)] + Or[20 + e % 10]; return A ? t.toLowerCase() : t; } function So(e) { return e > 0 ? Math.ceil(Math.log2(e)) : 0; } function ni(e, A) { return e[A] << 24 >> 24; } function yi(e, A) { return (e[A] << 24 | e[A + 1] << 16) >> 16; } function VA(e, A) { return e[A] << 8 | e[A + 1]; } function ge(e, A) { return (e[A] << 24 | e[A + 1] << 16 | e[A + 2] << 8 | e[A + 3]) >>> 0; } function kt(e) { return e === 32 || e === 9 || e === 13 || e === 10; } function PC(e, A) { return Array.isArray(e) && e.length === A && e.every((t) => typeof t == "boolean"); } function it(e, A) { return Array.isArray(e) ? (A === null || e.length === A) && e.every((t) => typeof t == "number") : ArrayBuffer.isView(e) && !(e instanceof BigInt64Array || e instanceof BigUint64Array) && (A === null || e.length === A); } function Vi(e, A) { return it(e, 6) ? e : A; } function kg(e, A) { return it(e, 4) ? e : A; } function Ri(e, A) { return it(e, 4) ? ne.normalizeRect(e) : A; } function il(e) { const A = /(.+)\[(\d+)\]$/; return e.split(".").map((t) => { const i = t.match(A); return i ? { name: i[1], pos: parseInt(i[2], 10) } : { name: t, pos: 0 }; }); } function Fo(e) { const A = []; let t = 0; for (let i = 0, s = e.length; i < s; i++) { const a = e.charCodeAt(i); (a < 33 || a > 126 || a === 35 || a === 40 || a === 41 || a === 60 || a === 62 || a === 91 || a === 93 || a === 123 || a === 125 || a === 47 || a === 37) && (t < i && A.push(e.substring(t, i)), A.push(`#${a.toString(16)}`), t = i + 1); } return A.length === 0 ? e : (t < e.length && A.push(e.substring(t, e.length)), A.join("")); } function Ea(e) { return e.replaceAll(/([()\\\n\r])/g, (A) => A === ` ` ? "\\n" : A === "\r" ? "\\r" : `\\${A}`); } function Pn(e, A, t, i) { if (!e) return; let s = null; if (e instanceof oA) { if (i.has(e)) return; s = e, i.put(s), e = A.fetch(e); } if (Array.isArray(e)) for (const a of e) Pn(a, A, t, i); else if (e instanceof F) { if (Fe(e.get("S"), "JavaScript")) { const a = e.get("JS"); let n; a instanceof vA ? n = a.getString() : typeof a == "string" && (n = a), n && (n = $A( n, /* keepEscapeSequence = */ !0 ).replaceAll("\0", "")), n && t.push(n); } Pn(e.getRaw("Next"), A, t, i); } s && i.remove(s); } function mr(e, A, t) { const i = /* @__PURE__ */ Object.create(null), s = Ht({ dict: A, key: "AA", stopWhenFound: !1 }); if (s) for (let a = s.length - 1; a >= 0; a--) { const n = s[a]; if (n instanceof F) for (const r of n.getKeys()) { const g = t[r]; if (!g) continue; const o = n.getRaw(r), I = new Re(), l = []; Pn(o, e, l, I), l.length > 0 && (i[g] = l); } } if (A.has("A")) { const a = A.get("A"), n = new Re(), r = []; Pn(a, e, r, n), r.length > 0 && (i.Action = r); } return ko(i) > 0 ? i : null; } const WC = { /* < */ 60: "&lt;", /* > */ 62: "&gt;", /* & */ 38: "&amp;", /* " */ 34: "&quot;", /* ' */ 39: "&apos;" }; function* OC(e) { for (let A = 0, t = e.length; A < t; A++) { const i = e.codePointAt(A); i > 55295 && (i < 57344 || i > 65533) && A++, yield i; } } function na(e) { const A = []; let t = 0; for (let i = 0, s = e.length; i < s; i++) { const a = e.codePointAt(i); if (32 <= a && a <= 126) { const n = WC[a]; n && (t < i && A.push(e.substring(t, i)), A.push(n), t = i + 1); } else t < i && A.push(e.substring(t, i)), A.push(`&#x${a.toString(16).toUpperCase()};`), a > 55295 && (a < 57344 || a > 65533) && i++, t = i + 1; } return A.length === 0 ? e : (t < e.length && A.push(e.substring(t, e.length)), A.join("")); } function Sg(e, A = !1) { const t = /^("|').*("|')$/.exec(e); if (t && t[1] === t[2]) { if (new RegExp(`[^\\\\]${t[1]}`).test(e.slice(1, -1))) return A && b(`FontFamily contains unescaped ${t[1]}: ${e}.`), !1; } else for (const i of e.split(/[ \t]+/)) if (/^(\d|(-(\d|-)))/.test(i) || !/^[\w-\\]+$/.test(i)) return A && b(`FontFamily contains invalid <custom-ident>: ${e}.`), !1; return !0; } function ZC(e) { const A = "14", t = "400", i = /* @__PURE__ */ new Set([ "100", "200", "300", "400", "500", "600", "700", "800", "900", "1000", "normal", "bold", "bolder", "lighter" ]), { fontFamily: s, fontWeight: a, italicAngle: n } = e; if (!Sg(s, !0)) return !1; const r = a ? a.toString() : ""; e.fontWeight = i.has(r) ? r : t; const g = parseFloat(n); return e.italicAngle = isNaN(g) || g < -90 || g > 90 ? A : n.toString(), !0; } function sl(e) { const A = ["app.launchURL", "window.open", "xfa.host.gotoURL"], i = new RegExp( "^\\s*(" + A.join("|").replaceAll(".", "\\.") + `)\\((?:'|")([^'"]*)(?:'|")(?:,\\s*(\\w+)\\)|\\))`, "i" ).exec(e); return i != null && i[2] ? { url: i[2], newWindow: i[1] === "app.launchURL" && i[3] === "true" } : null; } function jA(e) { if ((typeof PDFJSDev > "u" || PDFJSDev.test("TESTING")) && JA( typeof e == "number", `numberToString - the value (${e}) should be a number.` ), Number.isInteger(e)) return e.toString(); const A = Math.round(e * 100); return A % 100 === 0 ? (A / 100).toString() : A % 10 === 0 ? e.toFixed(1) : e.toFixed(2); } function al(e) { if (!e) return null; const A = /* @__PURE__ */ new Map(); for (const [t, i] of e) { if (!t.startsWith(jc)) continue; let s = A.get(i.pageIndex); s || (s = [], A.set(i.pageIndex, s)), s.push(i); } return A.size > 0 ? A : null; } function Yt(e) { return VC(e) ? e : nl( e, /* bigEndian = */ !0 ); } function VC(e) { return /^[\x00-\x7F]*$/.test(e); } function jC(e) { const A = []; for (let t = 0, i = e.length; t < i; t++) { const s = e.charCodeAt(t); A.push(lI[s >> 8 & 255], lI[s & 255]); } return A.join(""); } function nl(e, A = !1) { const t = []; A && t.push("þÿ"); for (let i = 0, s = e.length; i < s; i++) { const a = e.charCodeAt(i); t.push( String.fromCharCode(a >> 8 & 255), String.fromCharCode(a & 255) ); } return t.join(""); } function Wn(e, A, t) { switch (e) { case 90: return [0, 1, -1, 0, A, 0]; case 180: return [-1, 0, 0, -1, A, t]; case 270: return [0, -1, 1, 0, 0, t]; default: throw new Error("Invalid rotation"); } } function dI(e) { return Math.ceil(Math.ceil(Math.log2(1 + e)) / 8); } var b0; class de { static get _memoryArray() { const A = IA(this, b0); return A != null && A.byteLength ? A : le(this, b0, new Uint8Array(this._memory.buffer)); } } b0 = new WeakMap(), NA(de, b0, null), _A(de, "_memory", null), _A(de, "_mustAddAlpha", !1), _A(de, "_destBuffer", null), _A(de, "_destOffset", 0), _A(de, "_destLength", 0), _A(de, "_cssColor", ""), _A(de, "_makeHexColor", null); function XC(e, A) { const { _mustAddAlpha: t, _destBuffer: i, _destOffset: s, _destLength: a, _memoryArray: n } = de; if (A === a) { i.set(n.subarray(e, e + A), s); return; } if (t) for (let r = e, g = e + A, o = s; r < g; r += 3, o += 4) i[o] = n[r], i[o + 1] = n[r + 1], i[o + 2] = n[r + 2], i[o + 3] = 255; else for (let r = e, g = e + A, o = s; r < g; r += 3, o += 4) i[o] = n[r], i[o + 1] = n[r + 1], i[o + 2] = n[r + 2]; } function _C(e) { const { _destBuffer: A, _destOffset: t, _memoryArray: i } = de; A[t] = i[e], A[t + 1] = i[e + 1], A[t + 2] = i[e + 2]; } function zC(e) { const { _memoryArray: A } = de; de._cssColor = de._makeHexColor( A[e], A[e + 1], A[e + 2] ); } let ht; const rl = typeof TextDecoder < "u" ? new TextDecoder("utf-8", { ignoreBOM: !0, fatal: !0 }) : { decode: () => { throw Error("TextDecoder not available"); } }; typeof TextDecoder < "u" && rl.decode(); let ja = null; function gl() { return (ja === null || ja.byteLength === 0) && (ja = new Uint8Array(ht.memory.buffer)), ja; } function $C(e, A) { return e = e >>> 0, rl.decode(gl().subarray(e, e + A)); } let Ro = 0; function ol(e, A) { const t = A(e.length * 1, 1) >>> 0; return gl().set(e, t / 1), Ro = e.length, t; } function AB(e, A) { const t = ol(A, ht.__wbindgen_malloc), i = Ro; ht.qcms_convert_array(e, t, i); } function eB(e, A, t) { ht.qcms_convert_one(e, A, t); } function tB(e, A, t, i, s) { ht.qcms_convert_three(e, A, t, i, s); } function iB(e, A, t, i, s, a) { ht.qcms_convert_four(e, A, t, i, s, a); } function sB(e, A, t) { const i = ol(e, ht.__wbindgen_malloc), s = Ro; return ht.qcms_transformer_from_memory(i, s, A, t) >>> 0; } function aB(e) { ht.qcms_drop_transformer(e); } const Zr = Object.freeze({ RGB8: 0, 0: "RGB8", RGBA8: 1, 1: "RGBA8", BGRA8: 2, 2: "BGRA8", Gray8: 3, 3: "Gray8", GrayA8: 4, 4: "GrayA8", CMYK: 5, 5: "CMYK" }), nB = Object.freeze({ Perceptual: 0, 0: "Perceptual", RelativeColorimetric: 1, 1: "RelativeColorimetric", Saturation: 2, 2: "Saturation", AbsoluteColorimetric: 3, 3: "AbsoluteColorimetric" }); function rB() { const e = {}; return e.wbg = {}, e.wbg.__wbg_copyresult_b08ee7d273f295dd = function(A, t) { XC(A >>> 0, t >>> 0); }, e.wbg.__wbg_copyrgb_d60ce17bb05d9b67 = function(A) { _C(A >>> 0); }, e.wbg.__wbg_makecssRGB_893bf0cd9fdb302d = function(A) { zC(A >>> 0); }, e.wbg.__wbindgen_init_externref_table = function() { const A = ht.__wbindgen_export_0, t = A.grow(4); A.set(0, void 0), A.set(t + 0, void 0), A.set(t + 1, null), A.set(t + 2, !0), A.set(t + 3, !1); }, e.wbg.__wbindgen_throw = function(A, t) { throw new Error($C(A, t)); }, e; } function gB(e, A) { return ht = e.exports, ja = null, ht.__wbindgen_start(), ht; } function oB(e) { if (ht !== void 0) return ht; typeof e < "u" && (Object.getPrototypeOf(e) === Object.prototype ? { module: e } = e : console.warn("using deprecated parameters for `initSync()`; pass a single object instead")); const A = rB(); e instanceof WebAssembly.Module || (e = new WebAssembly.Module(e)); const t = new WebAssembly.Instance(e, A); return gB(t); } function IB(e, A, t, i, s, a, n) { n = n !== 1 ? 0 : n; const g = t / s, o = i / a; let I = 0, l; const c = new Uint16Array(s), h = t * 3; for (let C = 0; C < s; C++) c[C] = Math.floor(C * g) * 3; for (let C = 0; C < a; C++) { const B = Math.floor(C * o) * h; for (let E = 0; E < s; E++) l = B + c[E], A[I++] = e[l++], A[I++] = e[l++], A[I++] = e[l++], I += n; } } function cB(e, A, t, i, s, a, n) { const r = t / s, g = i / a; let o = 0; const I = new Uint16Array(s); if (n === 1) { for (let C = 0; C < s; C++) I[C] = Math.floor(C * r); const l = new Uint32Array(e.buffer), c = new Uint32Array(A.buffer), h = $t.isLittleEndian ? 16777215 : 4294967040; for (let C = 0; C < a; C++) { const B = l.subarray(Math.floor(C * g) * t); for (let E = 0; E < s; E++) c[o++] |= B[I[E]] & h; } } else { const c = t * 4; for (let h = 0; h < s; h++) I[h] = Math.floor(h * r) * 4; for (let h = 0; h < a; h++) { const C = e.subarray(Math.floor(h * g) * c); for (let B = 0; B < s; B++) { const E = I[B]; A[o++] = C[E], A[o++] = C[E + 1], A[o++] = C[E + 2]; } } } } function lB(e, A, t) { if (t === 1) { const i = new Uint32Array(e.buffer), s = new Uint32Array(A.buffer), a = $t.isLittleEndian ? 16777215 : 4294967040; for (let n = 0, r = i.length; n < r; n++) s[n] |= i[n] & a; } else { let i = 0; for (let s = 0, a = e.length; s < a; s += 4) A[i++] = e[s], A[i++] = e[s + 1], A[i++] = e[s + 2]; } } var or; const Aa = class Aa { constructor(A, t) { (typeof PDFJSDev > "u" || PDFJSDev.test("TESTING")) && this.constructor === Aa && FA("Cannot initialize ColorSpace."), this.name = A, this.numComps = t; } /** * Converts the color value to the RGB color. The color components are * located in the src array starting from the srcOffset. Returns the array * of the rgb components, each value ranging from [0,255]. */ getRgb(A, t, i = new Uint8ClampedArray(3)) { return this.getRgbItem(A, t, i, 0), i; } getRgbHex(A, t) { const i = this.getRgb(A, t, IA(Aa, or)); return ne.makeHexColor(i[0], i[1], i[2]); } /** * Converts the color value to the RGB color, similar to the getRgb method. * The result placed into the dest array starting from the destOffset. */ getRgbItem(A, t, i, s) { FA("Should not call ColorSpace.getRgbItem"); } /** * Converts the specified number of the color values to the RGB colors. * The colors are located in the src array starting from the srcOffset. * The result is placed into the dest array starting from the destOffset. * The src array items shall be in [0,2^bits) range, the dest array items * will be in [0,255] range. alpha01 indicates how many alpha components * there are in the dest array; it will be either 0 (RGB array) or 1 (RGBA * array). */ getRgbBuffer(A, t, i, s, a, n, r) { FA("Should not call ColorSpace.getRgbBuffer"); } /** * Determines the number of bytes required to store the result of the * conversion done by the getRgbBuffer method. As in getRgbBuffer, * |alpha01| is either 0 (RGB output) or 1 (RGBA output). */ getOutputLength(A, t) { FA("Should not call ColorSpace.getOutputLength"); } /** * Returns true if source data will be equal the result/output data. */ isPassthrough(A) { return !1; } /** * Refer to the static `ColorSpace.isDefaultDecode` method below. */ isDefaultDecode(A, t) { return Aa.isDefaultDecode(A, this.numComps); } /** * Fills in the RGB colors in the destination buffer. alpha01 indicates * how many alpha components there are in the dest array; it will be either * 0 (RGB array) or 1 (RGBA array). */ fillRgb(A, t, i, s, a, n, r, g, o) { (typeof PDFJSDev > "u" || PDFJSDev.test("TESTING")) && JA( A instanceof Uint8ClampedArray, 'ColorSpace.fillRgb: Unsupported "dest" type.' ); const I = t * i; let l = null; const c = 1 << r, h = i !== a || t !== s; if (this.isPassthrough(r)) l = g; else if (this.numComps === 1 && I > c && this.name !== "DeviceGray" && this.name !== "DeviceRGB") { const C = r <= 8 ? new Uint8Array(c) : new Uint16Array(c); for (let E = 0; E < c; E++) C[E] = E; const B = new Uint8ClampedArray(c * 3); if (this.getRgbBuffer( C, 0, c, B, 0, r, /* alpha01 = */ 0 ), h) { l = new Uint8Array(I * 3); let E = 0; for (let Q = 0; Q < I; ++Q) { const u = g[Q] * 3; l[E++] = B[u], l[E++] = B[u + 1], l[E++] = B[u + 2]; } } else { let E = 0; for (let Q = 0; Q < I; ++Q) { const u = g[Q] * 3; A[E++] = B[u], A[E++] = B[u + 1], A[E++] = B[u + 2], E += o; } } } else h ? (l = new Uint8ClampedArray(I * 3), this.getRgbBuffer( g, 0, I, l, 0, r, /* alpha01 = */ 0 )) : this.getRgbBuffer(g, 0, s * n, A, 0, r, o); if (l) if (h) IB( l, A, t, i, s, a, o ); else { let C = 0, B = 0; for (let E = 0, Q = s * n; E < Q; E++) A[C++] = l[B++], A[C++] = l[B++], A[C++] = l[B++], C += o; } } /** * True if the colorspace has components in the default range of [0, 1]. * This should be true for all colorspaces except for lab color spaces * which are [0,100], [-128, 127], [-128, 127]. */ get usesZeroToOneRange() { return iA(this, "usesZeroToOneRange", !0); } /** * Checks if a decode map matches the default decode map for a color space. * This handles the general decode maps where there are two values per * component, e.g. [0, 1, 0, 1, 0, 1] for a RGB color. * This does not handle Lab, Indexed, or Pattern decode maps since they are * slightly different. * @param {Array} decode - Decode map (usually from an image). * @param {number} numComps - Number of components the color space has. */ static isDefaultDecode(A, t) { if (!Array.isArray(A)) return !0; if (t * 2 !== A.length) return b("The decode map is not the correct length"), !0; for (let i = 0, s = A.length; i < s; i += 2) if (A[i] !== 0 || A[i + 1] !== 1) return !1; return !0; } }; or = new WeakMap(), NA(Aa, or, new Uint8ClampedArray(3)); let ze = Aa; class hB extends ze { constructor(A, t, i) { super("Alternate", A), this.base = t, this.tintFn = i, this.tmpBuf = new Float32Array(t.numComps); } getRgbItem(A, t, i, s) { (typeof PDFJSDev > "u" || PDFJSDev.test("TESTING")) && JA( i instanceof Uint8ClampedArray, 'AlternateCS.getRgbItem: Unsupported "dest" type.' ); const a = this.tmpBuf; this.tintFn(A, t, a, 0), this.base.getRgbItem(a, 0, i, s); } getRgbBuffer(A, t, i, s, a, n, r) { (typeof PDFJSDev > "u" || PDFJSDev.test("TESTING")) && JA( s instanceof Uint8ClampedArray, 'AlternateCS.getRgbBuffer: Unsupported "dest" type.' ); const g = this.tintFn, o = this.base, I = 1 / ((1 << n) - 1), l = o.numComps, c = o.usesZeroToOneRange, h = (o.isPassthrough(8) || !c) && r === 0; let C = h ? a : 0; const B = h ? s : new Uint8ClampedArray(l * i), E = this.numComps, Q = new Float32Array(E), u = new Float32Array(l); let f, d; for (f = 0; f < i; f++) { for (d = 0; d < E; d++) Q[d] = A[t++] * I; if (g(Q, 0, u, 0), c) for (d = 0; d < l; d++) B[C++] = u[d] * 255; else o.getRgbItem(u, 0, B, C), C += l; } h || o.getRgbBuffer(B, 0, i, s, a, 8, r); } getOutputLength(A, t) { return this.base.getOutputLength( A * this.base.numComps / this.numComps, t ); } } class xI extends ze { constructor(A) { super("Pattern", null), this.base = A; } isDefaultDecode(A, t) { FA("Should not call PatternCS.isDefaultDecode"); } } class CB extends ze { constructor(A, t, i) { super("Indexed", 1), this.base = A, this.highVal = t; const s = A.numComps * (t + 1); if (this.lookup = new Uint8Array(s), i instanceof vA) { const a = i.getBytes(s); this.lookup.set(a); } else if (typeof i == "string") for (let a = 0; a < s; ++a) this.lookup[a] = i.charCodeAt(a) & 255; else throw new K(`IndexedCS - unrecognized lookup table: ${i}`); } getRgbItem(A, t, i, s) { (typeof PDFJSDev > "u" || PDFJSDev.test("TESTING")) && JA( i instanceof Uint8ClampedArray, 'IndexedCS.getRgbItem: Unsupported "dest" type.' ); const { base: a, highVal: n, lookup: r } = this, g = Pe(Math.round(A[t]), 0, n) * a.numComps; a.getRgbBuffer(r, g, 1, i, s, 8, 0); } getRgbBuffer(A, t, i, s, a, n, r) { (typeof PDFJSDev > "u" || PDFJSDev.test("TESTING")) && JA( s instanceof Uint8ClampedArray, 'IndexedCS.getRgbBuffer: Unsupported "dest" type.' ); const { base: g, highVal: o, lookup: I } = this, { numComps: l } = g, c = g.getOutputLength(l, r); for (let h = 0; h < i; ++h) { const C = Pe(Math.round(A[t++]), 0, o) * l; g.getRgbBuffer(I, C, 1, s, a, 8, r), a += c; } } getOutputLength(A, t) { return this.base.getOutputLength(A * this.base.numComps, t); } isDefaultDecode(A, t) { return Array.isArray(A) ? A.length !== 2 ? (b("Decode map length is not correct"), !0) : !Number.isInteger(t) || t < 1 ? (b("Bits per component is not correct"), !0) : A[0] === 0 && A[1] === (1 << t) - 1 : !0; } } class BB extends ze { constructor() { super("DeviceGray", 1); } getRgbItem(A, t, i, s) { (typeof PDFJSDev > "u" || PDFJSDev.test("TESTING")) && JA( i instanceof Uint8ClampedArray, 'DeviceGrayCS.getRgbItem: Unsupported "dest" type.' ); const a = A[t] * 255; i[s] = i[s + 1] = i[s + 2] = a; } getRgbBuffer(A, t, i, s, a, n, r) { (typeof PDFJSDev > "u" || PDFJSDev.test("TESTING")) && JA( s instanceof Uint8ClampedArray, 'DeviceGrayCS.getRgbBuffer: Unsupported "dest" type.' ); const g = 255 / ((1 << n) - 1); let o = t, I = a; for (let l = 0; l < i; ++l) { const c = g * A[o++]; s[I++] = c, s[I++] = c, s[I++] = c, I += r; } } getOutputLength(A, t) { return A * (3 + t); } } class QB extends ze { constructor() { super("DeviceRGB", 3); } getRgbItem(A, t, i, s) { (typeof PDFJSDev > "u" || PDFJSDev.test("TESTING")) && JA( i instanceof Uint8ClampedArray, 'DeviceRgbCS.getRgbItem: Unsupported "dest" type.' ), i[s] = A[t] * 255, i[s + 1] = A[t + 1] * 255, i[s + 2] = A[t + 2] * 255; } getRgbBuffer(A, t, i, s, a, n, r) { if ((typeof PDFJSDev > "u" || PDFJSDev.test("TESTING")) && JA( s instanceof Uint8ClampedArray, 'DeviceRgbCS.getRgbBuffer: Unsupported "dest" type.' ), n === 8 && r === 0) { s.set(A.subarray(t, t + i * 3), a); return; } const g = 255 / ((1 << n) - 1); let o = t, I = a; for (let l = 0; l < i; ++l) s[I++] = g * A[o++], s[I++] = g * A[o++], s[I++] = g * A[o++], I += r; } getOutputLength(A, t) { return A * (3 + t) / 3 | 0; } isPassthrough(A) { return A === 8; } } class EB extends ze { constructor() { super("DeviceRGBA", 4); } getOutputLength(A, t) { return A * 4; } isPassthrough(A) { return A === 8; } fillRgb(A, t, i, s, a, n, r, g, o) { (typeof PDFJSDev > "u" || PDFJSDev.test("TESTING")) && JA( A instanceof Uint8ClampedArray, 'DeviceRgbaCS.fillRgb: Unsupported "dest" type.' ), i !== a || t !== s ? cB( g, A, t, i, s, a, o ) : lB(g, A, o); } } var D0, Fg; class Il extends ze { constructor() { super("DeviceCMYK", 4); NA(this, D0); } getRgbItem(t, i, s, a) { (typeof PDFJSDev > "u" || PDFJSDev.test("TESTING")) && JA( s instanceof Uint8ClampedArray, 'DeviceCmykCS.getRgbItem: Unsupported "dest" type.' ), rA(this, D0, Fg).call(this, t, i, 1, s, a); } getRgbBuffer(t, i, s, a, n, r, g) { (typeof PDFJSDev > "u" || PDFJSDev.test("TESTING")) && JA( a instanceof Uint8ClampedArray, 'DeviceCmykCS.getRgbBuffer: Unsupported "dest" type.' ); const o = 1 / ((1 << r) - 1); for (let I = 0; I < s; I++) rA(this, D0, Fg).call(this, t, i, o, a, n), i += 4, n += 3 + g; } getOutputLength(t, i) { return t / 4 * (3 + i) | 0; } } D0 = new WeakSet(), // The coefficients below was found using numerical analysis: the method of // steepest descent for the sum((f_i - color_value_i)^2) for r/g/b colors, // where color_value is the tabular value from the table of sampled RGB colors // from CMYK US Web Coated (SWOP) colorspace, and f_i is the corresponding // CMYK color conversion using the estimation below: // f(A, B,.. N) = Acc+Bcm+Ccy+Dck+c+Fmm+Gmy+Hmk+Im+Jyy+Kyk+Ly+Mkk+Nk+255 Fg = function(t, i, s, a, n) { const r = t[i] * s, g = t[i + 1] * s, o = t[i + 2] * s, I = t[i + 3] * s; a[n] = 255 + r * (-4.387332384609988 * r + 54.48615194189176 * g + 18.82290502165302 * o + 212.25662451639585 * I + -285.2331026137004) + g * (1.7149763477362134 * g - 5.6096736904047315 * o + -17.873870861415444 * I - 5.497006427196366) + o * (-2.5217340131683033 * o - 21.248923337353073 * I + 17.5119270841813) + I * (-21.86122147463605 * I - 189.48180835922747), a[n + 1] = 255 + r * (8.841041422036149 * r + 60.118027045597366 * g + 6.871425592049007 * o + 31.159100130055922 * I + -79.2970844816548) + g * (-15.310361306967817 * g + 17.575251261109482 * o + 131.35250912493976 * I - 190.9453302588951) + o * (4.444339102852739 * o + 9.8632861493405 * I - 24.86741582555878) + I * (-20.737325471181034 * I - 187.80453709719578), a[n + 2] = 255 + r * (0.8842522430003296 * r + 8.078677503112928 * g + 30.89978309703729 * o - 0.23883238689178934 * I + -14.183576799673286) + g * (10.49593273432072 * g + 63.02378494754052 * o + 50.606957656360734 * I - 112.23884253719248) + o * (0.03296041114873217 * o + 115.60384449646641 * I + -193.58209356861505) + I * (-22.33816807309886 * I - 180.12613974708367); }; var k0, Rg; class fB extends ze { constructor(t, i, s) { super("CalGray", 1); NA(this, k0); if (!t) throw new K( "WhitePoint missing - required for color space CalGray" ); if ([this.XW, this.YW, this.ZW] = t, [this.XB, this.YB, this.ZB] = i || [0, 0, 0], this.G = s || 1, this.XW < 0 || this.ZW < 0 || this.YW !== 1) throw new K( `Invalid WhitePoint components for ${this.name}, no fallback available` ); (this.XB < 0 || this.YB < 0 || this.ZB < 0) && (WA(`Invalid BlackPoint for ${this.name}, falling back to default.`), this.XB = this.YB = this.ZB = 0), (this.XB !== 0 || this.YB !== 0 || this.ZB !== 0) && b( `${this.name}, BlackPoint: XB: ${this.XB}, YB: ${this.YB}, ZB: ${this.ZB}, only default values are supported.` ), this.G < 1 && (WA( `Invalid Gamma: ${this.G} for ${this.name}, falling back to default.` ), this.G = 1); } getRgbItem(t, i, s, a) { (typeof PDFJSDev > "u" || PDFJSDev.test("TESTING")) && JA( s instanceof Uint8ClampedArray, 'CalGrayCS.getRgbItem: Unsupported "dest" type.' ), rA(this, k0, Rg).call(this, t, i, s, a, 1); } getRgbBuffer(t, i, s, a, n, r, g) { (typeof PDFJSDev > "u" || PDFJSDev.test("TESTING")) && JA( a instanceof Uint8ClampedArray, 'CalGrayCS.getRgbBuffer: Unsupported "dest" type.' ); const o = 1 / ((1 << r) - 1); for (let I = 0; I < s; ++I) rA(this, k0, Rg).call(this, t, i, a, n, o), i += 1, n += 3 + g; } getOutputLength(t, i) { return t * (3 + i); } } k0 = new WeakSet(), Rg = function(t, i, s, a, n) { const g = (t[i] * n) ** this.G, o = this.YW * g, I = Math.max(295.8 * o ** 0.3333333333333333 - 40.8, 0); s[a] = I, s[a + 1] = I, s[a + 2] = I; }; var S0, F0, Ir, cr, R0, Ia, G0, lr, Qe, Os, cl, ll, Sn, Zs, hl, Cl, Bl, Ng; const ye = class ye extends ze { constructor(t, i, s, a) { super("CalRGB", 3); NA(this, Qe); if (!t) throw new K( "WhitePoint missing - required for color space CalRGB" ); const [n, r, g] = this.whitePoint = t, [o, I, l] = this.blackPoint = i || new Float32Array(3); if ([this.GR, this.GG, this.GB] = s || new Float32Array([1, 1, 1]), [ this.MXA, this.MYA, this.MZA, this.MXB, this.MYB, this.MZB, this.MXC, this.MYC, this.MZC ] = a || new Float32Array([1, 0, 0, 0, 1, 0, 0, 0, 1]), n < 0 || g < 0 || r !== 1) throw new K( `Invalid WhitePoint components for ${this.name}, no fallback available` ); (o < 0 || I < 0 || l < 0) && (WA( `Invalid BlackPoint for ${this.name} [${o}, ${I}, ${l}], falling back to default.` ), this.blackPoint = new Float32Array(3)), (this.GR < 0 || this.GG < 0 || this.GB < 0) && (WA( `Invalid Gamma [${this.GR}, ${this.GG}, ${this.GB}] for ${this.name}, falling back to default.` ), this.GR = this.GG = this.GB = 1); } getRgbItem(t, i, s, a) { (typeof PDFJSDev > "u" || PDFJSDev.test("TESTING")) && JA( s instanceof Uint8ClampedArray, 'CalRGBCS.getRgbItem: Unsupported "dest" type.' ), rA(this, Qe, Ng).call(this, t, i, s, a, 1); } getRgbBuffer(t, i, s, a, n, r, g) { (typeof PDFJSDev > "u" || PDFJSDev.test("TESTING")) && JA( a instanceof Uint8ClampedArray, 'CalRGBCS.getRgbBuffer: Unsupported "dest" type.' ); const o = 1 / ((1 << r) - 1); for (let I = 0; I < s; ++I) rA(this, Qe, Ng).call(this, t, i, a, n, o), i += 3, n += 3 + g; } getOutputLength(t, i) { return t * (3 + i) / 3 | 0; } }; S0 = new WeakMap(), F0 = new WeakMap(), Ir = new WeakMap(), cr = new WeakMap(), R0 = new WeakMap(), Ia = new WeakMap(), G0 = new WeakMap(), lr = new WeakMap(), Qe = new WeakSet(), Os = function(t, i, s) { s[0] = t[0] * i[0] + t[1] * i[1] + t[2] * i[2], s[1] = t[3] * i[0] + t[4] * i[1] + t[5] * i[2], s[2] = t[6] * i[0] + t[7] * i[1] + t[8] * i[2]; }, cl = function(t, i, s) { s[0] = i[0] * 1 / t[0], s[1] = i[1] * 1 / t[1], s[2] = i[2] * 1 / t[2]; }, ll = function(t, i, s) { s[0] = i[0] * 0.95047 / t[0], s[1] = i[1] * 1 / t[1], s[2] = i[2] * 1.08883 / t[2]; }, Sn = function(t) { return t <= 31308e-7 ? Pe(12.92 * t, 0, 1) : t >= 0.99554525 ? 1 : Pe((1 + 0.055) * t ** (1 / 2.4) - 0.055, 0, 1); }, Zs = function(t) { return t < 0 ? -rA(this, Qe, Zs).call(this, -t) : t > 8 ? ((t + 16) / 116) ** 3 : t * IA(ye, lr); }, hl = function(t, i, s) { if (t[0] === 0 && t[1] === 0 && t[2] === 0) { s[0] = i[0], s[1] = i[1], s[2] = i[2]; return; } const a = rA(this, Qe, Zs).call(this, 0), n = a, r = rA(this, Qe, Zs).call(this, t[0]), g = a, o = rA(this, Qe, Zs).call(this, t[1]), I = a, l = rA(this, Qe, Zs).call(this, t[2]), c = (1 - n) / (1 - r), h = 1 - c, C = (1 - g) / (1 - o), B = 1 - C, E = (1 - I) / (1 - l), Q = 1 - E; s[0] = i[0] * c + h, s[1] = i[1] * C + B, s[2] = i[2] * E + Q; }, Cl = function(t, i, s) { if (t[0] === 1 && t[2] === 1) { s[0] = i[0], s[1] = i[1], s[2] = i[2]; return; } const a = s; rA(this, Qe, Os).call(this, IA(ye, S0), i, a); const n = IA(ye, R0); rA(this, Qe, cl).call(this, t, a, n), rA(this, Qe, Os).call(this, IA(ye, F0), n, s); }, Bl = function(t, i, s) { const a = s; rA(this, Qe, Os).call(this, IA(ye, S0), i, a); const n = IA(ye, R0); rA(this, Qe, ll).call(this, t, a, n), rA(this, Qe, Os).call(this, IA(ye, F0), n, s); }, Ng = function(t, i, s, a, n) { const r = Pe(t[i] * n, 0, 1), g = Pe(t[i + 1] * n, 0, 1), o = Pe(t[i + 2] * n, 0, 1), I = r === 1 ? 1 : r ** this.GR, l = g === 1 ? 1 : g ** this.GG, c = o === 1 ? 1 : o ** this.GB, h = this.MXA * I + this.MXB * l + this.MXC * c, C = this.MYA * I + this.MYB * l + this.MYC * c, B = this.MZA * I + this.MZB * l + this.MZC * c, E = IA(ye, Ia); E[0] = h, E[1] = C, E[2] = B; const Q = IA(ye, G0); rA(this, Qe, Cl).call(this, this.whitePoint, E, Q); const u = IA(ye, Ia); rA(this, Qe, hl).call(this, this.blackPoint, Q, u); const f = IA(ye, G0); rA(this, Qe, Bl).call(this, IA(ye, cr), u, f); const d = IA(ye, Ia); rA(this, Qe, Os).call(this, IA(ye, Ir), f, d), s[a] = rA(this, Qe, Sn).call(this, d[0]) * 255, s[a + 1] = rA(this, Qe, Sn).call(this, d[1]) * 255, s[a + 2] = rA(this, Qe, Sn).call(this, d[2]) * 255; }, // See http://www.brucelindbloom.com/index.html?Eqn_ChromAdapt.html for these // matrices. // prettier-ignore NA(ye, S0, new Float32Array([ 0.8951, 0.2664, -0.1614, -0.7502, 1.7135, 0.0367, 0.0389, -0.0685, 1.0296 ])), // prettier-ignore NA(ye, F0, new Float32Array([ 0.9869929, -0.1470543, 0.1599627, 0.4323053, 0.5183603, 0.0492912, -85287e-7, 0.0400428, 0.9684867 ])), // See http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html. // prettier-ignore NA(ye, Ir, new Float32Array([ 3.2404542, -1.5371385, -0.4985314, -0.969266, 1.8760108, 0.041556, 0.0556434, -0.2040259, 1.0572252 ])), NA(ye, cr, new Float32Array([1, 1, 1])), NA(ye, R0, new Float32Array(3)), NA(ye, Ia, new Float32Array(3)), NA(ye, G0, new Float32Array(3)), NA(ye, lr, (24 / 116) ** 3 / 8); let Gg = ye; var St, Fn, Rn, Mg; class uB extends ze { constructor(t, i, s) { super("Lab", 3); NA(this, St); if (!t) throw new K( "WhitePoint missing - required for color space Lab" ); if ([this.XW, this.YW, this.ZW] = t, [this.amin, this.amax, this.bmin, this.bmax] = s || [ -100, 100, -100, 100 ], [this.XB, this.YB, this.ZB] = i || [0, 0, 0], this.XW < 0 || this.ZW < 0 || this.YW !== 1) throw new K( "Invalid WhitePoint components, no fallback available" ); (this.XB < 0 || this.YB < 0 || this.ZB < 0) && (WA("Invalid BlackPoint, falling back to default"), this.XB = this.YB = this.ZB = 0), (this.amin > this.amax || this.bmin > this.bmax) && (WA("Invalid Range, falling back to defaults"), this.amin = -100, this.amax = 100, this.bmin = -100, this.bmax = 100); } getRgbItem(t, i, s, a) { (typeof PDFJSDev > "u" || PDFJSDev.test("TESTING")) && JA( s instanceof Uint8ClampedArray, 'LabCS.getRgbItem: Unsupported "dest" type.' ), rA(this, St, Mg).call(this, t, i, !1, s, a); } getRgbBuffer(t, i, s, a, n, r, g) { (typeof PDFJSDev > "u" || PDFJSDev.test("TESTING")) && JA( a instanceof Uint8ClampedArray, 'LabCS.getRgbBuffer: Unsupported "dest" type.' ); const o = (1 << r) - 1; for (let I = 0; I < s; I++) rA(this, St, Mg).call(this, t, i, o, a, n), i += 3, n += 3 + g; } getOutputLength(t, i) { return t * (3 + i) / 3 | 0; } isDefaultDecode(t, i) { return !0; } get usesZeroToOneRange() { return iA(this, "usesZeroToOneRange", !1); } } St = new WeakSet(), // Function g(x) from spec Fn = function(t) { return t >= 6 / 29 ? t ** 3 : 108 / 841 * (t - 4 / 29); }, Rn = function(t, i, s, a) { return s + t * (a - s) / i; }, // If decoding is needed maxVal should be 2^bits per component - 1. Mg = function(t, i, s, a, n) { let r = t[i], g = t[i + 1], o = t[i + 2]; s !== !1 && (r = rA(this, St, Rn).call(this, r, s, 0, 100), g = rA(this, St, Rn).call(this, g, s, this.amin, this.amax), o = rA(this, St, Rn).call(this, o, s, this.bmin, this.bmax)), g > this.amax ? g = this.amax : g < this.amin && (g = this.amin), o > this.bmax ? o = this.bmax : o < this.bmin && (o = this.bmin); const I = (r + 16) / 116, l = I + g / 500, c = I - o / 200, h = this.XW * rA(this, St, Fn).call(this, l), C = this.YW * rA(this, St, Fn).call(this, I), B = this.ZW * rA(this, St, Fn).call(this, c); let E, Q, u; this.ZW < 1 ? (E = h * 3.1339 + C * -1.617 + B * -0.4906, Q = h * -0.9785 + C * 1.916 + B * 0.0333, u = h * 0.072 + C * -0.229 + B * 1.4057) : (E = h * 3.2406 + C * -1.5372 + B * -0.4986, Q = h * -0.9689 + C * 1.8758 + B * 0.0415, u = h * 0.0557 + C * -0.204 + B * 1.057), a[n] = Math.sqrt(E) * 255, a[n + 1] = Math.sqrt(Q) * 255, a[n + 2] = Math.sqrt(u) * 255; }; function Ql(e) { const A = new XMLHttpRequest(); return A.open("GET", e, !1), A.responseType = "arraybuffer", A.send(null), A.response; } var oi, Pi, ca, la, hr; const Qs = class Qs extends ze { constructor(t, i, s) { if (!Qs.isUsable) throw new Error("No ICC color space support"); super(i, s); NA(this, oi); NA(this, Pi); let a; switch (s) { case 1: a = Zr.Gray8, le(this, Pi, (n, r, g) => eB(IA(this, oi), n[r] * 255, g)); break; case 3: a = Zr.RGB8, le(this, Pi, (n, r, g) => tB( IA(this, oi), n[r] * 255, n[r + 1] * 255, n[r + 2] * 255, g )); break; case 4: a = Zr.CMYK, le(this, Pi, (n, r, g) => iB( IA(this, oi), n[r] * 255, n[r + 1] * 255, n[r + 2] * 255, n[r + 3] * 255, g )); break; default: throw new Error(`Unsupported number of components: ${s}`); } if (le(this, oi, sB( t, a, nB.Perceptual )), !IA(this, oi)) throw new Error("Failed to create ICC color space"); IA(Qs, hr).register(this, IA(this, oi)); } getRgbHex(t, i) { return IA(this, Pi).call( this, t, i, /* css */ !0 ), de._cssColor; } getRgbItem(t, i, s, a) { de._destBuffer = s, de._destOffset = a, de._destLength = 3, IA(this, Pi).call( this, t, i, /* css */ !1 ), de._destBuffer = null; } getRgbBuffer(t, i, s, a, n, r, g) { if (t = t.subarray(i, i + s * this.numComps), r !== 8) { const o = 255 / ((1 << r) - 1); for (let I = 0, l = t.length; I < l; I++) t[I] *= o; } de._mustAddAlpha = g && a.buffer === t.buffer, de._destBuffer = a, de._destOffset = n, de._destLength = s * (3 + g), AB(IA(this, oi), t), de._mustAddAlpha = !1, de._destBuffer = null; } getOutputLength(t, i) { return t / this.numComps * (3 + i) | 0; } static setOptions({ useWasm: t, useWorkerFetch: i, wasmUrl: s }) { if (!i) { le(this, ca, !1); return; } le(this, ca, t), le(this, la, s); } static get isUsable() { let t = !1; if (IA(this, ca)) if (IA(this, la)) try { this._module = oB({ module: Ql(`${IA(this, la)}qcms_bg.wasm`) }), t = !!this._module, de._memory = this._module.memory, de._makeHexColor = ne.makeHexColor; } catch (i) { b(`ICCBased color space: "${i}".`); } else b("No ICC color space support due to missing `wasmUrl` API option"); return iA(