var Quagga =
( function webpackUniversalModuleDefinition ( root , factory ) {
if ( typeof exports === 'object' && typeof module === 'object' ) {
module . exports = factory ( factory . toString ( ) ) . default ;
} else if ( typeof exports === 'object' ) {
exports [ "Quagga" ] = factory ( factory . toString ( ) ) . default ;
} else {
root [ "Quagga" ] = factory ( factory . toString ( ) ) . default ;
}
} ) ( this , function ( _ _factorySource _ _ ) {
return /******/ ( function ( modules ) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = { } ;
/******/
/******/ // The require function
/******/ function _ _webpack _require _ _ ( moduleId ) {
/******/
/******/ // Check if module is in cache
/******/ if ( installedModules [ moduleId ] ) {
/******/ return installedModules [ moduleId ] . exports ;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules [ moduleId ] = {
/******/ i : moduleId ,
/******/ l : false ,
/******/ exports : { }
/******/ } ;
/******/
/******/ // Execute the module function
/******/ modules [ moduleId ] . call ( module . exports , module , module . exports , _ _webpack _require _ _ ) ;
/******/
/******/ // Flag the module as loaded
/******/ module . l = true ;
/******/
/******/ // Return the exports of the module
/******/ return module . exports ;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ _ _webpack _require _ _ . m = modules ;
/******/
/******/ // expose the module cache
/******/ _ _webpack _require _ _ . c = installedModules ;
/******/
/******/ // define getter function for harmony exports
/******/ _ _webpack _require _ _ . d = function ( exports , name , getter ) {
/******/ if ( ! _ _webpack _require _ _ . o ( exports , name ) ) {
/******/ Object . defineProperty ( exports , name , { enumerable : true , get : getter } ) ;
/******/ }
/******/ } ;
/******/
/******/ // define __esModule on exports
/******/ _ _webpack _require _ _ . r = function ( exports ) {
/******/ if ( typeof Symbol !== 'undefined' && Symbol . toStringTag ) {
/******/ Object . defineProperty ( exports , Symbol . toStringTag , { value : 'Module' } ) ;
/******/ }
/******/ Object . defineProperty ( exports , '__esModule' , { value : true } ) ;
/******/ } ;
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ _ _webpack _require _ _ . t = function ( value , mode ) {
/******/ if ( mode & 1 ) value = _ _webpack _require _ _ ( value ) ;
/******/ if ( mode & 8 ) return value ;
/******/ if ( ( mode & 4 ) && typeof value === 'object' && value && value . _ _esModule ) return value ;
/******/ var ns = Object . create ( null ) ;
/******/ _ _webpack _require _ _ . r ( ns ) ;
/******/ Object . defineProperty ( ns , 'default' , { enumerable : true , value : value } ) ;
/******/ if ( mode & 2 && typeof value != 'string' ) for ( var key in value ) _ _webpack _require _ _ . d ( ns , key , function ( key ) { return value [ key ] ; } . bind ( null , key ) ) ;
/******/ return ns ;
/******/ } ;
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ _ _webpack _require _ _ . n = function ( module ) {
/******/ var getter = module && module . _ _esModule ?
/******/ function getDefault ( ) { return module [ 'default' ] ; } :
/******/ function getModuleExports ( ) { return module ; } ;
/******/ _ _webpack _require _ _ . d ( getter , 'a' , getter ) ;
/******/ return getter ;
/******/ } ;
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ _ _webpack _require _ _ . o = function ( object , property ) { return Object . prototype . hasOwnProperty . call ( object , property ) ; } ;
/******/
/******/ // __webpack_public_path__
/******/ _ _webpack _require _ _ . p = "/" ;
/******/
/******/
/******/ // Load entry module and return exports
/******/ return _ _webpack _require _ _ ( _ _webpack _require _ _ . s = "./src/quagga.ts" ) ;
/******/ } )
/************************************************************************/
/******/ ( {
/***/ "../../node_modules/@babel/runtime/helpers/arrayWithoutHoles.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * / U s e r s / a d o m r a t c h e v / n o d e _ m o d u l e s / @ b a b e l / r u n t i m e / h e l p e r s / a r r a y W i t h o u t H o l e s . j s * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! no static exports found */
/***/ ( function ( module , exports ) {
function _arrayWithoutHoles ( arr ) {
if ( Array . isArray ( arr ) ) {
for ( var i = 0 , arr2 = new Array ( arr . length ) ; i < arr . length ; i ++ ) {
arr2 [ i ] = arr [ i ] ;
}
return arr2 ;
}
}
module . exports = _arrayWithoutHoles ;
/***/ } ) ,
/***/ "../../node_modules/@babel/runtime/helpers/assertThisInitialized.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * / U s e r s / a d o m r a t c h e v / n o d e _ m o d u l e s / @ b a b e l / r u n t i m e / h e l p e r s / a s s e r t T h i s I n i t i a l i z e d . j s * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! no static exports found */
/***/ ( function ( module , exports ) {
function _assertThisInitialized ( self ) {
if ( self === void 0 ) {
throw new ReferenceError ( "this hasn't been initialised - super() hasn't been called" ) ;
}
return self ;
}
module . exports = _assertThisInitialized ;
/***/ } ) ,
/***/ "../../node_modules/@babel/runtime/helpers/asyncToGenerator.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * / U s e r s / a d o m r a t c h e v / n o d e _ m o d u l e s / @ b a b e l / r u n t i m e / h e l p e r s / a s y n c T o G e n e r a t o r . j s * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! no static exports found */
/***/ ( function ( module , exports ) {
function asyncGeneratorStep ( gen , resolve , reject , _next , _throw , key , arg ) {
try {
var info = gen [ key ] ( arg ) ;
var value = info . value ;
} catch ( error ) {
reject ( error ) ;
return ;
}
if ( info . done ) {
resolve ( value ) ;
} else {
Promise . resolve ( value ) . then ( _next , _throw ) ;
}
}
function _asyncToGenerator ( fn ) {
return function ( ) {
var self = this ,
args = arguments ;
return new Promise ( function ( resolve , reject ) {
var gen = fn . apply ( self , args ) ;
function _next ( value ) {
asyncGeneratorStep ( gen , resolve , reject , _next , _throw , "next" , value ) ;
}
function _throw ( err ) {
asyncGeneratorStep ( gen , resolve , reject , _next , _throw , "throw" , err ) ;
}
_next ( undefined ) ;
} ) ;
} ;
}
module . exports = _asyncToGenerator ;
/***/ } ) ,
/***/ "../../node_modules/@babel/runtime/helpers/classCallCheck.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * / U s e r s / a d o m r a t c h e v / n o d e _ m o d u l e s / @ b a b e l / r u n t i m e / h e l p e r s / c l a s s C a l l C h e c k . j s * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! no static exports found */
/***/ ( function ( module , exports ) {
function _classCallCheck ( instance , Constructor ) {
if ( ! ( instance instanceof Constructor ) ) {
throw new TypeError ( "Cannot call a class as a function" ) ;
}
}
module . exports = _classCallCheck ;
/***/ } ) ,
/***/ "../../node_modules/@babel/runtime/helpers/createClass.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * / U s e r s / a d o m r a t c h e v / n o d e _ m o d u l e s / @ b a b e l / r u n t i m e / h e l p e r s / c r e a t e C l a s s . j s * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! no static exports found */
/***/ ( function ( module , exports ) {
function _defineProperties ( target , props ) {
for ( var i = 0 ; i < props . length ; i ++ ) {
var descriptor = props [ i ] ;
descriptor . enumerable = descriptor . enumerable || false ;
descriptor . configurable = true ;
if ( "value" in descriptor ) descriptor . writable = true ;
Object . defineProperty ( target , descriptor . key , descriptor ) ;
}
}
function _createClass ( Constructor , protoProps , staticProps ) {
if ( protoProps ) _defineProperties ( Constructor . prototype , protoProps ) ;
if ( staticProps ) _defineProperties ( Constructor , staticProps ) ;
return Constructor ;
}
module . exports = _createClass ;
/***/ } ) ,
/***/ "../../node_modules/@babel/runtime/helpers/defineProperty.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * / U s e r s / a d o m r a t c h e v / n o d e _ m o d u l e s / @ b a b e l / r u n t i m e / h e l p e r s / d e f i n e P r o p e r t y . j s * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! no static exports found */
/***/ ( function ( module , exports ) {
function _defineProperty ( obj , key , value ) {
if ( key in obj ) {
Object . defineProperty ( obj , key , {
value : value ,
enumerable : true ,
configurable : true ,
writable : true
} ) ;
} else {
obj [ key ] = value ;
}
return obj ;
}
module . exports = _defineProperty ;
/***/ } ) ,
/***/ "../../node_modules/@babel/runtime/helpers/get.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * / U s e r s / a d o m r a t c h e v / n o d e _ m o d u l e s / @ b a b e l / r u n t i m e / h e l p e r s / g e t . j s * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! no static exports found */
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
var getPrototypeOf = _ _webpack _require _ _ ( /*! ./getPrototypeOf */ "../../node_modules/@babel/runtime/helpers/getPrototypeOf.js" ) ;
var superPropBase = _ _webpack _require _ _ ( /*! ./superPropBase */ "../../node_modules/@babel/runtime/helpers/superPropBase.js" ) ;
function _get ( target , property , receiver ) {
if ( typeof Reflect !== "undefined" && Reflect . get ) {
module . exports = _get = Reflect . get ;
} else {
module . exports = _get = function _get ( target , property , receiver ) {
var base = superPropBase ( target , property ) ;
if ( ! base ) return ;
var desc = Object . getOwnPropertyDescriptor ( base , property ) ;
if ( desc . get ) {
return desc . get . call ( receiver ) ;
}
return desc . value ;
} ;
}
return _get ( target , property , receiver || target ) ;
}
module . exports = _get ;
/***/ } ) ,
/***/ "../../node_modules/@babel/runtime/helpers/getPrototypeOf.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * / U s e r s / a d o m r a t c h e v / n o d e _ m o d u l e s / @ b a b e l / r u n t i m e / h e l p e r s / g e t P r o t o t y p e O f . j s * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! no static exports found */
/***/ ( function ( module , exports ) {
function _getPrototypeOf ( o ) {
module . exports = _getPrototypeOf = Object . setPrototypeOf ? Object . getPrototypeOf : function _getPrototypeOf ( o ) {
return o . _ _proto _ _ || Object . getPrototypeOf ( o ) ;
} ;
return _getPrototypeOf ( o ) ;
}
module . exports = _getPrototypeOf ;
/***/ } ) ,
/***/ "../../node_modules/@babel/runtime/helpers/inherits.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * / U s e r s / a d o m r a t c h e v / n o d e _ m o d u l e s / @ b a b e l / r u n t i m e / h e l p e r s / i n h e r i t s . j s * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! no static exports found */
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
var setPrototypeOf = _ _webpack _require _ _ ( /*! ./setPrototypeOf */ "../../node_modules/@babel/runtime/helpers/setPrototypeOf.js" ) ;
function _inherits ( subClass , superClass ) {
if ( typeof superClass !== "function" && superClass !== null ) {
throw new TypeError ( "Super expression must either be null or a function" ) ;
}
subClass . prototype = Object . create ( superClass && superClass . prototype , {
constructor : {
value : subClass ,
writable : true ,
configurable : true
}
} ) ;
if ( superClass ) setPrototypeOf ( subClass , superClass ) ;
}
module . exports = _inherits ;
/***/ } ) ,
/***/ "../../node_modules/@babel/runtime/helpers/iterableToArray.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * / U s e r s / a d o m r a t c h e v / n o d e _ m o d u l e s / @ b a b e l / r u n t i m e / h e l p e r s / i t e r a b l e T o A r r a y . j s * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! no static exports found */
/***/ ( function ( module , exports ) {
function _iterableToArray ( iter ) {
if ( Symbol . iterator in Object ( iter ) || Object . prototype . toString . call ( iter ) === "[object Arguments]" ) return Array . from ( iter ) ;
}
module . exports = _iterableToArray ;
/***/ } ) ,
/***/ "../../node_modules/@babel/runtime/helpers/nonIterableSpread.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * / U s e r s / a d o m r a t c h e v / n o d e _ m o d u l e s / @ b a b e l / r u n t i m e / h e l p e r s / n o n I t e r a b l e S p r e a d . j s * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! no static exports found */
/***/ ( function ( module , exports ) {
function _nonIterableSpread ( ) {
throw new TypeError ( "Invalid attempt to spread non-iterable instance" ) ;
}
module . exports = _nonIterableSpread ;
/***/ } ) ,
/***/ "../../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * / U s e r s / a d o m r a t c h e v / n o d e _ m o d u l e s / @ b a b e l / r u n t i m e / h e l p e r s / p o s s i b l e C o n s t r u c t o r R e t u r n . j s * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! no static exports found */
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
var _typeof = _ _webpack _require _ _ ( /*! ../helpers/typeof */ "../../node_modules/@babel/runtime/helpers/typeof.js" ) ;
var assertThisInitialized = _ _webpack _require _ _ ( /*! ./assertThisInitialized */ "../../node_modules/@babel/runtime/helpers/assertThisInitialized.js" ) ;
function _possibleConstructorReturn ( self , call ) {
if ( call && ( _typeof ( call ) === "object" || typeof call === "function" ) ) {
return call ;
}
return assertThisInitialized ( self ) ;
}
module . exports = _possibleConstructorReturn ;
/***/ } ) ,
/***/ "../../node_modules/@babel/runtime/helpers/setPrototypeOf.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * / U s e r s / a d o m r a t c h e v / n o d e _ m o d u l e s / @ b a b e l / r u n t i m e / h e l p e r s / s e t P r o t o t y p e O f . j s * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! no static exports found */
/***/ ( function ( module , exports ) {
function _setPrototypeOf ( o , p ) {
module . exports = _setPrototypeOf = Object . setPrototypeOf || function _setPrototypeOf ( o , p ) {
o . _ _proto _ _ = p ;
return o ;
} ;
return _setPrototypeOf ( o , p ) ;
}
module . exports = _setPrototypeOf ;
/***/ } ) ,
/***/ "../../node_modules/@babel/runtime/helpers/superPropBase.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * / U s e r s / a d o m r a t c h e v / n o d e _ m o d u l e s / @ b a b e l / r u n t i m e / h e l p e r s / s u p e r P r o p B a s e . j s * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! no static exports found */
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
var getPrototypeOf = _ _webpack _require _ _ ( /*! ./getPrototypeOf */ "../../node_modules/@babel/runtime/helpers/getPrototypeOf.js" ) ;
function _superPropBase ( object , property ) {
while ( ! Object . prototype . hasOwnProperty . call ( object , property ) ) {
object = getPrototypeOf ( object ) ;
if ( object === null ) break ;
}
return object ;
}
module . exports = _superPropBase ;
/***/ } ) ,
/***/ "../../node_modules/@babel/runtime/helpers/toConsumableArray.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * / U s e r s / a d o m r a t c h e v / n o d e _ m o d u l e s / @ b a b e l / r u n t i m e / h e l p e r s / t o C o n s u m a b l e A r r a y . j s * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! no static exports found */
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
var arrayWithoutHoles = _ _webpack _require _ _ ( /*! ./arrayWithoutHoles */ "../../node_modules/@babel/runtime/helpers/arrayWithoutHoles.js" ) ;
var iterableToArray = _ _webpack _require _ _ ( /*! ./iterableToArray */ "../../node_modules/@babel/runtime/helpers/iterableToArray.js" ) ;
var nonIterableSpread = _ _webpack _require _ _ ( /*! ./nonIterableSpread */ "../../node_modules/@babel/runtime/helpers/nonIterableSpread.js" ) ;
function _toConsumableArray ( arr ) {
return arrayWithoutHoles ( arr ) || iterableToArray ( arr ) || nonIterableSpread ( ) ;
}
module . exports = _toConsumableArray ;
/***/ } ) ,
/***/ "../../node_modules/@babel/runtime/helpers/typeof.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * / U s e r s / a d o m r a t c h e v / n o d e _ m o d u l e s / @ b a b e l / r u n t i m e / h e l p e r s / t y p e o f . j s * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! no static exports found */
/***/ ( function ( module , exports ) {
function _typeof2 ( obj ) { if ( typeof Symbol === "function" && typeof Symbol . iterator === "symbol" ) { _typeof2 = function _typeof2 ( obj ) { return typeof obj ; } ; } else { _typeof2 = function _typeof2 ( obj ) { return obj && typeof Symbol === "function" && obj . constructor === Symbol && obj !== Symbol . prototype ? "symbol" : typeof obj ; } ; } return _typeof2 ( obj ) ; }
function _typeof ( obj ) {
if ( typeof Symbol === "function" && _typeof2 ( Symbol . iterator ) === "symbol" ) {
module . exports = _typeof = function _typeof ( obj ) {
return _typeof2 ( obj ) ;
} ;
} else {
module . exports = _typeof = function _typeof ( obj ) {
return obj && typeof Symbol === "function" && obj . constructor === Symbol && obj !== Symbol . prototype ? "symbol" : _typeof2 ( obj ) ;
} ;
}
return _typeof ( obj ) ;
}
module . exports = _typeof ;
/***/ } ) ,
/***/ "../../node_modules/@babel/runtime/regenerator/index.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * / U s e r s / a d o m r a t c h e v / n o d e _ m o d u l e s / @ b a b e l / r u n t i m e / r e g e n e r a t o r / i n d e x . j s * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! no static exports found */
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
module . exports = _ _webpack _require _ _ ( /*! regenerator-runtime */ "../../node_modules/regenerator-runtime/runtime-module.js" ) ;
/***/ } ) ,
/***/ "../../node_modules/regenerator-runtime/runtime-module.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * / U s e r s / a d o m r a t c h e v / n o d e _ m o d u l e s / r e g e n e r a t o r - r u n t i m e / r u n t i m e - m o d u l e . j s * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! no static exports found */
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
/ * *
* Copyright ( c ) 2014 - present , Facebook , Inc .
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree .
* /
// This method of obtaining a reference to the global object needs to be
// kept identical to the way it is obtained in runtime.js
var g = ( function ( ) {
return this || ( typeof self === "object" && self ) ;
} ) ( ) || Function ( "return this" ) ( ) ;
// Use `getOwnPropertyNames` because not all browsers support calling
// `hasOwnProperty` on the global `self` object in a worker. See #183.
var hadRuntime = g . regeneratorRuntime &&
Object . getOwnPropertyNames ( g ) . indexOf ( "regeneratorRuntime" ) >= 0 ;
// Save the old regeneratorRuntime in case it needs to be restored later.
var oldRuntime = hadRuntime && g . regeneratorRuntime ;
// Force reevalutation of runtime.js.
g . regeneratorRuntime = undefined ;
module . exports = _ _webpack _require _ _ ( /*! ./runtime */ "../../node_modules/regenerator-runtime/runtime.js" ) ;
if ( hadRuntime ) {
// Restore the original runtime.
g . regeneratorRuntime = oldRuntime ;
} else {
// Remove the global property added by runtime.js.
try {
delete g . regeneratorRuntime ;
} catch ( e ) {
g . regeneratorRuntime = undefined ;
}
}
/***/ } ) ,
/***/ "../../node_modules/regenerator-runtime/runtime.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * / U s e r s / a d o m r a t c h e v / n o d e _ m o d u l e s / r e g e n e r a t o r - r u n t i m e / r u n t i m e . j s * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! no static exports found */
/***/ ( function ( module , exports ) {
/ * *
* Copyright ( c ) 2014 - present , Facebook , Inc .
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree .
* /
! ( function ( global ) {
"use strict" ;
var Op = Object . prototype ;
var hasOwn = Op . hasOwnProperty ;
var undefined ; // More compressible than void 0.
var $Symbol = typeof Symbol === "function" ? Symbol : { } ;
var iteratorSymbol = $Symbol . iterator || "@@iterator" ;
var asyncIteratorSymbol = $Symbol . asyncIterator || "@@asyncIterator" ;
var toStringTagSymbol = $Symbol . toStringTag || "@@toStringTag" ;
var inModule = typeof module === "object" ;
var runtime = global . regeneratorRuntime ;
if ( runtime ) {
if ( inModule ) {
// If regeneratorRuntime is defined globally and we're in a module,
// make the exports object identical to regeneratorRuntime.
module . exports = runtime ;
}
// Don't bother evaluating the rest of this file if the runtime was
// already defined globally.
return ;
}
// Define the runtime globally (as expected by generated code) as either
// module.exports (if we're in a module) or a new, empty object.
runtime = global . regeneratorRuntime = inModule ? module . exports : { } ;
function wrap ( innerFn , outerFn , self , tryLocsList ) {
// If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
var protoGenerator = outerFn && outerFn . prototype instanceof Generator ? outerFn : Generator ;
var generator = Object . create ( protoGenerator . prototype ) ;
var context = new Context ( tryLocsList || [ ] ) ;
// The ._invoke method unifies the implementations of the .next,
// .throw, and .return methods.
generator . _invoke = makeInvokeMethod ( innerFn , self , context ) ;
return generator ;
}
runtime . wrap = wrap ;
// Try/catch helper to minimize deoptimizations. Returns a completion
// record like context.tryEntries[i].completion. This interface could
// have been (and was previously) designed to take a closure to be
// invoked without arguments, but in all the cases we care about we
// already have an existing method we want to call, so there's no need
// to create a new function object. We can even get away with assuming
// the method takes exactly one argument, since that happens to be true
// in every case, so we don't have to touch the arguments object. The
// only additional allocation required is the completion record, which
// has a stable shape and so hopefully should be cheap to allocate.
function tryCatch ( fn , obj , arg ) {
try {
return { type : "normal" , arg : fn . call ( obj , arg ) } ;
} catch ( err ) {
return { type : "throw" , arg : err } ;
}
}
var GenStateSuspendedStart = "suspendedStart" ;
var GenStateSuspendedYield = "suspendedYield" ;
var GenStateExecuting = "executing" ;
var GenStateCompleted = "completed" ;
// Returning this object from the innerFn has the same effect as
// breaking out of the dispatch switch statement.
var ContinueSentinel = { } ;
// Dummy constructor functions that we use as the .constructor and
// .constructor.prototype properties for functions that return Generator
// objects. For full spec compliance, you may wish to configure your
// minifier not to mangle the names of these two functions.
function Generator ( ) { }
function GeneratorFunction ( ) { }
function GeneratorFunctionPrototype ( ) { }
// This is a polyfill for %IteratorPrototype% for environments that
// don't natively support it.
var IteratorPrototype = { } ;
IteratorPrototype [ iteratorSymbol ] = function ( ) {
return this ;
} ;
var getProto = Object . getPrototypeOf ;
var NativeIteratorPrototype = getProto && getProto ( getProto ( values ( [ ] ) ) ) ;
if ( NativeIteratorPrototype &&
NativeIteratorPrototype !== Op &&
hasOwn . call ( NativeIteratorPrototype , iteratorSymbol ) ) {
// This environment has a native %IteratorPrototype%; use it instead
// of the polyfill.
IteratorPrototype = NativeIteratorPrototype ;
}
var Gp = GeneratorFunctionPrototype . prototype =
Generator . prototype = Object . create ( IteratorPrototype ) ;
GeneratorFunction . prototype = Gp . constructor = GeneratorFunctionPrototype ;
GeneratorFunctionPrototype . constructor = GeneratorFunction ;
GeneratorFunctionPrototype [ toStringTagSymbol ] =
GeneratorFunction . displayName = "GeneratorFunction" ;
// Helper for defining the .next, .throw, and .return methods of the
// Iterator interface in terms of a single ._invoke method.
function defineIteratorMethods ( prototype ) {
[ "next" , "throw" , "return" ] . forEach ( function ( method ) {
prototype [ method ] = function ( arg ) {
return this . _invoke ( method , arg ) ;
} ;
} ) ;
}
runtime . isGeneratorFunction = function ( genFun ) {
var ctor = typeof genFun === "function" && genFun . constructor ;
return ctor
? ctor === GeneratorFunction ||
// For the native GeneratorFunction constructor, the best we can
// do is to check its .name property.
( ctor . displayName || ctor . name ) === "GeneratorFunction"
: false ;
} ;
runtime . mark = function ( genFun ) {
if ( Object . setPrototypeOf ) {
Object . setPrototypeOf ( genFun , GeneratorFunctionPrototype ) ;
} else {
genFun . _ _proto _ _ = GeneratorFunctionPrototype ;
if ( ! ( toStringTagSymbol in genFun ) ) {
genFun [ toStringTagSymbol ] = "GeneratorFunction" ;
}
}
genFun . prototype = Object . create ( Gp ) ;
return genFun ;
} ;
// Within the body of any async function, `await x` is transformed to
// `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
// `hasOwn.call(value, "__await")` to determine if the yielded value is
// meant to be awaited.
runtime . awrap = function ( arg ) {
return { _ _await : arg } ;
} ;
function AsyncIterator ( generator ) {
function invoke ( method , arg , resolve , reject ) {
var record = tryCatch ( generator [ method ] , generator , arg ) ;
if ( record . type === "throw" ) {
reject ( record . arg ) ;
} else {
var result = record . arg ;
var value = result . value ;
if ( value &&
typeof value === "object" &&
hasOwn . call ( value , "__await" ) ) {
return Promise . resolve ( value . _ _await ) . then ( function ( value ) {
invoke ( "next" , value , resolve , reject ) ;
} , function ( err ) {
invoke ( "throw" , err , resolve , reject ) ;
} ) ;
}
return Promise . resolve ( value ) . then ( function ( unwrapped ) {
// When a yielded Promise is resolved, its final value becomes
// the .value of the Promise<{value,done}> result for the
// current iteration.
result . value = unwrapped ;
resolve ( result ) ;
} , function ( error ) {
// If a rejected Promise was yielded, throw the rejection back
// into the async generator function so it can be handled there.
return invoke ( "throw" , error , resolve , reject ) ;
} ) ;
}
}
var previousPromise ;
function enqueue ( method , arg ) {
function callInvokeWithMethodAndArg ( ) {
return new Promise ( function ( resolve , reject ) {
invoke ( method , arg , resolve , reject ) ;
} ) ;
}
return previousPromise =
// If enqueue has been called before, then we want to wait until
// all previous Promises have been resolved before calling invoke,
// so that results are always delivered in the correct order. If
// enqueue has not been called before, then it is important to
// call invoke immediately, without waiting on a callback to fire,
// so that the async generator function has the opportunity to do
// any necessary setup in a predictable way. This predictability
// is why the Promise constructor synchronously invokes its
// executor callback, and why async functions synchronously
// execute code before the first await. Since we implement simple
// async functions in terms of async generators, it is especially
// important to get this right, even though it requires care.
previousPromise ? previousPromise . then (
callInvokeWithMethodAndArg ,
// Avoid propagating failures to Promises returned by later
// invocations of the iterator.
callInvokeWithMethodAndArg
) : callInvokeWithMethodAndArg ( ) ;
}
// Define the unified helper method that is used to implement .next,
// .throw, and .return (see defineIteratorMethods).
this . _invoke = enqueue ;
}
defineIteratorMethods ( AsyncIterator . prototype ) ;
AsyncIterator . prototype [ asyncIteratorSymbol ] = function ( ) {
return this ;
} ;
runtime . AsyncIterator = AsyncIterator ;
// Note that simple async functions are implemented on top of
// AsyncIterator objects; they just return a Promise for the value of
// the final result produced by the iterator.
runtime . async = function ( innerFn , outerFn , self , tryLocsList ) {
var iter = new AsyncIterator (
wrap ( innerFn , outerFn , self , tryLocsList )
) ;
return runtime . isGeneratorFunction ( outerFn )
? iter // If outerFn is a generator, return the full iterator.
: iter . next ( ) . then ( function ( result ) {
return result . done ? result . value : iter . next ( ) ;
} ) ;
} ;
function makeInvokeMethod ( innerFn , self , context ) {
var state = GenStateSuspendedStart ;
return function invoke ( method , arg ) {
if ( state === GenStateExecuting ) {
throw new Error ( "Generator is already running" ) ;
}
if ( state === GenStateCompleted ) {
if ( method === "throw" ) {
throw arg ;
}
// Be forgiving, per 25.3.3.3.3 of the spec:
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
return doneResult ( ) ;
}
context . method = method ;
context . arg = arg ;
while ( true ) {
var delegate = context . delegate ;
if ( delegate ) {
var delegateResult = maybeInvokeDelegate ( delegate , context ) ;
if ( delegateResult ) {
if ( delegateResult === ContinueSentinel ) continue ;
return delegateResult ;
}
}
if ( context . method === "next" ) {
// Setting context._sent for legacy support of Babel's
// function.sent implementation.
context . sent = context . _sent = context . arg ;
} else if ( context . method === "throw" ) {
if ( state === GenStateSuspendedStart ) {
state = GenStateCompleted ;
throw context . arg ;
}
context . dispatchException ( context . arg ) ;
} else if ( context . method === "return" ) {
context . abrupt ( "return" , context . arg ) ;
}
state = GenStateExecuting ;
var record = tryCatch ( innerFn , self , context ) ;
if ( record . type === "normal" ) {
// If an exception is thrown from innerFn, we leave state ===
// GenStateExecuting and loop back for another invocation.
state = context . done
? GenStateCompleted
: GenStateSuspendedYield ;
if ( record . arg === ContinueSentinel ) {
continue ;
}
return {
value : record . arg ,
done : context . done
} ;
} else if ( record . type === "throw" ) {
state = GenStateCompleted ;
// Dispatch the exception by looping back around to the
// context.dispatchException(context.arg) call above.
context . method = "throw" ;
context . arg = record . arg ;
}
}
} ;
}
// Call delegate.iterator[context.method](context.arg) and handle the
// result, either by returning a { value, done } result from the
// delegate iterator, or by modifying context.method and context.arg,
// setting context.delegate to null, and returning the ContinueSentinel.
function maybeInvokeDelegate ( delegate , context ) {
var method = delegate . iterator [ context . method ] ;
if ( method === undefined ) {
// A .throw or .return when the delegate iterator has no .throw
// method always terminates the yield* loop.
context . delegate = null ;
if ( context . method === "throw" ) {
if ( delegate . iterator . return ) {
// If the delegate iterator has a return method, give it a
// chance to clean up.
context . method = "return" ;
context . arg = undefined ;
maybeInvokeDelegate ( delegate , context ) ;
if ( context . method === "throw" ) {
// If maybeInvokeDelegate(context) changed context.method from
// "return" to "throw", let that override the TypeError below.
return ContinueSentinel ;
}
}
context . method = "throw" ;
context . arg = new TypeError (
"The iterator does not provide a 'throw' method" ) ;
}
return ContinueSentinel ;
}
var record = tryCatch ( method , delegate . iterator , context . arg ) ;
if ( record . type === "throw" ) {
context . method = "throw" ;
context . arg = record . arg ;
context . delegate = null ;
return ContinueSentinel ;
}
var info = record . arg ;
if ( ! info ) {
context . method = "throw" ;
context . arg = new TypeError ( "iterator result is not an object" ) ;
context . delegate = null ;
return ContinueSentinel ;
}
if ( info . done ) {
// Assign the result of the finished delegate to the temporary
// variable specified by delegate.resultName (see delegateYield).
context [ delegate . resultName ] = info . value ;
// Resume execution at the desired location (see delegateYield).
context . next = delegate . nextLoc ;
// If context.method was "throw" but the delegate handled the
// exception, let the outer generator proceed normally. If
// context.method was "next", forget context.arg since it has been
// "consumed" by the delegate iterator. If context.method was
// "return", allow the original .return call to continue in the
// outer generator.
if ( context . method !== "return" ) {
context . method = "next" ;
context . arg = undefined ;
}
} else {
// Re-yield the result returned by the delegate method.
return info ;
}
// The delegate iterator is finished, so forget it and continue with
// the outer generator.
context . delegate = null ;
return ContinueSentinel ;
}
// Define Generator.prototype.{next,throw,return} in terms of the
// unified ._invoke helper method.
defineIteratorMethods ( Gp ) ;
Gp [ toStringTagSymbol ] = "Generator" ;
// A Generator should always return itself as the iterator object when the
// @@iterator function is called on it. Some browsers' implementations of the
// iterator prototype chain incorrectly implement this, causing the Generator
// object to not be returned from this call. This ensures that doesn't happen.
// See https://github.com/facebook/regenerator/issues/274 for more details.
Gp [ iteratorSymbol ] = function ( ) {
return this ;
} ;
Gp . toString = function ( ) {
return "[object Generator]" ;
} ;
function pushTryEntry ( locs ) {
var entry = { tryLoc : locs [ 0 ] } ;
if ( 1 in locs ) {
entry . catchLoc = locs [ 1 ] ;
}
if ( 2 in locs ) {
entry . finallyLoc = locs [ 2 ] ;
entry . afterLoc = locs [ 3 ] ;
}
this . tryEntries . push ( entry ) ;
}
function resetTryEntry ( entry ) {
var record = entry . completion || { } ;
record . type = "normal" ;
delete record . arg ;
entry . completion = record ;
}
function Context ( tryLocsList ) {
// The root entry object (effectively a try statement without a catch
// or a finally block) gives us a place to store values thrown from
// locations where there is no enclosing try statement.
this . tryEntries = [ { tryLoc : "root" } ] ;
tryLocsList . forEach ( pushTryEntry , this ) ;
this . reset ( true ) ;
}
runtime . keys = function ( object ) {
var keys = [ ] ;
for ( var key in object ) {
keys . push ( key ) ;
}
keys . reverse ( ) ;
// Rather than returning an object with a next method, we keep
// things simple and return the next function itself.
return function next ( ) {
while ( keys . length ) {
var key = keys . pop ( ) ;
if ( key in object ) {
next . value = key ;
next . done = false ;
return next ;
}
}
// To avoid creating an additional object, we just hang the .value
// and .done properties off the next function object itself. This
// also ensures that the minifier will not anonymize the function.
next . done = true ;
return next ;
} ;
} ;
function values ( iterable ) {
if ( iterable ) {
var iteratorMethod = iterable [ iteratorSymbol ] ;
if ( iteratorMethod ) {
return iteratorMethod . call ( iterable ) ;
}
if ( typeof iterable . next === "function" ) {
return iterable ;
}
if ( ! isNaN ( iterable . length ) ) {
var i = - 1 , next = function next ( ) {
while ( ++ i < iterable . length ) {
if ( hasOwn . call ( iterable , i ) ) {
next . value = iterable [ i ] ;
next . done = false ;
return next ;
}
}
next . value = undefined ;
next . done = true ;
return next ;
} ;
return next . next = next ;
}
}
// Return an iterator with no values.
return { next : doneResult } ;
}
runtime . values = values ;
function doneResult ( ) {
return { value : undefined , done : true } ;
}
Context . prototype = {
constructor : Context ,
reset : function ( skipTempReset ) {
this . prev = 0 ;
this . next = 0 ;
// Resetting context._sent for legacy support of Babel's
// function.sent implementation.
this . sent = this . _sent = undefined ;
this . done = false ;
this . delegate = null ;
this . method = "next" ;
this . arg = undefined ;
this . tryEntries . forEach ( resetTryEntry ) ;
if ( ! skipTempReset ) {
for ( var name in this ) {
// Not sure about the optimal order of these conditions:
if ( name . charAt ( 0 ) === "t" &&
hasOwn . call ( this , name ) &&
! isNaN ( + name . slice ( 1 ) ) ) {
this [ name ] = undefined ;
}
}
}
} ,
stop : function ( ) {
this . done = true ;
var rootEntry = this . tryEntries [ 0 ] ;
var rootRecord = rootEntry . completion ;
if ( rootRecord . type === "throw" ) {
throw rootRecord . arg ;
}
return this . rval ;
} ,
dispatchException : function ( exception ) {
if ( this . done ) {
throw exception ;
}
var context = this ;
function handle ( loc , caught ) {
record . type = "throw" ;
record . arg = exception ;
context . next = loc ;
if ( caught ) {
// If the dispatched exception was caught by a catch block,
// then let that catch block handle the exception normally.
context . method = "next" ;
context . arg = undefined ;
}
return ! ! caught ;
}
for ( var i = this . tryEntries . length - 1 ; i >= 0 ; -- i ) {
var entry = this . tryEntries [ i ] ;
var record = entry . completion ;
if ( entry . tryLoc === "root" ) {
// Exception thrown outside of any try block that could handle
// it, so set the completion value of the entire function to
// throw the exception.
return handle ( "end" ) ;
}
if ( entry . tryLoc <= this . prev ) {
var hasCatch = hasOwn . call ( entry , "catchLoc" ) ;
var hasFinally = hasOwn . call ( entry , "finallyLoc" ) ;
if ( hasCatch && hasFinally ) {
if ( this . prev < entry . catchLoc ) {
return handle ( entry . catchLoc , true ) ;
} else if ( this . prev < entry . finallyLoc ) {
return handle ( entry . finallyLoc ) ;
}
} else if ( hasCatch ) {
if ( this . prev < entry . catchLoc ) {
return handle ( entry . catchLoc , true ) ;
}
} else if ( hasFinally ) {
if ( this . prev < entry . finallyLoc ) {
return handle ( entry . finallyLoc ) ;
}
} else {
throw new Error ( "try statement without catch or finally" ) ;
}
}
}
} ,
abrupt : function ( type , arg ) {
for ( var i = this . tryEntries . length - 1 ; i >= 0 ; -- i ) {
var entry = this . tryEntries [ i ] ;
if ( entry . tryLoc <= this . prev &&
hasOwn . call ( entry , "finallyLoc" ) &&
this . prev < entry . finallyLoc ) {
var finallyEntry = entry ;
break ;
}
}
if ( finallyEntry &&
( type === "break" ||
type === "continue" ) &&
finallyEntry . tryLoc <= arg &&
arg <= finallyEntry . finallyLoc ) {
// Ignore the finally entry if control is not jumping to a
// location outside the try/catch block.
finallyEntry = null ;
}
var record = finallyEntry ? finallyEntry . completion : { } ;
record . type = type ;
record . arg = arg ;
if ( finallyEntry ) {
this . method = "next" ;
this . next = finallyEntry . finallyLoc ;
return ContinueSentinel ;
}
return this . complete ( record ) ;
} ,
complete : function ( record , afterLoc ) {
if ( record . type === "throw" ) {
throw record . arg ;
}
if ( record . type === "break" ||
record . type === "continue" ) {
this . next = record . arg ;
} else if ( record . type === "return" ) {
this . rval = this . arg = record . arg ;
this . method = "return" ;
this . next = "end" ;
} else if ( record . type === "normal" && afterLoc ) {
this . next = afterLoc ;
}
return ContinueSentinel ;
} ,
finish : function ( finallyLoc ) {
for ( var i = this . tryEntries . length - 1 ; i >= 0 ; -- i ) {
var entry = this . tryEntries [ i ] ;
if ( entry . finallyLoc === finallyLoc ) {
this . complete ( entry . completion , entry . afterLoc ) ;
resetTryEntry ( entry ) ;
return ContinueSentinel ;
}
}
} ,
"catch" : function ( tryLoc ) {
for ( var i = this . tryEntries . length - 1 ; i >= 0 ; -- i ) {
var entry = this . tryEntries [ i ] ;
if ( entry . tryLoc === tryLoc ) {
var record = entry . completion ;
if ( record . type === "throw" ) {
var thrown = record . arg ;
resetTryEntry ( entry ) ;
}
return thrown ;
}
}
// The context.catch method must only be called with a location
// argument that corresponds to a known catch block.
throw new Error ( "illegal catch attempt" ) ;
} ,
delegateYield : function ( iterable , resultName , nextLoc ) {
this . delegate = {
iterator : values ( iterable ) ,
resultName : resultName ,
nextLoc : nextLoc
} ;
if ( this . method === "next" ) {
// Deliberately forget the last sent value so that we don't
// accidentally pass it on to the delegate.
this . arg = undefined ;
}
return ContinueSentinel ;
}
} ;
} ) (
// In sloppy mode, unbound `this` refers to the global object, fallback to
// Function constructor if we're in global strict mode. That is sadly a form
// of indirect eval which violates Content Security Policy.
( function ( ) {
return this || ( typeof self === "object" && self ) ;
} ) ( ) || Function ( "return this" ) ( )
) ;
/***/ } ) ,
/***/ "./node_modules/webpack/buildin/global.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * ( webpack ) / buildin / global . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! no static exports found */
/***/ ( function ( module , exports ) {
var g ;
// This works in non-strict mode
g = ( function ( ) {
return this ;
} ) ( ) ;
try {
// This works if eval is allowed (see CSP)
g = g || new Function ( "return this" ) ( ) ;
} catch ( e ) {
// This works if the window reference is available
if ( typeof window === "object" ) g = window ;
}
// g can still be undefined, but nothing to do about it...
// We return undefined, instead of nothing here, so it's
// easier to handle this case. if(!global) { ...}
module . exports = g ;
/***/ } ) ,
/***/ "./src/analytics/result-collector.ts" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / analytics / result - collector . ts * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: ResultCollector */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "ResultCollector" , function ( ) { return ResultCollector ; } ) ;
/* harmony import */ var _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/classCallCheck */ "../../node_modules/@babel/runtime/helpers/classCallCheck.js" ) ;
/* harmony import */ var _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/createClass */ "../../node_modules/@babel/runtime/helpers/createClass.js" ) ;
/* harmony import */ var _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/defineProperty */ "../../node_modules/@babel/runtime/helpers/defineProperty.js" ) ;
/* harmony import */ var _babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ ) ;
/* harmony import */ var _common _image _debug _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! ../common/image-debug */ "./src/common/image-debug.ts" ) ;
var ResultCollector =
/*#__PURE__*/
function ( ) {
function ResultCollector ( config ) {
_babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default ( ) ( this , ResultCollector ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , "_canvas" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , "_context" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , "_config" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , "_capacity" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , "_capture" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , "_results" , void 0 ) ;
this . _results = new Array ( ) ;
this . _config = config ;
this . _capacity = config . capacity || 20 ;
this . _capture = config . capture === true ;
if ( this . _capture ) {
this . _canvas = document . createElement ( 'canvas' ) ;
this . _context = this . _canvas . getContext ( '2d' ) ;
}
}
_babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default ( ) ( ResultCollector , [ {
key : "addResult" ,
value : function addResult ( data , imageWidth , imageHeight , codeResult ) {
if ( codeResult && this . _capacity && ! this . _contains ( codeResult ) && this . _passesFilter ( codeResult ) ) {
var result = {
codeResult : codeResult
} ;
this . _capacity -- ;
if ( this . _capture ) {
this . _canvas . width = imageWidth ;
this . _canvas . height = imageHeight ;
_common _image _debug _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "ImageDebug" ] . drawImage ( data , imageWidth , imageHeight , this . _context ) ;
result . frame = this . _canvas . toDataURL ( ) ;
}
this . _results . push ( result ) ;
}
}
} , {
key : "getResults" ,
value : function getResults ( ) {
return this . _results ;
}
} , {
key : "_contains" ,
value : function _contains ( codeResult ) {
return this . _config . blacklist && this . _config . blacklist . some ( function ( item ) {
return Object . keys ( item ) . every ( function ( key ) {
return item [ key ] === codeResult [ key ] ;
} ) ;
} ) ;
}
} , {
key : "_passesFilter" ,
value : function _passesFilter ( codeResult ) {
return typeof this . _config . filter !== 'function' || this . _config . filter ( codeResult ) ;
}
} ] ) ;
return ResultCollector ;
} ( ) ;
/***/ } ) ,
/***/ "./src/common/cluster.ts" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / common / cluster . ts * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: Cluster */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "Cluster" , function ( ) { return Cluster ; } ) ;
/* harmony import */ var _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/classCallCheck */ "../../node_modules/@babel/runtime/helpers/classCallCheck.js" ) ;
/* harmony import */ var _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/createClass */ "../../node_modules/@babel/runtime/helpers/createClass.js" ) ;
/* harmony import */ var _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/defineProperty */ "../../node_modules/@babel/runtime/helpers/defineProperty.js" ) ;
/* harmony import */ var _babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ ) ;
/ * *
* Creates a cluster for grouping similar orientations of moments
* /
var Cluster =
/*#__PURE__*/
function ( ) {
_babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default ( ) ( Cluster , null , [ {
key : "clusterize" ,
value : function clusterize ( moments , threshold ) {
var clusters = new Array ( ) ;
moments . forEach ( function ( moment ) {
var matchingCluster = clusters . find ( function ( cluster ) {
return cluster . fits ( moment ) ;
} ) ;
if ( matchingCluster ) {
matchingCluster . add ( moment ) ;
} else {
clusters . push ( new Cluster ( threshold , moment ) ) ;
}
} ) ;
return clusters ;
}
} ] ) ;
function Cluster ( threshold , moment ) {
_babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default ( ) ( this , Cluster ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , "_threshold" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , "_moments" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , "_center" , void 0 ) ;
this . _threshold = threshold ;
this . _moments = new Array ( ) ;
this . _center = {
rad : 0 ,
x : 0 ,
y : 0
} ;
if ( moment ) {
this . add ( moment ) ;
}
}
_babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default ( ) ( Cluster , [ {
key : "add" ,
value : function add ( point ) {
this . _moments . push ( point ) ; // Update center
this . _center . rad = this . _moments . reduce ( function ( sum , p ) {
return sum + p . rad ;
} , 0 ) / this . _moments . length ;
this . _center . x = Math . cos ( this . _center . rad ) ;
this . _center . y = Math . sin ( this . _center . rad ) ;
}
} , {
key : "fits" ,
value : function fits ( moment ) {
// check cosine similarity to center-angle
var similarity = Math . abs ( moment . x * this . _center . x + moment . y * this . _center . y ) ;
return similarity > this . _threshold ;
}
} , {
key : "moments" ,
get : function get ( ) {
return this . _moments ;
}
} ] ) ;
return Cluster ;
} ( ) ;
/***/ } ) ,
/***/ "./src/common/events.ts" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / common / events . ts * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: Events */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "Events" , function ( ) { return Events ; } ) ;
/* harmony import */ var _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/classCallCheck */ "../../node_modules/@babel/runtime/helpers/classCallCheck.js" ) ;
/* harmony import */ var _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/createClass */ "../../node_modules/@babel/runtime/helpers/createClass.js" ) ;
/* harmony import */ var _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ ) ;
var events = { } ;
var Events =
/*#__PURE__*/
function ( ) {
function Events ( ) {
_babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default ( ) ( this , Events ) ;
}
_babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default ( ) ( Events , null , [ {
key : "subscribe" ,
value : function subscribe ( event , callback , async ) {
var subscription ;
if ( typeof callback === 'function' ) {
subscription = {
callback : callback ,
async : async
} ;
} else {
subscription = callback ;
if ( ! subscription . callback ) {
throw 'Callback was not specified on options' ;
}
}
getEvent ( event ) . subscriptions . push ( subscription ) ;
}
} , {
key : "publish" ,
value : function publish ( type , data ) {
var eventItem = getEvent ( type ) ;
var subscriptions = eventItem . subscriptions ; // Publish one-time subscriptions
subscriptions . filter ( function ( _ref ) {
var once = _ref . once ;
return ! ! once ;
} ) . forEach ( function ( subscription ) {
return publishSubscription ( subscription , data ) ;
} ) ; // remove them from the subscription
eventItem . subscriptions = subscriptions . filter ( function ( _ref2 ) {
var once = _ref2 . once ;
return ! once ;
} ) ; // publish the rest
eventItem . subscriptions . forEach ( function ( subscription ) {
return publishSubscription ( subscription , data ) ;
} ) ;
}
} , {
key : "once" ,
value : function once ( event , callback , async ) {
Events . subscribe ( event , {
callback : callback ,
async : async ,
once : true
} ) ;
}
} , {
key : "unsubscribe" ,
value : function unsubscribe ( eventName , callback ) {
if ( eventName ) {
var event = getEvent ( eventName ) ;
if ( event && callback ) {
event . subscriptions = event . subscriptions . filter ( function ( subscription ) {
return subscription . callback !== callback ;
} ) ;
} else {
event . subscriptions = [ ] ;
}
} else {
events = { } ;
}
}
} ] ) ;
return Events ;
} ( ) ;
function getEvent ( eventName ) {
if ( ! events [ eventName ] ) {
events [ eventName ] = {
subscriptions : [ ]
} ;
}
return events [ eventName ] ;
}
function publishSubscription ( subscription , data ) {
if ( subscription . async ) {
setTimeout ( function ( ) {
subscription . callback ( data ) ;
} , 4 ) ;
} else {
subscription . callback ( data ) ;
}
}
/***/ } ) ,
/***/ "./src/common/hsv2rgb.ts" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / common / hsv2rgb . ts * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: hsv2rgb */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "hsv2rgb" , function ( ) { return hsv2rgb ; } ) ;
function hsv2rgb ( hsv , rgb ) {
var h = hsv [ 0 ] ;
var s = hsv [ 1 ] ;
var v = hsv [ 2 ] ;
var c = v * s ;
var x = c * ( 1 - Math . abs ( h / 60 % 2 - 1 ) ) ;
var m = v - c ;
var r = 0 ;
var g = 0 ;
var b = 0 ;
if ( h < 60 ) {
r = c ;
g = x ;
} else if ( h < 120 ) {
r = x ;
g = c ;
} else if ( h < 180 ) {
g = c ;
b = x ;
} else if ( h < 240 ) {
g = x ;
b = c ;
} else if ( h < 300 ) {
r = x ;
b = c ;
} else if ( h < 360 ) {
r = c ;
b = x ;
}
rgb = rgb || [ 0 , 0 , 0 ] ;
rgb [ 0 ] = ( r + m ) * 255 | 0 ;
rgb [ 1 ] = ( g + m ) * 255 | 0 ;
rgb [ 2 ] = ( b + m ) * 255 | 0 ;
return rgb ;
}
/***/ } ) ,
/***/ "./src/common/image-debug.ts" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / common / image - debug . ts * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: ImageDebug */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "ImageDebug" , function ( ) { return ImageDebug ; } ) ;
var ImageDebug = {
drawPath : function drawPath ( path , context , color , lineWidth ) {
if ( path && path . length > 1 ) {
context . strokeStyle = color ;
context . fillStyle = color ;
context . lineWidth = lineWidth ;
context . beginPath ( ) ;
context . moveTo ( path [ 0 ] . x , path [ 0 ] . y ) ;
path . slice ( 1 ) . forEach ( function ( _ref ) {
var x = _ref . x ,
y = _ref . y ;
return context . lineTo ( x , y ) ;
} ) ;
context . closePath ( ) ;
context . stroke ( ) ;
}
} ,
drawImage : function drawImage ( imageData , width , height , context ) {
var canvasData = context . getImageData ( 0 , 0 , width , height ) ;
var data = canvasData . data ;
var imageIndex = imageData . length | 0 ;
var canvasIndex = data . length | 0 ;
if ( canvasIndex / imageIndex !== 4 ) {
return false ;
}
while ( imageIndex -- ) {
var value = imageData [ imageIndex ] ;
data [ -- canvasIndex ] = 255 ;
data [ -- canvasIndex ] = value ;
data [ -- canvasIndex ] = value ;
data [ -- canvasIndex ] = value ;
}
context . putImageData ( canvasData , 0 , 0 ) ;
return true ;
}
} ;
/***/ } ) ,
/***/ "./src/common/image-wrapper.ts" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / common / image - wrapper . ts * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: ImageWrapper */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "ImageWrapper" , function ( ) { return ImageWrapper ; } ) ;
/* harmony import */ var _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/classCallCheck */ "../../node_modules/@babel/runtime/helpers/classCallCheck.js" ) ;
/* harmony import */ var _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/createClass */ "../../node_modules/@babel/runtime/helpers/createClass.js" ) ;
/* harmony import */ var _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/defineProperty */ "../../node_modules/@babel/runtime/helpers/defineProperty.js" ) ;
/* harmony import */ var _babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ ) ;
/* harmony import */ var _hsv2rgb _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! ./hsv2rgb */ "./src/common/hsv2rgb.ts" ) ;
/ * *
* Represents a basic image combining the data and size .
* In addition , some methods for manipulation are contained .
* /
var ImageWrapper =
/*#__PURE__*/
function ( ) {
/ * *
* @ param size The size of the image in pixel
* @ param data If given , a flat array containing the pixel data
* @ param arrayType If given , the desired DataType of the Array ( may be typed / non - typed )
* @ param initialize Indicating if the array should be initialized on creation .
* /
function ImageWrapper ( size , data , arrayType , initialize ) {
_babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default ( ) ( this , ImageWrapper ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , "data" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , "size" , void 0 ) ;
if ( ! data ) {
this . data = new ( arrayType || Uint8Array ) ( size . x * size . y ) ;
if ( initialize ) {
this . data . fill ( 0 ) ;
}
} else {
this . data = data ;
}
this . size = size ;
}
/ * *
* Tests if a position is within the image with a given offset
* @ param point The location to test
* @ param border The padding value in pixels
* @ returns true if location inside the image ' s border , false otherwise
* @ see cvd / image . h
* /
_babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default ( ) ( ImageWrapper , [ {
key : "inImageWithBorder" ,
value : function inImageWithBorder ( point , border ) {
return point . x >= border && point . y >= border && point . x < this . size . x - border && point . y < this . size . y - border ;
}
/ * *
* Creates an { ImageWrapper ) and copies the needed underlying image - data area
* @ param imageWrapper The target { ImageWrapper } where the data should be copied
* @ param fromX The horizontal position where to copy from
* @ param fromY The vertical position where to copy from
* /
} , {
key : "subImageAsCopy" ,
value : function subImageAsCopy ( imageWrapper , fromX , fromY ) {
var sizeY = imageWrapper . size . y ;
var sizeX = imageWrapper . size . x ;
for ( var x = 0 ; x < sizeX ; x ++ ) {
for ( var y = 0 ; y < sizeY ; y ++ ) {
imageWrapper . data [ y * sizeX + x ] = this . data [ ( fromY + y ) * this . size . x + fromX + x ] ;
}
}
}
/ * *
* Retrieves a given pixel position from the image
* @ param x The x - position
* @ param y The y - position
* @ returns The grayscale value at the pixel - position
* /
} , {
key : "get" ,
value : function get ( x , y ) {
return this . data [ y * this . size . x + x ] ;
}
/ * *
* Sets a given pixel position in the image
* @ param x The x - position
* @ param y The y - position
* @ param value The grayscale value to set
* @ returns The Image itself ( for possible chaining )
* /
} , {
key : "set" ,
value : function set ( x , y , value ) {
this . data [ y * this . size . x + x ] = value ;
return this ;
}
/ * *
* Sets the border of the image ( 1 pixel ) to zero
* /
} , {
key : "zeroBorder" ,
value : function zeroBorder ( ) {
var width = this . size . x ;
var height = this . size . y ;
var data = this . data ;
for ( var i = 0 ; i < width ; i ++ ) {
data [ i ] = data [ ( height - 1 ) * width + i ] = 0 ;
}
for ( var _i = 1 ; _i < height - 1 ; _i ++ ) {
data [ _i * width ] = data [ _i * width + ( width - 1 ) ] = 0 ;
}
}
/ * *
* Inverts a binary image in place
* /
} , {
key : "invert" ,
value : function invert ( ) {
var data = this . data ;
for ( var i = data . length ; i -- ; ) {
data [ i ] = data [ i ] ? 0 : 1 ;
}
}
} , {
key : "moments" ,
value : function moments ( labelCount ) {
var height = this . size . y ;
var width = this . size . x ;
var labelSum = new Array ( ) ;
var result = new Array ( ) ;
if ( labelCount <= 0 ) {
return result ;
}
for ( var i = 0 ; i < labelCount ; i ++ ) {
labelSum [ i ] = {
m00 : 0 ,
m01 : 0 ,
m10 : 0 ,
m11 : 0 ,
m02 : 0 ,
m20 : 0 ,
theta : 0 ,
rad : 0
} ;
}
for ( var y = 0 ; y < height ; y ++ ) {
var ysq = y * y ;
for ( var x = 0 ; x < width ; x ++ ) {
var val = this . data [ y * width + x ] ;
if ( val > 0 ) {
var label = labelSum [ val - 1 ] ;
label . m00 += 1 ;
label . m01 += y ;
label . m10 += x ;
label . m11 += x * y ;
label . m02 += ysq ;
label . m20 += x * x ;
}
}
}
var PI = Math . PI ;
var PI _4 = PI / 4 ;
for ( var _i2 = 0 ; _i2 < labelCount ; _i2 ++ ) {
var _label = labelSum [ _i2 ] ;
if ( ! isNaN ( _label . m00 ) && _label . m00 !== 0 ) {
var x _ = _label . m10 / _label . m00 ;
var y _ = _label . m01 / _label . m00 ;
var mu11 = _label . m11 / _label . m00 - x _ * y _ ;
var mu02 = _label . m02 / _label . m00 - y _ * y _ ;
var mu20 = _label . m20 / _label . m00 - x _ * x _ ;
var tmp = 0.5 * Math . atan ( ( mu02 - mu20 ) / ( 2 * mu11 ) ) + ( mu11 >= 0 ? PI _4 : - PI _4 ) + PI ;
_label . theta = ( tmp * 180 / PI + 90 ) % 180 - 90 ;
if ( _label . theta < 0 ) {
_label . theta += 180 ;
}
_label . rad = tmp > PI ? tmp - PI : tmp ;
_label . x = Math . cos ( tmp ) ;
_label . y = Math . sin ( tmp ) ;
result . push ( _label ) ;
}
}
return result ;
}
/ * *
* Displays the { ImageWrapper } in a given canvas
* @ param context The rendering context to write to
* @ param scale Scale which is applied to each pixel - value
* /
} , {
key : "show" ,
value : function show ( context , scale ) {
var height = this . size . y ;
var width = this . size . x ; // const context = canvas.getContext('2d');
// canvas.height = height;
// canvas.width = width;
var frame = context . getImageData ( 0 , 0 , width , height ) ;
var data = frame . data ;
var current = 0 ;
if ( ! scale ) {
scale = 1.0 ;
}
for ( var y = 0 ; y < height ; y ++ ) {
for ( var x = 0 ; x < width ; x ++ ) {
var pixel = y * width + x ;
current = this . get ( x , y ) * scale ;
data [ pixel * 4 + 0 ] = current ;
data [ pixel * 4 + 1 ] = current ;
data [ pixel * 4 + 2 ] = current ;
data [ pixel * 4 + 3 ] = 255 ;
}
} //frame.data = data;
context . putImageData ( frame , 0 , 0 ) ;
}
/ * *
* Displays the part of the image in a given canvas
* @ param context The rendering context to write to
* @ param scale Scale which is applied to each pixel - value
* @ param fromX The horizontal position where to overlay from
* @ param fromY The vertical position where to overlay from
* /
} , {
key : "overlay" ,
value : function overlay ( context , scale , fromX , fromY ) {
var hsv = [ 0 , 1 , 1 ] ;
var whiteRgb = [ 255 , 255 , 255 ] ;
var blackRgb = [ 0 , 0 , 0 ] ;
var frame = context . getImageData ( fromX , fromY , this . size . x , this . size . y ) ;
var data = frame . data ;
if ( ! scale || scale < 0 || scale > 360 ) {
scale = 360 ;
}
for ( var length = this . data . length ; length -- ; ) {
hsv [ 0 ] = this . data [ length ] * scale ;
var rgb = hsv [ 0 ] <= 0 ? whiteRgb : hsv [ 0 ] >= 360 ? blackRgb : Object ( _hsv2rgb _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "hsv2rgb" ] ) ( hsv ) ;
data [ length * 4 + 0 ] = rgb [ 0 ] ;
data [ length * 4 + 1 ] = rgb [ 1 ] ;
data [ length * 4 + 2 ] = rgb [ 2 ] ;
data [ length * 4 + 3 ] = 255 ;
}
context . putImageData ( frame , fromX , fromY ) ;
}
} ] ) ;
return ImageWrapper ;
} ( ) ;
/***/ } ) ,
/***/ "./src/common/media-devices.ts" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / common / media - devices . ts * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: enumerateDevices, getUserMedia */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "enumerateDevices" , function ( ) { return enumerateDevices ; } ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "getUserMedia" , function ( ) { return getUserMedia ; } ) ;
function enumerateDevices ( ) {
if ( navigator . mediaDevices && typeof navigator . mediaDevices . enumerateDevices === 'function' ) {
return navigator . mediaDevices . enumerateDevices ( ) ;
}
return Promise . reject ( new Error ( 'enumerateDevices is not defined' ) ) ;
}
function getUserMedia ( constraints ) {
if ( navigator . mediaDevices && typeof navigator . mediaDevices . getUserMedia === 'function' ) {
return navigator . mediaDevices . getUserMedia ( constraints ) ;
}
return Promise . reject ( new Error ( 'getUserMedia is not defined' ) ) ;
}
/***/ } ) ,
/***/ "./src/common/merge.ts" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / common / merge . ts * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: merge */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "merge" , function ( ) { return merge ; } ) ;
/* harmony import */ var _babel _runtime _helpers _typeof _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/typeof */ "../../node_modules/@babel/runtime/helpers/typeof.js" ) ;
/* harmony import */ var _babel _runtime _helpers _typeof _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _typeof _ _WEBPACK _IMPORTED _MODULE _0 _ _ ) ;
/ * *
* Performs a deep merge of objects and returns new object .
* Does not modify objects ( immutable ) .
* @ see https : //stackoverflow.com/a/48218209
*
* @ param objects - Objects to merge
* @ returns New object with merged key / values
* /
function merge ( ) {
var isObject = function isObject ( obj ) {
return obj && _babel _runtime _helpers _typeof _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default ( ) ( obj ) === 'object' ;
} ;
for ( var _len = arguments . length , objects = new Array ( _len ) , _key = 0 ; _key < _len ; _key ++ ) {
objects [ _key ] = arguments [ _key ] ;
}
return objects . reduce ( function ( prev , obj ) {
if ( obj ) {
Object . keys ( obj ) . forEach ( function ( key ) {
var pVal = prev [ key ] ;
var oVal = obj [ key ] ;
if ( Array . isArray ( pVal ) && Array . isArray ( oVal ) ) {
// prev[key] = pVal.concat(...oVal);
prev [ key ] = oVal ;
} else if ( isObject ( pVal ) && isObject ( oVal ) ) {
prev [ key ] = merge ( pVal , oVal ) ;
} else {
prev [ key ] = oVal ;
}
} ) ;
}
return prev ;
} , { } ) ;
}
/***/ } ) ,
/***/ "./src/config/config.dev.ts" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / config / config . dev . ts * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: config */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "config" , function ( ) { return config ; } ) ;
var config = {
inputStream : {
name : 'Live' ,
type : 'LiveStream' ,
constraints : {
width : 640 ,
height : 480 ,
// aspectRatio: 640/480, // optional
facingMode : 'environment' // or user
// deviceId: '38745983457387598375983759834'
} ,
area : {
top : '0%' ,
right : '0%' ,
left : '0%' ,
bottom : '0%'
} ,
singleChannel : false // true: only the red color-channel is read
} ,
locate : true ,
numOfWorkers : 0 ,
decoder : {
readers : [ 'code_128_reader' ] ,
debug : {
drawBoundingBox : false ,
showFrequency : false ,
drawScanline : false ,
showPattern : false
}
} ,
locator : {
halfSample : true ,
patchSize : 'medium' ,
// x-small, small, medium, large, x-large
debug : {
showCanvas : false ,
showPatches : false ,
showFoundPatches : false ,
showSkeleton : false ,
showLabels : false ,
showPatchLabels : false ,
showRemainingPatchLabels : false ,
boxFromPatches : {
showTransformed : false ,
showTransformedBox : false ,
showBB : false
}
}
}
} ;
/***/ } ) ,
/***/ "./src/decoder/barcode-decoder.ts" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / decoder / barcode - decoder . ts * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: BarcodeDecoder */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "BarcodeDecoder" , function ( ) { return BarcodeDecoder ; } ) ;
/* harmony import */ var _babel _runtime _helpers _toConsumableArray _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/toConsumableArray */ "../../node_modules/@babel/runtime/helpers/toConsumableArray.js" ) ;
/* harmony import */ var _babel _runtime _helpers _toConsumableArray _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _toConsumableArray _ _WEBPACK _IMPORTED _MODULE _0 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _typeof _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/typeof */ "../../node_modules/@babel/runtime/helpers/typeof.js" ) ;
/* harmony import */ var _babel _runtime _helpers _typeof _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _typeof _ _WEBPACK _IMPORTED _MODULE _1 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/classCallCheck */ "../../node_modules/@babel/runtime/helpers/classCallCheck.js" ) ;
/* harmony import */ var _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _2 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/createClass */ "../../node_modules/@babel/runtime/helpers/createClass.js" ) ;
/* harmony import */ var _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _3 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _3 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _4 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/defineProperty */ "../../node_modules/@babel/runtime/helpers/defineProperty.js" ) ;
/* harmony import */ var _babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _4 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _4 _ _ ) ;
/* harmony import */ var _reader _index _ _WEBPACK _IMPORTED _MODULE _5 _ _ = _ _webpack _require _ _ ( /*! ../reader/index */ "./src/reader/index.ts" ) ;
/* harmony import */ var _bresenham _ _WEBPACK _IMPORTED _MODULE _6 _ _ = _ _webpack _require _ _ ( /*! ./bresenham */ "./src/decoder/bresenham.ts" ) ;
/* harmony import */ var _common _image _debug _ _WEBPACK _IMPORTED _MODULE _7 _ _ = _ _webpack _require _ _ ( /*! ../common/image-debug */ "./src/common/image-debug.ts" ) ;
;
var BarcodeDecoder =
/*#__PURE__*/
function ( ) {
function BarcodeDecoder ( config , inputImageWrapper ) {
_babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , BarcodeDecoder ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _4 _ _ _default ( ) ( this , "_config" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _4 _ _ _default ( ) ( this , "_inputImageWrapper" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _4 _ _ _default ( ) ( this , "_frequencyCanvas" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _4 _ _ _default ( ) ( this , "_patternCanvas" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _4 _ _ _default ( ) ( this , "_overlayContext" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _4 _ _ _default ( ) ( this , "_barcodeReaders" , void 0 ) ;
this . _config = config ;
this . _inputImageWrapper = inputImageWrapper ;
this . _barcodeReaders = [ ] ;
if ( true && this . _config . debug && typeof document !== 'undefined' ) {
var debugDiv = document . querySelector ( '#debug.detection' ) ;
this . _frequencyCanvas = document . querySelector ( 'canvas.frequency' ) ;
if ( ! this . _frequencyCanvas ) {
this . _frequencyCanvas = document . createElement ( 'canvas' ) ;
this . _frequencyCanvas . className = 'frequency' ;
if ( debugDiv ) {
debugDiv . appendChild ( this . _frequencyCanvas ) ;
}
}
this . _frequencyCanvas . style . display = this . _config . debug . showFrequency ? 'block' : 'none' ;
this . _patternCanvas = document . querySelector ( 'canvas.patternBuffer' ) ;
if ( ! this . _patternCanvas ) {
this . _patternCanvas = document . createElement ( 'canvas' ) ;
this . _patternCanvas . className = 'patternBuffer' ;
if ( debugDiv ) {
debugDiv . appendChild ( this . _patternCanvas ) ;
}
}
this . _patternCanvas . style . display = this . _config . debug . showPattern ? 'block' : 'none' ;
var overlayCanvas = document . querySelector ( 'canvas.drawingBuffer' ) ;
this . _overlayContext = overlayCanvas ? overlayCanvas . getContext ( '2d' ) : null ;
}
this . _initReaders ( ) ;
}
_babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _3 _ _ _default ( ) ( BarcodeDecoder , [ {
key : "decodeFromBoundingBoxes" ,
value : function decodeFromBoundingBoxes ( boxes ) {
var _this = this ;
var barcode = null ;
if ( boxes ) {
if ( this . _config . multiple ) {
var barcodes = boxes . map ( function ( box ) {
return _this . decodeFromBoundingBox ( box ) ;
} ) ;
return {
barcodes : barcodes ,
boxes : boxes
} ;
}
if ( boxes . some ( function ( box ) {
return ! ! ( barcode = _this . decodeFromBoundingBox ( box ) ) ;
} ) ) {
barcode . boxes = boxes ;
}
}
return barcode ;
}
/ * *
* With the help of the configured readers this function tries to detect
* a valid barcode pattern within the given area .
* @ param box The area to search in
* @ returns The result { codeResult , line , angle , pattern , threshold }
* /
} , {
key : "decodeFromBoundingBox" ,
value : function decodeFromBoundingBox ( box ) {
var debug = true && this . _overlayContext && this . _config . debug ;
if ( debug && debug . drawBoundingBox ) {
this . _drawPath ( box , 'blue' , 2 ) ;
}
var line = this . _getLine ( box ) ;
if ( line === null ) {
return null ;
}
var angle = Math . atan2 ( line [ 1 ] . y - line [ 0 ] . y , line [ 1 ] . x - line [ 0 ] . x ) ;
line = this . _getExtendedLine ( line , angle ) ;
var result = this . _tryDecode ( line ) ;
if ( result === null ) {
result = this . _tryDecodeBruteForce ( box , line , angle ) ;
}
if ( result === null ) {
return null ;
}
if ( debug && debug . drawScanline ) {
this . _drawPath ( line , 'red' , 3 ) ;
}
return {
angle : angle ,
box : box ,
codeResult : result . codeResult ,
line : line ,
pattern : result . barcodeLine . line ,
threshold : result . barcodeLine . threshold
} ;
}
} , {
key : "setReaders" ,
value : function setReaders ( readers ) {
this . _config . readers = readers ;
this . _barcodeReaders . length = 0 ;
this . _initReaders ( ) ;
}
} , {
key : "_initReaders" ,
value : function _initReaders ( ) {
var _this2 = this ;
this . _config . readers . forEach ( function ( readerConfig ) {
var reader ;
var configuration = { } ;
var supplements = [ ] ;
if ( _babel _runtime _helpers _typeof _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default ( ) ( readerConfig ) === 'object' ) {
reader = readerConfig . format ;
configuration = readerConfig . config || { } ;
} else if ( typeof readerConfig === 'string' ) {
reader = readerConfig ;
}
if ( true ) {
console . log ( 'Before registering reader:' , reader ) ;
}
if ( configuration . supplements ) {
supplements = configuration . supplements . map ( function ( supplement ) {
return new _reader _index _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "Readers" ] [ supplement ] ( ) ;
} ) ;
}
_this2 . _barcodeReaders . push ( new _reader _index _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "Readers" ] [ reader ] ( configuration , supplements ) ) ;
} ) ;
if ( true ) {
var _console ;
( _console = console ) . log . apply ( _console , [ 'Registered Readers:' ] . concat ( _babel _runtime _helpers _toConsumableArray _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default ( ) ( this . _barcodeReaders . map ( function ( _ref ) {
var config = _ref . config ,
FORMAT = _ref . FORMAT ;
return JSON . stringify ( {
config : config ,
FORMAT : FORMAT
} ) ;
} ) ) ) ) ;
}
}
/ * *
* extend the line on both ends
* @ param line
* @ param angle
* /
} , {
key : "_getExtendedLine" ,
value : function _getExtendedLine ( line , angle ) {
function extendLine ( amount ) {
var extension = {
y : amount * Math . sin ( angle ) ,
x : amount * Math . cos ( angle )
} ;
line [ 0 ] . y -= extension . y ;
line [ 0 ] . x -= extension . x ;
line [ 1 ] . y += extension . y ;
line [ 1 ] . x += extension . x ;
}
var lineLength = Math . sqrt ( Math . pow ( line [ 1 ] . y - line [ 0 ] . y , 2 ) + Math . pow ( line [ 1 ] . x - line [ 0 ] . x , 2 ) ) ;
var extensionLength = lineLength * 0.1 | 0 ;
extendLine ( extensionLength ) ; // check if inside image
while ( extensionLength > 1 && ( ! this . _inputImageWrapper . inImageWithBorder ( line [ 0 ] , 0 ) || ! this . _inputImageWrapper . inImageWithBorder ( line [ 1 ] , 0 ) ) ) {
extensionLength >>= 1 ;
extendLine ( - extensionLength ) ;
}
return line ;
}
} , {
key : "_getLine" ,
value : function _getLine ( box ) {
return [ {
x : ( box [ 1 ] . x + box [ 0 ] . x ) / 2 ,
y : ( box [ 1 ] . y + box [ 0 ] . y ) / 2
} , {
x : ( box [ 3 ] . x + box [ 2 ] . x ) / 2 ,
y : ( box [ 3 ] . y + box [ 2 ] . y ) / 2
} ] ;
}
} , {
key : "_tryDecode" ,
value : function _tryDecode ( line ) {
var debug = true && this . _config . debug ;
if ( debug && this . _overlayContext ) {
this . _drawPath ( line , 'red' , 3 ) ;
}
var barcodeLine = _bresenham _ _WEBPACK _IMPORTED _MODULE _6 _ _ [ "Bresenham" ] . getBarcodeLine ( this . _inputImageWrapper , line [ 0 ] , line [ 1 ] ) ;
if ( debug && debug . showFrequency ) {
this . _printFrequency ( barcodeLine . line ) ;
}
barcodeLine = _bresenham _ _WEBPACK _IMPORTED _MODULE _6 _ _ [ "Bresenham" ] . toBinaryLine ( barcodeLine ) ;
if ( debug && debug . showPattern ) {
this . _printPattern ( barcodeLine . line ) ;
}
var codeResult = null ;
this . _barcodeReaders . some ( function ( reader ) {
return ! ! ( codeResult = reader . decodePattern ( barcodeLine . line ) ) ;
} ) ;
return codeResult ? {
codeResult : codeResult ,
barcodeLine : barcodeLine
} : null ;
}
/ * *
* This method slices the given area apart and tries to detect a barcode - pattern for each slice .
* It returns the decoded barcode , or null if nothing was found
* @ param box
* @ param line
* @ param lineAngle
* /
} , {
key : "_tryDecodeBruteForce" ,
value : function _tryDecodeBruteForce ( box , line , lineAngle ) {
var sideLength = Math . sqrt ( Math . pow ( box [ 1 ] . x - box [ 0 ] . x , 2 ) + Math . pow ( box [ 1 ] . y - box [ 0 ] . y , 2 ) ) ;
var slices = 16 ;
var xdir = Math . sin ( lineAngle ) ;
var ydir = Math . cos ( lineAngle ) ;
for ( var i = 1 ; i < slices ; i ++ ) {
// move line perpendicular to angle
var dir = sideLength / slices * i * ( i % 2 === 0 ? - 1 : 1 ) ;
line [ 0 ] . y += dir * xdir ;
line [ 0 ] . x -= dir * ydir ;
line [ 1 ] . y += dir * xdir ;
line [ 1 ] . x -= dir * ydir ;
var result = this . _tryDecode ( line ) ;
if ( result ) {
return result ;
}
}
return null ;
}
/ * *
* Used for development only
* /
} , {
key : "_printFrequency" ,
value : function _printFrequency ( line ) {
var context = this . _frequencyCanvas . getContext ( '2d' ) ;
this . _frequencyCanvas . width = line . length ;
this . _frequencyCanvas . height = 256 ;
context . beginPath ( ) ;
context . strokeStyle = 'blue' ;
for ( var i = 0 ; i < line . length ; i ++ ) {
context . moveTo ( i , 255 ) ;
context . lineTo ( i , 255 - line [ i ] ) ;
}
context . closePath ( ) ;
context . stroke ( ) ;
}
/ * *
* Used for development only
* /
} , {
key : "_printPattern" ,
value : function _printPattern ( line ) {
var context = this . _patternCanvas . getContext ( '2d' ) ;
this . _patternCanvas . width = line . length ;
context . fillStyle = 'black' ;
for ( var i = 0 ; i < line . length ; i ++ ) {
if ( line [ i ] === 1 ) {
context . fillRect ( i , 0 , 1 , 100 ) ;
}
}
}
} , {
key : "_drawPath" ,
value : function _drawPath ( path , color , lineWidth ) {
_common _image _debug _ _WEBPACK _IMPORTED _MODULE _7 _ _ [ "ImageDebug" ] . drawPath ( path , this . _overlayContext , color , lineWidth ) ;
}
} ] ) ;
return BarcodeDecoder ;
} ( ) ;
/***/ } ) ,
/***/ "./src/decoder/bresenham.ts" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / decoder / bresenham . ts * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: Bresenham */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "Bresenham" , function ( ) { return Bresenham ; } ) ;
/* harmony import */ var _babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/defineProperty */ "../../node_modules/@babel/runtime/helpers/defineProperty.js" ) ;
/* harmony import */ var _babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _0 _ _ ) ;
function ownKeys ( object , enumerableOnly ) { var keys = Object . keys ( object ) ; if ( Object . getOwnPropertySymbols ) { var symbols = Object . getOwnPropertySymbols ( object ) ; if ( enumerableOnly ) symbols = symbols . filter ( function ( sym ) { return Object . getOwnPropertyDescriptor ( object , sym ) . enumerable ; } ) ; keys . push . apply ( keys , symbols ) ; } return keys ; }
function _objectSpread ( target ) { for ( var i = 1 ; i < arguments . length ; i ++ ) { var source = arguments [ i ] != null ? arguments [ i ] : { } ; if ( i % 2 ) { ownKeys ( source , true ) . forEach ( function ( key ) { _babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default ( ) ( target , key , source [ key ] ) ; } ) ; } else if ( Object . getOwnPropertyDescriptors ) { Object . defineProperties ( target , Object . getOwnPropertyDescriptors ( source ) ) ; } else { ownKeys ( source ) . forEach ( function ( key ) { Object . defineProperty ( target , key , Object . getOwnPropertyDescriptor ( source , key ) ) ; } ) ; } } return target ; }
var Slope ;
( function ( Slope ) {
Slope [ Slope [ "Up" ] = 1 ] = "Up" ;
Slope [ Slope [ "Down" ] = - 1 ] = "Down" ;
} ) ( Slope || ( Slope = { } ) ) ;
;
var Bresenham = {
/ * *
* Scans a line of the given image from point p1 to p2 and returns a result object containing
* gray - scale values ( 0 - 255 ) of the underlying pixels in addition to the min and max values .
* @ param imageWrapper
* @ param p1 The start point { x , y }
* @ param p2 The end point { x , y }
* @ returns { line , min , max }
* /
getBarcodeLine : function getBarcodeLine ( imageWrapper , p1 , p2 ) {
var x0 = p1 . x | 0 ;
var y0 = p1 . y | 0 ;
var x1 = p2 . x | 0 ;
var y1 = p2 . y | 0 ;
var steep = Math . abs ( y1 - y0 ) > Math . abs ( x1 - x0 ) ;
var tmp ;
var line = [ ] ;
var imageData = imageWrapper . data ;
var width = imageWrapper . size . x ;
var val ;
var min = 255 ;
var max = 0 ;
function read ( a , b ) {
val = imageData [ b * width + a ] ;
min = val < min ? val : min ;
max = val > max ? val : max ;
line . push ( val ) ;
}
if ( steep ) {
tmp = x0 ;
x0 = y0 ;
y0 = tmp ;
tmp = x1 ;
x1 = y1 ;
y1 = tmp ;
}
if ( x0 > x1 ) {
tmp = x0 ;
x0 = x1 ;
x1 = tmp ;
tmp = y0 ;
y0 = y1 ;
y1 = tmp ;
}
var deltax = x1 - x0 ;
var deltay = Math . abs ( y1 - y0 ) ;
var error = deltax / 2 | 0 ;
var y = y0 ;
var ystep = y0 < y1 ? 1 : - 1 ;
for ( var x = x0 ; x < x1 ; x ++ ) {
if ( steep ) {
read ( y , x ) ;
} else {
read ( x , y ) ;
}
error = error - deltay ;
if ( error < 0 ) {
y += ystep ;
error = error + deltax ;
}
}
return {
line : line ,
min : min ,
max : max
} ;
} ,
/ * *
* Converts the result from getBarcodeLine into a binary representation
* also considering the frequency and slope of the signal for more robust results
* @ param result { line , min , max }
* /
toBinaryLine : function toBinaryLine ( result ) {
var min = result . min ;
var max = result . max ;
var line = result . line ;
var center = min + ( max - min ) / 2 ;
var extrema = new Array ( ) ;
var threshold = ( max - min ) / 12 ;
var rThreshold = - threshold ; // 1. find extrema
var currentDir = line [ 0 ] > center ? Slope . Up : Slope . Down ;
extrema . push ( {
pos : 0 ,
val : line [ 0 ]
} ) ;
for ( var i = 0 ; i < line . length - 2 ; i ++ ) {
var slope = line [ i + 1 ] - line [ i ] ;
var slope2 = line [ i + 2 ] - line [ i + 1 ] ;
var dir = void 0 ;
if ( slope + slope2 < rThreshold && line [ i + 1 ] < center * 1.5 ) {
dir = Slope . Down ;
} else if ( slope + slope2 > threshold && line [ i + 1 ] > center * 0.5 ) {
dir = Slope . Up ;
} else {
dir = currentDir ;
}
if ( currentDir !== dir ) {
extrema . push ( {
pos : i ,
val : line [ i ]
} ) ;
currentDir = dir ;
}
}
extrema . push ( {
pos : line . length ,
val : line [ line . length - 1 ]
} ) ;
for ( var j = extrema [ 0 ] . pos ; j < extrema [ 1 ] . pos ; j ++ ) {
line [ j ] = line [ j ] > center ? 0 : 1 ;
} // iterate over extrema and convert to binary based on avg between minmax
for ( var _i = 1 ; _i < extrema . length - 1 ; _i ++ ) {
if ( extrema [ _i + 1 ] . val > extrema [ _i ] . val ) {
threshold = extrema [ _i ] . val + ( extrema [ _i + 1 ] . val - extrema [ _i ] . val ) / 3 * 2 | 0 ;
} else {
threshold = extrema [ _i + 1 ] . val + ( extrema [ _i ] . val - extrema [ _i + 1 ] . val ) / 3 | 0 ;
}
for ( var _j = extrema [ _i ] . pos ; _j < extrema [ _i + 1 ] . pos ; _j ++ ) {
line [ _j ] = line [ _j ] > threshold ? 0 : 1 ;
}
}
return _objectSpread ( { } , result , {
threshold : threshold
} ) ;
}
} ;
/***/ } ) ,
/***/ "./src/input/camera-access.ts" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / input / camera - access . ts * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: CameraAccess */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "CameraAccess" , function ( ) { return CameraAccess ; } ) ;
/* harmony import */ var _babel _runtime _regenerator _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/regenerator */ "../../node_modules/@babel/runtime/regenerator/index.js" ) ;
/* harmony import */ var _babel _runtime _regenerator _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _regenerator _ _WEBPACK _IMPORTED _MODULE _0 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _asyncToGenerator _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/asyncToGenerator */ "../../node_modules/@babel/runtime/helpers/asyncToGenerator.js" ) ;
/* harmony import */ var _babel _runtime _helpers _asyncToGenerator _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _asyncToGenerator _ _WEBPACK _IMPORTED _MODULE _1 _ _ ) ;
/* harmony import */ var _common _media _devices _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! ../common/media-devices */ "./src/common/media-devices.ts" ) ;
var _stream ;
var CameraAccess = {
/ * *
* Attempts to attach the camera - stream to a given video element
* and calls the callback function when the content is ready
* @ param video
* @ param videoConstraints
* /
request : function ( ) {
var _request = _babel _runtime _helpers _asyncToGenerator _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default ( ) (
/*#__PURE__*/
_babel _runtime _regenerator _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default . a . mark ( function _callee ( video , videoConstraints ) {
var normalizedConstraints ;
return _babel _runtime _regenerator _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default . a . wrap ( function _callee$ ( _context ) {
while ( 1 ) {
switch ( _context . prev = _context . next ) {
case 0 :
normalizedConstraints = CameraAccess . pickConstraints ( videoConstraints ) ;
_context . next = 3 ;
return Object ( _common _media _devices _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "getUserMedia" ] ) ( normalizedConstraints ) ;
case 3 :
_stream = _context . sent ;
video . srcObject = _stream ;
video . setAttribute ( 'autoplay' , '' ) ;
video . setAttribute ( 'muted' , '' ) ;
video . setAttribute ( 'playsinline' , '' ) ;
return _context . abrupt ( "return" , new Promise ( function ( resolve ) {
return video . addEventListener ( 'loadedmetadata' , function ( ) {
video . play ( ) ;
resolve ( ) ;
} ) ;
} ) . then ( _waitForVideo . bind ( null , video ) ) ) ;
case 9 :
case "end" :
return _context . stop ( ) ;
}
}
} , _callee ) ;
} ) ) ;
function request ( _x , _x2 ) {
return _request . apply ( this , arguments ) ;
}
return request ;
} ( ) ,
release : function release ( ) {
var tracks = _stream && _stream . getVideoTracks ( ) ;
if ( tracks && tracks . length ) {
tracks [ 0 ] . stop ( ) ;
}
_stream = null ;
} ,
enumerateVideoDevices : function ( ) {
var _enumerateVideoDevices = _babel _runtime _helpers _asyncToGenerator _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default ( ) (
/*#__PURE__*/
_babel _runtime _regenerator _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default . a . mark ( function _callee2 ( ) {
var devices ;
return _babel _runtime _regenerator _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default . a . wrap ( function _callee2$ ( _context2 ) {
while ( 1 ) {
switch ( _context2 . prev = _context2 . next ) {
case 0 :
_context2 . next = 2 ;
return Object ( _common _media _devices _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "enumerateDevices" ] ) ( ) ;
case 2 :
devices = _context2 . sent ;
return _context2 . abrupt ( "return" , devices . filter ( function ( _ref ) {
var kind = _ref . kind ;
return kind === 'videoinput' ;
} ) ) ;
case 4 :
case "end" :
return _context2 . stop ( ) ;
}
}
} , _callee2 ) ;
} ) ) ;
function enumerateVideoDevices ( ) {
return _enumerateVideoDevices . apply ( this , arguments ) ;
}
return enumerateVideoDevices ;
} ( ) ,
getActiveStreamLabel : function getActiveStreamLabel ( ) {
var track = CameraAccess . getActiveTrack ( ) ;
return track ? track . label : '' ;
} ,
getActiveTrack : function getActiveTrack ( ) {
var tracks = _stream && _stream . getVideoTracks ( ) ;
if ( tracks && tracks . length ) {
return tracks [ 0 ] ;
}
return null ;
} ,
pickConstraints : function pickConstraints ( videoConstraints ) {
var width = videoConstraints . width ,
height = videoConstraints . height ,
facingMode = videoConstraints . facingMode ,
aspectRatio = videoConstraints . aspectRatio ,
deviceId = videoConstraints . deviceId ;
var _ref2 = videoConstraints ,
minAspectRatio = _ref2 . minAspectRatio ,
facing = _ref2 . facing ;
if ( typeof minAspectRatio !== 'undefined' && minAspectRatio > 0 ) {
aspectRatio = minAspectRatio ;
console . log ( "WARNING: Constraint 'minAspectRatio' is deprecated; Use 'aspectRatio' instead" ) ;
}
if ( typeof facing !== 'undefined' ) {
facingMode = facing ;
console . log ( "WARNING: Constraint 'facing' is deprecated. Use 'facingMode' instead'" ) ;
}
var normalizedConstraints = deviceId && facingMode ? {
width : width ,
height : height ,
aspectRatio : aspectRatio ,
deviceId : deviceId
} : {
width : width ,
height : height ,
facingMode : facingMode ,
aspectRatio : aspectRatio ,
deviceId : deviceId
} ;
return {
audio : false ,
video : normalizedConstraints
} ;
}
} ;
function _waitForVideo ( _ref3 ) {
var videoWidth = _ref3 . videoWidth ,
videoHeight = _ref3 . videoHeight ;
return new Promise ( function ( resolve , reject ) {
var attempts = 10 ;
function checkVideo ( ) {
if ( attempts > 0 ) {
if ( videoWidth > 10 && videoHeight > 10 ) {
if ( true ) {
console . log ( "" . concat ( videoWidth , "px x " ) . concat ( videoHeight , "px" ) ) ;
}
resolve ( ) ;
} else {
window . setTimeout ( checkVideo , 500 ) ;
}
} else {
reject ( 'Unable to play video stream. Is webcam working?' ) ;
}
attempts -- ;
}
checkVideo ( ) ;
} ) ;
}
/***/ } ) ,
/***/ "./src/input/exif-helper.ts" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / input / exif - helper . ts * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: AvailableTags, findTagsInObjectURL, findTagsInBuffer */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "AvailableTags" , function ( ) { return AvailableTags ; } ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "findTagsInObjectURL" , function ( ) { return findTagsInObjectURL ; } ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "findTagsInBuffer" , function ( ) { return findTagsInBuffer ; } ) ;
/* harmony import */ var _babel _runtime _regenerator _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/regenerator */ "../../node_modules/@babel/runtime/regenerator/index.js" ) ;
/* harmony import */ var _babel _runtime _regenerator _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _regenerator _ _WEBPACK _IMPORTED _MODULE _0 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _asyncToGenerator _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/asyncToGenerator */ "../../node_modules/@babel/runtime/helpers/asyncToGenerator.js" ) ;
/* harmony import */ var _babel _runtime _helpers _asyncToGenerator _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _asyncToGenerator _ _WEBPACK _IMPORTED _MODULE _1 _ _ ) ;
/ * *
* @ borrows https : //github.com/exif-js/exif-js
* /
var ExifTags = {
0x0112 : 'orientation'
} ;
var AvailableTags = Object . keys ( ExifTags ) . map ( function ( key ) {
return ExifTags [ key ] ;
} ) ;
function findTagsInObjectURL ( _x ) {
return _findTagsInObjectURL . apply ( this , arguments ) ;
}
function _findTagsInObjectURL ( ) {
_findTagsInObjectURL = _babel _runtime _helpers _asyncToGenerator _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default ( ) (
/*#__PURE__*/
_babel _runtime _regenerator _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default . a . mark ( function _callee ( src ) {
var tags ,
buffer ,
_args = arguments ;
return _babel _runtime _regenerator _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default . a . wrap ( function _callee$ ( _context ) {
while ( 1 ) {
switch ( _context . prev = _context . next ) {
case 0 :
tags = _args . length > 1 && _args [ 1 ] !== undefined ? _args [ 1 ] : AvailableTags ;
if ( ! /^blob:/i . test ( src ) ) {
_context . next = 6 ;
break ;
}
_context . next = 4 ;
return objectURLToBlob ( src ) ;
case 4 :
buffer = _context . sent ;
return _context . abrupt ( "return" , findTagsInBuffer ( buffer , tags ) ) ;
case 6 :
return _context . abrupt ( "return" , Promise . resolve ( null ) ) ;
case 7 :
case "end" :
return _context . stop ( ) ;
}
}
} , _callee ) ;
} ) ) ;
return _findTagsInObjectURL . apply ( this , arguments ) ;
}
function findTagsInBuffer ( file ) {
var selectedTags = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : AvailableTags ;
var dataView = new DataView ( file ) ;
var length = file . byteLength ;
var exifTags = selectedTags . reduce ( function ( result , selectedTag ) {
var exifTag = Object . keys ( ExifTags ) . find ( function ( tag ) {
return ExifTags [ tag ] === selectedTag ;
} ) ;
if ( exifTag ) {
result [ exifTag ] = selectedTag ;
}
return result ;
} , { } ) ;
var offset = 2 ;
if ( dataView . getUint8 ( 0 ) !== 0xFF || dataView . getUint8 ( 1 ) !== 0xD8 ) {
return null ;
}
while ( offset < length ) {
if ( dataView . getUint8 ( offset ) !== 0xFF ) {
return null ;
}
var marker = dataView . getUint8 ( offset + 1 ) ;
if ( marker === 0xE1 ) {
return readEXIFData ( dataView , offset + 4 , exifTags ) ;
} else {
offset += 2 + dataView . getUint16 ( offset + 2 ) ;
}
}
return null ;
}
function objectURLToBlob ( _x2 ) {
return _objectURLToBlob . apply ( this , arguments ) ;
}
function _objectURLToBlob ( ) {
_objectURLToBlob = _babel _runtime _helpers _asyncToGenerator _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default ( ) (
/*#__PURE__*/
_babel _runtime _regenerator _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default . a . mark ( function _callee2 ( url ) {
var response ;
return _babel _runtime _regenerator _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default . a . wrap ( function _callee2$ ( _context2 ) {
while ( 1 ) {
switch ( _context2 . prev = _context2 . next ) {
case 0 :
_context2 . next = 2 ;
return fetch ( url ) ;
case 2 :
response = _context2 . sent ;
if ( ! response . ok ) {
_context2 . next = 5 ;
break ;
}
return _context2 . abrupt ( "return" , response . arrayBuffer ( ) ) ;
case 5 :
throw new Error ( 'HTTP Error ' + response . status ) ;
case 6 :
case "end" :
return _context2 . stop ( ) ;
}
}
} , _callee2 ) ;
} ) ) ;
return _objectURLToBlob . apply ( this , arguments ) ;
}
function readEXIFData ( dataView , start , exifTags ) {
if ( 'Exif' . split ( '' ) . some ( function ( _char , index ) {
return dataView . getUint8 ( start + index ) !== _char . charCodeAt ( 0 ) ;
} ) ) {
return null ;
}
var tiffOffset = start + 6 ;
var bigEnd ;
if ( dataView . getUint16 ( tiffOffset ) === 0x4949 ) {
bigEnd = false ;
} else if ( dataView . getUint16 ( tiffOffset ) === 0x4D4D ) {
bigEnd = true ;
} else {
return null ;
}
if ( dataView . getUint16 ( tiffOffset + 2 , ! bigEnd ) !== 0x002A ) {
return null ;
}
var firstIFDOffset = dataView . getUint32 ( tiffOffset + 4 , ! bigEnd ) ;
if ( firstIFDOffset < 0x00000008 ) {
return null ;
}
var tags = readTags ( dataView , tiffOffset + firstIFDOffset , exifTags , bigEnd ) ;
return tags ;
}
function readTags ( dataView , dirStart , strings , bigEnd ) {
var entries = dataView . getUint16 ( dirStart , ! bigEnd ) ;
var tags = { } ;
for ( var i = 0 ; i < entries ; i ++ ) {
var entryOffset = dirStart + i * 12 + 2 ;
var tag = strings [ dataView . getUint16 ( entryOffset , ! bigEnd ) ] ;
if ( tag ) {
tags [ tag ] = readTagValue ( dataView , entryOffset , bigEnd ) ;
}
}
return tags ;
}
function readTagValue ( dataView , entryOffset , bigEnd ) {
var type = dataView . getUint16 ( entryOffset + 2 , ! bigEnd ) ;
var numValues = dataView . getUint32 ( entryOffset + 4 , ! bigEnd ) ;
return type === 3 && numValues === 1 ? dataView . getUint16 ( entryOffset + 8 , ! bigEnd ) : undefined ;
}
/***/ } ) ,
/***/ "./src/input/frame-grabber.ts" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / input / frame - grabber . ts * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: FrameGrabber */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "FrameGrabber" , function ( ) { return FrameGrabber ; } ) ;
/* harmony import */ var _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/classCallCheck */ "../../node_modules/@babel/runtime/helpers/classCallCheck.js" ) ;
/* harmony import */ var _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/createClass */ "../../node_modules/@babel/runtime/helpers/createClass.js" ) ;
/* harmony import */ var _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/defineProperty */ "../../node_modules/@babel/runtime/helpers/defineProperty.js" ) ;
/* harmony import */ var _babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ ) ;
var QUATER _CIRCLE = Math . PI / 2 ;
var FrameGrabber =
/*#__PURE__*/
function ( ) {
function FrameGrabber ( inputStream , canvas ) {
_babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default ( ) ( this , FrameGrabber ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , "_inputStream" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , "_streamConfig" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , "_canvas" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , "_context" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , "_data" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , "_canvasHeight" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , "_canvasWidth" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , "_height" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , "_width" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , "_topLeft" , void 0 ) ;
this . _inputStream = inputStream ;
this . _streamConfig = inputStream . config ;
this . _canvasWidth = inputStream . canvasWidth ;
this . _canvasHeight = inputStream . canvasHeight ;
this . _width = inputStream . width ;
this . _height = inputStream . height ;
this . _topLeft = inputStream . topLeft ;
this . _canvas = canvas || document . createElement ( 'canvas' ) ;
this . _canvas . width = this . _canvasWidth ;
this . _canvas . height = this . _canvasHeight ;
this . _context = this . _canvas . getContext ( '2d' ) ;
this . _data = new Uint8Array ( this . _width * this . _height ) ;
if ( true ) {
console . log ( 'FrameGrabber' , JSON . stringify ( {
size : {
x : this . _width ,
y : this . _height
} ,
topLeft : this . _topLeft ,
videoSize : {
x : inputStream . realWidth ,
y : inputStream . realHeight
} ,
canvasSize : {
x : this . _canvasWidth ,
y : this . _canvasHeight
}
} ) ) ;
}
}
/ * *
* Fetches a frame from the input stream and puts into the frame buffer .
* The image data is converted to gray scale and then half - sampled if configured .
* /
_babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default ( ) ( FrameGrabber , [ {
key : "grab" ,
value : function grab ( data ) {
this . _data = data ;
var frame = this . _inputStream . getFrame ( ) ;
if ( frame ) {
this . _adjustCanvasSize ( ) ;
var drawable ;
var drawAngle = 0 ;
if ( frame instanceof HTMLVideoElement ) {
drawable = frame ;
} else {
drawable = frame . image ;
if ( frame . tags ) {
switch ( frame . tags . orientation ) {
case 6 :
{
drawAngle = QUATER _CIRCLE ;
break ;
}
case 8 :
{
drawAngle = - QUATER _CIRCLE ;
break ;
}
}
}
}
if ( drawAngle !== 0 ) {
var halfWidth = this . _canvasWidth >> 1 ;
var halfHeight = this . _canvasHeight >> 1 ;
this . _context . translate ( halfWidth , halfHeight ) ;
this . _context . rotate ( drawAngle ) ;
this . _context . drawImage ( drawable , - halfHeight , - halfWidth , this . _canvasHeight , this . _canvasWidth ) ;
this . _context . rotate ( - drawAngle ) ;
this . _context . translate ( - halfWidth , - halfHeight ) ;
} else {
this . _context . drawImage ( drawable , 0 , 0 , this . _canvasWidth , this . _canvasHeight ) ;
}
var imageData = this . _context . getImageData ( this . _topLeft . x , this . _topLeft . y , this . _width , this . _height ) . data ;
if ( this . _streamConfig . halfSample ) {
this . _grayAndHalfSampleFromCanvasData ( imageData ) ;
} else {
this . _computeGray ( imageData ) ;
}
return true ;
} else {
return false ;
}
}
} , {
key : "_adjustCanvasSize" ,
value : function _adjustCanvasSize ( ) {
if ( this . _canvas . height !== this . _canvasHeight || this . _canvas . width !== this . _canvasWidth ) {
if ( true ) {
console . warn ( 'Canvas size needs to be adjusted' ) ;
}
this . _canvas . height = this . _canvasHeight ;
this . _canvas . width = this . _canvasWidth ;
}
}
} , {
key : "_grayAndHalfSampleFromCanvasData" ,
value : function _grayAndHalfSampleFromCanvasData ( imageData ) {
var endIndex = imageData . length >> 2 ;
var outWidth = this . _width >> 1 ;
var topRowIndex = 0 ;
var bottomRowIndex = this . _width ;
var outImageIndex = 0 ;
while ( bottomRowIndex < endIndex ) {
for ( var i = 0 ; i < outWidth ; i ++ ) {
var top4 = topRowIndex << 2 ;
var bottom4 = bottomRowIndex << 2 ;
this . _data [ outImageIndex ] = ( 0.299 * imageData [ top4 + 0 ] + 0.587 * imageData [ top4 + 1 ] + 0.114 * imageData [ top4 + 2 ] + ( 0.299 * imageData [ top4 + 4 ] + 0.587 * imageData [ top4 + 5 ] + 0.114 * imageData [ top4 + 6 ] ) + ( 0.299 * imageData [ bottom4 + 0 ] + 0.587 * imageData [ bottom4 + 1 ] + 0.114 * imageData [ bottom4 + 2 ] ) + ( 0.299 * imageData [ bottom4 + 4 ] + 0.587 * imageData [ bottom4 + 5 ] + 0.114 * imageData [ bottom4 + 6 ] ) ) / 4 | 0 ;
outImageIndex ++ ;
topRowIndex += 2 ;
bottomRowIndex += 2 ;
}
topRowIndex += this . _width ;
bottomRowIndex += this . _width ;
}
}
} , {
key : "_computeGray" ,
value : function _computeGray ( imageData ) {
var imageDataLength = imageData . length ;
if ( this . _streamConfig && this . _streamConfig . singleChannel ) {
for ( var i = 0 , j = 0 ; i < imageDataLength ; i += 4 , j ++ ) {
this . _data [ j ] = imageData [ i ] ;
}
} else {
for ( var _i = 0 , _j = 0 ; _i < imageDataLength ; _i += 4 , _j ++ ) {
this . _data [ _j ] = 0.299 * imageData [ _i ] + 0.587 * imageData [ _i + 1 ] + 0.114 * imageData [ _i + 2 ] | 0 ;
}
}
}
} ] ) ;
return FrameGrabber ;
} ( ) ;
/***/ } ) ,
/***/ "./src/input/image-loader.ts" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / input / image - loader . ts * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: ImageLoader */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "ImageLoader" , function ( ) { return ImageLoader ; } ) ;
/* harmony import */ var _babel _runtime _regenerator _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/regenerator */ "../../node_modules/@babel/runtime/regenerator/index.js" ) ;
/* harmony import */ var _babel _runtime _regenerator _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _regenerator _ _WEBPACK _IMPORTED _MODULE _0 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _asyncToGenerator _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/asyncToGenerator */ "../../node_modules/@babel/runtime/helpers/asyncToGenerator.js" ) ;
/* harmony import */ var _babel _runtime _helpers _asyncToGenerator _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _asyncToGenerator _ _WEBPACK _IMPORTED _MODULE _1 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/classCallCheck */ "../../node_modules/@babel/runtime/helpers/classCallCheck.js" ) ;
/* harmony import */ var _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _2 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/createClass */ "../../node_modules/@babel/runtime/helpers/createClass.js" ) ;
/* harmony import */ var _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _3 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _3 _ _ ) ;
/* harmony import */ var _exif _helper _ _WEBPACK _IMPORTED _MODULE _4 _ _ = _ _webpack _require _ _ ( /*! ./exif-helper */ "./src/input/exif-helper.ts" ) ;
var ImageLoader =
/*#__PURE__*/
function ( ) {
function ImageLoader ( ) {
_babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , ImageLoader ) ;
}
_babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _3 _ _ _default ( ) ( ImageLoader , null , [ {
key : "load" ,
value : function ( ) {
var _load = _babel _runtime _helpers _asyncToGenerator _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default ( ) (
/*#__PURE__*/
_babel _runtime _regenerator _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default . a . mark ( function _callee2 ( baseUri , callback , offset , size , sequence ) {
var imageSrcs , loadedImages , notLoadedImages , i , loaded , _loaded ;
return _babel _runtime _regenerator _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default . a . wrap ( function _callee2$ ( _context2 ) {
while ( 1 ) {
switch ( _context2 . prev = _context2 . next ) {
case 0 :
_loaded = function _ref2 ( ) {
_loaded = _babel _runtime _helpers _asyncToGenerator _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default ( ) (
/*#__PURE__*/
_babel _runtime _regenerator _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default . a . mark ( function _callee ( loadedImage ) {
var x , y , imageName , firstImage ;
return _babel _runtime _regenerator _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default . a . wrap ( function _callee$ ( _context ) {
while ( 1 ) {
switch ( _context . prev = _context . next ) {
case 0 :
x = 0 ;
case 1 :
if ( ! ( x < notLoadedImages . length ) ) {
_context . next = 17 ;
break ;
}
if ( ! ( notLoadedImages [ x ] === loadedImage ) ) {
_context . next = 14 ;
break ;
}
notLoadedImages . splice ( x , 1 ) ; // TODO: assume the index is the same
y = 0 ;
case 5 :
if ( ! ( y < imageSrcs . length ) ) {
_context . next = 13 ;
break ;
}
imageName = imageSrcs [ y ] . substr ( imageSrcs [ y ] . lastIndexOf ( '/' ) ) ;
if ( ! ( loadedImage . src . lastIndexOf ( imageName ) !== - 1 ) ) {
_context . next = 10 ;
break ;
}
loadedImages [ y ] = {
image : loadedImage
} ;
return _context . abrupt ( "break" , 13 ) ;
case 10 :
y ++ ;
_context . next = 5 ;
break ;
case 13 :
return _context . abrupt ( "break" , 17 ) ;
case 14 :
x ++ ;
_context . next = 1 ;
break ;
case 17 :
if ( ! ( notLoadedImages . length === 0 ) ) {
_context . next = 33 ;
break ;
}
if ( true ) {
console . log ( 'Images loaded' ) ;
}
_context . prev = 19 ;
if ( ! ( sequence === false ) ) {
_context . next = 25 ;
break ;
}
firstImage = loadedImages [ 0 ] ;
_context . next = 24 ;
return Object ( _exif _helper _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "findTagsInObjectURL" ] ) ( baseUri ) ;
case 24 :
firstImage . tags = _context . sent ;
case 25 :
_context . next = 30 ;
break ;
case 27 :
_context . prev = 27 ;
_context . t0 = _context [ "catch" ] ( 19 ) ;
console . log ( _context . t0 ) ;
case 30 :
_context . prev = 30 ;
callback ( loadedImages ) ;
return _context . finish ( 30 ) ;
case 33 :
case "end" :
return _context . stop ( ) ;
}
}
} , _callee , null , [ [ 19 , 27 , 30 , 33 ] ] ) ;
} ) ) ;
return _loaded . apply ( this , arguments ) ;
} ;
loaded = function _ref ( _x6 ) {
return _loaded . apply ( this , arguments ) ;
} ;
imageSrcs = new Array ( size ) ;
loadedImages = new Array ( size ) ;
notLoadedImages = new Array ( ) ;
if ( sequence === false ) {
imageSrcs [ 0 ] = baseUri ;
} else {
for ( i = 0 ; i < size ; i ++ ) {
imageSrcs [ i ] = "" . concat ( baseUri , "image-" ) . concat ( ( '00' + ( offset + i ) ) . slice ( - 3 ) , ".jpg" ) ;
}
}
imageSrcs . forEach ( function ( src ) {
var image = new Image ( ) ;
notLoadedImages . push ( image ) ;
image . onload = function ( ) {
return loaded ( image ) ;
} ;
image . src = src ;
} ) ;
case 7 :
case "end" :
return _context2 . stop ( ) ;
}
}
} , _callee2 ) ;
} ) ) ;
function load ( _x , _x2 , _x3 , _x4 , _x5 ) {
return _load . apply ( this , arguments ) ;
}
return load ;
} ( )
} ] ) ;
return ImageLoader ;
} ( ) ;
/***/ } ) ,
/***/ "./src/input/image-stream.ts" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / input / image - stream . ts * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: ImageStream */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "ImageStream" , function ( ) { return ImageStream ; } ) ;
/* harmony import */ var _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/classCallCheck */ "../../node_modules/@babel/runtime/helpers/classCallCheck.js" ) ;
/* harmony import */ var _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/createClass */ "../../node_modules/@babel/runtime/helpers/createClass.js" ) ;
/* harmony import */ var _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/possibleConstructorReturn */ "../../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js" ) ;
/* harmony import */ var _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _2 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/getPrototypeOf */ "../../node_modules/@babel/runtime/helpers/getPrototypeOf.js" ) ;
/* harmony import */ var _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _3 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _3 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _assertThisInitialized _ _WEBPACK _IMPORTED _MODULE _4 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/assertThisInitialized */ "../../node_modules/@babel/runtime/helpers/assertThisInitialized.js" ) ;
/* harmony import */ var _babel _runtime _helpers _assertThisInitialized _ _WEBPACK _IMPORTED _MODULE _4 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _assertThisInitialized _ _WEBPACK _IMPORTED _MODULE _4 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _5 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/inherits */ "../../node_modules/@babel/runtime/helpers/inherits.js" ) ;
/* harmony import */ var _babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _5 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _5 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _6 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/defineProperty */ "../../node_modules/@babel/runtime/helpers/defineProperty.js" ) ;
/* harmony import */ var _babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _6 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _6 _ _ ) ;
/* harmony import */ var _image _loader _ _WEBPACK _IMPORTED _MODULE _7 _ _ = _ _webpack _require _ _ ( /*! ./image-loader */ "./src/input/image-loader.ts" ) ;
/* harmony import */ var _input _stream _ _WEBPACK _IMPORTED _MODULE _8 _ _ = _ _webpack _require _ _ ( /*! ./input-stream */ "./src/input/input-stream.ts" ) ;
function ownKeys ( object , enumerableOnly ) { var keys = Object . keys ( object ) ; if ( Object . getOwnPropertySymbols ) { var symbols = Object . getOwnPropertySymbols ( object ) ; if ( enumerableOnly ) symbols = symbols . filter ( function ( sym ) { return Object . getOwnPropertyDescriptor ( object , sym ) . enumerable ; } ) ; keys . push . apply ( keys , symbols ) ; } return keys ; }
function _objectSpread ( target ) { for ( var i = 1 ; i < arguments . length ; i ++ ) { var source = arguments [ i ] != null ? arguments [ i ] : { } ; if ( i % 2 ) { ownKeys ( source , true ) . forEach ( function ( key ) { _babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _6 _ _ _default ( ) ( target , key , source [ key ] ) ; } ) ; } else if ( Object . getOwnPropertyDescriptors ) { Object . defineProperties ( target , Object . getOwnPropertyDescriptors ( source ) ) ; } else { ownKeys ( source ) . forEach ( function ( key ) { Object . defineProperty ( target , key , Object . getOwnPropertyDescriptor ( source , key ) ) ; } ) ; } } return target ; }
var ImageStream =
/*#__PURE__*/
function ( _InputStream ) {
_babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _5 _ _ _default ( ) ( ImageStream , _InputStream ) ;
function ImageStream ( ) {
var _this ;
_babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default ( ) ( this , ImageStream ) ;
_this = _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _3 _ _ _default ( ) ( ImageStream ) . call ( this ) ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _6 _ _ _default ( ) ( _babel _runtime _helpers _assertThisInitialized _ _WEBPACK _IMPORTED _MODULE _4 _ _ _default ( ) ( _this ) , "_baseUrl" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _6 _ _ _default ( ) ( _babel _runtime _helpers _assertThisInitialized _ _WEBPACK _IMPORTED _MODULE _4 _ _ _default ( ) ( _this ) , "_ended" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _6 _ _ _default ( ) ( _babel _runtime _helpers _assertThisInitialized _ _WEBPACK _IMPORTED _MODULE _4 _ _ _default ( ) ( _this ) , "_frameIndex" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _6 _ _ _default ( ) ( _babel _runtime _helpers _assertThisInitialized _ _WEBPACK _IMPORTED _MODULE _4 _ _ _default ( ) ( _this ) , "_height" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _6 _ _ _default ( ) ( _babel _runtime _helpers _assertThisInitialized _ _WEBPACK _IMPORTED _MODULE _4 _ _ _default ( ) ( _this ) , "_images" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _6 _ _ _default ( ) ( _babel _runtime _helpers _assertThisInitialized _ _WEBPACK _IMPORTED _MODULE _4 _ _ _default ( ) ( _this ) , "_loaded" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _6 _ _ _default ( ) ( _babel _runtime _helpers _assertThisInitialized _ _WEBPACK _IMPORTED _MODULE _4 _ _ _default ( ) ( _this ) , "_offset" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _6 _ _ _default ( ) ( _babel _runtime _helpers _assertThisInitialized _ _WEBPACK _IMPORTED _MODULE _4 _ _ _default ( ) ( _this ) , "_paused" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _6 _ _ _default ( ) ( _babel _runtime _helpers _assertThisInitialized _ _WEBPACK _IMPORTED _MODULE _4 _ _ _default ( ) ( _this ) , "_size" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _6 _ _ _default ( ) ( _babel _runtime _helpers _assertThisInitialized _ _WEBPACK _IMPORTED _MODULE _4 _ _ _default ( ) ( _this ) , "_width" , void 0 ) ;
_this . _canvasHeight = 0 ;
_this . _canvasWidth = 0 ;
_this . _baseUrl = null ;
_this . _ended = false ;
_this . _frameIndex = 0 ;
_this . _height = 0 ;
_this . _images = null ;
_this . _loaded = false ;
_this . _offset = 1 ;
_this . _paused = true ;
_this . _size = 0 ;
_this . _width = 0 ;
return _this ;
}
_babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default ( ) ( ImageStream , [ {
key : "setAttribute" ,
value : function setAttribute ( ) { }
} , {
key : "pause" ,
value : function pause ( ) {
this . _paused = true ;
}
} , {
key : "play" ,
value : function play ( ) {
this . _paused = false ;
}
} , {
key : "getFrame" ,
value : function getFrame ( ) {
var _this2 = this ;
var frame = null ;
if ( this . _loaded && ! this . _paused ) {
frame = this . _images [ this . _frameIndex ] ;
if ( this . _frameIndex < this . _size - 1 ) {
this . _frameIndex ++ ;
} else {
setTimeout ( function ( ) {
_this2 . _ended = true ;
_this2 . trigger ( 'ended' , [ ] ) ;
} , 0 ) ;
}
}
return frame ;
}
} , {
key : "_loadImages" ,
value : function _loadImages ( ) {
var _this3 = this ;
this . _loaded = false ;
_image _loader _ _WEBPACK _IMPORTED _MODULE _7 _ _ [ "ImageLoader" ] . load ( this . _baseUrl , function ( images ) {
_this3 . _images = images ;
switch ( images [ 0 ] . tags && images [ 0 ] . tags . orientation ) {
case 6 :
case 8 :
{
_this3 . _width = images [ 0 ] . image . height ;
_this3 . _height = images [ 0 ] . image . width ;
break ;
}
default :
{
_this3 . _width = images [ 0 ] . image . width ;
_this3 . _height = images [ 0 ] . image . height ;
}
}
_this3 . _canvasWidth = _this3 . _calculatedWidth = _this3 . _config . size ? _this3 . _width > _this3 . _height ? _this3 . _config . size : _this3 . _width * _this3 . _config . size / _this3 . _height | 0 : _this3 . _width ;
_this3 . _canvasHeight = _this3 . _calculatedHeight = _this3 . _config . size ? _this3 . _width > _this3 . _height ? _this3 . _height * _this3 . _config . size / _this3 . _width | 0 : _this3 . _config . size : _this3 . _height ;
_this3 . _loaded = true ;
_this3 . _frameIndex = 0 ;
setTimeout ( function ( ) {
return _this3 . trigger ( 'canrecord' , [ ] ) ;
} , 0 ) ;
} , this . _offset , this . _size , this . _config . sequence ) ;
}
} , {
key : "realHeight" ,
get : function get ( ) {
return this . _height ;
}
} , {
key : "realWidth" ,
get : function get ( ) {
return this . _width ;
}
} , {
key : "config" ,
get : function get ( ) {
return this . _config ;
} ,
set : function set ( config ) {
this . _config = _objectSpread ( { } , config ) ;
this . _baseUrl = config . src ;
this . _size = config . sequence && config . length ? config . length : 1 ;
this . _loadImages ( ) ;
}
} , {
key : "ended" ,
get : function get ( ) {
return this . _ended ;
}
} , {
key : "currentTime" ,
set : function set ( time ) {
this . _frameIndex = time ;
}
} ] ) ;
return ImageStream ;
} ( _input _stream _ _WEBPACK _IMPORTED _MODULE _8 _ _ [ "InputStream" ] ) ;
/***/ } ) ,
/***/ "./src/input/input-stream-utils.ts" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / input / input - stream - utils . ts * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: calculatePatchSize, checkImageConstraints, _parseCssDimensionValues, _dimensionsConverters, computeImageArea */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "calculatePatchSize" , function ( ) { return calculatePatchSize ; } ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "checkImageConstraints" , function ( ) { return checkImageConstraints ; } ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "_parseCssDimensionValues" , function ( ) { return _parseCssDimensionValues ; } ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "_dimensionsConverters" , function ( ) { return _dimensionsConverters ; } ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "computeImageArea" , function ( ) { return computeImageArea ; } ) ;
function _computeDivisors ( n ) {
var divisors = new Array ( ) ;
var largeDivisors = new Array ( ) ;
for ( var divisor = 1 ; divisor * divisor <= n ; divisor ++ ) {
if ( n % divisor === 0 ) {
divisors . push ( divisor ) ;
if ( divisor * divisor !== n ) {
largeDivisors . unshift ( n / divisor | 0 ) ;
}
}
}
return divisors . concat ( largeDivisors ) ;
}
function _computeCommonDivisors ( m , n ) {
if ( m === n ) {
return _computeDivisors ( m ) ;
}
var max = m > n ? m : n ;
var min = m > n ? n : m ;
var divisors = new Array ( ) ;
var largeDivisors = new Array ( ) ;
for ( var divisor = 1 ; divisor * divisor <= min ; divisor ++ ) {
if ( max % divisor === 0 && min % divisor === 0 ) {
divisors . push ( divisor ) ;
var largeDivisor = min / divisor | 0 ;
if ( divisor !== largeDivisor && max % largeDivisor === 0 ) {
largeDivisors . unshift ( ) ;
}
}
}
return divisors . concat ( largeDivisors ) ;
}
function calculatePatchSize ( patchSize , _ref ) {
var x = _ref . x ,
y = _ref . y ;
var wideSide = Math . max ( x | 0 , y | 0 ) | 0 ;
var nrOfPatchesList = [ 8 , 10 , 15 , 20 , 32 , 60 , 80 ] ;
var nrOfPatchesMap = {
'x-small' : 5 ,
small : 4 ,
medium : 3 ,
large : 2 ,
'x-large' : 1
} ;
var nrOfPatchesIndex = nrOfPatchesMap [ patchSize ] || nrOfPatchesMap . medium | 0 ;
var nrOfPatches = nrOfPatchesList [ nrOfPatchesIndex ] | 0 ;
var desiredPatchSize = wideSide / nrOfPatches | 0 ;
function findPatchSizeForDivisors ( divisors ) {
var i = 0 ;
var found = divisors [ divisors . length >> 1 ] | 0 ;
while ( i < divisors . length - 1 && divisors [ i ] < desiredPatchSize ) {
i ++ ;
}
if ( i > 0 ) {
if ( Math . abs ( divisors [ i ] - desiredPatchSize ) > Math . abs ( divisors [ i - 1 ] - desiredPatchSize ) ) {
found = divisors [ i - 1 ] | 0 ;
} else {
found = divisors [ i ] | 0 ;
}
}
if ( desiredPatchSize / found < nrOfPatchesList [ nrOfPatchesIndex + 1 ] / nrOfPatchesList [ nrOfPatchesIndex ] && desiredPatchSize / found > nrOfPatchesList [ nrOfPatchesIndex - 1 ] / nrOfPatchesList [ nrOfPatchesIndex ] ) {
return {
x : found ,
y : found
} ;
}
return null ;
}
var optimalPatchSize = findPatchSizeForDivisors ( _computeCommonDivisors ( x , y ) ) || findPatchSizeForDivisors ( _computeDivisors ( wideSide ) ) || findPatchSizeForDivisors ( _computeDivisors ( desiredPatchSize * nrOfPatches ) ) ;
return optimalPatchSize ;
}
function checkImageConstraints ( inputStream , config ) {
var width = inputStream . width ;
var height = inputStream . height ;
var shift = config . halfSample ? 1 : 0 | 0 ;
var inputStreamConfig = inputStream . config ; // calculate width and height based on area
if ( inputStreamConfig && inputStreamConfig . area ) {
var area = computeImageArea ( width , height , inputStreamConfig . area ) ;
inputStream . topLeft = area . topLeft ;
inputStream . setCanvasSize ( width , height ) ;
width = area . width ;
height = area . height ;
}
var size = {
x : width >> shift ,
y : height >> shift
} ;
var patchSize = calculatePatchSize ( config . patchSize , size ) ;
if ( true ) {
console . log ( 'Patch-Size:' , JSON . stringify ( patchSize ) ) ;
}
inputStream . width = ( size . x / patchSize . x << shift ) * patchSize . x | 0 ;
inputStream . height = ( size . y / patchSize . y << shift ) * patchSize . y | 0 ;
if ( inputStream . width % patchSize . x === 0 && inputStream . height % patchSize . y === 0 ) {
return true ;
} // eslint-disable-next-line max-len
throw new Error ( "Image dimensions do not comply with the current settings: width (" . concat ( width , ") and height (" ) . concat ( height , ") must be a multiple of " ) . concat ( patchSize . x ) ) ;
}
function _parseCssDimensionValues ( value ) {
var dimension = {
value : parseFloat ( value ) ,
unit : value . indexOf ( '%' ) === value . length - 1 ? '%' : value . indexOf ( 'px' ) === value . length - 2 ? 'px' : '%'
} ;
return dimension ;
}
var _dimensionsConverters = {
bottom : function bottom ( dimension , _ref2 ) {
var height = _ref2 . height ;
return dimension . unit === '%' ? height - height * dimension . value / 100 | 0 : dimension . unit === 'px' ? height - dimension . value : height ;
} ,
left : function left ( dimension , _ref3 ) {
var width = _ref3 . width ;
return dimension . unit === '%' ? width * dimension . value / 100 | 0 : dimension . unit === 'px' ? dimension . value : 0 ;
} ,
right : function right ( dimension , _ref4 ) {
var width = _ref4 . width ;
return dimension . unit === '%' ? width - width * dimension . value / 100 | 0 : dimension . unit === 'px' ? width - dimension . value : width ;
} ,
top : function top ( dimension , _ref5 ) {
var height = _ref5 . height ;
return dimension . unit === '%' ? height * dimension . value / 100 | 0 : dimension . unit === 'px' ? dimension . value : 0 ;
}
} ;
function computeImageArea ( inputWidth , inputHeight , area ) {
var context = {
width : inputWidth ,
height : inputHeight
} ;
var parsedArea = Object . keys ( area ) . reduce ( function ( result , key ) {
var value = area [ key ] ;
var parsed = _parseCssDimensionValues ( value ) ;
var calculated = _dimensionsConverters [ key ] ( parsed , context ) ;
result [ key ] = calculated ;
return result ;
} , { } ) ;
return {
topLeft : {
x : parsedArea . left ,
y : parsedArea . top
} ,
width : parsedArea . right - parsedArea . left ,
height : parsedArea . bottom - parsedArea . top
} ;
}
/***/ } ) ,
/***/ "./src/input/input-stream.ts" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / input / input - stream . ts * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: InputStream */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "InputStream" , function ( ) { return InputStream ; } ) ;
/* harmony import */ var _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/classCallCheck */ "../../node_modules/@babel/runtime/helpers/classCallCheck.js" ) ;
/* harmony import */ var _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/createClass */ "../../node_modules/@babel/runtime/helpers/createClass.js" ) ;
/* harmony import */ var _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/defineProperty */ "../../node_modules/@babel/runtime/helpers/defineProperty.js" ) ;
/* harmony import */ var _babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ ) ;
function ownKeys ( object , enumerableOnly ) { var keys = Object . keys ( object ) ; if ( Object . getOwnPropertySymbols ) { var symbols = Object . getOwnPropertySymbols ( object ) ; if ( enumerableOnly ) symbols = symbols . filter ( function ( sym ) { return Object . getOwnPropertyDescriptor ( object , sym ) . enumerable ; } ) ; keys . push . apply ( keys , symbols ) ; } return keys ; }
function _objectSpread ( target ) { for ( var i = 1 ; i < arguments . length ; i ++ ) { var source = arguments [ i ] != null ? arguments [ i ] : { } ; if ( i % 2 ) { ownKeys ( source , true ) . forEach ( function ( key ) { _babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( target , key , source [ key ] ) ; } ) ; } else if ( Object . getOwnPropertyDescriptors ) { Object . defineProperties ( target , Object . getOwnPropertyDescriptors ( source ) ) ; } else { ownKeys ( source ) . forEach ( function ( key ) { Object . defineProperty ( target , key , Object . getOwnPropertyDescriptor ( source , key ) ) ; } ) ; } } return target ; }
var InputStream =
/*#__PURE__*/
function ( ) {
function InputStream ( ) {
_babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default ( ) ( this , InputStream ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , "_calculatedHeight" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , "_calculatedWidth" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , "_canvasHeight" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , "_canvasWidth" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , "_config" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , "_eventNames" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , "_eventHandlers" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , "_topLeft" , void 0 ) ;
this . _canvasWidth = 0 ;
this . _canvasHeight = 0 ;
this . _config = null ;
this . _eventNames = [ 'canrecord' , 'ended' ] ;
this . _eventHandlers = new Map ( ) ;
this . _topLeft = {
x : 0 ,
y : 0
} ;
}
_babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default ( ) ( InputStream , [ {
key : "setCanvasSize" ,
value : function setCanvasSize ( width , height ) {
this . _canvasWidth = width ;
this . _canvasHeight = height ;
}
} , {
key : "addEventListener" ,
value : function addEventListener ( event , listener , _options ) {
if ( this . _eventNames . indexOf ( event ) !== - 1 ) {
if ( ! this . _eventHandlers . has ( event ) ) {
this . _eventHandlers . set ( event , new Array ( ) ) ;
}
this . _eventHandlers . get ( event ) . push ( listener ) ;
}
}
} , {
key : "clearEventHandlers" ,
value : function clearEventHandlers ( ) {
this . _eventHandlers . clear ( ) ;
}
} , {
key : "trigger" ,
value : function trigger ( eventName , argArray ) {
var _this = this ;
var handlers = this . _eventHandlers . get ( eventName ) ;
if ( handlers ) {
handlers . forEach ( function ( handler ) {
return handler . apply ( _this , argArray ) ;
} ) ;
}
}
} , {
key : "height" ,
get : function get ( ) {
return this . _calculatedHeight ;
} ,
set : function set ( height ) {
this . _calculatedHeight = height ;
}
} , {
key : "width" ,
get : function get ( ) {
return this . _calculatedWidth ;
} ,
set : function set ( width ) {
this . _calculatedWidth = width ;
}
} , {
key : "topLeft" ,
get : function get ( ) {
return _objectSpread ( { } , this . _topLeft ) ;
} ,
set : function set ( topLeft ) {
this . _topLeft . x = topLeft . x ;
this . _topLeft . y = topLeft . y ;
}
} , {
key : "canvasHeight" ,
get : function get ( ) {
return this . _canvasHeight ;
}
} , {
key : "canvasWidth" ,
get : function get ( ) {
return this . _canvasWidth ;
}
} ] ) ;
return InputStream ;
} ( ) ;
/***/ } ) ,
/***/ "./src/input/live-stream.ts" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / input / live - stream . ts * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: LiveStream */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "LiveStream" , function ( ) { return LiveStream ; } ) ;
/* harmony import */ var _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/classCallCheck */ "../../node_modules/@babel/runtime/helpers/classCallCheck.js" ) ;
/* harmony import */ var _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/createClass */ "../../node_modules/@babel/runtime/helpers/createClass.js" ) ;
/* harmony import */ var _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/possibleConstructorReturn */ "../../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js" ) ;
/* harmony import */ var _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _2 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/getPrototypeOf */ "../../node_modules/@babel/runtime/helpers/getPrototypeOf.js" ) ;
/* harmony import */ var _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _3 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _3 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _4 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/inherits */ "../../node_modules/@babel/runtime/helpers/inherits.js" ) ;
/* harmony import */ var _babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _4 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _4 _ _ ) ;
/* harmony import */ var _video _stream _ _WEBPACK _IMPORTED _MODULE _5 _ _ = _ _webpack _require _ _ ( /*! ./video-stream */ "./src/input/video-stream.ts" ) ;
var LiveStream =
/*#__PURE__*/
function ( _VideoStream ) {
_babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _4 _ _ _default ( ) ( LiveStream , _VideoStream ) ;
function LiveStream ( video ) {
_babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default ( ) ( this , LiveStream ) ;
video . setAttribute ( 'autoplay' , '' ) ;
return _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _3 _ _ _default ( ) ( LiveStream ) . call ( this , video ) ) ;
}
_babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default ( ) ( LiveStream , [ {
key : "ended" ,
get : function get ( ) {
return false ;
}
} ] ) ;
return LiveStream ;
} ( _video _stream _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "VideoStream" ] ) ;
/***/ } ) ,
/***/ "./src/input/video-stream.ts" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / input / video - stream . ts * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: VideoStream, LiveStream */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "VideoStream" , function ( ) { return VideoStream ; } ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "LiveStream" , function ( ) { return LiveStream ; } ) ;
/* harmony import */ var _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/classCallCheck */ "../../node_modules/@babel/runtime/helpers/classCallCheck.js" ) ;
/* harmony import */ var _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/createClass */ "../../node_modules/@babel/runtime/helpers/createClass.js" ) ;
/* harmony import */ var _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/possibleConstructorReturn */ "../../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js" ) ;
/* harmony import */ var _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _2 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _assertThisInitialized _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/assertThisInitialized */ "../../node_modules/@babel/runtime/helpers/assertThisInitialized.js" ) ;
/* harmony import */ var _babel _runtime _helpers _assertThisInitialized _ _WEBPACK _IMPORTED _MODULE _3 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _assertThisInitialized _ _WEBPACK _IMPORTED _MODULE _3 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _4 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/getPrototypeOf */ "../../node_modules/@babel/runtime/helpers/getPrototypeOf.js" ) ;
/* harmony import */ var _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _4 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _4 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _get _ _WEBPACK _IMPORTED _MODULE _5 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/get */ "../../node_modules/@babel/runtime/helpers/get.js" ) ;
/* harmony import */ var _babel _runtime _helpers _get _ _WEBPACK _IMPORTED _MODULE _5 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _get _ _WEBPACK _IMPORTED _MODULE _5 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _6 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/inherits */ "../../node_modules/@babel/runtime/helpers/inherits.js" ) ;
/* harmony import */ var _babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _6 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _6 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _7 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/defineProperty */ "../../node_modules/@babel/runtime/helpers/defineProperty.js" ) ;
/* harmony import */ var _babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _7 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _7 _ _ ) ;
/* harmony import */ var _input _stream _ _WEBPACK _IMPORTED _MODULE _8 _ _ = _ _webpack _require _ _ ( /*! ./input-stream */ "./src/input/input-stream.ts" ) ;
function ownKeys ( object , enumerableOnly ) { var keys = Object . keys ( object ) ; if ( Object . getOwnPropertySymbols ) { var symbols = Object . getOwnPropertySymbols ( object ) ; if ( enumerableOnly ) symbols = symbols . filter ( function ( sym ) { return Object . getOwnPropertyDescriptor ( object , sym ) . enumerable ; } ) ; keys . push . apply ( keys , symbols ) ; } return keys ; }
function _objectSpread ( target ) { for ( var i = 1 ; i < arguments . length ; i ++ ) { var source = arguments [ i ] != null ? arguments [ i ] : { } ; if ( i % 2 ) { ownKeys ( source , true ) . forEach ( function ( key ) { _babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _7 _ _ _default ( ) ( target , key , source [ key ] ) ; } ) ; } else if ( Object . getOwnPropertyDescriptors ) { Object . defineProperties ( target , Object . getOwnPropertyDescriptors ( source ) ) ; } else { ownKeys ( source ) . forEach ( function ( key ) { Object . defineProperty ( target , key , Object . getOwnPropertyDescriptor ( source , key ) ) ; } ) ; } } return target ; }
var VideoStream =
/*#__PURE__*/
function ( _InputStream ) {
_babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _6 _ _ _default ( ) ( VideoStream , _InputStream ) ;
function VideoStream ( video ) {
var _this ;
_babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default ( ) ( this , VideoStream ) ;
_this = _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _4 _ _ _default ( ) ( VideoStream ) . call ( this ) ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _7 _ _ _default ( ) ( _babel _runtime _helpers _assertThisInitialized _ _WEBPACK _IMPORTED _MODULE _3 _ _ _default ( ) ( _this ) , "_video" , void 0 ) ;
_this . _video = video ;
return _this ;
}
_babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default ( ) ( VideoStream , [ {
key : "setAttribute" ,
value : function setAttribute ( name , value ) {
this . _video . setAttribute ( name , value ) ;
}
} , {
key : "pause" ,
value : function pause ( ) {
this . _video . pause ( ) ;
}
} , {
key : "play" ,
value : function play ( ) {
this . _video . play ( ) ;
}
} , {
key : "addEventListener" ,
value : function addEventListener ( event , listener , options ) {
_babel _runtime _helpers _get _ _WEBPACK _IMPORTED _MODULE _5 _ _ _default ( ) ( _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _4 _ _ _default ( ) ( VideoStream . prototype ) , "addEventListener" , this ) . call ( this , event , listener , options ) ;
if ( this . _eventNames . indexOf ( event ) === - 1 ) {
this . _video . addEventListener ( event , listener , options ) ;
}
}
} , {
key : "clearEventHandlers" ,
value : function clearEventHandlers ( ) {
// TODO: come up with a way to remove video event handlers
// this._eventNames.forEach(eventName => {
// const handlers = this._eventHandlers.get(eventName);
// if (handlers && handlers.length > 0) {
// handlers.forEach(handler => this._video.removeEventListener(eventName, handler));
// }
// });
_babel _runtime _helpers _get _ _WEBPACK _IMPORTED _MODULE _5 _ _ _default ( ) ( _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _4 _ _ _default ( ) ( VideoStream . prototype ) , "clearEventHandlers" , this ) . call ( this ) ;
}
} , {
key : "trigger" ,
value : function trigger ( eventName , argArray ) {
if ( eventName === 'canrecord' ) {
this . _initSize ( ) ;
}
_babel _runtime _helpers _get _ _WEBPACK _IMPORTED _MODULE _5 _ _ _default ( ) ( _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _4 _ _ _default ( ) ( VideoStream . prototype ) , "trigger" , this ) . call ( this , eventName , argArray ) ;
}
} , {
key : "getFrame" ,
value : function getFrame ( ) {
return this . _video ;
}
} , {
key : "_initSize" ,
value : function _initSize ( ) {
var width = this . _video . videoWidth ;
var height = this . _video . videoHeight ;
this . _canvasWidth = this . _calculatedWidth = this . _config . size ? width > height ? this . _config . size : width * this . _config . size / height | 0 : width ;
this . _canvasHeight = this . _calculatedHeight = this . _config . size ? width > height ? height * this . _config . size / width | 0 : this . _config . size : height ;
}
} , {
key : "realHeight" ,
get : function get ( ) {
return this . _video . videoHeight ;
}
} , {
key : "realWidth" ,
get : function get ( ) {
return this . _video . videoWidth ;
}
} , {
key : "config" ,
get : function get ( ) {
return this . _config ;
} ,
set : function set ( config ) {
this . _config = _objectSpread ( { } , config ) ;
this . _video . src = config . src || '' ;
}
} , {
key : "ended" ,
get : function get ( ) {
return this . _video . ended ;
}
} , {
key : "currentTime" ,
set : function set ( time ) {
if ( this . _config . type !== 'LiveStream' ) {
this . _video . currentTime = time ;
}
}
} ] ) ;
return VideoStream ;
} ( _input _stream _ _WEBPACK _IMPORTED _MODULE _8 _ _ [ "InputStream" ] ) ;
var LiveStream =
/*#__PURE__*/
function ( _VideoStream ) {
_babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _6 _ _ _default ( ) ( LiveStream , _VideoStream ) ;
function LiveStream ( video ) {
_babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default ( ) ( this , LiveStream ) ;
video . setAttribute ( 'autoplay' , '' ) ;
return _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _4 _ _ _default ( ) ( LiveStream ) . call ( this , video ) ) ;
}
_babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default ( ) ( LiveStream , [ {
key : "ended" ,
get : function get ( ) {
return false ;
}
} ] ) ;
return LiveStream ;
} ( VideoStream ) ;
/***/ } ) ,
/***/ "./src/locator/barcode-locator-utils.ts" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / locator / barcode - locator - utils . ts * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: invert, transformWithMatrix, otsuThreshold, halfSample */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "invert" , function ( ) { return invert ; } ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "transformWithMatrix" , function ( ) { return transformWithMatrix ; } ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "otsuThreshold" , function ( ) { return otsuThreshold ; } ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "halfSample" , function ( ) { return halfSample ; } ) ;
/ * *
* Invert matrix
* @ param matrix the matrix to invert
* @ returns the inverted matrix
* /
function invert ( matrix ) {
var a0 = matrix [ 0 ] ;
var a1 = matrix [ 1 ] ;
var a2 = matrix [ 2 ] ;
var a3 = matrix [ 3 ] ;
var determinant = a0 * a3 - a2 * a1 ;
if ( ! determinant ) {
return null ;
}
return new Float32Array ( [ a3 / determinant , - a1 / determinant , - a2 / determinant , a0 / determinant ] ) ;
}
/ * *
* Transforms the vector with a matrix
* @ param { x , y } vector to transform
* @ param matrix matrix to transform with
* @ returns the transformed vector
* /
function transformWithMatrix ( _ref , matrix ) {
var x = _ref . x ,
y = _ref . y ;
return {
x : matrix [ 0 ] * x + matrix [ 2 ] * y ,
y : matrix [ 1 ] * x + matrix [ 3 ] * y
} ;
}
function _computeHistogram ( imageWrapper , bitsPerPixel ) {
if ( ! bitsPerPixel ) {
bitsPerPixel = 8 ;
}
var imageData = imageWrapper . data ;
var bitShift = 8 - bitsPerPixel ;
var bucketCount = 1 << bitsPerPixel ;
var histogram = new Int32Array ( bucketCount ) ;
for ( var i = imageData . length ; i -- ; ) {
histogram [ imageData [ i ] >> bitShift ] ++ ;
}
return histogram ;
}
function _determineOtsuThreshold ( imageWrapper , bitsPerPixel ) {
if ( ! bitsPerPixel ) {
bitsPerPixel = 8 ;
}
var bitShift = 8 - bitsPerPixel ;
var hist = _computeHistogram ( imageWrapper , bitsPerPixel ) ;
var vet = [ 0 ] ;
var max = ( 1 << bitsPerPixel ) - 1 ;
function px ( init , end ) {
var sum = 0 ;
for ( var i = init ; i <= end ; i ++ ) {
sum += hist [ i ] ;
}
return sum ;
}
function mx ( init , end ) {
var sum = 0 ;
for ( var i = init ; i <= end ; i ++ ) {
sum += i * hist [ i ] ;
}
return sum ;
}
for ( var k = 1 ; k < max ; k ++ ) {
var p1 = px ( 0 , k ) ;
var p2 = px ( k + 1 , max ) ;
var p12 = p1 * p2 || 1 ;
var m1 = mx ( 0 , k ) * p2 ;
var m2 = mx ( k + 1 , max ) * p1 ;
var m12 = m1 - m2 ;
vet [ k ] = m12 * m12 / p12 ;
} // index of max element
var threshold = vet . reduce ( function ( maxIndex , item , index , array ) {
return item > array [ maxIndex ] ? index : maxIndex ;
} , 0 ) ;
return threshold << bitShift ;
}
function otsuThreshold ( imageWrapper , targetWrapper ) {
var threshold = _determineOtsuThreshold ( imageWrapper ) ;
var targetData = targetWrapper . data ;
imageWrapper . data . forEach ( function ( value , index ) {
targetData [ index ] = value < threshold ? 1 : 0 ;
} ) ;
return threshold ;
}
/ * *
* @ param imageWrapper input image to be sampled
* @ param outImageWrapper { ImageWrapper } to be stored in
* /
function halfSample ( imageWrapper , outImageWrapper ) {
var image = imageWrapper . data ;
var width = imageWrapper . size . x ;
var outImage = outImageWrapper . data ;
var endIndex = image . length ;
var outWidth = width >> 1 ;
var topRowIndex = 0 ;
var bottomRowIndex = width ;
var outImgIndex = 0 ;
while ( bottomRowIndex < endIndex ) {
for ( var i = 0 ; i < outWidth ; i ++ ) {
outImage [ outImgIndex ] = image [ topRowIndex ] + image [ topRowIndex + 1 ] + image [ bottomRowIndex ] + image [ bottomRowIndex + 1 ] >> 2 ;
outImgIndex ++ ;
topRowIndex += 2 ;
bottomRowIndex += 2 ;
}
topRowIndex += width ;
bottomRowIndex += width ;
}
}
/***/ } ) ,
/***/ "./src/locator/barcode-locator.ts" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / locator / barcode - locator . ts * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: BarcodeLocator */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* WEBPACK VAR INJECTION */ ( function ( global ) { /* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "BarcodeLocator" , function ( ) { return BarcodeLocator ; } ) ;
/* harmony import */ var _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/classCallCheck */ "../../node_modules/@babel/runtime/helpers/classCallCheck.js" ) ;
/* harmony import */ var _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/createClass */ "../../node_modules/@babel/runtime/helpers/createClass.js" ) ;
/* harmony import */ var _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/defineProperty */ "../../node_modules/@babel/runtime/helpers/defineProperty.js" ) ;
/* harmony import */ var _babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ ) ;
/* harmony import */ var _common _cluster _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! ../common/cluster */ "./src/common/cluster.ts" ) ;
/* harmony import */ var _common _hsv2rgb _ _WEBPACK _IMPORTED _MODULE _4 _ _ = _ _webpack _require _ _ ( /*! ../common/hsv2rgb */ "./src/common/hsv2rgb.ts" ) ;
/* harmony import */ var _common _image _debug _ _WEBPACK _IMPORTED _MODULE _5 _ _ = _ _webpack _require _ _ ( /*! ../common/image-debug */ "./src/common/image-debug.ts" ) ;
/* harmony import */ var _common _image _wrapper _ _WEBPACK _IMPORTED _MODULE _6 _ _ = _ _webpack _require _ _ ( /*! ../common/image-wrapper */ "./src/common/image-wrapper.ts" ) ;
/* harmony import */ var _input _input _stream _utils _ _WEBPACK _IMPORTED _MODULE _7 _ _ = _ _webpack _require _ _ ( /*! ../input/input-stream-utils */ "./src/input/input-stream-utils.ts" ) ;
/* harmony import */ var _barcode _locator _utils _ _WEBPACK _IMPORTED _MODULE _8 _ _ = _ _webpack _require _ _ ( /*! ./barcode-locator-utils */ "./src/locator/barcode-locator-utils.ts" ) ;
/* harmony import */ var _rasterizer _ _WEBPACK _IMPORTED _MODULE _9 _ _ = _ _webpack _require _ _ ( /*! ./rasterizer */ "./src/locator/rasterizer.ts" ) ;
/* harmony import */ var _skeletonizer _ _WEBPACK _IMPORTED _MODULE _10 _ _ = _ _webpack _require _ _ ( /*! ./skeletonizer */ "./src/locator/skeletonizer.js" ) ;
/* harmony import */ var _tracer _ _WEBPACK _IMPORTED _MODULE _11 _ _ = _ _webpack _require _ _ ( /*! ./tracer */ "./src/locator/tracer.ts" ) ;
var MomentSimilarityThreshold = 0.9 ;
var BarcodeLocator =
/*#__PURE__*/
function ( ) {
function BarcodeLocator ( inputImageWrapper , config ) {
_babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default ( ) ( this , BarcodeLocator ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , "_config" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , "_inputImageWrapper" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , "_currentImageWrapper" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , "_skelImageWrapper" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , "_subImageWrapper" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , "_labelImageWrapper" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , "_binaryImageWrapper" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , "_patchGrid" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , "_patchLabelGrid" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , "_imageToPatchGrid" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , "_patchSize" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , "_binaryContext" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , "_numPatches" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , "_skeletonizer" , void 0 ) ;
this . _config = config ;
this . _inputImageWrapper = inputImageWrapper ;
this . _numPatches = {
x : 0 ,
y : 0
} ;
this . _initBuffers ( ) ;
this . _initCanvas ( ) ;
}
_babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default ( ) ( BarcodeLocator , [ {
key : "locate" ,
value : function locate ( ) {
if ( this . _config . halfSample ) {
Object ( _barcode _locator _utils _ _WEBPACK _IMPORTED _MODULE _8 _ _ [ "halfSample" ] ) ( this . _inputImageWrapper , this . _currentImageWrapper ) ;
}
this . _binarizeImage ( ) ;
var patchesFound = this . _findPatches ( ) ; // return unless 5% or more patches are found
if ( patchesFound . length < this . _numPatches . x * this . _numPatches . y * 0.05 ) {
return null ;
} // rasterize area by comparing angular similarity;
var maxLabel = this . _rasterizeAngularSimilarity ( patchesFound ) ;
if ( maxLabel < 1 ) {
return null ;
} // search for area with the most patches (biggest connected area)
var topLabels = this . _findBiggestConnectedAreas ( maxLabel ) ;
if ( topLabels . length === 0 ) {
return null ;
}
var boxes = this . _findBoxes ( topLabels , maxLabel ) ;
return boxes ;
}
} , {
key : "_initBuffers" ,
value : function _initBuffers ( ) {
if ( this . _config . halfSample ) {
this . _currentImageWrapper = new _common _image _wrapper _ _WEBPACK _IMPORTED _MODULE _6 _ _ [ "ImageWrapper" ] ( {
x : this . _inputImageWrapper . size . x / 2 | 0 ,
y : this . _inputImageWrapper . size . y / 2 | 0
} ) ;
} else {
this . _currentImageWrapper = this . _inputImageWrapper ;
}
this . _patchSize = Object ( _input _input _stream _utils _ _WEBPACK _IMPORTED _MODULE _7 _ _ [ "calculatePatchSize" ] ) ( this . _config . patchSize , this . _currentImageWrapper . size ) ;
this . _numPatches . x = this . _currentImageWrapper . size . x / this . _patchSize . x | 0 ;
this . _numPatches . y = this . _currentImageWrapper . size . y / this . _patchSize . y | 0 ;
this . _binaryImageWrapper = new _common _image _wrapper _ _WEBPACK _IMPORTED _MODULE _6 _ _ [ "ImageWrapper" ] ( this . _currentImageWrapper . size , undefined , Uint8Array , false ) ;
this . _labelImageWrapper = new _common _image _wrapper _ _WEBPACK _IMPORTED _MODULE _6 _ _ [ "ImageWrapper" ] ( this . _patchSize , undefined , Array , true ) ;
var skeletonImageData = new ArrayBuffer ( 64 * 1024 ) ;
this . _subImageWrapper = new _common _image _wrapper _ _WEBPACK _IMPORTED _MODULE _6 _ _ [ "ImageWrapper" ] ( this . _patchSize , new Uint8Array ( skeletonImageData , 0 , this . _patchSize . x * this . _patchSize . y ) ) ;
this . _skelImageWrapper = new _common _image _wrapper _ _WEBPACK _IMPORTED _MODULE _6 _ _ [ "ImageWrapper" ] ( this . _patchSize , new Uint8Array ( skeletonImageData , this . _patchSize . x * this . _patchSize . y * 3 , this . _patchSize . x * this . _patchSize . y ) , undefined , true ) ;
this . _skeletonizer = Object ( _skeletonizer _ _WEBPACK _IMPORTED _MODULE _10 _ _ [ "default" ] ) ( typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : global , {
size : this . _patchSize . x
} , skeletonImageData ) ;
var size = {
x : this . _currentImageWrapper . size . x / this . _subImageWrapper . size . x | 0 ,
y : this . _currentImageWrapper . size . y / this . _subImageWrapper . size . y | 0
} ;
this . _patchLabelGrid = new _common _image _wrapper _ _WEBPACK _IMPORTED _MODULE _6 _ _ [ "ImageWrapper" ] ( size , undefined , Int32Array , true ) ;
this . _patchGrid = new _common _image _wrapper _ _WEBPACK _IMPORTED _MODULE _6 _ _ [ "ImageWrapper" ] ( size , undefined , undefined , true ) ;
this . _imageToPatchGrid = new Array ( this . _patchLabelGrid . data . length ) ;
}
} , {
key : "_initCanvas" ,
value : function _initCanvas ( ) {
if ( this . _config . useWorker || typeof document === 'undefined' ) {
return ;
}
var canvas = document . createElement ( 'canvas' ) ;
canvas . className = 'binaryBuffer' ;
canvas . width = this . _binaryImageWrapper . size . x ;
canvas . height = this . _binaryImageWrapper . size . y ;
if ( true && this . _config . debug && this . _config . debug . showCanvas ) {
document . querySelector ( '#debug' ) . appendChild ( canvas ) ;
}
this . _binaryContext = canvas . getContext ( '2d' ) ;
}
/ * *
* Creates a bounding box which encloses all the given patches
* @ returns The minimal bounding box
* /
} , {
key : "_boxFromPatches" ,
value : function _boxFromPatches ( patches ) {
var _this = this ;
var debug = true && this . _config . debug ;
var averageRad = patches . reduce ( function ( sum , _ref ) {
var pos = _ref . pos ,
rad = _ref . rad ;
if ( debug && debug . showPatches ) {
// draw all patches which are to be taken into consideration
_this . _drawRect ( pos , _this . _subImageWrapper . size , 'red' , 1 ) ;
}
return sum + rad ;
} , 0 ) / patches . length ;
averageRad = ( averageRad * 180 / Math . PI + 90 ) % 180 - 90 ;
if ( averageRad < 0 ) {
averageRad += 180 ;
}
averageRad = ( 180 - averageRad ) * Math . PI / 180 ;
var cos = Math . cos ( averageRad ) ;
var sin = Math . sin ( averageRad ) ;
var matrix = new Float32Array ( [ cos , sin , - sin , cos ] ) ;
var inverseMatrix = Object ( _barcode _locator _utils _ _WEBPACK _IMPORTED _MODULE _8 _ _ [ "invert" ] ) ( matrix ) ; // iterate over patches and rotate by angle
patches . forEach ( function ( _ref2 ) {
var box = _ref2 . box ;
for ( var j = 0 ; j < 4 ; j ++ ) {
box [ j ] = Object ( _barcode _locator _utils _ _WEBPACK _IMPORTED _MODULE _8 _ _ [ "transformWithMatrix" ] ) ( box [ j ] , matrix ) ;
}
if ( debug && debug . boxFromPatches . showTransformed ) {
_this . _drawPath ( box , '#99ff00' , 2 ) ;
}
} ) ;
var minX = this . _binaryImageWrapper . size . x ;
var minY = this . _binaryImageWrapper . size . y ;
var maxX = - minX ;
var maxY = - minY ; // find bounding box
patches . forEach ( function ( _ref3 ) {
var box = _ref3 . box ;
box . forEach ( function ( _ref4 ) {
var x = _ref4 . x ,
y = _ref4 . y ;
if ( x < minX ) {
minX = x ;
}
if ( x > maxX ) {
maxX = x ;
}
if ( y < minY ) {
minY = y ;
}
if ( y > maxY ) {
maxY = y ;
}
} ) ;
} ) ;
var box = [ {
x : minX ,
y : minY
} , {
x : maxX ,
y : minY
} , {
x : maxX ,
y : maxY
} , {
x : minX ,
y : maxY
} ] ;
if ( debug && debug . boxFromPatches . showTransformedBox ) {
this . _drawPath ( box , '#ff0000' , 2 ) ;
} // reverse rotation
box = box . map ( function ( vertex ) {
return Object ( _barcode _locator _utils _ _WEBPACK _IMPORTED _MODULE _8 _ _ [ "transformWithMatrix" ] ) ( vertex , inverseMatrix ) ;
} ) ;
if ( debug && debug . boxFromPatches . showBB ) {
this . _drawPath ( box , '#ff0000' , 2 ) ;
}
if ( this . _config . halfSample ) {
// scale
box = box . map ( function ( _ref5 ) {
var x = _ref5 . x ,
y = _ref5 . y ;
return {
x : x * 2 ,
y : y *= 2
} ;
} ) ;
}
return box ;
}
/ * *
* Creates a binary image of the current image
* /
} , {
key : "_binarizeImage" ,
value : function _binarizeImage ( ) {
Object ( _barcode _locator _utils _ _WEBPACK _IMPORTED _MODULE _8 _ _ [ "otsuThreshold" ] ) ( this . _currentImageWrapper , this . _binaryImageWrapper ) ;
this . _binaryImageWrapper . zeroBorder ( ) ;
if ( true && this . _config . debug && this . _config . debug . showCanvas ) {
this . _binaryImageWrapper . show ( this . _binaryContext , 255 ) ;
}
}
/ * *
* Iterate over the entire image , extract patches
* /
} , {
key : "_findPatches" ,
value : function _findPatches ( ) {
var debug = true && this . _config . debug ;
var patchesFound = new Array ( ) ;
for ( var i = 0 ; i < this . _numPatches . x ; i ++ ) {
for ( var j = 0 ; j < this . _numPatches . y ; j ++ ) {
var x = this . _subImageWrapper . size . x * i ;
var y = this . _subImageWrapper . size . y * j ; // seperate parts
this . _skeletonize ( x , y ) ; // Rasterize, find individual bars
this . _skelImageWrapper . zeroBorder ( ) ;
this . _labelImageWrapper . data . fill ( 0 ) ;
var rasterizer = new _rasterizer _ _WEBPACK _IMPORTED _MODULE _9 _ _ [ "Rasterizer" ] ( this . _skelImageWrapper , this . _labelImageWrapper ) ;
var rasterResult = rasterizer . rasterize ( 0 ) ;
if ( debug && debug . showLabels ) {
this . _labelImageWrapper . overlay ( this . _binaryContext , 360 / rasterResult . count | 0 , x , y ) ;
} // calculate moments from the skeletonized patch
var moments = this . _labelImageWrapper . moments ( rasterResult . count ) ; // extract eligible patches
var patch = this . _describePatch ( moments , j * this . _numPatches . x + i , x , y ) ;
if ( patch ) {
patchesFound . push ( patch ) ;
if ( debug && debug . showFoundPatches ) {
this . _drawRect ( patch . pos , this . _subImageWrapper . size , '#99ff00' , 2 ) ;
}
}
}
}
return patchesFound ;
}
/ * *
* Finds those connected areas which contain at least 6 patches
* and returns them ordered DESC by the number of contained patches
* @ param maxLabel
* /
} , {
key : "_findBiggestConnectedAreas" ,
value : function _findBiggestConnectedAreas ( maxLabel ) {
var labelHist = new Array ( maxLabel ) . fill ( 0 ) ;
this . _patchLabelGrid . data . forEach ( function ( data ) {
if ( data > 0 ) {
labelHist [ data - 1 ] ++ ;
}
} ) ; // extract top areas with at least 6 patches present
var topLabels = labelHist . map ( function ( value , index ) {
return {
value : value ,
index : index
} ;
} ) . filter ( function ( _ref6 ) {
var value = _ref6 . value ;
return value >= 5 ;
} ) . sort ( function ( a , b ) {
return b . value - a . value ;
} ) . map ( function ( _ref7 ) {
var index = _ref7 . index ;
return index + 1 ;
} ) ;
return topLabels ;
}
/ * *
*
* /
} , {
key : "_findBoxes" ,
value : function _findBoxes ( topLabels , maxLabel ) {
var _this2 = this ;
var boxes = new Array ( ) ;
var showRemainingPatchLabels = true && this . _config . debug && this . _config . debug . showRemainingPatchLabels ;
topLabels . forEach ( function ( label ) {
var patches = new Array ( ) ;
_this2 . _patchLabelGrid . data . forEach ( function ( data , index ) {
if ( data === label ) {
patches . push ( _this2 . _imageToPatchGrid [ index ] ) ;
}
} ) ;
var box = _this2 . _boxFromPatches ( patches ) ;
if ( box ) {
boxes . push ( box ) ;
if ( showRemainingPatchLabels ) {
// draw patch-labels if requested
var hsv = [ label / ( maxLabel + 1 ) * 360 , 1 , 1 ] ;
var rgb = [ 0 , 0 , 0 ] ;
Object ( _common _hsv2rgb _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "hsv2rgb" ] ) ( hsv , rgb ) ;
var color = "rgb(" . concat ( rgb . join ( ',' ) , ")" ) ;
patches . forEach ( function ( _ref8 ) {
var pos = _ref8 . pos ;
return _this2 . _drawRect ( pos , _this2 . _subImageWrapper . size , color , 2 ) ;
} ) ;
}
}
} ) ;
return boxes ;
}
/ * *
* Find similar moments ( via cluster )
* @ param moments
* /
} , {
key : "_similarMoments" ,
value : function _similarMoments ( moments ) {
var clusters = _common _cluster _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "Cluster" ] . clusterize ( moments , MomentSimilarityThreshold ) ;
var topCluster = clusters . reduce ( function ( top , item ) {
var count = item . moments . length ;
return count > top . count ? {
item : item ,
count : count
} : top ;
} , {
item : {
moments : [ ]
} ,
count : 0
} ) ;
var result = topCluster . item . moments ;
return result ;
}
} , {
key : "_skeletonize" ,
value : function _skeletonize ( x , y ) {
this . _binaryImageWrapper . subImageAsCopy ( this . _subImageWrapper , x , y ) ;
this . _skeletonizer . skeletonize ( ) ; // Show skeleton if requested
if ( true && this . _config . debug && this . _config . debug . showSkeleton ) {
this . _skelImageWrapper . overlay ( this . _binaryContext , 360 , x , y ) ;
}
}
/ * *
* Extracts and describes those patches which seem to contain a barcode pattern
* @ param moments
* @ param index
* @ param x
* @ param y
* @ returns list of patches
* /
} , {
key : "_describePatch" ,
value : function _describePatch ( moments , index , x , y ) {
if ( moments . length > 1 ) {
var minComponentWeight = Math . ceil ( this . _patchSize . x / 3 ) ; // only collect moments which area covers at least minComponentWeight pixels
var eligibleMoments = moments . filter ( function ( moment ) {
return moment . m00 > minComponentWeight ;
} ) ; // if at least 2 moments are found which have at least minComponentWeights covered
if ( eligibleMoments . length > 1 ) {
var matchingMoments = this . _similarMoments ( eligibleMoments ) ;
var length = matchingMoments . length | 0 ; // Only two of the moments are allowed not to fit into the equation
if ( length > 1 && length << 2 >= eligibleMoments . length * 3 && length << 2 > moments . length ) {
// determine the similarity of the moments
var rad = matchingMoments . reduce ( function ( sum , moment ) {
return sum + moment . rad ;
} , 0 ) / length ;
return {
index : index ,
pos : {
x : x ,
y : y
} ,
box : [ {
x : x ,
y : y
} , {
x : x + this . _subImageWrapper . size . x ,
y : y
} , {
x : x + this . _subImageWrapper . size . x ,
y : y + this . _subImageWrapper . size . y
} , {
x : x ,
y : y + this . _subImageWrapper . size . y
} ] ,
moments : matchingMoments ,
rad : rad ,
x : Math . cos ( rad ) ,
y : Math . sin ( rad )
} ;
}
}
}
return null ;
}
} , {
key : "_notYetProcessed" ,
value : function _notYetProcessed ( ) {
for ( var i = 0 ; i < this . _patchLabelGrid . data . length ; i ++ ) {
if ( this . _patchLabelGrid . data [ i ] === 0 && this . _patchGrid . data [ i ] === 1 ) {
return i ;
}
}
return this . _patchLabelGrid . data . length ;
}
} , {
key : "_trace" ,
value : function _trace ( currentIndex , label ) {
var _this3 = this ;
var threshold = 0.95 ;
var current = {
x : currentIndex % this . _patchLabelGrid . size . x ,
y : currentIndex / this . _patchLabelGrid . size . x | 0
} ;
if ( currentIndex < this . _patchLabelGrid . data . length ) {
var currentPatch = this . _imageToPatchGrid [ currentIndex ] ; // assign label
this . _patchLabelGrid . data [ currentIndex ] = label ;
_tracer _ _WEBPACK _IMPORTED _MODULE _11 _ _ [ "SearchDirections" ] . forEach ( function ( direction ) {
var y = current . y + direction [ 0 ] ;
var x = current . x + direction [ 1 ] ;
var index = y * _this3 . _patchLabelGrid . size . x + x ; // continue if patch empty
if ( _this3 . _patchGrid . data [ index ] === 0 ) {
_this3 . _patchLabelGrid . data [ index ] = Number . MAX _VALUE ;
} else if ( _this3 . _patchLabelGrid . data [ index ] === 0 ) {
var patch = _this3 . _imageToPatchGrid [ index ] ;
var similarity = Math . abs ( patch . x * currentPatch . x + patch . y * currentPatch . y ) ;
if ( similarity > threshold ) {
_this3 . _trace ( index , label ) ;
}
}
} ) ;
}
}
/ * *
* Finds patches which are connected and share the same orientation
* @ param patchesFound
* /
} , {
key : "_rasterizeAngularSimilarity" ,
value : function _rasterizeAngularSimilarity ( patchesFound ) {
var _this4 = this ;
var label = 0 ;
var hsv = [ 0 , 1 , 1 ] ;
var rgb = [ 0 , 0 , 0 ] ; // prepare for finding the right patches
this . _patchGrid . data . fill ( 0 ) ;
this . _patchLabelGrid . data . fill ( 0 ) ;
this . _imageToPatchGrid . fill ( null ) ;
patchesFound . forEach ( function ( patch ) {
_this4 . _imageToPatchGrid [ patch . index ] = patch ;
_this4 . _patchGrid . data [ patch . index ] = 1 ;
} ) ; // rasterize the patches found to determine area
this . _patchGrid . zeroBorder ( ) ;
var currentIndex = 0 ;
while ( ( currentIndex = this . _notYetProcessed ( ) ) < this . _patchLabelGrid . data . length ) {
label ++ ;
this . _trace ( currentIndex , label ) ;
} // draw patch-labels if requested
if ( true && this . _config . debug && this . _config . debug . showPatchLabels ) {
for ( var j = 0 ; j < this . _patchLabelGrid . data . length ; j ++ ) {
if ( this . _patchLabelGrid . data [ j ] > 0 && this . _patchLabelGrid . data [ j ] <= label ) {
var patch = this . _imageToPatchGrid [ j ] ;
hsv [ 0 ] = this . _patchLabelGrid . data [ j ] / ( label + 1 ) * 360 ;
Object ( _common _hsv2rgb _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "hsv2rgb" ] ) ( hsv , rgb ) ;
this . _drawRect ( patch . pos , this . _subImageWrapper . size , "rgb(" . concat ( rgb . join ( ',' ) , ")" ) , 2 ) ;
}
}
}
return label ;
}
} , {
key : "_drawRect" ,
value : function _drawRect ( _ref9 , size , color , lineWidth ) {
var x = _ref9 . x ,
y = _ref9 . y ;
this . _binaryContext . strokeStyle = color ;
this . _binaryContext . fillStyle = color ;
this . _binaryContext . lineWidth = lineWidth || 1 ;
this . _binaryContext . strokeRect ( x , y , size . x , size . y ) ;
}
} , {
key : "_drawPath" ,
value : function _drawPath ( path , color , lineWidth ) {
_common _image _debug _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "ImageDebug" ] . drawPath ( path , this . _binaryContext , color , lineWidth ) ;
}
} ] ) ;
return BarcodeLocator ;
} ( ) ;
/* WEBPACK VAR INJECTION */ } . call ( this , _ _webpack _require _ _ ( /*! ./../../node_modules/webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js" ) ) )
/***/ } ) ,
/***/ "./src/locator/rasterizer.ts" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / locator / rasterizer . ts * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: Rasterizer */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "Rasterizer" , function ( ) { return Rasterizer ; } ) ;
/* harmony import */ var _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/classCallCheck */ "../../node_modules/@babel/runtime/helpers/classCallCheck.js" ) ;
/* harmony import */ var _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/createClass */ "../../node_modules/@babel/runtime/helpers/createClass.js" ) ;
/* harmony import */ var _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/defineProperty */ "../../node_modules/@babel/runtime/helpers/defineProperty.js" ) ;
/* harmony import */ var _babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ ) ;
/* harmony import */ var _tracer _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! ./tracer */ "./src/locator/tracer.ts" ) ;
/ * *
* @ borrows http : //www.codeproject.com/Tips/407172/Connected-Component-Labeling-and-Vectorization
* /
var EdgeLabel ;
( function ( EdgeLabel ) {
EdgeLabel [ EdgeLabel [ "Outside" ] = - 32767 ] = "Outside" ;
EdgeLabel [ EdgeLabel [ "Inside" ] = - 32766 ] = "Inside" ;
} ) ( EdgeLabel || ( EdgeLabel = { } ) ) ;
;
var ContourDirection ;
( function ( ContourDirection ) {
ContourDirection [ ContourDirection [ "CW" ] = 0 ] = "CW" ;
ContourDirection [ ContourDirection [ "CCW" ] = 1 ] = "CCW" ;
ContourDirection [ ContourDirection [ "Unknown" ] = 2 ] = "Unknown" ;
} ) ( ContourDirection || ( ContourDirection = { } ) ) ;
;
var Rasterizer =
/*#__PURE__*/
function ( ) {
function Rasterizer ( imageWrapper , labelWrapper ) {
_babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default ( ) ( this , Rasterizer ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , "_width" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , "_height" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , "_tracer" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , "_imageData" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , "_labelData" , void 0 ) ;
this . _imageData = imageWrapper . data ;
this . _labelData = labelWrapper . data ;
this . _width = imageWrapper . size . x ;
this . _height = imageWrapper . size . y ;
this . _tracer = new _tracer _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "Tracer" ] ( imageWrapper , labelWrapper ) ;
}
_babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default ( ) ( Rasterizer , [ {
key : "rasterize" ,
value : function rasterize ( depthLabel ) {
var colorMap = new Array ( ) ;
for ( var i = 0 ; i < 400 ; i ++ ) {
colorMap [ i ] = 0 ;
}
colorMap [ 0 ] = this . _imageData [ 0 ] ;
var cc = null ;
var sc ;
var connectedCount = 0 ;
for ( var cy = 1 ; cy < this . _height - 1 ; cy ++ ) {
var labelIndex = 0 ;
var bc = colorMap [ 0 ] ;
for ( var cx = 1 ; cx < this . _width - 1 ; cx ++ ) {
var pos = cy * this . _width + cx ;
if ( this . _labelData [ pos ] === 0 ) {
var color = this . _imageData [ pos ] ;
if ( color !== bc ) {
if ( labelIndex === 0 ) {
var lc = connectedCount + 1 ;
colorMap [ lc ] = color ;
bc = color ;
var vertex = this . _tracer . contourTracing ( cy , cx , lc , color , EdgeLabel . Outside ) ;
if ( vertex !== null ) {
connectedCount ++ ;
labelIndex = lc ;
var p = {
dir : ContourDirection . CW ,
index : labelIndex ,
firstVertex : vertex ,
nextPeer : cc ,
insideContours : null
} ;
if ( cc !== null ) {
cc . previousPeer = p ;
}
cc = p ;
}
} else {
var _vertex = this . _tracer . contourTracing ( cy , cx , EdgeLabel . Inside , color , labelIndex ) ;
if ( _vertex !== null ) {
var _p = {
dir : depthLabel === 0 ? ContourDirection . CCW : ContourDirection . CW ,
firstVertex : _vertex ,
index : depthLabel ,
insideContours : null
} ;
sc = cc ;
while ( sc !== null && sc . index !== labelIndex ) {
sc = sc . nextPeer ;
}
if ( sc !== null ) {
_p . nextPeer = sc . insideContours ;
if ( sc . insideContours !== null ) {
sc . insideContours . previousPeer = _p ;
}
sc . insideContours = _p ;
}
}
}
} else {
this . _labelData [ pos ] = labelIndex ;
}
} else if ( this . _labelData [ pos ] === EdgeLabel . Inside ) {
labelIndex = 0 ;
bc = this . _imageData [ pos ] ;
} else if ( this . _labelData [ pos ] === EdgeLabel . Outside ) {
labelIndex = 0 ;
bc = colorMap [ 0 ] ;
} else {
labelIndex = this . _labelData [ pos ] ;
bc = colorMap [ labelIndex ] ;
}
}
}
sc = cc ;
while ( sc !== null ) {
sc . index = depthLabel ;
sc = sc . nextPeer ;
}
return {
cc : cc ,
count : connectedCount
} ;
}
} , {
key : "drawContour" ,
value : function drawContour ( canvas , firstContour ) {
var context = canvas . getContext ( '2d' ) ;
context . strokeStyle = 'red' ;
context . fillStyle = 'red' ;
context . lineWidth = 1 ;
var pq = firstContour ;
var iq = pq && pq . insideContours ;
while ( pq !== null ) {
var q = iq || pq ;
if ( iq !== null ) {
iq = iq . nextPeer ;
} else {
pq = pq . nextPeer ;
iq = pq && pq . insideContours ;
}
switch ( q . dir ) {
case ContourDirection . CW :
{
context . strokeStyle = 'red' ;
break ;
}
case ContourDirection . CCW :
{
context . strokeStyle = 'blue' ;
break ;
}
case ContourDirection . Unknown :
{
context . strokeStyle = 'green' ;
break ;
}
}
var p = q . firstVertex ;
context . beginPath ( ) ;
context . moveTo ( p . x , p . y ) ;
do {
p = p . next ;
context . lineTo ( p . x , p . y ) ;
} while ( p !== q . firstVertex ) ;
context . stroke ( ) ;
}
}
} ] ) ;
return Rasterizer ;
} ( ) ;
/***/ } ) ,
/***/ "./src/locator/skeletonizer.js" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / locator / skeletonizer . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* eslint-disable eqeqeq */
function Skeletonizer ( stdlib , foreign , buffer ) {
"use asm" ;
var images = new stdlib . Uint8Array ( buffer ) ,
size = foreign . size | 0 ,
imul = stdlib . Math . imul ;
function erode ( inImagePtr , outImagePtr ) {
inImagePtr = inImagePtr | 0 ;
outImagePtr = outImagePtr | 0 ;
var v = 0 ,
u = 0 ,
sum = 0 ,
yStart1 = 0 ,
yStart2 = 0 ,
xStart1 = 0 ,
xStart2 = 0 ,
offset = 0 ;
for ( v = 1 ; ( v | 0 ) < ( size - 1 | 0 ) ; v = v + 1 | 0 ) {
offset = offset + size | 0 ;
for ( u = 1 ; ( u | 0 ) < ( size - 1 | 0 ) ; u = u + 1 | 0 ) {
yStart1 = offset - size | 0 ;
yStart2 = offset + size | 0 ;
xStart1 = u - 1 | 0 ;
xStart2 = u + 1 | 0 ;
sum = ( images [ inImagePtr + yStart1 + xStart1 | 0 ] | 0 ) + ( images [ inImagePtr + yStart1 + xStart2 | 0 ] | 0 ) + ( images [ inImagePtr + offset + u | 0 ] | 0 ) + ( images [ inImagePtr + yStart2 + xStart1 | 0 ] | 0 ) + ( images [ inImagePtr + yStart2 + xStart2 | 0 ] | 0 ) | 0 ;
if ( ( sum | 0 ) == ( 5 | 0 ) ) {
images [ outImagePtr + offset + u | 0 ] = 1 ;
} else {
images [ outImagePtr + offset + u | 0 ] = 0 ;
}
}
}
return ;
}
function subtract ( aImagePtr , bImagePtr , outImagePtr ) {
aImagePtr = aImagePtr | 0 ;
bImagePtr = bImagePtr | 0 ;
outImagePtr = outImagePtr | 0 ;
var length = 0 ;
length = imul ( size , size ) | 0 ;
while ( ( length | 0 ) > 0 ) {
length = length - 1 | 0 ;
images [ outImagePtr + length | 0 ] = ( images [ aImagePtr + length | 0 ] | 0 ) - ( images [ bImagePtr + length | 0 ] | 0 ) | 0 ;
}
}
function bitwiseOr ( aImagePtr , bImagePtr , outImagePtr ) {
aImagePtr = aImagePtr | 0 ;
bImagePtr = bImagePtr | 0 ;
outImagePtr = outImagePtr | 0 ;
var length = 0 ;
length = imul ( size , size ) | 0 ;
while ( ( length | 0 ) > 0 ) {
length = length - 1 | 0 ;
images [ outImagePtr + length | 0 ] = images [ aImagePtr + length | 0 ] | 0 | ( images [ bImagePtr + length | 0 ] | 0 ) | 0 ;
}
}
function countNonZero ( imagePtr ) {
imagePtr = imagePtr | 0 ;
var sum = 0 ,
length = 0 ;
length = imul ( size , size ) | 0 ;
while ( ( length | 0 ) > 0 ) {
length = length - 1 | 0 ;
sum = ( sum | 0 ) + ( images [ imagePtr + length | 0 ] | 0 ) | 0 ;
}
return sum | 0 ;
}
function init ( imagePtr , value ) {
imagePtr = imagePtr | 0 ;
value = value | 0 ;
var length = 0 ;
length = imul ( size , size ) | 0 ;
while ( ( length | 0 ) > 0 ) {
length = length - 1 | 0 ;
images [ imagePtr + length | 0 ] = value ;
}
}
function dilate ( inImagePtr , outImagePtr ) {
inImagePtr = inImagePtr | 0 ;
outImagePtr = outImagePtr | 0 ;
var v = 0 ,
u = 0 ,
sum = 0 ,
yStart1 = 0 ,
yStart2 = 0 ,
xStart1 = 0 ,
xStart2 = 0 ,
offset = 0 ;
for ( v = 1 ; ( v | 0 ) < ( size - 1 | 0 ) ; v = v + 1 | 0 ) {
offset = offset + size | 0 ;
for ( u = 1 ; ( u | 0 ) < ( size - 1 | 0 ) ; u = u + 1 | 0 ) {
yStart1 = offset - size | 0 ;
yStart2 = offset + size | 0 ;
xStart1 = u - 1 | 0 ;
xStart2 = u + 1 | 0 ;
sum = ( images [ inImagePtr + yStart1 + xStart1 | 0 ] | 0 ) + ( images [ inImagePtr + yStart1 + xStart2 | 0 ] | 0 ) + ( images [ inImagePtr + offset + u | 0 ] | 0 ) + ( images [ inImagePtr + yStart2 + xStart1 | 0 ] | 0 ) + ( images [ inImagePtr + yStart2 + xStart2 | 0 ] | 0 ) | 0 ;
if ( ( sum | 0 ) > ( 0 | 0 ) ) {
images [ outImagePtr + offset + u | 0 ] = 1 ;
} else {
images [ outImagePtr + offset + u | 0 ] = 0 ;
}
}
}
return ;
}
function memcpy ( srcImagePtr , dstImagePtr ) {
srcImagePtr = srcImagePtr | 0 ;
dstImagePtr = dstImagePtr | 0 ;
var length = 0 ;
length = imul ( size , size ) | 0 ;
while ( ( length | 0 ) > 0 ) {
length = length - 1 | 0 ;
images [ dstImagePtr + length | 0 ] = images [ srcImagePtr + length | 0 ] | 0 ;
}
}
function zeroBorder ( imagePtr ) {
imagePtr = imagePtr | 0 ;
var x = 0 ,
y = 0 ;
for ( x = 0 ; ( x | 0 ) < ( size - 1 | 0 ) ; x = x + 1 | 0 ) {
images [ imagePtr + x | 0 ] = 0 ;
images [ imagePtr + y | 0 ] = 0 ;
y = y + size - 1 | 0 ;
images [ imagePtr + y | 0 ] = 0 ;
y = y + 1 | 0 ;
}
for ( x = 0 ; ( x | 0 ) < ( size | 0 ) ; x = x + 1 | 0 ) {
images [ imagePtr + y | 0 ] = 0 ;
y = y + 1 | 0 ;
}
}
function skeletonize ( ) {
var subImagePtr = 0 ,
erodedImagePtr = 0 ,
tempImagePtr = 0 ,
skelImagePtr = 0 ,
sum = 0 ,
done = 0 ;
erodedImagePtr = imul ( size , size ) | 0 ;
tempImagePtr = erodedImagePtr + erodedImagePtr | 0 ;
skelImagePtr = tempImagePtr + erodedImagePtr | 0 ; // init skel-image
init ( skelImagePtr , 0 ) ;
zeroBorder ( subImagePtr ) ;
do {
erode ( subImagePtr , erodedImagePtr ) ;
dilate ( erodedImagePtr , tempImagePtr ) ;
subtract ( subImagePtr , tempImagePtr , tempImagePtr ) ;
bitwiseOr ( skelImagePtr , tempImagePtr , skelImagePtr ) ;
memcpy ( erodedImagePtr , subImagePtr ) ;
sum = countNonZero ( subImagePtr ) | 0 ;
done = ( sum | 0 ) == 0 | 0 ;
} while ( ! done ) ;
}
return {
skeletonize : skeletonize
} ;
}
/* harmony default export */ _ _webpack _exports _ _ [ "default" ] = ( Skeletonizer ) ;
/* eslint-enable eqeqeq */
/***/ } ) ,
/***/ "./src/locator/tracer.ts" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / locator / tracer . ts * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: SearchDirections, Tracer */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "SearchDirections" , function ( ) { return SearchDirections ; } ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "Tracer" , function ( ) { return Tracer ; } ) ;
/* harmony import */ var _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/classCallCheck */ "../../node_modules/@babel/runtime/helpers/classCallCheck.js" ) ;
/* harmony import */ var _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/createClass */ "../../node_modules/@babel/runtime/helpers/createClass.js" ) ;
/* harmony import */ var _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/defineProperty */ "../../node_modules/@babel/runtime/helpers/defineProperty.js" ) ;
/* harmony import */ var _babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ ) ;
/ * *
* @ borrows http : //www.codeproject.com/Tips/407172/Connected-Component-Labeling-and-Vectorization
* /
var SearchDirections = [ [ 0 , 1 ] , [ 1 , 1 ] , [ 1 , 0 ] , [ 1 , - 1 ] , [ 0 , - 1 ] , [ - 1 , - 1 ] , [ - 1 , 0 ] , [ - 1 , 1 ] ] ;
var Tracer =
/*#__PURE__*/
function ( ) {
function Tracer ( imageWrapper , labelWrapper ) {
_babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default ( ) ( this , Tracer ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , "_imageData" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , "_labelData" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , "_width" , void 0 ) ;
this . _imageData = imageWrapper . data ;
this . _labelData = labelWrapper . data ;
this . _width = imageWrapper . size . x ;
}
_babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default ( ) ( Tracer , [ {
key : "trace" ,
value : function trace ( current , color , label , edgeLabel ) {
for ( var i = 0 ; i < 7 ; i ++ ) {
var y = current . cy + SearchDirections [ current . dir ] [ 0 ] | 0 ;
var x = current . cx + SearchDirections [ current . dir ] [ 1 ] | 0 ;
var pos = y * this . _width + x | 0 ;
if ( this . _imageData [ pos ] === color && ( this . _labelData [ pos ] === 0 || this . _labelData [ pos ] === label ) ) {
this . _labelData [ pos ] = label ;
current . cx = x ;
current . cy = y ;
return true ;
} else {
if ( this . _labelData [ pos ] === 0 ) {
this . _labelData [ pos ] = edgeLabel ;
}
current . dir = ( current . dir + 1 ) % 8 ;
}
}
return false ;
}
} , {
key : "contourTracing" ,
value : function contourTracing ( sy , sx , label , color , edgeLabel ) {
var Fv = null ;
var current = {
cx : sx ,
cy : sy ,
dir : 0
} ;
if ( this . trace ( current , color , label , edgeLabel ) ) {
Fv = {
x : sx ,
y : sy ,
dir : current . dir ,
next : null ,
prev : null
} ;
var Cv = Fv ;
var ldir = current . dir ;
var P = {
x : current . cx ,
y : current . cy ,
dir : 0 ,
next : null ,
prev : Cv
} ;
Cv . next = P ;
Cv = P ;
do {
current . dir = ( current . dir + 6 ) % 8 ;
this . trace ( current , color , label , edgeLabel ) ;
if ( ldir !== current . dir ) {
Cv . dir = current . dir ;
P = {
x : current . cx ,
y : current . cy ,
dir : 0 ,
next : null ,
prev : Cv
} ;
Cv . next = P ;
Cv = P ;
} else {
Cv . dir = ldir ;
Cv . x = current . cx ;
Cv . y = current . cy ;
}
ldir = current . dir ;
} while ( current . cx !== sx || current . cy !== sy ) ;
Fv . prev = Cv . prev ;
Cv . prev . next = Fv ;
}
return Fv ;
}
} ] ) ;
return Tracer ;
} ( ) ;
/***/ } ) ,
/***/ "./src/quagga.ts" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / quagga . ts * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: default */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony import */ var _analytics _result _collector _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ./analytics/result-collector */ "./src/analytics/result-collector.ts" ) ;
/* harmony import */ var _common _events _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! ./common/events */ "./src/common/events.ts" ) ;
/* harmony import */ var _common _image _debug _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! ./common/image-debug */ "./src/common/image-debug.ts" ) ;
/* harmony import */ var _common _image _wrapper _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! ./common/image-wrapper */ "./src/common/image-wrapper.ts" ) ;
/* harmony import */ var _common _merge _ _WEBPACK _IMPORTED _MODULE _4 _ _ = _ _webpack _require _ _ ( /*! ./common/merge */ "./src/common/merge.ts" ) ;
/* harmony import */ var _config _config _ _WEBPACK _IMPORTED _MODULE _5 _ _ = _ _webpack _require _ _ ( /*! ./config/config */ "./src/config/config.dev.ts" ) ;
/* harmony import */ var _decoder _barcode _decoder _ _WEBPACK _IMPORTED _MODULE _6 _ _ = _ _webpack _require _ _ ( /*! ./decoder/barcode-decoder */ "./src/decoder/barcode-decoder.ts" ) ;
/* harmony import */ var _input _camera _access _ _WEBPACK _IMPORTED _MODULE _7 _ _ = _ _webpack _require _ _ ( /*! ./input/camera-access */ "./src/input/camera-access.ts" ) ;
/* harmony import */ var _input _frame _grabber _ _WEBPACK _IMPORTED _MODULE _8 _ _ = _ _webpack _require _ _ ( /*! ./input/frame-grabber */ "./src/input/frame-grabber.ts" ) ;
/* harmony import */ var _input _image _stream _ _WEBPACK _IMPORTED _MODULE _9 _ _ = _ _webpack _require _ _ ( /*! ./input/image-stream */ "./src/input/image-stream.ts" ) ;
/* harmony import */ var _input _live _stream _ _WEBPACK _IMPORTED _MODULE _10 _ _ = _ _webpack _require _ _ ( /*! ./input/live-stream */ "./src/input/live-stream.ts" ) ;
/* harmony import */ var _input _video _stream _ _WEBPACK _IMPORTED _MODULE _11 _ _ = _ _webpack _require _ _ ( /*! ./input/video-stream */ "./src/input/video-stream.ts" ) ;
/* harmony import */ var _input _input _stream _utils _ _WEBPACK _IMPORTED _MODULE _12 _ _ = _ _webpack _require _ _ ( /*! ./input/input-stream-utils */ "./src/input/input-stream-utils.ts" ) ;
/* harmony import */ var _locator _barcode _locator _ _WEBPACK _IMPORTED _MODULE _13 _ _ = _ _webpack _require _ _ ( /*! ./locator/barcode-locator */ "./src/locator/barcode-locator.ts" ) ;
var _inputStream ;
var _frameGrabber ;
var _stopped ;
var _canvasContainer = {
ctx : {
image : null ,
overlay : null
} ,
dom : {
image : null ,
overlay : null
}
} ;
var _inputImageWrapper ;
var _locator ;
var _boxSize ;
var _decoder ;
var _workerPool = new Array ( ) ;
var _onUIThread ;
var _resultCollector ;
var _config ;
/* harmony default export */ _ _webpack _exports _ _ [ "default" ] = ( {
init : function init ( config , cb , imageWrapper ) {
_onUIThread = true ;
_config = Object ( _common _merge _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "merge" ] ) ( _config _config _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "config" ] , config ) ;
if ( imageWrapper ) {
_onUIThread = false ;
_initializeData ( imageWrapper ) ;
cb ( ) ;
} else {
_initInputStream ( cb ) ;
}
} ,
CameraAccess : _input _camera _access _ _WEBPACK _IMPORTED _MODULE _7 _ _ [ "CameraAccess" ] ,
ImageDebug : _common _image _debug _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "ImageDebug" ] ,
ImageWrapper : _common _image _wrapper _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "ImageWrapper" ] ,
ResultCollector : _analytics _result _collector _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "ResultCollector" ] ,
get canvas ( ) {
return _canvasContainer ;
} ,
start : function start ( ) {
if ( _onUIThread && _config . inputStream . type === 'LiveStream' ) {
_startContinuousUpdate ( ) ;
} else {
_update ( ) ;
}
} ,
stop : function stop ( ) {
_stopped = true ;
_adjustWorkerPool ( 0 ) ;
if ( _config . inputStream . type === 'LiveStream' ) {
_input _camera _access _ _WEBPACK _IMPORTED _MODULE _7 _ _ [ "CameraAccess" ] . release ( ) ;
_inputStream . clearEventHandlers ( ) ;
}
} ,
decodeSingle : function decodeSingle ( config , resultCallback ) {
var _this = this ;
config = Object ( _common _merge _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "merge" ] ) ( {
inputStream : {
type : 'ImageStream' ,
sequence : false ,
size : 800 ,
src : config . src
} ,
numOfWorkers : true && config . debug ? 0 : 1 ,
locator : {
halfSample : false
}
} , config ) ;
this . init ( config , function ( ) {
_common _events _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "Events" ] . once ( 'processed' , function ( result ) {
_this . stop ( ) ;
resultCallback . call ( null , result ) ;
} , true ) ;
_this . start ( ) ;
} ) ;
} ,
pause : function pause ( ) {
_stopped = true ;
} ,
onDetected : function onDetected ( callback ) {
_common _events _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "Events" ] . subscribe ( 'detected' , callback ) ;
} ,
offDetected : function offDetected ( callback ) {
_common _events _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "Events" ] . unsubscribe ( 'detected' , callback ) ;
} ,
onProcessed : function onProcessed ( callback ) {
_common _events _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "Events" ] . subscribe ( 'processed' , callback ) ;
} ,
offProcessed : function offProcessed ( callback ) {
_common _events _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "Events" ] . unsubscribe ( 'processed' , callback ) ;
} ,
setReaders : function setReaders ( readers ) {
if ( _decoder ) {
_decoder . setReaders ( readers ) ;
} else if ( _onUIThread && _workerPool . length > 0 ) {
_workerPool . forEach ( function ( _ref ) {
var worker = _ref . worker ;
return worker . postMessage ( {
cmd : 'setReaders' ,
readers : readers
} ) ;
} ) ;
}
} ,
registerResultCollector : function registerResultCollector ( resultCollector ) {
if ( resultCollector && typeof resultCollector . addResult === 'function' ) {
_resultCollector = resultCollector ;
}
}
} ) ;
function _initializeData ( imageWrapper ) {
_initBuffers ( imageWrapper ) ;
_decoder = new _decoder _barcode _decoder _ _WEBPACK _IMPORTED _MODULE _6 _ _ [ "BarcodeDecoder" ] ( _config . decoder , _inputImageWrapper ) ;
}
function _initInputStream ( callback ) {
var video ;
if ( _config . inputStream . type === 'VideoStream' ) {
video = document . createElement ( 'video' ) ;
_inputStream = new _input _video _stream _ _WEBPACK _IMPORTED _MODULE _11 _ _ [ "VideoStream" ] ( video ) ;
} else if ( _config . inputStream . type === 'ImageStream' ) {
_inputStream = new _input _image _stream _ _WEBPACK _IMPORTED _MODULE _9 _ _ [ "ImageStream" ] ( ) ;
} else if ( _config . inputStream . type === 'LiveStream' ) {
var viewport = _getViewPort ( ) ;
if ( viewport ) {
video = viewport . querySelector ( 'video' ) ;
if ( ! video ) {
video = document . createElement ( 'video' ) ;
viewport . appendChild ( video ) ;
}
}
_inputStream = new _input _live _stream _ _WEBPACK _IMPORTED _MODULE _10 _ _ [ "LiveStream" ] ( video ) ;
_input _camera _access _ _WEBPACK _IMPORTED _MODULE _7 _ _ [ "CameraAccess" ] . request ( video , _config . inputStream . constraints ) . then ( function ( ) {
return _inputStream . trigger ( 'canrecord' ) ;
} , function ( err ) {
return callback ( err ) ;
} ) ;
}
_inputStream . setAttribute ( 'preload' , 'auto' ) ;
_inputStream . config = _config . inputStream ;
_inputStream . addEventListener ( 'canrecord' , _canRecord . bind ( this , callback ) ) ;
}
function _getViewPort ( ) {
var target = _config . inputStream . target ; // Check if target is already a DOM element
if ( target instanceof HTMLElement ) {
return target ;
} else {
// Use '#interactive.viewport' as a fallback selector (backwards compatibility)
var selector = typeof target === 'string' ? target : '#interactive.viewport' ;
return document . querySelector ( selector ) ;
}
}
function _canRecord ( cb ) {
Object ( _input _input _stream _utils _ _WEBPACK _IMPORTED _MODULE _12 _ _ [ "checkImageConstraints" ] ) ( _inputStream , _config . locator ) ;
_initCanvas ( ) ;
_frameGrabber = new _input _frame _grabber _ _WEBPACK _IMPORTED _MODULE _8 _ _ [ "FrameGrabber" ] ( _inputStream , _canvasContainer . dom . image ) ;
_adjustWorkerPool ( _config . numOfWorkers , function ( ) {
if ( _config . numOfWorkers === 0 ) {
_initializeData ( ) ;
}
_inputStream . play ( ) ;
cb ( ) ;
} ) ;
}
function _initCanvas ( ) {
if ( typeof document !== 'undefined' ) {
var viewport = _getViewPort ( ) ;
_canvasContainer . dom . image = document . querySelector ( 'canvas.imgBuffer' ) ;
if ( ! _canvasContainer . dom . image ) {
_canvasContainer . dom . image = document . createElement ( 'canvas' ) ;
_canvasContainer . dom . image . className = 'imgBuffer' ;
if ( viewport && _config . inputStream . type === 'ImageStream' ) {
viewport . appendChild ( _canvasContainer . dom . image ) ;
}
}
_canvasContainer . ctx . image = _canvasContainer . dom . image . getContext ( '2d' ) ;
_canvasContainer . dom . image . width = _inputStream . canvasWidth ;
_canvasContainer . dom . image . height = _inputStream . canvasHeight ;
_canvasContainer . dom . overlay = document . querySelector ( 'canvas.drawingBuffer' ) ;
if ( ! _canvasContainer . dom . overlay ) {
_canvasContainer . dom . overlay = document . createElement ( 'canvas' ) ;
_canvasContainer . dom . overlay . className = 'drawingBuffer' ;
if ( viewport ) {
viewport . appendChild ( _canvasContainer . dom . overlay ) ;
}
var clearFix = document . createElement ( 'br' ) ;
clearFix . setAttribute ( 'clear' , 'all' ) ;
if ( viewport ) {
viewport . appendChild ( clearFix ) ;
}
}
_canvasContainer . ctx . overlay = _canvasContainer . dom . overlay . getContext ( '2d' ) ;
_canvasContainer . dom . overlay . width = _inputStream . canvasWidth ;
_canvasContainer . dom . overlay . height = _inputStream . canvasHeight ;
}
}
function _initBuffers ( imageWrapper ) {
if ( imageWrapper ) {
_inputImageWrapper = imageWrapper ;
} else {
_inputImageWrapper = new _common _image _wrapper _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "ImageWrapper" ] ( {
x : _inputStream . width ,
y : _inputStream . height
} ) ;
}
if ( true ) {
console . log ( _inputImageWrapper . size ) ;
}
_boxSize = [ {
x : 0 ,
y : 0
} , {
x : 0 ,
y : _inputImageWrapper . size . y
} , {
x : _inputImageWrapper . size . x ,
y : _inputImageWrapper . size . y
} , {
x : _inputImageWrapper . size . x ,
y : 0
} ] ;
_locator = new _locator _barcode _locator _ _WEBPACK _IMPORTED _MODULE _13 _ _ [ "BarcodeLocator" ] ( _inputImageWrapper , _config . locator ) ;
}
function _transform ( polygon , offset ) {
polygon . forEach ( function ( vertex ) {
vertex . x += offset . x ;
vertex . y += offset . y ;
} ) ;
}
function _transformResult ( result , offset ) {
if ( result . barcodes ) {
result . barcodes . forEach ( function ( barcode ) {
return _transformResult ( barcode , offset ) ;
} ) ;
}
if ( result . line ) {
_transform ( result . line , offset ) ;
}
if ( result . box ) {
_transform ( result . box , offset ) ;
}
if ( result . boxes ) {
result . boxes . forEach ( function ( box ) {
return _transform ( box , offset ) ;
} ) ;
}
}
function _addResult ( result , imageData , canvasWidth , canvasHeight ) {
if ( imageData && _resultCollector ) {
if ( result . barcodes ) {
result . barcodes . forEach ( function ( _ref2 ) {
var codeResult = _ref2 . codeResult ;
if ( codeResult ) {
_resultCollector . addResult ( imageData , canvasWidth , canvasHeight , codeResult ) ;
}
} ) ;
} else if ( result . codeResult ) {
_resultCollector . addResult ( imageData , canvasWidth , canvasHeight , result . codeResult ) ;
}
}
}
function _hasCodeResult ( result ) {
return result && ( ! ! result . codeResult || result . barcodes && result . barcodes . some ( function ( barcode ) {
return ! ! barcode . codeResult ;
} ) ) ;
}
function _publishResult ( result , imageData ) {
var resultToPublish = result ;
if ( result && _onUIThread ) {
var offset = _inputStream . topLeft ;
if ( offset . x !== 0 || offset . y !== 0 ) {
_transformResult ( result , offset ) ;
}
_addResult ( result , imageData , _inputStream . canvasWidth , _inputStream . canvasHeight ) ;
resultToPublish = result . barcodes || result ;
}
_common _events _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "Events" ] . publish ( 'processed' , resultToPublish ) ;
if ( _hasCodeResult ( result ) ) {
_common _events _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "Events" ] . publish ( 'detected' , resultToPublish ) ;
}
}
function _locateAndDecode ( ) {
var boxes = _config . locate ? _locator . locate ( ) : [ _boxSize ] ;
var result = _decoder . decodeFromBoundingBoxes ( boxes ) ;
_publishResult ( result , _inputImageWrapper . data ) ;
}
function _update ( ) {
if ( _onUIThread ) {
if ( _workerPool . length > 0 ) {
var availableWorker = _workerPool . find ( function ( _ref3 ) {
var busy = _ref3 . busy ;
return ! busy ;
} ) ;
if ( ! availableWorker ) {
return ; // all workers are busy
}
var imageData = availableWorker . imageData ;
if ( _frameGrabber . grab ( imageData ) ) {
availableWorker . busy = true ;
availableWorker . worker . postMessage ( {
cmd : 'process' ,
imageData : imageData
} , [ imageData . buffer ] ) ;
}
} else if ( _frameGrabber . grab ( _inputImageWrapper . data ) ) {
_locateAndDecode ( ) ;
}
} else {
_locateAndDecode ( ) ;
}
}
function _startContinuousUpdate ( ) {
var delay = 1000 / ( _config . frequency || 60 ) ;
var next = null ;
_stopped = false ;
( function frame ( timestamp ) {
next = next || timestamp ;
if ( ! _stopped ) {
if ( timestamp >= next ) {
next += delay ;
_update ( ) ;
}
window . requestAnimationFrame ( frame ) ;
}
} ) ( performance . now ( ) ) ;
}
function _initWorker ( cb ) {
var blobURL = _generateWorkerBlob ( ) ;
var workerThread = {
worker : new Worker ( blobURL ) ,
imageData : new Uint8Array ( _inputStream . width * _inputStream . height ) ,
busy : true
} ;
workerThread . worker . onmessage = function ( _ref4 ) {
var data = _ref4 . data ;
if ( data . event === 'initialized' ) {
URL . revokeObjectURL ( blobURL ) ;
workerThread . busy = false ;
workerThread . imageData = new Uint8Array ( data . imageData ) ;
if ( true ) {
console . log ( 'Worker initialized' ) ;
}
cb ( workerThread ) ;
} else if ( data . event === 'processed' ) {
workerThread . busy = false ;
workerThread . imageData = new Uint8Array ( data . imageData ) ;
_publishResult ( data . result , workerThread . imageData ) ;
} else if ( data . event === 'error' ) {
if ( true ) {
console . log ( 'Worker error:' , data . message ) ;
}
}
} ;
workerThread . worker . postMessage ( {
cmd : 'init' ,
size : {
x : _inputStream . width ,
y : _inputStream . height
} ,
imageData : workerThread . imageData ,
config : Object ( _common _merge _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "merge" ] ) ( _config , {
inputStream : {
target : null
}
} )
} , [ workerThread . imageData . buffer ] ) ;
}
function _workerInterface ( factory ) {
var Quagga ;
var worker = self ;
var imageWrapper ;
if ( factory ) {
Quagga = factory ( ) [ "default" ] ;
if ( ! Quagga ) {
worker . postMessage ( {
event : 'error' ,
message : 'Quagga could not be created'
} ) ;
return ;
}
}
self . onmessage = function ( _ref5 ) {
var data = _ref5 . data ;
if ( data . cmd === 'init' ) {
var config = data . config ;
config . numOfWorkers = 0 ;
imageWrapper = new Quagga . ImageWrapper ( {
x : data . size . x ,
y : data . size . y
} , new Uint8Array ( data . imageData ) ) ;
Quagga . init ( config , function ( ) {
return worker . postMessage ( {
event : 'initialized' ,
imageData : imageWrapper . data
} , [ imageWrapper . data . buffer ] ) ;
} , imageWrapper ) ;
Quagga . onProcessed ( function ( result ) {
return worker . postMessage ( {
event : 'processed' ,
imageData : imageWrapper . data ,
result : result
} , [ imageWrapper . data . buffer ] ) ;
} ) ;
} else if ( data . cmd === 'process' ) {
imageWrapper . data = new Uint8Array ( data . imageData ) ;
Quagga . start ( ) ;
} else if ( data . cmd === 'setReaders' ) {
Quagga . setReaders ( data . readers ) ;
}
} ;
}
function _generateWorkerBlob ( ) {
// @ts-ignore
var factorySource = _ _factorySource _ _ || '' ;
var blob = new Blob ( [ "(" . concat ( _workerInterface . toString ( ) , ")(" ) . concat ( factorySource , ");" ) ] , {
type : 'text/javascript'
} ) ;
return window . URL . createObjectURL ( blob ) ;
}
function _adjustWorkerPool ( capacity , cb ) {
var increaseBy = capacity - _workerPool . length ;
if ( increaseBy > 0 ) {
for ( var i = 0 ; i < increaseBy ; i ++ ) {
_initWorker ( function ( workerThread ) {
_workerPool . push ( workerThread ) ;
if ( _workerPool . length >= capacity && cb ) {
cb ( ) ;
}
} ) ;
}
} else {
if ( increaseBy < 0 ) {
_workerPool . slice ( increaseBy ) . forEach ( function ( _ref6 ) {
var worker = _ref6 . worker ;
worker . terminate ( ) ;
if ( true ) {
console . log ( 'Worker terminated!' ) ;
}
} ) ;
_workerPool = _workerPool . slice ( 0 , increaseBy ) ;
}
return cb && cb ( ) ;
}
}
/***/ } ) ,
/***/ "./src/reader/2of5-reader.ts" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / reader / 2 of5 - reader . ts * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: TwoOfFiveReader */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "TwoOfFiveReader" , function ( ) { return TwoOfFiveReader ; } ) ;
/* harmony import */ var _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/classCallCheck */ "../../node_modules/@babel/runtime/helpers/classCallCheck.js" ) ;
/* harmony import */ var _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/createClass */ "../../node_modules/@babel/runtime/helpers/createClass.js" ) ;
/* harmony import */ var _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/possibleConstructorReturn */ "../../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js" ) ;
/* harmony import */ var _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _2 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/getPrototypeOf */ "../../node_modules/@babel/runtime/helpers/getPrototypeOf.js" ) ;
/* harmony import */ var _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _3 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _3 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _assertThisInitialized _ _WEBPACK _IMPORTED _MODULE _4 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/assertThisInitialized */ "../../node_modules/@babel/runtime/helpers/assertThisInitialized.js" ) ;
/* harmony import */ var _babel _runtime _helpers _assertThisInitialized _ _WEBPACK _IMPORTED _MODULE _4 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _assertThisInitialized _ _WEBPACK _IMPORTED _MODULE _4 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _5 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/inherits */ "../../node_modules/@babel/runtime/helpers/inherits.js" ) ;
/* harmony import */ var _babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _5 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _5 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _6 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/defineProperty */ "../../node_modules/@babel/runtime/helpers/defineProperty.js" ) ;
/* harmony import */ var _babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _6 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _6 _ _ ) ;
/* harmony import */ var _barcode _reader _ _WEBPACK _IMPORTED _MODULE _7 _ _ = _ _webpack _require _ _ ( /*! ./barcode-reader */ "./src/reader/barcode-reader.ts" ) ;
var N = 1 ;
var W = 3 ;
var START _PATTERN = [ W , N , W , N , N , N ] ;
var STOP _PATTERN = [ W , N , N , N , W ] ;
var CODE _PATTERN = [ [ N , N , W , W , N ] , [ W , N , N , N , W ] , [ N , W , N , N , W ] , [ W , W , N , N , N ] , [ N , N , W , N , W ] , [ W , N , W , N , N ] , [ N , W , W , N , N ] , [ N , N , N , W , W ] , [ W , N , N , W , N ] , [ N , W , N , W , N ] ] ;
var startPatternLength = START _PATTERN . reduce ( function ( sum , val ) {
return sum + val ;
} , 0 ) ;
var TwoOfFiveReader =
/*#__PURE__*/
function ( _BarcodeReader ) {
_babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _5 _ _ _default ( ) ( TwoOfFiveReader , _BarcodeReader ) ;
function TwoOfFiveReader ( config ) {
var _this ;
_babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default ( ) ( this , TwoOfFiveReader ) ;
_this = _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _3 _ _ _default ( ) ( TwoOfFiveReader ) . call ( this , config ) ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _6 _ _ _default ( ) ( _babel _runtime _helpers _assertThisInitialized _ _WEBPACK _IMPORTED _MODULE _4 _ _ _default ( ) ( _this ) , "_barSpaceRatio" , void 0 ) ;
_this . _barSpaceRatio = [ 1 , 1 ] ;
_this . _format = '2of5' ;
_this . _singleCodeError = 0.78 ;
_this . _averageCodeError = 0.30 ;
return _this ;
}
_babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default ( ) ( TwoOfFiveReader , [ {
key : "decode" ,
value : function decode ( ) {
var startInfo = this . _findStart ( ) ;
if ( ! startInfo ) {
return null ;
}
var endInfo = this . _findEnd ( ) ;
if ( ! endInfo ) {
return null ;
}
var counters = this . _fillCounters ( startInfo . end , endInfo . start , 0 ) ;
if ( counters . length % 10 !== 0 ) {
return null ;
}
var result = new Array ( ) ;
var decodedCodes = new Array ( ) ;
decodedCodes . push ( startInfo ) ;
var code = this . _decodePayload ( counters , result , decodedCodes ) ;
if ( ! code || result . length < 5 ) {
return null ;
}
decodedCodes . push ( endInfo ) ;
return {
code : result . join ( '' ) ,
start : startInfo . start ,
end : endInfo . end ,
startInfo : startInfo ,
decodedCodes : decodedCodes
} ;
}
} , {
key : "_findStart" ,
value : function _findStart ( ) {
var offset = this . _nextSet ( this . _row ) ;
var narrowBarWidth = 1 ;
var startInfo ;
while ( ! startInfo ) {
startInfo = this . _findPattern ( START _PATTERN , offset , 0 , true ) ;
if ( ! startInfo ) {
return null ;
}
narrowBarWidth = ( startInfo . end - startInfo . start ) / startPatternLength | 0 ;
var leadingWhitespaceStart = startInfo . start - narrowBarWidth * 5 ;
if ( leadingWhitespaceStart >= 0 ) {
if ( this . _matchRange ( leadingWhitespaceStart , startInfo . start , 0 ) ) {
return startInfo ;
}
}
offset = startInfo . end ;
startInfo = null ;
}
return null ;
}
} , {
key : "_verifyTrailingWhitespace" ,
value : function _verifyTrailingWhitespace ( endInfo ) {
var trailingWhitespaceEnd = endInfo . end + ( endInfo . end - endInfo . start ) / 2 ;
if ( trailingWhitespaceEnd < this . _row . length ) {
if ( this . _matchRange ( endInfo . end , trailingWhitespaceEnd , 0 ) ) {
return endInfo ;
}
}
return null ;
}
} , {
key : "_findEnd" ,
value : function _findEnd ( ) {
this . _row . reverse ( ) ;
var offset = this . _nextSet ( this . _row ) ;
var endInfo = this . _findPattern ( STOP _PATTERN , offset , 0 , true ) ;
this . _row . reverse ( ) ;
if ( endInfo === null ) {
return null ;
} // reverse numbers
var start = endInfo . start ;
endInfo . start = this . _row . length - endInfo . end ;
endInfo . end = this . _row . length - start ;
return endInfo !== null ? this . _verifyTrailingWhitespace ( endInfo ) : null ;
}
} , {
key : "_decodeCode" ,
value : function _decodeCode ( counter ) {
var bestMatch = {
error : Number . MAX _VALUE ,
code : - 1 ,
start : 0 ,
end : 0
} ;
for ( var code = 0 ; code < CODE _PATTERN . length ; code ++ ) {
var error = this . _matchPattern ( counter , CODE _PATTERN [ code ] ) ;
if ( error < bestMatch . error ) {
bestMatch . code = code ;
bestMatch . error = error ;
}
}
return bestMatch . error < this . AVERAGE _CODE _ERROR ? bestMatch : null ;
}
} , {
key : "_decodePayload" ,
value : function _decodePayload ( counters , result , decodedCodes ) {
var counterLength = counters . length ;
var counter = [ 0 , 0 , 0 , 0 , 0 ] ;
var pos = 0 ;
var code ;
while ( pos < counterLength ) {
for ( var i = 0 ; i < 5 ; i ++ ) {
counter [ i ] = counters [ pos ] * this . _barSpaceRatio [ 0 ] ;
pos += 2 ;
}
code = this . _decodeCode ( counter ) ;
if ( ! code ) {
return null ;
}
result . push ( code . code ) ;
decodedCodes . push ( code ) ;
}
return code ;
}
} ] ) ;
return TwoOfFiveReader ;
} ( _barcode _reader _ _WEBPACK _IMPORTED _MODULE _7 _ _ [ "BarcodeReader" ] ) ;
/***/ } ) ,
/***/ "./src/reader/barcode-reader.ts" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / reader / barcode - reader . ts * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: BarcodeDirection, BarcodeReader */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "BarcodeDirection" , function ( ) { return BarcodeDirection ; } ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "BarcodeReader" , function ( ) { return BarcodeReader ; } ) ;
/* harmony import */ var _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/classCallCheck */ "../../node_modules/@babel/runtime/helpers/classCallCheck.js" ) ;
/* harmony import */ var _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/createClass */ "../../node_modules/@babel/runtime/helpers/createClass.js" ) ;
/* harmony import */ var _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/defineProperty */ "../../node_modules/@babel/runtime/helpers/defineProperty.js" ) ;
/* harmony import */ var _babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ ) ;
var BarcodeDirection ;
( function ( BarcodeDirection ) {
BarcodeDirection [ BarcodeDirection [ "Forward" ] = 1 ] = "Forward" ;
BarcodeDirection [ BarcodeDirection [ "Reverse" ] = - 1 ] = "Reverse" ;
} ) ( BarcodeDirection || ( BarcodeDirection = { } ) ) ;
;
var BarcodeReader =
/*#__PURE__*/
function ( ) {
_babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default ( ) ( BarcodeReader , [ {
key : "SINGLE_CODE_ERROR" ,
get : function get ( ) {
return this . _singleCodeError ;
}
} , {
key : "AVERAGE_CODE_ERROR" ,
get : function get ( ) {
return this . _averageCodeError ;
}
} , {
key : "FORMAT" ,
get : function get ( ) {
return this . _format ;
}
} ] , [ {
key : "Exception" ,
get : function get ( ) {
return {
StartNotFoundException : 'Start-Info was not found!' ,
CodeNotFoundException : 'Code could not be found!' ,
PatternNotFoundException : 'Pattern could not be found!'
} ;
}
} ] ) ;
function BarcodeReader ( config , supplements ) {
_babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default ( ) ( this , BarcodeReader ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , "_singleCodeError" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , "_averageCodeError" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , "_format" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , "_row" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , "config" , void 0 ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , "supplements" , void 0 ) ;
this . _format = 'unknown' ;
this . _row = [ ] ;
this . config = config || { } ;
this . supplements = supplements ;
}
_babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default ( ) ( BarcodeReader , [ {
key : "_findPattern" ,
value : function _findPattern ( pattern , offset , isWhite , tryHarder ) {
var counter = new Array ( pattern . length ) ;
var bestMatch = {
error : Number . MAX _VALUE ,
code : - 1 ,
start : 0 ,
end : 0
} ;
var epsilon = this . AVERAGE _CODE _ERROR ;
var counterPos = 0 ;
if ( ! offset ) {
offset = this . _nextSet ( this . _row ) ;
}
counter . fill ( 0 ) ;
for ( var i = offset ; i < this . _row . length ; i ++ ) {
if ( this . _row [ i ] ^ isWhite ) {
counter [ counterPos ] ++ ;
} else {
if ( counterPos === counter . length - 1 ) {
var error = this . _matchPattern ( counter , pattern ) ;
if ( error < epsilon ) {
bestMatch . error = error ;
bestMatch . start = i - counter . reduce ( function ( sum , value ) {
return sum + value ;
} , 0 ) ;
bestMatch . end = i ;
return bestMatch ;
}
if ( tryHarder ) {
for ( var j = 0 ; j < counter . length - 2 ; j ++ ) {
counter [ j ] = counter [ j + 2 ] ;
}
counter [ counter . length - 2 ] = 0 ;
counter [ counter . length - 1 ] = 0 ;
counterPos -- ;
} else {
return null ;
}
} else {
counterPos ++ ;
}
counter [ counterPos ] = 1 ;
isWhite = isWhite ? 0 : 1 ;
}
}
return null ;
}
} , {
key : "_nextUnset" ,
value : function _nextUnset ( line , start ) {
for ( var i = start || 0 ; i < line . length ; i ++ ) {
if ( ! line [ i ] ) {
return i ;
}
}
return line . length ;
}
} , {
key : "_nextSet" ,
value : function _nextSet ( line , start ) {
for ( var i = start || 0 ; i < line . length ; i ++ ) {
if ( line [ i ] ) {
return i ;
}
}
return line . length ;
}
} , {
key : "_matchRange" ,
value : function _matchRange ( start , end , value ) {
for ( var i = start < 0 ? 0 : start ; i < end ; i ++ ) {
if ( this . _row [ i ] !== value ) {
return false ;
}
}
return true ;
}
} , {
key : "_matchPattern" ,
value : function _matchPattern ( counter , code , maxSingleError ) {
var error = 0 ;
var sum = 0 ;
var modulo = 0 ;
maxSingleError = maxSingleError || this . SINGLE _CODE _ERROR || 1 ;
for ( var i = 0 ; i < counter . length ; i ++ ) {
sum += counter [ i ] ;
modulo += code [ i ] ;
}
if ( sum < modulo ) {
return Number . MAX _VALUE ;
}
var barWidth = sum / modulo ;
maxSingleError *= barWidth ;
for ( var _i = 0 ; _i < counter . length ; _i ++ ) {
var count = counter [ _i ] ;
var scaled = code [ _i ] * barWidth ;
var singleError = Math . abs ( count - scaled ) / scaled ;
if ( singleError > maxSingleError ) {
return Number . MAX _VALUE ;
}
error += singleError ;
}
return error / modulo ;
}
} , {
key : "_correctBars" ,
value : function _correctBars ( counter , correction , indices ) {
var length = indices . length ;
var tmp = 0 ;
while ( length -- ) {
tmp = counter [ indices [ length ] ] * ( 1 - ( 1 - correction ) / 2 ) ;
if ( tmp > 1 ) {
counter [ indices [ length ] ] = tmp ;
}
}
}
} , {
key : "decodePattern" ,
value : function decodePattern ( pattern ) {
this . _row = pattern ;
var result = this . decode ( ) ;
if ( result === null ) {
this . _row . reverse ( ) ;
result = this . decode ( ) ;
if ( result ) {
result . direction = BarcodeDirection . Reverse ;
result . start = this . _row . length - result . start ;
result . end = this . _row . length - result . end ;
}
} else {
result . direction = BarcodeDirection . Forward ;
}
if ( result ) {
result . format = this . FORMAT ;
}
return result ;
}
} , {
key : "_fillCounters" ,
value : function _fillCounters ( offset , end , isWhite ) {
var counters = new Array ( ) ;
var counterPos = 0 ;
counters [ counterPos ] = 0 ;
for ( var i = offset ; i < end ; i ++ ) {
if ( this . _row [ i ] ^ isWhite ) {
counters [ counterPos ] ++ ;
} else {
counterPos ++ ;
counters [ counterPos ] = 1 ;
isWhite = isWhite ? 0 : 1 ;
}
}
return counters ;
}
} , {
key : "_toCounters" ,
value : function _toCounters ( start , counters ) {
var numCounters = counters . length ;
var end = this . _row . length ;
var isWhite = this . _row [ start ] ? 0 : 1 ;
var counterPos = 0 ;
counters . fill ( 0 ) ;
for ( var i = start ; i < end ; i ++ ) {
if ( this . _row [ i ] ^ isWhite ) {
counters [ counterPos ] ++ ;
} else {
counterPos ++ ;
if ( counterPos === numCounters ) {
break ;
} else {
counters [ counterPos ] = 1 ;
isWhite = isWhite ? 0 : 1 ;
}
}
}
return counters ;
}
} ] ) ;
return BarcodeReader ;
} ( ) ;
/***/ } ) ,
/***/ "./src/reader/codabar-reader.ts" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / reader / codabar - reader . ts * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: CodabarReader */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "CodabarReader" , function ( ) { return CodabarReader ; } ) ;
/* harmony import */ var _babel _runtime _helpers _typeof _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/typeof */ "../../node_modules/@babel/runtime/helpers/typeof.js" ) ;
/* harmony import */ var _babel _runtime _helpers _typeof _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _typeof _ _WEBPACK _IMPORTED _MODULE _0 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/classCallCheck */ "../../node_modules/@babel/runtime/helpers/classCallCheck.js" ) ;
/* harmony import */ var _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _1 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/createClass */ "../../node_modules/@babel/runtime/helpers/createClass.js" ) ;
/* harmony import */ var _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _2 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/possibleConstructorReturn */ "../../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js" ) ;
/* harmony import */ var _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _3 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _3 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _4 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/getPrototypeOf */ "../../node_modules/@babel/runtime/helpers/getPrototypeOf.js" ) ;
/* harmony import */ var _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _4 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _4 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _assertThisInitialized _ _WEBPACK _IMPORTED _MODULE _5 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/assertThisInitialized */ "../../node_modules/@babel/runtime/helpers/assertThisInitialized.js" ) ;
/* harmony import */ var _babel _runtime _helpers _assertThisInitialized _ _WEBPACK _IMPORTED _MODULE _5 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _assertThisInitialized _ _WEBPACK _IMPORTED _MODULE _5 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _6 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/inherits */ "../../node_modules/@babel/runtime/helpers/inherits.js" ) ;
/* harmony import */ var _babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _6 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _6 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _7 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/defineProperty */ "../../node_modules/@babel/runtime/helpers/defineProperty.js" ) ;
/* harmony import */ var _babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _7 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _7 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _toConsumableArray _ _WEBPACK _IMPORTED _MODULE _8 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/toConsumableArray */ "../../node_modules/@babel/runtime/helpers/toConsumableArray.js" ) ;
/* harmony import */ var _babel _runtime _helpers _toConsumableArray _ _WEBPACK _IMPORTED _MODULE _8 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _toConsumableArray _ _WEBPACK _IMPORTED _MODULE _8 _ _ ) ;
/* harmony import */ var _barcode _reader _ _WEBPACK _IMPORTED _MODULE _9 _ _ = _ _webpack _require _ _ ( /*! ./barcode-reader */ "./src/reader/barcode-reader.ts" ) ;
var ALPHABETH _STRING = '0123456789-$:/.+ABCD' ;
var ALPHABET = _babel _runtime _helpers _toConsumableArray _ _WEBPACK _IMPORTED _MODULE _8 _ _ _default ( ) ( ALPHABETH _STRING ) . map ( function ( _char ) {
return _char . charCodeAt ( 0 ) ;
} ) ; // const ALPHABET = [48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 45, 36, 58, 47, 46, 43, 65, 66, 67, 68];
var CHARACTER _ENCODINGS = [ 0x003 , 0x006 , 0x009 , 0x060 , 0x012 , 0x042 , 0x021 , 0x024 , 0x030 , 0x048 , 0x00c , 0x018 , 0x045 , 0x051 , 0x054 , 0x015 , 0x01A , 0x029 , 0x00B , 0x00E ] ;
var START _END = [ 0x01A , 0x029 , 0x00B , 0x00E ] ;
var MIN _ENCODED _CHARS = 4 ;
var MAX _ACCEPTABLE = 2.0 ;
var PADDING = 1.5 ;
var CodabarReader =
/*#__PURE__*/
function ( _BarcodeReader ) {
_babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _6 _ _ _default ( ) ( CodabarReader , _BarcodeReader ) ;
function CodabarReader ( ) {
var _this ;
_babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default ( ) ( this , CodabarReader ) ;
_this = _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _3 _ _ _default ( ) ( this , _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _4 _ _ _default ( ) ( CodabarReader ) . call ( this ) ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _7 _ _ _default ( ) ( _babel _runtime _helpers _assertThisInitialized _ _WEBPACK _IMPORTED _MODULE _5 _ _ _default ( ) ( _this ) , "_counters" , void 0 ) ;
_this . _format = 'codabar' ;
_this . _counters = [ ] ;
return _this ;
}
_babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( CodabarReader , [ {
key : "decode" ,
value : function decode ( ) {
this . _counters = this . _fillCounters ( this . _nextUnset ( this . _row ) , this . _row . length , 1 ) ;
var start = this . _findStart ( ) ;
if ( ! start ) {
return null ;
}
var result = new Array ( ) ;
var nextStart = start . startCounter ;
var pattern ;
do {
pattern = this . _toPattern ( nextStart ) ;
if ( pattern < 0 ) {
return null ;
}
var decodedChar = this . _patternToChar ( pattern ) ;
if ( decodedChar === null ) {
return null ;
}
result . push ( decodedChar ) ;
nextStart += 8 ;
if ( result . length > 1 && START _END . some ( function ( code ) {
return code === pattern ;
} ) ) {
break ;
}
} while ( nextStart < this . _counters . length ) ; // verify end
if ( result . length - 2 < MIN _ENCODED _CHARS || ! START _END . some ( function ( code ) {
return code === pattern ;
} ) ) {
return null ;
} // verify end white space
if ( ! this . _verifyWhitespace ( start . startCounter , nextStart - 8 ) ) {
return null ;
}
if ( ! this . _validateResult ( result , start . startCounter ) ) {
return null ;
}
nextStart = nextStart > this . _counters . length ? this . _counters . length : nextStart ;
var end = start . start + this . _sumCounters ( start . startCounter , nextStart - 8 ) ;
return {
code : result . join ( '' ) ,
start : start . start ,
end : end ,
startInfo : start ,
decodedCodes : result
} ;
}
} , {
key : "_verifyWhitespace" ,
value : function _verifyWhitespace ( startCounter , endCounter ) {
if ( startCounter - 1 <= 0 || this . _counters [ startCounter - 1 ] >= this . _calculatePatternLength ( startCounter ) / 2.0 ) {
if ( endCounter + 8 >= this . _counters . length || this . _counters [ endCounter + 7 ] >= this . _calculatePatternLength ( endCounter ) / 2.0 ) {
return true ;
}
}
return false ;
}
} , {
key : "_calculatePatternLength" ,
value : function _calculatePatternLength ( offset ) {
var sum = 0 ;
for ( var i = offset ; i < offset + 7 ; i ++ ) {
sum += this . _counters [ i ] ;
}
return sum ;
}
} , {
key : "_thresholdResultPattern" ,
value : function _thresholdResultPattern ( result , startCounter ) {
var categorization = {
space : {
narrow : {
size : 0 ,
counts : 0 ,
min : 0 ,
max : Number . MAX _VALUE
} ,
wide : {
size : 0 ,
counts : 0 ,
min : 0 ,
max : Number . MAX _VALUE
}
} ,
bar : {
narrow : {
size : 0 ,
counts : 0 ,
min : 0 ,
max : Number . MAX _VALUE
} ,
wide : {
size : 0 ,
counts : 0 ,
min : 0 ,
max : Number . MAX _VALUE
}
}
} ;
var pos = startCounter ;
for ( var i = 0 ; i < result . length ; i ++ ) {
var pattern = this . _charToPattern ( result [ i ] ) ;
for ( var j = 6 ; j >= 0 ; j -- ) {
var kind = ( j & 1 ) === 2 ? categorization . bar : categorization . space ;
var cat = ( pattern & 1 ) === 1 ? kind . wide : kind . narrow ;
cat . size += this . _counters [ pos + j ] ;
cat . counts ++ ;
pattern >>= 1 ;
}
pos += 8 ;
}
[ 'space' , 'bar' ] . forEach ( function ( key ) {
var kind = categorization [ key ] ;
kind . wide . min = Math . floor ( ( kind . narrow . size / kind . narrow . counts + kind . wide . size / kind . wide . counts ) / 2 ) ;
kind . narrow . max = Math . ceil ( kind . wide . min ) ;
kind . wide . max = Math . ceil ( ( kind . wide . size * MAX _ACCEPTABLE + PADDING ) / kind . wide . counts ) ;
} ) ;
return categorization ;
}
} , {
key : "_charToPattern" ,
value : function _charToPattern ( _char2 ) {
var charCode = _char2 . charCodeAt ( 0 ) ;
for ( var i = 0 ; i < ALPHABET . length ; i ++ ) {
if ( ALPHABET [ i ] === charCode ) {
return CHARACTER _ENCODINGS [ i ] ;
}
}
return 0x0 ;
}
} , {
key : "_validateResult" ,
value : function _validateResult ( result , startCounter ) {
var threshold = this . _thresholdResultPattern ( result , startCounter ) ;
var pos = startCounter ;
for ( var i = 0 ; i < result . length ; i ++ ) {
var pattern = this . _charToPattern ( result [ i ] ) ;
for ( var j = 6 ; j >= 0 ; j -- ) {
var kind = ( j & 1 ) === 0 ? threshold . bar : threshold . space ;
var cat = ( pattern & 1 ) === 1 ? kind . wide : kind . narrow ;
var size = this . _counters [ pos + j ] ;
if ( size < cat . min || size > cat . max ) {
return false ;
}
pattern >>= 1 ;
}
pos += 8 ;
}
return true ;
}
} , {
key : "_patternToChar" ,
value : function _patternToChar ( pattern ) {
for ( var i = 0 ; i < CHARACTER _ENCODINGS . length ; i ++ ) {
if ( CHARACTER _ENCODINGS [ i ] === pattern ) {
return String . fromCharCode ( ALPHABET [ i ] ) ;
}
}
return null ;
}
} , {
key : "_computeAlternatingThreshold" ,
value : function _computeAlternatingThreshold ( offset , end ) {
var min = Number . MAX _VALUE ;
var max = 0 ;
for ( var i = offset ; i < end ; i += 2 ) {
var counter = this . _counters [ i ] ;
if ( counter > max ) {
max = counter ;
}
if ( counter < min ) {
min = counter ;
}
}
return ( min + max ) / 2.0 | 0 ;
}
} , {
key : "_toPattern" ,
value : function _toPattern ( offset ) {
var numCounters = 7 ;
var end = offset + numCounters ;
if ( end > this . _counters . length ) {
return - 1 ;
}
var barThreshold = this . _computeAlternatingThreshold ( offset , end ) ;
var spaceThreshold = this . _computeAlternatingThreshold ( offset + 1 , end ) ;
var bitmask = 1 << numCounters - 1 ;
var pattern = 0 ;
for ( var i = 0 ; i < numCounters ; i ++ ) {
var threshold = ( i & 1 ) === 0 ? barThreshold : spaceThreshold ;
if ( this . _counters [ offset + i ] > threshold ) {
pattern |= bitmask ;
}
bitmask >>= 1 ;
}
return pattern ;
}
} , {
key : "_sumCounters" ,
value : function _sumCounters ( start , end ) {
var sum = 0 ;
for ( var i = start ; i < end ; i ++ ) {
sum += this . _counters [ i ] ;
}
return sum ;
}
} , {
key : "_findStart" ,
value : function _findStart ( ) {
var _this2 = this ;
var start = this . _nextUnset ( this . _row ) ;
var _loop = function _loop ( i ) {
var pattern = _this2 . _toPattern ( i ) ;
if ( pattern !== - 1 && START _END . some ( function ( code ) {
return code === pattern ;
} ) ) {
// TODO: Look for whitespace ahead
start += _this2 . _sumCounters ( 0 , i ) ;
var end = start + _this2 . _sumCounters ( i , i + 8 ) ;
return {
v : {
start : start ,
end : end ,
startCounter : i ,
endCounter : i + 8
}
} ;
}
} ;
for ( var i = 1 ; i < this . _counters . length ; i ++ ) {
var _ret = _loop ( i ) ;
if ( _babel _runtime _helpers _typeof _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default ( ) ( _ret ) === "object" ) return _ret . v ;
}
return null ;
}
} ] ) ;
return CodabarReader ;
} ( _barcode _reader _ _WEBPACK _IMPORTED _MODULE _9 _ _ [ "BarcodeReader" ] ) ;
/***/ } ) ,
/***/ "./src/reader/code-128-reader.ts" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / reader / code - 128 - reader . ts * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: Code128Reader */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "Code128Reader" , function ( ) { return Code128Reader ; } ) ;
/* harmony import */ var _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/classCallCheck */ "../../node_modules/@babel/runtime/helpers/classCallCheck.js" ) ;
/* harmony import */ var _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/createClass */ "../../node_modules/@babel/runtime/helpers/createClass.js" ) ;
/* harmony import */ var _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/possibleConstructorReturn */ "../../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js" ) ;
/* harmony import */ var _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _2 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/getPrototypeOf */ "../../node_modules/@babel/runtime/helpers/getPrototypeOf.js" ) ;
/* harmony import */ var _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _3 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _3 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _4 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/inherits */ "../../node_modules/@babel/runtime/helpers/inherits.js" ) ;
/* harmony import */ var _babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _4 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _4 _ _ ) ;
/* harmony import */ var _barcode _reader _ _WEBPACK _IMPORTED _MODULE _5 _ _ = _ _webpack _require _ _ ( /*! ./barcode-reader */ "./src/reader/barcode-reader.ts" ) ;
var CODE _SHIFT = 98 ;
var CODE _C = 99 ;
var CODE _B = 100 ;
var CODE _A = 101 ;
var START _CODE _A = 103 ;
var START _CODE _B = 104 ;
var START _CODE _C = 105 ;
var STOP _CODE = 106 ;
var CODE _PATTERN = [ [ 2 , 1 , 2 , 2 , 2 , 2 ] , [ 2 , 2 , 2 , 1 , 2 , 2 ] , [ 2 , 2 , 2 , 2 , 2 , 1 ] , [ 1 , 2 , 1 , 2 , 2 , 3 ] , [ 1 , 2 , 1 , 3 , 2 , 2 ] , [ 1 , 3 , 1 , 2 , 2 , 2 ] , [ 1 , 2 , 2 , 2 , 1 , 3 ] , [ 1 , 2 , 2 , 3 , 1 , 2 ] , [ 1 , 3 , 2 , 2 , 1 , 2 ] , [ 2 , 2 , 1 , 2 , 1 , 3 ] , [ 2 , 2 , 1 , 3 , 1 , 2 ] , [ 2 , 3 , 1 , 2 , 1 , 2 ] , [ 1 , 1 , 2 , 2 , 3 , 2 ] , [ 1 , 2 , 2 , 1 , 3 , 2 ] , [ 1 , 2 , 2 , 2 , 3 , 1 ] , [ 1 , 1 , 3 , 2 , 2 , 2 ] , [ 1 , 2 , 3 , 1 , 2 , 2 ] , [ 1 , 2 , 3 , 2 , 2 , 1 ] , [ 2 , 2 , 3 , 2 , 1 , 1 ] , [ 2 , 2 , 1 , 1 , 3 , 2 ] , [ 2 , 2 , 1 , 2 , 3 , 1 ] , [ 2 , 1 , 3 , 2 , 1 , 2 ] , [ 2 , 2 , 3 , 1 , 1 , 2 ] , [ 3 , 1 , 2 , 1 , 3 , 1 ] , [ 3 , 1 , 1 , 2 , 2 , 2 ] , [ 3 , 2 , 1 , 1 , 2 , 2 ] , [ 3 , 2 , 1 , 2 , 2 , 1 ] , [ 3 , 1 , 2 , 2 , 1 , 2 ] , [ 3 , 2 , 2 , 1 , 1 , 2 ] , [ 3 , 2 , 2 , 2 , 1 , 1 ] , [ 2 , 1 , 2 , 1 , 2 , 3 ] , [ 2 , 1 , 2 , 3 , 2 , 1 ] , [ 2 , 3 , 2 , 1 , 2 , 1 ] , [ 1 , 1 , 1 , 3 , 2 , 3 ] , [ 1 , 3 , 1 , 1 , 2 , 3 ] , [ 1 , 3 , 1 , 3 , 2 , 1 ] , [ 1 , 1 , 2 , 3 , 1 , 3 ] , [ 1 , 3 , 2 , 1 , 1 , 3 ] , [ 1 , 3 , 2 , 3 , 1 , 1 ] , [ 2 , 1 , 1 , 3 , 1 , 3 ] , [ 2 , 3 , 1 , 1 , 1 , 3 ] , [ 2 , 3 , 1 , 3 , 1 , 1 ] , [ 1 , 1 , 2 , 1 , 3 , 3 ] , [ 1 , 1 , 2 , 3 , 3 , 1 ] , [ 1 , 3 , 2 , 1 , 3 , 1 ] , [ 1 , 1 , 3 , 1 , 2 , 3 ] , [ 1 , 1 , 3 , 3 , 2 , 1 ] , [ 1 , 3 , 3 , 1 , 2 , 1 ] , [ 3 , 1 , 3 , 1 , 2 , 1 ] , [ 2 , 1 , 1 , 3 , 3 , 1 ] , [ 2 , 3 , 1 , 1 , 3 , 1 ] , [ 2 , 1 , 3 , 1 , 1 , 3 ] , [ 2 , 1 , 3 , 3 , 1 , 1 ] , [ 2 , 1 , 3 , 1 , 3 , 1 ] , [ 3 , 1 , 1 , 1 , 2 , 3 ] , [ 3 , 1 , 1 , 3 , 2 , 1 ] , [ 3 , 3 , 1 , 1 , 2 , 1 ] , [ 3 , 1 , 2 , 1 , 1 , 3 ] , [ 3 , 1 , 2 , 3 , 1 , 1 ] , [ 3 , 3 , 2 , 1 , 1 , 1 ] , [ 3 , 1 , 4 , 1 , 1 , 1 ] , [ 2 , 2 , 1 , 4 , 1 , 1 ] , [ 4 , 3 , 1 , 1 , 1 , 1 ] , [ 1 , 1 , 1 , 2 , 2 , 4 ] , [ 1 , 1 , 1 , 4 , 2 , 2 ] , [ 1 , 2 , 1 , 1 , 2 , 4 ] , [ 1 , 2 , 1 , 4 , 2 , 1 ] , [ 1 , 4 , 1 , 1 , 2 , 2 ] , [ 1 , 4 , 1 , 2 , 2 , 1 ] , [ 1 , 1 , 2 , 2 , 1 , 4 ] , [ 1 , 1 , 2 , 4 , 1 , 2 ] , [ 1 , 2 , 2 , 1 , 1 , 4 ] , [ 1 , 2 , 2 , 4 , 1 , 1 ] , [ 1 , 4 , 2 , 1 , 1 , 2 ] , [ 1 , 4 , 2 , 2 , 1 , 1 ] , [ 2 , 4 , 1 , 2 , 1 , 1 ] , [ 2 , 2 , 1 , 1 , 1 , 4 ] , [ 4 , 1 , 3 , 1 , 1 , 1 ] , [ 2 , 4 , 1 , 1 , 1 , 2 ] , [ 1 , 3 , 4 , 1 , 1 , 1 ] , [ 1 , 1 , 1 , 2 , 4 , 2 ] , [ 1 , 2 , 1 , 1 , 4 , 2 ] , [ 1 , 2 , 1 , 2 , 4 , 1 ] , [ 1 , 1 , 4 , 2 , 1 , 2 ] , [ 1 , 2 , 4 , 1 , 1 , 2 ] , [ 1 , 2 , 4 , 2 , 1 , 1 ] , [ 4 , 1 , 1 , 2 , 1 , 2 ] , [ 4 , 2 , 1 , 1 , 1 , 2 ] , [ 4 , 2 , 1 , 2 , 1 , 1 ] , [ 2 , 1 , 2 , 1 , 4 , 1 ] , [ 2 , 1 , 4 , 1 , 2 , 1 ] , [ 4 , 1 , 2 , 1 , 2 , 1 ] , [ 1 , 1 , 1 , 1 , 4 , 3 ] , [ 1 , 1 , 1 , 3 , 4 , 1 ] , [ 1 , 3 , 1 , 1 , 4 , 1 ] , [ 1 , 1 , 4 , 1 , 1 , 3 ] , [ 1 , 1 , 4 , 3 , 1 , 1 ] , [ 4 , 1 , 1 , 1 , 1 , 3 ] , [ 4 , 1 , 1 , 3 , 1 , 1 ] , [ 1 , 1 , 3 , 1 , 4 , 1 ] , [ 1 , 1 , 4 , 1 , 3 , 1 ] , [ 3 , 1 , 1 , 1 , 4 , 1 ] , [ 4 , 1 , 1 , 1 , 3 , 1 ] , [ 2 , 1 , 1 , 4 , 1 , 2 ] , [ 2 , 1 , 1 , 2 , 1 , 4 ] , [ 2 , 1 , 1 , 2 , 3 , 2 ] , [ 2 , 3 , 3 , 1 , 1 , 1 , 2 ] ] ;
var MODULE _INDICES = {
bar : [ 0 , 2 , 4 ] ,
space : [ 1 , 3 , 5 ]
} ;
var Code128Reader =
/*#__PURE__*/
function ( _BarcodeReader ) {
_babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _4 _ _ _default ( ) ( Code128Reader , _BarcodeReader ) ;
function Code128Reader ( ) {
var _this ;
_babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default ( ) ( this , Code128Reader ) ;
_this = _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _3 _ _ _default ( ) ( Code128Reader ) . call ( this ) ) ;
_this . _format = 'code_128' ;
_this . _singleCodeError = 0.64 ;
_this . _averageCodeError = 0.30 ;
return _this ;
}
_babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default ( ) ( Code128Reader , [ {
key : "_decodeCode" ,
value : function _decodeCode ( start , correction ) {
var counter = [ 0 , 0 , 0 , 0 , 0 , 0 ] ;
var offset = start ;
var bestMatch = {
error : Number . MAX _VALUE ,
code : - 1 ,
start : start ,
end : start ,
correction : {
bar : 1 ,
space : 1
}
} ;
var epsilon = this . AVERAGE _CODE _ERROR ;
var isWhite = this . _row [ offset ] ? 0 : 1 ;
var counterPos = 0 ;
for ( var i = offset ; i < this . _row . length ; i ++ ) {
if ( this . _row [ i ] ^ isWhite ) {
counter [ counterPos ] ++ ;
} else {
if ( counterPos === counter . length - 1 ) {
if ( correction ) {
this . _correct ( counter , correction ) ;
}
for ( var code = 0 ; code < CODE _PATTERN . length ; code ++ ) {
var error = this . _matchPattern ( counter , CODE _PATTERN [ code ] ) ;
if ( error < bestMatch . error ) {
bestMatch . code = code ;
bestMatch . error = error ;
}
}
bestMatch . end = i ;
if ( bestMatch . code === - 1 || bestMatch . error > epsilon ) {
return null ;
}
var expected = CODE _PATTERN [ bestMatch . code ] ;
if ( expected ) {
bestMatch . correction . bar = this . _calculateCorrection ( expected , counter , MODULE _INDICES . bar ) ;
bestMatch . correction . space = this . _calculateCorrection ( expected , counter , MODULE _INDICES . space ) ;
}
return bestMatch ;
} else {
counterPos ++ ;
}
counter [ counterPos ] = 1 ;
isWhite = isWhite ? 0 : 1 ;
}
}
return null ;
}
} , {
key : "_correct" ,
value : function _correct ( counter , correction ) {
this . _correctBars ( counter , correction . bar , MODULE _INDICES . bar ) ;
this . _correctBars ( counter , correction . space , MODULE _INDICES . space ) ;
}
} , {
key : "_findStart" ,
value : function _findStart ( ) {
var counter = [ 0 , 0 , 0 , 0 , 0 , 0 ] ;
var offset = this . _nextSet ( this . _row ) ;
var bestMatch = {
error : Number . MAX _VALUE ,
code : - 1 ,
start : 0 ,
end : 0 ,
correction : {
bar : 1 ,
space : 1
}
} ;
var epsilon = this . AVERAGE _CODE _ERROR ;
var isWhite = 0 ;
var counterPos = 0 ;
var sum ;
for ( var i = offset ; i < this . _row . length ; i ++ ) {
if ( this . _row [ i ] ^ isWhite ) {
counter [ counterPos ] ++ ;
} else {
if ( counterPos === counter . length - 1 ) {
sum = 0 ;
for ( var j = 0 ; j < counter . length ; j ++ ) {
sum += counter [ j ] ;
}
for ( var code = START _CODE _A ; code <= START _CODE _C ; code ++ ) {
var error = this . _matchPattern ( counter , CODE _PATTERN [ code ] ) ;
if ( error < bestMatch . error ) {
bestMatch . code = code ;
bestMatch . error = error ;
}
}
if ( bestMatch . error < epsilon ) {
bestMatch . start = i - sum ;
bestMatch . end = i ;
bestMatch . correction . bar = this . _calculateCorrection ( CODE _PATTERN [ bestMatch . code ] , counter , MODULE _INDICES . bar ) ;
bestMatch . correction . space = this . _calculateCorrection ( CODE _PATTERN [ bestMatch . code ] , counter , MODULE _INDICES . space ) ;
return bestMatch ;
}
for ( var _j = 0 ; _j < 4 ; _j ++ ) {
counter [ _j ] = counter [ _j + 2 ] ;
}
counter [ 4 ] = 0 ;
counter [ 5 ] = 0 ;
counterPos -- ;
} else {
counterPos ++ ;
}
counter [ counterPos ] = 1 ;
isWhite = isWhite ? 0 : 1 ;
}
}
return null ;
}
} , {
key : "decode" ,
value : function decode ( ) {
var result = new Array ( ) ;
var startInfo = this . _findStart ( ) ;
var code = null ;
var done = false ;
var multiplier = 0 ;
var checksum = 0 ;
var codeset ;
var rawResult = new Array ( ) ;
var decodedCodes = new Array ( ) ;
var shiftNext = false ;
var unshift ;
var removeLastCharacter = true ;
if ( startInfo === null ) {
return null ;
}
code = {
code : startInfo . code ,
start : startInfo . start ,
end : startInfo . end ,
correction : {
bar : startInfo . correction . bar ,
space : startInfo . correction . space
}
} ;
decodedCodes . push ( code ) ;
checksum = code . code ;
switch ( code . code ) {
case START _CODE _A :
codeset = CODE _A ;
break ;
case START _CODE _B :
codeset = CODE _B ;
break ;
case START _CODE _C :
codeset = CODE _C ;
break ;
default :
return null ;
}
while ( ! done ) {
unshift = shiftNext ;
shiftNext = false ;
code = this . _decodeCode ( code . end , code . correction ) ;
if ( code !== null ) {
if ( code . code !== STOP _CODE ) {
removeLastCharacter = true ;
}
if ( code . code !== STOP _CODE ) {
rawResult . push ( code . code ) ;
multiplier ++ ;
checksum += multiplier * code . code ;
}
decodedCodes . push ( code ) ;
switch ( codeset ) {
case CODE _A :
{
if ( code . code < 64 ) {
result . push ( String . fromCharCode ( 32 + code . code ) ) ;
} else if ( code . code < 96 ) {
result . push ( String . fromCharCode ( code . code - 64 ) ) ;
} else {
if ( code . code !== STOP _CODE ) {
removeLastCharacter = false ;
}
switch ( code . code ) {
case CODE _SHIFT :
shiftNext = true ;
codeset = CODE _B ;
break ;
case CODE _B :
codeset = CODE _B ;
break ;
case CODE _C :
codeset = CODE _C ;
break ;
case STOP _CODE :
done = true ;
break ;
}
}
break ;
}
case CODE _B :
{
if ( code . code < 96 ) {
result . push ( String . fromCharCode ( 32 + code . code ) ) ;
} else {
if ( code . code !== STOP _CODE ) {
removeLastCharacter = false ;
}
switch ( code . code ) {
case CODE _SHIFT :
shiftNext = true ;
codeset = CODE _A ;
break ;
case CODE _A :
codeset = CODE _A ;
break ;
case CODE _C :
codeset = CODE _C ;
break ;
case STOP _CODE :
done = true ;
break ;
}
}
break ;
}
case CODE _C :
{
if ( code . code < 100 ) {
result . push ( code . code < 10 ? '0' + code . code : code . code ) ;
} else {
if ( code . code !== STOP _CODE ) {
removeLastCharacter = false ;
}
switch ( code . code ) {
case CODE _A :
codeset = CODE _A ;
break ;
case CODE _B :
codeset = CODE _B ;
break ;
case STOP _CODE :
done = true ;
break ;
}
}
break ;
}
}
} else {
done = true ;
}
if ( unshift ) {
codeset = codeset === CODE _A ? CODE _B : CODE _A ;
}
}
if ( code === null ) {
return null ;
}
code . end = this . _nextUnset ( this . _row , code . end ) ;
if ( ! this . _verifyTrailingWhitespace ( code ) ) {
return null ;
}
checksum -= multiplier * rawResult [ rawResult . length - 1 ] ;
if ( checksum % 103 !== rawResult [ rawResult . length - 1 ] ) {
return null ;
}
if ( ! result . length ) {
return null ;
} // remove last code from result (checksum)
if ( removeLastCharacter ) {
result . splice ( result . length - 1 , 1 ) ;
}
return {
code : result . join ( '' ) ,
start : startInfo . start ,
end : code . end ,
codeset : codeset ,
startInfo : startInfo ,
decodedCodes : decodedCodes ,
endInfo : code
} ;
}
} , {
key : "_verifyTrailingWhitespace" ,
value : function _verifyTrailingWhitespace ( endInfo ) {
var trailingWhitespaceEnd = endInfo . end + ( endInfo . end - endInfo . start ) / 2 ;
if ( trailingWhitespaceEnd < this . _row . length ) {
if ( this . _matchRange ( endInfo . end , trailingWhitespaceEnd , 0 ) ) {
return endInfo ;
}
}
return null ;
}
} , {
key : "_calculateCorrection" ,
value : function _calculateCorrection ( expected , normalized , indices ) {
var sumNormalized = 0 ;
var sumExpected = 0 ;
for ( var length = indices . length ; length -- ; ) {
sumExpected += expected [ indices [ length ] ] ;
sumNormalized += normalized [ indices [ length ] ] ;
}
return sumExpected / sumNormalized ;
}
} ] ) ;
return Code128Reader ;
} ( _barcode _reader _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "BarcodeReader" ] ) ;
/***/ } ) ,
/***/ "./src/reader/code-39-reader.ts" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / reader / code - 39 - reader . ts * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: Code39Reader */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "Code39Reader" , function ( ) { return Code39Reader ; } ) ;
/* harmony import */ var _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/classCallCheck */ "../../node_modules/@babel/runtime/helpers/classCallCheck.js" ) ;
/* harmony import */ var _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/createClass */ "../../node_modules/@babel/runtime/helpers/createClass.js" ) ;
/* harmony import */ var _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/possibleConstructorReturn */ "../../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js" ) ;
/* harmony import */ var _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _2 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/getPrototypeOf */ "../../node_modules/@babel/runtime/helpers/getPrototypeOf.js" ) ;
/* harmony import */ var _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _3 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _3 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _4 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/inherits */ "../../node_modules/@babel/runtime/helpers/inherits.js" ) ;
/* harmony import */ var _babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _4 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _4 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _toConsumableArray _ _WEBPACK _IMPORTED _MODULE _5 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/toConsumableArray */ "../../node_modules/@babel/runtime/helpers/toConsumableArray.js" ) ;
/* harmony import */ var _babel _runtime _helpers _toConsumableArray _ _WEBPACK _IMPORTED _MODULE _5 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _toConsumableArray _ _WEBPACK _IMPORTED _MODULE _5 _ _ ) ;
/* harmony import */ var _barcode _reader _ _WEBPACK _IMPORTED _MODULE _6 _ _ = _ _webpack _require _ _ ( /*! ./barcode-reader */ "./src/reader/barcode-reader.ts" ) ;
var ASTERISK = 0x094 ;
var ALPHABETH _STRING = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. *$/+%' ;
var ALPHABET = new Uint16Array ( _babel _runtime _helpers _toConsumableArray _ _WEBPACK _IMPORTED _MODULE _5 _ _ _default ( ) ( ALPHABETH _STRING ) . map ( function ( _char ) {
return _char . charCodeAt ( 0 ) ;
} ) ) ; // const ALPHABET = [48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
// 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 45, 46, 32, 42, 36, 47, 43, 37];
var CHARACTER _ENCODINGS = new Uint16Array ( [ 0x034 , 0x121 , 0x061 , 0x160 , 0x031 , 0x130 , 0x070 , 0x025 , 0x124 , 0x064 , 0x109 , 0x049 , 0x148 , 0x019 , 0x118 , 0x058 , 0x00D , 0x10C , 0x04C , 0x01C , 0x103 , 0x043 , 0x142 , 0x013 , 0x112 , 0x052 , 0x007 , 0x106 , 0x046 , 0x016 , 0x181 , 0x0C1 , 0x1C0 , 0x091 , 0x190 , 0x0D0 , 0x085 , 0x184 , 0x0C4 , 0x094 , 0x0A8 , 0x0A2 , 0x08A , 0x02A ] ) ;
var Code39Reader =
/*#__PURE__*/
function ( _BarcodeReader ) {
_babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _4 _ _ _default ( ) ( Code39Reader , _BarcodeReader ) ;
function Code39Reader ( ) {
var _this ;
_babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default ( ) ( this , Code39Reader ) ;
_this = _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _3 _ _ _default ( ) ( Code39Reader ) . call ( this ) ) ;
_this . _format = 'code_39' ;
return _this ;
}
_babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default ( ) ( Code39Reader , [ {
key : "decode" ,
value : function decode ( ) {
var start = this . _findStart ( ) ;
if ( ! start ) {
return null ;
}
var result = new Array ( ) ;
var counters = new Uint16Array ( 9 ) ;
var decodedChar ;
var lastStart ;
var nextStart = this . _nextSet ( this . _row , start . end ) ;
do {
this . _toCounters ( nextStart , counters ) ;
var pattern = this . _toPattern ( counters ) ;
if ( pattern < 0 ) {
return null ;
}
decodedChar = this . _patternToChar ( pattern ) ;
if ( decodedChar === null ) {
return null ;
}
result . push ( decodedChar ) ;
lastStart = nextStart ;
nextStart += counters . reduce ( function ( sum , item ) {
return sum + item ;
} , 0 ) ;
nextStart = this . _nextSet ( this . _row , nextStart ) ;
} while ( decodedChar !== '*' ) ;
result . pop ( ) ;
if ( ! result . length ) {
return null ;
}
if ( ! this . _verifyTrailingWhitespace ( lastStart , nextStart , counters ) ) {
return null ;
}
return {
code : result . join ( '' ) ,
start : start . start ,
end : nextStart ,
startInfo : start ,
decodedCodes : result
} ;
}
} , {
key : "_patternToChar" ,
value : function _patternToChar ( pattern ) {
for ( var i = 0 ; i < CHARACTER _ENCODINGS . length ; i ++ ) {
if ( CHARACTER _ENCODINGS [ i ] === pattern ) {
return String . fromCharCode ( ALPHABET [ i ] ) ;
}
}
return null ;
}
} , {
key : "_verifyTrailingWhitespace" ,
value : function _verifyTrailingWhitespace ( lastStart , nextStart , counters ) {
var patternSize = counters . reduce ( function ( sum , item ) {
return sum + item ;
} , 0 ) ;
var trailingWhitespaceEnd = nextStart - lastStart - patternSize ;
return trailingWhitespaceEnd * 3 >= patternSize ;
}
} , {
key : "_findNextWidth" ,
value : function _findNextWidth ( counters , current ) {
var minWidth = Number . MAX _VALUE ;
for ( var i = 0 ; i < counters . length ; i ++ ) {
if ( counters [ i ] < minWidth && counters [ i ] > current ) {
minWidth = counters [ i ] ;
}
}
return minWidth ;
}
} , {
key : "_toPattern" ,
value : function _toPattern ( counters ) {
var numCounters = counters . length ;
var maxNarrowWidth = 0 ;
var numWideBars = numCounters ;
var wideBarWidth = 0 ;
var pattern ;
while ( numWideBars > 3 ) {
maxNarrowWidth = this . _findNextWidth ( counters , maxNarrowWidth ) ;
numWideBars = 0 ;
pattern = 0 ;
for ( var i = 0 ; i < numCounters ; i ++ ) {
if ( counters [ i ] > maxNarrowWidth ) {
pattern |= 1 << numCounters - 1 - i ;
numWideBars ++ ;
wideBarWidth += counters [ i ] ;
}
}
if ( numWideBars === 3 ) {
for ( var _i = 0 ; _i < numCounters && numWideBars > 0 ; _i ++ ) {
if ( counters [ _i ] > maxNarrowWidth ) {
numWideBars -- ;
if ( counters [ _i ] * 2 >= wideBarWidth ) {
return - 1 ;
}
}
}
return pattern ;
}
}
return - 1 ;
}
} , {
key : "_findStart" ,
value : function _findStart ( ) {
var offset = this . _nextSet ( this . _row ) ;
var patternStart = offset ;
var counter = new Uint16Array ( 9 ) ;
var counterPos = 0 ;
var isWhite = 0 ;
var whiteSpaceMustStart ;
for ( var i = offset ; i < this . _row . length ; i ++ ) {
if ( this . _row [ i ] ^ isWhite ) {
counter [ counterPos ] ++ ;
} else {
if ( counterPos === counter . length - 1 ) {
// find start pattern
if ( this . _toPattern ( counter ) === ASTERISK ) {
whiteSpaceMustStart = Math . max ( 0 , patternStart - ( i - patternStart ) / 4 ) | 0 ;
if ( this . _matchRange ( whiteSpaceMustStart , patternStart , 0 ) ) {
return {
start : patternStart ,
end : i
} ;
}
}
patternStart += counter [ 0 ] + counter [ 1 ] ;
for ( var j = 0 ; j < 7 ; j ++ ) {
counter [ j ] = counter [ j + 2 ] ;
}
counter [ 7 ] = 0 ;
counter [ 8 ] = 0 ;
counterPos -- ;
} else {
counterPos ++ ;
}
counter [ counterPos ] = 1 ;
isWhite = isWhite ? 0 : 1 ;
}
}
return null ;
}
} ] ) ;
return Code39Reader ;
} ( _barcode _reader _ _WEBPACK _IMPORTED _MODULE _6 _ _ [ "BarcodeReader" ] ) ;
/***/ } ) ,
/***/ "./src/reader/code-39-vin-reader.ts" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / reader / code - 39 - vin - reader . ts * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: Code39VINReader */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "Code39VINReader" , function ( ) { return Code39VINReader ; } ) ;
/* harmony import */ var _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/classCallCheck */ "../../node_modules/@babel/runtime/helpers/classCallCheck.js" ) ;
/* harmony import */ var _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/createClass */ "../../node_modules/@babel/runtime/helpers/createClass.js" ) ;
/* harmony import */ var _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/possibleConstructorReturn */ "../../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js" ) ;
/* harmony import */ var _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _2 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/getPrototypeOf */ "../../node_modules/@babel/runtime/helpers/getPrototypeOf.js" ) ;
/* harmony import */ var _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _3 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _3 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _get _ _WEBPACK _IMPORTED _MODULE _4 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/get */ "../../node_modules/@babel/runtime/helpers/get.js" ) ;
/* harmony import */ var _babel _runtime _helpers _get _ _WEBPACK _IMPORTED _MODULE _4 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _get _ _WEBPACK _IMPORTED _MODULE _4 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _5 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/inherits */ "../../node_modules/@babel/runtime/helpers/inherits.js" ) ;
/* harmony import */ var _babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _5 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _5 _ _ ) ;
/* harmony import */ var _code _39 _reader _ _WEBPACK _IMPORTED _MODULE _6 _ _ = _ _webpack _require _ _ ( /*! ./code-39-reader */ "./src/reader/code-39-reader.ts" ) ;
var Code39VINReader =
/*#__PURE__*/
function ( _Code39Reader ) {
_babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _5 _ _ _default ( ) ( Code39VINReader , _Code39Reader ) ;
function Code39VINReader ( ) {
var _this ;
_babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default ( ) ( this , Code39VINReader ) ;
_this = _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _3 _ _ _default ( ) ( Code39VINReader ) . call ( this ) ) ;
_this . _format = 'code_39_vin' ;
return _this ;
}
/ * *
* @ borrows
* https : //github.com/zxing/zxing/blob/master/core/src/main/java/com/google/zxing/client/result/VINResultParser.java
* /
_babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default ( ) ( Code39VINReader , [ {
key : "decode" ,
value : function decode ( ) {
var result = _babel _runtime _helpers _get _ _WEBPACK _IMPORTED _MODULE _4 _ _ _default ( ) ( _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _3 _ _ _default ( ) ( Code39VINReader . prototype ) , "decode" , this ) . call ( this ) ;
if ( ! result ) {
return null ;
}
var code = result . code ;
if ( ! code ) {
return null ;
}
code = code . replace ( /[IOQ]/g , '' ) ;
if ( ! /[A-Z0-9]{17}/ . test ( code ) ) {
if ( true ) {
console . log ( 'Failed AZ09 pattern code:' , code ) ;
}
return null ;
}
if ( ! this . _checkChecksum ( code ) ) {
return null ;
}
result . code = code ;
return result ;
}
} , {
key : "_checkChecksum" ,
value : function _checkChecksum ( code ) {
// TODO
return ! ! code ;
}
} ] ) ;
return Code39VINReader ;
} ( _code _39 _reader _ _WEBPACK _IMPORTED _MODULE _6 _ _ [ "Code39Reader" ] ) ;
/***/ } ) ,
/***/ "./src/reader/code-93-reader.ts" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / reader / code - 93 - reader . ts * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: Code93Reader */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "Code93Reader" , function ( ) { return Code93Reader ; } ) ;
/* harmony import */ var _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/classCallCheck */ "../../node_modules/@babel/runtime/helpers/classCallCheck.js" ) ;
/* harmony import */ var _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/createClass */ "../../node_modules/@babel/runtime/helpers/createClass.js" ) ;
/* harmony import */ var _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/possibleConstructorReturn */ "../../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js" ) ;
/* harmony import */ var _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _2 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/getPrototypeOf */ "../../node_modules/@babel/runtime/helpers/getPrototypeOf.js" ) ;
/* harmony import */ var _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _3 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _3 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _4 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/inherits */ "../../node_modules/@babel/runtime/helpers/inherits.js" ) ;
/* harmony import */ var _babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _4 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _4 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _toConsumableArray _ _WEBPACK _IMPORTED _MODULE _5 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/toConsumableArray */ "../../node_modules/@babel/runtime/helpers/toConsumableArray.js" ) ;
/* harmony import */ var _babel _runtime _helpers _toConsumableArray _ _WEBPACK _IMPORTED _MODULE _5 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _toConsumableArray _ _WEBPACK _IMPORTED _MODULE _5 _ _ ) ;
/* harmony import */ var _barcode _reader _ _WEBPACK _IMPORTED _MODULE _6 _ _ = _ _webpack _require _ _ ( /*! ./barcode-reader */ "./src/reader/barcode-reader.ts" ) ;
var ALPHABETH _STRING = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%abcd*' ;
var ALPHABET = new Uint16Array ( _babel _runtime _helpers _toConsumableArray _ _WEBPACK _IMPORTED _MODULE _5 _ _ _default ( ) ( ALPHABETH _STRING ) . map ( function ( _char ) {
return _char . charCodeAt ( 0 ) ;
} ) ) ;
var CHARACTER _ENCODINGS = new Uint16Array ( [ 0x114 , 0x148 , 0x144 , 0x142 , 0x128 , 0x124 , 0x122 , 0x150 , 0x112 , 0x10A , 0x1A8 , 0x1A4 , 0x1A2 , 0x194 , 0x192 , 0x18A , 0x168 , 0x164 , 0x162 , 0x134 , 0x11A , 0x158 , 0x14C , 0x146 , 0x12C , 0x116 , 0x1B4 , 0x1B2 , 0x1AC , 0x1A6 , 0x196 , 0x19A , 0x16C , 0x166 , 0x136 , 0x13A , 0x12E , 0x1D4 , 0x1D2 , 0x1CA , 0x16E , 0x176 , 0x1AE , 0x126 , 0x1DA , 0x1D6 , 0x132 , 0x15E ] ) ;
var ASTERISK = 0x15E ;
var Code93Reader =
/*#__PURE__*/
function ( _BarcodeReader ) {
_babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _4 _ _ _default ( ) ( Code93Reader , _BarcodeReader ) ;
function Code93Reader ( ) {
var _this ;
_babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default ( ) ( this , Code93Reader ) ;
_this = _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _3 _ _ _default ( ) ( Code93Reader ) . call ( this ) ) ;
_this . _format = 'code_93' ;
return _this ;
}
_babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default ( ) ( Code93Reader , [ {
key : "decode" ,
value : function decode ( ) {
var start = this . _findStart ( ) ;
if ( ! start ) {
return null ;
}
var result = new Array ( ) ;
var counters = new Uint16Array ( 6 ) ;
var decodedChar ;
var lastStart ;
var nextStart = this . _nextSet ( this . _row , start . end ) ;
do {
this . _toCounters ( nextStart , counters ) ;
var pattern = this . _toPattern ( counters ) ;
if ( pattern < 0 ) {
return null ;
}
decodedChar = this . _patternToChar ( pattern ) ;
if ( decodedChar === null ) {
return null ;
}
result . push ( decodedChar ) ;
lastStart = nextStart ;
nextStart += counters . reduce ( function ( sum , item ) {
return sum + item ;
} , 0 ) ;
nextStart = this . _nextSet ( this . _row , nextStart ) ;
} while ( decodedChar !== '*' ) ;
result . pop ( ) ;
if ( ! result . length ) {
return null ;
}
if ( ! this . _verifyEnd ( lastStart , nextStart ) ) {
return null ;
}
if ( ! this . _verifyChecksums ( result ) ) {
return null ;
}
result = result . slice ( 0 , result . length - 2 ) ;
if ( ( result = this . _decodeExtended ( result ) ) === null ) {
return null ;
}
return {
code : result . join ( '' ) ,
start : start . start ,
end : nextStart ,
startInfo : start ,
decodedCodes : result
} ;
}
} , {
key : "_patternToChar" ,
value : function _patternToChar ( pattern ) {
for ( var i = 0 ; i < CHARACTER _ENCODINGS . length ; i ++ ) {
if ( CHARACTER _ENCODINGS [ i ] === pattern ) {
return String . fromCharCode ( ALPHABET [ i ] ) ;
}
}
return null ;
}
} , {
key : "_verifyEnd" ,
value : function _verifyEnd ( lastStart , nextStart ) {
if ( lastStart === nextStart || ! this . _row [ nextStart ] ) {
return false ;
}
return true ;
}
} , {
key : "_toPattern" ,
value : function _toPattern ( counters ) {
var numCounters = counters . length ;
var pattern = 0 ;
var sum = 0 ;
for ( var i = 0 ; i < numCounters ; i ++ ) {
sum += counters [ i ] ;
}
for ( var _i = 0 ; _i < numCounters ; _i ++ ) {
var normalized = Math . round ( counters [ _i ] * 9 / sum ) ;
if ( normalized < 1 || normalized > 4 ) {
return - 1 ;
}
if ( ( _i & 1 ) === 0 ) {
for ( var j = 0 ; j < normalized ; j ++ ) {
pattern = pattern << 1 | 1 ;
}
} else {
pattern <<= normalized ;
}
}
return pattern ;
}
} , {
key : "_findStart" ,
value : function _findStart ( ) {
var counter = new Uint16Array ( 6 ) ;
var offset = this . _nextSet ( this . _row ) ;
var patternStart = offset ;
var counterPos = 0 ;
var isWhite = 0 ;
var whiteSpaceMustStart ;
for ( var i = offset ; i < this . _row . length ; i ++ ) {
if ( this . _row [ i ] ^ isWhite ) {
counter [ counterPos ] ++ ;
} else {
if ( counterPos === counter . length - 1 ) {
// find start pattern
if ( this . _toPattern ( counter ) === ASTERISK ) {
whiteSpaceMustStart = Math . max ( 0 , patternStart - ( i - patternStart ) / 4 ) | 0 ;
if ( this . _matchRange ( whiteSpaceMustStart , patternStart , 0 ) ) {
return {
start : patternStart ,
end : i
} ;
}
}
patternStart += counter [ 0 ] + counter [ 1 ] ;
for ( var j = 0 ; j < 4 ; j ++ ) {
counter [ j ] = counter [ j + 2 ] ;
}
counter [ 4 ] = 0 ;
counter [ 5 ] = 0 ;
counterPos -- ;
} else {
counterPos ++ ;
}
counter [ counterPos ] = 1 ;
isWhite = isWhite ? 0 : 1 ;
}
}
return null ;
}
} , {
key : "_decodeExtended" ,
value : function _decodeExtended ( charArray ) {
var length = charArray . length ;
var result = new Array ( ) ;
for ( var i = 0 ; i < length ; i ++ ) {
var _char2 = charArray [ i ] ;
if ( _char2 >= 'a' && _char2 <= 'd' ) {
if ( i > length - 2 ) {
return null ;
}
var nextChar = charArray [ ++ i ] ;
var nextCharCode = nextChar . charCodeAt ( 0 ) ;
var decodedChar = void 0 ;
switch ( _char2 ) {
case 'a' :
{
if ( nextChar >= 'A' && nextChar <= 'Z' ) {
decodedChar = String . fromCharCode ( nextCharCode - 64 ) ;
} else {
return null ;
}
break ;
}
case 'b' :
{
if ( nextChar >= 'A' && nextChar <= 'E' ) {
decodedChar = String . fromCharCode ( nextCharCode - 38 ) ;
} else if ( nextChar >= 'F' && nextChar <= 'J' ) {
decodedChar = String . fromCharCode ( nextCharCode - 11 ) ;
} else if ( nextChar >= 'K' && nextChar <= 'O' ) {
decodedChar = String . fromCharCode ( nextCharCode + 16 ) ;
} else if ( nextChar >= 'P' && nextChar <= 'S' ) {
decodedChar = String . fromCharCode ( nextCharCode + 43 ) ;
} else if ( nextChar >= 'T' && nextChar <= 'Z' ) {
decodedChar = String . fromCharCode ( 127 ) ;
} else {
return null ;
}
break ;
}
case 'c' :
{
if ( nextChar >= 'A' && nextChar <= 'O' ) {
decodedChar = String . fromCharCode ( nextCharCode - 32 ) ;
} else if ( nextChar === 'Z' ) {
decodedChar = ':' ;
} else {
return null ;
}
break ;
}
case 'd' :
{
if ( nextChar >= 'A' && nextChar <= 'Z' ) {
decodedChar = String . fromCharCode ( nextCharCode + 32 ) ;
} else {
return null ;
}
break ;
}
}
result . push ( decodedChar ) ;
} else {
result . push ( _char2 ) ;
}
}
return result ;
}
} , {
key : "_verifyChecksums" ,
value : function _verifyChecksums ( charArray ) {
return this . _matchCheckChar ( charArray , charArray . length - 2 , 20 ) && this . _matchCheckChar ( charArray , charArray . length - 1 , 15 ) ;
}
} , {
key : "_matchCheckChar" ,
value : function _matchCheckChar ( charArray , index , maxWeight ) {
var arrayToCheck = charArray . slice ( 0 , index ) ;
var length = arrayToCheck . length ;
var weightedSums = arrayToCheck . reduce ( function ( sum , _char3 , i ) {
var weight = ( i * - 1 + ( length - 1 ) ) % maxWeight + 1 ;
var value = ALPHABET . indexOf ( _char3 . charCodeAt ( 0 ) ) ;
return sum + weight * value ;
} , 0 ) ;
var checkChar = ALPHABET [ weightedSums % 47 ] ;
return checkChar === charArray [ index ] . charCodeAt ( 0 ) ;
}
} ] ) ;
return Code93Reader ;
} ( _barcode _reader _ _WEBPACK _IMPORTED _MODULE _6 _ _ [ "BarcodeReader" ] ) ;
/***/ } ) ,
/***/ "./src/reader/ean-2-reader.ts" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / reader / ean - 2 - reader . ts * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: EAN2Reader */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "EAN2Reader" , function ( ) { return EAN2Reader ; } ) ;
/* harmony import */ var _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/classCallCheck */ "../../node_modules/@babel/runtime/helpers/classCallCheck.js" ) ;
/* harmony import */ var _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/createClass */ "../../node_modules/@babel/runtime/helpers/createClass.js" ) ;
/* harmony import */ var _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/possibleConstructorReturn */ "../../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js" ) ;
/* harmony import */ var _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _2 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/getPrototypeOf */ "../../node_modules/@babel/runtime/helpers/getPrototypeOf.js" ) ;
/* harmony import */ var _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _3 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _3 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _4 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/inherits */ "../../node_modules/@babel/runtime/helpers/inherits.js" ) ;
/* harmony import */ var _babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _4 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _4 _ _ ) ;
/* harmony import */ var _ean _reader _ _WEBPACK _IMPORTED _MODULE _5 _ _ = _ _webpack _require _ _ ( /*! ./ean-reader */ "./src/reader/ean-reader.ts" ) ;
var EAN2Reader =
/*#__PURE__*/
function ( _EANReader ) {
_babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _4 _ _ _default ( ) ( EAN2Reader , _EANReader ) ;
function EAN2Reader ( config , supplements ) {
var _this ;
_babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default ( ) ( this , EAN2Reader ) ;
_this = _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _3 _ _ _default ( ) ( EAN2Reader ) . call ( this , config , supplements ) ) ;
_this . _format = 'ean_2' ;
return _this ;
}
_babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default ( ) ( EAN2Reader , [ {
key : "decode" ,
value : function decode ( row , start ) {
var end = row . length ;
var result = new Array ( ) ;
var decodedCodes = new Array ( ) ;
var offset = start ;
var codeFrequency = 0 ;
var code ;
this . _row = row ;
for ( var i = 0 ; i < 2 && offset < end ; i ++ ) {
code = this . _decodeCode ( offset ) ;
if ( ! code ) {
return null ;
}
decodedCodes . push ( code ) ;
result . push ( code . code % 10 ) ;
if ( code . code >= this . CODE _G _START ) {
codeFrequency |= 1 << 1 - i ;
}
if ( i !== 1 ) {
offset = this . _nextSet ( this . _row , code . end ) ;
offset = this . _nextUnset ( this . _row , offset ) ;
}
}
if ( result . length !== 2 || parseInt ( result . join ( '' ) ) % 4 !== codeFrequency ) {
return null ;
}
return {
code : result . join ( '' ) ,
decodedCodes : decodedCodes ,
end : code . end
} ;
}
} ] ) ;
return EAN2Reader ;
} ( _ean _reader _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "EANReader" ] ) ;
/***/ } ) ,
/***/ "./src/reader/ean-5-reader.ts" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / reader / ean - 5 - reader . ts * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: EAN5Reader */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "EAN5Reader" , function ( ) { return EAN5Reader ; } ) ;
/* harmony import */ var _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/classCallCheck */ "../../node_modules/@babel/runtime/helpers/classCallCheck.js" ) ;
/* harmony import */ var _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/possibleConstructorReturn */ "../../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js" ) ;
/* harmony import */ var _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _1 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/getPrototypeOf */ "../../node_modules/@babel/runtime/helpers/getPrototypeOf.js" ) ;
/* harmony import */ var _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _2 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/createClass */ "../../node_modules/@babel/runtime/helpers/createClass.js" ) ;
/* harmony import */ var _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _3 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _3 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _4 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/inherits */ "../../node_modules/@babel/runtime/helpers/inherits.js" ) ;
/* harmony import */ var _babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _4 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _4 _ _ ) ;
/* harmony import */ var _ean _reader _ _WEBPACK _IMPORTED _MODULE _5 _ _ = _ _webpack _require _ _ ( /*! ./ean-reader */ "./src/reader/ean-reader.ts" ) ;
var EAN5Reader =
/*#__PURE__*/
function ( _EANReader ) {
_babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _4 _ _ _default ( ) ( EAN5Reader , _EANReader ) ;
_babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _3 _ _ _default ( ) ( EAN5Reader , [ {
key : "CHECK_DIGIT_ENCODINGS" ,
get : function get ( ) {
return [ 24 , 20 , 18 , 17 , 12 , 6 , 3 , 10 , 9 , 5 ] ;
}
} ] ) ;
function EAN5Reader ( config , supplements ) {
var _this ;
_babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default ( ) ( this , EAN5Reader ) ;
_this = _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default ( ) ( this , _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( EAN5Reader ) . call ( this , config , supplements ) ) ;
_this . _format = 'ean_5' ;
return _this ;
}
_babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _3 _ _ _default ( ) ( EAN5Reader , [ {
key : "decode" ,
value : function decode ( row , start ) {
var end = row . length ;
var result = new Array ( ) ;
var decodedCodes = new Array ( ) ;
var codeFrequency = 0 ;
var offset = start ;
var code ;
this . _row = row ;
for ( var i = 0 ; i < 5 && offset < end ; i ++ ) {
code = this . _decodeCode ( offset ) ;
if ( ! code ) {
return null ;
}
decodedCodes . push ( code ) ;
result . push ( code . code % 10 ) ;
if ( code . code >= this . CODE _G _START ) {
codeFrequency |= 1 << 4 - i ;
}
if ( i !== 4 ) {
offset = this . _nextSet ( this . _row , code . end ) ;
offset = this . _nextUnset ( this . _row , offset ) ;
}
}
if ( result . length !== 5 ) {
return null ;
}
if ( this . _extensionChecksum ( result ) !== this . _determineCheckDigit ( codeFrequency ) ) {
return null ;
}
return {
code : result . join ( '' ) ,
decodedCodes : decodedCodes ,
end : code . end
} ;
}
} , {
key : "_determineCheckDigit" ,
value : function _determineCheckDigit ( codeFrequency ) {
for ( var i = 0 ; i < 10 ; i ++ ) {
if ( codeFrequency === this . CHECK _DIGIT _ENCODINGS [ i ] ) {
return i ;
}
}
return null ;
}
} , {
key : "_extensionChecksum" ,
value : function _extensionChecksum ( result ) {
var length = result . length ;
var sum = 0 ;
for ( var i = length - 2 ; i >= 0 ; i -= 2 ) {
sum += result [ i ] ;
}
sum *= 3 ;
for ( var _i = length - 1 ; _i >= 0 ; _i -= 2 ) {
sum += result [ _i ] ;
}
sum *= 3 ;
return sum % 10 ;
}
} ] ) ;
return EAN5Reader ;
} ( _ean _reader _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "EANReader" ] ) ;
/***/ } ) ,
/***/ "./src/reader/ean-8-reader.ts" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / reader / ean - 8 - reader . ts * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: EAN8Reader */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "EAN8Reader" , function ( ) { return EAN8Reader ; } ) ;
/* harmony import */ var _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/classCallCheck */ "../../node_modules/@babel/runtime/helpers/classCallCheck.js" ) ;
/* harmony import */ var _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/createClass */ "../../node_modules/@babel/runtime/helpers/createClass.js" ) ;
/* harmony import */ var _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/possibleConstructorReturn */ "../../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js" ) ;
/* harmony import */ var _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _2 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/getPrototypeOf */ "../../node_modules/@babel/runtime/helpers/getPrototypeOf.js" ) ;
/* harmony import */ var _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _3 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _3 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _4 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/inherits */ "../../node_modules/@babel/runtime/helpers/inherits.js" ) ;
/* harmony import */ var _babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _4 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _4 _ _ ) ;
/* harmony import */ var _ean _reader _ _WEBPACK _IMPORTED _MODULE _5 _ _ = _ _webpack _require _ _ ( /*! ./ean-reader */ "./src/reader/ean-reader.ts" ) ;
var EAN8Reader =
/*#__PURE__*/
function ( _EANReader ) {
_babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _4 _ _ _default ( ) ( EAN8Reader , _EANReader ) ;
function EAN8Reader ( config , supplements ) {
var _this ;
_babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default ( ) ( this , EAN8Reader ) ;
_this = _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _3 _ _ _default ( ) ( EAN8Reader ) . call ( this , config , supplements ) ) ;
_this . _format = 'ean_8' ;
return _this ;
}
_babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default ( ) ( EAN8Reader , [ {
key : "_decodePayload" ,
value : function _decodePayload ( code , result , decodedCodes ) {
for ( var i = 0 ; i < 4 ; i ++ ) {
code = this . _decodeCode ( code . end , this . CODE _G _START ) ;
if ( ! code ) {
return null ;
}
result . push ( code . code ) ;
decodedCodes . push ( code ) ;
}
code = this . _findPattern ( this . MIDDLE _PATTERN , code . end , 1 , false ) ;
if ( code === null ) {
return null ;
}
decodedCodes . push ( code ) ;
for ( var _i = 0 ; _i < 4 ; _i ++ ) {
code = this . _decodeCode ( code . end , this . CODE _G _START ) ;
if ( ! code ) {
return null ;
}
decodedCodes . push ( code ) ;
result . push ( code . code ) ;
}
return code ;
}
} ] ) ;
return EAN8Reader ;
} ( _ean _reader _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "EANReader" ] ) ;
/***/ } ) ,
/***/ "./src/reader/ean-reader.ts" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / reader / ean - reader . ts * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: EANReader */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "EANReader" , function ( ) { return EANReader ; } ) ;
/* harmony import */ var _babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/defineProperty */ "../../node_modules/@babel/runtime/helpers/defineProperty.js" ) ;
/* harmony import */ var _babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _0 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/classCallCheck */ "../../node_modules/@babel/runtime/helpers/classCallCheck.js" ) ;
/* harmony import */ var _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _1 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/possibleConstructorReturn */ "../../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js" ) ;
/* harmony import */ var _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _2 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/getPrototypeOf */ "../../node_modules/@babel/runtime/helpers/getPrototypeOf.js" ) ;
/* harmony import */ var _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _3 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _3 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _4 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/createClass */ "../../node_modules/@babel/runtime/helpers/createClass.js" ) ;
/* harmony import */ var _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _4 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _4 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _5 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/inherits */ "../../node_modules/@babel/runtime/helpers/inherits.js" ) ;
/* harmony import */ var _babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _5 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _5 _ _ ) ;
/* harmony import */ var _common _merge _ _WEBPACK _IMPORTED _MODULE _6 _ _ = _ _webpack _require _ _ ( /*! ../common/merge */ "./src/common/merge.ts" ) ;
/* harmony import */ var _barcode _reader _ _WEBPACK _IMPORTED _MODULE _7 _ _ = _ _webpack _require _ _ ( /*! ./barcode-reader */ "./src/reader/barcode-reader.ts" ) ;
function ownKeys ( object , enumerableOnly ) { var keys = Object . keys ( object ) ; if ( Object . getOwnPropertySymbols ) { var symbols = Object . getOwnPropertySymbols ( object ) ; if ( enumerableOnly ) symbols = symbols . filter ( function ( sym ) { return Object . getOwnPropertyDescriptor ( object , sym ) . enumerable ; } ) ; keys . push . apply ( keys , symbols ) ; } return keys ; }
function _objectSpread ( target ) { for ( var i = 1 ; i < arguments . length ; i ++ ) { var source = arguments [ i ] != null ? arguments [ i ] : { } ; if ( i % 2 ) { ownKeys ( source , true ) . forEach ( function ( key ) { _babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default ( ) ( target , key , source [ key ] ) ; } ) ; } else if ( Object . getOwnPropertyDescriptors ) { Object . defineProperties ( target , Object . getOwnPropertyDescriptors ( source ) ) ; } else { ownKeys ( source ) . forEach ( function ( key ) { Object . defineProperty ( target , key , Object . getOwnPropertyDescriptor ( source , key ) ) ; } ) ; } } return target ; }
var EXTENSION _START _PATTERN = [ 1 , 1 , 2 ] ;
var CODE _PATTERN = [ [ 3 , 2 , 1 , 1 ] , [ 2 , 2 , 2 , 1 ] , [ 2 , 1 , 2 , 2 ] , [ 1 , 4 , 1 , 1 ] , [ 1 , 1 , 3 , 2 ] , [ 1 , 2 , 3 , 1 ] , [ 1 , 1 , 1 , 4 ] , [ 1 , 3 , 1 , 2 ] , [ 1 , 2 , 1 , 3 ] , [ 3 , 1 , 1 , 2 ] , [ 1 , 1 , 2 , 3 ] , [ 1 , 2 , 2 , 2 ] , [ 2 , 2 , 1 , 2 ] , [ 1 , 1 , 4 , 1 ] , [ 2 , 3 , 1 , 1 ] , [ 1 , 3 , 2 , 1 ] , [ 4 , 1 , 1 , 1 ] , [ 2 , 1 , 3 , 1 ] , [ 3 , 1 , 2 , 1 ] , [ 2 , 1 , 1 , 3 ] ] ;
var CODE _FREQUENCY = [ 0 , 11 , 13 , 14 , 19 , 25 , 28 , 21 , 22 , 26 ] ;
var EANReader =
/*#__PURE__*/
function ( _BarcodeReader ) {
_babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _5 _ _ _default ( ) ( EANReader , _BarcodeReader ) ;
_babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _4 _ _ _default ( ) ( EANReader , [ {
key : "CODE_L_START" ,
get : function get ( ) {
return 0 ;
}
} , {
key : "CODE_G_START" ,
get : function get ( ) {
return 10 ;
}
} , {
key : "START_PATTERN" ,
get : function get ( ) {
return [ 1 , 1 , 1 ] ;
}
} , {
key : "STOP_PATTERN" ,
get : function get ( ) {
return [ 1 , 1 , 1 ] ;
}
} , {
key : "MIDDLE_PATTERN" ,
get : function get ( ) {
return [ 1 , 1 , 1 , 1 , 1 ] ;
}
} ] ) ;
function EANReader ( config , supplements ) {
var _this ;
_babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default ( ) ( this , EANReader ) ;
_this = _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _3 _ _ _default ( ) ( EANReader ) . call ( this , Object ( _common _merge _ _WEBPACK _IMPORTED _MODULE _6 _ _ [ "merge" ] ) ( {
supplements : [ ] // Allowed extensions to be decoded (2 and/or 5)
} , config ) , supplements ) ) ;
_this . _format = 'ean_13' ;
_this . _singleCodeError = 0.70 ;
_this . _averageCodeError = 0.48 ;
return _this ;
}
_babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _4 _ _ _default ( ) ( EANReader , [ {
key : "_decodeCode" ,
value : function _decodeCode ( start , coderange ) {
var counter = [ 0 , 0 , 0 , 0 ] ;
var offset = start ;
var bestMatch = {
error : Number . MAX _VALUE ,
code : - 1 ,
start : start ,
end : start
} ;
var epsilon = this . AVERAGE _CODE _ERROR ;
var isWhite = this . _row [ offset ] ? 0 : 1 ;
var counterPos = 0 ;
if ( ! coderange ) {
coderange = CODE _PATTERN . length ;
}
for ( var i = offset ; i < this . _row . length ; i ++ ) {
if ( this . _row [ i ] ^ isWhite ) {
counter [ counterPos ] ++ ;
} else {
if ( counterPos === counter . length - 1 ) {
for ( var code = 0 ; code < coderange ; code ++ ) {
var error = this . _matchPattern ( counter , CODE _PATTERN [ code ] ) ;
if ( error < bestMatch . error ) {
bestMatch . code = code ;
bestMatch . error = error ;
}
}
bestMatch . end = i ;
if ( bestMatch . error > epsilon ) {
return null ;
}
return bestMatch ;
} else {
counterPos ++ ;
}
counter [ counterPos ] = 1 ;
isWhite = isWhite ? 0 : 1 ;
}
}
return null ;
}
} , {
key : "_findStart" ,
value : function _findStart ( ) {
var offset = this . _nextSet ( this . _row ) ;
var startInfo ;
while ( ! startInfo ) {
startInfo = this . _findPattern ( this . START _PATTERN , offset , 0 , true ) ;
if ( ! startInfo ) {
return null ;
}
var leadingWhitespaceStart = startInfo . start - ( startInfo . end - startInfo . start ) ;
if ( leadingWhitespaceStart >= 0 ) {
if ( this . _matchRange ( leadingWhitespaceStart , startInfo . start , 0 ) ) {
return startInfo ;
}
}
offset = startInfo . end ;
startInfo = null ;
}
return null ;
}
} , {
key : "_verifyTrailingWhitespace" ,
value : function _verifyTrailingWhitespace ( endInfo ) {
var trailingWhitespaceEnd = endInfo . end + ( endInfo . end - endInfo . start ) ;
if ( trailingWhitespaceEnd < this . _row . length ) {
if ( this . _matchRange ( endInfo . end , trailingWhitespaceEnd , 0 ) ) {
return endInfo ;
}
}
return null ;
}
} , {
key : "_findEnd" ,
value : function _findEnd ( offset , isWhite ) {
var endInfo = this . _findPattern ( this . STOP _PATTERN , offset , isWhite , false ) ;
return endInfo !== null ? this . _verifyTrailingWhitespace ( endInfo ) : null ;
}
} , {
key : "_calculateFirstDigit" ,
value : function _calculateFirstDigit ( codeFrequency ) {
for ( var i = 0 ; i < CODE _FREQUENCY . length ; i ++ ) {
if ( codeFrequency === CODE _FREQUENCY [ i ] ) {
return i ;
}
}
return null ;
}
} , {
key : "_decodePayload" ,
value : function _decodePayload ( code , result , decodedCodes ) {
var codeFrequency = 0x0 ;
for ( var i = 0 ; i < 6 ; i ++ ) {
code = this . _decodeCode ( code . end ) ;
if ( ! code ) {
return null ;
}
if ( code . code >= this . CODE _G _START ) {
code . code -= this . CODE _G _START ;
codeFrequency |= 1 << 5 - i ;
} else {
codeFrequency |= 0 << 5 - i ;
}
result . push ( code . code ) ;
decodedCodes . push ( code ) ;
}
var firstDigit = this . _calculateFirstDigit ( codeFrequency ) ;
if ( firstDigit === null ) {
return null ;
}
result . unshift ( firstDigit ) ;
code = this . _findPattern ( this . MIDDLE _PATTERN , code . end , 1 , false ) ;
if ( code === null ) {
return null ;
}
decodedCodes . push ( code ) ;
for ( var _i = 0 ; _i < 6 ; _i ++ ) {
code = this . _decodeCode ( code . end , this . CODE _G _START ) ;
if ( ! code ) {
return null ;
}
decodedCodes . push ( code ) ;
result . push ( code . code ) ;
}
return code ;
}
} , {
key : "decode" ,
value : function decode ( ) {
var result = new Array ( ) ;
var decodedCodes = new Array ( ) ;
var resultInfo = { } ;
var startInfo = this . _findStart ( ) ;
if ( ! startInfo ) {
return null ;
}
var code = {
code : startInfo . code ,
start : startInfo . start ,
end : startInfo . end
} ;
decodedCodes . push ( code ) ;
code = this . _decodePayload ( code , result , decodedCodes ) ;
if ( ! code ) {
return null ;
}
code = this . _findEnd ( code . end , 0 ) ;
if ( ! code ) {
return null ;
}
decodedCodes . push ( code ) ; // Checksum
if ( ! this . _checksum ( result ) ) {
return null ;
}
if ( this . supplements . length > 0 ) {
var supplement = this . _decodeExtensions ( code . end ) ;
if ( ! supplement ) {
return null ;
}
var lastCode = supplement . decodedCodes [ supplement . decodedCodes . length - 1 ] ;
var endInfo = {
start : lastCode . start + ( ( lastCode . end - lastCode . start ) / 2 | 0 ) ,
end : lastCode . end
} ;
if ( ! this . _verifyTrailingWhitespace ( endInfo ) ) {
return null ;
}
resultInfo = {
supplement : supplement ,
code : result . join ( '' ) + supplement . code
} ;
}
return _objectSpread ( {
code : result . join ( '' ) ,
start : startInfo . start ,
end : code . end ,
startInfo : startInfo ,
decodedCodes : decodedCodes
} , resultInfo ) ;
}
} , {
key : "_decodeExtensions" ,
value : function _decodeExtensions ( offset ) {
var start = this . _nextSet ( this . _row , offset ) ;
var startInfo = this . _findPattern ( EXTENSION _START _PATTERN , start , 0 , false ) ;
if ( startInfo === null ) {
return null ;
}
for ( var i = 0 ; i < this . supplements . length ; i ++ ) {
var result = this . supplements [ i ] . decode ( this . _row , startInfo . end ) ;
if ( result !== null ) {
return {
code : result . code ,
start : start ,
startInfo : startInfo ,
end : result . end ,
decodedCodes : result . decodedCodes
} ;
}
}
return null ;
}
} , {
key : "_checksum" ,
value : function _checksum ( result ) {
var sum = 0 ;
for ( var i = result . length - 2 ; i >= 0 ; i -= 2 ) {
sum += result [ i ] ;
}
sum *= 3 ;
for ( var _i2 = result . length - 1 ; _i2 >= 0 ; _i2 -= 2 ) {
sum += result [ _i2 ] ;
}
return sum % 10 === 0 ;
}
} ] ) ;
return EANReader ;
} ( _barcode _reader _ _WEBPACK _IMPORTED _MODULE _7 _ _ [ "BarcodeReader" ] ) ;
/***/ } ) ,
/***/ "./src/reader/i2of5-reader.ts" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / reader / i2of5 - reader . ts * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: I2of5Reader */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "I2of5Reader" , function ( ) { return I2of5Reader ; } ) ;
/* harmony import */ var _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/classCallCheck */ "../../node_modules/@babel/runtime/helpers/classCallCheck.js" ) ;
/* harmony import */ var _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/createClass */ "../../node_modules/@babel/runtime/helpers/createClass.js" ) ;
/* harmony import */ var _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/possibleConstructorReturn */ "../../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js" ) ;
/* harmony import */ var _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _2 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _assertThisInitialized _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/assertThisInitialized */ "../../node_modules/@babel/runtime/helpers/assertThisInitialized.js" ) ;
/* harmony import */ var _babel _runtime _helpers _assertThisInitialized _ _WEBPACK _IMPORTED _MODULE _3 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _assertThisInitialized _ _WEBPACK _IMPORTED _MODULE _3 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _4 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/getPrototypeOf */ "../../node_modules/@babel/runtime/helpers/getPrototypeOf.js" ) ;
/* harmony import */ var _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _4 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _4 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _get _ _WEBPACK _IMPORTED _MODULE _5 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/get */ "../../node_modules/@babel/runtime/helpers/get.js" ) ;
/* harmony import */ var _babel _runtime _helpers _get _ _WEBPACK _IMPORTED _MODULE _5 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _get _ _WEBPACK _IMPORTED _MODULE _5 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _6 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/inherits */ "../../node_modules/@babel/runtime/helpers/inherits.js" ) ;
/* harmony import */ var _babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _6 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _6 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _7 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/defineProperty */ "../../node_modules/@babel/runtime/helpers/defineProperty.js" ) ;
/* harmony import */ var _babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _7 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _7 _ _ ) ;
/* harmony import */ var _common _merge _ _WEBPACK _IMPORTED _MODULE _8 _ _ = _ _webpack _require _ _ ( /*! ../common/merge */ "./src/common/merge.ts" ) ;
/* harmony import */ var _barcode _reader _ _WEBPACK _IMPORTED _MODULE _9 _ _ = _ _webpack _require _ _ ( /*! ./barcode-reader */ "./src/reader/barcode-reader.ts" ) ;
var N = 1 ;
var W = 3 ;
var START _PATTERN = [ N , N , N , N ] ;
var STOP _PATTERN = [ N , N , W ] ;
var CODE _PATTERN = [ [ N , N , W , W , N ] , [ W , N , N , N , W ] , [ N , W , N , N , W ] , [ W , W , N , N , N ] , [ N , N , W , N , W ] , [ W , N , W , N , N ] , [ N , W , W , N , N ] , [ N , N , N , W , W ] , [ W , N , N , W , N ] , [ N , W , N , W , N ] ] ;
var MAX _CORRECTION _FACTOR = 5 ;
var I2of5Reader =
/*#__PURE__*/
function ( _BarcodeReader ) {
_babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _6 _ _ _default ( ) ( I2of5Reader , _BarcodeReader ) ;
function I2of5Reader ( config ) {
var _this ;
_babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default ( ) ( this , I2of5Reader ) ;
_this = _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _4 _ _ _default ( ) ( I2of5Reader ) . call ( this , Object ( _common _merge _ _WEBPACK _IMPORTED _MODULE _8 _ _ [ "merge" ] ) ( {
normalizeBarSpaceWidth : false // Normalize the width difference between bars and spaces
} , config ) ) ) ;
_babel _runtime _helpers _defineProperty _ _WEBPACK _IMPORTED _MODULE _7 _ _ _default ( ) ( _babel _runtime _helpers _assertThisInitialized _ _WEBPACK _IMPORTED _MODULE _3 _ _ _default ( ) ( _this ) , "_barSpaceRatio" , void 0 ) ;
_this . _barSpaceRatio = [ 1 , 1 ] ;
_this . _format = 'i2of5' ;
if ( _this . config . normalizeBarSpaceWidth ) {
_this . _singleCodeError = 0.38 ;
_this . _averageCodeError = 0.09 ;
} else {
_this . _singleCodeError = 0.78 ;
_this . _averageCodeError = 0.38 ;
}
return _this ;
}
_babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default ( ) ( I2of5Reader , [ {
key : "decode" ,
value : function decode ( ) {
var startInfo = this . _findStart ( ) ;
if ( ! startInfo ) {
return null ;
}
var endInfo = this . _findEnd ( ) ;
if ( ! endInfo ) {
return null ;
}
var counters = this . _fillCounters ( startInfo . end , endInfo . start , 0 ) ;
if ( counters . length % 10 !== 0 ) {
return null ;
}
var result = new Array ( ) ;
var decodedCodes = new Array ( ) ;
decodedCodes . push ( startInfo ) ;
var code = this . _decodePayload ( counters , result , decodedCodes ) ;
if ( ! code || result . length % 2 !== 0 || result . length < 6 ) {
return null ;
}
decodedCodes . push ( endInfo ) ;
return {
code : result . join ( '' ) ,
start : startInfo . start ,
end : endInfo . end ,
startInfo : startInfo ,
decodedCodes : decodedCodes
} ;
}
} , {
key : "_matchPattern" ,
value : function _matchPattern ( counter , code ) {
if ( this . config . normalizeBarSpaceWidth ) {
var counterSum = [ 0 , 0 ] ;
var codeSum = [ 0 , 0 ] ;
var correction = [ 0 , 0 ] ;
var correctionRatio = MAX _CORRECTION _FACTOR ;
var correctionRatioInverse = 1 / correctionRatio ;
for ( var i = 0 ; i < counter . length ; i ++ ) {
counterSum [ i % 2 ] += counter [ i ] ;
codeSum [ i % 2 ] += code [ i ] ;
}
correction [ 0 ] = codeSum [ 0 ] / counterSum [ 0 ] ;
correction [ 1 ] = codeSum [ 1 ] / counterSum [ 1 ] ;
correction [ 0 ] = Math . max ( Math . min ( correction [ 0 ] , correctionRatio ) , correctionRatioInverse ) ;
correction [ 1 ] = Math . max ( Math . min ( correction [ 1 ] , correctionRatio ) , correctionRatioInverse ) ;
this . _barSpaceRatio = correction ;
for ( var _i = 0 ; _i < counter . length ; _i ++ ) {
counter [ _i ] *= this . _barSpaceRatio [ _i % 2 ] ;
}
}
return _babel _runtime _helpers _get _ _WEBPACK _IMPORTED _MODULE _5 _ _ _default ( ) ( _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _4 _ _ _default ( ) ( I2of5Reader . prototype ) , "_matchPattern" , this ) . call ( this , counter , code ) ;
}
} , {
key : "_findStart" ,
value : function _findStart ( ) {
var offset = this . _nextSet ( this . _row ) ;
var startInfo ;
while ( ! startInfo ) {
startInfo = this . _findPattern ( START _PATTERN , offset , 0 , true ) ;
if ( ! startInfo ) {
return null ;
}
var narrowBarWidth = startInfo . end - startInfo . start >> 2 ;
var leadingWhitespaceStart = startInfo . start - narrowBarWidth * 10 ;
if ( leadingWhitespaceStart >= 0 ) {
if ( this . _matchRange ( leadingWhitespaceStart , startInfo . start , 0 ) ) {
return startInfo ;
}
}
offset = startInfo . end ;
startInfo = null ;
}
return null ;
}
} , {
key : "_verifyTrailingWhitespace" ,
value : function _verifyTrailingWhitespace ( endInfo ) {
var trailingWhitespaceEnd = endInfo . end + ( endInfo . end - endInfo . start ) / 2 ;
if ( trailingWhitespaceEnd < this . _row . length ) {
if ( this . _matchRange ( endInfo . end , trailingWhitespaceEnd , 0 ) ) {
return endInfo ;
}
}
return null ;
}
} , {
key : "_findEnd" ,
value : function _findEnd ( ) {
this . _row . reverse ( ) ;
var endInfo = this . _findPattern ( STOP _PATTERN , undefined , 0 , false ) ;
this . _row . reverse ( ) ;
if ( endInfo === null ) {
return null ;
} // reverse numbers
var start = endInfo . start ;
endInfo . start = this . _row . length - endInfo . end ;
endInfo . end = this . _row . length - start ;
return endInfo !== null ? this . _verifyTrailingWhitespace ( endInfo ) : null ;
}
} , {
key : "_decodeCode" ,
value : function _decodeCode ( counter ) {
var bestMatch = {
error : Number . MAX _VALUE ,
code : - 1 ,
start : 0 ,
end : 0
} ;
for ( var code = 0 ; code < CODE _PATTERN . length ; code ++ ) {
var error = this . _matchPattern ( counter , CODE _PATTERN [ code ] ) ;
if ( error < bestMatch . error ) {
bestMatch . code = code ;
bestMatch . error = error ;
}
}
return bestMatch . error < this . AVERAGE _CODE _ERROR ? bestMatch : null ;
}
} , {
key : "_decodePayload" ,
value : function _decodePayload ( counters , result , decodedCodes ) {
var counterLength = counters . length ;
var counter0 = [ 0 , 0 , 0 , 0 , 0 ] ;
var counter1 = [ 0 , 0 , 0 , 0 , 0 ] ;
var code0 ;
var code1 ;
var pos = 0 ;
while ( pos < counterLength ) {
for ( var i = 0 ; i < 5 ; i ++ ) {
counter0 [ i ] = counters [ pos ] * this . _barSpaceRatio [ 0 ] ;
counter1 [ i ] = counters [ pos + 1 ] * this . _barSpaceRatio [ 1 ] ;
pos += 2 ;
}
code0 = this . _decodeCode ( counter0 ) ;
if ( ! code0 ) {
return null ;
}
code1 = this . _decodeCode ( counter1 ) ;
if ( ! code1 ) {
return null ;
}
result . push ( code0 . code , code1 . code ) ;
decodedCodes . push ( code0 , code1 ) ;
}
return [ code0 , code1 ] ;
}
} ] ) ;
return I2of5Reader ;
} ( _barcode _reader _ _WEBPACK _IMPORTED _MODULE _9 _ _ [ "BarcodeReader" ] ) ;
/***/ } ) ,
/***/ "./src/reader/index.ts" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / reader / index . ts * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: Readers */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "Readers" , function ( ) { return Readers ; } ) ;
/* harmony import */ var _code _128 _reader _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ./code-128-reader */ "./src/reader/code-128-reader.ts" ) ;
/* harmony import */ var _code _39 _reader _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! ./code-39-reader */ "./src/reader/code-39-reader.ts" ) ;
/* harmony import */ var _code _39 _vin _reader _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! ./code-39-vin-reader */ "./src/reader/code-39-vin-reader.ts" ) ;
/* harmony import */ var _codabar _reader _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! ./codabar-reader */ "./src/reader/codabar-reader.ts" ) ;
/* harmony import */ var _ean _reader _ _WEBPACK _IMPORTED _MODULE _4 _ _ = _ _webpack _require _ _ ( /*! ./ean-reader */ "./src/reader/ean-reader.ts" ) ;
/* harmony import */ var _ean _8 _reader _ _WEBPACK _IMPORTED _MODULE _5 _ _ = _ _webpack _require _ _ ( /*! ./ean-8-reader */ "./src/reader/ean-8-reader.ts" ) ;
/* harmony import */ var _ean _2 _reader _ _WEBPACK _IMPORTED _MODULE _6 _ _ = _ _webpack _require _ _ ( /*! ./ean-2-reader */ "./src/reader/ean-2-reader.ts" ) ;
/* harmony import */ var _ean _5 _reader _ _WEBPACK _IMPORTED _MODULE _7 _ _ = _ _webpack _require _ _ ( /*! ./ean-5-reader */ "./src/reader/ean-5-reader.ts" ) ;
/* harmony import */ var _upc _reader _ _WEBPACK _IMPORTED _MODULE _8 _ _ = _ _webpack _require _ _ ( /*! ./upc-reader */ "./src/reader/upc-reader.ts" ) ;
/* harmony import */ var _upc _e _reader _ _WEBPACK _IMPORTED _MODULE _9 _ _ = _ _webpack _require _ _ ( /*! ./upc-e-reader */ "./src/reader/upc-e-reader.ts" ) ;
/* harmony import */ var _i2of5 _reader _ _WEBPACK _IMPORTED _MODULE _10 _ _ = _ _webpack _require _ _ ( /*! ./i2of5-reader */ "./src/reader/i2of5-reader.ts" ) ;
/* harmony import */ var _2of5 _reader _ _WEBPACK _IMPORTED _MODULE _11 _ _ = _ _webpack _require _ _ ( /*! ./2of5-reader */ "./src/reader/2of5-reader.ts" ) ;
/* harmony import */ var _code _93 _reader _ _WEBPACK _IMPORTED _MODULE _12 _ _ = _ _webpack _require _ _ ( /*! ./code-93-reader */ "./src/reader/code-93-reader.ts" ) ;
var Readers = {
code _128 _reader : _code _128 _reader _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "Code128Reader" ] ,
ean _reader : _ean _reader _ _WEBPACK _IMPORTED _MODULE _4 _ _ [ "EANReader" ] ,
ean _5 _reader : _ean _5 _reader _ _WEBPACK _IMPORTED _MODULE _7 _ _ [ "EAN5Reader" ] ,
ean _2 _reader : _ean _2 _reader _ _WEBPACK _IMPORTED _MODULE _6 _ _ [ "EAN2Reader" ] ,
ean _8 _reader : _ean _8 _reader _ _WEBPACK _IMPORTED _MODULE _5 _ _ [ "EAN8Reader" ] ,
code _39 _reader : _code _39 _reader _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "Code39Reader" ] ,
code _39 _vin _reader : _code _39 _vin _reader _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "Code39VINReader" ] ,
codabar _reader : _codabar _reader _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "CodabarReader" ] ,
upc _reader : _upc _reader _ _WEBPACK _IMPORTED _MODULE _8 _ _ [ "UPCReader" ] ,
upc _e _reader : _upc _e _reader _ _WEBPACK _IMPORTED _MODULE _9 _ _ [ "UPCEReader" ] ,
i2of5 _reader : _i2of5 _reader _ _WEBPACK _IMPORTED _MODULE _10 _ _ [ "I2of5Reader" ] ,
'2of5_reader' : _2of5 _reader _ _WEBPACK _IMPORTED _MODULE _11 _ _ [ "TwoOfFiveReader" ] ,
code _93 _reader : _code _93 _reader _ _WEBPACK _IMPORTED _MODULE _12 _ _ [ "Code93Reader" ]
} ;
/***/ } ) ,
/***/ "./src/reader/upc-e-reader.ts" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / reader / upc - e - reader . ts * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: UPCEReader */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "UPCEReader" , function ( ) { return UPCEReader ; } ) ;
/* harmony import */ var _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/classCallCheck */ "../../node_modules/@babel/runtime/helpers/classCallCheck.js" ) ;
/* harmony import */ var _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/possibleConstructorReturn */ "../../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js" ) ;
/* harmony import */ var _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _1 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/getPrototypeOf */ "../../node_modules/@babel/runtime/helpers/getPrototypeOf.js" ) ;
/* harmony import */ var _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _2 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _get _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/get */ "../../node_modules/@babel/runtime/helpers/get.js" ) ;
/* harmony import */ var _babel _runtime _helpers _get _ _WEBPACK _IMPORTED _MODULE _3 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _get _ _WEBPACK _IMPORTED _MODULE _3 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _4 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/createClass */ "../../node_modules/@babel/runtime/helpers/createClass.js" ) ;
/* harmony import */ var _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _4 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _4 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _5 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/inherits */ "../../node_modules/@babel/runtime/helpers/inherits.js" ) ;
/* harmony import */ var _babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _5 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _5 _ _ ) ;
/* harmony import */ var _ean _reader _ _WEBPACK _IMPORTED _MODULE _6 _ _ = _ _webpack _require _ _ ( /*! ./ean-reader */ "./src/reader/ean-reader.ts" ) ;
var CODE _FREQUENCY = [ [ 56 , 52 , 50 , 49 , 44 , 38 , 35 , 42 , 41 , 37 ] , [ 7 , 11 , 13 , 14 , 19 , 25 , 28 , 21 , 22 , 26 ] ] ;
var UPCEReader =
/*#__PURE__*/
function ( _EANReader ) {
_babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _5 _ _ _default ( ) ( UPCEReader , _EANReader ) ;
_babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _4 _ _ _default ( ) ( UPCEReader , [ {
key : "STOP_PATTERN" ,
get : function get ( ) {
return [ 1 / 6 * 7 , 1 / 6 * 7 , 1 / 6 * 7 , 1 / 6 * 7 , 1 / 6 * 7 , 1 / 6 * 7 ] ;
}
} ] ) ;
function UPCEReader ( config , supplements ) {
var _this ;
_babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default ( ) ( this , UPCEReader ) ;
_this = _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default ( ) ( this , _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( UPCEReader ) . call ( this , config , supplements ) ) ;
_this . _format = 'upc_e' ;
return _this ;
}
_babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _4 _ _ _default ( ) ( UPCEReader , [ {
key : "_decodePayload" ,
value : function _decodePayload ( code , result , decodedCodes ) {
var codeFrequency = 0x0 ;
for ( var i = 0 ; i < 6 ; i ++ ) {
code = this . _decodeCode ( code . end ) ;
if ( ! code ) {
return null ;
}
if ( code . code >= this . CODE _G _START ) {
code . code = code . code - this . CODE _G _START ;
codeFrequency |= 1 << 5 - i ;
}
result . push ( code . code ) ;
decodedCodes . push ( code ) ;
}
if ( ! this . _determineParity ( codeFrequency , result ) ) {
return null ;
}
return code ;
}
} , {
key : "_determineParity" ,
value : function _determineParity ( codeFrequency , result ) {
for ( var nrSystem = 0 ; nrSystem < CODE _FREQUENCY . length ; nrSystem ++ ) {
for ( var i = 0 ; i < CODE _FREQUENCY [ nrSystem ] . length ; i ++ ) {
if ( codeFrequency === CODE _FREQUENCY [ nrSystem ] [ i ] ) {
result . unshift ( nrSystem ) ;
result . push ( i ) ;
return true ;
}
}
}
return false ;
}
} , {
key : "_convertToUPCA" ,
value : function _convertToUPCA ( result ) {
var lastDigit = result [ result . length - 2 ] ;
var upca = [ result [ 0 ] ] ;
if ( lastDigit <= 2 ) {
upca = upca . concat ( result . slice ( 1 , 3 ) ) . concat ( [ lastDigit , 0 , 0 , 0 , 0 ] ) . concat ( result . slice ( 3 , 6 ) ) ;
} else if ( lastDigit === 3 ) {
upca = upca . concat ( result . slice ( 1 , 4 ) ) . concat ( [ 0 , 0 , 0 , 0 , 0 ] ) . concat ( result . slice ( 4 , 6 ) ) ;
} else if ( lastDigit === 4 ) {
upca = upca . concat ( result . slice ( 1 , 5 ) ) . concat ( [ 0 , 0 , 0 , 0 , 0 , result [ 5 ] ] ) ;
} else {
upca = upca . concat ( result . slice ( 1 , 6 ) ) . concat ( [ 0 , 0 , 0 , 0 , lastDigit ] ) ;
}
upca . push ( result [ result . length - 1 ] ) ;
return upca ;
}
} , {
key : "_checksum" ,
value : function _checksum ( result ) {
return _babel _runtime _helpers _get _ _WEBPACK _IMPORTED _MODULE _3 _ _ _default ( ) ( _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( UPCEReader . prototype ) , "_checksum" , this ) . call ( this , this . _convertToUPCA ( result ) ) ;
}
} , {
key : "_findEnd" ,
value : function _findEnd ( offset , isWhite ) {
isWhite = 1 ;
return _babel _runtime _helpers _get _ _WEBPACK _IMPORTED _MODULE _3 _ _ _default ( ) ( _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( UPCEReader . prototype ) , "_findEnd" , this ) . call ( this , offset , isWhite ) ;
}
} , {
key : "_verifyTrailingWhitespace" ,
value : function _verifyTrailingWhitespace ( endInfo ) {
var trailingWhitespaceEnd = endInfo . end + ( endInfo . end - endInfo . start ) / 2 ;
if ( trailingWhitespaceEnd < this . _row . length ) {
if ( this . _matchRange ( endInfo . end , trailingWhitespaceEnd , 0 ) ) {
return endInfo ;
}
}
return null ;
}
} ] ) ;
return UPCEReader ;
} ( _ean _reader _ _WEBPACK _IMPORTED _MODULE _6 _ _ [ "EANReader" ] ) ;
/***/ } ) ,
/***/ "./src/reader/upc-reader.ts" :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / reader / upc - reader . ts * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/*! exports provided: UPCReader */
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "UPCReader" , function ( ) { return UPCReader ; } ) ;
/* harmony import */ var _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/classCallCheck */ "../../node_modules/@babel/runtime/helpers/classCallCheck.js" ) ;
/* harmony import */ var _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/createClass */ "../../node_modules/@babel/runtime/helpers/createClass.js" ) ;
/* harmony import */ var _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/possibleConstructorReturn */ "../../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js" ) ;
/* harmony import */ var _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _2 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/getPrototypeOf */ "../../node_modules/@babel/runtime/helpers/getPrototypeOf.js" ) ;
/* harmony import */ var _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _3 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _3 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _get _ _WEBPACK _IMPORTED _MODULE _4 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/get */ "../../node_modules/@babel/runtime/helpers/get.js" ) ;
/* harmony import */ var _babel _runtime _helpers _get _ _WEBPACK _IMPORTED _MODULE _4 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _get _ _WEBPACK _IMPORTED _MODULE _4 _ _ ) ;
/* harmony import */ var _babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _5 _ _ = _ _webpack _require _ _ ( /*! @babel/runtime/helpers/inherits */ "../../node_modules/@babel/runtime/helpers/inherits.js" ) ;
/* harmony import */ var _babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _5 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _5 _ _ ) ;
/* harmony import */ var _ean _reader _ _WEBPACK _IMPORTED _MODULE _6 _ _ = _ _webpack _require _ _ ( /*! ./ean-reader */ "./src/reader/ean-reader.ts" ) ;
var UPCReader =
/*#__PURE__*/
function ( _EANReader ) {
_babel _runtime _helpers _inherits _ _WEBPACK _IMPORTED _MODULE _5 _ _ _default ( ) ( UPCReader , _EANReader ) ;
function UPCReader ( config , supplements ) {
var _this ;
_babel _runtime _helpers _classCallCheck _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default ( ) ( this , UPCReader ) ;
_this = _babel _runtime _helpers _possibleConstructorReturn _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) ( this , _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _3 _ _ _default ( ) ( UPCReader ) . call ( this , config , supplements ) ) ;
_this . _format = 'upc_a' ;
return _this ;
}
_babel _runtime _helpers _createClass _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default ( ) ( UPCReader , [ {
key : "decode" ,
value : function decode ( ) {
var result = _babel _runtime _helpers _get _ _WEBPACK _IMPORTED _MODULE _4 _ _ _default ( ) ( _babel _runtime _helpers _getPrototypeOf _ _WEBPACK _IMPORTED _MODULE _3 _ _ _default ( ) ( UPCReader . prototype ) , "decode" , this ) . call ( this ) ;
if ( result && result . code && result . code . length === 13 && result . code . charAt ( 0 ) === '0' ) {
result . code = result . code . substring ( 1 ) ;
return result ;
}
return null ;
}
} ] ) ;
return UPCReader ;
} ( _ean _reader _ _WEBPACK _IMPORTED _MODULE _6 _ _ [ "EANReader" ] ) ;
/***/ } )
/******/ } )
} ) ;
;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9RdWFnZ2Evd2VicGFjay9teU1vZHVsZURlZmluaXRpb24iLCJ3ZWJwYWNrOi8vUXVhZ2dhL3dlYnBhY2svYm9vdHN0cmFwIiwid2VicGFjazovL1F1YWdnYS8vVXNlcnMvYWRvbXJhdGNoZXYvbm9kZV9tb2R1bGVzL0BiYWJlbC9ydW50aW1lL2hlbHBlcnMvYXJyYXlXaXRob3V0SG9sZXMuanMiLCJ3ZWJwYWNrOi8vUXVhZ2dhLy9Vc2Vycy9hZG9tcmF0Y2hldi9ub2RlX21vZHVsZXMvQGJhYmVsL3J1bnRpbWUvaGVscGVycy9hc3NlcnRUaGlzSW5pdGlhbGl6ZWQuanMiLCJ3ZWJwYWNrOi8vUXVhZ2dhLy9Vc2Vycy9hZG9tcmF0Y2hldi9ub2RlX21vZHVsZXMvQGJhYmVsL3J1bnRpbWUvaGVscGVycy9hc3luY1RvR2VuZXJhdG9yLmpzIiwid2VicGFjazovL1F1YWdnYS8vVXNlcnMvYWRvbXJhdGNoZXYvbm9kZV9tb2R1bGVzL0BiYWJlbC9ydW50aW1lL2hlbHBlcnMvY2xhc3NDYWxsQ2hlY2suanMiLCJ3ZWJwYWNrOi8vUXVhZ2dhLy9Vc2Vycy9hZG9tcmF0Y2hldi9ub2RlX21vZHVsZXMvQGJhYmVsL3J1bnRpbWUvaGVscGVycy9jcmVhdGVDbGFzcy5qcyIsIndlYnBhY2s6Ly9RdWFnZ2EvL1VzZXJzL2Fkb21yYXRjaGV2L25vZGVfbW9kdWxlcy9AYmFiZWwvcnVudGltZS9oZWxwZXJzL2RlZmluZVByb3BlcnR5LmpzIiwid2VicGFjazovL1F1YWdnYS8vVXNlcnMvYWRvbXJhdGNoZXYvbm9kZV9tb2R1bGVzL0BiYWJlbC9ydW50aW1lL2hlbHBlcnMvZ2V0LmpzIiwid2VicGFjazovL1F1YWdnYS8vVXNlcnMvYWRvbXJhdGNoZXYvbm9kZV9tb2R1bGVzL0BiYWJlbC9ydW50aW1lL2hlbHBlcnMvZ2V0UHJvdG90eXBlT2YuanMiLCJ3ZWJwYWNrOi8vUXVhZ2dhLy9Vc2Vycy9hZG9tcmF0Y2hldi9ub2RlX21vZHVsZXMvQGJhYmVsL3J1bnRpbWUvaGVscGVycy9pbmhlcml0cy5qcyIsIndlYnBhY2s6Ly9RdWFnZ2EvL1VzZXJzL2Fkb21yYXRjaGV2L25vZGVfbW9kdWxlcy9AYmFiZWwvcnVudGltZS9oZWxwZXJzL2l0ZXJhYmxlVG9BcnJheS5qcyIsIndlYnBhY2s6Ly9RdWFnZ2EvL1VzZXJzL2Fkb21yYXRjaGV2L25vZGVfbW9kdWxlcy9AYmFiZWwvcnVudGltZS9oZWxwZXJzL25vbkl0ZXJhYmxlU3ByZWFkLmpzIiwid2VicGFjazovL1F1YWdnYS8vVXNlcnMvYWRvbXJhdGNoZXYvbm9kZV9tb2R1bGVzL0BiYWJlbC9ydW50aW1lL2hlbHBlcnMvcG9zc2libGVDb25zdHJ1Y3RvclJldHVybi5qcyIsIndlYnBhY2s6Ly9RdWFnZ2EvL1VzZXJzL2Fkb21yYXRjaGV2L25vZGVfbW9kdWxlcy9AYmFiZWwvcnVudGltZS9oZWxwZXJzL3NldFByb3RvdHlwZU9mLmpzIiwid2VicGFjazovL1F1YWdnYS8vVXNlcnMvYWRvbXJhdGNoZXYvbm9kZV9tb2R1bGVzL0BiYWJlbC9ydW50aW1lL2hlbHBlcnMvc3VwZXJQcm9wQmFzZS5qcyIsIndlYnBhY2s6Ly9RdWFnZ2EvL1VzZXJzL2Fkb21yYXRjaGV2L25vZGVfbW9kdWxlcy9AYmFiZWwvcnVudGltZS9oZWxwZXJzL3RvQ29uc3VtYWJsZUFycmF5LmpzIiwid2VicGFjazovL1F1YWdnYS8vVXNlcnMvYWRvbXJhdGNoZXYvbm9kZV9tb2R1bGVzL0BiYWJlbC9ydW50aW1lL2hlbHBlcnMvdHlwZW9mLmpzIiwid2VicGFjazovL1F1YWdnYS8vVXNlcnMvYWRvbXJhdGNoZXYvbm9kZV9tb2R1bGVzL0BiYWJlbC9ydW50aW1lL3JlZ2VuZXJhdG9yL2luZGV4LmpzIiwid2VicGFjazovL1F1YWdnYS8vVXNlcnMvYWRvbXJhdGNoZXYvbm9kZV9tb2R1bGVzL3JlZ2VuZXJhdG9yLXJ1bnRpbWUvcnVudGltZS1tb2R1bGUuanMiLCJ3ZWJwYWNrOi8vUXVhZ2dhLy9Vc2Vycy9hZG9tcmF0Y2hldi9ub2RlX21vZHVsZXMvcmVnZW5lcmF0b3ItcnVudGltZS9ydW50aW1lLmpzIiwid2VicGFjazovL1F1YWdnYS8od2VicGFjaykvYnVpbGRpbi9nbG9iYWwuanMiLCJ3ZWJwYWNrOi8vUXVhZ2dhLy4vc3JjL2FuYWx5dGljcy9yZXN1bHQtY29sbGVjdG9yLnRzIiwid2VicGFjazovL1F1YWdnYS8uL3NyYy9jb21tb24vY2x1c3Rlci50cyIsIndlYnBhY2s6Ly9RdWFnZ2EvLi9zcmMvY29tbW9uL2V2ZW50cy50cyIsIndlYnBhY2s6Ly9RdWFnZ2EvLi9zcmMvY29tbW9uL2hzdjJyZ2IudHMiLCJ3ZWJwYWNrOi8vUXVhZ2dhLy4vc3JjL2NvbW1vbi9pbWFnZS1kZWJ1Zy50cyIsIndlYnBhY2s6Ly9RdWFnZ2EvLi9zcmMvY29tbW9uL2ltYWdlLXdyYXBwZXIudHMiLCJ3ZWJwYWNrOi8vUXVhZ2dhLy4vc3JjL2NvbW1vbi9tZWRpYS1kZXZpY2VzLnRzIiwid2VicGFjazovL1F1YWdnYS8uL3NyYy9jb21tb24vbWVyZ2UudHMiLCJ3ZWJwYWNrOi8vUXVhZ2dhLy4vc3JjL2NvbmZpZy9jb25maWcuZGV2LnRzIiwid2VicGFjazovL1F1YWdnYS8uL3NyYy9kZWNvZGVyL2JhcmNvZGUtZGVjb2Rlci50cyIsIndlYnBhY2s6Ly9RdWFnZ2EvLi9zcmMvZGVjb2Rlci9icmVzZW5oYW0udHMiLCJ3ZWJwYWNrOi8vUXVhZ2dhLy4vc3JjL2lucHV0L2NhbWVyYS1hY2Nlc3MudHMiLCJ3ZWJwYWNrOi8vUXVhZ2dhLy4vc3JjL2lucHV0L2V4aWYtaGVscGVyLnRzIiwid2VicGFjazovL1F1YWdnYS8uL3NyYy9pbnB1dC9mcmFtZS1ncmFiYmVyLnRzIiwid2VicGFjazovL1F1YWdnYS8uL3NyYy9pbnB1dC9pbWFnZS1sb2FkZXIudHMiLCJ3ZWJwYWNrOi8vUXVhZ2dhLy4vc3JjL2lucHV0L2ltYWdlLXN0cmVhbS50cyIsIndlYnBhY2s6Ly9RdWFnZ2EvLi9zcmMvaW5wdXQvaW5wdXQtc3RyZWFtLXV0aWxzLnRzIiwid2VicGFjazovL1F1YWdnYS8uL3NyYy9pbnB1dC9pbnB1dC1zdHJlYW0udHMiLCJ3ZWJwYWNrOi8vUXVhZ2dhLy4vc3JjL2lucHV0L2xpdmUtc3RyZWFtLnRzIiwid2VicGFjazovL1F1YWdnYS8uL3NyYy9pbnB1dC92aWRlby1zdHJlYW0udHMiLCJ3ZWJwYWNrOi8vUXVhZ2dhLy4vc3JjL2xvY2F0b3IvYmFyY29kZS1sb2NhdG9yLXV0aWxzLnRzIiwid2VicGFjazovL1F1YWdnYS8uL3NyYy9sb2NhdG9yL2JhcmNvZGUtbG9jYXRvci50cyIsIndlYnBhY2s6Ly9RdWFnZ2EvLi9zcmMvbG9jYXRvci9yYXN0ZXJpemVyLnRzIiwid2VicGFjazovL1F1YWdnYS8uL3NyYy9sb2NhdG9yL3NrZWxldG9