Socket
Socket
Sign inDemoInstall

@zxing/library

Package Overview
Dependencies
2
Maintainers
2
Versions
61
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.15.2 to 0.16.0

esm/browser.d.ts

1

CONTRIBUTING.md

@@ -75,2 +75,3 @@ # Contributing

- Use `Math.floor` for any division of ints otherwise the `number` type is a floating point and keeps the numbers after the dot.
- For `float` to `int` casting use `Math.trunc`, to replicate the same effect as Java casting does.

@@ -77,0 +78,0 @@ ## Encoding

@@ -0,0 +0,0 @@ import { BrowserCodeReader } from './BrowserCodeReader';

@@ -0,0 +0,0 @@ import { BrowserCodeReader } from './BrowserCodeReader';

@@ -0,0 +0,0 @@ import BinaryBitmap from '../core/BinaryBitmap';

@@ -0,0 +0,0 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

@@ -0,0 +0,0 @@ import { BrowserCodeReader } from './BrowserCodeReader';

@@ -0,0 +0,0 @@ import { BrowserCodeReader } from './BrowserCodeReader';

@@ -0,0 +0,0 @@ import { BrowserCodeReader } from './BrowserCodeReader';

@@ -0,0 +0,0 @@ import { BrowserCodeReader } from './BrowserCodeReader';

@@ -0,0 +0,0 @@ import { BrowserCodeReader } from './BrowserCodeReader';

@@ -0,0 +0,0 @@ import { BrowserCodeReader } from './BrowserCodeReader';

@@ -0,0 +0,0 @@ import EncodeHintType from '../core/EncodeHintType';

@@ -0,0 +0,0 @@ import EncodeHintType from '../core/EncodeHintType';

@@ -0,0 +0,0 @@ import EncodeHintType from '../core/EncodeHintType';

@@ -0,0 +0,0 @@ import EncodeHintType from '../core/EncodeHintType';

@@ -0,0 +0,0 @@ import Exception from '../core/Exception';

@@ -0,0 +0,0 @@ import LuminanceSource from '../core/LuminanceSource';

@@ -0,0 +0,0 @@ import InvertedLuminanceSource from '../core/InvertedLuminanceSource';

@@ -0,0 +0,0 @@ import Exception from './Exception';

@@ -0,0 +0,0 @@ import Exception from './Exception';

@@ -0,0 +0,0 @@ import Exception from './Exception';

@@ -0,0 +0,0 @@ import Exception from './Exception';

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ /*

@@ -0,0 +0,0 @@ import LuminanceSource from './LuminanceSource';

@@ -0,0 +0,0 @@ /*

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ /*

@@ -6,2 +6,3 @@ import Exception from './Exception';

export default class ChecksumException extends Exception {
static getChecksumInstance(): ChecksumException;
}

@@ -6,3 +6,6 @@ import Exception from './Exception';

export default class ChecksumException extends Exception {
static getChecksumInstance() {
return new ChecksumException();
}
}
//# sourceMappingURL=ChecksumException.js.map

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ /*

@@ -37,2 +37,3 @@ import BitArray from './BitArray';

*
* @function parse
* @param image bits of the image, as a row-major 2D array. Elements are arrays representing rows

@@ -42,2 +43,9 @@ * @return {@link BitMatrix} representation of image

static parseFromBooleanArray(image: boolean[][]): BitMatrix;
/**
*
* @function parse
* @param stringRepresentation
* @param setString
* @param unsetString
*/
static parseFromString(stringRepresentation: string, setString: string, unsetString: string): BitMatrix;

@@ -131,3 +139,3 @@ /**

equals(o: Object): boolean;
hashCode(): number;
hashCode(): int;
/**

@@ -134,0 +142,0 @@ * @return string representation using "X" for set and " " for unset bits

@@ -85,2 +85,3 @@ /*

*
* @function parse
* @param image bits of the image, as a row-major 2D array. Elements are arrays representing rows

@@ -103,2 +104,9 @@ * @return {@link BitMatrix} representation of image

}
/**
*
* @function parse
* @param stringRepresentation
* @param setString
* @param unsetString
*/
static parseFromString(stringRepresentation, setString, unsetString) {

@@ -105,0 +113,0 @@ if (stringRepresentation === null) {

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ /*

@@ -0,0 +0,0 @@ export declare enum CharacterSetValueIdentifiers {

@@ -0,0 +0,0 @@ import GridSampler from './GridSampler';

2

esm/core/common/DefaultGridSampler.js

@@ -41,3 +41,3 @@ /*

for (let x = 0; x < max; x += 2) {
points[x] = /*(float)*/ (x / 2) + 0.5;
points[x] = (x / 2) + 0.5;
points[x + 1] = iValue;

@@ -44,0 +44,0 @@ }

@@ -0,0 +0,0 @@ import ResultPoint from '../../ResultPoint';

@@ -0,0 +0,0 @@ import ResultPoint from '../ResultPoint';

@@ -0,0 +0,0 @@ import Binarizer from '../Binarizer';

@@ -91,3 +91,3 @@ /*

for (let y = 1; y < 5; y++) {
const row = height * y / 5;
const row = Math.floor((height * y) / 5);
const localLuminances = source.getRow(row, this.luminances);

@@ -94,0 +94,0 @@ const right = Math.floor((width * 4) / 5);

@@ -0,0 +0,0 @@ import BitMatrix from './BitMatrix';

@@ -0,0 +0,0 @@ import GridSampler from './GridSampler';

@@ -0,0 +0,0 @@ import DefaultGridSampler from './DefaultGridSampler';

@@ -0,0 +0,0 @@ import Binarizer from '../Binarizer';

import GenericGFPoly from './GenericGFPoly';
import AbstractGenericGF from './AbstractGenericGF';
/**

@@ -13,3 +14,3 @@ * <p>This class contains utility methods for performing mathematical operations over

*/
export default class GenericGF {
export default class GenericGF extends AbstractGenericGF {
private primitive;

@@ -26,4 +27,2 @@ private size;

static MAXICODE_FIELD_64: GenericGF;
private expTable;
private logTable;
private zero;

@@ -50,16 +49,2 @@ private one;

/**
* Implements both addition and subtraction -- they are the same in GF(size).
*
* @return sum/difference of a and b
*/
static addOrSubtract(a: number, b: number): number;
/**
* @return 2 to the power of a in GF(size)
*/
exp(a: number): number;
/**
* @return base 2 log of a in GF(size)
*/
log(a: number): number;
/**
* @return multiplicative inverse of a

@@ -66,0 +51,0 @@ */

@@ -18,2 +18,3 @@ /*

import GenericGFPoly from './GenericGFPoly';
import AbstractGenericGF from './AbstractGenericGF';
import Integer from '../../util/Integer';

@@ -33,3 +34,3 @@ import IllegalArgumentException from '../../IllegalArgumentException';

*/
export default class GenericGF {
export default class GenericGF extends AbstractGenericGF {
/**

@@ -47,2 +48,3 @@ * Create a representation of GF(size) using the given primitive polynomial.

constructor(primitive /*int*/, size /*int*/, generatorBase /*int*/) {
super();
this.primitive = primitive;

@@ -92,25 +94,2 @@ this.size = size;

/**
* Implements both addition and subtraction -- they are the same in GF(size).
*
* @return sum/difference of a and b
*/
static addOrSubtract(a /*int*/, b /*int*/) {
return a ^ b;
}
/**
* @return 2 to the power of a in GF(size)
*/
exp(a /*int*/) {
return this.expTable[a];
}
/**
* @return base 2 log of a in GF(size)
*/
log(a /*int*/) {
if (a === 0) {
throw new IllegalArgumentException();
}
return this.logTable[a];
}
/**
* @return multiplicative inverse of a

@@ -141,3 +120,3 @@ */

toString() {
return 'GF(0x' + Integer.toHexString(this.primitive) + ',' + this.size + ')';
return ('GF(0x' + Integer.toHexString(this.primitive) + ',' + this.size + ')');
}

@@ -152,6 +131,6 @@ equals(o) {

GenericGF.AZTEC_PARAM = new GenericGF(0x13, 16, 1); // x^4 + x + 1
GenericGF.QR_CODE_FIELD_256 = new GenericGF(0x011D, 256, 0); // x^8 + x^4 + x^3 + x^2 + 1
GenericGF.DATA_MATRIX_FIELD_256 = new GenericGF(0x012D, 256, 1); // x^8 + x^5 + x^3 + x^2 + 1
GenericGF.QR_CODE_FIELD_256 = new GenericGF(0x011d, 256, 0); // x^8 + x^4 + x^3 + x^2 + 1
GenericGF.DATA_MATRIX_FIELD_256 = new GenericGF(0x012d, 256, 1); // x^8 + x^5 + x^3 + x^2 + 1
GenericGF.AZTEC_DATA_8 = GenericGF.DATA_MATRIX_FIELD_256;
GenericGF.MAXICODE_FIELD_64 = GenericGF.AZTEC_DATA_6;
//# sourceMappingURL=GenericGF.js.map

@@ -1,2 +0,2 @@

import GenericGF from './GenericGF';
import AbstractGenericGF from './AbstractGenericGF';
/**

@@ -23,3 +23,3 @@ * <p>Represents a polynomial whose coefficients are elements of a GF.

*/
constructor(field: GenericGF, coefficients: Int32Array);
constructor(field: AbstractGenericGF, coefficients: Int32Array);
getCoefficients(): Int32Array;

@@ -26,0 +26,0 @@ /**

@@ -17,3 +17,3 @@ /*

/*namespace com.google.zxing.common.reedsolomon {*/
import GenericGF from './GenericGF';
import AbstractGenericGF from './AbstractGenericGF';
import System from '../../util/System';

@@ -100,3 +100,3 @@ import IllegalArgumentException from '../../IllegalArgumentException';

const coefficient = coefficients[i];
result = GenericGF.addOrSubtract(result, coefficient);
result = AbstractGenericGF.addOrSubtract(result, coefficient);
}

@@ -109,3 +109,3 @@ return result;

for (let i = 1; i < size; i++) {
result = GenericGF.addOrSubtract(field.multiply(a, result), coefficients[i]);
result = AbstractGenericGF.addOrSubtract(field.multiply(a, result), coefficients[i]);
}

@@ -136,3 +136,3 @@ return result;

for (let i = lengthDiff; i < largerCoefficients.length; i++) {
sumDiff[i] = GenericGF.addOrSubtract(smallerCoefficients[i - lengthDiff], largerCoefficients[i]);
sumDiff[i] = AbstractGenericGF.addOrSubtract(smallerCoefficients[i - lengthDiff], largerCoefficients[i]);
}

@@ -157,3 +157,3 @@ return new GenericGFPoly(this.field, sumDiff);

for (let j = 0; j < bLength; j++) {
product[i + j] = GenericGF.addOrSubtract(product[i + j], field.multiply(aCoeff, bCoefficients[j]));
product[i + j] = AbstractGenericGF.addOrSubtract(product[i + j], field.multiply(aCoeff, bCoefficients[j]));
}

@@ -160,0 +160,0 @@ }

@@ -0,0 +0,0 @@ import GenericGF from './GenericGF';

@@ -0,0 +0,0 @@ import GenericGF from './GenericGF';

import DecodeHintType from '../DecodeHintType';
import CharacterSetECI from './CharacterSetECI';
/**

@@ -16,3 +17,2 @@ * Common string-related functions.

private static ASSUME_SHIFT_JIS;
private StringUtils;
/**

@@ -26,2 +26,18 @@ * @param bytes bytes encoding a string, whose encoding should be guessed

static guessEncoding(bytes: Uint8Array, hints: Map<DecodeHintType, any>): string;
/**
*
* @see https://stackoverflow.com/a/13439711/4367683
*
* @param append The new string to append.
* @param args Argumets values to be formated.
*/
static format(append: string, ...args: any[]): string;
/**
*
*/
static getBytes(str: string, encoding: CharacterSetECI): Uint8Array;
/**
* Returns the charcode at the specified index or at index zero.
*/
static getCharCode(str: string, index?: number): int;
}

@@ -21,2 +21,3 @@ /*

import CharacterSetECI from './CharacterSetECI';
import StringEncoding from '../util/StringEncoding';
/**

@@ -31,3 +32,2 @@ * Common string-related functions.

// EUC_JP.equalsIgnoreCase(PLATFORM_DEFAULT_ENCODING);
StringUtils() { }
/**

@@ -199,2 +199,64 @@ * @param bytes bytes encoding a string, whose encoding should be guessed

}
/**
*
* @see https://stackoverflow.com/a/13439711/4367683
*
* @param append The new string to append.
* @param args Argumets values to be formated.
*/
static format(append, ...args) {
let i = -1;
function callback(exp, p0, p1, p2, p3, p4) {
if (exp === '%%')
return '%';
if (args[++i] === undefined)
return undefined;
exp = p2 ? parseInt(p2.substr(1)) : undefined;
let base = p3 ? parseInt(p3.substr(1)) : undefined;
let val;
switch (p4) {
case 's':
val = args[i];
break;
case 'c':
val = args[i][0];
break;
case 'f':
val = parseFloat(args[i]).toFixed(exp);
break;
case 'p':
val = parseFloat(args[i]).toPrecision(exp);
break;
case 'e':
val = parseFloat(args[i]).toExponential(exp);
break;
case 'x':
val = parseInt(args[i]).toString(base ? base : 16);
break;
case 'd':
val = parseFloat(parseInt(args[i], base ? base : 10).toPrecision(exp)).toFixed(0);
break;
}
val = typeof val === 'object' ? JSON.stringify(val) : (+val).toString(base);
let size = parseInt(p1); /* padding size */
let ch = p1 && (p1[0] + '') === '0' ? '0' : ' '; /* isnull? */
while (val.length < size)
val = p0 !== undefined ? val + ch : ch + val; /* isminus? */
return val;
}
let regex = /%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;
return append.replace(regex, callback);
}
/**
*
*/
static getBytes(str, encoding) {
return StringEncoding.encode(str, encoding);
}
/**
* Returns the charcode at the specified index or at index zero.
*/
static getCharCode(str, index = 0) {
return str.charCodeAt(index);
}
}

@@ -201,0 +263,0 @@ StringUtils.SHIFT_JIS = CharacterSetECI.SJIS.getName(); // "SJIS"

@@ -0,0 +0,0 @@ import Reader from '../Reader';

@@ -0,0 +0,0 @@ import Decoder from './decoder/Decoder';

@@ -0,0 +0,0 @@ import BitMatrix from '../../common/BitMatrix';

@@ -0,0 +0,0 @@ import BitMatrix from '../../common/BitMatrix';

@@ -0,0 +0,0 @@ import Version from './Version';

@@ -0,0 +0,0 @@ import IllegalArgumentException from '../../IllegalArgumentException';

@@ -0,0 +0,0 @@ import DecoderResult from '../../common/DecoderResult';

@@ -5,3 +5,3 @@ import DecoderResult from '../../common/DecoderResult';

import StringEncoding from '../../util/StringEncoding';
import { StringUtils } from '../../..';
import StringUtils from '../../common/StringUtils';
import FormatException from '../../FormatException';

@@ -8,0 +8,0 @@ import IllegalStateException from '../../IllegalStateException';

@@ -0,0 +0,0 @@ import DecoderResult from '../../common/DecoderResult';

@@ -0,0 +0,0 @@ import ReedSolomonDecoder from '../../common/reedsolomon/ReedSolomonDecoder';

@@ -0,0 +0,0 @@ import FormatException from '../../FormatException';

@@ -0,0 +0,0 @@ import BitMatrix from '../../common/BitMatrix';

@@ -0,0 +0,0 @@ import ResultPoint from '../../ResultPoint';

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ /*

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ /*

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ /*

@@ -0,0 +0,0 @@ import { CustomError } from 'ts-custom-error';

@@ -0,0 +0,0 @@ import { CustomError } from 'ts-custom-error';

@@ -6,2 +6,3 @@ import Exception from './Exception';

export default class FormatException extends Exception {
static getFormatInstance(): FormatException;
}

@@ -6,3 +6,6 @@ import Exception from './Exception';

export default class FormatException extends Exception {
static getFormatInstance() {
return new FormatException();
}
}
//# sourceMappingURL=FormatException.js.map

@@ -0,0 +0,0 @@ import Exception from './Exception';

@@ -0,0 +0,0 @@ import Exception from './Exception';

@@ -0,0 +0,0 @@ import Exception from './Exception';

@@ -0,0 +0,0 @@ import Exception from './Exception';

@@ -0,0 +0,0 @@ import LuminanceSource from './LuminanceSource';

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ /*

@@ -0,0 +0,0 @@ import DecodeHintType from './DecodeHintType';

@@ -22,2 +22,3 @@ /*

import NotFoundException from './NotFoundException';
import PDF417Reader from './pdf417/PDF417Reader';
import ReaderException from './ReaderException';

@@ -118,5 +119,5 @@ /*namespace com.google.zxing {*/

// }
// if (formats.includes(BarcodeFormat.PDF_417)) {
// readers.push(new PDF417Reader())
// }
if (formats.includes(BarcodeFormat.PDF_417)) {
readers.push(new PDF417Reader());
}
// if (formats.includes(BarcodeFormat.MAXICODE)) {

@@ -137,3 +138,3 @@ // readers.push(new MaxiCodeReader())

// readers.push(new AztecReader())
// readers.push(new PDF417Reader())
readers.push(new PDF417Reader());
// readers.push(new MaxiCodeReader())

@@ -140,0 +141,0 @@ if (tryHarder) {

@@ -0,0 +0,0 @@ import BitMatrix from './common/BitMatrix';

@@ -6,2 +6,3 @@ import Exception from './Exception';

export default class NotFoundException extends Exception {
static getNotFoundInstance(): NotFoundException;
}

@@ -6,3 +6,6 @@ import Exception from './Exception';

export default class NotFoundException extends Exception {
static getNotFoundInstance() {
return new NotFoundException();
}
}
//# sourceMappingURL=NotFoundException.js.map

@@ -0,0 +0,0 @@ import BitArray from '../common/BitArray';

@@ -0,0 +0,0 @@ import BitArray from '../common/BitArray';

@@ -0,0 +0,0 @@ import BarcodeFormat from '../BarcodeFormat';

@@ -0,0 +0,0 @@ /*

@@ -0,0 +0,0 @@ import BarcodeFormat from '../BarcodeFormat';

@@ -0,0 +0,0 @@ /*

@@ -0,0 +0,0 @@ import BitArray from '../common/BitArray';

@@ -0,0 +0,0 @@ /*

@@ -0,0 +0,0 @@ import BitArray from '../common/BitArray';

@@ -0,0 +0,0 @@ import BitArray from '../common/BitArray';

@@ -0,0 +0,0 @@ import BinaryBitmap from '../BinaryBitmap';

@@ -0,0 +0,0 @@ /*

@@ -0,0 +0,0 @@ import OneDReader from '../OneDReader';

@@ -0,0 +0,0 @@ import OneDReader from '../OneDReader';

@@ -0,0 +0,0 @@ export default class DataCharacter {

@@ -0,0 +0,0 @@ export default class DataCharacter {

@@ -0,0 +0,0 @@ import ResultPoint from '../../ResultPoint';

@@ -0,0 +0,0 @@ import ResultPoint from '../../ResultPoint';

@@ -0,0 +0,0 @@ import DataCharacter from './DataCharacter';

@@ -0,0 +0,0 @@ import DataCharacter from './DataCharacter';

@@ -0,0 +0,0 @@ import AbstractRSSReader from './AbstractRSSReader';

@@ -0,0 +0,0 @@ import AbstractRSSReader from './AbstractRSSReader';

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ import BitArray from '../common/BitArray';

@@ -17,3 +17,3 @@ /*

import BarcodeFormat from '../BarcodeFormat';
import UPCEANReader from './UPCEANReader';
import AbstractUPCEANReader from './AbstractUPCEANReader';
import Result from '../Result';

@@ -56,3 +56,3 @@ import ResultPoint from '../ResultPoint';

for (let x = 0; x < 2 && rowOffset < end; x++) {
let bestMatch = UPCEANReader.decodeDigit(row, counters, rowOffset, UPCEANReader.L_AND_G_PATTERNS);
let bestMatch = AbstractUPCEANReader.decodeDigit(row, counters, rowOffset, AbstractUPCEANReader.L_AND_G_PATTERNS);
resultString += String.fromCharCode(('0'.charCodeAt(0) + bestMatch % 10));

@@ -59,0 +59,0 @@ for (let counter of counters) {

@@ -0,0 +0,0 @@ import BitArray from '../common/BitArray';

@@ -17,3 +17,4 @@ /*

import BarcodeFormat from '../BarcodeFormat';
import UPCEANReader from './UPCEANReader';
// import UPCEANReader from './UPCEANReader';
import AbstractUPCEANReader from './AbstractUPCEANReader';
import Result from '../Result';

@@ -57,3 +58,3 @@ import ResultPoint from '../ResultPoint';

for (let x = 0; x < 5 && rowOffset < end; x++) {
let bestMatch = UPCEANReader.decodeDigit(row, counters, rowOffset, UPCEANReader.L_AND_G_PATTERNS);
let bestMatch = AbstractUPCEANReader.decodeDigit(row, counters, rowOffset, AbstractUPCEANReader.L_AND_G_PATTERNS);
resultString += String.fromCharCode(('0'.charCodeAt(0) + bestMatch % 10));

@@ -60,0 +61,0 @@ for (let counter of counters) {

@@ -0,0 +0,0 @@ import BitArray from '../common/BitArray';

@@ -16,3 +16,3 @@ /*

*/
import UPCEANReader from './UPCEANReader';
import AbstractUPCEANReader from './AbstractUPCEANReader';
import UPCEANExtension5Support from './UPCEANExtension5Support';

@@ -22,4 +22,5 @@ import UPCEANExtension2Support from './UPCEANExtension2Support';

static decodeRow(rowNumber, row, rowOffset) {
let extensionStartRange = UPCEANReader.findGuardPattern(row, rowOffset, false, this.EXTENSION_START_PATTERN, new Array(this.EXTENSION_START_PATTERN.length).fill(0));
let extensionStartRange = AbstractUPCEANReader.findGuardPattern(row, rowOffset, false, this.EXTENSION_START_PATTERN, new Array(this.EXTENSION_START_PATTERN.length).fill(0));
try {
// return null;
let fiveSupport = new UPCEANExtension5Support();

@@ -29,2 +30,3 @@ return fiveSupport.decodeRow(rowNumber, row, extensionStartRange);

catch (err) {
// return null;
let twoSupport = new UPCEANExtension2Support();

@@ -31,0 +33,0 @@ return twoSupport.decodeRow(rowNumber, row, extensionStartRange);

import BitArray from '../common/BitArray';
import DecodeHintType from '../DecodeHintType';
import Result from '../Result';
import OneDReader from './OneDReader';
import AbstractUPCEANReader from './AbstractUPCEANReader';
/**

@@ -13,28 +13,4 @@ * <p>Encapsulates functionality and implementation that is common to UPC and EAN families

*/
export default abstract class UPCEANReader extends OneDReader {
private static MAX_AVG_VARIANCE;
private static MAX_INDIVIDUAL_VARIANCE;
/**
* Start/end guard pattern.
*/
static START_END_PATTERN: number[];
/**
* Pattern marking the middle of a UPC/EAN pattern, separating the two halves.
*/
static MIDDLE_PATTERN: number[];
/**
* end guard pattern.
*/
static END_PATTERN: number[];
/**
* "Odd", or "L" patterns used to encode UPC/EAN digits.
*/
static L_PATTERNS: number[][];
/**
* As above but also including the "even", or "G" patterns used to encode UPC/EAN digits.
*/
static L_AND_G_PATTERNS: number[][];
private decodeRowStringBuffer;
export default abstract class UPCEANReader extends AbstractUPCEANReader {
constructor();
static findStartGuardPattern(row: BitArray): number[];
decodeRow(rowNumber: number, row: BitArray, hints?: Map<DecodeHintType, any>): Result;

@@ -45,21 +21,2 @@ static checkChecksum(s: string): boolean;

static decodeEnd(row: BitArray, endStart: number): number[];
static findGuardPattern(row: BitArray, rowOffset: number, whiteFirst: boolean, pattern: number[], counters: number[]): number[];
static decodeDigit(row: BitArray, counters: number[], rowOffset: number, patterns: number[][]): number;
/**
* Get the format of this decoder.
*
* @return The 1D format.
*/
abstract getBarcodeFormat(): any;
/**
* Subclasses override this to decode the portion of a barcode between the start
* and end guard patterns.
*
* @param row row of black/white values to search
* @param startRange start/end offset of start guard pattern
* @param resultString {@link StringBuilder} to append decoded chars to
* @return horizontal offset of first pixel after the "middle" that was decoded
* @throws NotFoundException if decoding could not complete successfully
*/
abstract decodeMiddle(row: BitArray, startRange: number[], resultString: string): any;
}

@@ -21,4 +21,4 @@ /*

import ResultPoint from '../ResultPoint';
import OneDReader from './OneDReader';
import UPCEANExtensionSupport from './UPCEANExtensionSupport';
import AbstractUPCEANReader from './AbstractUPCEANReader';
import NotFoundException from '../NotFoundException';

@@ -35,9 +35,6 @@ import FormatException from '../FormatException';

*/
export default class UPCEANReader extends OneDReader {
// private final UPCEANExtensionSupport extensionReader;
// private final EANManufacturerOrgSupport eanManSupport;
export default class UPCEANReader extends AbstractUPCEANReader {
constructor() {
super();
this.decodeRowStringBuffer = '';
this.decodeRowStringBuffer = '';
UPCEANReader.L_AND_G_PATTERNS = UPCEANReader.L_PATTERNS.map(function (arr) {

@@ -55,26 +52,2 @@ return arr.slice();

}
/*
protected UPCEANReader() {
decodeRowStringBuffer = new StringBuilder(20);
extensionReader = new UPCEANExtensionSupport();
eanManSupport = new EANManufacturerOrgSupport();
}
*/
static findStartGuardPattern(row) {
let foundStart = false;
let startRange = null;
let nextStart = 0;
let counters = [0, 0, 0];
while (!foundStart) {
counters = [0, 0, 0];
startRange = UPCEANReader.findGuardPattern(row, nextStart, false, this.START_END_PATTERN, counters);
let start = startRange[0];
nextStart = startRange[1];
let quietStart = start - (nextStart - start);
if (quietStart >= 0) {
foundStart = row.isRange(quietStart, start, false);
}
}
return startRange;
}
decodeRow(rowNumber, row, hints) {

@@ -183,89 +156,3 @@ let startGuardRange = UPCEANReader.findStartGuardPattern(row);

}
static findGuardPattern(row, rowOffset, whiteFirst, pattern, counters) {
let width = row.getSize();
rowOffset = whiteFirst ? row.getNextUnset(rowOffset) : row.getNextSet(rowOffset);
let counterPosition = 0;
let patternStart = rowOffset;
let patternLength = pattern.length;
let isWhite = whiteFirst;
for (let x = rowOffset; x < width; x++) {
if (row.get(x) !== isWhite) {
counters[counterPosition]++;
}
else {
if (counterPosition === patternLength - 1) {
if (OneDReader.patternMatchVariance(counters, pattern, UPCEANReader.MAX_INDIVIDUAL_VARIANCE) < UPCEANReader.MAX_AVG_VARIANCE) {
return [patternStart, x];
}
patternStart += counters[0] + counters[1];
let slice = counters.slice(2, counters.length);
for (let i = 0; i < counterPosition - 1; i++) {
counters[i] = slice[i];
}
counters[counterPosition - 1] = 0;
counters[counterPosition] = 0;
counterPosition--;
}
else {
counterPosition++;
}
counters[counterPosition] = 1;
isWhite = !isWhite;
}
}
throw new NotFoundException();
}
static decodeDigit(row, counters, rowOffset, patterns) {
this.recordPattern(row, rowOffset, counters);
let bestVariance = this.MAX_AVG_VARIANCE;
let bestMatch = -1;
let max = patterns.length;
for (let i = 0; i < max; i++) {
let pattern = patterns[i];
let variance = OneDReader.patternMatchVariance(counters, pattern, UPCEANReader.MAX_INDIVIDUAL_VARIANCE);
if (variance < bestVariance) {
bestVariance = variance;
bestMatch = i;
}
}
if (bestMatch >= 0) {
return bestMatch;
}
else {
throw new NotFoundException();
}
}
}
// These two values are critical for determining how permissive the decoding will be.
// We've arrived at these values through a lot of trial and error. Setting them any higher
// lets false positives creep in quickly.
UPCEANReader.MAX_AVG_VARIANCE = 0.48;
UPCEANReader.MAX_INDIVIDUAL_VARIANCE = 0.7;
/**
* Start/end guard pattern.
*/
UPCEANReader.START_END_PATTERN = [1, 1, 1];
/**
* Pattern marking the middle of a UPC/EAN pattern, separating the two halves.
*/
UPCEANReader.MIDDLE_PATTERN = [1, 1, 1, 1, 1];
/**
* end guard pattern.
*/
UPCEANReader.END_PATTERN = [1, 1, 1, 1, 1, 1];
/**
* "Odd", or "L" patterns used to encode UPC/EAN digits.
*/
UPCEANReader.L_PATTERNS = [
[3, 2, 1, 1],
[2, 2, 2, 1],
[2, 1, 2, 2],
[1, 4, 1, 1],
[1, 1, 3, 2],
[1, 2, 3, 1],
[1, 1, 1, 4],
[1, 3, 1, 2],
[1, 2, 1, 3],
[3, 1, 1, 2],
];
//# sourceMappingURL=UPCEANReader.js.map

@@ -0,0 +0,0 @@ import LuminanceSource from './LuminanceSource';

@@ -0,0 +0,0 @@ import BitMatrix from '../../common/BitMatrix';

@@ -0,0 +0,0 @@ import Version from './Version';

@@ -0,0 +0,0 @@ import BitMatrix from '../../common/BitMatrix';

@@ -0,0 +0,0 @@ import DecodeHintType from '../../DecodeHintType';

@@ -0,0 +0,0 @@ import DecodeHintType from '../../DecodeHintType';

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ import ECB from './ECB';

@@ -0,0 +0,0 @@ export declare enum ErrorCorrectionLevelValues {

@@ -0,0 +0,0 @@ import ErrorCorrectionLevel from './ErrorCorrectionLevel';

@@ -0,0 +0,0 @@ import Version from './Version';

@@ -0,0 +0,0 @@ import ResultPoint from '../../ResultPoint';

@@ -0,0 +0,0 @@ import BitMatrix from '../../common/BitMatrix';

@@ -0,0 +0,0 @@ import ResultPoint from '../../ResultPoint';

@@ -0,0 +0,0 @@ import ResultPointCallback from '../../ResultPointCallback';

@@ -0,0 +0,0 @@ import DecodeHintType from '../../DecodeHintType';

@@ -0,0 +0,0 @@ import ResultPoint from '../../ResultPoint';

@@ -0,0 +0,0 @@ import DecodeHintType from '../../DecodeHintType';

@@ -546,3 +546,3 @@ /*

const possibleCenters = this.possibleCenters;
let average; /*float*/
let average;
// Filter outlier possibilities whose module size is too different

@@ -549,0 +549,0 @@ if (startSize > 3) {

@@ -0,0 +0,0 @@ import FinderPattern from './FinderPattern';

@@ -0,0 +0,0 @@ export default class BlockPair {

@@ -63,3 +63,3 @@ /*

for (const aByte of this.bytes) {
Arrays.fillUint8Array(aByte, value);
Arrays.fill(aByte, value);
}

@@ -66,0 +66,0 @@ }

@@ -0,0 +0,0 @@ import EncodeHintType from '../../EncodeHintType';

@@ -0,0 +0,0 @@ import ByteMatrix from './ByteMatrix';

@@ -0,0 +0,0 @@ import BitArray from '../../common/BitArray';

@@ -0,0 +0,0 @@ import ErrorCorrectionLevel from '../decoder/ErrorCorrectionLevel';

@@ -0,0 +0,0 @@ import BinaryBitmap from '../BinaryBitmap';

@@ -0,0 +0,0 @@ import BarcodeFormat from '../BarcodeFormat';

@@ -0,0 +0,0 @@ import BinaryBitmap from './BinaryBitmap';

@@ -0,0 +0,0 @@ /*

@@ -0,0 +0,0 @@ import Exception from './Exception';

@@ -0,0 +0,0 @@ import Exception from './Exception';

@@ -0,0 +0,0 @@ import Exception from './Exception';

@@ -0,0 +0,0 @@ import Exception from './Exception';

@@ -17,3 +17,3 @@ import ResultPoint from './ResultPoint';

private resultMetadata;
constructor(text: string, rawBytes: Uint8Array, numBits: number, resultPoints: Array<ResultPoint>, format: BarcodeFormat, timestamp: number);
constructor(text: string, rawBytes: Uint8Array, numBits: number, resultPoints: ResultPoint[], format: BarcodeFormat, timestamp?: number);
/**

@@ -20,0 +20,0 @@ * @return raw text encoded by the barcode

@@ -16,6 +16,2 @@ /*

*/
/*namespace com.google.zxing {*/
/*import java.util.EnumMap;*/
/*import java.util.Map;*/
import ResultPoint from './ResultPoint';
import System from './util/System';

@@ -42,3 +38,3 @@ /**

// }
constructor(text, rawBytes, numBits /*int*/, resultPoints, format, timestamp /*long*/) {
constructor(text, rawBytes, numBits = rawBytes == null ? 0 : 8 * rawBytes.length, resultPoints, format, timestamp = System.currentTimeMillis()) {
this.text = text;

@@ -131,3 +127,3 @@ this.rawBytes = rawBytes;

else if (newPoints !== null && newPoints.length > 0) {
const allPoints = new ResultPoint[oldPoints.length + newPoints.length];
const allPoints = new Array(oldPoints.length + newPoints.length);
System.arraycopy(oldPoints, 0, allPoints, 0, oldPoints.length);

@@ -134,0 +130,0 @@ System.arraycopy(newPoints, 0, allPoints, oldPoints.length, newPoints.length);

@@ -10,7 +10,7 @@ /**

private y;
constructor(x: number, y: number);
getX(): number;
getY(): number;
constructor(x: float, y: float);
getX(): float;
getY(): float;
equals(other: Object): boolean;
hashCode(): number;
hashCode(): int;
toString(): string;

@@ -29,3 +29,3 @@ /**

*/
static distance(pattern1: ResultPoint, pattern2: ResultPoint): number;
static distance(pattern1: ResultPoint, pattern2: ResultPoint): float;
/**

@@ -32,0 +32,0 @@ * Returns the z component of the cross product between vectors BC and BA.

@@ -26,3 +26,3 @@ /*

export default class ResultPoint {
constructor(x /*float*/, y /*float*/) {
constructor(x, y) {
this.x = x;

@@ -29,0 +29,0 @@ this.y = y;

@@ -0,0 +0,0 @@ import ResultPoint from './ResultPoint';

@@ -0,0 +0,0 @@ import './InvertedLuminanceSource';

@@ -0,0 +0,0 @@ import Exception from './Exception';

@@ -0,0 +0,0 @@ import Exception from './Exception';

export default class Arrays {
/**
* Assigns the specified int value to each element of the specified array
* of ints.
*
* @param a the array to be filled
* @param val the value to be stored in all elements of the array
*/
static fill(a: Int32Array | Uint8Array | any[], val: int): void;
/**
* Assigns the specified int value to each element of the specified
* range of the specified array of ints. The range to be filled
* extends from index {@code fromIndex}, inclusive, to index
* {@code toIndex}, exclusive. (If {@code fromIndex==toIndex}, the
* range to be filled is empty.)
*
* @param a the array to be filled
* @param fromIndex the index of the first element (inclusive) to be
* filled with the specified value
* @param toIndex the index of the last element (exclusive) to be
* filled with the specified value
* @param val the value to be stored in all elements of the array
* @throws IllegalArgumentException if {@code fromIndex > toIndex}
* @throws ArrayIndexOutOfBoundsException if {@code fromIndex < 0} or
* {@code toIndex > a.length}
*/
static fillWithin(a: Int32Array, fromIndex: int, toIndex: int, val: int): void;
/**
* Checks that {@code fromIndex} and {@code toIndex} are in
* the range and throws an exception if they aren't.
*/
static rangeCheck(arrayLength: int, fromIndex: int, toIndex: int): void;
static asList<T = any>(...args: T[]): T[];
static create<T = any>(rows: int, cols: int, value?: T): T[][];
static createInt32Array(rows: int, cols: int, value?: int): Int32Array[];
static equals(first: any, second: any): boolean;

@@ -6,4 +40,6 @@ static hashCode(a: any): number;

static copyOf(original: Int32Array, newLength: number): Int32Array;
static copyOfUint8Array(original: Uint8Array, newLength: number): Uint8Array;
static copyOfRange(original: Int32Array, from: number, to: number): Int32Array;
static binarySearch(ar: Int32Array, el: number, comparator?: (a: number, b: number) => number): number;
static numberComparator(a: number, b: number): number;
}
import System from './System';
import IllegalArgumentException from '../IllegalArgumentException';
import ArrayIndexOutOfBoundsException from '../ArrayIndexOutOfBoundsException';
export default class Arrays {
/**
* Assigns the specified int value to each element of the specified array
* of ints.
*
* @param a the array to be filled
* @param val the value to be stored in all elements of the array
*/
static fill(a, val) {
for (let i = 0, len = a.length; i < len; i++)
a[i] = val;
}
/**
* Assigns the specified int value to each element of the specified
* range of the specified array of ints. The range to be filled
* extends from index {@code fromIndex}, inclusive, to index
* {@code toIndex}, exclusive. (If {@code fromIndex==toIndex}, the
* range to be filled is empty.)
*
* @param a the array to be filled
* @param fromIndex the index of the first element (inclusive) to be
* filled with the specified value
* @param toIndex the index of the last element (exclusive) to be
* filled with the specified value
* @param val the value to be stored in all elements of the array
* @throws IllegalArgumentException if {@code fromIndex > toIndex}
* @throws ArrayIndexOutOfBoundsException if {@code fromIndex < 0} or
* {@code toIndex > a.length}
*/
static fillWithin(a, fromIndex, toIndex, val) {
Arrays.rangeCheck(a.length, fromIndex, toIndex);
for (let i = fromIndex; i < toIndex; i++)
a[i] = val;
}
/**
* Checks that {@code fromIndex} and {@code toIndex} are in
* the range and throws an exception if they aren't.
*/
static rangeCheck(arrayLength, fromIndex, toIndex) {
if (fromIndex > toIndex) {
throw new IllegalArgumentException('fromIndex(' + fromIndex + ') > toIndex(' + toIndex + ')');
}
if (fromIndex < 0) {
throw new ArrayIndexOutOfBoundsException(fromIndex);
}
if (toIndex > arrayLength) {
throw new ArrayIndexOutOfBoundsException(toIndex);
}
}
static asList(...args) {
return args;
}
static create(rows, cols, value) {
let arr = Array.from({ length: rows });
return arr.map(x => Array.from({ length: cols }).fill(value));
}
static createInt32Array(rows, cols, value) {
let arr = Array.from({ length: rows });
return arr.map(x => Int32Array.from({ length: cols }).fill(value));
}
static equals(first, second) {

@@ -42,4 +103,16 @@ if (!first) {

static copyOf(original, newLength) {
return original.slice(0, newLength);
}
static copyOfUint8Array(original, newLength) {
if (original.length <= newLength) {
const newArray = new Uint8Array(newLength);
newArray.set(original);
return newArray;
}
return original.slice(0, newLength);
}
static copyOfRange(original, from, to) {
const newLength = to - from;
const copy = new Int32Array(newLength);
System.arraycopy(original, 0, copy, 0, Math.min(original.length, newLength));
System.arraycopy(original, from, copy, 0, newLength);
return copy;

@@ -46,0 +119,0 @@ }

@@ -0,3 +1,14 @@

/**
* Ponyfill for Java's Float class.
*/
export default class Float {
/**
* The float max value in JS is the number max value.
*/
static MAX_VALUE: number;
/**
* SincTS has no difference between int and float, there's all numbers,
* this is used only to polyfill Java code.
*/
static floatToIntBits(f: number): number;
}

@@ -0,2 +1,9 @@

/**
* Ponyfill for Java's Float class.
*/
export default class Float {
/**
* SincTS has no difference between int and float, there's all numbers,
* this is used only to polyfill Java code.
*/
static floatToIntBits(f) {

@@ -6,2 +13,6 @@ return f;

}
/**
* The float max value in JS is the number max value.
*/
Float.MAX_VALUE = Number.MAX_SAFE_INTEGER;
//# sourceMappingURL=Float.js.map

@@ -0,3 +1,7 @@

/**
* Ponyfill for Java's Integer class.
*/
export default class Integer {
static MIN_VALUE_32_BITS: number;
static MAX_VALUE: number;
static numberOfTrailingZeros(i: number): number;

@@ -7,2 +11,8 @@ static numberOfLeadingZeros(i: number): number;

static bitCount(i: number): number;
/**
* Converts A string to an integer.
* @param s A string to convert into a number.
* @param radix A value between 2 and 36 that specifies the base of the number in numString. If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. All other strings are considered decimal.
*/
static parseInt(num: string, radix?: number): number;
}

@@ -0,1 +1,4 @@

/**
* Ponyfill for Java's Integer class.
*/
export default class Integer {

@@ -69,4 +72,13 @@ static numberOfTrailingZeros(i) {

}
/**
* Converts A string to an integer.
* @param s A string to convert into a number.
* @param radix A value between 2 and 36 that specifies the base of the number in numString. If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. All other strings are considered decimal.
*/
static parseInt(num, radix = undefined) {
return parseInt(num, radix);
}
}
Integer.MIN_VALUE_32_BITS = -2147483648;
Integer.MAX_VALUE = Number.MAX_SAFE_INTEGER;
//# sourceMappingURL=Integer.js.map

@@ -0,4 +1,7 @@

import CharacterSetECI from '../common/CharacterSetECI';
export default class StringBuilder {
private value;
private encoding;
constructor(value?: string);
enableDecoding(encoding: CharacterSetECI): StringBuilder;
append(s: string | number): StringBuilder;

@@ -9,4 +12,9 @@ length(): number;

setCharAt(n: number, c: string): void;
substring(start: int, end: int): string;
/**
* @note helper method for RSS Expanded
*/
setLengthToZero(): void;
toString(): string;
insert(n: number, c: string): void;
}

@@ -0,1 +1,2 @@

import StringEncoding from './StringEncoding';
export default class StringBuilder {

@@ -5,2 +6,6 @@ constructor(value = '') {

}
enableDecoding(encoding) {
this.encoding = encoding;
return this;
}
append(s) {

@@ -10,3 +15,8 @@ if (typeof s === 'string') {

}
else if (this.encoding) {
// use passed format (fromCharCode will return UTF8 encoding)
this.value += StringEncoding.decode(new Uint8Array([s]), this.encoding);
}
else {
// correctly converts from UTF-8, but not other encodings
this.value += String.fromCharCode(s);

@@ -28,2 +38,11 @@ }

}
substring(start, end) {
return this.value.substring(start, end);
}
/**
* @note helper method for RSS Expanded
*/
setLengthToZero() {
this.value = "";
}
toString() {

@@ -30,0 +49,0 @@ return this.value;

@@ -0,0 +0,0 @@ import CharacterSetECI from '../common/CharacterSetECI';

@@ -0,0 +0,0 @@ import UnsupportedOperationException from '../UnsupportedOperationException';

@@ -0,0 +0,0 @@ export default class System {

@@ -0,0 +0,0 @@ export default class System {

@@ -0,0 +0,0 @@ import BitMatrix from './common/BitMatrix';

@@ -0,0 +0,0 @@ /*

@@ -0,0 +0,0 @@ import Exception from './Exception';

@@ -0,0 +0,0 @@ import Exception from './Exception';

@@ -1,11 +0,2 @@

export * from './browser/BrowserBarcodeReader';
export * from './browser/BrowserCodeReader';
export * from './browser/BrowserDatamatrixCodeReader';
export * from './browser/BrowserMultiFormatReader';
export * from './browser/BrowserQRCodeReader';
export * from './browser/BrowserQRCodeSvgWriter';
export * from './browser/DecodeContinuouslyCallback';
export * from './browser/HTMLCanvasElementLuminanceSource';
export * from './browser/HTMLVisualMediaElement';
export * from './browser/VideoInputDevice';
export * from './browser';
export { default as ArgumentException } from './core/ArgumentException';

@@ -70,2 +61,3 @@ export { default as ArithmeticException } from './core/ArithmeticException';

export { default as RSS14Reader } from './core/oned/rss/RSS14Reader';
export { default as RSSExpandedReader } from './core/oned/rss/expanded/RSSExpandedReader';
export { default as MultiformatReader } from './core/oned/MultiFormatOneDReader';

@@ -1,10 +0,2 @@

// browser
export * from './browser/BrowserBarcodeReader';
export * from './browser/BrowserCodeReader';
export * from './browser/BrowserDatamatrixCodeReader';
export * from './browser/BrowserMultiFormatReader';
export * from './browser/BrowserQRCodeReader';
export * from './browser/BrowserQRCodeSvgWriter';
export * from './browser/HTMLCanvasElementLuminanceSource';
export * from './browser/VideoInputDevice';
export * from './browser';
// Exceptions

@@ -75,3 +67,4 @@ export { default as ArgumentException } from './core/ArgumentException';

export { default as RSS14Reader } from './core/oned/rss/RSS14Reader';
export { default as RSSExpandedReader } from './core/oned/rss/expanded/RSSExpandedReader';
export { default as MultiformatReader } from './core/oned/MultiFormatOneDReader';
//# sourceMappingURL=index.js.map

@@ -0,0 +0,0 @@ import { BrowserCodeReader } from './BrowserCodeReader';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import BinaryBitmap from '../core/BinaryBitmap';

@@ -37,2 +37,12 @@ "use strict";

};
var __values = (this && this.__values) || function (o) {
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
if (m) return m.call(o);
return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -145,5 +155,5 @@ var ArgumentException_1 = require("../core/ArgumentException");

return __awaiter(this, void 0, void 0, function () {
var devices, videoDevices, _i, devices_1, device, kind, deviceId, label, groupId, videoDevice;
return __generator(this, function (_a) {
switch (_a.label) {
var e_1, _a, devices, videoDevices, devices_1, devices_1_1, device, kind, deviceId, label, groupId, videoDevice;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:

@@ -158,16 +168,25 @@ if (!this.hasNavigator) {

case 1:
devices = _a.sent();
devices = _b.sent();
videoDevices = [];
for (_i = 0, devices_1 = devices; _i < devices_1.length; _i++) {
device = devices_1[_i];
kind = device.kind === 'video' ? 'videoinput' : device.kind;
if (kind !== 'videoinput') {
continue;
try {
for (devices_1 = __values(devices), devices_1_1 = devices_1.next(); !devices_1_1.done; devices_1_1 = devices_1.next()) {
device = devices_1_1.value;
kind = device.kind === 'video' ? 'videoinput' : device.kind;
if (kind !== 'videoinput') {
continue;
}
deviceId = device.deviceId || device.id;
label = device.label || "Video device " + (videoDevices.length + 1);
groupId = device.groupId;
videoDevice = { deviceId: deviceId, label: label, kind: kind, groupId: groupId };
videoDevices.push(videoDevice);
}
deviceId = device.deviceId || device.id;
label = device.label || "Video device " + (videoDevices.length + 1);
groupId = device.groupId;
videoDevice = { deviceId: deviceId, label: label, kind: kind, groupId: groupId };
videoDevices.push(videoDevice);
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (devices_1_1 && !devices_1_1.done && (_a = devices_1.return)) _a.call(devices_1);
}
finally { if (e_1) throw e_1.error; }
}
return [2 /*return*/, videoDevices];

@@ -174,0 +193,0 @@ }

@@ -0,0 +0,0 @@ import { BrowserCodeReader } from './BrowserCodeReader';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { BrowserCodeReader } from './BrowserCodeReader';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { BrowserCodeReader } from './BrowserCodeReader';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import EncodeHintType from '../core/EncodeHintType';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import EncodeHintType from '../core/EncodeHintType';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import Exception from '../core/Exception';

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=DecodeContinuouslyCallback.js.map

@@ -0,0 +0,0 @@ import LuminanceSource from '../core/LuminanceSource';

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=HTMLVisualMediaElement.js.map

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import Exception from './Exception';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import Exception from './Exception';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import LuminanceSource from './LuminanceSource';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ "use strict";

@@ -6,2 +6,3 @@ import Exception from './Exception';

export default class ChecksumException extends Exception {
static getChecksumInstance(): ChecksumException;
}

@@ -25,2 +25,5 @@ "use strict";

}
ChecksumException.getChecksumInstance = function () {
return new ChecksumException();
};
return ChecksumException;

@@ -27,0 +30,0 @@ }(Exception_1.default));

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ "use strict";

@@ -37,2 +37,3 @@ import BitArray from './BitArray';

*
* @function parse
* @param image bits of the image, as a row-major 2D array. Elements are arrays representing rows

@@ -42,2 +43,9 @@ * @return {@link BitMatrix} representation of image

static parseFromBooleanArray(image: boolean[][]): BitMatrix;
/**
*
* @function parse
* @param stringRepresentation
* @param setString
* @param unsetString
*/
static parseFromString(stringRepresentation: string, setString: string, unsetString: string): BitMatrix;

@@ -131,3 +139,3 @@ /**

equals(o: Object): boolean;
hashCode(): number;
hashCode(): int;
/**

@@ -134,0 +142,0 @@ * @return string representation using "X" for set and " " for unset bits

@@ -87,2 +87,3 @@ "use strict";

*
* @function parse
* @param image bits of the image, as a row-major 2D array. Elements are arrays representing rows

@@ -105,2 +106,9 @@ * @return {@link BitMatrix} representation of image

};
/**
*
* @function parse
* @param stringRepresentation
* @param setString
* @param unsetString
*/
BitMatrix.parseFromString = function (stringRepresentation, setString, unsetString) {

@@ -107,0 +115,0 @@ if (stringRepresentation === null) {

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ export declare enum CharacterSetValueIdentifiers {

@@ -17,2 +17,12 @@ "use strict";

*/
var __values = (this && this.__values) || function (o) {
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
if (m) return m.call(o);
return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -61,2 +71,3 @@ /*namespace com.google.zxing.common {*/

function CharacterSetECI(valueIdentifier, valuesParam, name) {
var e_1, _a;
var otherEncodingNames = [];

@@ -82,6 +93,15 @@ for (var _i = 3; _i < arguments.length; _i++) {

}
for (var _a = 0, otherEncodingNames_1 = otherEncodingNames; _a < otherEncodingNames_1.length; _a++) {
var otherName = otherEncodingNames_1[_a];
CharacterSetECI.NAME_TO_ECI.set(otherName, this);
try {
for (var otherEncodingNames_1 = __values(otherEncodingNames), otherEncodingNames_1_1 = otherEncodingNames_1.next(); !otherEncodingNames_1_1.done; otherEncodingNames_1_1 = otherEncodingNames_1.next()) {
var otherName = otherEncodingNames_1_1.value;
CharacterSetECI.NAME_TO_ECI.set(otherName, this);
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (otherEncodingNames_1_1 && !otherEncodingNames_1_1.done && (_a = otherEncodingNames_1.return)) _a.call(otherEncodingNames_1);
}
finally { if (e_1) throw e_1.error; }
}
}

@@ -88,0 +108,0 @@ // CharacterSetECI(value: number /*int*/) {

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import GridSampler from './GridSampler';

@@ -60,3 +60,3 @@ "use strict";

for (var x = 0; x < max; x += 2) {
points[x] = /*(float)*/ (x / 2) + 0.5;
points[x] = (x / 2) + 0.5;
points[x + 1] = iValue;

@@ -63,0 +63,0 @@ }

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import ResultPoint from '../../ResultPoint';

@@ -0,0 +0,0 @@ import ResultPoint from '../ResultPoint';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import Binarizer from '../Binarizer';

@@ -108,3 +108,3 @@ "use strict";

for (var y = 1; y < 5; y++) {
var row = height * y / 5;
var row = Math.floor((height * y) / 5);
var localLuminances_1 = source.getRow(row, this.luminances);

@@ -111,0 +111,0 @@ var right = Math.floor((width * 4) / 5);

@@ -0,0 +0,0 @@ import BitMatrix from './BitMatrix';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import GridSampler from './GridSampler';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import Binarizer from '../Binarizer';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ "use strict";

import GenericGFPoly from './GenericGFPoly';
import AbstractGenericGF from './AbstractGenericGF';
/**

@@ -13,3 +14,3 @@ * <p>This class contains utility methods for performing mathematical operations over

*/
export default class GenericGF {
export default class GenericGF extends AbstractGenericGF {
private primitive;

@@ -26,4 +27,2 @@ private size;

static MAXICODE_FIELD_64: GenericGF;
private expTable;
private logTable;
private zero;

@@ -50,16 +49,2 @@ private one;

/**
* Implements both addition and subtraction -- they are the same in GF(size).
*
* @return sum/difference of a and b
*/
static addOrSubtract(a: number, b: number): number;
/**
* @return 2 to the power of a in GF(size)
*/
exp(a: number): number;
/**
* @return base 2 log of a in GF(size)
*/
log(a: number): number;
/**
* @return multiplicative inverse of a

@@ -66,0 +51,0 @@ */

@@ -17,5 +17,19 @@ "use strict";

*/
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
/*namespace com.google.zxing.common.reedsolomon {*/
var GenericGFPoly_1 = require("./GenericGFPoly");
var AbstractGenericGF_1 = require("./AbstractGenericGF");
var Integer_1 = require("../../util/Integer");

@@ -35,3 +49,4 @@ var IllegalArgumentException_1 = require("../../IllegalArgumentException");

*/
var GenericGF = /** @class */ (function () {
var GenericGF = /** @class */ (function (_super) {
__extends(GenericGF, _super);
/**

@@ -49,5 +64,6 @@ * Create a representation of GF(size) using the given primitive polynomial.

function GenericGF(primitive /*int*/, size /*int*/, generatorBase /*int*/) {
this.primitive = primitive;
this.size = size;
this.generatorBase = generatorBase;
var _this = _super.call(this) || this;
_this.primitive = primitive;
_this.size = size;
_this.generatorBase = generatorBase;
var expTable = new Int32Array(size);

@@ -63,3 +79,3 @@ var x = 1;

}
this.expTable = expTable;
_this.expTable = expTable;
var logTable = new Int32Array(size);

@@ -69,6 +85,7 @@ for (var i = 0; i < size - 1; i++) {

}
this.logTable = logTable;
_this.logTable = logTable;
// logTable[0] == 0 but this should never be used
this.zero = new GenericGFPoly_1.default(this, Int32Array.from([0]));
this.one = new GenericGFPoly_1.default(this, Int32Array.from([1]));
_this.zero = new GenericGFPoly_1.default(_this, Int32Array.from([0]));
_this.one = new GenericGFPoly_1.default(_this, Int32Array.from([1]));
return _this;
}

@@ -96,25 +113,2 @@ GenericGF.prototype.getZero = function () {

/**
* Implements both addition and subtraction -- they are the same in GF(size).
*
* @return sum/difference of a and b
*/
GenericGF.addOrSubtract = function (a /*int*/, b /*int*/) {
return a ^ b;
};
/**
* @return 2 to the power of a in GF(size)
*/
GenericGF.prototype.exp = function (a /*int*/) {
return this.expTable[a];
};
/**
* @return base 2 log of a in GF(size)
*/
GenericGF.prototype.log = function (a /*int*/) {
if (a === 0) {
throw new IllegalArgumentException_1.default();
}
return this.logTable[a];
};
/**
* @return multiplicative inverse of a

@@ -145,3 +139,3 @@ */

GenericGF.prototype.toString = function () {
return 'GF(0x' + Integer_1.default.toHexString(this.primitive) + ',' + this.size + ')';
return ('GF(0x' + Integer_1.default.toHexString(this.primitive) + ',' + this.size + ')');
};

@@ -155,9 +149,9 @@ GenericGF.prototype.equals = function (o) {

GenericGF.AZTEC_PARAM = new GenericGF(0x13, 16, 1); // x^4 + x + 1
GenericGF.QR_CODE_FIELD_256 = new GenericGF(0x011D, 256, 0); // x^8 + x^4 + x^3 + x^2 + 1
GenericGF.DATA_MATRIX_FIELD_256 = new GenericGF(0x012D, 256, 1); // x^8 + x^5 + x^3 + x^2 + 1
GenericGF.QR_CODE_FIELD_256 = new GenericGF(0x011d, 256, 0); // x^8 + x^4 + x^3 + x^2 + 1
GenericGF.DATA_MATRIX_FIELD_256 = new GenericGF(0x012d, 256, 1); // x^8 + x^5 + x^3 + x^2 + 1
GenericGF.AZTEC_DATA_8 = GenericGF.DATA_MATRIX_FIELD_256;
GenericGF.MAXICODE_FIELD_64 = GenericGF.AZTEC_DATA_6;
return GenericGF;
}());
}(AbstractGenericGF_1.default));
exports.default = GenericGF;
//# sourceMappingURL=GenericGF.js.map

@@ -1,2 +0,2 @@

import GenericGF from './GenericGF';
import AbstractGenericGF from './AbstractGenericGF';
/**

@@ -23,3 +23,3 @@ * <p>Represents a polynomial whose coefficients are elements of a GF.

*/
constructor(field: GenericGF, coefficients: Int32Array);
constructor(field: AbstractGenericGF, coefficients: Int32Array);
getCoefficients(): Int32Array;

@@ -26,0 +26,0 @@ /**

@@ -19,3 +19,3 @@ "use strict";

/*namespace com.google.zxing.common.reedsolomon {*/
var GenericGF_1 = require("./GenericGF");
var AbstractGenericGF_1 = require("./AbstractGenericGF");
var System_1 = require("../../util/System");

@@ -102,3 +102,3 @@ var IllegalArgumentException_1 = require("../../IllegalArgumentException");

var coefficient = coefficients[i];
result = GenericGF_1.default.addOrSubtract(result, coefficient);
result = AbstractGenericGF_1.default.addOrSubtract(result, coefficient);
}

@@ -111,3 +111,3 @@ return result;

for (var i = 1; i < size; i++) {
result = GenericGF_1.default.addOrSubtract(field.multiply(a, result), coefficients[i]);
result = AbstractGenericGF_1.default.addOrSubtract(field.multiply(a, result), coefficients[i]);
}

@@ -138,3 +138,3 @@ return result;

for (var i = lengthDiff; i < largerCoefficients.length; i++) {
sumDiff[i] = GenericGF_1.default.addOrSubtract(smallerCoefficients[i - lengthDiff], largerCoefficients[i]);
sumDiff[i] = AbstractGenericGF_1.default.addOrSubtract(smallerCoefficients[i - lengthDiff], largerCoefficients[i]);
}

@@ -159,3 +159,3 @@ return new GenericGFPoly(this.field, sumDiff);

for (var j = 0; j < bLength; j++) {
product[i + j] = GenericGF_1.default.addOrSubtract(product[i + j], field.multiply(aCoeff, bCoefficients[j]));
product[i + j] = AbstractGenericGF_1.default.addOrSubtract(product[i + j], field.multiply(aCoeff, bCoefficients[j]));
}

@@ -162,0 +162,0 @@ }

@@ -0,0 +0,0 @@ import GenericGF from './GenericGF';

@@ -0,0 +0,0 @@ import GenericGF from './GenericGF';

import DecodeHintType from '../DecodeHintType';
import CharacterSetECI from './CharacterSetECI';
/**

@@ -16,3 +17,2 @@ * Common string-related functions.

private static ASSUME_SHIFT_JIS;
private StringUtils;
/**

@@ -26,2 +26,18 @@ * @param bytes bytes encoding a string, whose encoding should be guessed

static guessEncoding(bytes: Uint8Array, hints: Map<DecodeHintType, any>): string;
/**
*
* @see https://stackoverflow.com/a/13439711/4367683
*
* @param append The new string to append.
* @param args Argumets values to be formated.
*/
static format(append: string, ...args: any[]): string;
/**
*
*/
static getBytes(str: string, encoding: CharacterSetECI): Uint8Array;
/**
* Returns the charcode at the specified index or at index zero.
*/
static getCharCode(str: string, index?: number): int;
}

@@ -23,2 +23,3 @@ "use strict";

var CharacterSetECI_1 = require("./CharacterSetECI");
var StringEncoding_1 = require("../util/StringEncoding");
/**

@@ -35,3 +36,2 @@ * Common string-related functions.

// EUC_JP.equalsIgnoreCase(PLATFORM_DEFAULT_ENCODING);
StringUtils.prototype.StringUtils = function () { };
/**

@@ -203,2 +203,69 @@ * @param bytes bytes encoding a string, whose encoding should be guessed

};
/**
*
* @see https://stackoverflow.com/a/13439711/4367683
*
* @param append The new string to append.
* @param args Argumets values to be formated.
*/
StringUtils.format = function (append) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
var i = -1;
function callback(exp, p0, p1, p2, p3, p4) {
if (exp === '%%')
return '%';
if (args[++i] === undefined)
return undefined;
exp = p2 ? parseInt(p2.substr(1)) : undefined;
var base = p3 ? parseInt(p3.substr(1)) : undefined;
var val;
switch (p4) {
case 's':
val = args[i];
break;
case 'c':
val = args[i][0];
break;
case 'f':
val = parseFloat(args[i]).toFixed(exp);
break;
case 'p':
val = parseFloat(args[i]).toPrecision(exp);
break;
case 'e':
val = parseFloat(args[i]).toExponential(exp);
break;
case 'x':
val = parseInt(args[i]).toString(base ? base : 16);
break;
case 'd':
val = parseFloat(parseInt(args[i], base ? base : 10).toPrecision(exp)).toFixed(0);
break;
}
val = typeof val === 'object' ? JSON.stringify(val) : (+val).toString(base);
var size = parseInt(p1); /* padding size */
var ch = p1 && (p1[0] + '') === '0' ? '0' : ' '; /* isnull? */
while (val.length < size)
val = p0 !== undefined ? val + ch : ch + val; /* isminus? */
return val;
}
var regex = /%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;
return append.replace(regex, callback);
};
/**
*
*/
StringUtils.getBytes = function (str, encoding) {
return StringEncoding_1.default.encode(str, encoding);
};
/**
* Returns the charcode at the specified index or at index zero.
*/
StringUtils.getCharCode = function (str, index) {
if (index === void 0) { index = 0; }
return str.charCodeAt(index);
};
StringUtils.SHIFT_JIS = CharacterSetECI_1.default.SJIS.getName(); // "SJIS"

@@ -205,0 +272,0 @@ StringUtils.GB2312 = 'GB2312';

@@ -0,0 +0,0 @@ import Reader from '../Reader';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import BitMatrix from '../../common/BitMatrix';

@@ -0,0 +0,0 @@ import Version from './Version';

"use strict";
var __values = (this && this.__values) || function (o) {
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
if (m) return m.call(o);
return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -42,2 +52,3 @@ var IllegalArgumentException_1 = require("../../IllegalArgumentException");

DataBlock.getDataBlocks = function (rawCodewords, version) {
var e_1, _a, e_2, _b;
// Figure out the number and size of data blocks used by this version

@@ -48,17 +59,35 @@ var ecBlocks = version.getECBlocks();

var ecBlockArray = ecBlocks.getECBlocks();
for (var _i = 0, ecBlockArray_1 = ecBlockArray; _i < ecBlockArray_1.length; _i++) {
var ecBlock = ecBlockArray_1[_i];
totalBlocks += ecBlock.getCount();
try {
for (var ecBlockArray_1 = __values(ecBlockArray), ecBlockArray_1_1 = ecBlockArray_1.next(); !ecBlockArray_1_1.done; ecBlockArray_1_1 = ecBlockArray_1.next()) {
var ecBlock = ecBlockArray_1_1.value;
totalBlocks += ecBlock.getCount();
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (ecBlockArray_1_1 && !ecBlockArray_1_1.done && (_a = ecBlockArray_1.return)) _a.call(ecBlockArray_1);
}
finally { if (e_1) throw e_1.error; }
}
// Now establish DataBlocks of the appropriate size and number of data codewords
var result = new Array(totalBlocks);
var numResultBlocks = 0;
for (var _a = 0, ecBlockArray_2 = ecBlockArray; _a < ecBlockArray_2.length; _a++) {
var ecBlock = ecBlockArray_2[_a];
for (var i = 0; i < ecBlock.getCount(); i++) {
var numDataCodewords = ecBlock.getDataCodewords();
var numBlockCodewords = ecBlocks.getECCodewords() + numDataCodewords;
result[numResultBlocks++] = new DataBlock(numDataCodewords, new Uint8Array(numBlockCodewords));
try {
for (var ecBlockArray_2 = __values(ecBlockArray), ecBlockArray_2_1 = ecBlockArray_2.next(); !ecBlockArray_2_1.done; ecBlockArray_2_1 = ecBlockArray_2.next()) {
var ecBlock = ecBlockArray_2_1.value;
for (var i = 0; i < ecBlock.getCount(); i++) {
var numDataCodewords = ecBlock.getDataCodewords();
var numBlockCodewords = ecBlocks.getECCodewords() + numDataCodewords;
result[numResultBlocks++] = new DataBlock(numDataCodewords, new Uint8Array(numBlockCodewords));
}
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (ecBlockArray_2_1 && !ecBlockArray_2_1.done && (_b = ecBlockArray_2.return)) _b.call(ecBlockArray_2);
}
finally { if (e_2) throw e_2.error; }
}
// All blocks have the same amount of data, except that the last n

@@ -65,0 +94,0 @@ // (where n may be 0) have 1 less byte. Figure out where these start.

@@ -0,0 +0,0 @@ import DecoderResult from '../../common/DecoderResult';

@@ -7,3 +7,3 @@ "use strict";

var StringEncoding_1 = require("../../util/StringEncoding");
var __1 = require("../../..");
var StringUtils_1 = require("../../common/StringUtils");
var FormatException_1 = require("../../FormatException");

@@ -468,3 +468,3 @@ var IllegalStateException_1 = require("../../IllegalStateException");

try {
result.append(StringEncoding_1.default.decode(bytes, __1.StringUtils.ISO88591));
result.append(StringEncoding_1.default.decode(bytes, StringUtils_1.default.ISO88591));
}

@@ -471,0 +471,0 @@ catch (uee) {

@@ -0,0 +0,0 @@ import DecoderResult from '../../common/DecoderResult';

"use strict";
var __values = (this && this.__values) || function (o) {
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
if (m) return m.call(o);
return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -44,2 +54,3 @@ var ReedSolomonDecoder_1 = require("../../common/reedsolomon/ReedSolomonDecoder");

Decoder.prototype.decode = function (bits) {
var e_1, _a;
// Construct a parser and read version, error-correction level

@@ -54,6 +65,15 @@ var parser = new BitMatrixParser_1.default(bits);

var totalBytes = 0;
for (var _i = 0, dataBlocks_1 = dataBlocks; _i < dataBlocks_1.length; _i++) {
var db = dataBlocks_1[_i];
totalBytes += db.getNumDataCodewords();
try {
for (var dataBlocks_1 = __values(dataBlocks), dataBlocks_1_1 = dataBlocks_1.next(); !dataBlocks_1_1.done; dataBlocks_1_1 = dataBlocks_1.next()) {
var db = dataBlocks_1_1.value;
totalBytes += db.getNumDataCodewords();
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (dataBlocks_1_1 && !dataBlocks_1_1.done && (_a = dataBlocks_1.return)) _a.call(dataBlocks_1);
}
finally { if (e_1) throw e_1.error; }
}
var resultBytes = new Uint8Array(totalBytes);

@@ -60,0 +80,0 @@ var dataBlocksCount = dataBlocks.length;

"use strict";
var __values = (this && this.__values) || function (o) {
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
if (m) return m.call(o);
return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -67,2 +77,3 @@ var FormatException_1 = require("../../FormatException");

function Version(versionNumber, symbolSizeRows, symbolSizeColumns, dataRegionSizeRows, dataRegionSizeColumns, ecBlocks) {
var e_1, _a;
this.versionNumber = versionNumber;

@@ -78,6 +89,15 @@ this.symbolSizeRows = symbolSizeRows;

var ecbArray = ecBlocks.getECBlocks();
for (var _i = 0, ecbArray_1 = ecbArray; _i < ecbArray_1.length; _i++) {
var ecBlock = ecbArray_1[_i];
total += ecBlock.getCount() * (ecBlock.getDataCodewords() + ecCodewords);
try {
for (var ecbArray_1 = __values(ecbArray), ecbArray_1_1 = ecbArray_1.next(); !ecbArray_1_1.done; ecbArray_1_1 = ecbArray_1.next()) {
var ecBlock = ecbArray_1_1.value;
total += ecBlock.getCount() * (ecBlock.getDataCodewords() + ecCodewords);
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (ecbArray_1_1 && !ecbArray_1_1.done && (_a = ecbArray_1.return)) _a.call(ecbArray_1);
}
finally { if (e_1) throw e_1.error; }
}
this.totalCodewords = total;

@@ -115,11 +135,21 @@ }

Version.getVersionForDimensions = function (numRows, numColumns) {
var e_2, _a;
if ((numRows & 0x01) !== 0 || (numColumns & 0x01) !== 0) {
throw new FormatException_1.default();
}
for (var _i = 0, _a = Version.VERSIONS; _i < _a.length; _i++) {
var version = _a[_i];
if (version.symbolSizeRows === numRows && version.symbolSizeColumns === numColumns) {
return version;
try {
for (var _b = __values(Version.VERSIONS), _c = _b.next(); !_c.done; _c = _b.next()) {
var version = _c.value;
if (version.symbolSizeRows === numRows && version.symbolSizeColumns === numColumns) {
return version;
}
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_2) throw e_2.error; }
}
throw new FormatException_1.default();

@@ -126,0 +156,0 @@ };

@@ -0,0 +0,0 @@ import BitMatrix from '../../common/BitMatrix';

"use strict";
var __values = (this && this.__values) || function (o) {
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
if (m) return m.call(o);
return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
};
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -42,2 +68,3 @@ var ResultPoint_1 = require("../../ResultPoint");

Detector.prototype.detect = function () {
var e_1, _a;
var cornerPoints = this.rectangleDetector.detect();

@@ -71,17 +98,26 @@ var pointA = cornerPoints[0];

var maybeBottomRight = null;
for (var _i = 0, _a = Array.from(pointCount.entries()); _i < _a.length; _i++) {
var _b = _a[_i], point = _b[0], value = _b[1];
if (value === 2) {
bottomLeft = point; // this is definitely the bottom left, then -- end of two L sides
}
else {
// Otherwise it's either top left or bottom right -- just assign the two arbitrarily now
if (maybeTopLeft == null) {
maybeTopLeft = point;
try {
for (var _b = __values(Array.from(pointCount.entries())), _c = _b.next(); !_c.done; _c = _b.next()) {
var _d = __read(_c.value, 2), point = _d[0], value = _d[1];
if (value === 2) {
bottomLeft = point; // this is definitely the bottom left, then -- end of two L sides
}
else {
maybeBottomRight = point;
// Otherwise it's either top left or bottom right -- just assign the two arbitrarily now
if (maybeTopLeft == null) {
maybeTopLeft = point;
}
else {
maybeBottomRight = point;
}
}
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_1) throw e_1.error; }
}
if (maybeTopLeft == null || bottomLeft == null || maybeBottomRight == null) {

@@ -88,0 +124,0 @@ throw new NotFoundException_1.default();

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { CustomError } from 'ts-custom-error';

@@ -0,0 +0,0 @@ "use strict";

@@ -6,2 +6,3 @@ import Exception from './Exception';

export default class FormatException extends Exception {
static getFormatInstance(): FormatException;
}

@@ -25,2 +25,5 @@ "use strict";

}
FormatException.getFormatInstance = function () {
return new FormatException();
};
return FormatException;

@@ -27,0 +30,0 @@ }(Exception_1.default));

@@ -0,0 +0,0 @@ import Exception from './Exception';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import Exception from './Exception';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import LuminanceSource from './LuminanceSource';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import DecodeHintType from './DecodeHintType';

@@ -17,2 +17,12 @@ "use strict";

*/
var __values = (this && this.__values) || function (o) {
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
if (m) return m.call(o);
return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -25,2 +35,3 @@ var DecodeHintType_1 = require("./DecodeHintType");

var NotFoundException_1 = require("./NotFoundException");
var PDF417Reader_1 = require("./pdf417/PDF417Reader");
var ReaderException_1 = require("./ReaderException");

@@ -125,5 +136,5 @@ /*namespace com.google.zxing {*/

// }
// if (formats.includes(BarcodeFormat.PDF_417)) {
// readers.push(new PDF417Reader())
// }
if (formats.includes(BarcodeFormat_1.default.PDF_417)) {
readers.push(new PDF417Reader_1.default());
}
// if (formats.includes(BarcodeFormat.MAXICODE)) {

@@ -144,3 +155,3 @@ // readers.push(new MaxiCodeReader())

// readers.push(new AztecReader())
// readers.push(new PDF417Reader())
readers.push(new PDF417Reader_1.default());
// readers.push(new MaxiCodeReader())

@@ -155,7 +166,17 @@ if (tryHarder) {

MultiFormatReader.prototype.reset = function () {
var e_1, _a;
if (this.readers !== null) {
for (var _i = 0, _a = this.readers; _i < _a.length; _i++) {
var reader = _a[_i];
reader.reset();
try {
for (var _b = __values(this.readers), _c = _b.next(); !_c.done; _c = _b.next()) {
var reader = _c.value;
reader.reset();
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_1) throw e_1.error; }
}
}

@@ -167,18 +188,28 @@ };

MultiFormatReader.prototype.decodeInternal = function (image) {
var e_2, _a;
if (this.readers === null) {
throw new ReaderException_1.default('No readers where selected, nothing can be read.');
}
for (var _i = 0, _a = this.readers; _i < _a.length; _i++) {
var reader = _a[_i];
// Trying to decode with ${reader} reader.
try {
return reader.decode(image, this.hints);
}
catch (ex) {
if (ex instanceof ReaderException_1.default) {
continue;
try {
for (var _b = __values(this.readers), _c = _b.next(); !_c.done; _c = _b.next()) {
var reader = _c.value;
// Trying to decode with ${reader} reader.
try {
return reader.decode(image, this.hints);
}
// Bad Exception.
catch (ex) {
if (ex instanceof ReaderException_1.default) {
continue;
}
// Bad Exception.
}
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_2) throw e_2.error; }
}
throw new NotFoundException_1.default('No MultiFormat Readers were able to detect the code.');

@@ -185,0 +216,0 @@ };

@@ -0,0 +0,0 @@ import BitMatrix from './common/BitMatrix';

@@ -0,0 +0,0 @@ "use strict";

@@ -6,2 +6,3 @@ import Exception from './Exception';

export default class NotFoundException extends Exception {
static getNotFoundInstance(): NotFoundException;
}

@@ -25,2 +25,5 @@ "use strict";

}
NotFoundException.getNotFoundInstance = function () {
return new NotFoundException();
};
return NotFoundException;

@@ -27,0 +30,0 @@ }(Exception_1.default));

@@ -0,0 +0,0 @@ import BitArray from '../common/BitArray';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import BitArray from '../common/BitArray';

@@ -30,2 +30,12 @@ "use strict";

})();
var __values = (this && this.__values) || function (o) {
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
if (m) return m.call(o);
return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -86,2 +96,3 @@ /*namespace com.google.zxing.oned {*/

Code39Reader.prototype.decodeRow = function (rowNumber, row, hints) {
var e_1, _a, e_2, _b;
var theCounters = this.counters;

@@ -105,6 +116,15 @@ theCounters.fill(0);

lastStart = nextStart;
for (var _i = 0, theCounters_1 = theCounters; _i < theCounters_1.length; _i++) {
var counter = theCounters_1[_i];
nextStart += counter;
try {
for (var theCounters_1 = __values(theCounters), theCounters_1_1 = theCounters_1.next(); !theCounters_1_1.done; theCounters_1_1 = theCounters_1.next()) {
var counter = theCounters_1_1.value;
nextStart += counter;
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (theCounters_1_1 && !theCounters_1_1.done && (_a = theCounters_1.return)) _a.call(theCounters_1);
}
finally { if (e_1) throw e_1.error; }
}
// Read off white space

@@ -116,6 +136,15 @@ nextStart = row.getNextSet(nextStart);

var lastPatternSize = 0;
for (var _a = 0, theCounters_2 = theCounters; _a < theCounters_2.length; _a++) {
var counter = theCounters_2[_a];
lastPatternSize += counter;
try {
for (var theCounters_2 = __values(theCounters), theCounters_2_1 = theCounters_2.next(); !theCounters_2_1.done; theCounters_2_1 = theCounters_2.next()) {
var counter = theCounters_2_1.value;
lastPatternSize += counter;
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (theCounters_2_1 && !theCounters_2_1.done && (_b = theCounters_2.return)) _b.call(theCounters_2);
}
finally { if (e_2) throw e_2.error; }
}
var whiteSpaceAfterEnd = nextStart - lastStart - lastPatternSize;

@@ -189,2 +218,3 @@ // If 50% of last pattern size, following last pattern, is not whitespace, fail

Code39Reader.toNarrowWidePattern = function (counters) {
var e_3, _a;
var numCounters = counters.length;

@@ -195,8 +225,17 @@ var maxNarrowCounter = 0;

var minCounter = 0x7fffffff;
for (var _i = 0, counters_1 = counters; _i < counters_1.length; _i++) {
var counter = counters_1[_i];
if (counter < minCounter && counter > maxNarrowCounter) {
minCounter = counter;
try {
for (var counters_1 = __values(counters), counters_1_1 = counters_1.next(); !counters_1_1.done; counters_1_1 = counters_1.next()) {
var counter = counters_1_1.value;
if (counter < minCounter && counter > maxNarrowCounter) {
minCounter = counter;
}
}
}
catch (e_3_1) { e_3 = { error: e_3_1 }; }
finally {
try {
if (counters_1_1 && !counters_1_1.done && (_a = counters_1.return)) _a.call(counters_1);
}
finally { if (e_3) throw e_3.error; }
}
maxNarrowCounter = minCounter;

@@ -203,0 +242,0 @@ wideCounters = 0;

@@ -0,0 +0,0 @@ import BarcodeFormat from '../BarcodeFormat';

@@ -30,2 +30,12 @@ "use strict";

})();
var __values = (this && this.__values) || function (o) {
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
if (m) return m.call(o);
return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -50,2 +60,3 @@ var BarcodeFormat_1 = require("../BarcodeFormat");

EAN13Reader.prototype.decodeMiddle = function (row, startRange, resultString) {
var e_1, _a, e_2, _b;
var counters = this.decodeMiddleCounters;

@@ -62,6 +73,15 @@ counters[0] = 0;

resultString += String.fromCharCode(('0'.charCodeAt(0) + bestMatch % 10));
for (var _i = 0, counters_1 = counters; _i < counters_1.length; _i++) {
var counter = counters_1[_i];
rowOffset += counter;
try {
for (var counters_1 = __values(counters), counters_1_1 = counters_1.next(); !counters_1_1.done; counters_1_1 = counters_1.next()) {
var counter = counters_1_1.value;
rowOffset += counter;
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (counters_1_1 && !counters_1_1.done && (_a = counters_1.return)) _a.call(counters_1);
}
finally { if (e_1) throw e_1.error; }
}
if (bestMatch >= 10) {

@@ -77,6 +97,15 @@ lgPatternFound |= 1 << (5 - x);

resultString += String.fromCharCode(('0'.charCodeAt(0) + bestMatch));
for (var _a = 0, counters_2 = counters; _a < counters_2.length; _a++) {
var counter = counters_2[_a];
rowOffset += counter;
try {
for (var counters_2 = __values(counters), counters_2_1 = counters_2.next(); !counters_2_1.done; counters_2_1 = counters_2.next()) {
var counter = counters_2_1.value;
rowOffset += counter;
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (counters_2_1 && !counters_2_1.done && (_b = counters_2.return)) _b.call(counters_2);
}
finally { if (e_2) throw e_2.error; }
}
}

@@ -83,0 +112,0 @@ return { rowOffset: rowOffset, resultString: resultString };

@@ -0,0 +0,0 @@ import BarcodeFormat from '../BarcodeFormat';

@@ -30,2 +30,12 @@ "use strict";

})();
var __values = (this && this.__values) || function (o) {
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
if (m) return m.call(o);
return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -47,2 +57,3 @@ var BarcodeFormat_1 = require("../BarcodeFormat");

EAN8Reader.prototype.decodeMiddle = function (row, startRange, resultString) {
var e_1, _a, e_2, _b;
var counters = this.decodeMiddleCounters;

@@ -58,6 +69,15 @@ counters[0] = 0;

resultString += String.fromCharCode(('0'.charCodeAt(0) + bestMatch));
for (var _i = 0, counters_1 = counters; _i < counters_1.length; _i++) {
var counter = counters_1[_i];
rowOffset += counter;
try {
for (var counters_1 = __values(counters), counters_1_1 = counters_1.next(); !counters_1_1.done; counters_1_1 = counters_1.next()) {
var counter = counters_1_1.value;
rowOffset += counter;
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (counters_1_1 && !counters_1_1.done && (_a = counters_1.return)) _a.call(counters_1);
}
finally { if (e_1) throw e_1.error; }
}
}

@@ -69,6 +89,15 @@ var middleRange = UPCEANReader_1.default.findGuardPattern(row, rowOffset, true, UPCEANReader_1.default.MIDDLE_PATTERN, new Array(UPCEANReader_1.default.MIDDLE_PATTERN.length).fill(0));

resultString += String.fromCharCode(('0'.charCodeAt(0) + bestMatch));
for (var _a = 0, counters_2 = counters; _a < counters_2.length; _a++) {
var counter = counters_2[_a];
rowOffset += counter;
try {
for (var counters_2 = __values(counters), counters_2_1 = counters_2.next(); !counters_2_1.done; counters_2_1 = counters_2.next()) {
var counter = counters_2_1.value;
rowOffset += counter;
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (counters_2_1 && !counters_2_1.done && (_b = counters_2.return)) _b.call(counters_2);
}
finally { if (e_2) throw e_2.error; }
}
}

@@ -75,0 +104,0 @@ return { rowOffset: rowOffset, resultString: resultString };

@@ -0,0 +0,0 @@ import BitArray from '../common/BitArray';

@@ -30,2 +30,12 @@ "use strict";

})();
var __values = (this && this.__values) || function (o) {
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
if (m) return m.call(o);
return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -63,2 +73,3 @@ /*namespace com.google.zxing.oned {*/

ITFReader.prototype.decodeRow = function (rowNumber, row, hints) {
var e_1, _a;
// Find out where the Middle section (payload) starts & ends

@@ -82,11 +93,20 @@ var startRange = this.decodeStart(row);

var maxAllowedLength = 0;
for (var _i = 0, allowedLengths_1 = allowedLengths; _i < allowedLengths_1.length; _i++) {
var value = allowedLengths_1[_i];
if (length === value) {
lengthOK = true;
break;
try {
for (var allowedLengths_1 = __values(allowedLengths), allowedLengths_1_1 = allowedLengths_1.next(); !allowedLengths_1_1.done; allowedLengths_1_1 = allowedLengths_1.next()) {
var value = allowedLengths_1_1.value;
if (length === value) {
lengthOK = true;
break;
}
if (value > maxAllowedLength) {
maxAllowedLength = value;
}
}
if (value > maxAllowedLength) {
maxAllowedLength = value;
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (allowedLengths_1_1 && !allowedLengths_1_1.done && (_a = allowedLengths_1.return)) _a.call(allowedLengths_1);
}
finally { if (e_1) throw e_1.error; }
}

@@ -93,0 +113,0 @@ if (!lengthOK && length > maxAllowedLength) {

@@ -0,0 +0,0 @@ import BitArray from '../common/BitArray';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import BitArray from '../common/BitArray';

@@ -30,2 +30,12 @@ "use strict";

})();
var __values = (this && this.__values) || function (o) {
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
if (m) return m.call(o);
return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -69,11 +79,21 @@ var BarcodeFormat_1 = require("../BarcodeFormat");

MultiFormatUPCEANReader.prototype.decodeRow = function (rowNumber, row, hints) {
for (var _i = 0, _a = this.readers; _i < _a.length; _i++) {
var reader = _a[_i];
var e_1, _a;
try {
for (var _b = __values(this.readers), _c = _b.next(); !_c.done; _c = _b.next()) {
var reader = _c.value;
try {
return reader.decodeRow(rowNumber, row, hints);
// TODO ean13MayBeUPCA
}
catch (err) {
// continue;
}
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
return reader.decodeRow(rowNumber, row, hints);
// TODO ean13MayBeUPCA
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
catch (err) {
// continue;
}
finally { if (e_1) throw e_1.error; }
}

@@ -83,6 +103,16 @@ throw new NotFoundException_1.default();

MultiFormatUPCEANReader.prototype.reset = function () {
for (var _i = 0, _a = this.readers; _i < _a.length; _i++) {
var reader = _a[_i];
reader.reset();
var e_2, _a;
try {
for (var _b = __values(this.readers), _c = _b.next(); !_c.done; _c = _b.next()) {
var reader = _c.value;
reader.reset();
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_2) throw e_2.error; }
}
};

@@ -89,0 +119,0 @@ return MultiFormatUPCEANReader;

@@ -0,0 +0,0 @@ import BinaryBitmap from '../BinaryBitmap';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import OneDReader from '../OneDReader';

@@ -15,2 +15,12 @@ "use strict";

})();
var __values = (this && this.__values) || function (o) {
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
if (m) return m.call(o);
return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -89,2 +99,3 @@ var OneDReader_1 = require("../OneDReader");

AbstractRSSReader.isFinderPattern = function (counters) {
var e_1, _a;
var firstTwoSum = counters[0] + counters[1];

@@ -97,10 +108,19 @@ var sum = firstTwoSum + counters[2] + counters[3];

var maxCounter = Number.MIN_SAFE_INTEGER;
for (var _i = 0, counters_1 = counters; _i < counters_1.length; _i++) {
var counter = counters_1[_i];
if (counter > maxCounter) {
maxCounter = counter;
try {
for (var counters_1 = __values(counters), counters_1_1 = counters_1.next(); !counters_1_1.done; counters_1_1 = counters_1.next()) {
var counter = counters_1_1.value;
if (counter > maxCounter) {
maxCounter = counter;
}
if (counter < minCounter) {
minCounter = counter;
}
}
if (counter < minCounter) {
minCounter = counter;
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (counters_1_1 && !counters_1_1.done && (_a = counters_1.return)) _a.call(counters_1);
}
finally { if (e_1) throw e_1.error; }
}

@@ -107,0 +127,0 @@ return maxCounter < 10 * minCounter;

@@ -0,0 +0,0 @@ export default class DataCharacter {

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import ResultPoint from '../../ResultPoint';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import DataCharacter from './DataCharacter';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import AbstractRSSReader from './AbstractRSSReader';

@@ -15,2 +15,12 @@ "use strict";

})();
var __values = (this && this.__values) || function (o) {
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
if (m) return m.call(o);
return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -40,2 +50,3 @@ var AbstractRSSReader_1 = require("./AbstractRSSReader");

RSS14Reader.prototype.decodeRow = function (rowNumber, row, hints) {
var e_1, _a, e_2, _b;
var leftPair = this.decodePair(row, false, rowNumber, hints);

@@ -47,16 +58,35 @@ RSS14Reader.addOrTally(this.possibleLeftPairs, leftPair);

row.reverse();
for (var _i = 0, _a = this.possibleLeftPairs; _i < _a.length; _i++) {
var left = _a[_i];
if (left.getCount() > 1) {
for (var _b = 0, _c = this.possibleRightPairs; _b < _c.length; _b++) {
var right = _c[_b];
if (right.getCount() > 1 && RSS14Reader.checkChecksum(left, right)) {
return RSS14Reader.constructResult(left, right);
try {
for (var _c = __values(this.possibleLeftPairs), _d = _c.next(); !_d.done; _d = _c.next()) {
var left = _d.value;
if (left.getCount() > 1) {
try {
for (var _e = __values(this.possibleRightPairs), _f = _e.next(); !_f.done; _f = _e.next()) {
var right = _f.value;
if (right.getCount() > 1 && RSS14Reader.checkChecksum(left, right)) {
return RSS14Reader.constructResult(left, right);
}
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
}
finally { if (e_2) throw e_2.error; }
}
}
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
}
finally { if (e_1) throw e_1.error; }
}
throw new NotFoundException_1.default();
};
RSS14Reader.addOrTally = function (possiblePairs, pair) {
var e_3, _a;
if (pair == null) {

@@ -66,10 +96,19 @@ return;

var found = false;
for (var _i = 0, possiblePairs_1 = possiblePairs; _i < possiblePairs_1.length; _i++) {
var other = possiblePairs_1[_i];
if (other.getValue() === pair.getValue()) {
other.incrementCount();
found = true;
break;
try {
for (var possiblePairs_1 = __values(possiblePairs), possiblePairs_1_1 = possiblePairs_1.next(); !possiblePairs_1_1.done; possiblePairs_1_1 = possiblePairs_1.next()) {
var other = possiblePairs_1_1.value;
if (other.getValue() === pair.getValue()) {
other.incrementCount();
found = true;
break;
}
}
}
catch (e_3_1) { e_3 = { error: e_3_1 }; }
finally {
try {
if (possiblePairs_1_1 && !possiblePairs_1_1.done && (_a = possiblePairs_1.return)) _a.call(possiblePairs_1);
}
finally { if (e_3) throw e_3.error; }
}
if (!found) {

@@ -76,0 +115,0 @@ possiblePairs.push(pair);

"use strict";
var __values = (this && this.__values) || function (o) {
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
if (m) return m.call(o);
return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -11,7 +21,17 @@ /**

RSSUtils.getRSSvalue = function (widths, maxWidth, noNarrow) {
var e_1, _a;
var n = 0;
for (var _i = 0, widths_1 = widths; _i < widths_1.length; _i++) {
var width = widths_1[_i];
n += width;
try {
for (var widths_1 = __values(widths), widths_1_1 = widths_1.next(); !widths_1_1.done; widths_1_1 = widths_1.next()) {
var width = widths_1_1.value;
n += width;
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (widths_1_1 && !widths_1_1.done && (_a = widths_1.return)) _a.call(widths_1);
}
finally { if (e_1) throw e_1.error; }
}
var val = 0;

@@ -18,0 +38,0 @@ var narrowMask = 0;

@@ -0,0 +0,0 @@ import BitArray from '../common/BitArray';

@@ -17,5 +17,15 @@ "use strict";

*/
var __values = (this && this.__values) || function (o) {
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
if (m) return m.call(o);
return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
};
Object.defineProperty(exports, "__esModule", { value: true });
var BarcodeFormat_1 = require("../BarcodeFormat");
var UPCEANReader_1 = require("./UPCEANReader");
var AbstractUPCEANReader_1 = require("./AbstractUPCEANReader");
var Result_1 = require("../Result");

@@ -49,2 +59,3 @@ var ResultPoint_1 = require("../ResultPoint");

UPCEANExtension2Support.prototype.decodeMiddle = function (row, startRange, resultString) {
var e_1, _a;
var counters = this.decodeMiddleCounters;

@@ -59,8 +70,17 @@ counters[0] = 0;

for (var x = 0; x < 2 && rowOffset < end; x++) {
var bestMatch = UPCEANReader_1.default.decodeDigit(row, counters, rowOffset, UPCEANReader_1.default.L_AND_G_PATTERNS);
var bestMatch = AbstractUPCEANReader_1.default.decodeDigit(row, counters, rowOffset, AbstractUPCEANReader_1.default.L_AND_G_PATTERNS);
resultString += String.fromCharCode(('0'.charCodeAt(0) + bestMatch % 10));
for (var _i = 0, counters_1 = counters; _i < counters_1.length; _i++) {
var counter = counters_1[_i];
rowOffset += counter;
try {
for (var counters_1 = __values(counters), counters_1_1 = counters_1.next(); !counters_1_1.done; counters_1_1 = counters_1.next()) {
var counter = counters_1_1.value;
rowOffset += counter;
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (counters_1_1 && !counters_1_1.done && (_a = counters_1.return)) _a.call(counters_1);
}
finally { if (e_1) throw e_1.error; }
}
if (bestMatch >= 10) {

@@ -67,0 +87,0 @@ checkParity |= 1 << (1 - x);

@@ -0,0 +0,0 @@ import BitArray from '../common/BitArray';

@@ -17,5 +17,16 @@ "use strict";

*/
var __values = (this && this.__values) || function (o) {
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
if (m) return m.call(o);
return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
};
Object.defineProperty(exports, "__esModule", { value: true });
var BarcodeFormat_1 = require("../BarcodeFormat");
var UPCEANReader_1 = require("./UPCEANReader");
// import UPCEANReader from './UPCEANReader';
var AbstractUPCEANReader_1 = require("./AbstractUPCEANReader");
var Result_1 = require("../Result");

@@ -50,2 +61,3 @@ var ResultPoint_1 = require("../ResultPoint");

UPCEANExtension5Support.prototype.decodeMiddle = function (row, startRange, resultString) {
var e_1, _a;
var counters = this.decodeMiddleCounters;

@@ -60,8 +72,17 @@ counters[0] = 0;

for (var x = 0; x < 5 && rowOffset < end; x++) {
var bestMatch = UPCEANReader_1.default.decodeDigit(row, counters, rowOffset, UPCEANReader_1.default.L_AND_G_PATTERNS);
var bestMatch = AbstractUPCEANReader_1.default.decodeDigit(row, counters, rowOffset, AbstractUPCEANReader_1.default.L_AND_G_PATTERNS);
resultString += String.fromCharCode(('0'.charCodeAt(0) + bestMatch % 10));
for (var _i = 0, counters_1 = counters; _i < counters_1.length; _i++) {
var counter = counters_1[_i];
rowOffset += counter;
try {
for (var counters_1 = __values(counters), counters_1_1 = counters_1.next(); !counters_1_1.done; counters_1_1 = counters_1.next()) {
var counter = counters_1_1.value;
rowOffset += counter;
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (counters_1_1 && !counters_1_1.done && (_a = counters_1.return)) _a.call(counters_1);
}
finally { if (e_1) throw e_1.error; }
}
if (bestMatch >= 10) {

@@ -68,0 +89,0 @@ lgPatternFound |= 1 << (4 - x);

@@ -0,0 +0,0 @@ import BitArray from '../common/BitArray';

@@ -18,3 +18,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
var UPCEANReader_1 = require("./UPCEANReader");
var AbstractUPCEANReader_1 = require("./AbstractUPCEANReader");
var UPCEANExtension5Support_1 = require("./UPCEANExtension5Support");

@@ -26,4 +26,5 @@ var UPCEANExtension2Support_1 = require("./UPCEANExtension2Support");

UPCEANExtensionSupport.decodeRow = function (rowNumber, row, rowOffset) {
var extensionStartRange = UPCEANReader_1.default.findGuardPattern(row, rowOffset, false, this.EXTENSION_START_PATTERN, new Array(this.EXTENSION_START_PATTERN.length).fill(0));
var extensionStartRange = AbstractUPCEANReader_1.default.findGuardPattern(row, rowOffset, false, this.EXTENSION_START_PATTERN, new Array(this.EXTENSION_START_PATTERN.length).fill(0));
try {
// return null;
var fiveSupport = new UPCEANExtension5Support_1.default();

@@ -33,2 +34,3 @@ return fiveSupport.decodeRow(rowNumber, row, extensionStartRange);

catch (err) {
// return null;
var twoSupport = new UPCEANExtension2Support_1.default();

@@ -35,0 +37,0 @@ return twoSupport.decodeRow(rowNumber, row, extensionStartRange);

import BitArray from '../common/BitArray';
import DecodeHintType from '../DecodeHintType';
import Result from '../Result';
import OneDReader from './OneDReader';
import AbstractUPCEANReader from './AbstractUPCEANReader';
/**

@@ -13,28 +13,4 @@ * <p>Encapsulates functionality and implementation that is common to UPC and EAN families

*/
export default abstract class UPCEANReader extends OneDReader {
private static MAX_AVG_VARIANCE;
private static MAX_INDIVIDUAL_VARIANCE;
/**
* Start/end guard pattern.
*/
static START_END_PATTERN: number[];
/**
* Pattern marking the middle of a UPC/EAN pattern, separating the two halves.
*/
static MIDDLE_PATTERN: number[];
/**
* end guard pattern.
*/
static END_PATTERN: number[];
/**
* "Odd", or "L" patterns used to encode UPC/EAN digits.
*/
static L_PATTERNS: number[][];
/**
* As above but also including the "even", or "G" patterns used to encode UPC/EAN digits.
*/
static L_AND_G_PATTERNS: number[][];
private decodeRowStringBuffer;
export default abstract class UPCEANReader extends AbstractUPCEANReader {
constructor();
static findStartGuardPattern(row: BitArray): number[];
decodeRow(rowNumber: number, row: BitArray, hints?: Map<DecodeHintType, any>): Result;

@@ -45,21 +21,2 @@ static checkChecksum(s: string): boolean;

static decodeEnd(row: BitArray, endStart: number): number[];
static findGuardPattern(row: BitArray, rowOffset: number, whiteFirst: boolean, pattern: number[], counters: number[]): number[];
static decodeDigit(row: BitArray, counters: number[], rowOffset: number, patterns: number[][]): number;
/**
* Get the format of this decoder.
*
* @return The 1D format.
*/
abstract getBarcodeFormat(): any;
/**
* Subclasses override this to decode the portion of a barcode between the start
* and end guard patterns.
*
* @param row row of black/white values to search
* @param startRange start/end offset of start guard pattern
* @param resultString {@link StringBuilder} to append decoded chars to
* @return horizontal offset of first pixel after the "middle" that was decoded
* @throws NotFoundException if decoding could not complete successfully
*/
abstract decodeMiddle(row: BitArray, startRange: number[], resultString: string): any;
}

@@ -36,4 +36,4 @@ "use strict";

var ResultPoint_1 = require("../ResultPoint");
var OneDReader_1 = require("./OneDReader");
var UPCEANExtensionSupport_1 = require("./UPCEANExtensionSupport");
var AbstractUPCEANReader_1 = require("./AbstractUPCEANReader");
var NotFoundException_1 = require("../NotFoundException");

@@ -52,8 +52,5 @@ var FormatException_1 = require("../FormatException");

__extends(UPCEANReader, _super);
// private final UPCEANExtensionSupport extensionReader;
// private final EANManufacturerOrgSupport eanManSupport;
function UPCEANReader() {
var _this = _super.call(this) || this;
_this.decodeRowStringBuffer = '';
_this.decodeRowStringBuffer = '';
UPCEANReader.L_AND_G_PATTERNS = UPCEANReader.L_PATTERNS.map(function (arr) {

@@ -72,26 +69,2 @@ return arr.slice();

}
/*
protected UPCEANReader() {
decodeRowStringBuffer = new StringBuilder(20);
extensionReader = new UPCEANExtensionSupport();
eanManSupport = new EANManufacturerOrgSupport();
}
*/
UPCEANReader.findStartGuardPattern = function (row) {
var foundStart = false;
var startRange = null;
var nextStart = 0;
var counters = [0, 0, 0];
while (!foundStart) {
counters = [0, 0, 0];
startRange = UPCEANReader.findGuardPattern(row, nextStart, false, this.START_END_PATTERN, counters);
var start = startRange[0];
nextStart = startRange[1];
var quietStart = start - (nextStart - start);
if (quietStart >= 0) {
foundStart = row.isRange(quietStart, start, false);
}
}
return startRange;
};
UPCEANReader.prototype.decodeRow = function (rowNumber, row, hints) {

@@ -200,91 +173,5 @@ var startGuardRange = UPCEANReader.findStartGuardPattern(row);

};
UPCEANReader.findGuardPattern = function (row, rowOffset, whiteFirst, pattern, counters) {
var width = row.getSize();
rowOffset = whiteFirst ? row.getNextUnset(rowOffset) : row.getNextSet(rowOffset);
var counterPosition = 0;
var patternStart = rowOffset;
var patternLength = pattern.length;
var isWhite = whiteFirst;
for (var x = rowOffset; x < width; x++) {
if (row.get(x) !== isWhite) {
counters[counterPosition]++;
}
else {
if (counterPosition === patternLength - 1) {
if (OneDReader_1.default.patternMatchVariance(counters, pattern, UPCEANReader.MAX_INDIVIDUAL_VARIANCE) < UPCEANReader.MAX_AVG_VARIANCE) {
return [patternStart, x];
}
patternStart += counters[0] + counters[1];
var slice = counters.slice(2, counters.length);
for (var i = 0; i < counterPosition - 1; i++) {
counters[i] = slice[i];
}
counters[counterPosition - 1] = 0;
counters[counterPosition] = 0;
counterPosition--;
}
else {
counterPosition++;
}
counters[counterPosition] = 1;
isWhite = !isWhite;
}
}
throw new NotFoundException_1.default();
};
UPCEANReader.decodeDigit = function (row, counters, rowOffset, patterns) {
this.recordPattern(row, rowOffset, counters);
var bestVariance = this.MAX_AVG_VARIANCE;
var bestMatch = -1;
var max = patterns.length;
for (var i = 0; i < max; i++) {
var pattern = patterns[i];
var variance = OneDReader_1.default.patternMatchVariance(counters, pattern, UPCEANReader.MAX_INDIVIDUAL_VARIANCE);
if (variance < bestVariance) {
bestVariance = variance;
bestMatch = i;
}
}
if (bestMatch >= 0) {
return bestMatch;
}
else {
throw new NotFoundException_1.default();
}
};
// These two values are critical for determining how permissive the decoding will be.
// We've arrived at these values through a lot of trial and error. Setting them any higher
// lets false positives creep in quickly.
UPCEANReader.MAX_AVG_VARIANCE = 0.48;
UPCEANReader.MAX_INDIVIDUAL_VARIANCE = 0.7;
/**
* Start/end guard pattern.
*/
UPCEANReader.START_END_PATTERN = [1, 1, 1];
/**
* Pattern marking the middle of a UPC/EAN pattern, separating the two halves.
*/
UPCEANReader.MIDDLE_PATTERN = [1, 1, 1, 1, 1];
/**
* end guard pattern.
*/
UPCEANReader.END_PATTERN = [1, 1, 1, 1, 1, 1];
/**
* "Odd", or "L" patterns used to encode UPC/EAN digits.
*/
UPCEANReader.L_PATTERNS = [
[3, 2, 1, 1],
[2, 2, 2, 1],
[2, 1, 2, 2],
[1, 4, 1, 1],
[1, 1, 3, 2],
[1, 2, 3, 1],
[1, 1, 1, 4],
[1, 3, 1, 2],
[1, 2, 1, 3],
[3, 1, 1, 2],
];
return UPCEANReader;
}(OneDReader_1.default));
}(AbstractUPCEANReader_1.default));
exports.default = UPCEANReader;
//# sourceMappingURL=UPCEANReader.js.map

@@ -0,0 +0,0 @@ import LuminanceSource from './LuminanceSource';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import BitMatrix from '../../common/BitMatrix';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import Version from './Version';

@@ -17,2 +17,12 @@ "use strict";

*/
var __values = (this && this.__values) || function (o) {
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
if (m) return m.call(o);
return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -44,2 +54,3 @@ var IllegalArgumentException_1 = require("../../IllegalArgumentException");

DataBlock.getDataBlocks = function (rawCodewords, version, ecLevel) {
var e_1, _a, e_2, _b;
if (rawCodewords.length !== version.getTotalCodewords()) {

@@ -54,17 +65,35 @@ throw new IllegalArgumentException_1.default();

var ecBlockArray = ecBlocks.getECBlocks();
for (var _i = 0, ecBlockArray_1 = ecBlockArray; _i < ecBlockArray_1.length; _i++) {
var ecBlock = ecBlockArray_1[_i];
totalBlocks += ecBlock.getCount();
try {
for (var ecBlockArray_1 = __values(ecBlockArray), ecBlockArray_1_1 = ecBlockArray_1.next(); !ecBlockArray_1_1.done; ecBlockArray_1_1 = ecBlockArray_1.next()) {
var ecBlock = ecBlockArray_1_1.value;
totalBlocks += ecBlock.getCount();
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (ecBlockArray_1_1 && !ecBlockArray_1_1.done && (_a = ecBlockArray_1.return)) _a.call(ecBlockArray_1);
}
finally { if (e_1) throw e_1.error; }
}
// Now establish DataBlocks of the appropriate size and number of data codewords
var result = new Array(totalBlocks);
var numResultBlocks = 0;
for (var _a = 0, ecBlockArray_2 = ecBlockArray; _a < ecBlockArray_2.length; _a++) {
var ecBlock = ecBlockArray_2[_a];
for (var i = 0; i < ecBlock.getCount(); i++) {
var numDataCodewords = ecBlock.getDataCodewords();
var numBlockCodewords = ecBlocks.getECCodewordsPerBlock() + numDataCodewords;
result[numResultBlocks++] = new DataBlock(numDataCodewords, new Uint8Array(numBlockCodewords));
try {
for (var ecBlockArray_2 = __values(ecBlockArray), ecBlockArray_2_1 = ecBlockArray_2.next(); !ecBlockArray_2_1.done; ecBlockArray_2_1 = ecBlockArray_2.next()) {
var ecBlock = ecBlockArray_2_1.value;
for (var i = 0; i < ecBlock.getCount(); i++) {
var numDataCodewords = ecBlock.getDataCodewords();
var numBlockCodewords = ecBlocks.getECCodewordsPerBlock() + numDataCodewords;
result[numResultBlocks++] = new DataBlock(numDataCodewords, new Uint8Array(numBlockCodewords));
}
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (ecBlockArray_2_1 && !ecBlockArray_2_1.done && (_b = ecBlockArray_2.return)) _b.call(ecBlockArray_2);
}
finally { if (e_2) throw e_2.error; }
}
// All blocks have the same amount of data, except that the last n

@@ -71,0 +100,0 @@ // (where n may be 0) have 1 more byte. Figure out where these start.

@@ -0,0 +0,0 @@ import BitMatrix from '../../common/BitMatrix';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import DecodeHintType from '../../DecodeHintType';

@@ -0,0 +0,0 @@ import DecodeHintType from '../../DecodeHintType';

@@ -17,2 +17,12 @@ "use strict";

*/
var __values = (this && this.__values) || function (o) {
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
if (m) return m.call(o);
return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -107,2 +117,3 @@ var BitMatrix_1 = require("../../common/BitMatrix");

Decoder.prototype.decodeBitMatrixParser = function (parser, hints) {
var e_1, _a, e_2, _b;
var version = parser.readVersion();

@@ -116,18 +127,36 @@ var ecLevel = parser.readFormatInformation().getErrorCorrectionLevel();

var totalBytes = 0;
for (var _i = 0, dataBlocks_1 = dataBlocks; _i < dataBlocks_1.length; _i++) {
var dataBlock = dataBlocks_1[_i];
totalBytes += dataBlock.getNumDataCodewords();
try {
for (var dataBlocks_1 = __values(dataBlocks), dataBlocks_1_1 = dataBlocks_1.next(); !dataBlocks_1_1.done; dataBlocks_1_1 = dataBlocks_1.next()) {
var dataBlock = dataBlocks_1_1.value;
totalBytes += dataBlock.getNumDataCodewords();
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (dataBlocks_1_1 && !dataBlocks_1_1.done && (_a = dataBlocks_1.return)) _a.call(dataBlocks_1);
}
finally { if (e_1) throw e_1.error; }
}
var resultBytes = new Uint8Array(totalBytes);
var resultOffset = 0;
// Error-correct and copy data blocks together into a stream of bytes
for (var _a = 0, dataBlocks_2 = dataBlocks; _a < dataBlocks_2.length; _a++) {
var dataBlock = dataBlocks_2[_a];
var codewordBytes = dataBlock.getCodewords();
var numDataCodewords = dataBlock.getNumDataCodewords();
this.correctErrors(codewordBytes, numDataCodewords);
for (var i = 0; i < numDataCodewords; i++) {
resultBytes[resultOffset++] = codewordBytes[i];
try {
// Error-correct and copy data blocks together into a stream of bytes
for (var dataBlocks_2 = __values(dataBlocks), dataBlocks_2_1 = dataBlocks_2.next(); !dataBlocks_2_1.done; dataBlocks_2_1 = dataBlocks_2.next()) {
var dataBlock = dataBlocks_2_1.value;
var codewordBytes = dataBlock.getCodewords();
var numDataCodewords = dataBlock.getNumDataCodewords();
this.correctErrors(codewordBytes, numDataCodewords);
for (var i = 0; i < numDataCodewords; i++) {
resultBytes[resultOffset++] = codewordBytes[i];
}
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (dataBlocks_2_1 && !dataBlocks_2_1.done && (_b = dataBlocks_2.return)) _b.call(dataBlocks_2);
}
finally { if (e_2) throw e_2.error; }
}
// Decode the contents of that stream of bytes

@@ -134,0 +163,0 @@ return DecodedBitStreamParser_1.default.decode(resultBytes, version, ecLevel, hints);

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import ECB from './ECB';

"use strict";
var __values = (this && this.__values) || function (o) {
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
if (m) return m.call(o);
return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -22,8 +32,18 @@ /**

ECBlocks.prototype.getNumBlocks = function () {
var e_1, _a;
var total = 0;
var ecBlocks = this.ecBlocks;
for (var _i = 0, ecBlocks_1 = ecBlocks; _i < ecBlocks_1.length; _i++) {
var ecBlock = ecBlocks_1[_i];
total += ecBlock.getCount();
try {
for (var ecBlocks_1 = __values(ecBlocks), ecBlocks_1_1 = ecBlocks_1.next(); !ecBlocks_1_1.done; ecBlocks_1_1 = ecBlocks_1.next()) {
var ecBlock = ecBlocks_1_1.value;
total += ecBlock.getCount();
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (ecBlocks_1_1 && !ecBlocks_1_1.done && (_a = ecBlocks_1.return)) _a.call(ecBlocks_1);
}
finally { if (e_1) throw e_1.error; }
}
return total;

@@ -30,0 +50,0 @@ };

@@ -0,0 +0,0 @@ export declare enum ErrorCorrectionLevelValues {

@@ -0,0 +0,0 @@ import ErrorCorrectionLevel from './ErrorCorrectionLevel';

@@ -17,2 +17,12 @@ "use strict";

*/
var __values = (this && this.__values) || function (o) {
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
if (m) return m.call(o);
return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -58,20 +68,15 @@ /*namespace com.google.zxing.qrcode.decoder {*/

FormatInformation.doDecodeFormatInformation = function (maskedFormatInfo1 /*int*/, maskedFormatInfo2 /*int*/) {
var e_1, _a;
// Find the int in FORMAT_INFO_DECODE_LOOKUP with fewest bits differing
var bestDifference = Number.MAX_SAFE_INTEGER;
var bestFormatInfo = 0;
for (var _i = 0, _a = FormatInformation.FORMAT_INFO_DECODE_LOOKUP; _i < _a.length; _i++) {
var decodeInfo = _a[_i];
var targetInfo = decodeInfo[0];
if (targetInfo === maskedFormatInfo1 || targetInfo === maskedFormatInfo2) {
// Found an exact match
return new FormatInformation(decodeInfo[1]);
}
var bitsDifference = FormatInformation.numBitsDiffering(maskedFormatInfo1, targetInfo);
if (bitsDifference < bestDifference) {
bestFormatInfo = decodeInfo[1];
bestDifference = bitsDifference;
}
if (maskedFormatInfo1 !== maskedFormatInfo2) {
// also try the other option
bitsDifference = FormatInformation.numBitsDiffering(maskedFormatInfo2, targetInfo);
try {
for (var _b = __values(FormatInformation.FORMAT_INFO_DECODE_LOOKUP), _c = _b.next(); !_c.done; _c = _b.next()) {
var decodeInfo = _c.value;
var targetInfo = decodeInfo[0];
if (targetInfo === maskedFormatInfo1 || targetInfo === maskedFormatInfo2) {
// Found an exact match
return new FormatInformation(decodeInfo[1]);
}
var bitsDifference = FormatInformation.numBitsDiffering(maskedFormatInfo1, targetInfo);
if (bitsDifference < bestDifference) {

@@ -81,4 +86,19 @@ bestFormatInfo = decodeInfo[1];

}
if (maskedFormatInfo1 !== maskedFormatInfo2) {
// also try the other option
bitsDifference = FormatInformation.numBitsDiffering(maskedFormatInfo2, targetInfo);
if (bitsDifference < bestDifference) {
bestFormatInfo = decodeInfo[1];
bestDifference = bitsDifference;
}
}
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_1) throw e_1.error; }
}
// Hamming distance of the 32 masked codes is 7, by construction, so <= 3 bits

@@ -85,0 +105,0 @@ // differing means we found a match

@@ -0,0 +0,0 @@ import Version from './Version';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import ResultPoint from '../../ResultPoint';

@@ -0,0 +0,0 @@ import BitMatrix from '../../common/BitMatrix';

@@ -17,2 +17,12 @@ "use strict";

*/
var __values = (this && this.__values) || function (o) {
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
if (m) return m.call(o);
return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -33,2 +43,3 @@ /*namespace com.google.zxing.qrcode.decoder {*/

function Version(versionNumber /*int*/, alignmentPatternCenters) {
var e_1, _a;
var ecBlocks = [];

@@ -44,6 +55,15 @@ for (var _i = 2; _i < arguments.length; _i++) {

var ecbArray = ecBlocks[0].getECBlocks();
for (var _a = 0, ecbArray_1 = ecbArray; _a < ecbArray_1.length; _a++) {
var ecBlock = ecbArray_1[_a];
total += ecBlock.getCount() * (ecBlock.getDataCodewords() + ecCodewords);
try {
for (var ecbArray_1 = __values(ecbArray), ecbArray_1_1 = ecbArray_1.next(); !ecbArray_1_1.done; ecbArray_1_1 = ecbArray_1.next()) {
var ecBlock = ecbArray_1_1.value;
total += ecBlock.getCount() * (ecBlock.getDataCodewords() + ecCodewords);
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (ecbArray_1_1 && !ecbArray_1_1.done && (_a = ecbArray_1.return)) _a.call(ecbArray_1);
}
finally { if (e_1) throw e_1.error; }
}
this.totalCodewords = total;

@@ -50,0 +70,0 @@ }

@@ -0,0 +0,0 @@ import ResultPoint from '../../ResultPoint';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import ResultPointCallback from '../../ResultPointCallback';

@@ -17,2 +17,12 @@ "use strict";

*/
var __values = (this && this.__values) || function (o) {
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
if (m) return m.call(o);
return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -228,2 +238,3 @@ var AlignmentPattern_1 = require("./AlignmentPattern");

AlignmentPatternFinder.prototype.handlePossibleCenter = function (stateCount, i /*int*/, j /*int*/) {
var e_1, _a;
var stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2];

@@ -234,9 +245,18 @@ var centerJ = AlignmentPatternFinder.centerFromEnd(stateCount, j);

var estimatedModuleSize = (stateCount[0] + stateCount[1] + stateCount[2]) / 3.0;
for (var _i = 0, _a = this.possibleCenters; _i < _a.length; _i++) {
var center = _a[_i];
// Look for about the same center and module size:
if (center.aboutEquals(estimatedModuleSize, centerI, centerJ)) {
return center.combineEstimate(centerI, centerJ, estimatedModuleSize);
try {
for (var _b = __values(this.possibleCenters), _c = _b.next(); !_c.done; _c = _b.next()) {
var center = _c.value;
// Look for about the same center and module size:
if (center.aboutEquals(estimatedModuleSize, centerI, centerJ)) {
return center.combineEstimate(centerI, centerJ, estimatedModuleSize);
}
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_1) throw e_1.error; }
}
// Hadn't found this before; save it

@@ -243,0 +263,0 @@ var point = new AlignmentPattern_1.default(centerJ, centerI, estimatedModuleSize);

@@ -0,0 +0,0 @@ import DecodeHintType from '../../DecodeHintType';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import ResultPoint from '../../ResultPoint';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import DecodeHintType from '../../DecodeHintType';

@@ -17,2 +17,12 @@ "use strict";

*/
var __values = (this && this.__values) || function (o) {
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
if (m) return m.call(o);
return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -483,2 +493,3 @@ /*namespace com.google.zxing.qrcode.detector {*/

FinderPatternFinder.prototype.findRowSkip = function () {
var e_1, _a;
var max = this.possibleCenters.length;

@@ -489,20 +500,29 @@ if (max <= 1) {

var firstConfirmedCenter = null;
for (var _i = 0, _a = this.possibleCenters; _i < _a.length; _i++) {
var center = _a[_i];
if (center.getCount() >= FinderPatternFinder.CENTER_QUORUM) {
if (firstConfirmedCenter == null) {
firstConfirmedCenter = center;
try {
for (var _b = __values(this.possibleCenters), _c = _b.next(); !_c.done; _c = _b.next()) {
var center = _c.value;
if (center.getCount() >= FinderPatternFinder.CENTER_QUORUM) {
if (firstConfirmedCenter == null) {
firstConfirmedCenter = center;
}
else {
// We have two confirmed centers
// How far down can we skip before resuming looking for the next
// pattern? In the worst case, only the difference between the
// difference in the x / y coordinates of the two centers.
// This is the case where you find top left last.
this.hasSkipped = true;
return /*(int) */ Math.floor((Math.abs(firstConfirmedCenter.getX() - center.getX()) -
Math.abs(firstConfirmedCenter.getY() - center.getY())) / 2);
}
}
else {
// We have two confirmed centers
// How far down can we skip before resuming looking for the next
// pattern? In the worst case, only the difference between the
// difference in the x / y coordinates of the two centers.
// This is the case where you find top left last.
this.hasSkipped = true;
return /*(int) */ Math.floor((Math.abs(firstConfirmedCenter.getX() - center.getX()) -
Math.abs(firstConfirmedCenter.getY() - center.getY())) / 2);
}
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_1) throw e_1.error; }
}
return 0;

@@ -516,12 +536,22 @@ };

FinderPatternFinder.prototype.haveMultiplyConfirmedCenters = function () {
var e_2, _a, e_3, _b;
var confirmedCount = 0;
var totalModuleSize = 0.0;
var max = this.possibleCenters.length;
for (var _i = 0, _a = this.possibleCenters; _i < _a.length; _i++) {
var pattern = _a[_i];
if (pattern.getCount() >= FinderPatternFinder.CENTER_QUORUM) {
confirmedCount++;
totalModuleSize += pattern.getEstimatedModuleSize();
try {
for (var _c = __values(this.possibleCenters), _d = _c.next(); !_d.done; _d = _c.next()) {
var pattern = _d.value;
if (pattern.getCount() >= FinderPatternFinder.CENTER_QUORUM) {
confirmedCount++;
totalModuleSize += pattern.getEstimatedModuleSize();
}
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
}
finally { if (e_2) throw e_2.error; }
}
if (confirmedCount < 3) {

@@ -536,6 +566,15 @@ return false;

var totalDeviation = 0.0;
for (var _b = 0, _c = this.possibleCenters; _b < _c.length; _b++) {
var pattern = _c[_b];
totalDeviation += Math.abs(pattern.getEstimatedModuleSize() - average);
try {
for (var _e = __values(this.possibleCenters), _f = _e.next(); !_f.done; _f = _e.next()) {
var pattern = _f.value;
totalDeviation += Math.abs(pattern.getEstimatedModuleSize() - average);
}
}
catch (e_3_1) { e_3 = { error: e_3_1 }; }
finally {
try {
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
}
finally { if (e_3) throw e_3.error; }
}
return totalDeviation <= 0.05 * totalModuleSize;

@@ -550,2 +589,3 @@ };

FinderPatternFinder.prototype.selectBestPatterns = function () {
var e_4, _a, e_5, _b;
var startSize = this.possibleCenters.length;

@@ -557,3 +597,3 @@ if (startSize < 3) {

var possibleCenters = this.possibleCenters;
var average; /*float*/
var average;
// Filter outlier possibilities whose module size is too different

@@ -564,8 +604,17 @@ if (startSize > 3) {

var square = 0.0;
for (var _i = 0, _a = this.possibleCenters; _i < _a.length; _i++) {
var center = _a[_i];
var size = center.getEstimatedModuleSize();
totalModuleSize += size;
square += size * size;
try {
for (var _c = __values(this.possibleCenters), _d = _c.next(); !_d.done; _d = _c.next()) {
var center = _d.value;
var size = center.getEstimatedModuleSize();
totalModuleSize += size;
square += size * size;
}
}
catch (e_4_1) { e_4 = { error: e_4_1 }; }
finally {
try {
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
}
finally { if (e_4) throw e_4.error; }
}
average = totalModuleSize / startSize;

@@ -595,6 +644,15 @@ var stdDev = Math.sqrt(square / startSize - average * average);

var totalModuleSize = 0.0;
for (var _b = 0, possibleCenters_1 = possibleCenters; _b < possibleCenters_1.length; _b++) {
var possibleCenter = possibleCenters_1[_b];
totalModuleSize += possibleCenter.getEstimatedModuleSize();
try {
for (var possibleCenters_1 = __values(possibleCenters), possibleCenters_1_1 = possibleCenters_1.next(); !possibleCenters_1_1.done; possibleCenters_1_1 = possibleCenters_1.next()) {
var possibleCenter = possibleCenters_1_1.value;
totalModuleSize += possibleCenter.getEstimatedModuleSize();
}
}
catch (e_5_1) { e_5 = { error: e_5_1 }; }
finally {
try {
if (possibleCenters_1_1 && !possibleCenters_1_1.done && (_b = possibleCenters_1.return)) _b.call(possibleCenters_1);
}
finally { if (e_5) throw e_5.error; }
}
average = totalModuleSize / possibleCenters.length;

@@ -601,0 +659,0 @@ possibleCenters.sort(

@@ -0,0 +0,0 @@ import FinderPattern from './FinderPattern';

@@ -0,0 +0,0 @@ export default class BlockPair {

@@ -0,0 +0,0 @@ "use strict";

@@ -17,2 +17,12 @@ "use strict";

*/
var __values = (this && this.__values) || function (o) {
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
if (m) return m.call(o);
return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -65,6 +75,16 @@ /*namespace com.google.zxing.qrcode.encoder {*/

ByteMatrix.prototype.clear = function (value /*byte*/) {
for (var _i = 0, _a = this.bytes; _i < _a.length; _i++) {
var aByte = _a[_i];
Arrays_1.default.fillUint8Array(aByte, value);
var e_1, _a;
try {
for (var _b = __values(this.bytes), _c = _b.next(); !_c.done; _c = _b.next()) {
var aByte = _c.value;
Arrays_1.default.fill(aByte, value);
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_1) throw e_1.error; }
}
};

@@ -71,0 +91,0 @@ ByteMatrix.prototype.equals = function (o) {

@@ -0,0 +0,0 @@ import EncodeHintType from '../../EncodeHintType';

@@ -17,2 +17,12 @@ "use strict";

*/
var __values = (this && this.__values) || function (o) {
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
if (m) return m.call(o);
return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -337,2 +347,3 @@ /*namespace com.google.zxing.qrcode.encoder {*/

Encoder.interleaveWithECBytes = function (bits, numTotalBytes /*int*/, numDataBytes /*int*/, numRSBlocks /*int*/) {
var e_1, _a, e_2, _b;
// "bits" must have "getNumDataBytes" bytes of data.

@@ -368,19 +379,37 @@ if (bits.getSizeInBytes() !== numDataBytes) {

for (var i = 0; i < maxNumDataBytes; ++i) {
for (var _i = 0, blocks_1 = blocks; _i < blocks_1.length; _i++) {
var block = blocks_1[_i];
var dataBytes = block.getDataBytes();
if (i < dataBytes.length) {
result.appendBits(dataBytes[i], 8);
try {
for (var blocks_1 = __values(blocks), blocks_1_1 = blocks_1.next(); !blocks_1_1.done; blocks_1_1 = blocks_1.next()) {
var block = blocks_1_1.value;
var dataBytes = block.getDataBytes();
if (i < dataBytes.length) {
result.appendBits(dataBytes[i], 8);
}
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (blocks_1_1 && !blocks_1_1.done && (_a = blocks_1.return)) _a.call(blocks_1);
}
finally { if (e_1) throw e_1.error; }
}
}
// Then, place error correction blocks.
for (var i = 0; i < maxNumEcBytes; ++i) {
for (var _a = 0, blocks_2 = blocks; _a < blocks_2.length; _a++) {
var block = blocks_2[_a];
var ecBytes = block.getErrorCorrectionBytes();
if (i < ecBytes.length) {
result.appendBits(ecBytes[i], 8);
try {
for (var blocks_2 = __values(blocks), blocks_2_1 = blocks_2.next(); !blocks_2_1.done; blocks_2_1 = blocks_2.next()) {
var block = blocks_2_1.value;
var ecBytes = block.getErrorCorrectionBytes();
if (i < ecBytes.length) {
result.appendBits(ecBytes[i], 8);
}
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (blocks_2_1 && !blocks_2_1.done && (_b = blocks_2.return)) _b.call(blocks_2);
}
finally { if (e_2) throw e_2.error; }
}
}

@@ -387,0 +416,0 @@ if (numTotalBytes !== result.getSizeInBytes()) { // Should be same.

@@ -0,0 +0,0 @@ import ByteMatrix from './ByteMatrix';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import BitArray from '../../common/BitArray';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import ErrorCorrectionLevel from '../decoder/ErrorCorrectionLevel';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import BinaryBitmap from '../BinaryBitmap';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import BarcodeFormat from '../BarcodeFormat';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import BinaryBitmap from './BinaryBitmap';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import Exception from './Exception';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import Exception from './Exception';

@@ -0,0 +0,0 @@ "use strict";

@@ -17,3 +17,3 @@ import ResultPoint from './ResultPoint';

private resultMetadata;
constructor(text: string, rawBytes: Uint8Array, numBits: number, resultPoints: Array<ResultPoint>, format: BarcodeFormat, timestamp: number);
constructor(text: string, rawBytes: Uint8Array, numBits: number, resultPoints: ResultPoint[], format: BarcodeFormat, timestamp?: number);
/**

@@ -20,0 +20,0 @@ * @return raw text encoded by the barcode

@@ -18,6 +18,2 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
/*namespace com.google.zxing {*/
/*import java.util.EnumMap;*/
/*import java.util.Map;*/
var ResultPoint_1 = require("./ResultPoint");
var System_1 = require("./util/System");

@@ -44,3 +40,5 @@ /**

// }
function Result(text, rawBytes, numBits /*int*/, resultPoints, format, timestamp /*long*/) {
function Result(text, rawBytes, numBits, resultPoints, format, timestamp) {
if (numBits === void 0) { numBits = rawBytes == null ? 0 : 8 * rawBytes.length; }
if (timestamp === void 0) { timestamp = System_1.default.currentTimeMillis(); }
this.text = text;

@@ -133,3 +131,3 @@ this.rawBytes = rawBytes;

else if (newPoints !== null && newPoints.length > 0) {
var allPoints = new ResultPoint_1.default[oldPoints.length + newPoints.length];
var allPoints = new Array(oldPoints.length + newPoints.length);
System_1.default.arraycopy(oldPoints, 0, allPoints, 0, oldPoints.length);

@@ -136,0 +134,0 @@ System_1.default.arraycopy(newPoints, 0, allPoints, oldPoints.length, newPoints.length);

@@ -0,0 +0,0 @@ "use strict";

@@ -10,7 +10,7 @@ /**

private y;
constructor(x: number, y: number);
getX(): number;
getY(): number;
constructor(x: float, y: float);
getX(): float;
getY(): float;
equals(other: Object): boolean;
hashCode(): number;
hashCode(): int;
toString(): string;

@@ -29,3 +29,3 @@ /**

*/
static distance(pattern1: ResultPoint, pattern2: ResultPoint): number;
static distance(pattern1: ResultPoint, pattern2: ResultPoint): float;
/**

@@ -32,0 +32,0 @@ * Returns the z component of the cross product between vectors BC and BA.

@@ -28,3 +28,3 @@ "use strict";

var ResultPoint = /** @class */ (function () {
function ResultPoint(x /*float*/, y /*float*/) {
function ResultPoint(x, y) {
this.x = x;

@@ -31,0 +31,0 @@ this.y = y;

@@ -0,0 +0,0 @@ import ResultPoint from './ResultPoint';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import './InvertedLuminanceSource';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import Exception from './Exception';

@@ -0,0 +0,0 @@ "use strict";

export default class Arrays {
/**
* Assigns the specified int value to each element of the specified array
* of ints.
*
* @param a the array to be filled
* @param val the value to be stored in all elements of the array
*/
static fill(a: Int32Array | Uint8Array | any[], val: int): void;
/**
* Assigns the specified int value to each element of the specified
* range of the specified array of ints. The range to be filled
* extends from index {@code fromIndex}, inclusive, to index
* {@code toIndex}, exclusive. (If {@code fromIndex==toIndex}, the
* range to be filled is empty.)
*
* @param a the array to be filled
* @param fromIndex the index of the first element (inclusive) to be
* filled with the specified value
* @param toIndex the index of the last element (exclusive) to be
* filled with the specified value
* @param val the value to be stored in all elements of the array
* @throws IllegalArgumentException if {@code fromIndex > toIndex}
* @throws ArrayIndexOutOfBoundsException if {@code fromIndex < 0} or
* {@code toIndex > a.length}
*/
static fillWithin(a: Int32Array, fromIndex: int, toIndex: int, val: int): void;
/**
* Checks that {@code fromIndex} and {@code toIndex} are in
* the range and throws an exception if they aren't.
*/
static rangeCheck(arrayLength: int, fromIndex: int, toIndex: int): void;
static asList<T = any>(...args: T[]): T[];
static create<T = any>(rows: int, cols: int, value?: T): T[][];
static createInt32Array(rows: int, cols: int, value?: int): Int32Array[];
static equals(first: any, second: any): boolean;

@@ -6,4 +40,6 @@ static hashCode(a: any): number;

static copyOf(original: Int32Array, newLength: number): Int32Array;
static copyOfUint8Array(original: Uint8Array, newLength: number): Uint8Array;
static copyOfRange(original: Int32Array, from: number, to: number): Int32Array;
static binarySearch(ar: Int32Array, el: number, comparator?: (a: number, b: number) => number): number;
static numberComparator(a: number, b: number): number;
}
"use strict";
var __values = (this && this.__values) || function (o) {
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
if (m) return m.call(o);
return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
};
Object.defineProperty(exports, "__esModule", { value: true });
var System_1 = require("./System");
var IllegalArgumentException_1 = require("../IllegalArgumentException");
var ArrayIndexOutOfBoundsException_1 = require("../ArrayIndexOutOfBoundsException");
var Arrays = /** @class */ (function () {
function Arrays() {
}
/**
* Assigns the specified int value to each element of the specified array
* of ints.
*
* @param a the array to be filled
* @param val the value to be stored in all elements of the array
*/
Arrays.fill = function (a, val) {
for (var i = 0, len = a.length; i < len; i++)
a[i] = val;
};
/**
* Assigns the specified int value to each element of the specified
* range of the specified array of ints. The range to be filled
* extends from index {@code fromIndex}, inclusive, to index
* {@code toIndex}, exclusive. (If {@code fromIndex==toIndex}, the
* range to be filled is empty.)
*
* @param a the array to be filled
* @param fromIndex the index of the first element (inclusive) to be
* filled with the specified value
* @param toIndex the index of the last element (exclusive) to be
* filled with the specified value
* @param val the value to be stored in all elements of the array
* @throws IllegalArgumentException if {@code fromIndex > toIndex}
* @throws ArrayIndexOutOfBoundsException if {@code fromIndex < 0} or
* {@code toIndex > a.length}
*/
Arrays.fillWithin = function (a, fromIndex, toIndex, val) {
Arrays.rangeCheck(a.length, fromIndex, toIndex);
for (var i = fromIndex; i < toIndex; i++)
a[i] = val;
};
/**
* Checks that {@code fromIndex} and {@code toIndex} are in
* the range and throws an exception if they aren't.
*/
Arrays.rangeCheck = function (arrayLength, fromIndex, toIndex) {
if (fromIndex > toIndex) {
throw new IllegalArgumentException_1.default('fromIndex(' + fromIndex + ') > toIndex(' + toIndex + ')');
}
if (fromIndex < 0) {
throw new ArrayIndexOutOfBoundsException_1.default(fromIndex);
}
if (toIndex > arrayLength) {
throw new ArrayIndexOutOfBoundsException_1.default(toIndex);
}
};
Arrays.asList = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return args;
};
Arrays.create = function (rows, cols, value) {
var arr = Array.from({ length: rows });
return arr.map(function (x) { return Array.from({ length: cols }).fill(value); });
};
Arrays.createInt32Array = function (rows, cols, value) {
var arr = Array.from({ length: rows });
return arr.map(function (x) { return Int32Array.from({ length: cols }).fill(value); });
};
Arrays.equals = function (first, second) {

@@ -31,2 +106,3 @@ if (!first) {

Arrays.hashCode = function (a) {
var e_1, _a;
if (a === null) {

@@ -36,6 +112,15 @@ return 0;

var result = 1;
for (var _i = 0, a_1 = a; _i < a_1.length; _i++) {
var element = a_1[_i];
result = 31 * result + element;
try {
for (var a_1 = __values(a), a_1_1 = a_1.next(); !a_1_1.done; a_1_1 = a_1.next()) {
var element = a_1_1.value;
result = 31 * result + element;
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (a_1_1 && !a_1_1.done && (_a = a_1.return)) _a.call(a_1);
}
finally { if (e_1) throw e_1.error; }
}
return result;

@@ -49,4 +134,16 @@ };

Arrays.copyOf = function (original, newLength) {
return original.slice(0, newLength);
};
Arrays.copyOfUint8Array = function (original, newLength) {
if (original.length <= newLength) {
var newArray = new Uint8Array(newLength);
newArray.set(original);
return newArray;
}
return original.slice(0, newLength);
};
Arrays.copyOfRange = function (original, from, to) {
var newLength = to - from;
var copy = new Int32Array(newLength);
System_1.default.arraycopy(original, 0, copy, 0, Math.min(original.length, newLength));
System_1.default.arraycopy(original, from, copy, 0, newLength);
return copy;

@@ -53,0 +150,0 @@ };

@@ -0,3 +1,14 @@

/**
* Ponyfill for Java's Float class.
*/
export default class Float {
/**
* The float max value in JS is the number max value.
*/
static MAX_VALUE: number;
/**
* SincTS has no difference between int and float, there's all numbers,
* this is used only to polyfill Java code.
*/
static floatToIntBits(f: number): number;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
* Ponyfill for Java's Float class.
*/
var Float = /** @class */ (function () {
function Float() {
}
/**
* SincTS has no difference between int and float, there's all numbers,
* this is used only to polyfill Java code.
*/
Float.floatToIntBits = function (f) {
return f;
};
/**
* The float max value in JS is the number max value.
*/
Float.MAX_VALUE = Number.MAX_SAFE_INTEGER;
return Float;

@@ -10,0 +21,0 @@ }());

@@ -0,3 +1,7 @@

/**
* Ponyfill for Java's Integer class.
*/
export default class Integer {
static MIN_VALUE_32_BITS: number;
static MAX_VALUE: number;
static numberOfTrailingZeros(i: number): number;

@@ -7,2 +11,8 @@ static numberOfLeadingZeros(i: number): number;

static bitCount(i: number): number;
/**
* Converts A string to an integer.
* @param s A string to convert into a number.
* @param radix A value between 2 and 36 that specifies the base of the number in numString. If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. All other strings are considered decimal.
*/
static parseInt(num: string, radix?: number): number;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
* Ponyfill for Java's Integer class.
*/
var Integer = /** @class */ (function () {

@@ -73,3 +76,13 @@ function Integer() {

};
/**
* Converts A string to an integer.
* @param s A string to convert into a number.
* @param radix A value between 2 and 36 that specifies the base of the number in numString. If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. All other strings are considered decimal.
*/
Integer.parseInt = function (num, radix) {
if (radix === void 0) { radix = undefined; }
return parseInt(num, radix);
};
Integer.MIN_VALUE_32_BITS = -2147483648;
Integer.MAX_VALUE = Number.MAX_SAFE_INTEGER;
return Integer;

@@ -76,0 +89,0 @@ }());

@@ -0,4 +1,7 @@

import CharacterSetECI from '../common/CharacterSetECI';
export default class StringBuilder {
private value;
private encoding;
constructor(value?: string);
enableDecoding(encoding: CharacterSetECI): StringBuilder;
append(s: string | number): StringBuilder;

@@ -9,4 +12,9 @@ length(): number;

setCharAt(n: number, c: string): void;
substring(start: int, end: int): string;
/**
* @note helper method for RSS Expanded
*/
setLengthToZero(): void;
toString(): string;
insert(n: number, c: string): void;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var StringEncoding_1 = require("./StringEncoding");
var StringBuilder = /** @class */ (function () {

@@ -8,2 +9,6 @@ function StringBuilder(value) {

}
StringBuilder.prototype.enableDecoding = function (encoding) {
this.encoding = encoding;
return this;
};
StringBuilder.prototype.append = function (s) {

@@ -13,3 +18,8 @@ if (typeof s === 'string') {

}
else if (this.encoding) {
// use passed format (fromCharCode will return UTF8 encoding)
this.value += StringEncoding_1.default.decode(new Uint8Array([s]), this.encoding);
}
else {
// correctly converts from UTF-8, but not other encodings
this.value += String.fromCharCode(s);

@@ -31,2 +41,11 @@ }

};
StringBuilder.prototype.substring = function (start, end) {
return this.value.substring(start, end);
};
/**
* @note helper method for RSS Expanded
*/
StringBuilder.prototype.setLengthToZero = function () {
this.value = "";
};
StringBuilder.prototype.toString = function () {

@@ -33,0 +52,0 @@ return this.value;

@@ -0,0 +0,0 @@ import CharacterSetECI from '../common/CharacterSetECI';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ export default class System {

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import BitMatrix from './common/BitMatrix';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import Exception from './Exception';

@@ -0,0 +0,0 @@ "use strict";

@@ -1,11 +0,2 @@

export * from './browser/BrowserBarcodeReader';
export * from './browser/BrowserCodeReader';
export * from './browser/BrowserDatamatrixCodeReader';
export * from './browser/BrowserMultiFormatReader';
export * from './browser/BrowserQRCodeReader';
export * from './browser/BrowserQRCodeSvgWriter';
export * from './browser/DecodeContinuouslyCallback';
export * from './browser/HTMLCanvasElementLuminanceSource';
export * from './browser/HTMLVisualMediaElement';
export * from './browser/VideoInputDevice';
export * from './browser';
export { default as ArgumentException } from './core/ArgumentException';

@@ -70,2 +61,3 @@ export { default as ArithmeticException } from './core/ArithmeticException';

export { default as RSS14Reader } from './core/oned/rss/RSS14Reader';
export { default as RSSExpandedReader } from './core/oned/rss/expanded/RSSExpandedReader';
export { default as MultiformatReader } from './core/oned/MultiFormatOneDReader';

@@ -6,11 +6,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
// browser
__export(require("./browser/BrowserBarcodeReader"));
__export(require("./browser/BrowserCodeReader"));
__export(require("./browser/BrowserDatamatrixCodeReader"));
__export(require("./browser/BrowserMultiFormatReader"));
__export(require("./browser/BrowserQRCodeReader"));
__export(require("./browser/BrowserQRCodeSvgWriter"));
__export(require("./browser/HTMLCanvasElementLuminanceSource"));
__export(require("./browser/VideoInputDevice"));
__export(require("./browser"));
// Exceptions

@@ -137,4 +129,6 @@ var ArgumentException_1 = require("./core/ArgumentException");

exports.RSS14Reader = RSS14Reader_1.default;
var RSSExpandedReader_1 = require("./core/oned/rss/expanded/RSSExpandedReader");
exports.RSSExpandedReader = RSSExpandedReader_1.default;
var MultiFormatOneDReader_1 = require("./core/oned/MultiFormatOneDReader");
exports.MultiformatReader = MultiFormatOneDReader_1.default;
//# sourceMappingURL=index.js.map
{
"name": "@zxing/library",
"version": "0.15.2",
"version": "0.16.0",
"description": "TypeScript port of ZXing multi-format 1D/2D barcode image processing library.",

@@ -55,3 +55,3 @@ "keywords": [

"scripts": {
"lint": "yarn tslint src/**/*.ts",
"lint": "yarn tslint --project .",
"clean": "yarn shx rm -rf umd esm esm5",

@@ -110,2 +110,3 @@ "test": "yarn mocha-webpack \"./src/**/*.spec.ts\" --timeout 200000 --webpack-config webpack.config.test.js",

"tslint": "^5.13.1",
"tslint-no-circular-imports": "^0.7.0",
"typescript": "~3.3.3333",

@@ -117,4 +118,5 @@ "uglify-js": "^3.4.9",

"webpack-config-utils": "2.3.1",
"webpack-node-externals": "^1.6.0"
"webpack-node-externals": "^1.6.0",
"yarn": "^1.17.3"
}
}

@@ -22,3 +22,3 @@ [<img align="right" src="https://raw.github.com/wiki/zxing/zxing/zxing-logo.png"/>][1]

| EAN-8 | Code 128 | ~~Aztec~~ \* |
| EAN-13 | ~~Codabar~~ | ~~PDF 417~~ \* |
| EAN-13 | ~~Codabar~~ | PDF 417 |
| | ITF | ~~MaxiCode~~ |

@@ -206,3 +206,3 @@ | | RSS-14 |

codeReader
.decodeFromInputVideoDevice(firstDeviceId, 'video')
.decodeOnceFromVideoDevice(firstDeviceId, 'video')
.then(result => console.log(result.text))

@@ -212,3 +212,3 @@ .catch(err => console.error(err));

If there are more input devices then you will need to chose one for `codeReader.decodeFromInputVideoDevice` device id parameter.
If there are more input devices then you will need to chose one for `codeReader.decodeOnceFromVideoDevice` device id parameter.

@@ -219,3 +219,3 @@ You can also provide `undefined` for the device id parameter in which case the library will automatically choose the camera, preferring the main (environment facing) camera if more are available:

codeReader
.decodeFromInputVideoDevice(undefined, 'video')
.decodeOnceFromVideoDevice(undefined, 'video')
.then(result => console.log(result.text))

@@ -222,0 +222,0 @@ .catch(err => console.error(err));

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc