Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-conte.../plugins/embedpre.../assets/pdf/web
File: viewer.js
optionalContentConfigPromise.then(optionalContentConfig => {
[13500] Fix | Delete
if (optionalContentConfigPromise !== this._optionalContentConfigPromise) {
[13501] Fix | Delete
return;
[13502] Fix | Delete
}
[13503] Fix | Delete
this.#useThumbnailCanvas.initialOptionalContent = optionalContentConfig.hasInitialVisibility;
[13504] Fix | Delete
});
[13505] Fix | Delete
}
[13506] Fix | Delete
this.#useThumbnailCanvas.directDrawing = true;
[13507] Fix | Delete
const totalRotation = (this.rotation + this.pdfPageRotate) % 360;
[13508] Fix | Delete
this.viewport = this.viewport.clone({
[13509] Fix | Delete
scale: this.scale * PixelsPerInch.PDF_TO_CSS_UNITS,
[13510] Fix | Delete
rotation: totalRotation
[13511] Fix | Delete
});
[13512] Fix | Delete
this.#setDimensions();
[13513] Fix | Delete
if (this._isStandalone) {
[13514] Fix | Delete
this._container?.style.setProperty("--scale-factor", this.viewport.scale);
[13515] Fix | Delete
}
[13516] Fix | Delete
if (this.canvas) {
[13517] Fix | Delete
let onlyCssZoom = false;
[13518] Fix | Delete
if (this.#hasRestrictedScaling) {
[13519] Fix | Delete
if (this.maxCanvasPixels === 0) {
[13520] Fix | Delete
onlyCssZoom = true;
[13521] Fix | Delete
} else if (this.maxCanvasPixels > 0) {
[13522] Fix | Delete
const {
[13523] Fix | Delete
width,
[13524] Fix | Delete
height
[13525] Fix | Delete
} = this.viewport;
[13526] Fix | Delete
const {
[13527] Fix | Delete
sx,
[13528] Fix | Delete
sy
[13529] Fix | Delete
} = this.outputScale;
[13530] Fix | Delete
onlyCssZoom = (Math.floor(width) * sx | 0) * (Math.floor(height) * sy | 0) > this.maxCanvasPixels;
[13531] Fix | Delete
}
[13532] Fix | Delete
}
[13533] Fix | Delete
const postponeDrawing = drawingDelay >= 0 && drawingDelay < 1000;
[13534] Fix | Delete
if (postponeDrawing || onlyCssZoom) {
[13535] Fix | Delete
if (postponeDrawing && !onlyCssZoom && this.renderingState !== RenderingStates.FINISHED) {
[13536] Fix | Delete
this.cancelRendering({
[13537] Fix | Delete
keepZoomLayer: true,
[13538] Fix | Delete
keepAnnotationLayer: true,
[13539] Fix | Delete
keepAnnotationEditorLayer: true,
[13540] Fix | Delete
keepXfaLayer: true,
[13541] Fix | Delete
keepTextLayer: true,
[13542] Fix | Delete
cancelExtraDelay: drawingDelay
[13543] Fix | Delete
});
[13544] Fix | Delete
this.renderingState = RenderingStates.FINISHED;
[13545] Fix | Delete
this.#useThumbnailCanvas.directDrawing = false;
[13546] Fix | Delete
}
[13547] Fix | Delete
this.cssTransform({
[13548] Fix | Delete
target: this.canvas,
[13549] Fix | Delete
redrawAnnotationLayer: true,
[13550] Fix | Delete
redrawAnnotationEditorLayer: true,
[13551] Fix | Delete
redrawXfaLayer: true,
[13552] Fix | Delete
redrawTextLayer: !postponeDrawing,
[13553] Fix | Delete
hideTextLayer: postponeDrawing
[13554] Fix | Delete
});
[13555] Fix | Delete
if (postponeDrawing) {
[13556] Fix | Delete
return;
[13557] Fix | Delete
}
[13558] Fix | Delete
this.eventBus.dispatch("pagerendered", {
[13559] Fix | Delete
source: this,
[13560] Fix | Delete
pageNumber: this.id,
[13561] Fix | Delete
cssTransform: true,
[13562] Fix | Delete
timestamp: performance.now(),
[13563] Fix | Delete
error: this.#renderError
[13564] Fix | Delete
});
[13565] Fix | Delete
return;
[13566] Fix | Delete
}
[13567] Fix | Delete
if (!this.zoomLayer && !this.canvas.hidden) {
[13568] Fix | Delete
this.zoomLayer = this.canvas.parentNode;
[13569] Fix | Delete
this.zoomLayer.style.position = "absolute";
[13570] Fix | Delete
}
[13571] Fix | Delete
}
[13572] Fix | Delete
if (this.zoomLayer) {
[13573] Fix | Delete
this.cssTransform({
[13574] Fix | Delete
target: this.zoomLayer.firstChild
[13575] Fix | Delete
});
[13576] Fix | Delete
}
[13577] Fix | Delete
this.reset({
[13578] Fix | Delete
keepZoomLayer: true,
[13579] Fix | Delete
keepAnnotationLayer: true,
[13580] Fix | Delete
keepAnnotationEditorLayer: true,
[13581] Fix | Delete
keepXfaLayer: true,
[13582] Fix | Delete
keepTextLayer: true
[13583] Fix | Delete
});
[13584] Fix | Delete
}
[13585] Fix | Delete
cancelRendering({
[13586] Fix | Delete
keepAnnotationLayer = false,
[13587] Fix | Delete
keepAnnotationEditorLayer = false,
[13588] Fix | Delete
keepXfaLayer = false,
[13589] Fix | Delete
keepTextLayer = false,
[13590] Fix | Delete
cancelExtraDelay = 0
[13591] Fix | Delete
} = {}) {
[13592] Fix | Delete
if (this.renderTask) {
[13593] Fix | Delete
this.renderTask.cancel(cancelExtraDelay);
[13594] Fix | Delete
this.renderTask = null;
[13595] Fix | Delete
}
[13596] Fix | Delete
this.resume = null;
[13597] Fix | Delete
if (this.textLayer && (!keepTextLayer || !this.textLayer.div)) {
[13598] Fix | Delete
this.textLayer.cancel();
[13599] Fix | Delete
this.textLayer = null;
[13600] Fix | Delete
}
[13601] Fix | Delete
if (this.structTreeLayer && !this.textLayer) {
[13602] Fix | Delete
this.structTreeLayer = null;
[13603] Fix | Delete
}
[13604] Fix | Delete
if (this.annotationLayer && (!keepAnnotationLayer || !this.annotationLayer.div)) {
[13605] Fix | Delete
this.annotationLayer.cancel();
[13606] Fix | Delete
this.annotationLayer = null;
[13607] Fix | Delete
this._annotationCanvasMap = null;
[13608] Fix | Delete
}
[13609] Fix | Delete
if (this.annotationEditorLayer && (!keepAnnotationEditorLayer || !this.annotationEditorLayer.div)) {
[13610] Fix | Delete
if (this.drawLayer) {
[13611] Fix | Delete
this.drawLayer.cancel();
[13612] Fix | Delete
this.drawLayer = null;
[13613] Fix | Delete
}
[13614] Fix | Delete
this.annotationEditorLayer.cancel();
[13615] Fix | Delete
this.annotationEditorLayer = null;
[13616] Fix | Delete
}
[13617] Fix | Delete
if (this.xfaLayer && (!keepXfaLayer || !this.xfaLayer.div)) {
[13618] Fix | Delete
this.xfaLayer.cancel();
[13619] Fix | Delete
this.xfaLayer = null;
[13620] Fix | Delete
this._textHighlighter?.disable();
[13621] Fix | Delete
}
[13622] Fix | Delete
}
[13623] Fix | Delete
cssTransform({
[13624] Fix | Delete
target,
[13625] Fix | Delete
redrawAnnotationLayer = false,
[13626] Fix | Delete
redrawAnnotationEditorLayer = false,
[13627] Fix | Delete
redrawXfaLayer = false,
[13628] Fix | Delete
redrawTextLayer = false,
[13629] Fix | Delete
hideTextLayer = false
[13630] Fix | Delete
}) {
[13631] Fix | Delete
if (!target.hasAttribute("zooming")) {
[13632] Fix | Delete
target.setAttribute("zooming", true);
[13633] Fix | Delete
const {
[13634] Fix | Delete
style
[13635] Fix | Delete
} = target;
[13636] Fix | Delete
style.width = style.height = "";
[13637] Fix | Delete
}
[13638] Fix | Delete
const originalViewport = this.#viewportMap.get(target);
[13639] Fix | Delete
if (this.viewport !== originalViewport) {
[13640] Fix | Delete
const relativeRotation = this.viewport.rotation - originalViewport.rotation;
[13641] Fix | Delete
const absRotation = Math.abs(relativeRotation);
[13642] Fix | Delete
let scaleX = 1,
[13643] Fix | Delete
scaleY = 1;
[13644] Fix | Delete
if (absRotation === 90 || absRotation === 270) {
[13645] Fix | Delete
const {
[13646] Fix | Delete
width,
[13647] Fix | Delete
height
[13648] Fix | Delete
} = this.viewport;
[13649] Fix | Delete
scaleX = height / width;
[13650] Fix | Delete
scaleY = width / height;
[13651] Fix | Delete
}
[13652] Fix | Delete
target.style.transform = `rotate(${relativeRotation}deg) scale(${scaleX}, ${scaleY})`;
[13653] Fix | Delete
}
[13654] Fix | Delete
if (redrawAnnotationLayer && this.annotationLayer) {
[13655] Fix | Delete
this.#renderAnnotationLayer();
[13656] Fix | Delete
}
[13657] Fix | Delete
if (redrawAnnotationEditorLayer && this.annotationEditorLayer) {
[13658] Fix | Delete
if (this.drawLayer) {
[13659] Fix | Delete
this.#renderDrawLayer();
[13660] Fix | Delete
}
[13661] Fix | Delete
this.#renderAnnotationEditorLayer();
[13662] Fix | Delete
}
[13663] Fix | Delete
if (redrawXfaLayer && this.xfaLayer) {
[13664] Fix | Delete
this.#renderXfaLayer();
[13665] Fix | Delete
}
[13666] Fix | Delete
if (this.textLayer) {
[13667] Fix | Delete
if (hideTextLayer) {
[13668] Fix | Delete
this.textLayer.hide();
[13669] Fix | Delete
this.structTreeLayer?.hide();
[13670] Fix | Delete
} else if (redrawTextLayer) {
[13671] Fix | Delete
this.#renderTextLayer();
[13672] Fix | Delete
}
[13673] Fix | Delete
}
[13674] Fix | Delete
}
[13675] Fix | Delete
get width() {
[13676] Fix | Delete
return this.viewport.width;
[13677] Fix | Delete
}
[13678] Fix | Delete
get height() {
[13679] Fix | Delete
return this.viewport.height;
[13680] Fix | Delete
}
[13681] Fix | Delete
getPagePoint(x, y) {
[13682] Fix | Delete
return this.viewport.convertToPdfPoint(x, y);
[13683] Fix | Delete
}
[13684] Fix | Delete
async #finishRenderTask(renderTask, error = null) {
[13685] Fix | Delete
if (renderTask === this.renderTask) {
[13686] Fix | Delete
this.renderTask = null;
[13687] Fix | Delete
}
[13688] Fix | Delete
if (error instanceof RenderingCancelledException) {
[13689] Fix | Delete
this.#renderError = null;
[13690] Fix | Delete
return;
[13691] Fix | Delete
}
[13692] Fix | Delete
this.#renderError = error;
[13693] Fix | Delete
this.renderingState = RenderingStates.FINISHED;
[13694] Fix | Delete
this._resetZoomLayer(true);
[13695] Fix | Delete
this.#useThumbnailCanvas.regularAnnotations = !renderTask.separateAnnots;
[13696] Fix | Delete
this.eventBus.dispatch("pagerendered", {
[13697] Fix | Delete
source: this,
[13698] Fix | Delete
pageNumber: this.id,
[13699] Fix | Delete
cssTransform: false,
[13700] Fix | Delete
timestamp: performance.now(),
[13701] Fix | Delete
error: this.#renderError
[13702] Fix | Delete
});
[13703] Fix | Delete
if (error) {
[13704] Fix | Delete
throw error;
[13705] Fix | Delete
}
[13706] Fix | Delete
}
[13707] Fix | Delete
async draw() {
[13708] Fix | Delete
if (this.renderingState !== RenderingStates.INITIAL) {
[13709] Fix | Delete
console.error("Must be in new state before drawing");
[13710] Fix | Delete
this.reset();
[13711] Fix | Delete
}
[13712] Fix | Delete
const {
[13713] Fix | Delete
div,
[13714] Fix | Delete
l10n,
[13715] Fix | Delete
pageColors,
[13716] Fix | Delete
pdfPage,
[13717] Fix | Delete
viewport
[13718] Fix | Delete
} = this;
[13719] Fix | Delete
if (!pdfPage) {
[13720] Fix | Delete
this.renderingState = RenderingStates.FINISHED;
[13721] Fix | Delete
throw new Error("pdfPage is not loaded");
[13722] Fix | Delete
}
[13723] Fix | Delete
this.renderingState = RenderingStates.RUNNING;
[13724] Fix | Delete
const canvasWrapper = document.createElement("div");
[13725] Fix | Delete
canvasWrapper.classList.add("canvasWrapper");
[13726] Fix | Delete
this.#addLayer(canvasWrapper, "canvasWrapper");
[13727] Fix | Delete
if (!this.textLayer && this.#textLayerMode !== TextLayerMode.DISABLE && !pdfPage.isPureXfa) {
[13728] Fix | Delete
this._accessibilityManager ||= new TextAccessibilityManager();
[13729] Fix | Delete
this.textLayer = new TextLayerBuilder({
[13730] Fix | Delete
pdfPage,
[13731] Fix | Delete
highlighter: this._textHighlighter,
[13732] Fix | Delete
accessibilityManager: this._accessibilityManager,
[13733] Fix | Delete
enablePermissions: this.#textLayerMode === TextLayerMode.ENABLE_PERMISSIONS,
[13734] Fix | Delete
onAppend: textLayerDiv => {
[13735] Fix | Delete
this.l10n.pause();
[13736] Fix | Delete
this.#addLayer(textLayerDiv, "textLayer");
[13737] Fix | Delete
this.l10n.resume();
[13738] Fix | Delete
}
[13739] Fix | Delete
});
[13740] Fix | Delete
}
[13741] Fix | Delete
if (!this.annotationLayer && this.#annotationMode !== AnnotationMode.DISABLE) {
[13742] Fix | Delete
const {
[13743] Fix | Delete
annotationStorage,
[13744] Fix | Delete
annotationEditorUIManager,
[13745] Fix | Delete
downloadManager,
[13746] Fix | Delete
enableScripting,
[13747] Fix | Delete
fieldObjectsPromise,
[13748] Fix | Delete
hasJSActionsPromise,
[13749] Fix | Delete
linkService
[13750] Fix | Delete
} = this.#layerProperties;
[13751] Fix | Delete
this._annotationCanvasMap ||= new Map();
[13752] Fix | Delete
this.annotationLayer = new AnnotationLayerBuilder({
[13753] Fix | Delete
pdfPage,
[13754] Fix | Delete
annotationStorage,
[13755] Fix | Delete
imageResourcesPath: this.imageResourcesPath,
[13756] Fix | Delete
renderForms: this.#annotationMode === AnnotationMode.ENABLE_FORMS,
[13757] Fix | Delete
linkService,
[13758] Fix | Delete
downloadManager,
[13759] Fix | Delete
enableScripting,
[13760] Fix | Delete
hasJSActionsPromise,
[13761] Fix | Delete
fieldObjectsPromise,
[13762] Fix | Delete
annotationCanvasMap: this._annotationCanvasMap,
[13763] Fix | Delete
accessibilityManager: this._accessibilityManager,
[13764] Fix | Delete
annotationEditorUIManager,
[13765] Fix | Delete
onAppend: annotationLayerDiv => {
[13766] Fix | Delete
this.#addLayer(annotationLayerDiv, "annotationLayer");
[13767] Fix | Delete
}
[13768] Fix | Delete
});
[13769] Fix | Delete
}
[13770] Fix | Delete
const renderContinueCallback = cont => {
[13771] Fix | Delete
showCanvas?.(false);
[13772] Fix | Delete
if (this.renderingQueue && !this.renderingQueue.isHighestPriority(this)) {
[13773] Fix | Delete
this.renderingState = RenderingStates.PAUSED;
[13774] Fix | Delete
this.resume = () => {
[13775] Fix | Delete
this.renderingState = RenderingStates.RUNNING;
[13776] Fix | Delete
cont();
[13777] Fix | Delete
};
[13778] Fix | Delete
return;
[13779] Fix | Delete
}
[13780] Fix | Delete
cont();
[13781] Fix | Delete
};
[13782] Fix | Delete
const {
[13783] Fix | Delete
width,
[13784] Fix | Delete
height
[13785] Fix | Delete
} = viewport;
[13786] Fix | Delete
const canvas = document.createElement("canvas");
[13787] Fix | Delete
canvas.setAttribute("role", "presentation");
[13788] Fix | Delete
canvas.hidden = true;
[13789] Fix | Delete
const hasHCM = !!(pageColors?.background && pageColors?.foreground);
[13790] Fix | Delete
let showCanvas = isLastShow => {
[13791] Fix | Delete
if (!hasHCM || isLastShow) {
[13792] Fix | Delete
canvas.hidden = false;
[13793] Fix | Delete
showCanvas = null;
[13794] Fix | Delete
}
[13795] Fix | Delete
};
[13796] Fix | Delete
canvasWrapper.append(canvas);
[13797] Fix | Delete
this.canvas = canvas;
[13798] Fix | Delete
const ctx = canvas.getContext("2d", {
[13799] Fix | Delete
alpha: false
[13800] Fix | Delete
});
[13801] Fix | Delete
const outputScale = this.outputScale = new OutputScale();
[13802] Fix | Delete
if (this.maxCanvasPixels === 0) {
[13803] Fix | Delete
const invScale = 1 / this.scale;
[13804] Fix | Delete
outputScale.sx *= invScale;
[13805] Fix | Delete
outputScale.sy *= invScale;
[13806] Fix | Delete
this.#hasRestrictedScaling = true;
[13807] Fix | Delete
} else if (this.maxCanvasPixels > 0) {
[13808] Fix | Delete
const pixelsInViewport = width * height;
[13809] Fix | Delete
const maxScale = Math.sqrt(this.maxCanvasPixels / pixelsInViewport);
[13810] Fix | Delete
if (outputScale.sx > maxScale || outputScale.sy > maxScale) {
[13811] Fix | Delete
outputScale.sx = maxScale;
[13812] Fix | Delete
outputScale.sy = maxScale;
[13813] Fix | Delete
this.#hasRestrictedScaling = true;
[13814] Fix | Delete
} else {
[13815] Fix | Delete
this.#hasRestrictedScaling = false;
[13816] Fix | Delete
}
[13817] Fix | Delete
}
[13818] Fix | Delete
const sfx = approximateFraction(outputScale.sx);
[13819] Fix | Delete
const sfy = approximateFraction(outputScale.sy);
[13820] Fix | Delete
canvas.width = roundToDivide(width * outputScale.sx, sfx[0]);
[13821] Fix | Delete
canvas.height = roundToDivide(height * outputScale.sy, sfy[0]);
[13822] Fix | Delete
const {
[13823] Fix | Delete
style
[13824] Fix | Delete
} = canvas;
[13825] Fix | Delete
style.width = roundToDivide(width, sfx[1]) + "px";
[13826] Fix | Delete
style.height = roundToDivide(height, sfy[1]) + "px";
[13827] Fix | Delete
this.#viewportMap.set(canvas, viewport);
[13828] Fix | Delete
const transform = outputScale.scaled ? [outputScale.sx, 0, 0, outputScale.sy, 0, 0] : null;
[13829] Fix | Delete
const renderContext = {
[13830] Fix | Delete
canvasContext: ctx,
[13831] Fix | Delete
transform,
[13832] Fix | Delete
viewport,
[13833] Fix | Delete
annotationMode: this.#annotationMode,
[13834] Fix | Delete
optionalContentConfigPromise: this._optionalContentConfigPromise,
[13835] Fix | Delete
annotationCanvasMap: this._annotationCanvasMap,
[13836] Fix | Delete
pageColors
[13837] Fix | Delete
};
[13838] Fix | Delete
const renderTask = this.renderTask = pdfPage.render(renderContext);
[13839] Fix | Delete
renderTask.onContinue = renderContinueCallback;
[13840] Fix | Delete
const resultPromise = renderTask.promise.then(async () => {
[13841] Fix | Delete
showCanvas?.(true);
[13842] Fix | Delete
await this.#finishRenderTask(renderTask);
[13843] Fix | Delete
this.#renderTextLayer();
[13844] Fix | Delete
if (this.annotationLayer) {
[13845] Fix | Delete
await this.#renderAnnotationLayer();
[13846] Fix | Delete
}
[13847] Fix | Delete
const {
[13848] Fix | Delete
annotationEditorUIManager
[13849] Fix | Delete
} = this.#layerProperties;
[13850] Fix | Delete
if (!annotationEditorUIManager) {
[13851] Fix | Delete
return;
[13852] Fix | Delete
}
[13853] Fix | Delete
this.drawLayer ||= new DrawLayerBuilder({
[13854] Fix | Delete
pageIndex: this.id
[13855] Fix | Delete
});
[13856] Fix | Delete
await this.#renderDrawLayer();
[13857] Fix | Delete
this.drawLayer.setParent(canvasWrapper);
[13858] Fix | Delete
if (!this.annotationEditorLayer) {
[13859] Fix | Delete
this.annotationEditorLayer = new AnnotationEditorLayerBuilder({
[13860] Fix | Delete
uiManager: annotationEditorUIManager,
[13861] Fix | Delete
pdfPage,
[13862] Fix | Delete
l10n,
[13863] Fix | Delete
accessibilityManager: this._accessibilityManager,
[13864] Fix | Delete
annotationLayer: this.annotationLayer?.annotationLayer,
[13865] Fix | Delete
textLayer: this.textLayer,
[13866] Fix | Delete
drawLayer: this.drawLayer.getDrawLayer(),
[13867] Fix | Delete
onAppend: annotationEditorLayerDiv => {
[13868] Fix | Delete
this.#addLayer(annotationEditorLayerDiv, "annotationEditorLayer");
[13869] Fix | Delete
}
[13870] Fix | Delete
});
[13871] Fix | Delete
}
[13872] Fix | Delete
this.#renderAnnotationEditorLayer();
[13873] Fix | Delete
}, error => {
[13874] Fix | Delete
if (!(error instanceof RenderingCancelledException)) {
[13875] Fix | Delete
showCanvas?.(true);
[13876] Fix | Delete
}
[13877] Fix | Delete
return this.#finishRenderTask(renderTask, error);
[13878] Fix | Delete
});
[13879] Fix | Delete
if (pdfPage.isPureXfa) {
[13880] Fix | Delete
if (!this.xfaLayer) {
[13881] Fix | Delete
const {
[13882] Fix | Delete
annotationStorage,
[13883] Fix | Delete
linkService
[13884] Fix | Delete
} = this.#layerProperties;
[13885] Fix | Delete
this.xfaLayer = new XfaLayerBuilder({
[13886] Fix | Delete
pdfPage,
[13887] Fix | Delete
annotationStorage,
[13888] Fix | Delete
linkService
[13889] Fix | Delete
});
[13890] Fix | Delete
}
[13891] Fix | Delete
this.#renderXfaLayer();
[13892] Fix | Delete
}
[13893] Fix | Delete
div.setAttribute("data-loaded", true);
[13894] Fix | Delete
this.eventBus.dispatch("pagerender", {
[13895] Fix | Delete
source: this,
[13896] Fix | Delete
pageNumber: this.id
[13897] Fix | Delete
});
[13898] Fix | Delete
return resultPromise;
[13899] Fix | Delete
}
[13900] Fix | Delete
setPageLabel(label) {
[13901] Fix | Delete
this.pageLabel = typeof label === "string" ? label : null;
[13902] Fix | Delete
this.div.setAttribute("data-l10n-args", JSON.stringify({
[13903] Fix | Delete
page: this.pageLabel ?? this.id
[13904] Fix | Delete
}));
[13905] Fix | Delete
if (this.pageLabel !== null) {
[13906] Fix | Delete
this.div.setAttribute("data-page-label", this.pageLabel);
[13907] Fix | Delete
} else {
[13908] Fix | Delete
this.div.removeAttribute("data-page-label");
[13909] Fix | Delete
}
[13910] Fix | Delete
}
[13911] Fix | Delete
get thumbnailCanvas() {
[13912] Fix | Delete
const {
[13913] Fix | Delete
directDrawing,
[13914] Fix | Delete
initialOptionalContent,
[13915] Fix | Delete
regularAnnotations
[13916] Fix | Delete
} = this.#useThumbnailCanvas;
[13917] Fix | Delete
return directDrawing && initialOptionalContent && regularAnnotations ? this.canvas : null;
[13918] Fix | Delete
}
[13919] Fix | Delete
}
[13920] Fix | Delete
[13921] Fix | Delete
;// CONCATENATED MODULE: ./web/pdf_viewer.js
[13922] Fix | Delete
[13923] Fix | Delete
[13924] Fix | Delete
[13925] Fix | Delete
[13926] Fix | Delete
[13927] Fix | Delete
[13928] Fix | Delete
[13929] Fix | Delete
[13930] Fix | Delete
[13931] Fix | Delete
[13932] Fix | Delete
[13933] Fix | Delete
[13934] Fix | Delete
[13935] Fix | Delete
[13936] Fix | Delete
[13937] Fix | Delete
[13938] Fix | Delete
[13939] Fix | Delete
[13940] Fix | Delete
const DEFAULT_CACHE_SIZE = 10;
[13941] Fix | Delete
const PagesCountLimit = {
[13942] Fix | Delete
FORCE_SCROLL_MODE_PAGE: 15000,
[13943] Fix | Delete
FORCE_LAZY_PAGE_INIT: 7500,
[13944] Fix | Delete
PAUSE_EAGER_PAGE_INIT: 250
[13945] Fix | Delete
};
[13946] Fix | Delete
function isValidAnnotationEditorMode(mode) {
[13947] Fix | Delete
return Object.values(AnnotationEditorType).includes(mode) && mode !== AnnotationEditorType.DISABLE;
[13948] Fix | Delete
}
[13949] Fix | Delete
class PDFPageViewBuffer {
[13950] Fix | Delete
#buf = new Set();
[13951] Fix | Delete
#size = 0;
[13952] Fix | Delete
constructor(size) {
[13953] Fix | Delete
this.#size = size;
[13954] Fix | Delete
}
[13955] Fix | Delete
push(view) {
[13956] Fix | Delete
const buf = this.#buf;
[13957] Fix | Delete
if (buf.has(view)) {
[13958] Fix | Delete
buf.delete(view);
[13959] Fix | Delete
}
[13960] Fix | Delete
buf.add(view);
[13961] Fix | Delete
if (buf.size > this.#size) {
[13962] Fix | Delete
this.#destroyFirstView();
[13963] Fix | Delete
}
[13964] Fix | Delete
}
[13965] Fix | Delete
resize(newSize, idsToKeep = null) {
[13966] Fix | Delete
this.#size = newSize;
[13967] Fix | Delete
const buf = this.#buf;
[13968] Fix | Delete
if (idsToKeep) {
[13969] Fix | Delete
const ii = buf.size;
[13970] Fix | Delete
let i = 1;
[13971] Fix | Delete
for (const view of buf) {
[13972] Fix | Delete
if (idsToKeep.has(view.id)) {
[13973] Fix | Delete
buf.delete(view);
[13974] Fix | Delete
buf.add(view);
[13975] Fix | Delete
}
[13976] Fix | Delete
if (++i > ii) {
[13977] Fix | Delete
break;
[13978] Fix | Delete
}
[13979] Fix | Delete
}
[13980] Fix | Delete
}
[13981] Fix | Delete
while (buf.size > this.#size) {
[13982] Fix | Delete
this.#destroyFirstView();
[13983] Fix | Delete
}
[13984] Fix | Delete
}
[13985] Fix | Delete
has(view) {
[13986] Fix | Delete
return this.#buf.has(view);
[13987] Fix | Delete
}
[13988] Fix | Delete
[Symbol.iterator]() {
[13989] Fix | Delete
return this.#buf.keys();
[13990] Fix | Delete
}
[13991] Fix | Delete
#destroyFirstView() {
[13992] Fix | Delete
const firstView = this.#buf.keys().next().value;
[13993] Fix | Delete
firstView?.destroy();
[13994] Fix | Delete
this.#buf.delete(firstView);
[13995] Fix | Delete
}
[13996] Fix | Delete
}
[13997] Fix | Delete
class PDFViewer {
[13998] Fix | Delete
#buffer = null;
[13999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function