{"version":3,"sources":["webpack://ZXing/webpack/universalModuleDefinition","webpack://ZXing/webpack/bootstrap","webpack://ZXing/./src/core/NotFoundException.ts","webpack://ZXing/./src/core/IllegalArgumentException.ts","webpack://ZXing/./src/core/FormatException.ts","webpack://ZXing/./src/core/BarcodeFormat.ts","webpack://ZXing/./src/core/ResultPoint.ts","webpack://ZXing/./src/core/util/StringBuilder.ts","webpack://ZXing/./src/core/util/System.ts","webpack://ZXing/./src/core/Exception.ts","webpack://ZXing/./src/core/DecodeHintType.ts","webpack://ZXing/./src/core/Result.ts","webpack://ZXing/./src/core/common/detector/MathUtils.ts","webpack://ZXing/./src/core/ChecksumException.ts","webpack://ZXing/./src/core/common/BitMatrix.ts","webpack://ZXing/./src/core/util/Integer.ts","webpack://ZXing/./src/core/ResultMetadataType.ts","webpack://ZXing/./src/core/oned/OneDReader.ts","webpack://ZXing/./src/core/IllegalStateException.ts","webpack://ZXing/./src/browser/BrowserCodeReader.ts","webpack://ZXing/./src/core/common/BitArray.ts","webpack://ZXing/./src/core/util/Arrays.ts","webpack://ZXing/./src/core/common/reedsolomon/GenericGF.ts","webpack://ZXing/./src/core/pdf417/PDF417Common.ts","webpack://ZXing/./src/core/common/CharacterSetECI.ts","webpack://ZXing/./src/core/util/StringEncoding.ts","webpack://ZXing/./src/core/InvertedLuminanceSource.ts","webpack://ZXing/./src/core/LuminanceSource.ts","webpack://ZXing/./src/core/common/DecoderResult.ts","webpack://ZXing/./src/core/common/reedsolomon/ReedSolomonDecoder.ts","webpack://ZXing/./src/core/common/StringUtils.ts","webpack://ZXing/./src/core/common/reedsolomon/GenericGFPoly.ts","webpack://ZXing/./src/core/common/DetectorResult.ts","webpack://ZXing/./src/core/common/GridSamplerInstance.ts","webpack://ZXing/./src/core/oned/AbstractUPCEANReader.ts","webpack://ZXing/./src/core/qrcode/decoder/ErrorCorrectionLevel.ts","webpack://ZXing/./src/core/EncodeHintType.ts","webpack://ZXing/./src/core/oned/rss/expanded/decoders/AI01decoder.ts","webpack://ZXing/./src/core/ArgumentException.ts","webpack://ZXing/./src/core/IndexOutOfBoundsException.ts","webpack://ZXing/./src/core/UnsupportedOperationException.ts","webpack://ZXing/./src/core/aztec/AztecReader.ts","webpack://ZXing/./src/core/ArithmeticException.ts","webpack://ZXing/./src/core/common/detector/WhiteRectangleDetector.ts","webpack://ZXing/./src/core/common/PerspectiveTransform.ts","webpack://ZXing/./src/core/oned/MultiFormatOneDReader.ts","webpack://ZXing/./src/core/oned/rss/DataCharacter.ts","webpack://ZXing/./src/core/datamatrix/DataMatrixReader.ts","webpack://ZXing/./src/core/common/BitSource.ts","webpack://ZXing/./src/core/qrcode/QRCodeReader.ts","webpack://ZXing/./src/core/qrcode/decoder/Version.ts","webpack://ZXing/./src/core/util/Formatter.ts","webpack://ZXing/./src/core/qrcode/encoder/Encoder.ts","webpack://ZXing/./src/core/qrcode/encoder/QRCode.ts","webpack://ZXing/./src/core/WriterException.ts","webpack://ZXing/./src/core/oned/rss/expanded/decoders/DecodedObject.ts","webpack://ZXing/./src/index.ts","webpack://ZXing/./src/core/BinaryBitmap.ts","webpack://ZXing/./src/core/common/HybridBinarizer.ts","webpack://ZXing/./src/core/common/GlobalHistogramBinarizer.ts","webpack://ZXing/./src/core/Binarizer.ts","webpack://ZXing/./src/browser/HTMLCanvasElementLuminanceSource.ts","webpack://ZXing/./src/browser/VideoInputDevice.ts","webpack://ZXing/./src/core/common/reedsolomon/AbstractGenericGF.ts","webpack://ZXing/./src/core/ReedSolomonException.ts","webpack://ZXing/./src/core/util/Float.ts","webpack://ZXing/./src/core/common/DefaultGridSampler.ts","webpack://ZXing/./src/core/common/GridSampler.ts","webpack://ZXing/./src/core/oned/Code39Reader.ts","webpack://ZXing/./src/core/oned/Code128Reader.ts","webpack://ZXing/./src/core/oned/rss/RSS14Reader.ts","webpack://ZXing/./src/core/oned/rss/AbstractRSSReader.ts","webpack://ZXing/./src/core/oned/rss/FinderPattern.ts","webpack://ZXing/./src/core/oned/rss/RSSUtils.ts","webpack://ZXing/./src/core/oned/ITFReader.ts","webpack://ZXing/./src/core/oned/EAN13Reader.ts","webpack://ZXing/./src/core/oned/UPCEANReader.ts","webpack://ZXing/./src/core/MultiFormatReader.ts","webpack://ZXing/./src/core/qrcode/decoder/FormatInformation.ts","webpack://ZXing/./src/core/qrcode/decoder/QRCodeDecoderMetaData.ts","webpack://ZXing/./src/core/qrcode/decoder/Mode.ts","webpack://ZXing/./src/core/pdf417/PDF417Reader.ts","webpack://ZXing/./src/core/pdf417/decoder/ec/ModulusPoly.ts","webpack://ZXing/./src/core/pdf417/decoder/BoundingBox.ts","webpack://ZXing/./src/core/pdf417/decoder/DetectionResultColumn.ts","webpack://ZXing/./src/core/pdf417/decoder/BarcodeValue.ts","webpack://ZXing/./src/core/ReaderException.ts","webpack://ZXing/./src/core/common/reedsolomon/ReedSolomonEncoder.ts","webpack://ZXing/./src/core/qrcode/encoder/MaskUtil.ts","webpack://ZXing/./src/core/qrcode/QRCodeWriter.ts","webpack://ZXing/./src/core/oned/rss/expanded/decoders/GeneralAppIdDecoder.ts","webpack://ZXing/./src/core/oned/rss/expanded/decoders/AbstractExpandedDecoder.ts","webpack://ZXing/./src/core/oned/rss/expanded/decoders/AI013x0xDecoder.ts","webpack://ZXing/./src/core/oned/rss/expanded/decoders/AI01weightDecoder.ts","webpack://ZXing/./src/browser.ts","webpack://ZXing/./src/browser/BrowserAztecCodeReader.ts","webpack://ZXing/./node_modules/ts-custom-error/dist/custom-error.umd.js","webpack://ZXing/./src/core/ArrayIndexOutOfBoundsException.ts","webpack://ZXing/./src/core/aztec/decoder/Decoder.ts","webpack://ZXing/./src/core/aztec/detector/Detector.ts","webpack://ZXing/./src/core/aztec/AztecDetectorResult.ts","webpack://ZXing/./src/browser/BrowserBarcodeReader.ts","webpack://ZXing/./src/core/oned/rss/Pair.ts","webpack://ZXing/./src/core/oned/MultiFormatUPCEANReader.ts","webpack://ZXing/./src/core/oned/UPCEANExtensionSupport.ts","webpack://ZXing/./src/core/oned/UPCEANExtension5Support.ts","webpack://ZXing/./src/core/oned/UPCEANExtension2Support.ts","webpack://ZXing/./src/core/oned/EAN8Reader.ts","webpack://ZXing/./src/browser/BrowserDatamatrixCodeReader.ts","webpack://ZXing/./src/core/datamatrix/decoder/Decoder.ts","webpack://ZXing/./src/core/datamatrix/decoder/BitMatrixParser.ts","webpack://ZXing/./src/core/datamatrix/decoder/Version.ts","webpack://ZXing/./src/core/datamatrix/decoder/DataBlock.ts","webpack://ZXing/./src/core/datamatrix/decoder/DecodedBitStreamParser.ts","webpack://ZXing/./src/core/datamatrix/detector/Detector.ts","webpack://ZXing/./src/browser/BrowserMultiFormatReader.ts","webpack://ZXing/./src/core/qrcode/decoder/Decoder.ts","webpack://ZXing/./src/core/qrcode/decoder/BitMatrixParser.ts","webpack://ZXing/./src/core/qrcode/decoder/ECBlocks.ts","webpack://ZXing/./src/core/qrcode/decoder/ECB.ts","webpack://ZXing/./src/core/qrcode/decoder/DataMask.ts","webpack://ZXing/./src/core/qrcode/decoder/DataBlock.ts","webpack://ZXing/./src/core/qrcode/decoder/DecodedBitStreamParser.ts","webpack://ZXing/./src/core/qrcode/detector/Detector.ts","webpack://ZXing/./src/core/qrcode/detector/FinderPatternFinder.ts","webpack://ZXing/./src/core/qrcode/detector/FinderPattern.ts","webpack://ZXing/./src/core/qrcode/detector/FinderPatternInfo.ts","webpack://ZXing/./src/core/qrcode/detector/AlignmentPatternFinder.ts","webpack://ZXing/./src/core/qrcode/detector/AlignmentPattern.ts","webpack://ZXing/./src/core/pdf417/detector/Detector.ts","webpack://ZXing/./src/core/pdf417/detector/PDF417DetectorResult.ts","webpack://ZXing/./src/core/pdf417/decoder/PDF417ScanningDecoder.ts","webpack://ZXing/./src/core/pdf417/decoder/ec/ErrorCorrection.ts","webpack://ZXing/./src/core/pdf417/decoder/ec/ModulusGF.ts","webpack://ZXing/./src/core/pdf417/decoder/ec/ModulusBase.ts","webpack://ZXing/./src/core/pdf417/decoder/DetectionResultRowIndicatorColumn.ts","webpack://ZXing/./src/core/pdf417/decoder/BarcodeMetadata.ts","webpack://ZXing/./src/core/pdf417/decoder/DetectionResult.ts","webpack://ZXing/./src/core/pdf417/decoder/Codeword.ts","webpack://ZXing/./src/core/pdf417/decoder/PDF417CodewordDecoder.ts","webpack://ZXing/./src/core/pdf417/decoder/DecodedBitStreamParser.ts","webpack://ZXing/(webpack)/buildin/global.js","webpack://ZXing/./src/core/pdf417/PDF417ResultMetadata.ts","webpack://ZXing/./src/core/util/Long.ts","webpack://ZXing/./src/core/util/ByteArrayOutputStream.ts","webpack://ZXing/./src/core/util/OutputStream.ts","webpack://ZXing/./src/core/NullPointerException.ts","webpack://ZXing/./src/core/OutOfMemoryError.ts","webpack://ZXing/./src/browser/BrowserPDF417Reader.ts","webpack://ZXing/./src/browser/BrowserQRCodeReader.ts","webpack://ZXing/./src/browser/BrowserQRCodeSvgWriter.ts","webpack://ZXing/./src/core/qrcode/encoder/ByteMatrix.ts","webpack://ZXing/./src/core/qrcode/encoder/MatrixUtil.ts","webpack://ZXing/./src/core/qrcode/encoder/BlockPair.ts","webpack://ZXing/./src/core/MultiFormatWriter.ts","webpack://ZXing/./src/core/PlanarYUVLuminanceSource.ts","webpack://ZXing/./src/core/RGBLuminanceSource.ts","webpack://ZXing/./src/core/oned/rss/expanded/RSSExpandedReader.ts","webpack://ZXing/./src/core/oned/rss/expanded/decoders/AbstractExpandedDecoderComplement.ts","webpack://ZXing/./src/core/oned/rss/expanded/decoders/DecodedChar.ts","webpack://ZXing/./src/core/oned/rss/expanded/decoders/DecodedNumeric.ts","webpack://ZXing/./src/core/oned/rss/expanded/decoders/DecodedInformation.ts","webpack://ZXing/./src/core/oned/rss/expanded/decoders/FieldParser.ts","webpack://ZXing/./src/core/oned/rss/expanded/decoders/BlockParsedResult.ts","webpack://ZXing/./src/core/oned/rss/expanded/decoders/AI01AndOtherAIs.ts","webpack://ZXing/./src/core/oned/rss/expanded/decoders/AnyAIDecoder.ts","webpack://ZXing/./src/core/oned/rss/expanded/decoders/AI013103decoder.ts","webpack://ZXing/./src/core/oned/rss/expanded/decoders/AI01320xDecoder.ts","webpack://ZXing/./src/core/oned/rss/expanded/decoders/AI01392xDecoder.ts","webpack://ZXing/./src/core/oned/rss/expanded/decoders/AI01393xDecoder.ts","webpack://ZXing/./src/core/oned/rss/expanded/decoders/AI013x0x1xDecoder.ts","webpack://ZXing/./src/core/oned/rss/expanded/ExpandedPair.ts","webpack://ZXing/./src/core/oned/rss/expanded/ExpandedRow.ts","webpack://ZXing/./src/core/oned/rss/expanded/BitArrayBuilder.ts"],"names":["root","factory","exports","module","define","amd","ZXing","window","installedModules","__webpack_require__","m","_super","Exception_1","NotFoundException","__extends","default","getNotFoundInstance","IllegalArgumentException","FormatException","getFormatInstance","BarcodeFormat","AZTEC","CODABAR","CODE_39","CODE_93","CODE_128","DATA_MATRIX","EAN_8","EAN_13","ITF","MAXICODE","PDF_417","QR_CODE","RSS_14","RSS_EXPANDED","UPC_A","UPC_E","UPC_EAN_EXTENSION","MathUtils_1","Float_1","ResultPoint","prototype","getX","this","x","getY","y","equals","other","otherPoint","hashCode","floatToIntBits","toString","orderBestPatterns","patterns","pointA","pointB","pointC","zeroOneDistance","distance","oneTwoDistance","zeroTwoDistance","crossProductZ","temp","pattern1","pattern2","bX","bY","StringUtils_1","StringBuilder","enableDecoding","encoding","append","s","value","castAsNonUtf8Char","String","fromCharCode","length","charAt","n","deleteCharAt","substr","substring","setCharAt","c","start","end","setLengthToZero","insert","System","arraycopy","src","srcPos","dest","destPos","currentTimeMillis","Date","now","ts_custom_error_1","Exception","CustomError","message","_this","call","DecodeHintType","OTHER","PURE_BARCODE","POSSIBLE_FORMATS","TRY_HARDER","CHARACTER_SET","ALLOWED_LENGTHS","ASSUME_CODE_39_CHECK_DIGIT","ASSUME_GS1","RETURN_CODABAR_START_END","NEED_RESULT_POINT_CALLBACK","ALLOWED_EAN_EXTENSIONS","System_1","Result","getText","text","getRawBytes","rawBytes","getNumBits","numBits","getResultPoints","resultPoints","getBarcodeFormat","format","getResultMetadata","resultMetadata","putMetadata","type","Map","set","putAllMetadata","metadata","addResultPoints","newPoints","oldPoints","allPoints","Array","getTimestamp","timestamp","undefined","MathUtils","round","d","NaN","Number","MIN_SAFE_INTEGER","MAX_SAFE_INTEGER","aX","aY","xDiff","yDiff","Math","sqrt","sum","array","count","i","length_1","ChecksumException","getChecksumInstance","BitArray_1","Arrays_1","StringBuilder_1","IllegalArgumentException_1","BitMatrix","parseFromBooleanArray","image","height","width","bits","imageI","j","parseFromString","stringRepresentation","setString","unsetString","bitsPos","rowStartPos","rowLength","nRows","pos","matrix","floor","get","offset","rowSize","unset","flip","xor","mask","getWidth","getHeight","getRowSize","rowArray","row","getRow","getBitArray","clear","max","setRegion","left","top","right","bottom","getSize","setBulk","setRow","rotate180","topRow","bottomRow","reverse","getEnclosingRectangle","x32","theBits","bit","Int32Array","from","getTopLeftOnBit","bitsOffset","getBottomRightOnBit","o","hash","lineSeparator","buildToString","result","clone","slice","Integer","numberOfTrailingZeros","numberOfLeadingZeros","toHexString","toBinaryString","intNumber","parseInt","bitCount","truncDivision","dividend","divisor","trunc","num","radix","MIN_VALUE_32_BITS","MAX_VALUE","ResultMetadataType","ORIENTATION","BYTE_SEGMENTS","ERROR_CORRECTION_LEVEL","ISSUE_NUMBER","SUGGESTED_PRICE","POSSIBLE_COUNTRY","PDF417_EXTRA_METADATA","STRUCTURED_APPEND_SEQUENCE","STRUCTURED_APPEND_PARITY","DecodeHintType_1","ResultMetadataType_1","ResultPoint_1","NotFoundException_1","OneDReader","decode","hints","doDecode","nfe","isRotateSupported","rotatedImage","rotateCounterClockwise","orientation_1","points","reset","maxLines","tryHarder","rowStep","middle","rowStepsAboveOrBelow","rowNumber","getBlackRow","ignored","attempt","newHints_1","forEach","hint","key","delete","this_1","decodeRow","re","_","recordPattern","counters","numCounters","index","isWhite","counterPosition","recordPatternInReverse","numTransitionsLeft","last","patternMatchVariance","pattern","maxIndividualVariance","total","patternLength","POSITIVE_INFINITY","unitBarWidth","totalVariance","counter","scaledPattern","variance","IllegalStateException","ArgumentException_1","BinaryBitmap_1","ChecksumException_1","HybridBinarizer_1","FormatException_1","HTMLCanvasElementLuminanceSource_1","VideoInputDevice_1","BrowserCodeReader","Object","defineProperty","navigator","hasNavigator","mediaDevices","isMediaDevicesSuported","enumerateDevices","_timeBetweenDecodingAttempts","millis","_hints","enumerable","configurable","listVideoInputDevices","e","r","a","u","f","l","h","t","label","Error","canEnumerateDevices","devices","_b","sent","videoDevices","devices_1","__values","devices_1_1","next","done","device","kind","deviceId","id","groupId","videoDevice","push","getVideoInputDevices","_a","map","VideoInputDevice","findDeviceById","find","decodeFromInputVideoDevice","videoSource","decodeOnceFromVideoDevice","constraints","video","exact","facingMode","decodeOnceFromConstraints","getUserMedia","stream","decodeOnceFromStream","attachStreamToVideo","decodeOnce","decodeFromInputVideoDeviceContinuously","callbackFn","decodeFromVideoDevice","decodeFromConstraints","decodeFromStream","decodeContinuously","stopAsyncDecode","_stopAsyncDecode","stopContinuousDecode","_stopContinuousDecode","videoElement","prepareVideoElement","addVideoSource","playVideoOnLoadAsync","Promise","resolve","reject","playVideoOnLoad","element","videoEndedListener","stopStreams","videoCanPlayListener","tryPlayVideo","addEventListener","isVideoPlaying","currentTime","paused","ended","readyState","console","warn","trys","play","getMediaElement","mediaElementId","mediaElement","document","getElementById","nodeName","toLowerCase","decodeFromImage","source","url","decodeFromImageUrl","decodeFromImageElement","decodeFromVideo","decodeFromVideoUrl","decodeFromVideoElement","decodeFromVideoContinuously","decodeFromVideoUrlContinuously","decodeFromVideoElementContinuously","prepareImageElement","imageElement","isImageLoaded","_decodeOnLoadImage","_decodeFromVideoElementSetup","_decodeOnLoadVideo","_decodeOnLoadVideoContinuously","decodeTask","imageLoadedListener","then","img","complete","naturalWidth","imageSource","createElement","HTMLImageElement","HTMLVideoElement","setAttribute","retryIfNotFound","retryIfChecksumOrFormatError","loop","ifNotFound","isChecksumOrFormatError","setTimeout","timeBetweenScansMillis","isNotFound","binaryBitmap","createBinaryBitmap","decodeBitmap","ctx","getCaptureCanvasContext","drawImageOnCanvas","canvas","getCaptureCanvas","luminanceSource","HTMLCanvasElementLuminanceSource","hybridBinarizer","captureCanvasContext","getContext","captureCanvas","elem","createCaptureCanvas","canvasElementContext","srcElement","drawImage","reader","_destroyCaptureCanvas","canvasElement","videoWidth","videoHeight","naturalHeight","style","getVideoTracks","stop","_destroyVideoElement","_destroyImageElement","removeEventListener","videoPlayingEventListener","cleanVideoSource","removeAttribute","srcObject","err","URL","createObjectURL","Integer_1","BitArray","size","getSizeInBytes","ensureCapacity","newBits","makeArray","getNextSet","currentBits","getNextUnset","setRange","firstInt","lastInt","isRange","appendBit","appendBits","numBitsLeft","appendBitArray","otherSize","toBytes","bitOffset","numBytes","theByte","len","oldBitsLen","leftOffset","currentInt","nextInt","ArrayIndexOutOfBoundsException_1","Arrays","fill","val","fillWithin","fromIndex","toIndex","rangeCheck","arrayLength","asList","args","_i","arguments","create","rows","cols","createInt32Array","first","second","a_1","a_1_1","fillUint8Array","copyOf","original","newLength","copyOfUint8Array","newArray","Uint8Array","copyOfRange","to","copy","binarySearch","ar","el","comparator","numberComparator","k","cmp","b","GenericGFPoly_1","AbstractGenericGF_1","ArithmeticException_1","GenericGF","getZero","zero","getOne","one","buildMonomial","degree","coefficient","coefficients","inverse","expTable","logTable","multiply","getGeneratorBase","generatorBase","primitive","AZTEC_DATA_12","AZTEC_DATA_10","AZTEC_DATA_6","AZTEC_PARAM","QR_CODE_FIELD_256","DATA_MATRIX_FIELD_256","AZTEC_DATA_8","MAXICODE_FIELD_64","PDF417Common","getBitCountSum","moduleBitCount","toIntArray","list","EMPTY_INT_ARRAY","list_1","list_1_1","integer","getCodeword","symbol","SYMBOL_TABLE","CODEWORD_TABLE","NUMBER_OF_CODEWORDS","MAX_CODEWORDS_IN_BARCODE","MIN_ROWS_IN_BARCODE","MAX_ROWS_IN_BARCODE","MODULES_IN_CODEWORD","MODULES_IN_STOP_PATTERN","BARS_IN_MODULE","CharacterSetValueIdentifiers","Cp437","ISO8859_1","ISO8859_2","ISO8859_3","ISO8859_4","ISO8859_5","ISO8859_6","ISO8859_7","ISO8859_8","ISO8859_9","ISO8859_10","ISO8859_11","ISO8859_13","ISO8859_14","ISO8859_15","ISO8859_16","SJIS","Cp1250","Cp1251","Cp1252","Cp1256","UnicodeBigUnmarked","UTF8","ASCII","Big5","GB18030","EUC_KR","CharacterSetECI","getValueIdentifier","valueIdentifier","getName","name","getValue","values","getCharacterSetECIByValue","characterSet","VALUES_TO_ECI","getCharacterSetECIByName","NAME_TO_ECI","VALUE_IDENTIFIER_TO_ECI","valuesParam","otherEncodingNames","v","otherEncodingNames_1","otherEncodingNames_1_1","otherName","UnsupportedOperationException_1","CharacterSetECI_1","StringEncoding","bytes","encodingName","customDecoder","TextDecoder","shouldDecodeOnFallback","decodeFallback","isBrowser","encode","customEncoder","TextEncoder","encodeFallback","encodingCharacterSet","isDecodeFallbackSupported","decodeURIComponent","apply","Uint16Array","buffer","charList","btoa","unescape","encodeURIComponent","split","uintArray","charCodeAt","LuminanceSource_1","InvertedLuminanceSource","sourceRow","delegate","getMatrix","invertedMatrix","Uint8ClampedArray","isCropSupported","crop","invert","rotateCounterClockwise45","LuminanceSource","luminance","DecoderResult","setNumBits","getByteSegments","byteSegments","getECLevel","ecLevel","getErrorsCorrected","errorsCorrected","setErrorsCorrected","getErasures","erasures","setErasures","getOther","setOther","hasStructuredAppend","structuredAppendParity","structuredAppendSequenceNumber","getStructuredAppendParity","getStructuredAppendSequenceNumber","GenericGF_1","ReedSolomonException_1","IllegalStateException_1","ReedSolomonDecoder","received","twoS","field","poly","syndromeCoefficients","noError","evalResult","evaluateAt","exp","syndrome","sigmaOmega","runEuclideanAlgorithm","sigma","omega","errorLocations","findErrorLocations","errorMagnitudes","findErrorMagnitudes","position","log","addOrSubtract","R","getDegree","rLast","tLast","rLastLast","tLastLast","isZero","q","denominatorLeadingTerm","getCoefficient","dltInverse","degreeDiff","scale","multiplyByMonomial","sigmaTildeAtZero","multiplyScalar","errorLocator","numErrors","errorEvaluator","xiInverse","denominator","term","termPlus1","StringEncoding_1","StringUtils","code","ISO88591","guessEncoding","canBeISO88591","canBeShiftJIS","canBeUTF8","utf8BytesLeft","utf2BytesChars","utf3BytesChars","utf4BytesChars","sjisBytesLeft","sjisKatakanaChars","sjisCurKatakanaWordLength","sjisCurDoubleBytesWordLength","sjisMaxKatakanaWordLength","sjisMaxDoubleBytesWordLength","isoHighOther","utf8bom","ASSUME_SHIFT_JIS","SHIFT_JIS","PLATFORM_DEFAULT_ENCODING","replace","p0","p1","p2","p3","p4","base","parseFloat","toFixed","toPrecision","toExponential","JSON","stringify","ch","getBytes","str","getCharCode","getCharAt","charCode","GB2312","EUC_JP","GenericGFPoly","getCoefficients","smallerCoefficients","largerCoefficients","sumDiff","lengthDiff","aCoefficients","aLength","bCoefficients","bLength","product","aCoeff","scalar","divide","quotient","remainder","inverseDenominatorLeadingTerm","degreeDifference","iterationQuotient","alphaPower","coefficientsLength","firstNonZero","DetectorResult","getBits","getPoints","DefaultGridSampler_1","GridSamplerInstance","setGridSampler","newGridSampler","gridSampler","getInstance","OneDReader_1","AbstractUPCEANReader","findStartGuardPattern","foundStart","startRange","nextStart","findGuardPattern","START_END_PATTERN","quietStart","checkChecksum","checkStandardUPCEANChecksum","check","getStandardUPCEANChecksum","digit","decodeEnd","endStart","rowOffset","whiteFirst","patternStart","MAX_INDIVIDUAL_VARIANCE","MAX_AVG_VARIANCE","decodeDigit","bestVariance","bestMatch","MIDDLE_PATTERN","END_PATTERN","L_PATTERNS","decodeRowStringBuffer","ErrorCorrectionLevelValues","L","M","Q","H","ErrorCorrectionLevel","fromString","stringValue","forBits","FOR_BITS","FOR_VALUE","EncodeHintType","ERROR_CORRECTION","DATA_MATRIX_SHAPE","MIN_SIZE","MAX_SIZE","MARGIN","PDF417_COMPACT","PDF417_COMPACTION","PDF417_DIMENSIONS","AZTEC_LAYERS","QR_VERSION","AbstractExpandedDecoder_1","AI01decoder","encodeCompressedGtin","buf","currentPos","initialPosition","encodeCompressedGtinWithoutAI","initialBufferPosition","currentBlock","getGeneralDecoder","extractNumericValueFromBitArray","appendCheckDigit","checkDigit","GTIN_SIZE","information","ArgumentException","IndexOutOfBoundsException","UnsupportedOperationException","Result_1","BarcodeFormat_1","Decoder_1","Detector_1","AztecReader","exception","detector","getBlackMatrix","decoderResult","detectorResult","detectMirror","reportFoundResultPoints","rpcb_1","point","idx","arr","foundPossibleResultPoint","ArithmeticException","WhiteRectangleDetector","detect","leftInit","rightInit","up","upInit","down","downInit","sizeExceeded","aBlackPointFoundOnBorder","atLeastOneBlackPointFoundOnBorder","atLeastOneBlackPointFoundOnRight","atLeastOneBlackPointFoundOnBottom","atLeastOneBlackPointFoundOnLeft","atLeastOneBlackPointFoundOnTop","rightBorderNotWhite","containsBlackPoint","bottomBorderNotWhite","leftBorderNotWhite","topBorderNotWhite","maxSize","z","getBlackPointOnSegment","centerEdges","dist","xStep","yStep","yi","yj","zi","zj","xi","xj","ti","tj","CORR","fixed","horizontal","INIT_SIZE","initSize","halfsize","PerspectiveTransform","quadrilateralToQuadrilateral","x0","y0","x1","y1","x2","y2","x3","y3","x0p","y0p","x1p","y1p","x2p","y2p","x3p","y3p","qToS","quadrilateralToSquare","squareToQuadrilateral","times","transformPoints","a11","a12","a13","a21","a22","a23","a31","a32","a33","transformPointsWithValues","xValues","yValues","dx3","dy3","dx1","dx2","dy1","dy2","buildAdjoint","Code39Reader_1","Code128Reader_1","RSS14Reader_1","ITFReader_1","MultiFormatUPCEANReader_1","MultiFormatOneDReader","readers","possibleFormats","useCode39CheckDigit","includes","DataCharacter","getChecksumPortion","checksumPortion","that","BitMatrix_1","DataMatrixReader","has","extractPureBits","decoder","NO_POINTS","leftTopBlack","rightBottomBlack","moduleSize","matrixWidth","matrixHeight","nudge","iOffset","BitSource","getBitOffset","getByteOffset","byteOffset","readBits","available","bitsLeft","toRead","bitsToNotRead","QRCodeDecoderMetaData_1","QRCodeReader","getDecoder","decodeBitMatrix","applyMirroredCorrection","nudgedTooFarRight","nudgedTooFarDown","inBlack","transitions","FormatInformation_1","ECBlocks_1","ECB_1","Version","getVersionNumber","versionNumber","getAlignmentPatternCenters","alignmentPatternCenters","getTotalCodewords","totalCodewords","getDimensionForVersion","getECBlocksForLevel","ecBlocks","getProvisionalVersionForDimension","dimension","getVersionForNumber","VERSIONS","decodeVersionInformation","versionBits","bestDifference","bestVersion","VERSION_DECODE_INFO","targetVersion","bitsDifference","numBitsDiffering","buildFunctionPattern","bitMatrix","ecCodewords","getECCodewordsPerBlock","ecbArray","getECBlocks","ecbArray_1","ecbArray_1_1","ecBlock","getCount","getDataCodewords","Formatter","form","Symbol","iterator","EncodeHintType_1","ReedSolomonEncoder_1","Mode_1","Version_1","MaskUtil_1","ByteMatrix_1","QRCode_1","MatrixUtil_1","BlockPair_1","WriterException_1","Encoder","calculateMaskPenalty","applyMaskPenaltyRule1","applyMaskPenaltyRule2","applyMaskPenaltyRule3","applyMaskPenaltyRule4","content","DEFAULT_BYTE_MODE_ENCODING","hasEncodingHint","mode","chooseMode","headerBits","BYTE","eci","appendECI","appendModeInfo","version","dataBits","appendBytes","bitsNeeded","calculateBitsNeeded","willFit","recommendVersion","headerAndDataBits","numLetters","appendLengthInfo","numDataBytes","getTotalECCodewords","terminateBits","finalBits","interleaveWithECBytes","getNumBlocks","qrCode","setECLevel","setMode","setVersion","maskPattern","chooseMaskPattern","setMaskPattern","buildMatrix","setMatrix","provisionalBitsNeeded","provisionalVersion","chooseVersion","getCharacterCountBits","getAlphanumericCode","ALPHANUMERIC_TABLE","isOnlyDoubleByteKanji","KANJI","hasNumeric","hasAlphanumeric","isDigit","ALPHANUMERIC","NUMERIC","byte1","minPenalty","bestMaskPattern","NUM_MASK_PATTERNS","penalty","numInputBits","versionNum","capacity","numBitsInLastByte","numPaddingBytes","getNumDataBytesAndNumECBytesForBlockID","numTotalBytes","numRSBlocks","blockID","numDataBytesInBlock","numECBytesInBlock","numRsBlocksInGroup2","numRsBlocksInGroup1","numTotalBytesInGroup1","numTotalBytesInGroup2","numDataBytesInGroup1","numDataBytesInGroup2","numEcBytesInGroup1","numEcBytesInGroup2","dataBytesOffset","maxNumDataBytes","maxNumEcBytes","blocks","numEcBytesInBlock","dataBytes","ecBytes","generateECBytes","blocks_1","blocks_1_1","getDataBytes","error","E","return","blocks_2","blocks_2_1","getErrorCorrectionBytes","C","A","toEncode","appendNumericBytes","appendAlphanumericBytes","append8BitBytes","appendKanjiBytes","getDigit","singleCharacter","cn","num1","num2","num3","code1","code2","uee","length_2","subtracted","encoded","ECI","QRCode","getMode","getVersion","getMaskPattern","isValidMaskPattern","WriterException","DecodedObject","getNewPosition","newPosition","ReaderException_1","ReaderException","ReedSolomonException","Binarizer_1","Binarizer","BinaryBitmap","InvertedLuminanceSource_1","MultiFormatReader_1","MultiFormatReader","MultiFormatWriter_1","MultiFormatWriter","PlanarYUVLuminanceSource_1","PlanarYUVLuminanceSource","RGBLuminanceSource_1","RGBLuminanceSource","BitSource_1","DecoderResult_1","DefaultGridSampler","DetectorResult_1","GlobalHistogramBinarizer_1","GlobalHistogramBinarizer","GridSampler_1","GridSampler","GridSamplerInstance_1","HybridBinarizer","PerspectiveTransform_1","WhiteRectangleDetector_1","ReedSolomonDecoder_1","ReedSolomonEncoder","DataMatrixReader_1","QRCodeReader_1","QRCodeWriter_1","QRCodeWriter","ErrorCorrectionLevel_1","QRCodeDecoderErrorCorrectionLevel","Encoder_1","QRCodeEncoder","QRCodeEncoderQRCode","AztecReader_1","AztecCodeReader","EAN13Reader_1","EAN13Reader","Code128Reader","ITFReader","Code39Reader","RSS14Reader","RSSExpandedReader_1","RSSExpandedReader","MultiFormatOneDReader_1","MultiformatReader","binarizer","getLuminanceSource","newSource","createBinarizer","setPrototypeOf","__proto__","hasOwnProperty","constructor","MINIMUM_DIMENSION","luminances","subWidth","BLOCK_SIZE_POWER","BLOCK_SIZE_MASK","subHeight","blackPoints","calculateBlackPoints","newMatrix","calculateThresholdForBlock","maxYOffset","BLOCK_SIZE","maxXOffset","yoffset","top_1","cap","xoffset","blackRow","thresholdBlock","min","threshold","stride","yy","xx","pixel","MIN_DYNAMIC_RANGE","average","averageNeighborBlackPoint","initArrays","localLuminances","localBuckets","buckets","LUMINANCE_SHIFT","blackPoint","estimateBlackPoint","center","localLuminances_1","luminanceSize","LUMINANCE_BUCKETS","numBuckets","maxBucketCount","firstPeak","firstPeakSize","secondPeak","secondPeakScore","distanceToBiggest","score","bestValley","bestValleyScore","fromFirst","LUMINANCE_BITS","EMPTY","makeBufferFromCanvasImageData","imageData","getImageData","toGrayscaleBuffer","data","imageBuffer","grayscaleBuffer","gray","rotate","getTempCanvasElement","tempCanvasElement","ownerDocument","angle","tempContext","angleRadians","DEGREE_TO_RADIANS","newWidth","ceil","abs","cos","sin","newHeight","translate","PI","toJSON","AbstractGenericGF","Float","sampleGrid","dimensionX","dimensionY","p1ToX","p1ToY","p2ToX","p2ToY","p3ToX","p3ToY","p4ToX","p4ToY","p1FromX","p1FromY","p2FromX","p2FromY","p3FromX","p3FromY","p4FromX","p4FromY","transform","sampleGridWithTransform","Float32Array","iValue","checkAndNudgePoints","aioobe","nudged","theCounters","decodeRowResult","decodedChar","lastStart","findAsteriskPattern","toNarrowWidePattern","patternToChar","theCounters_1","theCounters_1_1","resultString","lastPatternSize","theCounters_2","theCounters_2_1","usingCheckDigit","ALPHABET_STRING","indexOf","extendedMode","decodeExtended","getTime","ASTERISK_ENCODING","copyWithin","wideCounters","maxNarrowCounter","minCounter","counters_1","counters_1_1","totalWideCountersWidth","CHARACTER_ENCODINGS","decoded","findStartPattern","startCode","CODE_START_A","CODE_START_C","CODE_PATTERNS","splice","decodeCode","codeSet","convertFNC1","startPatternInfo","currentRawCodesIndex","rawCodes","CODE_CODE_A","CODE_START_B","CODE_CODE_B","CODE_CODE_C","isNextShifted","lastCode","checksumTotal","multiplier","lastCharacterWasPrintable","upperMode","shiftUpperMode","unshift","CODE_STOP","reduce","previous","current","CODE_FNC_1","CODE_FNC_2","CODE_FNC_3","CODE_FNC_4_A","CODE_SHIFT","CODE_FNC_4_B","resultLength","rawCodesSize","AbstractRSSReader_1","Pair_1","FinderPattern_1","DataCharacter_1","RSSUtils_1","leftPair","decodePair","addOrTally","possibleLeftPairs","rightPair","possibleRightPairs","_c","_d","_e","_f","constructResult","possiblePairs","pair","found","possiblePairs_1","possiblePairs_1_1","incrementCount","symbolValue","leftPoints","getFinderPattern","rightPoints","checkValue","targetCheckValue","startEnd","findFinderPattern","parseFoundFinderPattern","resultPointCallback","outside","decodeDataCharacter","inside","outsideChar","getDataCharacterCounters","getStartEnd","numModules","elementWidth","oddCounts","getOddCounts","evenCounts","getEvenCounts","oddRoundingErrors","getOddRoundingErrors","evenRoundingErrors","getEvenRoundingErrors","adjustOddEvenCounts","oddSum","oddChecksumPortion","evenChecksumPortion","evenSum","evenWidest","oddWidest","OUTSIDE_ODD_WIDEST","group","vOdd","getRSSvalue","vEven","tEven","OUTSIDE_EVEN_TOTAL_SUBSET","gSum","OUTSIDE_GSUM","INSIDE_ODD_WIDEST","tOdd","INSIDE_ODD_TOTAL_SUBSET","INSIDE_GSUM","rightFinderPattern","getDecodeFinderCounters","isFinderPattern","firstIsBlack","firstElementStart","firstCounter","parseFinderValue","FINDER_PATTERNS","incrementOdd","decrementOdd","incrementEven","decrementEven","mismatch","oddParityBad","evenParityBad","increment","decrement","AbstractRSSReader","decodeFinderCounters","dataCharacterCounters","finderPatterns","errors","biggestError","firstTwoSum","ratio","MIN_FINDER_PATTERN_RATIO","MAX_FINDER_PATTERN_RATIO","maxCounter","FinderPattern","RSSUtils","widths","maxWidth","noNarrow","widths_1","widths_1_1","narrowMask","elements","bar","elmWidth","subVal","combins","lessVal","mxwElement","maxDenom","minDenom","decodeStart","endRange","decodeMiddle","allowedLengths","DEFAULT_ALLOWED_LENGTHS","lengthOK","maxAllowedLength","allowedLengths_1","allowedLengths_1_1","payloadStart","payloadEnd","counterDigitPair","counterBlack","counterWhite","twoK","counterDigit","skipWhiteSpace","startPattern","START_PATTERN","narrowLineWidth","validateQuietZone","quietCount","endPattern","END_PATTERN_REVERSED","PATTERNS","W","w","N","UPCEANReader_1","decodeMiddleCounters","lgPatternFound","L_AND_G_PATTERNS","determineFirstDigit","counters_2","counters_2_1","FIRST_DIGIT_ENCODINGS","UPCEANExtensionSupport_1","AbstractUPCEANReader_1","UPCEANReader","startGuardRange","resultPoint_1","budello","resultPoint_2","resultPoint_3","quietEnd","resultPoint","decodeResult","extensionLength","extensionResult","allowedExtensions","valid","reversedWidths","PDF417Reader_1","setHints","decodeInternal","decodeWithState","formats","addOneDReader","some","ex","FormatInformation","decodeFormatInformation","maskedFormatInfo1","maskedFormatInfo2","formatInfo","doDecodeFormatInformation","FORMAT_INFO_MASK_QR","bestFormatInfo","FORMAT_INFO_DECODE_LOOKUP","decodeInfo","targetInfo","getErrorCorrectionLevel","errorCorrectionLevel","getDataMask","dataMask","QRCodeDecoderMetaData","isMirrored","mirrored","bottomLeft","ModeValues","TERMINATOR","STRUCTURED_APPEND","FNC1_FIRST_POSITION","FNC1_SECOND_POSITION","HANZI","Mode","characterCountBitsForVersions","PDF417Common_1","PDF417ScanningDecoder_1","PDF417Reader","decodeMultiple","multiple","results","detectMultiple","getMinCodewordWidth","getMaxCodewordWidth","pdf417ResultMetadata","getMaxWidth","getMinWidth","p","ModulusPoly","add","subtract","negative","multiplyOther","negativeCoefficients","BoundingBox","constructor_1","topLeft","topRight","bottomRight","leftUnspecified","rightUnspecified","minX","maxX","minY","maxY","constructor_2","boundingBox","getTopLeft","getBottomLeft","getTopRight","getBottomRight","getMinX","getMaxX","getMinY","getMaxY","merge","leftBox","rightBox","addMissingRows","missingStartRows","missingEndRows","isLeft","newTopLeft","newBottomLeft","newTopRight","newBottomRight","newMinY","newTop","newMaxY","newBottom","Formatter_1","BoundingBox_1","DetectionResultColumn","getCodewordNearby","imageRow","codeword","MAX_NEARBY_DISTANCE","nearImageRow","imageRowToCodewordIndex","codewords","setCodeword","getBoundingBox","getCodewords","formatter","getRowNumber","BarcodeValue","setValue","confidence","entry","maxConfidence","entries","__read","getConfidence","buildGenerator","cachedGenerators","lastGenerator","nextGenerator","generator","infoCoefficients","info","numZeroCoefficients","MaskUtil","applyMaskPenaltyRule1Internal","getArray","arrayY","N2","numPenalties","isWhiteHorizontal","isWhiteVertical","N3","col","numDarkCells","numTotalCells","N4","getDataMaskBit","intermediate","isHorizontal","iLimit","jLimit","numSameBitCells","prevBit","N1","contents","quietZone","QUIET_ZONE_SIZE","renderResult","input","inputWidth","inputHeight","qrWidth","qrHeight","outputWidth","outputHeight","leftPadding","topPadding","output","inputY","outputY","inputX","outputX","DecodedChar_1","DecodedNumeric_1","DecodedInformation_1","FieldParser_1","BlockParsedResult_1","GeneralAppIdDecoder","decodeAllCodes","buff","currentPosition","remaining","decodeGeneralPurposeField","parsedFields","parseFieldsInGeneralPurpose","getNewString","isRemaining","getRemainingValue","isStillNumeric","decodeNumeric","numeric_1","FNC1","numeric","digit1","digit2","setPosition","lastDecoded","parseBlocks","getPosition","isFinished","isAlpha","parseAlphaBlock","isIsoIec646","parseIsoIec646Block","parseNumericBlock","getDecodedInformation","isFirstDigitFNC1","isSecondDigitFNC1","getSecondDigit","getFirstDigit","isNumericToAlphaNumericLatch","setAlpha","incrementPosition","isStillIsoIec646","iso","decodeIsoIec646","isFNC1","isAlphaOr646ToNumericLatch","setNumeric","isAlphaTo646ToAlphaLatch","isStillAlpha","alpha","decodeAlphanumeric","setIsoIec646","fiveBitValue","sevenBitValue","eightBitValue","sixBitValue","GeneralAppIdDecoder_1","AbstractExpandedDecoder","getInformation","generalDecoder","AI01weightDecoder_1","AI013x0xDecoder","parseInformation","HEADER_SIZE","WEIGHT_SIZE","encodeCompressedWeight","AI01decoder_1","AI01weightDecoder","weightSize","originalWeightNumeric","addWeightCode","weightNumeric","checkWeight","currentDivisor","__export","BrowserCodeReader_1","BrowserAztecCodeReader","fixStack","target","fn","captureStackTrace","extendStatics","_newTarget","__","customErrorFactory","parent","bind","concat","defineProperties","writable","IndexOutOfBoundsException_1","ArrayIndexOutOfBoundsException","Table","__1","UPPER","LOWER","MIXED","DIGIT","PUNCT","BINARY","Decoder","ddata","rawbits","extractBits","correctedBits","correctBits","convertBoolArrayToByteArray","getEncodedData","highLevelDecode","endIndex","latchTable","shiftTable","readCode","charCount","getCharacter","startsWith","getTable","table","UPPER_TABLE","LOWER_TABLE","MIXED_TABLE","PUNCT_TABLE","DIGIT_TABLE","gf","codewordSize","getNbLayers","numDataCodewords","getNbDatablocks","numCodewords","dataWords","stuffedBits","dataWord","compact","isCompact","layers","baseMatrixSize","alignmentMap","totalBitsInLayer","matrixSize","origCenter","newOffset","low","high","columnOffset","startIndex","res","readByte","boolArr","byteArr","AztecDetectorResult_1","Point","toResultPoint","Detector","isMirror","pCenter","getMatrixCenter","bullsEyeCorners","getBullsEyeCorners","extractParameters","shift","corners","getMatrixCornerPoints","nbDataBlocks","nbLayers","isValidPoint","nbCenterLayers","sides","sampleLine","getRotation","parameterData","side","correctedData","getCorrectedParameterData","cornerBits","EXPECTED_CORNER_BITS","numECCodewords","parameterWords","pina","pinb","pinc","pind","color","pouta","getFirstDifferent","poutb","poutc","poutd","distancePoint","isWhiteOrBlackRectangle","pinax","pinbx","pincx","pindx","expandSquare","pointD","cornerPoints","cx_1","cy_1","cx","cy","getDimension","sampler","distanceResultPoint","px","py","dx","dy","cInit","getColor","colorModel","iMax","errRatio","init","isValid","oldSide","newSide","centerx","centery","result0","result2","AztecDetectorResult","nbDatablocks","BrowserBarcodeReader","Pair","finderPattern","EAN8Reader_1","MultiFormatUPCEANReader","UPCEANExtension5Support_1","UPCEANExtension2Support_1","UPCEANExtensionSupport","extensionStartRange","EXTENSION_START_PATTERN","UPCEANExtension5Support","extensionData","parseExtensionString","determineCheckDigit","extensionChecksum","CHECK_DIGIT_ENCODINGS","raw","parseExtension5String","currency","rawAmount","hundredths","UPCEANExtension2Support","checkParity","g","EAN8Reader","BrowserDatamatrixCodeReader","BitMatrixParser_1","DataBlock_1","DecodedBitStreamParser_1","parser","readCodewords","dataBlocks","getDataBlocks","totalBytes","dataBlocks_1","dataBlocks_1_1","getNumDataCodewords","resultBytes","dataBlocksCount","dataBlock","codewordBytes","correctErrors","codewordsInts","rsDecoder","BitMatrixParser","readVersion","numRows","numColumns","getVersionForDimensions","Int8Array","resultOffset","column","mappingBitMatrix","corner1Read","corner2Read","corner3Read","corner4Read","readMappingMatrix","readUtah","readCorner4","readCorner3","readCorner2","readCorner1","readModule","currentByte","extractDataRegion","symbolSizeRows","getSymbolSizeRows","symbolSizeColumns","getSymbolSizeColumns","dataRegionSizeRows","getDataRegionSizeRows","dataRegionSizeColumns","getDataRegionSizeColumns","numDataRegionsRow","numDataRegionsColumn","sizeDataRegionRow","sizeDataRegionColumn","bitMatrixWithoutAlignment","dataRegionRow","dataRegionRowOffset","dataRegionColumn","dataRegionColumnOffset","readRowOffset","writeRowOffset","readColumnOffset","writeColumnOffset","ECBlocks","getECCodewords","ecBlocks1","ecBlocks2","ECB","dataCodewords","buildVersions","DataBlock","rawCodewords","totalBlocks","ecBlockArray","ecBlockArray_1","ecBlockArray_1_1","numResultBlocks","ecBlockArray_2","ecBlockArray_2_1","numBlockCodewords","longerBlocksNumDataCodewords","shorterBlocksNumDataCodewords","rawCodewordsOffset","specialVersion","numLongerBlocks","jOffset","PAD_ENCODE","ASCII_ENCODE","C40_ENCODE","TEXT_ENCODE","ANSIX12_ENCODE","EDIFACT_ENCODE","BASE256_ENCODE","DecodedBitStreamParser","resultTrailer","decodeAsciiSegment","decodeC40Segment","decodeTextSegment","decodeAnsiX12Segment","decodeEdifactSegment","decodeBase256Segment","upperShift","oneByte","cValues","firstByte","parseTwoBytes","cValue","C40_BASIC_SET_CHARS","c40char","C40_SHIFT2_SET_CHARS","TEXT_BASIC_SET_CHARS","textChar","TEXT_SHIFT2_SET_CHARS","TEXT_SHIFT3_SET_CHARS","secondByte","fullBitValue","edifactValue","codewordPosition","d1","unrandomize255State","randomizedBase256Codeword","base256CodewordPosition","tempVariable","rectangleDetector","detectSolid1","detectSolid2","correctTopRight","shiftToModuleCenter","dimensionTop","transitionsBetween","dimensionRight","shiftPoint","div","moveAway","fromX","fromY","trAB","trBC","trCD","trDA","tr","pointBs","pointCs","trTop","trRight","pointAs","candidate1","candidate2","sumc1","dimH","dimV","pointDs","centerX","centerY","toX","toY","steep","ystep","xstep","isBlack","BrowserMultiFormatReader","decodeBooleanArray","decodeBitMatrixParser","remask","setMirror","readFormatInformation","mirror","dataBlocks_2","dataBlocks_2_1","DataMask_1","parsedFormatInfo","formatInfoBits1","copyBit","formatInfoBits2","jMin","parsedVersion","ijMin","theParsedVersion","unmaskBitMatrix","functionPattern","readingUp","bitsRead","ecCodewordsPerBlock","ecBlocks_1","ecBlocks_1_1","DataMaskValues","DATA_MASK_000","DATA_MASK_001","DATA_MASK_010","DATA_MASK_011","DATA_MASK_100","DATA_MASK_101","DATA_MASK_110","DATA_MASK_111","DataMask","isMasked","shorterBlocksTotalCodewords","longerBlocksStartAt","symbolSequence","parityData","currentCharacterSetECI","fc1InEffect","modeBits","parseECIValue","subset","countHanzi","GB2312_SUBSET","decodeHanziSegment","decodeNumericSegment","decodeAlphanumericSegment","decodeByteSegment","decodeKanjiSegment","iae","twoBytes","assembledTwoBytes","readBytes","toAlphaNumericChar","ALPHANUMERIC_CHARS","nextTwoCharsBits","threeDigitsBits","twoDigitsBits","digitBits","FinderPatternFinder_1","AlignmentPatternFinder_1","getImage","getResultPointCallback","processFinderPatternInfo","calculateModuleSize","computeDimension","modulesBetweenFPCenters","alignmentPattern","bottomRightX","bottomRightY","correctionToTopLeft","estAlignmentX","estAlignmentY","findAlignmentInRegion","createTransform","sourceBottomRightX","sourceBottomRightY","dimMinusThree","tltrCentersDimension","tlblCentersDimension","calculateModuleSizeOneWay","otherPattern","moduleSizeEst1","sizeOfBlackWhiteBlackRunBothWays","moduleSizeEst2","isNaN","sizeOfBlackWhiteBlackRun","otherToX","otherToY","state","xLimit","realX","realY","overallEstModuleSize","allowanceFactor","allowance","alignmentAreaLeftX","alignmentAreaRightX","alignmentAreaTopY","alignmentAreaBottomY","FinderPatternInfo_1","FinderPatternFinder","getPossibleCenters","possibleCenters","pureBarcode","maxI","maxJ","iSkip","MAX_MODULES","MIN_SKIP","stateCount","currentState","foundPatternCross","handlePossibleCenter","hasSkipped","haveMultiplyConfirmedCenters","rowSkip","findRowSkip","patternInfo","selectBestPatterns","centerFromEnd","totalModuleSize","maxVariance","getCrossCheckStateCount","crossCheckStateCount","crossCheckDiagonal","startI","centerJ","maxCount","originalStateCountTotal","stateCountTotal","crossCheckVertical","crossCheckHorizontal","startJ","centerI","estimatedModuleSize","aboutEquals","combineEstimate","firstConfirmedCenter","CENTER_QUORUM","confirmedCount","getEstimatedModuleSize","totalDeviation","startSize","square","stdDev","sort","center1","center2","dA","dB","limit","possibleCenters_1","possibleCenters_1_1","moduleSizeDiff","newModuleSize","combinedCount","posX","posY","FinderPatternInfo","patternCenters","AlignmentPattern_1","AlignmentPatternFinder","startX","middleI","startY","iGen","confirmed","AlignmentPattern","PDF417DetectorResult_1","barcodeCoordinates","foundBarcodeInRow","vertices","findVertices","barcodeCoordinates_1","barcodeCoordinates_1_1","barcodeCoordinate","ROW_STEP","startRow","startColumn","copyToResult","findRowsWithPattern","INDEXES_START_PATTERN","STOP_PATTERN","INDEXES_STOP_PATTERN","tmpResult","destinationIndexes","loc","previousRowLoc","stopRow","skippedRowCount","MAX_PATTERN_DRIFT","SKIPPED_ROW_COUNT_MAX","BARCODE_MIN_HEIGHT","pixelDrift","MAX_PIXEL_DRIFT","Infinity","PDF417DetectorResult","ErrorCorrection_1","DetectionResultRowIndicatorColumn_1","DetectionResult_1","DetectionResultColumn_1","Codeword_1","BarcodeValue_1","PDF417CodewordDecoder_1","PDF417ScanningDecoder","imageTopLeft","imageBottomLeft","imageTopRight","imageBottomRight","minCodewordWidth","maxCodewordWidth","detectionResult","leftRowIndicatorColumn","rightRowIndicatorColumn","firstPass","getRowIndicatorColumn","resultBox","setBoundingBox","maxBarcodeColumn","getBarcodeColumnCount","setDetectionResultColumn","leftToRight","barcodeColumnCount","barcodeColumn","getDetectionResultColumn","detectionResultColumn","previousStartColumn","getStartColumn","detectCodeword","createDecoderResult","barcodeMetadata","getBarcodeMetadata","adjustBoundingBox","rowIndicatorColumn","rowHeights","getRowHeights","maxRowHeight","getMax","rowHeights_1","rowHeights_1_1","rowHeight","maxValue","values_1","values_1_1","leftBarcodeMetadata","rightBarcodeMetadata","getColumnCount","getRowCount","startPoint","getStartX","getEndX","adjustCodewordCount","barcodeMatrix","barcodeMatrix01","numberOfCodewords","calculatedNumberOfCodewords","getBarcodeRowCount","getNumberOfECCodeWords","getBarcodeECLevel","createBarcodeMatrix","ambiguousIndexValuesList","ambiguousIndexesList","codewordIndex","ambiguousIndexValues","createDecoderResultFromAmbiguousValues","erasureArray","ambiguousIndexes","ambiguousIndexCount","tries","decodeCodewords","column_1","getDetectionResultColumns","isValidBarcodeColumn","skippedColumns","previousRowCodeword","minColumn","maxColumn","adjustCodewordStartColumn","endColumn","getModuleBitCount","codewordBitCount","tmpCount","checkCodewordSkew","decodedValue","getDecodedValue","getCodewordBucketNumber","imageColumn","moduleNumber","previousPixelValue","barcodeECLevel","codewordStartColumn","correctedStartColumn","CODEWORD_SKEW_SIZE","correctedErrorsCount","verifyCodewordCount","MAX_ERRORS","MAX_EC_CODEWORDS","errorCorrection","getBitCountForCodeword","previousValue","getCodewordBucketNumber_Int32Array","getCodewordBucketNumber_number","barcodeValue","ModulusPoly_1","ModulusGF_1","ErrorCorrection","S","evaluation","knownErrors","erasures_1","erasures_1_1","erasure","errorLocatorDegree","formalDerivativeCoefficients","formalDerivative","numerator","PDF417_GF","ModulusBase_1","ModulusGF","modulus","ModulusBase","BarcodeMetadata_1","DetectionResultRowIndicatorColumn","setRowNumbers","setRowNumberAsRowIndicatorColumn","adjustCompleteIndicatorColumnRowNumbers","removeIncorrectCodewords","_isLeft","firstRow","lastRow","barcodeRow","currentRowHeight","codewordsRow","rowDifference","checkedRows","closePreviousCodewordFound","adjustIncompleteIndicatorColumnRowNumbers","barcodeRowCountUpperPart","barcodeRowCountLowerPart","codewords_1","codewords_1_1","rowIndicatorValue","codewordRowNumber","codewordRow","getRowCountUpperPart","getRowCountLowerPart","BarcodeMetadata","columnCount","rowCount","rowCountUpperPart","rowCountLowerPart","DetectionResult","adjustIndicatorColumnRowNumbers","detectionResultColumns","previousUnadjustedCount","unadjustedCodewordCount","adjustRowNumbersAndGetCount","unadjustedCount","adjustRowNumbersByRow","hasValidRowNumber","adjustRowNumbers","adjustRowNumbersFromBothRI","adjustRowNumbersFromLRI","adjustRowNumbersFromRRI","LRIcodewords","RRIcodewords","setRowNumber","rowIndicatorRowNumber","invalidRowCounts","ADJUST_ROW_NUMBER_SKIP","adjustRowNumberIfValid","isValidRowNumber","previousColumnCodewords","nextColumnCodewords","otherCodewords","otherCodewords_1","otherCodewords_1_1","otherCodeword","adjustRowNumber","getBucket","Codeword","BARCODE_ROW_UNKNOWN","bucket","endX","PDF417CodewordDecoder","initialize","currentSymbol","currentBit","RATIOS_TABLE","fround","bSymbolTableReady","getDecodedCodewordValue","sampleBitCounts","getClosestDecodedValue","bitCountSum","bitCountIndex","sumPreviousBits","sampleIndex","getBitValue","bitCountRatios","bestMatchError","ratioTableRow","diff","BigInteger","PDF417ResultMetadata_1","Long_1","ByteArrayOutputStream_1","getBigIntConstructor","BigInt","global","createBigInt","ALPHA","ALPHA_SHIFT","PUNCT_SHIFT","codeIndex","TEXT_COMPACTION_MODE_LATCH","textCompaction","BYTE_COMPACTION_MODE_LATCH","BYTE_COMPACTION_MODE_LATCH_6","byteCompaction","MODE_SHIFT_TO_BYTE_COMPACTION_MODE","NUMERIC_COMPACTION_MODE_LATCH","numericCompaction","ECI_CHARSET","ECI_GENERAL_PURPOSE","ECI_USER_DEFINED","BEGIN_MACRO_PDF417_CONTROL_BLOCK","decodeMacroBlock","BEGIN_MACRO_PDF417_OPTIONAL_FIELD","MACRO_PDF417_TERMINATOR","NUMBER_OF_SEQUENCE_CODEWORDS","segmentIndexArray","setSegmentIndex","decodeBase900toBase10","fileId","setFileId","optionalFieldsStart","MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME","fileName","setFileName","MACRO_PDF417_OPTIONAL_FIELD_SENDER","sender","setSender","MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE","addressee","setAddressee","MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT","segmentCount","setSegmentCount","MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP","setTimestamp","parseLong","MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM","checksum","setChecksum","MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE","fileSize","setFileSize","setLastSegment","optionalFieldsLength","isLastSegment","setOptionalData","textCompactionData","byteCompactionData","decodeTextCompaction","subMode","priorToShiftMode","subModeCh","LL","ML","PS","AS","PL","MIXED_CHARS","AL","PAL","PUNCT_CHARS","decodedBytes","byteCompactedCodewords","nextCode","write","toByteArray","numericCodewords","MAX_NUMERIC_CODEWORDS","EXP900","nineHundred","Function","PDF417ResultMetadata","getSegmentIndex","segmentIndex","getFileId","getOptionalData","optionalData","lastSegment","getSegmentCount","getSender","getAddressee","getFileName","getFileSize","getChecksum","Long","OutputStream_1","OutOfMemoryError_1","ByteArrayOutputStream","minCapacity","grow","newCapacity","writeBytesOffset","off","writeTo","out","param","toString_string","toString_number","toString_void","charsetName","hibyte","close","NullPointerException_1","OutputStream","writeBytes","flush","NullPointerException","OutOfMemoryError","BrowserPDF417Reader","BrowserQRCodeReader","BrowserQRCodeSvgWriter","writeToDom","containerElement","querySelector","svgElement","appendChild","createSVGElement","svgRectElement","createSvgRectElement","createElementNS","SVG_NS","setAttributeNS","rect","ByteMatrix","setNumber","setBoolean","aByte","bytesY","otherBytesY","MatrixUtil","clearMatrix","embedBasicPatterns","embedTypeInfo","maybeEmbedVersionInfo","embedDataBits","embedPositionDetectionPatternsAndSeparators","embedDarkDotAtLeftBottomCorner","maybeEmbedPositionAdjustmentPatterns","embedTimingPatterns","typeInfoBits","makeTypeInfoBits","coordinates","TYPE_INFO_COORDINATES","versionInfoBits","makeVersionInfoBits","bitIndex","direction","isEmpty","findMSBSet","calculateBCHCode","msbSetInPoly","typeInfo","bchCode","TYPE_INFO_POLY","maskBits","TYPE_INFO_MASK_PATTERN","VERSION_INFO_POLY","embedHorizontalSeparationPattern","xStart","yStart","embedVerticalSeparationPattern","embedPositionAdjustmentPattern","patternY","POSITION_ADJUSTMENT_PATTERN","embedPositionDetectionPattern","POSITION_DETECTION_PATTERN","pdpWidth","hspWidth","POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE","BlockPair","errorCorrectionBytes","writer","dataWidth","yuvData","dataHeight","area","inputOffset","outputOffset","renderThumbnail","THUMBNAIL_SCALE_FACTOR","pixels","yuv","grey","getThumbnailWidth","getThumbnailHeight","reverseHorizontal","rowStart","BYTES_PER_ELEMENT","luminancesUint8Array","g2","AbstractExpandedDecoderComplement_1","ExpandedPair_1","ExpandedRow_1","BitArrayBuilder_1","pairs","startFromEven","decodeRow2pairs","tryStackedDecode","retrieveNextPair","storeRow","ps","checkRowsBoolean","checkRows","collectedRows","currentRow","collectedRows_1","collectedRows_1_1","collectedRow","getPairs","isValidSequence","rs","FINDER_PATTERN_SEQUENCES","sequence","stop_1","wasReversed","insertPos","prevIsSame","nextIsSame","erow","isEquivalent","isPartialRow","removePartialRows","rows_1","rows_1_1","pairs_1","pairs_1_1","pp","rows_2","rows_2_1","allFound","pairs_2","pairs_2_1","getRows","binary","buildBitArray","resultingString","createDecoder","firstPoints","lastPoints","firstPair","checkCharacter","getLeftChar","firstCharacter","getRightChar","currentPair","currentRightChar","getNextSecondBar","initialPos","previousPairs","isOddPattern","keepFinding","forcedOffset","findNextPair","rightChar","leftChar","isEmptyPair","mustBeLast","searchingEvenPair","reverseCounters","tmp","oddPattern","expectedElementWidth","value_1","weightRowNumber","isNotA1left","weight","WEIGHTS","SYMBOL_WIDEST","EVEN_TOTAL_SUBSET","GSUM","FINDER_PAT_A","FINDER_PAT_B","FINDER_PAT_C","FINDER_PAT_D","FINDER_PAT_E","FINDER_PAT_F","MAX_PAIRS","AI01AndOtherAIs_1","AnyAIDecoder_1","AI013103decoder_1","AI01320xDecoder_1","AI01392xDecoder_1","AI01393xDecoder_1","AI013x0x1xDecoder_1","DecodedObject_1","DecodedChar","DecodedNumeric","firstDigit","secondDigit","isAnyFNC1","DecodedInformation","newString","remainingValue","FieldParser","rawInformation","firstTwoDigits","TWO_DIGIT_DATA_LENGTH","dataLength","VARIABLE_LENGTH","processVariableAI","processFixedAI","firstThreeDigits","_g","THREE_DIGIT_DATA_LENGTH","_h","_j","THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH","_k","firstFourDigits","_l","FOUR_DIGIT_DATA_LENGTH","_m","aiSize","fieldSize","ai","parsedAI","variableFieldSize","BlockParsedResult","decodedInformation","finished","AI01AndOtherAIs","initialGtinPosition","firstGtinDigit","AnyAIDecoder","AI013x0xDecoder_1","AI013103decoder","AI01320xDecoder","AI01392xDecoder","lastAIdigit","LAST_DIGIT_SIZE","AI01393xDecoder","FIRST_THREE_DIGITS_SIZE","generalInformation","AI013x0x1xDecoder","DATE_SIZE","encodeCompressedDate","numericDate","dateCode","day","month","year","firstAIdigits","ExpandedPair","mayBeLast","maybeLast","leftchar","rightchar","finderpattern","o1","o2","equalsOrNull","hashNotNull","finderPatter","ExpandedRow","isReversed","otherPairs","checkEqualitity","pair1","pair2","e1","e2","getFinderPatter","BitArrayBuilder","charNumber","accPos","firstValue","leftValue","rightValue","getter","toStringTag","__esModule","ns","object","property","moduleId","modules"],"mappings":"CAAA,SAAAA,EAAAC,GACA,iBAAAC,SAAA,iBAAAC,OACAA,OAAAD,QAAAD,IACA,mBAAAG,eAAAC,IACAD,OAAA,WAAAH,G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,IA9EA,SAAAhE,EAAAy5F,GAGA,GAAA15F,EAAA05F,GACA,OAAA15F,EAAA05F,GAAAh6F,QAGA,IAAAC,EAAAK,EAAA05F,GAAA,CACAjwF,EAAAiwF,EACAhlF,KACAhV,QAAA,IAUA,OANAi6F,EAAAD,GAAA1zF,KAAArG,EAAAD,QAAAC,IAAAD,QAAAO,GAGAN,EAAA+U,KAGA/U,EAAAD,cAvBAM","file":"index.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"ZXing\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"ZXing\"] = factory();\n\telse\n\t\troot[\"ZXing\"] = factory();\n})(window, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 92);\n","import Exception from './Exception';\n\n/**\n * Custom Error class of type Exception.\n */\nexport default class NotFoundException extends Exception {\n static getNotFoundInstance(): NotFoundException {\n return new NotFoundException();\n }\n}\n","import Exception from './Exception';\n\n/**\n * Custom Error class of type Exception.\n */\nexport default class IllegalArgumentException extends Exception {}\n","import Exception from './Exception';\n\n/**\n * Custom Error class of type Exception.\n */\nexport default class FormatException extends Exception {\n\n static getFormatInstance(): FormatException {\n return new FormatException();\n }\n}\n","/*\n * Direct port to TypeScript of ZXing by Adrian Toșcă\n */\n\n/*\n * Copyright 2009 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*namespace com.google.zxing {*/\n\n/**\n * Enumerates barcode formats known to this package. Please keep alphabetized.\n *\n * @author Sean Owen\n */\nenum BarcodeFormat {\n /** Aztec 2D barcode format. */\n AZTEC,\n\n /** CODABAR 1D format. */\n CODABAR,\n\n /** Code 39 1D format. */\n CODE_39,\n\n /** Code 93 1D format. */\n CODE_93,\n\n /** Code 128 1D format. */\n CODE_128,\n\n /** Data Matrix 2D barcode format. */\n DATA_MATRIX,\n\n /** EAN-8 1D format. */\n EAN_8,\n\n /** EAN-13 1D format. */\n EAN_13,\n\n /** ITF (Interleaved Two of Five) 1D format. */\n ITF,\n\n /** MaxiCode 2D barcode format. */\n MAXICODE,\n\n /** PDF417 format. */\n PDF_417,\n\n /** QR Code 2D barcode format. */\n QR_CODE,\n\n /** RSS 14 */\n RSS_14,\n\n /** RSS EXPANDED */\n RSS_EXPANDED,\n\n /** UPC-A 1D format. */\n UPC_A,\n\n /** UPC-E 1D format. */\n UPC_E,\n\n /** UPC/EAN extension format. Not a stand-alone format. */\n UPC_EAN_EXTENSION\n\n}\n\nexport default BarcodeFormat;\n","/*\n * Copyright 2007 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*namespace com.google.zxing {*/\n\nimport MathUtils from './common/detector/MathUtils';\nimport Float from './util/Float';\nimport { float, int } from '../customTypings';\n\n/**\n *

Encapsulates a point of interest in an image containing a barcode. Typically, this\n * would be the location of a finder pattern or the corner of the barcode, for example.

\n *\n * @author Sean Owen\n */\nexport default class ResultPoint {\n\n public constructor(private x: float, private y: float) { }\n\n public getX(): float {\n return this.x;\n }\n\n public getY(): float {\n return this.y;\n }\n\n /*@Override*/\n public equals(other: Object): boolean {\n if (other instanceof ResultPoint) {\n const otherPoint = other;\n return this.x === otherPoint.x && this.y === otherPoint.y;\n }\n return false;\n }\n\n /*@Override*/\n public hashCode(): int {\n return 31 * Float.floatToIntBits(this.x) + Float.floatToIntBits(this.y);\n }\n\n /*@Override*/\n public toString(): string {\n return '(' + this.x + ',' + this.y + ')';\n }\n\n /**\n * Orders an array of three ResultPoints in an order [A,B,C] such that AB is less than AC\n * and BC is less than AC, and the angle between BC and BA is less than 180 degrees.\n *\n * @param patterns array of three {@code ResultPoint} to order\n */\n public static orderBestPatterns(patterns: Array): void {\n\n // Find distances between pattern centers\n const zeroOneDistance = this.distance(patterns[0], patterns[1]);\n const oneTwoDistance = this.distance(patterns[1], patterns[2]);\n const zeroTwoDistance = this.distance(patterns[0], patterns[2]);\n\n let pointA: ResultPoint;\n let pointB: ResultPoint;\n let pointC: ResultPoint;\n // Assume one closest to other two is B; A and C will just be guesses at first\n if (oneTwoDistance >= zeroOneDistance && oneTwoDistance >= zeroTwoDistance) {\n pointB = patterns[0];\n pointA = patterns[1];\n pointC = patterns[2];\n } else if (zeroTwoDistance >= oneTwoDistance && zeroTwoDistance >= zeroOneDistance) {\n pointB = patterns[1];\n pointA = patterns[0];\n pointC = patterns[2];\n } else {\n pointB = patterns[2];\n pointA = patterns[0];\n pointC = patterns[1];\n }\n\n // Use cross product to figure out whether A and C are correct or flipped.\n // This asks whether BC x BA has a positive z component, which is the arrangement\n // we want for A, B, C. If it's negative, then we've got it flipped around and\n // should swap A and C.\n if (this.crossProductZ(pointA, pointB, pointC) < 0.0) {\n const temp = pointA;\n pointA = pointC;\n pointC = temp;\n }\n\n patterns[0] = pointA;\n patterns[1] = pointB;\n patterns[2] = pointC;\n }\n\n /**\n * @param pattern1 first pattern\n * @param pattern2 second pattern\n * @return distance between two points\n */\n public static distance(pattern1: ResultPoint, pattern2: ResultPoint): float {\n return MathUtils.distance(pattern1.x, pattern1.y, pattern2.x, pattern2.y);\n }\n\n /**\n * Returns the z component of the cross product between vectors BC and BA.\n */\n private static crossProductZ(pointA: ResultPoint,\n pointB: ResultPoint,\n pointC: ResultPoint): float {\n const bX = pointB.x;\n const bY = pointB.y;\n return ((pointC.x - bX) * (pointA.y - bY)) - ((pointC.y - bY) * (pointA.x - bX));\n }\n\n}\n","import CharacterSetECI from '../common/CharacterSetECI';\nimport StringEncoding from './StringEncoding';\nimport { int } from '../../customTypings';\nimport StringUtils from '../common/StringUtils';\n\n\nexport default class StringBuilder {\n\n private encoding: CharacterSetECI;\n\n public constructor(private value: string = '') {}\n\n public enableDecoding(encoding: CharacterSetECI): StringBuilder {\n this.encoding = encoding;\n return this;\n }\n\n public append(s: string | number): StringBuilder {\n if (typeof s === 'string') {\n this.value += s.toString();\n } else if (this.encoding) {\n // use passed format (fromCharCode will return UTF8 encoding)\n this.value += StringUtils.castAsNonUtf8Char(s, this.encoding);\n } else {\n // correctly converts from UTF-8, but not other encodings\n this.value += String.fromCharCode(s);\n }\n return this;\n }\n\n public length(): number {\n return this.value.length;\n }\n\n public charAt(n: number): string {\n return this.value.charAt(n);\n }\n\n public deleteCharAt(n: number) {\n this.value = this.value.substr(0, n) + this.value.substring(n + 1);\n }\n\n public setCharAt(n: number, c: string) {\n this.value = this.value.substr(0, n) + c + this.value.substr(n + 1);\n }\n\n public substring(start: int, end: int): string {\n return this.value.substring(start, end);\n }\n\n /**\n * @note helper method for RSS Expanded\n */\n public setLengthToZero(): void {\n this.value = \"\";\n }\n\n public toString(): string {\n return this.value;\n }\n\n public insert(n: number, c: string) {\n this.value = this.value.substr(0, n) + c + this.value.substr(n + c.length);\n }\n}\n","export default class System {\n\n // public static void arraycopy(Object src, int srcPos, Object dest, int destPos, int length)\n /**\n * Makes a copy of a array.\n */\n public static arraycopy(src: any, srcPos: number, dest: any, destPos: number, length: number): void {\n // TODO: better use split or set?\n while (length--) {\n dest[destPos++] = src[srcPos++];\n }\n }\n\n /**\n * Returns the current time in milliseconds.\n */\n public static currentTimeMillis(): number {\n return Date.now();\n }\n}\n","import { CustomError } from 'ts-custom-error';\n\n/**\n * Custom Error class of type Exception.\n */\nexport default class Exception extends CustomError {\n\n /**\n * Allows Exception to be constructed directly\n * with some message and prototype definition.\n */\n constructor(\n public message: string = undefined\n ) {\n super(message);\n }\n}\n","/*\n * Copyright 2009 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*namespace com.google.zxing {*/\n\n/**\n * Encapsulates a type of hint that a caller may pass to a barcode reader to help it\n * more quickly or accurately decode it. It is up to implementations to decide what,\n * if anything, to do with the information that is supplied.\n *\n * @author Sean Owen\n * @author dswitkin@google.com (Daniel Switkin)\n * @see Reader#decode(BinaryBitmap,java.util.Map)\n */\nenum DecodeHintType {\n\n /**\n * Unspecified, application-specific hint. Maps to an unspecified {@link Object}.\n */\n OTHER/*(Object.class)*/,\n\n /**\n * Image is a pure monochrome image of a barcode. Doesn't matter what it maps to;\n * use {@link Boolean#TRUE}.\n */\n PURE_BARCODE/*(Void.class)*/,\n\n /**\n * Image is known to be of one of a few possible formats.\n * Maps to a {@link List} of {@link BarcodeFormat}s.\n */\n POSSIBLE_FORMATS/*(List.class)*/,\n\n /**\n * Spend more time to try to find a barcode; optimize for accuracy, not speed.\n * Doesn't matter what it maps to; use {@link Boolean#TRUE}.\n */\n TRY_HARDER/*(Void.class)*/,\n\n /**\n * Specifies what character encoding to use when decoding, where applicable (type String)\n */\n CHARACTER_SET/*(String.class)*/,\n\n /**\n * Allowed lengths of encoded data -- reject anything else. Maps to an {@code Int32Array}.\n */\n ALLOWED_LENGTHS/*(Int32Array.class)*/,\n\n /**\n * Assume Code 39 codes employ a check digit. Doesn't matter what it maps to;\n * use {@link Boolean#TRUE}.\n */\n ASSUME_CODE_39_CHECK_DIGIT/*(Void.class)*/,\n\n /**\n * Assume the barcode is being processed as a GS1 barcode, and modify behavior as needed.\n * For example this affects FNC1 handling for Code 128 (aka GS1-128). Doesn't matter what it maps to;\n * use {@link Boolean#TRUE}.\n */\n ASSUME_GS1/*(Void.class)*/,\n\n /**\n * If true, return the start and end digits in a Codabar barcode instead of stripping them. They\n * are alpha, whereas the rest are numeric. By default, they are stripped, but this causes them\n * to not be. Doesn't matter what it maps to; use {@link Boolean#TRUE}.\n */\n RETURN_CODABAR_START_END/*(Void.class)*/,\n\n /**\n * The caller needs to be notified via callback when a possible {@link ResultPoint}\n * is found. Maps to a {@link ResultPointCallback}.\n */\n NEED_RESULT_POINT_CALLBACK/*(ResultPointCallback.class)*/,\n\n\n /**\n * Allowed extension lengths for EAN or UPC barcodes. Other formats will ignore this.\n * Maps to an {@code Int32Array} of the allowed extension lengths, for example [2], [5], or [2, 5].\n * If it is optional to have an extension, do not set this hint. If this is set,\n * and a UPC or EAN barcode is found but an extension is not, then no result will be returned\n * at all.\n */\n ALLOWED_EAN_EXTENSIONS/*(Int32Array.class)*/,\n\n // End of enumeration values.\n\n\n /**\n * Data type the hint is expecting.\n * Among the possible values the {@link Void} stands out as being used for\n * hints that do not expect a value to be supplied (flag hints). Such hints\n * will possibly have their value ignored, or replaced by a\n * {@link Boolean#TRUE}. Hint suppliers should probably use\n * {@link Boolean#TRUE} as directed by the actual hint documentation.\n */\n // private valueType: Class\n\n // DecodeHintType(valueType: Class) {\n // this.valueType = valueType\n // }\n\n // public getValueType(): Class {\n // return valueType\n // }\n\n}\n\nexport default DecodeHintType;\n","/*\n * Copyright 2007 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*namespace com.google.zxing {*/\n\n/*import java.util.EnumMap;*/\n/*import java.util.Map;*/\nimport ResultPoint from './ResultPoint';\nimport BarcodeFormat from './BarcodeFormat';\nimport System from './util/System';\nimport ResultMetadataType from './ResultMetadataType';\n\n/**\n *

Encapsulates the result of decoding a barcode within an image.

\n *\n * @author Sean Owen\n */\nexport default class Result {\n\n private resultMetadata: Map;\n\n // public constructor(private text: string,\n // Uint8Array rawBytes,\n // ResultPoconst resultPoints: Int32Array,\n // BarcodeFormat format) {\n // this(text, rawBytes, resultPoints, format, System.currentTimeMillis())\n // }\n\n // public constructor(text: string,\n // Uint8Array rawBytes,\n // ResultPoconst resultPoints: Int32Array,\n // BarcodeFormat format,\n // long timestamp) {\n // this(text, rawBytes, rawBytes == null ? 0 : 8 * rawBytes.length,\n // resultPoints, format, timestamp)\n // }\n\n public constructor(private text: string,\n private rawBytes: Uint8Array,\n private numBits: number /*int*/ = rawBytes == null ? 0 : 8 * rawBytes.length,\n private resultPoints: ResultPoint[],\n private format: BarcodeFormat,\n private timestamp: number /*long*/ = System.currentTimeMillis()) {\n this.text = text;\n this.rawBytes = rawBytes;\n if (undefined === numBits || null === numBits) {\n this.numBits = (rawBytes === null || rawBytes === undefined) ? 0 : 8 * rawBytes.length;\n } else {\n this.numBits = numBits;\n }\n this.resultPoints = resultPoints;\n this.format = format;\n this.resultMetadata = null;\n if (undefined === timestamp || null === timestamp) {\n this.timestamp = System.currentTimeMillis();\n } else {\n this.timestamp = timestamp;\n }\n }\n\n /**\n * @return raw text encoded by the barcode\n */\n public getText(): string {\n return this.text;\n }\n\n /**\n * @return raw bytes encoded by the barcode, if applicable, otherwise {@code null}\n */\n public getRawBytes(): Uint8Array {\n return this.rawBytes;\n }\n\n /**\n * @return how many bits of {@link #getRawBytes()} are valid; typically 8 times its length\n * @since 3.3.0\n */\n public getNumBits(): number /*int*/ {\n return this.numBits;\n }\n\n /**\n * @return points related to the barcode in the image. These are typically points\n * identifying finder patterns or the corners of the barcode. The exact meaning is\n * specific to the type of barcode that was decoded.\n */\n public getResultPoints(): Array {\n return this.resultPoints;\n }\n\n /**\n * @return {@link BarcodeFormat} representing the format of the barcode that was decoded\n */\n public getBarcodeFormat(): BarcodeFormat {\n return this.format;\n }\n\n /**\n * @return {@link Map} mapping {@link ResultMetadataType} keys to values. May be\n * {@code null}. This contains optional metadata about what was detected about the barcode,\n * like orientation.\n */\n public getResultMetadata(): Map {\n return this.resultMetadata;\n }\n\n public putMetadata(type: ResultMetadataType, value: Object): void {\n if (this.resultMetadata === null) {\n this.resultMetadata = new Map();\n }\n this.resultMetadata.set(type, value);\n }\n\n public putAllMetadata(metadata: Map): void {\n if (metadata !== null) {\n if (this.resultMetadata === null) {\n this.resultMetadata = metadata;\n } else {\n this.resultMetadata = new Map(metadata);\n }\n }\n }\n\n public addResultPoints(newPoints: Array): void {\n const oldPoints = this.resultPoints;\n if (oldPoints === null) {\n this.resultPoints = newPoints;\n } else if (newPoints !== null && newPoints.length > 0) {\n const allPoints = new Array(oldPoints.length + newPoints.length);\n System.arraycopy(oldPoints, 0, allPoints, 0, oldPoints.length);\n System.arraycopy(newPoints, 0, allPoints, oldPoints.length, newPoints.length);\n this.resultPoints = allPoints;\n }\n }\n\n public getTimestamp(): number/*long*/ {\n return this.timestamp;\n }\n\n /*@Override*/\n public toString(): string {\n return this.text;\n }\n\n}\n","/*\n * Copyright 2012 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*namespace com.google.zxing.common.detector {*/\n\n/**\n * General math-related and numeric utility functions.\n */\nexport default class MathUtils {\n\n private MathUtils() {\n }\n\n /**\n * Ends up being a bit faster than {@link Math#round(float)}. This merely rounds its\n * argument to the nearest int, where x.5 rounds up to x+1. Semantics of this shortcut\n * differ slightly from {@link Math#round(float)} in that half rounds down for negative\n * values. -2.5 rounds to -3, not -2. For purposes here it makes no difference.\n *\n * @param d real value to round\n * @return nearest {@code int}\n */\n public static round(d: number/*float*/): number /*int*/ {\n if (NaN === d) return 0;\n if (d <= Number.MIN_SAFE_INTEGER) return Number.MIN_SAFE_INTEGER;\n if (d >= Number.MAX_SAFE_INTEGER) return Number.MAX_SAFE_INTEGER;\n return /*(int) */(d + (d < 0.0 ? -0.5 : 0.5)) | 0;\n }\n // TYPESCRIPTPORT: maybe remove round method and call directly Math.round, it looks like it doesn't make sense for js\n\n /**\n * @param aX point A x coordinate\n * @param aY point A y coordinate\n * @param bX point B x coordinate\n * @param bY point B y coordinate\n * @return Euclidean distance between points A and B\n */\n public static distance(aX: number/*float|int*/, aY: number/*float|int*/, bX: number/*float|int*/, bY: number/*float|int*/): number/*float*/ {\n const xDiff = aX - bX;\n const yDiff = aY - bY;\n return /*(float) */Math.sqrt(xDiff * xDiff + yDiff * yDiff);\n }\n\n /**\n * @param aX point A x coordinate\n * @param aY point A y coordinate\n * @param bX point B x coordinate\n * @param bY point B y coordinate\n * @return Euclidean distance between points A and B\n */\n // public static distance(aX: number /*int*/, aY: number /*int*/, bX: number /*int*/, bY: number /*int*/): float {\n // const xDiff = aX - bX\n // const yDiff = aY - bY\n // return (float) Math.sqrt(xDiff * xDiff + yDiff * yDiff);\n // }\n\n /**\n * @param array values to sum\n * @return sum of values in array\n */\n public static sum(array: Int32Array): number /*int*/ {\n let count = 0;\n for (let i = 0, length = array.length; i !== length; i++) {\n const a = array[i];\n count += a;\n }\n return count;\n }\n\n}\n","import Exception from './Exception';\n\n/**\n * Custom Error class of type Exception.\n */\nexport default class ChecksumException extends Exception {\n static getChecksumInstance(): ChecksumException {\n return new ChecksumException();\n }\n}\n","/*\n * Copyright 2007 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*namespace com.google.zxing.common {*/\n\n/*import java.util.Arrays;*/\n\nimport BitArray from './BitArray';\nimport System from '../util/System';\nimport Arrays from '../util/Arrays';\nimport StringBuilder from '../util/StringBuilder';\nimport IllegalArgumentException from '../IllegalArgumentException';\n\nimport { int } from '../../customTypings';\n\n/**\n *

Represents a 2D matrix of bits. In function arguments below, and throughout the common\n * module, x is the column position, and y is the row position. The ordering is always x, y.\n * The origin is at the top-left.

\n *\n *

Internally the bits are represented in a 1-D array of 32-bit ints. However, each row begins\n * with a new int. This is done intentionally so that we can copy out a row into a BitArray very\n * efficiently.

\n *\n *

The ordering of bits is row-major. Within each int, the least significant bits are used first,\n * meaning they represent lower x values. This is compatible with BitArray's implementation.

\n *\n * @author Sean Owen\n * @author dswitkin@google.com (Daniel Switkin)\n */\nexport default class BitMatrix /*implements Cloneable*/ {\n\n /**\n * Creates an empty square {@link BitMatrix}.\n *\n * @param dimension height and width\n */\n // public constructor(dimension: number /*int*/) {\n // this(dimension, dimension)\n // }\n\n /**\n * Creates an empty {@link BitMatrix}.\n *\n * @param width bit matrix width\n * @param height bit matrix height\n */\n // public constructor(width: number /*int*/, height: number /*int*/) {\n // if (width < 1 || height < 1) {\n // throw new IllegalArgumentException(\"Both dimensions must be greater than 0\")\n // }\n // this.width = width\n // this.height = height\n // this.rowSize = (width + 31) / 32\n // bits = new int[rowSize * height];\n // }\n\n public constructor(private width: number /*int*/, private height?: number /*int*/,\n private rowSize?: number /*int*/, private bits?: Int32Array) {\n if (undefined === height || null === height) {\n height = width;\n }\n this.height = height;\n if (width < 1 || height < 1) {\n throw new IllegalArgumentException('Both dimensions must be greater than 0');\n }\n if (undefined === rowSize || null === rowSize) {\n rowSize = Math.floor((width + 31) / 32);\n }\n this.rowSize = rowSize;\n if (undefined === bits || null === bits) {\n this.bits = new Int32Array(this.rowSize * this.height);\n }\n }\n\n /**\n * Interprets a 2D array of booleans as a {@link BitMatrix}, where \"true\" means an \"on\" bit.\n *\n * @function parse\n * @param image bits of the image, as a row-major 2D array. Elements are arrays representing rows\n * @return {@link BitMatrix} representation of image\n */\n public static parseFromBooleanArray(image: boolean[][]): BitMatrix {\n const height = image.length;\n const width = image[0].length;\n const bits = new BitMatrix(width, height);\n for (let i = 0; i < height; i++) {\n const imageI = image[i];\n for (let j = 0; j < width; j++) {\n if (imageI[j]) {\n bits.set(j, i);\n }\n }\n }\n return bits;\n }\n\n /**\n *\n * @function parse\n * @param stringRepresentation\n * @param setString\n * @param unsetString\n */\n public static parseFromString(stringRepresentation: string, setString: string, unsetString: string): BitMatrix {\n if (stringRepresentation === null) {\n throw new IllegalArgumentException('stringRepresentation cannot be null');\n }\n\n const bits = new Array(stringRepresentation.length);\n let bitsPos = 0;\n let rowStartPos = 0;\n let rowLength = -1;\n let nRows = 0;\n let pos = 0;\n while (pos < stringRepresentation.length) {\n if (stringRepresentation.charAt(pos) === '\\n' ||\n stringRepresentation.charAt(pos) === '\\r') {\n if (bitsPos > rowStartPos) {\n if (rowLength === -1) {\n rowLength = bitsPos - rowStartPos;\n } else if (bitsPos - rowStartPos !== rowLength) {\n throw new IllegalArgumentException('row lengths do not match');\n }\n rowStartPos = bitsPos;\n nRows++;\n }\n pos++;\n } else if (stringRepresentation.substring(pos, pos + setString.length) === setString) {\n pos += setString.length;\n bits[bitsPos] = true;\n bitsPos++;\n } else if (stringRepresentation.substring(pos, pos + unsetString.length) === unsetString) {\n pos += unsetString.length;\n bits[bitsPos] = false;\n bitsPos++;\n } else {\n throw new IllegalArgumentException(\n 'illegal character encountered: ' + stringRepresentation.substring(pos));\n }\n }\n\n // no EOL at end?\n if (bitsPos > rowStartPos) {\n if (rowLength === -1) {\n rowLength = bitsPos - rowStartPos;\n } else if (bitsPos - rowStartPos !== rowLength) {\n throw new IllegalArgumentException('row lengths do not match');\n }\n nRows++;\n }\n\n const matrix = new BitMatrix(rowLength, nRows);\n for (let i = 0; i < bitsPos; i++) {\n if (bits[i]) {\n matrix.set(Math.floor(i % rowLength), Math.floor(i / rowLength));\n }\n }\n return matrix;\n }\n\n /**\n *

Gets the requested bit, where true means black.

\n *\n * @param x The horizontal component (i.e. which column)\n * @param y The vertical component (i.e. which row)\n * @return value of given bit in matrix\n */\n public get(x: number /*int*/, y: number /*int*/): boolean {\n const offset = y * this.rowSize + Math.floor(x / 32);\n return ((this.bits[offset] >>> (x & 0x1f)) & 1) !== 0;\n }\n\n /**\n *

Sets the given bit to true.

\n *\n * @param x The horizontal component (i.e. which column)\n * @param y The vertical component (i.e. which row)\n */\n public set(x: number /*int*/, y: number /*int*/): void {\n const offset = y * this.rowSize + Math.floor(x / 32);\n this.bits[offset] |= (1 << (x & 0x1f)) & 0xFFFFFFFF;\n }\n\n public unset(x: number /*int*/, y: number /*int*/): void {\n const offset = y * this.rowSize + Math.floor(x / 32);\n this.bits[offset] &= ~((1 << (x & 0x1f)) & 0xFFFFFFFF);\n }\n\n /**\n *

Flips the given bit.

\n *\n * @param x The horizontal component (i.e. which column)\n * @param y The vertical component (i.e. which row)\n */\n public flip(x: number /*int*/, y: number /*int*/): void {\n const offset = y * this.rowSize + Math.floor(x / 32);\n this.bits[offset] ^= ((1 << (x & 0x1f)) & 0xFFFFFFFF);\n }\n\n /**\n * Exclusive-or (XOR): Flip the bit in this {@code BitMatrix} if the corresponding\n * mask bit is set.\n *\n * @param mask XOR mask\n */\n public xor(mask: BitMatrix): void {\n if (this.width !== mask.getWidth() || this.height !== mask.getHeight()\n || this.rowSize !== mask.getRowSize()) {\n throw new IllegalArgumentException('input matrix dimensions do not match');\n }\n const rowArray = new BitArray(Math.floor(this.width / 32) + 1);\n const rowSize = this.rowSize;\n const bits = this.bits;\n for (let y = 0, height = this.height; y < height; y++) {\n const offset = y * rowSize;\n const row = mask.getRow(y, rowArray).getBitArray();\n for (let x = 0; x < rowSize; x++) {\n bits[offset + x] ^= row[x];\n }\n }\n }\n\n /**\n * Clears all bits (sets to false).\n */\n public clear(): void {\n const bits = this.bits;\n const max = bits.length;\n for (let i = 0; i < max; i++) {\n bits[i] = 0;\n }\n }\n\n /**\n *

Sets a square region of the bit matrix to true.

\n *\n * @param left The horizontal position to begin at (inclusive)\n * @param top The vertical position to begin at (inclusive)\n * @param width The width of the region\n * @param height The height of the region\n */\n public setRegion(left: number /*int*/, top: number /*int*/, width: number /*int*/, height: number /*int*/): void {\n if (top < 0 || left < 0) {\n throw new IllegalArgumentException('Left and top must be nonnegative');\n }\n if (height < 1 || width < 1) {\n throw new IllegalArgumentException('Height and width must be at least 1');\n }\n const right = left + width;\n const bottom = top + height;\n if (bottom > this.height || right > this.width) {\n throw new IllegalArgumentException('The region must fit inside the matrix');\n }\n const rowSize = this.rowSize;\n const bits = this.bits;\n for (let y = top; y < bottom; y++) {\n const offset = y * rowSize;\n for (let x = left; x < right; x++) {\n bits[offset + Math.floor(x / 32)] |= ((1 << (x & 0x1f)) & 0xFFFFFFFF);\n }\n }\n }\n\n /**\n * A fast method to retrieve one row of data from the matrix as a BitArray.\n *\n * @param y The row to retrieve\n * @param row An optional caller-allocated BitArray, will be allocated if null or too small\n * @return The resulting BitArray - this reference should always be used even when passing\n * your own row\n */\n public getRow(y: number /*int*/, row?: BitArray): BitArray {\n if (row === null || row === undefined || row.getSize() < this.width) {\n row = new BitArray(this.width);\n } else {\n row.clear();\n }\n const rowSize = this.rowSize;\n const bits = this.bits;\n const offset = y * rowSize;\n for (let x = 0; x < rowSize; x++) {\n row.setBulk(x * 32, bits[offset + x]);\n }\n return row;\n }\n\n /**\n * @param y row to set\n * @param row {@link BitArray} to copy from\n */\n public setRow(y: number /*int*/, row: BitArray): void {\n System.arraycopy(row.getBitArray(), 0, this.bits, y * this.rowSize, this.rowSize);\n }\n\n /**\n * Modifies this {@code BitMatrix} to represent the same but rotated 180 degrees\n */\n public rotate180(): void {\n const width = this.getWidth();\n const height = this.getHeight();\n let topRow = new BitArray(width);\n let bottomRow = new BitArray(width);\n for (let i = 0, length = Math.floor((height + 1) / 2); i < length; i++) {\n topRow = this.getRow(i, topRow);\n bottomRow = this.getRow(height - 1 - i, bottomRow);\n topRow.reverse();\n bottomRow.reverse();\n this.setRow(i, bottomRow);\n this.setRow(height - 1 - i, topRow);\n }\n }\n\n /**\n * This is useful in detecting the enclosing rectangle of a 'pure' barcode.\n *\n * @return {@code left,top,width,height} enclosing rectangle of all 1 bits, or null if it is all white\n */\n public getEnclosingRectangle(): Int32Array {\n const width = this.width;\n const height = this.height;\n const rowSize = this.rowSize;\n const bits = this.bits;\n\n let left = width;\n let top = height;\n let right = -1;\n let bottom = -1;\n\n for (let y = 0; y < height; y++) {\n for (let x32 = 0; x32 < rowSize; x32++) {\n const theBits = bits[y * rowSize + x32];\n if (theBits !== 0) {\n if (y < top) {\n top = y;\n }\n if (y > bottom) {\n bottom = y;\n }\n if (x32 * 32 < left) {\n let bit = 0;\n while (((theBits << (31 - bit)) & 0xFFFFFFFF) === 0) {\n bit++;\n }\n if ((x32 * 32 + bit) < left) {\n left = x32 * 32 + bit;\n }\n }\n if (x32 * 32 + 31 > right) {\n let bit = 31;\n while ((theBits >>> bit) === 0) {\n bit--;\n }\n if ((x32 * 32 + bit) > right) {\n right = x32 * 32 + bit;\n }\n }\n }\n }\n }\n\n if (right < left || bottom < top) {\n return null;\n }\n\n return Int32Array.from([left, top, right - left + 1, bottom - top + 1]);\n }\n\n /**\n * This is useful in detecting a corner of a 'pure' barcode.\n *\n * @return {@code x,y} coordinate of top-left-most 1 bit, or null if it is all white\n */\n public getTopLeftOnBit(): Int32Array {\n const rowSize = this.rowSize;\n const bits = this.bits;\n\n let bitsOffset = 0;\n while (bitsOffset < bits.length && bits[bitsOffset] === 0) {\n bitsOffset++;\n }\n if (bitsOffset === bits.length) {\n return null;\n }\n const y = bitsOffset / rowSize;\n let x = (bitsOffset % rowSize) * 32;\n\n const theBits = bits[bitsOffset];\n let bit = 0;\n while (((theBits << (31 - bit)) & 0xFFFFFFFF) === 0) {\n bit++;\n }\n x += bit;\n return Int32Array.from([x, y]);\n }\n\n public getBottomRightOnBit(): Int32Array {\n const rowSize = this.rowSize;\n const bits = this.bits;\n\n let bitsOffset = bits.length - 1;\n while (bitsOffset >= 0 && bits[bitsOffset] === 0) {\n bitsOffset--;\n }\n if (bitsOffset < 0) {\n return null;\n }\n\n const y = Math.floor(bitsOffset / rowSize);\n let x = Math.floor(bitsOffset % rowSize) * 32;\n\n const theBits = bits[bitsOffset];\n let bit = 31;\n while ((theBits >>> bit) === 0) {\n bit--;\n }\n x += bit;\n\n return Int32Array.from([x, y]);\n }\n\n /**\n * @return The width of the matrix\n */\n public getWidth(): number /*int*/ {\n return this.width;\n }\n\n /**\n * @return The height of the matrix\n */\n public getHeight(): number /*int*/ {\n return this.height;\n }\n\n /**\n * @return The row size of the matrix\n */\n public getRowSize(): number /*int*/ {\n return this.rowSize;\n }\n\n /*@Override*/\n public equals(o: Object): boolean {\n if (!(o instanceof BitMatrix)) {\n return false;\n }\n const other = o;\n return this.width === other.width && this.height === other.height && this.rowSize === other.rowSize &&\n Arrays.equals(this.bits, other.bits);\n }\n\n /*@Override*/\n public hashCode(): int {\n let hash = this.width;\n hash = 31 * hash + this.width;\n hash = 31 * hash + this.height;\n hash = 31 * hash + this.rowSize;\n hash = 31 * hash + Arrays.hashCode(this.bits);\n return hash;\n }\n\n /**\n * @return string representation using \"X\" for set and \" \" for unset bits\n */\n /*@Override*/\n // public toString(): string {\n // return toString(\": \"X, \" \")\n // }\n\n /**\n * @param setString representation of a set bit\n * @param unsetString representation of an unset bit\n * @return string representation of entire matrix utilizing given strings\n */\n // public toString(setString: string = \"X \", unsetString: string = \" \"): string {\n // return this.buildToString(setString, unsetString, \"\\n\")\n // }\n\n /**\n * @param setString representation of a set bit\n * @param unsetString representation of an unset bit\n * @param lineSeparator newline character in string representation\n * @return string representation of entire matrix utilizing given strings and line separator\n * @deprecated call {@link #toString(String,String)} only, which uses \\n line separator always\n */\n // @Deprecated\n public toString(setString: string = 'X ', unsetString: string = ' ', lineSeparator: string = '\\n'): string {\n return this.buildToString(setString, unsetString, lineSeparator);\n }\n\n private buildToString(setString: string, unsetString: string, lineSeparator: string) {\n let result = new StringBuilder();\n // result.append(lineSeparator);\n for (let y = 0, height = this.height; y < height; y++) {\n for (let x = 0, width = this.width; x < width; x++) {\n result.append(this.get(x, y) ? setString : unsetString);\n }\n result.append(lineSeparator);\n }\n return result.toString();\n }\n\n /*@Override*/\n public clone(): BitMatrix {\n return new BitMatrix(this.width, this.height, this.rowSize, this.bits.slice());\n }\n\n}\n","/**\n * Ponyfill for Java's Integer class.\n */\nexport default class Integer {\n\n static MIN_VALUE_32_BITS = -2147483648;\n static MAX_VALUE: number = Number.MAX_SAFE_INTEGER;\n\n public static numberOfTrailingZeros(i: number): number {\n\n let y: number;\n\n if (i === 0) return 32;\n\n let n = 31;\n\n y = i << 16;\n\n if (y !== 0) {\n n -= 16;\n i = y;\n }\n\n y = i << 8;\n\n if (y !== 0) {\n n -= 8;\n i = y;\n }\n\n y = i << 4;\n\n if (y !== 0) {\n n -= 4;\n i = y;\n }\n\n y = i << 2;\n\n if (y !== 0) {\n n -= 2;\n i = y;\n }\n\n return n - ((i << 1) >>> 31);\n }\n\n public static numberOfLeadingZeros(i: number): number {\n\n // HD, Figure 5-6\n if (i === 0) {\n return 32;\n }\n\n let n = 1;\n\n if (i >>> 16 === 0) {\n n += 16;\n i <<= 16;\n }\n\n if (i >>> 24 === 0) {\n n += 8;\n i <<= 8;\n }\n\n if (i >>> 28 === 0) {\n n += 4;\n i <<= 4;\n }\n\n if (i >>> 30 === 0) {\n n += 2;\n i <<= 2;\n }\n\n n -= i >>> 31;\n\n return n;\n }\n\n public static toHexString(i: number) {\n return i.toString(16);\n }\n\n public static toBinaryString(intNumber: number): string {\n return String(parseInt(String(intNumber), 2));\n }\n\n // Returns the number of one-bits in the two's complement binary representation of the specified int value. This function is sometimes referred to as the population count.\n // Returns:\n // the number of one-bits in the two's complement binary representation of the specified int value.\n public static bitCount(i: number): number {\n // HD, Figure 5-2\n i = i - ((i >>> 1) & 0x55555555);\n i = (i & 0x33333333) + ((i >>> 2) & 0x33333333);\n i = (i + (i >>> 4)) & 0x0f0f0f0f;\n i = i + (i >>> 8);\n i = i + (i >>> 16);\n\n return i & 0x3f;\n }\n\n public static truncDivision(dividend: number, divisor: number): number {\n return Math.trunc(dividend / divisor);\n }\n\n /**\n * Converts A string to an integer.\n * @param s A string to convert into a number.\n * @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.\n */\n static parseInt(num: string, radix: number = undefined) {\n return parseInt(num, radix);\n }\n}\n","/*\n * Copyright 2008 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*namespace com.google.zxing {*/\n\n/**\n * Represents some type of metadata about the result of the decoding that the decoder\n * wishes to communicate back to the caller.\n *\n * @author Sean Owen\n */\nenum ResultMetadataType {\n\n /**\n * Unspecified, application-specific metadata. Maps to an unspecified {@link Object}.\n */\n OTHER,\n\n /**\n * Denotes the likely approximate orientation of the barcode in the image. This value\n * is given as degrees rotated clockwise from the normal, upright orientation.\n * For example a 1D barcode which was found by reading top-to-bottom would be\n * said to have orientation \"90\". This key maps to an {@link Integer} whose\n * value is in the range [0,360).\n */\n ORIENTATION,\n\n /**\n *

2D barcode formats typically encode text, but allow for a sort of 'byte mode'\n * which is sometimes used to encode binary data. While {@link Result} makes available\n * the complete raw bytes in the barcode for these formats, it does not offer the bytes\n * from the byte segments alone.

\n *\n *

This maps to a {@link java.util.List} of byte arrays corresponding to the\n * raw bytes in the byte segments in the barcode, in order.

\n */\n BYTE_SEGMENTS,\n\n /**\n * Error correction level used, if applicable. The value type depends on the\n * format, but is typically a String.\n */\n ERROR_CORRECTION_LEVEL,\n\n /**\n * For some periodicals, indicates the issue number as an {@link Integer}.\n */\n ISSUE_NUMBER,\n\n /**\n * For some products, indicates the suggested retail price in the barcode as a\n * formatted {@link String}.\n */\n SUGGESTED_PRICE,\n\n /**\n * For some products, the possible country of manufacture as a {@link String} denoting the\n * ISO country code. Some map to multiple possible countries, like \"US/CA\".\n */\n POSSIBLE_COUNTRY,\n\n /**\n * For some products, the extension text\n */\n UPC_EAN_EXTENSION,\n\n /**\n * PDF417-specific metadata\n */\n PDF417_EXTRA_METADATA,\n\n /**\n * If the code format supports structured append and the current scanned code is part of one then the\n * sequence number is given with it.\n */\n STRUCTURED_APPEND_SEQUENCE,\n\n /**\n * If the code format supports structured append and the current scanned code is part of one then the\n * parity is given with it.\n */\n STRUCTURED_APPEND_PARITY,\n\n}\n\nexport default ResultMetadataType;\n","/*\n * Copyright 2008 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*namespace com.google.zxing.oned {*/\n\nimport BinaryBitmap from '../BinaryBitmap';\nimport BitArray from '../common/BitArray';\nimport DecodeHintType from '../DecodeHintType';\n\nimport Reader from '../Reader';\nimport Result from '../Result';\nimport ResultMetadataType from '../ResultMetadataType';\nimport ResultPoint from '../ResultPoint';\nimport NotFoundException from '../NotFoundException';\n\n/**\n * Encapsulates functionality and implementation that is common to all families\n * of one-dimensional barcodes.\n *\n * @author dswitkin@google.com (Daniel Switkin)\n * @author Sean Owen\n */\nexport default abstract class OneDReader implements Reader {\n\n /*\n @Override\n public Result decode(BinaryBitmap image) throws NotFoundException, FormatException {\n return decode(image, null);\n }\n */\n\n // Note that we don't try rotation without the try harder flag, even if rotation was supported.\n // @Override\n public decode(image: BinaryBitmap, hints?: Map): Result {\n try {\n return this.doDecode(image, hints);\n } catch (nfe) {\n const tryHarder = hints && (hints.get(DecodeHintType.TRY_HARDER) === true);\n\n if (tryHarder && image.isRotateSupported()) {\n const rotatedImage = image.rotateCounterClockwise();\n const result = this.doDecode(rotatedImage, hints);\n // Record that we found it rotated 90 degrees CCW / 270 degrees CW\n const metadata = result.getResultMetadata();\n let orientation = 270;\n if (metadata !== null && (metadata.get(ResultMetadataType.ORIENTATION) === true)) {\n // But if we found it reversed in doDecode(), add in that result here:\n orientation = (orientation + (metadata.get(ResultMetadataType.ORIENTATION) as number) % 360);\n }\n result.putMetadata(ResultMetadataType.ORIENTATION, orientation);\n // Update result points\n const points = result.getResultPoints();\n if (points !== null) {\n const height = rotatedImage.getHeight();\n for (let i = 0; i < points.length; i++) {\n points[i] = new ResultPoint(height - points[i].getY() - 1, points[i].getX());\n }\n }\n return result;\n } else {\n throw new NotFoundException();\n }\n }\n }\n\n // @Override\n public reset(): void {\n // do nothing\n }\n\n /**\n * We're going to examine rows from the middle outward, searching alternately above and below the\n * middle, and farther out each time. rowStep is the number of rows between each successive\n * attempt above and below the middle. So we'd scan row middle, then middle - rowStep, then\n * middle + rowStep, then middle - (2 * rowStep), etc.\n * rowStep is bigger as the image is taller, but is always at least 1. We've somewhat arbitrarily\n * decided that moving up and down by about 1/16 of the image is pretty good; we try more of the\n * image if \"trying harder\".\n *\n * @param image The image to decode\n * @param hints Any hints that were requested\n * @return The contents of the decoded barcode\n * @throws NotFoundException Any spontaneous errors which occur\n */\n private doDecode(image: BinaryBitmap, hints?: Map): Result {\n const width = image.getWidth();\n const height = image.getHeight();\n let row = new BitArray(width);\n\n const tryHarder = hints && (hints.get(DecodeHintType.TRY_HARDER) === true);\n const rowStep = Math.max(1, height >> (tryHarder ? 8 : 5));\n let maxLines;\n if (tryHarder) {\n maxLines = height; // Look at the whole image, not just the center\n } else {\n maxLines = 15; // 15 rows spaced 1/32 apart is roughly the middle half of the image\n }\n\n const middle = Math.trunc(height / 2);\n for (let x = 0; x < maxLines; x++) {\n // Scanning from the middle out. Determine which row we're looking at next:\n const rowStepsAboveOrBelow = Math.trunc((x + 1) / 2);\n const isAbove = (x & 0x01) === 0; // i.e. is x even?\n const rowNumber = middle + rowStep * (isAbove ? rowStepsAboveOrBelow : -rowStepsAboveOrBelow);\n if (rowNumber < 0 || rowNumber >= height) {\n // Oops, if we run off the top or bottom, stop\n break;\n }\n\n // Estimate black point for this row and load it:\n try {\n row = image.getBlackRow(rowNumber, row);\n } catch (ignored) { continue; }\n\n // While we have the image data in a BitArray, it's fairly cheap to reverse it in place to\n // handle decoding upside down barcodes.\n for (let attempt = 0; attempt < 2; attempt++) {\n if (attempt === 1) { // trying again?\n row.reverse(); // reverse the row and continue\n\n // This means we will only ever draw result points *once* in the life of this method\n // since we want to avoid drawing the wrong points after flipping the row, and,\n // don't want to clutter with noise from every single row scan -- just the scans\n // that start on the center line.\n if (hints && (hints.get(DecodeHintType.NEED_RESULT_POINT_CALLBACK) === true)) {\n const newHints = new Map();\n hints.forEach((hint, key) => newHints.set(key, hint));\n newHints.delete(DecodeHintType.NEED_RESULT_POINT_CALLBACK);\n hints = newHints;\n }\n }\n\n try {\n // Look for a barcode\n const result = this.decodeRow(rowNumber, row, hints);\n // We found our barcode\n if (attempt === 1) {\n // But it was upside down, so note that\n result.putMetadata(ResultMetadataType.ORIENTATION, 180);\n // And remember to flip the result points horizontally.\n const points = result.getResultPoints();\n if (points !== null) {\n points[0] = new ResultPoint(width - points[0].getX() - 1, points[0].getY());\n points[1] = new ResultPoint(width - points[1].getX() - 1, points[1].getY());\n }\n }\n return result;\n } catch (re) {\n // continue -- just couldn't decode this row\n }\n }\n }\n\n throw new NotFoundException();\n }\n\n /**\n * Records the size of successive runs of white and black pixels in a row, starting at a given point.\n * The values are recorded in the given array, and the number of runs recorded is equal to the size\n * of the array. If the row starts on a white pixel at the given start point, then the first count\n * recorded is the run of white pixels starting from that point; likewise it is the count of a run\n * of black pixels if the row begin on a black pixels at that point.\n *\n * @param row row to count from\n * @param start offset into row to start at\n * @param counters array into which to record counts\n * @throws NotFoundException if counters cannot be filled entirely from row before running out\n * of pixels\n */\n protected static recordPattern(row: BitArray, start: number, counters: number[]): void {\n const numCounters = counters.length;\n for (let index = 0; index < numCounters; index++)\n counters[index] = 0;\n\n const end = row.getSize();\n if (start >= end) {\n throw new NotFoundException();\n }\n\n let isWhite = !row.get(start);\n let counterPosition = 0;\n let i = start;\n while (i < end) {\n if (row.get(i) !== isWhite) {\n counters[counterPosition]++;\n } else {\n if (++counterPosition === numCounters) {\n break;\n } else {\n counters[counterPosition] = 1;\n isWhite = !isWhite;\n }\n }\n i++;\n }\n\n // If we read fully the last section of pixels and filled up our counters -- or filled\n // the last counter but ran off the side of the image, OK. Otherwise, a problem.\n if (!(counterPosition === numCounters || (counterPosition === numCounters - 1 && i === end))) {\n throw new NotFoundException();\n }\n }\n\n protected static recordPatternInReverse(row: BitArray, start: number, counters: number[]): void {\n // This could be more efficient I guess\n let numTransitionsLeft = counters.length;\n let last = row.get(start);\n while (start > 0 && numTransitionsLeft >= 0) {\n if (row.get(--start) !== last) {\n numTransitionsLeft--;\n last = !last;\n }\n }\n if (numTransitionsLeft >= 0) {\n throw new NotFoundException();\n }\n\n OneDReader.recordPattern(row, start + 1, counters);\n }\n\n /**\n * Determines how closely a set of observed counts of runs of black/white values matches a given\n * target pattern. This is reported as the ratio of the total variance from the expected pattern\n * proportions across all pattern elements, to the length of the pattern.\n *\n * @param counters observed counters\n * @param pattern expected pattern\n * @param maxIndividualVariance The most any counter can differ before we give up\n * @return ratio of total variance between counters and pattern compared to total pattern size\n */\n protected static patternMatchVariance(counters: number[], pattern: number[], maxIndividualVariance: number): number {\n const numCounters = counters.length;\n let total = 0;\n let patternLength = 0;\n for (let i = 0; i < numCounters; i++) {\n total += counters[i];\n patternLength += pattern[i];\n }\n if (total < patternLength) {\n // If we don't even have one pixel per unit of bar width, assume this is too small\n // to reliably match, so fail:\n return Number.POSITIVE_INFINITY;\n }\n\n const unitBarWidth = total / patternLength;\n maxIndividualVariance *= unitBarWidth;\n\n let totalVariance = 0.0;\n for (let x = 0; x < numCounters; x++) {\n const counter = counters[x];\n const scaledPattern = pattern[x] * unitBarWidth;\n const variance = counter > scaledPattern ? counter - scaledPattern : scaledPattern - counter;\n if (variance > maxIndividualVariance) {\n return Number.POSITIVE_INFINITY;\n }\n totalVariance += variance;\n }\n return totalVariance / total;\n }\n\n /**\n *

Attempts to decode a one-dimensional barcode format given a single row of\n * an image.

\n *\n * @param rowNumber row number from top of the row\n * @param row the black/white pixel data of the row\n * @param hints decode hints\n * @return {@link Result} containing encoded string and start/end of barcode\n * @throws NotFoundException if no potential barcode is found\n * @throws ChecksumException if a potential barcode is found but does not pass its checksum\n * @throws FormatException if a potential barcode is found but format is invalid\n */\n public abstract decodeRow(rowNumber: number, row: BitArray, hints?: Map): Result;\n}\n","import Exception from './Exception';\n\n/**\n * Custom Error class of type Exception.\n */\nexport default class IllegalStateException extends Exception {}\n","import ArgumentException from '../core/ArgumentException';\nimport BinaryBitmap from '../core/BinaryBitmap';\nimport ChecksumException from '../core/ChecksumException';\nimport HybridBinarizer from '../core/common/HybridBinarizer';\nimport DecodeHintType from '../core/DecodeHintType';\nimport FormatException from '../core/FormatException';\nimport NotFoundException from '../core/NotFoundException';\nimport Reader from '../core/Reader';\nimport Result from '../core/Result';\nimport { DecodeContinuouslyCallback } from './DecodeContinuouslyCallback';\nimport { HTMLCanvasElementLuminanceSource } from './HTMLCanvasElementLuminanceSource';\nimport { HTMLVisualMediaElement } from './HTMLVisualMediaElement';\nimport { VideoInputDevice } from './VideoInputDevice';\n\n/**\n * @deprecated Moving to @zxing/browser\n *\n * Base class for browser code reader.\n */\nexport class BrowserCodeReader {\n\n /**\n * If navigator is present.\n */\n public get hasNavigator() {\n return typeof navigator !== 'undefined';\n }\n\n /**\n * If mediaDevices under navigator is supported.\n */\n public get isMediaDevicesSuported() {\n return this.hasNavigator && !!navigator.mediaDevices;\n }\n\n /**\n * If enumerateDevices under navigator is supported.\n */\n public get canEnumerateDevices() {\n return !!(this.isMediaDevicesSuported && navigator.mediaDevices.enumerateDevices);\n }\n\n /**\n * This will break the loop.\n */\n private _stopContinuousDecode = false;\n\n /**\n * This will break the loop.\n */\n private _stopAsyncDecode = false;\n\n /**\n * Delay time between decode attempts made by the scanner.\n */\n protected _timeBetweenDecodingAttempts: number = 0;\n\n /** Time between two decoding tries in milli seconds. */\n get timeBetweenDecodingAttempts(): number {\n return this._timeBetweenDecodingAttempts;\n }\n\n /**\n * Change the time span the decoder waits between two decoding tries.\n *\n * @param {number} millis Time between two decoding tries in milli seconds.\n */\n set timeBetweenDecodingAttempts(millis: number) {\n this._timeBetweenDecodingAttempts = millis < 0 ? 0 : millis;\n }\n\n /**\n * The HTML canvas element, used to draw the video or image's frame for decoding.\n */\n protected captureCanvas: HTMLCanvasElement;\n /**\n * The HTML canvas element context.\n */\n protected captureCanvasContext: CanvasRenderingContext2D;\n\n /**\n * The HTML image element, used as a fallback for the video element when decoding.\n */\n protected imageElement: HTMLImageElement;\n\n /**\n * Should contain the current registered listener for image loading,\n * used to unregister that listener when needed.\n */\n protected imageLoadedListener: EventListener;\n\n /**\n * The stream output from camera.\n */\n protected stream: MediaStream;\n\n /**\n * The HTML video element, used to display the camera stream.\n */\n protected videoElement: HTMLVideoElement;\n\n /**\n * Should contain the current registered listener for video loaded-metadata,\n * used to unregister that listener when needed.\n */\n protected videoCanPlayListener: EventListener;\n\n /**\n * Should contain the current registered listener for video play-ended,\n * used to unregister that listener when needed.\n */\n protected videoEndedListener: EventListener;\n\n /**\n * Should contain the current registered listener for video playing,\n * used to unregister that listener when needed.\n */\n protected videoPlayingEventListener: EventListener;\n\n /**\n * Sets the hints.\n */\n set hints(hints: Map) {\n this._hints = hints || null;\n }\n\n /**\n * Sets the hints.\n */\n get hints(): Map {\n return this._hints;\n }\n\n /**\n * Creates an instance of BrowserCodeReader.\n * @param {Reader} reader The reader instance to decode the barcode\n * @param {number} [timeBetweenScansMillis=500] the time delay between subsequent successful decode tries\n *\n * @memberOf BrowserCodeReader\n */\n public constructor(protected readonly reader: Reader, protected timeBetweenScansMillis: number = 500, protected _hints?: Map) { }\n\n /**\n * Lists all the available video input devices.\n */\n public async listVideoInputDevices(): Promise {\n\n if (!this.hasNavigator) {\n throw new Error('Can\\'t enumerate devices, navigator is not present.');\n }\n\n if (!this.canEnumerateDevices) {\n throw new Error('Can\\'t enumerate devices, method not supported.');\n }\n\n const devices = await navigator.mediaDevices.enumerateDevices();\n\n const videoDevices: MediaDeviceInfo[] = [];\n\n for (const device of devices) {\n\n const kind = device.kind === 'video' ? 'videoinput' : device.kind;\n\n if (kind !== 'videoinput') {\n continue;\n }\n\n const deviceId = device.deviceId || (device).id;\n const label = device.label || `Video device ${videoDevices.length + 1}`;\n const groupId = device.groupId;\n\n const videoDevice = { deviceId, label, kind, groupId };\n\n videoDevices.push(videoDevice);\n }\n\n return videoDevices;\n }\n\n\n /**\n * Obtain the list of available devices with type 'videoinput'.\n *\n * @returns {Promise} an array of available video input devices\n *\n * @memberOf BrowserCodeReader\n *\n * @deprecated Use `listVideoInputDevices` instead.\n */\n public async getVideoInputDevices(): Promise {\n\n const devices = await this.listVideoInputDevices();\n\n return devices.map(d => new VideoInputDevice(d.deviceId, d.label));\n }\n\n /**\n * Let's you find a device using it's Id.\n */\n public async findDeviceById(deviceId: string): Promise {\n\n const devices = await this.listVideoInputDevices();\n\n if (!devices) {\n return null;\n }\n\n return devices.find(x => x.deviceId === deviceId);\n }\n\n /**\n * Decodes the barcode from the device specified by deviceId while showing the video in the specified video element.\n *\n * @param deviceId the id of one of the devices obtained after calling getVideoInputDevices. Can be undefined, in this case it will decode from one of the available devices, preffering the main camera (environment facing) if available.\n * @param video the video element in page where to show the video while decoding. Can be either an element id or directly an HTMLVideoElement. Can be undefined, in which case no video will be shown.\n * @returns The decoding result.\n *\n * @memberOf BrowserCodeReader\n *\n * @deprecated Use `decodeOnceFromVideoDevice` instead.\n */\n public async decodeFromInputVideoDevice(deviceId?: string, videoSource?: string | HTMLVideoElement): Promise {\n return await this.decodeOnceFromVideoDevice(deviceId, videoSource);\n }\n\n /**\n * In one attempt, tries to decode the barcode from the device specified by deviceId while showing the video in the specified video element.\n *\n * @param deviceId the id of one of the devices obtained after calling getVideoInputDevices. Can be undefined, in this case it will decode from one of the available devices, preffering the main camera (environment facing) if available.\n * @param video the video element in page where to show the video while decoding. Can be either an element id or directly an HTMLVideoElement. Can be undefined, in which case no video will be shown.\n * @returns The decoding result.\n *\n * @memberOf BrowserCodeReader\n */\n public async decodeOnceFromVideoDevice(deviceId?: string, videoSource?: string | HTMLVideoElement): Promise {\n\n this.reset();\n\n let videoConstraints: MediaTrackConstraints;\n\n if (!deviceId) {\n videoConstraints = { facingMode: 'environment' };\n } else {\n videoConstraints = { deviceId: { exact: deviceId } };\n }\n\n const constraints: MediaStreamConstraints = { video: videoConstraints };\n\n return await this.decodeOnceFromConstraints(constraints, videoSource);\n }\n\n /**\n * In one attempt, tries to decode the barcode from a stream obtained from the given constraints while showing the video in the specified video element.\n *\n * @param constraints the media stream constraints to get s valid media stream to decode from\n * @param video the video element in page where to show the video while decoding. Can be either an element id or directly an HTMLVideoElement. Can be undefined, in which case no video will be shown.\n * @returns The decoding result.\n *\n * @memberOf BrowserCodeReader\n */\n public async decodeOnceFromConstraints(constraints: MediaStreamConstraints, videoSource?: string | HTMLVideoElement): Promise {\n\n const stream = await navigator.mediaDevices.getUserMedia(constraints);\n\n return await this.decodeOnceFromStream(stream, videoSource);\n }\n\n /**\n * In one attempt, tries to decode the barcode from a stream obtained from the given constraints while showing the video in the specified video element.\n *\n * @param {MediaStream} [constraints] the media stream constraints to get s valid media stream to decode from\n * @param {string|HTMLVideoElement} [video] the video element in page where to show the video while decoding. Can be either an element id or directly an HTMLVideoElement. Can be undefined, in which case no video will be shown.\n * @returns {Promise} The decoding result.\n *\n * @memberOf BrowserCodeReader\n */\n public async decodeOnceFromStream(stream: MediaStream, videoSource?: string | HTMLVideoElement): Promise {\n\n this.reset();\n\n const video = await this.attachStreamToVideo(stream, videoSource);\n const result = await this.decodeOnce(video);\n\n return result;\n }\n\n /**\n * Continuously decodes the barcode from the device specified by device while showing the video in the specified video element.\n *\n * @param {string|null} [deviceId] the id of one of the devices obtained after calling getVideoInputDevices. Can be undefined, in this case it will decode from one of the available devices, preffering the main camera (environment facing) if available.\n * @param {string|HTMLVideoElement|null} [video] the video element in page where to show the video while decoding. Can be either an element id or directly an HTMLVideoElement. Can be undefined, in which case no video will be shown.\n * @returns {Promise}\n *\n * @memberOf BrowserCodeReader\n *\n * @deprecated Use `decodeFromVideoDevice` instead.\n */\n public async decodeFromInputVideoDeviceContinuously(deviceId: string | null, videoSource: string | HTMLVideoElement | null, callbackFn: DecodeContinuouslyCallback): Promise {\n return await this.decodeFromVideoDevice(deviceId, videoSource, callbackFn);\n }\n\n /**\n * Continuously tries to decode the barcode from the device specified by device while showing the video in the specified video element.\n *\n * @param {string|null} [deviceId] the id of one of the devices obtained after calling getVideoInputDevices. Can be undefined, in this case it will decode from one of the available devices, preffering the main camera (environment facing) if available.\n * @param {string|HTMLVideoElement|null} [video] the video element in page where to show the video while decoding. Can be either an element id or directly an HTMLVideoElement. Can be undefined, in which case no video will be shown.\n * @returns {Promise}\n *\n * @memberOf BrowserCodeReader\n */\n public async decodeFromVideoDevice(deviceId: string | null, videoSource: string | HTMLVideoElement | null, callbackFn: DecodeContinuouslyCallback): Promise {\n\n let videoConstraints: MediaTrackConstraints;\n\n if (!deviceId) {\n videoConstraints = { facingMode: 'environment' };\n } else {\n videoConstraints = { deviceId: { exact: deviceId } };\n }\n\n const constraints: MediaStreamConstraints = { video: videoConstraints };\n\n return await this.decodeFromConstraints(constraints, videoSource, callbackFn);\n }\n\n /**\n * Continuously tries to decode the barcode from a stream obtained from the given constraints while showing the video in the specified video element.\n *\n * @param {MediaStream} [constraints] the media stream constraints to get s valid media stream to decode from\n * @param {string|HTMLVideoElement} [video] the video element in page where to show the video while decoding. Can be either an element id or directly an HTMLVideoElement. Can be undefined, in which case no video will be shown.\n * @returns {Promise} The decoding result.\n *\n * @memberOf BrowserCodeReader\n */\n public async decodeFromConstraints(constraints: MediaStreamConstraints, videoSource: string | HTMLVideoElement, callbackFn: DecodeContinuouslyCallback): Promise {\n\n const stream = await navigator.mediaDevices.getUserMedia(constraints);\n\n return await this.decodeFromStream(stream, videoSource, callbackFn);\n }\n\n /**\n * In one attempt, tries to decode the barcode from a stream obtained from the given constraints while showing the video in the specified video element.\n *\n * @param {MediaStream} [constraints] the media stream constraints to get s valid media stream to decode from\n * @param {string|HTMLVideoElement} [video] the video element in page where to show the video while decoding. Can be either an element id or directly an HTMLVideoElement. Can be undefined, in which case no video will be shown.\n * @returns {Promise} The decoding result.\n *\n * @memberOf BrowserCodeReader\n */\n public async decodeFromStream(stream: MediaStream, videoSource: string | HTMLVideoElement, callbackFn: DecodeContinuouslyCallback) {\n\n this.reset();\n\n const video = await this.attachStreamToVideo(stream, videoSource);\n\n return await this.decodeContinuously(video, callbackFn);\n }\n\n /**\n * Breaks the decoding loop.\n */\n public stopAsyncDecode() {\n this._stopAsyncDecode = true;\n }\n\n /**\n * Breaks the decoding loop.\n */\n public stopContinuousDecode() {\n this._stopContinuousDecode = true;\n }\n\n /**\n * Sets the new stream and request a new decoding-with-delay.\n *\n * @param stream The stream to be shown in the video element.\n * @param decodeFn A callback for the decode method.\n */\n protected async attachStreamToVideo(stream: MediaStream, videoSource: string | HTMLVideoElement): Promise {\n\n const videoElement = this.prepareVideoElement(videoSource);\n\n this.addVideoSource(videoElement, stream);\n\n this.videoElement = videoElement;\n this.stream = stream;\n\n await this.playVideoOnLoadAsync(videoElement);\n\n return videoElement;\n }\n\n /**\n *\n * @param videoElement\n */\n protected playVideoOnLoadAsync(videoElement: HTMLVideoElement): Promise {\n return new Promise((resolve, reject) => this.playVideoOnLoad(videoElement, () => resolve()));\n }\n\n /**\n * Binds listeners and callbacks to the videoElement.\n *\n * @param element\n * @param callbackFn\n */\n protected playVideoOnLoad(element: HTMLVideoElement, callbackFn: EventListener): void {\n\n this.videoEndedListener = () => this.stopStreams();\n this.videoCanPlayListener = () => this.tryPlayVideo(element);\n\n element.addEventListener('ended', this.videoEndedListener);\n element.addEventListener('canplay', this.videoCanPlayListener);\n element.addEventListener('playing', callbackFn);\n\n // if canplay was already fired, we won't know when to play, so just give it a try\n this.tryPlayVideo(element);\n }\n\n /**\n * Checks if the given video element is currently playing.\n */\n isVideoPlaying(video: HTMLVideoElement): boolean {\n return video.currentTime > 0 && !video.paused && !video.ended && video.readyState > 2;\n }\n\n /**\n * Just tries to play the video and logs any errors.\n * The play call is only made is the video is not already playing.\n */\n async tryPlayVideo(videoElement: HTMLVideoElement): Promise {\n\n if (this.isVideoPlaying(videoElement)) {\n console.warn('Trying to play video that is already playing.');\n return;\n }\n\n try {\n await videoElement.play();\n } catch {\n console.warn('It was not possible to play the video.');\n }\n }\n\n /**\n * Searches and validates a media element.\n */\n public getMediaElement(mediaElementId: string, type: string): HTMLVisualMediaElement {\n\n const mediaElement = document.getElementById(mediaElementId);\n\n if (!mediaElement) {\n throw new ArgumentException(`element with id '${mediaElementId}' not found`);\n }\n\n if (mediaElement.nodeName.toLowerCase() !== type.toLowerCase()) {\n throw new ArgumentException(`element with id '${mediaElementId}' must be an ${type} element`);\n }\n\n return mediaElement;\n }\n\n /**\n * Decodes the barcode from an image.\n *\n * @param {(string|HTMLImageElement)} [source] The image element that can be either an element id or the element itself. Can be undefined in which case the decoding will be done from the imageUrl parameter.\n * @param {string} [url]\n * @returns {Promise} The decoding result.\n *\n * @memberOf BrowserCodeReader\n */\n public decodeFromImage(source?: string | HTMLImageElement, url?: string): Promise {\n\n if (!source && !url) {\n throw new ArgumentException('either imageElement with a src set or an url must be provided');\n }\n\n if (url && !source) {\n return this.decodeFromImageUrl(url);\n }\n\n return this.decodeFromImageElement(source);\n }\n\n /**\n * Decodes the barcode from a video.\n *\n * @param {(string|HTMLImageElement)} [source] The image element that can be either an element id or the element itself. Can be undefined in which case the decoding will be done from the imageUrl parameter.\n * @param {string} [url]\n * @returns {Promise} The decoding result.\n *\n * @memberOf BrowserCodeReader\n */\n public decodeFromVideo(source?: string | HTMLVideoElement, url?: string): Promise {\n\n if (!source && !url) {\n throw new ArgumentException('Either an element with a src set or an URL must be provided');\n }\n\n if (url && !source) {\n return this.decodeFromVideoUrl(url);\n }\n\n return this.decodeFromVideoElement(source);\n }\n\n /**\n * Decodes continuously the barcode from a video.\n *\n * @param {(string|HTMLImageElement)} [source] The image element that can be either an element id or the element itself. Can be undefined in which case the decoding will be done from the imageUrl parameter.\n * @param {string} [url]\n * @returns {Promise} The decoding result.\n *\n * @memberOf BrowserCodeReader\n *\n * @experimental\n */\n public decodeFromVideoContinuously(source: string | HTMLVideoElement | null, url: string | null, callbackFn: DecodeContinuouslyCallback): Promise {\n\n if (undefined === source && undefined === url) {\n throw new ArgumentException('Either an element with a src set or an URL must be provided');\n }\n\n if (url && !source) {\n return this.decodeFromVideoUrlContinuously(url, callbackFn);\n }\n\n return this.decodeFromVideoElementContinuously(source, callbackFn);\n }\n\n /**\n * Decodes something from an image HTML element.\n */\n public decodeFromImageElement(source: string | HTMLImageElement): Promise {\n\n if (!source) {\n throw new ArgumentException('An image element must be provided.');\n }\n\n this.reset();\n\n const element = this.prepareImageElement(source);\n\n this.imageElement = element;\n\n let task: Promise;\n\n if (this.isImageLoaded(element)) {\n task = this.decodeOnce(element, false, true);\n } else {\n task = this._decodeOnLoadImage(element);\n }\n\n return task;\n }\n\n /**\n * Decodes something from an image HTML element.\n */\n public decodeFromVideoElement(source: string | HTMLVideoElement): Promise {\n\n const element = this._decodeFromVideoElementSetup(source);\n\n return this._decodeOnLoadVideo(element);\n }\n\n /**\n * Decodes something from an image HTML element.\n */\n public decodeFromVideoElementContinuously(source: string | HTMLVideoElement, callbackFn: DecodeContinuouslyCallback): Promise {\n\n const element = this._decodeFromVideoElementSetup(source);\n\n return this._decodeOnLoadVideoContinuously(element, callbackFn);\n }\n\n /**\n * Sets up the video source so it can be decoded when loaded.\n *\n * @param source The video source element.\n */\n private _decodeFromVideoElementSetup(source: string | HTMLVideoElement) {\n\n if (!source) {\n throw new ArgumentException('A video element must be provided.');\n }\n\n this.reset();\n\n const element = this.prepareVideoElement(source);\n\n // defines the video element before starts decoding\n this.videoElement = element;\n\n return element;\n }\n\n /**\n * Decodes an image from a URL.\n */\n public decodeFromImageUrl(url?: string): Promise {\n\n if (!url) {\n throw new ArgumentException('An URL must be provided.');\n }\n\n this.reset();\n\n const element = this.prepareImageElement();\n\n this.imageElement = element;\n\n const decodeTask = this._decodeOnLoadImage(element);\n\n element.src = url;\n\n return decodeTask;\n }\n\n /**\n * Decodes an image from a URL.\n */\n public decodeFromVideoUrl(url: string): Promise {\n\n if (!url) {\n throw new ArgumentException('An URL must be provided.');\n }\n\n this.reset();\n\n // creates a new element\n const element = this.prepareVideoElement();\n\n const decodeTask = this.decodeFromVideoElement(element);\n\n element.src = url;\n\n return decodeTask;\n }\n\n /**\n * Decodes an image from a URL.\n *\n * @experimental\n */\n public decodeFromVideoUrlContinuously(url: string, callbackFn: DecodeContinuouslyCallback): Promise {\n\n if (!url) {\n throw new ArgumentException('An URL must be provided.');\n }\n\n this.reset();\n\n // creates a new element\n const element = this.prepareVideoElement();\n\n const decodeTask = this.decodeFromVideoElementContinuously(element, callbackFn);\n\n element.src = url;\n\n return decodeTask;\n }\n\n private _decodeOnLoadImage(element: HTMLImageElement): Promise {\n return new Promise((resolve, reject) => {\n this.imageLoadedListener = () => this.decodeOnce(element, false, true).then(resolve, reject);\n element.addEventListener('load', this.imageLoadedListener);\n });\n }\n\n private async _decodeOnLoadVideo(videoElement: HTMLVideoElement): Promise {\n // plays the video\n await this.playVideoOnLoadAsync(videoElement);\n // starts decoding after played the video\n return await this.decodeOnce(videoElement);\n }\n\n private async _decodeOnLoadVideoContinuously(videoElement: HTMLVideoElement, callbackFn: DecodeContinuouslyCallback): Promise {\n // plays the video\n await this.playVideoOnLoadAsync(videoElement);\n // starts decoding after played the video\n this.decodeContinuously(videoElement, callbackFn);\n }\n\n public isImageLoaded(img: HTMLImageElement) {\n // During the onload event, IE correctly identifies any images that\n // weren’t downloaded as not complete. Others should too. Gecko-based\n // browsers act like NS4 in that they report this incorrectly.\n if (!img.complete) {\n return false;\n }\n\n // However, they do have two very useful properties: naturalWidth and\n // naturalHeight. These give the true size of the image. If it failed\n // to load, either of these should be zero.\n\n if (img.naturalWidth === 0) {\n return false;\n }\n\n // No other way of checking: assume it’s ok.\n return true;\n }\n\n public prepareImageElement(imageSource?: HTMLImageElement | string): HTMLImageElement {\n\n let imageElement: HTMLImageElement;\n\n if (typeof imageSource === 'undefined') {\n imageElement = document.createElement('img');\n imageElement.width = 200;\n imageElement.height = 200;\n }\n\n if (typeof imageSource === 'string') {\n imageElement = this.getMediaElement(imageSource, 'img');\n }\n\n if (imageSource instanceof HTMLImageElement) {\n imageElement = imageSource;\n }\n\n return imageElement;\n }\n\n /**\n * Sets a HTMLVideoElement for scanning or creates a new one.\n *\n * @param videoSource The HTMLVideoElement to be set.\n */\n public prepareVideoElement(videoSource?: HTMLVideoElement | string): HTMLVideoElement {\n\n let videoElement: HTMLVideoElement;\n\n if (!videoSource && typeof document !== 'undefined') {\n videoElement = document.createElement('video');\n videoElement.width = 200;\n videoElement.height = 200;\n }\n\n if (typeof videoSource === 'string') {\n videoElement = this.getMediaElement(videoSource, 'video');\n }\n\n if (videoSource instanceof HTMLVideoElement) {\n videoElement = videoSource;\n }\n\n // Needed for iOS 11\n videoElement.setAttribute('autoplay', 'true');\n videoElement.setAttribute('muted', 'true');\n videoElement.setAttribute('playsinline', 'true');\n\n return videoElement;\n }\n\n /**\n * Tries to decode from the video input until it finds some value.\n */\n public decodeOnce(element: HTMLVisualMediaElement, retryIfNotFound = true, retryIfChecksumOrFormatError = true): Promise {\n\n this._stopAsyncDecode = false;\n\n const loop = (resolve: (value?: Result | PromiseLike) => void, reject: (reason?: any) => void) => {\n\n if (this._stopAsyncDecode) {\n reject(new NotFoundException('Video stream has ended before any code could be detected.'));\n this._stopAsyncDecode = undefined;\n return;\n }\n\n try {\n const result = this.decode(element);\n resolve(result);\n } catch (e) {\n\n const ifNotFound = retryIfNotFound && e instanceof NotFoundException;\n const isChecksumOrFormatError = e instanceof ChecksumException || e instanceof FormatException;\n const ifChecksumOrFormat = isChecksumOrFormatError && retryIfChecksumOrFormatError;\n\n if (ifNotFound || ifChecksumOrFormat) {\n // trying again\n return setTimeout(loop, this._timeBetweenDecodingAttempts, resolve, reject);\n }\n\n reject(e);\n }\n };\n\n return new Promise((resolve, reject) => loop(resolve, reject));\n }\n\n /**\n * Continuously decodes from video input.\n */\n public decodeContinuously(element: HTMLVideoElement, callbackFn: DecodeContinuouslyCallback): void {\n\n this._stopContinuousDecode = false;\n\n const loop = () => {\n\n if (this._stopContinuousDecode) {\n this._stopContinuousDecode = undefined;\n return;\n }\n\n try {\n const result = this.decode(element);\n callbackFn(result, null);\n setTimeout(loop, this.timeBetweenScansMillis);\n } catch (e) {\n\n callbackFn(null, e);\n\n const isChecksumOrFormatError = e instanceof ChecksumException || e instanceof FormatException;\n const isNotFound = e instanceof NotFoundException;\n\n if (isChecksumOrFormatError || isNotFound) {\n // trying again\n setTimeout(loop, this._timeBetweenDecodingAttempts);\n }\n\n }\n };\n\n loop();\n }\n\n /**\n * Gets the BinaryBitmap for ya! (and decodes it)\n */\n public decode(element: HTMLVisualMediaElement): Result {\n\n // get binary bitmap for decode function\n const binaryBitmap = this.createBinaryBitmap(element);\n\n return this.decodeBitmap(binaryBitmap);\n }\n\n /**\n * Creates a binaryBitmap based in some image source.\n *\n * @param mediaElement HTML element containing drawable image source.\n */\n public createBinaryBitmap(mediaElement: HTMLVisualMediaElement): BinaryBitmap {\n\n const ctx = this.getCaptureCanvasContext(mediaElement);\n\n this.drawImageOnCanvas(ctx, mediaElement);\n\n const canvas = this.getCaptureCanvas(mediaElement);\n\n const luminanceSource = new HTMLCanvasElementLuminanceSource(canvas);\n const hybridBinarizer = new HybridBinarizer(luminanceSource);\n\n return new BinaryBitmap(hybridBinarizer);\n }\n\n /**\n *\n */\n protected getCaptureCanvasContext(mediaElement?: HTMLVisualMediaElement) {\n\n if (!this.captureCanvasContext) {\n const elem = this.getCaptureCanvas(mediaElement);\n const ctx = elem.getContext('2d');\n this.captureCanvasContext = ctx;\n }\n\n return this.captureCanvasContext;\n }\n\n /**\n *\n */\n protected getCaptureCanvas(mediaElement?: HTMLVisualMediaElement): HTMLCanvasElement {\n\n if (!this.captureCanvas) {\n const elem = this.createCaptureCanvas(mediaElement);\n this.captureCanvas = elem;\n }\n\n return this.captureCanvas;\n }\n\n /**\n * Ovewriting this allows you to manipulate the snapshot image in anyway you want before decode.\n */\n public drawImageOnCanvas(canvasElementContext: CanvasRenderingContext2D, srcElement: HTMLVisualMediaElement) {\n canvasElementContext.drawImage(srcElement, 0, 0);\n }\n\n /**\n * Call the encapsulated readers decode\n */\n public decodeBitmap(binaryBitmap: BinaryBitmap): Result {\n return this.reader.decode(binaryBitmap, this._hints);\n }\n\n /**\n * 🖌 Prepares the canvas for capture and scan frames.\n */\n public createCaptureCanvas(mediaElement?: HTMLVisualMediaElement): HTMLCanvasElement {\n\n if (typeof document === 'undefined') {\n this._destroyCaptureCanvas();\n return null;\n }\n\n const canvasElement = document.createElement('canvas');\n\n let width: number;\n let height: number;\n\n if (typeof mediaElement !== 'undefined') {\n if (mediaElement instanceof HTMLVideoElement) {\n width = mediaElement.videoWidth;\n height = mediaElement.videoHeight;\n } else if (mediaElement instanceof HTMLImageElement) {\n width = mediaElement.naturalWidth || mediaElement.width;\n height = mediaElement.naturalHeight || mediaElement.height;\n }\n }\n\n canvasElement.style.width = width + 'px';\n canvasElement.style.height = height + 'px';\n canvasElement.width = width;\n canvasElement.height = height;\n\n return canvasElement;\n }\n\n /**\n * Stops the continuous scan and cleans the stream.\n */\n protected stopStreams(): void {\n if (this.stream) {\n this.stream.getVideoTracks().forEach(t => t.stop());\n this.stream = undefined;\n }\n if (this._stopAsyncDecode === false) {\n this.stopAsyncDecode();\n }\n if (this._stopContinuousDecode === false) {\n this.stopContinuousDecode();\n }\n }\n\n /**\n * Resets the code reader to the initial state. Cancels any ongoing barcode scanning from video or camera.\n *\n * @memberOf BrowserCodeReader\n */\n public reset() {\n\n // stops the camera, preview and scan 🔴\n\n this.stopStreams();\n\n // clean and forget about HTML elements\n\n this._destroyVideoElement();\n this._destroyImageElement();\n this._destroyCaptureCanvas();\n }\n\n private _destroyVideoElement(): void {\n\n if (!this.videoElement) {\n return;\n }\n\n // first gives freedon to the element 🕊\n\n if (typeof this.videoEndedListener !== 'undefined') {\n this.videoElement.removeEventListener('ended', this.videoEndedListener);\n }\n\n if (typeof this.videoPlayingEventListener !== 'undefined') {\n this.videoElement.removeEventListener('playing', this.videoPlayingEventListener);\n }\n\n if (typeof this.videoCanPlayListener !== 'undefined') {\n this.videoElement.removeEventListener('loadedmetadata', this.videoCanPlayListener);\n }\n\n // then forgets about that element 😢\n\n this.cleanVideoSource(this.videoElement);\n\n this.videoElement = undefined;\n }\n\n private _destroyImageElement(): void {\n\n if (!this.imageElement) {\n return;\n }\n\n // first gives freedon to the element 🕊\n\n if (undefined !== this.imageLoadedListener) {\n this.imageElement.removeEventListener('load', this.imageLoadedListener);\n }\n\n // then forget about that element 😢\n\n this.imageElement.src = undefined;\n this.imageElement.removeAttribute('src');\n this.imageElement = undefined;\n }\n\n /**\n * Cleans canvas references 🖌\n */\n private _destroyCaptureCanvas(): void {\n\n // then forget about that element 😢\n\n this.captureCanvasContext = undefined;\n this.captureCanvas = undefined;\n }\n\n /**\n * Defines what the videoElement src will be.\n *\n * @param videoElement\n * @param stream\n */\n public addVideoSource(videoElement: HTMLVideoElement, stream: MediaStream): void {\n // Older browsers may not have `srcObject`\n try {\n // @note Throws Exception if interrupted by a new loaded request\n videoElement.srcObject = stream;\n } catch (err) {\n // @note Avoid using this in new browsers, as it is going away.\n videoElement.src = URL.createObjectURL(stream);\n }\n }\n\n /**\n * Unbinds a HTML video src property.\n *\n * @param videoElement\n */\n private cleanVideoSource(videoElement: HTMLVideoElement): void {\n\n try {\n videoElement.srcObject = null;\n } catch (err) {\n videoElement.src = '';\n }\n\n this.videoElement.removeAttribute('src');\n }\n}\n","/*\n * Copyright 2007 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*namespace com.google.zxing.common {*/\n\n/*import java.util.Arrays;*/\n\nimport System from '../util/System';\nimport Integer from '../util/Integer';\nimport Arrays from '../util/Arrays';\n\nimport IllegalArgumentException from '../IllegalArgumentException';\n\n/**\n *

A simple, fast array of bits, represented compactly by an array of ints internally.

\n *\n * @author Sean Owen\n */\nexport default class BitArray /*implements Cloneable*/ {\n\n private size: number;\n private bits: Int32Array;\n\n // public constructor() {\n // this.size = 0\n // this.bits = new Int32Array(1)\n // }\n\n // public constructor(size?: number /*int*/) {\n // if (undefined === size) {\n // this.size = 0\n // } else {\n // this.size = size\n // }\n // this.bits = this.makeArray(size)\n // }\n\n // For testing only\n public constructor(size?: number /*int*/, bits?: Int32Array) {\n if (undefined === size) {\n this.size = 0;\n this.bits = new Int32Array(1);\n } else {\n this.size = size;\n if (undefined === bits || null === bits) {\n this.bits = BitArray.makeArray(size);\n } else {\n this.bits = bits;\n }\n }\n }\n\n public getSize(): number /*int*/ {\n return this.size;\n }\n\n public getSizeInBytes(): number /*int*/ {\n return Math.floor((this.size + 7) / 8);\n }\n\n private ensureCapacity(size: number /*int*/): void {\n if (size > this.bits.length * 32) {\n const newBits = BitArray.makeArray(size);\n System.arraycopy(this.bits, 0, newBits, 0, this.bits.length);\n this.bits = newBits;\n }\n }\n\n /**\n * @param i bit to get\n * @return true iff bit i is set\n */\n public get(i: number /*int*/): boolean {\n return (this.bits[Math.floor(i / 32)] & (1 << (i & 0x1F))) !== 0;\n }\n\n /**\n * Sets bit i.\n *\n * @param i bit to set\n */\n public set(i: number /*int*/): void {\n this.bits[Math.floor(i / 32)] |= 1 << (i & 0x1F);\n }\n\n /**\n * Flips bit i.\n *\n * @param i bit to set\n */\n public flip(i: number /*int*/): void {\n this.bits[Math.floor(i / 32)] ^= 1 << (i & 0x1F);\n }\n\n /**\n * @param from first bit to check\n * @return index of first bit that is set, starting from the given index, or size if none are set\n * at or beyond this given index\n * @see #getNextUnset(int)\n */\n public getNextSet(from: number /*int*/): number /*int*/ {\n const size = this.size;\n if (from >= size) {\n return size;\n }\n const bits = this.bits;\n let bitsOffset = Math.floor(from / 32);\n let currentBits = bits[bitsOffset];\n // mask off lesser bits first\n currentBits &= ~((1 << (from & 0x1F)) - 1);\n const length = bits.length;\n while (currentBits === 0) {\n if (++bitsOffset === length) {\n return size;\n }\n currentBits = bits[bitsOffset];\n }\n const result = (bitsOffset * 32) + Integer.numberOfTrailingZeros(currentBits);\n return result > size ? size : result;\n }\n\n /**\n * @param from index to start looking for unset bit\n * @return index of next unset bit, or {@code size} if none are unset until the end\n * @see #getNextSet(int)\n */\n public getNextUnset(from: number /*int*/): number /*int*/ {\n const size = this.size;\n if (from >= size) {\n return size;\n }\n const bits = this.bits;\n let bitsOffset = Math.floor(from / 32);\n let currentBits = ~bits[bitsOffset];\n // mask off lesser bits first\n currentBits &= ~((1 << (from & 0x1F)) - 1);\n const length = bits.length;\n while (currentBits === 0) {\n if (++bitsOffset === length) {\n return size;\n }\n currentBits = ~bits[bitsOffset];\n }\n const result = (bitsOffset * 32) + Integer.numberOfTrailingZeros(currentBits);\n return result > size ? size : result;\n }\n\n /**\n * Sets a block of 32 bits, starting at bit i.\n *\n * @param i first bit to set\n * @param newBits the new value of the next 32 bits. Note again that the least-significant bit\n * corresponds to bit i, the next-least-significant to i+1, and so on.\n */\n public setBulk(i: number /*int*/, newBits: number /*int*/): void {\n this.bits[Math.floor(i / 32)] = newBits;\n }\n\n /**\n * Sets a range of bits.\n *\n * @param start start of range, inclusive.\n * @param end end of range, exclusive\n */\n public setRange(start: number /*int*/, end: number /*int*/): void {\n if (end < start || start < 0 || end > this.size) {\n throw new IllegalArgumentException();\n }\n if (end === start) {\n return;\n }\n end--; // will be easier to treat this as the last actually set bit -- inclusive\n const firstInt = Math.floor(start / 32);\n const lastInt = Math.floor(end / 32);\n const bits = this.bits;\n for (let i = firstInt; i <= lastInt; i++) {\n const firstBit = i > firstInt ? 0 : start & 0x1F;\n const lastBit = i < lastInt ? 31 : end & 0x1F;\n // Ones from firstBit to lastBit, inclusive\n const mask = (2 << lastBit) - (1 << firstBit);\n bits[i] |= mask;\n }\n }\n\n /**\n * Clears all bits (sets to false).\n */\n public clear(): void {\n const max = this.bits.length;\n const bits = this.bits;\n for (let i = 0; i < max; i++) {\n bits[i] = 0;\n }\n }\n\n /**\n * Efficient method to check if a range of bits is set, or not set.\n *\n * @param start start of range, inclusive.\n * @param end end of range, exclusive\n * @param value if true, checks that bits in range are set, otherwise checks that they are not set\n * @return true iff all bits are set or not set in range, according to value argument\n * @throws IllegalArgumentException if end is less than start or the range is not contained in the array\n */\n public isRange(start: number /*int*/, end: number /*int*/, value: boolean): boolean {\n if (end < start || start < 0 || end > this.size) {\n throw new IllegalArgumentException();\n }\n if (end === start) {\n return true; // empty range matches\n }\n end--; // will be easier to treat this as the last actually set bit -- inclusive\n const firstInt = Math.floor(start / 32);\n const lastInt = Math.floor(end / 32);\n const bits = this.bits;\n for (let i = firstInt; i <= lastInt; i++) {\n const firstBit = i > firstInt ? 0 : start & 0x1F;\n const lastBit = i < lastInt ? 31 : end & 0x1F;\n // Ones from firstBit to lastBit, inclusive\n const mask = (2 << lastBit) - (1 << firstBit) & 0xFFFFFFFF;\n // TYPESCRIPTPORT: & 0xFFFFFFFF added to discard anything after 32 bits, as ES has 53 bits\n // Return false if we're looking for 1s and the masked bits[i] isn't all 1s (is: that,\n // equals the mask, or we're looking for 0s and the masked portion is not all 0s\n if ((bits[i] & mask) !== (value ? mask : 0)) {\n return false;\n }\n }\n return true;\n }\n\n public appendBit(bit: boolean): void {\n this.ensureCapacity(this.size + 1);\n if (bit) {\n this.bits[Math.floor(this.size / 32)] |= 1 << (this.size & 0x1F);\n }\n this.size++;\n }\n\n /**\n * Appends the least-significant bits, from value, in order from most-significant to\n * least-significant. For example, appending 6 bits from 0x000001E will append the bits\n * 0, 1, 1, 1, 1, 0 in that order.\n *\n * @param value {@code int} containing bits to append\n * @param numBits bits from value to append\n */\n public appendBits(value: number /*int*/, numBits: number /*int*/): void {\n if (numBits < 0 || numBits > 32) {\n throw new IllegalArgumentException('Num bits must be between 0 and 32');\n }\n this.ensureCapacity(this.size + numBits);\n const appendBit = this.appendBit;\n for (let numBitsLeft = numBits; numBitsLeft > 0; numBitsLeft--) {\n this.appendBit(((value >> (numBitsLeft - 1)) & 0x01) === 1);\n }\n }\n\n public appendBitArray(other: BitArray): void {\n const otherSize = other.size;\n this.ensureCapacity(this.size + otherSize);\n const appendBit = this.appendBit;\n for (let i = 0; i < otherSize; i++) {\n this.appendBit(other.get(i));\n }\n }\n\n public xor(other: BitArray): void {\n if (this.size !== other.size) {\n throw new IllegalArgumentException('Sizes don\\'t match');\n }\n const bits = this.bits;\n for (let i = 0, length = bits.length; i < length; i++) {\n // The last int could be incomplete (i.e. not have 32 bits in\n // it) but there is no problem since 0 XOR 0 == 0.\n bits[i] ^= other.bits[i];\n }\n }\n\n /**\n *\n * @param bitOffset first bit to start writing\n * @param array array to write into. Bytes are written most-significant byte first. This is the opposite\n * of the internal representation, which is exposed by {@link #getBitArray()}\n * @param offset position in array to start writing\n * @param numBytes how many bytes to write\n */\n public toBytes(bitOffset: number /*int*/, array: Uint8Array, offset: number /*int*/, numBytes: number /*int*/): void {\n for (let i = 0; i < numBytes; i++) {\n let theByte = 0;\n for (let j = 0; j < 8; j++) {\n if (this.get(bitOffset)) {\n theByte |= 1 << (7 - j);\n }\n bitOffset++;\n }\n array[offset + i] = /*(byte)*/ theByte;\n }\n }\n\n /**\n * @return underlying array of ints. The first element holds the first 32 bits, and the least\n * significant bit is bit 0.\n */\n public getBitArray(): Int32Array {\n return this.bits;\n }\n\n /**\n * Reverses all bits in the array.\n */\n public reverse(): void {\n const newBits = new Int32Array(this.bits.length);\n // reverse all int's first\n const len = Math.floor((this.size - 1) / 32);\n const oldBitsLen = len + 1;\n const bits = this.bits;\n for (let i = 0; i < oldBitsLen; i++) {\n let x = bits[i];\n x = ((x >> 1) & 0x55555555) | ((x & 0x55555555) << 1);\n x = ((x >> 2) & 0x33333333) | ((x & 0x33333333) << 2);\n x = ((x >> 4) & 0x0f0f0f0f) | ((x & 0x0f0f0f0f) << 4);\n x = ((x >> 8) & 0x00ff00ff) | ((x & 0x00ff00ff) << 8);\n x = ((x >> 16) & 0x0000ffff) | ((x & 0x0000ffff) << 16);\n newBits[len - i] = /*(int)*/ x;\n }\n // now correct the int's if the bit size isn't a multiple of 32\n if (this.size !== oldBitsLen * 32) {\n const leftOffset = oldBitsLen * 32 - this.size;\n let currentInt = newBits[0] >>> leftOffset;\n for (let i = 1; i < oldBitsLen; i++) {\n const nextInt = newBits[i];\n currentInt |= nextInt << (32 - leftOffset);\n newBits[i - 1] = currentInt;\n currentInt = nextInt >>> leftOffset;\n }\n newBits[oldBitsLen - 1] = currentInt;\n }\n this.bits = newBits;\n }\n\n private static makeArray(size: number /*int*/): Int32Array {\n return new Int32Array(Math.floor((size + 31) / 32));\n }\n\n /*@Override*/\n public equals(o: any): boolean {\n if (!(o instanceof BitArray)) {\n return false;\n }\n const other = o;\n return this.size === other.size && Arrays.equals(this.bits, other.bits);\n }\n\n /*@Override*/\n public hashCode(): number /*int*/ {\n return 31 * this.size + Arrays.hashCode(this.bits);\n }\n\n /*@Override*/\n public toString(): string {\n let result = '';\n for (let i = 0, size = this.size; i < size; i++) {\n if ((i & 0x07) === 0) {\n result += ' ';\n }\n result += this.get(i) ? 'X' : '.';\n }\n return result;\n }\n\n /*@Override*/\n public clone(): BitArray {\n return new BitArray(this.size, this.bits.slice());\n }\n\n}\n","import System from './System';\nimport IllegalArgumentException from '../IllegalArgumentException';\nimport ArrayIndexOutOfBoundsException from '../ArrayIndexOutOfBoundsException';\nimport { int } from '../../customTypings';\n\nexport default class Arrays {\n\n /**\n * Assigns the specified int value to each element of the specified array\n * of ints.\n *\n * @param a the array to be filled\n * @param val the value to be stored in all elements of the array\n */\n public static fill(a: Int32Array | Uint8Array | any[], val: int): void {\n for (let i = 0, len = a.length; i < len; i++)\n a[i] = val;\n }\n\n /**\n * Assigns the specified int value to each element of the specified\n * range of the specified array of ints. The range to be filled\n * extends from index {@code fromIndex}, inclusive, to index\n * {@code toIndex}, exclusive. (If {@code fromIndex==toIndex}, the\n * range to be filled is empty.)\n *\n * @param a the array to be filled\n * @param fromIndex the index of the first element (inclusive) to be\n * filled with the specified value\n * @param toIndex the index of the last element (exclusive) to be\n * filled with the specified value\n * @param val the value to be stored in all elements of the array\n * @throws IllegalArgumentException if {@code fromIndex > toIndex}\n * @throws ArrayIndexOutOfBoundsException if {@code fromIndex < 0} or\n * {@code toIndex > a.length}\n */\n public static fillWithin(a: Int32Array, fromIndex: int, toIndex: int, val: int): void {\n Arrays.rangeCheck(a.length, fromIndex, toIndex);\n for (let i = fromIndex; i < toIndex; i++)\n a[i] = val;\n }\n\n /**\n * Checks that {@code fromIndex} and {@code toIndex} are in\n * the range and throws an exception if they aren't.\n */\n static rangeCheck(arrayLength: int, fromIndex: int, toIndex: int): void {\n if (fromIndex > toIndex) {\n throw new IllegalArgumentException(\n 'fromIndex(' + fromIndex + ') > toIndex(' + toIndex + ')');\n }\n if (fromIndex < 0) {\n throw new ArrayIndexOutOfBoundsException(fromIndex);\n }\n if (toIndex > arrayLength) {\n throw new ArrayIndexOutOfBoundsException(toIndex);\n }\n }\n\n public static asList(...args: T[]): T[] {\n return args;\n }\n\n public static create(rows: int, cols: int, value?: T): T[][] {\n\n let arr = Array.from({ length: rows });\n\n return arr.map(x => Array.from({ length: cols }).fill(value));\n }\n\n public static createInt32Array(rows: int, cols: int, value?: int): Int32Array[] {\n\n let arr = Array.from({ length: rows });\n\n return arr.map(x => Int32Array.from({ length: cols }).fill(value));\n }\n\n public static equals(first: any, second: any): boolean {\n if (!first) {\n return false;\n }\n if (!second) {\n return false;\n }\n if (!first.length) {\n return false;\n }\n if (!second.length) {\n return false;\n }\n if (first.length !== second.length) {\n return false;\n }\n for (let i = 0, length = first.length; i < length; i++) {\n if (first[i] !== second[i]) {\n return false;\n }\n }\n return true;\n }\n\n public static hashCode(a: any) {\n if (a === null) {\n return 0;\n }\n let result = 1;\n for (const element of a) {\n result = 31 * result + element;\n }\n return result;\n }\n\n public static fillUint8Array(a: Uint8Array, value: number) {\n for (let i = 0; i !== a.length; i++) {\n a[i] = value;\n }\n }\n\n public static copyOf(original: Int32Array, newLength: number): Int32Array {\n return original.slice(0, newLength);\n }\n\n public static copyOfUint8Array(original: Uint8Array, newLength: number): Uint8Array {\n\n if (original.length <= newLength) {\n const newArray = new Uint8Array(newLength);\n newArray.set(original);\n return newArray;\n }\n\n return original.slice(0, newLength);\n }\n\n public static copyOfRange(original: Int32Array, from: number, to: number): Int32Array {\n const newLength = to - from;\n const copy = new Int32Array(newLength);\n System.arraycopy(original, from, copy, 0, newLength);\n return copy;\n }\n\n /*\n * Returns the index of of the element in a sorted array or (-n-1) where n is the insertion point\n * for the new element.\n * Parameters:\n * ar - A sorted array\n * el - An element to search for\n * comparator - A comparator function. The function takes two arguments: (a, b) and returns:\n * a negative number if a is less than b;\n * 0 if a is equal to b;\n * a positive number of a is greater than b.\n * The array may contain duplicate elements. If there are more than one equal elements in the array,\n * the returned value can be the index of any one of the equal elements.\n *\n * http://jsfiddle.net/aryzhov/pkfst550/\n */\n public static binarySearch(ar: Int32Array, el: number, comparator?: (a: number, b: number) => number): number {\n if (undefined === comparator) {\n comparator = Arrays.numberComparator;\n }\n let m = 0;\n let n = ar.length - 1;\n while (m <= n) {\n const k = (n + m) >> 1;\n const cmp = comparator(el, ar[k]);\n if (cmp > 0) {\n m = k + 1;\n } else if (cmp < 0) {\n n = k - 1;\n } else {\n return k;\n }\n }\n return -m - 1;\n }\n\n public static numberComparator(a: number, b: number) {\n return a - b;\n }\n}\n","/*\n * Copyright 2007 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*namespace com.google.zxing.common.reedsolomon {*/\n\nimport GenericGFPoly from './GenericGFPoly';\nimport AbstractGenericGF from './AbstractGenericGF';\n\nimport Integer from '../../util/Integer';\nimport IllegalArgumentException from '../../IllegalArgumentException';\nimport ArithmeticException from '../../ArithmeticException';\n\n/**\n *

This class contains utility methods for performing mathematical operations over\n * the Galois Fields. Operations use a given primitive polynomial in calculations.

\n *\n *

Throughout this package, elements of the GF are represented as an {@code int}\n * for convenience and speed (but at the cost of memory).\n *

\n *\n * @author Sean Owen\n * @author David Olivier\n */\nexport default class GenericGF extends AbstractGenericGF {\n public static AZTEC_DATA_12 = new GenericGF(0x1069, 4096, 1); // x^12 + x^6 + x^5 + x^3 + 1\n public static AZTEC_DATA_10 = new GenericGF(0x409, 1024, 1); // x^10 + x^3 + 1\n public static AZTEC_DATA_6 = new GenericGF(0x43, 64, 1); // x^6 + x + 1\n public static AZTEC_PARAM = new GenericGF(0x13, 16, 1); // x^4 + x + 1\n public static QR_CODE_FIELD_256 = new GenericGF(0x011d, 256, 0); // x^8 + x^4 + x^3 + x^2 + 1\n public static DATA_MATRIX_FIELD_256 = new GenericGF(0x012d, 256, 1); // x^8 + x^5 + x^3 + x^2 + 1\n public static AZTEC_DATA_8 = GenericGF.DATA_MATRIX_FIELD_256;\n public static MAXICODE_FIELD_64 = GenericGF.AZTEC_DATA_6;\n\n private zero: GenericGFPoly;\n private one: GenericGFPoly;\n\n /**\n * Create a representation of GF(size) using the given primitive polynomial.\n *\n * @param primitive irreducible polynomial whose coefficients are represented by\n * the bits of an int, where the least-significant bit represents the constant\n * coefficient\n * @param size the size of the field\n * @param b the factor b in the generator polynomial can be 0- or 1-based\n * (g(x) = (x+a^b)(x+a^(b+1))...(x+a^(b+2t-1))).\n * In most cases it should be 1, but for QR code it is 0.\n */\n public constructor(\n private primitive: number /*int*/,\n private size: number /*int*/,\n private generatorBase: number /*int*/\n ) {\n super();\n const expTable = new Int32Array(size);\n let x = 1;\n for (let i = 0; i < size; i++) {\n expTable[i] = x;\n x *= 2; // we're assuming the generator alpha is 2\n if (x >= size) {\n x ^= primitive;\n x &= size - 1;\n }\n }\n this.expTable = expTable;\n\n const logTable = new Int32Array(size);\n for (let i = 0; i < size - 1; i++) {\n logTable[expTable[i]] = i;\n }\n this.logTable = logTable;\n\n // logTable[0] == 0 but this should never be used\n this.zero = new GenericGFPoly(this, Int32Array.from([0]));\n this.one = new GenericGFPoly(this, Int32Array.from([1]));\n }\n\n public getZero(): GenericGFPoly {\n return this.zero;\n }\n\n public getOne(): GenericGFPoly {\n return this.one;\n }\n\n /**\n * @return the monomial representing coefficient * x^degree\n */\n public buildMonomial(\n degree: number /*int*/,\n coefficient: number /*int*/\n ): GenericGFPoly {\n if (degree < 0) {\n throw new IllegalArgumentException();\n }\n if (coefficient === 0) {\n return this.zero;\n }\n const coefficients = new Int32Array(degree + 1);\n coefficients[0] = coefficient;\n return new GenericGFPoly(this, coefficients);\n }\n\n /**\n * @return multiplicative inverse of a\n */\n public inverse(a: number /*int*/): number /*int*/ {\n if (a === 0) {\n throw new ArithmeticException();\n }\n return this.expTable[this.size - this.logTable[a] - 1];\n }\n\n /**\n * @return product of a and b in GF(size)\n */\n public multiply(a: number /*int*/, b: number /*int*/): number /*int*/ {\n if (a === 0 || b === 0) {\n return 0;\n }\n return this.expTable[\n (this.logTable[a] + this.logTable[b]) % (this.size - 1)\n ];\n }\n\n public getSize(): number /*int*/ {\n return this.size;\n }\n\n public getGeneratorBase(): number /*int*/ {\n return this.generatorBase;\n }\n\n /*@Override*/\n public toString(): string {\n return (\n 'GF(0x' + Integer.toHexString(this.primitive) + ',' + this.size + ')'\n );\n }\n\n public equals(o: Object): boolean {\n return o === this;\n }\n}\n","/*\n* Copyright 2009 ZXing authors\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n// package com.google.zxing.pdf417;\n\n// import java.util.Arrays;\nimport Arrays from '../util/Arrays';\n// import java.util.Collection;\n\n// import com.google.zxing.common.detector.MathUtils;\nimport MathUtils from '../common/detector/MathUtils';\n\nimport { int } from '../../customTypings';\n\n/**\n * @author SITA Lab (kevin.osullivan@sita.aero)\n * @author Guenther Grau\n */\nexport default /*public final*/ class PDF417Common {\n\n public static /*final int*/ NUMBER_OF_CODEWORDS = 929;\n // Maximum Codewords (Data + Error).\n public static /*final int*/ MAX_CODEWORDS_IN_BARCODE = PDF417Common.NUMBER_OF_CODEWORDS - 1;\n public static /*final int*/ MIN_ROWS_IN_BARCODE = 3;\n public static /*final int*/ MAX_ROWS_IN_BARCODE = 90;\n // One left row indication column + max 30 data columns + one right row indicator column\n // public static /*final*/ MAX_CODEWORDS_IN_ROW: /*int*/ number = 32;\n public static /*final int*/ MODULES_IN_CODEWORD = 17;\n public static /*final int*/ MODULES_IN_STOP_PATTERN = 18;\n public static /*final int*/ BARS_IN_MODULE = 8;\n\n private static /*final int[]*/ EMPTY_INT_ARRAY: Int32Array = new Int32Array([]);\n\n private PDF417Common() {\n }\n\n /**\n * @param moduleBitCount values to sum\n * @return sum of values\n * @deprecated call {@link MathUtils#sum(int[])}\n */\n // @Deprecated\n public static getBitCountSum(moduleBitCount: Int32Array): int {\n return MathUtils.sum(moduleBitCount);\n }\n\n public static toIntArray(list: /*Collection*/ int[]): Int32Array {\n if (list == null || !list.length) {\n return PDF417Common.EMPTY_INT_ARRAY;\n }\n const result = new Int32Array(list.length);\n let i: int = 0;\n for (const integer of list) {\n result[i++] = integer;\n }\n return result;\n }\n\n /**\n * @param symbol encoded symbol to translate to a codeword\n * @return the codeword corresponding to the symbol.\n */\n public static getCodeword(symbol: number/*int*/): number/*int*/ {\n const i = Arrays.binarySearch(PDF417Common.SYMBOL_TABLE, symbol & 0x3FFFF);\n if (i < 0) {\n return -1;\n }\n return (PDF417Common.CODEWORD_TABLE[i] - 1) % PDF417Common.NUMBER_OF_CODEWORDS;\n }\n\n /**\n * The sorted table of all possible symbols. Extracted from the PDF417\n * specification. The index of a symbol in this table corresponds to the\n * index into the codeword table.\n */\n public static /*final int[]*/ SYMBOL_TABLE = Int32Array.from([\n 0x1025e, 0x1027a, 0x1029e, 0x102bc, 0x102f2, 0x102f4, 0x1032e, 0x1034e, 0x1035c, 0x10396, 0x103a6, 0x103ac,\n 0x10422, 0x10428, 0x10436, 0x10442, 0x10444, 0x10448, 0x10450, 0x1045e, 0x10466, 0x1046c, 0x1047a, 0x10482,\n 0x1049e, 0x104a0, 0x104bc, 0x104c6, 0x104d8, 0x104ee, 0x104f2, 0x104f4, 0x10504, 0x10508, 0x10510, 0x1051e,\n 0x10520, 0x1053c, 0x10540, 0x10578, 0x10586, 0x1058c, 0x10598, 0x105b0, 0x105be, 0x105ce, 0x105dc, 0x105e2,\n 0x105e4, 0x105e8, 0x105f6, 0x1062e, 0x1064e, 0x1065c, 0x1068e, 0x1069c, 0x106b8, 0x106de, 0x106fa, 0x10716,\n 0x10726, 0x1072c, 0x10746, 0x1074c, 0x10758, 0x1076e, 0x10792, 0x10794, 0x107a2, 0x107a4, 0x107a8, 0x107b6,\n 0x10822, 0x10828, 0x10842, 0x10848, 0x10850, 0x1085e, 0x10866, 0x1086c, 0x1087a, 0x10882, 0x10884, 0x10890,\n 0x1089e, 0x108a0, 0x108bc, 0x108c6, 0x108cc, 0x108d8, 0x108ee, 0x108f2, 0x108f4, 0x10902, 0x10908, 0x1091e,\n 0x10920, 0x1093c, 0x10940, 0x10978, 0x10986, 0x10998, 0x109b0, 0x109be, 0x109ce, 0x109dc, 0x109e2, 0x109e4,\n 0x109e8, 0x109f6, 0x10a08, 0x10a10, 0x10a1e, 0x10a20, 0x10a3c, 0x10a40, 0x10a78, 0x10af0, 0x10b06, 0x10b0c,\n 0x10b18, 0x10b30, 0x10b3e, 0x10b60, 0x10b7c, 0x10b8e, 0x10b9c, 0x10bb8, 0x10bc2, 0x10bc4, 0x10bc8, 0x10bd0,\n 0x10bde, 0x10be6, 0x10bec, 0x10c2e, 0x10c4e, 0x10c5c, 0x10c62, 0x10c64, 0x10c68, 0x10c76, 0x10c8e, 0x10c9c,\n 0x10cb8, 0x10cc2, 0x10cc4, 0x10cc8, 0x10cd0, 0x10cde, 0x10ce6, 0x10cec, 0x10cfa, 0x10d0e, 0x10d1c, 0x10d38,\n 0x10d70, 0x10d7e, 0x10d82, 0x10d84, 0x10d88, 0x10d90, 0x10d9e, 0x10da0, 0x10dbc, 0x10dc6, 0x10dcc, 0x10dd8,\n 0x10dee, 0x10df2, 0x10df4, 0x10e16, 0x10e26, 0x10e2c, 0x10e46, 0x10e58, 0x10e6e, 0x10e86, 0x10e8c, 0x10e98,\n 0x10eb0, 0x10ebe, 0x10ece, 0x10edc, 0x10f0a, 0x10f12, 0x10f14, 0x10f22, 0x10f28, 0x10f36, 0x10f42, 0x10f44,\n 0x10f48, 0x10f50, 0x10f5e, 0x10f66, 0x10f6c, 0x10fb2, 0x10fb4, 0x11022, 0x11028, 0x11042, 0x11048, 0x11050,\n 0x1105e, 0x1107a, 0x11082, 0x11084, 0x11090, 0x1109e, 0x110a0, 0x110bc, 0x110c6, 0x110cc, 0x110d8, 0x110ee,\n 0x110f2, 0x110f4, 0x11102, 0x1111e, 0x11120, 0x1113c, 0x11140, 0x11178, 0x11186, 0x11198, 0x111b0, 0x111be,\n 0x111ce, 0x111dc, 0x111e2, 0x111e4, 0x111e8, 0x111f6, 0x11208, 0x1121e, 0x11220, 0x11278, 0x112f0, 0x1130c,\n 0x11330, 0x1133e, 0x11360, 0x1137c, 0x1138e, 0x1139c, 0x113b8, 0x113c2, 0x113c8, 0x113d0, 0x113de, 0x113e6,\n 0x113ec, 0x11408, 0x11410, 0x1141e, 0x11420, 0x1143c, 0x11440, 0x11478, 0x114f0, 0x115e0, 0x1160c, 0x11618,\n 0x11630, 0x1163e, 0x11660, 0x1167c, 0x116c0, 0x116f8, 0x1171c, 0x11738, 0x11770, 0x1177e, 0x11782, 0x11784,\n 0x11788, 0x11790, 0x1179e, 0x117a0, 0x117bc, 0x117c6, 0x117cc, 0x117d8, 0x117ee, 0x1182e, 0x11834, 0x1184e,\n 0x1185c, 0x11862, 0x11864, 0x11868, 0x11876, 0x1188e, 0x1189c, 0x118b8, 0x118c2, 0x118c8, 0x118d0, 0x118de,\n 0x118e6, 0x118ec, 0x118fa, 0x1190e, 0x1191c, 0x11938, 0x11970, 0x1197e, 0x11982, 0x11984, 0x11990, 0x1199e,\n 0x119a0, 0x119bc, 0x119c6, 0x119cc, 0x119d8, 0x119ee, 0x119f2, 0x119f4, 0x11a0e, 0x11a1c, 0x11a38, 0x11a70,\n 0x11a7e, 0x11ae0, 0x11afc, 0x11b08, 0x11b10, 0x11b1e, 0x11b20, 0x11b3c, 0x11b40, 0x11b78, 0x11b8c, 0x11b98,\n 0x11bb0, 0x11bbe, 0x11bce, 0x11bdc, 0x11be2, 0x11be4, 0x11be8, 0x11bf6, 0x11c16, 0x11c26, 0x11c2c, 0x11c46,\n 0x11c4c, 0x11c58, 0x11c6e, 0x11c86, 0x11c98, 0x11cb0, 0x11cbe, 0x11cce, 0x11cdc, 0x11ce2, 0x11ce4, 0x11ce8,\n 0x11cf6, 0x11d06, 0x11d0c, 0x11d18, 0x11d30, 0x11d3e, 0x11d60, 0x11d7c, 0x11d8e, 0x11d9c, 0x11db8, 0x11dc4,\n 0x11dc8, 0x11dd0, 0x11dde, 0x11de6, 0x11dec, 0x11dfa, 0x11e0a, 0x11e12, 0x11e14, 0x11e22, 0x11e24, 0x11e28,\n 0x11e36, 0x11e42, 0x11e44, 0x11e50, 0x11e5e, 0x11e66, 0x11e6c, 0x11e82, 0x11e84, 0x11e88, 0x11e90, 0x11e9e,\n 0x11ea0, 0x11ebc, 0x11ec6, 0x11ecc, 0x11ed8, 0x11eee, 0x11f1a, 0x11f2e, 0x11f32, 0x11f34, 0x11f4e, 0x11f5c,\n 0x11f62, 0x11f64, 0x11f68, 0x11f76, 0x12048, 0x1205e, 0x12082, 0x12084, 0x12090, 0x1209e, 0x120a0, 0x120bc,\n 0x120d8, 0x120f2, 0x120f4, 0x12108, 0x1211e, 0x12120, 0x1213c, 0x12140, 0x12178, 0x12186, 0x12198, 0x121b0,\n 0x121be, 0x121e2, 0x121e4, 0x121e8, 0x121f6, 0x12204, 0x12210, 0x1221e, 0x12220, 0x12278, 0x122f0, 0x12306,\n 0x1230c, 0x12330, 0x1233e, 0x12360, 0x1237c, 0x1238e, 0x1239c, 0x123b8, 0x123c2, 0x123c8, 0x123d0, 0x123e6,\n 0x123ec, 0x1241e, 0x12420, 0x1243c, 0x124f0, 0x125e0, 0x12618, 0x1263e, 0x12660, 0x1267c, 0x126c0, 0x126f8,\n 0x12738, 0x12770, 0x1277e, 0x12782, 0x12784, 0x12790, 0x1279e, 0x127a0, 0x127bc, 0x127c6, 0x127cc, 0x127d8,\n 0x127ee, 0x12820, 0x1283c, 0x12840, 0x12878, 0x128f0, 0x129e0, 0x12bc0, 0x12c18, 0x12c30, 0x12c3e, 0x12c60,\n 0x12c7c, 0x12cc0, 0x12cf8, 0x12df0, 0x12e1c, 0x12e38, 0x12e70, 0x12e7e, 0x12ee0, 0x12efc, 0x12f04, 0x12f08,\n 0x12f10, 0x12f20, 0x12f3c, 0x12f40, 0x12f78, 0x12f86, 0x12f8c, 0x12f98, 0x12fb0, 0x12fbe, 0x12fce, 0x12fdc,\n 0x1302e, 0x1304e, 0x1305c, 0x13062, 0x13068, 0x1308e, 0x1309c, 0x130b8, 0x130c2, 0x130c8, 0x130d0, 0x130de,\n 0x130ec, 0x130fa, 0x1310e, 0x13138, 0x13170, 0x1317e, 0x13182, 0x13184, 0x13190, 0x1319e, 0x131a0, 0x131bc,\n 0x131c6, 0x131cc, 0x131d8, 0x131f2, 0x131f4, 0x1320e, 0x1321c, 0x13270, 0x1327e, 0x132e0, 0x132fc, 0x13308,\n 0x1331e, 0x13320, 0x1333c, 0x13340, 0x13378, 0x13386, 0x13398, 0x133b0, 0x133be, 0x133ce, 0x133dc, 0x133e2,\n 0x133e4, 0x133e8, 0x133f6, 0x1340e, 0x1341c, 0x13438, 0x13470, 0x1347e, 0x134e0, 0x134fc, 0x135c0, 0x135f8,\n 0x13608, 0x13610, 0x1361e, 0x13620, 0x1363c, 0x13640, 0x13678, 0x136f0, 0x1370c, 0x13718, 0x13730, 0x1373e,\n 0x13760, 0x1377c, 0x1379c, 0x137b8, 0x137c2, 0x137c4, 0x137c8, 0x137d0, 0x137de, 0x137e6, 0x137ec, 0x13816,\n 0x13826, 0x1382c, 0x13846, 0x1384c, 0x13858, 0x1386e, 0x13874, 0x13886, 0x13898, 0x138b0, 0x138be, 0x138ce,\n 0x138dc, 0x138e2, 0x138e4, 0x138e8, 0x13906, 0x1390c, 0x13930, 0x1393e, 0x13960, 0x1397c, 0x1398e, 0x1399c,\n 0x139b8, 0x139c8, 0x139d0, 0x139de, 0x139e6, 0x139ec, 0x139fa, 0x13a06, 0x13a0c, 0x13a18, 0x13a30, 0x13a3e,\n 0x13a60, 0x13a7c, 0x13ac0, 0x13af8, 0x13b0e, 0x13b1c, 0x13b38, 0x13b70, 0x13b7e, 0x13b88, 0x13b90, 0x13b9e,\n 0x13ba0, 0x13bbc, 0x13bcc, 0x13bd8, 0x13bee, 0x13bf2, 0x13bf4, 0x13c12, 0x13c14, 0x13c22, 0x13c24, 0x13c28,\n 0x13c36, 0x13c42, 0x13c48, 0x13c50, 0x13c5e, 0x13c66, 0x13c6c, 0x13c82, 0x13c84, 0x13c90, 0x13c9e, 0x13ca0,\n 0x13cbc, 0x13cc6, 0x13ccc, 0x13cd8, 0x13cee, 0x13d02, 0x13d04, 0x13d08, 0x13d10, 0x13d1e, 0x13d20, 0x13d3c,\n 0x13d40, 0x13d78, 0x13d86, 0x13d8c, 0x13d98, 0x13db0, 0x13dbe, 0x13dce, 0x13ddc, 0x13de4, 0x13de8, 0x13df6,\n 0x13e1a, 0x13e2e, 0x13e32, 0x13e34, 0x13e4e, 0x13e5c, 0x13e62, 0x13e64, 0x13e68, 0x13e76, 0x13e8e, 0x13e9c,\n 0x13eb8, 0x13ec2, 0x13ec4, 0x13ec8, 0x13ed0, 0x13ede, 0x13ee6, 0x13eec, 0x13f26, 0x13f2c, 0x13f3a, 0x13f46,\n 0x13f4c, 0x13f58, 0x13f6e, 0x13f72, 0x13f74, 0x14082, 0x1409e, 0x140a0, 0x140bc, 0x14104, 0x14108, 0x14110,\n 0x1411e, 0x14120, 0x1413c, 0x14140, 0x14178, 0x1418c, 0x14198, 0x141b0, 0x141be, 0x141e2, 0x141e4, 0x141e8,\n 0x14208, 0x14210, 0x1421e, 0x14220, 0x1423c, 0x14240, 0x14278, 0x142f0, 0x14306, 0x1430c, 0x14318, 0x14330,\n 0x1433e, 0x14360, 0x1437c, 0x1438e, 0x143c2, 0x143c4, 0x143c8, 0x143d0, 0x143e6, 0x143ec, 0x14408, 0x14410,\n 0x1441e, 0x14420, 0x1443c, 0x14440, 0x14478, 0x144f0, 0x145e0, 0x1460c, 0x14618, 0x14630, 0x1463e, 0x14660,\n 0x1467c, 0x146c0, 0x146f8, 0x1471c, 0x14738, 0x14770, 0x1477e, 0x14782, 0x14784, 0x14788, 0x14790, 0x147a0,\n 0x147bc, 0x147c6, 0x147cc, 0x147d8, 0x147ee, 0x14810, 0x14820, 0x1483c, 0x14840, 0x14878, 0x148f0, 0x149e0,\n 0x14bc0, 0x14c30, 0x14c3e, 0x14c60, 0x14c7c, 0x14cc0, 0x14cf8, 0x14df0, 0x14e38, 0x14e70, 0x14e7e, 0x14ee0,\n 0x14efc, 0x14f04, 0x14f08, 0x14f10, 0x14f1e, 0x14f20, 0x14f3c, 0x14f40, 0x14f78, 0x14f86, 0x14f8c, 0x14f98,\n 0x14fb0, 0x14fce, 0x14fdc, 0x15020, 0x15040, 0x15078, 0x150f0, 0x151e0, 0x153c0, 0x15860, 0x1587c, 0x158c0,\n 0x158f8, 0x159f0, 0x15be0, 0x15c70, 0x15c7e, 0x15ce0, 0x15cfc, 0x15dc0, 0x15df8, 0x15e08, 0x15e10, 0x15e20,\n 0x15e40, 0x15e78, 0x15ef0, 0x15f0c, 0x15f18, 0x15f30, 0x15f60, 0x15f7c, 0x15f8e, 0x15f9c, 0x15fb8, 0x1604e,\n 0x1605c, 0x1608e, 0x1609c, 0x160b8, 0x160c2, 0x160c4, 0x160c8, 0x160de, 0x1610e, 0x1611c, 0x16138, 0x16170,\n 0x1617e, 0x16184, 0x16188, 0x16190, 0x1619e, 0x161a0, 0x161bc, 0x161c6, 0x161cc, 0x161d8, 0x161f2, 0x161f4,\n 0x1620e, 0x1621c, 0x16238, 0x16270, 0x1627e, 0x162e0, 0x162fc, 0x16304, 0x16308, 0x16310, 0x1631e, 0x16320,\n 0x1633c, 0x16340, 0x16378, 0x16386, 0x1638c, 0x16398, 0x163b0, 0x163be, 0x163ce, 0x163dc, 0x163e2, 0x163e4,\n 0x163e8, 0x163f6, 0x1640e, 0x1641c, 0x16438, 0x16470, 0x1647e, 0x164e0, 0x164fc, 0x165c0, 0x165f8, 0x16610,\n 0x1661e, 0x16620, 0x1663c, 0x16640, 0x16678, 0x166f0, 0x16718, 0x16730, 0x1673e, 0x16760, 0x1677c, 0x1678e,\n 0x1679c, 0x167b8, 0x167c2, 0x167c4, 0x167c8, 0x167d0, 0x167de, 0x167e6, 0x167ec, 0x1681c, 0x16838, 0x16870,\n 0x168e0, 0x168fc, 0x169c0, 0x169f8, 0x16bf0, 0x16c10, 0x16c1e, 0x16c20, 0x16c3c, 0x16c40, 0x16c78, 0x16cf0,\n 0x16de0, 0x16e18, 0x16e30, 0x16e3e, 0x16e60, 0x16e7c, 0x16ec0, 0x16ef8, 0x16f1c, 0x16f38, 0x16f70, 0x16f7e,\n 0x16f84, 0x16f88, 0x16f90, 0x16f9e, 0x16fa0, 0x16fbc, 0x16fc6, 0x16fcc, 0x16fd8, 0x17026, 0x1702c, 0x17046,\n 0x1704c, 0x17058, 0x1706e, 0x17086, 0x1708c, 0x17098, 0x170b0, 0x170be, 0x170ce, 0x170dc, 0x170e8, 0x17106,\n 0x1710c, 0x17118, 0x17130, 0x1713e, 0x17160, 0x1717c, 0x1718e, 0x1719c, 0x171b8, 0x171c2, 0x171c4, 0x171c8,\n 0x171d0, 0x171de, 0x171e6, 0x171ec, 0x171fa, 0x17206, 0x1720c, 0x17218, 0x17230, 0x1723e, 0x17260, 0x1727c,\n 0x172c0, 0x172f8, 0x1730e, 0x1731c, 0x17338, 0x17370, 0x1737e, 0x17388, 0x17390, 0x1739e, 0x173a0, 0x173bc,\n 0x173cc, 0x173d8, 0x173ee, 0x173f2, 0x173f4, 0x1740c, 0x17418, 0x17430, 0x1743e, 0x17460, 0x1747c, 0x174c0,\n 0x174f8, 0x175f0, 0x1760e, 0x1761c, 0x17638, 0x17670, 0x1767e, 0x176e0, 0x176fc, 0x17708, 0x17710, 0x1771e,\n 0x17720, 0x1773c, 0x17740, 0x17778, 0x17798, 0x177b0, 0x177be, 0x177dc, 0x177e2, 0x177e4, 0x177e8, 0x17822,\n 0x17824, 0x17828, 0x17836, 0x17842, 0x17844, 0x17848, 0x17850, 0x1785e, 0x17866, 0x1786c, 0x17882, 0x17884,\n 0x17888, 0x17890, 0x1789e, 0x178a0, 0x178bc, 0x178c6, 0x178cc, 0x178d8, 0x178ee, 0x178f2, 0x178f4, 0x17902,\n 0x17904, 0x17908, 0x17910, 0x1791e, 0x17920, 0x1793c, 0x17940, 0x17978, 0x17986, 0x1798c, 0x17998, 0x179b0,\n 0x179be, 0x179ce, 0x179dc, 0x179e2, 0x179e4, 0x179e8, 0x179f6, 0x17a04, 0x17a08, 0x17a10, 0x17a1e, 0x17a20,\n 0x17a3c, 0x17a40, 0x17a78, 0x17af0, 0x17b06, 0x17b0c, 0x17b18, 0x17b30, 0x17b3e, 0x17b60, 0x17b7c, 0x17b8e,\n 0x17b9c, 0x17bb8, 0x17bc4, 0x17bc8, 0x17bd0, 0x17bde, 0x17be6, 0x17bec, 0x17c2e, 0x17c32, 0x17c34, 0x17c4e,\n 0x17c5c, 0x17c62, 0x17c64, 0x17c68, 0x17c76, 0x17c8e, 0x17c9c, 0x17cb8, 0x17cc2, 0x17cc4, 0x17cc8, 0x17cd0,\n 0x17cde, 0x17ce6, 0x17cec, 0x17d0e, 0x17d1c, 0x17d38, 0x17d70, 0x17d82, 0x17d84, 0x17d88, 0x17d90, 0x17d9e,\n 0x17da0, 0x17dbc, 0x17dc6, 0x17dcc, 0x17dd8, 0x17dee, 0x17e26, 0x17e2c, 0x17e3a, 0x17e46, 0x17e4c, 0x17e58,\n 0x17e6e, 0x17e72, 0x17e74, 0x17e86, 0x17e8c, 0x17e98, 0x17eb0, 0x17ece, 0x17edc, 0x17ee2, 0x17ee4, 0x17ee8,\n 0x17ef6, 0x1813a, 0x18172, 0x18174, 0x18216, 0x18226, 0x1823a, 0x1824c, 0x18258, 0x1826e, 0x18272, 0x18274,\n 0x18298, 0x182be, 0x182e2, 0x182e4, 0x182e8, 0x182f6, 0x1835e, 0x1837a, 0x183ae, 0x183d6, 0x18416, 0x18426,\n 0x1842c, 0x1843a, 0x18446, 0x18458, 0x1846e, 0x18472, 0x18474, 0x18486, 0x184b0, 0x184be, 0x184ce, 0x184dc,\n 0x184e2, 0x184e4, 0x184e8, 0x184f6, 0x18506, 0x1850c, 0x18518, 0x18530, 0x1853e, 0x18560, 0x1857c, 0x1858e,\n 0x1859c, 0x185b8, 0x185c2, 0x185c4, 0x185c8, 0x185d0, 0x185de, 0x185e6, 0x185ec, 0x185fa, 0x18612, 0x18614,\n 0x18622, 0x18628, 0x18636, 0x18642, 0x18650, 0x1865e, 0x1867a, 0x18682, 0x18684, 0x18688, 0x18690, 0x1869e,\n 0x186a0, 0x186bc, 0x186c6, 0x186cc, 0x186d8, 0x186ee, 0x186f2, 0x186f4, 0x1872e, 0x1874e, 0x1875c, 0x18796,\n 0x187a6, 0x187ac, 0x187d2, 0x187d4, 0x18826, 0x1882c, 0x1883a, 0x18846, 0x1884c, 0x18858, 0x1886e, 0x18872,\n 0x18874, 0x18886, 0x18898, 0x188b0, 0x188be, 0x188ce, 0x188dc, 0x188e2, 0x188e4, 0x188e8, 0x188f6, 0x1890c,\n 0x18930, 0x1893e, 0x18960, 0x1897c, 0x1898e, 0x189b8, 0x189c2, 0x189c8, 0x189d0, 0x189de, 0x189e6, 0x189ec,\n 0x189fa, 0x18a18, 0x18a30, 0x18a3e, 0x18a60, 0x18a7c, 0x18ac0, 0x18af8, 0x18b1c, 0x18b38, 0x18b70, 0x18b7e,\n 0x18b82, 0x18b84, 0x18b88, 0x18b90, 0x18b9e, 0x18ba0, 0x18bbc, 0x18bc6, 0x18bcc, 0x18bd8, 0x18bee, 0x18bf2,\n 0x18bf4, 0x18c22, 0x18c24, 0x18c28, 0x18c36, 0x18c42, 0x18c48, 0x18c50, 0x18c5e, 0x18c66, 0x18c7a, 0x18c82,\n 0x18c84, 0x18c90, 0x18c9e, 0x18ca0, 0x18cbc, 0x18ccc, 0x18cf2, 0x18cf4, 0x18d04, 0x18d08, 0x18d10, 0x18d1e,\n 0x18d20, 0x18d3c, 0x18d40, 0x18d78, 0x18d86, 0x18d98, 0x18dce, 0x18de2, 0x18de4, 0x18de8, 0x18e2e, 0x18e32,\n 0x18e34, 0x18e4e, 0x18e5c, 0x18e62, 0x18e64, 0x18e68, 0x18e8e, 0x18e9c, 0x18eb8, 0x18ec2, 0x18ec4, 0x18ec8,\n 0x18ed0, 0x18efa, 0x18f16, 0x18f26, 0x18f2c, 0x18f46, 0x18f4c, 0x18f58, 0x18f6e, 0x18f8a, 0x18f92, 0x18f94,\n 0x18fa2, 0x18fa4, 0x18fa8, 0x18fb6, 0x1902c, 0x1903a, 0x19046, 0x1904c, 0x19058, 0x19072, 0x19074, 0x19086,\n 0x19098, 0x190b0, 0x190be, 0x190ce, 0x190dc, 0x190e2, 0x190e8, 0x190f6, 0x19106, 0x1910c, 0x19130, 0x1913e,\n 0x19160, 0x1917c, 0x1918e, 0x1919c, 0x191b8, 0x191c2, 0x191c8, 0x191d0, 0x191de, 0x191e6, 0x191ec, 0x191fa,\n 0x19218, 0x1923e, 0x19260, 0x1927c, 0x192c0, 0x192f8, 0x19338, 0x19370, 0x1937e, 0x19382, 0x19384, 0x19390,\n 0x1939e, 0x193a0, 0x193bc, 0x193c6, 0x193cc, 0x193d8, 0x193ee, 0x193f2, 0x193f4, 0x19430, 0x1943e, 0x19460,\n 0x1947c, 0x194c0, 0x194f8, 0x195f0, 0x19638, 0x19670, 0x1967e, 0x196e0, 0x196fc, 0x19702, 0x19704, 0x19708,\n 0x19710, 0x19720, 0x1973c, 0x19740, 0x19778, 0x19786, 0x1978c, 0x19798, 0x197b0, 0x197be, 0x197ce, 0x197dc,\n 0x197e2, 0x197e4, 0x197e8, 0x19822, 0x19824, 0x19842, 0x19848, 0x19850, 0x1985e, 0x19866, 0x1987a, 0x19882,\n 0x19884, 0x19890, 0x1989e, 0x198a0, 0x198bc, 0x198cc, 0x198f2, 0x198f4, 0x19902, 0x19908, 0x1991e, 0x19920,\n 0x1993c, 0x19940, 0x19978, 0x19986, 0x19998, 0x199ce, 0x199e2, 0x199e4, 0x199e8, 0x19a08, 0x19a10, 0x19a1e,\n 0x19a20, 0x19a3c, 0x19a40, 0x19a78, 0x19af0, 0x19b18, 0x19b3e, 0x19b60, 0x19b9c, 0x19bc2, 0x19bc4, 0x19bc8,\n 0x19bd0, 0x19be6, 0x19c2e, 0x19c34, 0x19c4e, 0x19c5c, 0x19c62, 0x19c64, 0x19c68, 0x19c8e, 0x19c9c, 0x19cb8,\n 0x19cc2, 0x19cc8, 0x19cd0, 0x19ce6, 0x19cfa, 0x19d0e, 0x19d1c, 0x19d38, 0x19d70, 0x19d7e, 0x19d82, 0x19d84,\n 0x19d88, 0x19d90, 0x19da0, 0x19dcc, 0x19df2, 0x19df4, 0x19e16, 0x19e26, 0x19e2c, 0x19e46, 0x19e4c, 0x19e58,\n 0x19e74, 0x19e86, 0x19e8c, 0x19e98, 0x19eb0, 0x19ebe, 0x19ece, 0x19ee2, 0x19ee4, 0x19ee8, 0x19f0a, 0x19f12,\n 0x19f14, 0x19f22, 0x19f24, 0x19f28, 0x19f42, 0x19f44, 0x19f48, 0x19f50, 0x19f5e, 0x19f6c, 0x19f9a, 0x19fae,\n 0x19fb2, 0x19fb4, 0x1a046, 0x1a04c, 0x1a072, 0x1a074, 0x1a086, 0x1a08c, 0x1a098, 0x1a0b0, 0x1a0be, 0x1a0e2,\n 0x1a0e4, 0x1a0e8, 0x1a0f6, 0x1a106, 0x1a10c, 0x1a118, 0x1a130, 0x1a13e, 0x1a160, 0x1a17c, 0x1a18e, 0x1a19c,\n 0x1a1b8, 0x1a1c2, 0x1a1c4, 0x1a1c8, 0x1a1d0, 0x1a1de, 0x1a1e6, 0x1a1ec, 0x1a218, 0x1a230, 0x1a23e, 0x1a260,\n 0x1a27c, 0x1a2c0, 0x1a2f8, 0x1a31c, 0x1a338, 0x1a370, 0x1a37e, 0x1a382, 0x1a384, 0x1a388, 0x1a390, 0x1a39e,\n 0x1a3a0, 0x1a3bc, 0x1a3c6, 0x1a3cc, 0x1a3d8, 0x1a3ee, 0x1a3f2, 0x1a3f4, 0x1a418, 0x1a430, 0x1a43e, 0x1a460,\n 0x1a47c, 0x1a4c0, 0x1a4f8, 0x1a5f0, 0x1a61c, 0x1a638, 0x1a670, 0x1a67e, 0x1a6e0, 0x1a6fc, 0x1a702, 0x1a704,\n 0x1a708, 0x1a710, 0x1a71e, 0x1a720, 0x1a73c, 0x1a740, 0x1a778, 0x1a786, 0x1a78c, 0x1a798, 0x1a7b0, 0x1a7be,\n 0x1a7ce, 0x1a7dc, 0x1a7e2, 0x1a7e4, 0x1a7e8, 0x1a830, 0x1a860, 0x1a87c, 0x1a8c0, 0x1a8f8, 0x1a9f0, 0x1abe0,\n 0x1ac70, 0x1ac7e, 0x1ace0, 0x1acfc, 0x1adc0, 0x1adf8, 0x1ae04, 0x1ae08, 0x1ae10, 0x1ae20, 0x1ae3c, 0x1ae40,\n 0x1ae78, 0x1aef0, 0x1af06, 0x1af0c, 0x1af18, 0x1af30, 0x1af3e, 0x1af60, 0x1af7c, 0x1af8e, 0x1af9c, 0x1afb8,\n 0x1afc4, 0x1afc8, 0x1afd0, 0x1afde, 0x1b042, 0x1b05e, 0x1b07a, 0x1b082, 0x1b084, 0x1b088, 0x1b090, 0x1b09e,\n 0x1b0a0, 0x1b0bc, 0x1b0cc, 0x1b0f2, 0x1b0f4, 0x1b102, 0x1b104, 0x1b108, 0x1b110, 0x1b11e, 0x1b120, 0x1b13c,\n 0x1b140, 0x1b178, 0x1b186, 0x1b198, 0x1b1ce, 0x1b1e2, 0x1b1e4, 0x1b1e8, 0x1b204, 0x1b208, 0x1b210, 0x1b21e,\n 0x1b220, 0x1b23c, 0x1b240, 0x1b278, 0x1b2f0, 0x1b30c, 0x1b33e, 0x1b360, 0x1b39c, 0x1b3c2, 0x1b3c4, 0x1b3c8,\n 0x1b3d0, 0x1b3e6, 0x1b410, 0x1b41e, 0x1b420, 0x1b43c, 0x1b440, 0x1b478, 0x1b4f0, 0x1b5e0, 0x1b618, 0x1b660,\n 0x1b67c, 0x1b6c0, 0x1b738, 0x1b782, 0x1b784, 0x1b788, 0x1b790, 0x1b79e, 0x1b7a0, 0x1b7cc, 0x1b82e, 0x1b84e,\n 0x1b85c, 0x1b88e, 0x1b89c, 0x1b8b8, 0x1b8c2, 0x1b8c4, 0x1b8c8, 0x1b8d0, 0x1b8e6, 0x1b8fa, 0x1b90e, 0x1b91c,\n 0x1b938, 0x1b970, 0x1b97e, 0x1b982, 0x1b984, 0x1b988, 0x1b990, 0x1b99e, 0x1b9a0, 0x1b9cc, 0x1b9f2, 0x1b9f4,\n 0x1ba0e, 0x1ba1c, 0x1ba38, 0x1ba70, 0x1ba7e, 0x1bae0, 0x1bafc, 0x1bb08, 0x1bb10, 0x1bb20, 0x1bb3c, 0x1bb40,\n 0x1bb98, 0x1bbce, 0x1bbe2, 0x1bbe4, 0x1bbe8, 0x1bc16, 0x1bc26, 0x1bc2c, 0x1bc46, 0x1bc4c, 0x1bc58, 0x1bc72,\n 0x1bc74, 0x1bc86, 0x1bc8c, 0x1bc98, 0x1bcb0, 0x1bcbe, 0x1bcce, 0x1bce2, 0x1bce4, 0x1bce8, 0x1bd06, 0x1bd0c,\n 0x1bd18, 0x1bd30, 0x1bd3e, 0x1bd60, 0x1bd7c, 0x1bd9c, 0x1bdc2, 0x1bdc4, 0x1bdc8, 0x1bdd0, 0x1bde6, 0x1bdfa,\n 0x1be12, 0x1be14, 0x1be22, 0x1be24, 0x1be28, 0x1be42, 0x1be44, 0x1be48, 0x1be50, 0x1be5e, 0x1be66, 0x1be82,\n 0x1be84, 0x1be88, 0x1be90, 0x1be9e, 0x1bea0, 0x1bebc, 0x1becc, 0x1bef4, 0x1bf1a, 0x1bf2e, 0x1bf32, 0x1bf34,\n 0x1bf4e, 0x1bf5c, 0x1bf62, 0x1bf64, 0x1bf68, 0x1c09a, 0x1c0b2, 0x1c0b4, 0x1c11a, 0x1c132, 0x1c134, 0x1c162,\n 0x1c164, 0x1c168, 0x1c176, 0x1c1ba, 0x1c21a, 0x1c232, 0x1c234, 0x1c24e, 0x1c25c, 0x1c262, 0x1c264, 0x1c268,\n 0x1c276, 0x1c28e, 0x1c2c2, 0x1c2c4, 0x1c2c8, 0x1c2d0, 0x1c2de, 0x1c2e6, 0x1c2ec, 0x1c2fa, 0x1c316, 0x1c326,\n 0x1c33a, 0x1c346, 0x1c34c, 0x1c372, 0x1c374, 0x1c41a, 0x1c42e, 0x1c432, 0x1c434, 0x1c44e, 0x1c45c, 0x1c462,\n 0x1c464, 0x1c468, 0x1c476, 0x1c48e, 0x1c49c, 0x1c4b8, 0x1c4c2, 0x1c4c8, 0x1c4d0, 0x1c4de, 0x1c4e6, 0x1c4ec,\n 0x1c4fa, 0x1c51c, 0x1c538, 0x1c570, 0x1c57e, 0x1c582, 0x1c584, 0x1c588, 0x1c590, 0x1c59e, 0x1c5a0, 0x1c5bc,\n 0x1c5c6, 0x1c5cc, 0x1c5d8, 0x1c5ee, 0x1c5f2, 0x1c5f4, 0x1c616, 0x1c626, 0x1c62c, 0x1c63a, 0x1c646, 0x1c64c,\n 0x1c658, 0x1c66e, 0x1c672, 0x1c674, 0x1c686, 0x1c68c, 0x1c698, 0x1c6b0, 0x1c6be, 0x1c6ce, 0x1c6dc, 0x1c6e2,\n 0x1c6e4, 0x1c6e8, 0x1c712, 0x1c714, 0x1c722, 0x1c728, 0x1c736, 0x1c742, 0x1c744, 0x1c748, 0x1c750, 0x1c75e,\n 0x1c766, 0x1c76c, 0x1c77a, 0x1c7ae, 0x1c7d6, 0x1c7ea, 0x1c81a, 0x1c82e, 0x1c832, 0x1c834, 0x1c84e, 0x1c85c,\n 0x1c862, 0x1c864, 0x1c868, 0x1c876, 0x1c88e, 0x1c89c, 0x1c8b8, 0x1c8c2, 0x1c8c8, 0x1c8d0, 0x1c8de, 0x1c8e6,\n 0x1c8ec, 0x1c8fa, 0x1c90e, 0x1c938, 0x1c970, 0x1c97e, 0x1c982, 0x1c984, 0x1c990, 0x1c99e, 0x1c9a0, 0x1c9bc,\n 0x1c9c6, 0x1c9cc, 0x1c9d8, 0x1c9ee, 0x1c9f2, 0x1c9f4, 0x1ca38, 0x1ca70, 0x1ca7e, 0x1cae0, 0x1cafc, 0x1cb02,\n 0x1cb04, 0x1cb08, 0x1cb10, 0x1cb20, 0x1cb3c, 0x1cb40, 0x1cb78, 0x1cb86, 0x1cb8c, 0x1cb98, 0x1cbb0, 0x1cbbe,\n 0x1cbce, 0x1cbdc, 0x1cbe2, 0x1cbe4, 0x1cbe8, 0x1cbf6, 0x1cc16, 0x1cc26, 0x1cc2c, 0x1cc3a, 0x1c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0x1d4fc, 0x1d5c0, 0x1d5f8, 0x1d604, 0x1d608, 0x1d610, 0x1d620, 0x1d640, 0x1d678, 0x1d6f0, 0x1d706,\n 0x1d70c, 0x1d718, 0x1d730, 0x1d73e, 0x1d760, 0x1d77c, 0x1d78e, 0x1d79c, 0x1d7b8, 0x1d7c2, 0x1d7c4, 0x1d7c8,\n 0x1d7d0, 0x1d7de, 0x1d7e6, 0x1d7ec, 0x1d826, 0x1d82c, 0x1d83a, 0x1d846, 0x1d84c, 0x1d858, 0x1d872, 0x1d874,\n 0x1d886, 0x1d88c, 0x1d898, 0x1d8b0, 0x1d8be, 0x1d8ce, 0x1d8e2, 0x1d8e4, 0x1d8e8, 0x1d8f6, 0x1d90c, 0x1d918,\n 0x1d930, 0x1d93e, 0x1d960, 0x1d97c, 0x1d99c, 0x1d9c2, 0x1d9c4, 0x1d9c8, 0x1d9d0, 0x1d9e6, 0x1d9fa, 0x1da0c,\n 0x1da18, 0x1da30, 0x1da3e, 0x1da60, 0x1da7c, 0x1dac0, 0x1daf8, 0x1db38, 0x1db82, 0x1db84, 0x1db88, 0x1db90,\n 0x1db9e, 0x1dba0, 0x1dbcc, 0x1dbf2, 0x1dbf4, 0x1dc22, 0x1dc42, 0x1dc44, 0x1dc48, 0x1dc50, 0x1dc5e, 0x1dc66,\n 0x1dc7a, 0x1dc82, 0x1dc84, 0x1dc88, 0x1dc90, 0x1dc9e, 0x1dca0, 0x1dcbc, 0x1dccc, 0x1dcf2, 0x1dcf4, 0x1dd04,\n 0x1dd08, 0x1dd10, 0x1dd1e, 0x1dd20, 0x1dd3c, 0x1dd40, 0x1dd78, 0x1dd86, 0x1dd98, 0x1ddce, 0x1dde2, 0x1dde4,\n 0x1dde8, 0x1de2e, 0x1de32, 0x1de34, 0x1de4e, 0x1de5c, 0x1de62, 0x1de64, 0x1de68, 0x1de8e, 0x1de9c, 0x1deb8,\n 0x1dec2, 0x1dec4, 0x1dec8, 0x1ded0, 0x1dee6, 0x1defa, 0x1df16, 0x1df26, 0x1df2c, 0x1df46, 0x1df4c, 0x1df58,\n 0x1df72, 0x1df74, 0x1df8a, 0x1df92, 0x1df94, 0x1dfa2, 0x1dfa4, 0x1dfa8, 0x1e08a, 0x1e092, 0x1e094, 0x1e0a2,\n 0x1e0a4, 0x1e0a8, 0x1e0b6, 0x1e0da, 0x1e10a, 0x1e112, 0x1e114, 0x1e122, 0x1e124, 0x1e128, 0x1e136, 0x1e142,\n 0x1e144, 0x1e148, 0x1e150, 0x1e166, 0x1e16c, 0x1e17a, 0x1e19a, 0x1e1b2, 0x1e1b4, 0x1e20a, 0x1e212, 0x1e214,\n 0x1e222, 0x1e224, 0x1e228, 0x1e236, 0x1e242, 0x1e248, 0x1e250, 0x1e25e, 0x1e266, 0x1e26c, 0x1e27a, 0x1e282,\n 0x1e284, 0x1e288, 0x1e290, 0x1e2a0, 0x1e2bc, 0x1e2c6, 0x1e2cc, 0x1e2d8, 0x1e2ee, 0x1e2f2, 0x1e2f4, 0x1e31a,\n 0x1e332, 0x1e334, 0x1e35c, 0x1e362, 0x1e364, 0x1e368, 0x1e3ba, 0x1e40a, 0x1e412, 0x1e414, 0x1e422, 0x1e428,\n 0x1e436, 0x1e442, 0x1e448, 0x1e450, 0x1e45e, 0x1e466, 0x1e46c, 0x1e47a, 0x1e482, 0x1e484, 0x1e490, 0x1e49e,\n 0x1e4a0, 0x1e4bc, 0x1e4c6, 0x1e4cc, 0x1e4d8, 0x1e4ee, 0x1e4f2, 0x1e4f4, 0x1e502, 0x1e504, 0x1e508, 0x1e510,\n 0x1e51e, 0x1e520, 0x1e53c, 0x1e540, 0x1e578, 0x1e586, 0x1e58c, 0x1e598, 0x1e5b0, 0x1e5be, 0x1e5ce, 0x1e5dc,\n 0x1e5e2, 0x1e5e4, 0x1e5e8, 0x1e5f6, 0x1e61a, 0x1e62e, 0x1e632, 0x1e634, 0x1e64e, 0x1e65c, 0x1e662, 0x1e668,\n 0x1e68e, 0x1e69c, 0x1e6b8, 0x1e6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ee16, 0x1ee26, 0x1ee2c, 0x1ee3a, 0x1ee46, 0x1ee4c,\n 0x1ee58, 0x1ee6e, 0x1ee72, 0x1ee74, 0x1ee86, 0x1ee8c, 0x1ee98, 0x1eeb0, 0x1eebe, 0x1eece, 0x1eedc, 0x1eee2,\n 0x1eee4, 0x1eee8, 0x1ef12, 0x1ef22, 0x1ef24, 0x1ef28, 0x1ef36, 0x1ef42, 0x1ef44, 0x1ef48, 0x1ef50, 0x1ef5e,\n 0x1ef66, 0x1ef6c, 0x1ef7a, 0x1efae, 0x1efb2, 0x1efb4, 0x1efd6, 0x1f096, 0x1f0a6, 0x1f0ac, 0x1f0ba, 0x1f0ca,\n 0x1f0d2, 0x1f0d4, 0x1f116, 0x1f126, 0x1f12c, 0x1f13a, 0x1f146, 0x1f14c, 0x1f158, 0x1f16e, 0x1f172, 0x1f174,\n 0x1f18a, 0x1f192, 0x1f194, 0x1f1a2, 0x1f1a4, 0x1f1a8, 0x1f1da, 0x1f216, 0x1f226, 0x1f22c, 0x1f23a, 0x1f246,\n 0x1f258, 0x1f26e, 0x1f272, 0x1f274, 0x1f286, 0x1f28c, 0x1f298, 0x1f2b0, 0x1f2be, 0x1f2ce, 0x1f2dc, 0x1f2e2,\n 0x1f2e4, 0x1f2e8, 0x1f2f6, 0x1f30a, 0x1f312, 0x1f314, 0x1f322, 0x1f328, 0x1f342, 0x1f344, 0x1f348, 0x1f350,\n 0x1f35e, 0x1f366, 0x1f37a, 0x1f39a, 0x1f3ae, 0x1f3b2, 0x1f3b4, 0x1f416, 0x1f426, 0x1f42c, 0x1f43a, 0x1f446,\n 0x1f44c, 0x1f458, 0x1f46e, 0x1f472, 0x1f474, 0x1f486, 0x1f48c, 0x1f498, 0x1f4b0, 0x1f4be, 0x1f4ce, 0x1f4dc,\n 0x1f4e2, 0x1f4e4, 0x1f4e8, 0x1f4f6, 0x1f506, 0x1f50c, 0x1f518, 0x1f530, 0x1f53e, 0x1f560, 0x1f57c, 0x1f58e,\n 0x1f59c, 0x1f5b8, 0x1f5c2, 0x1f5c4, 0x1f5c8, 0x1f5d0, 0x1f5de, 0x1f5e6, 0x1f5ec, 0x1f5fa, 0x1f60a, 0x1f612,\n 0x1f614, 0x1f622, 0x1f624, 0x1f628, 0x1f636, 0x1f642, 0x1f644, 0x1f648, 0x1f650, 0x1f65e, 0x1f666, 0x1f67a,\n 0x1f682, 0x1f684, 0x1f688, 0x1f690, 0x1f69e, 0x1f6a0, 0x1f6bc, 0x1f6cc, 0x1f6f2, 0x1f6f4, 0x1f71a, 0x1f72e,\n 0x1f732, 0x1f734, 0x1f74e, 0x1f75c, 0x1f762, 0x1f764, 0x1f768, 0x1f776, 0x1f796, 0x1f7a6, 0x1f7ac, 0x1f7ba,\n 0x1f7d2, 0x1f7d4, 0x1f89a, 0x1f8ae, 0x1f8b2, 0x1f8b4, 0x1f8d6, 0x1f8ea, 0x1f91a, 0x1f92e, 0x1f932, 0x1f934,\n 0x1f94e, 0x1f95c, 0x1f962, 0x1f964, 0x1f968, 0x1f976, 0x1f996, 0x1f9a6, 0x1f9ac, 0x1f9ba, 0x1f9ca, 0x1f9d2,\n 0x1f9d4, 0x1fa1a, 0x1fa2e, 0x1fa32, 0x1fa34, 0x1fa4e, 0x1fa5c, 0x1fa62, 0x1fa64, 0x1fa68, 0x1fa76, 0x1fa8e,\n 0x1fa9c, 0x1fab8, 0x1fac2, 0x1fac4, 0x1fac8, 0x1fad0, 0x1fade, 0x1fae6, 0x1faec, 0x1fb16, 0x1fb26, 0x1fb2c,\n 0x1fb3a, 0x1fb46, 0x1fb4c, 0x1fb58, 0x1fb6e, 0x1fb72, 0x1fb74, 0x1fb8a, 0x1fb92, 0x1fb94, 0x1fba2, 0x1fba4,\n 0x1fba8, 0x1fbb6, 0x1fbda]);\n\n /**\n * This table contains to codewords for all symbols.\n */\n private static /*final int[]*/ CODEWORD_TABLE = Int32Array.from([\n 2627, 1819, 2622, 2621, 1813, 1812, 2729, 2724, 2723, 2779, 2774, 2773, 902, 896, 908, 868, 865, 861, 859, 2511,\n 873, 871, 1780, 835, 2493, 825, 2491, 842, 837, 844, 1764, 1762, 811, 810, 809, 2483, 807, 2482, 806, 2480, 815,\n 814, 813, 812, 2484, 817, 816, 1745, 1744, 1742, 1746, 2655, 2637, 2635, 2626, 2625, 2623, 2628, 1820, 2752,\n 2739, 2737, 2728, 2727, 2725, 2730, 2785, 2783, 2778, 2777, 2775, 2780, 787, 781, 747, 739, 736, 2413, 754, 752,\n 1719, 692, 689, 681, 2371, 678, 2369, 700, 697, 694, 703, 1688, 1686, 642, 638, 2343, 631, 2341, 627, 2338, 651,\n 646, 643, 2345, 654, 652, 1652, 1650, 1647, 1654, 601, 599, 2322, 596, 2321, 594, 2319, 2317, 611, 610, 608, 606,\n 2324, 603, 2323, 615, 614, 612, 1617, 1616, 1614, 1612, 616, 1619, 1618, 2575, 2538, 2536, 905, 901, 898, 909,\n 2509, 2507, 2504, 870, 867, 864, 860, 2512, 875, 872, 1781, 2490, 2489, 2487, 2485, 1748, 836, 834, 832, 830,\n 2494, 827, 2492, 843, 841, 839, 845, 1765, 1763, 2701, 2676, 2674, 2653, 2648, 2656, 2634, 2633, 2631, 2629,\n 1821, 2638, 2636, 2770, 2763, 2761, 2750, 2745, 2753, 2736, 2735, 2733, 2731, 1848, 2740, 2738, 2786, 2784, 591,\n 588, 576, 569, 566, 2296, 1590, 537, 534, 526, 2276, 522, 2274, 545, 542, 539, 548, 1572, 1570, 481, 2245, 466,\n 2242, 462, 2239, 492, 485, 482, 2249, 496, 494, 1534, 1531, 1528, 1538, 413, 2196, 406, 2191, 2188, 425, 419,\n 2202, 415, 2199, 432, 430, 427, 1472, 1467, 1464, 433, 1476, 1474, 368, 367, 2160, 365, 2159, 362, 2157, 2155,\n 2152, 378, 377, 375, 2166, 372, 2165, 369, 2162, 383, 381, 379, 2168, 1419, 1418, 1416, 1414, 385, 1411, 384,\n 1423, 1422, 1420, 1424, 2461, 802, 2441, 2439, 790, 786, 783, 794, 2409, 2406, 2403, 750, 742, 738, 2414, 756,\n 753, 1720, 2367, 2365, 2362, 2359, 1663, 693, 691, 684, 2373, 680, 2370, 702, 699, 696, 704, 1690, 1687, 2337,\n 2336, 2334, 2332, 1624, 2329, 1622, 640, 637, 2344, 634, 2342, 630, 2340, 650, 648, 645, 2346, 655, 653, 1653,\n 1651, 1649, 1655, 2612, 2597, 2595, 2571, 2568, 2565, 2576, 2534, 2529, 2526, 1787, 2540, 2537, 907, 904, 900,\n 910, 2503, 2502, 2500, 2498, 1768, 2495, 1767, 2510, 2508, 2506, 869, 866, 863, 2513, 876, 874, 1782, 2720, 2713,\n 2711, 2697, 2694, 2691, 2702, 2672, 2670, 2664, 1828, 2678, 2675, 2647, 2646, 2644, 2642, 1823, 2639, 1822, 2654,\n 2652, 2650, 2657, 2771, 1855, 2765, 2762, 1850, 1849, 2751, 2749, 2747, 2754, 353, 2148, 344, 342, 336, 2142,\n 332, 2140, 345, 1375, 1373, 306, 2130, 299, 2128, 295, 2125, 319, 314, 311, 2132, 1354, 1352, 1349, 1356, 262,\n 257, 2101, 253, 2096, 2093, 274, 273, 267, 2107, 263, 2104, 280, 278, 275, 1316, 1311, 1308, 1320, 1318, 2052,\n 202, 2050, 2044, 2040, 219, 2063, 212, 2060, 208, 2055, 224, 221, 2066, 1260, 1258, 1252, 231, 1248, 229, 1266,\n 1264, 1261, 1268, 155, 1998, 153, 1996, 1994, 1991, 1988, 165, 164, 2007, 162, 2006, 159, 2003, 2000, 172, 171,\n 169, 2012, 166, 2010, 1186, 1184, 1182, 1179, 175, 1176, 173, 1192, 1191, 1189, 1187, 176, 1194, 1193, 2313,\n 2307, 2305, 592, 589, 2294, 2292, 2289, 578, 572, 568, 2297, 580, 1591, 2272, 2267, 2264, 1547, 538, 536, 529,\n 2278, 525, 2275, 547, 544, 541, 1574, 1571, 2237, 2235, 2229, 1493, 2225, 1489, 478, 2247, 470, 2244, 465, 2241,\n 493, 488, 484, 2250, 498, 495, 1536, 1533, 1530, 1539, 2187, 2186, 2184, 2182, 1432, 2179, 1430, 2176, 1427, 414,\n 412, 2197, 409, 2195, 405, 2193, 2190, 426, 424, 421, 2203, 418, 2201, 431, 429, 1473, 1471, 1469, 1466, 434,\n 1477, 1475, 2478, 2472, 2470, 2459, 2457, 2454, 2462, 803, 2437, 2432, 2429, 1726, 2443, 2440, 792, 789, 785,\n 2401, 2399, 2393, 1702, 2389, 1699, 2411, 2408, 2405, 745, 741, 2415, 758, 755, 1721, 2358, 2357, 2355, 2353,\n 1661, 2350, 1660, 2347, 1657, 2368, 2366, 2364, 2361, 1666, 690, 687, 2374, 683, 2372, 701, 698, 705, 1691, 1689,\n 2619, 2617, 2610, 2608, 2605, 2613, 2593, 2588, 2585, 1803, 2599, 2596, 2563, 2561, 2555, 1797, 2551, 1795, 2573,\n 2570, 2567, 2577, 2525, 2524, 2522, 2520, 1786, 2517, 1785, 2514, 1783, 2535, 2533, 2531, 2528, 1788, 2541, 2539,\n 906, 903, 911, 2721, 1844, 2715, 2712, 1838, 1836, 2699, 2696, 2693, 2703, 1827, 1826, 1824, 2673, 2671, 2669,\n 2666, 1829, 2679, 2677, 1858, 1857, 2772, 1854, 1853, 1851, 1856, 2766, 2764, 143, 1987, 139, 1986, 135, 133,\n 131, 1984, 128, 1983, 125, 1981, 138, 137, 136, 1985, 1133, 1132, 1130, 112, 110, 1974, 107, 1973, 104, 1971,\n 1969, 122, 121, 119, 117, 1977, 114, 1976, 124, 1115, 1114, 1112, 1110, 1117, 1116, 84, 83, 1953, 81, 1952, 78,\n 1950, 1948, 1945, 94, 93, 91, 1959, 88, 1958, 85, 1955, 99, 97, 95, 1961, 1086, 1085, 1083, 1081, 1078, 100,\n 1090, 1089, 1087, 1091, 49, 47, 1917, 44, 1915, 1913, 1910, 1907, 59, 1926, 56, 1925, 53, 1922, 1919, 66, 64,\n 1931, 61, 1929, 1042, 1040, 1038, 71, 1035, 70, 1032, 68, 1048, 1047, 1045, 1043, 1050, 1049, 12, 10, 1869, 1867,\n 1864, 1861, 21, 1880, 19, 1877, 1874, 1871, 28, 1888, 25, 1886, 22, 1883, 982, 980, 977, 974, 32, 30, 991, 989,\n 987, 984, 34, 995, 994, 992, 2151, 2150, 2147, 2146, 2144, 356, 355, 354, 2149, 2139, 2138, 2136, 2134, 1359,\n 343, 341, 338, 2143, 335, 2141, 348, 347, 346, 1376, 1374, 2124, 2123, 2121, 2119, 1326, 2116, 1324, 310, 308,\n 305, 2131, 302, 2129, 298, 2127, 320, 318, 316, 313, 2133, 322, 321, 1355, 1353, 1351, 1357, 2092, 2091, 2089,\n 2087, 1276, 2084, 1274, 2081, 1271, 259, 2102, 256, 2100, 252, 2098, 2095, 272, 269, 2108, 266, 2106, 281, 279,\n 277, 1317, 1315, 1313, 1310, 282, 1321, 1319, 2039, 2037, 2035, 2032, 1203, 2029, 1200, 1197, 207, 2053, 205,\n 2051, 201, 2049, 2046, 2043, 220, 218, 2064, 215, 2062, 211, 2059, 228, 226, 223, 2069, 1259, 1257, 1254, 232,\n 1251, 230, 1267, 1265, 1263, 2316, 2315, 2312, 2311, 2309, 2314, 2304, 2303, 2301, 2299, 1593, 2308, 2306, 590,\n 2288, 2287, 2285, 2283, 1578, 2280, 1577, 2295, 2293, 2291, 579, 577, 574, 571, 2298, 582, 581, 1592, 2263, 2262,\n 2260, 2258, 1545, 2255, 1544, 2252, 1541, 2273, 2271, 2269, 2266, 1550, 535, 532, 2279, 528, 2277, 546, 543, 549,\n 1575, 1573, 2224, 2222, 2220, 1486, 2217, 1485, 2214, 1482, 1479, 2238, 2236, 2234, 2231, 1496, 2228, 1492, 480,\n 477, 2248, 473, 2246, 469, 2243, 490, 487, 2251, 497, 1537, 1535, 1532, 2477, 2476, 2474, 2479, 2469, 2468, 2466,\n 2464, 1730, 2473, 2471, 2453, 2452, 2450, 2448, 1729, 2445, 1728, 2460, 2458, 2456, 2463, 805, 804, 2428, 2427,\n 2425, 2423, 1725, 2420, 1724, 2417, 1722, 2438, 2436, 2434, 2431, 1727, 2444, 2442, 793, 791, 788, 795, 2388,\n 2386, 2384, 1697, 2381, 1696, 2378, 1694, 1692, 2402, 2400, 2398, 2395, 1703, 2392, 1701, 2412, 2410, 2407, 751,\n 748, 744, 2416, 759, 757, 1807, 2620, 2618, 1806, 1805, 2611, 2609, 2607, 2614, 1802, 1801, 1799, 2594, 2592,\n 2590, 2587, 1804, 2600, 2598, 1794, 1793, 1791, 1789, 2564, 2562, 2560, 2557, 1798, 2554, 1796, 2574, 2572, 2569,\n 2578, 1847, 1846, 2722, 1843, 1842, 1840, 1845, 2716, 2714, 1835, 1834, 1832, 1830, 1839, 1837, 2700, 2698, 2695,\n 2704, 1817, 1811, 1810, 897, 862, 1777, 829, 826, 838, 1760, 1758, 808, 2481, 1741, 1740, 1738, 1743, 2624, 1818,\n 2726, 2776, 782, 740, 737, 1715, 686, 679, 695, 1682, 1680, 639, 628, 2339, 647, 644, 1645, 1643, 1640, 1648,\n 602, 600, 597, 595, 2320, 593, 2318, 609, 607, 604, 1611, 1610, 1608, 1606, 613, 1615, 1613, 2328, 926, 924, 892,\n 886, 899, 857, 850, 2505, 1778, 824, 823, 821, 819, 2488, 818, 2486, 833, 831, 828, 840, 1761, 1759, 2649, 2632,\n 2630, 2746, 2734, 2732, 2782, 2781, 570, 567, 1587, 531, 527, 523, 540, 1566, 1564, 476, 467, 463, 2240, 486,\n 483, 1524, 1521, 1518, 1529, 411, 403, 2192, 399, 2189, 423, 416, 1462, 1457, 1454, 428, 1468, 1465, 2210, 366,\n 363, 2158, 360, 2156, 357, 2153, 376, 373, 370, 2163, 1410, 1409, 1407, 1405, 382, 1402, 380, 1417, 1415, 1412,\n 1421, 2175, 2174, 777, 774, 771, 784, 732, 725, 722, 2404, 743, 1716, 676, 674, 668, 2363, 665, 2360, 685, 1684,\n 1681, 626, 624, 622, 2335, 620, 2333, 617, 2330, 641, 635, 649, 1646, 1644, 1642, 2566, 928, 925, 2530, 2527,\n 894, 891, 888, 2501, 2499, 2496, 858, 856, 854, 851, 1779, 2692, 2668, 2665, 2645, 2643, 2640, 2651, 2768, 2759,\n 2757, 2744, 2743, 2741, 2748, 352, 1382, 340, 337, 333, 1371, 1369, 307, 300, 296, 2126, 315, 312, 1347, 1342,\n 1350, 261, 258, 250, 2097, 246, 2094, 271, 268, 264, 1306, 1301, 1298, 276, 1312, 1309, 2115, 203, 2048, 195,\n 2045, 191, 2041, 213, 209, 2056, 1246, 1244, 1238, 225, 1234, 222, 1256, 1253, 1249, 1262, 2080, 2079, 154, 1997,\n 150, 1995, 147, 1992, 1989, 163, 160, 2004, 156, 2001, 1175, 1174, 1172, 1170, 1167, 170, 1164, 167, 1185, 1183,\n 1180, 1177, 174, 1190, 1188, 2025, 2024, 2022, 587, 586, 564, 559, 556, 2290, 573, 1588, 520, 518, 512, 2268,\n 508, 2265, 530, 1568, 1565, 461, 457, 2233, 450, 2230, 446, 2226, 479, 471, 489, 1526, 1523, 1520, 397, 395,\n 2185, 392, 2183, 389, 2180, 2177, 410, 2194, 402, 422, 1463, 1461, 1459, 1456, 1470, 2455, 799, 2433, 2430, 779,\n 776, 773, 2397, 2394, 2390, 734, 728, 724, 746, 1717, 2356, 2354, 2351, 2348, 1658, 677, 675, 673, 670, 667, 688,\n 1685, 1683, 2606, 2589, 2586, 2559, 2556, 2552, 927, 2523, 2521, 2518, 2515, 1784, 2532, 895, 893, 890, 2718,\n 2709, 2707, 2689, 2687, 2684, 2663, 2662, 2660, 2658, 1825, 2667, 2769, 1852, 2760, 2758, 142, 141, 1139, 1138,\n 134, 132, 129, 126, 1982, 1129, 1128, 1126, 1131, 113, 111, 108, 105, 1972, 101, 1970, 120, 118, 115, 1109, 1108,\n 1106, 1104, 123, 1113, 1111, 82, 79, 1951, 75, 1949, 72, 1946, 92, 89, 86, 1956, 1077, 1076, 1074, 1072, 98,\n 1069, 96, 1084, 1082, 1079, 1088, 1968, 1967, 48, 45, 1916, 42, 1914, 39, 1911, 1908, 60, 57, 54, 1923, 50, 1920,\n 1031, 1030, 1028, 1026, 67, 1023, 65, 1020, 62, 1041, 1039, 1036, 1033, 69, 1046, 1044, 1944, 1943, 1941, 11, 9,\n 1868, 7, 1865, 1862, 1859, 20, 1878, 16, 1875, 13, 1872, 970, 968, 966, 963, 29, 960, 26, 23, 983, 981, 978, 975,\n 33, 971, 31, 990, 988, 985, 1906, 1904, 1902, 993, 351, 2145, 1383, 331, 330, 328, 326, 2137, 323, 2135, 339,\n 1372, 1370, 294, 293, 291, 289, 2122, 286, 2120, 283, 2117, 309, 303, 317, 1348, 1346, 1344, 245, 244, 242, 2090,\n 239, 2088, 236, 2085, 2082, 260, 2099, 249, 270, 1307, 1305, 1303, 1300, 1314, 189, 2038, 186, 2036, 183, 2033,\n 2030, 2026, 206, 198, 2047, 194, 216, 1247, 1245, 1243, 1240, 227, 1237, 1255, 2310, 2302, 2300, 2286, 2284,\n 2281, 565, 563, 561, 558, 575, 1589, 2261, 2259, 2256, 2253, 1542, 521, 519, 517, 514, 2270, 511, 533, 1569,\n 1567, 2223, 2221, 2218, 2215, 1483, 2211, 1480, 459, 456, 453, 2232, 449, 474, 491, 1527, 1525, 1522, 2475, 2467,\n 2465, 2451, 2449, 2446, 801, 800, 2426, 2424, 2421, 2418, 1723, 2435, 780, 778, 775, 2387, 2385, 2382, 2379,\n 1695, 2375, 1693, 2396, 735, 733, 730, 727, 749, 1718, 2616, 2615, 2604, 2603, 2601, 2584, 2583, 2581, 2579,\n 1800, 2591, 2550, 2549, 2547, 2545, 1792, 2542, 1790, 2558, 929, 2719, 1841, 2710, 2708, 1833, 1831, 2690, 2688,\n 2686, 1815, 1809, 1808, 1774, 1756, 1754, 1737, 1736, 1734, 1739, 1816, 1711, 1676, 1674, 633, 629, 1638, 1636,\n 1633, 1641, 598, 1605, 1604, 1602, 1600, 605, 1609, 1607, 2327, 887, 853, 1775, 822, 820, 1757, 1755, 1584, 524,\n 1560, 1558, 468, 464, 1514, 1511, 1508, 1519, 408, 404, 400, 1452, 1447, 1444, 417, 1458, 1455, 2208, 364, 361,\n 358, 2154, 1401, 1400, 1398, 1396, 374, 1393, 371, 1408, 1406, 1403, 1413, 2173, 2172, 772, 726, 723, 1712, 672,\n 669, 666, 682, 1678, 1675, 625, 623, 621, 618, 2331, 636, 632, 1639, 1637, 1635, 920, 918, 884, 880, 889, 849,\n 848, 847, 846, 2497, 855, 852, 1776, 2641, 2742, 2787, 1380, 334, 1367, 1365, 301, 297, 1340, 1338, 1335, 1343,\n 255, 251, 247, 1296, 1291, 1288, 265, 1302, 1299, 2113, 204, 196, 192, 2042, 1232, 1230, 1224, 214, 1220, 210,\n 1242, 1239, 1235, 1250, 2077, 2075, 151, 148, 1993, 144, 1990, 1163, 1162, 1160, 1158, 1155, 161, 1152, 157,\n 1173, 1171, 1168, 1165, 168, 1181, 1178, 2021, 2020, 2018, 2023, 585, 560, 557, 1585, 516, 509, 1562, 1559, 458,\n 447, 2227, 472, 1516, 1513, 1510, 398, 396, 393, 390, 2181, 386, 2178, 407, 1453, 1451, 1449, 1446, 420, 1460,\n 2209, 769, 764, 720, 712, 2391, 729, 1713, 664, 663, 661, 659, 2352, 656, 2349, 671, 1679, 1677, 2553, 922, 919,\n 2519, 2516, 885, 883, 881, 2685, 2661, 2659, 2767, 2756, 2755, 140, 1137, 1136, 130, 127, 1125, 1124, 1122, 1127,\n 109, 106, 102, 1103, 1102, 1100, 1098, 116, 1107, 1105, 1980, 80, 76, 73, 1947, 1068, 1067, 1065, 1063, 90, 1060,\n 87, 1075, 1073, 1070, 1080, 1966, 1965, 46, 43, 40, 1912, 36, 1909, 1019, 1018, 1016, 1014, 58, 1011, 55, 1008,\n 51, 1029, 1027, 1024, 1021, 63, 1037, 1034, 1940, 1939, 1937, 1942, 8, 1866, 4, 1863, 1, 1860, 956, 954, 952,\n 949, 946, 17, 14, 969, 967, 964, 961, 27, 957, 24, 979, 976, 972, 1901, 1900, 1898, 1896, 986, 1905, 1903, 350,\n 349, 1381, 329, 327, 324, 1368, 1366, 292, 290, 287, 284, 2118, 304, 1341, 1339, 1337, 1345, 243, 240, 237, 2086,\n 233, 2083, 254, 1297, 1295, 1293, 1290, 1304, 2114, 190, 187, 184, 2034, 180, 2031, 177, 2027, 199, 1233, 1231,\n 1229, 1226, 217, 1223, 1241, 2078, 2076, 584, 555, 554, 552, 550, 2282, 562, 1586, 507, 506, 504, 502, 2257, 499,\n 2254, 515, 1563, 1561, 445, 443, 441, 2219, 438, 2216, 435, 2212, 460, 454, 475, 1517, 1515, 1512, 2447, 798,\n 797, 2422, 2419, 770, 768, 766, 2383, 2380, 2376, 721, 719, 717, 714, 731, 1714, 2602, 2582, 2580, 2548, 2546,\n 2543, 923, 921, 2717, 2706, 2705, 2683, 2682, 2680, 1771, 1752, 1750, 1733, 1732, 1731, 1735, 1814, 1707, 1670,\n 1668, 1631, 1629, 1626, 1634, 1599, 1598, 1596, 1594, 1603, 1601, 2326, 1772, 1753, 1751, 1581, 1554, 1552, 1504,\n 1501, 1498, 1509, 1442, 1437, 1434, 401, 1448, 1445, 2206, 1392, 1391, 1389, 1387, 1384, 359, 1399, 1397, 1394,\n 1404, 2171, 2170, 1708, 1672, 1669, 619, 1632, 1630, 1628, 1773, 1378, 1363, 1361, 1333, 1328, 1336, 1286, 1281,\n 1278, 248, 1292, 1289, 2111, 1218, 1216, 1210, 197, 1206, 193, 1228, 1225, 1221, 1236, 2073, 2071, 1151, 1150,\n 1148, 1146, 152, 1143, 149, 1140, 145, 1161, 1159, 1156, 1153, 158, 1169, 1166, 2017, 2016, 2014, 2019, 1582,\n 510, 1556, 1553, 452, 448, 1506, 1500, 394, 391, 387, 1443, 1441, 1439, 1436, 1450, 2207, 765, 716, 713, 1709,\n 662, 660, 657, 1673, 1671, 916, 914, 879, 878, 877, 882, 1135, 1134, 1121, 1120, 1118, 1123, 1097, 1096, 1094,\n 1092, 103, 1101, 1099, 1979, 1059, 1058, 1056, 1054, 77, 1051, 74, 1066, 1064, 1061, 1071, 1964, 1963, 1007,\n 1006, 1004, 1002, 999, 41, 996, 37, 1017, 1015, 1012, 1009, 52, 1025, 1022, 1936, 1935, 1933, 1938, 942, 940,\n 938, 935, 932, 5, 2, 955, 953, 950, 947, 18, 943, 15, 965, 962, 958, 1895, 1894, 1892, 1890, 973, 1899, 1897,\n 1379, 325, 1364, 1362, 288, 285, 1334, 1332, 1330, 241, 238, 234, 1287, 1285, 1283, 1280, 1294, 2112, 188, 185,\n 181, 178, 2028, 1219, 1217, 1215, 1212, 200, 1209, 1227, 2074, 2072, 583, 553, 551, 1583, 505, 503, 500, 513,\n 1557, 1555, 444, 442, 439, 436, 2213, 455, 451, 1507, 1505, 1502, 796, 763, 762, 760, 767, 711, 710, 708, 706,\n 2377, 718, 715, 1710, 2544, 917, 915, 2681, 1627, 1597, 1595, 2325, 1769, 1749, 1747, 1499, 1438, 1435, 2204,\n 1390, 1388, 1385, 1395, 2169, 2167, 1704, 1665, 1662, 1625, 1623, 1620, 1770, 1329, 1282, 1279, 2109, 1214, 1207,\n 1222, 2068, 2065, 1149, 1147, 1144, 1141, 146, 1157, 1154, 2013, 2011, 2008, 2015, 1579, 1549, 1546, 1495, 1487,\n 1433, 1431, 1428, 1425, 388, 1440, 2205, 1705, 658, 1667, 1664, 1119, 1095, 1093, 1978, 1057, 1055, 1052, 1062,\n 1962, 1960, 1005, 1003, 1000, 997, 38, 1013, 1010, 1932, 1930, 1927, 1934, 941, 939, 936, 933, 6, 930, 3, 951,\n 948, 944, 1889, 1887, 1884, 1881, 959, 1893, 1891, 35, 1377, 1360, 1358, 1327, 1325, 1322, 1331, 1277, 1275,\n 1272, 1269, 235, 1284, 2110, 1205, 1204, 1201, 1198, 182, 1195, 179, 1213, 2070, 2067, 1580, 501, 1551, 1548,\n 440, 437, 1497, 1494, 1490, 1503, 761, 709, 707, 1706, 913, 912, 2198, 1386, 2164, 2161, 1621, 1766, 2103, 1208,\n 2058, 2054, 1145, 1142, 2005, 2002, 1999, 2009, 1488, 1429, 1426, 2200, 1698, 1659, 1656, 1975, 1053, 1957, 1954,\n 1001, 998, 1924, 1921, 1918, 1928, 937, 934, 931, 1879, 1876, 1873, 1870, 945, 1885, 1882, 1323, 1273, 1270,\n 2105, 1202, 1199, 1196, 1211, 2061, 2057, 1576, 1543, 1540, 1484, 1481, 1478, 1491, 1700]);\n}\n","/*\n * Copyright 2008 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*namespace com.google.zxing.common {*/\n\n\nimport FormatException from '../FormatException';\n\n/*import java.util.HashMap;*/\n/*import java.util.Map;*/\n\nexport enum CharacterSetValueIdentifiers {\n Cp437,\n ISO8859_1,\n ISO8859_2,\n ISO8859_3,\n ISO8859_4,\n ISO8859_5,\n ISO8859_6,\n ISO8859_7,\n ISO8859_8,\n ISO8859_9,\n ISO8859_10,\n ISO8859_11,\n ISO8859_13,\n ISO8859_14,\n ISO8859_15,\n ISO8859_16,\n SJIS,\n Cp1250,\n Cp1251,\n Cp1252,\n Cp1256,\n UnicodeBigUnmarked,\n UTF8,\n ASCII,\n Big5,\n GB18030,\n EUC_KR,\n}\n\n/**\n * Encapsulates a Character Set ECI, according to \"Extended Channel Interpretations\" 5.3.1.1\n * of ISO 18004.\n *\n * @author Sean Owen\n */\n\nexport default class CharacterSetECI {\n\n private static VALUE_IDENTIFIER_TO_ECI = new Map();\n private static VALUES_TO_ECI = new Map();\n private static NAME_TO_ECI = new Map();\n\n // Enum name is a Java encoding valid for java.lang and java.io\n // TYPESCRIPTPORT: changed the main label for ISO as the TextEncoder did not recognized them in the form from java\n // (eg ISO8859_1 must be ISO88591 or ISO8859-1 or ISO-8859-1)\n // later on: well, except 16 wich does not work with ISO885916 so used ISO-8859-1 form for default\n public static readonly Cp437 = new CharacterSetECI(\n CharacterSetValueIdentifiers.Cp437, Int32Array.from([0, 2]), 'Cp437');\n\n public static readonly ISO8859_1 = new CharacterSetECI(\n CharacterSetValueIdentifiers.ISO8859_1, Int32Array.from([1, 3]), 'ISO-8859-1', 'ISO88591', 'ISO8859_1');\n\n public static readonly ISO8859_2 = new CharacterSetECI(\n CharacterSetValueIdentifiers.ISO8859_2, 4, 'ISO-8859-2', 'ISO88592', 'ISO8859_2');\n\n public static readonly ISO8859_3 = new CharacterSetECI(\n CharacterSetValueIdentifiers.ISO8859_3, 5, 'ISO-8859-3', 'ISO88593', 'ISO8859_3');\n\n public static readonly ISO8859_4 = new CharacterSetECI(\n CharacterSetValueIdentifiers.ISO8859_4, 6, 'ISO-8859-4', 'ISO88594', 'ISO8859_4');\n\n public static readonly ISO8859_5 = new CharacterSetECI(\n CharacterSetValueIdentifiers.ISO8859_5, 7, 'ISO-8859-5', 'ISO88595', 'ISO8859_5');\n\n public static readonly ISO8859_6 = new CharacterSetECI(\n CharacterSetValueIdentifiers.ISO8859_6, 8, 'ISO-8859-6', 'ISO88596', 'ISO8859_6');\n\n public static readonly ISO8859_7 = new CharacterSetECI(\n CharacterSetValueIdentifiers.ISO8859_7, 9, 'ISO-8859-7', 'ISO88597', 'ISO8859_7');\n\n public static readonly ISO8859_8 = new CharacterSetECI(\n CharacterSetValueIdentifiers.ISO8859_8, 10, 'ISO-8859-8', 'ISO88598', 'ISO8859_8');\n\n public static readonly ISO8859_9 = new CharacterSetECI(\n CharacterSetValueIdentifiers.ISO8859_9, 11, 'ISO-8859-9', 'ISO88599', 'ISO8859_9');\n\n public static readonly ISO8859_10 = new CharacterSetECI(\n CharacterSetValueIdentifiers.ISO8859_10, 12, 'ISO-8859-10', 'ISO885910', 'ISO8859_10');\n\n public static readonly ISO8859_11 = new CharacterSetECI(\n CharacterSetValueIdentifiers.ISO8859_11, 13, 'ISO-8859-11', 'ISO885911', 'ISO8859_11');\n\n public static readonly ISO8859_13 = new CharacterSetECI(\n CharacterSetValueIdentifiers.ISO8859_13, 15, 'ISO-8859-13', 'ISO885913', 'ISO8859_13');\n\n public static readonly ISO8859_14 = new CharacterSetECI(\n CharacterSetValueIdentifiers.ISO8859_14, 16, 'ISO-8859-14', 'ISO885914', 'ISO8859_14');\n\n public static readonly ISO8859_15 = new CharacterSetECI(\n CharacterSetValueIdentifiers.ISO8859_15, 17, 'ISO-8859-15', 'ISO885915', 'ISO8859_15');\n\n public static readonly ISO8859_16 = new CharacterSetECI(\n CharacterSetValueIdentifiers.ISO8859_16, 18, 'ISO-8859-16', 'ISO885916', 'ISO8859_16');\n\n public static readonly SJIS = new CharacterSetECI(\n CharacterSetValueIdentifiers.SJIS, 20, 'SJIS', 'Shift_JIS');\n\n public static readonly Cp1250 = new CharacterSetECI(\n CharacterSetValueIdentifiers.Cp1250, 21, 'Cp1250', 'windows-1250');\n\n public static readonly Cp1251 = new CharacterSetECI(\n CharacterSetValueIdentifiers.Cp1251, 22, 'Cp1251', 'windows-1251');\n\n public static readonly Cp1252 = new CharacterSetECI(\n CharacterSetValueIdentifiers.Cp1252, 23, 'Cp1252', 'windows-1252');\n\n public static readonly Cp1256 = new CharacterSetECI(\n CharacterSetValueIdentifiers.Cp1256, 24, 'Cp1256', 'windows-1256');\n\n public static readonly UnicodeBigUnmarked = new CharacterSetECI(\n CharacterSetValueIdentifiers.UnicodeBigUnmarked, 25, 'UnicodeBigUnmarked', 'UTF-16BE', 'UnicodeBig');\n\n public static readonly UTF8 = new CharacterSetECI(\n CharacterSetValueIdentifiers.UTF8, 26, 'UTF8', 'UTF-8');\n\n public static readonly ASCII = new CharacterSetECI(\n CharacterSetValueIdentifiers.ASCII, Int32Array.from([27, 170]), 'ASCII', 'US-ASCII');\n\n public static readonly Big5 = new CharacterSetECI(\n CharacterSetValueIdentifiers.Big5, 28, 'Big5');\n\n public static readonly GB18030 = new CharacterSetECI(\n CharacterSetValueIdentifiers.GB18030, 29, 'GB18030', 'GB2312', 'EUC_CN', 'GBK');\n\n public static readonly EUC_KR = new CharacterSetECI(\n CharacterSetValueIdentifiers.EUC_KR, 30, 'EUC_KR', 'EUC-KR');\n\n public values: Int32Array;\n public otherEncodingNames: string[];\n\n public constructor(\n public valueIdentifier: CharacterSetValueIdentifiers,\n valuesParam: Int32Array | number,\n public name: string, ...otherEncodingNames: string[]\n ) {\n\n if (typeof valuesParam === 'number') {\n this.values = Int32Array.from([valuesParam]);\n } else {\n this.values = valuesParam;\n }\n\n this.otherEncodingNames = otherEncodingNames;\n\n CharacterSetECI.VALUE_IDENTIFIER_TO_ECI.set(valueIdentifier, this);\n CharacterSetECI.NAME_TO_ECI.set(name, this);\n\n const values = this.values;\n\n for (let i = 0, length = values.length; i !== length; i++) {\n const v = values[i];\n CharacterSetECI.VALUES_TO_ECI.set(v, this);\n }\n for (const otherName of otherEncodingNames) {\n CharacterSetECI.NAME_TO_ECI.set(otherName, this);\n }\n }\n\n // CharacterSetECI(value: number /*int*/) {\n // this(new Int32Array {value})\n // }\n\n // CharacterSetECI(value: number /*int*/, String... otherEncodingNames) {\n // this.values = new Int32Array {value}\n // this.otherEncodingNames = otherEncodingNames\n // }\n\n // CharacterSetECI(values: Int32Array, String... otherEncodingNames) {\n // this.values = values\n // this.otherEncodingNames = otherEncodingNames\n // }\n\n public getValueIdentifier(): CharacterSetValueIdentifiers/*int*/ {\n return this.valueIdentifier;\n }\n\n public getName(): string {\n return this.name;\n }\n\n public getValue(): number /*int*/ {\n return this.values[0];\n }\n\n /**\n * @param value character set ECI value\n * @return {@code CharacterSetECI} representing ECI of given value, or null if it is legal but\n * unsupported\n * @throws FormatException if ECI value is invalid\n */\n public static getCharacterSetECIByValue(value: number /*int*/): CharacterSetECI /*throws FormatException*/ {\n\n if (value < 0 || value >= 900) {\n throw new FormatException('incorect value');\n }\n\n const characterSet = CharacterSetECI.VALUES_TO_ECI.get(value);\n\n if (undefined === characterSet) {\n throw new FormatException('incorect value');\n }\n\n return characterSet;\n }\n\n /**\n * @param name character set ECI encoding name\n * @return CharacterSetECI representing ECI for character encoding, or null if it is legal\n * but unsupported\n */\n public static getCharacterSetECIByName(name: string): CharacterSetECI {\n\n const characterSet = CharacterSetECI.NAME_TO_ECI.get(name);\n\n if (undefined === characterSet) {\n throw new FormatException('incorect value');\n }\n\n return characterSet;\n }\n\n public equals(o: CharacterSetECI) {\n\n if (!(o instanceof CharacterSetECI)) {\n return false;\n }\n\n const other = o as CharacterSetECI;\n\n return this.getName() === other.getName();\n }\n\n}\n","import UnsupportedOperationException from '../UnsupportedOperationException';\nimport CharacterSetECI from '../common/CharacterSetECI';\n\n/**\n * Responsible for en/decoding strings.\n */\nexport default class StringEncoding {\n\n /**\n * Allows the user to set a custom decoding function\n * so more encoding formats the native ones can be supported.\n */\n public static customDecoder: (bytes: Uint8Array, encodingName: string) => string;\n\n /**\n * Allows the user to set a custom encoding function\n * so more encoding formats the native ones can be supported.\n */\n public static customEncoder: (s: string, encodingName: string) => Uint8Array;\n\n /**\n * Decodes some Uint8Array to a string format.\n */\n public static decode(bytes: Uint8Array, encoding: string | CharacterSetECI): string {\n\n const encodingName = this.encodingName(encoding);\n\n if (this.customDecoder) {\n return this.customDecoder(bytes, encodingName);\n }\n\n // Increases browser support.\n if (typeof TextDecoder === 'undefined' || this.shouldDecodeOnFallback(encodingName)) {\n return this.decodeFallback(bytes, encodingName);\n }\n\n return new TextDecoder(encodingName).decode(bytes);\n }\n\n /**\n * Checks if the decoding method should use the fallback for decoding\n * once Node TextDecoder doesn't support all encoding formats.\n *\n * @param encodingName\n */\n private static shouldDecodeOnFallback(encodingName: string): boolean {\n return !StringEncoding.isBrowser() && encodingName === 'ISO-8859-1';\n }\n\n /**\n * Encodes some string into a Uint8Array.\n */\n public static encode(s: string, encoding: string | CharacterSetECI): Uint8Array {\n\n const encodingName = this.encodingName(encoding);\n\n if (this.customEncoder) {\n return this.customEncoder(s, encodingName);\n }\n\n // Increases browser support.\n if (typeof TextEncoder === 'undefined') {\n return this.encodeFallback(s);\n }\n\n // TextEncoder only encodes to UTF8 by default as specified by encoding.spec.whatwg.org\n return new TextEncoder().encode(s);\n }\n\n private static isBrowser(): boolean {\n return (typeof window !== 'undefined' && {}.toString.call(window) === '[object Window]');\n }\n\n /**\n * Returns the string value from some encoding character set.\n */\n public static encodingName(encoding: string | CharacterSetECI): string {\n return typeof encoding === 'string'\n ? encoding\n : encoding.getName();\n }\n\n /**\n * Returns character set from some encoding character set.\n */\n public static encodingCharacterSet(encoding: string | CharacterSetECI): CharacterSetECI {\n\n if (encoding instanceof CharacterSetECI) {\n return encoding;\n }\n\n return CharacterSetECI.getCharacterSetECIByName(encoding);\n }\n\n /**\n * Runs a fallback for the native decoding funcion.\n */\n private static decodeFallback(bytes: Uint8Array, encoding: string | CharacterSetECI): string {\n\n const characterSet = this.encodingCharacterSet(encoding);\n\n if (StringEncoding.isDecodeFallbackSupported(characterSet)) {\n\n let s = '';\n\n for (let i = 0, length = bytes.length; i < length; i++) {\n\n let h = bytes[i].toString(16);\n\n if (h.length < 2) {\n h = '0' + h;\n }\n\n s += '%' + h;\n }\n\n return decodeURIComponent(s);\n }\n\n if (characterSet.equals(CharacterSetECI.UnicodeBigUnmarked)) {\n return String.fromCharCode.apply(null, new Uint16Array(bytes.buffer));\n }\n\n throw new UnsupportedOperationException(`Encoding ${this.encodingName(encoding)} not supported by fallback.`);\n }\n\n private static isDecodeFallbackSupported(characterSet: CharacterSetECI) {\n return characterSet.equals(CharacterSetECI.UTF8) ||\n characterSet.equals(CharacterSetECI.ISO8859_1) ||\n characterSet.equals(CharacterSetECI.ASCII);\n }\n\n /**\n * Runs a fallback for the native encoding funcion.\n *\n * @see https://stackoverflow.com/a/17192845/4367683\n */\n private static encodeFallback(s: string): Uint8Array {\n\n const encodedURIstring = btoa(unescape(encodeURIComponent(s)));\n const charList = encodedURIstring.split('');\n const uintArray = [];\n\n for (let i = 0; i < charList.length; i++) {\n uintArray.push(charList[i].charCodeAt(0));\n }\n\n return new Uint8Array(uintArray);\n }\n}\n","/*\n * Copyright 2009 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport LuminanceSource from './LuminanceSource';\n\n/*namespace com.google.zxing {*/\n\n/**\n * A wrapper implementation of {@link LuminanceSource} which inverts the luminances it returns -- black becomes\n * white and vice versa, and each value becomes (255-value).\n *\n * @author Sean Owen\n */\nexport default class InvertedLuminanceSource extends LuminanceSource {\n\n public constructor(private delegate: LuminanceSource) {\n super(delegate.getWidth(), delegate.getHeight());\n }\n\n /*@Override*/\n public getRow(y: number /*int*/, row?: Uint8ClampedArray): Uint8ClampedArray {\n const sourceRow = this.delegate.getRow(y, row);\n const width: number /*int*/ = this.getWidth();\n for (let i = 0; i < width; i++) {\n sourceRow[i] = /*(byte)*/ (255 - (sourceRow[i] & 0xFF));\n }\n return sourceRow;\n }\n\n /*@Override*/\n public getMatrix(): Uint8ClampedArray {\n\n const matrix: Uint8ClampedArray = this.delegate.getMatrix();\n const length: number /*int*/ = this.getWidth() * this.getHeight();\n const invertedMatrix = new Uint8ClampedArray(length);\n\n for (let i = 0; i < length; i++) {\n invertedMatrix[i] = /*(byte)*/ (255 - (matrix[i] & 0xFF));\n }\n\n return invertedMatrix;\n }\n\n /*@Override*/\n public isCropSupported(): boolean {\n return this.delegate.isCropSupported();\n }\n\n /*@Override*/\n public crop(left: number /*int*/, top: number /*int*/, width: number /*int*/, height: number /*int*/): LuminanceSource {\n return new InvertedLuminanceSource(this.delegate.crop(left, top, width, height));\n }\n\n /*@Override*/\n public isRotateSupported(): boolean {\n return this.delegate.isRotateSupported();\n }\n\n /**\n * @return original delegate {@link LuminanceSource} since invert undoes itself\n */\n /*@Override*/\n public invert(): LuminanceSource {\n return this.delegate;\n }\n\n /*@Override*/\n public rotateCounterClockwise(): LuminanceSource {\n return new InvertedLuminanceSource(this.delegate.rotateCounterClockwise());\n }\n\n /*@Override*/\n public rotateCounterClockwise45(): LuminanceSource {\n return new InvertedLuminanceSource(this.delegate.rotateCounterClockwise45());\n }\n\n}\n","/*\n * Copyright 2009 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\nimport StringBuilder from './util/StringBuilder';\nimport UnsupportedOperationException from './UnsupportedOperationException';\n\n/*namespace com.google.zxing {*/\n\n/**\n * The purpose of this class hierarchy is to abstract different bitmap implementations across\n * platforms into a standard interface for requesting greyscale luminance values. The interface\n * only provides immutable methods; therefore crop and rotation create copies. This is to ensure\n * that one Reader does not modify the original luminance source and leave it in an unknown state\n * for other Readers in the chain.\n *\n * @author dswitkin@google.com (Daniel Switkin)\n */\nabstract class LuminanceSource {\n\n protected constructor(private width: number /*int*/, private height: number /*int*/) { }\n\n /**\n * Fetches one row of luminance data from the underlying platform's bitmap. Values range from\n * 0 (black) to 255 (white). Because Java does not have an unsigned byte type, callers will have\n * to bitwise and with 0xff for each value. It is preferable for implementations of this method\n * to only fetch this row rather than the whole image, since no 2D Readers may be installed and\n * getMatrix() may never be called.\n *\n * @param y The row to fetch, which must be in [0,getHeight())\n * @param row An optional preallocated array. If null or too small, it will be ignored.\n * Always use the returned object, and ignore the .length of the array.\n * @return An array containing the luminance data.\n */\n public abstract getRow(y: number /*int*/, row?: Uint8ClampedArray): Uint8ClampedArray;\n\n /**\n * Fetches luminance data for the underlying bitmap. Values should be fetched using:\n * {@code int luminance = array[y * width + x] & 0xff}\n *\n * @return A row-major 2D array of luminance values. Do not use result.length as it may be\n * larger than width * height bytes on some platforms. Do not modify the contents\n * of the result.\n */\n public abstract getMatrix(): Uint8ClampedArray;\n\n /**\n * @return The width of the bitmap.\n */\n public getWidth(): number /*int*/ {\n return this.width;\n }\n\n /**\n * @return The height of the bitmap.\n */\n public getHeight(): number /*int*/ {\n return this.height;\n }\n\n /**\n * @return Whether this subclass supports cropping.\n */\n public isCropSupported(): boolean {\n return false;\n }\n\n /**\n * Returns a new object with cropped image data. Implementations may keep a reference to the\n * original data rather than a copy. Only callable if isCropSupported() is true.\n *\n * @param left The left coordinate, which must be in [0,getWidth())\n * @param top The top coordinate, which must be in [0,getHeight())\n * @param width The width of the rectangle to crop.\n * @param height The height of the rectangle to crop.\n * @return A cropped version of this object.\n */\n public crop(left: number /*int*/, top: number /*int*/, width: number /*int*/, height: number /*int*/): LuminanceSource {\n throw new UnsupportedOperationException('This luminance source does not support cropping.');\n }\n\n /**\n * @return Whether this subclass supports counter-clockwise rotation.\n */\n public isRotateSupported(): boolean {\n return false;\n }\n\n /**\n * @return a wrapper of this {@code LuminanceSource} which inverts the luminances it returns -- black becomes\n * white and vice versa, and each value becomes (255-value).\n */\n public abstract invert(): LuminanceSource;\n\n /**\n * Returns a new object with rotated image data by 90 degrees counterclockwise.\n * Only callable if {@link #isRotateSupported()} is true.\n *\n * @return A rotated version of this object.\n */\n public rotateCounterClockwise(): LuminanceSource {\n throw new UnsupportedOperationException('This luminance source does not support rotation by 90 degrees.');\n }\n\n /**\n * Returns a new object with rotated image data by 45 degrees counterclockwise.\n * Only callable if {@link #isRotateSupported()} is true.\n *\n * @return A rotated version of this object.\n */\n public rotateCounterClockwise45(): LuminanceSource {\n throw new UnsupportedOperationException('This luminance source does not support rotation by 45 degrees.');\n }\n\n /*@Override*/\n public toString(): string {\n const row = new Uint8ClampedArray(this.width);\n let result = new StringBuilder();\n for (let y = 0; y < this.height; y++) {\n const sourceRow = this.getRow(y, row);\n for (let x = 0; x < this.width; x++) {\n const luminance = sourceRow[x] & 0xFF;\n let c;\n if (luminance < 0x40) {\n c = '#';\n } else if (luminance < 0x80) {\n c = '+';\n } else if (luminance < 0xC0) {\n c = '.';\n } else {\n c = ' ';\n }\n result.append(c);\n }\n result.append('\\n');\n }\n return result.toString();\n }\n\n}\n\nexport default LuminanceSource;\n","/*\n * Copyright 2007 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*namespace com.google.zxing.common {*/\n\n/*import java.util.List;*/\n\n/**\n *

Encapsulates the result of decoding a matrix of bits. This typically\n * applies to 2D barcode formats. For now it contains the raw bytes obtained,\n * as well as a String interpretation of those bytes, if applicable.

\n *\n * @author Sean Owen\n */\nexport default class DecoderResult {\n\n private numBits: number; /*int*/\n private errorsCorrected: number; /*Integer*/\n private erasures: number; /*Integer*/\n private other: any;\n\n // public constructor(rawBytes: Uint8Array,\n // text: string,\n // List byteSegments,\n // String ecLevel) {\n // this(rawBytes, text, byteSegments, ecLevel, -1, -1)\n // }\n\n public constructor(private rawBytes: Uint8Array,\n private text: string,\n private byteSegments: Uint8Array[],\n private ecLevel: string,\n private structuredAppendSequenceNumber: number /*int*/ = -1,\n private structuredAppendParity: number /*int*/ = -1) {\n this.numBits = (rawBytes === undefined || rawBytes === null) ? 0 : 8 * rawBytes.length;\n }\n\n /**\n * @return raw bytes representing the result, or {@code null} if not applicable\n */\n public getRawBytes(): Uint8Array {\n return this.rawBytes;\n }\n\n /**\n * @return how many bits of {@link #getRawBytes()} are valid; typically 8 times its length\n * @since 3.3.0\n */\n public getNumBits(): number /*int*/ {\n return this.numBits;\n }\n\n /**\n * @param numBits overrides the number of bits that are valid in {@link #getRawBytes()}\n * @since 3.3.0\n */\n public setNumBits(numBits: number /*int*/): void {\n this.numBits = numBits;\n }\n\n /**\n * @return text representation of the result\n */\n public getText(): string {\n return this.text;\n }\n\n /**\n * @return list of byte segments in the result, or {@code null} if not applicable\n */\n public getByteSegments(): Uint8Array[] {\n return this.byteSegments;\n }\n\n /**\n * @return name of error correction level used, or {@code null} if not applicable\n */\n public getECLevel(): string {\n return this.ecLevel;\n }\n\n /**\n * @return number of errors corrected, or {@code null} if not applicable\n */\n public getErrorsCorrected(): number/*Integer*/ {\n return this.errorsCorrected;\n }\n\n public setErrorsCorrected(errorsCorrected: number/*Integer*/): void {\n this.errorsCorrected = errorsCorrected;\n }\n\n /**\n * @return number of erasures corrected, or {@code null} if not applicable\n */\n public getErasures(): number/*Integer*/ {\n return this.erasures;\n }\n\n public setErasures(erasures: number/*Integer*/): void {\n this.erasures = erasures;\n }\n\n /**\n * @return arbitrary additional metadata\n */\n public getOther(): any {\n return this.other;\n }\n\n public setOther(other: any): void {\n this.other = other;\n }\n\n public hasStructuredAppend(): boolean {\n return this.structuredAppendParity >= 0 && this.structuredAppendSequenceNumber >= 0;\n }\n\n public getStructuredAppendParity(): number /*int*/ {\n return this.structuredAppendParity;\n }\n\n public getStructuredAppendSequenceNumber(): number /*int*/ {\n return this.structuredAppendSequenceNumber;\n }\n\n}\n","/*\n * Copyright 2007 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*namespace com.google.zxing.common.reedsolomon {*/\n\nimport GenericGF from './GenericGF';\nimport GenericGFPoly from './GenericGFPoly';\n\nimport ReedSolomonException from '../../ReedSolomonException';\nimport IllegalStateException from '../../IllegalStateException';\n\n/**\n *

Implements Reed-Solomon decoding, as the name implies.

\n *\n *

The algorithm will not be explained here, but the following references were helpful\n * in creating this implementation:

\n *\n * \n *\n *

Much credit is due to William Rucklidge since portions of this code are an indirect\n * port of his C++ Reed-Solomon implementation.

\n *\n * @author Sean Owen\n * @author William Rucklidge\n * @author sanfordsquires\n */\nexport default class ReedSolomonDecoder {\n\n public constructor(private field: GenericGF) { }\n\n /**\n *

Decodes given set of received codewords, which include both data and error-correction\n * codewords. Really, this means it uses Reed-Solomon to detect and correct errors, in-place,\n * in the input.

\n *\n * @param received data and error-correction codewords\n * @param twoS number of error-correction codewords available\n * @throws ReedSolomonException if decoding fails for any reason\n */\n public decode(received: Int32Array, twoS: number /*int*/): void /*throws ReedSolomonException*/ {\n const field = this.field;\n const poly = new GenericGFPoly(field, received);\n const syndromeCoefficients = new Int32Array(twoS);\n let noError: boolean = true;\n for (let i = 0; i < twoS; i++) {\n const evalResult = poly.evaluateAt(field.exp(i + field.getGeneratorBase()));\n syndromeCoefficients[syndromeCoefficients.length - 1 - i] = evalResult;\n if (evalResult !== 0) {\n noError = false;\n }\n }\n if (noError) {\n return;\n }\n const syndrome = new GenericGFPoly(field, syndromeCoefficients);\n const sigmaOmega = this.runEuclideanAlgorithm(field.buildMonomial(twoS, 1), syndrome, twoS);\n const sigma = sigmaOmega[0];\n const omega = sigmaOmega[1];\n const errorLocations = this.findErrorLocations(sigma);\n const errorMagnitudes = this.findErrorMagnitudes(omega, errorLocations);\n for (let i = 0; i < errorLocations.length; i++) {\n const position = received.length - 1 - field.log(errorLocations[i]);\n if (position < 0) {\n throw new ReedSolomonException('Bad error location');\n }\n received[position] = GenericGF.addOrSubtract(received[position], errorMagnitudes[i]);\n }\n }\n\n private runEuclideanAlgorithm(a: GenericGFPoly, b: GenericGFPoly, R: number /*int*/): GenericGFPoly[] {\n // Assume a's degree is >= b's\n if (a.getDegree() < b.getDegree()) {\n const temp = a;\n a = b;\n b = temp;\n }\n\n const field = this.field;\n\n let rLast = a;\n let r = b;\n let tLast = field.getZero();\n let t = field.getOne();\n\n // Run Euclidean algorithm until r's degree is less than R/2\n while (r.getDegree() >= (R / 2 | 0)) {\n let rLastLast = rLast;\n let tLastLast = tLast;\n rLast = r;\n tLast = t;\n\n // Divide rLastLast by rLast, with quotient in q and remainder in r\n if (rLast.isZero()) {\n // Oops, Euclidean algorithm already terminated?\n throw new ReedSolomonException('r_{i-1} was zero');\n }\n r = rLastLast;\n let q = field.getZero();\n const denominatorLeadingTerm = rLast.getCoefficient(rLast.getDegree());\n const dltInverse = field.inverse(denominatorLeadingTerm);\n while (r.getDegree() >= rLast.getDegree() && !r.isZero()) {\n const degreeDiff = r.getDegree() - rLast.getDegree();\n const scale = field.multiply(r.getCoefficient(r.getDegree()), dltInverse);\n q = q.addOrSubtract(field.buildMonomial(degreeDiff, scale));\n r = r.addOrSubtract(rLast.multiplyByMonomial(degreeDiff, scale));\n }\n\n t = q.multiply(tLast).addOrSubtract(tLastLast);\n\n if (r.getDegree() >= rLast.getDegree()) {\n throw new IllegalStateException('Division algorithm failed to reduce polynomial?');\n }\n }\n\n const sigmaTildeAtZero = t.getCoefficient(0);\n if (sigmaTildeAtZero === 0) {\n throw new ReedSolomonException('sigmaTilde(0) was zero');\n }\n\n const inverse = field.inverse(sigmaTildeAtZero);\n const sigma = t.multiplyScalar(inverse);\n const omega = r.multiplyScalar(inverse);\n return [sigma, omega];\n }\n\n private findErrorLocations(errorLocator: GenericGFPoly): Int32Array /*throws ReedSolomonException*/ {\n // This is a direct application of Chien's search\n const numErrors = errorLocator.getDegree();\n if (numErrors === 1) { // shortcut\n return Int32Array.from([errorLocator.getCoefficient(1)]);\n }\n const result = new Int32Array(numErrors);\n let e = 0;\n const field = this.field;\n for (let i = 1; i < field.getSize() && e < numErrors; i++) {\n if (errorLocator.evaluateAt(i) === 0) {\n result[e] = field.inverse(i);\n e++;\n }\n }\n if (e !== numErrors) {\n throw new ReedSolomonException('Error locator degree does not match number of roots');\n }\n return result;\n }\n\n private findErrorMagnitudes(errorEvaluator: GenericGFPoly, errorLocations: Int32Array): Int32Array {\n // This is directly applying Forney's Formula\n const s = errorLocations.length;\n const result = new Int32Array(s);\n const field = this.field;\n for (let i = 0; i < s; i++) {\n const xiInverse = field.inverse(errorLocations[i]);\n let denominator = 1;\n for (let j = 0; j < s; j++) {\n if (i !== j) {\n // denominator = field.multiply(denominator,\n // GenericGF.addOrSubtract(1, field.multiply(errorLocations[j], xiInverse)))\n // Above should work but fails on some Apple and Linux JDKs due to a Hotspot bug.\n // Below is a funny-looking workaround from Steven Parkes\n const term = field.multiply(errorLocations[j], xiInverse);\n const termPlus1 = (term & 0x1) === 0 ? term | 1 : term & ~1;\n denominator = field.multiply(denominator, termPlus1);\n }\n }\n result[i] = field.multiply(errorEvaluator.evaluateAt(xiInverse),\n field.inverse(denominator));\n if (field.getGeneratorBase() !== 0) {\n result[i] = field.multiply(result[i], xiInverse);\n }\n }\n return result;\n }\n\n}\n","/*\n * Copyright (C) 2010 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*namespace com.google.zxing.common {*/\n\n/*import java.nio.charset.Charset;*/\n/*import java.util.Map;*/\n\nimport DecodeHintType from '../DecodeHintType';\nimport CharacterSetECI from './CharacterSetECI';\nimport StringEncoding from '../util/StringEncoding';\nimport { int } from '../../customTypings';\nimport Charset from '../util/Charset';\n\n/**\n * Common string-related functions.\n *\n * @author Sean Owen\n * @author Alex Dupre\n */\nexport default class StringUtils {\n\n public static SHIFT_JIS = CharacterSetECI.SJIS.getName(); // \"SJIS\"\n public static GB2312 = 'GB2312';\n public static ISO88591 = CharacterSetECI.ISO8859_1.getName(); // \"ISO8859_1\"\n private static EUC_JP = 'EUC_JP';\n private static UTF8 = CharacterSetECI.UTF8.getName(); // \"UTF8\"\n private static PLATFORM_DEFAULT_ENCODING = StringUtils.UTF8; // \"UTF8\"//Charset.defaultCharset().name()\n private static ASSUME_SHIFT_JIS = false;\n // SHIFT_JIS.equalsIgnoreCase(PLATFORM_DEFAULT_ENCODING) ||\n // EUC_JP.equalsIgnoreCase(PLATFORM_DEFAULT_ENCODING);\n\n static castAsNonUtf8Char(code: number, encoding: Charset = null) {\n // ISO 8859-1 is the Java default as UTF-8 is JavaScripts\n // you can see this method as a Java version of String.fromCharCode\n const e = encoding ? encoding.getName() : this.ISO88591;\n // use passed format (fromCharCode will return UTF8 encoding)\n return StringEncoding.decode(new Uint8Array([code]), e);\n }\n\n /**\n * @param bytes bytes encoding a string, whose encoding should be guessed\n * @param hints decode hints if applicable\n * @return name of guessed encoding; at the moment will only guess one of:\n * {@link #SHIFT_JIS}, {@link #UTF8}, {@link #ISO88591}, or the platform\n * default encoding if none of these can possibly be correct\n */\n public static guessEncoding(bytes: Uint8Array, hints: Map): string {\n if (hints !== null && hints !== undefined && undefined !== hints.get(DecodeHintType.CHARACTER_SET)) {\n return hints.get(DecodeHintType.CHARACTER_SET).toString();\n }\n // For now, merely tries to distinguish ISO-8859-1, UTF-8 and Shift_JIS,\n // which should be by far the most common encodings.\n const length = bytes.length;\n let canBeISO88591 = true;\n let canBeShiftJIS = true;\n let canBeUTF8 = true;\n let utf8BytesLeft = 0;\n // int utf8LowChars = 0\n let utf2BytesChars = 0;\n let utf3BytesChars = 0;\n let utf4BytesChars = 0;\n let sjisBytesLeft = 0;\n // int sjisLowChars = 0\n let sjisKatakanaChars = 0;\n // int sjisDoubleBytesChars = 0\n let sjisCurKatakanaWordLength = 0;\n let sjisCurDoubleBytesWordLength = 0;\n let sjisMaxKatakanaWordLength = 0;\n let sjisMaxDoubleBytesWordLength = 0;\n // int isoLowChars = 0\n // int isoHighChars = 0\n let isoHighOther = 0;\n\n const utf8bom = bytes.length > 3 &&\n bytes[0] === /*(byte) */0xEF &&\n bytes[1] === /*(byte) */0xBB &&\n bytes[2] === /*(byte) */0xBF;\n\n for (let i = 0;\n i < length && (canBeISO88591 || canBeShiftJIS || canBeUTF8);\n i++) {\n\n const value = bytes[i] & 0xFF;\n\n // UTF-8 stuff\n if (canBeUTF8) {\n if (utf8BytesLeft > 0) {\n if ((value & 0x80) === 0) {\n canBeUTF8 = false;\n } else {\n utf8BytesLeft--;\n }\n } else if ((value & 0x80) !== 0) {\n if ((value & 0x40) === 0) {\n canBeUTF8 = false;\n } else {\n utf8BytesLeft++;\n if ((value & 0x20) === 0) {\n utf2BytesChars++;\n } else {\n utf8BytesLeft++;\n if ((value & 0x10) === 0) {\n utf3BytesChars++;\n } else {\n utf8BytesLeft++;\n if ((value & 0x08) === 0) {\n utf4BytesChars++;\n } else {\n canBeUTF8 = false;\n }\n }\n }\n }\n } // else {\n // utf8LowChars++\n // }\n }\n\n // ISO-8859-1 stuff\n if (canBeISO88591) {\n if (value > 0x7F && value < 0xA0) {\n canBeISO88591 = false;\n } else if (value > 0x9F) {\n if (value < 0xC0 || value === 0xD7 || value === 0xF7) {\n isoHighOther++;\n } // else {\n // isoHighChars++\n // }\n } // else {\n // isoLowChars++\n // }\n }\n\n // Shift_JIS stuff\n if (canBeShiftJIS) {\n if (sjisBytesLeft > 0) {\n if (value < 0x40 || value === 0x7F || value > 0xFC) {\n canBeShiftJIS = false;\n } else {\n sjisBytesLeft--;\n }\n } else if (value === 0x80 || value === 0xA0 || value > 0xEF) {\n canBeShiftJIS = false;\n } else if (value > 0xA0 && value < 0xE0) {\n sjisKatakanaChars++;\n sjisCurDoubleBytesWordLength = 0;\n sjisCurKatakanaWordLength++;\n if (sjisCurKatakanaWordLength > sjisMaxKatakanaWordLength) {\n sjisMaxKatakanaWordLength = sjisCurKatakanaWordLength;\n }\n } else if (value > 0x7F) {\n sjisBytesLeft++;\n // sjisDoubleBytesChars++\n sjisCurKatakanaWordLength = 0;\n sjisCurDoubleBytesWordLength++;\n if (sjisCurDoubleBytesWordLength > sjisMaxDoubleBytesWordLength) {\n sjisMaxDoubleBytesWordLength = sjisCurDoubleBytesWordLength;\n }\n } else {\n // sjisLowChars++\n sjisCurKatakanaWordLength = 0;\n sjisCurDoubleBytesWordLength = 0;\n }\n }\n }\n\n if (canBeUTF8 && utf8BytesLeft > 0) {\n canBeUTF8 = false;\n }\n if (canBeShiftJIS && sjisBytesLeft > 0) {\n canBeShiftJIS = false;\n }\n\n // Easy -- if there is BOM or at least 1 valid not-single byte character (and no evidence it can't be UTF-8), done\n if (canBeUTF8 && (utf8bom || utf2BytesChars + utf3BytesChars + utf4BytesChars > 0)) {\n return StringUtils.UTF8;\n }\n // Easy -- if assuming Shift_JIS or at least 3 valid consecutive not-ascii characters (and no evidence it can't be), done\n if (canBeShiftJIS && (StringUtils.ASSUME_SHIFT_JIS || sjisMaxKatakanaWordLength >= 3 || sjisMaxDoubleBytesWordLength >= 3)) {\n return StringUtils.SHIFT_JIS;\n }\n // Distinguishing Shift_JIS and ISO-8859-1 can be a little tough for short words. The crude heuristic is:\n // - If we saw\n // - only two consecutive katakana chars in the whole text, or\n // - at least 10% of bytes that could be \"upper\" not-alphanumeric Latin1,\n // - then we conclude Shift_JIS, else ISO-8859-1\n if (canBeISO88591 && canBeShiftJIS) {\n return (sjisMaxKatakanaWordLength === 2 && sjisKatakanaChars === 2) || isoHighOther * 10 >= length\n ? StringUtils.SHIFT_JIS : StringUtils.ISO88591;\n }\n\n // Otherwise, try in order ISO-8859-1, Shift JIS, UTF-8 and fall back to default platform encoding\n if (canBeISO88591) {\n return StringUtils.ISO88591;\n }\n if (canBeShiftJIS) {\n return StringUtils.SHIFT_JIS;\n }\n if (canBeUTF8) {\n return StringUtils.UTF8;\n }\n // Otherwise, we take a wild guess with platform encoding\n return StringUtils.PLATFORM_DEFAULT_ENCODING;\n }\n\n /**\n *\n * @see https://stackoverflow.com/a/13439711/4367683\n *\n * @param append The new string to append.\n * @param args Argumets values to be formated.\n */\n public static format(append: string, ...args: any[]) {\n\n let i = -1;\n\n function callback(exp: string | number, p0: any, p1: any, p2: any, p3: any, p4: any) {\n\n if (exp === '%%') return '%';\n if (args[++i] === undefined) return undefined;\n\n exp = p2 ? parseInt(p2.substr(1)) : undefined;\n\n let base = p3 ? parseInt(p3.substr(1)) : undefined;\n let val: string;\n\n switch (p4) {\n case 's': val = args[i]; break;\n case 'c': val = args[i][0]; break;\n case 'f': val = parseFloat(args[i]).toFixed(exp); break;\n case 'p': val = parseFloat(args[i]).toPrecision(exp); break;\n case 'e': val = parseFloat(args[i]).toExponential(exp); break;\n case 'x': val = parseInt(args[i]).toString(base ? base : 16); break;\n case 'd': val = parseFloat(parseInt(args[i], base ? base : 10).toPrecision(exp)).toFixed(0); break;\n }\n\n val = typeof val === 'object' ? JSON.stringify(val) : (+val).toString(base);\n let size = parseInt(p1); /* padding size */\n let ch = p1 && (p1[0] + '') === '0' ? '0' : ' '; /* isnull? */\n\n while (val.length < size) val = p0 !== undefined ? val + ch : ch + val; /* isminus? */\n\n return val;\n }\n\n let regex = /%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;\n\n return append.replace(regex, callback);\n }\n\n /**\n *\n */\n public static getBytes(str: string, encoding: CharacterSetECI): Uint8Array {\n return StringEncoding.encode(str, encoding);\n }\n\n /**\n * Returns the charcode at the specified index or at index zero.\n */\n public static getCharCode(str: string, index = 0): int {\n return str.charCodeAt(index);\n }\n\n /**\n * Returns char for given charcode\n */\n public static getCharAt(charCode: number): string {\n return String.fromCharCode(charCode);\n }\n}\n","/*\n * Copyright 2007 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*namespace com.google.zxing.common.reedsolomon {*/\n\nimport AbstractGenericGF from './AbstractGenericGF';\n\nimport System from '../../util/System';\nimport IllegalArgumentException from '../../IllegalArgumentException';\n\n/**\n *

Represents a polynomial whose coefficients are elements of a GF.\n * Instances of this class are immutable.

\n *\n *

Much credit is due to William Rucklidge since portions of this code are an indirect\n * port of his C++ Reed-Solomon implementation.

\n *\n * @author Sean Owen\n */\nexport default class GenericGFPoly {\n\n private field: AbstractGenericGF;\n private coefficients: Int32Array;\n\n /**\n * @param field the {@link GenericGF} instance representing the field to use\n * to perform computations\n * @param coefficients coefficients as ints representing elements of GF(size), arranged\n * from most significant (highest-power term) coefficient to least significant\n * @throws IllegalArgumentException if argument is null or empty,\n * or if leading coefficient is 0 and this is not a\n * constant polynomial (that is, it is not the monomial \"0\")\n */\n public constructor(field: AbstractGenericGF, coefficients: Int32Array) {\n if (coefficients.length === 0) {\n throw new IllegalArgumentException();\n }\n this.field = field;\n const coefficientsLength = coefficients.length;\n if (coefficientsLength > 1 && coefficients[0] === 0) {\n // Leading term must be non-zero for anything except the constant polynomial \"0\"\n let firstNonZero = 1;\n while (firstNonZero < coefficientsLength && coefficients[firstNonZero] === 0) {\n firstNonZero++;\n }\n if (firstNonZero === coefficientsLength) {\n this.coefficients = Int32Array.from([0]);\n } else {\n this.coefficients = new Int32Array(coefficientsLength - firstNonZero);\n System.arraycopy(coefficients,\n firstNonZero,\n this.coefficients,\n 0,\n this.coefficients.length);\n }\n } else {\n this.coefficients = coefficients;\n }\n }\n\n public getCoefficients(): Int32Array {\n return this.coefficients;\n }\n\n /**\n * @return degree of this polynomial\n */\n public getDegree(): number {\n return this.coefficients.length - 1;\n }\n\n /**\n * @return true iff this polynomial is the monomial \"0\"\n */\n public isZero(): boolean {\n return this.coefficients[0] === 0;\n }\n\n /**\n * @return coefficient of x^degree term in this polynomial\n */\n public getCoefficient(degree: number /*int*/): number {\n return this.coefficients[this.coefficients.length - 1 - degree];\n }\n\n /**\n * @return evaluation of this polynomial at a given point\n */\n public evaluateAt(a: number /*int*/): number {\n if (a === 0) {\n // Just return the x^0 coefficient\n return this.getCoefficient(0);\n }\n const coefficients = this.coefficients;\n let result: number;\n if (a === 1) {\n // Just the sum of the coefficients\n result = 0;\n for (let i = 0, length = coefficients.length; i !== length; i++) {\n const coefficient = coefficients[i];\n result = AbstractGenericGF.addOrSubtract(result, coefficient);\n }\n return result;\n }\n result = coefficients[0];\n const size = coefficients.length;\n const field = this.field;\n for (let i = 1; i < size; i++) {\n result = AbstractGenericGF.addOrSubtract(field.multiply(a, result), coefficients[i]);\n }\n return result;\n }\n\n public addOrSubtract(other: GenericGFPoly): GenericGFPoly {\n if (!this.field.equals(other.field)) {\n throw new IllegalArgumentException('GenericGFPolys do not have same GenericGF field');\n }\n if (this.isZero()) {\n return other;\n }\n if (other.isZero()) {\n return this;\n }\n\n let smallerCoefficients = this.coefficients;\n let largerCoefficients = other.coefficients;\n if (smallerCoefficients.length > largerCoefficients.length) {\n const temp = smallerCoefficients;\n smallerCoefficients = largerCoefficients;\n largerCoefficients = temp;\n }\n let sumDiff = new Int32Array(largerCoefficients.length);\n const lengthDiff = largerCoefficients.length - smallerCoefficients.length;\n // Copy high-order terms only found in higher-degree polynomial's coefficients\n System.arraycopy(largerCoefficients, 0, sumDiff, 0, lengthDiff);\n\n for (let i = lengthDiff; i < largerCoefficients.length; i++) {\n sumDiff[i] = AbstractGenericGF.addOrSubtract(smallerCoefficients[i - lengthDiff], largerCoefficients[i]);\n }\n\n return new GenericGFPoly(this.field, sumDiff);\n }\n\n public multiply(other: GenericGFPoly): GenericGFPoly {\n if (!this.field.equals(other.field)) {\n throw new IllegalArgumentException('GenericGFPolys do not have same GenericGF field');\n }\n if (this.isZero() || other.isZero()) {\n return this.field.getZero();\n }\n const aCoefficients = this.coefficients;\n const aLength = aCoefficients.length;\n const bCoefficients = other.coefficients;\n const bLength = bCoefficients.length;\n const product = new Int32Array(aLength + bLength - 1);\n const field = this.field;\n for (let i = 0; i < aLength; i++) {\n const aCoeff = aCoefficients[i];\n for (let j = 0; j < bLength; j++) {\n product[i + j] = AbstractGenericGF.addOrSubtract(product[i + j],\n field.multiply(aCoeff, bCoefficients[j]));\n }\n }\n return new GenericGFPoly(field, product);\n }\n\n public multiplyScalar(scalar: number /*int*/): GenericGFPoly {\n if (scalar === 0) {\n return this.field.getZero();\n }\n if (scalar === 1) {\n return this;\n }\n const size = this.coefficients.length;\n const field = this.field;\n const product = new Int32Array(size);\n const coefficients = this.coefficients;\n for (let i = 0; i < size; i++) {\n product[i] = field.multiply(coefficients[i], scalar);\n }\n return new GenericGFPoly(field, product);\n }\n\n public multiplyByMonomial(degree: number /*int*/, coefficient: number /*int*/): GenericGFPoly {\n if (degree < 0) {\n throw new IllegalArgumentException();\n }\n if (coefficient === 0) {\n return this.field.getZero();\n }\n const coefficients = this.coefficients;\n const size = coefficients.length;\n const product = new Int32Array(size + degree);\n const field = this.field;\n for (let i = 0; i < size; i++) {\n product[i] = field.multiply(coefficients[i], coefficient);\n }\n return new GenericGFPoly(field, product);\n }\n\n public divide(other: GenericGFPoly): GenericGFPoly[] {\n if (!this.field.equals(other.field)) {\n throw new IllegalArgumentException('GenericGFPolys do not have same GenericGF field');\n }\n if (other.isZero()) {\n throw new IllegalArgumentException('Divide by 0');\n }\n\n const field = this.field;\n\n let quotient: GenericGFPoly = field.getZero();\n let remainder: GenericGFPoly = this;\n\n const denominatorLeadingTerm = other.getCoefficient(other.getDegree());\n const inverseDenominatorLeadingTerm = field.inverse(denominatorLeadingTerm);\n\n while (remainder.getDegree() >= other.getDegree() && !remainder.isZero()) {\n const degreeDifference = remainder.getDegree() - other.getDegree();\n const scale = field.multiply(remainder.getCoefficient(remainder.getDegree()), inverseDenominatorLeadingTerm);\n const term = other.multiplyByMonomial(degreeDifference, scale);\n const iterationQuotient = field.buildMonomial(degreeDifference, scale);\n quotient = quotient.addOrSubtract(iterationQuotient);\n remainder = remainder.addOrSubtract(term);\n }\n\n return [quotient, remainder];\n }\n\n /*@Override*/\n public toString(): string {\n let result = '';\n for (let degree = this.getDegree(); degree >= 0; degree--) {\n let coefficient = this.getCoefficient(degree);\n if (coefficient !== 0) {\n if (coefficient < 0) {\n result += ' - ';\n coefficient = -coefficient;\n } else {\n if (result.length > 0) {\n result += ' + ';\n }\n }\n if (degree === 0 || coefficient !== 1) {\n const alphaPower = this.field.log(coefficient);\n if (alphaPower === 0) {\n result += '1';\n } else if (alphaPower === 1) {\n result += 'a';\n } else {\n result += 'a^';\n result += alphaPower;\n }\n }\n if (degree !== 0) {\n if (degree === 1) {\n result += 'x';\n } else {\n result += 'x^';\n result += degree;\n }\n }\n }\n }\n return result;\n }\n\n}\n","/*\n * Copyright 2007 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*namespace com.google.zxing.common {*/\n\nimport ResultPoint from '../ResultPoint';\nimport BitMatrix from './BitMatrix';\n\n/**\n *

Encapsulates the result of detecting a barcode in an image. This includes the raw\n * matrix of black/white pixels corresponding to the barcode, and possibly points of interest\n * in the image, like the location of finder patterns or corners of the barcode in the image.

\n *\n * @author Sean Owen\n */\nexport default class DetectorResult {\n\n private bits: BitMatrix;\n private points: Array;\n\n public constructor(bits: BitMatrix, points: Array) {\n this.bits = bits;\n this.points = points;\n }\n\n public getBits(): BitMatrix {\n return this.bits;\n }\n\n public getPoints(): Array {\n return this.points;\n }\n\n}\n","import GridSampler from './GridSampler';\nimport DefaultGridSampler from './DefaultGridSampler';\n\nexport default class GridSamplerInstance {\n\n private static gridSampler: GridSampler = new DefaultGridSampler();\n\n /**\n * Sets the implementation of GridSampler used by the library. One global\n * instance is stored, which may sound problematic. But, the implementation provided\n * ought to be appropriate for the entire platform, and all uses of this library\n * in the whole lifetime of the JVM. For instance, an Android activity can swap in\n * an implementation that takes advantage of native platform libraries.\n *\n * @param newGridSampler The platform-specific object to install.\n */\n public static setGridSampler(newGridSampler: GridSampler): void {\n GridSamplerInstance.gridSampler = newGridSampler;\n }\n\n /**\n * @return the current implementation of GridSampler\n */\n public static getInstance(): GridSampler {\n return GridSamplerInstance.gridSampler;\n }\n\n}\n","/*\n * Copyright 2008 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport BitArray from '../common/BitArray';\nimport DecodeHintType from '../DecodeHintType';\n\nimport Result from '../Result';\nimport OneDReader from './OneDReader';\nimport NotFoundException from '../NotFoundException';\nimport FormatException from '../FormatException';\n\n/**\n *

Encapsulates functionality and implementation that is common to UPC and EAN families\n * of one-dimensional barcodes.

\n *\n * @author dswitkin@google.com (Daniel Switkin)\n * @author Sean Owen\n * @author alasdair@google.com (Alasdair Mackintosh)\n */\nexport default abstract class AbstractUPCEANReader extends OneDReader {\n // These two values are critical for determining how permissive the decoding will be.\n // We've arrived at these values through a lot of trial and error. Setting them any higher\n // lets false positives creep in quickly.\n private static MAX_AVG_VARIANCE = 0.48;\n private static MAX_INDIVIDUAL_VARIANCE = 0.7;\n\n /**\n * Start/end guard pattern.\n */\n public static START_END_PATTERN: number[] = [1, 1, 1];\n\n /**\n * Pattern marking the middle of a UPC/EAN pattern, separating the two halves.\n */\n public static MIDDLE_PATTERN: number[] = [1, 1, 1, 1, 1];\n /**\n * end guard pattern.\n */\n public static END_PATTERN: number[] = [1, 1, 1, 1, 1, 1];\n /**\n * \"Odd\", or \"L\" patterns used to encode UPC/EAN digits.\n */\n public static L_PATTERNS: number[][] = [\n [3, 2, 1, 1], // 0\n [2, 2, 2, 1], // 1\n [2, 1, 2, 2], // 2\n [1, 4, 1, 1], // 3\n [1, 1, 3, 2], // 4\n [1, 2, 3, 1], // 5\n [1, 1, 1, 4], // 6\n [1, 3, 1, 2], // 7\n [1, 2, 1, 3], // 8\n [3, 1, 1, 2], // 9\n ];\n\n /**\n * As above but also including the \"even\", or \"G\" patterns used to encode UPC/EAN digits.\n */\n public static L_AND_G_PATTERNS: number[][];\n\n protected decodeRowStringBuffer = '';\n // private final UPCEANExtensionSupport extensionReader;\n // private final EANManufacturerOrgSupport eanManSupport;\n\n\n /*\n protected UPCEANReader() {\n decodeRowStringBuffer = new StringBuilder(20);\n extensionReader = new UPCEANExtensionSupport();\n eanManSupport = new EANManufacturerOrgSupport();\n }\n */\n\n static findStartGuardPattern(row: BitArray): number[] {\n let foundStart = false;\n let startRange: number[] = null;\n let nextStart = 0;\n let counters = [0, 0, 0];\n while (!foundStart) {\n counters = [0, 0, 0];\n startRange = AbstractUPCEANReader.findGuardPattern(row, nextStart, false, this.START_END_PATTERN, counters);\n let start = startRange[0];\n nextStart = startRange[1];\n let quietStart = start - (nextStart - start);\n if (quietStart >= 0) {\n foundStart = row.isRange(quietStart, start, false);\n }\n }\n return startRange;\n }\n\n public abstract decodeRow(rowNumber: number, row: BitArray, hints?: Map): Result;\n\n static checkChecksum(s: string): boolean {\n return AbstractUPCEANReader.checkStandardUPCEANChecksum(s);\n }\n\n static checkStandardUPCEANChecksum(s: string): boolean {\n let length = s.length;\n if (length === 0) return false;\n\n let check = parseInt(s.charAt(length - 1), 10);\n return AbstractUPCEANReader.getStandardUPCEANChecksum(s.substring(0, length - 1)) === check;\n }\n\n static getStandardUPCEANChecksum(s: string): number {\n let length = s.length;\n let sum = 0;\n for (let i = length - 1; i >= 0; i -= 2) {\n let digit = s.charAt(i).charCodeAt(0) - '0'.charCodeAt(0);\n if (digit < 0 || digit > 9) {\n throw new FormatException();\n }\n sum += digit;\n }\n sum *= 3;\n for (let i = length - 2; i >= 0; i -= 2) {\n let digit = s.charAt(i).charCodeAt(0) - '0'.charCodeAt(0);\n if (digit < 0 || digit > 9) {\n throw new FormatException();\n }\n sum += digit;\n }\n return (1000 - sum) % 10;\n }\n\n static decodeEnd(row: BitArray, endStart: number): number[] {\n return AbstractUPCEANReader.findGuardPattern(row, endStart, false, AbstractUPCEANReader.START_END_PATTERN, new Array(AbstractUPCEANReader.START_END_PATTERN.length).fill(0));\n }\n\n static findGuardPattern(row: BitArray, rowOffset: number, whiteFirst: boolean, pattern: number[], counters: number[]) {\n let width = row.getSize();\n rowOffset = whiteFirst ? row.getNextUnset(rowOffset) : row.getNextSet(rowOffset);\n let counterPosition = 0;\n let patternStart = rowOffset;\n let patternLength = pattern.length;\n let isWhite = whiteFirst;\n for (let x = rowOffset; x < width; x++) {\n if (row.get(x) !== isWhite) {\n counters[counterPosition]++;\n } else {\n if (counterPosition === patternLength - 1) {\n if (OneDReader.patternMatchVariance(counters, pattern, AbstractUPCEANReader.MAX_INDIVIDUAL_VARIANCE) < AbstractUPCEANReader.MAX_AVG_VARIANCE) {\n return [patternStart, x];\n }\n patternStart += counters[0] + counters[1];\n\n let slice = counters.slice(2, counters.length);\n for (let i = 0; i < counterPosition - 1; i++) {\n counters[i] = slice[i];\n }\n\n counters[counterPosition - 1] = 0;\n counters[counterPosition] = 0;\n counterPosition--;\n } else {\n counterPosition++;\n }\n counters[counterPosition] = 1;\n isWhite = !isWhite;\n }\n }\n throw new NotFoundException();\n }\n\n static decodeDigit(row: BitArray, counters: number[], rowOffset: number, patterns: number[][]) {\n this.recordPattern(row, rowOffset, counters);\n let bestVariance = this.MAX_AVG_VARIANCE;\n let bestMatch = -1;\n let max = patterns.length;\n for (let i = 0; i < max; i++) {\n let pattern = patterns[i];\n let variance = OneDReader.patternMatchVariance(counters, pattern, AbstractUPCEANReader.MAX_INDIVIDUAL_VARIANCE);\n if (variance < bestVariance) {\n bestVariance = variance;\n bestMatch = i;\n }\n }\n if (bestMatch >= 0) {\n return bestMatch;\n } else {\n throw new NotFoundException();\n }\n }\n\n /**\n * Get the format of this decoder.\n *\n * @return The 1D format.\n */\n public abstract getBarcodeFormat();\n\n /**\n * Subclasses override this to decode the portion of a barcode between the start\n * and end guard patterns.\n *\n * @param row row of black/white values to search\n * @param startRange start/end offset of start guard pattern\n * @param resultString {@link StringBuilder} to append decoded chars to\n * @return horizontal offset of first pixel after the \"middle\" that was decoded\n * @throws NotFoundException if decoding could not complete successfully\n */\n public abstract decodeMiddle(row: BitArray, startRange: number[], resultString: string);\n}\n","/*\n * Copyright 2007 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*namespace com.google.zxing.qrcode.decoder {*/\n\n\nimport ArgumentException from '../../ArgumentException';\nimport IllegalArgumentException from '../../IllegalArgumentException';\n\nexport enum ErrorCorrectionLevelValues {\n L,\n M,\n Q,\n H\n}\n\n/**\n *

See ISO 18004:2006, 6.5.1. This enum encapsulates the four error correction levels\n * defined by the QR code standard.

\n *\n * @author Sean Owen\n */\nexport default class ErrorCorrectionLevel {\n\n private static FOR_BITS = new Map();\n private static FOR_VALUE = new Map();\n\n /** L = ~7% correction */\n public static L = new ErrorCorrectionLevel(ErrorCorrectionLevelValues.L, 'L', 0x01);\n /** M = ~15% correction */\n public static M = new ErrorCorrectionLevel(ErrorCorrectionLevelValues.M, 'M', 0x00);\n /** Q = ~25% correction */\n public static Q = new ErrorCorrectionLevel(ErrorCorrectionLevelValues.Q, 'Q', 0x03);\n /** H = ~30% correction */\n public static H = new ErrorCorrectionLevel(ErrorCorrectionLevelValues.H, 'H', 0x02);\n\n private constructor(private value: ErrorCorrectionLevelValues, private stringValue: string, private bits: number /*int*/) {\n ErrorCorrectionLevel.FOR_BITS.set(bits, this);\n ErrorCorrectionLevel.FOR_VALUE.set(value, this);\n }\n\n public getValue(): ErrorCorrectionLevelValues/*int*/ {\n return this.value;\n }\n\n public getBits(): number /*int*/ {\n return this.bits;\n }\n\n public static fromString(s: string): ErrorCorrectionLevel {\n switch (s) {\n case 'L': return ErrorCorrectionLevel.L;\n case 'M': return ErrorCorrectionLevel.M;\n case 'Q': return ErrorCorrectionLevel.Q;\n case 'H': return ErrorCorrectionLevel.H;\n default: throw new ArgumentException(s + 'not available');\n }\n }\n\n public toString(): string {\n return this.stringValue;\n }\n\n public equals(o: any): boolean {\n if (!(o instanceof ErrorCorrectionLevel)) {\n return false;\n }\n const other = o;\n return this.value === other.value;\n }\n /**\n * @param bits int containing the two bits encoding a QR Code's error correction level\n * @return ErrorCorrectionLevel representing the encoded error correction level\n */\n public static forBits(bits: number /*int*/): ErrorCorrectionLevel {\n if (bits < 0 || bits >= ErrorCorrectionLevel.FOR_BITS.size) {\n throw new IllegalArgumentException();\n }\n return ErrorCorrectionLevel.FOR_BITS.get(bits);\n }\n\n}\n","/*\n * Copyright 2009 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*namespace com.google.zxing {*/\n\n/**\n * These are a set of hints that you may pass to Writers to specify their behavior.\n *\n * @author dswitkin@google.com (Daniel Switkin)\n */\nenum EncodeHintType {\n\n /**\n * Specifies what degree of error correction to use, for example in QR Codes.\n * Type depends on the encoder. For example for QR codes it's type\n * {@link com.google.zxing.qrcode.decoder.ErrorCorrectionLevel ErrorCorrectionLevel}.\n * For Aztec it is of type {@link Integer}, representing the minimal percentage of error correction words.\n * For PDF417 it is of type {@link Integer}, valid values being 0 to 8.\n * In all cases, it can also be a {@link String} representation of the desired value as well.\n * Note: an Aztec symbol should have a minimum of 25% EC words.\n */\n ERROR_CORRECTION,\n\n /**\n * Specifies what character encoding to use where applicable (type {@link String})\n */\n CHARACTER_SET,\n\n /**\n * Specifies the matrix shape for Data Matrix (type {@link com.google.zxing.datamatrix.encoder.SymbolShapeHint})\n */\n DATA_MATRIX_SHAPE,\n\n /**\n * Specifies a minimum barcode size (type {@link Dimension}). Only applicable to Data Matrix now.\n *\n * @deprecated use width/height params in\n * {@link com.google.zxing.datamatrix.DataMatrixWriter#encode(String, BarcodeFormat, int, int)}\n */\n /*@Deprecated*/\n MIN_SIZE,\n\n /**\n * Specifies a maximum barcode size (type {@link Dimension}). Only applicable to Data Matrix now.\n *\n * @deprecated without replacement\n */\n /*@Deprecated*/\n MAX_SIZE,\n\n /**\n * Specifies margin, in pixels, to use when generating the barcode. The meaning can vary\n * by format; for example it controls margin before and after the barcode horizontally for\n * most 1D formats. (Type {@link Integer}, or {@link String} representation of the integer value).\n */\n MARGIN,\n\n /**\n * Specifies whether to use compact mode for PDF417 (type {@link Boolean}, or \"true\" or \"false\"\n * {@link String} value).\n */\n PDF417_COMPACT,\n\n /**\n * Specifies what compaction mode to use for PDF417 (type\n * {@link com.google.zxing.pdf417.encoder.Compaction Compaction} or {@link String} value of one of its\n * enum values).\n */\n PDF417_COMPACTION,\n\n /**\n * Specifies the minimum and maximum number of rows and columns for PDF417 (type\n * {@link com.google.zxing.pdf417.encoder.Dimensions Dimensions}).\n */\n PDF417_DIMENSIONS,\n\n /**\n * Specifies the required number of layers for an Aztec code.\n * A negative number (-1, -2, -3, -4) specifies a compact Aztec code.\n * 0 indicates to use the minimum number of layers (the default).\n * A positive number (1, 2, .. 32) specifies a normal (non-compact) Aztec code.\n * (Type {@link Integer}, or {@link String} representation of the integer value).\n */\n AZTEC_LAYERS,\n\n /**\n * Specifies the exact version of QR code to be encoded.\n * (Type {@link Integer}, or {@link String} representation of the integer value).\n */\n QR_VERSION,\n}\n\nexport default EncodeHintType;\n","import BitArray from '../../../../common/BitArray';\nimport AbstractExpandedDecoder from './AbstractExpandedDecoder';\nimport StringBuilder from '../../../../util/StringBuilder';\nexport default abstract class AI01decoder extends AbstractExpandedDecoder {\n\n static readonly GTIN_SIZE:number = 40;\n\n constructor(information: BitArray) {\n super(information);\n }\n encodeCompressedGtin(buf:StringBuilder, currentPos:number):void {\n buf.append(\"(01)\");\n let initialPosition = buf.length();\n buf.append('9');\n\n this.encodeCompressedGtinWithoutAI(buf, currentPos, initialPosition);\n }\n\n encodeCompressedGtinWithoutAI( buf:StringBuilder, currentPos:number, initialBufferPosition:number):void {\n for (let i = 0; i < 4; ++i) {\n let currentBlock = this.getGeneralDecoder().extractNumericValueFromBitArray(currentPos + 10 * i, 10);\n if (currentBlock / 100 == 0) {\n buf.append('0');\n }\n if (currentBlock / 10 == 0) {\n buf.append('0');\n }\n buf.append(currentBlock);\n }\n\n AI01decoder.appendCheckDigit(buf, initialBufferPosition);\n }\n\n private static appendCheckDigit(buf:StringBuilder, currentPos:number):void {\n let checkDigit = 0;\n for (let i = 0; i < 13; i++) {\n //let digit = buf.charAt(i + currentPos) - '0';\n //To be checked\n let digit = buf.charAt(i + currentPos).charCodeAt(0) - '0'.charCodeAt(0);\n checkDigit += (i & 0x01) == 0 ? 3 * digit : digit;\n }\n\n checkDigit = 10 - (checkDigit % 10);\n if (checkDigit == 10) {\n checkDigit = 0;\n }\n\n buf.append(checkDigit);\n }\n\n}\n","import Exception from './Exception';\n\n/**\n * Custom Error class of type Exception.\n */\nexport default class ArgumentException extends Exception {}\n","import Exception from './Exception';\n\n/**\n * Custom Error class of type Exception.\n */\nexport default class IndexOutOfBoundsException extends Exception {}\n","import Exception from './Exception';\n\n/**\n * Custom Error class of type Exception.\n */\nexport default class UnsupportedOperationException extends Exception {}\n","/*\n * Copyright 2010 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Reader from '../Reader';\nimport ResultPoint from '../ResultPoint';\nimport Result from '../Result';\nimport BarcodeFormat from '../BarcodeFormat';\nimport BinaryBitmap from '../BinaryBitmap';\nimport DecodeHintType from '../DecodeHintType';\nimport ResultMetadataType from '../ResultMetadataType';\nimport DecoderResult from '../common/DecoderResult';\nimport System from '../util/System';\n\nimport Decoder from './decoder/Decoder';\nimport Detector from './detector/Detector';\nimport Exception from '../../core/Exception';\n\n\n\n// import java.util.List;\n// import java.util.Map;\n\n/**\n * This implementation can detect and decode Aztec codes in an image.\n *\n * @author David Olivier\n */\nexport default class AztecReader implements Reader {\n\n /**\n * Locates and decodes a Data Matrix code in an image.\n *\n * @return a String representing the content encoded by the Data Matrix code\n * @throws NotFoundException if a Data Matrix code cannot be found\n * @throws FormatException if a Data Matrix code cannot be decoded\n */\n public decode(image: BinaryBitmap, hints: Map | null = null): Result {\n\n let exception: Exception = null;\n let detector = new Detector(image.getBlackMatrix());\n let points: ResultPoint[] = null;\n let decoderResult: DecoderResult = null;\n\n try {\n let detectorResult = detector.detectMirror(false);\n points = detectorResult.getPoints();\n this.reportFoundResultPoints(hints, points);\n decoderResult = new Decoder().decode(detectorResult);\n } catch (e) {\n exception = e;\n }\n if (decoderResult == null) {\n try {\n let detectorResult = detector.detectMirror(true);\n points = detectorResult.getPoints();\n this.reportFoundResultPoints(hints, points);\n decoderResult = new Decoder().decode(detectorResult);\n } catch (e) {\n if (exception != null) {\n throw exception;\n }\n throw e;\n }\n }\n\n let result = new Result(decoderResult.getText(),\n decoderResult.getRawBytes(),\n decoderResult.getNumBits(),\n points,\n BarcodeFormat.AZTEC,\n System.currentTimeMillis());\n\n let byteSegments = decoderResult.getByteSegments();\n if (byteSegments != null) {\n result.putMetadata(ResultMetadataType.BYTE_SEGMENTS, byteSegments);\n }\n let ecLevel = decoderResult.getECLevel();\n if (ecLevel != null) {\n result.putMetadata(ResultMetadataType.ERROR_CORRECTION_LEVEL, ecLevel);\n }\n\n return result;\n }\n\n private reportFoundResultPoints(hints: Map, points: ResultPoint[]): void {\n if (hints != null) {\n let rpcb = hints.get(DecodeHintType.NEED_RESULT_POINT_CALLBACK);\n if (rpcb != null) {\n points.forEach((point, idx, arr) => {\n rpcb.foundPossibleResultPoint(point);\n });\n }\n }\n }\n\n // @Override\n public reset(): void {\n // do nothing\n }\n\n}\n","import Exception from './Exception';\n\n/**\n * Custom Error class of type Exception.\n */\nexport default class ArithmeticException extends Exception {}\n","/*\n * Copyright 2010 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*namespace com.google.zxing.common.detector {*/\n\nimport ResultPoint from '../../ResultPoint';\nimport BitMatrix from '../BitMatrix';\n\nimport MathUtils from './MathUtils';\nimport NotFoundException from '../../NotFoundException';\n\n/**\n *

\n * Detects a candidate barcode-like rectangular region within an image. It\n * starts around the center of the image, increases the size of the candidate\n * region until it finds a white rectangular region. By keeping track of the\n * last black points it encountered, it determines the corners of the barcode.\n *

\n *\n * @author David Olivier\n */\nexport default class WhiteRectangleDetector {\n\n private static INIT_SIZE = 10;\n private static CORR = 1;\n\n private height: number; /*int*/\n private width: number; /*int*/\n private leftInit: number; /*int*/\n private rightInit: number; /*int*/\n private downInit: number; /*int*/\n private upInit: number; /*int*/\n\n // public constructor(private image: BitMatrix) /*throws NotFoundException*/ {\n // this(image, INIT_SIZE, image.getWidth() / 2, image.getHeight() / 2)\n // }\n\n /**\n * @param image barcode image to find a rectangle in\n * @param initSize initial size of search area around center\n * @param x x position of search center\n * @param y y position of search center\n * @throws NotFoundException if image is too small to accommodate {@code initSize}\n */\n public constructor(private image: BitMatrix, initSize?: number /*int*/, x?: number /*int*/, y?: number /*int*/) /*throws NotFoundException*/ {\n this.height = image.getHeight();\n this.width = image.getWidth();\n if (undefined === initSize || null === initSize) {\n initSize = WhiteRectangleDetector.INIT_SIZE;\n }\n if (undefined === x || null === x) {\n x = image.getWidth() / 2 | 0;\n }\n if (undefined === y || null === y) {\n y = image.getHeight() / 2 | 0;\n }\n const halfsize = initSize / 2 | 0;\n this.leftInit = x - halfsize;\n this.rightInit = x + halfsize;\n this.upInit = y - halfsize;\n this.downInit = y + halfsize;\n if (this.upInit < 0 || this.leftInit < 0 || this.downInit >= this.height || this.rightInit >= this.width) {\n throw new NotFoundException();\n }\n }\n\n /**\n *

\n * Detects a candidate barcode-like rectangular region within an image. It\n * starts around the center of the image, increases the size of the candidate\n * region until it finds a white rectangular region.\n *

\n *\n * @return {@link ResultPoint}[] describing the corners of the rectangular\n * region. The first and last points are opposed on the diagonal, as\n * are the second and third. The first point will be the topmost\n * point and the last, the bottommost. The second point will be\n * leftmost and the third, the rightmost\n * @throws NotFoundException if no Data Matrix Code can be found\n */\n public detect(): Array /*throws NotFoundException*/ {\n let left = this.leftInit;\n let right = this.rightInit;\n let up = this.upInit;\n let down = this.downInit;\n let sizeExceeded: boolean = false;\n let aBlackPointFoundOnBorder: boolean = true;\n let atLeastOneBlackPointFoundOnBorder: boolean = false;\n\n let atLeastOneBlackPointFoundOnRight: boolean = false;\n let atLeastOneBlackPointFoundOnBottom: boolean = false;\n let atLeastOneBlackPointFoundOnLeft: boolean = false;\n let atLeastOneBlackPointFoundOnTop: boolean = false;\n\n const width = this.width;\n const height = this.height;\n\n while (aBlackPointFoundOnBorder) {\n\n aBlackPointFoundOnBorder = false;\n\n // .....\n // . |\n // .....\n let rightBorderNotWhite: boolean = true;\n while ((rightBorderNotWhite || !atLeastOneBlackPointFoundOnRight) && right < width) {\n rightBorderNotWhite = this.containsBlackPoint(up, down, right, false);\n if (rightBorderNotWhite) {\n right++;\n aBlackPointFoundOnBorder = true;\n atLeastOneBlackPointFoundOnRight = true;\n } else if (!atLeastOneBlackPointFoundOnRight) {\n right++;\n }\n }\n\n if (right >= width) {\n sizeExceeded = true;\n break;\n }\n\n // .....\n // . .\n // .___.\n let bottomBorderNotWhite: boolean = true;\n while ((bottomBorderNotWhite || !atLeastOneBlackPointFoundOnBottom) && down < height) {\n bottomBorderNotWhite = this.containsBlackPoint(left, right, down, true);\n if (bottomBorderNotWhite) {\n down++;\n aBlackPointFoundOnBorder = true;\n atLeastOneBlackPointFoundOnBottom = true;\n } else if (!atLeastOneBlackPointFoundOnBottom) {\n down++;\n }\n }\n\n if (down >= height) {\n sizeExceeded = true;\n break;\n }\n\n // .....\n // | .\n // .....\n let leftBorderNotWhite: boolean = true;\n while ((leftBorderNotWhite || !atLeastOneBlackPointFoundOnLeft) && left >= 0) {\n leftBorderNotWhite = this.containsBlackPoint(up, down, left, false);\n if (leftBorderNotWhite) {\n left--;\n aBlackPointFoundOnBorder = true;\n atLeastOneBlackPointFoundOnLeft = true;\n } else if (!atLeastOneBlackPointFoundOnLeft) {\n left--;\n }\n }\n\n if (left < 0) {\n sizeExceeded = true;\n break;\n }\n\n // .___.\n // . .\n // .....\n let topBorderNotWhite: boolean = true;\n while ((topBorderNotWhite || !atLeastOneBlackPointFoundOnTop) && up >= 0) {\n topBorderNotWhite = this.containsBlackPoint(left, right, up, true);\n if (topBorderNotWhite) {\n up--;\n aBlackPointFoundOnBorder = true;\n atLeastOneBlackPointFoundOnTop = true;\n } else if (!atLeastOneBlackPointFoundOnTop) {\n up--;\n }\n }\n\n if (up < 0) {\n sizeExceeded = true;\n break;\n }\n\n if (aBlackPointFoundOnBorder) {\n atLeastOneBlackPointFoundOnBorder = true;\n }\n\n }\n\n if (!sizeExceeded && atLeastOneBlackPointFoundOnBorder) {\n\n const maxSize = right - left;\n\n let z: ResultPoint | null = null;\n for (let i = 1; z === null && i < maxSize; i++) {\n z = this.getBlackPointOnSegment(left, down - i, left + i, down);\n }\n\n if (z == null) {\n throw new NotFoundException();\n }\n\n let t: ResultPoint | null = null;\n // go down right\n for (let i = 1; t === null && i < maxSize; i++) {\n t = this.getBlackPointOnSegment(left, up + i, left + i, up);\n }\n\n if (t == null) {\n throw new NotFoundException();\n }\n\n let x: ResultPoint | null = null;\n // go down left\n for (let i = 1; x === null && i < maxSize; i++) {\n x = this.getBlackPointOnSegment(right, up + i, right - i, up);\n }\n\n if (x == null) {\n throw new NotFoundException();\n }\n\n let y: ResultPoint | null = null;\n // go up left\n for (let i = 1; y === null && i < maxSize; i++) {\n y = this.getBlackPointOnSegment(right, down - i, right - i, down);\n }\n\n if (y == null) {\n throw new NotFoundException();\n }\n\n return this.centerEdges(y, z, x, t);\n\n } else {\n throw new NotFoundException();\n }\n }\n\n private getBlackPointOnSegment(aX: number/*float*/, aY: number/*float*/, bX: number/*float*/, bY: number/*float*/): ResultPoint | null {\n const dist = MathUtils.round(MathUtils.distance(aX, aY, bX, bY));\n const xStep: number /*float*/ = (bX - aX) / dist;\n const yStep: number /*float*/ = (bY - aY) / dist;\n\n const image = this.image;\n\n for (let i = 0; i < dist; i++) {\n const x = MathUtils.round(aX + i * xStep);\n const y = MathUtils.round(aY + i * yStep);\n if (image.get(x, y)) {\n return new ResultPoint(x, y);\n }\n }\n return null;\n }\n\n /**\n * recenters the points of a constant distance towards the center\n *\n * @param y bottom most point\n * @param z left most point\n * @param x right most point\n * @param t top most point\n * @return {@link ResultPoint}[] describing the corners of the rectangular\n * region. The first and last points are opposed on the diagonal, as\n * are the second and third. The first point will be the topmost\n * point and the last, the bottommost. The second point will be\n * leftmost and the third, the rightmost\n */\n private centerEdges(y: ResultPoint, z: ResultPoint,\n x: ResultPoint, t: ResultPoint): Array {\n\n //\n // t t\n // z x\n // x OR z\n // y y\n //\n\n const yi: number /*float*/ = y.getX();\n const yj: number /*float*/ = y.getY();\n const zi: number /*float*/ = z.getX();\n const zj: number /*float*/ = z.getY();\n const xi: number /*float*/ = x.getX();\n const xj: number /*float*/ = x.getY();\n const ti: number /*float*/ = t.getX();\n const tj: number /*float*/ = t.getY();\n\n const CORR = WhiteRectangleDetector.CORR;\n\n if (yi < this.width / 2.0) {\n return [\n new ResultPoint(ti - CORR, tj + CORR),\n new ResultPoint(zi + CORR, zj + CORR),\n new ResultPoint(xi - CORR, xj - CORR),\n new ResultPoint(yi + CORR, yj - CORR)];\n } else {\n return [\n new ResultPoint(ti + CORR, tj + CORR),\n new ResultPoint(zi + CORR, zj - CORR),\n new ResultPoint(xi - CORR, xj + CORR),\n new ResultPoint(yi - CORR, yj - CORR)];\n }\n }\n\n /**\n * Determines whether a segment contains a black point\n *\n * @param a min value of the scanned coordinate\n * @param b max value of the scanned coordinate\n * @param fixed value of fixed coordinate\n * @param horizontal set to true if scan must be horizontal, false if vertical\n * @return true if a black point has been found, else false.\n */\n private containsBlackPoint(a: number /*int*/, b: number /*int*/, fixed: number /*int*/, horizontal: boolean): boolean {\n\n const image = this.image;\n\n if (horizontal) {\n for (let x = a; x <= b; x++) {\n if (image.get(x, fixed)) {\n return true;\n }\n }\n } else {\n for (let y = a; y <= b; y++) {\n if (image.get(fixed, y)) {\n return true;\n }\n }\n }\n\n return false;\n }\n\n}\n","/*\n * Copyright 2007 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*namespace com.google.zxing.common {*/\n\n/**\n *

This class implements a perspective transform in two dimensions. Given four source and four\n * destination points, it will compute the transformation implied between them. The code is based\n * directly upon section 3.4.2 of George Wolberg's \"Digital Image Warping\"; see pages 54-56.

\n *\n * @author Sean Owen\n */\nexport default class PerspectiveTransform {\n\n private constructor(private a11: number/*float*/, private a21: number/*float*/, private a31: number/*float*/,\n private a12: number/*float*/, private a22: number/*float*/, private a32: number/*float*/,\n private a13: number/*float*/, private a23: number/*float*/, private a33: number/*float*/) { }\n\n public static quadrilateralToQuadrilateral(\n x0: number/*float*/, y0: number/*float*/,\n x1: number/*float*/, y1: number/*float*/,\n x2: number/*float*/, y2: number/*float*/,\n x3: number/*float*/, y3: number/*float*/,\n x0p: number/*float*/, y0p: number/*float*/,\n x1p: number/*float*/, y1p: number/*float*/,\n x2p: number/*float*/, y2p: number/*float*/,\n x3p: number/*float*/, y3p: number/*float*/\n ): PerspectiveTransform {\n\n const qToS = PerspectiveTransform.quadrilateralToSquare(x0, y0, x1, y1, x2, y2, x3, y3);\n const sToQ = PerspectiveTransform.squareToQuadrilateral(x0p, y0p, x1p, y1p, x2p, y2p, x3p, y3p);\n\n return sToQ.times(qToS);\n }\n\n public transformPoints(points: Float32Array): void {\n\n const max = points.length;\n\n const a11 = this.a11;\n const a12 = this.a12;\n const a13 = this.a13;\n const a21 = this.a21;\n const a22 = this.a22;\n const a23 = this.a23;\n const a31 = this.a31;\n const a32 = this.a32;\n const a33 = this.a33;\n\n for (let i = 0; i < max; i += 2) {\n const x = points[i];\n const y = points[i + 1];\n const denominator = a13 * x + a23 * y + a33;\n points[i] = (a11 * x + a21 * y + a31) / denominator;\n points[i + 1] = (a12 * x + a22 * y + a32) / denominator;\n }\n }\n\n public transformPointsWithValues(xValues: Float32Array, yValues: Float32Array): void {\n\n const a11 = this.a11;\n const a12 = this.a12;\n const a13 = this.a13;\n const a21 = this.a21;\n const a22 = this.a22;\n const a23 = this.a23;\n const a31 = this.a31;\n const a32 = this.a32;\n const a33 = this.a33;\n\n const n = xValues.length;\n\n for (let i = 0; i < n; i++) {\n const x = xValues[i];\n const y = yValues[i];\n const denominator = a13 * x + a23 * y + a33;\n\n xValues[i] = (a11 * x + a21 * y + a31) / denominator;\n yValues[i] = (a12 * x + a22 * y + a32) / denominator;\n }\n }\n\n public static squareToQuadrilateral(\n x0: number/*float*/, y0: number/*float*/,\n x1: number/*float*/, y1: number/*float*/,\n x2: number/*float*/, y2: number/*float*/,\n x3: number/*float*/, y3: number/*float*/\n ): PerspectiveTransform {\n\n const dx3 = x0 - x1 + x2 - x3;\n const dy3 = y0 - y1 + y2 - y3;\n\n if (dx3 === 0.0 && dy3 === 0.0) {\n // Affine\n return new PerspectiveTransform(x1 - x0, x2 - x1, x0,\n y1 - y0, y2 - y1, y0,\n 0.0, 0.0, 1.0);\n } else {\n const dx1 = x1 - x2;\n const dx2 = x3 - x2;\n const dy1 = y1 - y2;\n const dy2 = y3 - y2;\n\n const denominator = dx1 * dy2 - dx2 * dy1;\n\n const a13 = (dx3 * dy2 - dx2 * dy3) / denominator;\n const a23 = (dx1 * dy3 - dx3 * dy1) / denominator;\n\n return new PerspectiveTransform(\n x1 - x0 + a13 * x1, x3 - x0 + a23 * x3, x0,\n y1 - y0 + a13 * y1, y3 - y0 + a23 * y3, y0,\n a13, a23, 1.0\n );\n }\n }\n\n public static quadrilateralToSquare(\n x0: number/*float*/, y0: number/*float*/,\n x1: number/*float*/, y1: number/*float*/,\n x2: number/*float*/, y2: number/*float*/,\n x3: number/*float*/, y3: number/*float*/\n ): PerspectiveTransform {\n // Here, the adjoint serves as the inverse:\n return PerspectiveTransform.squareToQuadrilateral(x0, y0, x1, y1, x2, y2, x3, y3).buildAdjoint();\n }\n\n protected buildAdjoint(): PerspectiveTransform {\n // Adjoint is the transpose of the cofactor matrix:\n return new PerspectiveTransform(\n this.a22 * this.a33 - this.a23 * this.a32,\n this.a23 * this.a31 - this.a21 * this.a33,\n this.a21 * this.a32 - this.a22 * this.a31,\n this.a13 * this.a32 - this.a12 * this.a33,\n this.a11 * this.a33 - this.a13 * this.a31,\n this.a12 * this.a31 - this.a11 * this.a32,\n this.a12 * this.a23 - this.a13 * this.a22,\n this.a13 * this.a21 - this.a11 * this.a23,\n this.a11 * this.a22 - this.a12 * this.a21\n );\n }\n\n protected times(other: PerspectiveTransform): PerspectiveTransform {\n return new PerspectiveTransform(\n this.a11 * other.a11 + this.a21 * other.a12 + this.a31 * other.a13,\n this.a11 * other.a21 + this.a21 * other.a22 + this.a31 * other.a23,\n this.a11 * other.a31 + this.a21 * other.a32 + this.a31 * other.a33,\n this.a12 * other.a11 + this.a22 * other.a12 + this.a32 * other.a13,\n this.a12 * other.a21 + this.a22 * other.a22 + this.a32 * other.a23,\n this.a12 * other.a31 + this.a22 * other.a32 + this.a32 * other.a33,\n this.a13 * other.a11 + this.a23 * other.a12 + this.a33 * other.a13,\n this.a13 * other.a21 + this.a23 * other.a22 + this.a33 * other.a23,\n this.a13 * other.a31 + this.a23 * other.a32 + this.a33 * other.a33\n );\n }\n\n}\n","/*\n * Copyright 2008 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*namespace com.google.zxing.oned {*/\n\nimport BarcodeFormat from '../BarcodeFormat';\nimport BitArray from '../common/BitArray';\nimport Code39Reader from './Code39Reader';\nimport Code128Reader from './Code128Reader';\nimport RSS14Reader from './rss/RSS14Reader';\nimport DecodeHintType from '../DecodeHintType';\nimport ITFReader from './ITFReader';\nimport MultiFormatUPCEANReader from './MultiFormatUPCEANReader';\nimport NotFoundException from '../NotFoundException';\nimport OneDReader from './OneDReader';\nimport Result from '../Result';\n\n/**\n * @author Daniel Switkin \n * @author Sean Owen\n */\nexport default class MultiFormatOneDReader extends OneDReader {\n\n private readers: OneDReader[] = [];\n\n public constructor(hints: Map) {\n super();\n const possibleFormats = !hints ? null : hints.get(DecodeHintType.POSSIBLE_FORMATS);\n const useCode39CheckDigit = hints && hints.get(DecodeHintType.ASSUME_CODE_39_CHECK_DIGIT) !== undefined;\n\n if (possibleFormats) {\n if (possibleFormats.includes(BarcodeFormat.EAN_13) ||\n possibleFormats.includes(BarcodeFormat.EAN_8)) {\n this.readers.push(new MultiFormatUPCEANReader(hints));\n }\n // if (possibleFormats.includes(BarcodeFormat.EAN_13) ||\n // possibleFormats.includes(BarcodeFormat.UPC_A) ||\n // possibleFormats.includes(BarcodeFormat.EAN_8) ||\n // possibleFormats.includes(BarcodeFormat.UPC_E)) {\n // readers.push(new MultiFormatUPCEANReader(hints));\n // }\n if (possibleFormats.includes(BarcodeFormat.CODE_39)) {\n this.readers.push(new Code39Reader(useCode39CheckDigit));\n }\n // if (possibleFormats.includes(BarcodeFormat.CODE_93)) {\n // this.readers.push(new Code93Reader());\n // }\n if (possibleFormats.includes(BarcodeFormat.CODE_128)) {\n this.readers.push(new Code128Reader());\n }\n if (possibleFormats.includes(BarcodeFormat.ITF)) {\n this.readers.push(new ITFReader());\n }\n // if (possibleFormats.includes(BarcodeFormat.CODABAR)) {\n // this.readers.push(new CodaBarReader());\n // }\n if (possibleFormats.includes(BarcodeFormat.RSS_14)) {\n this.readers.push(new RSS14Reader());\n }\n // if (possibleFormats.includes(BarcodeFormat.RSS_EXPANDED)) {\n // this.readers.push(new RSSExpandedReader());\n // }\n }\n if (this.readers.length === 0) {\n // this.readers.push(new MultiFormatUPCEANReader(hints));\n this.readers.push(new Code39Reader());\n // this.readers.push(new CodaBarReader());\n // this.readers.push(new Code93Reader());\n this.readers.push(new MultiFormatUPCEANReader(hints));\n this.readers.push(new Code128Reader());\n this.readers.push(new ITFReader());\n this.readers.push(new RSS14Reader());\n // this.readers.push(new RSSExpandedReader());\n }\n }\n\n // @Override\n public decodeRow(\n rowNumber: number,\n row: BitArray,\n hints: Map\n ): Result {\n\n for (let i = 0; i < this.readers.length; i++) {\n try {\n return this.readers[i].decodeRow(rowNumber, row, hints);\n } catch (re) {\n // continue\n }\n }\n\n throw new NotFoundException();\n }\n\n // @Override\n public reset(): void {\n this.readers.forEach(reader => reader.reset());\n }\n}\n","export default class DataCharacter {\n\n private value: number;\n private checksumPortion: number;\n\n public constructor(value: number, checksumPortion: number) {\n this.value = value;\n this.checksumPortion = checksumPortion;\n }\n\n public getValue(): number {\n return this.value;\n }\n\n public getChecksumPortion(): number {\n return this.checksumPortion;\n }\n\n public toString(): string {\n return this.value + '(' + this.checksumPortion + ')';\n }\n\n public equals(o: object): boolean {\n if (!(o instanceof DataCharacter)) {\n return false;\n }\n const that = o;\n return this.value === that.value && this.checksumPortion === that.checksumPortion;\n }\n\n public hashCode(): number {\n return this.value ^ this.checksumPortion;\n }\n}\n","import Reader from '../Reader';\nimport ResultPoint from '../ResultPoint';\nimport Decoder from './decoder/Decoder';\nimport Result from '../Result';\nimport BarcodeFormat from '../BarcodeFormat';\nimport BinaryBitmap from '../BinaryBitmap';\nimport DecodeHintType from '../DecodeHintType';\nimport ResultMetadataType from '../ResultMetadataType';\nimport BitMatrix from '../common/BitMatrix';\nimport DecoderResult from '../common/DecoderResult';\nimport DetectorResult from '../common/DetectorResult';\nimport Detector from './detector/Detector';\n\nimport System from '../util/System';\nimport NotFoundException from '../NotFoundException';\n\n/*\n * Copyright 2007 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * This implementation can detect and decode Data Matrix codes in an image.\n *\n * @author bbrown@google.com (Brian Brown)\n */\nexport default class DataMatrixReader implements Reader {\n\n private static NO_POINTS: ResultPoint[] = [];\n\n private decoder: Decoder = new Decoder();\n\n /**\n * Locates and decodes a Data Matrix code in an image.\n *\n * @return a String representing the content encoded by the Data Matrix code\n * @throws NotFoundException if a Data Matrix code cannot be found\n * @throws FormatException if a Data Matrix code cannot be decoded\n * @throws ChecksumException if error correction fails\n */\n // @Override\n // public Result decode(BinaryBitmap image) throws NotFoundException, ChecksumException, FormatException {\n // return decode(image, null);\n // }\n\n // @Override\n public decode(image: BinaryBitmap, hints: Map | null = null): Result {\n let decoderResult: DecoderResult;\n let points: ResultPoint[];\n\n if (hints != null && hints.has(DecodeHintType.PURE_BARCODE)) {\n const bits = DataMatrixReader.extractPureBits(image.getBlackMatrix());\n decoderResult = this.decoder.decode(bits);\n points = DataMatrixReader.NO_POINTS;\n } else {\n const detectorResult = new Detector(image.getBlackMatrix()).detect();\n decoderResult = this.decoder.decode(detectorResult.getBits());\n points = detectorResult.getPoints();\n }\n const rawBytes = decoderResult.getRawBytes();\n const result = new Result(\n decoderResult.getText(),\n rawBytes,\n 8 * rawBytes.length,\n points,\n BarcodeFormat.DATA_MATRIX,\n System.currentTimeMillis()\n );\n\n const byteSegments = decoderResult.getByteSegments();\n if (byteSegments != null) {\n result.putMetadata(ResultMetadataType.BYTE_SEGMENTS, byteSegments);\n }\n const ecLevel = decoderResult.getECLevel();\n if (ecLevel != null) {\n result.putMetadata(ResultMetadataType.ERROR_CORRECTION_LEVEL, ecLevel);\n }\n return result;\n }\n\n // @Override\n public reset(): void {\n // do nothing\n }\n\n /**\n * This method detects a code in a \"pure\" image -- that is, pure monochrome image\n * which contains only an unrotated, unskewed, image of a code, with some white border\n * around it. This is a specialized method that works exceptionally fast in this special\n * case.\n *\n * @see com.google.zxing.qrcode.QRCodeReader#extractPureBits(BitMatrix)\n */\n private static extractPureBits(image: BitMatrix): BitMatrix {\n\n const leftTopBlack = image.getTopLeftOnBit();\n const rightBottomBlack = image.getBottomRightOnBit();\n if (leftTopBlack == null || rightBottomBlack == null) {\n throw new NotFoundException();\n }\n\n const moduleSize = this.moduleSize(leftTopBlack, image);\n\n let top = leftTopBlack[1];\n const bottom = rightBottomBlack[1];\n let left = leftTopBlack[0];\n const right = rightBottomBlack[0];\n\n const matrixWidth = (right - left + 1) / moduleSize;\n const matrixHeight = (bottom - top + 1) / moduleSize;\n if (matrixWidth <= 0 || matrixHeight <= 0) {\n throw new NotFoundException();\n }\n\n // Push in the \"border\" by half the module width so that we start\n // sampling in the middle of the module. Just in case the image is a\n // little off, this will help recover.\n const nudge = moduleSize / 2;\n top += nudge;\n left += nudge;\n\n // Now just read off the bits\n const bits = new BitMatrix(matrixWidth, matrixHeight);\n for (let y = 0; y < matrixHeight; y++) {\n const iOffset = top + y * moduleSize;\n for (let x = 0; x < matrixWidth; x++) {\n if (image.get(left + x * moduleSize, iOffset)) {\n bits.set(x, y);\n }\n }\n }\n return bits;\n }\n\n private static moduleSize(leftTopBlack: Int32Array, image: BitMatrix): number {\n const width = image.getWidth();\n let x = leftTopBlack[0];\n const y = leftTopBlack[1];\n while (x < width && image.get(x, y)) {\n x++;\n }\n if (x === width) {\n throw new NotFoundException();\n }\n\n const moduleSize = x - leftTopBlack[0];\n if (moduleSize === 0) {\n throw new NotFoundException();\n }\n return moduleSize;\n }\n\n}\n","/*\n * Copyright 2007 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*namespace com.google.zxing.common {*/\n\n\nimport IllegalArgumentException from '../IllegalArgumentException';\n\n/**\n *

This provides an easy abstraction to read bits at a time from a sequence of bytes, where the\n * number of bits read is not often a multiple of 8.

\n *\n *

This class is thread-safe but not reentrant -- unless the caller modifies the bytes array\n * it passed in, in which case all bets are off.

\n *\n * @author Sean Owen\n */\nexport default class BitSource {\n\n private byteOffset: number; /*int*/\n private bitOffset: number; /*int*/\n\n /**\n * @param bytes bytes from which this will read bits. Bits will be read from the first byte first.\n * Bits are read within a byte from most-significant to least-significant bit.\n */\n public constructor(private bytes: Uint8Array) {\n this.byteOffset = 0;\n this.bitOffset = 0;\n }\n\n /**\n * @return index of next bit in current byte which would be read by the next call to {@link #readBits(int)}.\n */\n public getBitOffset(): number /*int*/ {\n return this.bitOffset;\n }\n\n /**\n * @return index of next byte in input byte array which would be read by the next call to {@link #readBits(int)}.\n */\n public getByteOffset(): number /*int*/ {\n return this.byteOffset;\n }\n\n /**\n * @param numBits number of bits to read\n * @return int representing the bits read. The bits will appear as the least-significant\n * bits of the int\n * @throws IllegalArgumentException if numBits isn't in [1,32] or more than is available\n */\n public readBits(numBits: number /*int*/): number /*int*/ {\n if (numBits < 1 || numBits > 32 || numBits > this.available()) {\n throw new IllegalArgumentException('' + numBits);\n }\n\n let result = 0;\n\n let bitOffset = this.bitOffset;\n let byteOffset = this.byteOffset;\n\n const bytes = this.bytes;\n // First, read remainder from current byte\n if (bitOffset > 0) {\n const bitsLeft = 8 - bitOffset;\n const toRead = numBits < bitsLeft ? numBits : bitsLeft;\n const bitsToNotRead = bitsLeft - toRead;\n const mask = (0xFF >> (8 - toRead)) << bitsToNotRead;\n\n result = (bytes[byteOffset] & mask) >> bitsToNotRead;\n numBits -= toRead;\n bitOffset += toRead;\n\n if (bitOffset === 8) {\n bitOffset = 0;\n byteOffset++;\n }\n }\n\n // Next read whole bytes\n if (numBits > 0) {\n\n while (numBits >= 8) {\n result = (result << 8) | (bytes[byteOffset] & 0xFF);\n byteOffset++;\n numBits -= 8;\n }\n\n // Finally read a partial byte\n if (numBits > 0) {\n const bitsToNotRead = 8 - numBits;\n const mask = (0xFF >> bitsToNotRead) << bitsToNotRead;\n\n result = (result << numBits) | ((bytes[byteOffset] & mask) >> bitsToNotRead);\n bitOffset += numBits;\n }\n }\n\n this.bitOffset = bitOffset;\n this.byteOffset = byteOffset;\n\n return result;\n }\n\n /**\n * @return number of bits that can be read successfully\n */\n public available(): number /*int*/ {\n return 8 * (this.bytes.length - this.byteOffset) - this.bitOffset;\n }\n\n}\n","/*\n * Copyright 2007 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*namespace com.google.zxing.qrcode {*/\n\nimport BarcodeFormat from '../BarcodeFormat';\nimport BinaryBitmap from '../BinaryBitmap';\nimport DecodeHintType from '../DecodeHintType';\nimport Reader from '../Reader';\nimport Result from '../Result';\nimport ResultMetadataType from '../ResultMetadataType';\nimport ResultPoint from '../ResultPoint';\nimport BitMatrix from '../common/BitMatrix';\nimport DecoderResult from '../common/DecoderResult';\nimport DetectorResult from '../common/DetectorResult';\nimport Decoder from './decoder/Decoder';\nimport QRCodeDecoderMetaData from './decoder/QRCodeDecoderMetaData';\nimport Detector from './detector/Detector';\n\nimport NotFoundException from '../NotFoundException';\n\n/*import java.util.List;*/\n/*import java.util.Map;*/\n\n/**\n * This implementation can detect and decode QR Codes in an image.\n *\n * @author Sean Owen\n */\nexport default class QRCodeReader implements Reader {\n\n private static NO_POINTS = new Array();\n\n private decoder = new Decoder();\n\n protected getDecoder(): Decoder {\n return this.decoder;\n }\n\n /**\n * Locates and decodes a QR code in an image.\n *\n * @return a representing: string the content encoded by the QR code\n * @throws NotFoundException if a QR code cannot be found\n * @throws FormatException if a QR code cannot be decoded\n * @throws ChecksumException if error correction fails\n */\n /*@Override*/\n // public decode(image: BinaryBitmap): Result /*throws NotFoundException, ChecksumException, FormatException */ {\n // return this.decode(image, null)\n // }\n\n /*@Override*/\n public decode(image: BinaryBitmap, hints?: Map): Result {\n let decoderResult: DecoderResult;\n let points: Array;\n if (hints !== undefined && hints !== null && undefined !== hints.get(DecodeHintType.PURE_BARCODE)) {\n const bits = QRCodeReader.extractPureBits(image.getBlackMatrix());\n decoderResult = this.decoder.decodeBitMatrix(bits, hints);\n points = QRCodeReader.NO_POINTS;\n } else {\n const detectorResult = new Detector(image.getBlackMatrix()).detect(hints);\n decoderResult = this.decoder.decodeBitMatrix(detectorResult.getBits(), hints);\n points = detectorResult.getPoints();\n }\n\n // If the code was mirrored: swap the bottom-left and the top-right points.\n if (decoderResult.getOther() instanceof QRCodeDecoderMetaData) {\n (decoderResult.getOther()).applyMirroredCorrection(points);\n }\n\n const result = new Result(decoderResult.getText(), decoderResult.getRawBytes(), undefined, points, BarcodeFormat.QR_CODE, undefined);\n const byteSegments: Array = decoderResult.getByteSegments();\n if (byteSegments !== null) {\n result.putMetadata(ResultMetadataType.BYTE_SEGMENTS, byteSegments);\n }\n const ecLevel: string = decoderResult.getECLevel();\n if (ecLevel !== null) {\n result.putMetadata(ResultMetadataType.ERROR_CORRECTION_LEVEL, ecLevel);\n }\n if (decoderResult.hasStructuredAppend()) {\n result.putMetadata(ResultMetadataType.STRUCTURED_APPEND_SEQUENCE,\n decoderResult.getStructuredAppendSequenceNumber());\n result.putMetadata(ResultMetadataType.STRUCTURED_APPEND_PARITY,\n decoderResult.getStructuredAppendParity());\n }\n return result;\n }\n\n /*@Override*/\n public reset(): void {\n // do nothing\n }\n\n /**\n * This method detects a code in a \"pure\" image -- that is, pure monochrome image\n * which contains only an unrotated, unskewed, image of a code, with some white border\n * around it. This is a specialized method that works exceptionally fast in this special\n * case.\n *\n * @see com.google.zxing.datamatrix.DataMatrixReader#extractPureBits(BitMatrix)\n */\n private static extractPureBits(image: BitMatrix): BitMatrix /*throws NotFoundException */ {\n\n const leftTopBlack: Int32Array = image.getTopLeftOnBit();\n const rightBottomBlack: Int32Array = image.getBottomRightOnBit();\n if (leftTopBlack === null || rightBottomBlack === null) {\n throw new NotFoundException();\n }\n\n const moduleSize: number /*float*/ = this.moduleSize(leftTopBlack, image);\n\n let top = leftTopBlack[1];\n let bottom = rightBottomBlack[1];\n let left = leftTopBlack[0];\n let right = rightBottomBlack[0];\n\n // Sanity check!\n if (left >= right || top >= bottom) {\n throw new NotFoundException();\n }\n\n if (bottom - top !== right - left) {\n // Special case, where bottom-right module wasn't black so we found something else in the last row\n // Assume it's a square, so use height as the width\n right = left + (bottom - top);\n if (right >= image.getWidth()) {\n // Abort if that would not make sense -- off image\n throw new NotFoundException();\n }\n }\n\n const matrixWidth = Math.round((right - left + 1) / moduleSize);\n const matrixHeight = Math.round((bottom - top + 1) / moduleSize);\n if (matrixWidth <= 0 || matrixHeight <= 0) {\n throw new NotFoundException();\n }\n if (matrixHeight !== matrixWidth) {\n // Only possibly decode square regions\n throw new NotFoundException();\n }\n\n // Push in the \"border\" by half the module width so that we start\n // sampling in the middle of the module. Just in case the image is a\n // little off, this will help recover.\n const nudge = /*(int) */Math.floor(moduleSize / 2.0);\n top += nudge;\n left += nudge;\n\n // But careful that this does not sample off the edge\n // \"right\" is the farthest-right valid pixel location -- right+1 is not necessarily\n // This is positive by how much the inner x loop below would be too large\n const nudgedTooFarRight = left + /*(int) */Math.floor((matrixWidth - 1) * moduleSize) - right;\n if (nudgedTooFarRight > 0) {\n if (nudgedTooFarRight > nudge) {\n // Neither way fits; abort\n throw new NotFoundException();\n }\n left -= nudgedTooFarRight;\n }\n // See logic above\n const nudgedTooFarDown = top + /*(int) */Math.floor((matrixHeight - 1) * moduleSize) - bottom;\n if (nudgedTooFarDown > 0) {\n if (nudgedTooFarDown > nudge) {\n // Neither way fits; abort\n throw new NotFoundException();\n }\n top -= nudgedTooFarDown;\n }\n\n // Now just read off the bits\n const bits = new BitMatrix(matrixWidth, matrixHeight);\n for (let y = 0; y < matrixHeight; y++) {\n const iOffset = top + /*(int) */Math.floor(y * moduleSize);\n for (let x = 0; x < matrixWidth; x++) {\n if (image.get(left + /*(int) */Math.floor(x * moduleSize), iOffset)) {\n bits.set(x, y);\n }\n }\n }\n return bits;\n }\n\n private static moduleSize(leftTopBlack: Int32Array, image: BitMatrix): number/*float*/ /*throws NotFoundException */ {\n const height: number /*int*/ = image.getHeight();\n const width: number /*int*/ = image.getWidth();\n let x = leftTopBlack[0];\n let y = leftTopBlack[1];\n let inBlack: boolean = true;\n let transitions = 0;\n while (x < width && y < height) {\n if (inBlack !== image.get(x, y)) {\n if (++transitions === 5) {\n break;\n }\n inBlack = !inBlack;\n }\n x++;\n y++;\n }\n if (x === width || y === height) {\n throw new NotFoundException();\n }\n return (x - leftTopBlack[0]) / 7.0;\n }\n\n}\n","/*\n * Copyright 2007 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*namespace com.google.zxing.qrcode.decoder {*/\n\nimport BitMatrix from '../../common/BitMatrix';\n\nimport ErrorCorrectionLevel from './ErrorCorrectionLevel';\nimport FormatInformation from './FormatInformation';\nimport ECBlocks from './ECBlocks';\nimport ECB from './ECB';\nimport FormatException from '../../FormatException';\nimport IllegalArgumentException from '../../IllegalArgumentException';\n\n/**\n * See ISO 18004:2006 Annex D\n *\n * @author Sean Owen\n */\nexport default class Version {\n\n /**\n * See ISO 18004:2006 Annex D.\n * Element i represents the raw version bits that specify version i + 7\n */\n private static VERSION_DECODE_INFO = Int32Array.from([\n 0x07C94, 0x085BC, 0x09A99, 0x0A4D3, 0x0BBF6,\n 0x0C762, 0x0D847, 0x0E60D, 0x0F928, 0x10B78,\n 0x1145D, 0x12A17, 0x13532, 0x149A6, 0x15683,\n 0x168C9, 0x177EC, 0x18EC4, 0x191E1, 0x1AFAB,\n 0x1B08E, 0x1CC1A, 0x1D33F, 0x1ED75, 0x1F250,\n 0x209D5, 0x216F0, 0x228BA, 0x2379F, 0x24B0B,\n 0x2542E, 0x26A64, 0x27541, 0x28C69]);\n\n /**\n * See ISO 18004:2006 6.5.1 Table 9\n */\n private static VERSIONS: Version[] = [\n new Version(1, new Int32Array(0),\n new ECBlocks(7, new ECB(1, 19)),\n new ECBlocks(10, new ECB(1, 16)),\n new ECBlocks(13, new ECB(1, 13)),\n new ECBlocks(17, new ECB(1, 9))),\n new Version(2, Int32Array.from([6, 18]),\n new ECBlocks(10, new ECB(1, 34)),\n new ECBlocks(16, new ECB(1, 28)),\n new ECBlocks(22, new ECB(1, 22)),\n new ECBlocks(28, new ECB(1, 16))),\n new Version(3, Int32Array.from([6, 22]),\n new ECBlocks(15, new ECB(1, 55)),\n new ECBlocks(26, new ECB(1, 44)),\n new ECBlocks(18, new ECB(2, 17)),\n new ECBlocks(22, new ECB(2, 13))),\n new Version(4, Int32Array.from([6, 26]),\n new ECBlocks(20, new ECB(1, 80)),\n new ECBlocks(18, new ECB(2, 32)),\n new ECBlocks(26, new ECB(2, 24)),\n new ECBlocks(16, new ECB(4, 9))),\n new Version(5, Int32Array.from([6, 30]),\n new ECBlocks(26, new ECB(1, 108)),\n new ECBlocks(24, new ECB(2, 43)),\n new ECBlocks(18, new ECB(2, 15),\n new ECB(2, 16)),\n new ECBlocks(22, new ECB(2, 11),\n new ECB(2, 12))),\n new Version(6, Int32Array.from([6, 34]),\n new ECBlocks(18, new ECB(2, 68)),\n new ECBlocks(16, new ECB(4, 27)),\n new ECBlocks(24, new ECB(4, 19)),\n new ECBlocks(28, new ECB(4, 15))),\n new Version(7, Int32Array.from([6, 22, 38]),\n new ECBlocks(20, new ECB(2, 78)),\n new ECBlocks(18, new ECB(4, 31)),\n new ECBlocks(18, new ECB(2, 14),\n new ECB(4, 15)),\n new ECBlocks(26, new ECB(4, 13),\n new ECB(1, 14))),\n new Version(8, Int32Array.from([6, 24, 42]),\n new ECBlocks(24, new ECB(2, 97)),\n new ECBlocks(22, new ECB(2, 38),\n new ECB(2, 39)),\n new ECBlocks(22, new ECB(4, 18),\n new ECB(2, 19)),\n new ECBlocks(26, new ECB(4, 14),\n new ECB(2, 15))),\n new Version(9, Int32Array.from([6, 26, 46]),\n new ECBlocks(30, new ECB(2, 116)),\n new ECBlocks(22, new ECB(3, 36),\n new ECB(2, 37)),\n new ECBlocks(20, new ECB(4, 16),\n new ECB(4, 17)),\n new ECBlocks(24, new ECB(4, 12),\n new ECB(4, 13))),\n new Version(10, Int32Array.from([6, 28, 50]),\n new ECBlocks(18, new ECB(2, 68),\n new ECB(2, 69)),\n new ECBlocks(26, new ECB(4, 43),\n new ECB(1, 44)),\n new ECBlocks(24, new ECB(6, 19),\n new ECB(2, 20)),\n new ECBlocks(28, new ECB(6, 15),\n new ECB(2, 16))),\n new Version(11, Int32Array.from([6, 30, 54]),\n new ECBlocks(20, new ECB(4, 81)),\n new ECBlocks(30, new ECB(1, 50),\n new ECB(4, 51)),\n new ECBlocks(28, new ECB(4, 22),\n new ECB(4, 23)),\n new ECBlocks(24, new ECB(3, 12),\n new ECB(8, 13))),\n new Version(12, Int32Array.from([6, 32, 58]),\n new ECBlocks(24, new ECB(2, 92),\n new ECB(2, 93)),\n new ECBlocks(22, new ECB(6, 36),\n new ECB(2, 37)),\n new ECBlocks(26, new ECB(4, 20),\n new ECB(6, 21)),\n new ECBlocks(28, new ECB(7, 14),\n new ECB(4, 15))),\n new Version(13, Int32Array.from([6, 34, 62]),\n new ECBlocks(26, new ECB(4, 107)),\n new ECBlocks(22, new ECB(8, 37),\n new ECB(1, 38)),\n new ECBlocks(24, new ECB(8, 20),\n new ECB(4, 21)),\n new ECBlocks(22, new ECB(12, 11),\n new ECB(4, 12))),\n new Version(14, Int32Array.from([6, 26, 46, 66]),\n new ECBlocks(30, new ECB(3, 115),\n new ECB(1, 116)),\n new ECBlocks(24, new ECB(4, 40),\n new ECB(5, 41)),\n new ECBlocks(20, new ECB(11, 16),\n new ECB(5, 17)),\n new ECBlocks(24, new ECB(11, 12),\n new ECB(5, 13))),\n new Version(15, Int32Array.from([6, 26, 48, 70]),\n new ECBlocks(22, new ECB(5, 87),\n new ECB(1, 88)),\n new ECBlocks(24, new ECB(5, 41),\n new ECB(5, 42)),\n new ECBlocks(30, new ECB(5, 24),\n new ECB(7, 25)),\n new ECBlocks(24, new ECB(11, 12),\n new ECB(7, 13))),\n new Version(16, Int32Array.from([6, 26, 50, 74]),\n new ECBlocks(24, new ECB(5, 98),\n new ECB(1, 99)),\n new ECBlocks(28, new ECB(7, 45),\n new ECB(3, 46)),\n new ECBlocks(24, new ECB(15, 19),\n new ECB(2, 20)),\n new ECBlocks(30, new ECB(3, 15),\n new ECB(13, 16))),\n new Version(17, Int32Array.from([6, 30, 54, 78]),\n new ECBlocks(28, new ECB(1, 107),\n new ECB(5, 108)),\n new ECBlocks(28, new ECB(10, 46),\n new ECB(1, 47)),\n new ECBlocks(28, new ECB(1, 22),\n new ECB(15, 23)),\n new ECBlocks(28, new ECB(2, 14),\n new ECB(17, 15))),\n new Version(18, Int32Array.from([6, 30, 56, 82]),\n new ECBlocks(30, new ECB(5, 120),\n new ECB(1, 121)),\n new ECBlocks(26, new ECB(9, 43),\n new ECB(4, 44)),\n new ECBlocks(28, new ECB(17, 22),\n new ECB(1, 23)),\n new ECBlocks(28, new ECB(2, 14),\n new ECB(19, 15))),\n new Version(19, Int32Array.from([6, 30, 58, 86]),\n new ECBlocks(28, new ECB(3, 113),\n new ECB(4, 114)),\n new ECBlocks(26, new ECB(3, 44),\n new ECB(11, 45)),\n new ECBlocks(26, new ECB(17, 21),\n new ECB(4, 22)),\n new ECBlocks(26, new ECB(9, 13),\n new ECB(16, 14))),\n new Version(20, Int32Array.from([6, 34, 62, 90]),\n new ECBlocks(28, new ECB(3, 107),\n new ECB(5, 108)),\n new ECBlocks(26, new ECB(3, 41),\n new ECB(13, 42)),\n new ECBlocks(30, new ECB(15, 24),\n new ECB(5, 25)),\n new ECBlocks(28, new ECB(15, 15),\n new ECB(10, 16))),\n new Version(21, Int32Array.from([6, 28, 50, 72, 94]),\n new ECBlocks(28, new ECB(4, 116),\n new ECB(4, 117)),\n new ECBlocks(26, new ECB(17, 42)),\n new ECBlocks(28, new ECB(17, 22),\n new ECB(6, 23)),\n new ECBlocks(30, new ECB(19, 16),\n new ECB(6, 17))),\n new Version(22, Int32Array.from([6, 26, 50, 74, 98]),\n new ECBlocks(28, new ECB(2, 111),\n new ECB(7, 112)),\n new ECBlocks(28, new ECB(17, 46)),\n new ECBlocks(30, new ECB(7, 24),\n new ECB(16, 25)),\n new ECBlocks(24, new ECB(34, 13))),\n new Version(23, Int32Array.from([6, 30, 54, 78, 102]),\n new ECBlocks(30, new ECB(4, 121),\n new ECB(5, 122)),\n new ECBlocks(28, new ECB(4, 47),\n new ECB(14, 48)),\n new ECBlocks(30, new ECB(11, 24),\n new ECB(14, 25)),\n new ECBlocks(30, new ECB(16, 15),\n new ECB(14, 16))),\n new Version(24, Int32Array.from([6, 28, 54, 80, 106]),\n new ECBlocks(30, new ECB(6, 117),\n new ECB(4, 118)),\n new ECBlocks(28, new ECB(6, 45),\n new ECB(14, 46)),\n new ECBlocks(30, new ECB(11, 24),\n new ECB(16, 25)),\n new ECBlocks(30, new ECB(30, 16),\n new ECB(2, 17))),\n new Version(25, Int32Array.from([6, 32, 58, 84, 110]),\n new ECBlocks(26, new ECB(8, 106),\n new ECB(4, 107)),\n new ECBlocks(28, new ECB(8, 47),\n new ECB(13, 48)),\n new ECBlocks(30, new ECB(7, 24),\n new ECB(22, 25)),\n new ECBlocks(30, new ECB(22, 15),\n new ECB(13, 16))),\n new Version(26, Int32Array.from([6, 30, 58, 86, 114]),\n new ECBlocks(28, new ECB(10, 114),\n new ECB(2, 115)),\n new ECBlocks(28, new ECB(19, 46),\n new ECB(4, 47)),\n new ECBlocks(28, new ECB(28, 22),\n new ECB(6, 23)),\n new ECBlocks(30, new ECB(33, 16),\n new ECB(4, 17))),\n new Version(27, Int32Array.from([6, 34, 62, 90, 118]),\n new ECBlocks(30, new ECB(8, 122),\n new ECB(4, 123)),\n new ECBlocks(28, new ECB(22, 45),\n new ECB(3, 46)),\n new ECBlocks(30, new ECB(8, 23),\n new ECB(26, 24)),\n new ECBlocks(30, new ECB(12, 15),\n new ECB(28, 16))),\n new Version(28, Int32Array.from([6, 26, 50, 74, 98, 122]),\n new ECBlocks(30, new ECB(3, 117),\n new ECB(10, 118)),\n new ECBlocks(28, new ECB(3, 45),\n new ECB(23, 46)),\n new ECBlocks(30, new ECB(4, 24),\n new ECB(31, 25)),\n new ECBlocks(30, new ECB(11, 15),\n new ECB(31, 16))),\n new Version(29, Int32Array.from([6, 30, 54, 78, 102, 126]),\n new ECBlocks(30, new ECB(7, 116),\n new ECB(7, 117)),\n new ECBlocks(28, new ECB(21, 45),\n new ECB(7, 46)),\n new ECBlocks(30, new ECB(1, 23),\n new ECB(37, 24)),\n new ECBlocks(30, new ECB(19, 15),\n new ECB(26, 16))),\n new Version(30, Int32Array.from([6, 26, 52, 78, 104, 130]),\n new ECBlocks(30, new ECB(5, 115),\n new ECB(10, 116)),\n new ECBlocks(28, new ECB(19, 47),\n new ECB(10, 48)),\n new ECBlocks(30, new ECB(15, 24),\n new ECB(25, 25)),\n new ECBlocks(30, new ECB(23, 15),\n new ECB(25, 16))),\n new Version(31, Int32Array.from([6, 30, 56, 82, 108, 134]),\n new ECBlocks(30, new ECB(13, 115),\n new ECB(3, 116)),\n new ECBlocks(28, new ECB(2, 46),\n new ECB(29, 47)),\n new ECBlocks(30, new ECB(42, 24),\n new ECB(1, 25)),\n new ECBlocks(30, new ECB(23, 15),\n new ECB(28, 16))),\n new Version(32, Int32Array.from([6, 34, 60, 86, 112, 138]),\n new ECBlocks(30, new ECB(17, 115)),\n new ECBlocks(28, new ECB(10, 46),\n new ECB(23, 47)),\n new ECBlocks(30, new ECB(10, 24),\n new ECB(35, 25)),\n new ECBlocks(30, new ECB(19, 15),\n new ECB(35, 16))),\n new Version(33, Int32Array.from([6, 30, 58, 86, 114, 142]),\n new ECBlocks(30, new ECB(17, 115),\n new ECB(1, 116)),\n new ECBlocks(28, new ECB(14, 46),\n new ECB(21, 47)),\n new ECBlocks(30, new ECB(29, 24),\n new ECB(19, 25)),\n new ECBlocks(30, new ECB(11, 15),\n new ECB(46, 16))),\n new Version(34, Int32Array.from([6, 34, 62, 90, 118, 146]),\n new ECBlocks(30, new ECB(13, 115),\n new ECB(6, 116)),\n new ECBlocks(28, new ECB(14, 46),\n new ECB(23, 47)),\n new ECBlocks(30, new ECB(44, 24),\n new ECB(7, 25)),\n new ECBlocks(30, new ECB(59, 16),\n new ECB(1, 17))),\n new Version(35, Int32Array.from([6, 30, 54, 78, 102, 126, 150]),\n new ECBlocks(30, new ECB(12, 121),\n new ECB(7, 122)),\n new ECBlocks(28, new ECB(12, 47),\n new ECB(26, 48)),\n new ECBlocks(30, new ECB(39, 24),\n new ECB(14, 25)),\n new ECBlocks(30, new ECB(22, 15),\n new ECB(41, 16))),\n new Version(36, Int32Array.from([6, 24, 50, 76, 102, 128, 154]),\n new ECBlocks(30, new ECB(6, 121),\n new ECB(14, 122)),\n new ECBlocks(28, new ECB(6, 47),\n new ECB(34, 48)),\n new ECBlocks(30, new ECB(46, 24),\n new ECB(10, 25)),\n new ECBlocks(30, new ECB(2, 15),\n new ECB(64, 16))),\n new Version(37, Int32Array.from([6, 28, 54, 80, 106, 132, 158]),\n new ECBlocks(30, new ECB(17, 122),\n new ECB(4, 123)),\n new ECBlocks(28, new ECB(29, 46),\n new ECB(14, 47)),\n new ECBlocks(30, new ECB(49, 24),\n new ECB(10, 25)),\n new ECBlocks(30, new ECB(24, 15),\n new ECB(46, 16))),\n new Version(38, Int32Array.from([6, 32, 58, 84, 110, 136, 162]),\n new ECBlocks(30, new ECB(4, 122),\n new ECB(18, 123)),\n new ECBlocks(28, new ECB(13, 46),\n new ECB(32, 47)),\n new ECBlocks(30, new ECB(48, 24),\n new ECB(14, 25)),\n new ECBlocks(30, new ECB(42, 15),\n new ECB(32, 16))),\n new Version(39, Int32Array.from([6, 26, 54, 82, 110, 138, 166]),\n new ECBlocks(30, new ECB(20, 117),\n new ECB(4, 118)),\n new ECBlocks(28, new ECB(40, 47),\n new ECB(7, 48)),\n new ECBlocks(30, new ECB(43, 24),\n new ECB(22, 25)),\n new ECBlocks(30, new ECB(10, 15),\n new ECB(67, 16))),\n new Version(40, Int32Array.from([6, 30, 58, 86, 114, 142, 170]),\n new ECBlocks(30, new ECB(19, 118),\n new ECB(6, 119)),\n new ECBlocks(28, new ECB(18, 47),\n new ECB(31, 48)),\n new ECBlocks(30, new ECB(34, 24),\n new ECB(34, 25)),\n new ECBlocks(30, new ECB(20, 15),\n new ECB(61, 16)))\n ];\n\n private ecBlocks: ECBlocks[];\n private totalCodewords: number; /*int*/\n\n private constructor(private versionNumber: number /*int*/,\n private alignmentPatternCenters: Int32Array,\n ...ecBlocks: ECBlocks[]) {\n this.ecBlocks = ecBlocks;\n let total = 0;\n const ecCodewords = ecBlocks[0].getECCodewordsPerBlock();\n const ecbArray: ECB[] = ecBlocks[0].getECBlocks();\n for (const ecBlock of ecbArray) {\n total += ecBlock.getCount() * (ecBlock.getDataCodewords() + ecCodewords);\n }\n this.totalCodewords = total;\n }\n\n public getVersionNumber(): number /*int*/ {\n return this.versionNumber;\n }\n\n public getAlignmentPatternCenters(): Int32Array {\n return this.alignmentPatternCenters;\n }\n\n public getTotalCodewords(): number /*int*/ {\n return this.totalCodewords;\n }\n\n public getDimensionForVersion(): number /*int*/ {\n return 17 + 4 * this.versionNumber;\n }\n\n public getECBlocksForLevel(ecLevel: ErrorCorrectionLevel): ECBlocks {\n return this.ecBlocks[ecLevel.getValue()];\n // TYPESCRIPTPORT: original was using ordinal, and using the order of levels as defined in ErrorCorrectionLevel enum (LMQH)\n // I will use the direct value from ErrorCorrectionLevelValues enum which in typescript goes to a number\n }\n\n /**\n *

Deduces version information purely from QR Code dimensions.

\n *\n * @param dimension dimension in modules\n * @return Version for a QR Code of that dimension\n * @throws FormatException if dimension is not 1 mod 4\n */\n public static getProvisionalVersionForDimension(dimension: number /*int*/): Version /*throws FormatException */ {\n if (dimension % 4 !== 1) {\n throw new FormatException();\n }\n try {\n return this.getVersionForNumber((dimension - 17) / 4);\n } catch (ignored/*: IllegalArgumentException*/) {\n throw new FormatException();\n }\n }\n\n public static getVersionForNumber(versionNumber: number /*int*/): Version {\n if (versionNumber < 1 || versionNumber > 40) {\n throw new IllegalArgumentException();\n }\n return Version.VERSIONS[versionNumber - 1];\n }\n\n public static decodeVersionInformation(versionBits: number /*int*/): Version {\n let bestDifference = Number.MAX_SAFE_INTEGER;\n let bestVersion = 0;\n for (let i = 0; i < Version.VERSION_DECODE_INFO.length; i++) {\n const targetVersion = Version.VERSION_DECODE_INFO[i];\n // Do the version info bits match exactly? done.\n if (targetVersion === versionBits) {\n return Version.getVersionForNumber(i + 7);\n }\n // Otherwise see if this is the closest to a real version info bit string\n // we have seen so far\n const bitsDifference = FormatInformation.numBitsDiffering(versionBits, targetVersion);\n if (bitsDifference < bestDifference) {\n bestVersion = i + 7;\n bestDifference = bitsDifference;\n }\n }\n // We can tolerate up to 3 bits of error since no two version info codewords will\n // differ in less than 8 bits.\n if (bestDifference <= 3) {\n return Version.getVersionForNumber(bestVersion);\n }\n // If we didn't find a close enough match, fail\n return null;\n }\n\n /**\n * See ISO 18004:2006 Annex E\n */\n public buildFunctionPattern(): BitMatrix {\n const dimension = this.getDimensionForVersion();\n const bitMatrix = new BitMatrix(dimension);\n\n // Top left finder pattern + separator + format\n bitMatrix.setRegion(0, 0, 9, 9);\n // Top right finder pattern + separator + format\n bitMatrix.setRegion(dimension - 8, 0, 8, 9);\n // Bottom left finder pattern + separator + format\n bitMatrix.setRegion(0, dimension - 8, 9, 8);\n\n // Alignment patterns\n const max = this.alignmentPatternCenters.length;\n for (let x = 0; x < max; x++) {\n const i = this.alignmentPatternCenters[x] - 2;\n for (let y = 0; y < max; y++) {\n if ((x === 0 && (y === 0 || y === max - 1)) || (x === max - 1 && y === 0)) {\n // No alignment patterns near the three finder patterns\n continue;\n }\n bitMatrix.setRegion(this.alignmentPatternCenters[y] - 2, i, 5, 5);\n }\n }\n\n // Vertical timing pattern\n bitMatrix.setRegion(6, 9, 1, dimension - 17);\n // Horizontal timing pattern\n bitMatrix.setRegion(9, 6, dimension - 17, 1);\n\n if (this.versionNumber > 6) {\n // Version info, top right\n bitMatrix.setRegion(dimension - 11, 0, 3, 6);\n // Version info, bottom left\n bitMatrix.setRegion(0, dimension - 11, 6, 3);\n }\n\n return bitMatrix;\n }\n\n /*@Override*/\n public toString(): string {\n return '' + this.versionNumber;\n }\n}\n","/**\n * Java Formatter class polyfill that works in the JS way.\n */\nexport default class Formatter {\n\n /**\n * The internal formatted value.\n */\n buffer: string;\n\n constructor() {\n this.buffer = '';\n }\n\n /**\n *\n * @see https://stackoverflow.com/a/13439711/4367683\n *\n * @param str\n * @param arr\n */\n private static form(str: string, arr: any[]) {\n\n let i = -1;\n\n function callback(exp: string | number, p0: any, p1: any, p2: any, p3: any, p4: any) {\n\n if (exp === '%%') return '%';\n if (arr[++i] === undefined) return undefined;\n\n exp = p2 ? parseInt(p2.substr(1)) : undefined;\n\n let base = p3 ? parseInt(p3.substr(1)) : undefined;\n let val: string;\n\n switch (p4) {\n case 's': val = arr[i]; break;\n case 'c': val = arr[i][0]; break;\n case 'f': val = parseFloat(arr[i]).toFixed(exp); break;\n case 'p': val = parseFloat(arr[i]).toPrecision(exp); break;\n case 'e': val = parseFloat(arr[i]).toExponential(exp); break;\n case 'x': val = parseInt(arr[i]).toString(base ? base : 16); break;\n case 'd': val = parseFloat(parseInt(arr[i], base ? base : 10).toPrecision(exp)).toFixed(0); break;\n }\n\n val = typeof val === 'object' ? JSON.stringify(val) : (+val).toString(base);\n let size = parseInt(p1); /* padding size */\n let ch = p1 && (p1[0] + '') === '0' ? '0' : ' '; /* isnull? */\n\n while (val.length < size) val = p0 !== undefined ? val + ch : ch + val; /* isminus? */\n\n return val;\n }\n\n let regex = /%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;\n\n return str.replace(regex, callback);\n }\n\n /**\n *\n * @param append The new string to append.\n * @param args Argumets values to be formated.\n */\n format(append: string, ...args: any) {\n this.buffer += Formatter.form(append, args);\n }\n\n /**\n * Returns the Formatter string value.\n */\n toString(): string {\n return this.buffer;\n }\n}\n","/*\n * Copyright 2008 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*namespace com.google.zxing.qrcode.encoder {*/\n\nimport EncodeHintType from '../../EncodeHintType';\nimport BitArray from '../../common/BitArray';\nimport CharacterSetECI from '../../common/CharacterSetECI';\nimport GenericGF from '../../common/reedsolomon/GenericGF';\nimport ReedSolomonEncoder from '../../common/reedsolomon/ReedSolomonEncoder';\nimport ErrorCorrectionLevel from '../decoder/ErrorCorrectionLevel';\nimport Mode from '../decoder/Mode';\nimport Version from '../decoder/Version';\nimport MaskUtil from './MaskUtil';\nimport ByteMatrix from './ByteMatrix';\nimport QRCode from './QRCode';\n\nimport ECBlocks from '../decoder/ECBlocks';\nimport MatrixUtil from './MatrixUtil';\nimport StringEncoding from '../../util/StringEncoding';\nimport BlockPair from './BlockPair';\nimport WriterException from '../../WriterException';\n\n/*import java.io.UnsupportedEncodingException;*/\n/*import java.util.ArrayList;*/\n/*import java.util.Collection;*/\n/*import java.util.Map;*/\n\n/**\n * @author satorux@google.com (Satoru Takabayashi) - creator\n * @author dswitkin@google.com (Daniel Switkin) - ported from C++\n */\nexport default class Encoder {\n\n // The original table is defined in the table 5 of JISX0510:2004 (p.19).\n private static ALPHANUMERIC_TABLE = Int32Array.from([\n -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 0x00-0x0f\n -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 0x10-0x1f\n 36, -1, -1, -1, 37, 38, -1, -1, -1, -1, 39, 40, -1, 41, 42, 43, // 0x20-0x2f\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 44, -1, -1, -1, -1, -1, // 0x30-0x3f\n -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, // 0x40-0x4f\n 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1, // 0x50-0x5f\n ]);\n\n public static DEFAULT_BYTE_MODE_ENCODING = CharacterSetECI.UTF8.getName(); // \"ISO-8859-1\"\n // TYPESCRIPTPORT: changed to UTF8, the default for js\n\n private constructor() { }\n\n // The mask penalty calculation is complicated. See Table 21 of JISX0510:2004 (p.45) for details.\n // Basically it applies four rules and summate all penalties.\n private static calculateMaskPenalty(matrix: ByteMatrix): number /*int*/ {\n return MaskUtil.applyMaskPenaltyRule1(matrix)\n + MaskUtil.applyMaskPenaltyRule2(matrix)\n + MaskUtil.applyMaskPenaltyRule3(matrix)\n + MaskUtil.applyMaskPenaltyRule4(matrix);\n }\n\n /**\n * @param content text to encode\n * @param ecLevel error correction level to use\n * @return {@link QRCode} representing the encoded QR code\n * @throws WriterException if encoding can't succeed, because of for example invalid content\n * or configuration\n */\n // public static encode(content: string, ecLevel: ErrorCorrectionLevel): QRCode /*throws WriterException*/ {\n // return encode(content, ecLevel, null)\n // }\n\n public static encode(content: string,\n ecLevel: ErrorCorrectionLevel,\n hints: Map = null): QRCode /*throws WriterException*/ {\n\n // Determine what character encoding has been specified by the caller, if any\n let encoding: string = Encoder.DEFAULT_BYTE_MODE_ENCODING;\n const hasEncodingHint: boolean = hints !== null && undefined !== hints.get(EncodeHintType.CHARACTER_SET);\n if (hasEncodingHint) {\n encoding = hints.get(EncodeHintType.CHARACTER_SET).toString();\n }\n\n // Pick an encoding mode appropriate for the content. Note that this will not attempt to use\n // multiple modes / segments even if that were more efficient. Twould be nice.\n const mode: Mode = this.chooseMode(content, encoding);\n\n // This will store the header information, like mode and\n // length, as well as \"header\" segments like an ECI segment.\n const headerBits = new BitArray();\n\n // Append ECI segment if applicable\n if (mode === Mode.BYTE && (hasEncodingHint || Encoder.DEFAULT_BYTE_MODE_ENCODING !== encoding)) {\n const eci = CharacterSetECI.getCharacterSetECIByName(encoding);\n if (eci !== undefined) {\n this.appendECI(eci, headerBits);\n }\n }\n\n // (With ECI in place,) Write the mode marker\n this.appendModeInfo(mode, headerBits);\n\n // Collect data within the main segment, separately, to count its size if needed. Don't add it to\n // main payload yet.\n const dataBits = new BitArray();\n this.appendBytes(content, mode, dataBits, encoding);\n\n let version: Version;\n if (hints !== null && undefined !== hints.get(EncodeHintType.QR_VERSION)) {\n const versionNumber = Number.parseInt(hints.get(EncodeHintType.QR_VERSION).toString(), 10);\n version = Version.getVersionForNumber(versionNumber);\n const bitsNeeded = this.calculateBitsNeeded(mode, headerBits, dataBits, version);\n if (!this.willFit(bitsNeeded, version, ecLevel)) {\n throw new WriterException('Data too big for requested version');\n }\n } else {\n version = this.recommendVersion(ecLevel, mode, headerBits, dataBits);\n }\n\n const headerAndDataBits = new BitArray();\n headerAndDataBits.appendBitArray(headerBits);\n // Find \"length\" of main segment and write it\n const numLetters = mode === Mode.BYTE ? dataBits.getSizeInBytes() : content.length;\n this.appendLengthInfo(numLetters, version, mode, headerAndDataBits);\n // Put data together into the overall payload\n headerAndDataBits.appendBitArray(dataBits);\n\n const ecBlocks: ECBlocks = version.getECBlocksForLevel(ecLevel);\n const numDataBytes = version.getTotalCodewords() - ecBlocks.getTotalECCodewords();\n\n // Terminate the bits properly.\n this.terminateBits(numDataBytes, headerAndDataBits);\n\n // Interleave data bits with error correction code.\n const finalBits: BitArray = this.interleaveWithECBytes(headerAndDataBits,\n version.getTotalCodewords(),\n numDataBytes,\n ecBlocks.getNumBlocks());\n\n const qrCode = new QRCode();\n\n qrCode.setECLevel(ecLevel);\n qrCode.setMode(mode);\n qrCode.setVersion(version);\n\n // Choose the mask pattern and set to \"qrCode\".\n const dimension = version.getDimensionForVersion();\n const matrix: ByteMatrix = new ByteMatrix(dimension, dimension);\n const maskPattern = this.chooseMaskPattern(finalBits, ecLevel, version, matrix);\n qrCode.setMaskPattern(maskPattern);\n\n // Build the matrix and set it to \"qrCode\".\n MatrixUtil.buildMatrix(finalBits, ecLevel, version, maskPattern, matrix);\n qrCode.setMatrix(matrix);\n\n return qrCode;\n }\n\n /**\n * Decides the smallest version of QR code that will contain all of the provided data.\n *\n * @throws WriterException if the data cannot fit in any version\n */\n private static recommendVersion(ecLevel: ErrorCorrectionLevel,\n mode: Mode,\n headerBits: BitArray,\n dataBits: BitArray): Version /*throws WriterException*/ {\n // Hard part: need to know version to know how many bits length takes. But need to know how many\n // bits it takes to know version. First we take a guess at version by assuming version will be\n // the minimum, 1:\n const provisionalBitsNeeded = this.calculateBitsNeeded(mode, headerBits, dataBits, Version.getVersionForNumber(1));\n const provisionalVersion = this.chooseVersion(provisionalBitsNeeded, ecLevel);\n\n // Use that guess to calculate the right version. I am still not sure this works in 100% of cases.\n const bitsNeeded = this.calculateBitsNeeded(mode, headerBits, dataBits, provisionalVersion);\n return this.chooseVersion(bitsNeeded, ecLevel);\n }\n\n private static calculateBitsNeeded(mode: Mode,\n headerBits: BitArray,\n dataBits: BitArray,\n version: Version): number /*int*/ {\n return headerBits.getSize() + mode.getCharacterCountBits(version) + dataBits.getSize();\n }\n\n /**\n * @return the code point of the table used in alphanumeric mode or\n * -1 if there is no corresponding code in the table.\n */\n public static getAlphanumericCode(code: number /*int*/): number /*int*/ {\n if (code < Encoder.ALPHANUMERIC_TABLE.length) {\n return Encoder.ALPHANUMERIC_TABLE[code];\n }\n return -1;\n }\n\n // public static chooseMode(content: string): Mode {\n // return chooseMode(content, null);\n // }\n\n /**\n * Choose the best mode by examining the content. Note that 'encoding' is used as a hint;\n * if it is Shift_JIS, and the input is only double-byte Kanji, then we return {@link Mode#KANJI}.\n */\n public static chooseMode(content: string, encoding: string = null): Mode {\n if (CharacterSetECI.SJIS.getName() === encoding && this.isOnlyDoubleByteKanji(content)) {\n // Choose Kanji mode if all input are double-byte characters\n return Mode.KANJI;\n }\n let hasNumeric: boolean = false;\n let hasAlphanumeric: boolean = false;\n for (let i = 0, length = content.length; i < length; ++i) {\n const c: string = content.charAt(i);\n if (Encoder.isDigit(c)) {\n hasNumeric = true;\n } else if (this.getAlphanumericCode(c.charCodeAt(0)) !== -1) {\n hasAlphanumeric = true;\n } else {\n return Mode.BYTE;\n }\n }\n if (hasAlphanumeric) {\n return Mode.ALPHANUMERIC;\n }\n if (hasNumeric) {\n return Mode.NUMERIC;\n }\n return Mode.BYTE;\n }\n\n private static isOnlyDoubleByteKanji(content: string): boolean {\n let bytes: Uint8Array;\n try {\n bytes = StringEncoding.encode(content, CharacterSetECI.SJIS); // content.getBytes(\"Shift_JIS\"))\n } catch (ignored/*: UnsupportedEncodingException*/) {\n return false;\n }\n const length = bytes.length;\n if (length % 2 !== 0) {\n return false;\n }\n for (let i = 0; i < length; i += 2) {\n const byte1 = bytes[i] & 0xFF;\n if ((byte1 < 0x81 || byte1 > 0x9F) && (byte1 < 0xE0 || byte1 > 0xEB)) {\n return false;\n }\n }\n return true;\n }\n\n private static chooseMaskPattern(bits: BitArray,\n ecLevel: ErrorCorrectionLevel,\n version: Version,\n matrix: ByteMatrix): number /*int*/ /*throws WriterException*/ {\n\n let minPenalty = Number.MAX_SAFE_INTEGER; // Lower penalty is better.\n let bestMaskPattern = -1;\n // We try all mask patterns to choose the best one.\n for (let maskPattern = 0; maskPattern < QRCode.NUM_MASK_PATTERNS; maskPattern++) {\n MatrixUtil.buildMatrix(bits, ecLevel, version, maskPattern, matrix);\n let penalty = this.calculateMaskPenalty(matrix);\n if (penalty < minPenalty) {\n minPenalty = penalty;\n bestMaskPattern = maskPattern;\n }\n }\n return bestMaskPattern;\n }\n\n private static chooseVersion(numInputBits: number /*int*/, ecLevel: ErrorCorrectionLevel): Version /*throws WriterException*/ {\n for (let versionNum = 1; versionNum <= 40; versionNum++) {\n const version = Version.getVersionForNumber(versionNum);\n if (Encoder.willFit(numInputBits, version, ecLevel)) {\n return version;\n }\n }\n throw new WriterException('Data too big');\n }\n\n /**\n * @return true if the number of input bits will fit in a code with the specified version and\n * error correction level.\n */\n private static willFit(numInputBits: number /*int*/, version: Version, ecLevel: ErrorCorrectionLevel): boolean {\n // In the following comments, we use numbers of Version 7-H.\n // numBytes = 196\n const numBytes = version.getTotalCodewords();\n // getNumECBytes = 130\n const ecBlocks = version.getECBlocksForLevel(ecLevel);\n const numEcBytes = ecBlocks.getTotalECCodewords();\n // getNumDataBytes = 196 - 130 = 66\n const numDataBytes = numBytes - numEcBytes;\n const totalInputBytes = (numInputBits + 7) / 8;\n return numDataBytes >= totalInputBytes;\n }\n\n /**\n * Terminate bits as described in 8.4.8 and 8.4.9 of JISX0510:2004 (p.24).\n */\n public static terminateBits(numDataBytes: number /*int*/, bits: BitArray): void /*throws WriterException*/ {\n const capacity = numDataBytes * 8;\n if (bits.getSize() > capacity) {\n throw new WriterException('data bits cannot fit in the QR Code' + bits.getSize() + ' > ' +\n capacity);\n }\n for (let i = 0; i < 4 && bits.getSize() < capacity; ++i) {\n bits.appendBit(false);\n }\n // Append termination bits. See 8.4.8 of JISX0510:2004 (p.24) for details.\n // If the last byte isn't 8-bit aligned, we'll add padding bits.\n const numBitsInLastByte = bits.getSize() & 0x07;\n if (numBitsInLastByte > 0) {\n for (let i = numBitsInLastByte; i < 8; i++) {\n bits.appendBit(false);\n }\n }\n // If we have more space, we'll fill the space with padding patterns defined in 8.4.9 (p.24).\n const numPaddingBytes = numDataBytes - bits.getSizeInBytes();\n for (let i = 0; i < numPaddingBytes; ++i) {\n bits.appendBits((i & 0x01) === 0 ? 0xEC : 0x11, 8);\n }\n if (bits.getSize() !== capacity) {\n throw new WriterException('Bits size does not equal capacity');\n }\n }\n\n /**\n * Get number of data bytes and number of error correction bytes for block id \"blockID\". Store\n * the result in \"numDataBytesInBlock\", and \"numECBytesInBlock\". See table 12 in 8.5.1 of\n * JISX0510:2004 (p.30)\n */\n public static getNumDataBytesAndNumECBytesForBlockID(numTotalBytes: number /*int*/,\n numDataBytes: number /*int*/,\n numRSBlocks: number /*int*/,\n blockID: number /*int*/,\n numDataBytesInBlock: Int32Array,\n numECBytesInBlock: Int32Array): void /*throws WriterException*/ {\n if (blockID >= numRSBlocks) {\n throw new WriterException('Block ID too large');\n }\n // numRsBlocksInGroup2 = 196 % 5 = 1\n const numRsBlocksInGroup2 = numTotalBytes % numRSBlocks;\n // numRsBlocksInGroup1 = 5 - 1 = 4\n const numRsBlocksInGroup1 = numRSBlocks - numRsBlocksInGroup2;\n // numTotalBytesInGroup1 = 196 / 5 = 39\n const numTotalBytesInGroup1 = Math.floor(numTotalBytes / numRSBlocks);\n // numTotalBytesInGroup2 = 39 + 1 = 40\n const numTotalBytesInGroup2 = numTotalBytesInGroup1 + 1;\n // numDataBytesInGroup1 = 66 / 5 = 13\n const numDataBytesInGroup1 = Math.floor(numDataBytes / numRSBlocks);\n // numDataBytesInGroup2 = 13 + 1 = 14\n const numDataBytesInGroup2 = numDataBytesInGroup1 + 1;\n // numEcBytesInGroup1 = 39 - 13 = 26\n const numEcBytesInGroup1 = numTotalBytesInGroup1 - numDataBytesInGroup1;\n // numEcBytesInGroup2 = 40 - 14 = 26\n const numEcBytesInGroup2 = numTotalBytesInGroup2 - numDataBytesInGroup2;\n // Sanity checks.\n // 26 = 26\n if (numEcBytesInGroup1 !== numEcBytesInGroup2) {\n throw new WriterException('EC bytes mismatch');\n }\n // 5 = 4 + 1.\n if (numRSBlocks !== numRsBlocksInGroup1 + numRsBlocksInGroup2) {\n throw new WriterException('RS blocks mismatch');\n }\n // 196 = (13 + 26) * 4 + (14 + 26) * 1\n if (numTotalBytes !==\n ((numDataBytesInGroup1 + numEcBytesInGroup1) *\n numRsBlocksInGroup1) +\n ((numDataBytesInGroup2 + numEcBytesInGroup2) *\n numRsBlocksInGroup2)) {\n throw new WriterException('Total bytes mismatch');\n }\n\n if (blockID < numRsBlocksInGroup1) {\n numDataBytesInBlock[0] = numDataBytesInGroup1;\n numECBytesInBlock[0] = numEcBytesInGroup1;\n } else {\n numDataBytesInBlock[0] = numDataBytesInGroup2;\n numECBytesInBlock[0] = numEcBytesInGroup2;\n }\n }\n\n /**\n * Interleave \"bits\" with corresponding error correction bytes. On success, store the result in\n * \"result\". The interleave rule is complicated. See 8.6 of JISX0510:2004 (p.37) for details.\n */\n public static interleaveWithECBytes(bits: BitArray,\n numTotalBytes: number /*int*/,\n numDataBytes: number /*int*/,\n numRSBlocks: number /*int*/): BitArray /*throws WriterException*/ {\n\n // \"bits\" must have \"getNumDataBytes\" bytes of data.\n if (bits.getSizeInBytes() !== numDataBytes) {\n throw new WriterException('Number of bits and data bytes does not match');\n }\n\n // Step 1. Divide data bytes into blocks and generate error correction bytes for them. We'll\n // store the divided data bytes blocks and error correction bytes blocks into \"blocks\".\n let dataBytesOffset = 0;\n let maxNumDataBytes = 0;\n let maxNumEcBytes = 0;\n\n // Since, we know the number of reedsolmon blocks, we can initialize the vector with the number.\n const blocks = new Array(); // new Array(numRSBlocks)\n\n for (let i = 0; i < numRSBlocks; ++i) {\n const numDataBytesInBlock: Int32Array = new Int32Array(1);\n const numEcBytesInBlock: Int32Array = new Int32Array(1);\n Encoder.getNumDataBytesAndNumECBytesForBlockID(\n numTotalBytes, numDataBytes, numRSBlocks, i,\n numDataBytesInBlock, numEcBytesInBlock);\n\n const size = numDataBytesInBlock[0];\n const dataBytes = new Uint8Array(size);\n bits.toBytes(8 * dataBytesOffset, dataBytes, 0, size);\n const ecBytes: Uint8Array = Encoder.generateECBytes(dataBytes, numEcBytesInBlock[0]);\n blocks.push(new BlockPair(dataBytes, ecBytes));\n\n maxNumDataBytes = Math.max(maxNumDataBytes, size);\n maxNumEcBytes = Math.max(maxNumEcBytes, ecBytes.length);\n dataBytesOffset += numDataBytesInBlock[0];\n }\n if (numDataBytes !== dataBytesOffset) {\n throw new WriterException('Data bytes does not match offset');\n }\n\n const result = new BitArray();\n\n // First, place data blocks.\n for (let i = 0; i < maxNumDataBytes; ++i) {\n for (const block of blocks) {\n const dataBytes = block.getDataBytes();\n if (i < dataBytes.length) {\n result.appendBits(dataBytes[i], 8);\n }\n }\n }\n // Then, place error correction blocks.\n for (let i = 0; i < maxNumEcBytes; ++i) {\n for (const block of blocks) {\n const ecBytes = block.getErrorCorrectionBytes();\n if (i < ecBytes.length) {\n result.appendBits(ecBytes[i], 8);\n }\n }\n }\n if (numTotalBytes !== result.getSizeInBytes()) { // Should be same.\n throw new WriterException('Interleaving error: ' + numTotalBytes + ' and ' +\n result.getSizeInBytes() + ' differ.');\n }\n\n return result;\n }\n\n public static generateECBytes(dataBytes: Uint8Array, numEcBytesInBlock: number /*int*/): Uint8Array {\n const numDataBytes = dataBytes.length;\n const toEncode: Int32Array = new Int32Array(numDataBytes + numEcBytesInBlock); // int[numDataBytes + numEcBytesInBlock]\n for (let i = 0; i < numDataBytes; i++) {\n toEncode[i] = dataBytes[i] & 0xFF;\n }\n new ReedSolomonEncoder(GenericGF.QR_CODE_FIELD_256).encode(toEncode, numEcBytesInBlock);\n\n const ecBytes = new Uint8Array(numEcBytesInBlock);\n for (let i = 0; i < numEcBytesInBlock; i++) {\n ecBytes[i] = /*(byte) */toEncode[numDataBytes + i];\n }\n return ecBytes;\n }\n\n /**\n * Append mode info. On success, store the result in \"bits\".\n */\n public static appendModeInfo(mode: Mode, bits: BitArray): void {\n bits.appendBits(mode.getBits(), 4);\n }\n\n\n /**\n * Append length info. On success, store the result in \"bits\".\n */\n public static appendLengthInfo(numLetters: number /*int*/, version: Version, mode: Mode, bits: BitArray): void /*throws WriterException*/ {\n const numBits = mode.getCharacterCountBits(version);\n if (numLetters >= (1 << numBits)) {\n throw new WriterException(numLetters + ' is bigger than ' + ((1 << numBits) - 1));\n }\n bits.appendBits(numLetters, numBits);\n }\n\n /**\n * Append \"bytes\" in \"mode\" mode (encoding) into \"bits\". On success, store the result in \"bits\".\n */\n public static appendBytes(content: string,\n mode: Mode,\n bits: BitArray,\n encoding: string): void /*throws WriterException*/ {\n switch (mode) {\n case Mode.NUMERIC:\n Encoder.appendNumericBytes(content, bits);\n break;\n case Mode.ALPHANUMERIC:\n Encoder.appendAlphanumericBytes(content, bits);\n break;\n case Mode.BYTE:\n Encoder.append8BitBytes(content, bits, encoding);\n break;\n case Mode.KANJI:\n Encoder.appendKanjiBytes(content, bits);\n break;\n default:\n throw new WriterException('Invalid mode: ' + mode);\n }\n }\n\n private static getDigit(singleCharacter: string): number {\n return singleCharacter.charCodeAt(0) - 48;\n }\n\n private static isDigit(singleCharacter: string): boolean {\n const cn = Encoder.getDigit(singleCharacter);\n return cn >= 0 && cn <= 9;\n }\n\n public static appendNumericBytes(content: string, bits: BitArray): void {\n const length = content.length;\n let i = 0;\n while (i < length) {\n const num1 = Encoder.getDigit(content.charAt(i));\n if (i + 2 < length) {\n // Encode three numeric letters in ten bits.\n const num2 = Encoder.getDigit(content.charAt(i + 1));\n const num3 = Encoder.getDigit(content.charAt(i + 2));\n bits.appendBits(num1 * 100 + num2 * 10 + num3, 10);\n i += 3;\n } else if (i + 1 < length) {\n // Encode two numeric letters in seven bits.\n const num2 = Encoder.getDigit(content.charAt(i + 1));\n bits.appendBits(num1 * 10 + num2, 7);\n i += 2;\n } else {\n // Encode one numeric letter in four bits.\n bits.appendBits(num1, 4);\n i++;\n }\n }\n }\n\n public static appendAlphanumericBytes(content: string, bits: BitArray): void /*throws WriterException*/ {\n const length = content.length;\n let i = 0;\n while (i < length) {\n const code1 = Encoder.getAlphanumericCode(content.charCodeAt(i));\n if (code1 === -1) {\n throw new WriterException();\n }\n if (i + 1 < length) {\n const code2 = Encoder.getAlphanumericCode(content.charCodeAt(i + 1));\n if (code2 === -1) {\n throw new WriterException();\n }\n // Encode two alphanumeric letters in 11 bits.\n bits.appendBits(code1 * 45 + code2, 11);\n i += 2;\n } else {\n // Encode one alphanumeric letter in six bits.\n bits.appendBits(code1, 6);\n i++;\n }\n }\n }\n\n public static append8BitBytes(content: string, bits: BitArray, encoding: string): void {\n let bytes: Uint8Array;\n try {\n bytes = StringEncoding.encode(content, encoding);\n } catch (uee/*: UnsupportedEncodingException*/) {\n throw new WriterException(uee);\n }\n for (let i = 0, length = bytes.length; i !== length; i++) {\n const b = bytes[i];\n bits.appendBits(b, 8);\n }\n }\n\n /**\n * @throws WriterException\n */\n public static appendKanjiBytes(content: string, bits: BitArray): void /*throws */ {\n\n let bytes: Uint8Array;\n\n try {\n bytes = StringEncoding.encode(content, CharacterSetECI.SJIS);\n } catch (uee/*: UnsupportedEncodingException*/) {\n throw new WriterException(uee);\n }\n\n const length = bytes.length;\n\n for (let i = 0; i < length; i += 2) {\n\n const byte1 = bytes[i] & 0xFF;\n const byte2 = bytes[i + 1] & 0xFF;\n const code = ((byte1 << 8) & 0xFFFFFFFF) | byte2;\n let subtracted = -1;\n\n if (code >= 0x8140 && code <= 0x9ffc) {\n subtracted = code - 0x8140;\n } else if (code >= 0xe040 && code <= 0xebbf) {\n subtracted = code - 0xc140;\n }\n\n if (subtracted === -1) {\n throw new WriterException('Invalid byte sequence');\n }\n\n const encoded = ((subtracted >> 8) * 0xc0) + (subtracted & 0xff);\n\n bits.appendBits(encoded, 13);\n }\n }\n\n private static appendECI(eci: CharacterSetECI, bits: BitArray): void {\n bits.appendBits(Mode.ECI.getBits(), 4);\n // This is correct for values up to 127, which is all we need now.\n bits.appendBits(eci.getValue(), 8);\n }\n\n}\n","/*\n * Copyright 2008 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*namespace com.google.zxing.qrcode.encoder {*/\n\nimport ErrorCorrectionLevel from '../decoder/ErrorCorrectionLevel';\nimport Mode from '../decoder/Mode';\nimport Version from '../decoder/Version';\nimport StringBuilder from '../../util/StringBuilder';\nimport ByteMatrix from './ByteMatrix';\n\n/**\n * @author satorux@google.com (Satoru Takabayashi) - creator\n * @author dswitkin@google.com (Daniel Switkin) - ported from C++\n */\nexport default class QRCode {\n\n public static NUM_MASK_PATTERNS = 8;\n\n private mode: Mode;\n private ecLevel: ErrorCorrectionLevel;\n private version: Version;\n private maskPattern: number; /*int*/\n private matrix: ByteMatrix;\n\n public constructor() {\n this.maskPattern = -1;\n }\n\n public getMode(): Mode {\n return this.mode;\n }\n\n public getECLevel(): ErrorCorrectionLevel {\n return this.ecLevel;\n }\n\n public getVersion(): Version {\n return this.version;\n }\n\n public getMaskPattern(): number /*int*/ {\n return this.maskPattern;\n }\n\n public getMatrix(): ByteMatrix {\n return this.matrix;\n }\n\n /*@Override*/\n public toString(): string {\n const result = new StringBuilder(); // (200)\n result.append('<<\\n');\n result.append(' mode: ');\n result.append(this.mode ? this.mode.toString() : 'null');\n result.append('\\n ecLevel: ');\n result.append(this.ecLevel ? this.ecLevel.toString() : 'null');\n result.append('\\n version: ');\n result.append(this.version ? this.version.toString() : 'null');\n result.append('\\n maskPattern: ');\n result.append(this.maskPattern.toString());\n if (this.matrix) {\n result.append('\\n matrix:\\n');\n result.append(this.matrix.toString());\n } else {\n result.append('\\n matrix: null\\n');\n }\n result.append('>>\\n');\n return result.toString();\n }\n\n public setMode(value: Mode): void {\n this.mode = value;\n }\n\n public setECLevel(value: ErrorCorrectionLevel): void {\n this.ecLevel = value;\n }\n\n public setVersion(version: Version): void {\n this.version = version;\n }\n\n public setMaskPattern(value: number /*int*/): void {\n this.maskPattern = value;\n }\n\n public setMatrix(value: ByteMatrix): void {\n this.matrix = value;\n }\n\n // Check if \"mask_pattern\" is valid.\n public static isValidMaskPattern(maskPattern: number /*int*/): boolean {\n return maskPattern >= 0 && maskPattern < QRCode.NUM_MASK_PATTERNS;\n }\n\n}\n","import Exception from './Exception';\n\n/**\n * Custom Error class of type Exception.\n */\nexport default class WriterException extends Exception {}\n","\nexport default abstract class DecodedObject{\n\n private readonly newPosition: number;\n\n constructor(newPosition: number) {\n this.newPosition = newPosition\n }\n\n getNewPosition(): number{\n return this.newPosition;\n }\n\n}","export * from './browser';\n\n// Exceptions\nexport { default as ArgumentException } from './core/ArgumentException';\nexport { default as ArithmeticException } from './core/ArithmeticException';\nexport { default as ChecksumException } from './core/ChecksumException';\nexport { default as Exception } from './core/Exception';\nexport { default as FormatException } from './core/FormatException';\nexport { default as IllegalArgumentException } from './core/IllegalArgumentException';\nexport { default as IllegalStateException } from './core/IllegalStateException';\nexport { default as NotFoundException } from './core/NotFoundException';\nexport { default as ReaderException } from './core/ReaderException';\nexport { default as ReedSolomonException } from './core/ReedSolomonException';\nexport { default as UnsupportedOperationException } from './core/UnsupportedOperationException';\nexport { default as WriterException } from './core/WriterException';\n\n// core\nexport { default as BarcodeFormat } from './core/BarcodeFormat';\nexport { default as Binarizer } from './core/Binarizer';\nexport { default as BinaryBitmap } from './core/BinaryBitmap';\nexport { default as DecodeHintType } from './core/DecodeHintType';\nexport { default as InvertedLuminanceSource } from './core/InvertedLuminanceSource';\nexport { default as LuminanceSource } from './core/LuminanceSource';\nexport { default as MultiFormatReader } from './core/MultiFormatReader';\nexport { default as MultiFormatWriter } from './core/MultiFormatWriter';\nexport { default as PlanarYUVLuminanceSource } from './core/PlanarYUVLuminanceSource';\nexport { default as Reader } from './core/Reader';\nexport { default as Result } from './core/Result';\nexport { default as ResultMetadataType } from './core/ResultMetadataType';\nexport { default as ResultPointCallback } from './core/ResultPointCallback';\nexport { default as RGBLuminanceSource } from './core/RGBLuminanceSource';\nexport { default as Writer } from './core/Writer';\n\n// core/common\nexport { default as BitArray } from './core/common/BitArray';\nexport { default as BitMatrix } from './core/common/BitMatrix';\nexport { default as BitSource } from './core/common/BitSource';\nexport { default as CharacterSetECI } from './core/common/CharacterSetECI';\nexport { default as DecoderResult } from './core/common/DecoderResult';\nexport { default as DefaultGridSampler } from './core/common/DefaultGridSampler';\nexport { default as DetectorResult } from './core/common/DetectorResult';\nexport { default as EncodeHintType } from './core/EncodeHintType';\nexport { default as GlobalHistogramBinarizer } from './core/common/GlobalHistogramBinarizer';\nexport { default as GridSampler } from './core/common/GridSampler';\nexport { default as GridSamplerInstance } from './core/common/GridSamplerInstance';\nexport { default as HybridBinarizer } from './core/common/HybridBinarizer';\nexport { default as PerspectiveTransform } from './core/common/PerspectiveTransform';\nexport { default as StringUtils } from './core/common/StringUtils';\n\n// core/common/detector\nexport { default as MathUtils } from './core/common/detector/MathUtils';\n// export { default as MonochromeRectangleDetector } from './core/common/detector/MonochromeRectangleDetector';\nexport { default as WhiteRectangleDetector } from './core/common/detector/WhiteRectangleDetector';\n\n// core/common/reedsolomon\nexport { default as GenericGF } from './core/common/reedsolomon/GenericGF';\nexport { default as GenericGFPoly } from './core/common/reedsolomon/GenericGFPoly';\nexport { default as ReedSolomonDecoder } from './core/common/reedsolomon/ReedSolomonDecoder';\nexport { default as ReedSolomonEncoder } from './core/common/reedsolomon/ReedSolomonEncoder';\n\n// core/datamatrix\nexport { default as DataMatrixReader } from './core/datamatrix/DataMatrixReader';\n\n// core/twod/qrcode\nexport { default as QRCodeReader } from './core/qrcode/QRCodeReader';\nexport { default as QRCodeWriter } from './core/qrcode/QRCodeWriter';\nexport { default as QRCodeDecoderErrorCorrectionLevel } from './core/qrcode/decoder/ErrorCorrectionLevel';\nexport { default as QRCodeEncoder } from './core/qrcode/encoder/Encoder';\nexport { default as QRCodeEncoderQRCode } from './core/qrcode/encoder/QRCode';\n\n// core/twod/aztec\nexport { default as AztecCodeReader } from './core/aztec/AztecReader';\n\n// core/oned\nexport { default as OneDReader } from './core/oned/OneDReader';\nexport { default as EAN13Reader } from './core/oned/EAN13Reader';\nexport { default as Code128Reader } from './core/oned/Code128Reader';\nexport { default as ITFReader } from './core/oned/ITFReader';\nexport { default as Code39Reader } from './core/oned/Code39Reader';\nexport { default as RSS14Reader } from './core/oned/rss/RSS14Reader';\nexport { default as RSSExpandedReader } from './core/oned/rss/expanded/RSSExpandedReader';\nexport { default as MultiformatReader } from './core/oned/MultiFormatOneDReader';\n","/*\n * Copyright 2009 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * This class is the core bitmap class used by ZXing to represent 1 bit data. Reader objects\n * accept a BinaryBitmap and attempt to decode it.\n *\n * @author dswitkin@google.com (Daniel Switkin)\n */\n\n/*namespace com.google.zxing {*/\n\nimport Binarizer from './Binarizer';\nimport BitArray from './common/BitArray';\nimport BitMatrix from './common/BitMatrix';\nimport LuminanceSource from './LuminanceSource';\nimport IllegalArgumentException from './IllegalArgumentException';\n\nexport default class BinaryBitmap {\n private matrix: BitMatrix;\n\n public constructor(private binarizer: Binarizer) {\n if (binarizer === null) {\n throw new IllegalArgumentException('Binarizer must be non-null.');\n }\n }\n\n /**\n * @return The width of the bitmap.\n */\n public getWidth(): number /*int*/ {\n return this.binarizer.getWidth();\n }\n\n /**\n * @return The height of the bitmap.\n */\n public getHeight(): number /*int*/ {\n return this.binarizer.getHeight();\n }\n\n /**\n * Converts one row of luminance data to 1 bit data. May actually do the conversion, or return\n * cached data. Callers should assume this method is expensive and call it as seldom as possible.\n * This method is intended for decoding 1D barcodes and may choose to apply sharpening.\n *\n * @param y The row to fetch, which must be in [0, bitmap height)\n * @param row An optional preallocated array. If null or too small, it will be ignored.\n * If used, the Binarizer will call BitArray.clear(). Always use the returned object.\n * @return The array of bits for this row (true means black).\n * @throws NotFoundException if row can't be binarized\n */\n public getBlackRow(y: number /*int*/, row: BitArray): BitArray /*throws NotFoundException */ {\n return this.binarizer.getBlackRow(y, row);\n }\n\n /**\n * Converts a 2D array of luminance data to 1 bit. As above, assume this method is expensive\n * and do not call it repeatedly. This method is intended for decoding 2D barcodes and may or\n * may not apply sharpening. Therefore, a row from this matrix may not be identical to one\n * fetched using getBlackRow(), so don't mix and match between them.\n *\n * @return The 2D array of bits for the image (true means black).\n * @throws NotFoundException if image can't be binarized to make a matrix\n */\n public getBlackMatrix(): BitMatrix /*throws NotFoundException*/ {\n // The matrix is created on demand the first time it is requested, then cached. There are two\n // reasons for this:\n // 1. This work will never be done if the caller only installs 1D Reader objects, or if a\n // 1D Reader finds a barcode before the 2D Readers run.\n // 2. This work will only be done once even if the caller installs multiple 2D Readers.\n if (this.matrix === null || this.matrix === undefined) {\n this.matrix = this.binarizer.getBlackMatrix();\n }\n return this.matrix;\n }\n\n /**\n * @return Whether this bitmap can be cropped.\n */\n public isCropSupported(): boolean {\n return this.binarizer.getLuminanceSource().isCropSupported();\n }\n\n /**\n * Returns a new object with cropped image data. Implementations may keep a reference to the\n * original data rather than a copy. Only callable if isCropSupported() is true.\n *\n * @param left The left coordinate, which must be in [0,getWidth())\n * @param top The top coordinate, which must be in [0,getHeight())\n * @param width The width of the rectangle to crop.\n * @param height The height of the rectangle to crop.\n * @return A cropped version of this object.\n */\n public crop(left: number /*int*/, top: number /*int*/, width: number /*int*/, height: number /*int*/): BinaryBitmap {\n const newSource: LuminanceSource = this.binarizer.getLuminanceSource().crop(left, top, width, height);\n return new BinaryBitmap(this.binarizer.createBinarizer(newSource));\n }\n\n /**\n * @return Whether this bitmap supports counter-clockwise rotation.\n */\n public isRotateSupported(): boolean {\n return this.binarizer.getLuminanceSource().isRotateSupported();\n }\n\n /**\n * Returns a new object with rotated image data by 90 degrees counterclockwise.\n * Only callable if {@link #isRotateSupported()} is true.\n *\n * @return A rotated version of this object.\n */\n public rotateCounterClockwise(): BinaryBitmap {\n const newSource: LuminanceSource = this.binarizer.getLuminanceSource().rotateCounterClockwise();\n return new BinaryBitmap(this.binarizer.createBinarizer(newSource));\n }\n\n /**\n * Returns a new object with rotated image data by 45 degrees counterclockwise.\n * Only callable if {@link #isRotateSupported()} is true.\n *\n * @return A rotated version of this object.\n */\n public rotateCounterClockwise45(): BinaryBitmap {\n const newSource: LuminanceSource = this.binarizer.getLuminanceSource().rotateCounterClockwise45();\n return new BinaryBitmap(this.binarizer.createBinarizer(newSource));\n }\n\n /*@Override*/\n public toString(): string {\n try {\n return this.getBlackMatrix().toString();\n } catch (e /*: NotFoundException*/) {\n return '';\n }\n }\n\n}\n","/*\n * Copyright 2009 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*namespace com.google.zxing.common {*/\n\nimport Binarizer from '../Binarizer';\nimport LuminanceSource from '../LuminanceSource';\nimport GlobalHistogramBinarizer from './GlobalHistogramBinarizer';\nimport BitMatrix from './BitMatrix';\n\n/**\n * This class implements a local thresholding algorithm, which while slower than the\n * GlobalHistogramBinarizer, is fairly efficient for what it does. It is designed for\n * high frequency images of barcodes with black data on white backgrounds. For this application,\n * it does a much better job than a global blackpoint with severe shadows and gradients.\n * However it tends to produce artifacts on lower frequency images and is therefore not\n * a good general purpose binarizer for uses outside ZXing.\n *\n * This class extends GlobalHistogramBinarizer, using the older histogram approach for 1D readers,\n * and the newer local approach for 2D readers. 1D decoding using a per-row histogram is already\n * inherently local, and only fails for horizontal gradients. We can revisit that problem later,\n * but for now it was not a win to use local blocks for 1D.\n *\n * This Binarizer is the default for the unit tests and the recommended class for library users.\n *\n * @author dswitkin@google.com (Daniel Switkin)\n */\nexport default class HybridBinarizer extends GlobalHistogramBinarizer {\n\n // This class uses 5x5 blocks to compute local luminance, where each block is 8x8 pixels.\n // So this is the smallest dimension in each axis we can accept.\n private static BLOCK_SIZE_POWER = 3;\n private static BLOCK_SIZE = 1 << HybridBinarizer.BLOCK_SIZE_POWER; // ...0100...00\n private static BLOCK_SIZE_MASK = HybridBinarizer.BLOCK_SIZE - 1; // ...0011...11\n private static MINIMUM_DIMENSION = HybridBinarizer.BLOCK_SIZE * 5;\n private static MIN_DYNAMIC_RANGE = 24;\n\n private matrix: BitMatrix | null = null;\n\n public constructor(source: LuminanceSource) {\n super(source);\n }\n\n /**\n * Calculates the final BitMatrix once for all requests. This could be called once from the\n * constructor instead, but there are some advantages to doing it lazily, such as making\n * profiling easier, and not doing heavy lifting when callers don't expect it.\n */\n /*@Override*/\n public getBlackMatrix(): BitMatrix /*throws NotFoundException*/ {\n if (this.matrix !== null) {\n return this.matrix;\n }\n const source = this.getLuminanceSource();\n const width = source.getWidth();\n const height = source.getHeight();\n if (width >= HybridBinarizer.MINIMUM_DIMENSION && height >= HybridBinarizer.MINIMUM_DIMENSION) {\n const luminances = source.getMatrix();\n let subWidth = width >> HybridBinarizer.BLOCK_SIZE_POWER;\n if ((width & HybridBinarizer.BLOCK_SIZE_MASK) !== 0) {\n subWidth++;\n }\n let subHeight = height >> HybridBinarizer.BLOCK_SIZE_POWER;\n if ((height & HybridBinarizer.BLOCK_SIZE_MASK) !== 0) {\n subHeight++;\n }\n const blackPoints = HybridBinarizer.calculateBlackPoints(luminances, subWidth, subHeight, width, height);\n\n const newMatrix = new BitMatrix(width, height);\n HybridBinarizer.calculateThresholdForBlock(luminances, subWidth, subHeight, width, height, blackPoints, newMatrix);\n this.matrix = newMatrix;\n } else {\n // If the image is too small, fall back to the global histogram approach.\n this.matrix = super.getBlackMatrix();\n }\n return this.matrix;\n }\n\n /*@Override*/\n public createBinarizer(source: LuminanceSource): Binarizer {\n return new HybridBinarizer(source);\n }\n\n /**\n * For each block in the image, calculate the average black point using a 5x5 grid\n * of the blocks around it. Also handles the corner cases (fractional blocks are computed based\n * on the last pixels in the row/column which are also used in the previous block).\n */\n private static calculateThresholdForBlock(luminances: Uint8ClampedArray,\n subWidth: number /*int*/,\n subHeight: number /*int*/,\n width: number /*int*/,\n height: number /*int*/,\n blackPoints: Int32Array[],\n matrix: BitMatrix): void {\n const maxYOffset = height - HybridBinarizer.BLOCK_SIZE;\n const maxXOffset = width - HybridBinarizer.BLOCK_SIZE;\n for (let y = 0; y < subHeight; y++) {\n let yoffset = y << HybridBinarizer.BLOCK_SIZE_POWER;\n if (yoffset > maxYOffset) {\n yoffset = maxYOffset;\n }\n const top = HybridBinarizer.cap(y, 2, subHeight - 3);\n for (let x = 0; x < subWidth; x++) {\n let xoffset = x << HybridBinarizer.BLOCK_SIZE_POWER;\n if (xoffset > maxXOffset) {\n xoffset = maxXOffset;\n }\n const left = HybridBinarizer.cap(x, 2, subWidth - 3);\n let sum = 0;\n for (let z = -2; z <= 2; z++) {\n const blackRow = blackPoints[top + z];\n sum += blackRow[left - 2] + blackRow[left - 1] + blackRow[left] + blackRow[left + 1] + blackRow[left + 2];\n }\n const average = sum / 25;\n HybridBinarizer.thresholdBlock(luminances, xoffset, yoffset, average, width, matrix);\n }\n }\n }\n\n private static cap(value: number /*int*/, min: number /*int*/, max: number /*int*/): number /*int*/ {\n return value < min ? min : value > max ? max : value;\n }\n\n /**\n * Applies a single threshold to a block of pixels.\n */\n private static thresholdBlock(luminances: Uint8ClampedArray,\n xoffset: number /*int*/,\n yoffset: number /*int*/,\n threshold: number /*int*/,\n stride: number /*int*/,\n matrix: BitMatrix): void {\n for (let y = 0, offset = yoffset * stride + xoffset; y < HybridBinarizer.BLOCK_SIZE; y++ , offset += stride) {\n for (let x = 0; x < HybridBinarizer.BLOCK_SIZE; x++) {\n // Comparison needs to be <= so that black == 0 pixels are black even if the threshold is 0.\n if ((luminances[offset + x] & 0xFF) <= threshold) {\n matrix.set(xoffset + x, yoffset + y);\n }\n }\n }\n }\n\n /**\n * Calculates a single black point for each block of pixels and saves it away.\n * See the following thread for a discussion of this algorithm:\n * http://groups.google.com/group/zxing/browse_thread/thread/d06efa2c35a7ddc0\n */\n private static calculateBlackPoints(luminances: Uint8ClampedArray,\n subWidth: number /*int*/,\n subHeight: number /*int*/,\n width: number /*int*/,\n height: number /*int*/): Int32Array[] {\n const maxYOffset = height - HybridBinarizer.BLOCK_SIZE;\n const maxXOffset = width - HybridBinarizer.BLOCK_SIZE;\n // tslint:disable-next-line:whitespace\n const blackPoints = new Array(subHeight);// subWidth\n\n for (let y = 0; y < subHeight; y++) {\n blackPoints[y] = new Int32Array(subWidth);\n let yoffset = y << HybridBinarizer.BLOCK_SIZE_POWER;\n if (yoffset > maxYOffset) {\n yoffset = maxYOffset;\n }\n for (let x = 0; x < subWidth; x++) {\n let xoffset = x << HybridBinarizer.BLOCK_SIZE_POWER;\n if (xoffset > maxXOffset) {\n xoffset = maxXOffset;\n }\n let sum = 0;\n let min = 0xFF;\n let max = 0;\n for (let yy = 0, offset = yoffset * width + xoffset; yy < HybridBinarizer.BLOCK_SIZE; yy++ , offset += width) {\n for (let xx = 0; xx < HybridBinarizer.BLOCK_SIZE; xx++) {\n const pixel = luminances[offset + xx] & 0xFF;\n sum += pixel;\n // still looking for good contrast\n if (pixel < min) {\n min = pixel;\n }\n if (pixel > max) {\n max = pixel;\n }\n }\n // short-circuit min/max tests once dynamic range is met\n if (max - min > HybridBinarizer.MIN_DYNAMIC_RANGE) {\n // finish the rest of the rows quickly\n for (yy++ , offset += width; yy < HybridBinarizer.BLOCK_SIZE; yy++ , offset += width) {\n for (let xx = 0; xx < HybridBinarizer.BLOCK_SIZE; xx++) {\n sum += luminances[offset + xx] & 0xFF;\n }\n }\n }\n }\n\n // The default estimate is the average of the values in the block.\n let average = sum >> (HybridBinarizer.BLOCK_SIZE_POWER * 2);\n if (max - min <= HybridBinarizer.MIN_DYNAMIC_RANGE) {\n // If variation within the block is low, assume this is a block with only light or only\n // dark pixels. In that case we do not want to use the average, as it would divide this\n // low contrast area into black and white pixels, essentially creating data out of noise.\n //\n // The default assumption is that the block is light/background. Since no estimate for\n // the level of dark pixels exists locally, use half the min for the block.\n average = min / 2;\n\n if (y > 0 && x > 0) {\n // Correct the \"white background\" assumption for blocks that have neighbors by comparing\n // the pixels in this block to the previously calculated black points. This is based on\n // the fact that dark barcode symbology is always surrounded by some amount of light\n // background for which reasonable black point estimates were made. The bp estimated at\n // the boundaries is used for the interior.\n\n // The (min < bp) is arbitrary but works better than other heuristics that were tried.\n const averageNeighborBlackPoint =\n (blackPoints[y - 1][x] + (2 * blackPoints[y][x - 1]) + blackPoints[y - 1][x - 1]) / 4;\n if (min < averageNeighborBlackPoint) {\n average = averageNeighborBlackPoint;\n }\n }\n }\n blackPoints[y][x] = average;\n }\n }\n return blackPoints;\n }\n\n}\n","/*\n * Copyright 2009 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*namespace com.google.zxing.common {*/\n\nimport Binarizer from '../Binarizer';\nimport LuminanceSource from '../LuminanceSource';\nimport BitArray from './BitArray';\nimport BitMatrix from './BitMatrix';\n\nimport NotFoundException from '../NotFoundException';\n\n/**\n * This Binarizer implementation uses the old ZXing global histogram approach. It is suitable\n * for low-end mobile devices which don't have enough CPU or memory to use a local thresholding\n * algorithm. However, because it picks a global black point, it cannot handle difficult shadows\n * and gradients.\n *\n * Faster mobile devices and all desktop applications should probably use HybridBinarizer instead.\n *\n * @author dswitkin@google.com (Daniel Switkin)\n * @author Sean Owen\n */\nexport default class GlobalHistogramBinarizer extends Binarizer {\n\n private static LUMINANCE_BITS = 5;\n private static LUMINANCE_SHIFT = 8 - GlobalHistogramBinarizer.LUMINANCE_BITS;\n private static LUMINANCE_BUCKETS = 1 << GlobalHistogramBinarizer.LUMINANCE_BITS;\n private static EMPTY = Uint8ClampedArray.from([0]);\n\n private luminances: Uint8ClampedArray;\n private buckets: Int32Array;\n\n public constructor(source: LuminanceSource) {\n super(source);\n this.luminances = GlobalHistogramBinarizer.EMPTY;\n this.buckets = new Int32Array(GlobalHistogramBinarizer.LUMINANCE_BUCKETS);\n }\n\n // Applies simple sharpening to the row data to improve performance of the 1D Readers.\n /*@Override*/\n public getBlackRow(y: number /*int*/, row: BitArray): BitArray /*throws NotFoundException*/ {\n const source = this.getLuminanceSource();\n const width = source.getWidth();\n if (row === undefined || row === null || row.getSize() < width) {\n row = new BitArray(width);\n } else {\n row.clear();\n }\n\n this.initArrays(width);\n const localLuminances = source.getRow(y, this.luminances);\n const localBuckets = this.buckets;\n for (let x = 0; x < width; x++) {\n localBuckets[(localLuminances[x] & 0xff) >> GlobalHistogramBinarizer.LUMINANCE_SHIFT]++;\n }\n const blackPoint = GlobalHistogramBinarizer.estimateBlackPoint(localBuckets);\n\n if (width < 3) {\n // Special case for very small images\n for (let x = 0; x < width; x++) {\n if ((localLuminances[x] & 0xff) < blackPoint) {\n row.set(x);\n }\n }\n } else {\n let left = localLuminances[0] & 0xff;\n let center = localLuminances[1] & 0xff;\n for (let x = 1; x < width - 1; x++) {\n const right = localLuminances[x + 1] & 0xff;\n // A simple -1 4 -1 box filter with a weight of 2.\n if (((center * 4) - left - right) / 2 < blackPoint) {\n row.set(x);\n }\n left = center;\n center = right;\n }\n }\n return row;\n }\n\n // Does not sharpen the data, as this call is intended to only be used by 2D Readers.\n /*@Override*/\n public getBlackMatrix(): BitMatrix /*throws NotFoundException*/ {\n const source = this.getLuminanceSource();\n const width = source.getWidth();\n const height = source.getHeight();\n const matrix = new BitMatrix(width, height);\n\n // Quickly calculates the histogram by sampling four rows from the image. This proved to be\n // more robust on the blackbox tests than sampling a diagonal as we used to do.\n this.initArrays(width);\n const localBuckets = this.buckets;\n for (let y = 1; y < 5; y++) {\n const row = Math.floor((height * y) / 5);\n const localLuminances = source.getRow(row, this.luminances);\n const right = Math.floor((width * 4) / 5);\n for (let x = Math.floor(width / 5); x < right; x++) {\n const pixel = localLuminances[x] & 0xff;\n localBuckets[pixel >> GlobalHistogramBinarizer.LUMINANCE_SHIFT]++;\n }\n }\n const blackPoint = GlobalHistogramBinarizer.estimateBlackPoint(localBuckets);\n\n // We delay reading the entire image luminance until the black point estimation succeeds.\n // Although we end up reading four rows twice, it is consistent with our motto of\n // \"fail quickly\" which is necessary for continuous scanning.\n const localLuminances = source.getMatrix();\n for (let y = 0; y < height; y++) {\n const offset = y * width;\n for (let x = 0; x < width; x++) {\n const pixel = localLuminances[offset + x] & 0xff;\n if (pixel < blackPoint) {\n matrix.set(x, y);\n }\n }\n }\n\n return matrix;\n }\n\n /*@Override*/\n public createBinarizer(source: LuminanceSource): Binarizer {\n return new GlobalHistogramBinarizer(source);\n }\n\n private initArrays(luminanceSize: number /*int*/): void {\n if (this.luminances.length < luminanceSize) {\n this.luminances = new Uint8ClampedArray(luminanceSize);\n }\n const buckets = this.buckets;\n for (let x = 0; x < GlobalHistogramBinarizer.LUMINANCE_BUCKETS; x++) {\n buckets[x] = 0;\n }\n }\n\n private static estimateBlackPoint(buckets: Int32Array): number /*int*/ /*throws NotFoundException*/ {\n // Find the tallest peak in the histogram.\n const numBuckets = buckets.length;\n let maxBucketCount = 0;\n let firstPeak = 0;\n let firstPeakSize = 0;\n for (let x = 0; x < numBuckets; x++) {\n if (buckets[x] > firstPeakSize) {\n firstPeak = x;\n firstPeakSize = buckets[x];\n }\n if (buckets[x] > maxBucketCount) {\n maxBucketCount = buckets[x];\n }\n }\n\n // Find the second-tallest peak which is somewhat far from the tallest peak.\n let secondPeak = 0;\n let secondPeakScore = 0;\n\n for (let x = 0; x < numBuckets; x++) {\n const distanceToBiggest = x - firstPeak;\n // Encourage more distant second peaks by multiplying by square of distance.\n const score = buckets[x] * distanceToBiggest * distanceToBiggest;\n if (score > secondPeakScore) {\n secondPeak = x;\n secondPeakScore = score;\n }\n }\n\n // Make sure firstPeak corresponds to the black peak.\n if (firstPeak > secondPeak) {\n const temp = firstPeak;\n firstPeak = secondPeak;\n secondPeak = temp;\n }\n\n // If there is too little contrast in the image to pick a meaningful black point, throw rather\n // than waste time trying to decode the image, and risk false positives.\n if (secondPeak - firstPeak <= numBuckets / 16) {\n throw new NotFoundException();\n }\n\n // Find a valley between them that is low and closer to the white peak.\n let bestValley = secondPeak - 1;\n let bestValleyScore = -1;\n for (let x = secondPeak - 1; x > firstPeak; x--) {\n const fromFirst = x - firstPeak;\n const score = fromFirst * fromFirst * (secondPeak - x) * (maxBucketCount - buckets[x]);\n if (score > bestValleyScore) {\n bestValley = x;\n bestValleyScore = score;\n }\n }\n\n return bestValley << GlobalHistogramBinarizer.LUMINANCE_SHIFT;\n }\n\n}\n","/*\n * Copyright 2009 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*namespace com.google.zxing {*/\n\nimport LuminanceSource from './LuminanceSource';\nimport BitArray from './common/BitArray';\nimport BitMatrix from './common/BitMatrix';\n\n/**\n * This class hierarchy provides a set of methods to convert luminance data to 1 bit data.\n * It allows the algorithm to vary polymorphically, for example allowing a very expensive\n * thresholding technique for servers and a fast one for mobile. It also permits the implementation\n * to vary, e.g. a JNI version for Android and a Java fallback version for other platforms.\n *\n * @author dswitkin@google.com (Daniel Switkin)\n */\nabstract class Binarizer {\n\n protected constructor(private source: LuminanceSource) { }\n\n public getLuminanceSource(): LuminanceSource {\n return this.source;\n }\n\n /**\n * Converts one row of luminance data to 1 bit data. May actually do the conversion, or return\n * cached data. Callers should assume this method is expensive and call it as seldom as possible.\n * This method is intended for decoding 1D barcodes and may choose to apply sharpening.\n * For callers which only examine one row of pixels at a time, the same BitArray should be reused\n * and passed in with each call for performance. However it is legal to keep more than one row\n * at a time if needed.\n *\n * @param y The row to fetch, which must be in [0, bitmap height)\n * @param row An optional preallocated array. If null or too small, it will be ignored.\n * If used, the Binarizer will call BitArray.clear(). Always use the returned object.\n * @return The array of bits for this row (true means black).\n * @throws NotFoundException if row can't be binarized\n */\n public abstract getBlackRow(y: number/*iny*/, row: BitArray): BitArray; /*throws NotFoundException*/\n\n /**\n * Converts a 2D array of luminance data to 1 bit data. As above, assume this method is expensive\n * and do not call it repeatedly. This method is intended for decoding 2D barcodes and may or\n * may not apply sharpening. Therefore, a row from this matrix may not be identical to one\n * fetched using getBlackRow(), so don't mix and match between them.\n *\n * @return The 2D array of bits for the image (true means black).\n * @throws NotFoundException if image can't be binarized to make a matrix\n */\n public abstract getBlackMatrix(): BitMatrix; /*throws NotFoundException*/\n\n /**\n * Creates a new object with the same type as this Binarizer implementation, but with pristine\n * state. This is needed because Binarizer implementations may be stateful, e.g. keeping a cache\n * of 1 bit data. See Effective Java for why we can't use Java's clone() method.\n *\n * @param source The LuminanceSource this Binarizer will operate on.\n * @return A new concrete Binarizer implementation object.\n */\n public abstract createBinarizer(source: LuminanceSource): Binarizer;\n\n public getWidth(): number /*int*/ {\n return this.source.getWidth();\n }\n\n public getHeight(): number /*int*/ {\n return this.source.getHeight();\n }\n}\n\nexport default Binarizer;\n","import InvertedLuminanceSource from '../core/InvertedLuminanceSource';\nimport LuminanceSource from '../core/LuminanceSource';\nimport IllegalArgumentException from '../core/IllegalArgumentException';\n\n/**\n * @deprecated Moving to @zxing/browser\n */\nexport class HTMLCanvasElementLuminanceSource extends LuminanceSource {\n\n private buffer: Uint8ClampedArray;\n\n private static DEGREE_TO_RADIANS = Math.PI / 180;\n\n private tempCanvasElement: HTMLCanvasElement = null;\n\n public constructor(private canvas: HTMLCanvasElement) {\n super(canvas.width, canvas.height);\n this.buffer = HTMLCanvasElementLuminanceSource.makeBufferFromCanvasImageData(canvas);\n }\n\n private static makeBufferFromCanvasImageData(canvas: HTMLCanvasElement): Uint8ClampedArray {\n const imageData = canvas.getContext('2d').getImageData(0, 0, canvas.width, canvas.height);\n return HTMLCanvasElementLuminanceSource.toGrayscaleBuffer(imageData.data, canvas.width, canvas.height);\n }\n\n private static toGrayscaleBuffer(imageBuffer: Uint8ClampedArray, width: number, height: number): Uint8ClampedArray {\n const grayscaleBuffer = new Uint8ClampedArray(width * height);\n for (let i = 0, j = 0, length = imageBuffer.length; i < length; i += 4, j++) {\n let gray;\n const alpha = imageBuffer[i + 3];\n // The color of fully-transparent pixels is irrelevant. They are often, technically, fully-transparent\n // black (0 alpha, and then 0 RGB). They are often used, of course as the \"white\" area in a\n // barcode image. Force any such pixel to be white:\n if (alpha === 0) {\n gray = 0xFF;\n } else {\n const pixelR = imageBuffer[i];\n const pixelG = imageBuffer[i + 1];\n const pixelB = imageBuffer[i + 2];\n // .299R + 0.587G + 0.114B (YUV/YIQ for PAL and NTSC),\n // (306*R) >> 10 is approximately equal to R*0.299, and so on.\n // 0x200 >> 10 is 0.5, it implements rounding.\n gray = (306 * pixelR +\n 601 * pixelG +\n 117 * pixelB +\n 0x200) >> 10;\n }\n grayscaleBuffer[j] = gray;\n }\n return grayscaleBuffer;\n }\n\n public getRow(y: number /*int*/, row: Uint8ClampedArray): Uint8ClampedArray {\n if (y < 0 || y >= this.getHeight()) {\n throw new IllegalArgumentException('Requested row is outside the image: ' + y);\n }\n const width: number /*int*/ = this.getWidth();\n const start = y * width;\n if (row === null) {\n row = this.buffer.slice(start, start + width);\n } else {\n if (row.length < width) {\n row = new Uint8ClampedArray(width);\n }\n // The underlying raster of image consists of bytes with the luminance values\n // TODO: can avoid set/slice?\n row.set(this.buffer.slice(start, start + width));\n }\n\n return row;\n }\n\n public getMatrix(): Uint8ClampedArray {\n return this.buffer;\n }\n\n public isCropSupported(): boolean {\n return true;\n }\n\n public crop(left: number /*int*/, top: number /*int*/, width: number /*int*/, height: number /*int*/): LuminanceSource {\n super.crop(left, top, width, height);\n return this;\n }\n\n /**\n * This is always true, since the image is a gray-scale image.\n *\n * @return true\n */\n public isRotateSupported(): boolean {\n return true;\n }\n\n public rotateCounterClockwise(): LuminanceSource {\n this.rotate(-90);\n return this;\n }\n\n public rotateCounterClockwise45(): LuminanceSource {\n this.rotate(-45);\n return this;\n }\n\n private getTempCanvasElement() {\n if (null === this.tempCanvasElement) {\n const tempCanvasElement = this.canvas.ownerDocument.createElement('canvas');\n tempCanvasElement.width = this.canvas.width;\n tempCanvasElement.height = this.canvas.height;\n this.tempCanvasElement = tempCanvasElement;\n }\n\n return this.tempCanvasElement;\n }\n\n private rotate(angle: number) {\n const tempCanvasElement = this.getTempCanvasElement();\n const tempContext = tempCanvasElement.getContext('2d');\n const angleRadians = angle * HTMLCanvasElementLuminanceSource.DEGREE_TO_RADIANS;\n\n // Calculate and set new dimensions for temp canvas\n const width = this.canvas.width;\n const height = this.canvas.height;\n const newWidth = Math.ceil( Math.abs(Math.cos(angleRadians)) * width + Math.abs(Math.sin(angleRadians)) * height );\n const newHeight = Math.ceil( Math.abs(Math.sin(angleRadians)) * width + Math.abs(Math.cos(angleRadians)) * height );\n tempCanvasElement.width = newWidth;\n tempCanvasElement.height = newHeight;\n\n // Draw at center of temp canvas to prevent clipping of image data\n tempContext.translate(newWidth / 2, newHeight / 2);\n tempContext.rotate(angleRadians);\n tempContext.drawImage(this.canvas, width / -2, height / -2);\n this.buffer = HTMLCanvasElementLuminanceSource.makeBufferFromCanvasImageData(tempCanvasElement);\n return this;\n }\n\n public invert(): LuminanceSource {\n return new InvertedLuminanceSource(this);\n }\n}\n","/**\n * @deprecated Moving to @zxing/browser\n *\n * Video input device metadata containing the id and label of the device if available.\n */\nexport class VideoInputDevice implements MediaDeviceInfo {\n\n /** @inheritdoc */\n readonly kind = 'videoinput';\n\n /** @inheritdoc */\n readonly groupId: string;\n\n /**\n * Creates an instance of VideoInputDevice.\n *\n * @param {string} deviceId the video input device id\n * @param {string} label the label of the device if available\n */\n public constructor(public deviceId: string, public label: string, groupId?: string) {\n this.groupId = groupId || undefined;\n }\n\n /** @inheritdoc */\n toJSON() {\n return {\n kind: this.kind,\n groupId: this.groupId,\n deviceId: this.deviceId,\n label: this.label,\n };\n }\n}\n","/*\n * Copyright 2007 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*namespace com.google.zxing.common.reedsolomon {*/\n\n// import GenericGFPoly from './GenericGFPoly';\n\nimport Integer from '../../util/Integer';\nimport IllegalArgumentException from '../../IllegalArgumentException';\nimport ArithmeticException from '../../ArithmeticException';\n\n/**\n *

This class contains utility methods for performing mathematical operations over\n * the Galois Fields. Operations use a given primitive polynomial in calculations.

\n *\n *

Throughout this package, elements of the GF are represented as an {@code int}\n * for convenience and speed (but at the cost of memory).\n *

\n *\n * @author Sean Owen\n * @author David Olivier\n */\nexport default abstract class AbstractGenericGF {\n protected expTable: Int32Array;\n protected logTable: Int32Array;\n\n public abstract getZero(): any; // GenericGFPoly\n public abstract buildMonomial(\n degree: number /*int*/,\n coefficient: number /*int*/\n ): any; // GenericGFPoly\n public abstract equals(o: Object): boolean;\n public abstract multiply(a: number /*int*/, b: number /*int*/): number;\n public abstract inverse(a: number /*int*/): number;\n\n /**\n * @return 2 to the power of a in GF(size)\n */\n public exp(a: number): number /*int*/ {\n return this.expTable[a];\n }\n\n /**\n * @return base 2 log of a in GF(size)\n */\n public log(a: number /*int*/): number /*int*/ {\n if (a === 0) {\n throw new IllegalArgumentException();\n }\n return this.logTable[a];\n }\n\n /**\n * Implements both addition and subtraction -- they are the same in GF(size).\n *\n * @return sum/difference of a and b\n */\n public static addOrSubtract(\n a: number /*int*/,\n b: number /*int*/\n ): number /*int*/ {\n return a ^ b;\n }\n}\n","import Exception from './Exception';\n\n/**\n * Custom Error class of type Exception.\n */\nexport default class ReedSolomonException extends Exception {}\n","/**\n * Ponyfill for Java's Float class.\n */\nexport default class Float {\n\n /**\n * The float max value in JS is the number max value.\n */\n static MAX_VALUE: number = Number.MAX_SAFE_INTEGER;\n\n /**\n * SincTS has no difference between int and float, there's all numbers,\n * this is used only to polyfill Java code.\n */\n public static floatToIntBits(f: number): number {\n return f;\n }\n}\n","/*\n * Copyright 2007 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*namespace com.google.zxing.common {*/\n\nimport GridSampler from './GridSampler';\nimport BitMatrix from './BitMatrix';\nimport PerspectiveTransform from './PerspectiveTransform';\n\nimport NotFoundException from '../NotFoundException';\n\nimport { float } from '../../customTypings';\n\n/**\n * @author Sean Owen\n */\nexport default class DefaultGridSampler extends GridSampler {\n\n /*@Override*/\n public sampleGrid(image: BitMatrix,\n dimensionX: number /*int*/,\n dimensionY: number /*int*/,\n p1ToX: number/*float*/, p1ToY: number/*float*/,\n p2ToX: number/*float*/, p2ToY: number/*float*/,\n p3ToX: number/*float*/, p3ToY: number/*float*/,\n p4ToX: number/*float*/, p4ToY: number/*float*/,\n p1FromX: number/*float*/, p1FromY: number/*float*/,\n p2FromX: number/*float*/, p2FromY: number/*float*/,\n p3FromX: number/*float*/, p3FromY: number/*float*/,\n p4FromX: number/*float*/, p4FromY: number/*float*/): BitMatrix /*throws NotFoundException*/ {\n\n const transform = PerspectiveTransform.quadrilateralToQuadrilateral(\n p1ToX, p1ToY, p2ToX, p2ToY, p3ToX, p3ToY, p4ToX, p4ToY,\n p1FromX, p1FromY, p2FromX, p2FromY, p3FromX, p3FromY, p4FromX, p4FromY);\n\n return this.sampleGridWithTransform(image, dimensionX, dimensionY, transform);\n }\n\n /*@Override*/\n public sampleGridWithTransform(image: BitMatrix,\n dimensionX: number /*int*/,\n dimensionY: number /*int*/,\n transform: PerspectiveTransform): BitMatrix /*throws NotFoundException*/ {\n if (dimensionX <= 0 || dimensionY <= 0) {\n throw new NotFoundException();\n }\n const bits = new BitMatrix(dimensionX, dimensionY);\n const points = new Float32Array(2 * dimensionX);\n for (let y = 0; y < dimensionY; y++) {\n const max = points.length;\n const iValue: number /*float*/ = y + 0.5;\n for (let x = 0; x < max; x += 2) {\n points[x] = (x / 2) + 0.5;\n points[x + 1] = iValue;\n }\n transform.transformPoints(points);\n // Quick check to see if points transformed to something inside the image\n // sufficient to check the endpoints\n GridSampler.checkAndNudgePoints(image, points);\n try {\n for (let x = 0; x < max; x += 2) {\n if (image.get(Math.floor(points[x]), Math.floor(points[x + 1]))) {\n // Black(-ish) pixel\n bits.set(x / 2, y);\n }\n }\n } catch (aioobe/*: ArrayIndexOutOfBoundsException*/) {\n // This feels wrong, but, sometimes if the finder patterns are misidentified, the resulting\n // transform gets \"twisted\" such that it maps a straight line of points to a set of points\n // whose endpoints are in bounds, but others are not. There is probably some mathematical\n // way to detect this about the transformation that I don't know yet.\n // This results in an ugly runtime exception despite our clever checks above -- can't have\n // that. We could check each point's coordinates but that feels duplicative. We settle for\n // catching and wrapping ArrayIndexOutOfBoundsException.\n throw new NotFoundException();\n }\n }\n return bits;\n }\n\n}\n","/*\n * Copyright 2007 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*namespace com.google.zxing.common {*/\n\nimport BitMatrix from './BitMatrix';\nimport PerspectiveTransform from './PerspectiveTransform';\n\nimport NotFoundException from '../NotFoundException';\n\n/**\n * Implementations of this class can, given locations of finder patterns for a QR code in an\n * image, sample the right points in the image to reconstruct the QR code, accounting for\n * perspective distortion. It is abstracted since it is relatively expensive and should be allowed\n * to take advantage of platform-specific optimized implementations, like Sun's Java Advanced\n * Imaging library, but which may not be available in other environments such as J2ME, and vice\n * versa.\n *\n * The implementation used can be controlled by calling {@link #setGridSampler(GridSampler)}\n * with an instance of a class which implements this interface.\n *\n * @author Sean Owen\n */\nabstract class GridSampler {\n\n /**\n * Samples an image for a rectangular matrix of bits of the given dimension. The sampling\n * transformation is determined by the coordinates of 4 points, in the original and transformed\n * image space.\n *\n * @param image image to sample\n * @param dimensionX width of {@link BitMatrix} to sample from image\n * @param dimensionY height of {@link BitMatrix} to sample from image\n * @param p1ToX point 1 preimage X\n * @param p1ToY point 1 preimage Y\n * @param p2ToX point 2 preimage X\n * @param p2ToY point 2 preimage Y\n * @param p3ToX point 3 preimage X\n * @param p3ToY point 3 preimage Y\n * @param p4ToX point 4 preimage X\n * @param p4ToY point 4 preimage Y\n * @param p1FromX point 1 image X\n * @param p1FromY point 1 image Y\n * @param p2FromX point 2 image X\n * @param p2FromY point 2 image Y\n * @param p3FromX point 3 image X\n * @param p3FromY point 3 image Y\n * @param p4FromX point 4 image X\n * @param p4FromY point 4 image Y\n *\n * @return {@link BitMatrix} representing a grid of points sampled from the image within a region\n * defined by the \"from\" parameters\n *\n * @throws NotFoundException if image can't be sampled, for example, if the transformation defined\n * by the given points is invalid or results in sampling outside the image boundaries\n */\n public abstract sampleGrid(\n image: BitMatrix,\n dimensionX: number /*int*/,\n dimensionY: number /*int*/,\n p1ToX: number/*float*/, p1ToY: number/*float*/,\n p2ToX: number/*float*/, p2ToY: number/*float*/,\n p3ToX: number/*float*/, p3ToY: number/*float*/,\n p4ToX: number/*float*/, p4ToY: number/*float*/,\n p1FromX: number/*float*/, p1FromY: number/*float*/,\n p2FromX: number/*float*/, p2FromY: number/*float*/,\n p3FromX: number/*float*/, p3FromY: number/*float*/,\n p4FromX: number/*float*/, p4FromY: number/*float*/\n ): BitMatrix; /*throws NotFoundException*/\n\n public abstract sampleGridWithTransform(\n image: BitMatrix,\n dimensionX: number /*int*/,\n dimensionY: number /*int*/,\n transform: PerspectiveTransform\n ): BitMatrix; /*throws NotFoundException*/\n\n /**\n *

Checks a set of points that have been transformed to sample points on an image against\n * the image's dimensions to see if the point are even within the image.

\n *\n *

This method will actually \"nudge\" the endpoints back onto the image if they are found to be\n * barely (less than 1 pixel) off the image. This accounts for imperfect detection of finder\n * patterns in an image where the QR Code runs all the way to the image border.

\n *\n *

For efficiency, the method will check points from either end of the line until one is found\n * to be within the image. Because the set of points are assumed to be linear, this is valid.

\n *\n * @param image image into which the points should map\n * @param points actual points in x1,y1,...,xn,yn form\n * @throws NotFoundException if an endpoint is lies outside the image boundaries\n */\n protected static checkAndNudgePoints(\n image: BitMatrix,\n points: Float32Array\n ): void /*throws NotFoundException*/ {\n\n const width: number /*int*/ = image.getWidth();\n const height: number /*int*/ = image.getHeight();\n\n // Check and nudge points from start until we see some that are OK:\n let nudged: boolean = true;\n\n for (let offset = 0; offset < points.length && nudged; offset += 2) {\n\n const x = Math.floor(points[offset]);\n const y = Math.floor(points[offset + 1]);\n\n if (x < -1 || x > width || y < -1 || y > height) {\n throw new NotFoundException();\n }\n\n nudged = false;\n\n if (x === -1) {\n points[offset] = 0.0;\n nudged = true;\n } else if (x === width) {\n points[offset] = width - 1;\n nudged = true;\n }\n\n if (y === -1) {\n points[offset + 1] = 0.0;\n nudged = true;\n } else if (y === height) {\n points[offset + 1] = height - 1;\n nudged = true;\n }\n }\n\n // Check and nudge points from end:\n nudged = true;\n\n for (let offset = points.length - 2; offset >= 0 && nudged; offset -= 2) {\n\n const x = Math.floor(points[offset]);\n const y = Math.floor(points[offset + 1]);\n\n if (x < -1 || x > width || y < -1 || y > height) {\n throw new NotFoundException();\n }\n\n nudged = false;\n\n if (x === -1) {\n points[offset] = 0.0;\n nudged = true;\n } else if (x === width) {\n points[offset] = width - 1;\n nudged = true;\n }\n\n if (y === -1) {\n points[offset + 1] = 0.0;\n nudged = true;\n } else if (y === height) {\n points[offset + 1] = height - 1;\n nudged = true;\n }\n }\n }\n\n}\n\nexport default GridSampler;\n","/*\n * Copyright 2008 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*namespace com.google.zxing.oned {*/\n\nimport BarcodeFormat from '../BarcodeFormat';\nimport BitArray from '../common/BitArray';\nimport ChecksumException from '../ChecksumException';\nimport DecodeHintType from '../DecodeHintType';\nimport FormatException from '../FormatException';\nimport NotFoundException from '../NotFoundException';\nimport OneDReader from './OneDReader';\nimport Result from '../Result';\nimport ResultPoint from '../ResultPoint';\n\n/**\n *

Decodes Code 39 barcodes. Supports \"Full ASCII Code 39\" if USE_CODE_39_EXTENDED_MODE is set.

\n *\n * @author Sean Owen\n * @see Code93Reader\n */\nexport default class Code39Reader extends OneDReader {\n\n private static readonly ALPHABET_STRING = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%';\n\n /**\n * These represent the encodings of characters, as patterns of wide and narrow bars.\n * The 9 least-significant bits of each int correspond to the pattern of wide and narrow,\n * with 1s representing \"wide\" and 0s representing narrow.\n */\n private static readonly CHARACTER_ENCODINGS: number[] = [\n 0x034, 0x121, 0x061, 0x160, 0x031, 0x130, 0x070, 0x025, 0x124, 0x064, // 0-9\n 0x109, 0x049, 0x148, 0x019, 0x118, 0x058, 0x00D, 0x10C, 0x04C, 0x01C, // A-J\n 0x103, 0x043, 0x142, 0x013, 0x112, 0x052, 0x007, 0x106, 0x046, 0x016, // K-T\n 0x181, 0x0C1, 0x1C0, 0x091, 0x190, 0x0D0, 0x085, 0x184, 0x0C4, 0x0A8, // U-$\n 0x0A2, 0x08A, 0x02A // /-%\n ];\n\n private static readonly ASTERISK_ENCODING = 0x094;\n\n private usingCheckDigit: boolean;\n private extendedMode: boolean;\n private decodeRowResult: string;\n private counters: number[];\n\n /**\n * Creates a reader that assumes all encoded data is data, and does not treat the final\n * character as a check digit. It will not decoded \"extended Code 39\" sequences.\n */\n // public Code39Reader() {\n // this(false);\n // }\n\n /**\n * Creates a reader that can be configured to check the last character as a check digit.\n * It will not decoded \"extended Code 39\" sequences.\n *\n * @param usingCheckDigit if true, treat the last data character as a check digit, not\n * data, and verify that the checksum passes.\n */\n // public Code39Reader(boolean usingCheckDigit) {\n // this(usingCheckDigit, false);\n // }\n\n /**\n * Creates a reader that can be configured to check the last character as a check digit,\n * or optionally attempt to decode \"extended Code 39\" sequences that are used to encode\n * the full ASCII character set.\n *\n * @param usingCheckDigit if true, treat the last data character as a check digit, not\n * data, and verify that the checksum passes.\n * @param extendedMode if true, will attempt to decode extended Code 39 sequences in the\n * text.\n */\n public constructor(usingCheckDigit: boolean = false, extendedMode: boolean = false) {\n super();\n this.usingCheckDigit = usingCheckDigit;\n this.extendedMode = extendedMode;\n this.decodeRowResult = '';\n this.counters = new Array(9);\n }\n\n public decodeRow(rowNumber: number, row: BitArray, hints?: Map): Result {\n let theCounters = this.counters;\n theCounters.fill(0);\n this.decodeRowResult = '';\n\n let start = Code39Reader.findAsteriskPattern(row, theCounters);\n // Read off white space\n let nextStart = row.getNextSet(start[1]);\n let end = row.getSize();\n\n let decodedChar: string;\n let lastStart: number;\n do {\n Code39Reader.recordPattern(row, nextStart, theCounters);\n let pattern = Code39Reader.toNarrowWidePattern(theCounters);\n if (pattern < 0) {\n throw new NotFoundException();\n }\n decodedChar = Code39Reader.patternToChar(pattern);\n this.decodeRowResult += decodedChar;\n lastStart = nextStart;\n for (let counter of theCounters) {\n nextStart += counter;\n }\n // Read off white space\n nextStart = row.getNextSet(nextStart);\n } while (decodedChar !== '*');\n this.decodeRowResult = this.decodeRowResult.substring(0, this.decodeRowResult.length - 1); // remove asterisk\n\n // Look for whitespace after pattern:\n let lastPatternSize = 0;\n for (let counter of theCounters) {\n lastPatternSize += counter;\n }\n let whiteSpaceAfterEnd = nextStart - lastStart - lastPatternSize;\n // If 50% of last pattern size, following last pattern, is not whitespace, fail\n // (but if it's whitespace to the very end of the image, that's OK)\n if (nextStart !== end && (whiteSpaceAfterEnd * 2) < lastPatternSize) {\n throw new NotFoundException();\n }\n\n if (this.usingCheckDigit) {\n let max = this.decodeRowResult.length - 1;\n let total = 0;\n for (let i = 0; i < max; i++) {\n total += Code39Reader.ALPHABET_STRING.indexOf(this.decodeRowResult.charAt(i));\n }\n if (this.decodeRowResult.charAt(max) !== Code39Reader.ALPHABET_STRING.charAt(total % 43)) {\n throw new ChecksumException();\n }\n this.decodeRowResult = this.decodeRowResult.substring(0, max);\n }\n\n if (this.decodeRowResult.length === 0) {\n // false positive\n throw new NotFoundException();\n }\n\n let resultString: string;\n if (this.extendedMode) {\n resultString = Code39Reader.decodeExtended(this.decodeRowResult);\n } else {\n resultString = this.decodeRowResult;\n }\n\n let left = (start[1] + start[0]) / 2.0;\n let right = lastStart + lastPatternSize / 2.0;\n return new Result(\n resultString,\n null,\n 0,\n [new ResultPoint(left, rowNumber), new ResultPoint(right, rowNumber)],\n BarcodeFormat.CODE_39,\n new Date().getTime());\n\n }\n\n private static findAsteriskPattern(row: BitArray, counters: number[]): number[] {\n let width = row.getSize();\n let rowOffset = row.getNextSet(0);\n\n let counterPosition = 0;\n let patternStart = rowOffset;\n let isWhite = false;\n let patternLength = counters.length;\n\n for (let i = rowOffset; i < width; i++) {\n if (row.get(i) !== isWhite) {\n counters[counterPosition]++;\n } else {\n if (counterPosition === patternLength - 1) {\n // Look for whitespace before start pattern, >= 50% of width of start pattern\n if (this.toNarrowWidePattern(counters) === Code39Reader.ASTERISK_ENCODING &&\n row.isRange(Math.max(0, patternStart - Math.floor((i - patternStart) / 2)), patternStart, false)) {\n return [patternStart, i];\n }\n patternStart += counters[0] + counters[1];\n counters.copyWithin(0, 2, 2 + counterPosition - 1);\n counters[counterPosition - 1] = 0;\n counters[counterPosition] = 0;\n counterPosition--;\n } else {\n counterPosition++;\n }\n counters[counterPosition] = 1;\n isWhite = !isWhite;\n }\n }\n throw new NotFoundException();\n }\n\n // For efficiency, returns -1 on failure. Not throwing here saved as many as 700 exceptions\n // per image when using some of our blackbox images.\n private static toNarrowWidePattern(counters: number[]): number {\n let numCounters = counters.length;\n let maxNarrowCounter = 0;\n let wideCounters: number;\n do {\n let minCounter = 0x7fffffff;\n for (let counter of counters) {\n if (counter < minCounter && counter > maxNarrowCounter) {\n minCounter = counter;\n }\n }\n maxNarrowCounter = minCounter;\n wideCounters = 0;\n let totalWideCountersWidth = 0;\n let pattern = 0;\n for (let i = 0; i < numCounters; i++) {\n let counter = counters[i];\n if (counter > maxNarrowCounter) {\n pattern |= 1 << (numCounters - 1 - i);\n wideCounters++;\n totalWideCountersWidth += counter;\n }\n }\n if (wideCounters === 3) {\n // Found 3 wide counters, but are they close enough in width?\n // We can perform a cheap, conservative check to see if any individual\n // counter is more than 1.5 times the average:\n for (let i = 0; i < numCounters && wideCounters > 0; i++) {\n let counter = counters[i];\n if (counter > maxNarrowCounter) {\n wideCounters--;\n // totalWideCountersWidth = 3 * average, so this checks if counter >= 3/2 * average\n if ((counter * 2) >= totalWideCountersWidth) {\n return -1;\n }\n }\n }\n return pattern;\n }\n } while (wideCounters > 3);\n return -1;\n }\n\n private static patternToChar(pattern: number): string {\n for (let i = 0; i < Code39Reader.CHARACTER_ENCODINGS.length; i++) {\n if (Code39Reader.CHARACTER_ENCODINGS[i] === pattern) {\n return Code39Reader.ALPHABET_STRING.charAt(i);\n }\n }\n if (pattern === Code39Reader.ASTERISK_ENCODING) {\n return '*';\n }\n throw new NotFoundException();\n }\n\n private static decodeExtended(encoded: string): string {\n let length = encoded.length;\n let decoded = '';\n for (let i = 0; i < length; i++) {\n let c = encoded.charAt(i);\n if (c === '+' || c === '$' || c === '%' || c === '/') {\n let next = encoded.charAt(i + 1);\n let decodedChar = '\\0';\n switch (c) {\n case '+':\n // +A to +Z map to a to z\n if (next >= 'A' && next <= 'Z') {\n decodedChar = String.fromCharCode(next.charCodeAt(0) + 32);\n } else {\n throw new FormatException();\n }\n break;\n case '$':\n // $A to $Z map to control codes SH to SB\n if (next >= 'A' && next <= 'Z') {\n decodedChar = String.fromCharCode(next.charCodeAt(0) - 64);\n } else {\n throw new FormatException();\n }\n break;\n case '%':\n // %A to %E map to control codes ESC to US\n if (next >= 'A' && next <= 'E') {\n decodedChar = String.fromCharCode(next.charCodeAt(0) - 38);\n } else if (next >= 'F' && next <= 'J') {\n decodedChar = String.fromCharCode(next.charCodeAt(0) - 11);\n } else if (next >= 'K' && next <= 'O') {\n decodedChar = String.fromCharCode(next.charCodeAt(0) + 16);\n } else if (next >= 'P' && next <= 'T') {\n decodedChar = String.fromCharCode(next.charCodeAt(0) + 43);\n } else if (next === 'U') {\n decodedChar = '\\0';\n } else if (next === 'V') {\n decodedChar = '@';\n } else if (next === 'W') {\n decodedChar = '`';\n } else if (next === 'X' || next === 'Y' || next === 'Z') {\n decodedChar = '\\x7f';\n } else {\n throw new FormatException();\n }\n break;\n case '/':\n // /A to /O map to ! to , and /Z maps to :\n if (next >= 'A' && next <= 'O') {\n decodedChar = String.fromCharCode(next.charCodeAt(0) - 32);\n } else if (next === 'Z') {\n decodedChar = ':';\n } else {\n throw new FormatException();\n }\n break;\n }\n decoded += decodedChar;\n // bump up i again since we read two characters\n i++;\n } else {\n decoded += c;\n }\n }\n return decoded;\n }\n\n}\n","/*\n * Copyright 2008 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*namespace com.google.zxing.oned {*/\n\nimport BarcodeFormat from '../BarcodeFormat';\nimport BinaryBitmap from '../BinaryBitmap';\nimport BitArray from '../common/BitArray';\nimport DecodeHintType from '../DecodeHintType';\n\nimport Reader from '../Reader';\nimport Result from '../Result';\nimport ResultMetadataType from '../ResultMetadataType';\nimport ResultPoint from '../ResultPoint';\nimport OneDReader from './OneDReader';\nimport NotFoundException from '../NotFoundException';\nimport FormatException from '../FormatException';\nimport ChecksumException from '../ChecksumException';\n\n/**\n *

Decodes Code 128 barcodes.

\n *\n * @author Sean Owen\n */\nexport default class Code128Reader extends OneDReader {\n\n private static CODE_PATTERNS: number[][] = [\n [2, 1, 2, 2, 2, 2],\n [2, 2, 2, 1, 2, 2],\n [2, 2, 2, 2, 2, 1],\n [1, 2, 1, 2, 2, 3],\n [1, 2, 1, 3, 2, 2],\n [1, 3, 1, 2, 2, 2],\n [1, 2, 2, 2, 1, 3],\n [1, 2, 2, 3, 1, 2],\n [1, 3, 2, 2, 1, 2],\n [2, 2, 1, 2, 1, 3],\n [2, 2, 1, 3, 1, 2],\n [2, 3, 1, 2, 1, 2],\n [1, 1, 2, 2, 3, 2],\n [1, 2, 2, 1, 3, 2],\n [1, 2, 2, 2, 3, 1],\n [1, 1, 3, 2, 2, 2],\n [1, 2, 3, 1, 2, 2],\n [1, 2, 3, 2, 2, 1],\n [2, 2, 3, 2, 1, 1],\n [2, 2, 1, 1, 3, 2],\n [2, 2, 1, 2, 3, 1],\n [2, 1, 3, 2, 1, 2],\n [2, 2, 3, 1, 1, 2],\n [3, 1, 2, 1, 3, 1],\n [3, 1, 1, 2, 2, 2],\n [3, 2, 1, 1, 2, 2],\n [3, 2, 1, 2, 2, 1],\n [3, 1, 2, 2, 1, 2],\n [3, 2, 2, 1, 1, 2],\n [3, 2, 2, 2, 1, 1],\n [2, 1, 2, 1, 2, 3],\n [2, 1, 2, 3, 2, 1],\n [2, 3, 2, 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, 2],\n [1, 2, 4, 1, 1, 2],\n [1, 2, 4, 2, 1, 1],\n [4, 1, 1, 2, 1, 2],\n [4, 2, 1, 1, 1, 2],\n [4, 2, 1, 2, 1, 1],\n [2, 1, 2, 1, 4, 1],\n [2, 1, 4, 1, 2, 1],\n [4, 1, 2, 1, 2, 1],\n [1, 1, 1, 1, 4, 3],\n [1, 1, 1, 3, 4, 1],\n [1, 3, 1, 1, 4, 1],\n [1, 1, 4, 1, 1, 3],\n [1, 1, 4, 3, 1, 1],\n [4, 1, 1, 1, 1, 3],\n [4, 1, 1, 3, 1, 1],\n [1, 1, 3, 1, 4, 1],\n [1, 1, 4, 1, 3, 1],\n [3, 1, 1, 1, 4, 1],\n [4, 1, 1, 1, 3, 1],\n [2, 1, 1, 4, 1, 2],\n [2, 1, 1, 2, 1, 4],\n [2, 1, 1, 2, 3, 2],\n [2, 3, 3, 1, 1, 1, 2]];\n\n private static MAX_AVG_VARIANCE = 0.25;\n private static MAX_INDIVIDUAL_VARIANCE = 0.7;\n\n private static CODE_SHIFT = 98;\n\n private static CODE_CODE_C = 99;\n private static CODE_CODE_B = 100;\n private static CODE_CODE_A = 101;\n\n private static CODE_FNC_1 = 102;\n private static CODE_FNC_2 = 97;\n private static CODE_FNC_3 = 96;\n private static CODE_FNC_4_A = 101;\n private static CODE_FNC_4_B = 100;\n\n private static CODE_START_A = 103;\n private static CODE_START_B = 104;\n private static CODE_START_C = 105;\n private static CODE_STOP = 106;\n\n private static findStartPattern(row: BitArray): number[] {\n const width = row.getSize();\n const rowOffset = row.getNextSet(0);\n\n let counterPosition = 0;\n const counters = [0, 0, 0, 0, 0, 0];\n let patternStart = rowOffset;\n let isWhite = false;\n const patternLength = 6;\n\n for (let i = rowOffset; i < width; i++) {\n if (row.get(i) !== isWhite) {\n counters[counterPosition]++;\n } else {\n if (counterPosition === (patternLength - 1)) {\n let bestVariance = Code128Reader.MAX_AVG_VARIANCE;\n let bestMatch = -1;\n for (let startCode = Code128Reader.CODE_START_A; startCode <= Code128Reader.CODE_START_C; startCode++) {\n const variance = OneDReader.patternMatchVariance(counters,\n Code128Reader.CODE_PATTERNS[startCode], Code128Reader.MAX_INDIVIDUAL_VARIANCE);\n if (variance < bestVariance) {\n bestVariance = variance;\n bestMatch = startCode;\n }\n }\n // Look for whitespace before start pattern, >= 50% of width of start pattern\n if (bestMatch >= 0 &&\n row.isRange(Math.max(0, patternStart - (i - patternStart) / 2), patternStart, false)) {\n return [patternStart, i, bestMatch];\n }\n patternStart += counters[0] + counters[1];\n\n counters.splice(0, 2);\n counters[counterPosition - 1] = 0;\n counters[counterPosition] = 0;\n counterPosition--;\n } else {\n counterPosition++;\n }\n counters[counterPosition] = 1;\n isWhite = !isWhite;\n }\n }\n throw new NotFoundException();\n }\n\n private static decodeCode(row: BitArray, counters: number[], rowOffset: number): number {\n OneDReader.recordPattern(row, rowOffset, counters);\n let bestVariance = Code128Reader.MAX_AVG_VARIANCE; // worst variance we'll accept\n let bestMatch = -1;\n for (let d = 0; d < Code128Reader.CODE_PATTERNS.length; d++) {\n const pattern = Code128Reader.CODE_PATTERNS[d];\n const variance = this.patternMatchVariance(counters, pattern, Code128Reader.MAX_INDIVIDUAL_VARIANCE);\n if (variance < bestVariance) {\n bestVariance = variance;\n bestMatch = d;\n }\n }\n // TODO We're overlooking the fact that the STOP pattern has 7 values, not 6.\n if (bestMatch >= 0) {\n return bestMatch;\n } else {\n throw new NotFoundException();\n }\n }\n\n public decodeRow(rowNumber: number, row: BitArray, hints?: Map): Result {\n const convertFNC1 = hints && (hints.get(DecodeHintType.ASSUME_GS1) === true);\n\n const startPatternInfo = Code128Reader.findStartPattern(row);\n const startCode = startPatternInfo[2];\n\n let currentRawCodesIndex = 0;\n const rawCodes: Uint8Array = new Uint8Array(20);\n rawCodes[currentRawCodesIndex++] = startCode;\n\n let codeSet;\n switch (startCode) {\n case Code128Reader.CODE_START_A:\n codeSet = Code128Reader.CODE_CODE_A;\n break;\n case Code128Reader.CODE_START_B:\n codeSet = Code128Reader.CODE_CODE_B;\n break;\n case Code128Reader.CODE_START_C:\n codeSet = Code128Reader.CODE_CODE_C;\n break;\n default:\n throw new FormatException();\n }\n\n let done = false;\n let isNextShifted = false;\n\n let result = '';\n\n let lastStart = startPatternInfo[0];\n let nextStart = startPatternInfo[1];\n const counters: number[] = [0, 0, 0, 0, 0, 0];\n\n let lastCode = 0;\n let code = 0;\n let checksumTotal = startCode;\n let multiplier = 0;\n let lastCharacterWasPrintable = true;\n let upperMode = false;\n let shiftUpperMode = false;\n\n while (!done) {\n\n const unshift = isNextShifted;\n isNextShifted = false;\n\n // Save off last code\n lastCode = code;\n\n // Decode another code from image\n code = Code128Reader.decodeCode(row, counters, nextStart);\n\n rawCodes[currentRawCodesIndex++] = code;\n\n // Remember whether the last code was printable or not (excluding CODE_STOP)\n if (code !== Code128Reader.CODE_STOP) {\n lastCharacterWasPrintable = true;\n }\n\n // Add to checksum computation (if not CODE_STOP of course)\n if (code !== Code128Reader.CODE_STOP) {\n multiplier++;\n checksumTotal += multiplier * code;\n }\n\n // Advance to where the next code will to start\n lastStart = nextStart;\n nextStart += counters.reduce((previous, current) => previous + current, 0);\n\n // Take care of illegal start codes\n switch (code) {\n case Code128Reader.CODE_START_A:\n case Code128Reader.CODE_START_B:\n case Code128Reader.CODE_START_C:\n throw new FormatException();\n }\n\n switch (codeSet) {\n\n case Code128Reader.CODE_CODE_A:\n if (code < 64) {\n if (shiftUpperMode === upperMode) {\n result += String.fromCharCode((' '.charCodeAt(0) + code));\n } else {\n result += String.fromCharCode((' '.charCodeAt(0) + code + 128));\n }\n shiftUpperMode = false;\n } else if (code < 96) {\n if (shiftUpperMode === upperMode) {\n result += String.fromCharCode((code - 64));\n } else {\n result += String.fromCharCode((code + 64));\n }\n shiftUpperMode = false;\n } else {\n // Don't let CODE_STOP, which always appears, affect whether whether we think the last\n // code was printable or not.\n if (code !== Code128Reader.CODE_STOP) {\n lastCharacterWasPrintable = false;\n }\n switch (code) {\n case Code128Reader.CODE_FNC_1:\n if (convertFNC1) {\n if (result.length === 0) {\n // GS1 specification 5.4.3.7. and 5.4.6.4. If the first char after the start code\n // is FNC1 then this is GS1-128. We add the symbology identifier.\n result += ']C1';\n } else {\n // GS1 specification 5.4.7.5. Every subsequent FNC1 is returned as ASCII 29 (GS)\n result += String.fromCharCode(29);\n }\n }\n break;\n case Code128Reader.CODE_FNC_2:\n case Code128Reader.CODE_FNC_3:\n // do nothing?\n break;\n case Code128Reader.CODE_FNC_4_A:\n if (!upperMode && shiftUpperMode) {\n upperMode = true;\n shiftUpperMode = false;\n } else if (upperMode && shiftUpperMode) {\n upperMode = false;\n shiftUpperMode = false;\n } else {\n shiftUpperMode = true;\n }\n break;\n case Code128Reader.CODE_SHIFT:\n isNextShifted = true;\n codeSet = Code128Reader.CODE_CODE_B;\n break;\n case Code128Reader.CODE_CODE_B:\n codeSet = Code128Reader.CODE_CODE_B;\n break;\n case Code128Reader.CODE_CODE_C:\n codeSet = Code128Reader.CODE_CODE_C;\n break;\n case Code128Reader.CODE_STOP:\n done = true;\n break;\n }\n }\n break;\n case Code128Reader.CODE_CODE_B:\n if (code < 96) {\n if (shiftUpperMode === upperMode) {\n result += String.fromCharCode((' '.charCodeAt(0) + code));\n } else {\n result += String.fromCharCode((' '.charCodeAt(0) + code + 128));\n }\n shiftUpperMode = false;\n } else {\n if (code !== Code128Reader.CODE_STOP) {\n lastCharacterWasPrintable = false;\n }\n switch (code) {\n case Code128Reader.CODE_FNC_1:\n if (convertFNC1) {\n if (result.length === 0) {\n // GS1 specification 5.4.3.7. and 5.4.6.4. If the first char after the start code\n // is FNC1 then this is GS1-128. We add the symbology identifier.\n result += ']C1';\n } else {\n // GS1 specification 5.4.7.5. Every subsequent FNC1 is returned as ASCII 29 (GS)\n result += String.fromCharCode(29);\n }\n }\n break;\n case Code128Reader.CODE_FNC_2:\n case Code128Reader.CODE_FNC_3:\n // do nothing?\n break;\n case Code128Reader.CODE_FNC_4_B:\n if (!upperMode && shiftUpperMode) {\n upperMode = true;\n shiftUpperMode = false;\n } else if (upperMode && shiftUpperMode) {\n upperMode = false;\n shiftUpperMode = false;\n } else {\n shiftUpperMode = true;\n }\n break;\n case Code128Reader.CODE_SHIFT:\n isNextShifted = true;\n codeSet = Code128Reader.CODE_CODE_A;\n break;\n case Code128Reader.CODE_CODE_A:\n codeSet = Code128Reader.CODE_CODE_A;\n break;\n case Code128Reader.CODE_CODE_C:\n codeSet = Code128Reader.CODE_CODE_C;\n break;\n case Code128Reader.CODE_STOP:\n done = true;\n break;\n }\n }\n break;\n case Code128Reader.CODE_CODE_C:\n if (code < 100) {\n if (code < 10) {\n result += '0';\n }\n result += code;\n } else {\n if (code !== Code128Reader.CODE_STOP) {\n lastCharacterWasPrintable = false;\n }\n switch (code) {\n case Code128Reader.CODE_FNC_1:\n if (convertFNC1) {\n if (result.length === 0) {\n // GS1 specification 5.4.3.7. and 5.4.6.4. If the first char after the start code\n // is FNC1 then this is GS1-128. We add the symbology identifier.\n result += ']C1';\n } else {\n // GS1 specification 5.4.7.5. Every subsequent FNC1 is returned as ASCII 29 (GS)\n result += String.fromCharCode(29);\n }\n }\n break;\n case Code128Reader.CODE_CODE_A:\n codeSet = Code128Reader.CODE_CODE_A;\n break;\n case Code128Reader.CODE_CODE_B:\n codeSet = Code128Reader.CODE_CODE_B;\n break;\n case Code128Reader.CODE_STOP:\n done = true;\n break;\n }\n }\n break;\n }\n\n // Unshift back to another code set if we were shifted\n if (unshift) {\n codeSet = codeSet === Code128Reader.CODE_CODE_A ? Code128Reader.CODE_CODE_B : Code128Reader.CODE_CODE_A;\n }\n\n }\n\n const lastPatternSize = nextStart - lastStart;\n\n // Check for ample whitespace following pattern, but, to do this we first need to remember that\n // we fudged decoding CODE_STOP since it actually has 7 bars, not 6. There is a black bar left\n // to read off. Would be slightly better to properly read. Here we just skip it:\n nextStart = row.getNextUnset(nextStart);\n if (!row.isRange(nextStart,\n Math.min(row.getSize(), nextStart + (nextStart - lastStart) / 2),\n false)) {\n throw new NotFoundException();\n }\n\n // Pull out from sum the value of the penultimate check code\n checksumTotal -= multiplier * lastCode;\n // lastCode is the checksum then:\n if (checksumTotal % 103 !== lastCode) {\n throw new ChecksumException();\n }\n\n // Need to pull out the check digits from string\n const resultLength = result.length;\n if (resultLength === 0) {\n // false positive\n throw new NotFoundException();\n }\n\n // Only bother if the result had at least one character, and if the checksum digit happened to\n // be a printable character. If it was just interpreted as a control code, nothing to remove.\n if (resultLength > 0 && lastCharacterWasPrintable) {\n if (codeSet === Code128Reader.CODE_CODE_C) {\n result = result.substring(0, resultLength - 2);\n } else {\n result = result.substring(0, resultLength - 1);\n }\n }\n\n const left = (startPatternInfo[1] + startPatternInfo[0]) / 2.0;\n const right = lastStart + lastPatternSize / 2.0;\n\n const rawCodesSize = rawCodes.length;\n const rawBytes: Uint8Array = new Uint8Array(rawCodesSize);\n\n for (let i = 0; i < rawCodesSize; i++) {\n rawBytes[i] = rawCodes[i];\n }\n\n const points: ResultPoint[] = [new ResultPoint(left, rowNumber), new ResultPoint(right, rowNumber)];\n\n return new Result(result, rawBytes, 0, points, BarcodeFormat.CODE_128, new Date().getTime());\n }\n}\n","import AbstractRSSReader from './AbstractRSSReader';\nimport Pair from './Pair';\nimport Result from '../../Result';\nimport BitArray from '../../common/BitArray';\nimport DecodeHintType from '../../DecodeHintType';\nimport NotFoundException from '../../NotFoundException';\nimport StringBuilder from '../../util/StringBuilder';\nimport BarcodeFormat from '../../BarcodeFormat';\nimport ResultPointCallback from '../../ResultPointCallback';\nimport ResultPoint from '../../ResultPoint';\nimport FinderPattern from './FinderPattern';\nimport DataCharacter from './DataCharacter';\nimport MathUtils from '../../common/detector/MathUtils';\nimport RSSUtils from './RSSUtils';\nimport System from '../../util/System';\nimport OneDReader from '../OneDReader';\n\nexport default class RSS14Reader extends AbstractRSSReader {\n\n private static readonly OUTSIDE_EVEN_TOTAL_SUBSET: number[] = [1, 10, 34, 70, 126];\n private static readonly INSIDE_ODD_TOTAL_SUBSET: number[] = [4, 20, 48, 81];\n private static readonly OUTSIDE_GSUM: number[] = [0, 161, 961, 2015, 2715];\n private static readonly INSIDE_GSUM: number[] = [0, 336, 1036, 1516];\n private static readonly OUTSIDE_ODD_WIDEST: number[] = [8, 6, 4, 3, 1];\n private static readonly INSIDE_ODD_WIDEST: number[] = [2, 4, 6, 8];\n\n private static readonly FINDER_PATTERNS: number[][] = [\n [ 3, 8, 2, 1 ],\n [ 3, 5, 5, 1 ],\n [ 3, 3, 7, 1 ],\n [ 3, 1, 9, 1 ],\n [ 2, 7, 4, 1 ],\n [ 2, 5, 6, 1 ],\n [ 2, 3, 8, 1 ],\n [ 1, 5, 7, 1 ],\n [ 1, 3, 9, 1 ],\n ];\n\n private readonly possibleLeftPairs: Pair[] = [];\n private readonly possibleRightPairs: Pair[] = [];\n\n public decodeRow(rowNumber: number, row: BitArray, hints?: Map): Result {\n const leftPair = this.decodePair(row, false, rowNumber, hints);\n RSS14Reader.addOrTally(this.possibleLeftPairs, leftPair);\n row.reverse();\n let rightPair = this.decodePair(row, true, rowNumber, hints);\n RSS14Reader.addOrTally(this.possibleRightPairs, rightPair);\n row.reverse();\n for (let left of this.possibleLeftPairs) {\n if (left.getCount() > 1) {\n for (let right of this.possibleRightPairs) {\n if (right.getCount() > 1 && RSS14Reader.checkChecksum(left, right)) {\n return RSS14Reader.constructResult(left, right);\n }\n }\n }\n }\n throw new NotFoundException();\n }\n\n private static addOrTally(possiblePairs: Pair[], pair: Pair) {\n if (pair == null) {\n return;\n }\n let found = false;\n for (let other of possiblePairs) {\n if (other.getValue() === pair.getValue()) {\n other.incrementCount();\n found = true;\n break;\n }\n }\n if (!found) {\n possiblePairs.push(pair);\n }\n }\n\n public reset() {\n this.possibleLeftPairs.length = 0;\n this.possibleRightPairs.length = 0;\n }\n\n private static constructResult(leftPair: Pair, rightPair: Pair): Result {\n let symbolValue = 4537077 * leftPair.getValue() + rightPair.getValue();\n let text = new String(symbolValue).toString();\n\n let buffer = new StringBuilder();\n for (let i = 13 - text.length; i > 0; i--) {\n buffer.append('0');\n }\n buffer.append(text);\n\n let checkDigit = 0;\n for (let i = 0; i < 13; i++) {\n let digit = buffer.charAt(i).charCodeAt(0) - '0'.charCodeAt(0);\n checkDigit += ((i & 0x01) === 0) ? 3 * digit : digit;\n }\n checkDigit = 10 - (checkDigit % 10);\n if (checkDigit === 10) {\n checkDigit = 0;\n }\n buffer.append(checkDigit.toString());\n\n let leftPoints = leftPair.getFinderPattern().getResultPoints();\n let rightPoints = rightPair.getFinderPattern().getResultPoints();\n return new Result(buffer.toString(), null, 0, [leftPoints[0], leftPoints[1], rightPoints[0], rightPoints[1]], BarcodeFormat.RSS_14, new Date().getTime());\n }\n\n private static checkChecksum(leftPair: Pair, rightPair: Pair): boolean {\n let checkValue = (leftPair.getChecksumPortion() + 16 * rightPair.getChecksumPortion()) % 79;\n let targetCheckValue =\n 9 * leftPair.getFinderPattern().getValue() + rightPair.getFinderPattern().getValue();\n if (targetCheckValue > 72) {\n targetCheckValue--;\n }\n if (targetCheckValue > 8) {\n targetCheckValue--;\n }\n return checkValue === targetCheckValue;\n }\n\n private decodePair(row: BitArray, right: boolean, rowNumber: number, hints: Map): Pair {\n try {\n let startEnd = this.findFinderPattern(row, right);\n let pattern = this.parseFoundFinderPattern(row, rowNumber, right, startEnd);\n\n let resultPointCallback = hints == null ? null : hints.get(DecodeHintType.NEED_RESULT_POINT_CALLBACK);\n\n if (resultPointCallback != null) {\n let center = (startEnd[0] + startEnd[1]) / 2.0;\n if (right) {\n // row is actually reversed\n center = row.getSize() - 1 - center;\n }\n resultPointCallback.foundPossibleResultPoint(new ResultPoint(center, rowNumber));\n }\n\n let outside = this.decodeDataCharacter(row, pattern, true);\n let inside = this.decodeDataCharacter(row, pattern, false);\n return new Pair(1597 * outside.getValue() + inside.getValue(),\n outside.getChecksumPortion() + 4 * inside.getChecksumPortion(),\n pattern);\n }\n catch (err) {\n return null;\n }\n }\n\n private decodeDataCharacter(row: BitArray, pattern: FinderPattern, outsideChar: boolean): DataCharacter {\n\n let counters = this.getDataCharacterCounters();\n for (let x = 0; x < counters.length; x++) {\n counters[x] = 0;\n }\n\n if (outsideChar) {\n OneDReader.recordPatternInReverse(row, pattern.getStartEnd()[0], counters);\n } else {\n OneDReader.recordPattern(row, pattern.getStartEnd()[1] + 1, counters);\n // reverse it\n for (let i = 0, j = counters.length - 1; i < j; i++ , j--) {\n let temp = counters[i];\n counters[i] = counters[j];\n counters[j] = temp;\n }\n }\n\n let numModules = outsideChar ? 16 : 15;\n let elementWidth = MathUtils.sum(new Int32Array(counters)) / numModules;\n\n let oddCounts = this.getOddCounts();\n let evenCounts = this.getEvenCounts();\n let oddRoundingErrors = this.getOddRoundingErrors();\n let evenRoundingErrors = this.getEvenRoundingErrors();\n\n for (let i = 0; i < counters.length; i++) {\n let value = counters[i] / elementWidth;\n let count = Math.floor(value + 0.5);\n if (count < 1) {\n count = 1;\n } else if (count > 8) {\n count = 8;\n }\n let offset = Math.floor(i / 2);\n if ((i & 0x01) === 0) {\n oddCounts[offset] = count;\n oddRoundingErrors[offset] = value - count;\n } else {\n evenCounts[offset] = count;\n evenRoundingErrors[offset] = value - count;\n }\n }\n\n this.adjustOddEvenCounts(outsideChar, numModules);\n\n let oddSum = 0;\n let oddChecksumPortion = 0;\n for (let i = oddCounts.length - 1; i >= 0; i--) {\n oddChecksumPortion *= 9;\n oddChecksumPortion += oddCounts[i];\n oddSum += oddCounts[i];\n }\n let evenChecksumPortion = 0;\n let evenSum = 0;\n for (let i = evenCounts.length - 1; i >= 0; i--) {\n evenChecksumPortion *= 9;\n evenChecksumPortion += evenCounts[i];\n evenSum += evenCounts[i];\n }\n let checksumPortion = oddChecksumPortion + 3 * evenChecksumPortion;\n\n if (outsideChar) {\n if ((oddSum & 0x01) !== 0 || oddSum > 12 || oddSum < 4) {\n throw new NotFoundException();\n }\n let group = (12 - oddSum) / 2;\n let oddWidest = RSS14Reader.OUTSIDE_ODD_WIDEST[group];\n let evenWidest = 9 - oddWidest;\n let vOdd = RSSUtils.getRSSvalue(oddCounts, oddWidest, false);\n let vEven = RSSUtils.getRSSvalue(evenCounts, evenWidest, true);\n let tEven = RSS14Reader.OUTSIDE_EVEN_TOTAL_SUBSET[group];\n let gSum = RSS14Reader.OUTSIDE_GSUM[group];\n return new DataCharacter(vOdd * tEven + vEven + gSum, checksumPortion);\n } else {\n if ((evenSum & 0x01) !== 0 || evenSum > 10 || evenSum < 4) {\n throw new NotFoundException();\n }\n let group = (10 - evenSum) / 2;\n let oddWidest = RSS14Reader.INSIDE_ODD_WIDEST[group];\n let evenWidest = 9 - oddWidest;\n let vOdd = RSSUtils.getRSSvalue(oddCounts, oddWidest, true);\n let vEven = RSSUtils.getRSSvalue(evenCounts, evenWidest, false);\n let tOdd = RSS14Reader.INSIDE_ODD_TOTAL_SUBSET[group];\n let gSum = RSS14Reader.INSIDE_GSUM[group];\n return new DataCharacter(vEven * tOdd + vOdd + gSum, checksumPortion);\n }\n\n }\n\n private findFinderPattern(row: BitArray, rightFinderPattern: boolean): number[] {\n\n let counters = this.getDecodeFinderCounters();\n counters[0] = 0;\n counters[1] = 0;\n counters[2] = 0;\n counters[3] = 0;\n\n let width = row.getSize();\n let isWhite = false;\n let rowOffset = 0;\n while (rowOffset < width) {\n isWhite = !row.get(rowOffset);\n if (rightFinderPattern === isWhite) {\n // Will encounter white first when searching for right finder pattern\n break;\n }\n rowOffset++;\n }\n\n let counterPosition = 0;\n let patternStart = rowOffset;\n for (let x = rowOffset; x < width; x++) {\n if (row.get(x) !== isWhite) {\n counters[counterPosition]++;\n } else {\n if (counterPosition === 3) {\n if (AbstractRSSReader.isFinderPattern(counters)) {\n return [patternStart, x ];\n }\n patternStart += counters[0] + counters[1];\n counters[0] = counters[2];\n counters[1] = counters[3];\n counters[2] = 0;\n counters[3] = 0;\n counterPosition--;\n } else {\n counterPosition++;\n }\n counters[counterPosition] = 1;\n isWhite = !isWhite;\n }\n }\n throw new NotFoundException();\n }\n\n private parseFoundFinderPattern(row: BitArray, rowNumber: number, right: boolean, startEnd: number[]): FinderPattern {\n // Actually we found elements 2-5\n let firstIsBlack = row.get(startEnd[0]);\n let firstElementStart = startEnd[0] - 1;\n // Locate element 1\n while (firstElementStart >= 0 && firstIsBlack !== row.get(firstElementStart)) {\n firstElementStart--;\n }\n firstElementStart++;\n let firstCounter = startEnd[0] - firstElementStart;\n // Make 'counters' hold 1-4\n let counters = this.getDecodeFinderCounters();\n let copy = new Array(counters.length);\n System.arraycopy(counters, 0, copy, 1, counters.length - 1);\n copy[0] = firstCounter;\n let value = this.parseFinderValue(copy, RSS14Reader.FINDER_PATTERNS);\n let start = firstElementStart;\n let end = startEnd[1];\n if (right) {\n // row is actually reversed\n start = row.getSize() - 1 - start;\n end = row.getSize() - 1 - end;\n }\n return new FinderPattern(value, [ firstElementStart, startEnd[1] ], start, end, rowNumber);\n }\n\n private adjustOddEvenCounts(outsideChar: boolean, numModules: number) {\n\n let oddSum = MathUtils.sum(new Int32Array(this.getOddCounts()));\n let evenSum = MathUtils.sum(new Int32Array(this.getEvenCounts()));\n\n let incrementOdd = false;\n let decrementOdd = false;\n let incrementEven = false;\n let decrementEven = false;\n\n if (outsideChar) {\n if (oddSum > 12) {\n decrementOdd = true;\n }\n else if (oddSum < 4) {\n incrementOdd = true;\n }\n if (evenSum > 12) {\n decrementEven = true;\n }\n else if (evenSum < 4) {\n incrementEven = true;\n }\n }\n else {\n if (oddSum > 11) {\n decrementOdd = true;\n }\n else if (oddSum < 5) {\n incrementOdd = true;\n }\n if (evenSum > 10) {\n decrementEven = true;\n }\n else if (evenSum < 4) {\n incrementEven = true;\n }\n }\n\n let mismatch = oddSum + evenSum - numModules;\n let oddParityBad = (oddSum & 0x01) === (outsideChar ? 1 : 0);\n let evenParityBad = (evenSum & 0x01) === 1;\n if (mismatch === 1) {\n if (oddParityBad) {\n if (evenParityBad) {\n throw new NotFoundException();\n }\n decrementOdd = true;\n } else {\n if (!evenParityBad) {\n throw new NotFoundException();\n }\n decrementEven = true;\n }\n } else if (mismatch === -1) {\n if (oddParityBad) {\n if (evenParityBad) {\n throw new NotFoundException();\n }\n incrementOdd = true;\n } else {\n if (!evenParityBad) {\n throw new NotFoundException();\n }\n incrementEven = true;\n }\n }\n else if (mismatch === 0) {\n if (oddParityBad) {\n if (!evenParityBad) {\n throw new NotFoundException();\n }\n // Both bad\n if (oddSum < evenSum) {\n incrementOdd = true;\n decrementEven = true;\n } else {\n decrementOdd = true;\n incrementEven = true;\n }\n }\n else {\n if (evenParityBad) {\n throw new NotFoundException();\n }\n // Nothing to do!\n }\n }\n else {\n throw new NotFoundException();\n }\n\n if (incrementOdd) {\n if (decrementOdd) {\n throw new NotFoundException();\n }\n AbstractRSSReader.increment(this.getOddCounts(), this.getOddRoundingErrors());\n }\n if (decrementOdd) {\n AbstractRSSReader.decrement(this.getOddCounts(), this.getOddRoundingErrors());\n }\n if (incrementEven) {\n if (decrementEven) {\n throw new NotFoundException();\n }\n AbstractRSSReader.increment(this.getEvenCounts(), this.getOddRoundingErrors());\n }\n if (decrementEven) {\n AbstractRSSReader.decrement(this.getEvenCounts(), this.getEvenRoundingErrors());\n }\n }\n}\n","import OneDReader from '../OneDReader';\nimport NotFoundException from '../../NotFoundException';\nimport MathUtils from '../../common/detector/MathUtils';\nimport Integer from '../../util/Integer';\nimport Float from '../../util/Float';\n\nexport default abstract class AbstractRSSReader extends OneDReader {\n\n private static readonly MAX_AVG_VARIANCE: number = 0.2;\n private static readonly MAX_INDIVIDUAL_VARIANCE: number = 0.45;\n\n private static readonly MIN_FINDER_PATTERN_RATIO: number = 9.5 / 12.0;\n private static readonly MAX_FINDER_PATTERN_RATIO: number = 12.5 / 14.0;\n\n private readonly decodeFinderCounters: number[];\n private readonly dataCharacterCounters: number[];\n private readonly oddRoundingErrors: number[];\n private readonly evenRoundingErrors: number[];\n private readonly oddCounts: number[];\n private readonly evenCounts: number[];\n\n public constructor() {\n super();\n this.decodeFinderCounters = new Array(4);\n this.dataCharacterCounters = new Array(8);\n this.oddRoundingErrors = new Array(4);\n this.evenRoundingErrors = new Array(4);\n this.oddCounts = new Array(this.dataCharacterCounters.length / 2);\n this.evenCounts = new Array(this.dataCharacterCounters.length / 2);\n }\n\n protected getDecodeFinderCounters(): number[] {\n return this.decodeFinderCounters;\n }\n\n protected getDataCharacterCounters(): number[] {\n return this.dataCharacterCounters;\n }\n\n protected getOddRoundingErrors(): number[] {\n return this.oddRoundingErrors;\n }\n\n protected getEvenRoundingErrors(): number[] {\n return this.evenRoundingErrors;\n }\n\n protected getOddCounts(): number[] {\n return this.oddCounts;\n }\n\n protected getEvenCounts(): number[] {\n return this.evenCounts;\n }\n\n protected parseFinderValue(counters: number[], finderPatterns: number[][]): number {\n for (let value = 0; value < finderPatterns.length; value++) {\n if (OneDReader.patternMatchVariance(counters, finderPatterns[value], AbstractRSSReader.MAX_INDIVIDUAL_VARIANCE) < AbstractRSSReader.MAX_AVG_VARIANCE) {\n return value;\n }\n }\n throw new NotFoundException();\n }\n\n /**\n * @param array values to sum\n * @return sum of values\n * @deprecated call {@link MathUtils#sum(int[])}\n */\n protected static count(array: number[]) {\n return MathUtils.sum(new Int32Array(array));\n }\n\n protected static increment(array: number[], errors: number[]) {\n let index = 0;\n let biggestError = errors[0];\n for (let i = 1; i < array.length; i++) {\n if (errors[i] > biggestError) {\n biggestError = errors[i];\n index = i;\n }\n }\n array[index]++;\n }\n\n protected static decrement(array: number[], errors: number[]) {\n let index = 0;\n let biggestError = errors[0];\n for (let i = 1; i < array.length; i++) {\n if (errors[i] < biggestError) {\n biggestError = errors[i];\n index = i;\n }\n }\n array[index]--;\n }\n\n protected static isFinderPattern(counters: number[]): boolean {\n let firstTwoSum = counters[0] + counters[1];\n let sum = firstTwoSum + counters[2] + counters[3];\n let ratio = firstTwoSum / sum;\n if (ratio >= AbstractRSSReader.MIN_FINDER_PATTERN_RATIO && ratio <= AbstractRSSReader.MAX_FINDER_PATTERN_RATIO) {\n // passes ratio test in spec, but see if the counts are unreasonable\n let minCounter = Number.MAX_SAFE_INTEGER;\n let maxCounter = Number.MIN_SAFE_INTEGER;\n for (let counter of counters) {\n if (counter > maxCounter) {\n maxCounter = counter;\n }\n if (counter < minCounter) {\n minCounter = counter;\n }\n }\n return maxCounter < 10 * minCounter;\n }\n return false;\n }\n}\n","\nimport ResultPoint from '../../ResultPoint';\n\nexport default class FinderPattern {\n\n private resultPoints: Array;\n\n public constructor(private value: number, private startEnd: number[], start: number, end: number, rowNumber: number) {\n this.value = value;\n this.startEnd = startEnd;\n this.resultPoints = new Array();\n this.resultPoints.push(new ResultPoint(start, rowNumber));\n this.resultPoints.push(new ResultPoint(end, rowNumber));\n }\n\n public getValue(): number {\n return this.value;\n }\n\n public getStartEnd(): number[] {\n return this.startEnd;\n }\n\n public getResultPoints(): Array {\n return this.resultPoints;\n }\n\n public equals(o: object): boolean {\n if (!(o instanceof FinderPattern)) {\n return false;\n }\n const that = o;\n return this.value === that.value;\n }\n\n public hashCode(): number {\n return this.value;\n }\n}\n","/**\n * RSS util functions.\n */\nexport default class RSSUtils {\n\n private RSSUtils() { }\n\n public static getRSSvalue(widths: number[], maxWidth: number, noNarrow: boolean): number {\n let n = 0;\n for (let width of widths) {\n n += width;\n }\n let val = 0;\n let narrowMask = 0;\n let elements = widths.length;\n for (let bar = 0; bar < elements - 1; bar++) {\n let elmWidth;\n for (elmWidth = 1, narrowMask |= 1 << bar; elmWidth < widths[bar]; elmWidth++ , narrowMask &= ~(1 << bar)) {\n let subVal = RSSUtils.combins(n - elmWidth - 1, elements - bar - 2);\n if (noNarrow && (narrowMask === 0) && (n - elmWidth - (elements - bar - 1) >= elements - bar - 1)) {\n subVal -= RSSUtils.combins(n - elmWidth - (elements - bar), elements - bar - 2);\n }\n if (elements - bar - 1 > 1) {\n let lessVal = 0;\n for (let mxwElement = n - elmWidth - (elements - bar - 2); mxwElement > maxWidth; mxwElement--) {\n lessVal += RSSUtils.combins(n - elmWidth - mxwElement - 1, elements - bar - 3);\n }\n subVal -= lessVal * (elements - 1 - bar);\n } else if (n - elmWidth > maxWidth) {\n subVal--;\n }\n val += subVal;\n }\n n -= elmWidth;\n }\n return val;\n }\n\n private static combins(n: number, r: number): number {\n let maxDenom;\n let minDenom;\n if (n - r > r) {\n minDenom = r;\n maxDenom = n - r;\n } else {\n minDenom = n - r;\n maxDenom = r;\n }\n let val = 1;\n let j = 1;\n for (let i: number = n; i > maxDenom; i--) {\n val *= i;\n if (j <= minDenom) {\n val /= j;\n j++;\n }\n }\n while ((j <= minDenom)) {\n val /= j;\n j++;\n }\n return val;\n }\n}\n","/*\n * Copyright 2008 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*namespace com.google.zxing.oned {*/\n\nimport BarcodeFormat from '../BarcodeFormat';\nimport BitArray from '../common/BitArray';\nimport DecodeHintType from '../DecodeHintType';\n\nimport Result from '../Result';\nimport ResultPoint from '../ResultPoint';\nimport OneDReader from './OneDReader';\nimport StringBuilder from '../util/StringBuilder';\nimport System from '../util/System';\nimport FormatException from '../FormatException';\nimport NotFoundException from '../NotFoundException';\n\n/**\n *

Decodes ITF barcodes.

\n *\n * @author Tjieco\n */\nexport default class ITFReader extends OneDReader {\n\n private static W = 3; // Pixel width of a 3x wide line\n private static w = 2; // Pixel width of a 2x wide line\n private static N = 1; // Pixed width of a narrow line\n\n private static PATTERNS: number[][] = [\n [1, 1, 2, 2, 1], // 0\n [2, 1, 1, 1, 2], // 1\n [1, 2, 1, 1, 2], // 2\n [2, 2, 1, 1, 1], // 3\n [1, 1, 2, 1, 2], // 4\n [2, 1, 2, 1, 1], // 5\n [1, 2, 2, 1, 1], // 6\n [1, 1, 1, 2, 2], // 7\n [2, 1, 1, 2, 1], // 8\n [1, 2, 1, 2, 1], // 9\n [1, 1, 3, 3, 1], // 0\n [3, 1, 1, 1, 3], // 1\n [1, 3, 1, 1, 3], // 2\n [3, 3, 1, 1, 1], // 3\n [1, 1, 3, 1, 3], // 4\n [3, 1, 3, 1, 1], // 5\n [1, 3, 3, 1, 1], // 6\n [1, 1, 1, 3, 3], // 7\n [3, 1, 1, 3, 1], // 8\n [1, 3, 1, 3, 1] // 9\n ];\n\n private static MAX_AVG_VARIANCE = 0.38;\n private static MAX_INDIVIDUAL_VARIANCE = 0.5;\n\n\n\n /* /!** Valid ITF lengths. Anything longer than the largest value is also allowed. *!/*/\n private static DEFAULT_ALLOWED_LENGTHS: number[] = [6, 8, 10, 12, 14];\n\n // Stores the actual narrow line width of the image being decoded.\n private narrowLineWidth = -1;\n\n /*/!**\n * Start/end guard pattern.\n *\n * Note: The end pattern is reversed because the row is reversed before\n * searching for the END_PATTERN\n *!/*/\n private static START_PATTERN = [1, 1, 1, 1];\n private static END_PATTERN_REVERSED: number[][] = [\n [1, 1, 2], // 2x\n [1, 1, 3] // 3x\n ];\n\n // See ITFWriter.PATTERNS\n /*\n\n /!**\n * Patterns of Wide / Narrow lines to indicate each digit\n *!/\n */\n\n public decodeRow(rowNumber: number, row: BitArray, hints?: Map): Result {\n\n // Find out where the Middle section (payload) starts & ends\n let startRange: number[] = this.decodeStart(row);\n let endRange: number[] = this.decodeEnd(row);\n\n let result: StringBuilder = new StringBuilder();\n ITFReader.decodeMiddle(row, startRange[1], endRange[0], result);\n let resultString: string = result.toString();\n\n let allowedLengths: number[] = null;\n if (hints != null) {\n allowedLengths = hints.get(DecodeHintType.ALLOWED_LENGTHS);\n\n }\n if (allowedLengths == null) {\n allowedLengths = ITFReader.DEFAULT_ALLOWED_LENGTHS;\n }\n\n // To avoid false positives with 2D barcodes (and other patterns), make\n // an assumption that the decoded string must be a 'standard' length if it's short\n let length: number = resultString.length;\n let lengthOK: boolean = false;\n let maxAllowedLength: number = 0;\n\n for (let value of allowedLengths) {\n if (length === value) {\n lengthOK = true;\n break;\n }\n if (value > maxAllowedLength) {\n maxAllowedLength = value;\n }\n }\n\n if (!lengthOK && length > maxAllowedLength) {\n lengthOK = true;\n }\n\n if (!lengthOK) {\n throw new FormatException();\n }\n\n const points: ResultPoint[] = [new ResultPoint(startRange[1], rowNumber), new ResultPoint(endRange[0], rowNumber)];\n\n let resultReturn: Result = new Result(\n resultString,\n null, // no natural byte representation for these barcodes\n 0,\n points,\n BarcodeFormat.ITF,\n new Date().getTime()\n );\n\n return resultReturn;\n }\n /*\n /!**\n * @param row row of black/white values to search\n * @param payloadStart offset of start pattern\n * @param resultString {@link StringBuilder} to append decoded chars to\n * @throws NotFoundException if decoding could not complete successfully\n *!/*/\n private static decodeMiddle(\n row: BitArray,\n payloadStart: number,\n payloadEnd: number,\n resultString: StringBuilder\n ) {\n\n // Digits are interleaved in pairs - 5 black lines for one digit, and the\n // 5\n // interleaved white lines for the second digit.\n // Therefore, need to scan 10 lines and then\n // split these into two arrays\n\n let counterDigitPair: number[] = new Array(10); // 10\n let counterBlack: number[] = new Array(5); // 5\n let counterWhite: number[] = new Array(5); // 5\n\n counterDigitPair.fill(0);\n counterBlack.fill(0);\n counterWhite.fill(0);\n\n while (payloadStart < payloadEnd) {\n\n // Get 10 runs of black/white.\n OneDReader.recordPattern(row, payloadStart, counterDigitPair);\n // Split them into each array\n for (let k = 0; k < 5; k++) {\n let twoK: number = 2 * k;\n counterBlack[k] = counterDigitPair[twoK];\n counterWhite[k] = counterDigitPair[twoK + 1];\n }\n\n let bestMatch: number = ITFReader.decodeDigit(counterBlack);\n resultString.append(bestMatch.toString());\n bestMatch = this.decodeDigit(counterWhite);\n resultString.append(bestMatch.toString());\n\n counterDigitPair.forEach(function(counterDigit) {\n payloadStart += counterDigit;\n });\n }\n }\n\n /*/!**\n * Identify where the start of the middle / payload section starts.\n *\n * @param row row of black/white values to search\n * @return Array, containing index of start of 'start block' and end of\n * 'start block'\n *!/*/\n private decodeStart(row: BitArray): number[] {\n\n let endStart = ITFReader.skipWhiteSpace(row);\n let startPattern: number[] = ITFReader.findGuardPattern(row, endStart, ITFReader.START_PATTERN);\n\n // Determine the width of a narrow line in pixels. We can do this by\n // getting the width of the start pattern and dividing by 4 because its\n // made up of 4 narrow lines.\n this.narrowLineWidth = (startPattern[1] - startPattern[0]) / 4;\n\n this.validateQuietZone(row, startPattern[0]);\n\n return startPattern;\n }\n\n /*/!**\n * The start & end patterns must be pre/post fixed by a quiet zone. This\n * zone must be at least 10 times the width of a narrow line. Scan back until\n * we either get to the start of the barcode or match the necessary number of\n * quiet zone pixels.\n *\n * Note: Its assumed the row is reversed when using this method to find\n * quiet zone after the end pattern.\n *\n * ref: http://www.barcode-1.net/i25code.html\n *\n * @param row bit array representing the scanned barcode.\n * @param startPattern index into row of the start or end pattern.\n * @throws NotFoundException if the quiet zone cannot be found\n *!/*/\n private validateQuietZone(row: BitArray, startPattern: number): void {\n\n let quietCount: number = this.narrowLineWidth * 10; // expect to find this many pixels of quiet zone\n\n // if there are not so many pixel at all let's try as many as possible\n quietCount = quietCount < startPattern ? quietCount : startPattern;\n\n for (let i = startPattern - 1; quietCount > 0 && i >= 0; i--) {\n if (row.get(i)) {\n break;\n }\n quietCount--;\n }\n if (quietCount !== 0) {\n // Unable to find the necessary number of quiet zone pixels.\n throw new NotFoundException();\n }\n }\n /*\n /!**\n * Skip all whitespace until we get to the first black line.\n *\n * @param row row of black/white values to search\n * @return index of the first black line.\n * @throws NotFoundException Throws exception if no black lines are found in the row\n *!/*/\n private static skipWhiteSpace(row: BitArray): number {\n\n const width = row.getSize();\n const endStart = row.getNextSet(0);\n\n if (endStart === width) {\n throw new NotFoundException();\n }\n\n return endStart;\n }\n\n /*/!**\n * Identify where the end of the middle / payload section ends.\n *\n * @param row row of black/white values to search\n * @return Array, containing index of start of 'end block' and end of 'end\n * block'\n *!/*/\n private decodeEnd(row: BitArray): number[] {\n\n // For convenience, reverse the row and then\n // search from 'the start' for the end block\n row.reverse();\n\n try {\n let endStart: number = ITFReader.skipWhiteSpace(row);\n let endPattern: number[];\n\n try {\n endPattern = ITFReader.findGuardPattern(row, endStart, ITFReader.END_PATTERN_REVERSED[0]);\n } catch (NotFoundException) {\n endPattern = ITFReader.findGuardPattern(row, endStart, ITFReader.END_PATTERN_REVERSED[1]);\n }\n\n // The start & end patterns must be pre/post fixed by a quiet zone. This\n // zone must be at least 10 times the width of a narrow line.\n // ref: http://www.barcode-1.net/i25code.html\n this.validateQuietZone(row, endPattern[0]);\n\n // Now recalculate the indices of where the 'endblock' starts & stops to\n // accommodate\n // the reversed nature of the search\n let temp = endPattern[0];\n endPattern[0] = row.getSize() - endPattern[1];\n endPattern[1] = row.getSize() - temp;\n\n return endPattern;\n\n } finally {\n // Put the row back the right way.\n row.reverse();\n }\n }\n\n /*\n /!**\n * @param row row of black/white values to search\n * @param rowOffset position to start search\n * @param pattern pattern of counts of number of black and white pixels that are\n * being searched for as a pattern\n * @return start/end horizontal offset of guard pattern, as an array of two\n * ints\n * @throws NotFoundException if pattern is not found\n *!/*/\n private static findGuardPattern(\n row: BitArray,\n rowOffset: number,\n pattern: number[]\n ): number[] {\n\n let patternLength: number = pattern.length;\n let counters: number[] = new Array(patternLength);\n let width: number = row.getSize();\n let isWhite: boolean = false;\n\n let counterPosition: number = 0;\n let patternStart: number = rowOffset;\n\n counters.fill(0);\n\n for (let x = rowOffset; x < width; x++) {\n if (row.get(x) !== isWhite) {\n counters[counterPosition]++;\n } else {\n if (counterPosition === patternLength - 1) {\n if (OneDReader.patternMatchVariance(counters, pattern, ITFReader.MAX_INDIVIDUAL_VARIANCE) < ITFReader.MAX_AVG_VARIANCE) {\n return [patternStart, x];\n }\n patternStart += counters[0] + counters[1];\n System.arraycopy(counters, 2, counters, 0, counterPosition - 1);\n counters[counterPosition - 1] = 0;\n counters[counterPosition] = 0;\n counterPosition--;\n } else {\n counterPosition++;\n }\n counters[counterPosition] = 1;\n isWhite = !isWhite;\n }\n }\n throw new NotFoundException();\n }\n\n /*/!**\n * Attempts to decode a sequence of ITF black/white lines into single\n * digit.\n *\n * @param counters the counts of runs of observed black/white/black/... values\n * @return The decoded digit\n * @throws NotFoundException if digit cannot be decoded\n *!/*/\n private static decodeDigit(counters: number[]): number {\n\n let bestVariance: number = ITFReader.MAX_AVG_VARIANCE; // worst variance we'll accept\n let bestMatch: number = -1;\n let max: number = ITFReader.PATTERNS.length;\n\n for (let i = 0; i < max; i++) {\n\n let pattern = ITFReader.PATTERNS[i];\n let variance: number = OneDReader.patternMatchVariance(counters, pattern, ITFReader.MAX_INDIVIDUAL_VARIANCE);\n\n if (variance < bestVariance) {\n bestVariance = variance;\n bestMatch = i;\n } else if (variance === bestVariance) {\n // if we find a second 'best match' with the same variance, we can not reliably report to have a suitable match\n bestMatch = -1;\n }\n }\n\n if (bestMatch >= 0) {\n return bestMatch % 10;\n } else {\n throw new NotFoundException();\n }\n }\n\n}\n","/*\n * Copyright 2008 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport BarcodeFormat from '../BarcodeFormat';\nimport BitArray from '../common/BitArray';\n\nimport UPCEANReader from './UPCEANReader';\nimport NotFoundException from '../NotFoundException';\n\n/**\n *

Implements decoding of the EAN-13 format.

\n *\n * @author dswitkin@google.com (Daniel Switkin)\n * @author Sean Owen\n * @author alasdair@google.com (Alasdair Mackintosh)\n */\nexport default class EAN13Reader extends UPCEANReader {\n private static FIRST_DIGIT_ENCODINGS: number[] = [0x00, 0x0B, 0x0D, 0xE, 0x13, 0x19, 0x1C, 0x15, 0x16, 0x1A];\n\n private decodeMiddleCounters: number[];\n\n public constructor() {\n super();\n this.decodeMiddleCounters = [0, 0, 0, 0];\n }\n\n public decodeMiddle(row: BitArray, startRange: number[], resultString: string) {\n let counters = this.decodeMiddleCounters;\n counters[0] = 0;\n counters[1] = 0;\n counters[2] = 0;\n counters[3] = 0;\n let end = row.getSize();\n let rowOffset = startRange[1];\n\n let lgPatternFound = 0;\n\n for (let x = 0; x < 6 && rowOffset < end; x++) {\n let bestMatch = UPCEANReader.decodeDigit(row, counters, rowOffset, UPCEANReader.L_AND_G_PATTERNS);\n resultString += String.fromCharCode(('0'.charCodeAt(0) + bestMatch % 10));\n for (let counter of counters) {\n rowOffset += counter;\n }\n if (bestMatch >= 10) {\n lgPatternFound |= 1 << (5 - x);\n }\n }\n\n resultString = EAN13Reader.determineFirstDigit(resultString, lgPatternFound);\n\n let middleRange = UPCEANReader.findGuardPattern(row, rowOffset, true, UPCEANReader.MIDDLE_PATTERN, new Array(UPCEANReader.MIDDLE_PATTERN.length).fill(0));\n rowOffset = middleRange[1];\n\n for (let x = 0; x < 6 && rowOffset < end; x++) {\n let bestMatch = UPCEANReader.decodeDigit(row, counters, rowOffset, UPCEANReader.L_PATTERNS);\n resultString += String.fromCharCode(('0'.charCodeAt(0) + bestMatch));\n for (let counter of counters) {\n rowOffset += counter;\n }\n }\n\n return {rowOffset, resultString};\n }\n\n public getBarcodeFormat(): BarcodeFormat {\n return BarcodeFormat.EAN_13;\n }\n\n static determineFirstDigit(resultString: string, lgPatternFound: number) {\n for (let d = 0; d < 10; d++) {\n if (lgPatternFound === this.FIRST_DIGIT_ENCODINGS[d]) {\n resultString = String.fromCharCode(('0'.charCodeAt(0) + d)) + resultString;\n return resultString;\n }\n }\n throw new NotFoundException();\n }\n}\n","/*\n * Copyright 2008 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport BarcodeFormat from '../BarcodeFormat';\nimport BitArray from '../common/BitArray';\nimport DecodeHintType from '../DecodeHintType';\n\nimport Result from '../Result';\nimport ResultMetadataType from '../ResultMetadataType';\nimport ResultPoint from '../ResultPoint';\nimport UPCEANExtensionSupport from './UPCEANExtensionSupport';\nimport AbstractUPCEANReader from './AbstractUPCEANReader';\nimport NotFoundException from '../NotFoundException';\nimport FormatException from '../FormatException';\nimport ChecksumException from '../ChecksumException';\n\n/**\n *

Encapsulates functionality and implementation that is common to UPC and EAN families\n * of one-dimensional barcodes.

\n *\n * @author dswitkin@google.com (Daniel Switkin)\n * @author Sean Owen\n * @author alasdair@google.com (Alasdair Mackintosh)\n */\nexport default abstract class UPCEANReader extends AbstractUPCEANReader {\n\n public constructor() {\n super();\n this.decodeRowStringBuffer = '';\n\n UPCEANReader.L_AND_G_PATTERNS = UPCEANReader.L_PATTERNS.map(function(arr) {\n return arr.slice();\n });\n\n for (let i = 10; i < 20; i++) {\n let widths = UPCEANReader.L_PATTERNS[i - 10];\n let reversedWidths = new Array(widths.length);\n for (let j = 0; j < widths.length; j++) {\n reversedWidths[j] = widths[widths.length - j - 1];\n }\n UPCEANReader.L_AND_G_PATTERNS[i] = reversedWidths;\n }\n }\n\n public decodeRow(rowNumber: number, row: BitArray, hints?: Map): Result {\n let startGuardRange = UPCEANReader.findStartGuardPattern(row);\n let resultPointCallback = hints == null ? null : hints.get(DecodeHintType.NEED_RESULT_POINT_CALLBACK);\n\n if (resultPointCallback != null) {\n const resultPoint = new ResultPoint((startGuardRange[0] + startGuardRange[1]) / 2.0, rowNumber);\n resultPointCallback.foundPossibleResultPoint(resultPoint);\n }\n\n let budello = this.decodeMiddle(row, startGuardRange, this.decodeRowStringBuffer);\n let endStart = budello.rowOffset;\n let result = budello.resultString;\n\n if (resultPointCallback != null) {\n const resultPoint = new ResultPoint(endStart, rowNumber);\n resultPointCallback.foundPossibleResultPoint(resultPoint);\n }\n\n let endRange = UPCEANReader.decodeEnd(row, endStart);\n\n if (resultPointCallback != null) {\n const resultPoint = new ResultPoint((endRange[0] + endRange[1]) / 2.0, rowNumber);\n resultPointCallback.foundPossibleResultPoint(resultPoint);\n }\n\n // Make sure there is a quiet zone at least as big as the end pattern after the barcode. The\n // spec might want more whitespace, but in practice this is the maximum we can count on.\n let end = endRange[1];\n let quietEnd = end + (end - endRange[0]);\n\n if (quietEnd >= row.getSize() || !row.isRange(end, quietEnd, false)) {\n throw new NotFoundException();\n }\n\n let resultString = result.toString();\n // UPC/EAN should never be less than 8 chars anyway\n if (resultString.length < 8) {\n throw new FormatException();\n }\n if (!UPCEANReader.checkChecksum(resultString)) {\n throw new ChecksumException();\n }\n\n let left = (startGuardRange[1] + startGuardRange[0]) / 2.0;\n let right = (endRange[1] + endRange[0]) / 2.0;\n let format = this.getBarcodeFormat();\n let resultPoint = [new ResultPoint(left, rowNumber), new ResultPoint(right, rowNumber)];\n let decodeResult = new Result(resultString, null, 0, resultPoint, format, new Date().getTime());\n\n let extensionLength = 0;\n\n try {\n let extensionResult = UPCEANExtensionSupport.decodeRow(rowNumber, row, endRange[1]);\n decodeResult.putMetadata(ResultMetadataType.UPC_EAN_EXTENSION, extensionResult.getText());\n decodeResult.putAllMetadata(extensionResult.getResultMetadata());\n decodeResult.addResultPoints(extensionResult.getResultPoints());\n extensionLength = extensionResult.getText().length;\n } catch (err) {\n }\n\n let allowedExtensions = hints == null ? null : hints.get(DecodeHintType.ALLOWED_EAN_EXTENSIONS);\n if (allowedExtensions != null) {\n let valid = false;\n for (let length in allowedExtensions) {\n if (extensionLength.toString() === length) { // check me\n valid = true;\n break;\n }\n }\n if (!valid) {\n throw new NotFoundException();\n }\n }\n\n if (format === BarcodeFormat.EAN_13 || format === BarcodeFormat.UPC_A) {\n // let countryID = eanManSupport.lookupContryIdentifier(resultString); todo\n // if (countryID != null) {\n // decodeResult.putMetadata(ResultMetadataType.POSSIBLE_COUNTRY, countryID);\n // }\n }\n\n return decodeResult;\n }\n\n static checkChecksum(s: string): boolean {\n return UPCEANReader.checkStandardUPCEANChecksum(s);\n }\n\n static checkStandardUPCEANChecksum(s: string): boolean {\n let length = s.length;\n if (length === 0) return false;\n\n let check = parseInt(s.charAt(length - 1), 10);\n return UPCEANReader.getStandardUPCEANChecksum(s.substring(0, length - 1)) === check;\n }\n\n static getStandardUPCEANChecksum(s: string): number {\n let length = s.length;\n let sum = 0;\n for (let i = length - 1; i >= 0; i -= 2) {\n let digit = s.charAt(i).charCodeAt(0) - '0'.charCodeAt(0);\n if (digit < 0 || digit > 9) {\n throw new FormatException();\n }\n sum += digit;\n }\n sum *= 3;\n for (let i = length - 2; i >= 0; i -= 2) {\n let digit = s.charAt(i).charCodeAt(0) - '0'.charCodeAt(0);\n if (digit < 0 || digit > 9) {\n throw new FormatException();\n }\n sum += digit;\n }\n return (1000 - sum) % 10;\n }\n\n static decodeEnd(row: BitArray, endStart: number): number[] {\n return UPCEANReader.findGuardPattern(row, endStart, false, UPCEANReader.START_END_PATTERN, new Array(UPCEANReader.START_END_PATTERN.length).fill(0));\n }\n}\n","/*\n * Copyright 2009 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport DecodeHintType from './DecodeHintType';\nimport Reader from './Reader';\nimport Result from './Result';\nimport BinaryBitmap from './BinaryBitmap';\nimport BarcodeFormat from './BarcodeFormat';\nimport QRCodeReader from './qrcode/QRCodeReader';\n\nimport AztecReader from './aztec/AztecReader';\nimport MultiFormatOneDReader from './oned/MultiFormatOneDReader';\nimport DataMatrixReader from './datamatrix/DataMatrixReader';\nimport NotFoundException from './NotFoundException';\nimport PDF417Reader from './pdf417/PDF417Reader';\nimport ReaderException from './ReaderException';\n\n/*namespace com.google.zxing {*/\n\n/**\n * MultiFormatReader is a convenience class and the main entry point into the library for most uses.\n * By default it attempts to decode all barcode formats that the library supports. Optionally, you\n * can provide a hints object to request different behavior, for example only decoding QR codes.\n *\n * @author Sean Owen\n * @author dswitkin@google.com (Daniel Switkin)\n */\nexport default class MultiFormatReader implements Reader {\n\n private hints: Map | null;\n private readers: Reader[];\n\n /**\n * This version of decode honors the intent of Reader.decode(BinaryBitmap) in that it\n * passes null as a hint to the decoders. However, that makes it inefficient to call repeatedly.\n * Use setHints() followed by decodeWithState() for continuous scan applications.\n *\n * @param image The pixel data to decode\n * @return The contents of the image\n *\n * @throws NotFoundException Any errors which occurred\n */\n /*@Override*/\n // public decode(image: BinaryBitmap): Result {\n // setHints(null)\n // return decodeInternal(image)\n // }\n\n /**\n * Decode an image using the hints provided. Does not honor existing state.\n *\n * @param image The pixel data to decode\n * @param hints The hints to use, clearing the previous state.\n * @return The contents of the image\n *\n * @throws NotFoundException Any errors which occurred\n */\n /*@Override*/\n public decode(image: BinaryBitmap, hints?: Map): Result {\n this.setHints(hints);\n return this.decodeInternal(image);\n }\n\n /**\n * Decode an image using the state set up by calling setHints() previously. Continuous scan\n * clients will get a large speed increase by using this instead of decode().\n *\n * @param image The pixel data to decode\n * @return The contents of the image\n *\n * @throws NotFoundException Any errors which occurred\n */\n public decodeWithState(image: BinaryBitmap): Result {\n // Make sure to set up the default state so we don't crash\n if (this.readers === null || this.readers === undefined) {\n this.setHints(null);\n }\n return this.decodeInternal(image);\n }\n\n /**\n * This method adds state to the MultiFormatReader. By setting the hints once, subsequent calls\n * to decodeWithState(image) can reuse the same set of readers without reallocating memory. This\n * is important for performance in continuous scan clients.\n *\n * @param hints The set of hints to use for subsequent calls to decode(image)\n */\n public setHints(hints?: Map | null): void {\n this.hints = hints;\n\n const tryHarder: boolean = hints !== null && hints !== undefined && undefined !== hints.get(DecodeHintType.TRY_HARDER);\n /*@SuppressWarnings(\"unchecked\")*/\n const formats = hints === null || hints === undefined ? null : hints.get(DecodeHintType.POSSIBLE_FORMATS);\n const readers = new Array();\n if (formats !== null && formats !== undefined) {\n const addOneDReader: boolean = formats.some(f =>\n f === BarcodeFormat.UPC_A ||\n f === BarcodeFormat.UPC_E ||\n f === BarcodeFormat.EAN_13 ||\n f === BarcodeFormat.EAN_8 ||\n f === BarcodeFormat.CODABAR ||\n f === BarcodeFormat.CODE_39 ||\n f === BarcodeFormat.CODE_93 ||\n f === BarcodeFormat.CODE_128 ||\n f === BarcodeFormat.ITF ||\n f === BarcodeFormat.RSS_14 ||\n f === BarcodeFormat.RSS_EXPANDED\n );\n // Put 1D readers upfront in \"normal\" mode\n\n // TYPESCRIPTPORT: TODO: uncomment below as they are ported\n\n if (addOneDReader && !tryHarder) {\n readers.push(new MultiFormatOneDReader(hints));\n }\n if (formats.includes(BarcodeFormat.QR_CODE)) {\n readers.push(new QRCodeReader());\n }\n if (formats.includes(BarcodeFormat.DATA_MATRIX)) {\n readers.push(new DataMatrixReader());\n }\n if (formats.includes(BarcodeFormat.AZTEC)) {\n readers.push(new AztecReader());\n }\n if (formats.includes(BarcodeFormat.PDF_417)) {\n readers.push(new PDF417Reader());\n }\n // if (formats.includes(BarcodeFormat.MAXICODE)) {\n // readers.push(new MaxiCodeReader())\n // }\n // At end in \"try harder\" mode\n if (addOneDReader && tryHarder) {\n readers.push(new MultiFormatOneDReader(hints));\n }\n }\n if (readers.length === 0) {\n if (!tryHarder) {\n readers.push(new MultiFormatOneDReader(hints));\n }\n\n readers.push(new QRCodeReader());\n readers.push(new DataMatrixReader());\n readers.push(new AztecReader());\n readers.push(new PDF417Reader());\n // readers.push(new MaxiCodeReader())\n\n if (tryHarder) {\n readers.push(new MultiFormatOneDReader(hints));\n }\n }\n this.readers = readers; // .toArray(new Reader[readers.size()])\n }\n\n /*@Override*/\n public reset(): void {\n if (this.readers !== null) {\n for (const reader of this.readers) {\n reader.reset();\n }\n }\n }\n\n /**\n * @throws NotFoundException\n */\n private decodeInternal(image: BinaryBitmap): Result {\n\n if (this.readers === null) {\n throw new ReaderException('No readers where selected, nothing can be read.');\n }\n\n for (const reader of this.readers) {\n\n // Trying to decode with ${reader} reader.\n\n try {\n return reader.decode(image, this.hints);\n } catch (ex) {\n if (ex instanceof ReaderException) {\n continue;\n }\n\n // Bad Exception.\n }\n }\n\n throw new NotFoundException('No MultiFormat Readers were able to detect the code.');\n }\n\n}\n","/*\n * Copyright 2007 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*namespace com.google.zxing.qrcode.decoder {*/\n\nimport ErrorCorrectionLevel from './ErrorCorrectionLevel';\nimport Integer from '../../util/Integer';\n\n/**\n *

Encapsulates a QR Code's format information, including the data mask used and\n * error correction level.

\n *\n * @author Sean Owen\n * @see DataMask\n * @see ErrorCorrectionLevel\n */\nexport default class FormatInformation {\n\n private static FORMAT_INFO_MASK_QR = 0x5412;\n\n /**\n * See ISO 18004:2006, Annex C, Table C.1\n */\n private static FORMAT_INFO_DECODE_LOOKUP = [\n Int32Array.from([0x5412, 0x00]),\n Int32Array.from([0x5125, 0x01]),\n Int32Array.from([0x5E7C, 0x02]),\n Int32Array.from([0x5B4B, 0x03]),\n Int32Array.from([0x45F9, 0x04]),\n Int32Array.from([0x40CE, 0x05]),\n Int32Array.from([0x4F97, 0x06]),\n Int32Array.from([0x4AA0, 0x07]),\n Int32Array.from([0x77C4, 0x08]),\n Int32Array.from([0x72F3, 0x09]),\n Int32Array.from([0x7DAA, 0x0A]),\n Int32Array.from([0x789D, 0x0B]),\n Int32Array.from([0x662F, 0x0C]),\n Int32Array.from([0x6318, 0x0D]),\n Int32Array.from([0x6C41, 0x0E]),\n Int32Array.from([0x6976, 0x0F]),\n Int32Array.from([0x1689, 0x10]),\n Int32Array.from([0x13BE, 0x11]),\n Int32Array.from([0x1CE7, 0x12]),\n Int32Array.from([0x19D0, 0x13]),\n Int32Array.from([0x0762, 0x14]),\n Int32Array.from([0x0255, 0x15]),\n Int32Array.from([0x0D0C, 0x16]),\n Int32Array.from([0x083B, 0x17]),\n Int32Array.from([0x355F, 0x18]),\n Int32Array.from([0x3068, 0x19]),\n Int32Array.from([0x3F31, 0x1A]),\n Int32Array.from([0x3A06, 0x1B]),\n Int32Array.from([0x24B4, 0x1C]),\n Int32Array.from([0x2183, 0x1D]),\n Int32Array.from([0x2EDA, 0x1E]),\n Int32Array.from([0x2BED, 0x1F]),\n ];\n\n private errorCorrectionLevel: ErrorCorrectionLevel;\n private dataMask: number; /*byte*/\n\n private constructor(formatInfo: number /*int*/) {\n // Bits 3,4\n this.errorCorrectionLevel = ErrorCorrectionLevel.forBits((formatInfo >> 3) & 0x03);\n // Bottom 3 bits\n this.dataMask = /*(byte) */(formatInfo & 0x07);\n }\n\n public static numBitsDiffering(a: number /*int*/, b: number /*int*/): number /*int*/ {\n return Integer.bitCount(a ^ b);\n }\n\n /**\n * @param maskedFormatInfo1 format info indicator, with mask still applied\n * @param maskedFormatInfo2 second copy of same info; both are checked at the same time\n * to establish best match\n * @return information about the format it specifies, or {@code null}\n * if doesn't seem to match any known pattern\n */\n public static decodeFormatInformation(maskedFormatInfo1: number /*int*/, maskedFormatInfo2: number /*int*/): FormatInformation {\n const formatInfo = FormatInformation.doDecodeFormatInformation(maskedFormatInfo1, maskedFormatInfo2);\n if (formatInfo !== null) {\n return formatInfo;\n }\n // Should return null, but, some QR codes apparently\n // do not mask this info. Try again by actually masking the pattern\n // first\n return FormatInformation.doDecodeFormatInformation(maskedFormatInfo1 ^ FormatInformation.FORMAT_INFO_MASK_QR,\n maskedFormatInfo2 ^ FormatInformation.FORMAT_INFO_MASK_QR);\n }\n\n private static doDecodeFormatInformation(maskedFormatInfo1: number /*int*/, maskedFormatInfo2: number /*int*/): FormatInformation {\n // Find the int in FORMAT_INFO_DECODE_LOOKUP with fewest bits differing\n let bestDifference = Number.MAX_SAFE_INTEGER;\n let bestFormatInfo = 0;\n for (const decodeInfo of FormatInformation.FORMAT_INFO_DECODE_LOOKUP) {\n const targetInfo = decodeInfo[0];\n if (targetInfo === maskedFormatInfo1 || targetInfo === maskedFormatInfo2) {\n // Found an exact match\n return new FormatInformation(decodeInfo[1]);\n }\n let bitsDifference = FormatInformation.numBitsDiffering(maskedFormatInfo1, targetInfo);\n if (bitsDifference < bestDifference) {\n bestFormatInfo = decodeInfo[1];\n bestDifference = bitsDifference;\n }\n if (maskedFormatInfo1 !== maskedFormatInfo2) {\n // also try the other option\n bitsDifference = FormatInformation.numBitsDiffering(maskedFormatInfo2, targetInfo);\n if (bitsDifference < bestDifference) {\n bestFormatInfo = decodeInfo[1];\n bestDifference = bitsDifference;\n }\n }\n }\n // Hamming distance of the 32 masked codes is 7, by construction, so <= 3 bits\n // differing means we found a match\n if (bestDifference <= 3) {\n return new FormatInformation(bestFormatInfo);\n }\n return null;\n }\n\n public getErrorCorrectionLevel(): ErrorCorrectionLevel {\n return this.errorCorrectionLevel;\n }\n\n public getDataMask(): number/*byte*/ {\n return this.dataMask;\n }\n\n /*@Override*/\n public hashCode(): number /*int*/ {\n return (this.errorCorrectionLevel.getBits() << 3) | this.dataMask;\n }\n\n /*@Override*/\n public equals(o: Object): boolean {\n if (!(o instanceof FormatInformation)) {\n return false;\n }\n const other = o;\n return this.errorCorrectionLevel === other.errorCorrectionLevel &&\n this.dataMask === other.dataMask;\n }\n\n}\n","/*\n * Copyright 2013 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*namespace com.google.zxing.qrcode.decoder {*/\n\nimport ResultPoint from '../../ResultPoint';\n\n/**\n * Meta-data container for QR Code decoding. Instances of this class may be used to convey information back to the\n * decoding caller. Callers are expected to process this.\n *\n * @see com.google.zxing.common.DecoderResult#getOther()\n */\nexport default class QRCodeDecoderMetaData {\n\n\n public constructor(private mirrored: boolean) { }\n\n /**\n * @return true if the QR Code was mirrored.\n */\n public isMirrored(): boolean {\n return this.mirrored;\n }\n\n /**\n * Apply the result points' order correction due to mirroring.\n *\n * @param points Array of points to apply mirror correction to.\n */\n public applyMirroredCorrection(points: Array): void {\n if (!this.mirrored || points === null || points.length < 3) {\n return;\n }\n const bottomLeft = points[0];\n points[0] = points[2];\n points[2] = bottomLeft;\n // No need to 'fix' top-left and alignment pattern.\n }\n\n}\n","/*\n * Copyright 2007 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*namespace com.google.zxing.qrcode.decoder {*/\n\n\nimport Version from './Version';\nimport IllegalArgumentException from '../../IllegalArgumentException';\n\nexport enum ModeValues {\n TERMINATOR, // Not really a mode...\n NUMERIC,\n ALPHANUMERIC,\n STRUCTURED_APPEND, // Not supported\n BYTE,\n ECI, // character counts don't apply\n KANJI,\n FNC1_FIRST_POSITION,\n FNC1_SECOND_POSITION,\n /** See GBT 18284-2000; \"Hanzi\" is a transliteration of this mode name. */\n HANZI\n}\n\n/**\n *

See ISO 18004:2006, 6.4.1, Tables 2 and 3. This enum encapsulates the various modes in which\n * data can be encoded to bits in the QR code standard.

\n *\n * @author Sean Owen\n */\nexport default class Mode {\n\n private static FOR_BITS = new Map();\n private static FOR_VALUE = new Map();\n\n public static TERMINATOR = new Mode(ModeValues.TERMINATOR, 'TERMINATOR', Int32Array.from([0, 0, 0]), 0x00); // Not really a mode...\n public static NUMERIC = new Mode(ModeValues.NUMERIC, 'NUMERIC', Int32Array.from([10, 12, 14]), 0x01);\n public static ALPHANUMERIC = new Mode(ModeValues.ALPHANUMERIC, 'ALPHANUMERIC', Int32Array.from([9, 11, 13]), 0x02);\n public static STRUCTURED_APPEND = new Mode(ModeValues.STRUCTURED_APPEND, 'STRUCTURED_APPEND', Int32Array.from([0, 0, 0]), 0x03); // Not supported\n public static BYTE = new Mode(ModeValues.BYTE, 'BYTE', Int32Array.from([8, 16, 16]), 0x04);\n public static ECI = new Mode(ModeValues.ECI, 'ECI', Int32Array.from([0, 0, 0]), 0x07); // character counts don't apply\n public static KANJI = new Mode(ModeValues.KANJI, 'KANJI', Int32Array.from([8, 10, 12]), 0x08);\n public static FNC1_FIRST_POSITION = new Mode(ModeValues.FNC1_FIRST_POSITION, 'FNC1_FIRST_POSITION', Int32Array.from([0, 0, 0]), 0x05);\n public static FNC1_SECOND_POSITION = new Mode(ModeValues.FNC1_SECOND_POSITION, 'FNC1_SECOND_POSITION', Int32Array.from([0, 0, 0]), 0x09);\n /** See GBT 18284-2000; \"Hanzi\" is a transliteration of this mode name. */\n public static HANZI = new Mode(ModeValues.HANZI, 'HANZI', Int32Array.from([8, 10, 12]), 0x0D);\n\n private constructor(private value: ModeValues, private stringValue: string, private characterCountBitsForVersions: Int32Array, private bits: number /*int*/) {\n Mode.FOR_BITS.set(bits, this);\n Mode.FOR_VALUE.set(value, this);\n }\n\n /**\n * @param bits four bits encoding a QR Code data mode\n * @return Mode encoded by these bits\n * @throws IllegalArgumentException if bits do not correspond to a known mode\n */\n public static forBits(bits: number /*int*/): Mode {\n const mode = Mode.FOR_BITS.get(bits);\n if (undefined === mode) {\n throw new IllegalArgumentException();\n }\n return mode;\n }\n\n /**\n * @param version version in question\n * @return number of bits used, in this QR Code symbol {@link Version}, to encode the\n * count of characters that will follow encoded in this Mode\n */\n public getCharacterCountBits(version: Version): number /*int*/ {\n const versionNumber = version.getVersionNumber();\n\n let offset;\n\n if (versionNumber <= 9) {\n offset = 0;\n } else if (versionNumber <= 26) {\n offset = 1;\n } else {\n offset = 2;\n }\n\n return this.characterCountBitsForVersions[offset];\n }\n\n public getValue(): ModeValues/*int*/ {\n return this.value;\n }\n\n public getBits(): number /*int*/ {\n return this.bits;\n }\n\n public equals(o: any): boolean {\n if (!(o instanceof Mode)) {\n return false;\n }\n const other = o;\n return this.value === other.value;\n }\n\n public toString(): string {\n return this.stringValue;\n }\n}\n","/*\n * Copyright 2009 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// package com.google.zxing.pdf417;\n\n// import com.google.zxing.BarcodeFormat;\nimport BarcodeFormat from '../BarcodeFormat';\n// import com.google.zxing.BinaryBitmap;\nimport BinaryBitmap from '../BinaryBitmap';\n// import com.google.zxing.ChecksumException;\nimport ChecksumException from '../ChecksumException';\n// import com.google.zxing.DecodeHintType;\nimport DecodeHintType from '../DecodeHintType';\n// import com.google.zxing.FormatException;\nimport FormatException from '../FormatException';\n// import com.google.zxing.NotFoundException;\nimport NotFoundException from '../NotFoundException';\n// import com.google.zxing.Reader;\nimport Reader from '../Reader';\n// import com.google.zxing.Result;\nimport Result from '../Result';\n// import com.google.zxing.ResultMetadataType;\n// import com.google.zxing.ResultPoint;\nimport ResultPoint from '../ResultPoint';\n// import com.google.zxing.common.DecoderResult;\n// import com.google.zxing.multi.MultipleBarcodeReader;\n// import com.google.zxing.pdf417.decoder.PDF417ScanningDecoder;\n// import com.google.zxing.pdf417.detector.Detector;\n// import com.google.zxing.pdf417.detector.PDF417DetectorResult;\n\nimport PDF417Common from './PDF417Common';\nimport Integer from '../util/Integer';\nimport PDF417ResultMetadata from './PDF417ResultMetadata';\nimport ResultMetadataType from '../ResultMetadataType';\nimport MultipleBarcodeReader from '../multi/MultipleBarcodeReader';\nimport Detector from './detector/Detector';\nimport PDF417ScanningDecoder from './decoder/PDF417ScanningDecoder';\n\nimport { int } from '../../customTypings';\n\n\n// import java.util.ArrayList;\n// import java.util.List;\n// import java.util.Map;\n\n/**\n * This implementation can detect and decode PDF417 codes in an image.\n *\n * @author Guenther Grau\n */\nexport default /*public final*/ class PDF417Reader implements Reader, MultipleBarcodeReader {\n\n // private static /*final Result[]*/ EMPTY_RESULT_ARRAY: Result[] = new Result([0]);\n\n /**\n * Locates and decodes a PDF417 code in an image.\n *\n * @return a String representing the content encoded by the PDF417 code\n * @throws NotFoundException if a PDF417 code cannot be found,\n * @throws FormatException if a PDF417 cannot be decoded\n * @throws ChecksumException\n */\n // @Override\n public decode(image: BinaryBitmap, hints: Map = null): Result {\n let result = PDF417Reader.decode(image, hints, false);\n if (result == null || result.length === 0 || result[0] == null) {\n throw NotFoundException.getNotFoundInstance();\n }\n return result[0];\n }\n\n /**\n *\n * @param BinaryBitmap\n * @param image\n * @throws NotFoundException\n */\n // @Override\n public decodeMultiple(image: BinaryBitmap, hints: Map = null): Result[] {\n try {\n return PDF417Reader.decode(image, hints, true);\n } catch (ignored) {\n if (ignored instanceof FormatException || ignored instanceof ChecksumException) {\n throw NotFoundException.getNotFoundInstance();\n }\n\n throw ignored;\n }\n }\n\n /**\n *\n * @param image\n * @param hints\n * @param multiple\n *\n * @throws NotFoundException\n * @throws FormatExceptionß\n * @throws ChecksumException\n */\n private static decode(image: BinaryBitmap, hints: Map, multiple: boolean) {\n const results = new Array();\n const detectorResult = Detector.detectMultiple(image, hints, multiple);\n for (const points of detectorResult.getPoints()) {\n const decoderResult = PDF417ScanningDecoder.decode(detectorResult.getBits(), points[4], points[5],\n points[6], points[7], PDF417Reader.getMinCodewordWidth(points), PDF417Reader.getMaxCodewordWidth(points));\n const result = new Result(decoderResult.getText(), decoderResult.getRawBytes(), undefined, points, BarcodeFormat.PDF_417);\n result.putMetadata(ResultMetadataType.ERROR_CORRECTION_LEVEL, decoderResult.getECLevel());\n const pdf417ResultMetadata: PDF417ResultMetadata = decoderResult.getOther();\n if (pdf417ResultMetadata != null) {\n result.putMetadata(ResultMetadataType.PDF417_EXTRA_METADATA, pdf417ResultMetadata);\n }\n results.push(result);\n }\n return results.map(x => x);\n }\n\n private static getMaxWidth(p1: ResultPoint, p2: ResultPoint): number /*int*/ {\n if (p1 == null || p2 == null) {\n return 0;\n }\n return Math.trunc(Math.abs(p1.getX() - p2.getX()));\n }\n\n private static getMinWidth(p1: ResultPoint, p2: ResultPoint): number /*int*/ {\n if (p1 == null || p2 == null) {\n return Integer.MAX_VALUE;\n }\n return Math.trunc(Math.abs(p1.getX() - p2.getX()));\n }\n\n private static getMaxCodewordWidth(p: ResultPoint[]): number /*int*/ {\n return Math.floor(Math.max(\n Math.max(PDF417Reader.getMaxWidth(p[0], p[4]), PDF417Reader.getMaxWidth(p[6], p[2]) * PDF417Common.MODULES_IN_CODEWORD /\n PDF417Common.MODULES_IN_STOP_PATTERN),\n Math.max(PDF417Reader.getMaxWidth(p[1], p[5]), PDF417Reader.getMaxWidth(p[7], p[3]) * PDF417Common.MODULES_IN_CODEWORD /\n PDF417Common.MODULES_IN_STOP_PATTERN)));\n }\n\n private static getMinCodewordWidth(p: ResultPoint[]): number /*int*/ {\n return Math.floor(Math.min(\n Math.min(PDF417Reader.getMinWidth(p[0], p[4]), PDF417Reader.getMinWidth(p[6], p[2]) * PDF417Common.MODULES_IN_CODEWORD /\n PDF417Common.MODULES_IN_STOP_PATTERN),\n Math.min(PDF417Reader.getMinWidth(p[1], p[5]), PDF417Reader.getMinWidth(p[7], p[3]) * PDF417Common.MODULES_IN_CODEWORD /\n PDF417Common.MODULES_IN_STOP_PATTERN)));\n }\n\n // @Override\n public reset(): void {\n // nothing needs to be reset\n }\n\n}\n","/*\n* Copyright 2012 ZXing authors\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n// package com.google.zxing.pdf417.decoder.ec;\n\nimport IllegalArgumentException from '../../../IllegalArgumentException';\nimport System from '../../../util/System';\nimport StringBuilder from '../../../util/StringBuilder';\nimport ModulusBase from './ModulusBase';\n\n/**\n * @author Sean Owen\n * @see com.google.zxing.common.reedsolomon.GenericGFPoly\n */\nexport default /*final*/ class ModulusPoly {\n\n private /*final*/ field: ModulusBase;\n private /*final*/ coefficients: Int32Array;\n\n constructor(field: ModulusBase, coefficients: Int32Array) {\n if (coefficients.length === 0) {\n throw new IllegalArgumentException();\n }\n this.field = field;\n let coefficientsLength: /*int*/ number = coefficients.length;\n if (coefficientsLength > 1 && coefficients[0] === 0) {\n // Leading term must be non-zero for anything except the constant polynomial \"0\"\n let firstNonZero: /*int*/ number = 1;\n while (firstNonZero < coefficientsLength && coefficients[firstNonZero] === 0) {\n firstNonZero++;\n }\n if (firstNonZero === coefficientsLength) {\n this.coefficients = new Int32Array([0]);\n } else {\n this.coefficients = new Int32Array(coefficientsLength - firstNonZero);\n System.arraycopy(coefficients,\n firstNonZero,\n this.coefficients,\n 0,\n this.coefficients.length);\n }\n } else {\n this.coefficients = coefficients;\n }\n }\n\n getCoefficients(): Int32Array {\n return this.coefficients;\n }\n\n /**\n * @return degree of this polynomial\n */\n getDegree(): /*int*/ number {\n return this.coefficients.length - 1;\n }\n\n /**\n * @return true iff this polynomial is the monomial \"0\"\n */\n isZero(): boolean {\n return this.coefficients[0] === 0;\n }\n\n /**\n * @return coefficient of x^degree term in this polynomial\n */\n getCoefficient(degree: /*int*/ number): /*int*/ number {\n return this.coefficients[this.coefficients.length - 1 - degree];\n }\n\n /**\n * @return evaluation of this polynomial at a given point\n */\n evaluateAt(a: /*int*/ number): /*int*/ number {\n if (a === 0) {\n // Just return the x^0 coefficient\n return this.getCoefficient(0);\n }\n if (a === 1) {\n // Just the sum of the coefficients\n let sum: /*int*/ number = 0;\n for (let coefficient /*int*/ of this.coefficients) {\n sum = this.field.add(sum, coefficient);\n }\n return sum;\n }\n let result: /*int*/ number = this.coefficients[0];\n let size: /*int*/ number = this.coefficients.length;\n for (let i /*int*/ = 1; i < size; i++) {\n result = this.field.add(this.field.multiply(a, result), this.coefficients[i]);\n }\n return result;\n }\n\n add(other: ModulusPoly): ModulusPoly {\n if (!this.field.equals(other.field)) {\n throw new IllegalArgumentException('ModulusPolys do not have same ModulusGF field');\n }\n if (this.isZero()) {\n return other;\n }\n if (other.isZero()) {\n return this;\n }\n\n let smallerCoefficients: Int32Array = this.coefficients;\n let largerCoefficients: Int32Array = other.coefficients;\n if (smallerCoefficients.length > largerCoefficients.length) {\n let temp: Int32Array = smallerCoefficients;\n smallerCoefficients = largerCoefficients;\n largerCoefficients = temp;\n }\n let sumDiff: Int32Array = new Int32Array(largerCoefficients.length);\n let lengthDiff: /*int*/ number = largerCoefficients.length - smallerCoefficients.length;\n // Copy high-order terms only found in higher-degree polynomial's coefficients\n System.arraycopy(largerCoefficients, 0, sumDiff, 0, lengthDiff);\n\n for (let i /*int*/ = lengthDiff; i < largerCoefficients.length; i++) {\n sumDiff[i] = this.field.add(smallerCoefficients[i - lengthDiff], largerCoefficients[i]);\n }\n\n return new ModulusPoly(this.field, sumDiff);\n }\n\n subtract(other: ModulusPoly): ModulusPoly {\n if (!this.field.equals(other.field)) {\n throw new IllegalArgumentException('ModulusPolys do not have same ModulusGF field');\n }\n if (other.isZero()) {\n return this;\n }\n return this.add(other.negative());\n }\n\n multiply(other: ModulusPoly | number) {\n if (other instanceof ModulusPoly) {\n return this.multiplyOther(other);\n }\n return this.multiplyScalar(other);\n }\n\n multiplyOther(other: ModulusPoly): ModulusPoly {\n if (!this.field.equals(other.field)) {\n throw new IllegalArgumentException('ModulusPolys do not have same ModulusGF field');\n }\n if (this.isZero() || other.isZero()) {\n // return this.field.getZero();\n return new ModulusPoly(this.field, new Int32Array([0]));\n }\n let aCoefficients: Int32Array = this.coefficients;\n let aLength: /*int*/ number = aCoefficients.length;\n let bCoefficients: Int32Array = other.coefficients;\n let bLength: /*int*/ number = bCoefficients.length;\n let product: Int32Array = new Int32Array(aLength + bLength - 1);\n for (let i /*int*/ = 0; i < aLength; i++) {\n let aCoeff: /*int*/ number = aCoefficients[i];\n for (let j /*int*/ = 0; j < bLength; j++) {\n product[i + j] = this.field.add(product[i + j], this.field.multiply(aCoeff, bCoefficients[j]));\n }\n }\n return new ModulusPoly(this.field, product);\n }\n\n negative(): ModulusPoly {\n let size: /*int*/ number = this.coefficients.length;\n let negativeCoefficients: Int32Array = new Int32Array(size);\n for (let i /*int*/ = 0; i < size; i++) {\n negativeCoefficients[i] = this.field.subtract(0, this.coefficients[i]);\n }\n return new ModulusPoly(this.field, negativeCoefficients);\n }\n\n multiplyScalar(scalar: /*int*/ number): ModulusPoly {\n if (scalar === 0) {\n return new ModulusPoly(this.field, new Int32Array([0]));\n }\n if (scalar === 1) {\n return this;\n }\n let size: /*int*/ number = this.coefficients.length;\n let product: Int32Array = new Int32Array(size);\n for (let i /*int*/ = 0; i < size; i++) {\n product[i] = this.field.multiply(this.coefficients[i], scalar);\n }\n return new ModulusPoly(this.field, product);\n }\n\n multiplyByMonomial(degree: /*int*/ number, coefficient: /*int*/ number): ModulusPoly {\n if (degree < 0) {\n throw new IllegalArgumentException();\n }\n if (coefficient === 0) {\n return new ModulusPoly(this.field, new Int32Array([0]));\n }\n let size: /*int*/ number = this.coefficients.length;\n let product: Int32Array = new Int32Array(size + degree);\n for (let i /*int*/ = 0; i < size; i++) {\n product[i] = this.field.multiply(this.coefficients[i], coefficient);\n }\n return new ModulusPoly(this.field, product);\n }\n\n /*\n ModulusPoly[] divide(other: ModulusPoly) {\n if (!field.equals(other.field)) {\n throw new IllegalArgumentException(\"ModulusPolys do not have same ModulusGF field\");\n }\n if (other.isZero()) {\n throw new IllegalArgumentException(\"Divide by 0\");\n }\n\n let quotient: ModulusPoly = field.getZero();\n let remainder: ModulusPoly = this;\n\n let denominatorLeadingTerm: /*int/ number = other.getCoefficient(other.getDegree());\n let inverseDenominatorLeadingTerm: /*int/ number = field.inverse(denominatorLeadingTerm);\n\n while (remainder.getDegree() >= other.getDegree() && !remainder.isZero()) {\n let degreeDifference: /*int/ number = remainder.getDegree() - other.getDegree();\n let scale: /*int/ number = field.multiply(remainder.getCoefficient(remainder.getDegree()), inverseDenominatorLeadingTerm);\n let term: ModulusPoly = other.multiplyByMonomial(degreeDifference, scale);\n let iterationQuotient: ModulusPoly = field.buildMonomial(degreeDifference, scale);\n quotient = quotient.add(iterationQuotient);\n remainder = remainder.subtract(term);\n }\n\n return new ModulusPoly[] { quotient, remainder };\n }\n */\n\n // @Override\n public toString(): String {\n let result: StringBuilder = new StringBuilder(/*8 * this.getDegree()*/); // dynamic string size in JS\n for (let degree /*int*/ = this.getDegree(); degree >= 0; degree--) {\n let coefficient: /*int*/ number = this.getCoefficient(degree);\n if (coefficient !== 0) {\n if (coefficient < 0) {\n result.append(' - ');\n coefficient = -coefficient;\n } else {\n if (result.length() > 0) {\n result.append(' + ');\n }\n }\n if (degree === 0 || coefficient !== 1) {\n result.append(coefficient);\n }\n if (degree !== 0) {\n if (degree === 1) {\n result.append('x');\n } else {\n result.append('x^');\n result.append(degree);\n }\n }\n }\n }\n return result.toString();\n }\n\n}\n","/*\n* Copyright 2013 ZXing authors\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n// package com.google.zxing.pdf417.decoder;\n\n// import com.google.zxing.NotFoundException;\nimport NotFoundException from '../../NotFoundException';\n// import com.google.zxing.ResultPoint;\nimport ResultPoint from '../../ResultPoint';\n// import com.google.zxing.common.BitMatrix;\nimport BitMatrix from '../../common/BitMatrix';\nimport { int } from '../../../customTypings';\n\n/**\n * @author Guenther Grau\n */\nexport default /*final*/ class BoundingBox {\n\n private /*final*/ image: BitMatrix;\n private /*final*/ topLeft: ResultPoint;\n private /*final*/ bottomLeft: ResultPoint;\n private /*final*/ topRight: ResultPoint;\n private /*final*/ bottomRight: ResultPoint;\n private /*final*/ minX: int;\n private /*final*/ maxX: int;\n private /*final*/ minY: int;\n private /*final*/ maxY: int;\n\n constructor( image: BitMatrix|BoundingBox,\n topLeft?: ResultPoint,\n bottomLeft?: ResultPoint,\n topRight?: ResultPoint,\n bottomRight?: ResultPoint) {\n if (image instanceof BoundingBox) {\n this.constructor_2(image);\n } else {\n this.constructor_1(image, topLeft, bottomLeft, topRight, bottomRight);\n }\n }\n\n /**\n *\n * @param image\n * @param topLeft\n * @param bottomLeft\n * @param topRight\n * @param bottomRight\n *\n * @throws NotFoundException\n */\n private constructor_1( image: BitMatrix,\n topLeft: ResultPoint,\n bottomLeft: ResultPoint,\n topRight: ResultPoint,\n bottomRight: ResultPoint) {\n const leftUnspecified = topLeft == null || bottomLeft == null;\n const rightUnspecified = topRight == null || bottomRight == null;\n if (leftUnspecified && rightUnspecified) {\n throw new NotFoundException();\n }\n if (leftUnspecified) {\n topLeft = new ResultPoint(0, topRight.getY());\n bottomLeft = new ResultPoint(0, bottomRight.getY());\n } else if (rightUnspecified) {\n topRight = new ResultPoint(image.getWidth() - 1, topLeft.getY());\n bottomRight = new ResultPoint(image.getWidth() - 1, bottomLeft.getY());\n }\n this.image = image;\n this.topLeft = topLeft;\n this.bottomLeft = bottomLeft;\n this.topRight = topRight;\n this.bottomRight = bottomRight;\n this.minX = Math.trunc(Math.min(topLeft.getX(), bottomLeft.getX()));\n this.maxX = Math.trunc(Math.max(topRight.getX(), bottomRight.getX()));\n this.minY = Math.trunc(Math.min(topLeft.getY(), topRight.getY()));\n this.maxY = Math.trunc(Math.max(bottomLeft.getY(), bottomRight.getY()));\n }\n\n private constructor_2(boundingBox: BoundingBox) {\n this.image = boundingBox.image;\n this.topLeft = boundingBox.getTopLeft();\n this.bottomLeft = boundingBox.getBottomLeft();\n this.topRight = boundingBox.getTopRight();\n this.bottomRight = boundingBox.getBottomRight();\n this.minX = boundingBox.getMinX();\n this.maxX = boundingBox.getMaxX();\n this.minY = boundingBox.getMinY();\n this.maxY = boundingBox.getMaxY();\n }\n\n /**\n * @throws NotFoundException\n */\n static merge( leftBox: BoundingBox, rightBox: BoundingBox): BoundingBox {\n if (leftBox == null) {\n return rightBox;\n }\n if (rightBox == null) {\n return leftBox;\n }\n return new BoundingBox(leftBox.image, leftBox.topLeft, leftBox.bottomLeft, rightBox.topRight, rightBox.bottomRight);\n }\n\n /**\n * @throws NotFoundException\n */\n addMissingRows(missingStartRows: int, missingEndRows: int, isLeft: boolean): BoundingBox {\n let newTopLeft: ResultPoint = this.topLeft;\n let newBottomLeft: ResultPoint = this.bottomLeft;\n let newTopRight: ResultPoint = this.topRight;\n let newBottomRight: ResultPoint = this.bottomRight;\n\n if (missingStartRows > 0) {\n let top: ResultPoint = isLeft ? this.topLeft : this.topRight;\n let newMinY: int = Math.trunc(top.getY() - missingStartRows);\n if (newMinY < 0) {\n newMinY = 0;\n }\n let newTop: ResultPoint = new ResultPoint(top.getX(), newMinY);\n if (isLeft) {\n newTopLeft = newTop;\n } else {\n newTopRight = newTop;\n }\n }\n\n if (missingEndRows > 0) {\n let bottom: ResultPoint = isLeft ? this.bottomLeft : this.bottomRight;\n let newMaxY: int = Math.trunc(bottom.getY() + missingEndRows);\n if (newMaxY >= this.image.getHeight()) {\n newMaxY = this.image.getHeight() - 1;\n }\n let newBottom: ResultPoint = new ResultPoint(bottom.getX(), newMaxY);\n if (isLeft) {\n newBottomLeft = newBottom;\n } else {\n newBottomRight = newBottom;\n }\n }\n\n return new BoundingBox(this.image, newTopLeft, newBottomLeft, newTopRight, newBottomRight);\n }\n\n getMinX(): int {\n return this.minX;\n }\n\n getMaxX(): int {\n return this.maxX;\n }\n\n getMinY(): int {\n return this.minY;\n }\n\n getMaxY(): int {\n return this.maxY;\n }\n\n getTopLeft(): ResultPoint {\n return this.topLeft;\n }\n\n getTopRight(): ResultPoint {\n return this.topRight;\n }\n\n getBottomLeft(): ResultPoint {\n return this.bottomLeft;\n }\n\n getBottomRight(): ResultPoint {\n return this.bottomRight;\n }\n\n}\n","/*\n * Copyright 2013 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// package com.google.zxing.pdf417.decoder;\n\n// import java.util.Formatter;\nimport Formatter from '../../util/Formatter';\n\nimport Codeword from './Codeword';\nimport BoundingBox from './BoundingBox';\n\nimport { int } from '../../../customTypings';\n\n/**\n * @author Guenther Grau\n */\nexport default class DetectionResultColumn {\n\n private static /*final*/ MAX_NEARBY_DISTANCE: int = 5;\n\n private /*final*/ boundingBox: BoundingBox;\n private /*final*/ codewords: Codeword[];\n\n constructor(boundingBox: BoundingBox) {\n this.boundingBox = new BoundingBox(boundingBox);\n // this.codewords = new Codeword[boundingBox.getMaxY() - boundingBox.getMinY() + 1];\n this.codewords = new Array(boundingBox.getMaxY() - boundingBox.getMinY() + 1);\n }\n\n /*final*/ getCodewordNearby(imageRow: int): Codeword {\n let codeword = this.getCodeword(imageRow);\n if (codeword != null) {\n return codeword;\n }\n for (let i = 1; i < DetectionResultColumn.MAX_NEARBY_DISTANCE; i++) {\n let nearImageRow = this.imageRowToCodewordIndex(imageRow) - i;\n if (nearImageRow >= 0) {\n codeword = this.codewords[nearImageRow];\n if (codeword != null) {\n return codeword;\n }\n }\n nearImageRow = this.imageRowToCodewordIndex(imageRow) + i;\n if (nearImageRow < this.codewords.length) {\n codeword = this.codewords[nearImageRow];\n if (codeword != null) {\n return codeword;\n }\n }\n }\n return null;\n }\n\n /*final int*/ imageRowToCodewordIndex(imageRow: int): int {\n return imageRow - this.boundingBox.getMinY();\n }\n\n /*final void*/ setCodeword(imageRow: int, codeword: Codeword): void {\n this.codewords[this.imageRowToCodewordIndex(imageRow)] = codeword;\n }\n\n/*final*/ getCodeword(imageRow: int): Codeword {\n return this.codewords[this.imageRowToCodewordIndex(imageRow)];\n }\n\n/*final*/ getBoundingBox(): BoundingBox {\n return this.boundingBox;\n }\n\n/*final*/ getCodewords(): Codeword[] {\n return this.codewords;\n }\n\n // @Override\n public toString(): string {\n const formatter = new Formatter();\n let row = 0;\n for (const codeword of this.codewords) {\n if (codeword == null) {\n formatter.format('%3d: | %n', row++);\n continue;\n }\n formatter.format('%3d: %3d|%3d%n', row++, codeword.getRowNumber(), codeword.getValue());\n }\n return formatter.toString();\n\n }\n\n}\n","/*\n * Copyright 2013 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// package com.google.zxing.pdf417.decoder;\n\n// import com.google.zxing.pdf417.PDF417Common;\nimport PDF417Common from '../PDF417Common';\n\nimport { int, Collection } from '../../../customTypings';\n\n// import java.util.ArrayList;\n// import java.util.Collection;\n// import java.util.HashMap;\n// import java.util.Map;\n// import java.util.Map.Entry;\n\n/**\n * @author Guenther Grau\n */\nexport default /*final*/ class BarcodeValue {\n private /*final*/ values = new Map();\n\n /**\n * Add an occurrence of a value\n */\n setValue(value: int): void {\n value = Math.trunc(value);\n let confidence: int = this.values.get(value);\n if (confidence == null) {\n confidence = 0;\n }\n confidence++;\n this.values.set(value, confidence);\n }\n\n /**\n * Determines the maximum occurrence of a set value and returns all values which were set with this occurrence.\n * @return an array of int, containing the values with the highest occurrence, or null, if no value was set\n */\n getValue(): Int32Array {\n let maxConfidence: int = -1;\n let result: Collection = new Array();\n for (const [key, value] of this.values.entries()) {\n\n const entry = {\n getKey: () => key,\n getValue: () => value,\n };\n\n if (entry.getValue() > maxConfidence) {\n maxConfidence = entry.getValue();\n result = [];\n result.push(entry.getKey());\n } else if (entry.getValue() === maxConfidence) {\n result.push(entry.getKey());\n }\n }\n return PDF417Common.toIntArray(result);\n }\n\n getConfidence(value: int): int {\n return this.values.get(value);\n }\n\n}\n","import Exception from './Exception';\n\n/**\n * Custom Error class of type Exception.\n */\nexport default class ReaderException extends Exception {}\n","/*\n * Copyright 2008 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*namespace com.google.zxing.common.reedsolomon {*/\n\n/*import java.util.ArrayList;*/\n/*import java.util.List;*/\n\nimport GenericGF from './GenericGF';\nimport GenericGFPoly from './GenericGFPoly';\n\nimport System from '../../util/System';\nimport IllegalArgumentException from '../../IllegalArgumentException';\n\n/**\n *

Implements Reed-Solomon encoding, as the name implies.

\n *\n * @author Sean Owen\n * @author William Rucklidge\n */\nexport default class ReedSolomonEncoder {\n\n private field: GenericGF;\n private cachedGenerators: GenericGFPoly[];\n\n /**\n * A reed solomon error-correcting encoding constructor is created by\n * passing as Galois Field with of size equal to the number of code\n * words (symbols) in the alphabet (the number of values in each\n * element of arrays that are encoded/decoded).\n * @param field A galois field with a number of elements equal to the size\n * of the alphabet of symbols to encode.\n */\n public constructor(field: GenericGF) {\n this.field = field;\n this.cachedGenerators = [];\n this.cachedGenerators.push(new GenericGFPoly(field, Int32Array.from([1])));\n }\n\n private buildGenerator(degree: number /*int*/): GenericGFPoly {\n const cachedGenerators = this.cachedGenerators;\n if (degree >= cachedGenerators.length) {\n let lastGenerator = cachedGenerators[cachedGenerators.length - 1];\n const field = this.field;\n for (let d = cachedGenerators.length; d <= degree; d++) {\n const nextGenerator = lastGenerator.multiply(\n new GenericGFPoly(field, Int32Array.from([1, field.exp(d - 1 + field.getGeneratorBase())])));\n cachedGenerators.push(nextGenerator);\n lastGenerator = nextGenerator;\n }\n }\n return cachedGenerators[degree];\n }\n\n /**\n *

Encode a sequence of code words (symbols) using Reed-Solomon to allow decoders\n * to detect and correct errors that may have been introduced when the resulting\n * data is stored or transmitted.

\n *\n * @param toEncode array used for both and output. Caller initializes the array with\n * the code words (symbols) to be encoded followed by empty elements allocated to make\n * space for error-correction code words in the encoded output. The array contains\n * the encdoded output when encode returns. Code words are encoded as numbers from\n * 0 to n-1, where n is the number of possible code words (symbols), as determined\n * by the size of the Galois Field passed in the constructor of this object.\n * @param ecBytes the number of elements reserved in the array (first parameter)\n * to store error-correction code words. Thus, the number of code words (symbols)\n * to encode in the first parameter is thus toEncode.length - ecBytes.\n * Note, the use of \"bytes\" in the name of this parameter is misleading, as there may\n * be more or fewer than 256 symbols being encoded, as determined by the number of\n * elements in the Galois Field passed as a constructor to this object.\n * @throws IllegalArgumentException thrown in response to validation errros.\n */\n public encode(toEncode: Int32Array, ecBytes: number /*int*/): void {\n if (ecBytes === 0) {\n throw new IllegalArgumentException('No error correction bytes');\n }\n const dataBytes = toEncode.length - ecBytes;\n if (dataBytes <= 0) {\n throw new IllegalArgumentException('No data bytes provided');\n }\n const generator = this.buildGenerator(ecBytes);\n const infoCoefficients: Int32Array = new Int32Array(dataBytes);\n System.arraycopy(toEncode, 0, infoCoefficients, 0, dataBytes);\n let info = new GenericGFPoly(this.field, infoCoefficients);\n info = info.multiplyByMonomial(ecBytes, 1);\n const remainder = info.divide(generator)[1];\n const coefficients = remainder.getCoefficients();\n const numZeroCoefficients = ecBytes - coefficients.length;\n for (let i = 0; i < numZeroCoefficients; i++) {\n toEncode[dataBytes + i] = 0;\n }\n System.arraycopy(coefficients, 0, toEncode, dataBytes + numZeroCoefficients, coefficients.length);\n }\n\n}\n","/*\n * Copyright 2008 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*namespace com.google.zxing.qrcode.encoder {*/\n\nimport ByteMatrix from './ByteMatrix';\n\nimport IllegalArgumentException from '../../IllegalArgumentException';\n\n/**\n * @author Satoru Takabayashi\n * @author Daniel Switkin\n * @author Sean Owen\n */\nexport default class MaskUtil {\n\n // Penalty weights from section 6.8.2.1\n private static N1 = 3;\n private static N2 = 3;\n private static N3 = 40;\n private static N4 = 10;\n\n private constructor() {\n // do nothing\n }\n\n /**\n * Apply mask penalty rule 1 and return the penalty. Find repetitive cells with the same color and\n * give penalty to them. Example: 00000 or 11111.\n */\n public static applyMaskPenaltyRule1(matrix: ByteMatrix): number /*int*/ {\n return MaskUtil.applyMaskPenaltyRule1Internal(matrix, true) + MaskUtil.applyMaskPenaltyRule1Internal(matrix, false);\n }\n\n /**\n * Apply mask penalty rule 2 and return the penalty. Find 2x2 blocks with the same color and give\n * penalty to them. This is actually equivalent to the spec's rule, which is to find MxN blocks and give a\n * penalty proportional to (M-1)x(N-1), because this is the number of 2x2 blocks inside such a block.\n */\n public static applyMaskPenaltyRule2(matrix: ByteMatrix): number /*int*/ {\n let penalty = 0;\n const array: Array = matrix.getArray();\n const width: number /*int*/ = matrix.getWidth();\n const height: number /*int*/ = matrix.getHeight();\n for (let y = 0; y < height - 1; y++) {\n const arrayY = array[y];\n for (let x = 0; x < width - 1; x++) {\n const value = arrayY[x];\n if (value === arrayY[x + 1] && value === array[y + 1][x] && value === array[y + 1][x + 1]) {\n penalty++;\n }\n }\n }\n return MaskUtil.N2 * penalty;\n }\n\n /**\n * Apply mask penalty rule 3 and return the penalty. Find consecutive runs of 1:1:3:1:1:4\n * starting with black, or 4:1:1:3:1:1 starting with white, and give penalty to them. If we\n * find patterns like 000010111010000, we give penalty once.\n */\n public static applyMaskPenaltyRule3(matrix: ByteMatrix): number /*int*/ {\n let numPenalties = 0;\n const array: Array = matrix.getArray();\n const width: number /*int*/ = matrix.getWidth();\n const height: number /*int*/ = matrix.getHeight();\n for (let y = 0; y < height; y++) {\n for (let x = 0; x < width; x++) {\n const arrayY: Uint8Array = array[y]; // We can at least optimize this access\n if (x + 6 < width &&\n arrayY[x] === 1 &&\n arrayY[x + 1] === 0 &&\n arrayY[x + 2] === 1 &&\n arrayY[x + 3] === 1 &&\n arrayY[x + 4] === 1 &&\n arrayY[x + 5] === 0 &&\n arrayY[x + 6] === 1 &&\n (MaskUtil.isWhiteHorizontal(arrayY, x - 4, x) || MaskUtil.isWhiteHorizontal(arrayY, x + 7, x + 11))) {\n numPenalties++;\n }\n if (y + 6 < height &&\n array[y][x] === 1 &&\n array[y + 1][x] === 0 &&\n array[y + 2][x] === 1 &&\n array[y + 3][x] === 1 &&\n array[y + 4][x] === 1 &&\n array[y + 5][x] === 0 &&\n array[y + 6][x] === 1 &&\n (MaskUtil.isWhiteVertical(array, x, y - 4, y) || MaskUtil.isWhiteVertical(array, x, y + 7, y + 11))) {\n numPenalties++;\n }\n }\n }\n return numPenalties * MaskUtil.N3;\n }\n\n private static isWhiteHorizontal(rowArray: Uint8Array, from: number /*int*/, to: number /*int*/): boolean {\n from = Math.max(from, 0);\n to = Math.min(to, rowArray.length);\n for (let i = from; i < to; i++) {\n if (rowArray[i] === 1) {\n return false;\n }\n }\n return true;\n }\n\n private static isWhiteVertical(array: Uint8Array[], col: number /*int*/, from: number /*int*/, to: number /*int*/): boolean {\n from = Math.max(from, 0);\n to = Math.min(to, array.length);\n for (let i = from; i < to; i++) {\n if (array[i][col] === 1) {\n return false;\n }\n }\n return true;\n }\n\n /**\n * Apply mask penalty rule 4 and return the penalty. Calculate the ratio of dark cells and give\n * penalty if the ratio is far from 50%. It gives 10 penalty for 5% distance.\n */\n public static applyMaskPenaltyRule4(matrix: ByteMatrix): number /*int*/ {\n let numDarkCells = 0;\n const array: Array = matrix.getArray();\n const width: number /*int*/ = matrix.getWidth();\n const height: number /*int*/ = matrix.getHeight();\n for (let y = 0; y < height; y++) {\n const arrayY: Uint8Array = array[y];\n for (let x = 0; x < width; x++) {\n if (arrayY[x] === 1) {\n numDarkCells++;\n }\n }\n }\n const numTotalCells = matrix.getHeight() * matrix.getWidth();\n const fivePercentVariances = Math.floor(Math.abs(numDarkCells * 2 - numTotalCells) * 10 / numTotalCells);\n return fivePercentVariances * MaskUtil.N4;\n }\n\n /**\n * Return the mask bit for \"getMaskPattern\" at \"x\" and \"y\". See 8.8 of JISX0510:2004 for mask\n * pattern conditions.\n */\n public static getDataMaskBit(maskPattern: number /*int*/, x: number /*int*/, y: number /*int*/): boolean {\n let intermediate: number; /*int*/\n let temp: number; /*int*/\n switch (maskPattern) {\n case 0:\n intermediate = (y + x) & 0x1;\n break;\n case 1:\n intermediate = y & 0x1;\n break;\n case 2:\n intermediate = x % 3;\n break;\n case 3:\n intermediate = (y + x) % 3;\n break;\n case 4:\n intermediate = (Math.floor(y / 2) + Math.floor(x / 3)) & 0x1;\n break;\n case 5:\n temp = y * x;\n intermediate = (temp & 0x1) + (temp % 3);\n break;\n case 6:\n temp = y * x;\n intermediate = ((temp & 0x1) + (temp % 3)) & 0x1;\n break;\n case 7:\n temp = y * x;\n intermediate = ((temp % 3) + ((y + x) & 0x1)) & 0x1;\n break;\n default:\n throw new IllegalArgumentException('Invalid mask pattern: ' + maskPattern);\n }\n return intermediate === 0;\n }\n\n /**\n * Helper function for applyMaskPenaltyRule1. We need this for doing this calculation in both\n * vertical and horizontal orders respectively.\n */\n private static applyMaskPenaltyRule1Internal(matrix: ByteMatrix, isHorizontal: boolean): number /*int*/ {\n let penalty = 0;\n const iLimit = isHorizontal ? matrix.getHeight() : matrix.getWidth();\n const jLimit = isHorizontal ? matrix.getWidth() : matrix.getHeight();\n const array: Array = matrix.getArray();\n for (let i = 0; i < iLimit; i++) {\n let numSameBitCells = 0;\n let prevBit = -1;\n for (let j = 0; j < jLimit; j++) {\n const bit = isHorizontal ? array[i][j] : array[j][i];\n if (bit === prevBit) {\n numSameBitCells++;\n } else {\n if (numSameBitCells >= 5) {\n penalty += MaskUtil.N1 + (numSameBitCells - 5);\n }\n numSameBitCells = 1; // Include the cell itself.\n prevBit = bit;\n }\n }\n if (numSameBitCells >= 5) {\n penalty += MaskUtil.N1 + (numSameBitCells - 5);\n }\n }\n return penalty;\n }\n\n}\n","/*\n * Copyright 2008 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*namespace com.google.zxing.qrcode {*/\n\nimport BarcodeFormat from '../BarcodeFormat';\nimport EncodeHintType from '../EncodeHintType';\nimport Writer from '../Writer';\nimport BitMatrix from '../common/BitMatrix';\nimport ErrorCorrectionLevel from './decoder/ErrorCorrectionLevel';\nimport Encoder from './encoder/Encoder';\nimport QRCode from './encoder/QRCode';\n\nimport IllegalArgumentException from '../IllegalArgumentException';\nimport IllegalStateException from '../IllegalStateException';\n\n/*import java.util.Map;*/\n\n/**\n * This object renders a QR Code as a BitMatrix 2D array of greyscale values.\n *\n * @author dswitkin@google.com (Daniel Switkin)\n */\nexport default class QRCodeWriter implements Writer {\n\n private static QUIET_ZONE_SIZE = 4;\n\n /*@Override*/\n // public encode(contents: string, format: BarcodeFormat, width: number /*int*/, height: number /*int*/): BitMatrix\n // /*throws WriterException */ {\n\n // return encode(contents, format, width, height, null)\n // }\n\n /*@Override*/\n public encode(contents: string,\n format: BarcodeFormat,\n width: number /*int*/,\n height: number /*int*/,\n hints: Map): BitMatrix /*throws WriterException */ {\n\n if (contents.length === 0) {\n throw new IllegalArgumentException('Found empty contents');\n }\n\n if (format !== BarcodeFormat.QR_CODE) {\n throw new IllegalArgumentException('Can only encode QR_CODE, but got ' + format);\n }\n\n if (width < 0 || height < 0) {\n throw new IllegalArgumentException(`Requested dimensions are too small: ${width}x${height}`);\n }\n\n let errorCorrectionLevel = ErrorCorrectionLevel.L;\n let quietZone = QRCodeWriter.QUIET_ZONE_SIZE;\n if (hints !== null) {\n if (undefined !== hints.get(EncodeHintType.ERROR_CORRECTION)) {\n errorCorrectionLevel = ErrorCorrectionLevel.fromString(hints.get(EncodeHintType.ERROR_CORRECTION).toString());\n }\n if (undefined !== hints.get(EncodeHintType.MARGIN)) {\n quietZone = Number.parseInt(hints.get(EncodeHintType.MARGIN).toString(), 10);\n }\n }\n\n const code: QRCode = Encoder.encode(contents, errorCorrectionLevel, hints);\n return QRCodeWriter.renderResult(code, width, height, quietZone);\n }\n\n // Note that the input matrix uses 0 == white, 1 == black, while the output matrix uses\n // 0 == black, 255 == white (i.e. an 8 bit greyscale bitmap).\n private static renderResult(code: QRCode, width: number /*int*/, height: number /*int*/, quietZone: number /*int*/): BitMatrix {\n const input = code.getMatrix();\n if (input === null) {\n throw new IllegalStateException();\n }\n const inputWidth = input.getWidth();\n const inputHeight = input.getHeight();\n const qrWidth = inputWidth + (quietZone * 2);\n const qrHeight = inputHeight + (quietZone * 2);\n const outputWidth = Math.max(width, qrWidth);\n const outputHeight = Math.max(height, qrHeight);\n\n const multiple = Math.min(Math.floor(outputWidth / qrWidth), Math.floor(outputHeight / qrHeight));\n // Padding includes both the quiet zone and the extra white pixels to accommodate the requested\n // dimensions. For example, if input is 25x25 the QR will be 33x33 including the quiet zone.\n // If the requested size is 200x160, the multiple will be 4, for a QR of 132x132. These will\n // handle all the padding from 100x100 (the actual QR) up to 200x160.\n const leftPadding = Math.floor((outputWidth - (inputWidth * multiple)) / 2);\n const topPadding = Math.floor((outputHeight - (inputHeight * multiple)) / 2);\n\n const output = new BitMatrix(outputWidth, outputHeight);\n\n for (let inputY = 0, outputY = topPadding; inputY < inputHeight; inputY++ , outputY += multiple) {\n // Write the contents of this row of the barcode\n for (let inputX = 0, outputX = leftPadding; inputX < inputWidth; inputX++ , outputX += multiple) {\n if (input.get(inputX, inputY) === 1) {\n output.setRegion(outputX, outputY, multiple, multiple);\n }\n }\n }\n\n return output;\n }\n\n}\n","import FormatException from '../../../../FormatException';\nimport NotFoundException from '../../../../NotFoundException';\nimport IllegalStateException from '../../../../IllegalStateException';\nimport BitArray from '../../../../common/BitArray';\nimport CurrentParsingState from './CurrentParsingState';\nimport StringBuilder from '../../../../util/StringBuilder';\nimport DecodedChar from './DecodedChar';\nimport DecodedNumeric from './DecodedNumeric';\nimport DecodedObject from './DecodedObject';\nimport DecodedInformation from './DecodedInformation'\nimport FieldParser from './FieldParser';\nimport BlockParsedResult from './BlockParsedResult';\nexport default class GeneralAppIdDecoder{\n private readonly information: BitArray;\n private readonly current: CurrentParsingState;\n private readonly buffer = new StringBuilder();\n\n constructor(information: BitArray) {\n this.information = information;\n }\n decodeAllCodes(buff:StringBuilder,initialPosition:number):string {\n let currentPosition = initialPosition;\n let remaining = null;\n do {\n let info = this.decodeGeneralPurposeField(currentPosition, remaining);\n let parsedFields = FieldParser.parseFieldsInGeneralPurpose(info.getNewString());\n if (parsedFields != null) {\n buff.append(parsedFields);\n }\n if (info.isRemaining()) {\n remaining = \"\"+info.getRemainingValue();\n } else {\n remaining = null;\n }\n\n if (currentPosition == info.getNewPosition()) { // No step forward!\n break;\n }\n currentPosition = info.getNewPosition();\n } while (true);\n\n return buff.toString();\n }\n\n private isStillNumeric(pos:number):boolean {\n // It's numeric if it still has 7 positions\n // and one of the first 4 bits is \"1\".\n if (pos + 7 > this.information.getSize()) {\n return pos + 4 <= this.information.getSize();\n }\n\n for (let i = pos; i < pos + 3; ++i) {\n if (this.information.get(i)) {\n return true;\n }\n }\n\n return this.information.get(pos + 3);\n }\n\n private decodeNumeric(pos:number):DecodedNumeric {\n if (pos + 7 > this.information.getSize()) {\n let numeric = this.extractNumericValueFromBitArray(pos, 4);\n if (numeric == 0) {\n return new DecodedNumeric(this.information.getSize(), DecodedNumeric.FNC1, DecodedNumeric.FNC1);\n }\n return new DecodedNumeric(this.information.getSize(), numeric - 1, DecodedNumeric.FNC1);\n }\n let numeric = this.extractNumericValueFromBitArray(pos, 7);\n\n let digit1 = (numeric - 8) / 11;\n let digit2 = (numeric - 8) % 11;\n\n return new DecodedNumeric(pos + 7, digit1, digit2);\n }\n\n extractNumericValueFromBitArray(pos:number,bits:number):number {\n return GeneralAppIdDecoder.extractNumericValueFromBitArray(this.information, pos, bits);\n }\n\n static extractNumericValueFromBitArray(information:BitArray, pos:number,bits:number):number {\n let value = 0;\n for (let i = 0; i < bits; ++i) {\n if (information.get(pos + i)) {\n value |= 1 << (bits - i - 1);\n }\n }\n\n return value;\n }\n\n decodeGeneralPurposeField(pos:number, remaining:string):DecodedInformation {\n //this.buffer.setLength(0);\n this.buffer.setLengthToZero();\n\n if (remaining != null) {\n this.buffer.append(remaining);\n }\n\n this.current.setPosition(pos);\n\n let lastDecoded = this.parseBlocks();\n if (lastDecoded != null && lastDecoded.isRemaining()) {\n return new DecodedInformation(this.current.getPosition(), this.buffer.toString(), lastDecoded.getRemainingValue());\n }\n return new DecodedInformation(this.current.getPosition(), this.buffer.toString());\n }\n\n private parseBlocks():DecodedInformation {\n let isFinished:boolean;\n let result:BlockParsedResult;\n do {\n let initialPosition = this.current.getPosition();\n\n if (this.current.isAlpha()) {\n result = this.parseAlphaBlock();\n isFinished = result.isFinished();\n } else if (this.current.isIsoIec646()) {\n result = this.parseIsoIec646Block();\n isFinished = result.isFinished();\n } else { // it must be numeric\n result = this.parseNumericBlock();\n isFinished = result.isFinished();\n }\n\n let positionChanged:boolean = initialPosition != this.current.getPosition();\n if (!positionChanged && !isFinished) {\n break;\n }\n } while (!isFinished);\n\n return result.getDecodedInformation();\n }\n\n private parseNumericBlock():BlockParsedResult {\n while (this.isStillNumeric(this.current.getPosition())) {\n let numeric:DecodedNumeric = this.decodeNumeric(this.current.getPosition());\n this.current.setPosition(numeric.getNewPosition());\n\n if (numeric.isFirstDigitFNC1()) {\n let information: DecodedInformation;\n if (numeric.isSecondDigitFNC1()) {\n information = new DecodedInformation(this.current.getPosition(), this.buffer.toString());\n } else {\n information = new DecodedInformation(this.current.getPosition(), this.buffer.toString(), numeric.getSecondDigit());\n }\n return new BlockParsedResult(true,information);\n }\n this.buffer.append(numeric.getFirstDigit());\n\n if (numeric.isSecondDigitFNC1()) {\n let information = new DecodedInformation(this.current.getPosition(), this.buffer.toString());\n return new BlockParsedResult(true, information);\n }\n this.buffer.append(numeric.getSecondDigit());\n }\n\n if (this.isNumericToAlphaNumericLatch(this.current.getPosition())) {\n this.current.setAlpha();\n this.current.incrementPosition(4);\n }\n return new BlockParsedResult(false);\n }\n\n private parseIsoIec646Block():BlockParsedResult {\n while (this.isStillIsoIec646(this.current.getPosition())) {\n let iso = this.decodeIsoIec646(this.current.getPosition());\n this.current.setPosition(iso.getNewPosition());\n\n if (iso.isFNC1()) {\n let information = new DecodedInformation(this.current.getPosition(), this.buffer.toString());\n return new BlockParsedResult(true,information);\n }\n this.buffer.append(iso.getValue());\n }\n\n if (this.isAlphaOr646ToNumericLatch(this.current.getPosition())) {\n this.current.incrementPosition(3);\n this.current.setNumeric();\n } else if (this.isAlphaTo646ToAlphaLatch(this.current.getPosition())) {\n if (this.current.getPosition() + 5 < this.information.getSize()) {\n this.current.incrementPosition(5);\n } else {\n this.current.setPosition(this.information.getSize());\n }\n\n this.current.setAlpha();\n }\n return new BlockParsedResult(false);\n }\n\n private parseAlphaBlock():BlockParsedResult {\n while (this.isStillAlpha(this.current.getPosition())) {\n let alpha = this.decodeAlphanumeric(this.current.getPosition());\n this.current.setPosition(alpha.getNewPosition());\n\n if (alpha.isFNC1()) {\n let information = new DecodedInformation(this.current.getPosition(), this.buffer.toString());\n return new BlockParsedResult(true,information); //end of the char block\n }\n\n this.buffer.append(alpha.getValue());\n }\n\n if (this.isAlphaOr646ToNumericLatch(this.current.getPosition())) {\n this.current.incrementPosition(3);\n this.current.setNumeric();\n } else if (this.isAlphaTo646ToAlphaLatch(this.current.getPosition())) {\n if (this.current.getPosition() + 5 < this.information.getSize()) {\n this.current.incrementPosition(5);\n } else {\n this.current.setPosition(this.information.getSize());\n }\n\n this.current.setIsoIec646();\n }\n return new BlockParsedResult(false);\n }\n\n private isStillIsoIec646(pos:number):boolean {\n if (pos + 5 > this.information.getSize()) {\n return false;\n }\n\n let fiveBitValue = this.extractNumericValueFromBitArray(pos, 5);\n if (fiveBitValue >= 5 && fiveBitValue < 16) {\n return true;\n }\n\n if (pos + 7 > this.information.getSize()) {\n return false;\n }\n\n let sevenBitValue = this.extractNumericValueFromBitArray(pos, 7);\n if (sevenBitValue >= 64 && sevenBitValue < 116) {\n return true;\n }\n\n if (pos + 8 > this.information.getSize()) {\n return false;\n }\n\n let eightBitValue = this.extractNumericValueFromBitArray(pos, 8);\n return eightBitValue >= 232 && eightBitValue < 253;\n\n }\n\n private decodeIsoIec646(pos:number):DecodedChar {\n let fiveBitValue = this.extractNumericValueFromBitArray(pos, 5);\n if (fiveBitValue == 15) {\n return new DecodedChar(pos + 5, DecodedChar.FNC1);\n }\n\n if (fiveBitValue >= 5 && fiveBitValue < 15) {\n return new DecodedChar(pos + 5, ('0' + (fiveBitValue - 5)));\n }\n\n let sevenBitValue = this.extractNumericValueFromBitArray(pos, 7);\n\n if (sevenBitValue >= 64 && sevenBitValue < 90) {\n return new DecodedChar(pos + 7, (\"\"+(sevenBitValue + 1)));\n }\n\n if (sevenBitValue >= 90 && sevenBitValue < 116) {\n return new DecodedChar(pos + 7, (\"\"+(sevenBitValue + 7)));\n }\n\n let eightBitValue = this.extractNumericValueFromBitArray(pos, 8);\n let c;\n switch (eightBitValue) {\n case 232:\n c = '!';\n break;\n case 233:\n c = '\"';\n break;\n case 234:\n c = '%';\n break;\n case 235:\n c = '&';\n break;\n case 236:\n c = '\\'';\n break;\n case 237:\n c = '(';\n break;\n case 238:\n c = ')';\n break;\n case 239:\n c = '*';\n break;\n case 240:\n c = '+';\n break;\n case 241:\n c = ',';\n break;\n case 242:\n c = '-';\n break;\n case 243:\n c = '.';\n break;\n case 244:\n c = '/';\n break;\n case 245:\n c = ':';\n break;\n case 246:\n c = ';';\n break;\n case 247:\n c = '<';\n break;\n case 248:\n c = '=';\n break;\n case 249:\n c = '>';\n break;\n case 250:\n c = '?';\n break;\n case 251:\n c = '_';\n break;\n case 252:\n c = ' ';\n break;\n default:\n throw new FormatException();\n }\n return new DecodedChar(pos + 8, c);\n }\n\n private isStillAlpha(pos:number):boolean {\n if (pos + 5 > this.information.getSize()) {\n return false;\n }\n\n // We now check if it's a valid 5-bit value (0..9 and FNC1)\n let fiveBitValue = this.extractNumericValueFromBitArray(pos, 5);\n if (fiveBitValue >= 5 && fiveBitValue < 16) {\n return true;\n }\n\n if (pos + 6 > this.information.getSize()) {\n return false;\n }\n\n let sixBitValue = this.extractNumericValueFromBitArray(pos, 6);\n return sixBitValue >= 16 && sixBitValue < 63; // 63 not included\n }\n\n private decodeAlphanumeric(pos:number):DecodedChar {\n let fiveBitValue = this.extractNumericValueFromBitArray(pos, 5);\n if (fiveBitValue == 15) {\n return new DecodedChar(pos + 5, DecodedChar.FNC1);\n }\n\n if (fiveBitValue >= 5 && fiveBitValue < 15) {\n return new DecodedChar(pos + 5, ('0' + (fiveBitValue - 5)));\n }\n\n let sixBitValue = this.extractNumericValueFromBitArray(pos, 6);\n\n if (sixBitValue >= 32 && sixBitValue < 58) {\n return new DecodedChar(pos + 6, (''+ (sixBitValue + 33)));\n }\n\n let c;\n switch (sixBitValue) {\n case 58:\n c = '*';\n break;\n case 59:\n c = ',';\n break;\n case 60:\n c = '-';\n break;\n case 61:\n c = '.';\n break;\n case 62:\n c = '/';\n break;\n default:\n throw new IllegalStateException(\"Decoding invalid alphanumeric value: \" + sixBitValue);\n }\n return new DecodedChar(pos + 6, c);\n }\n\n private isAlphaTo646ToAlphaLatch(pos:number):boolean {\n if (pos + 1 > this.information.getSize()) {\n return false;\n }\n\n for (let i = 0; i < 5 && i + pos < this.information.getSize(); ++i) {\n if (i == 2) {\n if (!this.information.get(pos + 2)) {\n return false;\n }\n } else if (this.information.get(pos + i)) {\n return false;\n }\n }\n\n return true;\n }\n\n private isAlphaOr646ToNumericLatch(pos:number):boolean {\n // Next is alphanumeric if there are 3 positions and they are all zeros\n if (pos + 3 > this.information.getSize()) {\n return false;\n }\n\n for (let i = pos; i < pos + 3; ++i) {\n if (this.information.get(i)) {\n return false;\n }\n }\n return true;\n }\n\n private isNumericToAlphaNumericLatch(pos:number):boolean {\n // Next is alphanumeric if there are 4 positions and they are all zeros, or\n // if there is a subset of this just before the end of the symbol\n if (pos + 1 > this.information.getSize()) {\n return false;\n }\n\n for (let i = 0; i < 4 && i + pos < this.information.getSize(); ++i) {\n if (this.information.get(pos + i)) {\n return false;\n }\n }\n return true;\n }\n\n\n}","import BitArray from '../../../../common/BitArray';\nimport GeneralAppIdDecoder from './GeneralAppIdDecoder';\n\nexport default abstract class AbstractExpandedDecoder {\n\n private readonly information: BitArray;\n private readonly generalDecoder: GeneralAppIdDecoder;\n\n constructor(information: BitArray) {\n this.information = information;\n this.generalDecoder = new GeneralAppIdDecoder(information);\n }\n\n protected getInformation(): BitArray {\n return this.information;\n }\n\n protected getGeneralDecoder(): GeneralAppIdDecoder {\n return this.generalDecoder;\n }\n\n public abstract parseInformation(): string;\n\n // createDecoder moved to own file due to circular dependency\n}\n","import AI01weightDecoder from './AI01weightDecoder';\nimport BitArray from '../../../../common/BitArray';\nimport StringBuilder from '../../../../util/StringBuilder';\nimport NotFoundException from '../../../../NotFoundException';\n\nexport default abstract class AI013x0xDecoder extends AI01weightDecoder{\n private static readonly HEADER_SIZE = 4 + 1;\n private static readonly WEIGHT_SIZE = 15;\n\n constructor(information: BitArray) {\n super(information);\n }\n\n\n public parseInformation() {\n if (this.getInformation().getSize() != AI013x0xDecoder.HEADER_SIZE + AI01weightDecoder.GTIN_SIZE + AI013x0xDecoder.WEIGHT_SIZE) {\n throw new NotFoundException();\n }\n\n let buf = new StringBuilder();\n\n this.encodeCompressedGtin(buf, AI013x0xDecoder.HEADER_SIZE);\n this.encodeCompressedWeight(buf, AI013x0xDecoder.HEADER_SIZE + AI01weightDecoder.GTIN_SIZE, AI013x0xDecoder.WEIGHT_SIZE);\n\n return buf.toString();\n }\n}","import BitArray from '../../../../common/BitArray';\nimport AI01decoder from './AI01decoder';\nimport StringBuilder from '../../../../util/StringBuilder';\nexport default abstract class AI01weightDecoder extends AI01decoder {\n\n constructor(information: BitArray){\n super(information);\n}\n\n encodeCompressedWeight(buf:StringBuilder, currentPos:number, weightSize:number):void {\n let originalWeightNumeric = this.getGeneralDecoder().extractNumericValueFromBitArray(currentPos, weightSize);\n this.addWeightCode(buf, originalWeightNumeric);\n\n let weightNumeric = this.checkWeight(originalWeightNumeric);\n\n let currentDivisor = 100000;\n for (let i = 0; i < 5; ++i) {\n if (weightNumeric / currentDivisor == 0) {\n buf.append('0');\n }\n currentDivisor /= 10;\n }\n buf.append(weightNumeric);\n }\n\n protected abstract addWeightCode(buf:StringBuilder,weight:number):void;\n\n protected abstract checkWeight(weight:number):number;\n}","// browser\nexport * from './browser/BrowserAztecCodeReader';\nexport * from './browser/BrowserBarcodeReader';\nexport * from './browser/BrowserCodeReader';\nexport * from './browser/BrowserDatamatrixCodeReader';\nexport * from './browser/BrowserMultiFormatReader';\nexport * from './browser/BrowserPDF417Reader';\nexport * from './browser/BrowserQRCodeReader';\nexport * from './browser/BrowserQRCodeSvgWriter';\nexport * from './browser/DecodeContinuouslyCallback';\nexport * from './browser/HTMLCanvasElementLuminanceSource';\nexport * from './browser/HTMLVisualMediaElement';\nexport * from './browser/VideoInputDevice';\n","import { BrowserCodeReader } from './BrowserCodeReader';\nimport AztecReader from '../core/aztec/AztecReader';\n\n/**\n * Aztec Code reader to use from browser.\n *\n * @class BrowserAztecCodeReader\n * @extends {BrowserCodeReader}\n */\nexport class BrowserAztecCodeReader extends BrowserCodeReader {\n /**\n * Creates an instance of BrowserAztecCodeReader.\n * @param {number} [timeBetweenScansMillis=500] the time delay between subsequent decode tries\n *\n * @memberOf BrowserAztecCodeReader\n */\n public constructor(timeBetweenScansMillis: number = 500) {\n super(new AztecReader(), timeBetweenScansMillis);\n }\n}\n","(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :\n typeof define === 'function' && define.amd ? define(['exports'], factory) :\n (factory((global.tsCustomError = {})));\n}(this, (function (exports) {\n /*! *****************************************************************************\r\n Copyright (c) Microsoft Corporation. All rights reserved.\r\n Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\n this file except in compliance with the License. You may obtain a copy of the\r\n License at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\n WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\n MERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\n See the Apache Version 2.0 License for specific language governing permissions\r\n and limitations under the License.\r\n ***************************************************************************** */\r\n /* global Reflect, Promise */\r\n\r\n var extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n\r\n function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n }\n\n function fixProto(target, prototype) {\n var setPrototypeOf = Object.setPrototypeOf;\n setPrototypeOf ? setPrototypeOf(target, prototype) : (target.__proto__ = prototype);\n }\n\n function fixStack(target, fn) {\n if (fn === void 0) {\n fn = target.constructor;\n }\n var captureStackTrace = Error.captureStackTrace;\n captureStackTrace && captureStackTrace(target, fn);\n }\n\n\n\n //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInV0aWxzLnRzKG9yaWdpbmFsKSJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLFNBQVMsU0FBUyxNQUFRLEVB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pO1xyXG59XHJcbi8vIyBzb3VyY2VNYXBwaW5nVVJMPXV0aWxzLmpzLm1hcCJdfQ==\n\n var CustomError = (function (_super) {\n __extends(CustomError, _super);\n function CustomError(message) {\n var _newTarget = this.constructor;\n var _this = _super.call(this, message) || this;\n Object.defineProperty(_this, 'name', {\n value: _newTarget.name,\n enumerable: false\n });\n fixProto(_this, _newTarget.prototype);\n fixStack(_this);\n return _this;\n }\n \n return CustomError;\n })(Error);\n\n\n //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImN1c3RvbS1lcnJvci50cyhvcmlnaW5hbCkiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsWUFBWSxhQUFhO0FBQ3pCLFFBQVMsVUFBVSxlQUFnQjtBQUNuQyxHQUFBLENBQUksZUFBZSxVQUFVLFFBQVE7SUFDakMsT0FBQSxDQUFRLFNBQVIsQ0FBa0IsYUFBYTtJQUMvQixTQUFTLFlBQVksU0FBUztRQUMxQixHQUFBLENBQUksYUFBYSxJQUFBLENBQUs7UUFDdEIsR0FBQSxDQUFJLFFBQVEsTUFBQSxDQUFPLElBQVAsQ0FBWSxNQUFNLFFBQWxCLENBQUEsRUFBQSxDQUE4QjtRQUMxQyxNQUFBLENBQU8sY0FBUCxDQUFzQixPQUFPLFFBQVE7WUFDakMsT0FBTyxVQUFBLENBQVcsSUFEZSxDQUFBO1lBRWpDLFlBQVk7O1FBRWhCLFFBQUEsQ0FBUyxPQUFPLFVBQUEsQ0FBVztRQUMzQixRQUFBLENBQVM7UUFDVCxPQUFPO0lBQ2Y7O0lBQ0ksT0FBTztBQUNYLEVBZG1CLENBY2pCO0FBQ0YsT0FBQSxDQUFTO0FBakJUIiwiZmlsZSI6ImN1c3RvbS1lcnJvci50cyhvcmlnaW5hbCkiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgKiBhcyB0c2xpYl8xIGZyb20gXCJ0c2xpYlwiO1xyXG5pbXBvcnQgeyBmaXhQcm90bywgZml4U3RhY2sgfSBmcm9tICcuL3V0aWxzJztcclxudmFyIEN1c3RvbUVycm9yID0gKGZ1bmN0aW9uIChfc3VwZXIpIHtcclxuICAgIHRzbGliXzEuX19leHRlbmRzKEN1c3RvbUVycm9yLCBfc3VwZXIpO1xyXG4gICAgZnVuY3Rpb24gQ3VzdG9tRXJyb3IobWVzc2FnZSkge1xyXG4gICAgICAgIHZhciBfbmV3VGFyZ2V0ID0gdGhpcy5jb25zdHJ1Y3RvcjtcclxuICAgICAgICB2YXIgX3RoaXMgPSBfc3VwZXIuY2FsbCh0aGlzLCBtZXNzYWdlKSB8fCB0aGlzO1xyXG4gICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShfdGhpcywgJ25hbWUnLCB7XHJcbiAgICAgICAgICAgIHZhbHVlOiBfbmV3VGFyZ2V0Lm5hbWUsXHJcbiAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLFxyXG4gICAgICAgIH0pO1xyXG4gICAgICAgIGZpeFByb3RvKF90aGlzLCBfbmV3VGFyZ2V0LnByb3RvdHlwZSk7XHJcbiAgICAgICAgZml4U3RhY2soX3RoaXMpO1xyXG4gICAgICAgIHJldHVybiBfdGhpcztcclxuICAgIH1cclxuICAgIHJldHVybiBDdXN0b21FcnJvcjtcclxufShFcnJvcikpO1xyXG5leHBvcnQgeyBDdXN0b21FcnJvciB9O1xyXG4vLyMgc291cmNlTWFwcGluZ1VSTD1jdXN0b20tZXJyb3IuanMubWFwIl19\n\n function customErrorFactory(fn, parent) {\n if (parent === void 0) {\n parent = Error;\n }\n function CustomError() {\n var args = [];\n for (var _i = 0;_i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n if (!(this instanceof CustomError)) \n return new (CustomError.bind.apply(CustomError, [void 0].concat(args)))();\n parent.apply(this, args);\n fn.apply(this, args);\n this.name = fn.name || parent.name;\n fixStack(this, CustomError);\n }\n \n return Object.defineProperties(CustomError, {\n prototype: {\n value: Object.create(parent.prototype, {\n constructor: {\n value: CustomError,\n writable: true,\n configurable: true\n }\n })\n }\n });\n }\n\n\n\n //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImZhY3RvcnkudHMob3JpZ2luYWwpIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLFFBQVMsZUFBZ0I7QUFDekIsT0FBTyxTQUFTLG1CQUFtQixFQUFJLEVBQUEsUUFBUTtJQUMzQyxJQUFJLE1BQUEsQ0FBQSxHQUFBLENBQVcsSUFBQSxDQUFLLEdBQUc7UUFBRSxNQUFBLENBQUEsQ0FBQSxDQUFTO0lBQXRDO0lBQ0ksU0FBUyxjQUFjO1FBQ25CLEdBQUEsQ0FBSSxPQUFPO1FBQ1gsS0FBSyxHQUFBLENBQUksS0FBSyxFQUFHLEVBQUEsQ0FBQSxDQUFBLENBQUssU0FBQSxDQUFVLFFBQVEsRUFBQSxJQUFNO1lBQzFDLElBQUEsQ0FBSyxHQUFMLENBQUEsQ0FBQSxDQUFXLFNBQUEsQ0FBVTtRQUNqQztRQUNRLElBQUksRUFBRSxJQUFBLENBQUEsVUFBQSxDQUFnQjtZQUNsQixPQUFPLEtBQUssV0FBQSxDQUFZLElBQVosQ0FBaUIsS0FBakIsQ0FBdUIsYUFBYSxDQUFDLElBQUEsQ0FBSyxFQUFOLENBQVMsTUFBVCxDQUFnQixPQUF6RDtRQUNYLE1BQUEsQ0FBTyxLQUFQLENBQWEsTUFBTTtRQUNuQixFQUFBLENBQUcsS0FBSCxDQUFTLE1BQU07UUFDZixJQUFBLENBQUssSUFBTCxDQUFBLENBQUEsQ0FBWSxFQUFBLENBQUcsSUFBSCxDQUFBLEVBQUEsQ0FBVyxNQUFBLENBQU87UUFDOUIsUUFBQSxDQUFTLE1BQU07SUFDdkI7O0lBQ0ksT0FBTyxNQUFBLENBQU8sZ0JBQVAsQ0FBd0IsYUFBYTtRQUN4QyxXQU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VzdG9tRXJyb3IsIHtcclxuICAgICAgICBwcm90b3R5cGU6IHtcclxuICAgICAgICAgICAgdmFsdWU6IE9iamVjdC5jcmVhdGUocGFyZW50LnByb3RvdHlwZSwge1xyXG4gICAgICAgICAgICAgICAgY29uc3RydWN0b3I6IHtcclxuICAgICAgICAgICAgICAgICAgICB2YWx1ZTogQ3VzdG9tRXJyb3IsXHJcbiAgICAgICAgICAgICAgICAgICAgd3JpdGFibGU6IHRydWUsXHJcbiAgICAgICAgICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlLFxyXG4gICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgfSksXHJcbiAgICAgICAgfSxcclxuICAgIH0pO1xyXG59XHJcbi8vIyBzb3VyY2VNYXBwaW5nVVJMPWZhY3RvcnkuanMubWFwIl19\n\n //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzKG9yaWdpbmFsKSJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLGdCQUFBO0FBQ2QsY0FBYyxXQUFBO0FBRGQiLCJmaWxlIjoiaW5kZXgudHMob3JpZ2luYWwpIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0ICogZnJvbSAnLi9jdXN0b20tZXJyb3InO1xyXG5leHBvcnQgKiBmcm9tICcuL2ZhY3RvcnknO1xyXG4vLyMgc291cmNlTWFwcGluZ1VSTD1pbmRleC5qcy5tYXAiXX0=\n\n exports.CustomError = CustomError;\n exports.customErrorFactory = customErrorFactory;\n\n})));\n//# sourceMappingURL=custom-error.umd.js.map\n","import IndexOutOfBoundsException from './IndexOutOfBoundsException';\n\n/**\n * Custom Error class of type Exception.\n */\nexport default class ArrayIndexOutOfBoundsException extends IndexOutOfBoundsException {\n constructor(\n public index: number = undefined,\n public message: string = undefined\n ) {\n super(message);\n }\n}\n","/*\n * Copyright 2010 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\nimport AztecDetectorResult from '../AztecDetectorResult';\nimport BitMatrix from '../../common/BitMatrix';\nimport DecoderResult from '../../common/DecoderResult';\nimport GenericGF from '../../common/reedsolomon/GenericGF';\nimport ReedSolomonDecoder from '../../common/reedsolomon/ReedSolomonDecoder';\nimport IllegalStateException from '../../IllegalStateException';\nimport FormatException from '../../FormatException';\nimport { StringUtils } from '../../..';\nimport Integer from '../../util/Integer';\nimport { int } from '../../../customTypings';\n\n// import java.util.Arrays;\n\nenum Table {\n UPPER,\n LOWER,\n MIXED,\n DIGIT,\n PUNCT,\n BINARY\n}\n\n/**\n *

The main class which implements Aztec Code decoding -- as opposed to locating and extracting\n * the Aztec Code from an image.

\n *\n * @author David Olivier\n */\nexport default class Decoder {\n\n private static UPPER_TABLE: string[] = [\n 'CTRL_PS', ' ', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',\n 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'CTRL_LL', 'CTRL_ML', 'CTRL_DL', 'CTRL_BS'\n ];\n\n private static LOWER_TABLE: string[] = [\n 'CTRL_PS', ' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p',\n 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'CTRL_US', 'CTRL_ML', 'CTRL_DL', 'CTRL_BS'\n ];\n\n private static MIXED_TABLE: string[] = [\n // Module parse failed: Octal literal in strict mode (50:29)\n // so number string were scaped\n 'CTRL_PS', ' ', '\\\\1', '\\\\2', '\\\\3', '\\\\4', '\\\\5', '\\\\6', '\\\\7', '\\b', '\\t', '\\n',\n '\\\\13', '\\f', '\\r', '\\\\33', '\\\\34', '\\\\35', '\\\\36', '\\\\37', '@', '\\\\', '^', '_',\n '`', '|', '~', '\\\\177', 'CTRL_LL', 'CTRL_UL', 'CTRL_PL', 'CTRL_BS'\n ];\n\n private static PUNCT_TABLE: string[] = [\n '', '\\r', '\\r\\n', '. ', ', ', ': ', '!', '\"', '#', '$', '%', '&', '\\'', '(', ')',\n '*', '+', ',', '-', '.', '/', ':', ';', '<', '=', '>', '?', '[', ']', '{', '}', 'CTRL_UL'\n ];\n\n private static DIGIT_TABLE: string[] = [\n 'CTRL_PS', ' ', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ',', '.', 'CTRL_UL', 'CTRL_US'\n ];\n\n private ddata: AztecDetectorResult;\n\n public decode(detectorResult: AztecDetectorResult): DecoderResult {\n this.ddata = detectorResult;\n let matrix = detectorResult.getBits();\n let rawbits = this.extractBits(matrix);\n let correctedBits = this.correctBits(rawbits);\n let rawBytes = Decoder.convertBoolArrayToByteArray(correctedBits);\n let result = Decoder.getEncodedData(correctedBits);\n let decoderResult = new DecoderResult(rawBytes, result, null, null);\n decoderResult.setNumBits(correctedBits.length);\n return decoderResult;\n }\n\n // This method is used for testing the high-level encoder\n public static highLevelDecode(correctedBits: boolean[]): string {\n return this.getEncodedData(correctedBits);\n }\n\n /**\n * Gets the string encoded in the aztec code bits\n *\n * @return the decoded string\n */\n private static getEncodedData(correctedBits: boolean[]): string {\n let endIndex: number = correctedBits.length;\n let latchTable = Table.UPPER; // table most recently latched to\n let shiftTable = Table.UPPER; // table to use for the next read\n let result: string = '';\n let index = 0;\n while (index < endIndex) {\n if (shiftTable === Table.BINARY) {\n if (endIndex - index < 5) {\n break;\n }\n let length = Decoder.readCode(correctedBits, index, 5);\n index += 5;\n if (length === 0) {\n if (endIndex - index < 11) {\n break;\n }\n length = Decoder.readCode(correctedBits, index, 11) + 31;\n index += 11;\n }\n for (let charCount = 0; charCount < length; charCount++) {\n if (endIndex - index < 8) {\n index = endIndex; // Force outer loop to exit\n break;\n }\n const code: int = Decoder.readCode(correctedBits, index, 8);\n result += /*(char)*/ StringUtils.castAsNonUtf8Char(code);\n index += 8;\n }\n // Go back to whatever mode we had been in\n shiftTable = latchTable;\n } else {\n let size = shiftTable === Table.DIGIT ? 4 : 5;\n if (endIndex - index < size) {\n break;\n }\n let code = Decoder.readCode(correctedBits, index, size);\n index += size;\n let str = Decoder.getCharacter(shiftTable, code);\n if (str.startsWith('CTRL_')) {\n // Table changes\n // ISO/IEC 24778:2008 prescribes ending a shift sequence in the mode from which it was invoked.\n // That's including when that mode is a shift.\n // Our test case dlusbs.png for issue #642 exercises that.\n latchTable = shiftTable; // Latch the current mode, so as to return to Upper after U/S B/S\n shiftTable = Decoder.getTable(str.charAt(5));\n if (str.charAt(6) === 'L') {\n latchTable = shiftTable;\n }\n } else {\n result += str;\n // Go back to whatever mode we had been in\n shiftTable = latchTable;\n }\n }\n }\n return result;\n }\n\n /**\n * gets the table corresponding to the char passed\n */\n private static getTable(t: string): Table {\n switch (t) {\n case 'L':\n return Table.LOWER;\n case 'P':\n return Table.PUNCT;\n case 'M':\n return Table.MIXED;\n case 'D':\n return Table.DIGIT;\n case 'B':\n return Table.BINARY;\n case 'U':\n default:\n return Table.UPPER;\n }\n }\n\n /**\n * Gets the character (or string) corresponding to the passed code in the given table\n *\n * @param table the table used\n * @param code the code of the character\n */\n private static getCharacter(table: Table, code: number): string {\n switch (table) {\n case Table.UPPER:\n return Decoder.UPPER_TABLE[code];\n case Table.LOWER:\n return Decoder.LOWER_TABLE[code];\n case Table.MIXED:\n return Decoder.MIXED_TABLE[code];\n case Table.PUNCT:\n return Decoder.PUNCT_TABLE[code];\n case Table.DIGIT:\n return Decoder.DIGIT_TABLE[code];\n default:\n // Should not reach here.\n throw new IllegalStateException('Bad table');\n }\n }\n\n /**\n *

Performs RS error correction on an array of bits.

\n *\n * @return the corrected array\n * @throws FormatException if the input contains too many errors\n */\n private correctBits(rawbits: boolean[]): boolean[] {\n let gf: GenericGF;\n let codewordSize: number;\n\n if (this.ddata.getNbLayers() <= 2) {\n codewordSize = 6;\n gf = GenericGF.AZTEC_DATA_6;\n } else if (this.ddata.getNbLayers() <= 8) {\n codewordSize = 8;\n gf = GenericGF.AZTEC_DATA_8;\n } else if (this.ddata.getNbLayers() <= 22) {\n codewordSize = 10;\n gf = GenericGF.AZTEC_DATA_10;\n } else {\n codewordSize = 12;\n gf = GenericGF.AZTEC_DATA_12;\n }\n\n let numDataCodewords = this.ddata.getNbDatablocks();\n let numCodewords = rawbits.length / codewordSize;\n if (numCodewords < numDataCodewords) {\n throw new FormatException();\n }\n let offset = rawbits.length % codewordSize;\n\n let dataWords: Int32Array = new Int32Array(numCodewords);\n for (let i = 0; i < numCodewords; i++ , offset += codewordSize) {\n dataWords[i] = Decoder.readCode(rawbits, offset, codewordSize);\n }\n\n try {\n let rsDecoder = new ReedSolomonDecoder(gf);\n rsDecoder.decode(dataWords, numCodewords - numDataCodewords);\n } catch (ex) {\n throw new FormatException(ex);\n }\n\n // Now perform the unstuffing operation.\n // First, count how many bits are going to be thrown out as stuffing\n let mask = (1 << codewordSize) - 1;\n let stuffedBits = 0;\n for (let i = 0; i < numDataCodewords; i++) {\n let dataWord = dataWords[i];\n if (dataWord === 0 || dataWord === mask) {\n throw new FormatException();\n } else if (dataWord === 1 || dataWord === mask - 1) {\n stuffedBits++;\n }\n }\n // Now, actually unpack the bits and remove the stuffing\n let correctedBits: boolean[] = new Array(numDataCodewords * codewordSize - stuffedBits);\n let index = 0;\n for (let i = 0; i < numDataCodewords; i++) {\n let dataWord = dataWords[i];\n if (dataWord === 1 || dataWord === mask - 1) {\n // next codewordSize-1 bits are all zeros or all ones\n correctedBits.fill(dataWord > 1, index, index + codewordSize - 1);\n // Arrays.fill(correctedBits, index, index + codewordSize - 1, dataWord > 1);\n index += codewordSize - 1;\n } else {\n for (let bit = codewordSize - 1; bit >= 0; --bit) {\n correctedBits[index++] = (dataWord & (1 << bit)) !== 0;\n }\n }\n }\n return correctedBits;\n }\n\n /**\n * Gets the array of bits from an Aztec Code matrix\n *\n * @return the array of bits\n */\n private extractBits(matrix: BitMatrix): boolean[] {\n let compact = this.ddata.isCompact();\n let layers = this.ddata.getNbLayers();\n let baseMatrixSize = (compact ? 11 : 14) + layers * 4; // not including alignment lines\n let alignmentMap = new Int32Array(baseMatrixSize);\n let rawbits: boolean[] = new Array(this.totalBitsInLayer(layers, compact));\n\n if (compact) {\n for (let i = 0; i < alignmentMap.length; i++) {\n alignmentMap[i] = i;\n }\n } else {\n let matrixSize = baseMatrixSize + 1 + 2 * Integer.truncDivision((Integer.truncDivision(baseMatrixSize, 2) - 1), 15);\n let origCenter = baseMatrixSize / 2;\n let center = Integer.truncDivision(matrixSize, 2);\n for (let i = 0; i < origCenter; i++) {\n let newOffset = i + Integer.truncDivision(i, 15);\n alignmentMap[origCenter - i - 1] = center - newOffset - 1;\n alignmentMap[origCenter + i] = center + newOffset + 1;\n }\n }\n for (let i = 0, rowOffset = 0; i < layers; i++) {\n let rowSize = (layers - i) * 4 + (compact ? 9 : 12);\n // The top-left most point of this layer is (not including alignment lines)\n let low = i * 2;\n // The bottom-right most point of this layer is (not including alignment lines)\n let high = baseMatrixSize - 1 - low;\n // We pull bits from the two 2 x rowSize columns and two rowSize x 2 rows\n for (let j = 0; j < rowSize; j++) {\n let columnOffset = j * 2;\n for (let k = 0; k < 2; k++) {\n // left column\n rawbits[rowOffset + columnOffset + k] =\n matrix.get(alignmentMap[low + k], alignmentMap[low + j]);\n // bottom row\n rawbits[rowOffset + 2 * rowSize + columnOffset + k] =\n matrix.get(alignmentMap[low + j], alignmentMap[high - k]);\n // right column\n rawbits[rowOffset + 4 * rowSize + columnOffset + k] =\n matrix.get(alignmentMap[high - k], alignmentMap[high - j]);\n // top row\n rawbits[rowOffset + 6 * rowSize + columnOffset + k] =\n matrix.get(alignmentMap[high - j], alignmentMap[low + k]);\n }\n }\n rowOffset += rowSize * 8;\n }\n return rawbits;\n }\n\n /**\n * Reads a code of given length and at given index in an array of bits\n */\n private static readCode(rawbits: boolean[], startIndex: number, length: number): number {\n let res = 0;\n for (let i = startIndex; i < startIndex + length; i++) {\n res <<= 1;\n if (rawbits[i]) {\n res |= 0x01;\n }\n }\n return res;\n }\n\n /**\n * Reads a code of length 8 in an array of bits, padding with zeros\n */\n private static readByte(rawbits: boolean[], startIndex: number): number {\n let n = rawbits.length - startIndex;\n if (n >= 8) {\n return Decoder.readCode(rawbits, startIndex, 8);\n }\n return Decoder.readCode(rawbits, startIndex, n) << (8 - n);\n }\n\n /**\n * Packs a bit array into bytes, most significant bit first\n */\n public static convertBoolArrayToByteArray(boolArr: boolean[]): Uint8Array {\n let byteArr = new Uint8Array((boolArr.length + 7) / 8);\n for (let i = 0; i < byteArr.length; i++) {\n byteArr[i] = Decoder.readByte(boolArr, 8 * i);\n }\n return byteArr;\n }\n\n private totalBitsInLayer(layers: number, compact: boolean): number {\n return ((compact ? 88 : 112) + 16 * layers) * layers;\n }\n}\n","/*\n * Copyright 2010 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport ResultPoint from '../../ResultPoint';\nimport AztecDetectorResult from '../AztecDetectorResult';\nimport BitMatrix from '../../common/BitMatrix';\nimport CornerDetector from '../../common/detector/CornerDetector';\nimport MathUtils from '../../common/detector/MathUtils';\nimport WhiteRectangleDetector from '../../common/detector/WhiteRectangleDetector';\nimport GenericGF from '../../common/reedsolomon/GenericGF';\nimport ReedSolomonDecoder from '../../common/reedsolomon/ReedSolomonDecoder';\nimport NotFoundException from '../../NotFoundException';\nimport GridSamplerInstance from '../../common/GridSamplerInstance';\nimport Integer from '../../util/Integer';\n\n\nexport class Point {\n private x: number;\n private y: number;\n\n public toResultPoint(): ResultPoint {\n return new ResultPoint(this.getX(), this.getY());\n }\n\n public constructor(x: number, y: number) {\n this.x = x;\n this.y = y;\n }\n\n public getX(): number {\n return this.x;\n }\n\n public getY(): number {\n return this.y;\n }\n\n // @Override\n // public String toString() {\n // return \"<\" + x + ' ' + y + '>';\n // }\n}\n\n/**\n * Encapsulates logic that can detect an Aztec Code in an image, even if the Aztec Code\n * is rotated or skewed, or partially obscured.\n *\n * @author David Olivier\n * @author Frank Yellin\n */\nexport default class Detector {\n\n private EXPECTED_CORNER_BITS = new Int32Array([\n 0xee0, // 07340 XXX .XX X.. ...\n 0x1dc, // 00734 ... XXX .XX X..\n 0x83b, // 04073 X.. ... XXX .XX\n 0x707, // 03407 .XX X.. ... XXX\n ]);\n\n private image: BitMatrix;\n\n private compact: boolean;\n private nbLayers: number;\n private nbDataBlocks: number;\n private nbCenterLayers: number;\n private shift: number;\n\n public constructor(image: BitMatrix) {\n this.image = image;\n }\n\n public detect(): AztecDetectorResult {\n return this.detectMirror(false);\n }\n\n /**\n * Detects an Aztec Code in an image.\n *\n * @param isMirror if true, image is a mirror-image of original\n * @return {@link AztecDetectorResult} encapsulating results of detecting an Aztec Code\n * @throws NotFoundException if no Aztec Code can be found\n */\n public detectMirror(isMirror: boolean): AztecDetectorResult {\n\n // 1. Get the center of the aztec matrix\n let pCenter = this.getMatrixCenter();\n\n // 2. Get the center points of the four diagonal points just outside the bull's eye\n // [topRight, bottomRight, bottomLeft, topLeft]\n let bullsEyeCorners = this.getBullsEyeCorners(pCenter);\n\n if (isMirror) {\n let temp = bullsEyeCorners[0];\n bullsEyeCorners[0] = bullsEyeCorners[2];\n bullsEyeCorners[2] = temp;\n }\n\n // 3. Get the size of the matrix and other parameters from the bull's eye\n this.extractParameters(bullsEyeCorners);\n\n\n // 4. Sample the grid\n let bits: BitMatrix = this.sampleGrid(this.image,\n bullsEyeCorners[this.shift % 4],\n bullsEyeCorners[(this.shift + 1) % 4],\n bullsEyeCorners[(this.shift + 2) % 4],\n bullsEyeCorners[(this.shift + 3) % 4]\n );\n\n // 5. Get the corners of the matrix.\n let corners: ResultPoint[] = this.getMatrixCornerPoints(bullsEyeCorners);\n\n return new AztecDetectorResult(bits, corners, this.compact, this.nbDataBlocks, this.nbLayers);\n }\n\n /**\n * Extracts the number of data layers and data blocks from the layer around the bull's eye.\n *\n * @param bullsEyeCorners the array of bull's eye corners\n * @throws NotFoundException in case of too many errors or invalid parameters\n */\n private extractParameters(bullsEyeCorners: ResultPoint[]): void {\n if (!this.isValidPoint(bullsEyeCorners[0]) || !this.isValidPoint(bullsEyeCorners[1]) ||\n !this.isValidPoint(bullsEyeCorners[2]) || !this.isValidPoint(bullsEyeCorners[3])) {\n throw new NotFoundException();\n }\n let length = 2 * this.nbCenterLayers;\n // Get the bits around the bull's eye\n let sides = new Int32Array([\n this.sampleLine(bullsEyeCorners[0], bullsEyeCorners[1], length), // Right side\n this.sampleLine(bullsEyeCorners[1], bullsEyeCorners[2], length), // Bottom\n this.sampleLine(bullsEyeCorners[2], bullsEyeCorners[3], length), // Left side\n this.sampleLine(bullsEyeCorners[3], bullsEyeCorners[0], length) // Top\n ]);\n\n // bullsEyeCorners[shift] is the corner of the bulls'eye that has three\n // orientation marks.\n // sides[shift] is the row/column that goes from the corner with three\n // orientation marks to the corner with two.\n this.shift = this.getRotation(sides, length);\n\n // Flatten the parameter bits into a single 28- or 40-bit long\n let parameterData = 0;\n for (let i = 0; i < 4; i++) {\n let side = sides[(this.shift + i) % 4];\n if (this.compact) {\n // Each side of the form ..XXXXXXX. where Xs are parameter data\n parameterData <<= 7;\n parameterData += (side >> 1) & 0x7F;\n } else {\n // Each side of the form ..XXXXX.XXXXX. where Xs are parameter data\n parameterData <<= 10;\n parameterData += ((side >> 2) & (0x1f << 5)) + ((side >> 1) & 0x1F);\n }\n }\n\n // Corrects parameter data using RS. Returns just the data portion\n // without the error correction.\n let correctedData = this.getCorrectedParameterData(parameterData, this.compact);\n\n if (this.compact) {\n // 8 bits: 2 bits layers and 6 bits data blocks\n this.nbLayers = (correctedData >> 6) + 1;\n this.nbDataBlocks = (correctedData & 0x3F) + 1;\n } else {\n // 16 bits: 5 bits layers and 11 bits data blocks\n this.nbLayers = (correctedData >> 11) + 1;\n this.nbDataBlocks = (correctedData & 0x7FF) + 1;\n }\n }\n\n private getRotation(sides: Int32Array, length: number): number {\n // In a normal pattern, we expect to See\n // ** .* D A\n // * *\n //\n // . *\n // .. .. C B\n //\n // Grab the 3 bits from each of the sides the form the locator pattern and concatenate\n // into a 12-bit integer. Start with the bit at A\n let cornerBits = 0;\n sides.forEach((side, idx, arr) => {\n // XX......X where X's are orientation marks\n let t = ((side >> (length - 2)) << 1) + (side & 1);\n cornerBits = (cornerBits << 3) + t;\n });\n // for (var side in sides) {\n // // XX......X where X's are orientation marks\n // var t = ((side >> (length - 2)) << 1) + (side & 1);\n // cornerBits = (cornerBits << 3) + t;\n // }\n\n // Mov the bottom bit to the top, so that the three bits of the locator pattern at A are\n // together. cornerBits is now:\n // 3 orientation bits at A || 3 orientation bits at B || ... || 3 orientation bits at D\n cornerBits = ((cornerBits & 1) << 11) + (cornerBits >> 1);\n // The result shift indicates which element of BullsEyeCorners[] goes into the top-left\n // corner. Since the four rotation values have a Hamming distance of 8, we\n // can easily tolerate two errors.\n for (let shift = 0; shift < 4; shift++) {\n if (Integer.bitCount(cornerBits ^ this.EXPECTED_CORNER_BITS[shift]) <= 2) {\n return shift;\n }\n }\n throw new NotFoundException();\n }\n\n /**\n * Corrects the parameter bits using Reed-Solomon algorithm.\n *\n * @param parameterData parameter bits\n * @param compact true if this is a compact Aztec code\n * @throws NotFoundException if the array contains too many errors\n */\n private getCorrectedParameterData(parameterData: number, compact: boolean): number {\n let numCodewords;\n let numDataCodewords;\n\n if (compact) {\n numCodewords = 7;\n numDataCodewords = 2;\n } else {\n numCodewords = 10;\n numDataCodewords = 4;\n }\n\n let numECCodewords = numCodewords - numDataCodewords;\n let parameterWords: Int32Array = new Int32Array(numCodewords);\n for (let i = numCodewords - 1; i >= 0; --i) {\n parameterWords[i] = parameterData & 0xF;\n parameterData >>= 4;\n }\n try {\n let rsDecoder = new ReedSolomonDecoder(GenericGF.AZTEC_PARAM);\n rsDecoder.decode(parameterWords, numECCodewords);\n } catch (ignored) {\n throw new NotFoundException();\n }\n // Toss the error correction. Just return the data as an integer\n let result = 0;\n for (let i = 0; i < numDataCodewords; i++) {\n result = (result << 4) + parameterWords[i];\n }\n return result;\n }\n\n /**\n * Finds the corners of a bull-eye centered on the passed point.\n * This returns the centers of the diagonal points just outside the bull's eye\n * Returns [topRight, bottomRight, bottomLeft, topLeft]\n *\n * @param pCenter Center point\n * @return The corners of the bull-eye\n * @throws NotFoundException If no valid bull-eye can be found\n */\n private getBullsEyeCorners(pCenter: Point): ResultPoint[] {\n\n\n let pina = pCenter;\n let pinb = pCenter;\n let pinc = pCenter;\n let pind = pCenter;\n\n let color = true;\n\n for (this.nbCenterLayers = 1; this.nbCenterLayers < 9; this.nbCenterLayers++) {\n\n let pouta = this.getFirstDifferent(pina, color, 1, -1);\n let poutb = this.getFirstDifferent(pinb, color, 1, 1);\n let poutc = this.getFirstDifferent(pinc, color, -1, 1);\n let poutd = this.getFirstDifferent(pind, color, -1, -1);\n\n // d a\n //\n // c b\n\n if (this.nbCenterLayers > 2) {\n let q = (this.distancePoint(poutd, pouta) * this.nbCenterLayers) / (this.distancePoint(pind, pina) * (this.nbCenterLayers + 2));\n if (q < 0.75 || q > 1.25 || !this.isWhiteOrBlackRectangle(pouta, poutb, poutc, poutd)) {\n break;\n }\n }\n\n pina = pouta;\n pinb = poutb;\n pinc = poutc;\n pind = poutd;\n\n color = !color;\n }\n\n if (this.nbCenterLayers !== 5 && this.nbCenterLayers !== 7) {\n throw new NotFoundException();\n }\n\n this.compact = this.nbCenterLayers === 5;\n\n // Expand the square by .5 pixel in each direction so that we're on the border\n // between the white square and the black square\n let pinax = new ResultPoint(pina.getX() + 0.5, pina.getY() - 0.5);\n let pinbx = new ResultPoint(pinb.getX() + 0.5, pinb.getY() + 0.5);\n let pincx = new ResultPoint(pinc.getX() - 0.5, pinc.getY() + 0.5);\n let pindx = new ResultPoint(pind.getX() - 0.5, pind.getY() - 0.5);\n\n // Expand the square so that its corners are the centers of the points\n // just outside the bull's eye.\n return this.expandSquare([pinax, pinbx, pincx, pindx],\n 2 * this.nbCenterLayers - 3,\n 2 * this.nbCenterLayers);\n }\n\n /**\n * Finds a candidate center point of an Aztec code from an image\n *\n * @return the center point\n */\n private getMatrixCenter(): Point {\n\n let pointA: ResultPoint;\n let pointB: ResultPoint;\n let pointC: ResultPoint;\n let pointD: ResultPoint;\n\n // Get a white rectangle that can be the border of the matrix in center bull's eye or\n try {\n\n let cornerPoints = new WhiteRectangleDetector(this.image).detect();\n pointA = cornerPoints[0];\n pointB = cornerPoints[1];\n pointC = cornerPoints[2];\n pointD = cornerPoints[3];\n\n } catch (e) {\n\n // This exception can be in case the initial rectangle is white\n // In that case, surely in the bull's eye, we try to expand the rectangle.\n let cx = this.image.getWidth() / 2;\n let cy = this.image.getHeight() / 2;\n pointA = this.getFirstDifferent(new Point(cx + 7, cy - 7), false, 1, -1).toResultPoint();\n pointB = this.getFirstDifferent(new Point(cx + 7, cy + 7), false, 1, 1).toResultPoint();\n pointC = this.getFirstDifferent(new Point(cx - 7, cy + 7), false, -1, 1).toResultPoint();\n pointD = this.getFirstDifferent(new Point(cx - 7, cy - 7), false, -1, -1).toResultPoint();\n\n }\n\n // Compute the center of the rectangle\n let cx = MathUtils.round((pointA.getX() + pointD.getX() + pointB.getX() + pointC.getX()) / 4.0);\n let cy = MathUtils.round((pointA.getY() + pointD.getY() + pointB.getY() + pointC.getY()) / 4.0);\n\n // Redetermine the white rectangle starting from previously computed center.\n // This will ensure that we end up with a white rectangle in center bull's eye\n // in order to compute a more accurate center.\n try {\n let cornerPoints = new WhiteRectangleDetector(this.image, 15, cx, cy).detect();\n pointA = cornerPoints[0];\n pointB = cornerPoints[1];\n pointC = cornerPoints[2];\n pointD = cornerPoints[3];\n } catch (e) {\n // This exception can be in case the initial rectangle is white\n // In that case we try to expand the rectangle.\n pointA = this.getFirstDifferent(new Point(cx + 7, cy - 7), false, 1, -1).toResultPoint();\n pointB = this.getFirstDifferent(new Point(cx + 7, cy + 7), false, 1, 1).toResultPoint();\n pointC = this.getFirstDifferent(new Point(cx - 7, cy + 7), false, -1, 1).toResultPoint();\n pointD = this.getFirstDifferent(new Point(cx - 7, cy - 7), false, -1, -1).toResultPoint();\n }\n\n // Recompute the center of the rectangle\n cx = MathUtils.round((pointA.getX() + pointD.getX() + pointB.getX() + pointC.getX()) / 4.0);\n cy = MathUtils.round((pointA.getY() + pointD.getY() + pointB.getY() + pointC.getY()) / 4.0);\n\n return new Point(cx, cy);\n }\n\n /**\n * Gets the Aztec code corners from the bull's eye corners and the parameters.\n *\n * @param bullsEyeCorners the array of bull's eye corners\n * @return the array of aztec code corners\n */\n private getMatrixCornerPoints(bullsEyeCorners: ResultPoint[]): ResultPoint[] {\n return this.expandSquare(bullsEyeCorners, 2 * this.nbCenterLayers, this.getDimension());\n }\n\n /**\n * Creates a BitMatrix by sampling the provided image.\n * topLeft, topRight, bottomRight, and bottomLeft are the centers of the squares on the\n * diagonal just outside the bull's eye.\n */\n private sampleGrid(image: BitMatrix,\n topLeft: ResultPoint,\n topRight: ResultPoint,\n bottomRight: ResultPoint,\n bottomLeft: ResultPoint): BitMatrix {\n\n let sampler = GridSamplerInstance.getInstance();\n let dimension = this.getDimension();\n\n let low = dimension / 2 - this.nbCenterLayers;\n let high = dimension / 2 + this.nbCenterLayers;\n\n return sampler.sampleGrid(image,\n dimension,\n dimension,\n low, low, // topleft\n high, low, // topright\n high, high, // bottomright\n low, high, // bottomleft\n topLeft.getX(), topLeft.getY(),\n topRight.getX(), topRight.getY(),\n bottomRight.getX(), bottomRight.getY(),\n bottomLeft.getX(), bottomLeft.getY());\n }\n\n /**\n * Samples a line.\n *\n * @param p1 start point (inclusive)\n * @param p2 end point (exclusive)\n * @param size number of bits\n * @return the array of bits as an int (first bit is high-order bit of result)\n */\n private sampleLine(p1: ResultPoint, p2: ResultPoint, size: number): number {\n let result = 0;\n\n let d = this.distanceResultPoint(p1, p2);\n let moduleSize = d / size;\n let px = p1.getX();\n let py = p1.getY();\n let dx = moduleSize * (p2.getX() - p1.getX()) / d;\n let dy = moduleSize * (p2.getY() - p1.getY()) / d;\n for (let i = 0; i < size; i++) {\n if (this.image.get(MathUtils.round(px + i * dx), MathUtils.round(py + i * dy))) {\n result |= 1 << (size - i - 1);\n }\n }\n return result;\n }\n\n /**\n * @return true if the border of the rectangle passed in parameter is compound of white points only\n * or black points only\n */\n private isWhiteOrBlackRectangle(p1: Point,\n p2: Point,\n p3: Point,\n p4: Point): boolean {\n\n let corr = 3;\n p1 = new Point(p1.getX() - corr, p1.getY() + corr);\n p2 = new Point(p2.getX() - corr, p2.getY() - corr);\n p3 = new Point(p3.getX() + corr, p3.getY() - corr);\n p4 = new Point(p4.getX() + corr, p4.getY() + corr);\n\n let cInit = this.getColor(p4, p1);\n\n if (cInit === 0) {\n return false;\n }\n\n let c = this.getColor(p1, p2);\n\n if (c !== cInit) {\n return false;\n }\n\n c = this.getColor(p2, p3);\n\n if (c !== cInit) {\n return false;\n }\n\n c = this.getColor(p3, p4);\n\n return c === cInit;\n\n }\n\n /**\n * Gets the color of a segment\n *\n * @return 1 if segment more than 90% black, -1 if segment is more than 90% white, 0 else\n */\n private getColor(p1: Point, p2: Point): number {\n let d = this.distancePoint(p1, p2);\n let dx = (p2.getX() - p1.getX()) / d;\n let dy = (p2.getY() - p1.getY()) / d;\n let error = 0;\n\n let px = p1.getX();\n let py = p1.getY();\n\n let colorModel = this.image.get(p1.getX(), p1.getY());\n\n let iMax = Math.ceil(d);\n for (let i = 0; i < iMax; i++) {\n px += dx;\n py += dy;\n if (this.image.get(MathUtils.round(px), MathUtils.round(py)) !== colorModel) {\n error++;\n }\n }\n\n let errRatio = error / d;\n\n if (errRatio > 0.1 && errRatio < 0.9) {\n return 0;\n }\n\n return (errRatio <= 0.1) === colorModel ? 1 : -1;\n }\n\n /**\n * Gets the coordinate of the first point with a different color in the given direction\n */\n private getFirstDifferent(init: Point, color: boolean, dx: number, dy: number): Point {\n let x = init.getX() + dx;\n let y = init.getY() + dy;\n\n while (this.isValid(x, y) && this.image.get(x, y) === color) {\n x += dx;\n y += dy;\n }\n\n x -= dx;\n y -= dy;\n\n while (this.isValid(x, y) && this.image.get(x, y) === color) {\n x += dx;\n }\n x -= dx;\n\n while (this.isValid(x, y) && this.image.get(x, y) === color) {\n y += dy;\n }\n y -= dy;\n\n return new Point(x, y);\n }\n\n /**\n * Expand the square represented by the corner points by pushing out equally in all directions\n *\n * @param cornerPoints the corners of the square, which has the bull's eye at its center\n * @param oldSide the original length of the side of the square in the target bit matrix\n * @param newSide the new length of the size of the square in the target bit matrix\n * @return the corners of the expanded square\n */\n private expandSquare(cornerPoints: ResultPoint[], oldSide: number, newSide: number): ResultPoint[] {\n let ratio = newSide / (2.0 * oldSide);\n let dx = cornerPoints[0].getX() - cornerPoints[2].getX();\n let dy = cornerPoints[0].getY() - cornerPoints[2].getY();\n let centerx = (cornerPoints[0].getX() + cornerPoints[2].getX()) / 2.0;\n let centery = (cornerPoints[0].getY() + cornerPoints[2].getY()) / 2.0;\n\n let result0 = new ResultPoint(centerx + ratio * dx, centery + ratio * dy);\n let result2 = new ResultPoint(centerx - ratio * dx, centery - ratio * dy);\n\n dx = cornerPoints[1].getX() - cornerPoints[3].getX();\n dy = cornerPoints[1].getY() - cornerPoints[3].getY();\n centerx = (cornerPoints[1].getX() + cornerPoints[3].getX()) / 2.0;\n centery = (cornerPoints[1].getY() + cornerPoints[3].getY()) / 2.0;\n let result1 = new ResultPoint(centerx + ratio * dx, centery + ratio * dy);\n let result3 = new ResultPoint(centerx - ratio * dx, centery - ratio * dy);\n\n let results: ResultPoint[] = [result0, result1, result2, result3];\n return results;\n }\n\n private isValid(x: number, y: number): boolean {\n return x >= 0 && x < this.image.getWidth() && y > 0 && y < this.image.getHeight();\n }\n\n private isValidPoint(point: ResultPoint): boolean {\n let x = MathUtils.round(point.getX());\n let y = MathUtils.round(point.getY());\n return this.isValid(x, y);\n }\n\n private distancePoint(a: Point, b: Point): number {\n return MathUtils.distance(a.getX(), a.getY(), b.getX(), b.getY());\n }\n\n private distanceResultPoint(a: ResultPoint, b: ResultPoint): number {\n return MathUtils.distance(a.getX(), a.getY(), b.getX(), b.getY());\n }\n\n private getDimension(): number {\n if (this.compact) {\n return 4 * this.nbLayers + 11;\n }\n if (this.nbLayers <= 4) {\n return 4 * this.nbLayers + 15;\n }\n return 4 * this.nbLayers + 2 * (Integer.truncDivision((this.nbLayers - 4), 8) + 1) + 15;\n }\n\n}\n","/*\n * Copyright 2010 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport ResultPoint from '../ResultPoint';\nimport BitMatrix from '../common/BitMatrix';\nimport DetectorResult from '../common/DetectorResult';\n\n/**\n *

Extends {@link DetectorResult} with more information specific to the Aztec format,\n * like the number of layers and whether it's compact.

\n *\n * @author Sean Owen\n */\nexport default class AztecDetectorResult extends DetectorResult {\n\n private compact: boolean;\n private nbDatablocks: number;\n private nbLayers: number;\n\n public constructor(bits: BitMatrix,\n points: ResultPoint[],\n compact: boolean,\n nbDatablocks: number,\n nbLayers: number) {\n super(bits, points);\n this.compact = compact;\n this.nbDatablocks = nbDatablocks;\n this.nbLayers = nbLayers;\n }\n\n public getNbLayers(): number {\n return this.nbLayers;\n }\n\n public getNbDatablocks(): number {\n return this.nbDatablocks;\n }\n\n public isCompact(): boolean {\n return this.compact;\n }\n}\n","import { BrowserCodeReader } from './BrowserCodeReader';\nimport MultiFormatOneDReader from '../core/oned/MultiFormatOneDReader';\nimport DecodeHintType from '../core/DecodeHintType';\n\n/**\n * @deprecated Moving to @zxing/browser\n *\n * Barcode reader reader to use from browser.\n */\nexport class BrowserBarcodeReader extends BrowserCodeReader {\n /**\n * Creates an instance of BrowserBarcodeReader.\n * @param {number} [timeBetweenScansMillis=500] the time delay between subsequent decode tries\n * @param {Map} hints\n */\n public constructor(timeBetweenScansMillis: number = 500, hints?: Map) {\n super(new MultiFormatOneDReader(hints), timeBetweenScansMillis, hints);\n }\n}\n","import DataCharacter from './DataCharacter';\nimport FinderPattern from './FinderPattern';\n\nexport default class Pair extends DataCharacter {\n\n private finderPattern: FinderPattern;\n private count: number = 0;\n\n public constructor(value: number, checksumPortion: number, finderPattern: FinderPattern) {\n super(value, checksumPortion);\n this.finderPattern = finderPattern;\n }\n\n getFinderPattern(): FinderPattern {\n return this.finderPattern;\n }\n\n getCount(): number {\n return this.count;\n }\n\n incrementCount() {\n this.count++;\n }\n\n}\n","/*\n * Copyright 2008 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport BarcodeFormat from '../BarcodeFormat';\nimport BitArray from '../common/BitArray';\nimport DecodeHintType from '../DecodeHintType';\n\nimport Result from '../Result';\nimport OneDReader from './OneDReader';\nimport UPCEANReader from './UPCEANReader';\nimport EAN13Reader from './EAN13Reader';\nimport EAN8Reader from './EAN8Reader';\nimport NotFoundException from '../NotFoundException';\n\n/**\n *

A reader that can read all available UPC/EAN formats. If a caller wants to try to\n * read all such formats, it is most efficient to use this implementation rather than invoke\n * individual readers.

\n *\n * @author Sean Owen\n */\nexport default class MultiFormatUPCEANReader extends OneDReader {\n private readers: UPCEANReader[];\n\n public constructor(hints?: Map) {\n super();\n let possibleFormats = hints == null ? null : hints.get(DecodeHintType.POSSIBLE_FORMATS);\n let readers: UPCEANReader[] = [];\n if (possibleFormats != null) {\n if (possibleFormats.indexOf(BarcodeFormat.EAN_13) > -1) {\n readers.push(new EAN13Reader());\n }\n\n if (possibleFormats.indexOf(BarcodeFormat.EAN_8) > -1) {\n readers.push(new EAN8Reader());\n }\n // todo add UPC_A, UPC_E\n }\n\n if (readers.length === 0) {\n readers.push(new EAN13Reader());\n readers.push(new EAN8Reader());\n // todo add UPC_A, UPC_E\n }\n\n this.readers = readers;\n }\n\n public decodeRow(rowNumber: number, row: BitArray, hints?: Map): Result {\n for (let reader of this.readers) {\n try {\n return reader.decodeRow(rowNumber, row, hints);\n // TODO ean13MayBeUPCA\n } catch (err) {\n // continue;\n }\n }\n throw new NotFoundException();\n }\n\n public reset() {\n for (let reader of this.readers) {\n reader.reset();\n }\n }\n}\n","/*\n * Copyright (C) 2010 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport BitArray from '../common/BitArray';\nimport AbstractUPCEANReader from './AbstractUPCEANReader';\nimport UPCEANExtension5Support from './UPCEANExtension5Support';\nimport UPCEANExtension2Support from './UPCEANExtension2Support';\nimport Result from '../Result';\n\nexport default class UPCEANExtensionSupport {\n private static EXTENSION_START_PATTERN = [1, 1, 2];\n\n static decodeRow(rowNumber: number, row: BitArray, rowOffset: number): Result {\n let extensionStartRange = AbstractUPCEANReader.findGuardPattern(row, rowOffset, false, this.EXTENSION_START_PATTERN, new Array(this.EXTENSION_START_PATTERN.length).fill(0));\n try {\n // return null;\n let fiveSupport = new UPCEANExtension5Support();\n return fiveSupport.decodeRow(rowNumber, row, extensionStartRange);\n } catch (err) {\n // return null;\n let twoSupport = new UPCEANExtension2Support();\n return twoSupport.decodeRow(rowNumber, row, extensionStartRange);\n }\n }\n}\n","/*\n * Copyright (C) 2010 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport BarcodeFormat from '../BarcodeFormat';\nimport BitArray from '../common/BitArray';\n\n// import UPCEANReader from './UPCEANReader';\nimport AbstractUPCEANReader from './AbstractUPCEANReader';\nimport Result from '../Result';\nimport ResultPoint from '../ResultPoint';\nimport ResultMetadataType from '../ResultMetadataType';\nimport NotFoundException from '../NotFoundException';\n\n/**\n * @see UPCEANExtension2Support\n */\nexport default class UPCEANExtension5Support {\n private CHECK_DIGIT_ENCODINGS = [0x18, 0x14, 0x12, 0x11, 0x0C, 0x06, 0x03, 0x0A, 0x09, 0x05];\n private decodeMiddleCounters = [0, 0, 0, 0];\n private decodeRowStringBuffer = '';\n\n\n public decodeRow(rowNumber: number, row: BitArray, extensionStartRange: number[]): Result {\n let result = this.decodeRowStringBuffer;\n let end = this.decodeMiddle(row, extensionStartRange, result);\n\n let resultString = result.toString();\n let extensionData = UPCEANExtension5Support.parseExtensionString(resultString);\n\n let resultPoints = [\n new ResultPoint((extensionStartRange[0] + extensionStartRange[1]) / 2.0, rowNumber),\n new ResultPoint(end, rowNumber)\n ];\n\n let extensionResult = new Result(resultString, null, 0, resultPoints, BarcodeFormat.UPC_EAN_EXTENSION, new Date().getTime());\n\n if (extensionData != null) {\n extensionResult.putAllMetadata(extensionData);\n }\n\n return extensionResult;\n }\n\n public decodeMiddle(row: BitArray, startRange: number[], resultString: string) {\n let counters = this.decodeMiddleCounters;\n counters[0] = 0;\n counters[1] = 0;\n counters[2] = 0;\n counters[3] = 0;\n let end = row.getSize();\n let rowOffset = startRange[1];\n\n let lgPatternFound = 0;\n\n for (let x = 0; x < 5 && rowOffset < end; x++) {\n let bestMatch = AbstractUPCEANReader.decodeDigit(row, counters, rowOffset, AbstractUPCEANReader.L_AND_G_PATTERNS);\n resultString += String.fromCharCode(('0'.charCodeAt(0) + bestMatch % 10));\n for (let counter of counters) {\n rowOffset += counter;\n }\n if (bestMatch >= 10) {\n lgPatternFound |= 1 << (4 - x);\n }\n if (x !== 4) {\n // Read off separator if not last\n rowOffset = row.getNextSet(rowOffset);\n rowOffset = row.getNextUnset(rowOffset);\n }\n }\n\n if (resultString.length !== 5) {\n throw new NotFoundException();\n }\n\n let checkDigit = this.determineCheckDigit(lgPatternFound);\n if (UPCEANExtension5Support.extensionChecksum(resultString.toString()) !== checkDigit) {\n throw new NotFoundException();\n }\n\n return rowOffset;\n }\n\n static extensionChecksum(s: string) {\n let length = s.length;\n let sum = 0;\n for (let i = length - 2; i >= 0; i -= 2) {\n sum += s.charAt(i).charCodeAt(0) - '0'.charCodeAt(0);\n }\n sum *= 3;\n for (let i = length - 1; i >= 0; i -= 2) {\n sum += s.charAt(i).charCodeAt(0) - '0'.charCodeAt(0);\n }\n sum *= 3;\n return sum % 10;\n }\n\n public determineCheckDigit(lgPatternFound: number) {\n for (let d = 0; d < 10; d++) {\n if (lgPatternFound === this.CHECK_DIGIT_ENCODINGS[d]) {\n return d;\n }\n }\n throw new NotFoundException();\n }\n\n static parseExtensionString(raw: string) {\n if (raw.length !== 5) {\n return null;\n }\n let value = UPCEANExtension5Support.parseExtension5String(raw);\n if (value == null) {\n return null;\n }\n\n return new Map([[ResultMetadataType.SUGGESTED_PRICE, value]]);\n }\n\n static parseExtension5String(raw: string) {\n let currency;\n switch (raw.charAt(0)) {\n case '0':\n currency = '£';\n break;\n case '5':\n currency = '$';\n break;\n case '9':\n // Reference: http://www.jollytech.com\n switch (raw) {\n case '90000':\n // No suggested retail price\n return null;\n case '99991':\n // Complementary\n return '0.00';\n case '99990':\n return 'Used';\n }\n // Otherwise... unknown currency?\n currency = '';\n break;\n default:\n currency = '';\n break;\n }\n let rawAmount = parseInt(raw.substring(1));\n let unitsString = (rawAmount / 100).toString();\n let hundredths = rawAmount % 100;\n let hundredthsString = hundredths < 10 ? '0' + hundredths : hundredths.toString(); // fixme\n return currency + unitsString + '.' + hundredthsString;\n }\n}\n","/*\n * Copyright (C) 2012 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport BarcodeFormat from '../BarcodeFormat';\nimport BitArray from '../common/BitArray';\n\nimport AbstractUPCEANReader from './AbstractUPCEANReader';\nimport Result from '../Result';\nimport ResultPoint from '../ResultPoint';\nimport ResultMetadataType from '../ResultMetadataType';\nimport NotFoundException from '../NotFoundException';\n\n/**\n * @see UPCEANExtension5Support\n */\nexport default class UPCEANExtension2Support {\n private decodeMiddleCounters = [0, 0, 0, 0];\n private decodeRowStringBuffer = '';\n\n\n public decodeRow(rowNumber: number, row: BitArray, extensionStartRange: number[]) {\n let result = this.decodeRowStringBuffer;\n let end = this.decodeMiddle(row, extensionStartRange, result);\n\n let resultString = result.toString();\n let extensionData = UPCEANExtension2Support.parseExtensionString(resultString);\n\n let resultPoints = [\n new ResultPoint((extensionStartRange[0] + extensionStartRange[1]) / 2.0, rowNumber),\n new ResultPoint(end, rowNumber)\n ];\n\n let extensionResult = new Result(resultString, null, 0, resultPoints, BarcodeFormat.UPC_EAN_EXTENSION, new Date().getTime());\n\n if (extensionData != null) {\n extensionResult.putAllMetadata(extensionData);\n }\n\n return extensionResult;\n }\n\n public decodeMiddle(row: BitArray, startRange: number[], resultString: string) {\n let counters = this.decodeMiddleCounters;\n counters[0] = 0;\n counters[1] = 0;\n counters[2] = 0;\n counters[3] = 0;\n let end = row.getSize();\n let rowOffset = startRange[1];\n\n let checkParity = 0;\n\n for (let x = 0; x < 2 && rowOffset < end; x++) {\n let bestMatch = AbstractUPCEANReader.decodeDigit(row, counters, rowOffset, AbstractUPCEANReader.L_AND_G_PATTERNS);\n resultString += String.fromCharCode(('0'.charCodeAt(0) + bestMatch % 10));\n for (let counter of counters) {\n rowOffset += counter;\n }\n if (bestMatch >= 10) {\n checkParity |= 1 << (1 - x);\n }\n if (x !== 1) {\n // Read off separator if not last\n rowOffset = row.getNextSet(rowOffset);\n rowOffset = row.getNextUnset(rowOffset);\n }\n }\n\n if (resultString.length !== 2) {\n throw new NotFoundException();\n }\n\n if (parseInt(resultString.toString()) % 4 !== checkParity) {\n throw new NotFoundException();\n }\n\n return rowOffset;\n }\n\n static parseExtensionString(raw: string) {\n if (raw.length !== 2) {\n return null;\n }\n\n return new Map([[ResultMetadataType.ISSUE_NUMBER, parseInt(raw)]]);\n }\n}\n","/*\n * Copyright 2008 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport BarcodeFormat from '../BarcodeFormat';\nimport BitArray from '../common/BitArray';\n\nimport UPCEANReader from './UPCEANReader';\n\n/**\n *

Implements decoding of the EAN-8 format.

\n *\n * @author Sean Owen\n */\nexport default class EAN8Reader extends UPCEANReader {\n private decodeMiddleCounters: number[];\n\n public constructor() {\n super();\n this.decodeMiddleCounters = [0, 0, 0, 0];\n }\n\n public decodeMiddle(row: BitArray, startRange: number[], resultString: string) {\n let counters = this.decodeMiddleCounters;\n counters[0] = 0;\n counters[1] = 0;\n counters[2] = 0;\n counters[3] = 0;\n let end = row.getSize();\n let rowOffset = startRange[1];\n\n for (let x = 0; x < 4 && rowOffset < end; x++) {\n let bestMatch = UPCEANReader.decodeDigit(row, counters, rowOffset, UPCEANReader.L_PATTERNS);\n resultString += String.fromCharCode(('0'.charCodeAt(0) + bestMatch));\n\n for (let counter of counters) {\n rowOffset += counter;\n }\n }\n\n let middleRange = UPCEANReader.findGuardPattern(row, rowOffset, true, UPCEANReader.MIDDLE_PATTERN, new Array(UPCEANReader.MIDDLE_PATTERN.length).fill(0));\n rowOffset = middleRange[1];\n\n for (let x = 0; x < 4 && rowOffset < end; x++) {\n let bestMatch = UPCEANReader.decodeDigit(row, counters, rowOffset, UPCEANReader.L_PATTERNS);\n resultString += String.fromCharCode(('0'.charCodeAt(0) + bestMatch));\n\n for (let counter of counters) {\n rowOffset += counter;\n }\n }\n\n return {rowOffset, resultString};\n }\n\n public getBarcodeFormat(): BarcodeFormat {\n return BarcodeFormat.EAN_8;\n }\n}\n","import { BrowserCodeReader } from './BrowserCodeReader';\nimport DataMatrixReader from '../core/datamatrix/DataMatrixReader';\n\n/**\n * @deprecated Moving to @zxing/browser\n *\n * QR Code reader to use from browser.\n */\nexport class BrowserDatamatrixCodeReader extends BrowserCodeReader {\n /**\n * Creates an instance of BrowserQRCodeReader.\n * @param {number} [timeBetweenScansMillis=500] the time delay between subsequent decode tries\n */\n public constructor(timeBetweenScansMillis: number = 500) {\n super(new DataMatrixReader(), timeBetweenScansMillis);\n }\n}\n","import ReedSolomonDecoder from '../../common/reedsolomon/ReedSolomonDecoder';\nimport GenericGF from '../../common/reedsolomon/GenericGF';\nimport DecoderResult from '../../common/DecoderResult';\nimport BitMatrix from '../../common/BitMatrix';\nimport BitMatrixParser from './BitMatrixParser';\nimport DataBlock from './DataBlock';\nimport DecodedBitStreamParser from './DecodedBitStreamParser';\nimport ChecksumException from '../../ChecksumException';\n\n/*\n * Copyright 2007 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n *

The main class which implements Data Matrix Code decoding -- as opposed to locating and extracting\n * the Data Matrix Code from an image.

\n *\n * @author bbrown@google.com (Brian Brown)\n */\nexport default class Decoder {\n\n private rsDecoder: ReedSolomonDecoder;\n\n constructor() {\n this.rsDecoder = new ReedSolomonDecoder(GenericGF.DATA_MATRIX_FIELD_256);\n }\n\n /**\n *

Decodes a Data Matrix Code represented as a {@link BitMatrix}. A 1 or \"true\" is taken\n * to mean a black module.

\n *\n * @param bits booleans representing white/black Data Matrix Code modules\n * @return text and bytes encoded within the Data Matrix Code\n * @throws FormatException if the Data Matrix Code cannot be decoded\n * @throws ChecksumException if error correction fails\n */\n public decode(bits: BitMatrix): DecoderResult {\n // Construct a parser and read version, error-correction level\n const parser = new BitMatrixParser(bits);\n const version = parser.getVersion();\n\n // Read codewords\n const codewords = parser.readCodewords();\n // Separate into data blocks\n const dataBlocks = DataBlock.getDataBlocks(codewords, version);\n\n // Count total number of data bytes\n let totalBytes = 0;\n for (let db of dataBlocks) {\n totalBytes += db.getNumDataCodewords();\n }\n const resultBytes = new Uint8Array(totalBytes);\n\n const dataBlocksCount = dataBlocks.length;\n // Error-correct and copy data blocks together into a stream of bytes\n for (let j = 0; j < dataBlocksCount; j++) {\n const dataBlock = dataBlocks[j];\n const codewordBytes = dataBlock.getCodewords();\n const numDataCodewords = dataBlock.getNumDataCodewords();\n this.correctErrors(codewordBytes, numDataCodewords);\n for (let i = 0; i < numDataCodewords; i++) {\n // De-interlace data blocks.\n resultBytes[i * dataBlocksCount + j] = codewordBytes[i];\n }\n }\n\n // Decode the contents of that stream of bytes\n return DecodedBitStreamParser.decode(resultBytes);\n }\n\n /**\n *

Given data and error-correction codewords received, possibly corrupted by errors, attempts to\n * correct the errors in-place using Reed-Solomon error correction.

\n *\n * @param codewordBytes data and error correction codewords\n * @param numDataCodewords number of codewords that are data bytes\n * @throws ChecksumException if error correction fails\n */\n private correctErrors(codewordBytes: Uint8Array, numDataCodewords: number): void {\n const numCodewords = codewordBytes.length;\n // First read into an array of ints\n const codewordsInts = new Int32Array(codewordBytes);\n // for (let i = 0; i < numCodewords; i++) {\n // codewordsInts[i] = codewordBytes[i] & 0xFF;\n // }\n try {\n this.rsDecoder.decode(codewordsInts, codewordBytes.length - numDataCodewords);\n } catch (ignored /* ReedSolomonException */) {\n throw new ChecksumException();\n }\n // Copy back into array of bytes -- only need to worry about the bytes that were data\n // We don't care about errors in the error-correction codewords\n for (let i = 0; i < numDataCodewords; i++) {\n codewordBytes[i] = codewordsInts[i];\n }\n }\n\n}\n","import BitMatrix from '../../common/BitMatrix';\nimport Version from './Version';\n\nimport FormatException from '../../FormatException';\nimport IllegalArgumentException from '../../IllegalArgumentException';\n\n/*\n * Copyright 2007 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * @author bbrown@google.com (Brian Brown)\n */\nexport default class BitMatrixParser {\n\n private mappingBitMatrix: BitMatrix;\n private readMappingMatrix: BitMatrix;\n private version: Version;\n\n /**\n * @param bitMatrix {@link BitMatrix} to parse\n * @throws FormatException if dimension is < 8 or > 144 or not 0 mod 2\n */\n constructor(bitMatrix: BitMatrix) {\n const dimension = bitMatrix.getHeight();\n if (dimension < 8 || dimension > 144 || (dimension & 0x01) !== 0) {\n throw new FormatException();\n }\n\n this.version = BitMatrixParser.readVersion(bitMatrix);\n this.mappingBitMatrix = this.extractDataRegion(bitMatrix);\n this.readMappingMatrix = new BitMatrix(this.mappingBitMatrix.getWidth(), this.mappingBitMatrix.getHeight());\n }\n\n getVersion(): Version {\n return this.version;\n }\n\n /**\n *

Creates the version object based on the dimension of the original bit matrix from\n * the datamatrix code.

\n *\n *

See ISO 16022:2006 Table 7 - ECC 200 symbol attributes

\n *\n * @param bitMatrix Original {@link BitMatrix} including alignment patterns\n * @return {@link Version} encapsulating the Data Matrix Code's \"version\"\n * @throws FormatException if the dimensions of the mapping matrix are not valid\n * Data Matrix dimensions.\n */\n public static readVersion(bitMatrix: BitMatrix): Version {\n const numRows = bitMatrix.getHeight();\n const numColumns = bitMatrix.getWidth();\n return Version.getVersionForDimensions(numRows, numColumns);\n }\n\n /**\n *

Reads the bits in the {@link BitMatrix} representing the mapping matrix (No alignment patterns)\n * in the correct order in order to reconstitute the codewords bytes contained within the\n * Data Matrix Code.

\n *\n * @return bytes encoded within the Data Matrix Code\n * @throws FormatException if the exact number of bytes expected is not read\n */\n readCodewords(): Int8Array {\n\n const result = new Int8Array(this.version.getTotalCodewords());\n let resultOffset = 0;\n\n let row = 4;\n let column = 0;\n\n const numRows = this.mappingBitMatrix.getHeight();\n const numColumns = this.mappingBitMatrix.getWidth();\n\n let corner1Read = false;\n let corner2Read = false;\n let corner3Read = false;\n let corner4Read = false;\n\n // Read all of the codewords\n do {\n // Check the four corner cases\n if ((row === numRows) && (column === 0) && !corner1Read) {\n result[resultOffset++] = this.readCorner1(numRows, numColumns) & 0xff;\n row -= 2;\n column += 2;\n corner1Read = true;\n } else if ((row === numRows - 2) && (column === 0) && ((numColumns & 0x03) !== 0) && !corner2Read) {\n result[resultOffset++] = this.readCorner2(numRows, numColumns) & 0xff;\n row -= 2;\n column += 2;\n corner2Read = true;\n } else if ((row === numRows + 4) && (column === 2) && ((numColumns & 0x07) === 0) && !corner3Read) {\n result[resultOffset++] = this.readCorner3(numRows, numColumns) & 0xff;\n row -= 2;\n column += 2;\n corner3Read = true;\n } else if ((row === numRows - 2) && (column === 0) && ((numColumns & 0x07) === 4) && !corner4Read) {\n result[resultOffset++] = this.readCorner4(numRows, numColumns) & 0xff;\n row -= 2;\n column += 2;\n corner4Read = true;\n } else {\n // Sweep upward diagonally to the right\n do {\n if ((row < numRows) && (column >= 0) && !this.readMappingMatrix.get(column, row)) {\n result[resultOffset++] = this.readUtah(row, column, numRows, numColumns) & 0xff;\n }\n row -= 2;\n column += 2;\n } while ((row >= 0) && (column < numColumns));\n row += 1;\n column += 3;\n\n // Sweep downward diagonally to the left\n do {\n if ((row >= 0) && (column < numColumns) && !this.readMappingMatrix.get(column, row)) {\n result[resultOffset++] = this.readUtah(row, column, numRows, numColumns) & 0xff;\n }\n row += 2;\n column -= 2;\n } while ((row < numRows) && (column >= 0));\n row += 3;\n column += 1;\n }\n } while ((row < numRows) || (column < numColumns));\n\n if (resultOffset !== this.version.getTotalCodewords()) {\n throw new FormatException();\n }\n return result;\n }\n\n /**\n *

Reads a bit of the mapping matrix accounting for boundary wrapping.

\n *\n * @param row Row to read in the mapping matrix\n * @param column Column to read in the mapping matrix\n * @param numRows Number of rows in the mapping matrix\n * @param numColumns Number of columns in the mapping matrix\n * @return value of the given bit in the mapping matrix\n */\n private readModule(row: number, column: number, numRows: number, numColumns: number): boolean {\n // Adjust the row and column indices based on boundary wrapping\n if (row < 0) {\n row += numRows;\n column += 4 - ((numRows + 4) & 0x07);\n }\n if (column < 0) {\n column += numColumns;\n row += 4 - ((numColumns + 4) & 0x07);\n }\n this.readMappingMatrix.set(column, row);\n return this.mappingBitMatrix.get(column, row);\n }\n\n /**\n *

Reads the 8 bits of the standard Utah-shaped pattern.

\n *\n *

See ISO 16022:2006, 5.8.1 Figure 6

\n *\n * @param row Current row in the mapping matrix, anchored at the 8th bit (LSB) of the pattern\n * @param column Current column in the mapping matrix, anchored at the 8th bit (LSB) of the pattern\n * @param numRows Number of rows in the mapping matrix\n * @param numColumns Number of columns in the mapping matrix\n * @return byte from the utah shape\n */\n private readUtah(row: number, column: number, numRows: number, numColumns: number): number {\n let currentByte = 0;\n if (this.readModule(row - 2, column - 2, numRows, numColumns)) {\n currentByte |= 1;\n }\n currentByte <<= 1;\n if (this.readModule(row - 2, column - 1, numRows, numColumns)) {\n currentByte |= 1;\n }\n currentByte <<= 1;\n if (this.readModule(row - 1, column - 2, numRows, numColumns)) {\n currentByte |= 1;\n }\n currentByte <<= 1;\n if (this.readModule(row - 1, column - 1, numRows, numColumns)) {\n currentByte |= 1;\n }\n currentByte <<= 1;\n if (this.readModule(row - 1, column, numRows, numColumns)) {\n currentByte |= 1;\n }\n currentByte <<= 1;\n if (this.readModule(row, column - 2, numRows, numColumns)) {\n currentByte |= 1;\n }\n currentByte <<= 1;\n if (this.readModule(row, column - 1, numRows, numColumns)) {\n currentByte |= 1;\n }\n currentByte <<= 1;\n if (this.readModule(row, column, numRows, numColumns)) {\n currentByte |= 1;\n }\n return currentByte;\n }\n\n /**\n *

Reads the 8 bits of the special corner condition 1.

\n *\n *

See ISO 16022:2006, Figure F.3

\n *\n * @param numRows Number of rows in the mapping matrix\n * @param numColumns Number of columns in the mapping matrix\n * @return byte from the Corner condition 1\n */\n private readCorner1(numRows: number, numColumns: number): number {\n let currentByte = 0;\n if (this.readModule(numRows - 1, 0, numRows, numColumns)) {\n currentByte |= 1;\n }\n currentByte <<= 1;\n if (this.readModule(numRows - 1, 1, numRows, numColumns)) {\n currentByte |= 1;\n }\n currentByte <<= 1;\n if (this.readModule(numRows - 1, 2, numRows, numColumns)) {\n currentByte |= 1;\n }\n currentByte <<= 1;\n if (this.readModule(0, numColumns - 2, numRows, numColumns)) {\n currentByte |= 1;\n }\n currentByte <<= 1;\n if (this.readModule(0, numColumns - 1, numRows, numColumns)) {\n currentByte |= 1;\n }\n currentByte <<= 1;\n if (this.readModule(1, numColumns - 1, numRows, numColumns)) {\n currentByte |= 1;\n }\n currentByte <<= 1;\n if (this.readModule(2, numColumns - 1, numRows, numColumns)) {\n currentByte |= 1;\n }\n currentByte <<= 1;\n if (this.readModule(3, numColumns - 1, numRows, numColumns)) {\n currentByte |= 1;\n }\n return currentByte;\n }\n\n /**\n *

Reads the 8 bits of the special corner condition 2.

\n *\n *

See ISO 16022:2006, Figure F.4

\n *\n * @param numRows Number of rows in the mapping matrix\n * @param numColumns Number of columns in the mapping matrix\n * @return byte from the Corner condition 2\n */\n private readCorner2(numRows: number, numColumns: number): number {\n let currentByte = 0;\n if (this.readModule(numRows - 3, 0, numRows, numColumns)) {\n currentByte |= 1;\n }\n currentByte <<= 1;\n if (this.readModule(numRows - 2, 0, numRows, numColumns)) {\n currentByte |= 1;\n }\n currentByte <<= 1;\n if (this.readModule(numRows - 1, 0, numRows, numColumns)) {\n currentByte |= 1;\n }\n currentByte <<= 1;\n if (this.readModule(0, numColumns - 4, numRows, numColumns)) {\n currentByte |= 1;\n }\n currentByte <<= 1;\n if (this.readModule(0, numColumns - 3, numRows, numColumns)) {\n currentByte |= 1;\n }\n currentByte <<= 1;\n if (this.readModule(0, numColumns - 2, numRows, numColumns)) {\n currentByte |= 1;\n }\n currentByte <<= 1;\n if (this.readModule(0, numColumns - 1, numRows, numColumns)) {\n currentByte |= 1;\n }\n currentByte <<= 1;\n if (this.readModule(1, numColumns - 1, numRows, numColumns)) {\n currentByte |= 1;\n }\n return currentByte;\n }\n\n /**\n *

Reads the 8 bits of the special corner condition 3.

\n *\n *

See ISO 16022:2006, Figure F.5

\n *\n * @param numRows Number of rows in the mapping matrix\n * @param numColumns Number of columns in the mapping matrix\n * @return byte from the Corner condition 3\n */\n private readCorner3(numRows: number, numColumns: number): number {\n let currentByte = 0;\n if (this.readModule(numRows - 1, 0, numRows, numColumns)) {\n currentByte |= 1;\n }\n currentByte <<= 1;\n if (this.readModule(numRows - 1, numColumns - 1, numRows, numColumns)) {\n currentByte |= 1;\n }\n currentByte <<= 1;\n if (this.readModule(0, numColumns - 3, numRows, numColumns)) {\n currentByte |= 1;\n }\n currentByte <<= 1;\n if (this.readModule(0, numColumns - 2, numRows, numColumns)) {\n currentByte |= 1;\n }\n currentByte <<= 1;\n if (this.readModule(0, numColumns - 1, numRows, numColumns)) {\n currentByte |= 1;\n }\n currentByte <<= 1;\n if (this.readModule(1, numColumns - 3, numRows, numColumns)) {\n currentByte |= 1;\n }\n currentByte <<= 1;\n if (this.readModule(1, numColumns - 2, numRows, numColumns)) {\n currentByte |= 1;\n }\n currentByte <<= 1;\n if (this.readModule(1, numColumns - 1, numRows, numColumns)) {\n currentByte |= 1;\n }\n return currentByte;\n }\n\n /**\n *

Reads the 8 bits of the special corner condition 4.

\n *\n *

See ISO 16022:2006, Figure F.6

\n *\n * @param numRows Number of rows in the mapping matrix\n * @param numColumns Number of columns in the mapping matrix\n * @return byte from the Corner condition 4\n */\n private readCorner4(numRows: number, numColumns: number): number {\n let currentByte = 0;\n if (this.readModule(numRows - 3, 0, numRows, numColumns)) {\n currentByte |= 1;\n }\n currentByte <<= 1;\n if (this.readModule(numRows - 2, 0, numRows, numColumns)) {\n currentByte |= 1;\n }\n currentByte <<= 1;\n if (this.readModule(numRows - 1, 0, numRows, numColumns)) {\n currentByte |= 1;\n }\n currentByte <<= 1;\n if (this.readModule(0, numColumns - 2, numRows, numColumns)) {\n currentByte |= 1;\n }\n currentByte <<= 1;\n if (this.readModule(0, numColumns - 1, numRows, numColumns)) {\n currentByte |= 1;\n }\n currentByte <<= 1;\n if (this.readModule(1, numColumns - 1, numRows, numColumns)) {\n currentByte |= 1;\n }\n currentByte <<= 1;\n if (this.readModule(2, numColumns - 1, numRows, numColumns)) {\n currentByte |= 1;\n }\n currentByte <<= 1;\n if (this.readModule(3, numColumns - 1, numRows, numColumns)) {\n currentByte |= 1;\n }\n return currentByte;\n }\n\n /**\n *

Extracts the data region from a {@link BitMatrix} that contains\n * alignment patterns.

\n *\n * @param bitMatrix Original {@link BitMatrix} with alignment patterns\n * @return BitMatrix that has the alignment patterns removed\n */\n private extractDataRegion(bitMatrix: BitMatrix): BitMatrix {\n const symbolSizeRows = this.version.getSymbolSizeRows();\n const symbolSizeColumns = this.version.getSymbolSizeColumns();\n\n if (bitMatrix.getHeight() !== symbolSizeRows) {\n throw new IllegalArgumentException('Dimension of bitMatrix must match the version size');\n }\n\n const dataRegionSizeRows = this.version.getDataRegionSizeRows();\n const dataRegionSizeColumns = this.version.getDataRegionSizeColumns();\n\n const numDataRegionsRow = symbolSizeRows / dataRegionSizeRows | 0;\n const numDataRegionsColumn = symbolSizeColumns / dataRegionSizeColumns | 0;\n\n const sizeDataRegionRow = numDataRegionsRow * dataRegionSizeRows;\n const sizeDataRegionColumn = numDataRegionsColumn * dataRegionSizeColumns;\n\n const bitMatrixWithoutAlignment = new BitMatrix(sizeDataRegionColumn, sizeDataRegionRow);\n for (let dataRegionRow = 0; dataRegionRow < numDataRegionsRow; ++dataRegionRow) {\n const dataRegionRowOffset = dataRegionRow * dataRegionSizeRows;\n for (let dataRegionColumn = 0; dataRegionColumn < numDataRegionsColumn; ++dataRegionColumn) {\n const dataRegionColumnOffset = dataRegionColumn * dataRegionSizeColumns;\n for (let i = 0; i < dataRegionSizeRows; ++i) {\n const readRowOffset = dataRegionRow * (dataRegionSizeRows + 2) + 1 + i;\n const writeRowOffset = dataRegionRowOffset + i;\n for (let j = 0; j < dataRegionSizeColumns; ++j) {\n const readColumnOffset = dataRegionColumn * (dataRegionSizeColumns + 2) + 1 + j;\n if (bitMatrix.get(readColumnOffset, readRowOffset)) {\n const writeColumnOffset = dataRegionColumnOffset + j;\n bitMatrixWithoutAlignment.set(writeColumnOffset, writeRowOffset);\n }\n }\n }\n }\n }\n return bitMatrixWithoutAlignment;\n }\n\n}\n","\nimport FormatException from '../../FormatException';\n\n/*\n * Copyright 2007 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\n /**\n *

Encapsulates a set of error-correction blocks in one symbol version. Most versions will\n * use blocks of differing sizes within one version, so, this encapsulates the parameters for\n * each set of blocks. It also holds the number of error-correction codewords per block since it\n * will be the same across all blocks within one version.

\n */\n export class ECBlocks {\n private ecCodewords: number;\n private ecBlocks: ECB[];\n\n constructor(ecCodewords: number, ecBlocks1: ECB, ecBlocks2?: ECB) {\n this.ecCodewords = ecCodewords;\n this.ecBlocks = [ ecBlocks1 ];\n ecBlocks2 && this.ecBlocks.push(ecBlocks2);\n }\n\n getECCodewords(): number {\n return this.ecCodewords;\n }\n\n getECBlocks(): ECB[] {\n return this.ecBlocks;\n }\n }\n\n /**\n *

Encapsulates the parameters for one error-correction block in one symbol version.\n * This includes the number of data codewords, and the number of times a block with these\n * parameters is used consecutively in the Data Matrix code version's format.

\n */\nexport class ECB {\n private count: number;\n private dataCodewords: number;\n\n constructor(count: number, dataCodewords: number) {\n this.count = count;\n this.dataCodewords = dataCodewords;\n }\n\n getCount(): number {\n return this.count;\n }\n\n getDataCodewords(): number {\n return this.dataCodewords;\n }\n }\n\n/**\n * The Version object encapsulates attributes about a particular\n * size Data Matrix Code.\n *\n * @author bbrown@google.com (Brian Brown)\n */\nexport default class Version {\n\n private static VERSIONS: Version[] = Version.buildVersions();\n\n private versionNumber: number;\n private symbolSizeRows: number;\n private symbolSizeColumns: number;\n private dataRegionSizeRows: number;\n private dataRegionSizeColumns: number;\n private ecBlocks: ECBlocks;\n private totalCodewords: number;\n\n constructor(versionNumber,\n symbolSizeRows,\n symbolSizeColumns,\n dataRegionSizeRows,\n dataRegionSizeColumns,\n ecBlocks: ECBlocks) {\n this.versionNumber = versionNumber;\n this.symbolSizeRows = symbolSizeRows;\n this.symbolSizeColumns = symbolSizeColumns;\n this.dataRegionSizeRows = dataRegionSizeRows;\n this.dataRegionSizeColumns = dataRegionSizeColumns;\n this.ecBlocks = ecBlocks;\n\n // Calculate the total number of codewords\n let total = 0;\n const ecCodewords = ecBlocks.getECCodewords();\n const ecbArray = ecBlocks.getECBlocks();\n for (let ecBlock of ecbArray) {\n total += ecBlock.getCount() * (ecBlock.getDataCodewords() + ecCodewords);\n }\n this.totalCodewords = total;\n }\n\n public getVersionNumber(): number {\n return this.versionNumber;\n }\n\n public getSymbolSizeRows(): number {\n return this.symbolSizeRows;\n }\n\n public getSymbolSizeColumns(): number {\n return this.symbolSizeColumns;\n }\n\n public getDataRegionSizeRows(): number {\n return this.dataRegionSizeRows;\n }\n\n public getDataRegionSizeColumns(): number {\n return this.dataRegionSizeColumns;\n }\n\n public getTotalCodewords(): number {\n return this.totalCodewords;\n }\n\n public getECBlocks(): ECBlocks {\n return this.ecBlocks;\n }\n\n /**\n *

Deduces version information from Data Matrix dimensions.

\n *\n * @param numRows Number of rows in modules\n * @param numColumns Number of columns in modules\n * @return Version for a Data Matrix Code of those dimensions\n * @throws FormatException if dimensions do correspond to a valid Data Matrix size\n */\n public static getVersionForDimensions(numRows: number, numColumns: number): Version {\n if ((numRows & 0x01) !== 0 || (numColumns & 0x01) !== 0) {\n throw new FormatException();\n }\n\n for (let version of Version.VERSIONS) {\n if (version.symbolSizeRows === numRows && version.symbolSizeColumns === numColumns) {\n return version;\n }\n }\n\n throw new FormatException();\n }\n\n// @Override\n public toString(): string {\n return '' + this.versionNumber;\n }\n\n /**\n * See ISO 16022:2006 5.5.1 Table 7\n */\n private static buildVersions(): Version[] {\n return [\n new Version(1, 10, 10, 8, 8,\n new ECBlocks(5, new ECB(1, 3))),\n new Version(2, 12, 12, 10, 10,\n new ECBlocks(7, new ECB(1, 5))),\n new Version(3, 14, 14, 12, 12,\n new ECBlocks(10, new ECB(1, 8))),\n new Version(4, 16, 16, 14, 14,\n new ECBlocks(12, new ECB(1, 12))),\n new Version(5, 18, 18, 16, 16,\n new ECBlocks(14, new ECB(1, 18))),\n new Version(6, 20, 20, 18, 18,\n new ECBlocks(18, new ECB(1, 22))),\n new Version(7, 22, 22, 20, 20,\n new ECBlocks(20, new ECB(1, 30))),\n new Version(8, 24, 24, 22, 22,\n new ECBlocks(24, new ECB(1, 36))),\n new Version(9, 26, 26, 24, 24,\n new ECBlocks(28, new ECB(1, 44))),\n new Version(10, 32, 32, 14, 14,\n new ECBlocks(36, new ECB(1, 62))),\n new Version(11, 36, 36, 16, 16,\n new ECBlocks(42, new ECB(1, 86))),\n new Version(12, 40, 40, 18, 18,\n new ECBlocks(48, new ECB(1, 114))),\n new Version(13, 44, 44, 20, 20,\n new ECBlocks(56, new ECB(1, 144))),\n new Version(14, 48, 48, 22, 22,\n new ECBlocks(68, new ECB(1, 174))),\n new Version(15, 52, 52, 24, 24,\n new ECBlocks(42, new ECB(2, 102))),\n new Version(16, 64, 64, 14, 14,\n new ECBlocks(56, new ECB(2, 140))),\n new Version(17, 72, 72, 16, 16,\n new ECBlocks(36, new ECB(4, 92))),\n new Version(18, 80, 80, 18, 18,\n new ECBlocks(48, new ECB(4, 114))),\n new Version(19, 88, 88, 20, 20,\n new ECBlocks(56, new ECB(4, 144))),\n new Version(20, 96, 96, 22, 22,\n new ECBlocks(68, new ECB(4, 174))),\n new Version(21, 104, 104, 24, 24,\n new ECBlocks(56, new ECB(6, 136))),\n new Version(22, 120, 120, 18, 18,\n new ECBlocks(68, new ECB(6, 175))),\n new Version(23, 132, 132, 20, 20,\n new ECBlocks(62, new ECB(8, 163))),\n new Version(24, 144, 144, 22, 22,\n new ECBlocks(62, new ECB(8, 156), new ECB(2, 155))),\n new Version(25, 8, 18, 6, 16,\n new ECBlocks(7, new ECB(1, 5))),\n new Version(26, 8, 32, 6, 14,\n new ECBlocks(11, new ECB(1, 10))),\n new Version(27, 12, 26, 10, 24,\n new ECBlocks(14, new ECB(1, 16))),\n new Version(28, 12, 36, 10, 16,\n new ECBlocks(18, new ECB(1, 22))),\n new Version(29, 16, 36, 14, 16,\n new ECBlocks(24, new ECB(1, 32))),\n new Version(30, 16, 48, 14, 22,\n new ECBlocks(28, new ECB(1, 49)))\n ];\n }\n\n}\n","import Version from './Version';\n\nimport IllegalArgumentException from '../../IllegalArgumentException';\n\n/*\n * Copyright 2008 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n *

Encapsulates a block of data within a Data Matrix Code. Data Matrix Codes may split their data into\n * multiple blocks, each of which is a unit of data and error-correction codewords. Each\n * is represented by an instance of this class.

\n *\n * @author bbrown@google.com (Brian Brown)\n */\nexport default class DataBlock {\n\n private numDataCodewords: number;\n private codewords: Uint8Array;\n\n constructor(numDataCodewords: number, codewords: Uint8Array) {\n this.numDataCodewords = numDataCodewords;\n this.codewords = codewords;\n }\n\n /**\n *

When Data Matrix Codes use multiple data blocks, they actually interleave the bytes of each of them.\n * That is, the first byte of data block 1 to n is written, then the second bytes, and so on. This\n * method will separate the data into original blocks.

\n *\n * @param rawCodewords bytes as read directly from the Data Matrix Code\n * @param version version of the Data Matrix Code\n * @return DataBlocks containing original bytes, \"de-interleaved\" from representation in the\n * Data Matrix Code\n */\n static getDataBlocks(rawCodewords: Int8Array,\n version: Version): DataBlock[] {\n // Figure out the number and size of data blocks used by this version\n const ecBlocks = version.getECBlocks();\n\n // First count the total number of data blocks\n let totalBlocks = 0;\n const ecBlockArray = ecBlocks.getECBlocks();\n for (let ecBlock of ecBlockArray) {\n totalBlocks += ecBlock.getCount();\n }\n\n // Now establish DataBlocks of the appropriate size and number of data codewords\n const result: DataBlock[] = new Array(totalBlocks);\n let numResultBlocks = 0;\n for (let ecBlock of ecBlockArray) {\n for (let i = 0; i < ecBlock.getCount(); i++) {\n const numDataCodewords = ecBlock.getDataCodewords();\n const numBlockCodewords = ecBlocks.getECCodewords() + numDataCodewords;\n result[numResultBlocks++] = new DataBlock(numDataCodewords, new Uint8Array(numBlockCodewords));\n }\n }\n\n // All blocks have the same amount of data, except that the last n\n // (where n may be 0) have 1 less byte. Figure out where these start.\n // TODO(bbrown): There is only one case where there is a difference for Data Matrix for size 144\n const longerBlocksTotalCodewords = result[0].codewords.length;\n // int shorterBlocksTotalCodewords = longerBlocksTotalCodewords - 1;\n\n const longerBlocksNumDataCodewords = longerBlocksTotalCodewords - ecBlocks.getECCodewords();\n const shorterBlocksNumDataCodewords = longerBlocksNumDataCodewords - 1;\n // The last elements of result may be 1 element shorter for 144 matrix\n // first fill out as many elements as all of them have minus 1\n let rawCodewordsOffset = 0;\n for (let i = 0; i < shorterBlocksNumDataCodewords; i++) {\n for (let j = 0; j < numResultBlocks; j++) {\n result[j].codewords[i] = rawCodewords[rawCodewordsOffset++];\n }\n }\n\n // Fill out the last data block in the longer ones\n const specialVersion = version.getVersionNumber() === 24;\n const numLongerBlocks = specialVersion ? 8 : numResultBlocks;\n for (let j = 0; j < numLongerBlocks; j++) {\n result[j].codewords[longerBlocksNumDataCodewords - 1] = rawCodewords[rawCodewordsOffset++];\n }\n\n // Now add in error correction blocks\n const max = result[0].codewords.length;\n for (let i = longerBlocksNumDataCodewords; i < max; i++) {\n for (let j = 0; j < numResultBlocks; j++) {\n const jOffset = specialVersion ? (j + 8) % numResultBlocks : j;\n const iOffset = specialVersion && jOffset > 7 ? i - 1 : i;\n result[jOffset].codewords[iOffset] = rawCodewords[rawCodewordsOffset++];\n }\n }\n\n if (rawCodewordsOffset !== rawCodewords.length) {\n throw new IllegalArgumentException();\n }\n\n return result;\n }\n\n getNumDataCodewords(): number {\n return this.numDataCodewords;\n }\n\n getCodewords(): Uint8Array {\n return this.codewords;\n }\n\n}\n","import DecoderResult from '../../common/DecoderResult';\nimport BitSource from '../../common/BitSource';\nimport StringBuilder from '../../util/StringBuilder';\n\nimport StringEncoding from '../../util/StringEncoding';\nimport StringUtils from '../../common/StringUtils';\nimport FormatException from '../../FormatException';\nimport IllegalStateException from '../../IllegalStateException';\n\n/*\n * Copyright 2008 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nenum Mode {\n PAD_ENCODE, // Not really a mode\n ASCII_ENCODE,\n C40_ENCODE,\n TEXT_ENCODE,\n ANSIX12_ENCODE,\n EDIFACT_ENCODE,\n BASE256_ENCODE\n}\n\n/**\n *

Data Matrix Codes can encode text as bits in one of several modes, and can use multiple modes\n * in one Data Matrix Code. This class decodes the bits back into text.

\n *\n *

See ISO 16022:2006, 5.2.1 - 5.2.9.2

\n *\n * @author bbrown@google.com (Brian Brown)\n * @author Sean Owen\n */\nexport default class DecodedBitStreamParser {\n\n /**\n * See ISO 16022:2006, Annex C Table C.1\n * The C40 Basic Character Set (*'s used for placeholders for the shift values)\n */\n private static C40_BASIC_SET_CHARS: string[] = [\n '*', '*', '*', ' ', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',\n 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',\n 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'\n ];\n\n private static C40_SHIFT2_SET_CHARS: string[] = [\n '!', '\"', '#', '$', '%', '&', '\\'', '(', ')', '*', '+', ',', '-', '.',\n '/', ':', ';', '<', '=', '>', '?', '@', '[', '\\\\', ']', '^', '_'\n ];\n\n /**\n * See ISO 16022:2006, Annex C Table C.2\n * The Text Basic Character Set (*'s used for placeholders for the shift values)\n */\n private static TEXT_BASIC_SET_CHARS: string[] = [\n '*', '*', '*', ' ', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',\n 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',\n 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'\n ];\n\n // Shift 2 for Text is the same encoding as C40\n private static TEXT_SHIFT2_SET_CHARS = DecodedBitStreamParser.C40_SHIFT2_SET_CHARS;\n\n private static TEXT_SHIFT3_SET_CHARS: string[] = [\n '`', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',\n 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '{', '|', '}', '~', String.fromCharCode(127)\n ];\n\n static decode(bytes: Uint8Array): DecoderResult {\n const bits = new BitSource(bytes);\n const result = new StringBuilder();\n const resultTrailer = new StringBuilder();\n const byteSegments = new Array();\n let mode = Mode.ASCII_ENCODE;\n do {\n if (mode === Mode.ASCII_ENCODE) {\n mode = this.decodeAsciiSegment(bits, result, resultTrailer);\n } else {\n switch (mode) {\n case Mode.C40_ENCODE:\n this.decodeC40Segment(bits, result);\n break;\n case Mode.TEXT_ENCODE:\n this.decodeTextSegment(bits, result);\n break;\n case Mode.ANSIX12_ENCODE:\n this.decodeAnsiX12Segment(bits, result);\n break;\n case Mode.EDIFACT_ENCODE:\n this.decodeEdifactSegment(bits, result);\n break;\n case Mode.BASE256_ENCODE:\n this.decodeBase256Segment(bits, result, byteSegments);\n break;\n default:\n throw new FormatException();\n }\n mode = Mode.ASCII_ENCODE;\n }\n } while (mode !== Mode.PAD_ENCODE && bits.available() > 0);\n if (resultTrailer.length() > 0) {\n result.append(resultTrailer.toString());\n }\n return new DecoderResult(bytes, result.toString(), byteSegments.length === 0 ? null : byteSegments, null);\n }\n\n /**\n * See ISO 16022:2006, 5.2.3 and Annex C, Table C.2\n */\n private static decodeAsciiSegment(bits: BitSource,\n result: StringBuilder,\n resultTrailer: StringBuilder): Mode {\n let upperShift = false;\n do {\n let oneByte = bits.readBits(8);\n if (oneByte === 0) {\n throw new FormatException();\n } else if (oneByte <= 128) { // ASCII data (ASCII value + 1)\n if (upperShift) {\n oneByte += 128;\n // upperShift = false;\n }\n result.append(String.fromCharCode(oneByte - 1));\n return Mode.ASCII_ENCODE;\n } else if (oneByte === 129) { // Pad\n return Mode.PAD_ENCODE;\n } else if (oneByte <= 229) { // 2-digit data 00-99 (Numeric Value + 130)\n const value = oneByte - 130;\n if (value < 10) { // pad with '0' for single digit values\n result.append('0');\n }\n result.append('' + value);\n } else {\n switch (oneByte) {\n case 230: // Latch to C40 encodation\n return Mode.C40_ENCODE;\n case 231: // Latch to Base 256 encodation\n return Mode.BASE256_ENCODE;\n case 232: // FNC1\n result.append(String.fromCharCode(29)); // translate as ASCII 29\n break;\n case 233: // Structured Append\n case 234: // Reader Programming\n // Ignore these symbols for now\n // throw ReaderException.getInstance();\n break;\n case 235: // Upper Shift (shift to Extended ASCII)\n upperShift = true;\n break;\n case 236: // 05 Macro\n result.append('[)>\\u001E05\\u001D');\n resultTrailer.insert(0, '\\u001E\\u0004');\n break;\n case 237: // 06 Macro\n result.append('[)>\\u001E06\\u001D');\n resultTrailer.insert(0, '\\u001E\\u0004');\n break;\n case 238: // Latch to ANSI X12 encodation\n return Mode.ANSIX12_ENCODE;\n case 239: // Latch to Text encodation\n return Mode.TEXT_ENCODE;\n case 240: // Latch to EDIFACT encodation\n return Mode.EDIFACT_ENCODE;\n case 241: // ECI Character\n // TODO(bbrown): I think we need to support ECI\n // throw ReaderException.getInstance();\n // Ignore this symbol for now\n break;\n default:\n // Not to be used in ASCII encodation\n // but work around encoders that end with 254, latch back to ASCII\n if (oneByte !== 254 || bits.available() !== 0) {\n throw new FormatException();\n }\n break;\n }\n }\n } while (bits.available() > 0);\n return Mode.ASCII_ENCODE;\n }\n\n /**\n * See ISO 16022:2006, 5.2.5 and Annex C, Table C.1\n */\n private static decodeC40Segment(bits: BitSource, result: StringBuilder): void {\n // Three C40 values are encoded in a 16-bit value as\n // (1600 * C1) + (40 * C2) + C3 + 1\n // TODO(bbrown): The Upper Shift with C40 doesn't work in the 4 value scenario all the time\n let upperShift = false;\n\n const cValues: number[] = [];\n let shift = 0;\n\n do {\n // If there is only one byte left then it will be encoded as ASCII\n if (bits.available() === 8) {\n return;\n }\n const firstByte = bits.readBits(8);\n if (firstByte === 254) { // Unlatch codeword\n return;\n }\n\n this.parseTwoBytes(firstByte, bits.readBits(8), cValues);\n for (let i = 0; i < 3; i++) {\n const cValue = cValues[i];\n switch (shift) {\n case 0:\n if (cValue < 3) {\n shift = cValue + 1;\n } else if (cValue < this.C40_BASIC_SET_CHARS.length) {\n const c40char = this.C40_BASIC_SET_CHARS[cValue];\n if (upperShift) {\n result.append(String.fromCharCode(c40char.charCodeAt(0) + 128));\n upperShift = false;\n } else {\n result.append(c40char);\n }\n } else {\n throw new FormatException();\n }\n break;\n case 1:\n if (upperShift) {\n result.append(String.fromCharCode(cValue + 128));\n upperShift = false;\n } else {\n result.append(String.fromCharCode(cValue));\n }\n shift = 0;\n break;\n case 2:\n if (cValue < this.C40_SHIFT2_SET_CHARS.length) {\n const c40char = this.C40_SHIFT2_SET_CHARS[cValue];\n if (upperShift) {\n result.append(String.fromCharCode(c40char.charCodeAt(0) + 128));\n upperShift = false;\n } else {\n result.append(c40char);\n }\n } else {\n switch (cValue) {\n case 27: // FNC1\n result.append(String.fromCharCode(29)); // translate as ASCII 29\n break;\n case 30: // Upper Shift\n upperShift = true;\n break;\n default:\n throw new FormatException();\n }\n }\n shift = 0;\n break;\n case 3:\n if (upperShift) {\n result.append(String.fromCharCode(cValue + 224));\n upperShift = false;\n } else {\n result.append(String.fromCharCode(cValue + 96));\n }\n shift = 0;\n break;\n default:\n throw new FormatException();\n }\n }\n } while (bits.available() > 0);\n }\n\n /**\n * See ISO 16022:2006, 5.2.6 and Annex C, Table C.2\n */\n private static decodeTextSegment(bits: BitSource, result: StringBuilder): void {\n // Three Text values are encoded in a 16-bit value as\n // (1600 * C1) + (40 * C2) + C3 + 1\n // TODO(bbrown): The Upper Shift with Text doesn't work in the 4 value scenario all the time\n let upperShift = false;\n\n let cValues: number[] = [];\n let shift = 0;\n do {\n // If there is only one byte left then it will be encoded as ASCII\n if (bits.available() === 8) {\n return;\n }\n const firstByte = bits.readBits(8);\n if (firstByte === 254) { // Unlatch codeword\n return;\n }\n\n this.parseTwoBytes(firstByte, bits.readBits(8), cValues);\n\n for (let i = 0; i < 3; i++) {\n const cValue = cValues[i];\n switch (shift) {\n case 0:\n if (cValue < 3) {\n shift = cValue + 1;\n } else if (cValue < this.TEXT_BASIC_SET_CHARS.length) {\n const textChar = this.TEXT_BASIC_SET_CHARS[cValue];\n if (upperShift) {\n result.append(String.fromCharCode(textChar.charCodeAt(0) + 128));\n upperShift = false;\n } else {\n result.append(textChar);\n }\n } else {\n throw new FormatException();\n }\n break;\n case 1:\n if (upperShift) {\n result.append(String.fromCharCode(cValue + 128));\n upperShift = false;\n } else {\n result.append(String.fromCharCode(cValue));\n }\n shift = 0;\n break;\n case 2:\n // Shift 2 for Text is the same encoding as C40\n if (cValue < this.TEXT_SHIFT2_SET_CHARS.length) {\n const textChar = this.TEXT_SHIFT2_SET_CHARS[cValue];\n if (upperShift) {\n result.append(String.fromCharCode(textChar.charCodeAt(0) + 128));\n upperShift = false;\n } else {\n result.append(textChar);\n }\n } else {\n switch (cValue) {\n case 27: // FNC1\n result.append(String.fromCharCode(29)); // translate as ASCII 29\n break;\n case 30: // Upper Shift\n upperShift = true;\n break;\n default:\n throw new FormatException();\n }\n }\n shift = 0;\n break;\n case 3:\n if (cValue < this.TEXT_SHIFT3_SET_CHARS.length) {\n const textChar = this.TEXT_SHIFT3_SET_CHARS[cValue];\n if (upperShift) {\n result.append(String.fromCharCode(textChar.charCodeAt(0) + 128));\n upperShift = false;\n } else {\n result.append(textChar);\n }\n shift = 0;\n } else {\n throw new FormatException();\n }\n break;\n default:\n throw new FormatException();\n }\n }\n } while (bits.available() > 0);\n }\n\n /**\n * See ISO 16022:2006, 5.2.7\n */\n private static decodeAnsiX12Segment(bits: BitSource,\n result: StringBuilder): void {\n // Three ANSI X12 values are encoded in a 16-bit value as\n // (1600 * C1) + (40 * C2) + C3 + 1\n\n const cValues: number[] = [];\n do {\n // If there is only one byte left then it will be encoded as ASCII\n if (bits.available() === 8) {\n return;\n }\n const firstByte = bits.readBits(8);\n if (firstByte === 254) { // Unlatch codeword\n return;\n }\n\n this.parseTwoBytes(firstByte, bits.readBits(8), cValues);\n\n for (let i = 0; i < 3; i++) {\n const cValue = cValues[i];\n switch (cValue) {\n case 0: // X12 segment terminator \n result.append('\\r');\n break;\n case 1: // X12 segment separator *\n result.append('*');\n break;\n case 2: // X12 sub-element separator >\n result.append('>');\n break;\n case 3: // space\n result.append(' ');\n break;\n default:\n if (cValue < 14) { // 0 - 9\n result.append(String.fromCharCode(cValue + 44));\n } else if (cValue < 40) { // A - Z\n result.append(String.fromCharCode(cValue + 51));\n } else {\n throw new FormatException();\n }\n break;\n }\n }\n } while (bits.available() > 0);\n }\n\n private static parseTwoBytes(firstByte: number, secondByte: number, result: number[]): void {\n let fullBitValue = (firstByte << 8) + secondByte - 1;\n let temp = Math.floor(fullBitValue / 1600);\n result[0] = temp;\n fullBitValue -= temp * 1600;\n temp = Math.floor(fullBitValue / 40);\n result[1] = temp;\n result[2] = fullBitValue - temp * 40;\n }\n\n /**\n * See ISO 16022:2006, 5.2.8 and Annex C Table C.3\n */\n private static decodeEdifactSegment(bits: BitSource, result: StringBuilder): void {\n do {\n // If there is only two or less bytes left then it will be encoded as ASCII\n if (bits.available() <= 16) {\n return;\n }\n\n for (let i = 0; i < 4; i++) {\n let edifactValue = bits.readBits(6);\n\n // Check for the unlatch character\n if (edifactValue === 0x1F) { // 011111\n // Read rest of byte, which should be 0, and stop\n const bitsLeft = 8 - bits.getBitOffset();\n if (bitsLeft !== 8) {\n bits.readBits(bitsLeft);\n }\n return;\n }\n\n if ((edifactValue & 0x20) === 0) { // no 1 in the leading (6th) bit\n edifactValue |= 0x40; // Add a leading 01 to the 6 bit binary value\n }\n result.append(String.fromCharCode(edifactValue));\n }\n } while (bits.available() > 0);\n }\n\n /**\n * See ISO 16022:2006, 5.2.9 and Annex B, B.2\n */\n private static decodeBase256Segment(bits: BitSource,\n result: StringBuilder,\n byteSegments: Uint8Array[]): void {\n // Figure out how long the Base 256 Segment is.\n let codewordPosition = 1 + bits.getByteOffset(); // position is 1-indexed\n const d1 = this.unrandomize255State(bits.readBits(8), codewordPosition++);\n let count: number;\n if (d1 === 0) { // Read the remainder of the symbol\n count = bits.available() / 8 | 0;\n } else if (d1 < 250) {\n count = d1;\n } else {\n count = 250 * (d1 - 249) + this.unrandomize255State(bits.readBits(8), codewordPosition++);\n }\n\n // We're seeing NegativeArraySizeException errors from users.\n if (count < 0) {\n throw new FormatException();\n }\n\n const bytes = new Uint8Array(count);\n for (let i = 0; i < count; i++) {\n // Have seen this particular error in the wild, such as at\n // http://www.bcgen.com/demo/IDAutomationStreamingDataMatrix.aspx?MODE=3&D=Fred&PFMT=3&PT=F&X=0.3&O=0&LM=0.2\n if (bits.available() < 8) {\n throw new FormatException();\n }\n bytes[i] = this.unrandomize255State(bits.readBits(8), codewordPosition++);\n }\n byteSegments.push(bytes);\n try {\n result.append(StringEncoding.decode(bytes, StringUtils.ISO88591));\n } catch (uee) {\n throw new IllegalStateException('Platform does not support required encoding: ' + uee.message);\n }\n }\n\n /**\n * See ISO 16022:2006, Annex B, B.2\n */\n private static unrandomize255State(randomizedBase256Codeword: number,\n base256CodewordPosition: number): number {\n const pseudoRandomNumber = ((149 * base256CodewordPosition) % 255) + 1;\n const tempVariable = randomizedBase256Codeword - pseudoRandomNumber;\n return tempVariable >= 0 ? tempVariable : tempVariable + 256;\n }\n}\n","import DecodeHintType from '../../DecodeHintType';\nimport ResultPoint from '../../ResultPoint';\nimport ResultPointCallback from '../../ResultPointCallback';\nimport BitMatrix from '../../common/BitMatrix';\nimport DetectorResult from '../../common/DetectorResult';\nimport GridSampler from '../../common/GridSampler';\nimport GridSamplerInstance from '../../common/GridSamplerInstance';\nimport PerspectiveTransform from '../../common/PerspectiveTransform';\nimport MathUtils from '../../common/detector/MathUtils';\nimport Version from '../decoder/Version';\nimport WhiteRectangleDetector from '../../common/detector/WhiteRectangleDetector';\n\nimport NotFoundException from '../../NotFoundException';\nimport { float, int } from '../../../customTypings';\n\n/*\n * Copyright 2008 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n *

Encapsulates logic that can detect a Data Matrix Code in an image, even if the Data Matrix Code\n * is rotated or skewed, or partially obscured.

\n *\n * @author Sean Owen\n */\nexport default class Detector {\n\n private image: BitMatrix;\n private rectangleDetector: WhiteRectangleDetector;\n\n constructor(image: BitMatrix) {\n this.image = image;\n this.rectangleDetector = new WhiteRectangleDetector(this.image);\n }\n\n /**\n *

Detects a Data Matrix Code in an image.

\n *\n * @return {@link DetectorResult} encapsulating results of detecting a Data Matrix Code\n * @throws NotFoundException if no Data Matrix Code can be found\n */\n public detect(): DetectorResult {\n\n\n const cornerPoints = this.rectangleDetector.detect();\n\n let points = this.detectSolid1(cornerPoints);\n points = this.detectSolid2(points);\n points[3] = this.correctTopRight(points);\n if (!points[3]) {\n throw new NotFoundException();\n }\n points = this.shiftToModuleCenter(points);\n\n const topLeft = points[0];\n const bottomLeft = points[1];\n const bottomRight = points[2];\n const topRight = points[3];\n\n let dimensionTop = this.transitionsBetween(topLeft, topRight) + 1;\n let dimensionRight = this.transitionsBetween(bottomRight, topRight) + 1;\n if ((dimensionTop & 0x01) === 1) {\n dimensionTop += 1;\n }\n if ((dimensionRight & 0x01) === 1) {\n dimensionRight += 1;\n }\n\n if (4 * dimensionTop < 7 * dimensionRight && 4 * dimensionRight < 7 * dimensionTop) {\n // The matrix is square\n dimensionTop = dimensionRight = Math.max(dimensionTop, dimensionRight);\n }\n\n let bits = Detector.sampleGrid(this.image,\n topLeft,\n bottomLeft,\n bottomRight,\n topRight,\n dimensionTop,\n dimensionRight);\n\n return new DetectorResult(bits, [topLeft, bottomLeft, bottomRight, topRight]);\n }\n\n private static shiftPoint(point: ResultPoint, to: ResultPoint, div: float): ResultPoint {\n let x = (to.getX() - point.getX()) / (div + 1);\n let y = (to.getY() - point.getY()) / (div + 1);\n return new ResultPoint(point.getX() + x, point.getY() + y);\n }\n\n private static moveAway(point: ResultPoint, fromX: float, fromY: float): ResultPoint {\n let x = point.getX();\n let y = point.getY();\n\n if (x < fromX) {\n x -= 1;\n } else {\n x += 1;\n }\n\n if (y < fromY) {\n y -= 1;\n } else {\n y += 1;\n }\n\n return new ResultPoint(x, y);\n }\n\n /**\n * Detect a solid side which has minimum transition.\n */\n private detectSolid1(cornerPoints: ResultPoint[]): ResultPoint[] {\n // 0 2\n // 1 3\n let pointA = cornerPoints[0];\n let pointB = cornerPoints[1];\n let pointC = cornerPoints[3];\n let pointD = cornerPoints[2];\n\n let trAB = this.transitionsBetween(pointA, pointB);\n let trBC = this.transitionsBetween(pointB, pointC);\n let trCD = this.transitionsBetween(pointC, pointD);\n let trDA = this.transitionsBetween(pointD, pointA);\n\n // 0..3\n // : :\n // 1--2\n let min = trAB;\n let points = [pointD, pointA, pointB, pointC];\n if (min > trBC) {\n min = trBC;\n points[0] = pointA;\n points[1] = pointB;\n points[2] = pointC;\n points[3] = pointD;\n }\n if (min > trCD) {\n min = trCD;\n points[0] = pointB;\n points[1] = pointC;\n points[2] = pointD;\n points[3] = pointA;\n }\n if (min > trDA) {\n points[0] = pointC;\n points[1] = pointD;\n points[2] = pointA;\n points[3] = pointB;\n }\n\n return points;\n }\n\n /**\n * Detect a second solid side next to first solid side.\n */\n private detectSolid2(points: ResultPoint[]): ResultPoint[] {\n // A..D\n // : :\n // B--C\n let pointA = points[0];\n let pointB = points[1];\n let pointC = points[2];\n let pointD = points[3];\n\n // Transition detection on the edge is not stable.\n // To safely detect, shift the points to the module center.\n let tr = this.transitionsBetween(pointA, pointD);\n let pointBs = Detector.shiftPoint(pointB, pointC, (tr + 1) * 4);\n let pointCs = Detector.shiftPoint(pointC, pointB, (tr + 1) * 4);\n let trBA = this.transitionsBetween(pointBs, pointA);\n let trCD = this.transitionsBetween(pointCs, pointD);\n\n // 0..3\n // | :\n // 1--2\n if (trBA < trCD) {\n // solid sides: A-B-C\n points[0] = pointA;\n points[1] = pointB;\n points[2] = pointC;\n points[3] = pointD;\n } else {\n // solid sides: B-C-D\n points[0] = pointB;\n points[1] = pointC;\n points[2] = pointD;\n points[3] = pointA;\n }\n\n return points;\n }\n\n /**\n * Calculates the corner position of the white top right module.\n */\n private correctTopRight(points: ResultPoint[]): ResultPoint {\n // A..D\n // | :\n // B--C\n let pointA = points[0];\n let pointB = points[1];\n let pointC = points[2];\n let pointD = points[3];\n\n // shift points for safe transition detection.\n let trTop = this.transitionsBetween(pointA, pointD);\n let trRight = this.transitionsBetween(pointB, pointD);\n let pointAs = Detector.shiftPoint(pointA, pointB, (trRight + 1) * 4);\n let pointCs = Detector.shiftPoint(pointC, pointB, (trTop + 1) * 4);\n\n trTop = this.transitionsBetween(pointAs, pointD);\n trRight = this.transitionsBetween(pointCs, pointD);\n\n let candidate1 = new ResultPoint(\n pointD.getX() + (pointC.getX() - pointB.getX()) / (trTop + 1),\n pointD.getY() + (pointC.getY() - pointB.getY()) / (trTop + 1));\n let candidate2 = new ResultPoint(\n pointD.getX() + (pointA.getX() - pointB.getX()) / (trRight + 1),\n pointD.getY() + (pointA.getY() - pointB.getY()) / (trRight + 1));\n\n if (!this.isValid(candidate1)) {\n if (this.isValid(candidate2)) {\n return candidate2;\n }\n return null;\n }\n if (!this.isValid(candidate2)) {\n return candidate1;\n }\n\n let sumc1 = this.transitionsBetween(pointAs, candidate1) + this.transitionsBetween(pointCs, candidate1);\n let sumc2 = this.transitionsBetween(pointAs, candidate2) + this.transitionsBetween(pointCs, candidate2);\n\n if (sumc1 > sumc2) {\n return candidate1;\n } else {\n return candidate2;\n }\n }\n\n /**\n * Shift the edge points to the module center.\n */\n private shiftToModuleCenter(points: ResultPoint[]): ResultPoint[] {\n // A..D\n // | :\n // B--C\n let pointA = points[0];\n let pointB = points[1];\n let pointC = points[2];\n let pointD = points[3];\n\n // calculate pseudo dimensions\n let dimH = this.transitionsBetween(pointA, pointD) + 1;\n let dimV = this.transitionsBetween(pointC, pointD) + 1;\n\n // shift points for safe dimension detection\n let pointAs = Detector.shiftPoint(pointA, pointB, dimV * 4);\n let pointCs = Detector.shiftPoint(pointC, pointB, dimH * 4);\n\n // calculate more precise dimensions\n dimH = this.transitionsBetween(pointAs, pointD) + 1;\n dimV = this.transitionsBetween(pointCs, pointD) + 1;\n if ((dimH & 0x01) === 1) {\n dimH += 1;\n }\n if ((dimV & 0x01) === 1) {\n dimV += 1;\n }\n\n // WhiteRectangleDetector returns points inside of the rectangle.\n // I want points on the edges.\n let centerX = (pointA.getX() + pointB.getX() + pointC.getX() + pointD.getX()) / 4;\n let centerY = (pointA.getY() + pointB.getY() + pointC.getY() + pointD.getY()) / 4;\n pointA = Detector.moveAway(pointA, centerX, centerY);\n pointB = Detector.moveAway(pointB, centerX, centerY);\n pointC = Detector.moveAway(pointC, centerX, centerY);\n pointD = Detector.moveAway(pointD, centerX, centerY);\n\n let pointBs: ResultPoint;\n let pointDs: ResultPoint;\n\n // shift points to the center of each modules\n pointAs = Detector.shiftPoint(pointA, pointB, dimV * 4);\n pointAs = Detector.shiftPoint(pointAs, pointD, dimH * 4);\n pointBs = Detector.shiftPoint(pointB, pointA, dimV * 4);\n pointBs = Detector.shiftPoint(pointBs, pointC, dimH * 4);\n pointCs = Detector.shiftPoint(pointC, pointD, dimV * 4);\n pointCs = Detector.shiftPoint(pointCs, pointB, dimH * 4);\n pointDs = Detector.shiftPoint(pointD, pointC, dimV * 4);\n pointDs = Detector.shiftPoint(pointDs, pointA, dimH * 4);\n\n return [pointAs, pointBs, pointCs, pointDs];\n }\n\n private isValid(p: ResultPoint): boolean {\n return p.getX() >= 0 && p.getX() < this.image.getWidth() && p.getY() > 0 && p.getY() < this.image.getHeight();\n }\n\n private static sampleGrid(image: BitMatrix,\n topLeft: ResultPoint,\n bottomLeft: ResultPoint,\n bottomRight: ResultPoint,\n topRight: ResultPoint,\n dimensionX: int,\n dimensionY: int): BitMatrix {\n\n const sampler = GridSamplerInstance.getInstance();\n\n return sampler.sampleGrid(image,\n dimensionX,\n dimensionY,\n 0.5,\n 0.5,\n dimensionX - 0.5,\n 0.5,\n dimensionX - 0.5,\n dimensionY - 0.5,\n 0.5,\n dimensionY - 0.5,\n topLeft.getX(),\n topLeft.getY(),\n topRight.getX(),\n topRight.getY(),\n bottomRight.getX(),\n bottomRight.getY(),\n bottomLeft.getX(),\n bottomLeft.getY());\n }\n\n /**\n * Counts the number of black/white transitions between two points, using something like Bresenham's algorithm.\n */\n private transitionsBetween(from: ResultPoint, to: ResultPoint): int {\n // See QR Code Detector, sizeOfBlackWhiteBlackRun()\n let fromX = Math.trunc(from.getX());\n let fromY = Math.trunc(from.getY());\n let toX = Math.trunc(to.getX());\n let toY = Math.trunc(to.getY());\n let steep: boolean = Math.abs(toY - fromY) > Math.abs(toX - fromX);\n if (steep) {\n let temp = fromX;\n fromX = fromY;\n fromY = temp;\n temp = toX;\n toX = toY;\n toY = temp;\n }\n\n let dx = Math.abs(toX - fromX);\n let dy = Math.abs(toY - fromY);\n let error = -dx / 2;\n let ystep = fromY < toY ? 1 : -1;\n let xstep = fromX < toX ? 1 : -1;\n let transitions = 0;\n let inBlack: boolean = this.image.get(steep ? fromY : fromX, steep ? fromX : fromY);\n for (let x: int = fromX, y = fromY; x !== toX; x += xstep) {\n let isBlack: boolean = this.image.get(steep ? y : x, steep ? x : y);\n if (isBlack !== inBlack) {\n transitions++;\n inBlack = isBlack;\n }\n error += dy;\n if (error > 0) {\n if (y === toY) {\n break;\n }\n y += ystep;\n error -= dx;\n }\n }\n return transitions;\n }\n}\n","import { BrowserCodeReader } from './BrowserCodeReader';\nimport MultiFormatReader from '../core/MultiFormatReader';\nimport BinaryBitmap from '../core/BinaryBitmap';\nimport Result from '../core/Result';\nimport DecodeHintType from '../core/DecodeHintType';\n\nexport class BrowserMultiFormatReader extends BrowserCodeReader {\n\n protected readonly reader: MultiFormatReader;\n\n public constructor(\n hints: Map = null,\n timeBetweenScansMillis: number = 500\n ) {\n const reader = new MultiFormatReader();\n reader.setHints(hints);\n super(reader, timeBetweenScansMillis);\n }\n\n /**\n * Overwrite decodeBitmap to call decodeWithState, which will pay\n * attention to the hints set in the constructor function\n */\n public decodeBitmap(binaryBitmap: BinaryBitmap): Result {\n return this.reader.decodeWithState(binaryBitmap);\n }\n}\n","/*\n * Copyright 2007 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*namespace com.google.zxing.qrcode.decoder {*/\n\nimport DecodeHintType from '../../DecodeHintType';\nimport BitMatrix from '../../common/BitMatrix';\nimport DecoderResult from '../../common/DecoderResult';\nimport GenericGF from '../../common/reedsolomon/GenericGF';\nimport ReedSolomonDecoder from '../../common/reedsolomon/ReedSolomonDecoder';\nimport BitMatrixParser from './BitMatrixParser';\nimport QRCodeDecoderMetaData from './QRCodeDecoderMetaData';\nimport DataBlock from './DataBlock';\nimport DecodedBitStreamParser from './DecodedBitStreamParser';\n\nimport ChecksumException from '../../ChecksumException';\n\n/*import java.util.Map;*/\n\n/**\n *

The main class which implements QR Code decoding -- as opposed to locating and extracting\n * the QR Code from an image.

\n *\n * @author Sean Owen\n */\nexport default class Decoder {\n\n private rsDecoder: ReedSolomonDecoder;\n\n public constructor() {\n this.rsDecoder = new ReedSolomonDecoder(GenericGF.QR_CODE_FIELD_256);\n }\n\n // public decode(image: boolean[][]): DecoderResult /*throws ChecksumException, FormatException*/ {\n // return decode(image, null)\n // }\n\n /**\n *

Convenience method that can decode a QR Code represented as a 2D array of booleans.\n * \"true\" is taken to mean a black module.

\n *\n * @param image booleans representing white/black QR Code modules\n * @param hints decoding hints that should be used to influence decoding\n * @return text and bytes encoded within the QR Code\n * @throws FormatException if the QR Code cannot be decoded\n * @throws ChecksumException if error correction fails\n */\n public decodeBooleanArray(image: boolean[][], hints?: Map): DecoderResult {\n return this.decodeBitMatrix(BitMatrix.parseFromBooleanArray(image), hints);\n }\n\n // public decodeBitMatrix(bits: BitMatrix): DecoderResult /*throws ChecksumException, FormatException*/ {\n // return decode(bits, null)\n // }\n\n /**\n *

Decodes a QR Code represented as a {@link BitMatrix}. A 1 or \"true\" is taken to mean a black module.

\n *\n * @param bits booleans representing white/black QR Code modules\n * @param hints decoding hints that should be used to influence decoding\n * @return text and bytes encoded within the QR Code\n * @throws FormatException if the QR Code cannot be decoded\n * @throws ChecksumException if error correction fails\n */\n public decodeBitMatrix(bits: BitMatrix, hints?: Map): DecoderResult {\n\n // Construct a parser and read version, error-correction level\n const parser = new BitMatrixParser(bits);\n let ex = null;\n try {\n return this.decodeBitMatrixParser(parser, hints);\n } catch (e/*: FormatException, ChecksumException*/) {\n ex = e;\n }\n\n try {\n\n // Revert the bit matrix\n parser.remask();\n\n // Will be attempting a mirrored reading of the version and format info.\n parser.setMirror(true);\n\n // Preemptively read the version.\n parser.readVersion();\n\n // Preemptively read the format information.\n parser.readFormatInformation();\n\n /*\n * Since we're here, this means we have successfully detected some kind\n * of version and format information when mirrored. This is a good sign,\n * that the QR code may be mirrored, and we should try once more with a\n * mirrored content.\n */\n // Prepare for a mirrored reading.\n parser.mirror();\n\n const result = this.decodeBitMatrixParser(parser, hints);\n\n // Success! Notify the caller that the code was mirrored.\n result.setOther(new QRCodeDecoderMetaData(true));\n\n return result;\n\n } catch (e/*FormatException | ChecksumException*/) {\n // Throw the exception from the original reading\n if (ex !== null) {\n throw ex;\n }\n throw e;\n\n }\n }\n\n private decodeBitMatrixParser(parser: BitMatrixParser, hints: Map): DecoderResult {\n const version = parser.readVersion();\n const ecLevel = parser.readFormatInformation().getErrorCorrectionLevel();\n\n // Read codewords\n const codewords = parser.readCodewords();\n // Separate into data blocks\n const dataBlocks = DataBlock.getDataBlocks(codewords, version, ecLevel);\n\n // Count total number of data bytes\n let totalBytes = 0;\n for (const dataBlock of dataBlocks) {\n totalBytes += dataBlock.getNumDataCodewords();\n }\n const resultBytes = new Uint8Array(totalBytes);\n let resultOffset = 0;\n\n // Error-correct and copy data blocks together into a stream of bytes\n for (const dataBlock of dataBlocks) {\n const codewordBytes = dataBlock.getCodewords();\n const numDataCodewords = dataBlock.getNumDataCodewords();\n this.correctErrors(codewordBytes, numDataCodewords);\n for (let i = 0; i < numDataCodewords; i++) {\n resultBytes[resultOffset++] = codewordBytes[i];\n }\n }\n\n // Decode the contents of that stream of bytes\n return DecodedBitStreamParser.decode(resultBytes, version, ecLevel, hints);\n }\n\n /**\n *

Given data and error-correction codewords received, possibly corrupted by errors, attempts to\n * correct the errors in-place using Reed-Solomon error correction.

\n *\n * @param codewordBytes data and error correction codewords\n * @param numDataCodewords number of codewords that are data bytes\n * @throws ChecksumException if error correction fails\n */\n private correctErrors(codewordBytes: Uint8Array, numDataCodewords: number /*int*/): void /*throws ChecksumException*/ {\n const numCodewords = codewordBytes.length;\n // First read into an array of ints\n const codewordsInts = new Int32Array(codewordBytes);\n // TYPESCRIPTPORT: not realy necessary to transform to ints? could redesign everything to work with unsigned bytes?\n // const codewordsInts = new Int32Array(numCodewords)\n // for (let i = 0; i < numCodewords; i++) {\n // codewordsInts[i] = codewordBytes[i] & 0xFF\n // }\n try {\n this.rsDecoder.decode(codewordsInts, codewordBytes.length - numDataCodewords);\n } catch (ignored/*: ReedSolomonException*/) {\n throw new ChecksumException();\n }\n // Copy back into array of bytes -- only need to worry about the bytes that were data\n // We don't care about errors in the error-correction codewords\n for (let i = 0; i < numDataCodewords; i++) {\n codewordBytes[i] = /*(byte) */codewordsInts[i];\n }\n }\n\n}\n","/*\n * Copyright 2007 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*namespace com.google.zxing.qrcode.decoder {*/\n\nimport BitMatrix from '../../common/BitMatrix';\nimport Version from './Version';\nimport FormatInformation from './FormatInformation';\n\nimport DataMask from './DataMask';\nimport FormatException from '../../FormatException';\n/**\n * @author Sean Owen\n */\nexport default class BitMatrixParser {\n\n private bitMatrix: BitMatrix;\n private parsedVersion: Version;\n private parsedFormatInfo: FormatInformation;\n private isMirror: boolean;\n\n /**\n * @param bitMatrix {@link BitMatrix} to parse\n * @throws FormatException if dimension is not >= 21 and 1 mod 4\n */\n public constructor(bitMatrix: BitMatrix) /*throws FormatException*/ {\n const dimension = bitMatrix.getHeight();\n if (dimension < 21 || (dimension & 0x03) !== 1) {\n throw new FormatException();\n }\n this.bitMatrix = bitMatrix;\n }\n\n /**\n *

Reads format information from one of its two locations within the QR Code.

\n *\n * @return {@link FormatInformation} encapsulating the QR Code's format info\n * @throws FormatException if both format information locations cannot be parsed as\n * the valid encoding of format information\n */\n public readFormatInformation(): FormatInformation /*throws FormatException*/ {\n\n if (this.parsedFormatInfo !== null && this.parsedFormatInfo !== undefined) {\n return this.parsedFormatInfo;\n }\n\n // Read top-left format info bits\n let formatInfoBits1 = 0;\n for (let i = 0; i < 6; i++) {\n formatInfoBits1 = this.copyBit(i, 8, formatInfoBits1);\n }\n // .. and skip a bit in the timing pattern ...\n formatInfoBits1 = this.copyBit(7, 8, formatInfoBits1);\n formatInfoBits1 = this.copyBit(8, 8, formatInfoBits1);\n formatInfoBits1 = this.copyBit(8, 7, formatInfoBits1);\n // .. and skip a bit in the timing pattern ...\n for (let j = 5; j >= 0; j--) {\n formatInfoBits1 = this.copyBit(8, j, formatInfoBits1);\n }\n\n // Read the top-right/bottom-left pattern too\n const dimension = this.bitMatrix.getHeight();\n let formatInfoBits2 = 0;\n const jMin = dimension - 7;\n for (let j = dimension - 1; j >= jMin; j--) {\n formatInfoBits2 = this.copyBit(8, j, formatInfoBits2);\n }\n for (let i = dimension - 8; i < dimension; i++) {\n formatInfoBits2 = this.copyBit(i, 8, formatInfoBits2);\n }\n\n this.parsedFormatInfo = FormatInformation.decodeFormatInformation(formatInfoBits1, formatInfoBits2);\n if (this.parsedFormatInfo !== null) {\n return this.parsedFormatInfo;\n }\n throw new FormatException();\n }\n\n /**\n *

Reads version information from one of its two locations within the QR Code.

\n *\n * @return {@link Version} encapsulating the QR Code's version\n * @throws FormatException if both version information locations cannot be parsed as\n * the valid encoding of version information\n */\n public readVersion(): Version /*throws FormatException*/ {\n\n if (this.parsedVersion !== null && this.parsedVersion !== undefined) {\n return this.parsedVersion;\n }\n\n const dimension = this.bitMatrix.getHeight();\n\n const provisionalVersion = Math.floor((dimension - 17) / 4);\n if (provisionalVersion <= 6) {\n return Version.getVersionForNumber(provisionalVersion);\n }\n\n // Read top-right version info: 3 wide by 6 tall\n let versionBits = 0;\n const ijMin = dimension - 11;\n for (let j = 5; j >= 0; j--) {\n for (let i = dimension - 9; i >= ijMin; i--) {\n versionBits = this.copyBit(i, j, versionBits);\n }\n }\n\n let theParsedVersion = Version.decodeVersionInformation(versionBits);\n if (theParsedVersion !== null && theParsedVersion.getDimensionForVersion() === dimension) {\n this.parsedVersion = theParsedVersion;\n return theParsedVersion;\n }\n\n // Hmm, failed. Try bottom left: 6 wide by 3 tall\n versionBits = 0;\n for (let i = 5; i >= 0; i--) {\n for (let j = dimension - 9; j >= ijMin; j--) {\n versionBits = this.copyBit(i, j, versionBits);\n }\n }\n\n theParsedVersion = Version.decodeVersionInformation(versionBits);\n if (theParsedVersion !== null && theParsedVersion.getDimensionForVersion() === dimension) {\n this.parsedVersion = theParsedVersion;\n return theParsedVersion;\n }\n throw new FormatException();\n }\n\n private copyBit(i: number /*int*/, j: number /*int*/, versionBits: number /*int*/): number /*int*/ {\n const bit: boolean = this.isMirror ? this.bitMatrix.get(j, i) : this.bitMatrix.get(i, j);\n return bit ? (versionBits << 1) | 0x1 : versionBits << 1;\n }\n\n /**\n *

Reads the bits in the {@link BitMatrix} representing the finder pattern in the\n * correct order in order to reconstruct the codewords bytes contained within the\n * QR Code.

\n *\n * @return bytes encoded within the QR Code\n * @throws FormatException if the exact number of bytes expected is not read\n */\n public readCodewords(): Uint8Array /*throws FormatException*/ {\n\n const formatInfo = this.readFormatInformation();\n const version = this.readVersion();\n\n // Get the data mask for the format used in this QR Code. This will exclude\n // some bits from reading as we wind through the bit matrix.\n const dataMask = DataMask.values.get(formatInfo.getDataMask());\n const dimension = this.bitMatrix.getHeight();\n dataMask.unmaskBitMatrix(this.bitMatrix, dimension);\n\n const functionPattern = version.buildFunctionPattern();\n\n let readingUp: boolean = true;\n const result = new Uint8Array(version.getTotalCodewords());\n let resultOffset = 0;\n let currentByte = 0;\n let bitsRead = 0;\n // Read columns in pairs, from right to left\n for (let j = dimension - 1; j > 0; j -= 2) {\n if (j === 6) {\n // Skip whole column with vertical alignment pattern\n // saves time and makes the other code proceed more cleanly\n j--;\n }\n // Read alternatingly from bottom to top then top to bottom\n for (let count = 0; count < dimension; count++) {\n const i = readingUp ? dimension - 1 - count : count;\n for (let col = 0; col < 2; col++) {\n // Ignore bits covered by the function pattern\n if (!functionPattern.get(j - col, i)) {\n // Read a bit\n bitsRead++;\n currentByte <<= 1;\n if (this.bitMatrix.get(j - col, i)) {\n currentByte |= 1;\n }\n // If we've made a whole byte, save it off\n if (bitsRead === 8) {\n result[resultOffset++] = /*(byte) */currentByte;\n bitsRead = 0;\n currentByte = 0;\n }\n }\n }\n }\n readingUp = !readingUp; // readingUp ^= true; // readingUp = !readingUp; // switch directions\n }\n if (resultOffset !== version.getTotalCodewords()) {\n throw new FormatException();\n }\n return result;\n }\n\n /**\n * Revert the mask removal done while reading the code words. The bit matrix should revert to its original state.\n */\n public remask(): void {\n if (this.parsedFormatInfo === null) {\n return; // We have no format information, and have no data mask\n }\n const dataMask = DataMask.values[this.parsedFormatInfo.getDataMask()];\n const dimension = this.bitMatrix.getHeight();\n dataMask.unmaskBitMatrix(this.bitMatrix, dimension);\n }\n\n /**\n * Prepare the parser for a mirrored operation.\n * This flag has effect only on the {@link #readFormatInformation()} and the\n * {@link #readVersion()}. Before proceeding with {@link #readCodewords()} the\n * {@link #mirror()} method should be called.\n *\n * @param mirror Whether to read version and format information mirrored.\n */\n public setMirror(isMirror: boolean): void {\n this.parsedVersion = null;\n this.parsedFormatInfo = null;\n this.isMirror = isMirror;\n }\n\n /** Mirror the bit matrix in order to attempt a second reading. */\n public mirror(): void {\n const bitMatrix = this.bitMatrix;\n for (let x = 0, width = bitMatrix.getWidth(); x < width; x++) {\n for (let y = x + 1, height = bitMatrix.getHeight(); y < height; y++) {\n if (bitMatrix.get(x, y) !== bitMatrix.get(y, x)) {\n bitMatrix.flip(y, x);\n bitMatrix.flip(x, y);\n }\n }\n }\n }\n\n}\n","import ECB from './ECB';\n\n/**\n *

Encapsulates a set of error-correction blocks in one symbol version. Most versions will\n * use blocks of differing sizes within one version, so, this encapsulates the parameters for\n * each set of blocks. It also holds the number of error-correction codewords per block since it\n * will be the same across all blocks within one version.

\n */\nexport default class ECBlocks {\n private ecBlocks: ECB[];\n\n public constructor(private ecCodewordsPerBlock: number /*int*/, ...ecBlocks: ECB[]) {\n this.ecBlocks = ecBlocks;\n }\n\n public getECCodewordsPerBlock(): number /*int*/ {\n return this.ecCodewordsPerBlock;\n }\n\n public getNumBlocks(): number /*int*/ {\n let total = 0;\n const ecBlocks = this.ecBlocks;\n for (const ecBlock of ecBlocks) {\n total += ecBlock.getCount();\n }\n return total;\n }\n\n public getTotalECCodewords(): number /*int*/ {\n return this.ecCodewordsPerBlock * this.getNumBlocks();\n }\n\n public getECBlocks(): ECB[] {\n return this.ecBlocks;\n }\n}\n","/**\n *

Encapsulates the parameters for one error-correction block in one symbol version.\n * This includes the number of data codewords, and the number of times a block with these\n * parameters is used consecutively in the QR code version's format.

\n */\nexport default class ECB {\n private count: number; /*int*/\n private dataCodewords: number; /*int*/\n\n public constructor(count: number /*int*/, dataCodewords: number /*int*/) {\n this.count = count;\n this.dataCodewords = dataCodewords;\n }\n\n public getCount(): number /*int*/ {\n return this.count;\n }\n\n public getDataCodewords(): number /*int*/ {\n return this.dataCodewords;\n }\n}\n","/*\n * Copyright 2007 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*namespace com.google.zxing.qrcode.decoder {*/\n\nimport BitMatrix from '../../common/BitMatrix';\n\nexport enum DataMaskValues {\n DATA_MASK_000,\n DATA_MASK_001,\n DATA_MASK_010,\n DATA_MASK_011,\n DATA_MASK_100,\n DATA_MASK_101,\n DATA_MASK_110,\n DATA_MASK_111\n}\n\n/**\n *

Encapsulates data masks for the data bits in a QR code, per ISO 18004:2006 6.8. Implementations\n * of this class can un-mask a raw BitMatrix. For simplicity, they will unmask the entire BitMatrix,\n * including areas used for finder patterns, timing patterns, etc. These areas should be unused\n * after the point they are unmasked anyway.

\n *\n *

Note that the diagram in section 6.8.1 is misleading since it indicates that i is column position\n * and j is row position. In fact, as the text says, i is row position and j is column position.

\n *\n * @author Sean Owen\n */\nexport default class DataMask {\n\n // See ISO 18004:2006 6.8.1\n\n public constructor(private value: DataMaskValues, private isMasked: (i: number, j: number) => boolean) {\n }\n\n public static values = new Map([\n /**\n * 000: mask bits for which (x + y) mod 2 == 0\n */\n [DataMaskValues.DATA_MASK_000, new DataMask(DataMaskValues.DATA_MASK_000, (i: number /*int*/, j: number /*int*/) => { return ((i + j) & 0x01) === 0; })],\n\n /**\n * 001: mask bits for which x mod 2 == 0\n */\n [DataMaskValues.DATA_MASK_001, new DataMask(DataMaskValues.DATA_MASK_001, (i: number /*int*/, j: number /*int*/) => { return (i & 0x01) === 0; })],\n\n /**\n * 010: mask bits for which y mod 3 == 0\n */\n [DataMaskValues.DATA_MASK_010, new DataMask(DataMaskValues.DATA_MASK_010, (i: number /*int*/, j: number /*int*/) => { return j % 3 === 0; })],\n\n /**\n * 011: mask bits for which (x + y) mod 3 == 0\n */\n [DataMaskValues.DATA_MASK_011, new DataMask(DataMaskValues.DATA_MASK_011, (i: number /*int*/, j: number /*int*/) => { return (i + j) % 3 === 0; })],\n\n /**\n * 100: mask bits for which (x/2 + y/3) mod 2 == 0\n */\n [DataMaskValues.DATA_MASK_100, new DataMask(DataMaskValues.DATA_MASK_100, (i: number /*int*/, j: number /*int*/) => { return ((Math.floor(i / 2) + Math.floor(j / 3)) & 0x01) === 0; })],\n\n /**\n * 101: mask bits for which xy mod 2 + xy mod 3 == 0\n * equivalently, such that xy mod 6 == 0\n */\n [DataMaskValues.DATA_MASK_101, new DataMask(DataMaskValues.DATA_MASK_101, (i: number /*int*/, j: number /*int*/) => { return (i * j) % 6 === 0; })],\n\n /**\n * 110: mask bits for which (xy mod 2 + xy mod 3) mod 2 == 0\n * equivalently, such that xy mod 6 < 3\n */\n [DataMaskValues.DATA_MASK_110, new DataMask(DataMaskValues.DATA_MASK_110, (i: number /*int*/, j: number /*int*/) => { return ((i * j) % 6) < 3; })],\n\n /**\n * 111: mask bits for which ((x+y)mod 2 + xy mod 3) mod 2 == 0\n * equivalently, such that (x + y + xy mod 3) mod 2 == 0\n */\n [DataMaskValues.DATA_MASK_111, new DataMask(DataMaskValues.DATA_MASK_111, (i: number /*int*/, j: number /*int*/) => { return ((i + j + ((i * j) % 3)) & 0x01) === 0; })],\n ]);\n\n // End of enum constants.\n\n\n /**\n *

Implementations of this method reverse the data masking process applied to a QR Code and\n * make its bits ready to read.

\n *\n * @param bits representation of QR Code bits\n * @param dimension dimension of QR Code, represented by bits, being unmasked\n */\n public unmaskBitMatrix(bits: BitMatrix, dimension: number /*int*/): void {\n for (let i = 0; i < dimension; i++) {\n for (let j = 0; j < dimension; j++) {\n if (this.isMasked(i, j)) {\n bits.flip(j, i);\n }\n }\n }\n }\n\n // abstract boolean isMasked(i: number /*int*/, j: number /*int*/);\n\n}\n","/*\n * Copyright 2007 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*namespace com.google.zxing.qrcode.decoder {*/\n\nimport Version from './Version';\nimport ECBlocks from './ECBlocks';\nimport ECB from './ECB';\nimport ErrorCorrectionLevel from './ErrorCorrectionLevel';\n\nimport IllegalArgumentException from '../../IllegalArgumentException';\n\n/**\n *

Encapsulates a block of data within a QR Code. QR Codes may split their data into\n * multiple blocks, each of which is a unit of data and error-correction codewords. Each\n * is represented by an instance of this class.

\n *\n * @author Sean Owen\n */\nexport default class DataBlock {\n\n private constructor(private numDataCodewords: number /*int*/, private codewords: Uint8Array) { }\n\n /**\n *

When QR Codes use multiple data blocks, they are actually interleaved.\n * That is, the first byte of data block 1 to n is written, then the second bytes, and so on. This\n * method will separate the data into original blocks.

\n *\n * @param rawCodewords bytes as read directly from the QR Code\n * @param version version of the QR Code\n * @param ecLevel error-correction level of the QR Code\n * @return DataBlocks containing original bytes, \"de-interleaved\" from representation in the\n * QR Code\n */\n public static getDataBlocks(rawCodewords: Uint8Array,\n version: Version,\n ecLevel: ErrorCorrectionLevel): DataBlock[] {\n\n if (rawCodewords.length !== version.getTotalCodewords()) {\n throw new IllegalArgumentException();\n }\n\n // Figure out the number and size of data blocks used by this version and\n // error correction level\n const ecBlocks: ECBlocks = version.getECBlocksForLevel(ecLevel);\n\n // First count the total number of data blocks\n let totalBlocks = 0;\n const ecBlockArray: ECB[] = ecBlocks.getECBlocks();\n for (const ecBlock of ecBlockArray) {\n totalBlocks += ecBlock.getCount();\n }\n\n // Now establish DataBlocks of the appropriate size and number of data codewords\n const result = new Array(totalBlocks);\n let numResultBlocks = 0;\n for (const ecBlock of ecBlockArray) {\n for (let i = 0; i < ecBlock.getCount(); i++) {\n const numDataCodewords = ecBlock.getDataCodewords();\n const numBlockCodewords = ecBlocks.getECCodewordsPerBlock() + numDataCodewords;\n result[numResultBlocks++] = new DataBlock(numDataCodewords, new Uint8Array(numBlockCodewords));\n }\n }\n\n // All blocks have the same amount of data, except that the last n\n // (where n may be 0) have 1 more byte. Figure out where these start.\n const shorterBlocksTotalCodewords = result[0].codewords.length;\n let longerBlocksStartAt = result.length - 1;\n // TYPESCRIPTPORT: check length is correct here\n while (longerBlocksStartAt >= 0) {\n const numCodewords = result[longerBlocksStartAt].codewords.length;\n if (numCodewords === shorterBlocksTotalCodewords) {\n break;\n }\n longerBlocksStartAt--;\n }\n longerBlocksStartAt++;\n\n const shorterBlocksNumDataCodewords = shorterBlocksTotalCodewords - ecBlocks.getECCodewordsPerBlock();\n // The last elements of result may be 1 element longer\n // first fill out as many elements as all of them have\n let rawCodewordsOffset = 0;\n for (let i = 0; i < shorterBlocksNumDataCodewords; i++) {\n for (let j = 0; j < numResultBlocks; j++) {\n result[j].codewords[i] = rawCodewords[rawCodewordsOffset++];\n }\n }\n // Fill out the last data block in the longer ones\n for (let j = longerBlocksStartAt; j < numResultBlocks; j++) {\n result[j].codewords[shorterBlocksNumDataCodewords] = rawCodewords[rawCodewordsOffset++];\n }\n // Now add in error correction blocks\n const max = result[0].codewords.length;\n for (let i = shorterBlocksNumDataCodewords; i < max; i++) {\n for (let j = 0; j < numResultBlocks; j++) {\n const iOffset = j < longerBlocksStartAt ? i : i + 1;\n result[j].codewords[iOffset] = rawCodewords[rawCodewordsOffset++];\n }\n }\n return result;\n }\n\n public getNumDataCodewords(): number /*int*/ {\n return this.numDataCodewords;\n }\n\n public getCodewords(): Uint8Array {\n return this.codewords;\n }\n\n}\n","/*\n * Copyright 2007 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*namespace com.google.zxing.qrcode.decoder {*/\n\nimport DecodeHintType from '../../DecodeHintType';\nimport BitSource from '../../common/BitSource';\nimport CharacterSetECI from '../../common/CharacterSetECI';\nimport DecoderResult from '../../common/DecoderResult';\nimport StringUtils from '../../common/StringUtils';\nimport Version from './Version';\nimport ErrorCorrectionLevel from './ErrorCorrectionLevel';\nimport Mode from './Mode';\n\nimport StringBuilder from '../../util/StringBuilder';\nimport StringEncoding from '../../util/StringEncoding';\nimport FormatException from '../../FormatException';\n\n/*import java.io.UnsupportedEncodingException;*/\n/*import java.util.ArrayList;*/\n/*import java.util.Collection;*/\n/*import java.util.List;*/\n/*import java.util.Map;*/\n\n/**\n *

QR Codes can encode text as bits in one of several modes, and can use multiple modes\n * in one QR Code. This class decodes the bits back into text.

\n *\n *

See ISO 18004:2006, 6.4.3 - 6.4.7

\n *\n * @author Sean Owen\n */\nexport default class DecodedBitStreamParser {\n\n /**\n * See ISO 18004:2006, 6.4.4 Table 5\n */\n private static ALPHANUMERIC_CHARS =\n '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:';\n private static GB2312_SUBSET = 1;\n\n public static decode(bytes: Uint8Array,\n version: Version,\n ecLevel: ErrorCorrectionLevel,\n hints: Map): DecoderResult /*throws FormatException*/ {\n const bits = new BitSource(bytes);\n let result = new StringBuilder();\n const byteSegments = new Array(); // 1\n // TYPESCRIPTPORT: I do not use constructor with size 1 as in original Java means capacity and the array length is checked below\n let symbolSequence = -1;\n let parityData = -1;\n\n try {\n let currentCharacterSetECI: CharacterSetECI = null;\n let fc1InEffect: boolean = false;\n let mode: Mode;\n do {\n // While still another segment to read...\n if (bits.available() < 4) {\n // OK, assume we're done. Really, a TERMINATOR mode should have been recorded here\n mode = Mode.TERMINATOR;\n } else {\n const modeBits = bits.readBits(4);\n mode = Mode.forBits(modeBits); // mode is encoded by 4 bits\n }\n switch (mode) {\n case Mode.TERMINATOR:\n break;\n case Mode.FNC1_FIRST_POSITION:\n case Mode.FNC1_SECOND_POSITION:\n // We do little with FNC1 except alter the parsed result a bit according to the spec\n fc1InEffect = true;\n break;\n case Mode.STRUCTURED_APPEND:\n if (bits.available() < 16) {\n throw new FormatException();\n }\n // sequence number and parity is added later to the result metadata\n // Read next 8 bits (symbol sequence #) and 8 bits (data: parity), then continue\n symbolSequence = bits.readBits(8);\n parityData = bits.readBits(8);\n break;\n case Mode.ECI:\n // Count doesn't apply to ECI\n const value = DecodedBitStreamParser.parseECIValue(bits);\n currentCharacterSetECI = CharacterSetECI.getCharacterSetECIByValue(value);\n if (currentCharacterSetECI === null) {\n throw new FormatException();\n }\n break;\n case Mode.HANZI:\n // First handle Hanzi mode which does not start with character count\n // Chinese mode contains a sub set indicator right after mode indicator\n const subset = bits.readBits(4);\n const countHanzi = bits.readBits(mode.getCharacterCountBits(version));\n if (subset === DecodedBitStreamParser.GB2312_SUBSET) {\n DecodedBitStreamParser.decodeHanziSegment(bits, result, countHanzi);\n }\n break;\n default:\n // \"Normal\" QR code modes:\n // How many characters will follow, encoded in this mode?\n const count = bits.readBits(mode.getCharacterCountBits(version));\n switch (mode) {\n case Mode.NUMERIC:\n DecodedBitStreamParser.decodeNumericSegment(bits, result, count);\n break;\n case Mode.ALPHANUMERIC:\n DecodedBitStreamParser.decodeAlphanumericSegment(bits, result, count, fc1InEffect);\n break;\n case Mode.BYTE:\n DecodedBitStreamParser.decodeByteSegment(bits, result, count, currentCharacterSetECI, byteSegments, hints);\n break;\n case Mode.KANJI:\n DecodedBitStreamParser.decodeKanjiSegment(bits, result, count);\n break;\n default:\n throw new FormatException();\n }\n break;\n }\n } while (mode !== Mode.TERMINATOR);\n } catch (iae/*: IllegalArgumentException*/) {\n // from readBits() calls\n throw new FormatException();\n }\n\n return new DecoderResult(bytes,\n result.toString(),\n byteSegments.length === 0 ? null : byteSegments,\n ecLevel === null ? null : ecLevel.toString(),\n symbolSequence,\n parityData);\n }\n\n /**\n * See specification GBT 18284-2000\n */\n private static decodeHanziSegment(bits: BitSource,\n result: StringBuilder,\n count: number /*int*/): void /*throws FormatException*/ {\n // Don't crash trying to read more bits than we have available.\n if (count * 13 > bits.available()) {\n throw new FormatException();\n }\n\n // Each character will require 2 bytes. Read the characters as 2-byte pairs\n // and decode as GB2312 afterwards\n const buffer = new Uint8Array(2 * count);\n let offset = 0;\n while (count > 0) {\n // Each 13 bits encodes a 2-byte character\n const twoBytes = bits.readBits(13);\n let assembledTwoBytes = (((twoBytes / 0x060) << 8) & 0xFFFFFFFF) | (twoBytes % 0x060);\n if (assembledTwoBytes < 0x003BF) {\n // In the 0xA1A1 to 0xAAFE range\n assembledTwoBytes += 0x0A1A1;\n } else {\n // In the 0xB0A1 to 0xFAFE range\n assembledTwoBytes += 0x0A6A1;\n }\n buffer[offset] = /*(byte) */((assembledTwoBytes >> 8) & 0xFF);\n buffer[offset + 1] = /*(byte) */(assembledTwoBytes & 0xFF);\n offset += 2;\n count--;\n }\n\n try {\n result.append(StringEncoding.decode(buffer, StringUtils.GB2312));\n // TYPESCRIPTPORT: TODO: implement GB2312 decode. StringView from MDN could be a starting point\n } catch (ignored/*: UnsupportedEncodingException*/) {\n throw new FormatException(ignored);\n }\n }\n\n private static decodeKanjiSegment(bits: BitSource,\n result: StringBuilder,\n count: number /*int*/): void /*throws FormatException*/ {\n // Don't crash trying to read more bits than we have available.\n if (count * 13 > bits.available()) {\n throw new FormatException();\n }\n\n // Each character will require 2 bytes. Read the characters as 2-byte pairs\n // and decode as Shift_JIS afterwards\n const buffer = new Uint8Array(2 * count);\n let offset = 0;\n while (count > 0) {\n // Each 13 bits encodes a 2-byte character\n const twoBytes = bits.readBits(13);\n let assembledTwoBytes = (((twoBytes / 0x0C0) << 8) & 0xFFFFFFFF) | (twoBytes % 0x0C0);\n if (assembledTwoBytes < 0x01F00) {\n // In the 0x8140 to 0x9FFC range\n assembledTwoBytes += 0x08140;\n } else {\n // In the 0xE040 to 0xEBBF range\n assembledTwoBytes += 0x0C140;\n }\n buffer[offset] = /*(byte) */(assembledTwoBytes >> 8);\n buffer[offset + 1] = /*(byte) */assembledTwoBytes;\n offset += 2;\n count--;\n }\n // Shift_JIS may not be supported in some environments:\n try {\n result.append(StringEncoding.decode(buffer, StringUtils.SHIFT_JIS));\n // TYPESCRIPTPORT: TODO: implement SHIFT_JIS decode. StringView from MDN could be a starting point\n } catch (ignored/*: UnsupportedEncodingException*/) {\n throw new FormatException(ignored);\n }\n }\n\n private static decodeByteSegment(bits: BitSource,\n result: StringBuilder,\n count: number /*int*/,\n currentCharacterSetECI: CharacterSetECI,\n byteSegments: Uint8Array[],\n hints: Map): void /*throws FormatException*/ {\n // Don't crash trying to read more bits than we have available.\n if (8 * count > bits.available()) {\n throw new FormatException();\n }\n\n const readBytes = new Uint8Array(count);\n for (let i = 0; i < count; i++) {\n readBytes[i] = /*(byte) */bits.readBits(8);\n }\n let encoding: string;\n if (currentCharacterSetECI === null) {\n // The spec isn't clear on this mode; see\n // section 6.4.5: t does not say which encoding to assuming\n // upon decoding. I have seen ISO-8859-1 used as well as\n // Shift_JIS -- without anything like an ECI designator to\n // give a hint.\n encoding = StringUtils.guessEncoding(readBytes, hints);\n } else {\n encoding = currentCharacterSetECI.getName();\n }\n try {\n result.append(StringEncoding.decode(readBytes, encoding));\n } catch (ignored/*: UnsupportedEncodingException*/) {\n throw new FormatException(ignored);\n }\n byteSegments.push(readBytes);\n }\n\n private static toAlphaNumericChar(value: number /*int*/): string /*throws FormatException*/ {\n if (value >= DecodedBitStreamParser.ALPHANUMERIC_CHARS.length) {\n throw new FormatException();\n }\n return DecodedBitStreamParser.ALPHANUMERIC_CHARS[value];\n }\n\n private static decodeAlphanumericSegment(bits: BitSource,\n result: StringBuilder,\n count: number /*int*/,\n fc1InEffect: boolean): void /*throws FormatException*/ {\n // Read two characters at a time\n const start = result.length();\n while (count > 1) {\n if (bits.available() < 11) {\n throw new FormatException();\n }\n const nextTwoCharsBits = bits.readBits(11);\n result.append(DecodedBitStreamParser.toAlphaNumericChar(Math.floor(nextTwoCharsBits / 45)));\n result.append(DecodedBitStreamParser.toAlphaNumericChar(nextTwoCharsBits % 45));\n count -= 2;\n }\n if (count === 1) {\n // special case: one character left\n if (bits.available() < 6) {\n throw new FormatException();\n }\n result.append(DecodedBitStreamParser.toAlphaNumericChar(bits.readBits(6)));\n }\n // See section 6.4.8.1, 6.4.8.2\n if (fc1InEffect) {\n // We need to massage the result a bit if in an FNC1 mode:\n for (let i = start; i < result.length(); i++) {\n if (result.charAt(i) === '%') {\n if (i < result.length() - 1 && result.charAt(i + 1) === '%') {\n // %% is rendered as %\n result.deleteCharAt(i + 1);\n } else {\n // In alpha mode, % should be converted to FNC1 separator 0x1D\n result.setCharAt(i, String.fromCharCode(0x1D));\n }\n }\n }\n }\n }\n\n private static decodeNumericSegment(bits: BitSource,\n result: StringBuilder,\n count: number /*int*/): void /*throws FormatException*/ {\n // Read three digits at a time\n while (count >= 3) {\n // Each 10 bits encodes three digits\n if (bits.available() < 10) {\n throw new FormatException();\n }\n const threeDigitsBits = bits.readBits(10);\n if (threeDigitsBits >= 1000) {\n throw new FormatException();\n }\n result.append(DecodedBitStreamParser.toAlphaNumericChar(Math.floor(threeDigitsBits / 100)));\n result.append(DecodedBitStreamParser.toAlphaNumericChar(Math.floor(threeDigitsBits / 10) % 10));\n result.append(DecodedBitStreamParser.toAlphaNumericChar(threeDigitsBits % 10));\n count -= 3;\n }\n if (count === 2) {\n // Two digits left over to read, encoded in 7 bits\n if (bits.available() < 7) {\n throw new FormatException();\n }\n const twoDigitsBits = bits.readBits(7);\n if (twoDigitsBits >= 100) {\n throw new FormatException();\n }\n result.append(DecodedBitStreamParser.toAlphaNumericChar(Math.floor(twoDigitsBits / 10)));\n result.append(DecodedBitStreamParser.toAlphaNumericChar(twoDigitsBits % 10));\n } else if (count === 1) {\n // One digit left over to read\n if (bits.available() < 4) {\n throw new FormatException();\n }\n const digitBits = bits.readBits(4);\n if (digitBits >= 10) {\n throw new FormatException();\n }\n result.append(DecodedBitStreamParser.toAlphaNumericChar(digitBits));\n }\n }\n\n private static parseECIValue(bits: BitSource): number /*int*/ /*throws FormatException*/ {\n const firstByte = bits.readBits(8);\n if ((firstByte & 0x80) === 0) {\n // just one byte\n return firstByte & 0x7F;\n }\n if ((firstByte & 0xC0) === 0x80) {\n // two bytes\n const secondByte = bits.readBits(8);\n return (((firstByte & 0x3F) << 8) & 0xFFFFFFFF) | secondByte;\n }\n if ((firstByte & 0xE0) === 0xC0) {\n // three bytes\n const secondThirdBytes = bits.readBits(16);\n return (((firstByte & 0x1F) << 16) & 0xFFFFFFFF) | secondThirdBytes;\n }\n throw new FormatException();\n }\n\n}\n\nfunction Uint8ArrayToString(a: Uint8Array): string {\n const CHUNK_SZ = 0x8000;\n const c = new StringBuilder();\n for (let i = 0, length = a.length; i < length; i += CHUNK_SZ) {\n c.append(String.fromCharCode.apply(null, a.subarray(i, i + CHUNK_SZ)));\n }\n return c.toString();\n}\n","/*\n * Copyright 2007 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*namespace com.google.zxing.qrcode.detector {*/\n\nimport DecodeHintType from '../../DecodeHintType';\nimport ResultPoint from '../../ResultPoint';\nimport ResultPointCallback from '../../ResultPointCallback';\nimport BitMatrix from '../../common/BitMatrix';\nimport DetectorResult from '../../common/DetectorResult';\nimport GridSampler from '../../common/GridSampler';\nimport GridSamplerInstance from '../../common/GridSamplerInstance';\nimport PerspectiveTransform from '../../common/PerspectiveTransform';\nimport MathUtils from '../../common/detector/MathUtils';\nimport Version from '../decoder/Version';\nimport FinderPatternFinder from './FinderPatternFinder';\nimport FinderPatternInfo from './FinderPatternInfo';\nimport FinderPattern from './FinderPattern';\n\nimport AlignmentPattern from './AlignmentPattern';\nimport AlignmentPatternFinder from './AlignmentPatternFinder';\nimport NotFoundException from '../../NotFoundException';\n\n/*import java.util.Map;*/\n\n/**\n *

Encapsulates logic that can detect a QR Code in an image, even if the QR Code\n * is rotated or skewed, or partially obscured.

\n *\n * @author Sean Owen\n */\nexport default class Detector {\n\n private resultPointCallback: ResultPointCallback;\n\n public constructor(private image: BitMatrix) { }\n\n protected getImage(): BitMatrix {\n return this.image;\n }\n\n protected getResultPointCallback(): ResultPointCallback {\n return this.resultPointCallback;\n }\n\n /**\n *

Detects a QR Code in an image.

\n *\n * @return {@link DetectorResult} encapsulating results of detecting a QR Code\n * @throws NotFoundException if QR Code cannot be found\n * @throws FormatException if a QR Code cannot be decoded\n */\n // public detect(): DetectorResult /*throws NotFoundException, FormatException*/ {\n // return detect(null)\n // }\n\n /**\n *

Detects a QR Code in an image.

\n *\n * @param hints optional hints to detector\n * @return {@link DetectorResult} encapsulating results of detecting a QR Code\n * @throws NotFoundException if QR Code cannot be found\n * @throws FormatException if a QR Code cannot be decoded\n */\n public detect(hints: Map): DetectorResult /*throws NotFoundException, FormatException*/ {\n\n this.resultPointCallback = (hints === null || hints === undefined) ? null :\n /*(ResultPointCallback) */hints.get(DecodeHintType.NEED_RESULT_POINT_CALLBACK);\n\n const finder = new FinderPatternFinder(this.image, this.resultPointCallback);\n const info = finder.find(hints);\n\n return this.processFinderPatternInfo(info);\n }\n\n protected processFinderPatternInfo(info: FinderPatternInfo): DetectorResult {\n\n const topLeft: FinderPattern = info.getTopLeft();\n const topRight: FinderPattern = info.getTopRight();\n const bottomLeft: FinderPattern = info.getBottomLeft();\n\n const moduleSize: number /*float*/ = this.calculateModuleSize(topLeft, topRight, bottomLeft);\n if (moduleSize < 1.0) {\n throw new NotFoundException('No pattern found in proccess finder.');\n }\n const dimension = Detector.computeDimension(topLeft, topRight, bottomLeft, moduleSize);\n const provisionalVersion: Version = Version.getProvisionalVersionForDimension(dimension);\n const modulesBetweenFPCenters = provisionalVersion.getDimensionForVersion() - 7;\n\n let alignmentPattern: AlignmentPattern = null;\n // Anything above version 1 has an alignment pattern\n if (provisionalVersion.getAlignmentPatternCenters().length > 0) {\n\n // Guess where a \"bottom right\" finder pattern would have been\n const bottomRightX: number /*float*/ = topRight.getX() - topLeft.getX() + bottomLeft.getX();\n const bottomRightY: number /*float*/ = topRight.getY() - topLeft.getY() + bottomLeft.getY();\n\n // Estimate that alignment pattern is closer by 3 modules\n // from \"bottom right\" to known top left location\n const correctionToTopLeft: number /*float*/ = 1.0 - 3.0 / modulesBetweenFPCenters;\n const estAlignmentX = /*(int) */Math.floor(topLeft.getX() + correctionToTopLeft * (bottomRightX - topLeft.getX()));\n const estAlignmentY = /*(int) */Math.floor(topLeft.getY() + correctionToTopLeft * (bottomRightY - topLeft.getY()));\n\n // Kind of arbitrary -- expand search radius before giving up\n for (let i = 4; i <= 16; i <<= 1) {\n try {\n alignmentPattern = this.findAlignmentInRegion(moduleSize,\n estAlignmentX,\n estAlignmentY,\n i);\n break;\n } catch (re/*NotFoundException*/) {\n if (!(re instanceof NotFoundException)) {\n throw re;\n }\n // try next round\n }\n }\n // If we didn't find alignment pattern... well try anyway without it\n }\n\n const transform: PerspectiveTransform =\n Detector.createTransform(topLeft, topRight, bottomLeft, alignmentPattern, dimension);\n\n const bits: BitMatrix = Detector.sampleGrid(this.image, transform, dimension);\n\n let points: ResultPoint[];\n if (alignmentPattern === null) {\n points = [bottomLeft, topLeft, topRight];\n } else {\n points = [bottomLeft, topLeft, topRight, alignmentPattern];\n }\n return new DetectorResult(bits, points);\n }\n\n private static createTransform(topLeft: ResultPoint,\n topRight: ResultPoint,\n bottomLeft: ResultPoint,\n alignmentPattern: ResultPoint,\n dimension: number /*int*/): PerspectiveTransform {\n const dimMinusThree: number /*float*/ = dimension - 3.5;\n let bottomRightX: number; /*float*/\n let bottomRightY: number; /*float*/\n let sourceBottomRightX: number; /*float*/\n let sourceBottomRightY: number; /*float*/\n if (alignmentPattern !== null) {\n bottomRightX = alignmentPattern.getX();\n bottomRightY = alignmentPattern.getY();\n sourceBottomRightX = dimMinusThree - 3.0;\n sourceBottomRightY = sourceBottomRightX;\n } else {\n // Don't have an alignment pattern, just make up the bottom-right point\n bottomRightX = (topRight.getX() - topLeft.getX()) + bottomLeft.getX();\n bottomRightY = (topRight.getY() - topLeft.getY()) + bottomLeft.getY();\n sourceBottomRightX = dimMinusThree;\n sourceBottomRightY = dimMinusThree;\n }\n\n return PerspectiveTransform.quadrilateralToQuadrilateral(\n 3.5,\n 3.5,\n dimMinusThree,\n 3.5,\n sourceBottomRightX,\n sourceBottomRightY,\n 3.5,\n dimMinusThree,\n topLeft.getX(),\n topLeft.getY(),\n topRight.getX(),\n topRight.getY(),\n bottomRightX,\n bottomRightY,\n bottomLeft.getX(),\n bottomLeft.getY());\n }\n\n private static sampleGrid(image: BitMatrix,\n transform: PerspectiveTransform,\n dimension: number /*int*/): BitMatrix /*throws NotFoundException*/ {\n\n const sampler = GridSamplerInstance.getInstance();\n return sampler.sampleGridWithTransform(image, dimension, dimension, transform);\n }\n\n /**\n *

Computes the dimension (number of modules on a size) of the QR Code based on the position\n * of the finder patterns and estimated module size.

\n */\n private static computeDimension(topLeft: ResultPoint,\n topRight: ResultPoint,\n bottomLeft: ResultPoint,\n moduleSize: number/*float*/): number /*int*/ /*throws NotFoundException*/ {\n const tltrCentersDimension = MathUtils.round(ResultPoint.distance(topLeft, topRight) / moduleSize);\n const tlblCentersDimension = MathUtils.round(ResultPoint.distance(topLeft, bottomLeft) / moduleSize);\n let dimension = Math.floor((tltrCentersDimension + tlblCentersDimension) / 2) + 7;\n switch (dimension & 0x03) { // mod 4\n case 0:\n dimension++;\n break;\n // 1? do nothing\n case 2:\n dimension--;\n break;\n case 3:\n throw new NotFoundException('Dimensions could be not found.');\n }\n return dimension;\n }\n\n /**\n *

Computes an average estimated module size based on estimated derived from the positions\n * of the three finder patterns.

\n *\n * @param topLeft detected top-left finder pattern center\n * @param topRight detected top-right finder pattern center\n * @param bottomLeft detected bottom-left finder pattern center\n * @return estimated module size\n */\n protected calculateModuleSize(topLeft: ResultPoint,\n topRight: ResultPoint,\n bottomLeft: ResultPoint): number/*float*/ {\n // Take the average\n return (this.calculateModuleSizeOneWay(topLeft, topRight) +\n this.calculateModuleSizeOneWay(topLeft, bottomLeft)) / 2.0;\n }\n\n /**\n *

Estimates module size based on two finder patterns -- it uses\n * {@link #sizeOfBlackWhiteBlackRunBothWays(int, int, int, int)} to figure the\n * width of each, measuring along the axis between their centers.

\n */\n private calculateModuleSizeOneWay(pattern: ResultPoint, otherPattern: ResultPoint): number/*float*/ {\n const moduleSizeEst1: number /*float*/ = this.sizeOfBlackWhiteBlackRunBothWays(/*(int) */Math.floor(pattern.getX()),\n /*(int) */Math.floor(pattern.getY()),\n /*(int) */Math.floor(otherPattern.getX()),\n /*(int) */Math.floor(otherPattern.getY()));\n const moduleSizeEst2: number /*float*/ = this.sizeOfBlackWhiteBlackRunBothWays(/*(int) */Math.floor(otherPattern.getX()),\n /*(int) */Math.floor(otherPattern.getY()),\n /*(int) */Math.floor(pattern.getX()),\n /*(int) */Math.floor(pattern.getY()));\n if (isNaN(moduleSizeEst1)) {\n return moduleSizeEst2 / 7.0;\n }\n if (isNaN(moduleSizeEst2)) {\n return moduleSizeEst1 / 7.0;\n }\n // Average them, and divide by 7 since we've counted the width of 3 black modules,\n // and 1 white and 1 black module on either side. Ergo, divide sum by 14.\n return (moduleSizeEst1 + moduleSizeEst2) / 14.0;\n }\n\n /**\n * See {@link #sizeOfBlackWhiteBlackRun(int, int, int, int)}; computes the total width of\n * a finder pattern by looking for a black-white-black run from the center in the direction\n * of another point (another finder pattern center), and in the opposite direction too.\n */\n private sizeOfBlackWhiteBlackRunBothWays(fromX: number /*int*/, fromY: number /*int*/, toX: number /*int*/, toY: number /*int*/): number/*float*/ {\n\n let result: number /*float*/ = this.sizeOfBlackWhiteBlackRun(fromX, fromY, toX, toY);\n\n // Now count other way -- don't run off image though of course\n let scale: number /*float*/ = 1.0;\n let otherToX = fromX - (toX - fromX);\n if (otherToX < 0) {\n scale = fromX / /*(float) */(fromX - otherToX);\n otherToX = 0;\n } else if (otherToX >= this.image.getWidth()) {\n scale = (this.image.getWidth() - 1 - fromX) / /*(float) */(otherToX - fromX);\n otherToX = this.image.getWidth() - 1;\n }\n let otherToY = /*(int) */Math.floor(fromY - (toY - fromY) * scale);\n\n scale = 1.0;\n if (otherToY < 0) {\n scale = fromY / /*(float) */(fromY - otherToY);\n otherToY = 0;\n } else if (otherToY >= this.image.getHeight()) {\n scale = (this.image.getHeight() - 1 - fromY) / /*(float) */(otherToY - fromY);\n otherToY = this.image.getHeight() - 1;\n }\n otherToX = /*(int) */Math.floor(fromX + (otherToX - fromX) * scale);\n\n result += this.sizeOfBlackWhiteBlackRun(fromX, fromY, otherToX, otherToY);\n\n // Middle pixel is double-counted this way; subtract 1\n return result - 1.0;\n }\n\n /**\n *

This method traces a line from a point in the image, in the direction towards another point.\n * It begins in a black region, and keeps going until it finds white, then black, then white again.\n * It reports the distance from the start to this point.

\n *\n *

This is used when figuring out how wide a finder pattern is, when the finder pattern\n * may be skewed or rotated.

\n */\n private sizeOfBlackWhiteBlackRun(fromX: number /*int*/, fromY: number /*int*/, toX: number /*int*/, toY: number /*int*/): number/*float*/ {\n // Mild variant of Bresenham's algorithm\n // see http://en.wikipedia.org/wiki/Bresenham's_line_algorithm\n const steep: boolean = Math.abs(toY - fromY) > Math.abs(toX - fromX);\n if (steep) {\n let temp = fromX;\n fromX = fromY;\n fromY = temp;\n temp = toX;\n toX = toY;\n toY = temp;\n }\n\n const dx = Math.abs(toX - fromX);\n const dy = Math.abs(toY - fromY);\n let error = -dx / 2;\n const xstep = fromX < toX ? 1 : -1;\n const ystep = fromY < toY ? 1 : -1;\n\n // In black pixels, looking for white, first or second time.\n let state = 0;\n // Loop up until x == toX, but not beyond\n const xLimit = toX + xstep;\n for (let x = fromX, y = fromY; x !== xLimit; x += xstep) {\n const realX = steep ? y : x;\n const realY = steep ? x : y;\n\n // Does current pixel mean we have moved white to black or vice versa?\n // Scanning black in state 0,2 and white in state 1, so if we find the wrong\n // color, advance to next state or end if we are in state 2 already\n if ((state === 1) === this.image.get(realX, realY)) {\n if (state === 2) {\n return MathUtils.distance(x, y, fromX, fromY);\n }\n state++;\n }\n\n error += dy;\n if (error > 0) {\n if (y === toY) {\n break;\n }\n y += ystep;\n error -= dx;\n }\n }\n // Found black-white-black; give the benefit of the doubt that the next pixel outside the image\n // is \"white\" so this last point at (toX+xStep,toY) is the right ending. This is really a\n // small approximation; (toX+xStep,toY+yStep) might be really correct. Ignore this.\n if (state === 2) {\n return MathUtils.distance(toX + xstep, toY, fromX, fromY);\n }\n // else we didn't find even black-white-black; no estimate is really possible\n return NaN;\n }\n\n /**\n *

Attempts to locate an alignment pattern in a limited region of the image, which is\n * guessed to contain it. This method uses {@link AlignmentPattern}.

\n *\n * @param overallEstModuleSize estimated module size so far\n * @param estAlignmentX x coordinate of center of area probably containing alignment pattern\n * @param estAlignmentY y coordinate of above\n * @param allowanceFactor number of pixels in all directions to search from the center\n * @return {@link AlignmentPattern} if found, or null otherwise\n * @throws NotFoundException if an unexpected error occurs during detection\n */\n protected findAlignmentInRegion(overallEstModuleSize: number/*float*/,\n estAlignmentX: number /*int*/,\n estAlignmentY: number /*int*/,\n allowanceFactor: number/*float*/): AlignmentPattern {\n // Look for an alignment pattern (3 modules in size) around where it\n // should be\n const allowance = /*(int) */Math.floor(allowanceFactor * overallEstModuleSize);\n const alignmentAreaLeftX = Math.max(0, estAlignmentX - allowance);\n const alignmentAreaRightX = Math.min(this.image.getWidth() - 1, estAlignmentX + allowance);\n if (alignmentAreaRightX - alignmentAreaLeftX < overallEstModuleSize * 3) {\n throw new NotFoundException('Alignment top exceeds estimated module size.');\n }\n\n const alignmentAreaTopY = Math.max(0, estAlignmentY - allowance);\n const alignmentAreaBottomY = Math.min(this.image.getHeight() - 1, estAlignmentY + allowance);\n if (alignmentAreaBottomY - alignmentAreaTopY < overallEstModuleSize * 3) {\n throw new NotFoundException('Alignment bottom exceeds estimated module size.');\n }\n\n const alignmentFinder = new AlignmentPatternFinder(\n this.image,\n alignmentAreaLeftX,\n alignmentAreaTopY,\n alignmentAreaRightX - alignmentAreaLeftX,\n alignmentAreaBottomY - alignmentAreaTopY,\n overallEstModuleSize,\n this.resultPointCallback\n );\n\n return alignmentFinder.find();\n }\n\n}\n","/*\n * Copyright 2007 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*namespace com.google.zxing.qrcode.detector {*/\n\nimport DecodeHintType from '../../DecodeHintType';\nimport ResultPoint from '../../ResultPoint';\nimport ResultPointCallback from '../../ResultPointCallback';\nimport BitMatrix from '../../common/BitMatrix';\nimport FinderPattern from './FinderPattern';\nimport FinderPatternInfo from './FinderPatternInfo';\n\nimport NotFoundException from '../../NotFoundException';\n\nimport { float } from '../../../customTypings';\n\n/*import java.io.Serializable;*/\n/*import java.util.ArrayList;*/\n/*import java.util.Collections;*/\n/*import java.util.Comparator;*/\n/*import java.util.List;*/\n/*import java.util.Map;*/\n\n/**\n *

This class attempts to find finder patterns in a QR Code. Finder patterns are the square\n * markers at three corners of a QR Code.

\n *\n *

This class is thread-safe but not reentrant. Each thread must allocate its own object.\n *\n * @author Sean Owen\n */\nexport default class FinderPatternFinder {\n\n private static CENTER_QUORUM = 2;\n protected static MIN_SKIP = 3; // 1 pixel/module times 3 modules/center\n protected static MAX_MODULES = 57; // support up to version 10 for mobile clients\n\n private possibleCenters: FinderPattern[];\n private hasSkipped: boolean;\n private crossCheckStateCount: Int32Array;\n\n /**\n *

Creates a finder that will search the image for three finder patterns.

\n *\n * @param image image to search\n */\n // public constructor(image: BitMatrix) {\n // this(image, null)\n // }\n\n public constructor(private image: BitMatrix, private resultPointCallback: ResultPointCallback) {\n this.possibleCenters = [];\n this.crossCheckStateCount = new Int32Array(5);\n this.resultPointCallback = resultPointCallback;\n }\n\n protected getImage(): BitMatrix {\n return this.image;\n }\n\n protected getPossibleCenters(): FinderPattern[] {\n return this.possibleCenters;\n }\n\n public find(hints: Map): FinderPatternInfo /*throws NotFoundException */ {\n const tryHarder: boolean = (hints !== null && hints !== undefined) && undefined !== hints.get(DecodeHintType.TRY_HARDER);\n const pureBarcode: boolean = (hints !== null && hints !== undefined) && undefined !== hints.get(DecodeHintType.PURE_BARCODE);\n const image = this.image;\n const maxI = image.getHeight();\n const maxJ = image.getWidth();\n // We are looking for black/white/black/white/black modules in\n // 1:1:3:1:1 ratio; this tracks the number of such modules seen so far\n\n // Let's assume that the maximum version QR Code we support takes up 1/4 the height of the\n // image, and then account for the center being 3 modules in size. This gives the smallest\n // number of pixels the center could be, so skip this often. When trying harder, look for all\n // QR versions regardless of how dense they are.\n let iSkip = Math.floor((3 * maxI) / (4 * FinderPatternFinder.MAX_MODULES));\n if (iSkip < FinderPatternFinder.MIN_SKIP || tryHarder) {\n iSkip = FinderPatternFinder.MIN_SKIP;\n }\n\n let done: boolean = false;\n const stateCount = new Int32Array(5);\n for (let i = iSkip - 1; i < maxI && !done; i += iSkip) {\n // Get a row of black/white values\n stateCount[0] = 0;\n stateCount[1] = 0;\n stateCount[2] = 0;\n stateCount[3] = 0;\n stateCount[4] = 0;\n let currentState = 0;\n for (let j = 0; j < maxJ; j++) {\n if (image.get(j, i)) {\n // Black pixel\n if ((currentState & 1) === 1) { // Counting white pixels\n currentState++;\n }\n stateCount[currentState]++;\n } else { // White pixel\n if ((currentState & 1) === 0) { // Counting black pixels\n if (currentState === 4) { // A winner?\n if (FinderPatternFinder.foundPatternCross(stateCount)) { // Yes\n const confirmed: boolean = this.handlePossibleCenter(stateCount, i, j, pureBarcode);\n if (confirmed === true) {\n // Start examining every other line. Checking each line turned out to be too\n // expensive and didn't improve performance.\n iSkip = 2;\n if (this.hasSkipped === true) {\n done = this.haveMultiplyConfirmedCenters();\n } else {\n const rowSkip = this.findRowSkip();\n if (rowSkip > stateCount[2]) {\n // Skip rows between row of lower confirmed center\n // and top of presumed third confirmed center\n // but back up a bit to get a full chance of detecting\n // it, entire width of center of finder pattern\n\n // Skip by rowSkip, but back off by stateCount[2] (size of last center\n // of pattern we saw) to be conservative, and also back off by iSkip which\n // is about to be re-added\n i += rowSkip - stateCount[2] - iSkip;\n j = maxJ - 1;\n }\n }\n } else {\n stateCount[0] = stateCount[2];\n stateCount[1] = stateCount[3];\n stateCount[2] = stateCount[4];\n stateCount[3] = 1;\n stateCount[4] = 0;\n currentState = 3;\n continue;\n }\n // Clear state to start looking again\n currentState = 0;\n stateCount[0] = 0;\n stateCount[1] = 0;\n stateCount[2] = 0;\n stateCount[3] = 0;\n stateCount[4] = 0;\n } else { // No, shift counts back by two\n stateCount[0] = stateCount[2];\n stateCount[1] = stateCount[3];\n stateCount[2] = stateCount[4];\n stateCount[3] = 1;\n stateCount[4] = 0;\n currentState = 3;\n }\n } else {\n stateCount[++currentState]++;\n }\n } else { // Counting white pixels\n stateCount[currentState]++;\n }\n }\n }\n if (FinderPatternFinder.foundPatternCross(stateCount)) {\n const confirmed: boolean = this.handlePossibleCenter(stateCount, i, maxJ, pureBarcode);\n if (confirmed === true) {\n iSkip = stateCount[0];\n if (this.hasSkipped) {\n // Found a third one\n done = this.haveMultiplyConfirmedCenters();\n }\n }\n }\n }\n\n const patternInfo: FinderPattern[] = this.selectBestPatterns();\n ResultPoint.orderBestPatterns(patternInfo);\n\n return new FinderPatternInfo(patternInfo);\n }\n\n /**\n * Given a count of black/white/black/white/black pixels just seen and an end position,\n * figures the location of the center of this run.\n */\n private static centerFromEnd(stateCount: Int32Array, end: number /*int*/): number/*float*/ {\n return (end - stateCount[4] - stateCount[3]) - stateCount[2] / 2.0;\n }\n\n /**\n * @param stateCount count of black/white/black/white/black pixels just read\n * @return true iff the proportions of the counts is close enough to the 1/1/3/1/1 ratios\n * used by finder patterns to be considered a match\n */\n protected static foundPatternCross(stateCount: Int32Array): boolean {\n let totalModuleSize = 0;\n for (let i = 0; i < 5; i++) {\n const count = stateCount[i];\n if (count === 0) {\n return false;\n }\n totalModuleSize += count;\n }\n if (totalModuleSize < 7) {\n return false;\n }\n const moduleSize: number /*float*/ = totalModuleSize / 7.0;\n const maxVariance: number /*float*/ = moduleSize / 2.0;\n // Allow less than 50% variance from 1-1-3-1-1 proportions\n return Math.abs(moduleSize - stateCount[0]) < maxVariance &&\n Math.abs(moduleSize - stateCount[1]) < maxVariance &&\n Math.abs(3.0 * moduleSize - stateCount[2]) < 3 * maxVariance &&\n Math.abs(moduleSize - stateCount[3]) < maxVariance &&\n Math.abs(moduleSize - stateCount[4]) < maxVariance;\n }\n\n private getCrossCheckStateCount(): Int32Array {\n const crossCheckStateCount = this.crossCheckStateCount;\n crossCheckStateCount[0] = 0;\n crossCheckStateCount[1] = 0;\n crossCheckStateCount[2] = 0;\n crossCheckStateCount[3] = 0;\n crossCheckStateCount[4] = 0;\n return crossCheckStateCount;\n }\n\n /**\n * After a vertical and horizontal scan finds a potential finder pattern, this method\n * \"cross-cross-cross-checks\" by scanning down diagonally through the center of the possible\n * finder pattern to see if the same proportion is detected.\n *\n * @param startI row where a finder pattern was detected\n * @param centerJ center of the section that appears to cross a finder pattern\n * @param maxCount maximum reasonable number of modules that should be\n * observed in any reading state, based on the results of the horizontal scan\n * @param originalStateCountTotal The original state count total.\n * @return true if proportions are withing expected limits\n */\n private crossCheckDiagonal(startI: number /*int*/, centerJ: number /*int*/, maxCount: number /*int*/, originalStateCountTotal: number /*int*/): boolean {\n const stateCount: Int32Array = this.getCrossCheckStateCount();\n\n // Start counting up, left from center finding black center mass\n let i = 0;\n const image = this.image;\n while (startI >= i && centerJ >= i && image.get(centerJ - i, startI - i)) {\n stateCount[2]++;\n i++;\n }\n\n if (startI < i || centerJ < i) {\n return false;\n }\n\n // Continue up, left finding white space\n while (startI >= i && centerJ >= i && !image.get(centerJ - i, startI - i) &&\n stateCount[1] <= maxCount) {\n stateCount[1]++;\n i++;\n }\n\n // If already too many modules in this state or ran off the edge:\n if (startI < i || centerJ < i || stateCount[1] > maxCount) {\n return false;\n }\n\n // Continue up, left finding black border\n while (startI >= i && centerJ >= i && image.get(centerJ - i, startI - i) &&\n stateCount[0] <= maxCount) {\n stateCount[0]++;\n i++;\n }\n if (stateCount[0] > maxCount) {\n return false;\n }\n\n const maxI = image.getHeight();\n const maxJ = image.getWidth();\n\n // Now also count down, right from center\n i = 1;\n while (startI + i < maxI && centerJ + i < maxJ && image.get(centerJ + i, startI + i)) {\n stateCount[2]++;\n i++;\n }\n\n // Ran off the edge?\n if (startI + i >= maxI || centerJ + i >= maxJ) {\n return false;\n }\n\n while (startI + i < maxI && centerJ + i < maxJ && !image.get(centerJ + i, startI + i) &&\n stateCount[3] < maxCount) {\n stateCount[3]++;\n i++;\n }\n\n if (startI + i >= maxI || centerJ + i >= maxJ || stateCount[3] >= maxCount) {\n return false;\n }\n\n while (startI + i < maxI && centerJ + i < maxJ && image.get(centerJ + i, startI + i) &&\n stateCount[4] < maxCount) {\n stateCount[4]++;\n i++;\n }\n\n if (stateCount[4] >= maxCount) {\n return false;\n }\n\n // If we found a finder-pattern-like section, but its size is more than 100% different than\n // the original, assume it's a false positive\n const stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2] + stateCount[3] + stateCount[4];\n return Math.abs(stateCountTotal - originalStateCountTotal) < 2 * originalStateCountTotal &&\n FinderPatternFinder.foundPatternCross(stateCount);\n }\n\n /**\n *

After a horizontal scan finds a potential finder pattern, this method\n * \"cross-checks\" by scanning down vertically through the center of the possible\n * finder pattern to see if the same proportion is detected.

\n *\n * @param startI row where a finder pattern was detected\n * @param centerJ center of the section that appears to cross a finder pattern\n * @param maxCount maximum reasonable number of modules that should be\n * observed in any reading state, based on the results of the horizontal scan\n * @return vertical center of finder pattern, or {@link Float#NaN} if not found\n */\n private crossCheckVertical(startI: number /*int*/, centerJ: number /*int*/, maxCount: number /*int*/,\n originalStateCountTotal: number /*int*/): number/*float*/ {\n const image: BitMatrix = this.image;\n\n const maxI = image.getHeight();\n const stateCount: Int32Array = this.getCrossCheckStateCount();\n\n // Start counting up from center\n let i = startI;\n while (i >= 0 && image.get(centerJ, i)) {\n stateCount[2]++;\n i--;\n }\n if (i < 0) {\n return NaN;\n }\n while (i >= 0 && !image.get(centerJ, i) && stateCount[1] <= maxCount) {\n stateCount[1]++;\n i--;\n }\n // If already too many modules in this state or ran off the edge:\n if (i < 0 || stateCount[1] > maxCount) {\n return NaN;\n }\n while (i >= 0 && image.get(centerJ, i) && stateCount[0] <= maxCount) {\n stateCount[0]++;\n i--;\n }\n if (stateCount[0] > maxCount) {\n return NaN;\n }\n\n // Now also count down from center\n i = startI + 1;\n while (i < maxI && image.get(centerJ, i)) {\n stateCount[2]++;\n i++;\n }\n if (i === maxI) {\n return NaN;\n }\n while (i < maxI && !image.get(centerJ, i) && stateCount[3] < maxCount) {\n stateCount[3]++;\n i++;\n }\n if (i === maxI || stateCount[3] >= maxCount) {\n return NaN;\n }\n while (i < maxI && image.get(centerJ, i) && stateCount[4] < maxCount) {\n stateCount[4]++;\n i++;\n }\n if (stateCount[4] >= maxCount) {\n return NaN;\n }\n\n // If we found a finder-pattern-like section, but its size is more than 40% different than\n // the original, assume it's a false positive\n const stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2] + stateCount[3] +\n stateCount[4];\n if (5 * Math.abs(stateCountTotal - originalStateCountTotal) >= 2 * originalStateCountTotal) {\n return NaN;\n }\n\n return FinderPatternFinder.foundPatternCross(stateCount) ? FinderPatternFinder.centerFromEnd(stateCount, i) : NaN;\n }\n\n /**\n *

Like {@link #crossCheckVertical(int, int, int, int)}, and in fact is basically identical,\n * except it reads horizontally instead of vertically. This is used to cross-cross\n * check a vertical cross check and locate the real center of the alignment pattern.

\n */\n private crossCheckHorizontal(startJ: number /*int*/, centerI: number /*int*/, maxCount: number /*int*/,\n originalStateCountTotal: number /*int*/): number/*float*/ {\n const image: BitMatrix = this.image;\n\n const maxJ = image.getWidth();\n const stateCount: Int32Array = this.getCrossCheckStateCount();\n\n let j = startJ;\n while (j >= 0 && image.get(j, centerI)) {\n stateCount[2]++;\n j--;\n }\n if (j < 0) {\n return NaN;\n }\n while (j >= 0 && !image.get(j, centerI) && stateCount[1] <= maxCount) {\n stateCount[1]++;\n j--;\n }\n if (j < 0 || stateCount[1] > maxCount) {\n return NaN;\n }\n while (j >= 0 && image.get(j, centerI) && stateCount[0] <= maxCount) {\n stateCount[0]++;\n j--;\n }\n if (stateCount[0] > maxCount) {\n return NaN;\n }\n\n j = startJ + 1;\n while (j < maxJ && image.get(j, centerI)) {\n stateCount[2]++;\n j++;\n }\n if (j === maxJ) {\n return NaN;\n }\n while (j < maxJ && !image.get(j, centerI) && stateCount[3] < maxCount) {\n stateCount[3]++;\n j++;\n }\n if (j === maxJ || stateCount[3] >= maxCount) {\n return NaN;\n }\n while (j < maxJ && image.get(j, centerI) && stateCount[4] < maxCount) {\n stateCount[4]++;\n j++;\n }\n if (stateCount[4] >= maxCount) {\n return NaN;\n }\n\n // If we found a finder-pattern-like section, but its size is significantly different than\n // the original, assume it's a false positive\n const stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2] + stateCount[3] +\n stateCount[4];\n if (5 * Math.abs(stateCountTotal - originalStateCountTotal) >= originalStateCountTotal) {\n return NaN;\n }\n\n return FinderPatternFinder.foundPatternCross(stateCount) ? FinderPatternFinder.centerFromEnd(stateCount, j) : NaN;\n }\n\n /**\n *

This is called when a horizontal scan finds a possible alignment pattern. It will\n * cross check with a vertical scan, and if successful, will, ah, cross-cross-check\n * with another horizontal scan. This is needed primarily to locate the real horizontal\n * center of the pattern in cases of extreme skew.\n * And then we cross-cross-cross check with another diagonal scan.

\n *\n *

If that succeeds the finder pattern location is added to a list that tracks\n * the number of times each location has been nearly-matched as a finder pattern.\n * Each additional find is more evidence that the location is in fact a finder\n * pattern center\n *\n * @param stateCount reading state module counts from horizontal scan\n * @param i row where finder pattern may be found\n * @param j end of possible finder pattern in row\n * @param pureBarcode true if in \"pure barcode\" mode\n * @return true if a finder pattern candidate was found this time\n */\n protected handlePossibleCenter(stateCount: Int32Array, i: number /*int*/, j: number /*int*/, pureBarcode: boolean): boolean {\n const stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2] + stateCount[3] +\n stateCount[4];\n let centerJ: number /*float*/ = FinderPatternFinder.centerFromEnd(stateCount, j);\n let centerI: number /*float*/ = this.crossCheckVertical(i, /*(int) */Math.floor(centerJ), stateCount[2], stateCountTotal);\n if (!isNaN(centerI)) {\n // Re-cross check\n centerJ = this.crossCheckHorizontal(/*(int) */Math.floor(centerJ), /*(int) */Math.floor(centerI), stateCount[2], stateCountTotal);\n if (!isNaN(centerJ) &&\n (!pureBarcode || this.crossCheckDiagonal(/*(int) */Math.floor(centerI), /*(int) */Math.floor(centerJ), stateCount[2], stateCountTotal))) {\n const estimatedModuleSize: number /*float*/ = stateCountTotal / 7.0;\n let found: boolean = false;\n const possibleCenters = this.possibleCenters;\n for (let index = 0, length = possibleCenters.length; index < length; index++) {\n const center: FinderPattern = possibleCenters[index];\n // Look for about the same center and module size:\n if (center.aboutEquals(estimatedModuleSize, centerI, centerJ)) {\n possibleCenters[index] = center.combineEstimate(centerI, centerJ, estimatedModuleSize);\n found = true;\n break;\n }\n }\n if (!found) {\n const point: FinderPattern = new FinderPattern(centerJ, centerI, estimatedModuleSize);\n possibleCenters.push(point);\n if (this.resultPointCallback !== null && this.resultPointCallback !== undefined) {\n this.resultPointCallback.foundPossibleResultPoint(point);\n }\n }\n return true;\n }\n }\n return false;\n }\n\n /**\n * @return number of rows we could safely skip during scanning, based on the first\n * two finder patterns that have been located. In some cases their position will\n * allow us to infer that the third pattern must lie below a certain point farther\n * down in the image.\n */\n private findRowSkip(): number /*int*/ {\n const max = this.possibleCenters.length;\n if (max <= 1) {\n return 0;\n }\n let firstConfirmedCenter: ResultPoint = null;\n for (const center of this.possibleCenters) {\n if (center.getCount() >= FinderPatternFinder.CENTER_QUORUM) {\n if (firstConfirmedCenter == null) {\n firstConfirmedCenter = center;\n } else {\n // We have two confirmed centers\n // How far down can we skip before resuming looking for the next\n // pattern? In the worst case, only the difference between the\n // difference in the x / y coordinates of the two centers.\n // This is the case where you find top left last.\n this.hasSkipped = true;\n return /*(int) */Math.floor((Math.abs(firstConfirmedCenter.getX() - center.getX()) -\n Math.abs(firstConfirmedCenter.getY() - center.getY())) / 2);\n }\n }\n }\n return 0;\n }\n\n /**\n * @return true iff we have found at least 3 finder patterns that have been detected\n * at least {@link #CENTER_QUORUM} times each, and, the estimated module size of the\n * candidates is \"pretty similar\"\n */\n private haveMultiplyConfirmedCenters(): boolean {\n let confirmedCount = 0;\n let totalModuleSize: number /*float*/ = 0.0;\n const max = this.possibleCenters.length;\n for (const pattern of this.possibleCenters) {\n if (pattern.getCount() >= FinderPatternFinder.CENTER_QUORUM) {\n confirmedCount++;\n totalModuleSize += pattern.getEstimatedModuleSize();\n }\n }\n if (confirmedCount < 3) {\n return false;\n }\n // OK, we have at least 3 confirmed centers, but, it's possible that one is a \"false positive\"\n // and that we need to keep looking. We detect this by asking if the estimated module sizes\n // vary too much. We arbitrarily say that when the total deviation from average exceeds\n // 5% of the total module size estimates, it's too much.\n const average: number /*float*/ = totalModuleSize / max;\n let totalDeviation: number /*float*/ = 0.0;\n for (const pattern of this.possibleCenters) {\n totalDeviation += Math.abs(pattern.getEstimatedModuleSize() - average);\n }\n return totalDeviation <= 0.05 * totalModuleSize;\n }\n\n /**\n * @return the 3 best {@link FinderPattern}s from our list of candidates. The \"best\" are\n * those that have been detected at least {@link #CENTER_QUORUM} times, and whose module\n * size differs from the average among those patterns the least\n * @throws NotFoundException if 3 such finder patterns do not exist\n */\n private selectBestPatterns(): FinderPattern[] /*throws NotFoundException */ {\n\n const startSize = this.possibleCenters.length;\n if (startSize < 3) {\n // Couldn't find enough finder patterns\n throw new NotFoundException();\n }\n\n const possibleCenters = this.possibleCenters;\n\n let average: float;\n // Filter outlier possibilities whose module size is too different\n if (startSize > 3) {\n // But we can only afford to do so if we have at least 4 possibilities to choose from\n let totalModuleSize: float = 0.0;\n let square: float = 0.0;\n for (const center of this.possibleCenters) {\n const size: float = center.getEstimatedModuleSize();\n totalModuleSize += size;\n square += size * size;\n }\n average = totalModuleSize / startSize;\n let stdDev: float = Math.sqrt(square / startSize - average * average);\n\n possibleCenters.sort(\n /**\n *

Orders by furthest from average

\n */\n // FurthestFromAverageComparator implements Comparator\n (center1: FinderPattern, center2: FinderPattern) => {\n const dA: float = Math.abs(center2.getEstimatedModuleSize() - average);\n const dB: float = Math.abs(center1.getEstimatedModuleSize() - average);\n return dA < dB ? -1 : dA > dB ? 1 : 0;\n });\n\n const limit: float = Math.max(0.2 * average, stdDev);\n\n for (let i = 0; i < possibleCenters.length && possibleCenters.length > 3; i++) {\n const pattern: FinderPattern = possibleCenters[i];\n if (Math.abs(pattern.getEstimatedModuleSize() - average) > limit) {\n possibleCenters.splice(i, 1);\n i--;\n }\n }\n }\n\n if (possibleCenters.length > 3) {\n // Throw away all but those first size candidate points we found.\n\n let totalModuleSize: float = 0.0;\n for (const possibleCenter of possibleCenters) {\n totalModuleSize += possibleCenter.getEstimatedModuleSize();\n }\n\n average = totalModuleSize / possibleCenters.length;\n\n possibleCenters.sort(\n /**\n *

Orders by {@link FinderPattern#getCount()}, descending.

\n */\n // CenterComparator implements Comparator\n (center1: FinderPattern, center2: FinderPattern) => {\n if (center2.getCount() === center1.getCount()) {\n const dA: float = Math.abs(center2.getEstimatedModuleSize() - average);\n const dB: float = Math.abs(center1.getEstimatedModuleSize() - average);\n return dA < dB ? 1 : dA > dB ? -1 : 0;\n } else {\n return center2.getCount() - center1.getCount();\n }\n });\n\n possibleCenters.splice(3); // this is not realy necessary as we only return first 3 anyway\n }\n\n return [\n possibleCenters[0],\n possibleCenters[1],\n possibleCenters[2]\n ];\n }\n}\n","/*\n * Copyright 2007 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*namespace com.google.zxing.qrcode.detector {*/\n\nimport ResultPoint from '../../ResultPoint';\n\n/**\n *

Encapsulates a finder pattern, which are the three square patterns found in\n * the corners of QR Codes. It also encapsulates a count of similar finder patterns,\n * as a convenience to the finder's bookkeeping.

\n *\n * @author Sean Owen\n */\nexport default class FinderPattern extends ResultPoint {\n\n // FinderPattern(posX: number/*float*/, posY: number/*float*/, estimatedModuleSize: number/*float*/) {\n // this(posX, posY, estimatedModuleSize, 1)\n // }\n\n public constructor(posX: number/*float*/, posY: number/*float*/, private estimatedModuleSize: number/*float*/, private count?: number /*int*/) {\n super(posX, posY);\n if (undefined === count) {\n this.count = 1;\n }\n }\n\n public getEstimatedModuleSize(): number/*float*/ {\n return this.estimatedModuleSize;\n }\n\n public getCount(): number /*int*/ {\n return this.count;\n }\n\n /*\n void incrementCount() {\n this.count++\n }\n */\n\n /**\n *

Determines if this finder pattern \"about equals\" a finder pattern at the stated\n * position and size -- meaning, it is at nearly the same center with nearly the same size.

\n */\n public aboutEquals(moduleSize: number/*float*/, i: number/*float*/, j: number/*float*/): boolean {\n if (Math.abs(i - this.getY()) <= moduleSize && Math.abs(j - this.getX()) <= moduleSize) {\n const moduleSizeDiff: number /*float*/ = Math.abs(moduleSize - this.estimatedModuleSize);\n return moduleSizeDiff <= 1.0 || moduleSizeDiff <= this.estimatedModuleSize;\n }\n return false;\n }\n\n /**\n * Combines this object's current estimate of a finder pattern position and module size\n * with a new estimate. It returns a new {@code FinderPattern} containing a weighted average\n * based on count.\n */\n public combineEstimate(i: number/*float*/, j: number/*float*/, newModuleSize: number/*float*/): FinderPattern {\n const combinedCount = this.count + 1;\n const combinedX: number /*float*/ = (this.count * this.getX() + j) / combinedCount;\n const combinedY: number /*float*/ = (this.count * this.getY() + i) / combinedCount;\n const combinedModuleSize: number /*float*/ = (this.count * this.estimatedModuleSize + newModuleSize) / combinedCount;\n return new FinderPattern(combinedX, combinedY, combinedModuleSize, combinedCount);\n }\n\n}\n","/*\n * Copyright 2007 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*namespace com.google.zxing.qrcode.detector {*/\n\nimport FinderPattern from './FinderPattern';\n\n/**\n *

Encapsulates information about finder patterns in an image, including the location of\n * the three finder patterns, and their estimated module size.

\n *\n * @author Sean Owen\n */\nexport default class FinderPatternInfo {\n\n private bottomLeft: FinderPattern;\n private topLeft: FinderPattern;\n private topRight: FinderPattern;\n\n public constructor(patternCenters: FinderPattern[]) {\n this.bottomLeft = patternCenters[0];\n this.topLeft = patternCenters[1];\n this.topRight = patternCenters[2];\n }\n\n public getBottomLeft(): FinderPattern {\n return this.bottomLeft;\n }\n\n public getTopLeft(): FinderPattern {\n return this.topLeft;\n }\n\n public getTopRight(): FinderPattern {\n return this.topRight;\n }\n\n}\n","/*\n * Copyright 2007 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*namespace com.google.zxing.qrcode.detector {*/\n\nimport ResultPointCallback from '../../ResultPointCallback';\nimport BitMatrix from '../../common/BitMatrix';\nimport AlignmentPattern from './AlignmentPattern';\n\nimport NotFoundException from '../../NotFoundException';\n\n/*import java.util.ArrayList;*/\n/*import java.util.List;*/\n\n/**\n *

This class attempts to find alignment patterns in a QR Code. Alignment patterns look like finder\n * patterns but are smaller and appear at regular intervals throughout the image.

\n *\n *

At the moment this only looks for the bottom-right alignment pattern.

\n *\n *

This is mostly a simplified copy of {@link FinderPatternFinder}. It is copied,\n * pasted and stripped down here for maximum performance but does unfortunately duplicate\n * some code.

\n *\n *

This class is thread-safe but not reentrant. Each thread must allocate its own object.

\n *\n * @author Sean Owen\n */\nexport default class AlignmentPatternFinder {\n\n private possibleCenters: AlignmentPattern[];\n private crossCheckStateCount: Int32Array;\n\n /**\n *

Creates a finder that will look in a portion of the whole image.

\n *\n * @param image image to search\n * @param startX left column from which to start searching\n * @param startY top row from which to start searching\n * @param width width of region to search\n * @param height height of region to search\n * @param moduleSize estimated module size so far\n */\n public constructor(private image: BitMatrix,\n private startX: number /*int*/,\n private startY: number /*int*/,\n private width: number /*int*/,\n private height: number /*int*/,\n private moduleSize: number/*float*/,\n private resultPointCallback: ResultPointCallback) {\n this.possibleCenters = []; // new Array(5))\n // TYPESCRIPTPORT: array initialization without size as the length is checked below\n this.crossCheckStateCount = new Int32Array(3);\n }\n\n /**\n *

This method attempts to find the bottom-right alignment pattern in the image. It is a bit messy since\n * it's pretty performance-critical and so is written to be fast foremost.

\n *\n * @return {@link AlignmentPattern} if found\n * @throws NotFoundException if not found\n */\n public find(): AlignmentPattern /*throws NotFoundException*/ {\n const startX = this.startX;\n const height = this.height;\n const width = this.width;\n const maxJ = startX + width;\n const middleI = this.startY + (height / 2);\n // We are looking for black/white/black modules in 1:1:1 ratio\n // this tracks the number of black/white/black modules seen so far\n const stateCount = new Int32Array(3);\n const image = this.image;\n for (let iGen = 0; iGen < height; iGen++) {\n // Search from middle outwards\n const i = middleI + ((iGen & 0x01) === 0 ? Math.floor((iGen + 1) / 2) : -Math.floor((iGen + 1) / 2));\n\n stateCount[0] = 0;\n stateCount[1] = 0;\n stateCount[2] = 0;\n\n let j = startX;\n // Burn off leading white pixels before anything else; if we start in the middle of\n // a white run, it doesn't make sense to count its length, since we don't know if the\n // white run continued to the left of the start point\n while (j < maxJ && !image.get(j, i)) {\n j++;\n }\n let currentState = 0;\n while (j < maxJ) {\n if (image.get(j, i)) {\n // Black pixel\n if (currentState === 1) { // Counting black pixels\n stateCount[1]++;\n } else { // Counting white pixels\n if (currentState === 2) { // A winner?\n if (this.foundPatternCross(stateCount)) { // Yes\n const confirmed = this.handlePossibleCenter(stateCount, i, j);\n if (confirmed !== null) {\n return confirmed;\n }\n }\n stateCount[0] = stateCount[2];\n stateCount[1] = 1;\n stateCount[2] = 0;\n currentState = 1;\n } else {\n stateCount[++currentState]++;\n }\n }\n } else { // White pixel\n if (currentState === 1) { // Counting black pixels\n currentState++;\n }\n stateCount[currentState]++;\n }\n j++;\n }\n if (this.foundPatternCross(stateCount)) {\n const confirmed = this.handlePossibleCenter(stateCount, i, maxJ);\n if (confirmed !== null) {\n return confirmed;\n }\n }\n\n }\n\n // Hmm, nothing we saw was observed and confirmed twice. If we had\n // any guess at all, return it.\n if (this.possibleCenters.length !== 0) {\n return this.possibleCenters[0];\n }\n\n throw new NotFoundException();\n }\n\n /**\n * Given a count of black/white/black pixels just seen and an end position,\n * figures the location of the center of this black/white/black run.\n */\n private static centerFromEnd(stateCount: Int32Array, end: number /*int*/): number/*float*/ {\n return (end - stateCount[2]) - stateCount[1] / 2.0;\n }\n\n /**\n * @param stateCount count of black/white/black pixels just read\n * @return true iff the proportions of the counts is close enough to the 1/1/1 ratios\n * used by alignment patterns to be considered a match\n */\n private foundPatternCross(stateCount: Int32Array): boolean {\n const moduleSize: number /*float*/ = this.moduleSize;\n const maxVariance: number /*float*/ = moduleSize / 2.0;\n for (let i = 0; i < 3; i++) {\n if (Math.abs(moduleSize - stateCount[i]) >= maxVariance) {\n return false;\n }\n }\n return true;\n }\n\n /**\n *

After a horizontal scan finds a potential alignment pattern, this method\n * \"cross-checks\" by scanning down vertically through the center of the possible\n * alignment pattern to see if the same proportion is detected.

\n *\n * @param startI row where an alignment pattern was detected\n * @param centerJ center of the section that appears to cross an alignment pattern\n * @param maxCount maximum reasonable number of modules that should be\n * observed in any reading state, based on the results of the horizontal scan\n * @return vertical center of alignment pattern, or {@link Float#NaN} if not found\n */\n private crossCheckVertical(startI: number /*int*/, centerJ: number /*int*/, maxCount: number /*int*/,\n originalStateCountTotal: number /*int*/): number/*float*/ {\n const image = this.image;\n\n const maxI = image.getHeight();\n const stateCount = this.crossCheckStateCount;\n stateCount[0] = 0;\n stateCount[1] = 0;\n stateCount[2] = 0;\n\n // Start counting up from center\n let i = startI;\n while (i >= 0 && image.get(centerJ, i) && stateCount[1] <= maxCount) {\n stateCount[1]++;\n i--;\n }\n // If already too many modules in this state or ran off the edge:\n if (i < 0 || stateCount[1] > maxCount) {\n return NaN;\n }\n while (i >= 0 && !image.get(centerJ, i) && stateCount[0] <= maxCount) {\n stateCount[0]++;\n i--;\n }\n if (stateCount[0] > maxCount) {\n return NaN;\n }\n\n // Now also count down from center\n i = startI + 1;\n while (i < maxI && image.get(centerJ, i) && stateCount[1] <= maxCount) {\n stateCount[1]++;\n i++;\n }\n if (i === maxI || stateCount[1] > maxCount) {\n return NaN;\n }\n while (i < maxI && !image.get(centerJ, i) && stateCount[2] <= maxCount) {\n stateCount[2]++;\n i++;\n }\n if (stateCount[2] > maxCount) {\n return NaN;\n }\n\n const stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2];\n if (5 * Math.abs(stateCountTotal - originalStateCountTotal) >= 2 * originalStateCountTotal) {\n return NaN;\n }\n\n return this.foundPatternCross(stateCount) ? AlignmentPatternFinder.centerFromEnd(stateCount, i) : NaN;\n }\n\n /**\n *

This is called when a horizontal scan finds a possible alignment pattern. It will\n * cross check with a vertical scan, and if successful, will see if this pattern had been\n * found on a previous horizontal scan. If so, we consider it confirmed and conclude we have\n * found the alignment pattern.

\n *\n * @param stateCount reading state module counts from horizontal scan\n * @param i row where alignment pattern may be found\n * @param j end of possible alignment pattern in row\n * @return {@link AlignmentPattern} if we have found the same pattern twice, or null if not\n */\n private handlePossibleCenter(stateCount: Int32Array, i: number /*int*/, j: number /*int*/): AlignmentPattern {\n const stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2];\n const centerJ: number /*float*/ = AlignmentPatternFinder.centerFromEnd(stateCount, j);\n const centerI: number /*float*/ = this.crossCheckVertical(i, /*(int) */centerJ, 2 * stateCount[1], stateCountTotal);\n if (!isNaN(centerI)) {\n const estimatedModuleSize: number /*float*/ = (stateCount[0] + stateCount[1] + stateCount[2]) / 3.0;\n for (const center of this.possibleCenters) {\n // Look for about the same center and module size:\n if (center.aboutEquals(estimatedModuleSize, centerI, centerJ)) {\n return center.combineEstimate(centerI, centerJ, estimatedModuleSize);\n }\n }\n // Hadn't found this before; save it\n const point = new AlignmentPattern(centerJ, centerI, estimatedModuleSize);\n this.possibleCenters.push(point);\n if (this.resultPointCallback !== null && this.resultPointCallback !== undefined) {\n this.resultPointCallback.foundPossibleResultPoint(point);\n }\n }\n return null;\n }\n\n}\n","/*\n * Copyright 2007 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*namespace com.google.zxing.qrcode.detector {*/\n\nimport ResultPoint from '../../ResultPoint';\n\n/**\n *

Encapsulates an alignment pattern, which are the smaller square patterns found in\n * all but the simplest QR Codes.

\n *\n * @author Sean Owen\n */\nexport default class AlignmentPattern extends ResultPoint {\n\n public constructor(posX: number/*float*/, posY: number/*float*/, private estimatedModuleSize: number/*float*/) {\n super(posX, posY);\n }\n\n /**\n *

Determines if this alignment pattern \"about equals\" an alignment pattern at the stated\n * position and size -- meaning, it is at nearly the same center with nearly the same size.

\n */\n public aboutEquals(moduleSize: number/*float*/, i: number/*float*/, j: number/*float*/): boolean {\n if (Math.abs(i - this.getY()) <= moduleSize && Math.abs(j - this.getX()) <= moduleSize) {\n const moduleSizeDiff: number /*float*/ = Math.abs(moduleSize - this.estimatedModuleSize);\n return moduleSizeDiff <= 1.0 || moduleSizeDiff <= this.estimatedModuleSize;\n }\n return false;\n }\n\n /**\n * Combines this object's current estimate of a finder pattern position and module size\n * with a new estimate. It returns a new {@code FinderPattern} containing an average of the two.\n */\n public combineEstimate(i: number/*float*/, j: number/*float*/, newModuleSize: number/*float*/): AlignmentPattern {\n const combinedX: number /*float*/ = (this.getX() + j) / 2.0;\n const combinedY: number /*float*/ = (this.getY() + i) / 2.0;\n const combinedModuleSize: number /*float*/ = (this.estimatedModuleSize + newModuleSize) / 2.0;\n return new AlignmentPattern(combinedX, combinedY, combinedModuleSize);\n }\n\n}\n","/*\n* Copyright 2009 ZXing authors\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n// package com.google.zxing.pdf417.detector;\n\n// import com.google.zxing.BinaryBitmap;\nimport BinaryBitmap from '../../BinaryBitmap';\n// import com.google.zxing.DecodeHintType;\nimport DecodeHintType from '../../DecodeHintType';\n// import com.google.zxing.NotFoundException;\n// import com.google.zxing.ResultPoint;\nimport ResultPoint from '../../ResultPoint';\n// import com.google.zxing.common.BitMatrix;\nimport BitMatrix from '../../common/BitMatrix';\nimport System from '../../util/System';\nimport Arrays from '../../util/Arrays';\nimport PDF417DetectorResult from './PDF417DetectorResult';\n\nimport { float, int } from '../../../customTypings';\n\n// import java.util.ArrayList;\n// import java.util.Arrays;\n// import java.util.List;\n// import java.util.Map;\n\n/**\n *

Encapsulates logic that can detect a PDF417 Code in an image, even if the\n * PDF417 Code is rotated or skewed, or partially obscured.

\n *\n * @author SITA Lab (kevin.osullivan@sita.aero)\n * @author dswitkin@google.com (Daniel Switkin)\n * @author Guenther Grau\n */\nexport default /*public*/ /*final*/ class Detector {\n\n private static /*final*/ INDEXES_START_PATTERN = Int32Array.from([0, 4, 1, 5]);\n private static /*final*/ INDEXES_STOP_PATTERN = Int32Array.from([6, 2, 7, 3]);\n private static /*final*/ MAX_AVG_VARIANCE: float = /*0.42f*/ 0.42;\n private static /*final*/ MAX_INDIVIDUAL_VARIANCE: float = /*0.8f*/ 0.8;\n\n // B S B S B S B S Bar/Space pattern\n // 11111111 0 1 0 1 0 1 000\n private static /*final*/ START_PATTERN = Int32Array.from([8, 1, 1, 1, 1, 1, 1, 3]);\n // 1111111 0 1 000 1 0 1 00 1\n private static /*final*/ STOP_PATTERN = Int32Array.from([7, 1, 1, 3, 1, 1, 1, 2, 1]);\n private static /*final*/ MAX_PIXEL_DRIFT: /*int*/ number = 3;\n private static /*final*/ MAX_PATTERN_DRIFT: /*int*/ number = 5;\n // if we set the value too low, then we don't detect the correct height of the bar if the start patterns are damaged.\n // if we set the value too high, then we might detect the start pattern from a neighbor barcode.\n private static /*final*/ SKIPPED_ROW_COUNT_MAX: /*int*/ number = 25;\n // A PDF471 barcode should have at least 3 rows, with each row being >= 3 times the module width. Therefore it should be at least\n // 9 pixels tall. To be conservative, we use about half the size to ensure we don't miss it.\n private static /*final*/ ROW_STEP: /*int*/ number = 5;\n private static /*final*/ BARCODE_MIN_HEIGHT: /*int*/ number = 10;\n\n /**\n *

Detects a PDF417 Code in an image. Only checks 0 and 180 degree rotations.

\n *\n * @param image barcode image to decode\n * @param hints optional hints to detector\n * @param multiple if true, then the image is searched for multiple codes. If false, then at most one code will\n * be found and returned\n * @return {@link PDF417DetectorResult} encapsulating results of detecting a PDF417 code\n * @throws NotFoundException if no PDF417 Code can be found\n */\n public static detectMultiple( image: BinaryBitmap, hints: Map, multiple: boolean): PDF417DetectorResult {\n // TODO detection improvement, tryHarder could try several different luminance thresholds/blackpoints or even\n // different binarizers\n // boolean tryHarder = hints != null && hints.containsKey(DecodeHintType.TRY_HARDER);\n\n let bitMatrix = image.getBlackMatrix();\n\n let barcodeCoordinates = Detector.detect(multiple, bitMatrix);\n if (!barcodeCoordinates.length) {\n bitMatrix = bitMatrix.clone();\n bitMatrix.rotate180();\n barcodeCoordinates = Detector.detect(multiple, bitMatrix);\n }\n return new PDF417DetectorResult(bitMatrix, barcodeCoordinates);\n }\n\n /**\n * Detects PDF417 codes in an image. Only checks 0 degree rotation\n * @param multiple if true, then the image is searched for multiple codes. If false, then at most one code will\n * be found and returned\n * @param bitMatrix bit matrix to detect barcodes in\n * @return List of ResultPoint arrays containing the coordinates of found barcodes\n */\n private static detect( multiple: boolean, bitMatrix: BitMatrix): Array {\n const barcodeCoordinates = new Array();\n let row = 0;\n let column = 0;\n let foundBarcodeInRow = false;\n while (row < bitMatrix.getHeight()) {\n const vertices = Detector.findVertices(bitMatrix, row, column);\n\n if (vertices[0] == null && vertices[3] == null) {\n if (!foundBarcodeInRow) {\n // we didn't find any barcode so that's the end of searching\n break;\n }\n // we didn't find a barcode starting at the given column and row. Try again from the first column and slightly\n // below the lowest barcode we found so far.\n foundBarcodeInRow = false;\n column = 0;\n for (const barcodeCoordinate of barcodeCoordinates) {\n if (barcodeCoordinate[1] != null) {\n row = Math.trunc(Math.max(row, barcodeCoordinate[1].getY()));\n }\n if (barcodeCoordinate[3] != null) {\n row = Math.max(row, Math.trunc(barcodeCoordinate[3].getY()));\n }\n }\n row += Detector.ROW_STEP;\n continue;\n }\n foundBarcodeInRow = true;\n barcodeCoordinates.push(vertices);\n if (!multiple) {\n break;\n }\n // if we didn't find a right row indicator column, then continue the search for the next barcode after the\n // start pattern of the barcode just found.\n if (vertices[2] != null) {\n column = Math.trunc(vertices[2].getX());\n row = Math.trunc(vertices[2].getY());\n } else {\n column = Math.trunc(vertices[4].getX());\n row = Math.trunc(vertices[4].getY());\n }\n }\n return barcodeCoordinates;\n }\n\n /**\n * Locate the vertices and the codewords area of a black blob using the Start\n * and Stop patterns as locators.\n *\n * @param matrix the scanned barcode image.\n * @return an array containing the vertices:\n * vertices[0] x, y top left barcode\n * vertices[1] x, y bottom left barcode\n * vertices[2] x, y top right barcode\n * vertices[3] x, y bottom right barcode\n * vertices[4] x, y top left codeword area\n * vertices[5] x, y bottom left codeword area\n * vertices[6] x, y top right codeword area\n * vertices[7] x, y bottom right codeword area\n */\n private static findVertices( matrix: BitMatrix, startRow: /*int*/ number, startColumn: /*int*/ number): ResultPoint[] {\n const height = matrix.getHeight();\n const width = matrix.getWidth();\n\n // const result = new ResultPoint[8];\n const result = new Array(8);\n Detector.copyToResult(result, Detector.findRowsWithPattern(matrix, height, width, startRow, startColumn, Detector.START_PATTERN),\n Detector.INDEXES_START_PATTERN);\n\n if (result[4] != null) {\n startColumn = Math.trunc(result[4].getX());\n startRow = Math.trunc(result[4].getY());\n }\n Detector.copyToResult(result, Detector.findRowsWithPattern(matrix, height, width, startRow, startColumn, Detector.STOP_PATTERN),\n Detector.INDEXES_STOP_PATTERN);\n return result;\n }\n\n private static copyToResult(result: ResultPoint[], tmpResult: ResultPoint[], destinationIndexes: Int32Array): void {\n for (let i = 0; i < destinationIndexes.length; i++) {\n result[destinationIndexes[i]] = tmpResult[i];\n }\n }\n\n private static findRowsWithPattern( matrix: BitMatrix,\n height: /*int*/ number,\n width: /*int*/ number,\n startRow: /*int*/ number,\n startColumn: /*int*/ number,\n pattern: Int32Array): ResultPoint[] {\n // const result = new ResultPoint[4];\n const result = new Array(4);\n let found = false;\n const counters = new Int32Array(pattern.length);\n for (; startRow < height; startRow += Detector.ROW_STEP) {\n let loc = Detector.findGuardPattern(matrix, startColumn, startRow, width, false, pattern, counters);\n if (loc != null) {\n while (startRow > 0) {\n const previousRowLoc = Detector.findGuardPattern(matrix, startColumn, --startRow, width, false, pattern, counters);\n if (previousRowLoc != null) {\n loc = previousRowLoc;\n } else {\n startRow++;\n break;\n }\n }\n result[0] = new ResultPoint(loc[0], startRow);\n result[1] = new ResultPoint(loc[1], startRow);\n found = true;\n break;\n }\n }\n let stopRow = startRow + 1;\n // Last row of the current symbol that contains pattern\n if (found) {\n let skippedRowCount = 0;\n let previousRowLoc = Int32Array.from([ Math.trunc(result[0].getX()), Math.trunc(result[1].getX())]);\n for (; stopRow < height; stopRow++) {\n const loc = Detector.findGuardPattern(matrix, previousRowLoc[0], stopRow, width, false, pattern, counters);\n // a found pattern is only considered to belong to the same barcode if the start and end positions\n // don't differ too much. Pattern drift should be not bigger than two for consecutive rows. With\n // a higher number of skipped rows drift could be larger. To keep it simple for now, we allow a slightly\n // larger drift and don't check for skipped rows.\n if (loc != null &&\n Math.abs(previousRowLoc[0] - loc[0]) < Detector.MAX_PATTERN_DRIFT &&\n Math.abs(previousRowLoc[1] - loc[1]) < Detector.MAX_PATTERN_DRIFT) {\n previousRowLoc = loc;\n skippedRowCount = 0;\n } else {\n if (skippedRowCount > Detector.SKIPPED_ROW_COUNT_MAX) {\n break;\n } else {\n skippedRowCount++;\n }\n }\n }\n stopRow -= skippedRowCount + 1;\n result[2] = new ResultPoint(previousRowLoc[0], stopRow);\n result[3] = new ResultPoint(previousRowLoc[1], stopRow);\n }\n if (stopRow - startRow < Detector.BARCODE_MIN_HEIGHT) {\n Arrays.fill(result, null);\n }\n return result;\n }\n\n /**\n * @param matrix row of black/white values to search\n * @param column x position to start search\n * @param row y position to start search\n * @param width the number of pixels to search on this row\n * @param pattern pattern of counts of number of black and white pixels that are\n * being searched for as a pattern\n * @param counters array of counters, as long as pattern, to re-use\n * @return start/end horizontal offset of guard pattern, as an array of two ints.\n */\n private static findGuardPattern( matrix: BitMatrix,\n column: /*int*/ number,\n row: /*int*/ number,\n width: /*int*/ number,\n whiteFirst: boolean,\n pattern: Int32Array,\n counters: Int32Array): Int32Array {\n Arrays.fillWithin(counters, 0, counters.length, 0);\n let patternStart = column;\n let pixelDrift = 0;\n\n // if there are black pixels left of the current pixel shift to the left, but only for MAX_PIXEL_DRIFT pixels\n while (matrix.get(patternStart, row) && patternStart > 0 && pixelDrift++ < Detector.MAX_PIXEL_DRIFT) {\n patternStart--;\n }\n let x = patternStart;\n let counterPosition = 0;\n let patternLength = pattern.length;\n for (let isWhite = whiteFirst; x < width; x++) {\n let pixel = matrix.get(x, row);\n if (pixel !== isWhite) {\n counters[counterPosition]++;\n } else {\n if (counterPosition === patternLength - 1) {\n if (Detector.patternMatchVariance(counters, pattern, Detector.MAX_INDIVIDUAL_VARIANCE) < Detector.MAX_AVG_VARIANCE) {\n return new Int32Array([patternStart, x]);\n }\n patternStart += counters[0] + counters[1];\n System.arraycopy(counters, 2, counters, 0, counterPosition - 1);\n counters[counterPosition - 1] = 0;\n counters[counterPosition] = 0;\n counterPosition--;\n } else {\n counterPosition++;\n }\n counters[counterPosition] = 1;\n isWhite = !isWhite;\n }\n }\n if (counterPosition === patternLength - 1 &&\n Detector.patternMatchVariance(counters, pattern, Detector.MAX_INDIVIDUAL_VARIANCE) < Detector.MAX_AVG_VARIANCE) {\n return new Int32Array([patternStart, x - 1]);\n }\n return null;\n }\n\n /**\n * Determines how closely a set of observed counts of runs of black/white\n * values matches a given target pattern. This is reported as the ratio of\n * the total variance from the expected pattern proportions across all\n * pattern elements, to the length of the pattern.\n *\n * @param counters observed counters\n * @param pattern expected pattern\n * @param maxIndividualVariance The most any counter can differ before we give up\n * @return ratio of total variance between counters and pattern compared to total pattern size\n */\n private static patternMatchVariance( counters: Int32Array, pattern: Int32Array, maxIndividualVariance: float): float {\n let numCounters = counters.length;\n let total = 0;\n let patternLength = 0;\n for (let i = 0; i < numCounters; i++) {\n total += counters[i];\n patternLength += pattern[i];\n }\n if (total < patternLength) {\n // If we don't even have one pixel per unit of bar width, assume this\n // is too small to reliably match, so fail:\n return /*Float.POSITIVE_INFINITY*/ Infinity;\n }\n // We're going to fake floating-point math in integers. We just need to use more bits.\n // Scale up patternLength so that intermediate values below like scaledCounter will have\n // more \"significant digits\".\n let unitBarWidth = total / patternLength;\n maxIndividualVariance *= unitBarWidth;\n\n let totalVariance = 0.0;\n for (let x = 0; x < numCounters; x++) {\n let counter = counters[x];\n let scaledPattern = pattern[x] * unitBarWidth;\n let variance = counter > scaledPattern ? counter - scaledPattern : scaledPattern - counter;\n if (variance > maxIndividualVariance) {\n return /*Float.POSITIVE_INFINITY*/ Infinity;\n }\n totalVariance += variance;\n }\n return totalVariance / total;\n }\n}\n","/*\n* Copyright 2007 ZXing authors\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n// package com.google.zxing.pdf417.detector;\n\n// import com.google.zxing.ResultPoint;\nimport ResultPoint from '../../ResultPoint';\n// import com.google.zxing.common.BitMatrix;\nimport BitMatrix from '../../common/BitMatrix';\n\n// import java.util.List;\n\n/**\n * @author Guenther Grau\n */\nexport default /*public final*/ class PDF417DetectorResult {\n\n private /*final*/ bits: BitMatrix;\n private /*final*/ points: ResultPoint[][];\n\n constructor(bits: BitMatrix, points: ResultPoint[][]) {\n this.bits = bits;\n this.points = points;\n }\n\n public getBits(): BitMatrix {\n return this.bits;\n }\n\n public getPoints(): ResultPoint[][] {\n return this.points;\n }\n\n}\n","/*\n* Copyright 2013 ZXing authors\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n// package com.google.zxing.pdf417.decoder;\n\n// import com.google.zxing.ChecksumException;\nimport ChecksumException from '../../ChecksumException';\n// import com.google.zxing.FormatException;\nimport FormatException from '../../FormatException';\n// import com.google.zxing.NotFoundException;\nimport NotFoundException from '../../NotFoundException';\n// import com.google.zxing.ResultPoint;\nimport ResultPoint from '../../ResultPoint';\n// import com.google.zxing.common.BitMatrix;\nimport BitMatrix from '../../common/BitMatrix';\n// import com.google.zxing.common.DecoderResult;\nimport DecoderResult from '../../common/DecoderResult';\n// import com.google.zxing.common.detector.MathUtils;\nimport MathUtils from '../../common/detector/MathUtils';\n// import com.google.zxing.pdf417.PDF417Common;\nimport PDF417Common from '../PDF417Common';\n// import com.google.zxing.pdf417.decoder.ec.ErrorCorrection;\nimport ErrorCorrection from './ec/ErrorCorrection';\n\n// local\nimport BoundingBox from './BoundingBox';\nimport DetectionResultRowIndicatorColumn from './DetectionResultRowIndicatorColumn';\nimport DetectionResult from './DetectionResult';\nimport DetectionResultColumn from './DetectionResultColumn';\nimport Codeword from './Codeword';\nimport BarcodeMetadata from './BarcodeMetadata';\nimport BarcodeValue from './BarcodeValue';\nimport PDF417CodewordDecoder from './PDF417CodewordDecoder';\nimport DecodedBitStreamParser from './DecodedBitStreamParser';\n\n// utils\nimport Formatter from '../../util/Formatter';\nimport { int, List, Collection } from '../../../customTypings';\n\n// import java.util.ArrayList;\n// import java.util.Collection;\n// import java.util.Formatter;\n// import java.util.List;\n\n/**\n * @author Guenther Grau\n */\nexport default /*public final*/ class PDF417ScanningDecoder {\n\n /*final*/ static CODEWORD_SKEW_SIZE: int = 2;\n\n /*final*/ static MAX_ERRORS: int = 3;\n /*final*/ static MAX_EC_CODEWORDS: int = 512;\n /*final*/ static errorCorrection: ErrorCorrection = new ErrorCorrection();\n\n private constructor() {}\n\n /**\n * @TODO don't pass in minCodewordWidth and maxCodewordWidth, pass in barcode columns for start and stop pattern\n *\n * columns. That way width can be deducted from the pattern column.\n * This approach also allows to detect more details about the barcode, e.g. if a bar type (white or black) is wider\n * than it should be. This can happen if the scanner used a bad blackpoint.\n *\n * @param BitMatrix\n * @param image\n * @param ResultPoint\n * @param imageTopLeft\n * @param ResultPoint\n * @param imageBottomLeft\n * @param ResultPoint\n * @param imageTopRight\n * @param ResultPoint\n * @param imageBottomRight\n * @param int\n * @param minCodewordWidth\n * @param int\n * @param maxCodewordWidth\n *\n * @throws NotFoundException\n * @throws FormatException\n * @throws ChecksumException\n */\n public static decode(image: BitMatrix,\n imageTopLeft: ResultPoint,\n imageBottomLeft: ResultPoint,\n imageTopRight: ResultPoint,\n imageBottomRight: ResultPoint,\n minCodewordWidth: int,\n maxCodewordWidth: int): DecoderResult {\n let boundingBox: BoundingBox = new BoundingBox(image, imageTopLeft, imageBottomLeft, imageTopRight, imageBottomRight);\n let leftRowIndicatorColumn: DetectionResultRowIndicatorColumn = null;\n let rightRowIndicatorColumn: DetectionResultRowIndicatorColumn = null;\n let detectionResult: DetectionResult;\n for (let firstPass /*boolean*/ = true; ; firstPass = false) {\n if (imageTopLeft != null) {\n leftRowIndicatorColumn = PDF417ScanningDecoder.getRowIndicatorColumn(image, boundingBox, imageTopLeft, true, minCodewordWidth,\n maxCodewordWidth);\n }\n if (imageTopRight != null) {\n rightRowIndicatorColumn = PDF417ScanningDecoder.getRowIndicatorColumn(image, boundingBox, imageTopRight, false, minCodewordWidth,\n maxCodewordWidth);\n }\n detectionResult = PDF417ScanningDecoder.merge(leftRowIndicatorColumn, rightRowIndicatorColumn);\n if (detectionResult == null) {\n throw NotFoundException.getNotFoundInstance();\n }\n let resultBox: BoundingBox = detectionResult.getBoundingBox();\n if (firstPass && resultBox != null &&\n (resultBox.getMinY() < boundingBox.getMinY() || resultBox.getMaxY() > boundingBox.getMaxY())) {\n boundingBox = resultBox;\n } else {\n break;\n }\n }\n detectionResult.setBoundingBox(boundingBox);\n let maxBarcodeColumn: int = detectionResult.getBarcodeColumnCount() + 1;\n detectionResult.setDetectionResultColumn(0, leftRowIndicatorColumn);\n detectionResult.setDetectionResultColumn(maxBarcodeColumn, rightRowIndicatorColumn);\n\n let leftToRight: boolean = leftRowIndicatorColumn != null;\n for (let barcodeColumnCount /*int*/ = 1; barcodeColumnCount <= maxBarcodeColumn; barcodeColumnCount++) {\n let barcodeColumn: int = leftToRight ? barcodeColumnCount : maxBarcodeColumn - barcodeColumnCount;\n if (detectionResult.getDetectionResultColumn(barcodeColumn) !== /* null */ undefined) {\n // This will be the case for the opposite row indicator column, which doesn't need to be decoded again.\n continue;\n }\n let detectionResultColumn: DetectionResultColumn;\n if (barcodeColumn === 0 || barcodeColumn === maxBarcodeColumn) {\n detectionResultColumn = new DetectionResultRowIndicatorColumn(boundingBox, barcodeColumn === 0);\n } else {\n detectionResultColumn = new DetectionResultColumn(boundingBox);\n }\n detectionResult.setDetectionResultColumn(barcodeColumn, detectionResultColumn);\n let startColumn: int = -1;\n let previousStartColumn: int = startColumn;\n // TODO start at a row for which we know the start position, then detect upwards and downwards from there.\n for (let imageRow /*int*/ = boundingBox.getMinY(); imageRow <= boundingBox.getMaxY(); imageRow++) {\n startColumn = PDF417ScanningDecoder.getStartColumn(detectionResult, barcodeColumn, imageRow, leftToRight);\n if (startColumn < 0 || startColumn > boundingBox.getMaxX()) {\n if (previousStartColumn === -1) {\n continue;\n }\n startColumn = previousStartColumn;\n }\n let codeword: Codeword = PDF417ScanningDecoder.detectCodeword(image, boundingBox.getMinX(), boundingBox.getMaxX(), leftToRight,\n startColumn, imageRow, minCodewordWidth, maxCodewordWidth);\n if (codeword != null) {\n detectionResultColumn.setCodeword(imageRow, codeword);\n previousStartColumn = startColumn;\n minCodewordWidth = Math.min(minCodewordWidth, codeword.getWidth());\n maxCodewordWidth = Math.max(maxCodewordWidth, codeword.getWidth());\n }\n }\n }\n return PDF417ScanningDecoder.createDecoderResult(detectionResult);\n }\n\n /**\n *\n * @param leftRowIndicatorColumn\n * @param rightRowIndicatorColumn\n *\n * @throws NotFoundException\n */\n private static merge(leftRowIndicatorColumn: DetectionResultRowIndicatorColumn,\n rightRowIndicatorColumn: DetectionResultRowIndicatorColumn): DetectionResult {\n if (leftRowIndicatorColumn == null && rightRowIndicatorColumn == null) {\n return null;\n }\n let barcodeMetadata: BarcodeMetadata = PDF417ScanningDecoder.getBarcodeMetadata(leftRowIndicatorColumn, rightRowIndicatorColumn);\n if (barcodeMetadata == null) {\n return null;\n }\n let boundingBox: BoundingBox = BoundingBox.merge(PDF417ScanningDecoder.adjustBoundingBox(leftRowIndicatorColumn),\n PDF417ScanningDecoder.adjustBoundingBox(rightRowIndicatorColumn));\n return new DetectionResult(barcodeMetadata, boundingBox);\n }\n\n /**\n *\n * @param rowIndicatorColumn\n *\n * @throws NotFoundException\n */\n private static adjustBoundingBox(rowIndicatorColumn: DetectionResultRowIndicatorColumn): BoundingBox {\n if (rowIndicatorColumn == null) {\n return null;\n }\n let rowHeights: Int32Array = rowIndicatorColumn.getRowHeights();\n if (rowHeights == null) {\n return null;\n }\n let maxRowHeight: int = PDF417ScanningDecoder.getMax(rowHeights);\n let missingStartRows: int = 0;\n for (let rowHeight /*int*/ of rowHeights) {\n missingStartRows += maxRowHeight - rowHeight;\n if (rowHeight > 0) {\n break;\n }\n }\n let codewords: Codeword[] = rowIndicatorColumn.getCodewords();\n for (let row /*int*/ = 0; missingStartRows > 0 && codewords[row] == null; row++) {\n missingStartRows--;\n }\n let missingEndRows: int = 0;\n for (let row /*int*/ = rowHeights.length - 1; row >= 0; row--) {\n missingEndRows += maxRowHeight - rowHeights[row];\n if (rowHeights[row] > 0) {\n break;\n }\n }\n for (let row /*int*/ = codewords.length - 1; missingEndRows > 0 && codewords[row] == null; row--) {\n missingEndRows--;\n }\n return rowIndicatorColumn.getBoundingBox().addMissingRows(missingStartRows, missingEndRows,\n rowIndicatorColumn.isLeft());\n }\n\n private static getMax(values: Int32Array): int {\n let maxValue: int = -1;\n for (let value /*int*/ of values) {\n maxValue = Math.max(maxValue, value);\n }\n return maxValue;\n }\n\n private static getBarcodeMetadata(leftRowIndicatorColumn: DetectionResultRowIndicatorColumn,\n rightRowIndicatorColumn: DetectionResultRowIndicatorColumn): BarcodeMetadata {\n let leftBarcodeMetadata: BarcodeMetadata;\n if (leftRowIndicatorColumn == null ||\n (leftBarcodeMetadata = leftRowIndicatorColumn.getBarcodeMetadata()) == null) {\n return rightRowIndicatorColumn == null ? null : rightRowIndicatorColumn.getBarcodeMetadata();\n }\n let rightBarcodeMetadata: BarcodeMetadata;\n if (rightRowIndicatorColumn == null ||\n (rightBarcodeMetadata = rightRowIndicatorColumn.getBarcodeMetadata()) == null) {\n return leftBarcodeMetadata;\n }\n\n if (leftBarcodeMetadata.getColumnCount() !== rightBarcodeMetadata.getColumnCount() &&\n leftBarcodeMetadata.getErrorCorrectionLevel() !== rightBarcodeMetadata.getErrorCorrectionLevel() &&\n leftBarcodeMetadata.getRowCount() !== rightBarcodeMetadata.getRowCount()) {\n return null;\n }\n return leftBarcodeMetadata;\n }\n\n private static getRowIndicatorColumn(image: BitMatrix,\n boundingBox: BoundingBox,\n startPoint: ResultPoint,\n leftToRight: boolean,\n minCodewordWidth: int,\n maxCodewordWidth: int): DetectionResultRowIndicatorColumn {\n let rowIndicatorColumn: DetectionResultRowIndicatorColumn = new DetectionResultRowIndicatorColumn(boundingBox,\n leftToRight);\n for (let i /*int*/ = 0; i < 2; i++) {\n let increment: int = i === 0 ? 1 : -1;\n let startColumn: int = Math.trunc(Math.trunc(startPoint.getX()));\n for (let imageRow /*int*/ = Math.trunc(Math.trunc(startPoint.getY())); imageRow <= boundingBox.getMaxY() &&\n imageRow >= boundingBox.getMinY(); imageRow += increment) {\n let codeword: Codeword = PDF417ScanningDecoder.detectCodeword(image, 0, image.getWidth(), leftToRight, startColumn, imageRow,\n minCodewordWidth, maxCodewordWidth);\n if (codeword != null) {\n rowIndicatorColumn.setCodeword(imageRow, codeword);\n if (leftToRight) {\n startColumn = codeword.getStartX();\n } else {\n startColumn = codeword.getEndX();\n }\n }\n }\n }\n return rowIndicatorColumn;\n }\n\n /**\n *\n * @param detectionResult\n * @param BarcodeValue\n * @param param2\n * @param param3\n * @param barcodeMatrix\n *\n * @throws NotFoundException\n */\n private static adjustCodewordCount(detectionResult: DetectionResult, barcodeMatrix: BarcodeValue[][]): void {\n let barcodeMatrix01: BarcodeValue = barcodeMatrix[0][1];\n let numberOfCodewords: Int32Array = barcodeMatrix01.getValue();\n let calculatedNumberOfCodewords: int = detectionResult.getBarcodeColumnCount() *\n detectionResult.getBarcodeRowCount() -\n PDF417ScanningDecoder.getNumberOfECCodeWords(detectionResult.getBarcodeECLevel());\n if (numberOfCodewords.length === 0) {\n if (calculatedNumberOfCodewords < 1 || calculatedNumberOfCodewords > PDF417Common.MAX_CODEWORDS_IN_BARCODE) {\n throw NotFoundException.getNotFoundInstance();\n }\n barcodeMatrix01.setValue(calculatedNumberOfCodewords);\n } else if (numberOfCodewords[0] !== calculatedNumberOfCodewords) {\n // The calculated one is more reliable as it is derived from the row indicator columns\n barcodeMatrix01.setValue(calculatedNumberOfCodewords);\n }\n }\n\n /**\n *\n * @param detectionResult\n *\n * @throws FormatException\n * @throws ChecksumException\n * @throws NotFoundException\n */\n private static createDecoderResult(detectionResult: DetectionResult): DecoderResult {\n let barcodeMatrix: BarcodeValue[][] = PDF417ScanningDecoder.createBarcodeMatrix(detectionResult);\n PDF417ScanningDecoder.adjustCodewordCount(detectionResult, barcodeMatrix);\n let erasures /*Collection*/ = new Array();\n let codewords: Int32Array = new Int32Array(detectionResult.getBarcodeRowCount() * detectionResult.getBarcodeColumnCount());\n let ambiguousIndexValuesList: /*List*/ List = [];\n let ambiguousIndexesList: /*Collection*/ Collection = new Array();\n for (let row /*int*/ = 0; row < detectionResult.getBarcodeRowCount(); row++) {\n for (let column /*int*/ = 0; column < detectionResult.getBarcodeColumnCount(); column++) {\n let values: Int32Array = barcodeMatrix[row][column + 1].getValue();\n let codewordIndex: int = row * detectionResult.getBarcodeColumnCount() + column;\n if (values.length === 0) {\n erasures.push(codewordIndex);\n } else if (values.length === 1) {\n codewords[codewordIndex] = values[0];\n } else {\n ambiguousIndexesList.push(codewordIndex);\n ambiguousIndexValuesList.push(values);\n }\n }\n }\n let ambiguousIndexValues: Int32Array[] = new Array(ambiguousIndexValuesList.length);\n for (let i /*int*/ = 0; i < ambiguousIndexValues.length; i++) {\n ambiguousIndexValues[i] = ambiguousIndexValuesList[i];\n }\n return PDF417ScanningDecoder.createDecoderResultFromAmbiguousValues(detectionResult.getBarcodeECLevel(), codewords,\n PDF417Common.toIntArray(erasures), PDF417Common.toIntArray(ambiguousIndexesList), ambiguousIndexValues);\n }\n\n /**\n * This method deals with the fact, that the decoding process doesn't always yield a single most likely value. The\n * current error correction implementation doesn't deal with erasures very well, so it's better to provide a value\n * for these ambiguous codewords instead of treating it as an erasure. The problem is that we don't know which of\n * the ambiguous values to choose. We try decode using the first value, and if that fails, we use another of the\n * ambiguous values and try to decode again. This usually only happens on very hard to read and decode barcodes,\n * so decoding the normal barcodes is not affected by this.\n *\n * @param erasureArray contains the indexes of erasures\n * @param ambiguousIndexes array with the indexes that have more than one most likely value\n * @param ambiguousIndexValues two dimensional array that contains the ambiguous values. The first dimension must\n * be the same length as the ambiguousIndexes array\n *\n * @throws FormatException\n * @throws ChecksumException\n */\n private static createDecoderResultFromAmbiguousValues(ecLevel: int,\n codewords: Int32Array,\n erasureArray: Int32Array,\n ambiguousIndexes: Int32Array,\n ambiguousIndexValues: Int32Array[]): DecoderResult {\n let ambiguousIndexCount: Int32Array = new Int32Array(ambiguousIndexes.length);\n\n let tries: int = 100;\n while (tries-- > 0) {\n for (let i /*int*/ = 0; i < ambiguousIndexCount.length; i++) {\n codewords[ambiguousIndexes[i]] = ambiguousIndexValues[i][ambiguousIndexCount[i]];\n }\n try {\n return PDF417ScanningDecoder.decodeCodewords(codewords, ecLevel, erasureArray);\n } catch (err) {\n let ignored = err instanceof ChecksumException;\n if (!ignored) {\n throw err;\n }\n }\n if (ambiguousIndexCount.length === 0) {\n throw ChecksumException.getChecksumInstance();\n }\n for (let i /*int*/ = 0; i < ambiguousIndexCount.length; i++) {\n if (ambiguousIndexCount[i] < ambiguousIndexValues[i].length - 1) {\n ambiguousIndexCount[i]++;\n break;\n } else {\n ambiguousIndexCount[i] = 0;\n if (i === ambiguousIndexCount.length - 1) {\n throw ChecksumException.getChecksumInstance();\n }\n }\n }\n }\n throw ChecksumException.getChecksumInstance();\n }\n\n private static createBarcodeMatrix(detectionResult: DetectionResult): BarcodeValue[][] {\n // let barcodeMatrix: BarcodeValue[][] =\n // new BarcodeValue[detectionResult.getBarcodeRowCount()][detectionResult.getBarcodeColumnCount() + 2];\n let barcodeMatrix: BarcodeValue[][] =\n Array.from({ length: detectionResult.getBarcodeRowCount() }, () => new Array(detectionResult.getBarcodeColumnCount() + 2));\n for (let row /*int*/ = 0; row < barcodeMatrix.length; row++) {\n for (let column /*int*/ = 0; column < barcodeMatrix[row].length; column++) {\n barcodeMatrix[row][column] = new BarcodeValue();\n }\n }\n\n let column: int = 0;\n for (let detectionResultColumn /*DetectionResultColumn*/ of detectionResult.getDetectionResultColumns()) {\n if (detectionResultColumn != null) {\n for (let codeword /*Codeword*/ of detectionResultColumn.getCodewords()) {\n if (codeword != null) {\n let rowNumber: int = codeword.getRowNumber();\n if (rowNumber >= 0) {\n if (rowNumber >= barcodeMatrix.length) {\n // We have more rows than the barcode metadata allows for, ignore them.\n continue;\n }\n barcodeMatrix[rowNumber][column].setValue(codeword.getValue());\n }\n }\n }\n }\n column++;\n }\n return barcodeMatrix;\n }\n\n private static isValidBarcodeColumn(detectionResult: DetectionResult, barcodeColumn: int): boolean {\n return barcodeColumn >= 0 && barcodeColumn <= detectionResult.getBarcodeColumnCount() + 1;\n }\n\n private static getStartColumn(detectionResult: DetectionResult,\n barcodeColumn: int,\n imageRow: int,\n leftToRight: boolean): int {\n let offset: int = leftToRight ? 1 : -1;\n let codeword: Codeword = null;\n if (PDF417ScanningDecoder.isValidBarcodeColumn(detectionResult, barcodeColumn - offset)) {\n codeword = detectionResult.getDetectionResultColumn(barcodeColumn - offset).getCodeword(imageRow);\n }\n if (codeword != null) {\n return leftToRight ? codeword.getEndX() : codeword.getStartX();\n }\n codeword = detectionResult.getDetectionResultColumn(barcodeColumn).getCodewordNearby(imageRow);\n if (codeword != null) {\n return leftToRight ? codeword.getStartX() : codeword.getEndX();\n }\n if (PDF417ScanningDecoder.isValidBarcodeColumn(detectionResult, barcodeColumn - offset)) {\n codeword = detectionResult.getDetectionResultColumn(barcodeColumn - offset).getCodewordNearby(imageRow);\n }\n if (codeword != null) {\n return leftToRight ? codeword.getEndX() : codeword.getStartX();\n }\n let skippedColumns: int = 0;\n\n while (PDF417ScanningDecoder.isValidBarcodeColumn(detectionResult, barcodeColumn - offset)) {\n barcodeColumn -= offset;\n for (let previousRowCodeword /*Codeword*/ of detectionResult.getDetectionResultColumn(barcodeColumn).getCodewords()) {\n if (previousRowCodeword != null) {\n return (leftToRight ? previousRowCodeword.getEndX() : previousRowCodeword.getStartX()) +\n offset *\n skippedColumns *\n (previousRowCodeword.getEndX() - previousRowCodeword.getStartX());\n }\n }\n skippedColumns++;\n }\n return leftToRight ? detectionResult.getBoundingBox().getMinX() : detectionResult.getBoundingBox().getMaxX();\n }\n\n private static detectCodeword(image: BitMatrix,\n minColumn: int,\n maxColumn: int,\n leftToRight: boolean,\n startColumn: int,\n imageRow: int,\n minCodewordWidth: int,\n maxCodewordWidth: int): Codeword {\n startColumn = PDF417ScanningDecoder.adjustCodewordStartColumn(image, minColumn, maxColumn, leftToRight, startColumn, imageRow);\n // we usually know fairly exact now how long a codeword is. We should provide minimum and maximum expected length\n // and try to adjust the read pixels, e.g. remove single pixel errors or try to cut off exceeding pixels.\n // min and maxCodewordWidth should not be used as they are calculated for the whole barcode an can be inaccurate\n // for the current position\n let moduleBitCount: Int32Array = PDF417ScanningDecoder.getModuleBitCount(image, minColumn, maxColumn, leftToRight, startColumn, imageRow);\n if (moduleBitCount == null) {\n return null;\n }\n let endColumn: int;\n let codewordBitCount: int = MathUtils.sum(moduleBitCount);\n if (leftToRight) {\n endColumn = startColumn + codewordBitCount;\n } else {\n for (let i /*int*/ = 0; i < moduleBitCount.length / 2; i++) {\n let tmpCount: int = moduleBitCount[i];\n moduleBitCount[i] = moduleBitCount[moduleBitCount.length - 1 - i];\n moduleBitCount[moduleBitCount.length - 1 - i] = tmpCount;\n }\n endColumn = startColumn;\n startColumn = endColumn - codewordBitCount;\n }\n // TODO implement check for width and correction of black and white bars\n // use start (and maybe stop pattern) to determine if black bars are wider than white bars. If so, adjust.\n // should probably done only for codewords with a lot more than 17 bits.\n // The following fixes 10-1.png, which has wide black bars and small white bars\n // for (let i /*int*/ = 0; i < moduleBitCount.length; i++) {\n // if (i % 2 === 0) {\n // moduleBitCount[i]--;\n // } else {\n // moduleBitCount[i]++;\n // }\n // }\n\n // We could also use the width of surrounding codewords for more accurate results, but this seems\n // sufficient for now\n if (!PDF417ScanningDecoder.checkCodewordSkew(codewordBitCount, minCodewordWidth, maxCodewordWidth)) {\n // We could try to use the startX and endX position of the codeword in the same column in the previous row,\n // create the bit count from it and normalize it to 8. This would help with single pixel errors.\n return null;\n }\n\n let decodedValue: int = PDF417CodewordDecoder.getDecodedValue(moduleBitCount);\n let codeword: int = PDF417Common.getCodeword(decodedValue);\n if (codeword === -1) {\n return null;\n }\n return new Codeword(startColumn, endColumn, PDF417ScanningDecoder.getCodewordBucketNumber(decodedValue), codeword);\n }\n\n private static getModuleBitCount(image: BitMatrix,\n minColumn: int,\n maxColumn: int,\n leftToRight: boolean,\n startColumn: int,\n imageRow: int): Int32Array {\n let imageColumn: int = startColumn;\n let moduleBitCount: Int32Array = new Int32Array(8);\n let moduleNumber: int = 0;\n let increment: int = leftToRight ? 1 : -1;\n let previousPixelValue: boolean = leftToRight;\n while ((leftToRight ? imageColumn < maxColumn : imageColumn >= minColumn) &&\n moduleNumber < moduleBitCount.length) {\n if (image.get(imageColumn, imageRow) === previousPixelValue) {\n moduleBitCount[moduleNumber]++;\n imageColumn += increment;\n } else {\n moduleNumber++;\n previousPixelValue = !previousPixelValue;\n }\n }\n if (moduleNumber === moduleBitCount.length ||\n ((imageColumn === (leftToRight ? maxColumn : minColumn)) &&\n moduleNumber === moduleBitCount.length - 1)) {\n return moduleBitCount;\n }\n return null;\n }\n\n private static getNumberOfECCodeWords(barcodeECLevel: int): int {\n return 2 << barcodeECLevel;\n }\n\n private static adjustCodewordStartColumn(image: BitMatrix,\n minColumn: int,\n maxColumn: int,\n leftToRight: boolean,\n codewordStartColumn: int,\n imageRow: int): int {\n let correctedStartColumn: int = codewordStartColumn;\n let increment: int = leftToRight ? -1 : 1;\n // there should be no black pixels before the start column. If there are, then we need to start earlier.\n for (let i /*int*/ = 0; i < 2; i++) {\n while ((leftToRight ? correctedStartColumn >= minColumn : correctedStartColumn < maxColumn) &&\n leftToRight === image.get(correctedStartColumn, imageRow)) {\n if (Math.abs(codewordStartColumn - correctedStartColumn) > PDF417ScanningDecoder.CODEWORD_SKEW_SIZE) {\n return codewordStartColumn;\n }\n correctedStartColumn += increment;\n }\n increment = -increment;\n leftToRight = !leftToRight;\n }\n return correctedStartColumn;\n }\n\n private static checkCodewordSkew(codewordSize: int, minCodewordWidth: int, maxCodewordWidth: int): boolean {\n return minCodewordWidth - PDF417ScanningDecoder.CODEWORD_SKEW_SIZE <= codewordSize &&\n codewordSize <= maxCodewordWidth + PDF417ScanningDecoder.CODEWORD_SKEW_SIZE;\n }\n\n /**\n * @throws FormatException,\n * @throws ChecksumException\n */\n private static decodeCodewords(codewords: Int32Array, ecLevel: int, erasures: Int32Array): DecoderResult {\n if (codewords.length === 0) {\n throw FormatException.getFormatInstance();\n }\n\n let numECCodewords: int = 1 << (ecLevel + 1);\n let correctedErrorsCount: int = PDF417ScanningDecoder.correctErrors(codewords, erasures, numECCodewords);\n PDF417ScanningDecoder.verifyCodewordCount(codewords, numECCodewords);\n\n // Decode the codewords\n let decoderResult: DecoderResult = DecodedBitStreamParser.decode(codewords, '' + ecLevel);\n decoderResult.setErrorsCorrected(correctedErrorsCount);\n decoderResult.setErasures(erasures.length);\n return decoderResult;\n }\n\n /**\n *

Given data and error-correction codewords received, possibly corrupted by errors, attempts to\n * correct the errors in-place.

\n *\n * @param codewords data and error correction codewords\n * @param erasures positions of any known erasures\n * @param numECCodewords number of error correction codewords that are available in codewords\n * @throws ChecksumException if error correction fails\n */\n private static correctErrors(codewords: Int32Array, erasures: Int32Array, numECCodewords: int): int {\n if (erasures != null &&\n erasures.length > numECCodewords / 2 + PDF417ScanningDecoder.MAX_ERRORS ||\n numECCodewords < 0 ||\n numECCodewords > PDF417ScanningDecoder.MAX_EC_CODEWORDS) {\n // Too many errors or EC Codewords is corrupted\n throw ChecksumException.getChecksumInstance();\n }\n return PDF417ScanningDecoder.errorCorrection.decode(codewords, numECCodewords, erasures);\n }\n\n /**\n * Verify that all is OK with the codeword array.\n * @throws FormatException\n */\n private static verifyCodewordCount(codewords: Int32Array, numECCodewords: int): void {\n if (codewords.length < 4) {\n // Codeword array size should be at least 4 allowing for\n // Count CW, At least one Data CW, Error Correction CW, Error Correction CW\n throw FormatException.getFormatInstance();\n }\n // The first codeword, the Symbol Length Descriptor, shall always encode the total number of data\n // codewords in the symbol, including the Symbol Length Descriptor itself, data codewords and pad\n // codewords, but excluding the number of error correction codewords.\n let numberOfCodewords: int = codewords[0];\n if (numberOfCodewords > codewords.length) {\n throw FormatException.getFormatInstance();\n }\n if (numberOfCodewords === 0) {\n // Reset to the length of the array - 8 (Allow for at least level 3 Error Correction (8 Error Codewords)\n if (numECCodewords < codewords.length) {\n codewords[0] = codewords.length - numECCodewords;\n } else {\n throw FormatException.getFormatInstance();\n }\n }\n }\n\n private static getBitCountForCodeword(codeword: int): Int32Array {\n let result: Int32Array = new Int32Array(8);\n let previousValue: int = 0;\n let i: int = result.length - 1;\n while (true) {\n if ((codeword & 0x1) !== previousValue) {\n previousValue = codeword & 0x1;\n i--;\n if (i < 0) {\n break;\n }\n }\n result[i]++;\n codeword >>= 1;\n }\n return result;\n }\n\n private static getCodewordBucketNumber(codeword: int | Int32Array): int {\n if (codeword instanceof Int32Array) {\n return this.getCodewordBucketNumber_Int32Array(codeword);\n }\n return this.getCodewordBucketNumber_number(codeword);\n }\n\n private static getCodewordBucketNumber_number(codeword: int): int {\n return PDF417ScanningDecoder.getCodewordBucketNumber(PDF417ScanningDecoder.getBitCountForCodeword(codeword));\n }\n\n private static getCodewordBucketNumber_Int32Array(moduleBitCount: Int32Array): int {\n return (moduleBitCount[0] - moduleBitCount[2] + moduleBitCount[4] - moduleBitCount[6] + 9) % 9;\n }\n\n public static toString(barcodeMatrix: BarcodeValue[][]): String {\n let formatter = new Formatter();\n // try (let formatter = new Formatter()) {\n for (let row /*int*/ = 0; row < barcodeMatrix.length; row++) {\n formatter.format('Row %2d: ', row);\n for (let column /*int*/ = 0; column < barcodeMatrix[row].length; column++) {\n let barcodeValue: BarcodeValue = barcodeMatrix[row][column];\n if (barcodeValue.getValue().length === 0) {\n formatter.format(' ', null);\n } else {\n formatter.format('%4d(%2d)', barcodeValue.getValue()[0],\n barcodeValue.getConfidence(barcodeValue.getValue()[0]));\n }\n }\n formatter.format('%n');\n }\n return formatter.toString();\n // }\n }\n\n}\n","/*\n* Copyright 2012 ZXing authors\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n// package com.google.zxing.pdf417.decoder.ec;\n\n// import com.google.zxing.ChecksumException;\nimport ChecksumException from '../../../ChecksumException';\n\nimport ModulusPoly from './ModulusPoly';\nimport ModulusGF from './ModulusGF';\n\nimport { int } from '../../../../customTypings';\n\n/**\n *

PDF417 error correction implementation.

\n *\n *

This example\n * is quite useful in understanding the algorithm.

\n *\n * @author Sean Owen\n * @see com.google.zxing.common.reedsolomon.ReedSolomonDecoder\n */\nexport default /*public final*/ class ErrorCorrection {\n\n private /*final*/ field: ModulusGF;\n\n public constructor() {\n this.field = ModulusGF.PDF417_GF;\n }\n\n /**\n * @param received received codewords\n * @param numECCodewords number of those codewords used for EC\n * @param erasures location of erasures\n * @return number of errors\n * @throws ChecksumException if errors cannot be corrected, maybe because of too many errors\n */\n public decode(received: Int32Array,\n numECCodewords: int,\n erasures: Int32Array): int {\n\n let poly: ModulusPoly = new ModulusPoly(this.field, received);\n let S: Int32Array = new Int32Array(numECCodewords);\n let error: boolean = false;\n for (let i /*int*/ = numECCodewords; i > 0; i--) {\n let evaluation: int = poly.evaluateAt(this.field.exp(i));\n S[numECCodewords - i] = evaluation;\n if (evaluation !== 0) {\n error = true;\n }\n }\n\n if (!error) {\n return 0;\n }\n\n let knownErrors: ModulusPoly = this.field.getOne();\n if (erasures != null) {\n for (const erasure of erasures) {\n let b: int = this.field.exp(received.length - 1 - erasure);\n // Add (1 - bx) term:\n let term: ModulusPoly = new ModulusPoly(this.field, new Int32Array([this.field.subtract(0, b), 1]));\n knownErrors = knownErrors.multiply(term);\n }\n }\n\n let syndrome: ModulusPoly = new ModulusPoly(this.field, S);\n // syndrome = syndrome.multiply(knownErrors);\n\n let sigmaOmega: ModulusPoly[] =\n this.runEuclideanAlgorithm(this.field.buildMonomial(numECCodewords, 1), syndrome, numECCodewords);\n let sigma: ModulusPoly = sigmaOmega[0];\n let omega: ModulusPoly = sigmaOmega[1];\n\n // sigma = sigma.multiply(knownErrors);\n\n let errorLocations: Int32Array = this.findErrorLocations(sigma);\n let errorMagnitudes: Int32Array = this.findErrorMagnitudes(omega, sigma, errorLocations);\n\n for (let i /*int*/ = 0; i < errorLocations.length; i++) {\n let position: int = received.length - 1 - this.field.log(errorLocations[i]);\n if (position < 0) {\n throw ChecksumException.getChecksumInstance();\n }\n received[position] = this.field.subtract(received[position], errorMagnitudes[i]);\n }\n return errorLocations.length;\n }\n\n /**\n *\n * @param ModulusPoly\n * @param a\n * @param ModulusPoly\n * @param b\n * @param int\n * @param R\n * @throws ChecksumException\n */\n private runEuclideanAlgorithm(a: ModulusPoly, b: ModulusPoly, R: int): ModulusPoly[] {\n // Assume a's degree is >= b's\n if (a.getDegree() < b.getDegree()) {\n let temp: ModulusPoly = a;\n a = b;\n b = temp;\n }\n\n let rLast: ModulusPoly = a;\n let r: ModulusPoly = b;\n let tLast: ModulusPoly = this.field.getZero();\n let t: ModulusPoly = this.field.getOne();\n\n // Run Euclidean algorithm until r's degree is less than R/2\n while (r.getDegree() >= Math.round(R / 2)) {\n let rLastLast: ModulusPoly = rLast;\n let tLastLast: ModulusPoly = tLast;\n rLast = r;\n tLast = t;\n\n // Divide rLastLast by rLast, with quotient in q and remainder in r\n if (rLast.isZero()) {\n // Oops, Euclidean algorithm already terminated?\n throw ChecksumException.getChecksumInstance();\n }\n r = rLastLast;\n let q: ModulusPoly = this.field.getZero();\n let denominatorLeadingTerm: int = rLast.getCoefficient(rLast.getDegree());\n let dltInverse: int = this.field.inverse(denominatorLeadingTerm);\n while (r.getDegree() >= rLast.getDegree() && !r.isZero()) {\n let degreeDiff: int = r.getDegree() - rLast.getDegree();\n let scale: int = this.field.multiply(r.getCoefficient(r.getDegree()), dltInverse);\n q = q.add(this.field.buildMonomial(degreeDiff, scale));\n r = r.subtract(rLast.multiplyByMonomial(degreeDiff, scale));\n }\n\n t = q.multiply(tLast).subtract(tLastLast).negative();\n }\n\n let sigmaTildeAtZero: int = t.getCoefficient(0);\n if (sigmaTildeAtZero === 0) {\n throw ChecksumException.getChecksumInstance();\n }\n\n let inverse: int = this.field.inverse(sigmaTildeAtZero);\n let sigma: ModulusPoly = t.multiply(inverse);\n let omega: ModulusPoly = r.multiply(inverse);\n return [sigma, omega];\n }\n\n /**\n *\n * @param errorLocator\n * @throws ChecksumException\n */\n private findErrorLocations(errorLocator: ModulusPoly): Int32Array {\n // This is a direct application of Chien's search\n let numErrors: int = errorLocator.getDegree();\n let result: Int32Array = new Int32Array(numErrors);\n let e: int = 0;\n for (let i /*int*/ = 1; i < this.field.getSize() && e < numErrors; i++) {\n if (errorLocator.evaluateAt(i) === 0) {\n result[e] = this.field.inverse(i);\n e++;\n }\n }\n if (e !== numErrors) {\n throw ChecksumException.getChecksumInstance();\n }\n return result;\n }\n\n private findErrorMagnitudes(errorEvaluator: ModulusPoly,\n errorLocator: ModulusPoly,\n errorLocations: Int32Array): Int32Array {\n let errorLocatorDegree: int = errorLocator.getDegree();\n let formalDerivativeCoefficients: Int32Array = new Int32Array(errorLocatorDegree);\n for (let i /*int*/ = 1; i <= errorLocatorDegree; i++) {\n formalDerivativeCoefficients[errorLocatorDegree - i] =\n this.field.multiply(i, errorLocator.getCoefficient(i));\n }\n let formalDerivative: ModulusPoly = new ModulusPoly(this.field, formalDerivativeCoefficients);\n\n // This is directly applying Forney's Formula\n let s: int = errorLocations.length;\n let result: Int32Array = new Int32Array(s);\n for (let i /*int*/ = 0; i < s; i++) {\n let xiInverse: int = this.field.inverse(errorLocations[i]);\n let numerator: int = this.field.subtract(0, errorEvaluator.evaluateAt(xiInverse));\n let denominator: int = this.field.inverse(formalDerivative.evaluateAt(xiInverse));\n result[i] = this.field.multiply(numerator, denominator);\n }\n return result;\n }\n}\n","\n\n/*\n * Copyright 2012 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// package com.google.zxing.pdf417.decoder.ec;\n\n// import com.google.zxing.pdf417.PDF417Common;\nimport PDF417Common from '../../PDF417Common';\n\nimport ModulusPoly from './ModulusPoly';\n\nimport IllegalArgumentException from '../../../IllegalArgumentException';\nimport ModulusBase from './ModulusBase';\n\n\n/**\n *

A field based on powers of a generator integer, modulo some modulus.

\n *\n * @author Sean Owen\n * @see com.google.zxing.common.reedsolomon.GenericGF\n */\nexport default /*public final*/ class ModulusGF extends ModulusBase {\n\n public static /*final*/ PDF417_GF: ModulusGF = new ModulusGF(PDF417Common.NUMBER_OF_CODEWORDS, 3);\n\n // private /*final*/ expTable: Int32Array;\n // private /*final*/ logTable: Int32Array;\n private /*final*/ zero: ModulusPoly;\n private /*final*/ one: ModulusPoly;\n // private /*final*/ modulus: /*int*/ number;\n\n private constructor(modulus: /*int*/ number, generator: /*int*/ number) {\n super();\n this.modulus = modulus;\n this.expTable = new Int32Array(modulus);\n this.logTable = new Int32Array(modulus);\n let x: /*int*/ number = 1;\n for (let i /*int*/ = 0; i < modulus; i++) {\n this.expTable[i] = x;\n x = (x * generator) % modulus;\n }\n for (let i /*int*/ = 0; i < modulus - 1; i++) {\n this.logTable[this.expTable[i]] = i;\n }\n // logTable[0] == 0 but this should never be used\n this.zero = new ModulusPoly(this, new Int32Array([0]));\n this.one = new ModulusPoly(this, new Int32Array([1]));\n }\n\n\n getZero(): ModulusPoly {\n return this.zero;\n }\n\n getOne(): ModulusPoly {\n return this.one;\n }\n\n buildMonomial(degree: /*int*/ number, coefficient: /*int*/ number): ModulusPoly {\n if (degree < 0) {\n throw new IllegalArgumentException();\n }\n if (coefficient === 0) {\n return this.zero;\n }\n let coefficients: Int32Array = new Int32Array(degree + 1);\n coefficients[0] = coefficient;\n return new ModulusPoly(this, coefficients);\n }\n\n}\n","import IllegalArgumentException from '../../../IllegalArgumentException';\nimport ArithmeticException from '../../../ArithmeticException';\n\nexport default class ModulusBase {\n\n protected /*final*/ logTable: Int32Array;\n protected /*final*/ expTable: Int32Array;\n protected /*final*/ modulus: number;\n\n add(a: number, b: number): number {\n return (a + b) % this.modulus;\n }\n\n subtract(a: number, b: number): number {\n return (this.modulus + a - b) % this.modulus;\n }\n\n exp(a: number): number {\n return this.expTable[a];\n }\n\n log(a: number): number {\n if (a === 0) {\n throw new IllegalArgumentException();\n }\n return this.logTable[a];\n }\n\n inverse(a: number): number {\n if (a === 0) {\n throw new ArithmeticException();\n }\n return this.expTable[this.modulus - this.logTable[a] - 1];\n }\n\n multiply(a: number, b: number): number {\n if (a === 0 || b === 0) {\n return 0;\n }\n return this.expTable[(this.logTable[a] + this.logTable[b]) % (this.modulus - 1)];\n }\n\n getSize(): number {\n return this.modulus;\n }\n\n equals(o: Object): boolean {\n return o === this;\n }\n}\n","/*\n * Copyright 2013 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// package com.google.zxing.pdf417.decoder;\n\n// import com.google.zxing.ResultPoint;\nimport ResultPoint from '../../ResultPoint';\n// import com.google.zxing.pdf417.PDF417Common;\nimport PDF417Common from '../PDF417Common';\n\nimport BarcodeMetadata from './BarcodeMetadata';\nimport BoundingBox from './BoundingBox';\nimport DetectionResultColumn from './DetectionResultColumn';\nimport Codeword from './Codeword';\nimport BarcodeValue from './BarcodeValue';\n\nimport { int } from '../../../customTypings';\n\n/**\n * @author Guenther Grau\n */\nexport default /*final*/ class DetectionResultRowIndicatorColumn extends DetectionResultColumn {\n\n private /*final*/ _isLeft: boolean;\n\n constructor(boundingBox: BoundingBox, isLeft: boolean) {\n super(boundingBox);\n this._isLeft = isLeft;\n }\n\n private setRowNumbers(): void {\n for (let codeword /*Codeword*/ of this.getCodewords()) {\n if (codeword != null) {\n codeword.setRowNumberAsRowIndicatorColumn();\n }\n }\n }\n\n // TODO implement properly\n // TODO maybe we should add missing codewords to store the correct row number to make\n // finding row numbers for other columns easier\n // use row height count to make detection of invalid row numbers more reliable\n adjustCompleteIndicatorColumnRowNumbers(barcodeMetadata: BarcodeMetadata): void {\n let codewords: Codeword[] = this.getCodewords();\n this.setRowNumbers();\n this.removeIncorrectCodewords(codewords, barcodeMetadata);\n let boundingBox: BoundingBox = this.getBoundingBox();\n let top: ResultPoint = this._isLeft ? boundingBox.getTopLeft() : boundingBox.getTopRight();\n let bottom: ResultPoint = this._isLeft ? boundingBox.getBottomLeft() : boundingBox.getBottomRight();\n let firstRow: int = this.imageRowToCodewordIndex( Math.trunc(top.getY()));\n let lastRow: int = this.imageRowToCodewordIndex( Math.trunc(bottom.getY()));\n // We need to be careful using the average row height. Barcode could be skewed so that we have smaller and\n // taller rows\n // float averageRowHeight = (lastRow - firstRow) / /*(float)*/ barcodeMetadata.getRowCount();\n let barcodeRow: int = -1;\n let maxRowHeight: int = 1;\n let currentRowHeight: int = 0;\n for (let codewordsRow /*int*/ = firstRow; codewordsRow < lastRow; codewordsRow++) {\n if (codewords[codewordsRow] == null) {\n continue;\n }\n let codeword: Codeword = codewords[codewordsRow];\n\n // float expectedRowNumber = (codewordsRow - firstRow) / averageRowHeight;\n // if (Math.abs(codeword.getRowNumber() - expectedRowNumber) > 2) {\n // SimpleLog.log(LEVEL.WARNING,\n // \"Removing codeword, rowNumberSkew too high, codeword[\" + codewordsRow + \"]: Expected Row: \" +\n // expectedRowNumber + \", RealRow: \" + codeword.getRowNumber() + \", value: \" + codeword.getValue());\n // codewords[codewordsRow] = null;\n // }\n\n let rowDifference: int = codeword.getRowNumber() - barcodeRow;\n\n // TODO improve handling with case where first row indicator doesn't start with 0\n\n if (rowDifference === 0) {\n currentRowHeight++;\n } else if (rowDifference === 1) {\n maxRowHeight = Math.max(maxRowHeight, currentRowHeight);\n currentRowHeight = 1;\n barcodeRow = codeword.getRowNumber();\n } else if (rowDifference < 0 ||\n codeword.getRowNumber() >= barcodeMetadata.getRowCount() ||\n rowDifference > codewordsRow) {\n codewords[codewordsRow] = null;\n } else {\n let checkedRows: int;\n if (maxRowHeight > 2) {\n checkedRows = (maxRowHeight - 2) * rowDifference;\n } else {\n checkedRows = rowDifference;\n }\n let closePreviousCodewordFound: boolean = checkedRows >= codewordsRow;\n for (let i /*int*/ = 1; i <= checkedRows && !closePreviousCodewordFound; i++) {\n // there must be (height * rowDifference) number of codewords missing. For now we assume height = 1.\n // This should hopefully get rid of most problems already.\n closePreviousCodewordFound = codewords[codewordsRow - i] != null;\n }\n if (closePreviousCodewordFound) {\n codewords[codewordsRow] = null;\n } else {\n barcodeRow = codeword.getRowNumber();\n currentRowHeight = 1;\n }\n }\n }\n // return (int) (averageRowHeight + 0.5);\n }\n\n getRowHeights(): Int32Array {\n let barcodeMetadata: BarcodeMetadata = this.getBarcodeMetadata();\n if (barcodeMetadata == null) {\n return null;\n }\n this.adjustIncompleteIndicatorColumnRowNumbers(barcodeMetadata);\n let result: Int32Array = new Int32Array(barcodeMetadata.getRowCount());\n for (let codeword /*Codeword*/ of this.getCodewords()) {\n if (codeword != null) {\n let rowNumber: int = codeword.getRowNumber();\n if (rowNumber >= result.length) {\n // We have more rows than the barcode metadata allows for, ignore them.\n continue;\n }\n result[rowNumber]++;\n } // else throw exception?\n }\n return result;\n }\n\n // TODO maybe we should add missing codewords to store the correct row number to make\n // finding row numbers for other columns easier\n // use row height count to make detection of invalid row numbers more reliable\n private adjustIncompleteIndicatorColumnRowNumbers(barcodeMetadata: BarcodeMetadata): void {\n let boundingBox: BoundingBox = this.getBoundingBox();\n let top: ResultPoint = this._isLeft ? boundingBox.getTopLeft() : boundingBox.getTopRight();\n let bottom: ResultPoint = this._isLeft ? boundingBox.getBottomLeft() : boundingBox.getBottomRight();\n let firstRow: int = this.imageRowToCodewordIndex( Math.trunc(top.getY()));\n let lastRow: int = this.imageRowToCodewordIndex( Math.trunc(bottom.getY()));\n // float averageRowHeight = (lastRow - firstRow) / /*(float)*/ barcodeMetadata.getRowCount();\n let codewords: Codeword[] = this.getCodewords();\n let barcodeRow: int = -1;\n let maxRowHeight: int = 1;\n let currentRowHeight: int = 0;\n for (let codewordsRow /*int*/ = firstRow; codewordsRow < lastRow; codewordsRow++) {\n if (codewords[codewordsRow] == null) {\n continue;\n }\n let codeword: Codeword = codewords[codewordsRow];\n\n codeword.setRowNumberAsRowIndicatorColumn();\n\n let rowDifference: int = codeword.getRowNumber() - barcodeRow;\n\n // TODO improve handling with case where first row indicator doesn't start with 0\n\n if (rowDifference === 0) {\n currentRowHeight++;\n } else if (rowDifference === 1) {\n maxRowHeight = Math.max(maxRowHeight, currentRowHeight);\n currentRowHeight = 1;\n barcodeRow = codeword.getRowNumber();\n } else if (codeword.getRowNumber() >= barcodeMetadata.getRowCount()) {\n codewords[codewordsRow] = null;\n } else {\n barcodeRow = codeword.getRowNumber();\n currentRowHeight = 1;\n }\n }\n // return (int) (averageRowHeight + 0.5);\n }\n\n getBarcodeMetadata(): BarcodeMetadata {\n let codewords: Codeword[] = this.getCodewords();\n let barcodeColumnCount: BarcodeValue = new BarcodeValue();\n let barcodeRowCountUpperPart: BarcodeValue = new BarcodeValue();\n let barcodeRowCountLowerPart: BarcodeValue = new BarcodeValue();\n let barcodeECLevel: BarcodeValue = new BarcodeValue();\n for (let codeword /*Codeword*/ of codewords) {\n if (codeword == null) {\n continue;\n }\n codeword.setRowNumberAsRowIndicatorColumn();\n let rowIndicatorValue: int = codeword.getValue() % 30;\n let codewordRowNumber: int = codeword.getRowNumber();\n if (!this._isLeft) {\n codewordRowNumber += 2;\n }\n switch (codewordRowNumber % 3) {\n case 0:\n barcodeRowCountUpperPart.setValue(rowIndicatorValue * 3 + 1);\n break;\n case 1:\n barcodeECLevel.setValue(rowIndicatorValue / 3);\n barcodeRowCountLowerPart.setValue(rowIndicatorValue % 3);\n break;\n case 2:\n barcodeColumnCount.setValue(rowIndicatorValue + 1);\n break;\n }\n }\n // Maybe we should check if we have ambiguous values?\n if ((barcodeColumnCount.getValue().length === 0) ||\n (barcodeRowCountUpperPart.getValue().length === 0) ||\n (barcodeRowCountLowerPart.getValue().length === 0) ||\n (barcodeECLevel.getValue().length === 0) ||\n barcodeColumnCount.getValue()[0] < 1 ||\n barcodeRowCountUpperPart.getValue()[0] + barcodeRowCountLowerPart.getValue()[0] < PDF417Common.MIN_ROWS_IN_BARCODE ||\n barcodeRowCountUpperPart.getValue()[0] + barcodeRowCountLowerPart.getValue()[0] > PDF417Common.MAX_ROWS_IN_BARCODE) {\n return null;\n }\n let barcodeMetadata: BarcodeMetadata = new BarcodeMetadata(barcodeColumnCount.getValue()[0],\n barcodeRowCountUpperPart.getValue()[0], barcodeRowCountLowerPart.getValue()[0], barcodeECLevel.getValue()[0]);\n this.removeIncorrectCodewords(codewords, barcodeMetadata);\n return barcodeMetadata;\n }\n\n private removeIncorrectCodewords(codewords: Codeword[], barcodeMetadata: BarcodeMetadata): void {\n // Remove codewords which do not match the metadata\n // TODO Maybe we should keep the incorrect codewords for the start and end positions?\n for (let codewordRow /*int*/ = 0; codewordRow < codewords.length; codewordRow++) {\n let codeword: Codeword = codewords[codewordRow];\n if (codewords[codewordRow] == null) {\n continue;\n }\n let rowIndicatorValue: int = codeword.getValue() % 30;\n let codewordRowNumber: int = codeword.getRowNumber();\n if (codewordRowNumber > barcodeMetadata.getRowCount()) {\n codewords[codewordRow] = null;\n continue;\n }\n if (!this._isLeft) {\n codewordRowNumber += 2;\n }\n switch (codewordRowNumber % 3) {\n case 0:\n if (rowIndicatorValue * 3 + 1 !== barcodeMetadata.getRowCountUpperPart()) {\n codewords[codewordRow] = null;\n }\n break;\n case 1:\n if (Math.trunc(rowIndicatorValue / 3) !== barcodeMetadata.getErrorCorrectionLevel() ||\n rowIndicatorValue % 3 !== barcodeMetadata.getRowCountLowerPart()) {\n codewords[codewordRow] = null;\n }\n break;\n case 2:\n if (rowIndicatorValue + 1 !== barcodeMetadata.getColumnCount()) {\n codewords[codewordRow] = null;\n }\n break;\n }\n }\n }\n\n isLeft(): boolean {\n return this._isLeft;\n }\n\n // @Override\n public toString(): string {\n return 'IsLeft: ' + this._isLeft + '\\n' + super.toString();\n }\n\n}\n","/*\n * Copyright 2013 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { int } from '../../../customTypings';\n\n// package com.google.zxing.pdf417.decoder;\n\n/**\n * @author Guenther Grau\n */\nexport default /*final*/ class BarcodeMetadata {\n\n private /*final*/ columnCount: int;\n private /*final*/ errorCorrectionLevel: int;\n private /*final*/ rowCountUpperPart: int;\n private /*final*/ rowCountLowerPart: int;\n private /*final*/ rowCount: int;\n\n constructor(columnCount: int, rowCountUpperPart: int, rowCountLowerPart: int, errorCorrectionLevel: int) {\n this.columnCount = columnCount;\n this.errorCorrectionLevel = errorCorrectionLevel;\n this.rowCountUpperPart = rowCountUpperPart;\n this.rowCountLowerPart = rowCountLowerPart;\n this.rowCount = rowCountUpperPart + rowCountLowerPart;\n }\n\n getColumnCount(): int {\n return this.columnCount;\n }\n\n getErrorCorrectionLevel(): int {\n return this.errorCorrectionLevel;\n }\n\n getRowCount(): int {\n return this.rowCount;\n }\n\n getRowCountUpperPart(): int {\n return this.rowCountUpperPart;\n }\n\n getRowCountLowerPart(): int {\n return this.rowCountLowerPart;\n }\n\n}\n","/*\n * Copyright 2013 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// package com.google.zxing.pdf417.decoder;\n\n// import com.google.zxing.pdf417.PDF417Common;\nimport PDF417Common from '../PDF417Common';\n\n// import java.util.Formatter;\n\nimport BoundingBox from './BoundingBox';\nimport BarcodeMetadata from './BarcodeMetadata';\nimport DetectionResultColumn from './DetectionResultColumn';\nimport Codeword from './Codeword';\nimport DetectionResultRowIndicatorColumn from './DetectionResultRowIndicatorColumn';\nimport Formatter from '../../util/Formatter';\n\nimport { int } from '../../../customTypings';\n\n/**\n * @author Guenther Grau\n */\nexport default /*final*/ class DetectionResult {\n\n /*final*/ ADJUST_ROW_NUMBER_SKIP: int = 2;\n\n private /*final*/ barcodeMetadata: BarcodeMetadata;\n private /*final*/ detectionResultColumns: DetectionResultColumn[];\n private boundingBox: BoundingBox;\n private /*final*/ barcodeColumnCount: int;\n\n constructor(barcodeMetadata: BarcodeMetadata, boundingBox: BoundingBox) {\n this.barcodeMetadata = barcodeMetadata;\n this.barcodeColumnCount = barcodeMetadata.getColumnCount();\n this.boundingBox = boundingBox;\n // this.detectionResultColumns = new DetectionResultColumn[this.barcodeColumnCount + 2];\n this.detectionResultColumns = new Array(this.barcodeColumnCount + 2);\n }\n\n getDetectionResultColumns(): DetectionResultColumn[] {\n this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[0]);\n this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[this.barcodeColumnCount + 1]);\n let unadjustedCodewordCount: int = PDF417Common.MAX_CODEWORDS_IN_BARCODE;\n let previousUnadjustedCount: int;\n do {\n previousUnadjustedCount = unadjustedCodewordCount;\n unadjustedCodewordCount = this.adjustRowNumbersAndGetCount();\n } while (unadjustedCodewordCount > 0 && unadjustedCodewordCount < previousUnadjustedCount);\n return this.detectionResultColumns;\n }\n\n private adjustIndicatorColumnRowNumbers(detectionResultColumn: DetectionResultColumn): void {\n if (detectionResultColumn != null) {\n (detectionResultColumn)\n .adjustCompleteIndicatorColumnRowNumbers(this.barcodeMetadata);\n }\n }\n\n // TODO ensure that no detected codewords with unknown row number are left\n // we should be able to estimate the row height and use it as a hint for the row number\n // we should also fill the rows top to bottom and bottom to top\n /**\n * @return number of codewords which don't have a valid row number. Note that the count is not accurate as codewords\n * will be counted several times. It just serves as an indicator to see when we can stop adjusting row numbers\n */\n private adjustRowNumbersAndGetCount(): int {\n let unadjustedCount: int = this.adjustRowNumbersByRow();\n if (unadjustedCount === 0) {\n return 0;\n }\n for (let barcodeColumn /*int*/ = 1; barcodeColumn < this.barcodeColumnCount + 1; barcodeColumn++) {\n let codewords: Codeword[] = this.detectionResultColumns[barcodeColumn].getCodewords();\n for (let codewordsRow /*int*/ = 0; codewordsRow < codewords.length; codewordsRow++) {\n if (codewords[codewordsRow] == null) {\n continue;\n }\n if (!codewords[codewordsRow].hasValidRowNumber()) {\n this.adjustRowNumbers(barcodeColumn, codewordsRow, codewords);\n }\n }\n }\n return unadjustedCount;\n }\n\n private adjustRowNumbersByRow(): int {\n this.adjustRowNumbersFromBothRI();\n // TODO we should only do full row adjustments if row numbers of left and right row indicator column match.\n // Maybe it's even better to calculated the height (rows: d) and divide it by the number of barcode\n // rows. This, together with the LRI and RRI row numbers should allow us to get a good estimate where a row\n // number starts and ends.\n let unadjustedCount: int = this.adjustRowNumbersFromLRI();\n return unadjustedCount + this.adjustRowNumbersFromRRI();\n }\n\n private adjustRowNumbersFromBothRI(): void {\n if (this.detectionResultColumns[0] == null || this.detectionResultColumns[this.barcodeColumnCount + 1] == null) {\n return;\n }\n let LRIcodewords: Codeword[] = this.detectionResultColumns[0].getCodewords();\n let RRIcodewords: Codeword[] = this.detectionResultColumns[this.barcodeColumnCount + 1].getCodewords();\n for (let codewordsRow /*int*/ = 0; codewordsRow < LRIcodewords.length; codewordsRow++) {\n if (LRIcodewords[codewordsRow] != null &&\n RRIcodewords[codewordsRow] != null &&\n LRIcodewords[codewordsRow].getRowNumber() === RRIcodewords[codewordsRow].getRowNumber()) {\n for (let barcodeColumn /*int*/ = 1; barcodeColumn <= this.barcodeColumnCount; barcodeColumn++) {\n let codeword: Codeword = this.detectionResultColumns[barcodeColumn].getCodewords()[codewordsRow];\n if (codeword == null) {\n continue;\n }\n codeword.setRowNumber(LRIcodewords[codewordsRow].getRowNumber());\n if (!codeword.hasValidRowNumber()) {\n this.detectionResultColumns[barcodeColumn].getCodewords()[codewordsRow] = null;\n }\n }\n }\n }\n }\n\n private adjustRowNumbersFromRRI(): int {\n if (this.detectionResultColumns[this.barcodeColumnCount + 1] == null) {\n return 0;\n }\n let unadjustedCount: int = 0;\n let codewords: Codeword[] = this.detectionResultColumns[this.barcodeColumnCount + 1].getCodewords();\n for (let codewordsRow /*int*/ = 0; codewordsRow < codewords.length; codewordsRow++) {\n if (codewords[codewordsRow] == null) {\n continue;\n }\n let rowIndicatorRowNumber: int = codewords[codewordsRow].getRowNumber();\n let invalidRowCounts: int = 0;\n for (let barcodeColumn /*int*/ = this.barcodeColumnCount + 1; barcodeColumn > 0 && invalidRowCounts < this.ADJUST_ROW_NUMBER_SKIP; barcodeColumn--) {\n let codeword: Codeword = this.detectionResultColumns[barcodeColumn].getCodewords()[codewordsRow];\n if (codeword != null) {\n invalidRowCounts = DetectionResult.adjustRowNumberIfValid(rowIndicatorRowNumber, invalidRowCounts, codeword);\n if (!codeword.hasValidRowNumber()) {\n unadjustedCount++;\n }\n }\n }\n }\n return unadjustedCount;\n }\n\n private adjustRowNumbersFromLRI(): int {\n if (this.detectionResultColumns[0] == null) {\n return 0;\n }\n let unadjustedCount: int = 0;\n let codewords: Codeword[] = this.detectionResultColumns[0].getCodewords();\n for (let codewordsRow /*int*/ = 0; codewordsRow < codewords.length; codewordsRow++) {\n if (codewords[codewordsRow] == null) {\n continue;\n }\n let rowIndicatorRowNumber: int = codewords[codewordsRow].getRowNumber();\n let invalidRowCounts: int = 0;\n for (let barcodeColumn /*int*/ = 1; barcodeColumn < this.barcodeColumnCount + 1 && invalidRowCounts < this.ADJUST_ROW_NUMBER_SKIP; barcodeColumn++) {\n let codeword: Codeword = this.detectionResultColumns[barcodeColumn].getCodewords()[codewordsRow];\n if (codeword != null) {\n invalidRowCounts = DetectionResult.adjustRowNumberIfValid(rowIndicatorRowNumber, invalidRowCounts, codeword);\n if (!codeword.hasValidRowNumber()) {\n unadjustedCount++;\n }\n }\n }\n }\n return unadjustedCount;\n }\n\n private static adjustRowNumberIfValid(rowIndicatorRowNumber: int, invalidRowCounts: int, codeword: Codeword): int {\n if (codeword == null) {\n return invalidRowCounts;\n }\n if (!codeword.hasValidRowNumber()) {\n if (codeword.isValidRowNumber(rowIndicatorRowNumber)) {\n codeword.setRowNumber(rowIndicatorRowNumber);\n invalidRowCounts = 0;\n } else {\n ++invalidRowCounts;\n }\n }\n return invalidRowCounts;\n }\n\n private adjustRowNumbers(barcodeColumn: int, codewordsRow: int, codewords: Codeword[]): void {\n let codeword: Codeword = codewords[codewordsRow];\n let previousColumnCodewords: Codeword[] = this.detectionResultColumns[barcodeColumn - 1].getCodewords();\n let nextColumnCodewords: Codeword[] = previousColumnCodewords;\n if (this.detectionResultColumns[barcodeColumn + 1] != null) {\n nextColumnCodewords = this.detectionResultColumns[barcodeColumn + 1].getCodewords();\n }\n\n // let otherCodewords: Codeword[] = new Codeword[14];\n let otherCodewords: Codeword[] = new Array(14);\n\n otherCodewords[2] = previousColumnCodewords[codewordsRow];\n otherCodewords[3] = nextColumnCodewords[codewordsRow];\n\n if (codewordsRow > 0) {\n otherCodewords[0] = codewords[codewordsRow - 1];\n otherCodewords[4] = previousColumnCodewords[codewordsRow - 1];\n otherCodewords[5] = nextColumnCodewords[codewordsRow - 1];\n }\n if (codewordsRow > 1) {\n otherCodewords[8] = codewords[codewordsRow - 2];\n otherCodewords[10] = previousColumnCodewords[codewordsRow - 2];\n otherCodewords[11] = nextColumnCodewords[codewordsRow - 2];\n }\n if (codewordsRow < codewords.length - 1) {\n otherCodewords[1] = codewords[codewordsRow + 1];\n otherCodewords[6] = previousColumnCodewords[codewordsRow + 1];\n otherCodewords[7] = nextColumnCodewords[codewordsRow + 1];\n }\n if (codewordsRow < codewords.length - 2) {\n otherCodewords[9] = codewords[codewordsRow + 2];\n otherCodewords[12] = previousColumnCodewords[codewordsRow + 2];\n otherCodewords[13] = nextColumnCodewords[codewordsRow + 2];\n }\n for (let otherCodeword of otherCodewords) {\n if (DetectionResult.adjustRowNumber(codeword, otherCodeword)) {\n return;\n }\n }\n }\n\n /**\n * @return true, if row number was adjusted, false otherwise\n */\n private static adjustRowNumber(codeword: Codeword, otherCodeword: Codeword): boolean {\n if (otherCodeword == null) {\n return false;\n }\n if (otherCodeword.hasValidRowNumber() && otherCodeword.getBucket() === codeword.getBucket()) {\n codeword.setRowNumber(otherCodeword.getRowNumber());\n return true;\n }\n return false;\n }\n\n getBarcodeColumnCount(): int {\n return this.barcodeColumnCount;\n }\n\n getBarcodeRowCount(): int {\n return this.barcodeMetadata.getRowCount();\n }\n\n getBarcodeECLevel(): int {\n return this.barcodeMetadata.getErrorCorrectionLevel();\n }\n\n setBoundingBox(boundingBox: BoundingBox): void {\n this.boundingBox = boundingBox;\n }\n\n getBoundingBox(): BoundingBox {\n return this.boundingBox;\n }\n\n setDetectionResultColumn(barcodeColumn: int, detectionResultColumn: DetectionResultColumn): void {\n this.detectionResultColumns[barcodeColumn] = detectionResultColumn;\n }\n\n getDetectionResultColumn(barcodeColumn: int): DetectionResultColumn {\n return this.detectionResultColumns[barcodeColumn];\n }\n\n // @Override\n public toString(): String {\n let rowIndicatorColumn: DetectionResultColumn = this.detectionResultColumns[0];\n if (rowIndicatorColumn == null) {\n rowIndicatorColumn = this.detectionResultColumns[this.barcodeColumnCount + 1];\n }\n // try (\n let formatter: Formatter = new Formatter();\n // ) {\n for (let codewordsRow /*int*/ = 0; codewordsRow < rowIndicatorColumn.getCodewords().length; codewordsRow++) {\n formatter.format('CW %3d:', codewordsRow);\n for (let barcodeColumn /*int*/ = 0; barcodeColumn < this.barcodeColumnCount + 2; barcodeColumn++) {\n if (this.detectionResultColumns[barcodeColumn] == null) {\n formatter.format(' | ');\n continue;\n }\n let codeword: Codeword = this.detectionResultColumns[barcodeColumn].getCodewords()[codewordsRow];\n if (codeword == null) {\n formatter.format(' | ');\n continue;\n }\n formatter.format(' %3d|%3d', codeword.getRowNumber(), codeword.getValue());\n }\n formatter.format('%n');\n }\n return formatter.toString();\n // }\n }\n\n}\n","/*\n * Copyright 2013 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { int } from '../../../customTypings';\n\n// package com.google.zxing.pdf417.decoder;\n\n/**\n * @author Guenther Grau\n */\nexport default /*final*/ class Codeword {\n\n private static /*final*/ BARCODE_ROW_UNKNOWN: int = -1;\n\n private /*final*/ startX: int;\n private /*final*/ endX: int;\n private /*final*/ bucket: int;\n private /*final*/ value: int;\n private rowNumber: int = Codeword.BARCODE_ROW_UNKNOWN;\n\n constructor(startX: int, endX: int, bucket: int, value: int) {\n this.startX = Math.trunc(startX);\n this.endX = Math.trunc(endX);\n this.bucket = Math.trunc(bucket);\n this.value = Math.trunc(value);\n }\n\n hasValidRowNumber(): boolean {\n return this.isValidRowNumber(this.rowNumber);\n }\n\n isValidRowNumber(rowNumber: int): boolean {\n return rowNumber !== Codeword.BARCODE_ROW_UNKNOWN && this.bucket === (rowNumber % 3) * 3;\n }\n\n setRowNumberAsRowIndicatorColumn(): void {\n this.rowNumber = Math.trunc((Math.trunc(this.value / 30)) * 3 + Math.trunc(this.bucket / 3));\n }\n\n getWidth(): int {\n return this.endX - this.startX;\n }\n\n getStartX(): int {\n return this.startX;\n }\n\n getEndX(): int {\n return this.endX;\n }\n\n getBucket(): int {\n return this.bucket;\n }\n\n getValue(): int {\n return this.value;\n }\n\n getRowNumber(): int {\n return this.rowNumber;\n }\n\n setRowNumber(rowNumber: int ): void {\n this.rowNumber = rowNumber;\n }\n\n// @Override\n public toString(): string {\n return this.rowNumber + '|' + this.value;\n }\n\n}\n","/*\n* Copyright 2013 ZXing authors\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n// package com.google.zxing.pdf417.decoder;\n\n// import com.google.zxing.common.detector.MathUtils;\nimport MathUtils from '../../common/detector/MathUtils';\n// import com.google.zxing.pdf417.PDF417Common;\nimport PDF417Common from '../PDF417Common';\n\nimport Float from '../../util/Float';\nimport { int, float } from '../../../customTypings';\n\n/**\n * @author Guenther Grau\n * @author creatale GmbH (christoph.schulz@creatale.de)\n */\nexport default /*final*/ class PDF417CodewordDecoder {\n\n // flag that the table is ready for use\n private static bSymbolTableReady: boolean = false;\n\n private static /*final float[][]*/ RATIOS_TABLE: number[][] =\n new Array(PDF417Common.SYMBOL_TABLE.length).map(x => x = new Array(PDF417Common.BARS_IN_MODULE));\n\n /* @note\n * this action have to be performed before first use of class\n * - static constructor\n * working with 32bit float (based from Java logic)\n */\n static initialize() {\n // Pre-computes the symbol ratio table.\n for (/*int*/let i = 0; i < PDF417Common.SYMBOL_TABLE.length; i++) {\n let currentSymbol: int = PDF417Common.SYMBOL_TABLE[i];\n let currentBit: int = currentSymbol & 0x1;\n for (/*int*/ let j = 0; j < PDF417Common.BARS_IN_MODULE; j++) {\n let size: float = 0.0;\n while ((currentSymbol & 0x1) === currentBit) {\n size += 1.0;\n currentSymbol >>= 1;\n }\n currentBit = currentSymbol & 0x1;\n if (!PDF417CodewordDecoder.RATIOS_TABLE[i]) {\n PDF417CodewordDecoder.RATIOS_TABLE[i] = new Array(PDF417Common.BARS_IN_MODULE);\n }\n PDF417CodewordDecoder.RATIOS_TABLE[i][PDF417Common.BARS_IN_MODULE - j - 1] = Math.fround(size / PDF417Common.MODULES_IN_CODEWORD);\n }\n }\n this.bSymbolTableReady = true;\n }\n\n static getDecodedValue(moduleBitCount: Int32Array): int {\n let decodedValue: int = PDF417CodewordDecoder.getDecodedCodewordValue(PDF417CodewordDecoder.sampleBitCounts(moduleBitCount));\n if (decodedValue !== -1) {\n return decodedValue;\n }\n return PDF417CodewordDecoder.getClosestDecodedValue(moduleBitCount);\n }\n\n private static sampleBitCounts(moduleBitCount: Int32Array): Int32Array {\n let bitCountSum: float = MathUtils.sum(moduleBitCount);\n let result: Int32Array = new Int32Array(PDF417Common.BARS_IN_MODULE);\n let bitCountIndex: int = 0;\n let sumPreviousBits: int = 0;\n for (/*int*/ let i = 0; i < PDF417Common.MODULES_IN_CODEWORD; i++) {\n let sampleIndex: float =\n bitCountSum / (2 * PDF417Common.MODULES_IN_CODEWORD) +\n (i * bitCountSum) / PDF417Common.MODULES_IN_CODEWORD;\n if (sumPreviousBits + moduleBitCount[bitCountIndex] <= sampleIndex) {\n sumPreviousBits += moduleBitCount[bitCountIndex];\n bitCountIndex++;\n }\n result[bitCountIndex]++;\n }\n return result;\n }\n\n private static getDecodedCodewordValue(moduleBitCount: Int32Array): int {\n let decodedValue: int = PDF417CodewordDecoder.getBitValue(moduleBitCount);\n return PDF417Common.getCodeword(decodedValue) === -1 ? -1 : decodedValue;\n }\n\n private static getBitValue(moduleBitCount: Int32Array): int {\n let result: /*long*/ number = 0;\n for (let /*int*/ i = 0; i < moduleBitCount.length; i++) {\n for (/*int*/ let bit = 0; bit < moduleBitCount[i]; bit++) {\n result = (result << 1) | (i % 2 === 0 ? 1 : 0);\n }\n }\n return Math.trunc(result);\n }\n\n // working with 32bit float (as in Java)\n private static getClosestDecodedValue(moduleBitCount: Int32Array): int {\n let bitCountSum: int = MathUtils.sum(moduleBitCount);\n let bitCountRatios: float[] = new Array(PDF417Common.BARS_IN_MODULE);\n if (bitCountSum > 1) {\n for (let /*int*/ i = 0; i < bitCountRatios.length; i++) {\n bitCountRatios[i] = Math.fround(moduleBitCount[i] / bitCountSum);\n }\n }\n let bestMatchError: float = Float.MAX_VALUE;\n let bestMatch: int = -1;\n if (!this.bSymbolTableReady) {\n PDF417CodewordDecoder.initialize();\n }\n for (/*int*/ let j = 0; j < PDF417CodewordDecoder.RATIOS_TABLE.length; j++) {\n let error: float = 0.0;\n let ratioTableRow: float[] = PDF417CodewordDecoder.RATIOS_TABLE[j];\n for (/*int*/ let k = 0; k < PDF417Common.BARS_IN_MODULE; k++) {\n let diff: float = Math.fround(ratioTableRow[k] - bitCountRatios[k]);\n error += Math.fround(diff * diff);\n if (error >= bestMatchError) {\n break;\n }\n }\n if (error < bestMatchError) {\n bestMatchError = error;\n bestMatch = PDF417Common.SYMBOL_TABLE[j];\n }\n }\n return bestMatch;\n }\n\n}\n","/*\n * Copyright 2009 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// package com.google.zxing.pdf417.decoder;\n\n// import com.google.zxing.FormatException;\nimport FormatException from '../../FormatException';\n// import com.google.zxing.common.CharacterSetECI;\nimport CharacterSetECI from '../../common/CharacterSetECI';\n// import com.google.zxing.common.DecoderResult;\nimport DecoderResult from '../../common/DecoderResult';\n// import com.google.zxing.pdf417.PDF417ResultMetadata;\nimport PDF417ResultMetadata from '../PDF417ResultMetadata';\n\n// import java.io.ByteArrayOutputStream;\n// import java.math.BigInteger;\n// import java.nio.charset.Charset;\n// import java.nio.charset.StandardCharsets;\n// import java.util.Arrays;\nimport Arrays from '../../util/Arrays';\n\nimport StringBuilder from '../../util/StringBuilder';\nimport Integer from '../../util/Integer';\nimport Long from '../../util/Long';\nimport ByteArrayOutputStream from '../../util/ByteArrayOutputStream';\nimport StringEncoding from '../../util/StringEncoding';\n\nimport { int } from '../../../customTypings';\n\n\n/*private*/ enum Mode {\n ALPHA,\n LOWER,\n MIXED,\n PUNCT,\n ALPHA_SHIFT,\n PUNCT_SHIFT\n}\n\n/**\n * Indirectly access the global BigInt constructor, it\n * allows browsers that doesn't support BigInt to run\n * the library without breaking due to \"undefined BigInt\"\n * errors.\n */\nfunction getBigIntConstructor(): BigIntConstructor {\n\n if (typeof window !== 'undefined') {\n return window['BigInt'] || null;\n }\n\n if (typeof global !== 'undefined') {\n return global['BigInt'] || null;\n }\n\n throw new Error('Can\\'t search globals for BigInt!');\n}\n\n/**\n * Used to store the BigInt constructor.\n */\nlet BigInteger: BigIntConstructor;\n\n/**\n * This function creates a bigint value. It allows browsers\n * that doesn't support BigInt to run the rest of the library\n * by not directly accessing the BigInt constructor.\n */\nfunction createBigInt(num: number | string | bigint): bigint {\n\n if (typeof BigInteger === 'undefined') {\n BigInteger = getBigIntConstructor();\n }\n\n if (BigInteger === null) {\n throw new Error('BigInt is not supported!');\n }\n\n return BigInteger(num);\n}\n\nfunction getEXP900(): bigint[] {\n // in Java - array with length = 16\n let EXP900 = [];\n\n EXP900[0] = createBigInt(1);\n\n let nineHundred = createBigInt(900);\n\n EXP900[1] = nineHundred;\n\n // in Java - array with length = 16\n for (let i /*int*/ = 2; i < 16; i++) {\n EXP900[i] = EXP900[i - 1] * nineHundred;\n }\n\n return EXP900;\n}\n\n/**\n *

This class contains the methods for decoding the PDF417 codewords.

\n *\n * @author SITA Lab (kevin.osullivan@sita.aero)\n * @author Guenther Grau\n */\nexport default /*final*/ class DecodedBitStreamParser {\n\n private static /*final*/ TEXT_COMPACTION_MODE_LATCH: int = 900;\n private static /*final*/ BYTE_COMPACTION_MODE_LATCH: int = 901;\n private static /*final*/ NUMERIC_COMPACTION_MODE_LATCH: int = 902;\n private static /*final*/ BYTE_COMPACTION_MODE_LATCH_6: int = 924;\n private static /*final*/ ECI_USER_DEFINED: int = 925;\n private static /*final*/ ECI_GENERAL_PURPOSE: int = 926;\n private static /*final*/ ECI_CHARSET: int = 927;\n private static /*final*/ BEGIN_MACRO_PDF417_CONTROL_BLOCK: int = 928;\n private static /*final*/ BEGIN_MACRO_PDF417_OPTIONAL_FIELD: int = 923;\n private static /*final*/ MACRO_PDF417_TERMINATOR: int = 922;\n private static /*final*/ MODE_SHIFT_TO_BYTE_COMPACTION_MODE: int = 913;\n private static /*final*/ MAX_NUMERIC_CODEWORDS: int = 15;\n\n private static /*final*/ MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME: int = 0;\n private static /*final*/ MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT: int = 1;\n private static /*final*/ MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP: int = 2;\n private static /*final*/ MACRO_PDF417_OPTIONAL_FIELD_SENDER: int = 3;\n private static /*final*/ MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE: int = 4;\n private static /*final*/ MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE: int = 5;\n private static /*final*/ MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM: int = 6;\n\n private static /*final*/ PL: int = 25;\n private static /*final*/ LL: int = 27;\n private static /*final*/ AS: int = 27;\n private static /*final*/ ML: int = 28;\n private static /*final*/ AL: int = 28;\n private static /*final*/ PS: int = 29;\n private static /*final*/ PAL: int = 29;\n\n private static /*final*/ PUNCT_CHARS: string =\n ';<>@[\\\\]_`~!\\r\\t,:\\n-.$/\"|*()?{}\\'';\n\n private static /*final*/ MIXED_CHARS: string =\n '0123456789&\\r\\t,:#-.$/+%*=^';\n\n /**\n * Table containing values for the exponent of 900.\n * This is used in the numeric compaction decode algorithm.\n */\n private static /*final*/ EXP900: bigint[] = getBigIntConstructor() ? getEXP900() : [];\n\n private static /*final*/ NUMBER_OF_SEQUENCE_CODEWORDS: int = 2;\n\n // private DecodedBitStreamParser() {\n // }\n\n /**\n *\n * @param codewords\n * @param ecLevel\n *\n * @throws FormatException\n */\n static decode(codewords: Int32Array, ecLevel: string): DecoderResult {\n // pass encoding to result (will be used for decode symbols in byte mode)\n let result: StringBuilder = new StringBuilder('');\n // let encoding: Charset = StandardCharsets.ISO_8859_1;\n let encoding = CharacterSetECI.ISO8859_1;\n /**\n * @note the next command is specific from this TypeScript library\n * because TS can't properly cast some values to char and\n * convert it to string later correctly due to encoding\n * differences from Java version. As reported here:\n * https://github.com/zxing-js/library/pull/264/files#r382831593\n */\n result.enableDecoding(encoding);\n // Get compaction mode\n let codeIndex: int = 1;\n let code: int = codewords[codeIndex++];\n let resultMetadata: PDF417ResultMetadata = new PDF417ResultMetadata();\n while (codeIndex < codewords[0]) {\n switch (code) {\n case DecodedBitStreamParser.TEXT_COMPACTION_MODE_LATCH:\n codeIndex = DecodedBitStreamParser.textCompaction(codewords, codeIndex, result);\n break;\n case DecodedBitStreamParser.BYTE_COMPACTION_MODE_LATCH:\n case DecodedBitStreamParser.BYTE_COMPACTION_MODE_LATCH_6:\n codeIndex = DecodedBitStreamParser.byteCompaction(code, codewords, encoding, codeIndex, result);\n break;\n case DecodedBitStreamParser.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:\n result.append(/*(char)*/ codewords[codeIndex++]);\n break;\n case DecodedBitStreamParser.NUMERIC_COMPACTION_MODE_LATCH:\n codeIndex = DecodedBitStreamParser.numericCompaction(codewords, codeIndex, result);\n break;\n case DecodedBitStreamParser.ECI_CHARSET:\n let charsetECI: CharacterSetECI =\n CharacterSetECI.getCharacterSetECIByValue(codewords[codeIndex++]);\n // encoding = Charset.forName(charsetECI.getName());\n break;\n case DecodedBitStreamParser.ECI_GENERAL_PURPOSE:\n // Can't do anything with generic ECI; skip its 2 characters\n codeIndex += 2;\n break;\n case DecodedBitStreamParser.ECI_USER_DEFINED:\n // Can't do anything with user ECI; skip its 1 character\n codeIndex++;\n break;\n case DecodedBitStreamParser.BEGIN_MACRO_PDF417_CONTROL_BLOCK:\n codeIndex = DecodedBitStreamParser.decodeMacroBlock(codewords, codeIndex, resultMetadata);\n break;\n case DecodedBitStreamParser.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:\n case DecodedBitStreamParser.MACRO_PDF417_TERMINATOR:\n // Should not see these outside a macro block\n throw new FormatException();\n default:\n // Default to text compaction. During testing numerous barcodes\n // appeared to be missing the starting mode. In these cases defaulting\n // to text compaction seems to work.\n codeIndex--;\n codeIndex = DecodedBitStreamParser.textCompaction(codewords, codeIndex, result);\n break;\n }\n if (codeIndex < codewords.length) {\n code = codewords[codeIndex++];\n } else {\n throw FormatException.getFormatInstance();\n }\n }\n if (result.length() === 0) {\n throw FormatException.getFormatInstance();\n }\n let decoderResult: DecoderResult = new DecoderResult(null, result.toString(), null, ecLevel);\n decoderResult.setOther(resultMetadata);\n return decoderResult;\n }\n\n /**\n *\n * @param int\n * @param param1\n * @param codewords\n * @param int\n * @param codeIndex\n * @param PDF417ResultMetadata\n * @param resultMetadata\n *\n * @throws FormatException\n */\n // @SuppressWarnings(\"deprecation\")\n static decodeMacroBlock(codewords: Int32Array, codeIndex: int, resultMetadata: PDF417ResultMetadata): int {\n if (codeIndex + DecodedBitStreamParser.NUMBER_OF_SEQUENCE_CODEWORDS > codewords[0]) {\n // we must have at least two bytes left for the segment index\n throw FormatException.getFormatInstance();\n }\n let segmentIndexArray: Int32Array = new Int32Array(DecodedBitStreamParser.NUMBER_OF_SEQUENCE_CODEWORDS);\n for (let i /*int*/ = 0; i < DecodedBitStreamParser.NUMBER_OF_SEQUENCE_CODEWORDS; i++, codeIndex++) {\n segmentIndexArray[i] = codewords[codeIndex];\n }\n resultMetadata.setSegmentIndex(Integer.parseInt(DecodedBitStreamParser.decodeBase900toBase10(segmentIndexArray,\n DecodedBitStreamParser.NUMBER_OF_SEQUENCE_CODEWORDS)));\n\n let fileId: StringBuilder = new StringBuilder();\n codeIndex = DecodedBitStreamParser.textCompaction(codewords, codeIndex, fileId);\n resultMetadata.setFileId(fileId.toString());\n\n let optionalFieldsStart: int = -1;\n if (codewords[codeIndex] === DecodedBitStreamParser.BEGIN_MACRO_PDF417_OPTIONAL_FIELD) {\n optionalFieldsStart = codeIndex + 1;\n }\n\n while (codeIndex < codewords[0]) {\n switch (codewords[codeIndex]) {\n case DecodedBitStreamParser.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:\n codeIndex++;\n switch (codewords[codeIndex]) {\n case DecodedBitStreamParser.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME:\n let fileName: StringBuilder = new StringBuilder();\n codeIndex = DecodedBitStreamParser.textCompaction(codewords, codeIndex + 1, fileName);\n resultMetadata.setFileName(fileName.toString());\n break;\n case DecodedBitStreamParser.MACRO_PDF417_OPTIONAL_FIELD_SENDER:\n let sender: StringBuilder = new StringBuilder();\n codeIndex = DecodedBitStreamParser.textCompaction(codewords, codeIndex + 1, sender);\n resultMetadata.setSender(sender.toString());\n break;\n case DecodedBitStreamParser.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE:\n let addressee: StringBuilder = new StringBuilder();\n codeIndex = DecodedBitStreamParser.textCompaction(codewords, codeIndex + 1, addressee);\n resultMetadata.setAddressee(addressee.toString());\n break;\n case DecodedBitStreamParser.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT:\n let segmentCount: StringBuilder = new StringBuilder();\n codeIndex = DecodedBitStreamParser.numericCompaction(codewords, codeIndex + 1, segmentCount);\n resultMetadata.setSegmentCount(Integer.parseInt(segmentCount.toString()));\n break;\n case DecodedBitStreamParser.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP:\n let timestamp: StringBuilder = new StringBuilder();\n codeIndex = DecodedBitStreamParser.numericCompaction(codewords, codeIndex + 1, timestamp);\n resultMetadata.setTimestamp(Long.parseLong(timestamp.toString()));\n break;\n case DecodedBitStreamParser.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM:\n let checksum: StringBuilder = new StringBuilder();\n codeIndex = DecodedBitStreamParser.numericCompaction(codewords, codeIndex + 1, checksum);\n resultMetadata.setChecksum(Integer.parseInt(checksum.toString()));\n break;\n case DecodedBitStreamParser.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE:\n let fileSize: StringBuilder = new StringBuilder();\n codeIndex = DecodedBitStreamParser.numericCompaction(codewords, codeIndex + 1, fileSize);\n resultMetadata.setFileSize(Long.parseLong(fileSize.toString()));\n break;\n default:\n throw FormatException.getFormatInstance();\n }\n break;\n case DecodedBitStreamParser.MACRO_PDF417_TERMINATOR:\n codeIndex++;\n resultMetadata.setLastSegment(true);\n break;\n default:\n throw FormatException.getFormatInstance();\n }\n }\n\n // copy optional fields to additional options\n if (optionalFieldsStart !== -1) {\n let optionalFieldsLength: int = codeIndex - optionalFieldsStart;\n if (resultMetadata.isLastSegment()) {\n // do not include terminator\n optionalFieldsLength--;\n }\n resultMetadata.setOptionalData(Arrays.copyOfRange(codewords, optionalFieldsStart, optionalFieldsStart + optionalFieldsLength));\n }\n\n return codeIndex;\n }\n\n /**\n * Text Compaction mode (see 5.4.1.5) permits all printable ASCII characters to be\n * encoded, i.e. values 32 - 126 inclusive in accordance with ISO/IEC 646 (IRV), as\n * well as selected control characters.\n *\n * @param codewords The array of codewords (data + error)\n * @param codeIndex The current index into the codeword array.\n * @param result The decoded data is appended to the result.\n * @return The next index into the codeword array.\n */\n private static textCompaction(codewords: Int32Array, codeIndex: int, result: StringBuilder): int {\n // 2 character per codeword\n let textCompactionData: Int32Array = new Int32Array((codewords[0] - codeIndex) * 2);\n // Used to hold the byte compaction value if there is a mode shift\n let byteCompactionData: Int32Array = new Int32Array((codewords[0] - codeIndex) * 2);\n\n let index: int = 0;\n let end: boolean = false;\n while ((codeIndex < codewords[0]) && !end) {\n let code: int = codewords[codeIndex++];\n if (code < DecodedBitStreamParser.TEXT_COMPACTION_MODE_LATCH) {\n textCompactionData[index] = code / 30;\n textCompactionData[index + 1] = code % 30;\n index += 2;\n } else {\n switch (code) {\n case DecodedBitStreamParser.TEXT_COMPACTION_MODE_LATCH:\n // reinitialize text compaction mode to alpha sub mode\n textCompactionData[index++] = DecodedBitStreamParser.TEXT_COMPACTION_MODE_LATCH;\n break;\n case DecodedBitStreamParser.BYTE_COMPACTION_MODE_LATCH:\n case DecodedBitStreamParser.BYTE_COMPACTION_MODE_LATCH_6:\n case DecodedBitStreamParser.NUMERIC_COMPACTION_MODE_LATCH:\n case DecodedBitStreamParser.BEGIN_MACRO_PDF417_CONTROL_BLOCK:\n case DecodedBitStreamParser.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:\n case DecodedBitStreamParser.MACRO_PDF417_TERMINATOR:\n codeIndex--;\n end = true;\n break;\n case DecodedBitStreamParser.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:\n // The Mode Shift codeword 913 shall cause a temporary\n // switch from Text Compaction mode to Byte Compaction mode.\n // This switch shall be in effect for only the next codeword,\n // after which the mode shall revert to the prevailing sub-mode\n // of the Text Compaction mode. Codeword 913 is only available\n // in Text Compaction mode; its use is described in 5.4.2.4.\n textCompactionData[index] = DecodedBitStreamParser.MODE_SHIFT_TO_BYTE_COMPACTION_MODE;\n code = codewords[codeIndex++];\n byteCompactionData[index] = code;\n index++;\n break;\n }\n }\n }\n DecodedBitStreamParser.decodeTextCompaction(textCompactionData, byteCompactionData, index, result);\n return codeIndex;\n }\n\n /**\n * The Text Compaction mode includes all the printable ASCII characters\n * (i.e. values from 32 to 126) and three ASCII control characters: HT or tab\n * (9: e), LF or line feed (10: e), and CR or carriage\n * return (13: e). The Text Compaction mode also includes various latch\n * and shift characters which are used exclusively within the mode. The Text\n * Compaction mode encodes up to 2 characters per codeword. The compaction rules\n * for converting data into PDF417 codewords are defined in 5.4.2.2. The sub-mode\n * switches are defined in 5.4.2.3.\n *\n * @param textCompactionData The text compaction data.\n * @param byteCompactionData The byte compaction data if there\n * was a mode shift.\n * @param length The size of the text compaction and byte compaction data.\n * @param result The decoded data is appended to the result.\n */\n private static decodeTextCompaction(textCompactionData: Int32Array,\n byteCompactionData: Int32Array,\n length: int,\n result: StringBuilder): void {\n // Beginning from an initial state of the Alpha sub-mode\n // The default compaction mode for PDF417 in effect at the start of each symbol shall always be Text\n // Compaction mode Alpha sub-mode (alphabetic: uppercase). A latch codeword from another mode to the Text\n // Compaction mode shall always switch to the Text Compaction Alpha sub-mode.\n let subMode: Mode = Mode.ALPHA;\n let priorToShiftMode: Mode = Mode.ALPHA;\n let i: int = 0;\n while (i < length) {\n let subModeCh: int = textCompactionData[i];\n let ch: /*char*/ string = '';\n switch (subMode) {\n case Mode.ALPHA:\n // Alpha (alphabetic: uppercase)\n if (subModeCh < 26) {\n // Upper case Alpha Character\n // Note: 65 = 'A' ASCII -> there is byte code of symbol\n ch = /*(char)('A' + subModeCh) */ String.fromCharCode(65 + subModeCh);\n } else {\n switch (subModeCh) {\n case 26:\n ch = ' ';\n break;\n case DecodedBitStreamParser.LL:\n subMode = Mode.LOWER;\n break;\n case DecodedBitStreamParser.ML:\n subMode = Mode.MIXED;\n break;\n case DecodedBitStreamParser.PS:\n // Shift to punctuation\n priorToShiftMode = subMode;\n subMode = Mode.PUNCT_SHIFT;\n break;\n case DecodedBitStreamParser.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:\n result.append(/*(char)*/ byteCompactionData[i]);\n break;\n case DecodedBitStreamParser.TEXT_COMPACTION_MODE_LATCH:\n subMode = Mode.ALPHA;\n break;\n }\n }\n break;\n\n case Mode.LOWER:\n // Lower (alphabetic: lowercase)\n if (subModeCh < 26) {\n ch = /*(char)('a' + subModeCh)*/String.fromCharCode(97 + subModeCh);\n } else {\n switch (subModeCh) {\n case 26:\n ch = ' ';\n break;\n case DecodedBitStreamParser.AS:\n // Shift to alpha\n priorToShiftMode = subMode;\n subMode = Mode.ALPHA_SHIFT;\n break;\n case DecodedBitStreamParser.ML:\n subMode = Mode.MIXED;\n break;\n case DecodedBitStreamParser.PS:\n // Shift to punctuation\n priorToShiftMode = subMode;\n subMode = Mode.PUNCT_SHIFT;\n break;\n case DecodedBitStreamParser.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:\n // TODO Does this need to use the current character encoding? See other occurrences below\n result.append(/*(char)*/ byteCompactionData[i]);\n break;\n case DecodedBitStreamParser.TEXT_COMPACTION_MODE_LATCH:\n subMode = Mode.ALPHA;\n break;\n }\n }\n break;\n\n case Mode.MIXED:\n // Mixed (punctuation: e)\n if (subModeCh < DecodedBitStreamParser.PL) {\n ch = DecodedBitStreamParser.MIXED_CHARS[subModeCh];\n } else {\n switch (subModeCh) {\n case DecodedBitStreamParser.PL:\n subMode = Mode.PUNCT;\n break;\n case 26:\n ch = ' ';\n break;\n case DecodedBitStreamParser.LL:\n subMode = Mode.LOWER;\n break;\n case DecodedBitStreamParser.AL:\n subMode = Mode.ALPHA;\n break;\n case DecodedBitStreamParser.PS:\n // Shift to punctuation\n priorToShiftMode = subMode;\n subMode = Mode.PUNCT_SHIFT;\n break;\n case DecodedBitStreamParser.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:\n result.append(/*(char)*/ byteCompactionData[i]);\n break;\n case DecodedBitStreamParser.TEXT_COMPACTION_MODE_LATCH:\n subMode = Mode.ALPHA;\n break;\n }\n }\n break;\n\n case Mode.PUNCT:\n // Punctuation\n if (subModeCh < DecodedBitStreamParser.PAL) {\n ch = DecodedBitStreamParser.PUNCT_CHARS[subModeCh];\n } else {\n switch (subModeCh) {\n case DecodedBitStreamParser.PAL:\n subMode = Mode.ALPHA;\n break;\n case DecodedBitStreamParser.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:\n result.append(/*(char)*/ byteCompactionData[i]);\n break;\n case DecodedBitStreamParser.TEXT_COMPACTION_MODE_LATCH:\n subMode = Mode.ALPHA;\n break;\n }\n }\n break;\n\n case Mode.ALPHA_SHIFT:\n // Restore sub-mode\n subMode = priorToShiftMode;\n if (subModeCh < 26) {\n ch = /*(char)('A' + subModeCh)*/ String.fromCharCode(65 + subModeCh);\n } else {\n switch (subModeCh) {\n case 26:\n ch = ' ';\n break;\n case DecodedBitStreamParser.TEXT_COMPACTION_MODE_LATCH:\n subMode = Mode.ALPHA;\n break;\n }\n }\n break;\n\n case Mode.PUNCT_SHIFT:\n // Restore sub-mode\n subMode = priorToShiftMode;\n if (subModeCh < DecodedBitStreamParser.PAL) {\n ch = DecodedBitStreamParser.PUNCT_CHARS[subModeCh];\n } else {\n switch (subModeCh) {\n case DecodedBitStreamParser.PAL:\n subMode = Mode.ALPHA;\n break;\n case DecodedBitStreamParser.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:\n // PS before Shift-to-Byte is used as a padding character,\n // see 5.4.2.4 of the specification\n result.append(/*(char)*/ byteCompactionData[i]);\n break;\n case DecodedBitStreamParser.TEXT_COMPACTION_MODE_LATCH:\n subMode = Mode.ALPHA;\n break;\n }\n }\n break;\n }\n // if (ch !== 0) {\n if (ch !== '') {\n // Append decoded character to result\n result.append(ch);\n }\n i++;\n }\n }\n\n /**\n * Byte Compaction mode (see 5.4.3) permits all 256 possible 8-bit byte values to be encoded.\n * This includes all ASCII characters value 0 to 127 inclusive and provides for international\n * character set support.\n *\n * @param mode The byte compaction mode i.e. 901 or 924\n * @param codewords The array of codewords (data + error)\n * @param encoding Currently active character encoding\n * @param codeIndex The current index into the codeword array.\n * @param result The decoded data is appended to the result.\n * @return The next index into the codeword array.\n */\n private static /*int*/ byteCompaction(mode: int,\n codewords: Int32Array,\n encoding: /*Charset*/ CharacterSetECI,\n codeIndex: int,\n result: StringBuilder) {\n let decodedBytes: ByteArrayOutputStream = new ByteArrayOutputStream();\n let count: int = 0;\n let value: /*long*/ number = 0;\n let end: boolean = false;\n\n switch (mode) {\n case DecodedBitStreamParser.BYTE_COMPACTION_MODE_LATCH:\n // Total number of Byte Compaction characters to be encoded\n // is not a multiple of 6\n\n let byteCompactedCodewords: Int32Array = new Int32Array(6);\n let nextCode: int = codewords[codeIndex++];\n while ((codeIndex < codewords[0]) && !end) {\n byteCompactedCodewords[count++] = nextCode;\n // Base 900\n value = 900 * value + nextCode;\n nextCode = codewords[codeIndex++];\n // perhaps it should be ok to check only nextCode >= TEXT_COMPACTION_MODE_LATCH\n switch (nextCode) {\n case DecodedBitStreamParser.TEXT_COMPACTION_MODE_LATCH:\n case DecodedBitStreamParser.BYTE_COMPACTION_MODE_LATCH:\n case DecodedBitStreamParser.NUMERIC_COMPACTION_MODE_LATCH:\n case DecodedBitStreamParser.BYTE_COMPACTION_MODE_LATCH_6:\n case DecodedBitStreamParser.BEGIN_MACRO_PDF417_CONTROL_BLOCK:\n case DecodedBitStreamParser.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:\n case DecodedBitStreamParser.MACRO_PDF417_TERMINATOR:\n codeIndex--;\n end = true;\n break;\n default:\n if ((count % 5 === 0) && (count > 0)) {\n // Decode every 5 codewords\n // Convert to Base 256\n for (let j /*int*/ = 0; j < 6; ++j) {\n /* @note\n * JavaScript stores numbers as 64 bits floating point numbers, but all bitwise operations are performed on 32 bits binary numbers.\n * So the next bitwise operation could not be done with simple numbers\n */\n decodedBytes.write(/*(byte)*/Number(createBigInt(value) >> createBigInt(8 * (5 - j))));\n }\n value = 0;\n count = 0;\n }\n break;\n }\n }\n\n // if the end of all codewords is reached the last codeword needs to be added\n if (codeIndex === codewords[0] && nextCode < DecodedBitStreamParser.TEXT_COMPACTION_MODE_LATCH) {\n byteCompactedCodewords[count++] = nextCode;\n }\n\n // If Byte Compaction mode is invoked with codeword 901,\n // the last group of codewords is interpreted directly\n // as one byte per codeword, without compaction.\n for (let i /*int*/ = 0; i < count; i++) {\n decodedBytes.write(/*(byte)*/ byteCompactedCodewords[i]);\n }\n\n break;\n\n case DecodedBitStreamParser.BYTE_COMPACTION_MODE_LATCH_6:\n // Total number of Byte Compaction characters to be encoded\n // is an integer multiple of 6\n while (codeIndex < codewords[0] && !end) {\n let code: int = codewords[codeIndex++];\n if (code < DecodedBitStreamParser.TEXT_COMPACTION_MODE_LATCH) {\n count++;\n // Base 900\n value = 900 * value + code;\n } else {\n switch (code) {\n case DecodedBitStreamParser.TEXT_COMPACTION_MODE_LATCH:\n case DecodedBitStreamParser.BYTE_COMPACTION_MODE_LATCH:\n case DecodedBitStreamParser.NUMERIC_COMPACTION_MODE_LATCH:\n case DecodedBitStreamParser.BYTE_COMPACTION_MODE_LATCH_6:\n case DecodedBitStreamParser.BEGIN_MACRO_PDF417_CONTROL_BLOCK:\n case DecodedBitStreamParser.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:\n case DecodedBitStreamParser.MACRO_PDF417_TERMINATOR:\n codeIndex--;\n end = true;\n break;\n }\n }\n if ((count % 5 === 0) && (count > 0)) {\n // Decode every 5 codewords\n // Convert to Base 256\n /* @note\n * JavaScript stores numbers as 64 bits floating point numbers, but all bitwise operations are performed on 32 bits binary numbers.\n * So the next bitwise operation could not be done with simple numbers\n */\n for (let j /*int*/ = 0; j < 6; ++j) {\n decodedBytes.write(/*(byte)*/Number(createBigInt(value) >> createBigInt(8 * (5 - j))));\n }\n value = 0;\n count = 0;\n }\n }\n break;\n }\n result.append(StringEncoding.decode(decodedBytes.toByteArray(), encoding));\n return codeIndex;\n }\n\n /**\n * Numeric Compaction mode (see 5.4.4) permits efficient encoding of numeric data strings.\n *\n * @param codewords The array of codewords (data + error)\n * @param codeIndex The current index into the codeword array.\n * @param result The decoded data is appended to the result.\n * @return The next index into the codeword array.\n *\n * @throws FormatException\n */\n private static numericCompaction(codewords: Int32Array, codeIndex: number /*int*/, result: StringBuilder): int {\n let count: int = 0;\n let end: boolean = false;\n\n let numericCodewords: Int32Array = new Int32Array(DecodedBitStreamParser.MAX_NUMERIC_CODEWORDS);\n\n while (codeIndex < codewords[0] && !end) {\n let code: int = codewords[codeIndex++];\n if (codeIndex === codewords[0]) {\n end = true;\n }\n if (code < DecodedBitStreamParser.TEXT_COMPACTION_MODE_LATCH) {\n numericCodewords[count] = code;\n count++;\n } else {\n switch (code) {\n case DecodedBitStreamParser.TEXT_COMPACTION_MODE_LATCH:\n case DecodedBitStreamParser.BYTE_COMPACTION_MODE_LATCH:\n case DecodedBitStreamParser.BYTE_COMPACTION_MODE_LATCH_6:\n case DecodedBitStreamParser.BEGIN_MACRO_PDF417_CONTROL_BLOCK:\n case DecodedBitStreamParser.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:\n case DecodedBitStreamParser.MACRO_PDF417_TERMINATOR:\n codeIndex--;\n end = true;\n break;\n }\n }\n if ((count % DecodedBitStreamParser.MAX_NUMERIC_CODEWORDS === 0 || code === DecodedBitStreamParser.NUMERIC_COMPACTION_MODE_LATCH || end) && count > 0) {\n // Re-invoking Numeric Compaction mode (by using codeword 902\n // while in Numeric Compaction mode) serves to terminate the\n // current Numeric Compaction mode grouping as described in 5.4.4.2,\n // and then to start a new one grouping.\n result.append(DecodedBitStreamParser.decodeBase900toBase10(numericCodewords, count));\n count = 0;\n }\n }\n return codeIndex;\n }\n\n /**\n * Convert a list of Numeric Compacted codewords from Base 900 to Base 10.\n *\n * @param codewords The array of codewords\n * @param count The number of codewords\n * @return The decoded string representing the Numeric data.\n *\n * EXAMPLE\n * Encode the fifteen digit numeric string 000213298174000\n * Prefix the numeric string with a 1 and set the initial value of\n * t = 1 000 213 298 174 000\n * Calculate codeword 0\n * d0 = 1 000 213 298 174 000 mod 900 = 200\n *\n * t = 1 000 213 298 174 000 div 900 = 1 111 348 109 082\n * Calculate codeword 1\n * d1 = 1 111 348 109 082 mod 900 = 282\n *\n * t = 1 111 348 109 082 div 900 = 1 234 831 232\n * Calculate codeword 2\n * d2 = 1 234 831 232 mod 900 = 632\n *\n * t = 1 234 831 232 div 900 = 1 372 034\n * Calculate codeword 3\n * d3 = 1 372 034 mod 900 = 434\n *\n * t = 1 372 034 div 900 = 1 524\n * Calculate codeword 4\n * d4 = 1 524 mod 900 = 624\n *\n * t = 1 524 div 900 = 1\n * Calculate codeword 5\n * d5 = 1 mod 900 = 1\n * t = 1 div 900 = 0\n * Codeword sequence is: 1, 624, 434, 632, 282, 200\n *\n * Decode the above codewords involves\n * 1 x 900 power of 5 + 624 x 900 power of 4 + 434 x 900 power of 3 +\n * 632 x 900 power of 2 + 282 x 900 power of 1 + 200 x 900 power of 0 = 1000213298174000\n *\n * Remove leading 1 => Result is 000213298174000\n *\n * @throws FormatException\n */\n private static decodeBase900toBase10(codewords: Int32Array, count: int): string {\n let result = createBigInt(0);\n for (let i /*int*/ = 0; i < count; i++) {\n result += DecodedBitStreamParser.EXP900[count - i - 1] * createBigInt(codewords[i]);\n }\n let resultString: String = result.toString();\n if (resultString.charAt(0) !== '1') {\n throw new FormatException();\n }\n return resultString.substring(1);\n }\n\n}\n","var g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn this;\n})();\n\ntry {\n\t// This works if eval is allowed (see CSP)\n\tg = g || new Function(\"return this\")();\n} catch (e) {\n\t// This works if the window reference is available\n\tif (typeof window === \"object\") g = window;\n}\n\n// g can still be undefined, but nothing to do about it...\n// We return undefined, instead of nothing here, so it's\n// easier to handle this case. if(!global) { ...}\n\nmodule.exports = g;\n","/*\n * Copyright 2013 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// package com.google.zxing.pdf417;\n\n/**\n * @author Guenther Grau\n */\nexport default /*public final*/ class PDF417ResultMetadata {\n\n private segmentIndex: /*int*/ number;\n private fileId: string;\n private lastSegment: boolean;\n private segmentCount: /*int*/ number = -1;\n private sender: string;\n private addressee: string;\n private fileName: string;\n private fileSize: /*long*/ number = -1;\n private timestamp: /*long*/ number = -1;\n private checksum: /*int*/ number = -1;\n private optionalData: Int32Array;\n\n /**\n * The Segment ID represents the segment of the whole file distributed over different symbols.\n *\n * @return File segment index\n */\n public getSegmentIndex(): /*int*/ number {\n return this.segmentIndex;\n }\n\n public setSegmentIndex(segmentIndex: /*int*/ number): void {\n this.segmentIndex = segmentIndex;\n }\n\n /**\n * Is the same for each related PDF417 symbol\n *\n * @return File ID\n */\n public getFileId(): string {\n return this.fileId;\n }\n\n public setFileId(fileId: string): void {\n this.fileId = fileId;\n }\n\n /**\n * @return always null\n * @deprecated use dedicated already parsed fields\n */\n // @Deprecated\n public getOptionalData(): Int32Array {\n return this.optionalData;\n }\n\n /**\n * @param optionalData old optional data format as int array\n * @deprecated parse and use new fields\n */\n // @Deprecated\n public setOptionalData(optionalData: Int32Array): void {\n this.optionalData = optionalData;\n }\n\n\n /**\n * @return true if it is the last segment\n */\n public isLastSegment(): boolean {\n return this.lastSegment;\n }\n\n public setLastSegment(lastSegment: boolean): void {\n this.lastSegment = lastSegment;\n }\n\n /**\n * @return count of segments, -1 if not set\n */\n public getSegmentCount(): /*int*/ number {\n return this.segmentCount;\n }\n\n public setSegmentCount(segmentCount: number /*int*/): void {\n this.segmentCount = segmentCount;\n }\n\n public getSender(): string {\n return this.sender || null;\n }\n\n public setSender(sender: string): void {\n this.sender = sender;\n }\n\n public getAddressee(): string {\n return this.addressee || null;\n }\n\n public setAddressee(addressee: string): void {\n this.addressee = addressee;\n }\n\n /**\n * Filename of the encoded file\n *\n * @return filename\n */\n public getFileName(): string {\n return this.fileName;\n }\n\n public setFileName(fileName: string): void {\n this.fileName = fileName;\n }\n\n /**\n * filesize in bytes of the encoded file\n *\n * @return filesize in bytes, -1 if not set\n */\n public getFileSize(): /*long*/ number {\n return this.fileSize;\n }\n\n public setFileSize(fileSize: number /*long*/): void {\n this.fileSize = fileSize;\n }\n\n /**\n * 16-bit CRC checksum using CCITT-16\n *\n * @return crc checksum, -1 if not set\n */\n public getChecksum(): /*int*/ number {\n return this.checksum;\n }\n\n public setChecksum(checksum: number/*int*/): void {\n this.checksum = checksum;\n }\n\n /**\n * unix epock timestamp, elapsed seconds since 1970-01-01\n *\n * @return elapsed seconds, -1 if not set\n */\n public getTimestamp(): /*long*/ number {\n return this.timestamp;\n }\n\n public setTimestamp(timestamp: number /*long*/): void {\n this.timestamp = timestamp;\n }\n\n}\n","/**\n * Ponyfill for Java's Long class.\n */\nexport default class Long {\n\n /**\n * Parses a string to a number, since JS has no really Int64.\n *\n * @param num Numeric string.\n * @param radix Destination radix.\n */\n static parseLong(num: string, radix: number = undefined) {\n return parseInt(num, radix);\n }\n}\n","/*\n * Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved.\n * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.\n *\n * This code is free software; you can redistribute it and/or modify it\n * under the terms of the GNU General Public License version 2 only, as\n * published by the Free Software Foundation. Oracle designates this\n * particular file as subject to the \"Classpath\" exception as provided\n * by Oracle in the LICENSE file that accompanied this code.\n *\n * This code is distributed in the hope that it will be useful, but WITHOUT\n * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\n * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License\n * version 2 for more details (a copy is included in the LICENSE file that\n * accompanied this code).\n *\n * You should have received a copy of the GNU General Public License version\n * 2 along with this work; if not, write to the Free Software Foundation,\n * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.\n *\n * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA\n * or visit www.oracle.com if you need additional information or have any\n * questions.\n */\n\n// package java.io;\n\n// import java.util.Arrays;\nimport Arrays from './Arrays';\n\nimport OutputStream from './OutputStream';\nimport Integer from './Integer';\nimport IllegalArgumentException from '../IllegalArgumentException';\nimport OutOfMemoryError from '../OutOfMemoryError';\nimport System from './System';\nimport IndexOutOfBoundsException from '../IndexOutOfBoundsException';\n\nimport { int } from '../../customTypings';\n\n\n/**\n * This class implements an output stream in which the data is\n * written into a byte array. The buffer automatically grows as data\n * is written to it.\n * The data can be retrieved using toByteArray() and\n * toString().\n *

\n * Closing a ByteArrayOutputStream has no effect. The methods in\n * this class can be called after the stream has been closed without\n * generating an IOException.\n *\n * @author Arthur van Hoff\n * @since JDK1.0\n */\n\nexport default /*public*/ class ByteArrayOutputStream extends OutputStream {\n\n /**\n * The buffer where data is stored.\n */\n protected buf: Uint8Array;\n\n /**\n * The number of valid bytes in the buffer.\n */\n protected count: int = 0;\n\n /**\n * Creates a new byte array output stream. The buffer capacity is\n * initially 32 bytes, though its size increases if necessary.\n */\n // public constructor() {\n // this(32);\n // }\n\n /**\n * Creates a new byte array output stream, with a buffer capacity of\n * the specified size, in bytes.\n *\n * @param size the initial size.\n * @exception IllegalArgumentException if size is negative.\n */\n public constructor(size: int = 32) {\n super();\n if (size < 0) {\n throw new IllegalArgumentException('Negative initial size: '\n + size);\n }\n this.buf = new Uint8Array(size);\n }\n\n /**\n * Increases the capacity if necessary to ensure that it can hold\n * at least the number of elements specified by the minimum\n * capacity argument.\n *\n * @param minCapacity the desired minimum capacity\n * @throws OutOfMemoryError if {@code minCapacity < 0}. This is\n * interpreted as a request for the unsatisfiably large capacity\n * {@code (long) Integer.MAX_VALUE + (minCapacity - Integer.MAX_VALUE)}.\n */\n private ensureCapacity(minCapacity: int): void {\n // overflow-conscious code\n if (minCapacity - this.buf.length > 0)\n this.grow(minCapacity);\n }\n\n /**\n * Increases the capacity to ensure that it can hold at least the\n * number of elements specified by the minimum capacity argument.\n *\n * @param minCapacity the desired minimum capacity\n */\n private grow(minCapacity: int): void {\n // overflow-conscious code\n let oldCapacity: int = this.buf.length;\n let newCapacity: int = oldCapacity << 1;\n if (newCapacity - minCapacity < 0)\n newCapacity = minCapacity;\n if (newCapacity < 0) {\n if (minCapacity < 0) // overflow\n throw new OutOfMemoryError();\n newCapacity = Integer.MAX_VALUE;\n }\n this.buf = Arrays.copyOfUint8Array(this.buf, newCapacity);\n }\n\n /**\n * Writes the specified byte to this byte array output stream.\n *\n * @param b the byte to be written.\n */\n public /*synchronized*/ write(b: int): void {\n this.ensureCapacity(this.count + 1);\n this.buf[this.count] = /*(byte)*/ b;\n this.count += 1;\n }\n\n /**\n * Writes len bytes from the specified byte array\n * starting at offset off to this byte array output stream.\n *\n * @param b the data.\n * @param off the start offset in the data.\n * @param len the number of bytes to write.\n */\n public /*synchronized*/ writeBytesOffset(b: Uint8Array, off: int, len: int): void {\n if ((off < 0) || (off > b.length) || (len < 0) ||\n ((off + len) - b.length > 0)) {\n throw new IndexOutOfBoundsException();\n }\n this.ensureCapacity(this.count + len);\n System.arraycopy(b, off, this.buf, this.count, len);\n this.count += len;\n }\n\n /**\n * Writes the complete contents of this byte array output stream to\n * the specified output stream argument, as if by calling the output\n * stream's write method using out.write(buf, 0, count).\n *\n * @param out the output stream to which to write the data.\n * @exception IOException if an I/O error occurs.\n */\n public /*synchronized*/ writeTo(out: OutputStream): void {\n out.writeBytesOffset(this.buf, 0, this.count);\n }\n\n /**\n * Resets the count field of this byte array output\n * stream to zero, so that all currently accumulated output in the\n * output stream is discarded. The output stream can be used again,\n * reusing the already allocated buffer space.\n *\n * @see java.io.ByteArrayInputStream#count\n */\n public /*synchronized*/ reset(): void {\n this.count = 0;\n }\n\n /**\n * Creates a newly allocated byte array. Its size is the current\n * size of this output stream and the valid contents of the buffer\n * have been copied into it.\n *\n * @return the current contents of this output stream, as a byte array.\n * @see java.io.ByteArrayOutputStream#size()\n */\n public /*synchronized*/ toByteArray(): Uint8Array {\n return Arrays.copyOfUint8Array(this.buf, this.count);\n }\n\n /**\n * Returns the current size of the buffer.\n *\n * @return the value of the count field, which is the number\n * of valid bytes in this output stream.\n * @see java.io.ByteArrayOutputStream#count\n */\n public /*synchronized*/ size(): int {\n return this.count;\n }\n\n toString(param?: number | string) {\n if (!param) {\n return this.toString_void();\n }\n if (typeof param === 'string') {\n return this.toString_string(param);\n }\n return this.toString_number(param);\n }\n\n /**\n * Converts the buffer's contents into a string decoding bytes using the\n * platform's default character set. The length of the new String\n * is a function of the character set, and hence may not be equal to the\n * size of the buffer.\n *\n *

This method always replaces malformed-input and unmappable-character\n * sequences with the default replacement string for the platform's\n * default character set. The {@linkplain java.nio.charset.CharsetDecoder}\n * class should be used when more control over the decoding process is\n * required.\n *\n * @return String decoded from the buffer's contents.\n * @since JDK1.1\n */\n public /*synchronized*/ toString_void(): string {\n return new String(this.buf/*, 0, this.count*/).toString();\n }\n\n /**\n * Converts the buffer's contents into a string by decoding the bytes using\n * the specified {@link java.nio.charset.Charset charsetName}. The length of\n * the new String is a function of the charset, and hence may not be\n * equal to the length of the byte array.\n *\n *

This method always replaces malformed-input and unmappable-character\n * sequences with this charset's default replacement string. The {@link\n * java.nio.charset.CharsetDecoder} class should be used when more control\n * over the decoding process is required.\n *\n * @param charsetName the name of a supported\n * {@linkplain java.nio.charset.Charset charset}\n * @return String decoded from the buffer's contents.\n * @exception UnsupportedEncodingException\n * If the named charset is not supported\n * @since JDK1.1\n */\n public /*synchronized*/ toString_string(charsetName: string): string {\n return new String(this.buf/*, 0, this.count, charsetName*/).toString();\n }\n\n /**\n * Creates a newly allocated string. Its size is the current size of\n * the output stream and the valid contents of the buffer have been\n * copied into it. Each character c in the resulting string is\n * constructed from the corresponding element b in the byte\n * array such that:\n *

\n   *     c == (char)(((hibyte & 0xff) << 8) | (b & 0xff))\n   * 
\n *\n * @deprecated This method does not properly convert bytes into characters.\n * As of JDK 1.1, the preferred way to do this is via the\n * toString(String enc) method, which takes an encoding-name\n * argument, or the toString() method, which uses the\n * platform's default character encoding.\n *\n * @param hibyte the high byte of each resulting Unicode character.\n * @return the current contents of the output stream, as a string.\n * @see java.io.ByteArrayOutputStream#size()\n * @see java.io.ByteArrayOutputStream#toString(String)\n * @see java.io.ByteArrayOutputStream#toString()\n */\n // @Deprecated\n public /*synchronized*/ toString_number(hibyte: int): string {\n return new String(this.buf/*, hibyte, 0, this.count*/).toString();\n }\n\n /**\n * Closing a ByteArrayOutputStream has no effect. The methods in\n * this class can be called after the stream has been closed without\n * generating an IOException.\n *

\n *\n * @throws IOException\n */\n public close(): void {\n }\n\n}\n","import IndexOutOfBoundsException from '../IndexOutOfBoundsException';\nimport NullPointerException from '../NullPointerException';\n\n/*\n * Copyright (c) 1994, 2004, Oracle and/or its affiliates. All rights reserved.\n * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.\n *\n * This code is free software; you can redistribute it and/or modify it\n * under the terms of the GNU General Public License version 2 only, as\n * published by the Free Software Foundation. Oracle designates this\n * particular file as subject to the \"Classpath\" exception as provided\n * by Oracle in the LICENSE file that accompanied this code.\n *\n * This code is distributed in the hope that it will be useful, but WITHOUT\n * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\n * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License\n * version 2 for more details (a copy is included in the LICENSE file that\n * accompanied this code).\n *\n * You should have received a copy of the GNU General Public License version\n * 2 along with this work; if not, write to the Free Software Foundation,\n * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.\n *\n * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA\n * or visit www.oracle.com if you need additional information or have any\n * questions.\n */\n\n// package java.io;\n\n/**\n * This abstract class is the superclass of all classes representing\n * an output stream of bytes. An output stream accepts output bytes\n * and sends them to some sink.\n *

\n * Applications that need to define a subclass of\n * OutputStream must always provide at least a method\n * that writes one byte of output.\n *\n * @author Arthur van Hoff\n * @see java.io.BufferedOutputStream\n * @see java.io.ByteArrayOutputStream\n * @see java.io.DataOutputStream\n * @see java.io.FilterOutputStream\n * @see java.io.InputStream\n * @see java.io.OutputStream#write(int)\n * @since JDK1.0\n */\nexport default /*public*/ abstract class OutputStream /*implements Closeable, Flushable*/ {\n /**\n * Writes the specified byte to this output stream. The general\n * contract for write is that one byte is written\n * to the output stream. The byte to be written is the eight\n * low-order bits of the argument b. The 24\n * high-order bits of b are ignored.\n *

\n * Subclasses of OutputStream must provide an\n * implementation for this method.\n *\n * @param b the byte.\n * @exception IOException if an I/O error occurs. In particular,\n * an IOException may be thrown if the\n * output stream has been closed.\n */\n public abstract write(b: /*int*/ number): void;\n\n /**\n * Writes b.length bytes from the specified byte array\n * to this output stream. The general contract for write(b)\n * is that it should have exactly the same effect as the call\n * write(b, 0, b.length).\n *\n * @param b the data.\n * @exception IOException if an I/O error occurs.\n * @see java.io.OutputStream#write(byte[], int, int)\n */\n public writeBytes(b: Uint8Array): void {\n this.writeBytesOffset(b, 0, b.length);\n }\n\n /**\n * Writes len bytes from the specified byte array\n * starting at offset off to this output stream.\n * The general contract for write(b, off, len) is that\n * some of the bytes in the array b are written to the\n * output stream in order; element b[off] is the first\n * byte written and b[off+len-1] is the last byte written\n * by this operation.\n *

\n * The write method of OutputStream calls\n * the write method of one argument on each of the bytes to be\n * written out. Subclasses are encouraged to override this method and\n * provide a more efficient implementation.\n *

\n * If b is null, a\n * NullPointerException is thrown.\n *

\n * If off is negative, or len is negative, or\n * off+len is greater than the length of the array\n * b, then an IndexOutOfBoundsException is thrown.\n *\n * @param b the data.\n * @param off the start offset in the data.\n * @param len the number of bytes to write.\n * @exception IOException if an I/O error occurs. In particular,\n * an IOException is thrown if the output\n * stream is closed.\n */\n public writeBytesOffset(b: Uint8Array, off: /*int*/ number, len: /*int*/ number): void {\n if (b == null) {\n throw new NullPointerException();\n } else if ((off < 0) || (off > b.length) || (len < 0) ||\n ((off + len) > b.length) || ((off + len) < 0)) {\n throw new IndexOutOfBoundsException();\n } else if (len === 0) {\n return;\n }\n for (let i = 0; i < len; i++) {\n this.write(b[off + i]);\n }\n }\n\n /**\n * Flushes this output stream and forces any buffered output bytes\n * to be written out. The general contract of flush is\n * that calling it is an indication that, if any bytes previously\n * written have been buffered by the implementation of the output\n * stream, such bytes should immediately be written to their\n * intended destination.\n *

\n * If the intended destination of this stream is an abstraction provided by\n * the underlying operating system, for example a file, then flushing the\n * stream guarantees only that bytes previously written to the stream are\n * passed to the operating system for writing; it does not guarantee that\n * they are actually written to a physical device such as a disk drive.\n *

\n * The flush method of OutputStream does nothing.\n *\n * @exception IOException if an I/O error occurs.\n */\n public flush(): void {\n }\n\n /**\n * Closes this output stream and releases any system resources\n * associated with this stream. The general contract of close\n * is that it closes the output stream. A closed stream cannot perform\n * output operations and cannot be reopened.\n *

\n * The close method of OutputStream does nothing.\n *\n * @exception IOException if an I/O error occurs.\n */\n public close(): void {\n }\n\n}\n","import Exception from './Exception';\n\n/**\n * Custom Error class of type Exception.\n */\nexport default class NullPointerException extends Exception {}\n","import Exception from './Exception';\n\n/**\n * Custom Error class of type Exception.\n */\nexport default class OutOfMemoryError extends Exception {}\n","import { BrowserCodeReader } from './BrowserCodeReader';\nimport PDF417Reader from '../core/pdf417/PDF417Reader';\n\n/**\n * @deprecated Moving to @zxing/browser\n *\n * QR Code reader to use from browser.\n */\nexport class BrowserPDF417Reader extends BrowserCodeReader {\n /**\n * Creates an instance of BrowserPDF417Reader.\n * @param {number} [timeBetweenScansMillis=500] the time delay between subsequent decode tries\n */\n public constructor(timeBetweenScansMillis: number = 500) {\n super(new PDF417Reader(), timeBetweenScansMillis);\n }\n}\n","import { BrowserCodeReader } from './BrowserCodeReader';\nimport QRCodeReader from '../core/qrcode/QRCodeReader';\n\n/**\n * @deprecated Moving to @zxing/browser\n *\n * QR Code reader to use from browser.\n */\nexport class BrowserQRCodeReader extends BrowserCodeReader {\n /**\n * Creates an instance of BrowserQRCodeReader.\n * @param {number} [timeBetweenScansMillis=500] the time delay between subsequent decode tries\n */\n public constructor(timeBetweenScansMillis: number = 500) {\n super(new QRCodeReader(), timeBetweenScansMillis);\n }\n}\n","import EncodeHintType from '../core/EncodeHintType';\nimport Encoder from '../core/qrcode/encoder/Encoder';\nimport QRCode from '../core/qrcode/encoder/QRCode';\nimport ErrorCorrectionLevel from '../core/qrcode/decoder/ErrorCorrectionLevel';\nimport IllegalArgumentException from '../core/IllegalArgumentException';\nimport IllegalStateException from '../core/IllegalStateException';\n\n/**\n * @deprecated Moving to @zxing/browser\n */\nclass BrowserQRCodeSvgWriter {\n\n private static readonly QUIET_ZONE_SIZE = 4;\n\n /**\n * SVG markup NameSpace\n */\n private static readonly SVG_NS = 'http://www.w3.org/2000/svg';\n\n /**\n * Writes and renders a QRCode SVG element.\n *\n * @param contents\n * @param width\n * @param height\n * @param hints\n */\n public write(\n contents: string,\n width: number,\n height: number,\n hints: Map = null\n ): SVGSVGElement {\n\n if (contents.length === 0) {\n throw new IllegalArgumentException('Found empty contents');\n }\n\n // if (format != BarcodeFormat.QR_CODE) {\n // throw new IllegalArgumentException(\"Can only encode QR_CODE, but got \" + format)\n // }\n\n if (width < 0 || height < 0) {\n throw new IllegalArgumentException('Requested dimensions are too small: ' + width + 'x' + height);\n }\n\n let errorCorrectionLevel = ErrorCorrectionLevel.L;\n let quietZone = BrowserQRCodeSvgWriter.QUIET_ZONE_SIZE;\n\n if (hints !== null) {\n\n if (undefined !== hints.get(EncodeHintType.ERROR_CORRECTION)) {\n errorCorrectionLevel = ErrorCorrectionLevel.fromString(hints.get(EncodeHintType.ERROR_CORRECTION).toString());\n }\n\n if (undefined !== hints.get(EncodeHintType.MARGIN)) {\n quietZone = Number.parseInt(hints.get(EncodeHintType.MARGIN).toString(), 10);\n }\n }\n\n const code = Encoder.encode(contents, errorCorrectionLevel, hints);\n\n return this.renderResult(code, width, height, quietZone);\n }\n\n /**\n * Renders the result and then appends it to the DOM.\n */\n public writeToDom(\n containerElement: string | HTMLElement,\n contents: string,\n width: number,\n height: number,\n hints: Map = null\n ): void {\n\n if (typeof containerElement === 'string') {\n containerElement = document.querySelector(containerElement);\n }\n\n const svgElement = this.write(contents, width, height, hints);\n\n if (containerElement)\n containerElement.appendChild(svgElement);\n }\n\n /**\n * Note that the input matrix uses 0 == white, 1 == black.\n * The output matrix uses 0 == black, 255 == white (i.e. an 8 bit greyscale bitmap).\n */\n private renderResult(code: QRCode, width: number /*int*/, height: number /*int*/, quietZone: number /*int*/): SVGSVGElement {\n\n const input = code.getMatrix();\n\n if (input === null) {\n throw new IllegalStateException();\n }\n\n const inputWidth = input.getWidth();\n const inputHeight = input.getHeight();\n const qrWidth = inputWidth + (quietZone * 2);\n const qrHeight = inputHeight + (quietZone * 2);\n const outputWidth = Math.max(width, qrWidth);\n const outputHeight = Math.max(height, qrHeight);\n\n const multiple = Math.min(Math.floor(outputWidth / qrWidth), Math.floor(outputHeight / qrHeight));\n\n // Padding includes both the quiet zone and the extra white pixels to accommodate the requested\n // dimensions. For example, if input is 25x25 the QR will be 33x33 including the quiet zone.\n // If the requested size is 200x160, the multiple will be 4, for a QR of 132x132. These will\n // handle all the padding from 100x100 (the actual QR) up to 200x160.\n const leftPadding = Math.floor((outputWidth - (inputWidth * multiple)) / 2);\n const topPadding = Math.floor((outputHeight - (inputHeight * multiple)) / 2);\n\n const svgElement = this.createSVGElement(outputWidth, outputHeight);\n\n for (let inputY = 0, outputY = topPadding; inputY < inputHeight; inputY++ , outputY += multiple) {\n // Write the contents of this row of the barcode\n for (let inputX = 0, outputX = leftPadding; inputX < inputWidth; inputX++ , outputX += multiple) {\n if (input.get(inputX, inputY) === 1) {\n const svgRectElement = this.createSvgRectElement(outputX, outputY, multiple, multiple);\n svgElement.appendChild(svgRectElement);\n }\n }\n }\n\n return svgElement;\n }\n\n /**\n * Creates a SVG element.\n *\n * @param w SVG's width attribute\n * @param h SVG's height attribute\n */\n private createSVGElement(w: number, h: number): SVGSVGElement {\n\n const svgElement = document.createElementNS(BrowserQRCodeSvgWriter.SVG_NS, 'svg');\n\n svgElement.setAttributeNS(null, 'height', w.toString());\n svgElement.setAttributeNS(null, 'width', h.toString());\n\n return svgElement;\n }\n\n /**\n * Creates a SVG rect element.\n *\n * @param x Element's x coordinate\n * @param y Element's y coordinate\n * @param w Element's width attribute\n * @param h Element's height attribute\n */\n private createSvgRectElement(x: number, y: number, w: number, h: number): SVGRectElement {\n\n const rect = document.createElementNS(BrowserQRCodeSvgWriter.SVG_NS, 'rect');\n\n rect.setAttributeNS(null, 'x', x.toString());\n rect.setAttributeNS(null, 'y', y.toString());\n rect.setAttributeNS(null, 'height', w.toString());\n rect.setAttributeNS(null, 'width', h.toString());\n rect.setAttributeNS(null, 'fill', '#000000');\n\n return rect;\n }\n}\n\nexport { BrowserQRCodeSvgWriter };\n","/*\n * Copyright 2008 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*namespace com.google.zxing.qrcode.encoder {*/\n\n/*import java.util.Arrays;*/\n\nimport Arrays from '../../util/Arrays';\nimport StringBuilder from '../../util/StringBuilder';\n\n/**\n * JAVAPORT: The original code was a 2D array of ints, but since it only ever gets assigned\n * -1, 0, and 1, I'm going to use less memory and go with bytes.\n *\n * @author dswitkin@google.com (Daniel Switkin)\n */\nexport default class ByteMatrix {\n\n private bytes: Array;\n\n public constructor(private width: number /*int*/, private height: number /*int*/) {\n const bytes = new Array(height); // [height][width]\n for (let i = 0; i !== height; i++) {\n bytes[i] = new Uint8Array(width);\n }\n this.bytes = bytes;\n }\n\n public getHeight(): number /*int*/ {\n return this.height;\n }\n\n public getWidth(): number /*int*/ {\n return this.width;\n }\n\n public get(x: number /*int*/, y: number /*int*/): number/*byte*/ {\n return this.bytes[y][x];\n }\n\n /**\n * @return an internal representation as bytes, in row-major order. array[y][x] represents point (x,y)\n */\n public getArray(): Array {\n return this.bytes;\n }\n\n // TYPESCRIPTPORT: preffer to let two methods instead of override to avoid type comparison inside\n public setNumber(x: number /*int*/, y: number /*int*/, value: number/*byte|int*/): void {\n this.bytes[y][x] = value;\n }\n\n // public set(x: number /*int*/, y: number /*int*/, value: number /*int*/): void {\n // bytes[y][x] = (byte) value\n // }\n\n public setBoolean(x: number /*int*/, y: number /*int*/, value: boolean): void {\n this.bytes[y][x] = /*(byte) */(value ? 1 : 0);\n }\n\n public clear(value: number/*byte*/): void {\n for (const aByte of this.bytes) {\n Arrays.fill(aByte, value);\n }\n }\n\n public equals(o: any) {\n if (!(o instanceof ByteMatrix)) {\n return false;\n }\n const other = o;\n if (this.width !== other.width) {\n return false;\n }\n if (this.height !== other.height) {\n return false;\n }\n for (let y = 0, height = this.height; y < height; ++y) {\n const bytesY = this.bytes[y];\n const otherBytesY = other.bytes[y];\n for (let x = 0, width = this.width; x < width; ++x) {\n if (bytesY[x] !== otherBytesY[x]) {\n return false;\n }\n }\n }\n return true;\n }\n\n /*@Override*/\n public toString(): string {\n const result = new StringBuilder(); // (2 * width * height + 2)\n for (let y = 0, height = this.height; y < height; ++y) {\n const bytesY = this.bytes[y];\n for (let x = 0, width = this.width; x < width; ++x) {\n switch (bytesY[x]) {\n case 0:\n result.append(' 0');\n break;\n case 1:\n result.append(' 1');\n break;\n default:\n result.append(' ');\n break;\n }\n }\n result.append('\\n');\n }\n return result.toString();\n }\n\n}\n","/*\n * Copyright 2008 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*namespace com.google.zxing.qrcode.encoder {*/\n\nimport BitArray from '../../common/BitArray';\nimport ErrorCorrectionLevel from '../decoder/ErrorCorrectionLevel';\nimport Version from '../decoder/Version';\nimport ByteMatrix from './ByteMatrix';\n\nimport Integer from '../../util/Integer';\nimport QRCode from './QRCode';\nimport MaskUtil from './MaskUtil';\nimport WriterException from '../../WriterException';\nimport IllegalArgumentException from '../../IllegalArgumentException';\n\n/**\n * @author satorux@google.com (Satoru Takabayashi) - creator\n * @author dswitkin@google.com (Daniel Switkin) - ported from C++\n */\nexport default class MatrixUtil {\n\n private constructor() {\n // do nothing\n }\n\n private static POSITION_DETECTION_PATTERN: Array = Array.from([\n Int32Array.from([1, 1, 1, 1, 1, 1, 1]),\n Int32Array.from([1, 0, 0, 0, 0, 0, 1]),\n Int32Array.from([1, 0, 1, 1, 1, 0, 1]),\n Int32Array.from([1, 0, 1, 1, 1, 0, 1]),\n Int32Array.from([1, 0, 1, 1, 1, 0, 1]),\n Int32Array.from([1, 0, 0, 0, 0, 0, 1]),\n Int32Array.from([1, 1, 1, 1, 1, 1, 1]),\n ]);\n\n private static POSITION_ADJUSTMENT_PATTERN: Array = Array.from([\n Int32Array.from([1, 1, 1, 1, 1]),\n Int32Array.from([1, 0, 0, 0, 1]),\n Int32Array.from([1, 0, 1, 0, 1]),\n Int32Array.from([1, 0, 0, 0, 1]),\n Int32Array.from([1, 1, 1, 1, 1]),\n ]);\n\n // From Appendix E. Table 1, JIS0510X:2004 (71: p). The table was double-checked by komatsu.\n private static POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE: Array = Array.from([\n Int32Array.from([-1, -1, -1, -1, -1, -1, -1]), // Version 1\n Int32Array.from([6, 18, -1, -1, -1, -1, -1]), // Version 2\n Int32Array.from([6, 22, -1, -1, -1, -1, -1]), // Version 3\n Int32Array.from([6, 26, -1, -1, -1, -1, -1]), // Version 4\n Int32Array.from([6, 30, -1, -1, -1, -1, -1]), // Version 5\n Int32Array.from([6, 34, -1, -1, -1, -1, -1]), // Version 6\n Int32Array.from([6, 22, 38, -1, -1, -1, -1]), // Version 7\n Int32Array.from([6, 24, 42, -1, -1, -1, -1]), // Version 8\n Int32Array.from([6, 26, 46, -1, -1, -1, -1]), // Version 9\n Int32Array.from([6, 28, 50, -1, -1, -1, -1]), // Version 10\n Int32Array.from([6, 30, 54, -1, -1, -1, -1]), // Version 11\n Int32Array.from([6, 32, 58, -1, -1, -1, -1]), // Version 12\n Int32Array.from([6, 34, 62, -1, -1, -1, -1]), // Version 13\n Int32Array.from([6, 26, 46, 66, -1, -1, -1]), // Version 14\n Int32Array.from([6, 26, 48, 70, -1, -1, -1]), // Version 15\n Int32Array.from([6, 26, 50, 74, -1, -1, -1]), // Version 16\n Int32Array.from([6, 30, 54, 78, -1, -1, -1]), // Version 17\n Int32Array.from([6, 30, 56, 82, -1, -1, -1]), // Version 18\n Int32Array.from([6, 30, 58, 86, -1, -1, -1]), // Version 19\n Int32Array.from([6, 34, 62, 90, -1, -1, -1]), // Version 20\n Int32Array.from([6, 28, 50, 72, 94, -1, -1]), // Version 21\n Int32Array.from([6, 26, 50, 74, 98, -1, -1]), // Version 22\n Int32Array.from([6, 30, 54, 78, 102, -1, -1]), // Version 23\n Int32Array.from([6, 28, 54, 80, 106, -1, -1]), // Version 24\n Int32Array.from([6, 32, 58, 84, 110, -1, -1]), // Version 25\n Int32Array.from([6, 30, 58, 86, 114, -1, -1]), // Version 26\n Int32Array.from([6, 34, 62, 90, 118, -1, -1]), // Version 27\n Int32Array.from([6, 26, 50, 74, 98, 122, -1]), // Version 28\n Int32Array.from([6, 30, 54, 78, 102, 126, -1]), // Version 29\n Int32Array.from([6, 26, 52, 78, 104, 130, -1]), // Version 30\n Int32Array.from([6, 30, 56, 82, 108, 134, -1]), // Version 31\n Int32Array.from([6, 34, 60, 86, 112, 138, -1]), // Version 32\n Int32Array.from([6, 30, 58, 86, 114, 142, -1]), // Version 33\n Int32Array.from([6, 34, 62, 90, 118, 146, -1]), // Version 34\n Int32Array.from([6, 30, 54, 78, 102, 126, 150]), // Version 35\n Int32Array.from([6, 24, 50, 76, 102, 128, 154]), // Version 36\n Int32Array.from([6, 28, 54, 80, 106, 132, 158]), // Version 37\n Int32Array.from([6, 32, 58, 84, 110, 136, 162]), // Version 38\n Int32Array.from([6, 26, 54, 82, 110, 138, 166]), // Version 39\n Int32Array.from([6, 30, 58, 86, 114, 142, 170]), // Version 40\n ]);\n\n // Type info cells at the left top corner.\n private static TYPE_INFO_COORDINATES: Array = Array.from([\n Int32Array.from([8, 0]),\n Int32Array.from([8, 1]),\n Int32Array.from([8, 2]),\n Int32Array.from([8, 3]),\n Int32Array.from([8, 4]),\n Int32Array.from([8, 5]),\n Int32Array.from([8, 7]),\n Int32Array.from([8, 8]),\n Int32Array.from([7, 8]),\n Int32Array.from([5, 8]),\n Int32Array.from([4, 8]),\n Int32Array.from([3, 8]),\n Int32Array.from([2, 8]),\n Int32Array.from([1, 8]),\n Int32Array.from([0, 8]),\n ]);\n\n // From Appendix D in JISX0510:2004 (p. 67)\n private static VERSION_INFO_POLY = 0x1f25; // 1 1111 0010 0101\n\n // From Appendix C in JISX0510:2004 (p.65).\n private static TYPE_INFO_POLY = 0x537;\n private static TYPE_INFO_MASK_PATTERN = 0x5412;\n\n // Set all cells to -1 (TYPESCRIPTPORT: 255). -1 (TYPESCRIPTPORT: 255) means that the cell is empty (not set yet).\n //\n // JAVAPORT: We shouldn't need to do this at all. The code should be rewritten to begin encoding\n // with the ByteMatrix initialized all to zero.\n public static clearMatrix(matrix: ByteMatrix): void {\n // TYPESCRIPTPORT: we use UintArray se changed here from -1 to 255\n matrix.clear(/*(byte) *//*-1*/255);\n }\n\n // Build 2D matrix of QR Code from \"dataBits\" with \"ecLevel\", \"version\" and \"getMaskPattern\". On\n // success, store the result in \"matrix\" and return true.\n public static buildMatrix(dataBits: BitArray,\n ecLevel: ErrorCorrectionLevel,\n version: Version,\n maskPattern: number /*int*/,\n matrix: ByteMatrix): void /*throws WriterException*/ {\n MatrixUtil.clearMatrix(matrix);\n MatrixUtil.embedBasicPatterns(version, matrix);\n // Type information appear with any version.\n MatrixUtil.embedTypeInfo(ecLevel, maskPattern, matrix);\n // Version info appear if version >= 7.\n MatrixUtil.maybeEmbedVersionInfo(version, matrix);\n // Data should be embedded at end.\n MatrixUtil.embedDataBits(dataBits, maskPattern, matrix);\n }\n\n // Embed basic patterns. On success, modify the matrix and return true.\n // The basic patterns are:\n // - Position detection patterns\n // - Timing patterns\n // - Dark dot at the left bottom corner\n // - Position adjustment patterns, if need be\n public static embedBasicPatterns(version: Version, matrix: ByteMatrix): void /*throws WriterException*/ {\n // Let's get started with embedding big squares at corners.\n MatrixUtil.embedPositionDetectionPatternsAndSeparators(matrix);\n // Then, embed the dark dot at the left bottom corner.\n MatrixUtil.embedDarkDotAtLeftBottomCorner(matrix);\n\n // Position adjustment patterns appear if version >= 2.\n MatrixUtil.maybeEmbedPositionAdjustmentPatterns(version, matrix);\n // Timing patterns should be embedded after position adj. patterns.\n MatrixUtil.embedTimingPatterns(matrix);\n }\n\n // Embed type information. On success, modify the matrix.\n public static embedTypeInfo(ecLevel: ErrorCorrectionLevel, maskPattern: number /*int*/, matrix: ByteMatrix): void {\n const typeInfoBits: BitArray = new BitArray();\n MatrixUtil.makeTypeInfoBits(ecLevel, maskPattern, typeInfoBits);\n\n for (let i = 0, size = typeInfoBits.getSize(); i < size; ++i) {\n // Place bits in LSB to MSB order. LSB (least significant bit) is the last value in\n // \"typeInfoBits\".\n const bit: boolean = typeInfoBits.get(typeInfoBits.getSize() - 1 - i);\n\n // Type info bits at the left top corner. See 8.9 of JISX0510:2004 (p.46).\n const coordinates: Int32Array = MatrixUtil.TYPE_INFO_COORDINATES[i];\n const x1 = coordinates[0];\n const y1 = coordinates[1];\n matrix.setBoolean(x1, y1, bit);\n\n if (i < 8) {\n // Right top corner.\n const x2 = matrix.getWidth() - i - 1;\n const y2 = 8;\n matrix.setBoolean(x2, y2, bit);\n } else {\n // Left bottom corner.\n const x2 = 8;\n const y2 = matrix.getHeight() - 7 + (i - 8);\n matrix.setBoolean(x2, y2, bit);\n }\n }\n }\n\n // Embed version information if need be. On success, modify the matrix and return true.\n // See 8.10 of JISX0510:2004 (p.47) for how to embed version information.\n public static maybeEmbedVersionInfo(version: Version, matrix: ByteMatrix): void /*throws WriterException*/ {\n if (version.getVersionNumber() < 7) { // Version info is necessary if version >= 7.\n return; // Don't need version info.\n }\n const versionInfoBits = new BitArray();\n MatrixUtil.makeVersionInfoBits(version, versionInfoBits);\n\n let bitIndex = 6 * 3 - 1; // It will decrease from 17 to 0.\n for (let i = 0; i < 6; ++i) {\n for (let j = 0; j < 3; ++j) {\n // Place bits in LSB (least significant bit) to MSB order.\n const bit: boolean = versionInfoBits.get(bitIndex);\n bitIndex--;\n // Left bottom corner.\n matrix.setBoolean(i, matrix.getHeight() - 11 + j, bit);\n // Right bottom corner.\n matrix.setBoolean(matrix.getHeight() - 11 + j, i, bit);\n }\n }\n }\n\n // Embed \"dataBits\" using \"getMaskPattern\". On success, modify the matrix and return true.\n // For debugging purposes, it skips masking process if \"getMaskPattern\" is -1(TYPESCRIPTPORT: 255).\n // See 8.7 of JISX0510:2004 (p.38) for how to embed data bits.\n public static embedDataBits(dataBits: BitArray, maskPattern: number /*int*/, matrix: ByteMatrix): void {\n let bitIndex = 0;\n let direction = -1;\n // Start from the right bottom cell.\n let x = matrix.getWidth() - 1;\n let y = matrix.getHeight() - 1;\n while (x > 0) {\n // Skip the vertical timing pattern.\n if (x === 6) {\n x -= 1;\n }\n while (y >= 0 && y < matrix.getHeight()) {\n for (let i = 0; i < 2; ++i) {\n const xx = x - i;\n // Skip the cell if it's not empty.\n if (!MatrixUtil.isEmpty(matrix.get(xx, y))) {\n continue;\n }\n let bit: boolean;\n if (bitIndex < dataBits.getSize()) {\n bit = dataBits.get(bitIndex);\n ++bitIndex;\n } else {\n // Padding bit. If there is no bit left, we'll fill the left cells with 0, as described\n // in 8.4.9 of JISX0510:2004 (p. 24).\n bit = false;\n }\n\n // Skip masking if mask_pattern is -1 (TYPESCRIPTPORT: 255).\n if (maskPattern !== 255 && MaskUtil.getDataMaskBit(maskPattern, xx, y)) {\n bit = !bit;\n }\n matrix.setBoolean(xx, y, bit);\n }\n y += direction;\n }\n direction = -direction; // Reverse the direction.\n y += direction;\n x -= 2; // Move to the left.\n }\n // All bits should be consumed.\n if (bitIndex !== dataBits.getSize()) {\n throw new WriterException('Not all bits consumed: ' + bitIndex + '/' + dataBits.getSize());\n }\n }\n\n // Return the position of the most significant bit set (one: to) in the \"value\". The most\n // significant bit is position 32. If there is no bit set, return 0. Examples:\n // - findMSBSet(0) => 0\n // - findMSBSet(1) => 1\n // - findMSBSet(255) => 8\n public static findMSBSet(value: number /*int*/): number /*int*/ {\n return 32 - Integer.numberOfLeadingZeros(value);\n }\n\n // Calculate BCH (Bose-Chaudhuri-Hocquenghem) code for \"value\" using polynomial \"poly\". The BCH\n // code is used for encoding type information and version information.\n // Example: Calculation of version information of 7.\n // f(x) is created from 7.\n // - 7 = 000111 in 6 bits\n // - f(x) = x^2 + x^1 + x^0\n // g(x) is given by the standard (p. 67)\n // - g(x) = x^12 + x^11 + x^10 + x^9 + x^8 + x^5 + x^2 + 1\n // Multiply f(x) by x^(18 - 6)\n // - f'(x) = f(x) * x^(18 - 6)\n // - f'(x) = x^14 + x^13 + x^12\n // Calculate the remainder of f'(x) / g(x)\n // x^2\n // __________________________________________________\n // g(x) )x^14 + x^13 + x^12\n // x^14 + x^13 + x^12 + x^11 + x^10 + x^7 + x^4 + x^2\n // --------------------------------------------------\n // x^11 + x^10 + x^7 + x^4 + x^2\n //\n // The remainder is x^11 + x^10 + x^7 + x^4 + x^2\n // Encode it in binary: 110010010100\n // The return value is 0xc94 (1100 1001 0100)\n //\n // Since all coefficients in the polynomials are 1 or 0, we can do the calculation by bit\n // operations. We don't care if coefficients are positive or negative.\n public static calculateBCHCode(value: number /*int*/, poly: number /*int*/): number /*int*/ {\n if (poly === 0) {\n throw new IllegalArgumentException('0 polynomial');\n }\n // If poly is \"1 1111 0010 0101\" (version info poly), msbSetInPoly is 13. We'll subtract 1\n // from 13 to make it 12.\n const msbSetInPoly = MatrixUtil.findMSBSet(poly);\n value <<= msbSetInPoly - 1;\n // Do the division business using exclusive-or operations.\n while (MatrixUtil.findMSBSet(value) >= msbSetInPoly) {\n value ^= poly << (MatrixUtil.findMSBSet(value) - msbSetInPoly);\n }\n // Now the \"value\" is the remainder (i.e. the BCH code)\n return value;\n }\n\n // Make bit vector of type information. On success, store the result in \"bits\" and return true.\n // Encode error correction level and mask pattern. See 8.9 of\n // JISX0510:2004 (p.45) for details.\n public static makeTypeInfoBits(ecLevel: ErrorCorrectionLevel, maskPattern: number /*int*/, bits: BitArray): void {\n if (!QRCode.isValidMaskPattern(maskPattern)) {\n throw new WriterException('Invalid mask pattern');\n }\n const typeInfo = (ecLevel.getBits() << 3) | maskPattern;\n bits.appendBits(typeInfo, 5);\n\n const bchCode = MatrixUtil.calculateBCHCode(typeInfo, MatrixUtil.TYPE_INFO_POLY);\n bits.appendBits(bchCode, 10);\n\n const maskBits = new BitArray();\n maskBits.appendBits(MatrixUtil.TYPE_INFO_MASK_PATTERN, 15);\n bits.xor(maskBits);\n\n if (bits.getSize() !== 15) { // Just in case.\n throw new WriterException('should not happen but we got: ' + bits.getSize());\n }\n }\n\n // Make bit vector of version information. On success, store the result in \"bits\" and return true.\n // See 8.10 of JISX0510:2004 (p.45) for details.\n public static makeVersionInfoBits(version: Version, bits: BitArray): void /*throws WriterException*/ {\n bits.appendBits(version.getVersionNumber(), 6);\n const bchCode = MatrixUtil.calculateBCHCode(version.getVersionNumber(), MatrixUtil.VERSION_INFO_POLY);\n bits.appendBits(bchCode, 12);\n\n if (bits.getSize() !== 18) { // Just in case.\n throw new WriterException('should not happen but we got: ' + bits.getSize());\n }\n }\n\n // Check if \"value\" is empty.\n private static isEmpty(value: number /*int*/): boolean {\n return value === 255; // -1\n }\n\n private static embedTimingPatterns(matrix: ByteMatrix): void {\n // -8 is for skipping position detection patterns (7: size), and two horizontal/vertical\n // separation patterns (1: size). Thus, 8 = 7 + 1.\n for (let i = 8; i < matrix.getWidth() - 8; ++i) {\n const bit = (i + 1) % 2;\n // Horizontal line.\n if (MatrixUtil.isEmpty(matrix.get(i, 6))) {\n matrix.setNumber(i, 6, bit);\n }\n // Vertical line.\n if (MatrixUtil.isEmpty(matrix.get(6, i))) {\n matrix.setNumber(6, i, bit);\n }\n }\n }\n\n // Embed the lonely dark dot at left bottom corner. JISX0510:2004 (p.46)\n private static embedDarkDotAtLeftBottomCorner(matrix: ByteMatrix): void /*throws WriterException*/ {\n if (matrix.get(8, matrix.getHeight() - 8) === 0) {\n throw new WriterException();\n }\n matrix.setNumber(8, matrix.getHeight() - 8, 1);\n }\n\n private static embedHorizontalSeparationPattern(xStart: number /*int*/,\n yStart: number /*int*/,\n matrix: ByteMatrix): void /*throws WriterException*/ {\n for (let x = 0; x < 8; ++x) {\n if (!MatrixUtil.isEmpty(matrix.get(xStart + x, yStart))) {\n throw new WriterException();\n }\n matrix.setNumber(xStart + x, yStart, 0);\n }\n }\n\n private static embedVerticalSeparationPattern(xStart: number /*int*/,\n yStart: number /*int*/,\n matrix: ByteMatrix): void /*throws WriterException*/ {\n for (let y = 0; y < 7; ++y) {\n if (!MatrixUtil.isEmpty(matrix.get(xStart, yStart + y))) {\n throw new WriterException();\n }\n matrix.setNumber(xStart, yStart + y, 0);\n }\n }\n\n private static embedPositionAdjustmentPattern(xStart: number /*int*/, yStart: number /*int*/, matrix: ByteMatrix): void {\n for (let y = 0; y < 5; ++y) {\n const patternY: Int32Array = MatrixUtil.POSITION_ADJUSTMENT_PATTERN[y];\n for (let x = 0; x < 5; ++x) {\n matrix.setNumber(xStart + x, yStart + y, patternY[x]);\n }\n }\n }\n\n private static embedPositionDetectionPattern(xStart: number /*int*/, yStart: number /*int*/, matrix: ByteMatrix): void {\n for (let y = 0; y < 7; ++y) {\n const patternY: Int32Array = MatrixUtil.POSITION_DETECTION_PATTERN[y];\n for (let x = 0; x < 7; ++x) {\n matrix.setNumber(xStart + x, yStart + y, patternY[x]);\n }\n }\n }\n\n // Embed position detection patterns and surrounding vertical/horizontal separators.\n private static embedPositionDetectionPatternsAndSeparators(matrix: ByteMatrix): void /*throws WriterException*/ {\n // Embed three big squares at corners.\n const pdpWidth = MatrixUtil.POSITION_DETECTION_PATTERN[0].length;\n // Left top corner.\n MatrixUtil.embedPositionDetectionPattern(0, 0, matrix);\n // Right top corner.\n MatrixUtil.embedPositionDetectionPattern(matrix.getWidth() - pdpWidth, 0, matrix);\n // Left bottom corner.\n MatrixUtil.embedPositionDetectionPattern(0, matrix.getWidth() - pdpWidth, matrix);\n\n // Embed horizontal separation patterns around the squares.\n const hspWidth = 8;\n // Left top corner.\n MatrixUtil.embedHorizontalSeparationPattern(0, hspWidth - 1, matrix);\n // Right top corner.\n MatrixUtil.embedHorizontalSeparationPattern(matrix.getWidth() - hspWidth,\n hspWidth - 1, matrix);\n // Left bottom corner.\n MatrixUtil.embedHorizontalSeparationPattern(0, matrix.getWidth() - hspWidth, matrix);\n\n // Embed vertical separation patterns around the squares.\n const vspSize = 7;\n // Left top corner.\n MatrixUtil.embedVerticalSeparationPattern(vspSize, 0, matrix);\n // Right top corner.\n MatrixUtil.embedVerticalSeparationPattern(matrix.getHeight() - vspSize - 1, 0, matrix);\n // Left bottom corner.\n MatrixUtil.embedVerticalSeparationPattern(vspSize, matrix.getHeight() - vspSize,\n matrix);\n }\n\n // Embed position adjustment patterns if need be.\n private static maybeEmbedPositionAdjustmentPatterns(version: Version, matrix: ByteMatrix): void {\n if (version.getVersionNumber() < 2) { // The patterns appear if version >= 2\n return;\n }\n const index = version.getVersionNumber() - 1;\n const coordinates: Int32Array = MatrixUtil.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[index];\n for (let i = 0, length = coordinates.length; i !== length; i++) {\n const y = coordinates[i];\n if (y >= 0) {\n for (let j = 0; j !== length; j++) {\n const x = coordinates[j];\n if (x >= 0 && MatrixUtil.isEmpty(matrix.get(x, y))) {\n // If the cell is unset, we embed the position adjustment pattern here.\n // -2 is necessary since the x/y coordinates point to the center of the pattern, not the\n // left top corner.\n MatrixUtil.embedPositionAdjustmentPattern(x - 2, y - 2, matrix);\n }\n }\n }\n }\n }\n\n}\n","/*\n * Copyright 2008 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*namespace com.google.zxing.qrcode.encoder {*/\n\nexport default class BlockPair {\n\n public constructor(private dataBytes: Uint8Array, private errorCorrectionBytes: Uint8Array) { }\n\n public getDataBytes(): Uint8Array {\n return this.dataBytes;\n }\n\n public getErrorCorrectionBytes(): Uint8Array {\n return this.errorCorrectionBytes;\n }\n\n}\n","/*\n * Copyright 2008 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*namespace com.google.zxing {*/\n\nimport BitMatrix from './common/BitMatrix';\n// import DataMatrixWriter from './datamatrix/DataMatrixWriter'\n// import CodaBarWriter from './oned/CodaBarWriter'\n// import Code128Writer from './oned/Code128Writer'\n// import Code39Writer from './oned/Code39Writer'\n// import Code93Writer from './oned/Code93Writer'\n// import EAN13Writer from './oned/EAN13Writer'\n// import EAN8Writer from './oned/EAN8Writer'\n// import ITFWriter from './oned/ITFWriter'\n// import UPCAWriter from './oned/UPCAWriter'\n// import UPCEWriter from './oned/UPCEWriter'\n// import PDF417Writer from './pdf417/PDF417Writer'\nimport QRCodeWriter from './qrcode/QRCodeWriter';\nimport Writer from './Writer';\nimport BarcodeFormat from './BarcodeFormat';\nimport EncodeHintType from './EncodeHintType';\n\nimport IllegalArgumentException from './IllegalArgumentException';\n\n/*import java.util.Map;*/\n\n/**\n * This is a factory class which finds the appropriate Writer subclass for the BarcodeFormat\n * requested and encodes the barcode with the supplied contents.\n *\n * @author dswitkin@google.com (Daniel Switkin)\n */\nexport default class MultiFormatWriter implements Writer {\n\n /*@Override*/\n // public encode(contents: string,\n // format: BarcodeFormat,\n // width: number /*int*/,\n // height: number /*int*/): BitMatrix /*throws WriterException */ {\n // return encode(contents, format, width, height, null)\n // }\n\n /*@Override*/\n public encode(contents: string,\n format: BarcodeFormat,\n width: number /*int*/, height: number /*int*/,\n hints: Map): BitMatrix /*throws WriterException */ {\n\n let writer: Writer;\n switch (format) {\n // case BarcodeFormat.EAN_8:\n // writer = new EAN8Writer()\n // break\n // case BarcodeFormat.UPC_E:\n // writer = new UPCEWriter()\n // break\n // case BarcodeFormat.EAN_13:\n // writer = new EAN13Writer()\n // break\n // case BarcodeFormat.UPC_A:\n // writer = new UPCAWriter()\n // break\n case BarcodeFormat.QR_CODE:\n writer = new QRCodeWriter();\n break;\n // case BarcodeFormat.CODE_39:\n // writer = new Code39Writer()\n // break\n // case BarcodeFormat.CODE_93:\n // writer = new Code93Writer()\n // break\n // case BarcodeFormat.CODE_128:\n // writer = new Code128Writer()\n // break\n // case BarcodeFormat.ITF:\n // writer = new ITFWriter()\n // break\n // case BarcodeFormat.PDF_417:\n // writer = new PDF417Writer()\n // break\n // case BarcodeFormat.CODABAR:\n // writer = new CodaBarWriter()\n // break\n // case BarcodeFormat.DATA_MATRIX:\n // writer = new DataMatrixWriter()\n // break\n // case BarcodeFormat.AZTEC:\n // writer = new AztecWriter()\n // break\n default:\n throw new IllegalArgumentException('No encoder available for format ' + format);\n }\n return writer.encode(contents, format, width, height, hints);\n }\n\n}\n","/*\n * Copyright 2009 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*namespace com.google.zxing {*/\n\nimport System from './util/System';\n\nimport LuminanceSource from './LuminanceSource';\nimport InvertedLuminanceSource from './InvertedLuminanceSource';\nimport IllegalArgumentException from './IllegalArgumentException';\n\n/**\n * This object extends LuminanceSource around an array of YUV data returned from the camera driver,\n * with the option to crop to a rectangle within the full data. This can be used to exclude\n * superfluous pixels around the perimeter and speed up decoding.\n *\n * It works for any pixel format where the Y channel is planar and appears first, including\n * YCbCr_420_SP and YCbCr_422_SP.\n *\n * @author dswitkin@google.com (Daniel Switkin)\n */\nexport default class PlanarYUVLuminanceSource extends LuminanceSource {\n\n private static THUMBNAIL_SCALE_FACTOR: number /*int*/ = 2;\n\n public constructor(private yuvData: Uint8ClampedArray,\n private dataWidth: number /*int*/,\n private dataHeight: number /*int*/,\n private left: number /*int*/,\n private top: number /*int*/,\n width: number /*int*/,\n height: number /*int*/,\n reverseHorizontal: boolean) {\n super(width, height);\n\n if (left + width > dataWidth || top + height > dataHeight) {\n throw new IllegalArgumentException('Crop rectangle does not fit within image data.');\n }\n\n if (reverseHorizontal) {\n this.reverseHorizontal(width, height);\n }\n }\n\n /*@Override*/\n public getRow(y: number /*int*/, row?: Uint8ClampedArray): Uint8ClampedArray {\n if (y < 0 || y >= this.getHeight()) {\n throw new IllegalArgumentException('Requested row is outside the image: ' + y);\n }\n const width: number /*int*/ = this.getWidth();\n if (row === null || row === undefined || row.length < width) {\n row = new Uint8ClampedArray(width);\n }\n const offset = (y + this.top) * this.dataWidth + this.left;\n System.arraycopy(this.yuvData, offset, row, 0, width);\n return row;\n }\n\n /*@Override*/\n public getMatrix(): Uint8ClampedArray {\n const width: number /*int*/ = this.getWidth();\n const height: number /*int*/ = this.getHeight();\n\n // If the caller asks for the entire underlying image, save the copy and give them the\n // original data. The docs specifically warn that result.length must be ignored.\n if (width === this.dataWidth && height === this.dataHeight) {\n return this.yuvData;\n }\n\n const area = width * height;\n const matrix = new Uint8ClampedArray(area);\n let inputOffset = this.top * this.dataWidth + this.left;\n\n // If the width matches the full width of the underlying data, perform a single copy.\n if (width === this.dataWidth) {\n System.arraycopy(this.yuvData, inputOffset, matrix, 0, area);\n return matrix;\n }\n\n // Otherwise copy one cropped row at a time.\n for (let y = 0; y < height; y++) {\n const outputOffset = y * width;\n System.arraycopy(this.yuvData, inputOffset, matrix, outputOffset, width);\n inputOffset += this.dataWidth;\n }\n return matrix;\n }\n\n /*@Override*/\n public isCropSupported(): boolean {\n return true;\n }\n\n /*@Override*/\n public crop(left: number /*int*/, top: number /*int*/, width: number /*int*/, height: number /*int*/): LuminanceSource {\n return new PlanarYUVLuminanceSource(this.yuvData,\n this.dataWidth,\n this.dataHeight,\n this.left + left,\n this.top + top,\n width,\n height,\n false);\n }\n\n public renderThumbnail(): Int32Array {\n const width: number /*int*/ = this.getWidth() / PlanarYUVLuminanceSource.THUMBNAIL_SCALE_FACTOR;\n const height: number /*int*/ = this.getHeight() / PlanarYUVLuminanceSource.THUMBNAIL_SCALE_FACTOR;\n const pixels = new Int32Array(width * height);\n const yuv = this.yuvData;\n let inputOffset = this.top * this.dataWidth + this.left;\n\n for (let y = 0; y < height; y++) {\n const outputOffset = y * width;\n for (let x = 0; x < width; x++) {\n const grey = yuv[inputOffset + x * PlanarYUVLuminanceSource.THUMBNAIL_SCALE_FACTOR] & 0xff;\n pixels[outputOffset + x] = 0xFF000000 | (grey * 0x00010101);\n }\n inputOffset += this.dataWidth * PlanarYUVLuminanceSource.THUMBNAIL_SCALE_FACTOR;\n }\n return pixels;\n }\n\n /**\n * @return width of image from {@link #renderThumbnail()}\n */\n public getThumbnailWidth(): number /*int*/ {\n return this.getWidth() / PlanarYUVLuminanceSource.THUMBNAIL_SCALE_FACTOR;\n }\n\n /**\n * @return height of image from {@link #renderThumbnail()}\n */\n public getThumbnailHeight(): number /*int*/ {\n return this.getHeight() / PlanarYUVLuminanceSource.THUMBNAIL_SCALE_FACTOR;\n }\n\n private reverseHorizontal(width: number /*int*/, height: number /*int*/): void {\n const yuvData = this.yuvData;\n for (let y = 0, rowStart = this.top * this.dataWidth + this.left; y < height; y++ , rowStart += this.dataWidth) {\n const middle = rowStart + width / 2;\n for (let x1 = rowStart, x2 = rowStart + width - 1; x1 < middle; x1++ , x2--) {\n const temp = yuvData[x1];\n yuvData[x1] = yuvData[x2];\n yuvData[x2] = temp;\n }\n }\n }\n\n public invert(): LuminanceSource {\n return new InvertedLuminanceSource(this);\n }\n\n}\n","/*\n * Copyright 2009 ZXing authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*namespace com.google.zxing {*/\n\nimport './InvertedLuminanceSource'; // required because of circular dependencies between LuminanceSource and InvertedLuminanceSource\nimport InvertedLuminanceSource from './InvertedLuminanceSource';\nimport LuminanceSource from './LuminanceSource';\n\nimport System from './util/System';\nimport IllegalArgumentException from './IllegalArgumentException';\n\n/**\n * This class is used to help decode images from files which arrive as RGB data from\n * an ARGB pixel array. It does not support rotation.\n *\n * @author dswitkin@google.com (Daniel Switkin)\n * @author Betaminos\n */\nexport default class RGBLuminanceSource extends LuminanceSource {\n\n // public constructor(width: number /*int*/, height: number /*int*/, const pixels: Int32Array) {\n // super(width, height)\n\n // dataWidth = width\n // dataHeight = height\n // left = 0\n // top = 0\n\n // // In order to measure pure decoding speed, we convert the entire image to a greyscale array\n // // up front, which is the same as the Y channel of the YUVLuminanceSource in the real app.\n // //\n // // Total number of pixels suffices, can ignore shape\n // const size = width * height;\n // luminances = new byte[size]\n // for (let offset = 0; offset < size; offset++) {\n // const pixel = pixels[offset]\n // const r = (pixel >> 16) & 0xff; // red\n // const g2 = (pixel >> 7) & 0x1fe; // 2 * green\n // const b = pixel & 0xff; // blue\n // // Calculate green-favouring average cheaply\n // luminances[offset] = (byte) ((r + g2 + b) / 4)\n // }\n // }\n\n private luminances: Uint8ClampedArray;\n\n public constructor(luminances: Uint8ClampedArray | Int32Array,\n width: number /*int*/,\n height: number /*int*/,\n private dataWidth?: number /*int*/,\n private dataHeight?: number /*int*/,\n private left?: number /*int*/,\n private top?: number /*int*/) {\n super(width, height);\n\n if (luminances.BYTES_PER_ELEMENT === 4) {// Int32Array\n const size = width * height;\n const luminancesUint8Array = new Uint8ClampedArray(size);\n for (let offset = 0; offset < size; offset++) {\n const pixel = luminances[offset];\n const r = (pixel >> 16) & 0xff; // red\n const g2 = (pixel >> 7) & 0x1fe; // 2 * green\n const b = pixel & 0xff; // blue\n // Calculate green-favouring average cheaply\n luminancesUint8Array[offset] = /*(byte) */((r + g2 + b) / 4) & 0xFF;\n }\n this.luminances = luminancesUint8Array;\n } else {\n this.luminances = luminances;\n }\n\n if (undefined === dataWidth) {\n this.dataWidth = width;\n }\n if (undefined === dataHeight) {\n this.dataHeight = height;\n }\n if (undefined === left) {\n this.left = 0;\n }\n if (undefined === top) {\n this.top = 0;\n }\n if (this.left + width > this.dataWidth || this.top + height > this.dataHeight) {\n throw new IllegalArgumentException('Crop rectangle does not fit within image data.');\n }\n }\n\n /*@Override*/\n public getRow(y: number /*int*/, row?: Uint8ClampedArray): Uint8ClampedArray {\n if (y < 0 || y >= this.getHeight()) {\n throw new IllegalArgumentException('Requested row is outside the image: ' + y);\n }\n const width = this.getWidth();\n if (row === null || row === undefined || row.length < width) {\n row = new Uint8ClampedArray(width);\n }\n const offset = (y + this.top) * this.dataWidth + this.left;\n System.arraycopy(this.luminances, offset, row, 0, width);\n return row;\n }\n\n /*@Override*/\n public getMatrix(): Uint8ClampedArray {\n\n const width = this.getWidth();\n const height = this.getHeight();\n\n // If the caller asks for the entire underlying image, save the copy and give them the\n // original data. The docs specifically warn that result.length must be ignored.\n if (width === this.dataWidth && height === this.dataHeight) {\n return this.luminances;\n }\n\n const area = width * height;\n const matrix = new Uint8ClampedArray(area);\n let inputOffset = this.top * this.dataWidth + this.left;\n\n // If the width matches the full width of the underlying data, perform a single copy.\n if (width === this.dataWidth) {\n System.arraycopy(this.luminances, inputOffset, matrix, 0, area);\n return matrix;\n }\n\n // Otherwise copy one cropped row at a time.\n for (let y = 0; y < height; y++) {\n const outputOffset = y * width;\n System.arraycopy(this.luminances, inputOffset, matrix, outputOffset, width);\n inputOffset += this.dataWidth;\n }\n return matrix;\n }\n\n /*@Override*/\n public isCropSupported(): boolean {\n return true;\n }\n\n /*@Override*/\n public crop(left: number /*int*/, top: number /*int*/, width: number /*int*/, height: number /*int*/): LuminanceSource {\n return new RGBLuminanceSource(this.luminances,\n width,\n height,\n this.dataWidth,\n this.dataHeight,\n this.left + left,\n this.top + top, );\n }\n\n public invert(): LuminanceSource {\n return new InvertedLuminanceSource(this);\n }\n}\n","\nimport BarcodeFormat from '../../../BarcodeFormat';\nimport DecodeHintType from '../../../DecodeHintType';\nimport FormatException from '../../../FormatException';\nimport NotFoundException from '../../../NotFoundException';\nimport Result from '../../../Result';\nimport ResultPoint from '../../../ResultPoint';\nimport BitArray from '../../../common/BitArray';\nimport MathUtils from '../../../common/detector/MathUtils';\nimport AbstractRSSReader from '../../rss/AbstractRSSReader';\nimport DataCharacter from '../../rss/DataCharacter';\nimport FinderPattern from '../../rss/FinderPattern';\nimport RSSUtils from '../../rss/RSSUtils';\nimport { createDecoder } from './decoders/AbstractExpandedDecoderComplement';\nimport ExpandedPair from './ExpandedPair';\nimport ExpandedRow from './ExpandedRow';\nimport BitArrayBuilder from './BitArrayBuilder';\nimport System from '../../../util/System';\n\n\n// import java.util.ArrayList;\n// import java.util.Iterator;\n// import java.util.List;\n// import java.util.Map;\n// import java.util.Collections;\n\nexport default class RSSExpandedReader extends AbstractRSSReader {\n\n private static readonly SYMBOL_WIDEST = [7, 5, 4, 3, 1];\n private static readonly EVEN_TOTAL_SUBSET = [4, 20, 52, 104, 204];\n private static readonly GSUM = [0, 348, 1388, 2948, 3988];\n\n private static readonly FINDER_PATTERNS = [\n [1,8,4,1], // A\n [3,6,4,1], // B\n [3,4,6,1], // C\n [3,2,8,1], // D\n [2,6,5,1], // E\n [2,2,9,1] // F\n ];\n\n private static readonly WEIGHTS = [\n [ 1, 3, 9, 27, 81, 32, 96, 77],\n [ 20, 60, 180, 118, 143, 7, 21, 63],\n [189, 145, 13, 39, 117, 140, 209, 205],\n [193, 157, 49, 147, 19, 57, 171, 91],\n [62, 186, 136, 197, 169, 85, 44, 132],\n [185, 133, 188, 142, 4, 12, 36, 108],\n [113, 128, 173, 97, 80, 29, 87, 50],\n [150, 28, 84, 41, 123, 158, 52, 156],\n [46, 138, 203, 187, 139, 206, 196, 166],\n [ 76, 17, 51, 153, 37, 111, 122, 155],\n [ 43, 129, 176, 106, 107, 110, 119, 146],\n [16, 48, 144, 10, 30, 90, 59, 177],\n [109, 116, 137, 200, 178, 112, 125, 164],\n [70, 210, 208, 202, 184, 130, 179, 115],\n [134, 191, 151, 31, 93, 68, 204, 190],\n [148, 22, 66, 198, 172, 94, 71, 2],\n [6, 18, 54, 162, 64, 192,154, 40],\n [120, 149, 25, 75, 14, 42,126, 167],\n [ 79, 26, 78, 23, 69, 207,199, 175],\n [103, 98, 83, 38, 114, 131, 182, 124],\n [161, 61, 183, 127, 170, 88, 53, 159],\n [ 55, 165, 73, 8, 24, 72, 5, 15],\n [ 45, 135, 194, 160, 58, 174, 100, 89]\n ];\n\n private static readonly FINDER_PAT_A = 0;\n private static readonly FINDER_PAT_B = 1;\n private static readonly FINDER_PAT_C = 2;\n private static readonly FINDER_PAT_D = 3;\n private static readonly FINDER_PAT_E = 4;\n private static readonly FINDER_PAT_F = 5;\n\n private static readonly FINDER_PATTERN_SEQUENCES = [\n [RSSExpandedReader.FINDER_PAT_A, RSSExpandedReader.FINDER_PAT_A],\n [RSSExpandedReader.FINDER_PAT_A, RSSExpandedReader.FINDER_PAT_B, RSSExpandedReader.FINDER_PAT_B ],\n [RSSExpandedReader.FINDER_PAT_A, RSSExpandedReader.FINDER_PAT_C, RSSExpandedReader.FINDER_PAT_B, RSSExpandedReader.FINDER_PAT_D ],\n [RSSExpandedReader.FINDER_PAT_A, RSSExpandedReader.FINDER_PAT_E, RSSExpandedReader.FINDER_PAT_B, RSSExpandedReader.FINDER_PAT_D, RSSExpandedReader.FINDER_PAT_C ],\n [RSSExpandedReader.FINDER_PAT_A, RSSExpandedReader.FINDER_PAT_E, RSSExpandedReader.FINDER_PAT_B, RSSExpandedReader.FINDER_PAT_D, RSSExpandedReader.FINDER_PAT_D, RSSExpandedReader.FINDER_PAT_F ],\n [RSSExpandedReader.FINDER_PAT_A, RSSExpandedReader.FINDER_PAT_E, RSSExpandedReader.FINDER_PAT_B, RSSExpandedReader.FINDER_PAT_D, RSSExpandedReader.FINDER_PAT_E, RSSExpandedReader.FINDER_PAT_F, RSSExpandedReader.FINDER_PAT_F ],\n [RSSExpandedReader.FINDER_PAT_A, RSSExpandedReader.FINDER_PAT_A, RSSExpandedReader.FINDER_PAT_B, RSSExpandedReader.FINDER_PAT_B, RSSExpandedReader.FINDER_PAT_C, RSSExpandedReader.FINDER_PAT_C, RSSExpandedReader.FINDER_PAT_D, RSSExpandedReader.FINDER_PAT_D],\n [RSSExpandedReader.FINDER_PAT_A, RSSExpandedReader.FINDER_PAT_A, RSSExpandedReader.FINDER_PAT_B, RSSExpandedReader.FINDER_PAT_B, RSSExpandedReader.FINDER_PAT_C, RSSExpandedReader.FINDER_PAT_C, RSSExpandedReader.FINDER_PAT_D, RSSExpandedReader.FINDER_PAT_E, RSSExpandedReader.FINDER_PAT_E ],\n [RSSExpandedReader.FINDER_PAT_A, RSSExpandedReader.FINDER_PAT_A, RSSExpandedReader.FINDER_PAT_B, RSSExpandedReader.FINDER_PAT_B, RSSExpandedReader.FINDER_PAT_C, RSSExpandedReader.FINDER_PAT_C, RSSExpandedReader.FINDER_PAT_D, RSSExpandedReader.FINDER_PAT_E, RSSExpandedReader.FINDER_PAT_F, RSSExpandedReader.FINDER_PAT_F ],\n [RSSExpandedReader.FINDER_PAT_A, RSSExpandedReader.FINDER_PAT_A, RSSExpandedReader.FINDER_PAT_B, RSSExpandedReader.FINDER_PAT_B, RSSExpandedReader.FINDER_PAT_C, RSSExpandedReader.FINDER_PAT_D, RSSExpandedReader.FINDER_PAT_D, RSSExpandedReader.FINDER_PAT_E, RSSExpandedReader.FINDER_PAT_E, RSSExpandedReader.FINDER_PAT_F, RSSExpandedReader.FINDER_PAT_F ],\n ];\n\n private static readonly MAX_PAIRS = 11;\n\n private pairs: any= new Array(RSSExpandedReader.MAX_PAIRS);\n private rows: any= new Array();\n\n private readonly startEnd = [2];\n private startFromEven:boolean;\n\n public decodeRow(rowNumber:number,row:BitArray,hints:Map):Result {\n // Rows can start with even pattern in case in prev rows there where odd number of patters.\n // So lets try twice\n //this.pairs.clear();\n this.pairs.length = 0;\n this.startFromEven = false;\n try {\n return RSSExpandedReader.constructResult(this.decodeRow2pairs(rowNumber, row));\n } catch (e) {\n // OK\n console.log(e);\n }\n\n this.pairs.length = 0;\n this.startFromEven = true;\n return RSSExpandedReader.constructResult(this.decodeRow2pairs(rowNumber, row));\n }\n\n\n public reset():void {\n this.pairs.length = 0 ;\n this.rows.length = 0;\n }\n\n // Not private for testing\n decodeRow2pairs(rowNumber:number,row:BitArray):Array {\n let done = false;\n while (!done) {\n try {\n this.pairs.push(this.retrieveNextPair(row, this.pairs, rowNumber));\n } catch (NotFoundException) {\n if (!this.pairs.length) {\n throw new NotFoundException();\n }\n // exit this loop when retrieveNextPair() fails and throws\n done = true;\n }\n }\n\n // TODO: verify sequence of finder patterns as in checkPairSequence()\n if (this.checkChecksum()) {\n return this.pairs;\n }\n let tryStackedDecode;\n if (this.rows.length) {\n tryStackedDecode = true;\n } else {\n tryStackedDecode = false;\n }\n //let tryStackedDecode = !this.rows.isEmpty();\n this.storeRow(rowNumber, false); // TODO: deal with reversed rows\n if (tryStackedDecode) {\n // When the image is 180-rotated, then rows are sorted in wrong direction.\n // Try twice with both the directions.\n let ps = this.checkRowsBoolean(false);\n if (ps != null) {\n return ps;\n }\n ps = this.checkRowsBoolean(true);\n if (ps != null) {\n return ps;\n }\n }\n\n throw new NotFoundException()\n }\n //Need to Verify\n private checkRowsBoolean(reverse:boolean):Array {\n // Limit number of rows we are checking\n // We use recursive algorithm with pure complexity and don't want it to take forever\n // Stacked barcode can have up to 11 rows, so 25 seems reasonable enough\n if (this.rows.length > 25) {\n this.rows.length = 0 // We will never have a chance to get result, so clear it\n return null;\n }\n\n this.pairs.length = 0\n if (reverse) {\n this.rows = this.rows.reverse()\n //Collections.reverse(this.rows);\n }\n let ps: Array = null;\n try {\n ps = this.checkRows(new Array(), 0);\n } catch ( e) {\n // OK\n console.log(e);\n }\n\n if (reverse) {\n this.rows = this.rows.reverse();\n //Collections.reverse(this.rows);\n }\n\n return ps;\n }\n\n // Try to construct a valid rows sequence\n // Recursion is used to implement backtracking\n private checkRows(collectedRows:any,currentRow:number):Array {\n for (let i = currentRow; i < this.rows.length; i++) {\n let row:any = this.rows[i];\n this.pairs.length = 0;\n for (let collectedRow of collectedRows) {\n this.pairs.push(collectedRow.getPairs());\n }\n this.pairs.push(row.getPairs());\n\n if (!RSSExpandedReader.isValidSequence(this.pairs)) {\n continue;\n }\n\n if (this.checkChecksum()) {\n return this.pairs;\n }\n\n let rs = new Array(collectedRows);\n rs.push(row);\n try {\n // Recursion: try to add more rows\n return this.checkRows(rs, i + 1);\n } catch ( e) {\n // We failed, try the next candidate\n console.log(e);\n }\n }\n\n throw new NotFoundException();\n }\n\n // Whether the pairs form a valid find pattern sequence,\n // either complete or a prefix\n private static isValidSequence(pairs:Array):boolean {\n for (let sequence of RSSExpandedReader.FINDER_PATTERN_SEQUENCES) {\n if (pairs.length > sequence.length) {\n continue;\n }\n\n let stop = true;\n for (let j = 0; j < pairs.length; j++) {\n if (pairs[j].getFinderPattern().getValue() != sequence[j]) {\n stop = false;\n break;\n }\n }\n\n if (stop) {\n return true;\n }\n }\n\n return false;\n }\n\n private storeRow(rowNumber:number,wasReversed:boolean):void {\n // Discard if duplicate above or below; otherwise insert in order by row number.\n let insertPos = 0;\n let prevIsSame = false;\n let nextIsSame = false;\n while (insertPos < this.rows.length) {\n let erow = this.rows[insertPos];\n if (erow.getRowNumber() > rowNumber) {\n nextIsSame = erow.isEquivalent(this.pairs);\n break;\n }\n prevIsSame = erow.isEquivalent(this.pairs);\n insertPos++;\n }\n if (nextIsSame || prevIsSame) {\n return;\n }\n\n // When the row was partially decoded (e.g. 2 pairs found instead of 3),\n // it will prevent us from detecting the barcode.\n // Try to merge partial rows\n\n // Check whether the row is part of an allready detected row\n if (RSSExpandedReader.isPartialRow(this.pairs, this.rows)) {\n return;\n }\n\n this.rows.push(insertPos, new ExpandedRow(this.pairs, rowNumber, wasReversed));\n\n this.removePartialRows(this.pairs, this.rows);\n }\n\n // Remove all the rows that contains only specified pairs\n private removePartialRows(pairs:Array, rows:Array):void {\n // for (Iterator iterator = rows.iterator(); iterator.hasNext();) {\n // ExpandedRow r = iterator.next();\n // if (r.getPairs().size() == pairs.size()) {\n // continue;\n // }\n // boolean allFound = true;\n // for (ExpandedPair p : r.getPairs()) {\n // boolean found = false;\n // for (ExpandedPair pp : pairs) {\n // if (p.equals(pp)) {\n // found = true;\n // break;\n // }\n // }\n // if (!found) {\n // allFound = false;\n // break;\n // }\n // }\n // if (allFound) {\n // // 'pairs' contains all the pairs from the row 'r'\n // iterator.remove();\n // }\n // }\n for (let row of rows) {\n if (row.getPairs().length === pairs.length) {\n continue;\n }\n let allFound = true;\n for (let p of row.getPairs()) {\n let found = false;\n for (let pp of pairs) {\n if (ExpandedPair.equals(p, pp)) {\n found = true;\n break;\n }\n }\n if (!found) {\n allFound = false;\n }\n }\n }\n }\n\n // Returns true when one of the rows already contains all the pairs\n private static isPartialRow(pairs:any, rows:any):boolean {\n for (let r of rows) {\n let allFound = true;\n for (let p of pairs) {\n let found = false;\n for (let pp of r.getPairs()) {\n if (p.equals(pp)) {\n found = true;\n break;\n }\n }\n if (!found) {\n allFound = false;\n break;\n }\n }\n if (allFound) {\n // the row 'r' contain all the pairs from 'pairs'\n return true;\n }\n }\n return false;\n }\n\n // Only used for unit testing\n getRows() {\n return this.rows;\n }\n\n // Not private for unit testing\n static constructResult(pairs:Array){\n let binary = BitArrayBuilder.buildBitArray(pairs);\n\n let decoder = createDecoder(binary);\n let resultingString = decoder.parseInformation();\n\n let firstPoints = pairs[0].getFinderPattern().getResultPoints();\n let lastPoints = pairs[pairs.length - 1].getFinderPattern().getResultPoints();\n let points = [firstPoints[0], firstPoints[1], lastPoints[0], lastPoints[1]];\n return new Result(\n resultingString,\n null,\n null,\n points,\n BarcodeFormat.RSS_EXPANDED,\n null\n );\n\n }\n\n private checkChecksum():boolean {\n let firstPair = this.pairs.get(0);\n let checkCharacter = firstPair.getLeftChar();\n let firstCharacter = firstPair.getRightChar();\n\n if (firstCharacter == null) {\n return false;\n }\n\n let checksum = firstCharacter.getChecksumPortion();\n let s = 2;\n\n for (let i = 1; i < this.pairs.size(); ++i) {\n let currentPair = this.pairs.get(i);\n checksum += currentPair.getLeftChar().getChecksumPortion();\n s++;\n let currentRightChar = currentPair.getRightChar();\n if (currentRightChar != null) {\n checksum += currentRightChar.getChecksumPortion();\n s++;\n }\n }\n\n checksum %= 211;\n\n let checkCharacterValue = 211 * (s - 4) + checksum;\n\n return checkCharacterValue == checkCharacter.getValue();\n }\n\n private static getNextSecondBar(row:BitArray,initialPos:number):number{\n let currentPos;\n if (row.get(initialPos)) {\n currentPos = row.getNextUnset(initialPos);\n currentPos = row.getNextSet(currentPos);\n } else {\n currentPos = row.getNextSet(initialPos);\n currentPos = row.getNextUnset(currentPos);\n }\n return currentPos;\n }\n\n // not private for testing\n retrieveNextPair(row:BitArray,previousPairs:Array,rowNumber:number):ExpandedPair{\n let isOddPattern = previousPairs.length % 2 == 0;\n if (this.startFromEven) {\n isOddPattern = !isOddPattern;\n }\n\n let pattern;\n\n let keepFinding = true;\n let forcedOffset = -1;\n do {\n this.findNextPair(row, previousPairs, forcedOffset);\n pattern = this.parseFoundFinderPattern(row, rowNumber, isOddPattern);\n if (pattern == null) {\n forcedOffset = RSSExpandedReader.getNextSecondBar(row, this.startEnd[0]);\n } else {\n keepFinding = false;\n }\n } while (keepFinding);\n\n // When stacked symbol is split over multiple rows, there's no way to guess if this pair can be last or not.\n // boolean mayBeLast = checkPairSequence(previousPairs, pattern);\n\n let leftChar = this.decodeDataCharacter(row, pattern, isOddPattern, true);\n\n if (!this.isEmptyPair(previousPairs) && previousPairs[previousPairs.length - 1].mustBeLast()) {\n throw new NotFoundException();\n }\n\n let rightChar;\n try {\n rightChar = this.decodeDataCharacter(row, pattern, isOddPattern, false);\n } catch (e) {\n rightChar = null;\n console.log(e);\n }\n return new ExpandedPair(leftChar, rightChar, pattern, true);\n }\n isEmptyPair(pairs) {\n if (pairs.length === 0) {\n return true;\n }\n return false;\n }\n private findNextPair(row:BitArray ,previousPairs:Array,forcedOffset:number):void{\n let counters = this.getDecodeFinderCounters();\n counters[0] = 0;\n counters[1] = 0;\n counters[2] = 0;\n counters[3] = 0;\n\n let width = row.getSize();\n\n let rowOffset;\n if (forcedOffset >= 0) {\n rowOffset = forcedOffset;\n } else if (this.isEmptyPair(previousPairs)) {\n rowOffset = 0;\n } else {\n let lastPair = previousPairs[previousPairs.length - 1];\n rowOffset = lastPair.getFinderPattern().getStartEnd()[1];\n }\n let searchingEvenPair = previousPairs.length % 2 != 0;\n if (this.startFromEven) {\n searchingEvenPair = !searchingEvenPair;\n }\n\n let isWhite = false;\n while (rowOffset < width) {\n isWhite = !row.get(rowOffset);\n if (!isWhite) {\n break;\n }\n rowOffset++;\n }\n\n let counterPosition = 0;\n let patternStart = rowOffset;\n for (let x = rowOffset; x < width; x++) {\n if (row.get(x) != isWhite) {\n counters[counterPosition]++;\n } else {\n if (counterPosition == 3) {\n if (searchingEvenPair) {\n RSSExpandedReader.reverseCounters(counters);\n }\n\n if (RSSExpandedReader.isFinderPattern(counters)) {\n this.startEnd[0] = patternStart;\n this.startEnd[1] = x;\n return;\n }\n\n if (searchingEvenPair) {\n RSSExpandedReader.reverseCounters(counters);\n }\n\n patternStart += counters[0] + counters[1];\n counters[0] = counters[2];\n counters[1] = counters[3];\n counters[2] = 0;\n counters[3] = 0;\n counterPosition--;\n } else {\n counterPosition++;\n }\n counters[counterPosition] = 1;\n isWhite = !isWhite;\n }\n }\n throw new NotFoundException();\n }\n\n private static reverseCounters(counters):void {\n let length = counters.length;\n for (let i = 0; i < length / 2; ++i) {\n let tmp = counters[i];\n counters[i] = counters[length - i - 1];\n counters[length - i - 1] = tmp;\n }\n }\n\n private parseFoundFinderPattern(row:BitArray, rowNumber:number,oddPattern:boolean):FinderPattern {\n // Actually we found elements 2-5.\n let firstCounter;\n let start;\n let end;\n\n if (oddPattern) {\n // If pattern number is odd, we need to locate element 1 *before* the current block.\n\n let firstElementStart = this.startEnd[0] - 1;\n // Locate element 1\n while (firstElementStart >= 0 && !row.get(firstElementStart)) {\n firstElementStart--;\n }\n\n firstElementStart++;\n firstCounter = this.startEnd[0] - firstElementStart;\n start = firstElementStart;\n end = this.startEnd[1];\n\n } else {\n // If pattern number is even, the pattern is reversed, so we need to locate element 1 *after* the current block.\n\n start = this.startEnd[0];\n\n end = row.getNextUnset(this.startEnd[1] + 1);\n firstCounter = end - this.startEnd[1];\n }\n\n // Make 'counters' hold 1-4\n let counters = this.getDecodeFinderCounters();\n System.arraycopy(counters, 0, counters, 1, counters.length - 1);\n\n counters[0] = firstCounter;\n let value;\n try {\n value = this.parseFinderValue(counters, RSSExpandedReader.FINDER_PATTERNS);\n } catch (e) {\n return null;\n console.log(e);\n }\n //return new FinderPattern(value, new int[] { start, end }, start, end, rowNumber});\n return new FinderPattern(value,[start,end],start,end,rowNumber)\n }\n\n decodeDataCharacter(row: BitArray, pattern: FinderPattern, isOddPattern: boolean, leftChar: boolean) {\n let counters = this.getDataCharacterCounters();\n for (let x = 0; x < counters.length; x++) {\n counters[x] = 0;\n }\n\n if (leftChar) {\n RSSExpandedReader.recordPatternInReverse(row, pattern.getStartEnd()[0], counters);\n } else {\n RSSExpandedReader.recordPattern(row, pattern.getStartEnd()[1], counters);\n // reverse it\n for (let i = 0, j = counters.length - 1; i < j; i++ , j--) {\n let temp = counters[i];\n counters[i] = counters[j];\n counters[j] = temp;\n }\n } //counters[] has the pixels of the module\n\n let numModules = 17; //left and right data characters have all the same length\n let elementWidth = MathUtils.sum(new Int32Array(counters)) / numModules;\n\n // Sanity check: element width for pattern and the character should match\n let expectedElementWidth = (pattern.getStartEnd()[1] - pattern.getStartEnd()[0]) / 15.0;\n if (Math.abs(elementWidth - expectedElementWidth) / expectedElementWidth > 0.3) {\n throw new NotFoundException();\n }\n\n let oddCounts = this.getOddCounts();\n let evenCounts = this.getEvenCounts();\n let oddRoundingErrors = this.getOddRoundingErrors();\n let evenRoundingErrors = this.getEvenRoundingErrors();\n\n for (let i = 0; i < counters.length; i++) {\n let value = 1.0 * counters[i] / elementWidth;\n let count = value + 0.5; // Round\n if (count < 1) {\n if (value < 0.3) {\n throw new NotFoundException();\n }\n count = 1;\n } else if (count > 8) {\n if (value > 8.7) {\n throw new NotFoundException();\n }\n count = 8;\n }\n let offset = i / 2;\n if ((i & 0x01) == 0) {\n oddCounts[offset] = count;\n oddRoundingErrors[offset] = value - count;\n } else {\n evenCounts[offset] = count;\n evenRoundingErrors[offset] = value - count;\n }\n }\n\n this.adjustOddEvenCounts(numModules);\n\n let weightRowNumber = 4 * pattern.getValue() + (isOddPattern ? 0 : 2) + (leftChar ? 0 : 1) - 1;\n\n let oddSum = 0;\n let oddChecksumPortion = 0;\n for (let i = oddCounts.length - 1; i >= 0; i--) {\n if (RSSExpandedReader.isNotA1left(pattern, isOddPattern, leftChar)) {\n let weight = RSSExpandedReader.WEIGHTS[weightRowNumber][2 * i];\n oddChecksumPortion += oddCounts[i] * weight;\n }\n oddSum += oddCounts[i];\n }\n let evenChecksumPortion = 0;\n //int evenSum = 0;\n for (let i = evenCounts.length - 1; i >= 0; i--) {\n if (RSSExpandedReader.isNotA1left(pattern, isOddPattern, leftChar)) {\n let weight = RSSExpandedReader.WEIGHTS[weightRowNumber][2 * i + 1];\n evenChecksumPortion += evenCounts[i] * weight;\n }\n //evenSum += evenCounts[i];\n }\n let checksumPortion = oddChecksumPortion + evenChecksumPortion;\n\n if ((oddSum & 0x01) != 0 || oddSum > 13 || oddSum < 4) {\n throw new NotFoundException();\n }\n\n let group = (13 - oddSum) / 2;\n let oddWidest = RSSExpandedReader.SYMBOL_WIDEST[group];\n let evenWidest = 9 - oddWidest;\n let vOdd = RSSUtils.getRSSvalue(oddCounts, oddWidest, true);\n let vEven = RSSUtils.getRSSvalue(evenCounts, evenWidest, false);\n let tEven = RSSExpandedReader.EVEN_TOTAL_SUBSET[group];\n let gSum = RSSExpandedReader.GSUM[group];\n let value = vOdd * tEven + vEven + gSum;\n\n return new DataCharacter(value, checksumPortion);\n }\n\n private static isNotA1left(pattern:FinderPattern, isOddPattern:boolean, leftChar:boolean):boolean{\n // A1: pattern.getValue is 0 (A), and it's an oddPattern, and it is a left char\n return !(pattern.getValue() == 0 && isOddPattern && leftChar);\n }\n\n private adjustOddEvenCounts(numModules){\n\n let oddSum = MathUtils.sum(new Int32Array(this.getOddCounts()));\n let evenSum = MathUtils.sum(new Int32Array(this.getEvenCounts()));\n\n let incrementOdd = false;\n let decrementOdd = false;\n\n if (oddSum > 13) {\n decrementOdd = true;\n } else if (oddSum < 4) {\n incrementOdd = true;\n }\n let incrementEven = false;\n let decrementEven = false;\n if (evenSum > 13) {\n decrementEven = true;\n } else if (evenSum < 4) {\n incrementEven = true;\n }\n\n let mismatch = oddSum + evenSum - numModules;\n let oddParityBad = (oddSum & 0x01) == 1;\n let evenParityBad = (evenSum & 0x01) == 0;\n if (mismatch == 1) {\n if (oddParityBad) {\n if (evenParityBad) {\n throw new NotFoundException();\n }\n decrementOdd = true;\n } else {\n if (!evenParityBad) {\n throw new NotFoundException();\n }\n decrementEven = true;\n }\n } else if (mismatch == -1) {\n if (oddParityBad) {\n if (evenParityBad) {\n throw new NotFoundException();\n }\n incrementOdd = true;\n } else {\n if (!evenParityBad) {\n throw new NotFoundException();\n }\n incrementEven = true;\n }\n } else if (mismatch == 0) {\n if (oddParityBad) {\n if (!evenParityBad) {\n throw new NotFoundException();\n }\n // Both bad\n if (oddSum < evenSum) {\n incrementOdd = true;\n decrementEven = true;\n } else {\n decrementOdd = true;\n incrementEven = true;\n }\n } else {\n if (evenParityBad) {\n throw new NotFoundException();\n }\n // Nothing to do!\n }\n } else {\n throw new NotFoundException();\n }\n\n if (incrementOdd) {\n if (decrementOdd) {\n throw new NotFoundException();\n }\n RSSExpandedReader.increment(this.getOddCounts(), this.getOddRoundingErrors());\n }\n if (decrementOdd) {\n RSSExpandedReader.decrement(this.getOddCounts(), this.getOddRoundingErrors());\n }\n if (incrementEven) {\n if (decrementEven) {\n throw new NotFoundException();\n }\n RSSExpandedReader.increment(this.getEvenCounts(), this.getOddRoundingErrors());\n }\n if (decrementEven) {\n RSSExpandedReader.decrement(this.getEvenCounts(), this.getEvenRoundingErrors());\n }\n }\n}\n","import IllegalStateException from '../../../../IllegalStateException';\nimport BitArray from '../../../../common/BitArray';\nimport GeneralAppIdDecoder from './GeneralAppIdDecoder';\nimport AI01AndOtherAIs from './AI01AndOtherAIs';\nimport AnyAIDecoder from './AnyAIDecoder';\nimport AI013103decoder from './AI013103decoder';\nimport AI01320xDecoder from './AI01320xDecoder';\nimport AI01392xDecoder from './AI01392xDecoder';\nimport AI01393xDecoder from './AI01393xDecoder';\nimport AI013x0x1xDecoder from './AI013x0x1xDecoder';\nimport AbstractExpandedDecoder from './AbstractExpandedDecoder';\n\n\nexport function createDecoder(information: BitArray): AbstractExpandedDecoder {\n try {\n if (information.get(1)) {\n return new AI01AndOtherAIs(information);\n\n }\n if (!information.get(2)) {\n return new AnyAIDecoder(information);\n }\n\n let fourBitEncodationMethod = GeneralAppIdDecoder.extractNumericValueFromBitArray(information, 1, 4);\n\n switch (fourBitEncodationMethod) {\n case 4: return new AI013103decoder(information);\n case 5: return new AI01320xDecoder(information);\n }\n\n let fiveBitEncodationMethod = GeneralAppIdDecoder.extractNumericValueFromBitArray(information, 1, 5);\n switch (fiveBitEncodationMethod) {\n case 12: return new AI01392xDecoder(information);\n case 13: return new AI01393xDecoder(information);\n }\n\n let sevenBitEncodationMethod = GeneralAppIdDecoder.extractNumericValueFromBitArray(information, 1, 7);\n switch (sevenBitEncodationMethod) {\n case 56: return new AI013x0x1xDecoder(information, '310', '11');\n case 57: return new AI013x0x1xDecoder(information, '320', '11');\n case 58: return new AI013x0x1xDecoder(information, '310', '13');\n case 59: return new AI013x0x1xDecoder(information, '320', '13');\n case 60: return new AI013x0x1xDecoder(information, '310', '15');\n case 61: return new AI013x0x1xDecoder(information, '320', '15');\n case 62: return new AI013x0x1xDecoder(information, '310', '17');\n case 63: return new AI013x0x1xDecoder(information, '320', '17');\n }\n } catch (e) {\n console.log(e);\n throw new IllegalStateException('unknown decoder: ' + information);\n }\n\n\n}\n","import DecodedObject from './DecodedObject';\nexport default class DecodedChar extends DecodedObject{\n private readonly value: string\n static readonly FNC1 = '$';\n\n constructor(newPosition: number, value: string) {\n super(newPosition);\n this.value = value;\n }\n\n getValue(): string{\n return this.value;\n }\n isFNC1():boolean {\n return this.value === DecodedChar.FNC1;\n }\n\n}","import FormatException from '../../../../FormatException';\nimport DecodedObject from './DecodedObject';\nexport default class DecodedNumeric extends DecodedObject {\n private readonly firstDigit: number;\n private readonly secondDigit: number;\n static readonly FNC1: number = 10\n\n constructor(newPosition:number,firstDigit:number,secondDigit:number) {\n super(newPosition);\n if (firstDigit < 0 || firstDigit > 10 || secondDigit < 0 || secondDigit > 10) {\n throw new FormatException();\n }\n this.firstDigit = firstDigit;\n this.secondDigit = secondDigit;\n }\n\n getFirstDigit():number {\n return this.firstDigit;\n }\n\n getSecondDigit():number {\n return this.secondDigit;\n }\n\n getValue():number {\n return this.firstDigit * 10 + this.secondDigit;\n }\n\n isFirstDigitFNC1():boolean {\n return this.firstDigit == DecodedNumeric.FNC1;\n }\n\n isSecondDigitFNC1():boolean {\n return this.secondDigit == DecodedNumeric.FNC1;\n }\n\n isAnyFNC1():boolean {\n return this.firstDigit === DecodedNumeric.FNC1 || this.secondDigit === DecodedNumeric.FNC1;\n }\n\n}","import DecodedObject from './DecodedObject'\nexport default class DecodedInformation extends DecodedObject{\n\n private readonly newString: string;\n private readonly remainingValue: number;\n private readonly remaining: boolean;\n\n constructor(newPosition: number, newString: string,remainingValue?:number) {\n super(newPosition);\n if (remainingValue) {\n this.remaining = true;\n this.remainingValue = this.remainingValue;\n } else {\n this.remaining = false;\n this.remainingValue = 0;\n }\n this.newString = newString;\n }\n\n getNewString(): string{\n return this.newString;\n }\n\n isRemaining(): boolean{\n return this.remaining;\n }\n getRemainingValue() {\n return this.remainingValue;\n }\n}","import NotFoundException from '../../../../NotFoundException';\nexport default class FieldParser {\n\n private static readonly VARIABLE_LENGTH = [];\n private static readonly TWO_DIGIT_DATA_LENGTH = [\n [\"00\", 18],\n [\"01\", 14],\n [\"02\", 14],\n [\"10\", FieldParser.VARIABLE_LENGTH, 20],\n [\"11\", 6],\n [\"12\", 6],\n [\"13\", 6],\n [\"15\", 6],\n [\"17\", 6],\n [\"20\", 2],\n [\"21\", FieldParser.VARIABLE_LENGTH, 20],\n [\"22\", FieldParser.VARIABLE_LENGTH, 29],\n\n [\"30\", FieldParser.VARIABLE_LENGTH, 8],\n [\"37\", FieldParser.VARIABLE_LENGTH, 8],\n\n //internal company codes\n [\"90\", FieldParser.VARIABLE_LENGTH, 30],\n [\"91\", FieldParser.VARIABLE_LENGTH, 30],\n [\"92\", FieldParser.VARIABLE_LENGTH, 30],\n [\"93\", FieldParser.VARIABLE_LENGTH, 30],\n [\"94\", FieldParser.VARIABLE_LENGTH, 30],\n [\"95\", FieldParser.VARIABLE_LENGTH, 30],\n [\"96\", FieldParser.VARIABLE_LENGTH, 30],\n [\"97\", FieldParser.VARIABLE_LENGTH, 3],\n [\"98\", FieldParser.VARIABLE_LENGTH, 30],\n [\"99\", FieldParser.VARIABLE_LENGTH, 30],\n ];\n private static readonly THREE_DIGIT_DATA_LENGTH = [\n // Same format as above\n\n [\"240\", FieldParser.VARIABLE_LENGTH, 30],\n [\"241\", FieldParser.VARIABLE_LENGTH, 30],\n [\"242\", FieldParser.VARIABLE_LENGTH, 6],\n [\"250\", FieldParser.VARIABLE_LENGTH, 30],\n [\"251\", FieldParser.VARIABLE_LENGTH, 30],\n [\"253\", FieldParser.VARIABLE_LENGTH, 17],\n [\"254\", FieldParser.VARIABLE_LENGTH, 20],\n\n [\"400\", FieldParser.VARIABLE_LENGTH, 30],\n [\"401\", FieldParser.VARIABLE_LENGTH, 30],\n [\"402\", 17],\n [\"403\", FieldParser.VARIABLE_LENGTH, 30],\n [\"410\", 13],\n [\"411\", 13],\n [\"412\", 13],\n [\"413\", 13],\n [\"414\", 13],\n [\"420\", FieldParser.VARIABLE_LENGTH, 20],\n [\"421\", FieldParser.VARIABLE_LENGTH, 15],\n [\"422\", 3],\n [\"423\", FieldParser.VARIABLE_LENGTH, 15],\n [\"424\", 3],\n [\"425\", 3],\n [\"426\", 3],\n ];\n private static readonly THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH = [\n // Same format as above\n\n [\"310\", 6],\n [\"311\", 6],\n [\"312\", 6],\n [\"313\", 6],\n [\"314\", 6],\n [\"315\", 6],\n [\"316\", 6],\n [\"320\", 6],\n [\"321\", 6],\n [\"322\", 6],\n [\"323\", 6],\n [\"324\", 6],\n [\"325\", 6],\n [\"326\", 6],\n [\"327\", 6],\n [\"328\", 6],\n [\"329\", 6],\n [\"330\", 6],\n [\"331\", 6],\n [\"332\", 6],\n [\"333\", 6],\n [\"334\", 6],\n [\"335\", 6],\n [\"336\", 6],\n [\"340\", 6],\n [\"341\", 6],\n [\"342\", 6],\n [\"343\", 6],\n [\"344\", 6],\n [\"345\", 6],\n [\"346\", 6],\n [\"347\", 6],\n [\"348\", 6],\n [\"349\", 6],\n [\"350\", 6],\n [\"351\", 6],\n [\"352\", 6],\n [\"353\", 6],\n [\"354\", 6],\n [\"355\", 6],\n [\"356\", 6],\n [\"357\", 6],\n [\"360\", 6],\n [\"361\", 6],\n [\"362\", 6],\n [\"363\", 6],\n [\"364\", 6],\n [\"365\", 6],\n [\"366\", 6],\n [\"367\", 6],\n [\"368\", 6],\n [\"369\", 6],\n [\"390\", FieldParser.VARIABLE_LENGTH, 15],\n [\"391\", FieldParser.VARIABLE_LENGTH, 18],\n [\"392\", FieldParser.VARIABLE_LENGTH, 15],\n [\"393\", FieldParser.VARIABLE_LENGTH, 18],\n [\"703\", FieldParser.VARIABLE_LENGTH, 30],\n ];\n private static readonly FOUR_DIGIT_DATA_LENGTH = [\n // Same format as above\n\n [\"7001\", 13],\n [\"7002\", FieldParser.VARIABLE_LENGTH, 30],\n [\"7003\", 10],\n\n [\"8001\", 14],\n [\"8002\", FieldParser.VARIABLE_LENGTH, 20],\n [\"8003\", FieldParser.VARIABLE_LENGTH, 30],\n [\"8004\", FieldParser.VARIABLE_LENGTH, 30],\n [\"8005\", 6],\n [\"8006\", 18],\n [\"8007\", FieldParser.VARIABLE_LENGTH, 30],\n [\"8008\", FieldParser.VARIABLE_LENGTH, 12],\n [\"8018\", 18],\n [\"8020\", FieldParser.VARIABLE_LENGTH, 25],\n [\"8100\", 6],\n [\"8101\", 10],\n [\"8102\", 2],\n [\"8110\", FieldParser.VARIABLE_LENGTH, 70],\n [\"8200\", FieldParser.VARIABLE_LENGTH, 70],\n ];\n\n constructor() {\n\n }\n static parseFieldsInGeneralPurpose(rawInformation: string): string {\n if (!rawInformation) {\n return null;\n }\n\n // Processing 2-digit AIs\n\n if (rawInformation.length < 2) {\n throw new NotFoundException();\n }\n\n let firstTwoDigits = rawInformation.substring(0, 2);\n\n for (let dataLength of FieldParser.TWO_DIGIT_DATA_LENGTH) {\n if (dataLength[0] === firstTwoDigits) {\n if (dataLength[1] === FieldParser.VARIABLE_LENGTH) {\n return FieldParser.processVariableAI(2, dataLength[2], rawInformation);\n }\n return FieldParser.processFixedAI(2, dataLength[1], rawInformation);\n }\n }\n\n if (rawInformation.length < 3) {\n throw new NotFoundException();\n }\n\n let firstThreeDigits = rawInformation.substring(0, 3);\n\n for (let dataLength of FieldParser.THREE_DIGIT_DATA_LENGTH) {\n if (dataLength[0] === firstThreeDigits) {\n if (dataLength[1] === FieldParser.VARIABLE_LENGTH) {\n return FieldParser.processVariableAI(3, dataLength[2], rawInformation);\n }\n return FieldParser.processFixedAI(3, dataLength[1], rawInformation);\n }\n }\n\n\n for (let dataLength of FieldParser.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH) {\n if (dataLength[0] === firstThreeDigits) {\n if (dataLength[1] === FieldParser.VARIABLE_LENGTH) {\n return FieldParser.processVariableAI(4, dataLength[2], rawInformation);\n }\n return FieldParser.processFixedAI(4, dataLength[1], rawInformation);\n }\n }\n\n if (rawInformation.length < 4) {\n throw new NotFoundException();\n }\n\n let firstFourDigits = rawInformation.substring(0, 4);\n\n for (let dataLength of FieldParser.FOUR_DIGIT_DATA_LENGTH) {\n if (dataLength[0] === firstFourDigits) {\n if (dataLength[1] === FieldParser.VARIABLE_LENGTH) {\n return FieldParser.processVariableAI(4, dataLength[2], rawInformation);\n }\n return FieldParser.processFixedAI(4, dataLength[1], rawInformation);\n }\n }\n\n throw new NotFoundException();\n }\n\n private static processFixedAI(aiSize: number, fieldSize: number, rawInformation: string): string {\n if (rawInformation.length < aiSize) {\n throw new NotFoundException();\n }\n\n let ai = rawInformation.substring(0, aiSize);\n\n if (rawInformation.length < aiSize + fieldSize) {\n throw new NotFoundException();\n }\n\n let field = rawInformation.substring(aiSize, aiSize + fieldSize);\n let remaining = rawInformation.substring(aiSize + fieldSize);\n let result = '(' + ai + ')' + field;\n let parsedAI = FieldParser.parseFieldsInGeneralPurpose(remaining);\n return parsedAI == null ? result : result + parsedAI;\n }\n\n private static processVariableAI(aiSize: number, variableFieldSize: number, rawInformation: string): string {\n let ai = rawInformation.substring(0, aiSize);\n let maxSize;\n if (rawInformation.length < aiSize + variableFieldSize) {\n maxSize = rawInformation.length;\n } else {\n maxSize = aiSize + variableFieldSize;\n }\n let field = rawInformation.substring(aiSize, maxSize);\n let remaining = rawInformation.substring(maxSize);\n let result = '(' + ai + ')' + field;\n let parsedAI = FieldParser.parseFieldsInGeneralPurpose(remaining);\n return parsedAI == null ? result : result + parsedAI;\n }\n\n\n}","import DecodedInformation from './DecodedInformation';\n\nexport default class BlockParsedResult {\n\n private readonly decodedInformation: DecodedInformation;\n private readonly finished: boolean;\n\n constructor(finished: boolean,decodedInformation?:DecodedInformation) {\n if (decodedInformation) {\n this.decodedInformation = null;\n } else {\n this.finished = finished;\n this.decodedInformation = decodedInformation;\n }\n }\n\n getDecodedInformation(): DecodedInformation{\n return this.decodedInformation;\n }\n\n isFinished(): boolean{\n return this.finished;\n }\n\n}","import AI01decoder from './AI01decoder';\nimport BitArray from '../../../../common/BitArray';\nimport StringBuilder from '../../../../util/StringBuilder';\nexport default class AI01AndOtherAIs extends AI01decoder{\n\n private static readonly HEADER_SIZE = 1 + 1 + 2; //first bit encodes the linkage flag,\n //the second one is the encodation method, and the other two are for the variable length\n\n constructor(information: BitArray) {\n super(information)\n }\n\n public parseInformation(): string {\n\n let buff = new StringBuilder();\n buff.append(\"(01)\");\n let initialGtinPosition = buff.length();\n let firstGtinDigit = this.getGeneralDecoder().extractNumericValueFromBitArray(AI01AndOtherAIs.HEADER_SIZE, 4);\n buff.append(firstGtinDigit);\n this.encodeCompressedGtinWithoutAI(buff, AI01AndOtherAIs.HEADER_SIZE + 4, initialGtinPosition);\n return this.getGeneralDecoder().decodeAllCodes(buff, AI01AndOtherAIs.HEADER_SIZE + 44);\n}\n\n}","import BitArray from '../../../../common/BitArray';\nimport StringBuilder from '../../../../util/StringBuilder';\nimport AbstractExpandedDecoder from './AbstractExpandedDecoder';\n\n\nexport default class AnyAIDecoder extends AbstractExpandedDecoder {\n\n private static readonly HEADER_SIZE: number = 2 + 1 + 2;\n\n constructor(information: BitArray) {\n super(information);\n }\n\n public parseInformation(): string {\n let buf = new StringBuilder();\n return this.getGeneralDecoder().decodeAllCodes(buf, AnyAIDecoder.HEADER_SIZE);\n }\n}\n","import AI013x0xDecoder from './AI013x0xDecoder';\nimport BitArray from '../../../../common/BitArray';\nimport StringBuilder from '../../../../util/StringBuilder';\nexport default class AI013103decoder extends AI013x0xDecoder {\n constructor(information: BitArray) {\n super(information)\n }\n\n protected addWeightCode(buf:StringBuilder, weight:number):void {\n buf.append(\"(3103)\");\n }\n\n protected checkWeight(weight:number):number {\n return weight;\n }\n\n}","import AI013x0xDecoder from './AI013x0xDecoder';\nimport BitArray from '../../../../common/BitArray';\nimport StringBuilder from '../../../../util/StringBuilder';\nexport default class AI01320xDecoder extends AI013x0xDecoder {\n constructor(information: BitArray) {\n super(information);\n }\n\n protected addWeightCode(buf:StringBuilder, weight:number):void {\n if (weight < 10000) {\n buf.append(\"(3202)\");\n } else {\n buf.append(\"(3203)\");\n }\n }\n\n protected checkWeight(weight:number):number {\n if (weight < 10000) {\n return weight;\n }\n return weight - 10000;\n }\n}","import AI01decoder from './AI01decoder';\nimport BitArray from '../../../../common/BitArray';\nimport NotFoundException from '../../../../NotFoundException';\nimport StringBuilder from '../../../../util/StringBuilder';\nexport default class AI01392xDecoder extends AI01decoder{\n private static readonly HEADER_SIZE = 5 + 1 + 2;\n private static readonly LAST_DIGIT_SIZE = 2;\n\n constructor(information:BitArray) {\n super(information);\n }\n\n public parseInformation():string{\n if (this.getInformation().getSize() < AI01392xDecoder.HEADER_SIZE + AI01decoder.GTIN_SIZE) {\n throw new NotFoundException();\n }\n let buf = new StringBuilder();\n\n this.encodeCompressedGtin(buf, AI01392xDecoder.HEADER_SIZE);\n\n let lastAIdigit = this.getGeneralDecoder().extractNumericValueFromBitArray(AI01392xDecoder.HEADER_SIZE + AI01decoder.GTIN_SIZE, AI01392xDecoder.LAST_DIGIT_SIZE);\n buf.append(\"(392\");\n buf.append(lastAIdigit);\n buf.append(')');\n\n let decodedInformation = this.getGeneralDecoder().decodeGeneralPurposeField(AI01392xDecoder.HEADER_SIZE + AI01decoder.GTIN_SIZE + AI01392xDecoder.LAST_DIGIT_SIZE, null);\n buf.append(decodedInformation.getNewString());\n\n return buf.toString();\n }\n}","import AI01decoder from './AI01decoder';\nimport BitArray from '../../../../common/BitArray';\nimport NotFoundException from '../../../../NotFoundException';\nimport StringBuilder from '../../../../util/StringBuilder';\nexport default class AI01393xDecoder extends AI01decoder{\n private static readonly HEADER_SIZE = 5 + 1 + 2;\n private static readonly LAST_DIGIT_SIZE = 2;\n private static readonly FIRST_THREE_DIGITS_SIZE = 10;\n\n constructor(information:BitArray) {\n super(information)\n }\n\n public parseInformation():string {\n if (this.getInformation().getSize() < AI01393xDecoder.HEADER_SIZE + AI01decoder.GTIN_SIZE) {\n throw new NotFoundException();\n }\n\n let buf = new StringBuilder();\n\n this.encodeCompressedGtin(buf, AI01393xDecoder.HEADER_SIZE);\n\n let lastAIdigit = this.getGeneralDecoder().extractNumericValueFromBitArray(AI01393xDecoder.HEADER_SIZE + AI01decoder.GTIN_SIZE, AI01393xDecoder.LAST_DIGIT_SIZE);\n\n buf.append(\"(393\");\n buf.append(lastAIdigit);\n buf.append(')');\n\n let firstThreeDigits = this.getGeneralDecoder().extractNumericValueFromBitArray(AI01393xDecoder.HEADER_SIZE + AI01decoder.GTIN_SIZE + AI01393xDecoder.LAST_DIGIT_SIZE, AI01393xDecoder.FIRST_THREE_DIGITS_SIZE);\n if (firstThreeDigits / 100 == 0) {\n buf.append('0');\n }\n if (firstThreeDigits / 10 == 0) {\n buf.append('0');\n }\n buf.append(firstThreeDigits);\n\n let generalInformation = this.getGeneralDecoder().decodeGeneralPurposeField(AI01393xDecoder.HEADER_SIZE + AI01decoder.GTIN_SIZE + AI01393xDecoder.LAST_DIGIT_SIZE + AI01393xDecoder.FIRST_THREE_DIGITS_SIZE, null);\n buf.append(generalInformation.getNewString());\n\n return buf.toString();\n }\n}","import AI01weightDecoder from './AI01weightDecoder';\nimport BitArray from '../../../../common/BitArray';\nimport NotFoundException from '../../../../NotFoundException';\nimport StringBuilder from '../../../../util/StringBuilder';\nexport default class AI013x0x1xDecoder extends AI01weightDecoder {\n private static readonly HEADER_SIZE = 7 + 1;\n private static readonly WEIGHT_SIZE = 20;\n private static readonly DATE_SIZE = 16;\n\n private readonly dateCode:string;\n private readonly firstAIdigits:string;\n\n constructor(information: BitArray, firstAIdigits: string, dateCode: string) {\n super(information);\n this.dateCode = dateCode;\n this.firstAIdigits = firstAIdigits;\n }\n\n public parseInformation():string {\n if (this.getInformation().getSize() != AI013x0x1xDecoder.HEADER_SIZE + AI013x0x1xDecoder.GTIN_SIZE + AI013x0x1xDecoder.WEIGHT_SIZE + AI013x0x1xDecoder.DATE_SIZE) {\n throw new NotFoundException();\n }\n\n let buf = new StringBuilder();\n\n this.encodeCompressedGtin(buf, AI013x0x1xDecoder.HEADER_SIZE);\n this.encodeCompressedWeight(buf, AI013x0x1xDecoder.HEADER_SIZE + AI013x0x1xDecoder.GTIN_SIZE, AI013x0x1xDecoder.WEIGHT_SIZE);\n this.encodeCompressedDate(buf, AI013x0x1xDecoder.HEADER_SIZE + AI013x0x1xDecoder.GTIN_SIZE + AI013x0x1xDecoder.WEIGHT_SIZE);\n\n return buf.toString();\n }\n\n private encodeCompressedDate(buf:StringBuilder,currentPos:number):void {\n let numericDate = this.getGeneralDecoder().extractNumericValueFromBitArray(currentPos, AI013x0x1xDecoder.DATE_SIZE);\n if (numericDate == 38400) {\n return;\n }\n\n buf.append('(');\n buf.append(this.dateCode);\n buf.append(')');\n\n let day = numericDate % 32;\n numericDate /= 32;\n let month = numericDate % 12 + 1;\n numericDate /= 12;\n let year = numericDate;\n\n if (year / 10 == 0) {\n buf.append('0');\n }\n buf.append(year);\n if (month / 10 == 0) {\n buf.append('0');\n }\n buf.append(month);\n if (day / 10 == 0) {\n buf.append('0');\n }\n buf.append(day);\n }\n\n protected addWeightCode(buf:StringBuilder, weight:number):void {\n buf.append('(');\n buf.append(this.firstAIdigits);\n buf.append(weight / 100000);\n buf.append(')');\n }\n\n\n protected checkWeight(weight:number):number {\n return weight % 100000;\n }\n}","import DataCharacter from '../../rss/DataCharacter';\nimport FinderPattern from '../../rss/FinderPattern';\n\nexport default class ExpandedPair {\n private readonly maybeLast:boolean;\n private readonly leftchar: DataCharacter;\n private readonly rightchar: DataCharacter;\n private readonly finderpattern: FinderPattern;\n\n constructor(leftChar: DataCharacter, rightChar: DataCharacter, finderPatter: FinderPattern, mayBeLast: boolean) {\n this.leftchar = leftChar;\n this.rightchar = rightChar;\n this.finderpattern = finderPatter;\n this.maybeLast = mayBeLast;\n }\n\n mayBeLast(): boolean{\n return this.maybeLast;\n }\n getLeftChar(): DataCharacter{\n return this.leftchar;\n }\n getRightChar(): DataCharacter{\n return this.rightchar;\n }\n getFinderPattern(): FinderPattern{\n return this.finderpattern;\n }\n mustBeLast() {\n return this.rightchar == null;\n }\n toString(): String {\n return '[ ' + this.leftchar + ', ' + this.rightchar + ' : ' + (this.finderpattern == null ? \"null\" : this.finderpattern.getValue()) + \" ]\";\n }\n\n static equals(o1:any,o2:any):boolean {\n if (!(o1 instanceof ExpandedPair)) {\n return false;\n }\n return ExpandedPair.equalsOrNull(o1.leftchar, o2.leftchar) &&\n ExpandedPair.equalsOrNull(o1.rightchar, o2.rightchar) &&\n ExpandedPair.equalsOrNull(o1.finderpattern, o2.finderpattern);\n }\n\n private static equalsOrNull(o1:any, o2:any):boolean {\n return o1 === null ? o2 === null : ExpandedPair.equals(o1, o2);\n }\n\n hashCode():any {\n //return ExpandedPair.hashNotNull(leftChar) ^ hashNotNull(rightChar) ^ hashNotNull(finderPattern);\n let value = this.leftchar.getValue() ^ this.rightchar.getValue() ^ this.finderpattern.getValue();\n return value;\n }\n // To do - Re check the implementation\n private static hashNotNull(o:ExpandedPair):number {\n return o === null ? 0 : o.hashCode();\n }\n}\n\n","import ExpandedPair from './ExpandedPair'\n\n\nexport default class ExpandedRow {\n private readonly pairs: Array;\n private readonly rowNumber: number;\n private readonly wasReversed: boolean;\n constructor(pairs: Array,rowNumber:number,wasReversed:boolean) {\n this.pairs = pairs;\n this.rowNumber = rowNumber;\n this.wasReversed = wasReversed;\n }\n getPairs():Array{\n return this.pairs;\n }\n getRowNumber():number{\n return this.rowNumber;\n }\n isReversed(): boolean{\n return this.wasReversed;\n }\n // check implementation\n isEquivalent(otherPairs: Array): boolean{\n return this.checkEqualitity(this, otherPairs);\n }\n //@Override\n public toString():String {\n return \"{ \" + this.pairs + \" }\";\n }\n\n /**\n * Two rows are equal if they contain the same pairs in the same order.\n */\n //@Override\n // check implementation\n public equals(o1:ExpandedRow,o2:ExpandedRow):boolean {\n if (!(o1 instanceof ExpandedRow)) {\n return false;\n }\n return this.checkEqualitity(o1,o2) && o1.wasReversed === o2.wasReversed;\n }\n checkEqualitity(pair1:any, pair2:any):boolean {\n if (!pair1 || !pair2) return;\n let result;\n pair1.forEach((e1, i) => {\n pair2.forEach(e2 => {\n if (e1.getLeftChar().getValue() === e2.getLeftChar().getValue() && e1.getRightChar().getValue() === e2.getRightChar().getValue() && e1.getFinderPatter().getValue() === e2.getFinderPatter().getValue()) {\n result = true;\n }\n })\n });\n return result;\n }\n\n //@Override\n // check implementation\n // public int hashCode(): number {\n // let hash = this.pairs.values ^ this.wasReversed\n // //return pairs.hashCode() ^ Boolean.valueOf(wasReversed).hashCode();\n // }\n\n}\n","import BitArray from '../../../common/BitArray';\nimport ExpandedPair from './ExpandedPair';\nexport default class BitArrayBuilder{\n constructor() {\n }\n static buildBitArray(pairs:Array):BitArray {\n let charNumber:number = (pairs.length * 2) - 1;\n if (pairs[pairs.length - 1].getRightChar() == null) {\n charNumber -= 1;\n }\n\n let size:number = 12 * charNumber;\n\n let binary = new BitArray(size);\n let accPos = 0;\n\n let firstPair:ExpandedPair = pairs[0];\n let firstValue = firstPair.getRightChar().getValue();\n for (let i = 11; i >= 0; --i) {\n if ((firstValue & (1 << i)) != 0) {\n binary.set(accPos);\n }\n accPos++;\n }\n\n for (let i = 1; i < pairs.length; ++i) {\n let currentPair:ExpandedPair = pairs[i];\n\n let leftValue = currentPair.getLeftChar().getValue();\n for (let j = 11; j >= 0; --j) {\n if ((leftValue & (1 << j)) != 0) {\n binary.set(accPos);\n }\n accPos++;\n }\n\n if (currentPair.getRightChar() != null) {\n let rightValue = currentPair.getRightChar().getValue();\n for (let j = 11; j >= 0; --j) {\n if ((rightValue & (1 << j)) != 0) {\n binary.set(accPos);\n }\n accPos++;\n }\n }\n }\n return binary;\n }\n\n}"],"sourceRoot":""}