: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
element: options.cursorHandToolButton,
eventName: "switchcursortool",
element: options.scrollPageButton,
eventName: "switchscrollmode",
element: options.scrollVerticalButton,
eventName: "switchscrollmode",
mode: ScrollMode.VERTICAL
element: options.scrollHorizontalButton,
eventName: "switchscrollmode",
mode: ScrollMode.HORIZONTAL
element: options.scrollWrappedButton,
eventName: "switchscrollmode",
element: options.spreadNoneButton,
eventName: "switchspreadmode",
element: options.spreadOddButton,
eventName: "switchspreadmode",
element: options.spreadEvenButton,
eventName: "switchspreadmode",
element: options.documentPropertiesButton,
eventName: "documentproperties",
element: options.openFileButton,
this.eventBus = eventBus;
this.#bindListeners(buttons);
setPageNumber(pageNumber) {
this.pageNumber = pageNumber;
setPagesCount(pagesCount) {
this.pagesCount = pagesCount;
this.eventBus.dispatch("switchcursortool", {
this.#scrollModeChanged({
mode: ScrollMode.VERTICAL
this.#spreadModeChanged({
firstPageButton.disabled = this.pageNumber <= 1;
lastPageButton.disabled = this.pageNumber >= this.pagesCount;
pageRotateCwButton.disabled = this.pagesCount === 0;
pageRotateCcwButton.disabled = this.pagesCount === 0;
#bindListeners(buttons) {
toggleButton.addEventListener("click", this.toggle.bind(this));
element.addEventListener("click", evt => {
if (eventName !== null) {
eventBus.dispatch(eventName, {
eventBus.dispatch("reporttelemetry", {
eventBus._on("cursortoolchanged", this.#cursorToolChanged.bind(this));
eventBus._on("scrollmodechanged", this.#scrollModeChanged.bind(this));
eventBus._on("spreadmodechanged", this.#spreadModeChanged.bind(this));
toggleCheckedBtn(cursorSelectToolButton, tool === CursorTool.SELECT);
toggleCheckedBtn(cursorHandToolButton, tool === CursorTool.HAND);
toggleCheckedBtn(scrollPageButton, mode === ScrollMode.PAGE);
toggleCheckedBtn(scrollVerticalButton, mode === ScrollMode.VERTICAL);
toggleCheckedBtn(scrollHorizontalButton, mode === ScrollMode.HORIZONTAL);
toggleCheckedBtn(scrollWrappedButton, mode === ScrollMode.WRAPPED);
const forceScrollModePage = this.pagesCount > PagesCountLimit.FORCE_SCROLL_MODE_PAGE;
scrollPageButton.disabled = forceScrollModePage;
scrollVerticalButton.disabled = forceScrollModePage;
scrollHorizontalButton.disabled = forceScrollModePage;
scrollWrappedButton.disabled = forceScrollModePage;
const isHorizontal = mode === ScrollMode.HORIZONTAL;
spreadNoneButton.disabled = isHorizontal;
spreadOddButton.disabled = isHorizontal;
spreadEvenButton.disabled = isHorizontal;
toggleCheckedBtn(spreadNoneButton, mode === SpreadMode.NONE);
toggleCheckedBtn(spreadOddButton, mode === SpreadMode.ODD);
toggleCheckedBtn(spreadEvenButton, mode === SpreadMode.EVEN);
toggleExpandedBtn(toggleButton, true, toolbar);
toggleExpandedBtn(toggleButton, false, toolbar);
;// CONCATENATED MODULE: ./web/toolbar.js
constructor(options, eventBus) {
this.eventBus = eventBus;
element: options.previous,
eventName: "previouspage"
element: options.zoomOut,
element: options.download,
element: options.editorFreeTextButton,
eventName: "switchannotationeditormode",
} = options.editorFreeTextButton;
return classList.contains("toggled") ? AnnotationEditorType.NONE : AnnotationEditorType.FREETEXT;
element: options.editorHighlightButton,
eventName: "switchannotationeditormode",
} = options.editorHighlightButton;
return classList.contains("toggled") ? AnnotationEditorType.NONE : AnnotationEditorType.HIGHLIGHT;
element: options.editorInkButton,
eventName: "switchannotationeditormode",
} = options.editorInkButton;
return classList.contains("toggled") ? AnnotationEditorType.NONE : AnnotationEditorType.INK;
element: options.editorStampButton,
eventName: "switchannotationeditormode",
} = options.editorStampButton;
return classList.contains("toggled") ? AnnotationEditorType.NONE : AnnotationEditorType.STAMP;
this.#bindListeners(buttons);
if (options.editorHighlightColorPicker) {
eventBus._on("annotationeditoruimanager", ({
this.#setAnnotationEditorUIManager(uiManager, options.editorHighlightColorPicker);
eventBus._on("showannotationeditorui", ({
case AnnotationEditorType.HIGHLIGHT:
options.editorHighlightButton.click();
#setAnnotationEditorUIManager(uiManager, parentContainer) {
const colorPicker = new ColorPicker({
uiManager.setMainHighlightColorPicker(colorPicker);
parentContainer.append(colorPicker.renderMainDropdown());
setPageNumber(pageNumber, pageLabel) {
this.pageNumber = pageNumber;
this.pageLabel = pageLabel;
this.#updateUIState(false);
setPagesCount(pagesCount, hasPageLabels) {
this.pagesCount = pagesCount;
this.hasPageLabels = hasPageLabels;
this.#updateUIState(true);
setPageScale(pageScaleValue, pageScale) {
this.pageScaleValue = (pageScaleValue || pageScale).toString();
this.pageScale = pageScale;
this.#updateUIState(false);
this.hasPageLabels = false;
this.pageScaleValue = DEFAULT_SCALE_VALUE;
this.pageScale = DEFAULT_SCALE;
this.#updateUIState(true);
this.updateLoadingIndicatorState();
this.#editorModeChanged({
mode: AnnotationEditorType.DISABLE
#bindListeners(buttons) {
element.addEventListener("click", evt => {
if (eventName !== null) {
eventBus.dispatch(eventName, {
isFromKeyboard: evt.detail === 0
pageNumber.addEventListener("click", function () {
pageNumber.addEventListener("change", function () {
eventBus.dispatch("pagenumberchanged", {
scaleSelect.addEventListener("change", function () {
if (this.value === "custom") {
eventBus.dispatch("scalechanged", {
scaleSelect.addEventListener("click", function ({
if (this.value === self.pageScaleValue && target.tagName.toUpperCase() === "OPTION") {
scaleSelect.oncontextmenu = noContextMenu;
eventBus._on("annotationeditormodechanged", this.#editorModeChanged.bind(this));
editorFreeTextParamsToolbar,
editorHighlightParamsToolbar,
toggleCheckedBtn(editorFreeTextButton, mode === AnnotationEditorType.FREETEXT, editorFreeTextParamsToolbar);
toggleCheckedBtn(editorHighlightButton, mode === AnnotationEditorType.HIGHLIGHT, editorHighlightParamsToolbar);
toggleCheckedBtn(editorInkButton, mode === AnnotationEditorType.INK, editorInkParamsToolbar);
toggleCheckedBtn(editorStampButton, mode === AnnotationEditorType.STAMP, editorStampParamsToolbar);
const isDisable = mode === AnnotationEditorType.DISABLE;
editorFreeTextButton.disabled = isDisable;
editorHighlightButton.disabled = isDisable;
editorInkButton.disabled = isDisable;
editorStampButton.disabled = isDisable;
#updateUIState(resetNumPages = false) {
if (this.hasPageLabels) {
opts.pageNumber.type = "text";
opts.numPages.setAttribute("data-l10n-id", "pdfjs-page-of-pages");
opts.pageNumber.type = "number";
opts.numPages.setAttribute("data-l10n-id", "pdfjs-of-pages");
opts.numPages.setAttribute("data-l10n-args", JSON.stringify({
opts.pageNumber.max = pagesCount;
if (this.hasPageLabels) {
opts.pageNumber.value = this.pageLabel;
opts.numPages.setAttribute("data-l10n-args", JSON.stringify({
opts.pageNumber.value = pageNumber;
opts.previous.disabled = pageNumber <= 1;
opts.next.disabled = pageNumber >= pagesCount;
opts.zoomOut.disabled = pageScale <= MIN_SCALE;
opts.zoomIn.disabled = pageScale >= MAX_SCALE;
let predefinedValueFound = false;
for (const option of opts.scaleSelect.options) {
if (option.value !== pageScaleValue) {
predefinedValueFound = true;
if (!predefinedValueFound) {
opts.customScaleOption.selected = true;
opts.customScaleOption.setAttribute("data-l10n-args", JSON.stringify({
scale: Math.round(pageScale * 10000) / 100
updateLoadingIndicatorState(loading = false) {
pageNumber.classList.toggle("loading", loading);
;// CONCATENATED MODULE: ./web/view_history.js
const DEFAULT_VIEW_HISTORY_CACHE_SIZE = 20;
constructor(fingerprint, cacheSize = DEFAULT_VIEW_HISTORY_CACHE_SIZE) {
this.fingerprint = fingerprint;
this.cacheSize = cacheSize;
this._initializedPromise = this._readFromStorage().then(databaseStr => {
const database = JSON.parse(databaseStr || "{}");
if (!Array.isArray(database.files)) {