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,908 lines 3.6 MB
var OL = Object.defineProperty; var xu = (Z) => { throw TypeError(Z); }; var vL = (Z, l, t) => l in Z ? OL(Z, l, { enumerable: !0, configurable: !0, writable: !0, value: t }) : Z[l] = t; var X = (Z, l, t) => vL(Z, typeof l != "symbol" ? l + "" : l, t), FJ = (Z, l, t) => l.has(Z) || xu("Cannot " + t); var U = (Z, l, t) => (FJ(Z, l, "read from private field"), t ? t.call(Z) : l.get(Z)), W = (Z, l, t) => l.has(Z) ? xu("Cannot add the same private member more than once") : l instanceof WeakSet ? l.add(Z) : l.set(Z, t), e = (Z, l, t, d) => (FJ(Z, l, "write to private field"), d ? d.call(Z, t) : l.set(Z, t), t), R = (Z, l, t) => (FJ(Z, l, "access private method"), t); var Dl = (Z, l, t, d) => ({ set _(F) { e(Z, l, F, t); }, get _() { return U(Z, l, d); } }); import { openBlock as Lc, createElementBlock as rc, createStaticVNode as Gm, createElementVNode as p, createTextVNode as ku, defineComponent as Vb, onMounted as vp, watch as Ko, withDirectives as Pp, vShow as fp, inject as QM, createVNode as tW, unref as JJ, ref as yu, shallowRef as HQ, provide as Iu, onUpdated as PL, nextTick as fL, onUnmounted as AL, normalizeClass as qL, renderSlot as _L, isRef as $L } from "vue"; const o = { test: (Z) => /GENERIC/.test(Z), eval: (Z) => Z === "BUNDLE_VERSION" ? "5.7.284" : null }; typeof Promise.withResolvers != "function" && (Promise.withResolvers = function() { let Z, l; return { promise: new this((d, F) => { Z = d, l = F; }), resolve: Z, reject: l }; }); typeof Promise.try != "function" && (Promise.try = function(Z, ...l) { return new this((t) => { t(Z(...l)); }); }); const cm = "auto", Ap = 1, Cu = 1.1, iM = 0.1, ZM = 25, sJ = 0, lr = 1.25, zu = 40, Du = 5, yt = { UNKNOWN: 0, NORMAL: 1, CHANGING: 2, FULLSCREEN: 3 }, sl = { UNKNOWN: -1, NONE: 0, THUMBS: 1, // Default value. OUTLINE: 2, ATTACHMENTS: 3, LAYERS: 4 }, zF = { DISABLE: 0, ENABLE: 1, ENABLE_PERMISSIONS: 2 }, nl = { UNKNOWN: -1, VERTICAL: 0, // Default value. HORIZONTAL: 1, WRAPPED: 2, PAGE: 3 }, Cl = { UNKNOWN: -1, NONE: 0, // Default value. ODD: 1, EVEN: 2 }, fd = { SELECT: 0, // The default value. HAND: 1, ZOOM: 2 }, tr = /\bprint\s*\(/; function dr(Z, l) { let t = Z.offsetParent; if (!t) { console.error("offsetParent is not set -- cannot scroll"); return; } let d = Z.offsetTop + Z.clientTop, F = Z.offsetLeft + Z.clientLeft; for (; t.clientHeight === t.scrollHeight && t.clientWidth === t.scrollWidth; ) if (d += t.offsetTop, F += t.offsetLeft, t = t.offsetParent, !t) return; l && (l.top !== void 0 && (d += l.top), l.left !== void 0 && (F += l.left, t.scrollLeft = F)), t.scrollTop = d; } function aM(Z, l, t = void 0) { const d = function(n) { s || (s = window.requestAnimationFrame(function() { s = null; const i = Z.scrollLeft, a = F.lastX; i !== a && (F.right = i > a), F.lastX = i; const c = Z.scrollTop, V = F.lastY; c !== V && (F.down = c > V), F.lastY = c, l(F); })); }, F = { right: !0, down: !0, lastX: Z.scrollLeft, lastY: Z.scrollTop, _eventHandler: d }; let s = null; return Z.addEventListener("scroll", d, { useCapture: !0, signal: t }), t == null || t.addEventListener( "abort", () => window.cancelAnimationFrame(s), { once: !0 } ), F; } function pm(Z) { const l = /* @__PURE__ */ new Map(); for (const [t, d] of new URLSearchParams(Z)) l.set(t.toLowerCase(), d); return l; } const wu = /[\x00-\x1F]/g; function F0(Z, l = !1) { return wu.test(Z) ? l ? Z.replaceAll(wu, (t) => t === "\0" ? "" : " ") : Z.replaceAll("\0", "") : Z; } function DF(Z, l, t = 0) { let d = t, F = Z.length - 1; if (F < 0 || !l(Z[F])) return Z.length; if (l(Z[d])) return d; for (; d < F; ) { const s = d + F >> 1, n = Z[s]; l(n) ? F = s : d = s + 1; } return d; } function gu(Z) { if (Math.floor(Z) === Z) return [Z, 1]; const l = 1 / Z, t = 8; if (l > t) return [1, t]; if (Math.floor(l) === l) return [1, l]; const d = Z > 1 ? l : Z; let F = 0, s = 1, n = 1, Q = 1; for (; ; ) { const a = F + n, c = s + Q; if (c > t) break; d <= a / c ? (n = a, Q = c) : (F = a, s = c); } let i; return d - F / s < n / Q - d ? i = d === Z ? [F, s] : [s, F] : i = d === Z ? [n, Q] : [Q, n], i; } function Mb(Z, l) { return Z - Z % l; } function Ur({ view: Z, userUnit: l, rotate: t }) { const [d, F, s, n] = Z, Q = t % 180 !== 0, i = (s - d) / 72 * l, a = (n - F) / 72 * l; return { width: Q ? a : i, height: Q ? i : a }; } function Fr(Z, l, t) { if (Z < 2) return Z; let d = l[Z].div, F = d.offsetTop + d.clientTop; F >= t && (d = l[Z - 1].div, F = d.offsetTop + d.clientTop); for (let s = Z - 2; s >= 0 && (d = l[s].div, !(d.offsetTop + d.clientTop + d.clientHeight <= F)); --s) Z = s; return Z; } function eM({ scrollEl: Z, views: l, sortByVisibility: t = !1, horizontal: d = !1, rtl: F = !1 }) { const s = Z.scrollTop, n = s + Z.clientHeight, Q = Z.scrollLeft, i = Q + Z.clientWidth; function a(J) { const G = J.div; return G.offsetTop + G.clientTop + G.clientHeight > s; } function c(J) { const G = J.div, u = G.offsetLeft + G.clientLeft, E = u + G.clientWidth; return F ? u < i : E > Q; } const V = [], m = /* @__PURE__ */ new Set(), N = l.length; let h = DF( l, d ? c : a ); h > 0 && h < N && !d && (h = Fr( h, l, s )); let B = d ? i : -1; for (let J = h; J < N; J++) { const G = l[J], u = G.div, E = u.offsetLeft + u.clientLeft, M = u.offsetTop + u.clientTop, Y = u.clientWidth, L = u.clientHeight, T = E + Y, r = M + L; if (B === -1) r >= n && (B = r); else if ((d ? E : M) > B) break; if (r <= s || M >= n || T <= Q || E >= i) continue; const k = Math.max(0, s - M), w = Math.max(0, Q - E), O = k + Math.max(0, r - n), K = w + Math.max(0, T - i), Ul = (L - O) / L, D = (Y - K) / Y, g = Ul * D * 100 | 0; V.push({ id: G.id, x: E, y: M, visibleArea: ( // We only specify which part of the page is visible when it's not // the full page, as there is no point in handling a partial page // rendering otherwise. g === 100 ? null : { minX: w, minY: k, maxX: Math.min(T, i) - E, maxY: Math.min(r, n) - M } ), view: G, percent: g, widthPercent: D * 100 | 0 }), m.add(G.id); } const b = V[0], S = V.at(-1); return t && V.sort(function(J, G) { const u = J.percent - G.percent; return Math.abs(u) > 1e-3 ? -u : J.id - G.id; }), { first: b, last: S, views: V, ids: m }; } function cM(Z) { let l = Math.hypot(Z.deltaX, Z.deltaY); const t = Math.atan2(Z.deltaY, Z.deltaX); return -0.25 * Math.PI < t && t < 0.75 * Math.PI && (l = -l), l; } function sr(Z) { const l = Z.deltaMode; let t = cM(Z); const d = 30, F = 30; return l === WheelEvent.DOM_DELTA_PIXEL ? t /= d * F : l === WheelEvent.DOM_DELTA_LINE && (t /= F), t; } function Oo(Z) { return Number.isInteger(Z) && Z % 90 === 0; } function VM(Z) { return Number.isInteger(Z) && Object.values(nl).includes(Z) && Z !== nl.UNKNOWN; } function RM(Z) { return Number.isInteger(Z) && Object.values(Cl).includes(Z) && Z !== Cl.UNKNOWN; } function GJ(Z) { return Z.width <= Z.height; } const nr = new Promise(function(Z) { if (typeof o < "u" && o.test("LIB") && typeof window > "u") { setTimeout(Z, 20); return; } window.requestAnimationFrame(Z); }), qp = typeof o < "u" && o.test("LIB") && typeof document > "u" ? null : document.documentElement.style; var OQ, OZ, vQ, Z0, vZ; class Qr { constructor(l) { W(this, OQ, null); W(this, OZ, null); W(this, vQ, 0); W(this, Z0, null); W(this, vZ, !0); e(this, OQ, l.classList), e(this, Z0, l.style); } get percent() { return U(this, vQ); } set percent(l) { if (e(this, vQ, l), isNaN(l)) { U(this, OQ).add("indeterminate"); return; } U(this, OQ).remove("indeterminate"), U(this, Z0).setProperty("--vue-pdfjs-progressBar-percent", `${U(this, vQ)}%`); } setWidth(l) { if (!l) return; const d = l.parentNode.offsetWidth - l.offsetWidth; d > 0 && U(this, Z0).setProperty( "--vue-pdfjs-progressBar-end-offset", `${d}px` ); } setDisableAutoFetch(l = ( /* ms = */ 5e3 )) { U(this, vQ) === 100 || isNaN(U(this, vQ)) || (U(this, OZ) && clearTimeout(U(this, OZ)), this.show(), e(this, OZ, setTimeout(() => { e(this, OZ, null), this.hide(); }, l))); } hide() { U(this, vZ) && (e(this, vZ, !1), U(this, OQ).add("hidden")); } show() { U(this, vZ) || (e(this, vZ, !0), U(this, OQ).remove("hidden")); } } OQ = new WeakMap(), OZ = new WeakMap(), vQ = new WeakMap(), Z0 = new WeakMap(), vZ = new WeakMap(); function ju() { let Z = document, l = Z.activeElement || Z.querySelector(":focus"); for (; l != null && l.shadowRoot; ) Z = l.shadowRoot, l = Z.activeElement || Z.querySelector(":focus"); return l; } function WM(Z) { let l = nl.VERTICAL, t = Cl.NONE; switch (Z) { case "SinglePage": l = nl.PAGE; break; case "OneColumn": break; case "TwoPageLeft": l = nl.PAGE; case "TwoColumnLeft": t = Cl.ODD; break; case "TwoPageRight": l = nl.PAGE; case "TwoColumnRight": t = Cl.EVEN; break; } return { scrollMode: l, spreadMode: t }; } function ir(Z) { switch (Z) { case "UseNone": return sl.NONE; case "UseThumbs": return sl.THUMBS; case "UseOutlines": return sl.OUTLINE; case "UseAttachments": return sl.ATTACHMENTS; case "UseOC": return sl.LAYERS; } return sl.NONE; } function qs(Z, l, t = null) { Z.classList.toggle("toggled", l), Z.setAttribute("aria-checked", l), t == null || t.classList.toggle("hidden", !l); } function Tb(Z, l, t = null) { Z.classList.toggle("selected", l), Z.setAttribute("aria-selected", l), t == null || t.classList.toggle("hidden", !l); } function dF(Z, l, t = null) { Z.classList.toggle("toggled", l), Z.setAttribute("aria-expanded", l), t == null || t.classList.toggle("hidden", !l); } const Yb = typeof o < "u" && o.test("MOZCENTRAL") ? Math.fround : function() { if (typeof o < "u" && o.test("LIB") && typeof document > "u") return (l) => l; const Z = document.createElement("div"); return Z.style.width = "round(down, calc(1.6666666666666665 * 792px), 1px)", Z.style.width === "calc(1320px)" ? Math.fround : (l) => l; }(), Ql = { INITIAL: 0, RUNNING: 1, PAUSED: 2, FINISHED: 3 }; class vo { constructor() { /** * Unique ID for rendering queue. * @type {string} */ X(this, "renderingId", ""); /** * @type {import("../src/display/api").RenderTask | null} */ X(this, "renderTask", null); /** * @type {function | null} */ X(this, "resume", null); if ((typeof o > "u" || o.test("TESTING")) && this.constructor === vo) throw new Error("Cannot initialize RenderableView."); } /** * @type {number} */ get renderingState() { throw new Error("Abstract getter `renderingState` accessed"); } /** * @param {number} state */ set renderingState(l) { throw new Error("Abstract setter `renderingState` accessed"); } /** * @returns {Promise} Resolved on draw completion. */ async draw() { throw new Error("Not implemented: draw"); } } if (typeof o > "u" || o.test("GENERIC")) { var HZ = /* @__PURE__ */ new Map(); const { maxTouchPoints: Z, platform: l, userAgent: t } = navigator, d = /Android/.test(t); (/\b(iPad|iPhone|iPod)(?=;)/.test(t) || l === "MacIntel" && Z > 1 || d) && HZ.set("maxCanvasPixels", 5242880), d && HZ.set("useSystemFonts", !1); } const x = { BROWSER: 1, VIEWER: 2, API: 4, WORKER: 8, EVENT_DISPATCH: 16, PREFERENCE: 128 }, pJ = { BOOLEAN: 1, NUMBER: 2, OBJECT: 4, STRING: 8, UNDEFINED: 16 }, UF = { allowedGlobalEvents: { /** @type {Object} */ value: null, kind: x.BROWSER }, canvasMaxAreaInBytes: { /** @type {number} */ value: -1, kind: x.BROWSER + x.API }, isInAutomation: { /** @type {boolean} */ value: !1, kind: x.BROWSER }, localeProperties: { /** @type {Object} */ value: typeof o > "u" || o.test("GENERIC") ? { lang: navigator.language || "en-US" } : null, kind: x.BROWSER }, maxCanvasDim: { /** @type {number} */ value: 32767, kind: x.BROWSER + x.VIEWER }, nimbusDataStr: { /** @type {string} */ value: "", kind: x.BROWSER }, supportsCaretBrowsingMode: { /** @type {boolean} */ value: !1, kind: x.BROWSER }, supportsDocumentFonts: { /** @type {boolean} */ value: !0, kind: x.BROWSER }, supportsIntegratedFind: { /** @type {boolean} */ value: !1, kind: x.BROWSER }, supportsMouseWheelZoomCtrlKey: { /** @type {boolean} */ value: !0, kind: x.BROWSER }, supportsMouseWheelZoomMetaKey: { /** @type {boolean} */ value: !0, kind: x.BROWSER }, supportsPinchToZoom: { /** @type {boolean} */ value: !0, kind: x.BROWSER }, supportsPrinting: { /** @type {boolean} */ value: !0, kind: x.BROWSER }, toolbarDensity: { /** @type {number} */ value: 0, // 0 = "normal", 1 = "compact", 2 = "touch" kind: x.BROWSER + x.EVENT_DISPATCH }, altTextLearnMoreUrl: { /** @type {string} */ value: typeof o < "u" && o.test("MOZCENTRAL") ? "https://support.mozilla.org/1/firefox/%VERSION%/%OS%/%LOCALE%/pdf-alt-text" : "", kind: x.VIEWER + x.PREFERENCE }, annotationEditorMode: { /** @type {number} */ value: 0, kind: x.VIEWER + x.PREFERENCE }, annotationMode: { /** @type {number} */ value: 2, kind: x.VIEWER + x.PREFERENCE }, capCanvasAreaFactor: { /** @type {number} */ value: 200, kind: x.VIEWER + x.PREFERENCE }, commentLearnMoreUrl: { /** @type {string} */ value: typeof o > "u" || o.test("MOZCENTRAL") ? "https://support.mozilla.org/%LOCALE%/kb/view-pdf-files-firefox-or-choose-another-viewer#w_add-a-comment-to-a-pdf" : "", kind: x.VIEWER + x.PREFERENCE }, cursorToolOnLoad: { /** @type {number} */ value: 0, kind: x.VIEWER + x.PREFERENCE }, debuggerSrc: { /** @type {string} */ value: "./debugger.mjs", kind: x.VIEWER }, defaultZoomDelay: { /** @type {number} */ value: 400, kind: x.VIEWER + x.PREFERENCE }, defaultZoomValue: { /** @type {string} */ value: "", kind: x.VIEWER + x.PREFERENCE }, disableHistory: { /** @type {boolean} */ value: !1, kind: x.VIEWER }, disablePageLabels: { /** @type {boolean} */ value: !1, kind: x.VIEWER + x.PREFERENCE }, enableAltText: { /** @type {boolean} */ value: !1, kind: x.VIEWER + x.PREFERENCE }, enableAltTextModelDownload: { /** @type {boolean} */ value: !0, kind: x.VIEWER + x.PREFERENCE + x.EVENT_DISPATCH }, enableAutoLinking: { /** @type {boolean} */ value: !0, kind: x.VIEWER + x.PREFERENCE }, enableComment: { /** @type {boolean} */ value: typeof o > "u", kind: x.VIEWER + x.PREFERENCE }, enableDetailCanvas: { /** @type {boolean} */ value: !0, kind: x.VIEWER }, enableGuessAltText: { /** @type {boolean} */ value: !0, kind: x.VIEWER + x.PREFERENCE + x.EVENT_DISPATCH }, enableHighlightFloatingButton: { // We'll probably want to make some experiments before enabling this // in Firefox release, but it has to be temporary. // TODO: remove it when unnecessary. /** @type {boolean} */ value: typeof o > "u" || o.test("TESTING"), kind: x.VIEWER + x.PREFERENCE }, enableMerge: { /** @type {boolean} */ value: typeof o > "u" || o.test("TESTING"), kind: x.VIEWER + x.PREFERENCE }, enableNewAltTextWhenAddingImage: { /** @type {boolean} */ value: !0, kind: x.VIEWER + x.PREFERENCE }, enableNewBadge: { /** @type {boolean} */ value: typeof o > "u" || o.test("MOZCENTRAL"), kind: x.VIEWER + x.PREFERENCE }, enableOptimizedPartialRendering: { /** @type {boolean} */ value: !1, kind: x.VIEWER + x.PREFERENCE }, enablePermissions: { /** @type {boolean} */ value: !1, kind: x.VIEWER + x.PREFERENCE }, enablePrintAutoRotate: { /** @type {boolean} */ value: !0, kind: x.VIEWER + x.PREFERENCE }, enableScripting: { /** @type {boolean} */ value: typeof o > "u" || !o.test("CHROME"), kind: x.VIEWER + x.PREFERENCE }, enableSignatureEditor: { /** @type {boolean} */ value: typeof o > "u" || o.test("TESTING"), kind: x.VIEWER + x.PREFERENCE }, enableSplitMerge: { /** @type {boolean} */ value: typeof o > "u" || o.test("TESTING"), kind: x.VIEWER + x.PREFERENCE }, enableUpdatedAddImage: { // We'll probably want to make some experiments before enabling this // in Firefox release, but it has to be temporary. // TODO: remove it when unnecessary. /** @type {boolean} */ value: !1, kind: x.VIEWER + x.PREFERENCE }, externalLinkRel: { /** @type {string} */ value: "noopener noreferrer nofollow", kind: x.VIEWER }, externalLinkTarget: { /** @type {number} */ value: 0, kind: x.VIEWER + x.PREFERENCE }, highlightEditorColors: { /** @type {string} */ value: "yellow=#FFFF98,green=#53FFBC,blue=#80EBFF,pink=#FFCBE6,red=#FF4F5F,yellow_HCM=#FFFFCC,green_HCM=#53FFBC,blue_HCM=#80EBFF,pink_HCM=#F6B8FF,red_HCM=#C50043", kind: x.VIEWER + x.PREFERENCE }, historyUpdateUrl: { /** @type {boolean} */ value: !1, kind: x.VIEWER + x.PREFERENCE }, ignoreDestinationZoom: { /** @type {boolean} */ value: !1, kind: x.VIEWER + x.PREFERENCE }, imageResourcesPath: { /** @type {string} */ value: typeof o < "u" && o.test("MOZCENTRAL") ? "resource://pdf.js/web/images/" : "./images/", kind: x.VIEWER }, imagesRightClickMinSize: { /** @type {number} */ value: typeof o < "u" && // Firefox mobile does not support right-clicking on images, // see https://bugzilla.mozilla.org/show_bug.cgi?id=2014081. // This option is disabled by default outside of MOZCENTRAL // because it degrades the text selection experience in Chrome // and Safari. o.test("MOZCENTRAL && !GECKOVIEW") ? 16 : -1, kind: x.VIEWER + x.PREFERENCE }, maxCanvasPixels: { /** @type {number} */ value: 2 ** 25, kind: x.VIEWER }, minDurationToUpdateCanvas: { /** @type {number} */ value: 500, // ms kind: x.VIEWER }, forcePageColors: { /** @type {boolean} */ value: !1, kind: x.VIEWER + x.PREFERENCE }, pageColorsBackground: { /** @type {string} */ value: "Canvas", kind: x.VIEWER + x.PREFERENCE }, pageColorsForeground: { /** @type {string} */ value: "CanvasText", kind: x.VIEWER + x.PREFERENCE }, pdfBugEnabled: { /** @type {boolean} */ value: typeof o > "u" || o.test("TESTING"), kind: x.VIEWER + x.PREFERENCE }, printResolution: { /** @type {number} */ value: 150, kind: x.VIEWER }, sidebarViewOnLoad: { /** @type {number} */ value: -1, kind: x.VIEWER + x.PREFERENCE }, scrollModeOnLoad: { /** @type {number} */ value: -1, kind: x.VIEWER + x.PREFERENCE }, spreadModeOnLoad: { /** @type {number} */ value: -1, kind: x.VIEWER + x.PREFERENCE }, textLayerMode: { /** @type {number} */ value: 1, kind: x.VIEWER + x.PREFERENCE }, viewerCssTheme: { /** @type {number} */ value: typeof o < "u" && o.test("CHROME") ? 2 : 0, kind: x.VIEWER + x.PREFERENCE }, viewOnLoad: { /** @type {boolean} */ value: 0, kind: x.VIEWER + x.PREFERENCE }, cMapPacked: { /** @type {boolean} */ value: !0, kind: x.API }, cMapUrl: { /** @type {string} */ value: ( // eslint-disable-next-line no-nested-ternary typeof o > "u" ? "../external/bcmaps/" : o.test("MOZCENTRAL") ? "resource://pdf.js/web/cmaps/" : "../web/cmaps/" ), kind: x.API }, disableAutoFetch: { /** @type {boolean} */ value: !1, kind: x.API + x.PREFERENCE }, disableFontFace: { /** @type {boolean} */ value: !1, kind: x.API + x.PREFERENCE }, disableRange: { /** @type {boolean} */ value: !1, kind: x.API + x.PREFERENCE }, disableStream: { /** @type {boolean} */ value: !1, kind: x.API + x.PREFERENCE }, docBaseUrl: { /** @type {string} */ value: typeof o > "u" ? ( // NOTE: We cannot use the `updateUrlHash` function here, because of // the default preferences generation (see `gulpfile.mjs`). // However, the following line is *only* used in development mode. document.URL.split("#", 1)[0] ) : "", kind: x.API }, enableHWA: { /** @type {boolean} */ value: !0, kind: x.API + x.PREFERENCE }, enableWebGPU: { /** @type {boolean} */ value: !0, kind: x.API + x.PREFERENCE }, enableXfa: { /** @type {boolean} */ value: !0, kind: x.API + x.PREFERENCE }, fontExtraProperties: { /** @type {boolean} */ value: !1, kind: x.API }, iccUrl: { /** @type {string} */ value: ( // eslint-disable-next-line no-nested-ternary typeof o > "u" ? "../external/iccs/" : o.test("MOZCENTRAL") ? "resource://pdf.js/web/iccs/" : "../web/iccs/" ), kind: x.API }, isOffscreenCanvasSupported: { /** @type {boolean} */ value: !0, kind: x.API }, maxImageSize: { /** @type {number} */ value: -1, kind: x.API }, pdfBug: { /** @type {boolean} */ value: !1, kind: x.API }, standardFontDataUrl: { /** @type {string} */ value: ( // eslint-disable-next-line no-nested-ternary typeof o > "u" ? "../external/standard_fonts/" : o.test("MOZCENTRAL") ? "resource://pdf.js/web/standard_fonts/" : "../web/standard_fonts/" ), kind: x.API }, useSystemFonts: { // On Android, there is almost no chance to have the font we want so we // don't use the system fonts in this case (bug 1882613). /** @type {boolean|undefined} */ value: (typeof o > "u" ? window.isGECKOVIEW : o.test("GECKOVIEW")) ? !1 : void 0, kind: x.API, type: pJ.BOOLEAN + pJ.UNDEFINED }, verbosity: { /** @type {number} */ value: 1, kind: x.API }, wasmUrl: { /** @type {string} */ value: typeof o < "u" && o.test("MOZCENTRAL") ? "resource://pdf.js/web/wasm/" : "../web/wasm/", kind: x.API }, workerPort: { /** @type {Object} */ value: typeof o < "u" && o.test("MOZCENTRAL") && globalThis.pdfjsPreloadedWorker || null, kind: x.WORKER }, workerSrc: { /** @type {string} */ value: ( // eslint-disable-next-line no-nested-ternary typeof o > "u" ? "../src/pdf.worker.js" : o.test("MOZCENTRAL") ? "resource://pdf.js/build/pdf.worker.mjs" : "../build/pdf.worker.mjs" ), kind: x.WORKER } }; (typeof o > "u" || !o.test("MOZCENTRAL")) && (UF.defaultUrl = { /** @type {string} */ value: typeof o < "u" && o.test("CHROME") ? "" : "compressed.tracemonkey-pldi-09.pdf", kind: x.VIEWER }, UF.sandboxBundleSrc = { /** @type {string} */ value: typeof o > "u" ? "../build/dev-sandbox/pdf.sandbox.mjs" : "../build/pdf.sandbox.mjs", kind: x.VIEWER }, UF.enableFakeMLManager = { /** @type {boolean} */ value: !0, kind: x.VIEWER }); typeof o > "u" || o.test("GENERIC") ? UF.disablePreferences = { /** @type {boolean} */ value: typeof o < "u" && o.test("TESTING"), kind: x.VIEWER } : o.test("CHROME") && (UF.disableTelemetry = { /** @type {boolean} */ value: !1, kind: x.VIEWER + x.PREFERENCE }); if (typeof o > "u" || o.test("TESTING")) for (const Z in UF) { const { value: l, kind: t, type: d } = UF[Z]; if (t & x.PREFERENCE) { if (t === x.PREFERENCE) throw new Error(`Cannot use only "PREFERENCE" kind: ${Z}`); if (t & x.BROWSER) throw new Error(`Cannot mix "PREFERENCE" and "BROWSER" kind: ${Z}`); if (d !== void 0) throw new Error( `Cannot have \`type\`-field for "PREFERENCE" kind: ${Z}` ); if (typeof HZ == "object" && HZ.has(Z)) throw new Error( `Should not have compatibility-value for "PREFERENCE" kind: ${Z}` ); if (typeof l != "boolean" && typeof l != "string" && !Number.isInteger(l)) throw new Error(`Invalid value for "PREFERENCE" kind: ${Z}`); } else if (t & x.BROWSER) { if (d !== void 0) throw new Error( `Cannot have \`type\`-field for "BROWSER" kind: ${Z}` ); if (typeof HZ == "object" && HZ.has(Z)) throw new Error( `Should not have compatibility-value for "BROWSER" kind: ${Z}` ); if (l === void 0) throw new Error(`Invalid value for "BROWSER" kind: ${Z}`); } } var PQ; const _F = class _F { constructor() { if (typeof o > "u" || o.test("TESTING")) throw new Error("Cannot initialize AppOptions."); } static get(l) { return U(this, PQ).get(l); } static getAll(l = null, t = !1) { const d = /* @__PURE__ */ Object.create(null); for (const F in UF) { const s = UF[F]; l && !(l & s.kind) || (d[F] = t ? s.value : U(this, PQ).get(F)); } return d; } static set(l, t) { this.setAll({ [l]: t }); } static setAll(l, t = !1) { (typeof o > "u" || o.test("GENERIC")) && (this._hasInvokedSet || (this._hasInvokedSet = !0)); let d; for (const F in l) { const s = UF[F], n = l[F]; if (!s || !(typeof n == typeof s.value || pJ[(typeof n).toUpperCase()] & s.type)) continue; const { kind: Q } = s; t && !(Q & x.BROWSER || Q & x.PREFERENCE) || (this.eventBus && Q & x.EVENT_DISPATCH && (d || (d = /* @__PURE__ */ new Map())).set(F, n), U(this, PQ).set(F, n)); } if (d) for (const [F, s] of d) this.eventBus.dispatch(F.toLowerCase(), { source: this, value: s }); } }; PQ = new WeakMap(), X(_F, "eventBus"), W(_F, PQ, /* @__PURE__ */ new Map()), (() => { for (const l in UF) U(_F, PQ).set(l, UF[l].value); if (typeof o > "u" || o.test("GENERIC")) { for (const [l, t] of HZ) U(_F, PQ).set(l, t); _F._hasInvokedSet = !1, _F._checkDisablePreferences = () => _F.get("disablePreferences") ? !0 : (_F._hasInvokedSet && console.warn( 'The Preferences may override manually set AppOptions; please use the "disablePreferences"-option to prevent that.' ), !1); } })(); let I = _F; const lF = (typeof o > "u" || o.test("GENERIC")) && typeof process == "object" && process + "" == "[object process]" && !process.versions.nw && !(process.versions.electron && process.type && process.type !== "browser"), oQ = [1 / 0, 1 / 0, -1 / 0, -1 / 0], KZ = new Float32Array(oQ), uJ = [1e-3, 0, 0, 1e-3, 0, 0], Vm = 1.35, Zr = 0.35, EI = Zr / Vm, bU = { ANY: 1, DISPLAY: 2, PRINT: 4, SAVE: 8, ANNOTATIONS_FORMS: 16, ANNOTATIONS_STORAGE: 32, ANNOTATIONS_DISABLE: 64, IS_EDITING: 128, OPLIST: 256 }, Tt = { DISABLE: 0, ENABLE: 1, ENABLE_FORMS: 2, ENABLE_STORAGE: 3 }, um = "pdfjs_internal_editor_", z = { DISABLE: -1, NONE: 0, FREETEXT: 3, HIGHLIGHT: 9, STAMP: 13, INK: 15, POPUP: 16, SIGNATURE: 101, COMMENT: 102 }, tl = { RESIZE: 1, CREATE: 2, FREETEXT_SIZE: 11, FREETEXT_COLOR: 12, FREETEXT_OPACITY: 13, INK_COLOR: 21, INK_THICKNESS: 22, INK_OPACITY: 23, INK_COLOR_AND_OPACITY: 24, HIGHLIGHT_COLOR: 31, HIGHLIGHT_THICKNESS: 32, HIGHLIGHT_FREE: 33, HIGHLIGHT_SHOW_ALL: 34, DRAW_STEP: 41 }, wQ = { PRINT: 4, MODIFY_CONTENTS: 8, COPY: 16, MODIFY_ANNOTATIONS: 32, FILL_INTERACTIVE_FORMS: 256, COPY_FOR_ACCESSIBILITY: 512, ASSEMBLE: 1024, PRINT_HIGH_QUALITY: 2048 }, MI = { TRIANGLES: 1, LATTICE: 2, PATCH: 3 }, rt = { FILL: 0, STROKE: 1, FILL_STROKE: 2, INVISIBLE: 3, FILL_STROKE_MASK: 3, ADD_TO_PATH_FLAG: 4 }, pc = { GRAYSCALE_1BPP: 1, RGB_24BPP: 2, RGBA_32BPP: 3 }, it = { TEXT: 1, LINK: 2, FREETEXT: 3, LINE: 4, SQUARE: 5, CIRCLE: 6, POLYGON: 7, POLYLINE: 8, HIGHLIGHT: 9, UNDERLINE: 10, SQUIGGLY: 11, STRIKEOUT: 12, STAMP: 13, CARET: 14, INK: 15, POPUP: 16, FILEATTACHMENT: 17, SOUND: 18, MOVIE: 19, WIDGET: 20, SCREEN: 21, PRINTERMARK: 22, TRAPNET: 23, WATERMARK: 24, THREED: 25, REDACT: 26 }, TI = { GROUP: "Group", REPLY: "R" }, YI = { INVISIBLE: 1, HIDDEN: 2, PRINT: 4, NOROTATE: 16, NOVIEW: 32, LOCKED: 128, LOCKEDCONTENTS: 512 }, XI = { READONLY: 1, REQUIRED: 2, MULTILINE: 4096, PASSWORD: 8192, RADIO: 32768, PUSHBUTTON: 65536, COMBO: 131072, FILESELECT: 1048576, MULTISELECT: 2097152, DONOTSCROLL: 8388608, COMB: 16777216 }, Ic = { SOLID: 1, DASHED: 2, BEVELED: 3, INSET: 4, UNDERLINE: 5 }, LI = { E: "Mouse Enter", X: "Mouse Exit", D: "Mouse Down", U: "Mouse Up", Fo: "Focus", Bl: "Blur", PO: "PageOpen", PC: "PageClose", PV: "PageVisible", PI: "PageInvisible", K: "Keystroke", F: "Format", V: "Validate", C: "Calculate" }, rI = { WC: "WillClose", WS: "WillSave", DS: "DidSave", WP: "WillPrint", DP: "DidPrint" }, xI = { O: "PageOpen", C: "PageClose" }, Rb = { ERRORS: 0, WARNINGS: 1, INFOS: 5 }, gs = { // Intentionally start from 1 so it is easy to spot bad operators that will be // 0's. // PLEASE NOTE: We purposely keep any removed operators commented out, since // re-numbering the list would risk breaking third-party users. dependency: 1, setLineWidth: 2, setLineCap: 3, setLineJoin: 4, setMiterLimit: 5, setDash: 6, setRenderingIntent: 7, setFlatness: 8, setGState: 9, save: 10, restore: 11, transform: 12, moveTo: 13, lineTo: 14, curveTo: 15, curveTo2: 16, curveTo3: 17, closePath: 18, rectangle: 19, stroke: 20, closeStroke: 21, fill: 22, eoFill: 23, fillStroke: 24, eoFillStroke: 25, closeFillStroke: 26, closeEOFillStroke: 27, endPath: 28, clip: 29, eoClip: 30, beginText: 31, endText: 32, setCharSpacing: 33, setWordSpacing: 34, setHScale: 35, setLeading: 36, setFont: 37, setTextRenderingMode: 38, setTextRise: 39, moveText: 40, setLeadingMoveText: 41, setTextMatrix: 42, nextLine: 43, showText: 44, showSpacedText: 45, nextLineShowText: 46, nextLineSetSpacingShowText: 47, setCharWidth: 48, setCharWidthAndBounds: 49, setStrokeColorSpace: 50, setFillColorSpace: 51, setStrokeColor: 52, setStrokeColorN: 53, setFillColor: 54, setFillColorN: 55, setStrokeGray: 56, setFillGray: 57, setStrokeRGBColor: 58, setFillRGBColor: 59, setStrokeCMYKColor: 60, setFillCMYKColor: 61, shadingFill: 62, beginInlineImage: 63, beginImageData: 64, endInlineImage: 65, paintXObject: 66, markPoint: 67, markPointProps: 68, beginMarkedContent: 69, beginMarkedContentProps: 70, endMarkedContent: 71, beginCompat: 72, endCompat: 73, paintFormXObjectBegin: 74, paintFormXObjectEnd: 75, beginGroup: 76, endGroup: 77, // beginAnnotations: 78, // endAnnotations: 79, beginAnnotation: 80, endAnnotation: 81, // paintJpegXObject: 82, paintImageMaskXObject: 83, paintImageMaskXObjectGroup: 84, paintImageXObject: 85, paintInlineImageXObject: 86, paintInlineImageXObjectGroup: 87, paintImageXObjectRepeat: 88, paintImageMaskXObjectRepeat: 89, paintSolidColorImageMask: 90, constructPath: 91, setStrokeTransparent: 92, setFillTransparent: 93, rawFillPath: 94 }, NW = { moveTo: 0, lineTo: 1, curveTo: 2, quadraticCurveTo: 3, closePath: 4 }, _p = { NEED_PASSWORD: 1, INCORRECT_PASSWORD: 2 }; let Po = Rb.WARNINGS; function ar(Z) { Number.isInteger(Z) && (Po = Z); } function er() { return Po; } function fo(Z) { Po >= Rb.INFOS && console.info(`Info: ${Z}`); } function Zl(Z) { Po >= Rb.WARNINGS && console.warn(`Warning: ${Z}`); } function Rl(Z) { throw new Error(Z); } function Sl(Z, l) { Z || Rl(l); } function cr(Z) { switch (Z == null ? void 0 : Z.protocol) { case "http:": case "https:": case "ftp:": case "mailto:": case "tel:": return !0; default: return !1; } } function Wb(Z, l = null, t = null) { if (!Z) return null; if (t && typeof Z == "string") { if (t.addDefaultProtocol && Z.startsWith("www.")) { const F = Z.match(/\./g); (F == null ? void 0 : F.length) >= 2 && (Z = `http://${Z}`); } if (t.tryConvertEncoding) try { Z = Nr(Z); } catch { } } const d = l ? URL.parse(Z, l) : URL.parse(Z); return cr(d) ? d : null; } function SQ(Z, l, t = !1) { const d = URL.parse(Z); return d ? (d.hash = l, d.href) : t && Wb(Z, "http://example.com") ? Z.split("#", 1)[0] + `${l ? `#${l}` : ""}` : ""; } function EJ(Z) { return Z.substring(Z.lastIndexOf("/") + 1); } function f(Z, l, t, d = !1) { return (typeof o > "u" || o.test("TESTING")) && Sl( l in Z, `shadow: Property "${l && l.toString()}" not found in object.` ), Object.defineProperty(Z, l, { value: t, enumerable: !d, configurable: !0, writable: !1 }), t; } const xc = function() { function l(t, d) { (typeof o > "u" || o.test("TESTING")) && this.constructor === l && Rl("Cannot initialize BaseException."), this.message = t, this.name = d; } return l.prototype = new Error(), l.constructor = l, l; }(); class Hu extends xc { constructor(l, t) { super(l, "PasswordException"), this.code = t; } } class nJ extends xc { constructor(l, t) { super(l, "UnknownErrorException"), this.details = t; } } class Em extends xc { constructor(l) { super(l, "InvalidPDFException"); } } class dW extends xc { constructor(l, t, d) { super(l, "ResponseException"), this.status = t, this.missing = d; } } class Vr extends xc { constructor(l) { super(l, "FormatError"); } } class Os extends xc { constructor(l) { super(l, "AbortException"); } } function Rr(Z) { (typeof Z != "object" || (Z == null ? void 0 : Z.length) === void 0) && Rl("Invalid argument for bytesToString"); const l = Z.length, t = 8192; if (l < t) return String.fromCharCode.apply(null, Z); const d = []; for (let F = 0; F < l; F += t) { const s = Math.min(F + t, l), n = Z.subarray(F, s); d.push(String.fromCharCode.apply(null, n)); } return d.join(""); } function mb(Z) { typeof Z != "string" && Rl("Invalid argument for stringToBytes"); const l = Z.length, t = new Uint8Array(l); for (let d = 0; d < l; ++d) t[d] = Z.charCodeAt(d) & 255; return t; } function kI(Z) { return Object.keys(Z).length; } function Wr() { const Z = new Uint8Array(4); return Z[0] = 1, new Uint32Array(Z.buffer, 0, 1)[0] === 1; } class Xl { static get isLittleEndian() { return f(this, "isLittleEndian", Wr()); } static get isOffscreenCanvasSupported() { return f( this, "isOffscreenCanvasSupported", typeof OffscreenCanvas < "u" ); } static get isImageDecoderSupported() { return f( this, "isImageDecoderSupported", typeof ImageDecoder < "u" ); } static get isFloat16ArraySupported() { return f( this, "isFloat16ArraySupported", typeof Float16Array < "u" ); } static get isSanitizerSupported() { return f( this, "isSanitizerSupported", typeof Sanitizer < "u" ); } static get platform() { const { platform: l, userAgent: t } = navigator; return f(this, "platform", { isAndroid: t.includes("Android"), isLinux: l.includes("Linux"), isMac: l.includes("Mac"), isWindows: l.includes("Win"), isFirefox: typeof o < "u" && o.test("MOZCENTRAL") || t.includes("Firefox") }); } static get isCSSRoundSupported() { var l, t; return f( this, "isCSSRoundSupported", (t = (l = globalThis.CSS) == null ? void 0 : l.supports) == null ? void 0 : t.call(l, "width: round(1.5px, 1px)") ); } static get isAlphaColorInputSupported() { return f( this, "isAlphaColorInputSupported", (() => { if (typeof document > "u") return !1; const l = document.createElement("input"); return l.type = "color", l.setAttribute("alpha", ""), l.value = "#ff000080", l.value !== "#ff0000"; })() ); } } var pQ, gb, MJ; class C { static get hexNums() { return f( this, "hexNums", Array.from(Array(256).keys(), (l) => l.toString(16).padStart(2, "0")) ); } static makeHexColor(l, t, d) { return `#${this.hexNums[l]}${this.hexNums[t]}${this.hexNums[d]}`; } static domMatrixToTransform(l) { return [l.a, l.b, l.c, l.d, l.e, l.f]; } // Apply a scaling matrix to some min/max values. // If a scaling factor is negative then min and max must be // swapped. static scaleMinMax(l, t) { let d; l[0] ? (l[0] < 0 && (d = t[0], t[0] = t[2], t[2] = d), t[0] *= l[0], t[2] *= l[0], l[3] < 0 && (d = t[1], t[1] = t[3], t[3] = d), t[1] *= l[3], t[3] *= l[3]) : (d = t[0], t[0] = t[1], t[1] = d, d = t[2], t[2] = t[3], t[3] = d, l[1] < 0 && (d = t[1], t[1] = t[3], t[3] = d), t[1] *= l[1], t[3] *= l[1], l[2] < 0 && (d = t[0], t[0] = t[2], t[2] = d), t[0] *= l[2], t[2] *= l[2]), t[0] += l[4], t[1] += l[5], t[2] += l[4], t[3] += l[5]; } // Concatenates two transformation matrices together and returns the result. static transform(l, t) { return [ l[0] * t[0] + l[2] * t[1], l[1] * t[0] + l[3] * t[1], l[0] * t[2] + l[2] * t[3], l[1] * t[2] + l[3] * t[3], l[0] * t[4] + l[2] * t[5] + l[4], l[1] * t[4] + l[3] * t[5] + l[5] ]; } // Multiplies m (an array-based transform) by md (a DOMMatrix transform). static multiplyByDOMMatrix(l, t) { return [ l[0] * t.a + l[2] * t.b, l[1] * t.a + l[3] * t.b, l[0] * t.c + l[2] * t.d, l[1] * t.c + l[3] * t.d, l[0] * t.e + l[2] * t.f + l[4], l[1] * t.e + l[3] * t.f + l[5] ]; } // For 2d affine transforms static applyTransform(l, t, d = 0) { const F = l[d], s = l[d + 1]; l[d] = F * t[0] + s * t[2] + t[4], l[d + 1] = F * t[1] + s * t[3] + t[5]; } static applyTransformToBezier(l, t, d = 0) { const F = t[0], s = t[1], n = t[2], Q = t[3], i = t[4], a = t[5]; for (let c = 0; c < 6; c += 2) { const V = l[d + c], m = l[d + c + 1]; l[d + c] = V * F + m * n + i, l[d + c + 1] = V * s + m * Q + a; } } static applyInverseTransform(l, t) { const d = l[0], F = l[1], s = t[0] * t[3] - t[1] * t[2]; l[0] = (d * t[3] - F * t[2] + t[2] * t[5] - t[4] * t[3]) / s, l[1] = (-d * t[1] + F * t[0] + t[4] * t[1] - t[5] * t[0]) / s; } // Applies the transform to the rectangle and finds the minimum axially // aligned bounding box. static axialAlignedBoundingBox(l, t, d) { const F = t[0], s = t[1], n = t[2], Q = t[3], i = t[4], a = t[5], c = l[0], V = l[1], m = l[2], N = l[3]; let h = F * c + i, B = h, b = F * m + i, S = b, J = Q * V + a, G = J, u = Q * N + a, E = u; if (s !== 0 || n !== 0) { const M = s * c, Y = s * m, L = n * V, T = n * N; h += L, S += L, b += T, B += T, J += M, E += M, u += Y, G += Y; } d[0] = Math.min(d[0], h, b, B, S), d[1] = Math.min(d[1], J, u, G, E), d[2] = Math.max(d[2], h, b, B, S), d[3] = Math.max(d[3], J, u, G, E); } static inverseTransform(l) { const t = l[0] * l[3] - l[1] * l[2]; return [ l[3] / t, -l[1] / t, -l[2] / t, l[0] / t, (l[2] * l[5] - l[4] * l[3]) / t, (l[4] * l[1] - l[5] * l[0]) / t ]; } // This calculation uses Singular Value Decomposition. // The SVD can be represented with formula A = USV. We are interested in the // matrix S here because it represents the scale values. static singularValueDecompose2dScale(l, t) { const d = l[0], F = l[1], s = l[2], n = l[3], Q = d ** 2 + F ** 2, i = d * s + F * n, a = s ** 2 + n ** 2, c = (Q + a) / 2, V = Math.sqrt(c ** 2 - (Q * a - i ** 2)); t[0] = Math.sqrt(c + V || 1), t[1] = Math.sqrt(c - V || 1); } // Normalize rectangle rect=[x1, y1, x2, y2] so that (x1,y1) < (x2,y2) // For coordinate systems whose origin lies in the bottom-left, this // means normalization to (BL,TR) ordering. For systems with origin in the // top-left, this means (TL,BR) ordering. static normalizeRect(l) { const t = l.slice(0); return l[0] > l[2] && (t[0] = l[2], t[2] = l[0]), l[1] > l[3] && (t[1] = l[3], t[3] = l[1]), t; } // Returns a rectangle [x1, y1, x2, y2] corresponding to the // intersection of rect1 and rect2. If no intersection, returns 'null' // The rectangle coordinates of rect1, rect2 should be [x1, y1, x2, y2] static intersect(l, t) { const d = Math.max( Math.min(l[0], l[2]), Math.min(t[0], t[2]) ), F = Math.min( Math.max(l[0], l[2]), Math.max(t[0], t[2]) ); if (d > F) return null; const s = Math.max( Math.min(l[1], l[3]), Math.min(t[1], t[3]) ), n = Math.min( Math.max(l[1], l[3]), Math.max(t[1], t[3]) ); return s > n ? null : [d, s, F, n]; } static pointBoundingBox(l, t, d) { d[0] = Math.min(d[0], l), d[1] = Math.min(d[1], t), d[2] = Math.max(d[2], l), d[3] = Math.max(d[3], t); } static rectBoundingBox(l, t, d, F, s) { s[0] = Math.min(s[0], l, d), s[1] = Math.min(s[1], t, F), s[2] = Math.max(s[2], l, d), s[3] = Math.max(s[3], t, F); } // From https://github.com/adobe-webplatform/Snap.svg/blob/b365287722a72526000ac4bfcf0ce4cac2faa015/src/path.js#L852 static bezierBoundingBox(l, t, d, F, s, n, Q, i, a) { a[0] = Math.min(a[0], l, Q), a[1] = Math.min(a[1], t, i), a[2] = Math.max(a[2], l, Q), a[3] = Math.max(a[3], t, i), R(this, pQ, MJ).call(this, l, d, s, Q, t, F, n, i, 3 * (-l + 3 * (d - s) + Q), 6 * (l - 2 * d + s), 3 * (d - l), a), R(this, pQ, MJ).call(this, l, d, s, Q, t, F, n, i, 3 * (-t + 3 * (F - n) + i), 6 * (t - 2 * F + n), 3 * (F - t), a); } } pQ = new WeakSet(), gb = function(l, t, d, F, s, n, Q, i, a, c) { if (a <= 0 || a >= 1) return; const V = 1 - a, m = a * a, N = m * a, h = V * (V * (V * l + 3 * a * t) + 3 * m * d) + N * F, B = V * (V * (V * s + 3 * a * n) + 3 * m * Q) + N * i; c[0] = Math.min(c[0], h), c[1] = Math.min(c[1], B), c[2] = Math.max(c[2], h), c[3] = Math.max(c[3], B); }, MJ = function(l, t, d, F, s, n, Q, i, a, c, V, m) { if (Math.abs(a) < 1e-12) { Math.abs(c) >= 1e-12 && R(this, pQ, gb).call(this, l, t, d, F, s, n, Q, i, -V / c, m); return; } const N = c ** 2 - 4 * V * a; if (N < 0) return; const h = Math.sqrt(N), B = 2 * a; R(this, pQ, gb).call(this, l, t, d, F, s, n, Q, i, (-c + h) / B, m), R(this, pQ, gb).call(this, l, t, d, F, s, n, Q, i, (-c - h) / B, m); }, W(C, pQ); const mr = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 728, 711, 710, 729, 733, 731, 730, 732, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8226, 8224, 8225, 8230, 8212, 8211, 402, 8260, 8249, 8250, 8722, 8240, 8222, 8220, 8221, 8216, 8217, 8218, 8482, 64257, 64258, 321, 338, 352, 376, 381, 305, 322, 339, 353, 382, 0, 8364 ]; function yI(Z, l = !1) { if (Z[0] >= "ï") { let d; if (Z[0] === "þ" && Z[1] === "ÿ" ? (d = "utf-16be", Z.length % 2 === 1 && (Z = Z.slice(0, -1))) : Z[0] === "ÿ" && Z[1] === "þ" ? (d = "utf-16le", Z.length % 2 === 1 && (Z = Z.slice(0, -1))) : Z[0] === "ï" && Z[1] === "»" && Z[2] === "¿" && (d = "utf-8"), d) try { const F = new TextDecoder(d, { fatal: !0 }), s = mb(Z), n = F.decode(s); return l || !n.includes("\x1B") ? n : n.replaceAll(/\x1b[^\x1b]*(?:\x1b|$)/g, ""); } catch (F) { Zl(`stringToPDFString: "${F}".`); } } const t = []; for (let d = 0, F = Z.length; d < F; d++) { const s = Z.charCodeAt(d); if (!l && s === 27) { for (; ++d < F && Z.charCodeAt(d) !== 27; ) ; continue; } const n = mr[s]; t.push(n ? String.fromCharCode(n) : Z.charAt(d)); } return t.join(""); } function Nr(Z) { return decodeURIComponent(escape(Z)); } function II(Z) { return unescape(encodeURIComponent(Z)); } function CI(Z, l) { if (Z.length !== l.length) return !1; for (let t = 0, d = Z.length; t < d; t++) if (Z[t] !== l[t]) return !1; return !0; } function zI(Z = /* @__PURE__ */ new Date()) { return Z instanceof Date || (Z = new Date(Z)), [ Z.getUTCFullYear().toString(), (Z.getUTCMonth() + 1).toString().padStart(2, "0"), Z.getUTCDate().toString().padStart(2, "0"), Z.getUTCHours().toString().padStart(2, "0"), Z.getUTCMinutes().toString().padStart(2, "0"), Z.getUTCSeconds().toString().padStart(2, "0") ].join(""); } let QJ = null, Ku = null; function $p(Z) { return QJ || (QJ = /([\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, Ku = /* @__PURE__ */ new Map([["ſt", "ſt"]])), Z.replaceAll( QJ, (l, t, d) => t ? t.normalize("NFKC") : Ku.get(d) ); } function Ao() { if (typeof o < "u" && o.test("MOZCENTRAL") || typeof crypto.randomUUID == "function") return crypto.randomUUID(); const Z = new Uint8Array(32); return crypto.getRandomValues(Z), Rr(Z); } const $c = "pdfjs_internal_id_"; function hr(Z, l, t) { if (!Array.isArray(t) || t.length < 2) return !1; const [d, F, ...s] = t; if (!Z(d) && !Number.isInteger(d) || !l(F)) return !1; const n = s.length; let Q = !0; switch (F.name) { case "XYZ": if (n < 2 || n > 3) return !1; break; case "Fit": case "FitB": return n === 0; case "FitH": case "FitBH": case "FitV": case "FitBV": if (n > 1) return !1; break; case "FitR": if (n !== 4) return !1; Q = !1; break; default: return !1; } for (const i of s) if (!(typeof i == "number" || Q && i === null)) return !1; return !0; } const Nb = () => [], hb = () => /* @__PURE__ */ new Map(), $S = () => /* @__PURE__ */ Object.create(null); typeof o < "u" && !o.test("SKIP_BABEL") && typeof Blob.prototype.bytes != "function" && (Blob.prototype.bytes = async function() { return new Uint8Array(await this.arrayBuffer()); }); typeof o < "u" && !o.test("SKIP_BABEL") && typeof Response.prototype.bytes != "function" && (Response.prototype.bytes = async function() { return new Uint8Array(await this.arrayBuffer()); }); typeof o < "u" && !o.test("SKIP_BABEL") && typeof AbortSignal.any != "function" && (AbortSignal.any = function(Z) { const l = new AbortController(), { signal: t } = l; for (const d of Z) if (d.aborted) return l.abort(d.reason), t; for (const d of Z) d.addEventListener( "abort", () => { l.abort(d.reason); }, { signal: t } // Automatically remove the listener. ); return t; }); function Gl(Z, l, t) { return Math.min(Math.max(Z, l), t); } class Mm { /** * Walk an XFA tree and create an array of text nodes that is compatible * with a regular PDFs TextContent. Currently, only TextItem.str is supported, * all other fields and styles haven't been implemented. * * @param {Object} xfa - An XFA fake DOM object. * * @returns {TextContent} */ static textContent(l) { const t = [], d = { items: t, styles: /* @__PURE__ */ Object.create(null) }; function F(s) { var i; if (!s) return; let n = null; const Q = s.name; if (Q === "#text") n = s.value; else if (Mm.shouldBuildText(Q)) (i = s == null ? void 0 : s.attributes) != null && i.textContent ? n = s.attributes.textContent : s.value && (n = s.value); else return; if (n !== null && t.push({ str: n }), !!s.children) for (const a of s.children) F(a); } return F(l), d; } /** * @param {string} name - DOM node name. (lower case) * * @returns {boolean} true if the DOM node should have a corresponding text * node. */ static shouldBuildText(l) { return !(l === "textarea" || l === "input" || l === "option" || l === "select"); } } class s0 { static setupStorage(l, t, d, F, s) { const n = F.getValue(t, { value: null }); switch (d.name) { case "textarea": if (n.value !== null && (l.textContent = n.value), s === "print") break; l.addEventListener("input", (Q) => { F.setValue(t, { value: Q.target.value }); }); break; case "input": if (d.attributes.type === "radio" || d.attributes.type === "checkbox") { if (n.value === d.attributes.xfaOn ? l.setAttribute("checked", !0) : n.value === d.attributes.xfaOff && l.removeAttribute("checked"), s === "print") break; l.addEventListener("change", (Q) => { F.setValue