: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
[this._pageContents[i], this._pageDiffs[i], this._hasDiacritics[i]] = normalize(strBuf.join(""));
console.error(`Unable to get text content for page ${i + 1}`, reason);
this._pageContents[i] = "";
this._pageDiffs[i] = null;
this._hasDiacritics[i] = false;
if (this._scrollMatches && this._selected.pageIdx === index) {
this._linkService.page = index + 1;
this._eventBus.dispatch("updatetextlayermatches", {
this._eventBus.dispatch("updatetextlayermatches", {
const previous = this.#state.findPrevious;
const currentPageIndex = this._linkService.page - 1;
const numPages = this._linkService.pagesCount;
this._highlightMatches = true;
this._dirtyMatch = false;
this._selected.pageIdx = this._selected.matchIdx = -1;
this._offset.pageIdx = currentPageIndex;
this._offset.matchIdx = null;
this._offset.wrapped = false;
this._resumePageIdx = null;
this._pageMatches.length = 0;
this._pageMatchesLength.length = 0;
this.#visitedPagesCount = 0;
this._matchesCountTotal = 0;
for (let i = 0; i < numPages; i++) {
if (this._pendingFindMatches.has(i)) {
this._pendingFindMatches.add(i);
this._extractTextPromises[i].then(() => {
this._pendingFindMatches.delete(i);
const query = this.#query;
if (query.length === 0) {
this.#updateUIState(FindState.FOUND);
if (this._resumePageIdx) {
const offset = this._offset;
this._pagesToSearch = numPages;
if (offset.matchIdx !== null) {
const numPageMatches = this._pageMatches[offset.pageIdx].length;
if (!previous && offset.matchIdx + 1 < numPageMatches || previous && offset.matchIdx > 0) {
offset.matchIdx = previous ? offset.matchIdx - 1 : offset.matchIdx + 1;
this.#advanceOffsetPage(previous);
const offset = this._offset;
const numMatches = matches.length;
const previous = this.#state.findPrevious;
offset.matchIdx = previous ? numMatches - 1 : 0;
this.#advanceOffsetPage(previous);
if (this._pagesToSearch < 0) {
this.#updateMatch(false);
if (this._resumePageIdx !== null) {
console.error("There can only be one pending page.");
const pageIdx = this._offset.pageIdx;
matches = this._pageMatches[pageIdx];
this._resumePageIdx = pageIdx;
} while (!this.#matchesReady(matches));
#advanceOffsetPage(previous) {
const offset = this._offset;
const numPages = this._linkService.pagesCount;
offset.pageIdx = previous ? offset.pageIdx - 1 : offset.pageIdx + 1;
if (offset.pageIdx >= numPages || offset.pageIdx < 0) {
offset.pageIdx = previous ? numPages - 1 : 0;
#updateMatch(found = false) {
let state = FindState.NOT_FOUND;
const wrapped = this._offset.wrapped;
this._offset.wrapped = false;
const previousPage = this._selected.pageIdx;
this._selected.pageIdx = this._offset.pageIdx;
this._selected.matchIdx = this._offset.matchIdx;
state = wrapped ? FindState.WRAPPED : FindState.FOUND;
if (previousPage !== -1 && previousPage !== this._selected.pageIdx) {
this.#updatePage(previousPage);
this.#updateUIState(state, this.#state.findPrevious);
if (this._selected.pageIdx !== -1) {
this._scrollMatches = true;
this.#updatePage(this._selected.pageIdx);
const pdfDocument = this._pdfDocument;
this._firstPageCapability.promise.then(() => {
if (!this._pdfDocument || pdfDocument && this._pdfDocument !== pdfDocument) {
clearTimeout(this._findTimeout);
this._findTimeout = null;
if (this._resumePageIdx) {
this._resumePageIdx = null;
this.#updateUIState(FindState.FOUND);
this._highlightMatches = false;
total = this._matchesCountTotal;
for (let i = 0; i < pageIdx; i++) {
current += this._pageMatches[i]?.length || 0;
if (current < 1 || current > total) {
#updateUIResultsCount() {
this._eventBus.dispatch("updatefindmatchescount", {
matchesCount: this.#requestMatchesCount()
#updateUIState(state, previous = false) {
if (!this.#updateMatchesCountOnProgress && (this.#visitedPagesCount !== this._linkService.pagesCount || state === FindState.PENDING)) {
this._eventBus.dispatch("updatefindcontrolstate", {
matchesCount: this.#requestMatchesCount(),
rawQuery: this.#state?.query ?? null
;// CONCATENATED MODULE: ./web/pdf_find_bar.js
const MATCHES_COUNT_LIMIT = 1000;
#resizeObserver = new ResizeObserver(this.#resizeObserverCallback.bind(this));
constructor(options, eventBus) {
this.toggleButton = options.toggleButton;
this.findField = options.findField;
this.highlightAll = options.highlightAllCheckbox;
this.caseSensitive = options.caseSensitiveCheckbox;
this.matchDiacritics = options.matchDiacriticsCheckbox;
this.entireWord = options.entireWordCheckbox;
this.findMsg = options.findMsg;
this.findResultsCount = options.findResultsCount;
this.findPreviousButton = options.findPreviousButton;
this.findNextButton = options.findNextButton;
this.eventBus = eventBus;
this.toggleButton.addEventListener("click", () => {
this.findField.addEventListener("input", () => {
this.bar.addEventListener("keydown", e => {
if (e.target === this.findField) {
this.dispatchEvent("again", e.shiftKey);
this.findPreviousButton.addEventListener("click", () => {
this.dispatchEvent("again", true);
this.findNextButton.addEventListener("click", () => {
this.dispatchEvent("again", false);
this.highlightAll.addEventListener("click", () => {
this.dispatchEvent("highlightallchange");
this.caseSensitive.addEventListener("click", () => {
this.dispatchEvent("casesensitivitychange");
this.entireWord.addEventListener("click", () => {
this.dispatchEvent("entirewordchange");
this.matchDiacritics.addEventListener("click", () => {
this.dispatchEvent("diacriticmatchingchange");
dispatchEvent(type, findPrev = false) {
this.eventBus.dispatch("find", {
query: this.findField.value,
caseSensitive: this.caseSensitive.checked,
entireWord: this.entireWord.checked,
highlightAll: this.highlightAll.checked,
matchDiacritics: this.matchDiacritics.checked
updateUIState(state, previous, matchesCount) {
case FindState.NOT_FOUND:
findMsgId = "pdfjs-find-not-found";
findMsgId = `pdfjs-find-reached-${previous ? "top" : "bottom"}`;
findField.setAttribute("data-status", status);
findField.setAttribute("aria-invalid", state === FindState.NOT_FOUND);
findMsg.setAttribute("data-status", status);
findMsg.setAttribute("data-l10n-id", findMsgId);
findMsg.removeAttribute("data-l10n-id");
findMsg.textContent = "";
this.updateResultsCount(matchesCount);
const limit = MATCHES_COUNT_LIMIT;
findResultsCount.setAttribute("data-l10n-id", `pdfjs-find-match-count${total > limit ? "-limit" : ""}`);
findResultsCount.setAttribute("data-l10n-args", JSON.stringify({
findResultsCount.removeAttribute("data-l10n-id");
findResultsCount.textContent = "";
this.#resizeObserver.observe(this.bar.parentNode);
this.#resizeObserver.observe(this.bar);
toggleExpandedBtn(this.toggleButton, true, this.bar);
this.#resizeObserver.disconnect();
toggleExpandedBtn(this.toggleButton, false, this.bar);
this.eventBus.dispatch("findbarclose", {
#resizeObserverCallback(entries) {
bar.classList.remove("wrapContainers");
const findbarHeight = bar.clientHeight;
const inputContainerHeight = bar.firstElementChild.clientHeight;
if (findbarHeight > inputContainerHeight) {
bar.classList.add("wrapContainers");
;// CONCATENATED MODULE: ./web/pdf_history.js
const HASH_CHANGE_TIMEOUT = 1000;
const POSITION_UPDATED_THRESHOLD = 50;
const UPDATE_VIEWAREA_TIMEOUT = 1000;
function getCurrentHash() {
return document.location.hash;
#eventAbortController = null;
this.linkService = linkService;
this.eventBus = eventBus;
this._initialized = false;
this.eventBus._on("pagesinit", () => {
this._isPagesLoaded = false;
this.eventBus._on("pagesloaded", evt => {
this._isPagesLoaded = !!evt.pagesCount;
if (!fingerprint || typeof fingerprint !== "string") {
console.error('PDFHistory.initialize: The "fingerprint" must be a non-empty string.');
const reInitialized = this._fingerprint !== "" && this._fingerprint !== fingerprint;
this._fingerprint = fingerprint;
this._updateUrl = updateUrl === true;
this._initialized = true;
const state = window.history.state;
this._popStateInProgress = false;
this._blockHashChange = 0;
this._currentHash = getCurrentHash();
this._numPositionUpdates = 0;
this._uid = this._maxUid = 0;
this._destination = null;
if (!this.#isValidState(state, true) || resetHistory) {
} = this.#parseCurrentHash(true);
if (!hash || reInitialized || resetHistory) {
this.#pushOrReplaceState(null, true);
this.#pushOrReplaceState({
const destination = state.destination;
this.#updateInternalState(destination, state.uid, true);
if (destination.rotation !== undefined) {
this._initialRotation = destination.rotation;
this._initialBookmark = JSON.stringify(destination.dest);
this._destination.page = null;
} else if (destination.hash) {
this._initialBookmark = destination.hash;
} else if (destination.page) {
this._initialBookmark = `page=${destination.page}`;
this._initialized = false;
if (this._updateViewareaTimeout) {
clearTimeout(this._updateViewareaTimeout);
this._updateViewareaTimeout = null;
this._initialBookmark = null;
this._initialRotation = null;
if (!this._initialized) {
if (namedDest && typeof namedDest !== "string") {
console.error("PDFHistory.push: " + `"${namedDest}" is not a valid namedDest parameter.`);
} else if (!Array.isArray(explicitDest)) {
console.error("PDFHistory.push: " + `"${explicitDest}" is not a valid explicitDest parameter.`);
} else if (!this.#isValidPage(pageNumber)) {
if (pageNumber !== null || this._destination) {
console.error("PDFHistory.push: " + `"${pageNumber}" is not a valid pageNumber parameter.`);
const hash = namedDest || JSON.stringify(explicitDest);
let forceReplace = false;
if (this._destination && (isDestHashesEqual(this._destination.hash, hash) || isDestArraysEqual(this._destination.dest, explicitDest))) {
if (this._destination.page) {
if (this._popStateInProgress && !forceReplace) {
this.#pushOrReplaceState({