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/build
File: pdf.worker.js
const line = lines[i];
[10500] Fix | Delete
if (line.prefixLength > 0) {
[10501] Fix | Delete
this.rootNode.buildTree(line, line.prefixLength - 1);
[10502] Fix | Delete
}
[10503] Fix | Delete
}
[10504] Fix | Delete
}
[10505] Fix | Delete
decode(reader) {
[10506] Fix | Delete
return this.rootNode.decodeNode(reader);
[10507] Fix | Delete
}
[10508] Fix | Delete
assignPrefixCodes(lines) {
[10509] Fix | Delete
const linesLength = lines.length;
[10510] Fix | Delete
let prefixLengthMax = 0;
[10511] Fix | Delete
for (let i = 0; i < linesLength; i++) {
[10512] Fix | Delete
prefixLengthMax = Math.max(prefixLengthMax, lines[i].prefixLength);
[10513] Fix | Delete
}
[10514] Fix | Delete
const histogram = new Uint32Array(prefixLengthMax + 1);
[10515] Fix | Delete
for (let i = 0; i < linesLength; i++) {
[10516] Fix | Delete
histogram[lines[i].prefixLength]++;
[10517] Fix | Delete
}
[10518] Fix | Delete
let currentLength = 1,
[10519] Fix | Delete
firstCode = 0,
[10520] Fix | Delete
currentCode,
[10521] Fix | Delete
currentTemp,
[10522] Fix | Delete
line;
[10523] Fix | Delete
histogram[0] = 0;
[10524] Fix | Delete
while (currentLength <= prefixLengthMax) {
[10525] Fix | Delete
firstCode = firstCode + histogram[currentLength - 1] << 1;
[10526] Fix | Delete
currentCode = firstCode;
[10527] Fix | Delete
currentTemp = 0;
[10528] Fix | Delete
while (currentTemp < linesLength) {
[10529] Fix | Delete
line = lines[currentTemp];
[10530] Fix | Delete
if (line.prefixLength === currentLength) {
[10531] Fix | Delete
line.prefixCode = currentCode;
[10532] Fix | Delete
currentCode++;
[10533] Fix | Delete
}
[10534] Fix | Delete
currentTemp++;
[10535] Fix | Delete
}
[10536] Fix | Delete
currentLength++;
[10537] Fix | Delete
}
[10538] Fix | Delete
}
[10539] Fix | Delete
}
[10540] Fix | Delete
function decodeTablesSegment(data, start, end) {
[10541] Fix | Delete
const flags = data[start];
[10542] Fix | Delete
const lowestValue = readUint32(data, start + 1) & 0xffffffff;
[10543] Fix | Delete
const highestValue = readUint32(data, start + 5) & 0xffffffff;
[10544] Fix | Delete
const reader = new Reader(data, start + 9, end);
[10545] Fix | Delete
const prefixSizeBits = (flags >> 1 & 7) + 1;
[10546] Fix | Delete
const rangeSizeBits = (flags >> 4 & 7) + 1;
[10547] Fix | Delete
const lines = [];
[10548] Fix | Delete
let prefixLength,
[10549] Fix | Delete
rangeLength,
[10550] Fix | Delete
currentRangeLow = lowestValue;
[10551] Fix | Delete
do {
[10552] Fix | Delete
prefixLength = reader.readBits(prefixSizeBits);
[10553] Fix | Delete
rangeLength = reader.readBits(rangeSizeBits);
[10554] Fix | Delete
lines.push(new HuffmanLine([currentRangeLow, prefixLength, rangeLength, 0]));
[10555] Fix | Delete
currentRangeLow += 1 << rangeLength;
[10556] Fix | Delete
} while (currentRangeLow < highestValue);
[10557] Fix | Delete
prefixLength = reader.readBits(prefixSizeBits);
[10558] Fix | Delete
lines.push(new HuffmanLine([lowestValue - 1, prefixLength, 32, 0, "lower"]));
[10559] Fix | Delete
prefixLength = reader.readBits(prefixSizeBits);
[10560] Fix | Delete
lines.push(new HuffmanLine([highestValue, prefixLength, 32, 0]));
[10561] Fix | Delete
if (flags & 1) {
[10562] Fix | Delete
prefixLength = reader.readBits(prefixSizeBits);
[10563] Fix | Delete
lines.push(new HuffmanLine([prefixLength, 0]));
[10564] Fix | Delete
}
[10565] Fix | Delete
return new HuffmanTable(lines, false);
[10566] Fix | Delete
}
[10567] Fix | Delete
const standardTablesCache = {};
[10568] Fix | Delete
function getStandardTable(number) {
[10569] Fix | Delete
let table = standardTablesCache[number];
[10570] Fix | Delete
if (table) {
[10571] Fix | Delete
return table;
[10572] Fix | Delete
}
[10573] Fix | Delete
let lines;
[10574] Fix | Delete
switch (number) {
[10575] Fix | Delete
case 1:
[10576] Fix | Delete
lines = [[0, 1, 4, 0x0], [16, 2, 8, 0x2], [272, 3, 16, 0x6], [65808, 3, 32, 0x7]];
[10577] Fix | Delete
break;
[10578] Fix | Delete
case 2:
[10579] Fix | Delete
lines = [[0, 1, 0, 0x0], [1, 2, 0, 0x2], [2, 3, 0, 0x6], [3, 4, 3, 0xe], [11, 5, 6, 0x1e], [75, 6, 32, 0x3e], [6, 0x3f]];
[10580] Fix | Delete
break;
[10581] Fix | Delete
case 3:
[10582] Fix | Delete
lines = [[-256, 8, 8, 0xfe], [0, 1, 0, 0x0], [1, 2, 0, 0x2], [2, 3, 0, 0x6], [3, 4, 3, 0xe], [11, 5, 6, 0x1e], [-257, 8, 32, 0xff, "lower"], [75, 7, 32, 0x7e], [6, 0x3e]];
[10583] Fix | Delete
break;
[10584] Fix | Delete
case 4:
[10585] Fix | Delete
lines = [[1, 1, 0, 0x0], [2, 2, 0, 0x2], [3, 3, 0, 0x6], [4, 4, 3, 0xe], [12, 5, 6, 0x1e], [76, 5, 32, 0x1f]];
[10586] Fix | Delete
break;
[10587] Fix | Delete
case 5:
[10588] Fix | Delete
lines = [[-255, 7, 8, 0x7e], [1, 1, 0, 0x0], [2, 2, 0, 0x2], [3, 3, 0, 0x6], [4, 4, 3, 0xe], [12, 5, 6, 0x1e], [-256, 7, 32, 0x7f, "lower"], [76, 6, 32, 0x3e]];
[10589] Fix | Delete
break;
[10590] Fix | Delete
case 6:
[10591] Fix | Delete
lines = [[-2048, 5, 10, 0x1c], [-1024, 4, 9, 0x8], [-512, 4, 8, 0x9], [-256, 4, 7, 0xa], [-128, 5, 6, 0x1d], [-64, 5, 5, 0x1e], [-32, 4, 5, 0xb], [0, 2, 7, 0x0], [128, 3, 7, 0x2], [256, 3, 8, 0x3], [512, 4, 9, 0xc], [1024, 4, 10, 0xd], [-2049, 6, 32, 0x3e, "lower"], [2048, 6, 32, 0x3f]];
[10592] Fix | Delete
break;
[10593] Fix | Delete
case 7:
[10594] Fix | Delete
lines = [[-1024, 4, 9, 0x8], [-512, 3, 8, 0x0], [-256, 4, 7, 0x9], [-128, 5, 6, 0x1a], [-64, 5, 5, 0x1b], [-32, 4, 5, 0xa], [0, 4, 5, 0xb], [32, 5, 5, 0x1c], [64, 5, 6, 0x1d], [128, 4, 7, 0xc], [256, 3, 8, 0x1], [512, 3, 9, 0x2], [1024, 3, 10, 0x3], [-1025, 5, 32, 0x1e, "lower"], [2048, 5, 32, 0x1f]];
[10595] Fix | Delete
break;
[10596] Fix | Delete
case 8:
[10597] Fix | Delete
lines = [[-15, 8, 3, 0xfc], [-7, 9, 1, 0x1fc], [-5, 8, 1, 0xfd], [-3, 9, 0, 0x1fd], [-2, 7, 0, 0x7c], [-1, 4, 0, 0xa], [0, 2, 1, 0x0], [2, 5, 0, 0x1a], [3, 6, 0, 0x3a], [4, 3, 4, 0x4], [20, 6, 1, 0x3b], [22, 4, 4, 0xb], [38, 4, 5, 0xc], [70, 5, 6, 0x1b], [134, 5, 7, 0x1c], [262, 6, 7, 0x3c], [390, 7, 8, 0x7d], [646, 6, 10, 0x3d], [-16, 9, 32, 0x1fe, "lower"], [1670, 9, 32, 0x1ff], [2, 0x1]];
[10598] Fix | Delete
break;
[10599] Fix | Delete
case 9:
[10600] Fix | Delete
lines = [[-31, 8, 4, 0xfc], [-15, 9, 2, 0x1fc], [-11, 8, 2, 0xfd], [-7, 9, 1, 0x1fd], [-5, 7, 1, 0x7c], [-3, 4, 1, 0xa], [-1, 3, 1, 0x2], [1, 3, 1, 0x3], [3, 5, 1, 0x1a], [5, 6, 1, 0x3a], [7, 3, 5, 0x4], [39, 6, 2, 0x3b], [43, 4, 5, 0xb], [75, 4, 6, 0xc], [139, 5, 7, 0x1b], [267, 5, 8, 0x1c], [523, 6, 8, 0x3c], [779, 7, 9, 0x7d], [1291, 6, 11, 0x3d], [-32, 9, 32, 0x1fe, "lower"], [3339, 9, 32, 0x1ff], [2, 0x0]];
[10601] Fix | Delete
break;
[10602] Fix | Delete
case 10:
[10603] Fix | Delete
lines = [[-21, 7, 4, 0x7a], [-5, 8, 0, 0xfc], [-4, 7, 0, 0x7b], [-3, 5, 0, 0x18], [-2, 2, 2, 0x0], [2, 5, 0, 0x19], [3, 6, 0, 0x36], [4, 7, 0, 0x7c], [5, 8, 0, 0xfd], [6, 2, 6, 0x1], [70, 5, 5, 0x1a], [102, 6, 5, 0x37], [134, 6, 6, 0x38], [198, 6, 7, 0x39], [326, 6, 8, 0x3a], [582, 6, 9, 0x3b], [1094, 6, 10, 0x3c], [2118, 7, 11, 0x7d], [-22, 8, 32, 0xfe, "lower"], [4166, 8, 32, 0xff], [2, 0x2]];
[10604] Fix | Delete
break;
[10605] Fix | Delete
case 11:
[10606] Fix | Delete
lines = [[1, 1, 0, 0x0], [2, 2, 1, 0x2], [4, 4, 0, 0xc], [5, 4, 1, 0xd], [7, 5, 1, 0x1c], [9, 5, 2, 0x1d], [13, 6, 2, 0x3c], [17, 7, 2, 0x7a], [21, 7, 3, 0x7b], [29, 7, 4, 0x7c], [45, 7, 5, 0x7d], [77, 7, 6, 0x7e], [141, 7, 32, 0x7f]];
[10607] Fix | Delete
break;
[10608] Fix | Delete
case 12:
[10609] Fix | Delete
lines = [[1, 1, 0, 0x0], [2, 2, 0, 0x2], [3, 3, 1, 0x6], [5, 5, 0, 0x1c], [6, 5, 1, 0x1d], [8, 6, 1, 0x3c], [10, 7, 0, 0x7a], [11, 7, 1, 0x7b], [13, 7, 2, 0x7c], [17, 7, 3, 0x7d], [25, 7, 4, 0x7e], [41, 8, 5, 0xfe], [73, 8, 32, 0xff]];
[10610] Fix | Delete
break;
[10611] Fix | Delete
case 13:
[10612] Fix | Delete
lines = [[1, 1, 0, 0x0], [2, 3, 0, 0x4], [3, 4, 0, 0xc], [4, 5, 0, 0x1c], [5, 4, 1, 0xd], [7, 3, 3, 0x5], [15, 6, 1, 0x3a], [17, 6, 2, 0x3b], [21, 6, 3, 0x3c], [29, 6, 4, 0x3d], [45, 6, 5, 0x3e], [77, 7, 6, 0x7e], [141, 7, 32, 0x7f]];
[10613] Fix | Delete
break;
[10614] Fix | Delete
case 14:
[10615] Fix | Delete
lines = [[-2, 3, 0, 0x4], [-1, 3, 0, 0x5], [0, 1, 0, 0x0], [1, 3, 0, 0x6], [2, 3, 0, 0x7]];
[10616] Fix | Delete
break;
[10617] Fix | Delete
case 15:
[10618] Fix | Delete
lines = [[-24, 7, 4, 0x7c], [-8, 6, 2, 0x3c], [-4, 5, 1, 0x1c], [-2, 4, 0, 0xc], [-1, 3, 0, 0x4], [0, 1, 0, 0x0], [1, 3, 0, 0x5], [2, 4, 0, 0xd], [3, 5, 1, 0x1d], [5, 6, 2, 0x3d], [9, 7, 4, 0x7d], [-25, 7, 32, 0x7e, "lower"], [25, 7, 32, 0x7f]];
[10619] Fix | Delete
break;
[10620] Fix | Delete
default:
[10621] Fix | Delete
throw new Jbig2Error(`standard table B.${number} does not exist`);
[10622] Fix | Delete
}
[10623] Fix | Delete
for (let i = 0, ii = lines.length; i < ii; i++) {
[10624] Fix | Delete
lines[i] = new HuffmanLine(lines[i]);
[10625] Fix | Delete
}
[10626] Fix | Delete
table = new HuffmanTable(lines, true);
[10627] Fix | Delete
standardTablesCache[number] = table;
[10628] Fix | Delete
return table;
[10629] Fix | Delete
}
[10630] Fix | Delete
class Reader {
[10631] Fix | Delete
constructor(data, start, end) {
[10632] Fix | Delete
this.data = data;
[10633] Fix | Delete
this.start = start;
[10634] Fix | Delete
this.end = end;
[10635] Fix | Delete
this.position = start;
[10636] Fix | Delete
this.shift = -1;
[10637] Fix | Delete
this.currentByte = 0;
[10638] Fix | Delete
}
[10639] Fix | Delete
readBit() {
[10640] Fix | Delete
if (this.shift < 0) {
[10641] Fix | Delete
if (this.position >= this.end) {
[10642] Fix | Delete
throw new Jbig2Error("end of data while reading bit");
[10643] Fix | Delete
}
[10644] Fix | Delete
this.currentByte = this.data[this.position++];
[10645] Fix | Delete
this.shift = 7;
[10646] Fix | Delete
}
[10647] Fix | Delete
const bit = this.currentByte >> this.shift & 1;
[10648] Fix | Delete
this.shift--;
[10649] Fix | Delete
return bit;
[10650] Fix | Delete
}
[10651] Fix | Delete
readBits(numBits) {
[10652] Fix | Delete
let result = 0,
[10653] Fix | Delete
i;
[10654] Fix | Delete
for (i = numBits - 1; i >= 0; i--) {
[10655] Fix | Delete
result |= this.readBit() << i;
[10656] Fix | Delete
}
[10657] Fix | Delete
return result;
[10658] Fix | Delete
}
[10659] Fix | Delete
byteAlign() {
[10660] Fix | Delete
this.shift = -1;
[10661] Fix | Delete
}
[10662] Fix | Delete
next() {
[10663] Fix | Delete
if (this.position >= this.end) {
[10664] Fix | Delete
return -1;
[10665] Fix | Delete
}
[10666] Fix | Delete
return this.data[this.position++];
[10667] Fix | Delete
}
[10668] Fix | Delete
}
[10669] Fix | Delete
function getCustomHuffmanTable(index, referredTo, customTables) {
[10670] Fix | Delete
let currentIndex = 0;
[10671] Fix | Delete
for (let i = 0, ii = referredTo.length; i < ii; i++) {
[10672] Fix | Delete
const table = customTables[referredTo[i]];
[10673] Fix | Delete
if (table) {
[10674] Fix | Delete
if (index === currentIndex) {
[10675] Fix | Delete
return table;
[10676] Fix | Delete
}
[10677] Fix | Delete
currentIndex++;
[10678] Fix | Delete
}
[10679] Fix | Delete
}
[10680] Fix | Delete
throw new Jbig2Error("can't find custom Huffman table");
[10681] Fix | Delete
}
[10682] Fix | Delete
function getTextRegionHuffmanTables(textRegion, referredTo, customTables, numberOfSymbols, reader) {
[10683] Fix | Delete
const codes = [];
[10684] Fix | Delete
for (let i = 0; i <= 34; i++) {
[10685] Fix | Delete
const codeLength = reader.readBits(4);
[10686] Fix | Delete
codes.push(new HuffmanLine([i, codeLength, 0, 0]));
[10687] Fix | Delete
}
[10688] Fix | Delete
const runCodesTable = new HuffmanTable(codes, false);
[10689] Fix | Delete
codes.length = 0;
[10690] Fix | Delete
for (let i = 0; i < numberOfSymbols;) {
[10691] Fix | Delete
const codeLength = runCodesTable.decode(reader);
[10692] Fix | Delete
if (codeLength >= 32) {
[10693] Fix | Delete
let repeatedLength, numberOfRepeats, j;
[10694] Fix | Delete
switch (codeLength) {
[10695] Fix | Delete
case 32:
[10696] Fix | Delete
if (i === 0) {
[10697] Fix | Delete
throw new Jbig2Error("no previous value in symbol ID table");
[10698] Fix | Delete
}
[10699] Fix | Delete
numberOfRepeats = reader.readBits(2) + 3;
[10700] Fix | Delete
repeatedLength = codes[i - 1].prefixLength;
[10701] Fix | Delete
break;
[10702] Fix | Delete
case 33:
[10703] Fix | Delete
numberOfRepeats = reader.readBits(3) + 3;
[10704] Fix | Delete
repeatedLength = 0;
[10705] Fix | Delete
break;
[10706] Fix | Delete
case 34:
[10707] Fix | Delete
numberOfRepeats = reader.readBits(7) + 11;
[10708] Fix | Delete
repeatedLength = 0;
[10709] Fix | Delete
break;
[10710] Fix | Delete
default:
[10711] Fix | Delete
throw new Jbig2Error("invalid code length in symbol ID table");
[10712] Fix | Delete
}
[10713] Fix | Delete
for (j = 0; j < numberOfRepeats; j++) {
[10714] Fix | Delete
codes.push(new HuffmanLine([i, repeatedLength, 0, 0]));
[10715] Fix | Delete
i++;
[10716] Fix | Delete
}
[10717] Fix | Delete
} else {
[10718] Fix | Delete
codes.push(new HuffmanLine([i, codeLength, 0, 0]));
[10719] Fix | Delete
i++;
[10720] Fix | Delete
}
[10721] Fix | Delete
}
[10722] Fix | Delete
reader.byteAlign();
[10723] Fix | Delete
const symbolIDTable = new HuffmanTable(codes, false);
[10724] Fix | Delete
let customIndex = 0,
[10725] Fix | Delete
tableFirstS,
[10726] Fix | Delete
tableDeltaS,
[10727] Fix | Delete
tableDeltaT;
[10728] Fix | Delete
switch (textRegion.huffmanFS) {
[10729] Fix | Delete
case 0:
[10730] Fix | Delete
case 1:
[10731] Fix | Delete
tableFirstS = getStandardTable(textRegion.huffmanFS + 6);
[10732] Fix | Delete
break;
[10733] Fix | Delete
case 3:
[10734] Fix | Delete
tableFirstS = getCustomHuffmanTable(customIndex, referredTo, customTables);
[10735] Fix | Delete
customIndex++;
[10736] Fix | Delete
break;
[10737] Fix | Delete
default:
[10738] Fix | Delete
throw new Jbig2Error("invalid Huffman FS selector");
[10739] Fix | Delete
}
[10740] Fix | Delete
switch (textRegion.huffmanDS) {
[10741] Fix | Delete
case 0:
[10742] Fix | Delete
case 1:
[10743] Fix | Delete
case 2:
[10744] Fix | Delete
tableDeltaS = getStandardTable(textRegion.huffmanDS + 8);
[10745] Fix | Delete
break;
[10746] Fix | Delete
case 3:
[10747] Fix | Delete
tableDeltaS = getCustomHuffmanTable(customIndex, referredTo, customTables);
[10748] Fix | Delete
customIndex++;
[10749] Fix | Delete
break;
[10750] Fix | Delete
default:
[10751] Fix | Delete
throw new Jbig2Error("invalid Huffman DS selector");
[10752] Fix | Delete
}
[10753] Fix | Delete
switch (textRegion.huffmanDT) {
[10754] Fix | Delete
case 0:
[10755] Fix | Delete
case 1:
[10756] Fix | Delete
case 2:
[10757] Fix | Delete
tableDeltaT = getStandardTable(textRegion.huffmanDT + 11);
[10758] Fix | Delete
break;
[10759] Fix | Delete
case 3:
[10760] Fix | Delete
tableDeltaT = getCustomHuffmanTable(customIndex, referredTo, customTables);
[10761] Fix | Delete
customIndex++;
[10762] Fix | Delete
break;
[10763] Fix | Delete
default:
[10764] Fix | Delete
throw new Jbig2Error("invalid Huffman DT selector");
[10765] Fix | Delete
}
[10766] Fix | Delete
if (textRegion.refinement) {
[10767] Fix | Delete
throw new Jbig2Error("refinement with Huffman is not supported");
[10768] Fix | Delete
}
[10769] Fix | Delete
return {
[10770] Fix | Delete
symbolIDTable,
[10771] Fix | Delete
tableFirstS,
[10772] Fix | Delete
tableDeltaS,
[10773] Fix | Delete
tableDeltaT
[10774] Fix | Delete
};
[10775] Fix | Delete
}
[10776] Fix | Delete
function getSymbolDictionaryHuffmanTables(dictionary, referredTo, customTables) {
[10777] Fix | Delete
let customIndex = 0,
[10778] Fix | Delete
tableDeltaHeight,
[10779] Fix | Delete
tableDeltaWidth;
[10780] Fix | Delete
switch (dictionary.huffmanDHSelector) {
[10781] Fix | Delete
case 0:
[10782] Fix | Delete
case 1:
[10783] Fix | Delete
tableDeltaHeight = getStandardTable(dictionary.huffmanDHSelector + 4);
[10784] Fix | Delete
break;
[10785] Fix | Delete
case 3:
[10786] Fix | Delete
tableDeltaHeight = getCustomHuffmanTable(customIndex, referredTo, customTables);
[10787] Fix | Delete
customIndex++;
[10788] Fix | Delete
break;
[10789] Fix | Delete
default:
[10790] Fix | Delete
throw new Jbig2Error("invalid Huffman DH selector");
[10791] Fix | Delete
}
[10792] Fix | Delete
switch (dictionary.huffmanDWSelector) {
[10793] Fix | Delete
case 0:
[10794] Fix | Delete
case 1:
[10795] Fix | Delete
tableDeltaWidth = getStandardTable(dictionary.huffmanDWSelector + 2);
[10796] Fix | Delete
break;
[10797] Fix | Delete
case 3:
[10798] Fix | Delete
tableDeltaWidth = getCustomHuffmanTable(customIndex, referredTo, customTables);
[10799] Fix | Delete
customIndex++;
[10800] Fix | Delete
break;
[10801] Fix | Delete
default:
[10802] Fix | Delete
throw new Jbig2Error("invalid Huffman DW selector");
[10803] Fix | Delete
}
[10804] Fix | Delete
let tableBitmapSize, tableAggregateInstances;
[10805] Fix | Delete
if (dictionary.bitmapSizeSelector) {
[10806] Fix | Delete
tableBitmapSize = getCustomHuffmanTable(customIndex, referredTo, customTables);
[10807] Fix | Delete
customIndex++;
[10808] Fix | Delete
} else {
[10809] Fix | Delete
tableBitmapSize = getStandardTable(1);
[10810] Fix | Delete
}
[10811] Fix | Delete
if (dictionary.aggregationInstancesSelector) {
[10812] Fix | Delete
tableAggregateInstances = getCustomHuffmanTable(customIndex, referredTo, customTables);
[10813] Fix | Delete
} else {
[10814] Fix | Delete
tableAggregateInstances = getStandardTable(1);
[10815] Fix | Delete
}
[10816] Fix | Delete
return {
[10817] Fix | Delete
tableDeltaHeight,
[10818] Fix | Delete
tableDeltaWidth,
[10819] Fix | Delete
tableBitmapSize,
[10820] Fix | Delete
tableAggregateInstances
[10821] Fix | Delete
};
[10822] Fix | Delete
}
[10823] Fix | Delete
function readUncompressedBitmap(reader, width, height) {
[10824] Fix | Delete
const bitmap = [];
[10825] Fix | Delete
for (let y = 0; y < height; y++) {
[10826] Fix | Delete
const row = new Uint8Array(width);
[10827] Fix | Delete
bitmap.push(row);
[10828] Fix | Delete
for (let x = 0; x < width; x++) {
[10829] Fix | Delete
row[x] = reader.readBit();
[10830] Fix | Delete
}
[10831] Fix | Delete
reader.byteAlign();
[10832] Fix | Delete
}
[10833] Fix | Delete
return bitmap;
[10834] Fix | Delete
}
[10835] Fix | Delete
function decodeMMRBitmap(input, width, height, endOfBlock) {
[10836] Fix | Delete
const params = {
[10837] Fix | Delete
K: -1,
[10838] Fix | Delete
Columns: width,
[10839] Fix | Delete
Rows: height,
[10840] Fix | Delete
BlackIs1: true,
[10841] Fix | Delete
EndOfBlock: endOfBlock
[10842] Fix | Delete
};
[10843] Fix | Delete
const decoder = new CCITTFaxDecoder(input, params);
[10844] Fix | Delete
const bitmap = [];
[10845] Fix | Delete
let currentByte,
[10846] Fix | Delete
eof = false;
[10847] Fix | Delete
for (let y = 0; y < height; y++) {
[10848] Fix | Delete
const row = new Uint8Array(width);
[10849] Fix | Delete
bitmap.push(row);
[10850] Fix | Delete
let shift = -1;
[10851] Fix | Delete
for (let x = 0; x < width; x++) {
[10852] Fix | Delete
if (shift < 0) {
[10853] Fix | Delete
currentByte = decoder.readNextChar();
[10854] Fix | Delete
if (currentByte === -1) {
[10855] Fix | Delete
currentByte = 0;
[10856] Fix | Delete
eof = true;
[10857] Fix | Delete
}
[10858] Fix | Delete
shift = 7;
[10859] Fix | Delete
}
[10860] Fix | Delete
row[x] = currentByte >> shift & 1;
[10861] Fix | Delete
shift--;
[10862] Fix | Delete
}
[10863] Fix | Delete
}
[10864] Fix | Delete
if (endOfBlock && !eof) {
[10865] Fix | Delete
const lookForEOFLimit = 5;
[10866] Fix | Delete
for (let i = 0; i < lookForEOFLimit; i++) {
[10867] Fix | Delete
if (decoder.readNextChar() === -1) {
[10868] Fix | Delete
break;
[10869] Fix | Delete
}
[10870] Fix | Delete
}
[10871] Fix | Delete
}
[10872] Fix | Delete
return bitmap;
[10873] Fix | Delete
}
[10874] Fix | Delete
class Jbig2Image {
[10875] Fix | Delete
parseChunks(chunks) {
[10876] Fix | Delete
return parseJbig2Chunks(chunks);
[10877] Fix | Delete
}
[10878] Fix | Delete
parse(data) {
[10879] Fix | Delete
throw new Error("Not implemented: Jbig2Image.parse");
[10880] Fix | Delete
}
[10881] Fix | Delete
}
[10882] Fix | Delete
[10883] Fix | Delete
;// CONCATENATED MODULE: ./src/core/jbig2_stream.js
[10884] Fix | Delete
[10885] Fix | Delete
[10886] Fix | Delete
[10887] Fix | Delete
[10888] Fix | Delete
[10889] Fix | Delete
[10890] Fix | Delete
class Jbig2Stream extends DecodeStream {
[10891] Fix | Delete
constructor(stream, maybeLength, params) {
[10892] Fix | Delete
super(maybeLength);
[10893] Fix | Delete
this.stream = stream;
[10894] Fix | Delete
this.dict = stream.dict;
[10895] Fix | Delete
this.maybeLength = maybeLength;
[10896] Fix | Delete
this.params = params;
[10897] Fix | Delete
}
[10898] Fix | Delete
get bytes() {
[10899] Fix | Delete
return shadow(this, "bytes", this.stream.getBytes(this.maybeLength));
[10900] Fix | Delete
}
[10901] Fix | Delete
ensureBuffer(requested) {}
[10902] Fix | Delete
readBlock() {
[10903] Fix | Delete
if (this.eof) {
[10904] Fix | Delete
return;
[10905] Fix | Delete
}
[10906] Fix | Delete
const jbig2Image = new Jbig2Image();
[10907] Fix | Delete
const chunks = [];
[10908] Fix | Delete
if (this.params instanceof Dict) {
[10909] Fix | Delete
const globalsStream = this.params.get("JBIG2Globals");
[10910] Fix | Delete
if (globalsStream instanceof BaseStream) {
[10911] Fix | Delete
const globals = globalsStream.getBytes();
[10912] Fix | Delete
chunks.push({
[10913] Fix | Delete
data: globals,
[10914] Fix | Delete
start: 0,
[10915] Fix | Delete
end: globals.length
[10916] Fix | Delete
});
[10917] Fix | Delete
}
[10918] Fix | Delete
}
[10919] Fix | Delete
chunks.push({
[10920] Fix | Delete
data: this.bytes,
[10921] Fix | Delete
start: 0,
[10922] Fix | Delete
end: this.bytes.length
[10923] Fix | Delete
});
[10924] Fix | Delete
const data = jbig2Image.parseChunks(chunks);
[10925] Fix | Delete
const dataLength = data.length;
[10926] Fix | Delete
for (let i = 0; i < dataLength; i++) {
[10927] Fix | Delete
data[i] ^= 0xff;
[10928] Fix | Delete
}
[10929] Fix | Delete
this.buffer = data;
[10930] Fix | Delete
this.bufferLength = dataLength;
[10931] Fix | Delete
this.eof = true;
[10932] Fix | Delete
}
[10933] Fix | Delete
}
[10934] Fix | Delete
[10935] Fix | Delete
;// CONCATENATED MODULE: ./src/shared/image_utils.js
[10936] Fix | Delete
[10937] Fix | Delete
[10938] Fix | Delete
[10939] Fix | Delete
[10940] Fix | Delete
[10941] Fix | Delete
[10942] Fix | Delete
[10943] Fix | Delete
function convertToRGBA(params) {
[10944] Fix | Delete
switch (params.kind) {
[10945] Fix | Delete
case ImageKind.GRAYSCALE_1BPP:
[10946] Fix | Delete
return convertBlackAndWhiteToRGBA(params);
[10947] Fix | Delete
case ImageKind.RGB_24BPP:
[10948] Fix | Delete
return convertRGBToRGBA(params);
[10949] Fix | Delete
}
[10950] Fix | Delete
return null;
[10951] Fix | Delete
}
[10952] Fix | Delete
function convertBlackAndWhiteToRGBA({
[10953] Fix | Delete
src,
[10954] Fix | Delete
srcPos = 0,
[10955] Fix | Delete
dest,
[10956] Fix | Delete
width,
[10957] Fix | Delete
height,
[10958] Fix | Delete
nonBlackColor = 0xffffffff,
[10959] Fix | Delete
inverseDecode = false
[10960] Fix | Delete
}) {
[10961] Fix | Delete
const black = FeatureTest.isLittleEndian ? 0xff000000 : 0x000000ff;
[10962] Fix | Delete
const [zeroMapping, oneMapping] = inverseDecode ? [nonBlackColor, black] : [black, nonBlackColor];
[10963] Fix | Delete
const widthInSource = width >> 3;
[10964] Fix | Delete
const widthRemainder = width & 7;
[10965] Fix | Delete
const srcLength = src.length;
[10966] Fix | Delete
dest = new Uint32Array(dest.buffer);
[10967] Fix | Delete
let destPos = 0;
[10968] Fix | Delete
for (let i = 0; i < height; i++) {
[10969] Fix | Delete
for (const max = srcPos + widthInSource; srcPos < max; srcPos++) {
[10970] Fix | Delete
const elem = srcPos < srcLength ? src[srcPos] : 255;
[10971] Fix | Delete
dest[destPos++] = elem & 0b10000000 ? oneMapping : zeroMapping;
[10972] Fix | Delete
dest[destPos++] = elem & 0b1000000 ? oneMapping : zeroMapping;
[10973] Fix | Delete
dest[destPos++] = elem & 0b100000 ? oneMapping : zeroMapping;
[10974] Fix | Delete
dest[destPos++] = elem & 0b10000 ? oneMapping : zeroMapping;
[10975] Fix | Delete
dest[destPos++] = elem & 0b1000 ? oneMapping : zeroMapping;
[10976] Fix | Delete
dest[destPos++] = elem & 0b100 ? oneMapping : zeroMapping;
[10977] Fix | Delete
dest[destPos++] = elem & 0b10 ? oneMapping : zeroMapping;
[10978] Fix | Delete
dest[destPos++] = elem & 0b1 ? oneMapping : zeroMapping;
[10979] Fix | Delete
}
[10980] Fix | Delete
if (widthRemainder === 0) {
[10981] Fix | Delete
continue;
[10982] Fix | Delete
}
[10983] Fix | Delete
const elem = srcPos < srcLength ? src[srcPos++] : 255;
[10984] Fix | Delete
for (let j = 0; j < widthRemainder; j++) {
[10985] Fix | Delete
dest[destPos++] = elem & 1 << 7 - j ? oneMapping : zeroMapping;
[10986] Fix | Delete
}
[10987] Fix | Delete
}
[10988] Fix | Delete
return {
[10989] Fix | Delete
srcPos,
[10990] Fix | Delete
destPos
[10991] Fix | Delete
};
[10992] Fix | Delete
}
[10993] Fix | Delete
function convertRGBToRGBA({
[10994] Fix | Delete
src,
[10995] Fix | Delete
srcPos = 0,
[10996] Fix | Delete
dest,
[10997] Fix | Delete
destPos = 0,
[10998] Fix | Delete
width,
[10999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function