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/wp-conte.../plugins/embedpre.../assets/pdf/build
File: script.js
this.ctx.clip();
[12500] Fix | Delete
this.endPath();
[12501] Fix | Delete
}
[12502] Fix | Delete
}
[12503] Fix | Delete
this.current = new CanvasExtraState(this.ctx.canvas.width, this.ctx.canvas.height);
[12504] Fix | Delete
this.transform(...transform);
[12505] Fix | Delete
this.transform(...matrix);
[12506] Fix | Delete
}
[12507] Fix | Delete
endAnnotation() {
[12508] Fix | Delete
if (this.annotationCanvas) {
[12509] Fix | Delete
this.ctx.restore();
[12510] Fix | Delete
this.#drawFilter();
[12511] Fix | Delete
this.ctx = this.annotationCanvas.savedCtx;
[12512] Fix | Delete
delete this.annotationCanvas.savedCtx;
[12513] Fix | Delete
delete this.annotationCanvas;
[12514] Fix | Delete
}
[12515] Fix | Delete
}
[12516] Fix | Delete
paintImageMaskXObject(img) {
[12517] Fix | Delete
if (!this.contentVisible) {
[12518] Fix | Delete
return;
[12519] Fix | Delete
}
[12520] Fix | Delete
const count = img.count;
[12521] Fix | Delete
img = this.getObject(img.data, img);
[12522] Fix | Delete
img.count = count;
[12523] Fix | Delete
const ctx = this.ctx;
[12524] Fix | Delete
const glyph = this.processingType3;
[12525] Fix | Delete
if (glyph) {
[12526] Fix | Delete
if (glyph.compiled === undefined) {
[12527] Fix | Delete
glyph.compiled = compileType3Glyph(img);
[12528] Fix | Delete
}
[12529] Fix | Delete
if (glyph.compiled) {
[12530] Fix | Delete
glyph.compiled(ctx);
[12531] Fix | Delete
return;
[12532] Fix | Delete
}
[12533] Fix | Delete
}
[12534] Fix | Delete
const mask = this._createMaskCanvas(img);
[12535] Fix | Delete
const maskCanvas = mask.canvas;
[12536] Fix | Delete
ctx.save();
[12537] Fix | Delete
ctx.setTransform(1, 0, 0, 1, 0, 0);
[12538] Fix | Delete
ctx.drawImage(maskCanvas, mask.offsetX, mask.offsetY);
[12539] Fix | Delete
ctx.restore();
[12540] Fix | Delete
this.compose();
[12541] Fix | Delete
}
[12542] Fix | Delete
paintImageMaskXObjectRepeat(img, scaleX, skewX = 0, skewY = 0, scaleY, positions) {
[12543] Fix | Delete
if (!this.contentVisible) {
[12544] Fix | Delete
return;
[12545] Fix | Delete
}
[12546] Fix | Delete
img = this.getObject(img.data, img);
[12547] Fix | Delete
const ctx = this.ctx;
[12548] Fix | Delete
ctx.save();
[12549] Fix | Delete
const currentTransform = getCurrentTransform(ctx);
[12550] Fix | Delete
ctx.transform(scaleX, skewX, skewY, scaleY, 0, 0);
[12551] Fix | Delete
const mask = this._createMaskCanvas(img);
[12552] Fix | Delete
ctx.setTransform(1, 0, 0, 1, mask.offsetX - currentTransform[4], mask.offsetY - currentTransform[5]);
[12553] Fix | Delete
for (let i = 0, ii = positions.length; i < ii; i += 2) {
[12554] Fix | Delete
const trans = Util.transform(currentTransform, [scaleX, skewX, skewY, scaleY, positions[i], positions[i + 1]]);
[12555] Fix | Delete
const [x, y] = Util.applyTransform([0, 0], trans);
[12556] Fix | Delete
ctx.drawImage(mask.canvas, x, y);
[12557] Fix | Delete
}
[12558] Fix | Delete
ctx.restore();
[12559] Fix | Delete
this.compose();
[12560] Fix | Delete
}
[12561] Fix | Delete
paintImageMaskXObjectGroup(images) {
[12562] Fix | Delete
if (!this.contentVisible) {
[12563] Fix | Delete
return;
[12564] Fix | Delete
}
[12565] Fix | Delete
const ctx = this.ctx;
[12566] Fix | Delete
const fillColor = this.current.fillColor;
[12567] Fix | Delete
const isPatternFill = this.current.patternFill;
[12568] Fix | Delete
for (const image of images) {
[12569] Fix | Delete
const {
[12570] Fix | Delete
data,
[12571] Fix | Delete
width,
[12572] Fix | Delete
height,
[12573] Fix | Delete
transform
[12574] Fix | Delete
} = image;
[12575] Fix | Delete
const maskCanvas = this.cachedCanvases.getCanvas("maskCanvas", width, height);
[12576] Fix | Delete
const maskCtx = maskCanvas.context;
[12577] Fix | Delete
maskCtx.save();
[12578] Fix | Delete
const img = this.getObject(data, image);
[12579] Fix | Delete
putBinaryImageMask(maskCtx, img);
[12580] Fix | Delete
maskCtx.globalCompositeOperation = "source-in";
[12581] Fix | Delete
maskCtx.fillStyle = isPatternFill ? fillColor.getPattern(maskCtx, this, getCurrentTransformInverse(ctx), PathType.FILL) : fillColor;
[12582] Fix | Delete
maskCtx.fillRect(0, 0, width, height);
[12583] Fix | Delete
maskCtx.restore();
[12584] Fix | Delete
ctx.save();
[12585] Fix | Delete
ctx.transform(...transform);
[12586] Fix | Delete
ctx.scale(1, -1);
[12587] Fix | Delete
drawImageAtIntegerCoords(ctx, maskCanvas.canvas, 0, 0, width, height, 0, -1, 1, 1);
[12588] Fix | Delete
ctx.restore();
[12589] Fix | Delete
}
[12590] Fix | Delete
this.compose();
[12591] Fix | Delete
}
[12592] Fix | Delete
paintImageXObject(objId) {
[12593] Fix | Delete
if (!this.contentVisible) {
[12594] Fix | Delete
return;
[12595] Fix | Delete
}
[12596] Fix | Delete
const imgData = this.getObject(objId);
[12597] Fix | Delete
if (!imgData) {
[12598] Fix | Delete
warn("Dependent image isn't ready yet");
[12599] Fix | Delete
return;
[12600] Fix | Delete
}
[12601] Fix | Delete
this.paintInlineImageXObject(imgData);
[12602] Fix | Delete
}
[12603] Fix | Delete
paintImageXObjectRepeat(objId, scaleX, scaleY, positions) {
[12604] Fix | Delete
if (!this.contentVisible) {
[12605] Fix | Delete
return;
[12606] Fix | Delete
}
[12607] Fix | Delete
const imgData = this.getObject(objId);
[12608] Fix | Delete
if (!imgData) {
[12609] Fix | Delete
warn("Dependent image isn't ready yet");
[12610] Fix | Delete
return;
[12611] Fix | Delete
}
[12612] Fix | Delete
const width = imgData.width;
[12613] Fix | Delete
const height = imgData.height;
[12614] Fix | Delete
const map = [];
[12615] Fix | Delete
for (let i = 0, ii = positions.length; i < ii; i += 2) {
[12616] Fix | Delete
map.push({
[12617] Fix | Delete
transform: [scaleX, 0, 0, scaleY, positions[i], positions[i + 1]],
[12618] Fix | Delete
x: 0,
[12619] Fix | Delete
y: 0,
[12620] Fix | Delete
w: width,
[12621] Fix | Delete
h: height
[12622] Fix | Delete
});
[12623] Fix | Delete
}
[12624] Fix | Delete
this.paintInlineImageXObjectGroup(imgData, map);
[12625] Fix | Delete
}
[12626] Fix | Delete
applyTransferMapsToCanvas(ctx) {
[12627] Fix | Delete
if (this.current.transferMaps !== "none") {
[12628] Fix | Delete
ctx.filter = this.current.transferMaps;
[12629] Fix | Delete
ctx.drawImage(ctx.canvas, 0, 0);
[12630] Fix | Delete
ctx.filter = "none";
[12631] Fix | Delete
}
[12632] Fix | Delete
return ctx.canvas;
[12633] Fix | Delete
}
[12634] Fix | Delete
applyTransferMapsToBitmap(imgData) {
[12635] Fix | Delete
if (this.current.transferMaps === "none") {
[12636] Fix | Delete
return imgData.bitmap;
[12637] Fix | Delete
}
[12638] Fix | Delete
const {
[12639] Fix | Delete
bitmap,
[12640] Fix | Delete
width,
[12641] Fix | Delete
height
[12642] Fix | Delete
} = imgData;
[12643] Fix | Delete
const tmpCanvas = this.cachedCanvases.getCanvas("inlineImage", width, height);
[12644] Fix | Delete
const tmpCtx = tmpCanvas.context;
[12645] Fix | Delete
tmpCtx.filter = this.current.transferMaps;
[12646] Fix | Delete
tmpCtx.drawImage(bitmap, 0, 0);
[12647] Fix | Delete
tmpCtx.filter = "none";
[12648] Fix | Delete
return tmpCanvas.canvas;
[12649] Fix | Delete
}
[12650] Fix | Delete
paintInlineImageXObject(imgData) {
[12651] Fix | Delete
if (!this.contentVisible) {
[12652] Fix | Delete
return;
[12653] Fix | Delete
}
[12654] Fix | Delete
const width = imgData.width;
[12655] Fix | Delete
const height = imgData.height;
[12656] Fix | Delete
const ctx = this.ctx;
[12657] Fix | Delete
this.save();
[12658] Fix | Delete
if (!isNodeJS) {
[12659] Fix | Delete
const {
[12660] Fix | Delete
filter
[12661] Fix | Delete
} = ctx;
[12662] Fix | Delete
if (filter !== "none" && filter !== "") {
[12663] Fix | Delete
ctx.filter = "none";
[12664] Fix | Delete
}
[12665] Fix | Delete
}
[12666] Fix | Delete
ctx.scale(1 / width, -1 / height);
[12667] Fix | Delete
let imgToPaint;
[12668] Fix | Delete
if (imgData.bitmap) {
[12669] Fix | Delete
imgToPaint = this.applyTransferMapsToBitmap(imgData);
[12670] Fix | Delete
} else if (typeof HTMLElement === "function" && imgData instanceof HTMLElement || !imgData.data) {
[12671] Fix | Delete
imgToPaint = imgData;
[12672] Fix | Delete
} else {
[12673] Fix | Delete
const tmpCanvas = this.cachedCanvases.getCanvas("inlineImage", width, height);
[12674] Fix | Delete
const tmpCtx = tmpCanvas.context;
[12675] Fix | Delete
putBinaryImageData(tmpCtx, imgData);
[12676] Fix | Delete
imgToPaint = this.applyTransferMapsToCanvas(tmpCtx);
[12677] Fix | Delete
}
[12678] Fix | Delete
const scaled = this._scaleImage(imgToPaint, getCurrentTransformInverse(ctx));
[12679] Fix | Delete
ctx.imageSmoothingEnabled = getImageSmoothingEnabled(getCurrentTransform(ctx), imgData.interpolate);
[12680] Fix | Delete
drawImageAtIntegerCoords(ctx, scaled.img, 0, 0, scaled.paintWidth, scaled.paintHeight, 0, -height, width, height);
[12681] Fix | Delete
this.compose();
[12682] Fix | Delete
this.restore();
[12683] Fix | Delete
}
[12684] Fix | Delete
paintInlineImageXObjectGroup(imgData, map) {
[12685] Fix | Delete
if (!this.contentVisible) {
[12686] Fix | Delete
return;
[12687] Fix | Delete
}
[12688] Fix | Delete
const ctx = this.ctx;
[12689] Fix | Delete
let imgToPaint;
[12690] Fix | Delete
if (imgData.bitmap) {
[12691] Fix | Delete
imgToPaint = imgData.bitmap;
[12692] Fix | Delete
} else {
[12693] Fix | Delete
const w = imgData.width;
[12694] Fix | Delete
const h = imgData.height;
[12695] Fix | Delete
const tmpCanvas = this.cachedCanvases.getCanvas("inlineImage", w, h);
[12696] Fix | Delete
const tmpCtx = tmpCanvas.context;
[12697] Fix | Delete
putBinaryImageData(tmpCtx, imgData);
[12698] Fix | Delete
imgToPaint = this.applyTransferMapsToCanvas(tmpCtx);
[12699] Fix | Delete
}
[12700] Fix | Delete
for (const entry of map) {
[12701] Fix | Delete
ctx.save();
[12702] Fix | Delete
ctx.transform(...entry.transform);
[12703] Fix | Delete
ctx.scale(1, -1);
[12704] Fix | Delete
drawImageAtIntegerCoords(ctx, imgToPaint, entry.x, entry.y, entry.w, entry.h, 0, -1, 1, 1);
[12705] Fix | Delete
ctx.restore();
[12706] Fix | Delete
}
[12707] Fix | Delete
this.compose();
[12708] Fix | Delete
}
[12709] Fix | Delete
paintSolidColorImageMask() {
[12710] Fix | Delete
if (!this.contentVisible) {
[12711] Fix | Delete
return;
[12712] Fix | Delete
}
[12713] Fix | Delete
this.ctx.fillRect(0, 0, 1, 1);
[12714] Fix | Delete
this.compose();
[12715] Fix | Delete
}
[12716] Fix | Delete
markPoint(tag) {}
[12717] Fix | Delete
markPointProps(tag, properties) {}
[12718] Fix | Delete
beginMarkedContent(tag) {
[12719] Fix | Delete
this.markedContentStack.push({
[12720] Fix | Delete
visible: true
[12721] Fix | Delete
});
[12722] Fix | Delete
}
[12723] Fix | Delete
beginMarkedContentProps(tag, properties) {
[12724] Fix | Delete
if (tag === "OC") {
[12725] Fix | Delete
this.markedContentStack.push({
[12726] Fix | Delete
visible: this.optionalContentConfig.isVisible(properties)
[12727] Fix | Delete
});
[12728] Fix | Delete
} else {
[12729] Fix | Delete
this.markedContentStack.push({
[12730] Fix | Delete
visible: true
[12731] Fix | Delete
});
[12732] Fix | Delete
}
[12733] Fix | Delete
this.contentVisible = this.isContentVisible();
[12734] Fix | Delete
}
[12735] Fix | Delete
endMarkedContent() {
[12736] Fix | Delete
this.markedContentStack.pop();
[12737] Fix | Delete
this.contentVisible = this.isContentVisible();
[12738] Fix | Delete
}
[12739] Fix | Delete
beginCompat() {}
[12740] Fix | Delete
endCompat() {}
[12741] Fix | Delete
consumePath(clipBox) {
[12742] Fix | Delete
const isEmpty = this.current.isEmptyClip();
[12743] Fix | Delete
if (this.pendingClip) {
[12744] Fix | Delete
this.current.updateClipFromPath();
[12745] Fix | Delete
}
[12746] Fix | Delete
if (!this.pendingClip) {
[12747] Fix | Delete
this.compose(clipBox);
[12748] Fix | Delete
}
[12749] Fix | Delete
const ctx = this.ctx;
[12750] Fix | Delete
if (this.pendingClip) {
[12751] Fix | Delete
if (!isEmpty) {
[12752] Fix | Delete
if (this.pendingClip === EO_CLIP) {
[12753] Fix | Delete
ctx.clip("evenodd");
[12754] Fix | Delete
} else {
[12755] Fix | Delete
ctx.clip();
[12756] Fix | Delete
}
[12757] Fix | Delete
}
[12758] Fix | Delete
this.pendingClip = null;
[12759] Fix | Delete
}
[12760] Fix | Delete
this.current.startNewPathAndClipBox(this.current.clipBox);
[12761] Fix | Delete
ctx.beginPath();
[12762] Fix | Delete
}
[12763] Fix | Delete
getSinglePixelWidth() {
[12764] Fix | Delete
if (!this._cachedGetSinglePixelWidth) {
[12765] Fix | Delete
const m = getCurrentTransform(this.ctx);
[12766] Fix | Delete
if (m[1] === 0 && m[2] === 0) {
[12767] Fix | Delete
this._cachedGetSinglePixelWidth = 1 / Math.min(Math.abs(m[0]), Math.abs(m[3]));
[12768] Fix | Delete
} else {
[12769] Fix | Delete
const absDet = Math.abs(m[0] * m[3] - m[2] * m[1]);
[12770] Fix | Delete
const normX = Math.hypot(m[0], m[2]);
[12771] Fix | Delete
const normY = Math.hypot(m[1], m[3]);
[12772] Fix | Delete
this._cachedGetSinglePixelWidth = Math.max(normX, normY) / absDet;
[12773] Fix | Delete
}
[12774] Fix | Delete
}
[12775] Fix | Delete
return this._cachedGetSinglePixelWidth;
[12776] Fix | Delete
}
[12777] Fix | Delete
getScaleForStroking() {
[12778] Fix | Delete
if (this._cachedScaleForStroking[0] === -1) {
[12779] Fix | Delete
const {
[12780] Fix | Delete
lineWidth
[12781] Fix | Delete
} = this.current;
[12782] Fix | Delete
const {
[12783] Fix | Delete
a,
[12784] Fix | Delete
b,
[12785] Fix | Delete
c,
[12786] Fix | Delete
d
[12787] Fix | Delete
} = this.ctx.getTransform();
[12788] Fix | Delete
let scaleX, scaleY;
[12789] Fix | Delete
if (b === 0 && c === 0) {
[12790] Fix | Delete
const normX = Math.abs(a);
[12791] Fix | Delete
const normY = Math.abs(d);
[12792] Fix | Delete
if (normX === normY) {
[12793] Fix | Delete
if (lineWidth === 0) {
[12794] Fix | Delete
scaleX = scaleY = 1 / normX;
[12795] Fix | Delete
} else {
[12796] Fix | Delete
const scaledLineWidth = normX * lineWidth;
[12797] Fix | Delete
scaleX = scaleY = scaledLineWidth < 1 ? 1 / scaledLineWidth : 1;
[12798] Fix | Delete
}
[12799] Fix | Delete
} else if (lineWidth === 0) {
[12800] Fix | Delete
scaleX = 1 / normX;
[12801] Fix | Delete
scaleY = 1 / normY;
[12802] Fix | Delete
} else {
[12803] Fix | Delete
const scaledXLineWidth = normX * lineWidth;
[12804] Fix | Delete
const scaledYLineWidth = normY * lineWidth;
[12805] Fix | Delete
scaleX = scaledXLineWidth < 1 ? 1 / scaledXLineWidth : 1;
[12806] Fix | Delete
scaleY = scaledYLineWidth < 1 ? 1 / scaledYLineWidth : 1;
[12807] Fix | Delete
}
[12808] Fix | Delete
} else {
[12809] Fix | Delete
const absDet = Math.abs(a * d - b * c);
[12810] Fix | Delete
const normX = Math.hypot(a, b);
[12811] Fix | Delete
const normY = Math.hypot(c, d);
[12812] Fix | Delete
if (lineWidth === 0) {
[12813] Fix | Delete
scaleX = normY / absDet;
[12814] Fix | Delete
scaleY = normX / absDet;
[12815] Fix | Delete
} else {
[12816] Fix | Delete
const baseArea = lineWidth * absDet;
[12817] Fix | Delete
scaleX = normY > baseArea ? normY / baseArea : 1;
[12818] Fix | Delete
scaleY = normX > baseArea ? normX / baseArea : 1;
[12819] Fix | Delete
}
[12820] Fix | Delete
}
[12821] Fix | Delete
this._cachedScaleForStroking[0] = scaleX;
[12822] Fix | Delete
this._cachedScaleForStroking[1] = scaleY;
[12823] Fix | Delete
}
[12824] Fix | Delete
return this._cachedScaleForStroking;
[12825] Fix | Delete
}
[12826] Fix | Delete
rescaleAndStroke(saveRestore) {
[12827] Fix | Delete
const {
[12828] Fix | Delete
ctx
[12829] Fix | Delete
} = this;
[12830] Fix | Delete
const {
[12831] Fix | Delete
lineWidth
[12832] Fix | Delete
} = this.current;
[12833] Fix | Delete
const [scaleX, scaleY] = this.getScaleForStroking();
[12834] Fix | Delete
ctx.lineWidth = lineWidth || 1;
[12835] Fix | Delete
if (scaleX === 1 && scaleY === 1) {
[12836] Fix | Delete
ctx.stroke();
[12837] Fix | Delete
return;
[12838] Fix | Delete
}
[12839] Fix | Delete
const dashes = ctx.getLineDash();
[12840] Fix | Delete
if (saveRestore) {
[12841] Fix | Delete
ctx.save();
[12842] Fix | Delete
}
[12843] Fix | Delete
ctx.scale(scaleX, scaleY);
[12844] Fix | Delete
if (dashes.length > 0) {
[12845] Fix | Delete
const scale = Math.max(scaleX, scaleY);
[12846] Fix | Delete
ctx.setLineDash(dashes.map(x => x / scale));
[12847] Fix | Delete
ctx.lineDashOffset /= scale;
[12848] Fix | Delete
}
[12849] Fix | Delete
ctx.stroke();
[12850] Fix | Delete
if (saveRestore) {
[12851] Fix | Delete
ctx.restore();
[12852] Fix | Delete
}
[12853] Fix | Delete
}
[12854] Fix | Delete
isContentVisible() {
[12855] Fix | Delete
for (let i = this.markedContentStack.length - 1; i >= 0; i--) {
[12856] Fix | Delete
if (!this.markedContentStack[i].visible) {
[12857] Fix | Delete
return false;
[12858] Fix | Delete
}
[12859] Fix | Delete
}
[12860] Fix | Delete
return true;
[12861] Fix | Delete
}
[12862] Fix | Delete
}
[12863] Fix | Delete
for (const op in OPS) {
[12864] Fix | Delete
if (CanvasGraphics.prototype[op] !== undefined) {
[12865] Fix | Delete
CanvasGraphics.prototype[OPS[op]] = CanvasGraphics.prototype[op];
[12866] Fix | Delete
}
[12867] Fix | Delete
}
[12868] Fix | Delete
[12869] Fix | Delete
;// CONCATENATED MODULE: ./src/display/worker_options.js
[12870] Fix | Delete
class GlobalWorkerOptions {
[12871] Fix | Delete
static #port = null;
[12872] Fix | Delete
static #src = "";
[12873] Fix | Delete
static get workerPort() {
[12874] Fix | Delete
return this.#port;
[12875] Fix | Delete
}
[12876] Fix | Delete
static set workerPort(val) {
[12877] Fix | Delete
if (!(typeof Worker !== "undefined" && val instanceof Worker) && val !== null) {
[12878] Fix | Delete
throw new Error("Invalid `workerPort` type.");
[12879] Fix | Delete
}
[12880] Fix | Delete
this.#port = val;
[12881] Fix | Delete
}
[12882] Fix | Delete
static get workerSrc() {
[12883] Fix | Delete
return this.#src;
[12884] Fix | Delete
}
[12885] Fix | Delete
static set workerSrc(val) {
[12886] Fix | Delete
if (typeof val !== "string") {
[12887] Fix | Delete
throw new Error("Invalid `workerSrc` type.");
[12888] Fix | Delete
}
[12889] Fix | Delete
this.#src = val;
[12890] Fix | Delete
}
[12891] Fix | Delete
}
[12892] Fix | Delete
[12893] Fix | Delete
;// CONCATENATED MODULE: ./src/shared/message_handler.js
[12894] Fix | Delete
[12895] Fix | Delete
[12896] Fix | Delete
const CallbackKind = {
[12897] Fix | Delete
UNKNOWN: 0,
[12898] Fix | Delete
DATA: 1,
[12899] Fix | Delete
ERROR: 2
[12900] Fix | Delete
};
[12901] Fix | Delete
const StreamKind = {
[12902] Fix | Delete
UNKNOWN: 0,
[12903] Fix | Delete
CANCEL: 1,
[12904] Fix | Delete
CANCEL_COMPLETE: 2,
[12905] Fix | Delete
CLOSE: 3,
[12906] Fix | Delete
ENQUEUE: 4,
[12907] Fix | Delete
ERROR: 5,
[12908] Fix | Delete
PULL: 6,
[12909] Fix | Delete
PULL_COMPLETE: 7,
[12910] Fix | Delete
START_COMPLETE: 8
[12911] Fix | Delete
};
[12912] Fix | Delete
function wrapReason(reason) {
[12913] Fix | Delete
if (!(reason instanceof Error || typeof reason === "object" && reason !== null)) {
[12914] Fix | Delete
unreachable('wrapReason: Expected "reason" to be a (possibly cloned) Error.');
[12915] Fix | Delete
}
[12916] Fix | Delete
switch (reason.name) {
[12917] Fix | Delete
case "AbortException":
[12918] Fix | Delete
return new AbortException(reason.message);
[12919] Fix | Delete
case "MissingPDFException":
[12920] Fix | Delete
return new MissingPDFException(reason.message);
[12921] Fix | Delete
case "PasswordException":
[12922] Fix | Delete
return new PasswordException(reason.message, reason.code);
[12923] Fix | Delete
case "UnexpectedResponseException":
[12924] Fix | Delete
return new UnexpectedResponseException(reason.message, reason.status);
[12925] Fix | Delete
case "UnknownErrorException":
[12926] Fix | Delete
return new UnknownErrorException(reason.message, reason.details);
[12927] Fix | Delete
default:
[12928] Fix | Delete
return new UnknownErrorException(reason.message, reason.toString());
[12929] Fix | Delete
}
[12930] Fix | Delete
}
[12931] Fix | Delete
class MessageHandler {
[12932] Fix | Delete
constructor(sourceName, targetName, comObj) {
[12933] Fix | Delete
this.sourceName = sourceName;
[12934] Fix | Delete
this.targetName = targetName;
[12935] Fix | Delete
this.comObj = comObj;
[12936] Fix | Delete
this.callbackId = 1;
[12937] Fix | Delete
this.streamId = 1;
[12938] Fix | Delete
this.streamSinks = Object.create(null);
[12939] Fix | Delete
this.streamControllers = Object.create(null);
[12940] Fix | Delete
this.callbackCapabilities = Object.create(null);
[12941] Fix | Delete
this.actionHandler = Object.create(null);
[12942] Fix | Delete
this._onComObjOnMessage = event => {
[12943] Fix | Delete
const data = event.data;
[12944] Fix | Delete
if (data.targetName !== this.sourceName) {
[12945] Fix | Delete
return;
[12946] Fix | Delete
}
[12947] Fix | Delete
if (data.stream) {
[12948] Fix | Delete
this.#processStreamMessage(data);
[12949] Fix | Delete
return;
[12950] Fix | Delete
}
[12951] Fix | Delete
if (data.callback) {
[12952] Fix | Delete
const callbackId = data.callbackId;
[12953] Fix | Delete
const capability = this.callbackCapabilities[callbackId];
[12954] Fix | Delete
if (!capability) {
[12955] Fix | Delete
throw new Error(`Cannot resolve callback ${callbackId}`);
[12956] Fix | Delete
}
[12957] Fix | Delete
delete this.callbackCapabilities[callbackId];
[12958] Fix | Delete
if (data.callback === CallbackKind.DATA) {
[12959] Fix | Delete
capability.resolve(data.data);
[12960] Fix | Delete
} else if (data.callback === CallbackKind.ERROR) {
[12961] Fix | Delete
capability.reject(wrapReason(data.reason));
[12962] Fix | Delete
} else {
[12963] Fix | Delete
throw new Error("Unexpected callback case");
[12964] Fix | Delete
}
[12965] Fix | Delete
return;
[12966] Fix | Delete
}
[12967] Fix | Delete
const action = this.actionHandler[data.action];
[12968] Fix | Delete
if (!action) {
[12969] Fix | Delete
throw new Error(`Unknown action from worker: ${data.action}`);
[12970] Fix | Delete
}
[12971] Fix | Delete
if (data.callbackId) {
[12972] Fix | Delete
const cbSourceName = this.sourceName;
[12973] Fix | Delete
const cbTargetName = data.sourceName;
[12974] Fix | Delete
new Promise(function (resolve) {
[12975] Fix | Delete
resolve(action(data.data));
[12976] Fix | Delete
}).then(function (result) {
[12977] Fix | Delete
comObj.postMessage({
[12978] Fix | Delete
sourceName: cbSourceName,
[12979] Fix | Delete
targetName: cbTargetName,
[12980] Fix | Delete
callback: CallbackKind.DATA,
[12981] Fix | Delete
callbackId: data.callbackId,
[12982] Fix | Delete
data: result
[12983] Fix | Delete
});
[12984] Fix | Delete
}, function (reason) {
[12985] Fix | Delete
comObj.postMessage({
[12986] Fix | Delete
sourceName: cbSourceName,
[12987] Fix | Delete
targetName: cbTargetName,
[12988] Fix | Delete
callback: CallbackKind.ERROR,
[12989] Fix | Delete
callbackId: data.callbackId,
[12990] Fix | Delete
reason: wrapReason(reason)
[12991] Fix | Delete
});
[12992] Fix | Delete
});
[12993] Fix | Delete
return;
[12994] Fix | Delete
}
[12995] Fix | Delete
if (data.streamId) {
[12996] Fix | Delete
this.#createStreamSink(data);
[12997] Fix | Delete
return;
[12998] Fix | Delete
}
[12999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function